1 2002-01-25 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
4 pointer types to be incretemented.
8 * cs-parser.jay (pointer_member_access): Implement
9 expr->IDENTIFIER production.
11 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
12 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
15 (Unary): Implement indirection.
17 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
18 use in non-unsafe context).
20 (SimpleName.DoResolve): Check for pointers in field access on safe
23 (Expression.LoadFromPtr): Factor the load-indirect code in this
24 function. This was duplicated in UnboxCast and ParameterReference
26 2002-01-24 Miguel de Icaza <miguel@ximian.com>
28 * expression.cs (ComposedCast): report an error if a pointer cast
29 is used in a safe region.
31 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
32 pointer type casts in unsafe context.
34 * codegen.cs (EmitContext): Set up IsUnsafe.
36 * cs-parser.jay (non_expression_type): Add productions for pointer
39 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
40 code. We should not use force into static mode if the method is
41 not virtual. Fixes bug in MIS
43 * statement.cs (Do.Emit, While.Emit, For.Emit,
44 Statement.EmitBoolExpression): Add support to Do and While to
45 propagate infinite loop as `I do return' semantics.
47 Improve the For case to also test for boolean constants.
49 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
50 to the list of attributes we can add.
52 Remove `EmitContext' argument.
54 * class.cs (Method.Define): Apply parameter attributes.
55 (Constructor.Define): Apply parameter attributes.
56 (MethodCore.LabelParameters): Move here the core of labeling
59 * support.cs (ReflectionParameters.ParameterModifier,
60 InternalParameters.ParameterModifier): Use IsByRef on the type and
61 only return the OUT bit for these parameters instead of in/out/ref
64 This is because I miss-understood things. The ParameterInfo.IsIn
65 and IsOut represent whether the parameter has the [In] and [Out]
68 2002-01-22 Miguel de Icaza <miguel@ximian.com>
70 * ecore.cs (FieldExpr.Emit): Release temporaries.
72 * assign.cs (LocalTemporary.Release): new function.
74 * codegen.cs (EmitContext.GetTemporaryStorage,
75 EmitContext.FreeTemporaryStorage): Rework the way we deal with
76 temporary storage. Now we can "put back" localbuilders when we
79 2002-01-21 Miguel de Icaza <miguel@ximian.com>
81 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
82 need to make a copy of the variable to generate verifiable code.
84 2002-01-19 Miguel de Icaza <miguel@ximian.com>
86 * driver.cs: Compute dynamically the system directory.
88 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
89 Slower, but more generally useful. Used by the abstract
90 registering implementation.
92 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
93 the rules for the special rule on Type/instances. First check if
94 we have the same name, and if so, try that special static path
95 rather than the instance path.
97 2002-01-18 Miguel de Icaza <miguel@ximian.com>
99 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
102 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
103 Enum, ValueType, Delegate or Array for non-corlib compiles.
105 * cs-tokenizer.cs: Catch long identifiers (645)
107 * typemanager.cs (IndexerPropetyName): Ravi never tested this
110 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
111 fix, we were returning too early, so we were not registering
112 pending methods from abstract classes.
114 Do not register pending methods if the class is abstract.
116 * expression.cs (Conditional.DoResolve): Report circular implicit
117 conversions when we neecd to compute it for conditional
120 (Is.DoResolve): If the expression is always of the provided type,
121 flag warning 183. If the expression can not ever be of the
122 provided type flag warning 184.
124 * class.cs: Catch 169 as well.
126 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
129 2002-01-18 Nick Drochak <ndrochak@gol.com>
131 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
133 2002-01-17 Miguel de Icaza <miguel@ximian.com>
135 * interface.cs: (PopulateMethod): Check for pointers being defined
136 only if the unsafe context is active.
137 (PopulateProperty): ditto.
138 (PopulateIndexer): ditto.
140 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
141 specified. If pointers are present, make sure that they are
142 present in an unsafe context.
143 (Constructor, Constructor.Define): ditto.
144 (Field, Field.Define): ditto.
145 (Property, Property.Define): ditto.
146 (Event, Event.Define): ditto.
148 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
149 hashtable if there are classes or structs defined.
151 * expression.cs (LocalVariableReference.DoResolve): Simplify this
152 code, as the constant resolution moved.
154 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
155 the metadata, so we can flag error 133.
157 * decl.cs (MemberCore.UnsafeOK): New function to test that a
158 pointer is being declared in an unsafe context.
160 2002-01-16 Miguel de Icaza <miguel@ximian.com>
162 * modifiers.cs (Modifiers.Check): Require a Location argument.
163 Report error 227 for Unsafe use.
165 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
167 * statement.cs (For.Emit): If the test is null, then report that
168 we do `return', as we wont reach anything afterwards.
170 (Switch.SwitchGoverningType): Track the expression that matched
173 * driver.cs: Allow negative numbers as an error code to flag.
175 * cs-parser.jay: Handle 1551.
177 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
179 2002-01-15 Miguel de Icaza <miguel@ximian.com>
181 * cs-parser.jay: Report 1518 (type declaration can only contain
182 class, struct, interface, enum or delegate)
184 (switch_label): Report 1523 (keywords `case' or `default' must
187 (opt_switch_sections): Report 1522 (empty switch)
189 * driver.cs: Report 1515 (response file specified multiple times)
190 Report 1516 (Source file specified multiple times).
192 * expression.cs (Argument.Resolve): Signal 1510
194 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
195 access not allowed in static code)
197 2002-01-11 Ravi Pratap <ravi@ximian.com>
199 * typemanager.cs (IsPointerType): Utility method which we are going
202 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
203 the object type, so we take care of that.
205 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
207 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
208 added to non-params parameters :-)
210 * typemanager.cs (CSharpName): Include 'void' type too.
212 (void_ptr_type): Include in the set of core types.
214 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
217 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
220 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
221 completely forgotten about it.
223 2002-01-10 Ravi Pratap <ravi@ximian.com>
225 * cs-parser.jay (pointer_type): Add. This begins our implementation
226 of parsing rules for unsafe code.
228 (unsafe_statement): Implement.
230 (embedded_statement): Modify to include the above.
232 * statement.cs (Unsafe): Implement new class for unsafe blocks.
234 * codegen.cs (EmitContext.InUnsafe): Add. This determines
235 if the current context is an unsafe one.
237 * cs-parser.jay (local_variable_pointer_type): Since local variable types
238 are handled differently, we need separate rules for them.
240 (local_variable_declaration): Update to use local_variable_pointer_type
241 to allow variable declarations of unmanaged pointer types.
243 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
246 * ../errors/cs0214.cs : Add.
248 2002-01-16 Nick Drochak <ndrochak@gol.com>
250 * makefile: remove 'response' file when cleaning.
252 2002-01-15 Miguel de Icaza <miguel@ximian.com>
254 * cs-parser.jay: Report 1524.
256 2002-01-14 Miguel de Icaza <miguel@ximian.com>
258 * typemanager.cs (RegisterMethod): drop checking if we have
259 registered this from here
261 2002-01-12 Miguel de Icaza <miguel@ximian.com>
263 * class.cs (Method.EmitDestructor): Implement calling our base
266 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
269 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
270 this routine and will wrap the call in a try/catch block. Deal
273 2002-01-11 Miguel de Icaza <miguel@ximian.com>
275 * ecore.cs (Expression.MemberLookup): instead of taking a
276 parameter `same_type' that was used to tell whether we could
277 access private members we compute our containing type from the
280 (FieldExpr): Added partial support for volatile fields. This does
281 not work for volatile fields exposed from assemblies, as I can not
282 figure out how to extract the modreq from it.
284 Updated all the source files to use this.
286 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
287 because it is referenced by MemberLookup very often.
289 2002-01-09 Ravi Pratap <ravi@ximian.com>
291 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
292 TypeBuilder.GetCustomAttributes to retrieve what we need.
294 Get rid of redundant default_member_attr_type as this is the same as
295 default_member_type which already exists.
297 * interface.cs, attribute.cs : Update accordingly.
299 2002-01-08 Miguel de Icaza <miguel@ximian.com>
301 * typemanager.cs: Enable IndexerPropertyName again. It does not
302 work for TYpeBuilders though. Ravi, can you please fix this?
304 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
306 * expression.cs (Argument.Emit): Handle the case of ref objects
307 being passed to ref functions;
309 (ParameterReference.EmitLoad): Loads the content of the pointer
310 without dereferencing.
312 2002-01-07 Miguel de Icaza <miguel@ximian.com>
314 * cs-tokenizer.cs: Implemented the pre-processing expressions.
316 2002-01-08 Ravi Pratap <ravi@ximian.com>
318 * class.cs (Indexer.DefineMethod): Incorporate the interface
319 type in the name of the method if we are doing explicit interface
322 * expression.cs (ConversionExists): Remove as it is completely obsolete.
324 (BetterConversion): Fix extremely trivial bug where we were referring to
325 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
328 * ../errors/bug16.cs : Add although we have fixed it.
330 2002-01-07 Miguel de Icaza <miguel@ximian.com>
332 * expression.cs (BaseIndexer): Begin implementation.
334 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
336 * cs-parser.jay (indexer_declarator): Use qualified_identifier
337 production directly to remove a shift/reduce, and implement
338 explicit interface implementation.
340 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
341 after a floating point suffix.
343 * expression.cs (DoNumericPromotions): Improved the conversion for
344 uint/uint. If we have a constant, we avoid doing a typecast to a
347 * class.cs (Indexer): Implement explicit interface implementation
350 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
352 * class.cs: make the default instance constructor public and hidebysig.
354 2001-01-03 Ravi Pratap <ravi@ximian.com>
356 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
357 so we can call it from elsewhere.
359 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
360 we emit it internally if the class has a defined indexer; otherwise the user
361 emits it by decorating the class definition with the DefaultMemberAttribute.
363 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
364 attribute is not used on a type which defines an indexer.
366 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
367 character when we skip whitespace.
369 * ../errors/cs0646.cs : Add.
371 2002-01-03 Miguel de Icaza <miguel@ximian.com>
373 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
376 * makefile: Add practical target `mcs3.exe' which builds the third
379 * expression.cs (New): Fix structures constructor calling.
381 * class.cs (Property, Method, Indexer): Emit Final flag on the
382 method if we are an interface implementation and we are not
385 * ecore.cs (PropertyExpr): New public field `IsBase', tells
386 whether this property is referencing a `base' method.
388 * expression.cs (Invocation.EmitCall): take an extra argument:
389 is_base, this is used to determine whether the `call' or
390 `callvirt' opcode should be used.
393 * delegate.cs: update EmitCall.
395 * class.cs (Method.Define): Set NewSlot for the cases where we are
396 not implementing an interface method.
398 (Property.Define): ditto.
400 2002-01-02 Miguel de Icaza <miguel@ximian.com>
402 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
403 'r'. Allows mcs to parse itself fully.
405 2002-01-02 Ravi Pratap <ravi@ximian.com>
407 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
408 of the number of initializers that require the InitializeArray method.
410 (CheckIndices): Store the Expression in all cases - not the plain value. Also
411 update the above field where necessary.
413 (MakeByteBlob): Update accordingly.
415 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
418 (EmitDynamicInitializers): Update in accordance with the new optimization.
420 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
423 * cs-parser.jay : Fix some glaring errors I introduced.
425 2002-01-01 Ravi Pratap <ravi@ximian.com>
427 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
428 so that we can check for name clashes there too.
430 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
431 for interface indexers.
433 * interfaces.cs (Define): Emit the default member attribute.
435 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
436 variable was being referred to while setting the value ;-)
438 2002-01-01 Miguel de Icaza <miguel@ximian.com>
440 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
441 byte-by-byte information when we know the data is zero.
443 Make the block always a multiple of 4, because
444 DefineInitializedData has a bug.
446 * assign.cs: Fix, we should assign from the temporary, not from
449 * expression.cs (MakeByteBlob): Fix my incorrect code.
451 2001-12-31 Miguel de Icaza <miguel@ximian.com>
453 * typemanager.cs (EnumToUnderlying): This function is used to get
454 the underlying type from an enumeration, because it does not
457 * constant.cs: Use the I4_S form for values between -128 and 127.
459 * statement.cs (Block.LookupLabel): Looks up a label.
460 (Block): Drop support for labeled blocks.
462 (LabeledStatement): New kind of statement that represents a label
465 (Goto): Finally implement this bad boy.
467 * cs-parser.jay: Update to reflect new mechanism to implement
470 2001-12-30 Miguel de Icaza <miguel@ximian.com>
472 * codegen.cs (EmitContext.This): a codegen property that keeps the
473 a single instance of this instead of creating many different this
476 * delegate.cs (Delegate.DoResolve): Update to use the property;
478 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
480 * expression.cs (BaseAccess.DoResolve): Ditto.
482 2001-12-29 Ravi Pratap <ravi@ximian.com>
484 * typemanager.cs (methodimpl_attr_type): Add to hold the type
485 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
487 (InitCoreTypes): Update accordingly.
489 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
490 so we can quickly store the state.
492 (ApplyAttributes): Set the correct implementation flags
493 for InternalCall methods.
495 2001-12-29 Miguel de Icaza <miguel@ximian.com>
497 * expression.cs (EmitCall): if a method is not virtual, then do
498 not use callvirt on it.
500 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
501 user defined stuff) requires the use of stobj, which takes an
502 address on the stack instead of an array and an index. So emit
503 the Ldelema operation for it.
505 (EmitStoreOpcode): Use stobj for valuetypes.
507 (UnaryMutator.EmitCode): Use the right 1 value depending on
508 whether we are dealing with int64/uint64, float or doubles.
510 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
511 constructors that I implemented last night.
513 (Constructor.IsDefault): Fix to work properly for static
516 * cs-parser.jay (CheckDef): report method signature errors.
517 Update error number 103 to be 132.
519 * decl.cs: New AdditionResult enumeration value: MethodExists.
520 Although we do this check for methods later on in the semantic
521 analysis, catching repeated default constructors is so easy that
524 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
527 (ParameterReference.EmitAssign, Emit): handle
530 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
531 (ArrayAccess.EmitStoreOpcode): ditto.
533 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
535 * expression.cs (MakeByteBlob): Complete all the missing types
536 (uint, short, ushort, byte, sbyte)
538 * class.cs: Only init instance field initializers on instance
541 Rename `constructors' to instance_constructors.
543 (TypeContainer.AddConstructor): Only add constructors to the list
546 Make sure that we handle default_static_constructor independently
547 everywhere where we handle instance_constructors
549 2001-12-28 Miguel de Icaza <miguel@ximian.com>
551 * class.cs: Do not lookup or create a base initializer for a
554 (ConstructorInitializer.Resolve): use the proper type to lookup
557 * cs-parser.jay: Report error 1585 (modifiers between type and name).
559 * enum.cs, interface.cs: Remove CloseType, this is taken care by
562 * decl.cs: CloseType is now an virtual method, the default
563 implementation just closes this type.
565 2001-12-28 Ravi Pratap <ravi@ximian.com>
567 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
568 to PreserveSig by default. Also emit HideBySig on such methods.
570 Basically, set the defaults to standard values.
572 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
573 argument, if candidate is better, it can't be worse than the best !
575 (Invocation): Re-write bits to differentiate between methods being
576 applicable in their expanded form and their normal form - for params
579 Get rid of use_standard everywhere as only standard conversions are allowed
580 in overload resolution.
582 More spec conformance.
584 2001-12-27 Miguel de Icaza <miguel@ximian.com>
586 * driver.cs: Add --timestamp, to see where the compiler spends
589 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
590 `this' in static code.
592 (SimpleName.DoResolve): Implement in terms of a helper function
593 that allows static-references to be passed upstream to
596 (Expression.ResolveWithSimpleName): Resolve specially simple
597 names when called by MemberAccess to implement the special
600 (Expression.ImplicitReferenceConversion): Handle conversions from
601 Null to reference types before others, as Null's type is
604 * expression.cs (Invocation.EmitCall): Handle the special case of
605 calling methods declared on a reference type from a ValueType
606 (Base classes System.Object and System.Enum)
608 (MemberAccess.Resolve): Only perform lookups on Enumerations if
609 the left hand side is a TypeExpr, not on every enumeration.
611 (Binary.Resolve): If types are reference types, then do a cast to
612 object on operators != and == of both arguments.
614 * typemanager.cs (FindMembers): Extract instance and static
615 members if requested.
617 * interface.cs (PopulateProperty): Use void_type instead of null
618 as the return type for the setter method.
620 (PopulateIndexer): ditto.
622 2001-12-27 Ravi Pratap <ravi@ximian.com>
624 * support.cs (ReflectionParameters): Fix minor bug where we
625 were examining the wrong parameter for the ParamArray attribute.
627 Cope with requests for the type of the parameter at position
628 greater than the params parameter's. We now return the element
629 type of the params array as that makes more sense.
631 * expression.cs (Invocation.IsParamsMethodApplicable): Update
632 accordingly as we no longer have to extract the element type
635 (Invocation.OverloadResolve): Update.
637 2001-12-27 Miguel de Icaza <miguel@ximian.com>
639 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
640 against IEnumerator, test whether the return value is a descendant
641 of the IEnumerator interface.
643 * class.cs (Indexer.Define): Use an auxiliary method to implement
644 the other bits of the method definition. Begin support for
645 explicit interface implementation.
647 (Property.DefineMethod): Use TypeManager.void_type instead of null
648 for an empty return value.
650 2001-12-26 Miguel de Icaza <miguel@ximian.com>
652 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
653 dealing with a FieldExpr which is composed of a FieldBuilder, in
654 the code path we did extract the constant, but we should have
655 obtained the underlying value to be able to cast it (otherwise we
656 end up in an infinite loop, this is what Ravi was running into).
658 (ArrayCreation.UpdateIndices): Arrays might be empty.
660 (MemberAccess.ResolveMemberAccess): Add support for section
661 14.5.4.1 that deals with the special case of E.I when E is a type
662 and something else, that I can be a reference to a static member.
664 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
665 handle a particular array type to create byte blobs, it is just
666 something we dont generate byteblobs for.
668 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
671 * location.cs (Push): remove the key from the hashtable that we
672 are about to add. This happens for empty files.
674 * driver.cs: Dispose files after we have parsed them.
676 (tokenize): new function that only runs the tokenizer on its
677 input, for speed testing.
679 2001-12-26 Ravi Pratap <ravi@ximian.com>
681 * class.cs (Event.Define): Define the private field only if there
682 are no accessors defined.
684 * expression.cs (ResolveMemberAccess): If there is no associated
685 field with the event, that means we have an event defined with its
686 own accessors and we should flag error cs0070 since transforming
687 ourselves into a field is not valid in that case.
689 * ecore.cs (SimpleName.DoResolve): Same as above.
691 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
692 and charset to sane values.
694 2001-12-25 Ravi Pratap <ravi@ximian.com>
696 * assign.cs (DoResolve): Perform check on events only if they
697 are being accessed outside the declaring type.
699 * cs-parser.jay (event_declarations): Update rules to correctly
700 set the type of the implicit parameter etc.
702 (add_accessor, remove_accessor): Set current local parameters.
704 * expression.cs (Binary): For delegate addition and subtraction,
705 cast the return value from the method into the appropriate delegate
708 2001-12-24 Ravi Pratap <ravi@ximian.com>
710 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
711 of these as the workaround is unnecessary.
713 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
714 delegate data - none of that is needed at all.
716 Re-write bits to extract the instance expression and the delegate method
719 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
722 * attribute.cs (ApplyAttributes): New method to take care of common tasks
723 of attaching attributes instead of duplicating code everywhere.
725 * everywhere : Update code to do attribute emission using the above method.
727 2001-12-23 Miguel de Icaza <miguel@ximian.com>
729 * expression.cs (IsParamsMethodApplicable): if there are not
730 parameters, return immediately.
732 * ecore.cs: The 0 literal can be implicity converted to an enum
735 (SimpleName.DoResolve): First lookup the type, then lookup the
738 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
739 want to get its address. If the InstanceExpression is not
740 addressable, store the result in a temporary variable, then get
743 * codegen.cs: Only display 219 errors on warning level or above.
745 * expression.cs (ArrayAccess): Make it implement the
746 IMemoryLocation interface.
748 (Binary.DoResolve): handle the operator == (object a, object b)
749 and operator != (object a, object b) without incurring into a
750 BoxedCast (because 5 != o should never be performed).
752 Handle binary enumerator operators.
754 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
755 value type, otherwise use Ldelem_ref.
757 Use precomputed names;
759 (AddressOf): Implement address of
761 * cs-parser.jay (labeled_statement): Fix recursive block
762 addition by reworking the production.
764 * expression.cs (New.DoEmit): New has a special case:
766 If we are dealing with a ValueType, we have a few
767 situations to deal with:
769 * The target of New is a ValueType variable, that is
770 easy, we just pass this as the variable reference
772 * The target of New is being passed as an argument,
773 to a boxing operation or a function that takes a
776 In this case, we need to create a temporary variable
777 that is the argument of New.
780 2001-12-23 Ravi Pratap <ravi@ximian.com>
782 * rootcontext.cs (LookupType): Check that current_type is not null before
783 going about looking at nested types.
785 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
786 not implement the IAssignMethod interface any more.
788 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
789 where we tranform them into FieldExprs if they are being resolved from within
792 * ecore.cs (SimpleName.DoResolve): Do the same here.
794 * assign.cs (DoResolve, Emit): Clean up code considerably.
796 * ../errors/bug10.cs : Add.
798 * ../errors/cs0070.cs : Add.
800 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
802 * assign.cs : Get rid of EventIsLocal everywhere.
804 2001-12-23 Miguel de Icaza <miguel@ximian.com>
806 * ecore.cs (ConvertIntLiteral): finished the implementation.
808 * statement.cs (SwitchLabel): Convert the value we are using as a
809 key before looking up the table.
811 2001-12-22 Miguel de Icaza <miguel@ximian.com>
813 * codegen.cs (EmitTopBlock): Require a Location argument now.
815 * cs-parser.jay (constructor_declarator): We need to setup
816 current_local_parameters before we parse the
817 opt_constructor_initializer, to allow the variables to be bound
818 to the constructor arguments.
820 * rootcontext.cs (LookupType): First lookup nested classes in our
821 class and our parents before we go looking outside our class.
823 * expression.cs (ConstantFold): Extract/debox the values at the
826 * rootcontext.cs (EmitCode): Resolve the constants first before we
827 resolve the types. This is not really needed, but it helps debugging.
829 * statement.cs: report location.
831 * cs-parser.jay: pass location to throw statement.
833 * driver.cs: Small bug fix.
835 * report.cs: Updated format to be 4-zero filled digits.
837 2001-12-22 Ravi Pratap <ravi@ximian.com>
839 * expression.cs (CheckIndices): Fix minor bug where the wrong
840 variable was being referred to ;-)
842 (DoEmit): Do not call EmitStaticInitializers when the
843 underlying type is System.Object.
845 2001-12-21 Ravi Pratap <ravi@ximian.com>
847 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
848 and do the usual workaround for SRE.
850 * class.cs (MyEventBuilder.EventType): New member to get at the type
851 of the event, quickly.
853 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
855 * assign.cs (Assign.DoResolve): Handle the case when the target
856 is an EventExpr and perform the necessary checks.
858 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
861 (SimpleName.MemberStaticCheck): Include check for EventExpr.
863 (EventExpr): Set the type in the constructor itself since we
864 are meant to be born fully resolved.
866 (EventExpr.Define): Revert code I wrote earlier.
868 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
869 instance expression is null. The instance expression is a This in that case
870 or a null, depending on whether it is a static method or not.
872 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
873 refers to more than one method.
875 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
876 and accordingly flag errors.
878 2001-12-21 Miguel de Icaza <miguel@ximian.com>
880 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
882 2001-12-22 Miguel de Icaza <miguel@ximian.com>
884 * location.cs (ToString): Provide useful rutine.
886 2001-12-21 Miguel de Icaza <miguel@ximian.com>
888 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
889 objects, return the actual integral boxed.
891 * statement.cs (SwitchLabel): define an ILLabel for each
894 (Switch.CheckSwitch): If the value is a Literal, extract
895 the underlying literal.
897 Also in the unused hashtable we had, add the SwitchLabel so we can
898 quickly look this value up.
900 * constant.cs: Implement a bunch of new constants. Rewrite
901 Literal based on this. Made changes everywhere to adapt to this.
903 * expression.cs (Expression.MakeByteBlob): Optimize routine by
904 dereferencing array only once, and also copes with enumrations.
906 bytes are two bytes wide, not one.
908 (Cast): Perform constant conversions.
910 * ecore.cs (TryImplicitIntConversion): Return literals instead of
911 wrappers to the literals here.
913 * expression.cs (DoNumericPromotions): long literals can converted
914 to ulong implicity (this is taken care of elsewhere, but I was
917 * ecore.cs (Expression.Literalize): Make the return type Literal,
918 to improve type checking.
920 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
922 2001-12-20 Miguel de Icaza <miguel@ximian.com>
924 * literal.cs: Revert code from ravi that checked the bounds. The
925 bounds are sane by the definition of the type itself.
927 * typemanager.cs: Fix implementation of ImplementsInterface. We
928 need to actually look up in our parent hierarchy for interfaces
931 * const.cs: Use the underlying type for enumerations
933 * delegate.cs: Compute the basename for the delegate creation,
934 that should fix the delegate test case, and restore the correct
935 Type Lookup semantics in rootcontext
937 * rootcontext.cs: Revert Ravi's last patch. The correct way of
938 referencing a nested type with the Reflection API is using the "+"
941 * cs-parser.jay: Do not require EOF token at the end.
943 2001-12-20 Ravi Pratap <ravi@ximian.com>
945 * rootcontext.cs (LookupType): Concatenate type names with
946 a '.' instead of a '+' The test suite passes again.
948 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
949 field of the enumeration.
951 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
952 the case when the member is an EventExpr.
954 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
955 static has an associated instance expression.
957 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
959 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
961 * class.cs (Event.Define): Register event and perform appropriate checks
964 We define the Add and Remove methods even if the use provides none because
965 in that case, we provide default implementations ourselves.
967 Define a private field of the type of the event. This is done by the CSC compiler
968 and we should be doing it too ;-)
970 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
971 More methods we use in code we generate.
973 (multicast_delegate_type, delegate_type): Two separate types since the distinction
976 (InitCoreTypes): Update accordingly for the above.
978 * class.cs (Event.Emit): Generate code for default accessors that we provide
980 (EmitDefaultMethod): Do the job in the above.
982 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
985 2001-12-20 Miguel de Icaza <miguel@ximian.com>
987 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
988 builders even if we were missing one.
990 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
991 pass the Basename as our class name instead of the Name. The
992 basename will be correctly composed for us.
994 * parameter.cs (Paramters): Now takes a Location argument.
996 * decl.cs (DeclSpace.LookupType): Removed convenience function and
997 make all the code call directly LookupType in RootContext and take
998 this chance to pass the Location information everywhere.
1000 * Everywhere: pass Location information.
1002 2001-12-19 Miguel de Icaza <miguel@ximian.com>
1004 * class.cs (Constructor.Define): Updated way of detecting the
1005 length of the parameters.
1007 (TypeContainer.DefineType): Use basename as the type name for
1010 (TypeContainer.Define): Do not recursively define types here, as
1011 definition is taken care in order by the RootContext.
1013 * tree.cs: Keep track of namespaces in a per-file basis.
1015 * parameter.cs (Parameter.ComputeSignature): Update to use
1018 (Parameters.GetSignature): ditto.
1020 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
1021 instead of a TypeContainer.
1023 (Interface.SemanticAnalysis): Use `this' instead of our parent to
1024 resolve names. Because we need to be resolve in our context, not
1027 * driver.cs: Implement response files.
1029 * class.cs (TypeContainer.DefineType): If we are defined, do not
1032 (Event.Emit): Emit the code for add/remove handlers.
1033 (Event.Define): Save the MethodBuilders for add/remove.
1035 * typemanager.cs: Use pair here too.
1037 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
1038 DictionaryEntry requires the first argument to be non-null.
1040 (enum_declaration): Compute full name for registering the
1043 (delegate_declaration): Instead of using
1044 formal_parameter_list, use opt_formal_parameter_list as the list
1047 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
1048 (EventParsing): New property that controls whether `add' and
1049 `remove' are returned as tokens or identifiers (for events);
1051 2001-12-19 Ravi Pratap <ravi@ximian.com>
1053 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
1054 use MyEventBuilder only and let it wrap the real builder for us.
1056 (MyEventBuilder): Revamp constructor etc.
1058 Implement all operations that we perform on EventBuilder in precisely the same
1061 (FindMembers): Update to use the EventBuilder member.
1063 (Event.Emit): Update accordingly.
1065 2001-12-18 Ravi Pratap <ravi@ximian.com>
1067 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
1068 by calling the appropriate methods.
1070 (GetCustomAttributes): Make stubs as they cannot possibly do anything
1073 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
1075 2001-12-17 Ravi Pratap <ravi@ximian.com>
1077 * delegate.cs (Delegate.Populate): Check that the return type
1078 and various parameters types are indeed accessible.
1080 * class.cs (Constructor.Define): Same here.
1082 (Field.Define): Ditto.
1084 (Event.Define): Ditto.
1086 (Operator.Define): Check that the underlying Method defined itself
1087 correctly - so it's MethodBuilder should not be null.
1089 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
1090 expression happens to be null.
1092 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
1093 members but as of now we don't seem to be able to do anything really useful with it.
1095 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
1096 not the EventBuilder.
1098 2001-12-18 Miguel de Icaza <miguel@ximian.com>
1100 * cs-tokenizer.cs: Add support for defines.
1101 Add support for #if, #elif, #else, #endif
1103 (eval_var): evaluates a variable.
1104 (eval): stubbed for evaluating functions.
1106 * cs-parser.jay: Pass the defines information
1108 * driver.cs: Add --define command line option.
1110 * decl.cs: Move MemberCore here.
1112 Make it the base class for DeclSpace. This allows us to catch and
1113 report 108 and 109 for everything now.
1115 * class.cs (TypeContainer.Define): Extract all the members
1116 before populating and emit the warning 108 (new keyword required
1117 to override) instead of having each member implement this.
1119 (MemberCore.Define): New abstract method, we will be using this in
1120 the warning reporting engine in Populate.
1122 (Operator.Define): Adjust to new MemberCore protocol.
1124 * const.cs (Const): This does not derive from Expression, it is a
1125 temporary object we use to create fields, it is a MemberCore.
1127 * class.cs (Method.Define): Allow the entry point to be in a
1130 * driver.cs: Rewrite the argument handler to clean it up a bit.
1132 * rootcontext.cs: Made it just an auxiliary namespace feature by
1133 making everything static.
1135 * driver.cs: Adapt code to use RootContext type name instead of
1138 * delegate.cs: Remove RootContext argument.
1140 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
1143 * class.cs (Event.Define): The lookup can fail.
1145 * cs-tokenizer.cs: Begin implementation of pre-procesor.
1147 * expression.cs: Resolve the this instance before invoking the code.
1149 2001-12-17 Miguel de Icaza <miguel@ximian.com>
1151 * cs-parser.jay: Add a production in element_access that allows
1152 the thing to become a "type" reference. This way we can parse
1153 things like "(string [])" as a type.
1155 Note that this still does not handle the more complex rules of
1159 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
1161 * ecore.cs: (CopyNewMethods): new utility function used to
1162 assemble the list of methods from running FindMembers.
1164 (MemberLookup): Rework FindMembers so that
1166 2001-12-16 Miguel de Icaza <miguel@ximian.com>
1168 * class.cs (TypeContainer): Remove Delegates who fail to be
1171 * delegate.cs (Populate): Verify that we dont get null return
1172 values. TODO: Check for AsAccessible.
1174 * cs-parser.jay: Use basename to emit error 574 (destructor should
1175 have the same name as container class), not the full name.
1177 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
1178 possible representation.
1180 Also implements integer type suffixes U and L.
1182 2001-12-15 Miguel de Icaza <miguel@ximian.com>
1184 * expression.cs (ArrayCreation.DoResolve): We need to do the
1185 argument resolution *always*.
1187 * decl.cs: Make this hold the namespace. Hold the root context as
1189 (LookupType): Move here.
1191 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
1193 * location.cs (Row, Name): Fixed the code, it was always returning
1194 references to the first file.
1196 * interface.cs: Register properties defined through interfaces.
1198 * driver.cs: Add support for globbing on the command line
1200 * class.cs (Field): Make it derive from MemberCore as well.
1203 2001-12-15 Ravi Pratap <ravi@ximian.com>
1205 * class.cs (Event::Define): Check that the type of the event is a delegate
1206 type else flag error #66.
1208 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
1211 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
1212 values of EntryPoint, CharSet etc etc.
1214 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
1216 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
1217 be null and we should ignore this. I am not sure if this is really clean. Apparently,
1218 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
1219 which needs this to do its work.
1221 * ../errors/cs0066.cs : Add.
1223 2001-12-14 Miguel de Icaza <miguel@ximian.com>
1225 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
1228 * class.cs: (MethodSignature.MethodSignature): Removed hack that
1229 clears out the parameters field.
1230 (MemberSignatureCompare): Cleanup
1232 (MemberCore): New base class used to share code between MethodCore
1235 (RegisterRequiredImplementations) BindingFlags.Public requires
1236 either BindingFlags.Instace or Static. Use instance here.
1238 (Property): Refactored code to cope better with the full spec.
1240 * parameter.cs (GetParameterInfo): Return an empty array instead
1243 * class.cs (Property): Abstract or extern properties have no bodies.
1245 * parameter.cs (GetParameterInfo): return a zero-sized array.
1247 * class.cs (TypeContainer.MethodModifiersValid): Move all the
1248 method modifier validation to the typecontainer so we can reuse
1251 (MethodCore.ParameterTypes): return an empty sized array of types.
1253 (Property.Define): Test property modifier validity.
1255 Add tests for sealed/override too.
1257 (Method.Emit): abstract or extern methods have no bodies.
1259 2001-12-14 Ravi Pratap <ravi@ximian.com>
1261 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
1264 (Method::Define, ::Emit): Modify accordingly.
1266 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
1268 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
1270 * makefile: Pass in /unsafe.
1272 2001-12-13 Miguel de Icaza <miguel@ximian.com>
1274 * class.cs (MakeKey): Kill routine.
1276 * class.cs (TypeContainer.Define): Correctly define explicit
1277 method implementations (they require the full interface name plus
1280 * typemanager.cs: Deply the PtrHashtable here and stop using the
1281 lame keys. Things work so much better.
1283 This of course broke everyone who depended on `RegisterMethod' to
1284 do the `test for existance' test. This has to be done elsewhere.
1286 * support.cs (PtrHashtable): A hashtable that avoid comparing with
1287 the object stupid Equals method (because, that like fails all over
1288 the place). We still do not use it.
1290 * class.cs (TypeContainer.SetRequiredInterface,
1291 TypeContainer.RequireMethods): Killed these two routines and moved
1292 all the functionality to RegisterRequiredImplementations.
1294 (TypeContainer.RegisterRequiredImplementations): This routine now
1295 registers all the implementations required in an array for the
1296 interfaces and abstract methods. We use an array of structures
1297 which can be computed ahead of time to reduce memory usage and we
1298 also assume that lookups are cheap as most classes will not
1299 implement too many interfaces.
1301 We also avoid creating too many MethodSignatures.
1303 (TypeContainer.IsInterfaceMethod): Update and optionally does not
1304 clear the "pending" bit if we find that there are problems with
1307 (TypeContainer.VerifyPendingMethods): Update to report errors of
1308 methods that look like implementations but are not.
1310 (TypeContainer.Define): Add support for explicit interface method
1313 2001-12-12 Miguel de Icaza <miguel@ximian.com>
1315 * typemanager.cs: Keep track of the parameters here instead of
1316 being a feature of the TypeContainer.
1318 * class.cs: Drop the registration of parameters here, as
1319 InterfaceMethods are also interface declarations.
1321 * delegate.cs: Register methods with the TypeManager not only with
1322 the TypeContainer. This code was buggy.
1324 * interface.cs: Full registation here.
1326 2001-12-11 Miguel de Icaza <miguel@ximian.com>
1328 * expression.cs: Remove reducer for binary expressions, it can not
1331 * const.cs: Put here the code that used to go into constant.cs
1333 * constant.cs: Put here the code for constants, this is a new base
1336 * literal.cs: Make Literal derive from Constant.
1338 2001-12-09 Miguel de Icaza <miguel@ximian.com>
1340 * statement.cs (Return.Emit): Report error 157 if the user
1341 attempts to return from a finally block.
1343 (Return.Emit): Instead of emitting a return, jump to the end of
1346 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
1347 LocalBuilder to store the result of the function. ReturnLabel is
1348 the target where we jump.
1351 2001-12-09 Radek Doulik <rodo@ximian.com>
1353 * cs-parser.jay: remember alias in current namespace
1355 * ecore.cs (SimpleName::DoResolve): use aliases for types or
1358 * class.cs (LookupAlias): lookup alias in my_namespace
1360 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
1362 (LookupAlias): lookup alias in this and if needed in parent
1365 2001-12-08 Miguel de Icaza <miguel@ximian.com>
1369 * rootcontext.cs: (ModuleBuilder) Made static, first step into
1370 making things static. I need this to avoid passing the
1371 TypeContainer when calling ParameterType.
1373 * support.cs (InternalParameters.ParameterType): Remove ugly hack
1374 that did string manipulation to compute the type and then call
1375 GetType. Use Parameter.ParameterType instead.
1377 * cs-tokenizer.cs: Consume the suffix for floating values.
1379 * expression.cs (ParameterReference): figure out whether this is a
1380 reference parameter or not. Kill an extra variable by computing
1381 the arg_idx during emission.
1383 * parameter.cs (Parameters.GetParameterInfo): New overloaded
1384 function that returns whether a parameter is an out/ref value or not.
1386 (Parameter.ParameterType): The type of the parameter (base,
1387 without ref/out applied).
1389 (Parameter.Resolve): Perform resolution here.
1390 (Parameter.ExternalType): The full type (with ref/out applied).
1392 * statement.cs (Using.Emit, Using.EmitExpression): Implement
1393 support for expressions on the using statement.
1395 2001-12-07 Miguel de Icaza <miguel@ximian.com>
1397 * statement.cs (Using.EmitLocalVariableDecls): Split the
1398 localvariable handling of the using statement.
1400 (Block.EmitMeta): Keep track of variable count across blocks. We
1401 were reusing slots on separate branches of blocks.
1403 (Try.Emit): Emit the general code block, we were not emitting it.
1405 Check the type of the declaration to be an IDisposable or
1406 something that can be implicity converted to it.
1408 Emit conversions if required.
1410 * ecore.cs (EmptyExpression): New utility class.
1411 (Expression.ImplicitConversionExists): New utility function.
1413 2001-12-06 Miguel de Icaza <miguel@ximian.com>
1415 * statement.cs (Using): Implement.
1417 * expression.cs (LocalVariableReference): Support read only variables.
1419 * statement.cs: Remove the explicit emit for the Leave opcode.
1420 (VariableInfo): Add a readonly field.
1422 2001-12-05 Miguel de Icaza <miguel@ximian.com>
1424 * ecore.cs (ConvCast): new class used to encapsulate the various
1425 explicit integer conversions that works in both checked and
1428 (Expression.ConvertNumericExplicit): Use new ConvCast class to
1429 properly generate the overflow opcodes.
1431 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1433 * statement.cs: The correct type for the EmptyExpression is the
1434 element_type, not the variable type. Ravi pointed this out.
1436 2001-12-04 Ravi Pratap <ravi@ximian.com>
1438 * class.cs (Method::Define): Handle PInvoke methods specially
1439 by using DefinePInvokeMethod instead of the usual one.
1441 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
1442 above to do the task of extracting information and defining the method.
1444 2001-12-04 Ravi Pratap <ravi@ximian.com>
1446 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
1447 of the condition for string type.
1449 (Emit): Move that here.
1451 (ArrayCreation::CheckIndices): Keep string literals in their expression
1454 (EmitDynamicInitializers): Handle strings appropriately.
1456 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1458 * codegen.cs (EmitContext): Replace multiple variables with a
1459 single pointer to the current Switch statement.
1461 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
1464 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1468 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
1471 (Foreach.Emit): Foreach on arrays was not setting
1472 up the loop variables (for break/continue).
1474 (GotoCase): Semi-implented.
1476 2001-12-03 Ravi Pratap <ravi@ximian.com>
1478 * attribute.cs (CheckAttribute): Handle system attributes by using
1479 Attribute.GetAttributes to examine information we need.
1481 (GetValidPlaces): Same here.
1483 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
1485 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
1487 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
1489 (Method::Define): Set appropriate flags if we have a DllImport attribute.
1491 (Method::Emit): Handle the case when we are a PInvoke method.
1493 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1495 * expression.cs: Use ResolveWithSimpleName on compound names.
1497 2001-12-02 Ravi Pratap <ravi@ximian.com>
1499 * constant.cs (EmitConstant): Make sure we resolve the associated expression
1500 before trying to reduce it.
1502 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
1504 * constant.cs (LookupConstantValue): Implement.
1506 (EmitConstant): Use the above in emitting the constant.
1508 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
1509 that are user-defined by doing a LookupConstantValue on them.
1511 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
1514 2001-11-29 Miguel de Icaza <miguel@ximian.com>
1516 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
1518 (BaseAccess.DoResolve): Implement.
1520 (MemberAccess.DoResolve): Split this routine into a
1521 ResolveMemberAccess routine that can be used independently
1523 2001-11-28 Miguel de Icaza <miguel@ximian.com>
1525 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
1526 As that share bits of the implementation. Is returns a boolean,
1527 while As returns the Type that is being probed.
1529 2001-12-01 Ravi Pratap <ravi@ximian.com>
1531 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
1532 instead of a Literal - much easier.
1534 (EnumInTransit): Remove - utterly useless :-)
1536 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
1538 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
1540 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
1541 chain when we have no associated expression.
1543 2001-11-30 Ravi Pratap <ravi@ximian.com>
1545 * constant.cs (Define): Use Location while reporting the errror.
1547 Also emit a warning when 'new' is used and there is no inherited
1550 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
1553 (LookupEnumValue): Implement to lookup an enum member's value and define it
1556 (Populate): Re-write accordingly to use the above routine.
1558 2001-11-27 Miguel de Icaza <miguel@ximian.com>
1560 * expression.cs (This): Fix prototype for DoResolveLValue to
1561 override the base class DoResolveLValue.
1563 * cs-parser.cs: Report errors cs574 and cs575 (destructor
1566 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
1567 (we need to load the address of the field here). This fixes
1570 (FieldExpr.DoResolveLValue): Call the DoResolve
1571 function to initialize the Instance expression.
1573 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
1574 correctly the GetEnumerator operation on a value type.
1576 * cs-parser.jay: Add more simple parsing error catches.
1578 * statement.cs (Switch): Add support for string switches.
1579 Handle null specially.
1581 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
1583 2001-11-28 Ravi Pratap <ravi@ximian.com>
1585 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
1587 (declare_local_constant): New helper function.
1589 * statement.cs (AddConstant): Keep a separate record of constants
1591 (IsConstant): Implement to determine if a variable is a constant.
1593 (GetConstantExpression): Implement.
1595 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
1597 * statement.cs (IsVariableDefined): Re-write.
1599 2001-11-27 Ravi Pratap <ravi@ximian.com>
1601 * class.cs (TypeContainer::FindMembers): Look for constants
1602 in the case when we are looking for MemberTypes.Field
1604 * expression.cs (MemberAccess::DoResolve): Check that in the
1605 case we are a FieldExpr and a Literal, we are not being accessed
1606 by an instance reference.
1608 * cs-parser.jay (local_constant_declaration): Implement.
1610 (declaration_statement): Implement for constant declarations.
1612 2001-11-26 Miguel de Icaza <miguel@ximian.com>
1614 * statement.cs (Switch): Catch double defaults.
1616 (Switch): More work on the switch() statement
1617 implementation. It works for integral values now, need to finish
1621 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1623 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
1624 integer literals into other integer literals. To be used by
1627 2001-11-24 Ravi Pratap <ravi@ximian.com>
1629 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
1632 (EmitDynamicInitializers): Cope with the above since we extract data
1633 directly from ArrayData now.
1635 (ExpectInitializers): Keep track of whether initializers are mandatory
1638 (Bounds): Make it a hashtable to prevent the same dimension being
1639 recorded for every element in that dimension.
1641 (EmitDynamicInitializers): Fix bug which prevented the Set array method
1644 Also fix bug which was causing the indices to be emitted in the reverse
1647 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1649 * expression.cs (ArrayCreation): Implement the bits that Ravi left
1650 unfinished. They do not work, because the underlying code is
1653 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1655 * cs-parser.jay: Remove bogus fixme.
1657 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
1658 on Switch statement.
1660 2001-11-23 Ravi Pratap <ravi@ximian.com>
1662 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
1665 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
1666 parameter. Apparently, any expression is allowed.
1668 (ValidateInitializers): Update accordingly.
1670 (CheckIndices): Fix some tricky bugs thanks to recursion.
1672 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
1673 I was being completely brain-dead.
1675 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
1676 and re-write acordingly.
1678 (DelegateInvocation): Re-write accordingly.
1680 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
1682 (MakeByteBlob): Handle types more correctly.
1684 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
1685 initialization from expressions but it is incomplete because I am a complete
1688 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1690 * statement.cs (If.Emit): Fix a bug that generated incorrect code
1691 on If. Basically, we have to return `true' (ie, we do return to
1692 our caller) only if both branches of the if return.
1694 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
1695 short-circuit operators, handle them as short circuit operators.
1697 (Cast.DoResolve): Resolve type.
1698 (Cast.Cast): Take an expression as the target type.
1700 * cs-parser.jay (cast_expression): Remove old hack that only
1701 allowed a limited set of types to be handled. Now we take a
1702 unary_expression and we resolve to a type during semantic
1705 Use the grammar productions from Rhys to handle casts (this is
1706 not complete like Rhys syntax yet, we fail to handle that corner
1707 case that C# has regarding (-x), but we will get there.
1709 2001-11-22 Ravi Pratap <ravi@ximian.com>
1711 * class.cs (EmitFieldInitializer): Take care of the case when we have a
1712 field which is an array type.
1714 * cs-parser.jay (declare_local_variables): Support array initialization too.
1716 * typemanager.cs (MakeKey): Implement.
1718 (everywhere): Use the above appropriately.
1720 * cs-parser.jay (for_statement): Update for array initialization while
1721 declaring variables.
1723 * ecore.cs : The error message was correct, it's the variable's names that
1724 were misleading ;-) Make the code more readable.
1726 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
1727 the correct type etc.
1729 (ConvertExplicit): Handle Enum types by examining the underlying type.
1731 2001-11-21 Ravi Pratap <ravi@ximian.com>
1733 * parameter.cs (GetCallingConvention): Always return
1734 CallingConventions.Standard for now.
1736 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1738 * expression.cs (Binary.ResolveOperator): Update the values of `l'
1739 and `r' after calling DoNumericPromotions.
1741 * ecore.cs: Fix error message (the types were in the wrong order).
1743 * statement.cs (Foreach.ProbeCollectionType): Need to pass
1744 BindingFlags.Instance as well
1746 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
1747 implicit int literal conversion in an empty cast so that we
1748 propagate the right type upstream.
1750 (UnboxCast): new class used to unbox value types.
1751 (Expression.ConvertExplicit): Add explicit type conversions done
1754 (Expression.ImplicitNumericConversion): Oops, forgot to test for
1755 the target type before applying the implicit LongLiterals to ULong
1758 2001-11-21 Miguel de Icaza <miguel@ximian.com>
1760 * cs-parser.jay (for_statement): Reworked the way For works: now
1761 we declare manually any variables that are introduced in
1762 for_initializer to solve the problem of having out-of-band code
1763 emition (that is what got for broken).
1765 (declaration_statement): Perform the actual variable declaration
1766 that used to be done in local_variable_declaration here.
1768 (local_variable_declaration): Do not declare anything, just pass
1769 the information on a DictionaryEntry
1771 2001-11-20 Ravi Pratap <ravi@ximian.com>
1773 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
1774 re-write of the logic to now make it recursive.
1776 (UpdateIndices): Re-write accordingly.
1778 Store element data in a separate ArrayData list in the above methods.
1780 (MakeByteBlob): Implement to dump the array data into a byte array.
1782 2001-11-19 Ravi Pratap <ravi@ximian.com>
1784 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
1787 * constant.cs (Define): Implement.
1789 (EmitConstant): Re-write fully.
1791 Pass in location info.
1793 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
1796 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
1797 DictionaryEntry since we need location info too.
1799 (constant_declaration): Update accordingly.
1801 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
1802 code into another method : UpdateIndices.
1804 2001-11-18 Ravi Pratap <ravi@ximian.com>
1806 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
1807 some type checking etc.
1809 2001-11-17 Ravi Pratap <ravi@ximian.com>
1811 * expression.cs (ArrayCreation::ValidateInitializers): Implement
1812 bits to provide dimension info if the user skips doing that.
1814 Update second constructor to store the rank correctly.
1816 2001-11-16 Ravi Pratap <ravi@ximian.com>
1818 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
1819 and try to implement.
1821 * ../errors/cs0150.cs : Add.
1823 * ../errors/cs0178.cs : Add.
1825 2001-11-16 Miguel de Icaza <miguel@ximian.com>
1827 * statement.cs: Implement foreach on multi-dimensional arrays.
1829 * parameter.cs (Parameters.GetParameterByName): Also lookup the
1830 name of the params argument.
1832 * expression.cs: Use EmitStoreOpcode to get the right opcode while
1833 initializing the array.
1835 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
1836 we can use this elsewhere.
1838 * statement.cs: Finish implementation of foreach for single
1841 * cs-parser.jay: Use an out-of-band stack to pass information
1842 around, I wonder why I need this.
1844 foreach_block: Make the new foreach_block the current_block.
1846 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
1847 function used to return a static Parameters structure. Used for
1848 empty parameters, as those are created very frequently.
1850 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
1852 2001-11-15 Ravi Pratap <ravi@ximian.com>
1854 * interface.cs : Default modifier is private, not public. The
1855 make verify test passes again.
1857 2001-11-15 Ravi Pratap <ravi@ximian.com>
1859 * support.cs (ReflectionParameters): Fix logic to determine
1860 whether the last parameter is a params one. Test 9 passes again.
1862 * delegate.cs (Populate): Register the builders we define with
1863 RegisterParameterForBuilder. Test 19 passes again.
1865 * cs-parser.jay (property_declaration): Reference $6 instead
1866 of $$ to get at the location.
1868 (indexer_declaration): Similar stuff.
1872 * class.cs (Property): Register parameters for the Get and Set methods
1873 if they exist. Test 23 passes again.
1875 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
1876 call to EmitArguments as we are sure there aren't any params arguments.
1877 Test 32 passes again.
1879 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
1880 IndexOutOfRangeException.
1882 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
1883 Test 33 now passes again.
1885 2001-11-15 Miguel de Icaza <miguel@ximian.com>
1887 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
1888 broke a bunch of things. Will have to come up with a better way
1889 of tracking locations.
1891 * statement.cs: Implemented foreach for single dimension arrays.
1893 2001-11-09 Miguel de Icaza <miguel@ximian.com>
1895 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
1896 an error. This removes the lookup from the critical path.
1898 * cs-parser.jay: Removed use of temporary_loc, which is completely
1901 2001-11-14 Miguel de Icaza <miguel@ximian.com>
1903 * support.cs (ReflectionParameters.ParameterModifier): Report
1904 whether the argument is a PARAMS argument or not.
1906 * class.cs: Set the attribute `ParamArrayAttribute' on the
1909 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
1910 and cons_param_array_attribute (ConstructorInfo for
1911 ParamArrayAttribute).,
1913 * codegen.cs: Emit the return using the `Return' statement, that
1914 way we can report the error correctly for missing return values.
1916 * class.cs (Method.Emit): Clean up.
1918 * expression.cs (Argument.Resolve): Take another argument: the
1919 location where this argument is used. Notice that this is not
1920 part of the "Argument" class as to reduce the size of the
1921 structure (we know the approximate location anyways).
1923 Test if the argument is a variable-reference, if not, then
1924 complain with a 206.
1926 (Argument.Emit): Emit addresses of variables.
1928 (Argument.FullDesc): Simplify.
1930 (Invocation.DoResolve): Update for Argument.Resolve.
1932 (ElementAccess.DoResolve): ditto.
1934 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
1935 method should be virtual, as this method is always virtual.
1937 (NewDelegate.DoResolve): Update for Argument.Resolve.
1939 * class.cs (ConstructorInitializer.DoResolve): ditto.
1941 * attribute.cs (Attribute.Resolve): ditto.
1943 2001-11-13 Miguel de Icaza <miguel@ximian.com>
1945 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
1947 * expression.cs (ParameterReference): Drop IStackStorage and implement
1948 IAssignMethod instead.
1950 (LocalVariableReference): ditto.
1952 * ecore.cs (FieldExpr): Drop IStackStorage and implement
1953 IAssignMethod instead.
1955 2001-11-13 Miguel de Icaza <miguel@ximian.com>
1957 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
1958 enumerations that are used in heavily used structures derive from
1959 byte in a laughable and pathetic attempt to reduce memory usage.
1960 This is the kind of pre-optimzations that you should not do at
1961 home without adult supervision.
1963 * expression.cs (UnaryMutator): New class, used to handle ++ and
1964 -- separatedly from the other unary operators. Cleans up the
1965 code, and kills the ExpressionStatement dependency in Unary.
1967 (Unary): Removed `method' and `Arguments' from this class, making
1968 it smaller, and moving it all to SimpleCall, so I can reuse this
1969 code in other locations and avoid creating a lot of transient data
1970 strucutres when not required.
1972 * cs-parser.jay: Adjust for new changes.
1974 2001-11-11 Miguel de Icaza <miguel@ximian.com>
1976 * enum.cs (Enum.Populate): If there is a failure during
1979 * cs-parser.jay (opt_enum_base): we used to catch type errors
1980 here, but this is really incorrect. The type error should be
1981 catched during semantic analysis.
1983 2001-12-11 Ravi Pratap <ravi@ximian.com>
1985 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
1986 current_local_parameters as expected since I, in my stupidity, had forgotten
1989 * attribute.cs (GetValidPlaces): Fix stupid bug.
1991 * class.cs (Method::Emit): Perform check on applicability of attributes.
1993 (Constructor::Emit): Ditto.
1995 (Field::Emit): Ditto.
1997 (Field.Location): Store location information.
1999 (Property, Event, Indexer, Operator): Ditto.
2001 * cs-parser.jay (field_declaration): Pass in location for each field.
2003 * ../errors/cs0592.cs : Add.
2005 2001-11-12 Ravi Pratap <ravi@ximian.com>
2007 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
2009 (InitCoreTypes): Update accordingly.
2011 (RegisterAttrType, LookupAttr): Implement.
2013 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
2014 info about the same.
2016 (Resolve): Update to populate the above as necessary.
2020 (GetValidPlaces): Helper to the above.
2022 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
2024 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
2026 2001-11-12 Ravi Pratap <ravi@ximian.com>
2028 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
2030 * ../errors/cs0617.cs : Add.
2032 2001-11-11 Ravi Pratap <ravi@ximian.com>
2034 * enum.cs (Emit): Rename to Populate to be more consistent with what
2035 we expect it to do and when exactly it is called.
2037 * class.cs, rootcontext.cs : Update accordingly.
2039 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
2040 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
2042 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
2044 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
2045 of a fieldinfo using the above, when dealing with a FieldBuilder.
2047 2001-11-10 Ravi Pratap <ravi@ximian.com>
2049 * ../errors/cs0031.cs : Add.
2051 * ../errors/cs1008.cs : Add.
2053 * ../errrors/cs0543.cs : Add.
2055 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
2058 (FindMembers): Implement.
2060 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
2061 enums and delegates too.
2063 (enum_types): Rename to builder_to_enum.
2065 (delegate_types): Rename to builder_to_delegate.
2067 * delegate.cs (FindMembers): Implement.
2069 2001-11-09 Ravi Pratap <ravi@ximian.com>
2071 * typemanager.cs (IsEnumType): Implement.
2073 * enum.cs (Emit): Re-write parts to account for the underlying type
2074 better and perform checking etc.
2076 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
2077 of the underlying type.
2079 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
2082 * enum.cs (error31): Helper to report error #31.
2084 * cs-parser.jay (enum_declaration): Store location of each member too.
2086 * enum.cs (member_to_location): New hashtable.
2088 (AddEnumMember): Update location hashtable.
2090 (Emit): Use the location of each member while reporting errors.
2092 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2094 * cs-parser.jay: A for_initializer if is a
2095 local_variable_declaration really ammount to have an implicit
2096 block with the variable declaration and no initializer for for.
2098 * statement.cs (For.Emit): Cope with null initializers.
2100 This fixes the infinite loop on for initializers.
2102 2001-11-08 Miguel de Icaza <miguel@ximian.com>
2104 * enum.cs: More cleanup.
2106 * ecore.cs: Remove dead code.
2108 * class.cs (Property.Emit): More simplification.
2109 (Event.Emit): ditto.
2111 Reworked to have less levels of indentation.
2113 2001-11-08 Ravi Pratap <ravi@ximian.com>
2115 * class.cs (Property): Emit attributes.
2125 * enum.cs (Emit): Ditto.
2127 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
2130 * class.cs (Field, Event, etc.): Move attribute generation into the
2131 Emit method everywhere.
2133 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
2134 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
2135 as we had no way of defining nested enums !
2137 * rootcontext.cs : Adjust code accordingly.
2139 * typemanager.cs (AddEnumType): To keep track of enum types separately.
2141 2001-11-07 Ravi Pratap <ravi@ximian.com>
2143 * expression.cs (EvalConstantExpression): Move into ecore.cs
2145 * enum.cs (Enum): Rename some members and make them public and readonly
2146 according to our convention.
2148 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
2151 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
2153 (Enum::Emit): Write a simple version for now which doesn't try to compute
2154 expressions. I shall modify this to be more robust in just a while.
2156 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
2158 (TypeContainer::CloseType): Create the Enum types too.
2160 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
2162 * expression.cs (EvalConstantExpression): Get rid of completely.
2164 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
2165 user-defined values and other cases.
2167 (IsValidEnumLiteral): Helper function.
2169 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
2170 out there in the case we had a literal FieldExpr.
2172 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
2174 (Literalize): Revamp a bit to take two arguments.
2176 (EnumLiteral): New class which derives from Literal to wrap enum literals.
2178 2001-11-06 Ravi Pratap <ravi@ximian.com>
2180 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
2182 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
2184 (Resolve): Use the above to ensure we have proper initializers.
2186 2001-11-05 Ravi Pratap <ravi@ximian.com>
2188 * expression.cs (Expression::EvalConstantExpression): New method to
2189 evaluate constant expressions.
2191 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
2193 2001-11-07 Miguel de Icaza <miguel@ximian.com>
2195 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
2198 (Binary.ResolveOperator): Handle operator != (object a, object b)
2199 and operator == (object a, object b);
2201 (Binary.DoNumericPromotions): Indicate whether the numeric
2202 promotion was possible.
2204 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
2207 Made the ArrayAccess implement interface IAssignMethod instead of
2208 IStackStore as the order in which arguments are passed reflects
2211 * assign.cs: Instead of using expr.ExprClass to select the way of
2212 assinging, probe for the IStackStore/IAssignMethod interfaces.
2214 * typemanager.cs: Load InitializeArray definition.
2216 * rootcontext.cs (RootContext.MakeStaticData): Used to define
2217 static data that can be used to initialize arrays.
2219 2001-11-05 Miguel de Icaza <miguel@ximian.com>
2221 * expression.cs: Handle operator== and operator!= for booleans.
2223 (Conditioal.Reduce): Implement reducer for the ?: operator.
2225 (Conditional.Resolve): Implement dead code elimination.
2227 (Binary.Resolve): Catch string literals and return a new
2228 concatenated string.
2230 (Unary.Reduce): Implement reduction of unary expressions.
2232 * ecore.cs: Split out the expression core handling here.
2234 (Expression.Reduce): New method used to perform constant folding
2235 and CSE. This is needed to support constant-expressions.
2237 * statement.cs (Statement.EmitBoolExpression): Pass true and false
2238 targets, and optimize for !x.
2240 2001-11-04 Ravi Pratap <ravi@ximian.com>
2242 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
2243 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
2244 set custom atttributes.
2246 * literal.cs (Literal::GetValue): New abstract method to return the actual
2247 value of the literal, cast as an object.
2249 (*Literal): Implement GetValue method.
2251 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
2252 expressions to the arraylist but objects of type Argument.
2254 * class.cs (TypeContainer::Emit): Emit our attributes too.
2256 (Method::Emit, Constructor::Emit): Ditto.
2258 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
2259 to be ignoring earlier.
2261 2001-11-03 Ravi Pratap <ravi@ximian.com>
2263 * attribute.cs (AttributeSection::Define): Implement to do the business
2264 of constructing a CustomAttributeBuilder.
2266 (Attribute): New trivial class. Increases readability of code.
2268 * cs-parser.jay : Update accordingly.
2270 (positional_argument_list, named_argument_list, named_argument): New rules
2272 (attribute_arguments): Use the above so that we are more correct.
2274 2001-11-02 Ravi Pratap <ravi@ximian.com>
2276 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
2277 to perform all checks for a method with a params parameter.
2279 (Invocation::OverloadResolve): Update to use the above method and therefore
2280 cope correctly with params method invocations.
2282 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
2285 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
2286 constructors in our parent too because we can't afford to miss out on
2289 * attribute.cs (AttributeSection): New name for the class Attribute
2291 Other trivial changes to improve readability.
2293 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
2294 use the new class names.
2296 2001-11-01 Ravi Pratap <ravi@ximian.com>
2298 * class.cs (Method::Define): Complete definition for params types too
2300 (Indexer::Define): Ditto.
2302 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
2303 Cope everywhere with a request for info about the array parameter.
2305 2001-11-01 Ravi Pratap <ravi@ximian.com>
2307 * tree.cs (RecordNamespace): Fix up to check for the correct key.
2309 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
2310 local_variable_type to extract the string corresponding to the type.
2312 (local_variable_type): Fixup the action to use the new helper method.
2314 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
2317 * expression.cs : Clean out code which uses the above.
2319 2001-10-31 Ravi Pratap <ravi@ximian.com>
2321 * typemanager.cs (RegisterMethod): Check if we already have an existing key
2322 and bale out if necessary by returning a false.
2324 (RegisterProperty): Ditto.
2326 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
2327 and print out appropriate error messages.
2329 * interface.cs (everywhere): Ditto.
2331 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
2332 location to constructor.
2334 * class.cs (Property, Event, Indexer): Update accordingly.
2336 * ../errors/cs111.cs : Added.
2338 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
2339 of a method, as laid down by the spec.
2341 (Invocation::OverloadResolve): Use the above method.
2343 2001-10-31 Ravi Pratap <ravi@ximian.com>
2345 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
2346 now take a TypeContainer and a Parameters object.
2348 (ParameterData): Modify return type of ParameterModifier method to be
2349 Parameter.Modifier and not a string.
2351 (ReflectionParameters, InternalParameters): Update accordingly.
2353 * expression.cs (Argument::GetParameterModifier): Same here.
2355 * support.cs (InternalParameters::ParameterType): Find a better way of determining
2356 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
2357 symbol in it at all so maybe this is only for now.
2359 2001-10-30 Ravi Pratap <ravi@ximian.com>
2361 * support.cs (InternalParameters): Constructor now takes an extra argument
2362 which is the actual Parameters class.
2364 (ParameterDesc): Update to provide info on ref/out modifiers.
2366 * class.cs (everywhere): Update call to InternalParameters to pass in
2367 the second argument too.
2369 * support.cs (ParameterData): Add ParameterModifier, which is a method
2370 to return the modifier info [ref/out etc]
2372 (InternalParameters, ReflectionParameters): Implement the above.
2374 * expression.cs (Argument::ParameterModifier): Similar function to return
2375 info about the argument's modifiers.
2377 (Invocation::OverloadResolve): Update to take into account matching modifiers
2380 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
2381 a new SetFormalParameters object which we pass to InternalParameters.
2383 2001-10-30 Ravi Pratap <ravi@ximian.com>
2385 * expression.cs (NewArray): Merge into the ArrayCreation class.
2387 2001-10-29 Ravi Pratap <ravi@ximian.com>
2389 * expression.cs (NewArray): Merge classes NewBuiltinArray and
2390 NewUserdefinedArray into one as there wasn't much of a use in having
2393 * expression.cs (Argument): Change field's name to ArgType from Type.
2395 (Type): New readonly property which returns the proper type, taking into
2396 account ref/out modifiers.
2398 (everywhere): Adjust code accordingly for the above.
2400 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
2401 whether we are emitting for a ref or out parameter.
2403 * expression.cs (Argument::Emit): Use the above field to set the state.
2405 (LocalVariableReference::Emit): Update to honour the flag and emit the
2408 * parameter.cs (Attributes): Set the correct flags for ref parameters.
2410 * expression.cs (Argument::FullDesc): New function to provide a full desc.
2412 * support.cs (ParameterData): Add method ParameterDesc to the interface.
2414 (ReflectionParameters, InternalParameters): Implement the above method.
2416 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
2419 (Invocation::FullMethodDesc): Ditto.
2421 2001-10-29 Miguel de Icaza <miguel@ximian.com>
2423 * cs-parser.jay: Add extra production for the second form of array
2426 * expression.cs (ArrayCreation): Update to reflect the above
2429 * Small changes to prepare for Array initialization.
2431 2001-10-28 Miguel de Icaza <miguel@ximian.com>
2433 * typemanager.cs (ImplementsInterface): interface might be null;
2434 Deal with this problem;
2436 Also, we do store negative hits on the cache (null values), so use
2437 this instead of calling t.GetInterfaces on the type everytime.
2439 2001-10-28 Ravi Pratap <ravi@ximian.com>
2441 * typemanager.cs (IsBuiltinType): New method to help determine the same.
2443 * expression.cs (New::DoResolve): Get rid of array creation code and instead
2444 split functionality out into different classes.
2446 (New::FormArrayType): Move into NewBuiltinArray.
2448 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
2451 (NewBuiltinArray): New class to handle creation of built-in arrays.
2453 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
2454 account creation of one-dimensional arrays.
2456 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
2458 (NewUserdefinedArray::DoResolve): Implement.
2460 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
2462 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
2463 we maintain inside the TypeManager. This is necessary to perform lookups on the
2466 (LookupType): Update to perform GetType on the module builders too.
2468 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
2470 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
2472 2001-10-23 Ravi Pratap <ravi@ximian.com>
2474 * expression.cs (New::DoResolve): Implement guts of array creation.
2476 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
2478 2001-10-27 Miguel de Icaza <miguel@ximian.com>
2480 * expression.cs: Fix bug I introduced lsat night that broke
2483 (Expression.Resolve): Report a 246 error (can not resolve name)
2484 if we find a SimpleName in the stream.
2486 (Expression.ResolveLValue): Ditto.
2488 (Expression.ResolveWithSimpleName): This function is a variant of
2489 ResolveName, this one allows SimpleNames to be returned without a
2490 warning. The only consumer of SimpleNames is MemberAccess
2492 2001-10-26 Miguel de Icaza <miguel@ximian.com>
2494 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
2495 might arrive here. I have my doubts that this is correct.
2497 * statement.cs (Lock): Implement lock statement.
2499 * cs-parser.jay: Small fixes to support `lock' and `using'
2501 * cs-tokenizer.cs: Remove extra space
2503 * driver.cs: New flag --checked, allows to turn on integer math
2506 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
2507 Threading.Monitor.Exit
2509 2001-10-23 Miguel de Icaza <miguel@ximian.com>
2511 * expression.cs (IndexerAccess::DoResolveLValue): Set the
2512 Expression Class to be IndexerAccess.
2514 Notice that Indexer::DoResolve sets the eclass to Value.
2516 2001-10-22 Miguel de Icaza <miguel@ximian.com>
2518 * class.cs (TypeContainer::Emit): Emit code for indexers.
2520 * assign.cs (IAssignMethod): New interface implemented by Indexers
2521 and Properties for handling assignment.
2523 (Assign::Emit): Simplify and reuse code.
2525 * expression.cs (IndexerAccess, PropertyExpr): Implement
2526 IAssignMethod, clean up old code.
2528 2001-10-22 Ravi Pratap <ravi@ximian.com>
2530 * typemanager.cs (ImplementsInterface): New method to determine if a type
2531 implements a given interface. Provides a nice cache too.
2533 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
2536 (ConvertReferenceExplicit): Ditto.
2538 * delegate.cs (Delegate::Populate): Update to define the parameters on the
2539 various methods, with correct names etc.
2541 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
2542 Operator.UnaryNegation.
2544 * cs-parser.jay (operator_declarator): Be a little clever in the case where
2545 we have a unary plus or minus operator.
2547 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
2550 * everywhere : update accordingly.
2552 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
2555 * class.cs (Method::Define): For the case where we are implementing a method
2556 inherited from an interface, we need to set the MethodAttributes.Final flag too.
2557 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
2559 2001-10-21 Ravi Pratap <ravi@ximian.com>
2561 * interface.cs (FindMembers): Implement to work around S.R.E
2564 * typemanager.cs (IsInterfaceType): Implement.
2566 (FindMembers): Update to handle interface types too.
2568 * expression.cs (ImplicitReferenceConversion): Re-write bits which
2569 use IsAssignableFrom as that is not correct - it doesn't work.
2571 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
2572 and accordingly override EmitStatement.
2574 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
2575 using the correct logic :-)
2577 2001-10-19 Ravi Pratap <ravi@ximian.com>
2579 * ../errors/cs-11.cs : Add to demonstrate error -11
2581 2001-10-17 Miguel de Icaza <miguel@ximian.com>
2583 * assign.cs (Assign::Resolve): Resolve right hand side first, and
2584 then pass this as a hint to ResolveLValue.
2586 * expression.cs (FieldExpr): Add Location information
2588 (FieldExpr::LValueResolve): Report assignment to readonly
2591 (Expression::ExprClassFromMemberInfo): Pass location information.
2593 (Expression::ResolveLValue): Add new method that resolves an
2596 (Expression::DoResolveLValue): Default invocation calls
2599 (Indexers): New class used to keep track of indexers in a given
2602 (IStackStore): Renamed from LValue, as it did not really describe
2603 what this did. Also ResolveLValue is gone from this interface and
2604 now is part of Expression.
2606 (ElementAccess): Depending on the element access type
2608 * typemanager.cs: Add `indexer_name_type' as a Core type
2609 (System.Runtime.CompilerServices.IndexerNameAttribute)
2611 * statement.cs (Goto): Take a location.
2613 2001-10-18 Ravi Pratap <ravi@ximian.com>
2615 * delegate.cs (Delegate::VerifyDelegate): New method to verify
2616 if two delegates are compatible.
2618 (NewDelegate::DoResolve): Update to take care of the case when
2619 we instantiate a delegate from another delegate.
2621 * typemanager.cs (FindMembers): Don't even try to look up members
2622 of Delegate types for now.
2624 2001-10-18 Ravi Pratap <ravi@ximian.com>
2626 * delegate.cs (NewDelegate): New class to take care of delegate
2629 * expression.cs (New): Split the delegate related code out into
2630 the NewDelegate class.
2632 * delegate.cs (DelegateInvocation): New class to handle delegate
2635 * expression.cs (Invocation): Split out delegate related code into
2636 the DelegateInvocation class.
2638 2001-10-17 Ravi Pratap <ravi@ximian.com>
2640 * expression.cs (New::DoResolve): Implement delegate creation fully
2641 and according to the spec.
2643 (New::DoEmit): Update to handle delegates differently.
2645 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
2646 because of which we were printing out arguments in reverse order !
2648 * delegate.cs (VerifyMethod): Implement to check if the given method
2649 matches the delegate.
2651 (FullDelegateDesc): Implement.
2653 (VerifyApplicability): Implement.
2655 * expression.cs (Invocation::DoResolve): Update to accordingly handle
2656 delegate invocations too.
2658 (Invocation::Emit): Ditto.
2660 * ../errors/cs1593.cs : Added.
2662 * ../errors/cs1594.cs : Added.
2664 * delegate.cs (InstanceExpression, TargetMethod): New properties.
2666 2001-10-16 Ravi Pratap <ravi@ximian.com>
2668 * typemanager.cs (intptr_type): Core type for System.IntPtr
2670 (InitCoreTypes): Update for the same.
2672 (iasyncresult_type, asynccallback_type): Ditto.
2674 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
2677 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
2680 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
2681 the builders for the 4 members of a delegate type :-)
2683 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
2686 * expression.cs (New::DoResolve): Implement guts for delegate creation.
2688 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
2690 2001-10-15 Miguel de Icaza <miguel@ximian.com>
2692 * statement.cs (Break::Emit): Implement.
2693 (Continue::Emit): Implement.
2695 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
2696 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
2697 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
2698 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
2701 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
2702 properties that track the label for the current loop (begin of the
2703 loop and end of the loop).
2705 2001-10-15 Ravi Pratap <ravi@ximian.com>
2707 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
2708 use of emitting anything at all.
2710 * class.cs, rootcontext.cs : Get rid of calls to the same.
2712 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
2714 (Populate): Define the constructor correctly and set the implementation
2717 * typemanager.cs (delegate_types): New hashtable to hold delegates that
2720 (AddDelegateType): Implement.
2722 (IsDelegateType): Implement helper method.
2724 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
2726 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
2727 and accordingly handle it.
2729 * delegate.cs (Populate): Take TypeContainer argument.
2730 Implement bits to define the Invoke method. However, I still haven't figured out
2731 how to take care of the native int bit :-(
2733 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
2734 Qualify the name of the delegate, not its return type !
2736 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
2739 (StandardConversionExists): Checking for array types turns out to be recursive.
2741 (ConvertReferenceExplicit): Implement array conversion.
2743 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
2745 2001-10-12 Ravi Pratap <ravi@ximian.com>
2747 * cs-parser.jay (delegate_declaration): Store the fully qualified
2748 name as it is a type declaration.
2750 * delegate.cs (ReturnType, Name): Rename members to these. Make them
2753 (DefineDelegate): Renamed from Define. Does the same thing essentially,
2754 as TypeContainer::DefineType.
2756 (Populate): Method in which all the definition of the various methods (Invoke)
2759 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
2762 (CloseDelegate): Finally creates the delegate.
2764 * class.cs (TypeContainer::DefineType): Update to define delegates.
2765 (Populate, Emit and CloseType): Do the same thing here too.
2767 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
2768 delegates in all these operations.
2770 2001-10-14 Miguel de Icaza <miguel@ximian.com>
2772 * expression.cs: LocalTemporary: a new expression used to
2773 reference a temporary that has been created.
2775 * assign.cs: Handle PropertyAccess back here, so that we can
2776 provide the proper semantic access to properties.
2778 * expression.cs (Expression::ConvertReferenceExplicit): Implement
2779 a few more explicit conversions.
2781 * modifiers.cs: `NEW' modifier maps to HideBySig.
2783 * expression.cs (PropertyExpr): Make this into an
2784 ExpressionStatement, and support the EmitStatement code path.
2786 Perform get/set error checking, clean up the interface.
2788 * assign.cs: recognize PropertyExprs as targets, and if so, turn
2789 them into toplevel access objects.
2791 2001-10-12 Miguel de Icaza <miguel@ximian.com>
2793 * expression.cs: PropertyExpr::PropertyExpr: use work around the
2796 * typemanager.cs: Keep track here of our PropertyBuilders again to
2797 work around lameness in SRE.
2799 2001-10-11 Miguel de Icaza <miguel@ximian.com>
2801 * expression.cs (LValue::LValueResolve): New method in the
2802 interface, used to perform a second resolution pass for LValues.
2804 (This::DoResolve): Catch the use of this in static methods.
2806 (This::LValueResolve): Implement.
2808 (This::Store): Remove warning, assigning to `this' in structures
2811 (Invocation::Emit): Deal with invocation of
2812 methods on value types. We need to pass the address to structure
2813 methods rather than the object itself. (The equivalent code to
2814 emit "this" for structures leaves the entire structure on the
2815 stack instead of a pointer to it).
2817 (ParameterReference::DoResolve): Compute the real index for the
2818 argument based on whether the method takes or not a `this' pointer
2819 (ie, the method is static).
2821 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
2822 value types returned from functions when we need to invoke a
2823 method on the sturcture.
2826 2001-10-11 Ravi Pratap <ravi@ximian.com>
2828 * class.cs (TypeContainer::DefineType): Method to actually do the business of
2829 defining the type in the Modulebuilder or Typebuilder. This is to take
2830 care of nested types which need to be defined on the TypeBuilder using
2833 (TypeContainer::GetClassBases): Implement. Essentially the code from the
2834 methods in RootContext, only ported to be part of TypeContainer.
2836 (TypeContainer::GetInterfaceOrClass): Ditto.
2838 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
2840 * interface.cs (Interface::DefineInterface): New method. Does exactly
2841 what RootContext.CreateInterface did earlier, only it takes care of nested types
2844 (Interface::GetInterfaces): Move from RootContext here and port.
2846 (Interface::GetInterfaceByName): Same here.
2848 * rootcontext.cs (ResolveTree): Re-write.
2850 (PopulateTypes): Re-write.
2852 * class.cs (TypeContainer::Populate): Populate nested types too.
2853 (TypeContainer::Emit): Emit nested members too.
2855 * typemanager.cs (AddUserType): Do not make use of the FullName property,
2856 instead just use the name argument passed in as it is already fully
2859 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
2860 to TypeContainer mapping to see if a type is user-defined.
2862 * class.cs (TypeContainer::CloseType): Implement.
2864 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
2865 the default constructor.
2867 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
2870 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
2872 * interface.cs (CloseType): Create the type here.
2874 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
2877 Remove all the methods which are now in TypeContainer.
2879 2001-10-10 Ravi Pratap <ravi@ximian.com>
2881 * delegate.cs (Define): Re-write bits to define the delegate
2884 2001-10-10 Miguel de Icaza <miguel@ximian.com>
2886 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
2888 * expression.cs (ImplicitReferenceConversion): handle null as well
2889 as a source to convert to any reference type.
2891 * statement.cs (Return): Perform any implicit conversions to
2892 expected return type.
2894 Validate use of return statement.
2896 * codegen.cs (EmitContext): Pass the expected return type here.
2898 * class.cs (Method, Constructor, Property): Pass expected return
2899 type to EmitContext.
2901 2001-10-09 Miguel de Icaza <miguel@ximian.com>
2903 * expression.cs: Make DoResolve take an EmitContext instead of a
2906 Replaced `l' and `location' for `loc', for consistency.
2908 (Error, Warning): Remove unneeded Tc argument.
2910 * assign.cs, literal.cs, constant.cs: Update to new calling
2913 * codegen.cs: EmitContext now contains a flag indicating whether
2914 code is being generated in a static method or not.
2916 * cs-parser.jay: DecomposeQI, new function that replaces the old
2917 QualifiedIdentifier. Now we always decompose the assembled
2918 strings from qualified_identifier productions into a group of
2921 2001-10-08 Miguel de Icaza <miguel@ximian.com>
2923 * rootcontext.cs: Deal with field-less struct types correctly now
2924 by passing the size option to Define Type.
2926 * class.cs: Removed hack that created one static field.
2928 2001-10-07 Miguel de Icaza <miguel@ximian.com>
2930 * statement.cs: Moved most of the code generation here.
2932 2001-10-09 Ravi Pratap <ravi@ximian.com>
2934 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
2937 (ElementAccess): Remove useless bits for now - keep checks as the spec
2940 2001-10-08 Ravi Pratap <ravi@ximian.com>
2942 * expression.cs (ElementAccess::DoResolve): Remove my crap code
2943 and start performing checks according to the spec.
2945 2001-10-07 Ravi Pratap <ravi@ximian.com>
2947 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
2948 rank_specifiers instead.
2950 (rank_specifiers): Change the order in which the rank specifiers are stored
2952 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
2954 * expression.cs (ElementAccess): Implement the LValue interface too.
2956 2001-10-06 Ravi Pratap <ravi@ximian.com>
2958 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
2959 except that user defined conversions are not included.
2961 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
2962 perform the conversion of the return type, if necessary.
2964 (New::DoResolve): Check whether we are creating an array or an object
2965 and accordingly do the needful.
2967 (New::Emit): Same here.
2969 (New::DoResolve): Implement guts of array creation.
2971 (New::FormLookupType): Helper function.
2973 2001-10-07 Miguel de Icaza <miguel@ximian.com>
2975 * codegen.cs: Removed most of the code generation here, and move the
2976 corresponding code generation bits to the statement classes.
2978 Added support for try/catch/finalize and throw.
2980 * cs-parser.jay: Added support for try/catch/finalize.
2982 * class.cs: Catch static methods having the flags override,
2983 virtual or abstract.
2985 * expression.cs (UserCast): This user cast was not really doing
2986 what it was supposed to do. Which is to be born in fully resolved
2987 state. Parts of the resolution were being performed at Emit time!
2991 2001-10-05 Miguel de Icaza <miguel@ximian.com>
2993 * expression.cs: Implicity convert the result from UserCast.
2995 2001-10-05 Ravi Pratap <ravi@ximian.com>
2997 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
2998 prevented it from working correctly.
3000 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
3001 merely ConvertImplicit.
3003 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3005 * typemanager.cs: Make the LookupTypeContainer function static,
3006 and not per-instance.
3008 * class.cs: Make static FindMembers (the one that takes a Type
3011 * codegen.cs: Add EmitForeach here.
3013 * cs-parser.jay: Make foreach a toplevel object instead of the
3014 inline expansion, as we need to perform semantic analysis on it.
3016 2001-10-05 Ravi Pratap <ravi@ximian.com>
3018 * expression.cs (Expression::ImplicitUserConversion): Rename to
3019 UserDefinedConversion.
3021 (Expression::UserDefinedConversion): Take an extra argument specifying
3022 whether we look for explicit user conversions too.
3024 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
3026 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
3028 (ExplicitUserConversion): Make it a call to UserDefinedConversion
3029 with the appropriate arguments.
3031 * cs-parser.jay (cast_expression): Record location too.
3033 * expression.cs (Cast): Record location info.
3035 (Expression::ConvertExplicit): Take location argument.
3037 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
3038 to determine if we are doing explicit conversions.
3040 (UserCast::Emit): Update accordingly.
3042 (Expression::ConvertExplicit): Report an error if everything fails.
3044 * ../errors/cs0030.cs : Add.
3046 2001-10-04 Miguel de Icaza <miguel@ximian.com>
3048 * modifiers.cs: If the ABSTRACT keyword is present, also set the
3049 virtual and newslot bits.
3051 * class.cs (TypeContainer::RegisterRequiredImplementations):
3052 Record methods we need.
3054 (TypeContainer::MakeKey): Helper function to make keys for
3055 MethodBases, since the Methodbase key is useless.
3057 (TypeContainer::Populate): Call RegisterRequiredImplementations
3058 before defining the methods.
3060 Create a mapping for method_builders_to_methods ahead of time
3061 instead of inside a tight loop.
3063 (::RequireMethods): Accept an object as the data to set into the
3064 hashtable so we can report interface vs abstract method mismatch.
3066 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3068 * report.cs: Make all of it static.
3070 * rootcontext.cs: Drop object_type and value_type computations, as
3071 we have those in the TypeManager anyways.
3073 Drop report instance variable too, now it is a global.
3075 * driver.cs: Use try/catch on command line handling.
3077 Add --probe option to debug the error reporting system with a test
3080 * report.cs: Add support for exiting program when a probe
3081 condition is reached.
3083 2001-10-03 Ravi Pratap <ravi@ximian.com>
3085 * expression.cs (Binary::DoNumericPromotions): Fix the case when
3086 we do a forcible conversion regardless of type, to check if
3087 ForceConversion returns a null.
3089 (Binary::error19): Use location to report error.
3091 (Unary::error23): Use location here too.
3093 * ../errors/cs0019.cs : Check in.
3095 * ../errors/cs0023.cs : Check in.
3097 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
3098 case of a non-null MethodInfo object with a length of 0 !
3100 (Binary::ResolveOperator): Flag error if overload resolution fails to find
3101 an applicable member - according to the spec :-)
3102 Also fix logic to find members in base types.
3104 (Unary::ResolveOperator): Same here.
3106 (Unary::report23): Change name to error23 and make first argument a TypeContainer
3107 as I was getting thoroughly confused between this and error19 :-)
3109 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
3110 (::FindMostEncompassedType): Implement.
3111 (::FindMostEncompassingType): Implement.
3112 (::StandardConversionExists): Implement.
3114 (UserImplicitCast): Re-vamp. We now need info about most specific
3115 source and target types so that we can do the necessary conversions.
3117 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
3118 mathematical union with no duplicates.
3120 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3122 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
3123 in order from base classes to child classes, so that we can in
3124 child classes look up in our parent for method names and
3125 attributes (required for handling abstract, virtual, new, override
3126 constructs: we need to instrospect our base class, and if we dont
3127 populate the classes in order, the introspection might be
3128 incorrect. For example, a method could query its parent before
3129 the parent has any methods and would determine that the parent has
3130 no abstract methods (while it could have had them)).
3132 (RootContext::CreateType): Record the order in which we define the
3135 2001-10-02 Miguel de Icaza <miguel@ximian.com>
3137 * class.cs (TypeContainer::Populate): Also method definitions can
3138 fail now, keep track of this.
3140 (TypeContainer::FindMembers): Implement support for
3141 DeclaredOnly/noDeclaredOnly flag.
3143 (Constructor::Emit) Return the ConstructorBuilder.
3145 (Method::Emit) Return the MethodBuilder.
3146 Check for abstract or virtual methods to be public.
3148 * rootcontext.cs (RootContext::CreateType): Register all the
3149 abstract methods required for the class to be complete and the
3150 interface methods that must be implemented.
3152 * cs-parser.jay: Report error 501 (method requires body if it is
3153 not marked abstract or extern).
3155 * expression.cs (TypeOf::Emit): Implement.
3157 * typemanager.cs: runtime_handle_type, new global type.
3159 * class.cs (Property::Emit): Generate code for properties.
3161 2001-10-02 Ravi Pratap <ravi@ximian.com>
3163 * expression.cs (Unary::ResolveOperator): Find operators on base type
3164 too - we now conform exactly to the spec.
3166 (Binary::ResolveOperator): Same here.
3168 * class.cs (Operator::Define): Fix minor quirk in the tests.
3170 * ../errors/cs0215.cs : Added.
3172 * ../errors/cs0556.cs : Added.
3174 * ../errors/cs0555.cs : Added.
3176 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3178 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
3179 single integer which is really efficient
3181 2001-10-01 Ravi Pratap <ravi@ximian.com>
3183 * expression.cs (Expression::ImplicitUserConversion): Use location
3184 even in the case when we are examining True operators.
3186 * class.cs (Operator::Define): Perform extensive checks to conform
3187 with the rules for operator overloading in the spec.
3189 * expression.cs (Expression::ImplicitReferenceConversion): Implement
3190 some of the other conversions mentioned in the spec.
3192 * typemanager.cs (array_type): New static member for the System.Array built-in
3195 (cloneable_interface): For System.ICloneable interface.
3197 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
3198 we start resolving the tree and populating types.
3200 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
3202 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3204 * expression.cs (Expression::ExprClassFromMemberInfo,
3205 Expression::Literalize): Create literal expressions from
3206 FieldInfos which are literals.
3208 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
3209 type casts, because they were wrong. The test suite in tests
3212 (ImplicitNumericConversion): ushort to ulong requires a widening
3215 Int32 constant to long requires widening cast as well.
3217 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
3218 for integers because the type on the stack is not i4.
3220 2001-09-30 Miguel de Icaza <miguel@ximian.com>
3222 * expression.cs (report118): require location argument.
3224 * parameter.cs: Do not dereference potential null value.
3226 * class.cs: Catch methods that lack the `new' keyword when
3227 overriding a name. Report warnings when `new' is used without
3228 anything being there to override.
3230 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
3232 * class.cs: Only add constructor to hashtable if it is non-null
3233 (as now constructors can fail on define).
3235 (TypeManager, Class, Struct): Take location arguments.
3237 Catch field instance initialization in structs as errors.
3239 accepting_filter: a new filter for FindMembers that is static so
3240 that we dont create an instance per invocation.
3242 (Constructor::Define): Catch errors where a struct constructor is
3245 * cs-parser.jay: Pass location information for various new
3248 * delegate.cs (Delegate): take a location argument.
3250 * driver.cs: Do not call EmitCode if there were problesm in the
3251 Definition of the types, as many Builders wont be there.
3253 * decl.cs (Decl::Decl): Require a location argument.
3255 * cs-tokenizer.cs: Handle properly hex constants that can not fit
3256 into integers, and find the most appropiate integer for it.
3258 * literal.cs: Implement ULongLiteral.
3260 * rootcontext.cs: Provide better information about the location of
3261 failure when CreateType fails.
3263 2001-09-29 Miguel de Icaza <miguel@ximian.com>
3265 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
3268 * expression.cs (Binary::CheckShiftArguments): Add missing type
3270 (Binary::ResolveOperator): Add type to the logical and and logical
3271 or, Bitwise And/Or and Exclusive Or code paths, it was missing
3274 (Binary::DoNumericPromotions): In the case where either argument
3275 is ulong (and most signed types combined with ulong cause an
3276 error) perform implicit integer constant conversions as well.
3278 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3280 * expression.cs (UserImplicitCast): Method should always be
3282 (Invocation::BetterConversion): Simplified test for IntLiteral.
3284 (Expression::ImplicitNumericConversion): Split this routine out.
3285 Put the code that performs implicit constant integer conversions
3288 (Expression::Resolve): Become a wrapper around DoResolve so we can
3289 check eclass and type being set after resolve.
3291 (Invocation::Badness): Remove this dead function
3293 (Binary::ResolveOperator): Do not compute the expensive argumnets
3294 unless we have a union for it.
3296 (Probe::Emit): Is needs to do an isinst and then
3297 compare against null.
3299 (::CanConvert): Added Location argument. If the Location argument
3300 is null (Location.Null), then we do not report errors. This is
3301 used by the `probe' mechanism of the Explicit conversion. We do
3302 not want to generate an error for something that the user
3303 explicitly requested to be casted. But the pipeline for an
3304 explicit cast first tests for potential implicit casts.
3306 So for now, if the Location is null, it means `Probe only' to
3307 avoid adding another argument. Might have to revise this
3310 (ClassCast): New class used to type cast objects into arbitrary
3311 classes (used in Explicit Reference Conversions).
3313 Implement `as' as well.
3315 Reverted all the patches from Ravi below: they were broken:
3317 * The use of `level' as a mechanism to stop recursive
3318 invocations is wrong. That was there just to catch the
3319 bug with a strack trace but not as a way of addressing
3322 To fix the problem we have to *understand* what is going
3323 on and the interactions and come up with a plan, not
3324 just get things going.
3326 * The use of the type conversion cache that I proposed
3327 last night had an open topic: How does this work across
3328 protection domains. A user defined conversion might not
3329 be public in the location where we are applying the
3330 conversion, a different conversion might be selected
3331 (ie, private A->B (better) but public B->A (worse),
3332 inside A, A->B applies, but outside it, B->A will
3335 * On top of that (ie, even if the above is solved),
3336 conversions in a cache need to be abstract. Ie, `To
3337 convert from an Int to a Short use an OpcodeCast', not
3338 `To convert from an Int to a Short use the OpcodeCast on
3339 the variable 5' (which is what this patch was doing).
3341 2001-09-28 Ravi Pratap <ravi@ximian.com>
3343 * expression.cs (Invocation::ConversionExists): Re-write to use
3344 the conversion cache
3346 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
3347 cache all conversions done, not just user-defined ones.
3349 (Invocation::BetterConversion): The real culprit. Use ConversionExists
3350 to determine if a conversion exists instead of acutually trying to
3351 perform the conversion. It's faster too.
3353 (Expression::ConvertExplicit): Modify to use ConversionExists to check
3354 and only then attempt the implicit conversion.
3356 2001-09-28 Ravi Pratap <ravi@ximian.com>
3358 * expression.cs (ConvertImplicit): Use a cache for conversions
3359 already found. Check level of recursion and bail out if necessary.
3361 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3363 * typemanager.cs (string_concat_string_string, string_concat_object_object):
3364 Export standard methods that we expect for string operations.
3366 * statement.cs (Block::UsageWarning): Track usage of variables and
3367 report the errors for not used variables.
3369 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
3372 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3374 * codegen.cs: remove unnneded code
3376 * expression.cs: Removed BuiltinTypeAccess class
3378 Fix the order in which implicit conversions are
3381 The previous fixed dropped support for boxed conversions (adding a
3382 test to the test suite now)
3384 (UserImplicitCast::CanConvert): Remove test for source being null,
3385 that code is broken. We should not feed a null to begin with, if
3386 we do, then we should track the bug where the problem originates
3387 and not try to cover it up here.
3389 Return a resolved expression of type UserImplicitCast on success
3390 rather than true/false. Ravi: this is what I was talking about,
3391 the pattern is to use a static method as a "constructor" for
3394 Also, do not create arguments until the very last minute,
3395 otherwise we always create the arguments even for lookups that
3396 will never be performed.
3398 (UserImplicitCast::Resolve): Eliminate, objects of type
3399 UserImplicitCast are born in a fully resolved state.
3401 * typemanager.cs (InitCoreTypes): Init also value_type
3404 * expression.cs (Cast::Resolve): First resolve the child expression.
3406 (LValue): Add new method AddressOf to be used by
3409 Change the argument of Store to take an EmitContext instead of an
3410 ILGenerator, because things like FieldExpr need to be able to call
3411 their children expression to generate the instance code.
3413 (Expression::Error, Expression::Warning): Sugar functions for
3416 (Expression::MemberLookup): Accept a TypeContainer instead of a
3417 Report as the first argument.
3419 (Expression::ResolvePrimary): Killed. I still want to improve
3420 this as currently the code is just not right.
3422 (Expression::ResolveMemberAccess): Simplify, but it is still
3425 (Unary::Resolve): Catch errors in AddressOf operators.
3427 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
3428 index to a byte for the short-version, or the compiler will choose
3429 the wrong Emit call, which generates the wrong data.
3431 (ParameterReference::Emit, ::Store): same.
3433 (FieldExpr::AddressOf): Implement.
3435 * typemanager.cs: TypeManager: made public variable instead of
3438 * driver.cs: document --fatal.
3440 * report.cs (ErrorMessage, WarningMessage): new names for the old
3441 Error and Warning classes.
3443 * cs-parser.jay (member_access): Turn built-in access to types
3444 into a normal simplename
3446 2001-09-27 Ravi Pratap <ravi@ximian.com>
3448 * expression.cs (Invocation::BetterConversion): Fix to cope
3449 with q being null, since this was introducing a bug.
3451 * expression.cs (ConvertImplicit): Do built-in conversions first.
3453 2001-09-27 Ravi Pratap <ravi@ximian.com>
3455 * expression.cs (UserImplicitCast::Resolve): Fix bug.
3457 2001-09-27 Ravi Pratap <ravi@ximian.com>
3459 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
3460 I had introduced long ago (what's new ?).
3462 * expression.cs (UserImplicitCast::CanConvert): Static method to do
3463 the work of all the checking.
3464 (ConvertImplicit): Call CanConvert and only then create object if necessary.
3465 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
3467 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
3468 that is the right way.
3470 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
3471 overloading resolution. Use everywhere instead of cutting and pasting code.
3473 (Binary::ResolveOperator): Use MakeUnionSet.
3475 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
3476 we have to convert to bool types. Not complete yet.
3478 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3480 * typemanager.cs (TypeManager::CSharpName): support ushort.
3482 * expression.cs (Expression::TryImplicitIntConversion): Attempts
3483 to provide an expression that performsn an implicit constant int
3484 conversion (section 6.1.6).
3485 (Expression::ConvertImplicitRequired): Reworked to include
3486 implicit constant expression conversions.
3488 (Expression::ConvertNumericExplicit): Finished.
3490 (Invocation::Emit): If InstanceExpression is null, then it means
3491 that we perform a call on this.
3493 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3495 * expression.cs (Unary::Emit): Remove some dead code.
3496 (Probe): Implement Resolve and Emit for `is'.
3497 (Expression::ConvertImplicitRequired): Attempt to do constant
3498 expression conversions here. Maybe should be moved to
3499 ConvertImplicit, but I am not sure.
3500 (Expression::ImplicitLongConstantConversionPossible,
3501 Expression::ImplicitIntConstantConversionPossible): New functions
3502 that tell whether is it possible to apply an implicit constant
3503 expression conversion.
3505 (ConvertNumericExplicit): Started work on explicit numeric
3508 * cs-parser.jay: Update operator constants.
3510 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
3511 (Parameters::GetSignature): Hook up VerifyArgs here.
3512 (Parameters::VerifyArgs): Verifies that no two arguments have the
3515 * class.cs (Operator): Update the operator names to reflect the
3516 ones that the spec expects (as we are just stringizing the
3519 * expression.cs (Unary::ResolveOperator): Fix bug: Use
3520 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
3521 previous usage did only work for our methods.
3522 (Expression::ConvertImplicit): Handle decimal implicit numeric
3523 conversions as well.
3524 (Expression::InternalTypeConstructor): Used to invoke constructors
3525 on internal types for default promotions.
3527 (Unary::Emit): Implement special handling for the pre/post
3528 increment/decrement for overloaded operators, as they need to have
3529 the same semantics as the other operators.
3531 (Binary::ResolveOperator): ditto.
3532 (Invocation::ConversionExists): ditto.
3533 (UserImplicitCast::Resolve): ditto.
3535 2001-09-26 Ravi Pratap <ravi@ximian.com>
3537 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
3538 operator, return after emitting body. Regression tests pass again !
3540 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
3541 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
3542 (Invocation::OverloadResolve): Ditto.
3543 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
3545 * everywhere : update calls to the above methods accordingly.
3547 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3549 * assign.cs (Assign): Make it inherit from ExpressionStatement.
3551 * expression.cs (ExpressionStatement): New base class used for
3552 expressions that can appear in statements, so that we can provide
3553 an alternate path to generate expression that do not leave a value
3556 (Expression::Emit, and all the derivatives): We no longer return
3557 whether a value is left on the stack or not. Every expression
3558 after being emitted leaves a single value on the stack.
3560 * codegen.cs (EmitContext::EmitStatementExpression): Use the
3561 facilties of ExpressionStatement if possible.
3563 * cs-parser.jay: Update statement_expression.
3565 2001-09-25 Miguel de Icaza <miguel@ximian.com>
3567 * driver.cs: Change the wording of message
3569 2001-09-25 Ravi Pratap <ravi@ximian.com>
3571 * expression.cs (Binary::ResolveOperator): Had forgottten to set
3572 the type of the expression to the return type of the method if
3573 we have an overloaded operator match ! The regression tests pass again !
3574 (Unary::ResolveOperator): Ditto.
3576 * expression.cs (Invocation::ConversionExists): Correct the member lookup
3577 to find "op_Implicit", not "implicit" ;-)
3578 (UserImplicitCast): New class to take care of user-defined implicit conversions.
3579 (ConvertImplicit, ForceConversion): Take TypeContainer argument
3581 * everywhere : Correct calls to the above accordingly.
3583 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
3584 (ConvertImplicit): Do user-defined conversion if it exists.
3586 2001-09-24 Miguel de Icaza <miguel@ximian.com>
3588 * assign.cs: track location.
3589 (Resolve): Use implicit conversions on assignment.
3591 * literal.cs: Oops. Not good, Emit of short access values should
3592 pass (Bytes) or the wrong argument will be selected.
3594 * expression.cs (Unary::Emit): Emit code for -expr.
3596 (Unary::ResolveOperator): Handle `Substract' for non-constants
3597 (substract from zero from the non-constants).
3598 Deal with Doubles as well.
3600 (Expression::ConvertImplicitRequired): New routine that reports an
3601 error if no implicit conversion exists.
3603 (Invocation::OverloadResolve): Store the converted implicit
3604 expressions if we make them
3606 2001-09-24 Ravi Pratap <ravi@ximian.com>
3608 * class.cs (ConstructorInitializer): Take a Location argument.
3609 (ConstructorBaseInitializer): Same here.
3610 (ConstructorThisInitializer): Same here.
3612 * cs-parser.jay : Update all calls accordingly.
3614 * expression.cs (Unary, Binary, New): Take location argument.
3615 Update accordingly everywhere.
3617 * cs-parser.jay : Update all calls to the above to take a location
3622 2001-09-24 Ravi Pratap <ravi@ximian.com>
3624 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
3625 (Invocation::BetterConversion): Same here
3626 (Invocation::ConversionExists): Ditto.
3628 (Invocation::ConversionExists): Implement.
3630 2001-09-22 Ravi Pratap <ravi@ximian.com>
3632 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
3633 Also take an additional TypeContainer argument.
3635 * All over : Pass in TypeContainer as argument to OverloadResolve.
3637 * typemanager.cs (CSharpName): Update to check for the string type and return
3640 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
3643 2001-09-21 Ravi Pratap <ravi@ximian.com>
3645 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
3646 (Invocation::BetterFunction): Implement.
3647 (Invocation::BetterConversion): Implement.
3648 (Invocation::ConversionExists): Skeleton, no implementation yet.
3650 Okay, things work fine !
3652 2001-09-21 Miguel de Icaza <miguel@ximian.com>
3654 * typemanager.cs: declare and load enum_type, delegate_type and
3657 * expression.cs (Expression::Emit): Now emit returns a value that
3658 tells whether a value is left on the stack or not. This strategy
3659 might be reveted tomorrow with a mechanism that would address
3660 multiple assignments.
3661 (Expression::report118): Utility routine to report mismatches on
3664 (Unary::Report23): Report impossible type/operator combination
3667 (Unary::IsIncrementableNumber): Whether the type can be
3668 incremented or decremented with add.
3669 (Unary::ResolveOperator): Also allow enumerations to be bitwise
3671 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
3673 (Invocation::Emit): Deal with new Emit convetion.
3675 * All Expression derivatives: Updated their Emit method to return
3676 whether they leave values on the stack or not.
3678 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
3679 stack for expressions that are statements.
3681 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3683 * expression.cs (LValue): New interface. Must be implemented by
3685 (LocalVariableReference, ParameterReference, FieldExpr): Implement
3688 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
3689 interface for generating code, simplifies the code.
3691 2001-09-20 Ravi Pratap <ravi@ximian.com>
3693 * expression.cs (everywhere): Comment out return statements in ::Resolve
3694 methods to avoid the warnings.
3696 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3698 * driver.cs (parse): Report error 2001 if we can not open the
3701 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
3704 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
3707 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
3708 otherwise nested blocks end up with the same index.
3710 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
3712 * expression.cs: Instead of having FIXMEs in the Resolve
3713 functions, throw exceptions so it is obvious that we are facing a
3716 * cs-parser.jay (invocation_expression): Pass Location information.
3718 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
3719 Use a basename for those routines because .NET does not like paths
3722 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
3725 2001-09-19 Miguel de Icaza <miguel@ximian.com>
3727 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
3728 are loading the correct data types (throws an exception if not).
3729 (TypeManager::InitCoreTypes): Use CoreLookupType
3731 * expression.cs (Unary::ResolveOperator): return the child
3732 expression for expressions which are just +expr.
3733 (Unary::ResolveOperator): Return negative literals for -LITERAL
3734 expressions (otherwise they are Unary {Literal}).
3735 (Invocation::Badness): Take into account `Implicit constant
3736 expression conversions'.
3738 * literal.cs (LongLiteral): Implement long literal class.
3739 (IntLiteral): export the `Value' of the intliteral.
3741 2001-09-19 Ravi Pratap <ravi@ximian.com>
3743 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
3745 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
3746 instead of 'Operator'
3748 * expression.cs (Binary::ResolveOperator): Update accordingly.
3749 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
3752 * cs-parser.jay (unary_expression): Update to use the new names.
3754 * gen-treedump.cs (GetUnary): Same here.
3756 * expression.cs (Unary::Resolve): Implement.
3757 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
3758 operators are found instead of making noise ;-)
3759 (Unary::ResolveOperator): New method to do precisely the same thing which
3760 Binary::ResolveOperator does for Binary expressions.
3761 (Unary.method, .Arguments): Add.
3762 (Unary::OperName): Implement.
3763 (Unary::ForceConversion): Copy and Paste !
3765 * class.cs (Operator::Define): Fix a small bug for the case when we have
3768 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
3769 for the inbuilt operators. Only overloading works for now ;-)
3771 2001-09-18 Miguel de Icaza <miguel@ximian.com>
3773 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
3774 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
3776 * expression.cs (This::Emit): Implement.
3777 (This::Resolve): Implement.
3778 (TypeOf:Resolve): Implement.
3779 (Expression::ResolveSimpleName): Add an implicit this to instance
3781 (MemberAccess::Resolve): Deal with Parameters and Fields.
3782 Bind instance variable to Field expressions.
3783 (FieldExpr::Instance): New field used to track the expression that
3784 represents the object instance.
3785 (FieldExpr::Resolve): Track potential errors from MemberLookup not
3787 (FieldExpr::Emit): Implement.
3789 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
3790 the last instruction contains a return opcode to avoid generating
3791 the last `ret' instruction (this generates correct code, and it is
3792 nice to pass the peverify output).
3794 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
3795 initializer for static and instance variables.
3796 (Constructor::Emit): Allow initializer to be null in the case of
3797 static constructors. Only emit initializer for instance
3800 (TypeContainer::FindMembers): Return a null array if there are no
3803 Also fix the code for the MemberTypes.Method branch, as it was not
3804 scanning that for operators (or tried to access null variables before).
3806 * assign.cs (Assign::Emit): Handle instance and static fields.
3810 * driver.cs: Stop compilation if there are parse errors.
3812 * cs-parser.jay (constructor_declaration): Provide default base
3813 initializer for non-static constructors.
3814 (constructor_declarator): Do not provide a default base
3815 initializers if none was specified.
3816 Catch the fact that constructors should not have parameters.
3818 * class.cs: Do not emit parent class initializers for static
3819 constructors, that should be flagged as an error.
3821 2001-09-18 Ravi Pratap <ravi@ximian.com>
3823 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
3824 Move back code into TypeContainer::Populate.
3826 2001-09-18 Ravi Pratap <ravi@ximian.com>
3828 * class.cs (TypeContainer::AddConstructor): Fix the check to
3829 compare against Name, not Basename.
3830 (Operator::OpType): Change Plus and Minus to Add and Subtract.
3832 * cs-parser.jay : Update accordingly.
3834 * class.cs (TypeContainer::FindMembers): For the case where we are searching
3835 for methods, don't forget to look into the operators too.
3836 (RegisterMethodBuilder): Helper method to take care of this for
3837 methods, constructors and operators.
3838 (Operator::Define): Completely revamp.
3839 (Operator.OperatorMethod, MethodName): New fields.
3840 (TypeContainer::Populate): Move the registering of builders into
3841 RegisterMethodBuilder.
3842 (Operator::Emit): Re-write.
3844 * expression.cs (Binary::Emit): Comment out code path to emit method
3845 invocation stuff for the case when we have a user defined operator. I am
3846 just not able to get it right !
3848 2001-09-17 Miguel de Icaza <miguel@ximian.com>
3850 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
3853 (Expression::MemberLookup): Provide a version that allows to
3854 specify the MemberTypes and BindingFlags.
3856 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
3857 so it was not fetching variable information from outer blocks.
3859 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
3860 Beforefieldinit as it was buggy.
3862 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
3865 * class.cs (Constructor::Emit): Only emit if block is not null.
3866 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
3867 deal with this by semantically definining it as if the user had
3870 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
3871 constructors as we now "emit" them at a higher level.
3873 (TypeContainer::DefineDefaultConstructor): Used to define the
3874 default constructors if none was provided.
3876 (ConstructorInitializer): Add methods Resolve and Emit.
3878 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
3880 2001-09-17 Ravi Pratap <ravi@ximian.com>
3882 * class.cs (TypeContainer::EmitDefaultConstructor): Register
3883 the default constructor builder with our hashtable for methodbuilders
3886 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
3887 and argument_count is 0 in which case we have a match.
3888 (Binary::ResolveOperator): More null checking and miscellaneous coding
3891 2001-09-17 Ravi Pratap <ravi@ximian.com>
3893 * rootcontext.cs (IsNameSpace): Compare against null.
3895 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
3897 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
3898 and Unary::Operator.
3900 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
3903 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
3904 we have overloaded operators.
3905 (Binary::ResolveOperator): Implement the part which does the operator overload
3908 * class.cs (Operator::Emit): Implement.
3909 (TypeContainer::Emit): Emit the operators we have too.
3911 * expression.cs (Binary::Emit): Update to emit the appropriate code for
3912 the case when we have a user-defined operator.
3914 2001-09-17 Miguel de Icaza <miguel@ximian.com>
3916 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
3918 2001-09-16 Ravi Pratap <ravi@ximian.com>
3920 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
3921 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
3922 (Constructor::Emit): Implement.
3923 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
3924 if we have no work to do.
3925 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
3928 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
3929 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
3931 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
3934 2001-09-15 Ravi Pratap <ravi@ximian.com>
3936 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
3938 (Tree::RecordNamespace): Method to do what the name says ;-)
3939 (Tree::Namespaces): Property to get at the namespaces hashtable.
3941 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
3944 * rootcontext.cs (IsNamespace): Fixed it :-)
3946 2001-09-14 Miguel de Icaza <miguel@ximian.com>
3948 * class.cs (TypeContainer::FindMembers): Add support for
3950 (MethodCore): New class that encapsulates both the shared aspects
3951 of a Constructor and a Method.
3952 (Method, Constructor): Factored pieces into MethodCore.
3954 * driver.cs: Added --fatal which makes errors throw exceptions.
3955 Load System assembly as well as part of the standard library.
3957 * report.cs: Allow throwing exceptions on errors for debugging.
3959 * modifiers.cs: Do not use `parent', instead use the real type
3960 container to evaluate permission settings.
3962 * class.cs: Put Ravi's patch back in. He is right, and we will
3963 have to cope with the
3965 2001-09-14 Ravi Pratap <ravi@ximian.com>
3967 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
3968 FamORAssem, not FamANDAssem.
3970 2001-09-14 Miguel de Icaza <miguel@ximian.com>
3972 * driver.cs: Added --parse option that only parses its input files
3975 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
3976 incorrect. IsTopLevel is not used to tell whether an object is
3977 root_types or not (that can be achieved by testing this ==
3978 root_types). But to see if this is a top-level *class* (not
3979 necessarly our "toplevel" container).
3981 2001-09-14 Ravi Pratap <ravi@ximian.com>
3983 * enum.cs (Enum::Define): Modify to call the Lookup method on the
3984 parent instead of a direct call to GetType.
3986 2001-09-14 Ravi Pratap <ravi@ximian.com>
3988 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
3989 Modifiers.TypeAttr. This should just be a call to that method.
3991 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
3992 object so that we can determine if we are top-level or not.
3994 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
3997 * enum.cs (Enum::Define): Ditto.
3999 * modifiers.cs (FieldAttr): Re-write.
4001 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
4002 (TypeContainer::HaveStaticConstructor): New property to provide access
4003 to precisely that info.
4005 * modifiers.cs (MethodAttr): Re-write.
4006 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
4008 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
4009 of top-level types as claimed.
4011 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4013 * expression.cs (MemberLookup): Fruitless attempt to lookup
4014 constructors. Maybe I need to emit default constructors? That
4015 might be it (currently .NET emits this for me automatically).
4016 (Invocation::OverloadResolve): Cope with Arguments == null.
4017 (Invocation::EmitArguments): new function, shared by the new
4019 (Invocation::Emit): Handle static and instance methods. Emit
4020 proper call instruction for virtual or non-virtual invocations.
4021 (New::Emit): Implement.
4022 (New::Resolve): Implement.
4023 (MemberAccess:Resolve): Implement.
4024 (MethodGroupExpr::InstanceExpression): used conforming to the spec
4026 (FieldExpr::Resolve): Set type.
4028 * support.cs: Handle empty arguments.
4030 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
4031 SimpleLookup): Auxiliary routines to help parse a qualifier
4034 Update qualifier_identifier rule.
4036 * codegen.cs: Removed debugging messages.
4038 * class.cs: Make this a global thing, this acts just as a "key" to
4039 objects that we might have around.
4041 (Populate): Only initialize method_builders_to_methods once.
4043 * expression.cs (PropertyExpr): Initialize type from the
4046 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
4047 Resolve pattern. Attempt to implicitly convert value to boolean.
4050 * expression.cs: Set the type for the int32/int32 argument case.
4051 (Binary::ResolveOperator): Set the return type to boolean for
4052 comparission operators
4054 * typemanager.cs: Remove debugging print code.
4056 (Invocation::Resolve): resolve type.
4058 * class.cs: Allocate a MemberInfo of the correct size, as the code
4059 elsewhere depends on the test to reflect the correct contents.
4061 (Method::) Keep track of parameters, due to System.Reflection holes
4063 (TypeContainer::Populate): Keep track of MethodBuilders to Method
4066 (TypeContainer::FindMembers): Use ArrayList and then copy an array
4067 of the exact size and return that.
4069 (Class::LookupMethodByBuilder): New function that maps
4070 MethodBuilders to its methods. Required to locate the information
4071 on methods because System.Reflection bit us again.
4073 * support.cs: New file, contains an interface ParameterData and
4074 two implementations: ReflectionParameters and InternalParameters
4075 used to access Parameter information. We will need to grow this
4078 * expression.cs (Invocation::GetParameterData): implement a cache
4079 and a wrapper around the ParameterData creation for methods.
4080 (Invocation::OverloadResolve): Use new code.
4082 2001-09-13 Ravi Pratap <ravi@ximian.com>
4084 * class.cs (TypeContainer::EmitField): Remove and move into
4085 (Field::Define): here and modify accordingly.
4086 (Field.FieldBuilder): New member.
4087 (TypeContainer::Populate): Update accordingly.
4088 (TypeContainer::FindMembers): Implement.
4090 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4092 * statement.cs: (VariableInfo::VariableType): New field to be
4093 initialized with the full type once it is resolved.
4095 2001-09-12 Miguel de Icaza <miguel@ximian.com>
4097 * parameter.cs (GetParameterInfo): Use a type cache to compute
4098 things only once, and to reuse this information
4100 * expression.cs (LocalVariableReference::Emit): Implement.
4101 (OpcodeCast::Emit): fix.
4103 (ParameterReference::Resolve): Implement.
4104 (ParameterReference::Emit): Implement.
4106 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
4107 that are expressions need to stay as Expressions.
4109 * typemanager.cs (CSharpName): Returns the C# name of a type if
4112 * expression.cs (Expression::ConvertImplicit): New function that
4113 implements implicit type conversions.
4115 (Expression::ImplicitReferenceConversion): Implements implicit
4116 reference conversions.
4118 (EmptyCast): New type for transparent casts.
4120 (OpcodeCast): New type for casts of types that are performed with
4121 a sequence of bytecodes.
4123 (BoxedCast): New type used for casting value types into reference
4124 types. Emits a box opcode.
4126 (Binary::DoNumericPromotions): Implements numeric promotions of
4127 and computation of the Binary::Type.
4129 (Binary::EmitBranchable): Optimization.
4131 (Binary::Emit): Implement code emission for expressions.
4133 * typemanager.cs (TypeManager): Added two new core types: sbyte
4136 2001-09-12 Ravi Pratap <ravi@ximian.com>
4138 * class.cs (TypeContainer::FindMembers): Method which does exactly
4139 what Type.FindMembers does, only we don't have to use reflection. No
4142 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
4143 typecontainer objects as we need to get at them.
4144 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
4146 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
4147 typecontainer object.
4149 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
4150 of just a Report object.
4152 2001-09-11 Ravi Pratap <ravi@ximian.com>
4154 * class.cs (Event::Define): Go back to using the prefixes "add_" and
4156 (TypeContainer::Populate): Now define the delegates of the type too.
4157 (TypeContainer.Delegates): Property to access the list of delegates defined
4160 * delegates.cs (Delegate::Define): Implement partially.
4162 * modifiers.cs (TypeAttr): Handle more flags.
4164 2001-09-11 Ravi Pratap <ravi@ximian.com>
4166 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
4168 (Operator::Define): Re-write logic to get types by using the LookupType method
4169 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
4170 (Indexer::Define): Ditto.
4171 (Event::Define): Ditto.
4172 (Property::Define): Ditto.
4174 2001-09-10 Ravi Pratap <ravi@ximian.com>
4176 * class.cs (TypeContainer::Populate): Now define operators too.
4177 (TypeContainer.Operators): New property to access the list of operators
4179 (Operator.OperatorMethodBuilder): New member to hold the method builder
4180 for the operator we are defining.
4181 (Operator::Define): Implement.
4183 2001-09-10 Ravi Pratap <ravi@ximian.com>
4185 * class.cs (Event::Define): Make the prefixes of the accessor methods
4186 addOn_ and removeOn_
4188 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
4189 of the location being passed in too. Ideally, this should go later since all
4190 error reporting should be done through the Report object.
4192 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
4193 (Populate): Iterate thru the indexers we have and define them too.
4194 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
4195 for the get and set accessors.
4196 (Indexer::Define): Implement.
4198 2001-09-09 Miguel de Icaza <miguel@ximian.com>
4200 * expression.cs (Binary::Resolve): Beginning of it. I scratched
4201 my previous implementation, did not work.
4203 * typemanager.cs: Add a couple of missing types (the longs).
4205 * literal.cs: Use TypeManager.bool_type instead of getting it.
4207 * expression.cs (EventExpr): New kind of expressions.
4208 (Expressio::ExprClassFromMemberInfo): finish
4210 2001-09-08 Miguel de Icaza <miguel@ximian.com>
4212 * assign.cs: Emit stores to static fields differently.
4214 2001-09-08 Ravi Pratap <ravi@ximian.com>
4216 * Merge in changes and adjust code to tackle conflicts. Backed out my
4217 code in Assign::Resolve ;-)
4219 2001-09-08 Ravi Pratap <ravi@ximian.com>
4221 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
4222 instead Report.Error and also pass in the location.
4223 (CSharpParser::Lexer): New readonly property to return the reference
4224 to the Tokenizer object.
4225 (declare_local_variables): Use Report.Error with location instead of plain
4229 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
4230 (Operator.CheckBinaryOperator): Ditto.
4232 * cs-parser.jay (operator_declarator): Update accordingly.
4234 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
4235 (CheckBinaryOperator): Same here.
4237 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
4238 on the name without any prefixes of namespace names etc. This is because we
4239 already might have something already fully qualified like
4240 'System.Console.WriteLine'
4242 * assign.cs (Resolve): Begin implementation. Stuck ;-)
4244 2001-09-07 Ravi Pratap <ravi@ximian.com>
4246 * cs-tokenizer.cs (location): Return a string which also contains
4249 * expression.cs (ElementAccess): New class for expressions of the
4250 type 'element access.'
4251 (BaseAccess): New class for expressions of the type 'base access.'
4252 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
4255 * cs-parser.jay (element_access): Implement action.
4256 (base_access): Implement actions.
4257 (checked_expression, unchecked_expression): Implement.
4259 * cs-parser.jay (local_variable_type): Correct and implement.
4260 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
4262 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
4264 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
4265 name and the specifiers.
4267 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
4269 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
4270 making them all public ;-)
4272 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
4275 2001-09-07 Miguel de Icaza <miguel@ximian.com>
4277 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
4279 (FieldExpr, PropertyExprs): New resolved expressions.
4280 (SimpleName::MemberStaticCheck): Perform static checks for access
4281 to non-static fields on static methods. Maybe this should be
4282 generalized for MemberAccesses.
4283 (SimpleName::ResolveSimpleName): More work on simple name
4286 * cs-parser.jay (primary_expression/qualified_identifier): track
4287 the parameter index.
4289 * codegen.cs (CodeGen::Save): Catch save exception, report error.
4290 (EmitContext::EmitBoolExpression): Chain to expression generation
4291 instead of temporary hack.
4292 (::EmitStatementExpression): Put generic expression code generation.
4294 * assign.cs (Assign::Emit): Implement variable assignments to
4295 local variables, parameters and fields.
4297 2001-09-06 Miguel de Icaza <miguel@ximian.com>
4299 * statement.cs (Block::GetVariableInfo): New method, returns the
4300 VariableInfo for a variable name in a block.
4301 (Block::GetVariableType): Implement in terms of GetVariableInfo
4303 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
4304 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
4306 2001-09-06 Ravi Pratap <ravi@ximian.com>
4308 * cs-parser.jay (operator_declaration): Continue on my quest : update
4309 to take attributes argument.
4310 (event_declaration): Ditto.
4311 (enum_declaration): Ditto.
4312 (indexer_declaration): Ditto.
4314 * class.cs (Operator::Operator): Update constructor accordingly.
4315 (Event::Event): Ditto.
4317 * delegate.cs (Delegate::Delegate): Same here.
4319 * enum.cs (Enum::Enum): Same here.
4321 2001-09-05 Ravi Pratap <ravi@ximian.com>
4323 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
4325 * ../tests/cs0658.cs : New file to demonstrate error 0658.
4327 * attribute.cs (Attributes): New class to encapsulate all attributes which were
4328 being passed around as an arraylist.
4329 (Attributes::AddAttribute): Method to add attribute sections.
4331 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
4332 (struct_declaration): Update accordingly.
4333 (constant_declaration): Update.
4334 (field_declaration): Update.
4335 (method_header): Update.
4336 (fixed_parameter): Update.
4337 (parameter_array): Ditto.
4338 (property_declaration): Ditto.
4339 (destructor_declaration): Ditto.
4341 * class.cs (Struct::Struct): Update constructors accordingly.
4342 (Class::Class): Ditto.
4343 (Field::Field): Ditto.
4344 (Method::Method): Ditto.
4345 (Property::Property): Ditto.
4346 (TypeContainer::OptAttribute): update property's return type.
4348 * interface.cs (Interface.opt_attributes): New member.
4349 (Interface::Interface): Update to take the extra Attributes argument.
4351 * parameter.cs (Parameter::Parameter): Ditto.
4353 * constant.cs (Constant::Constant): Ditto.
4355 * interface.cs (InterfaceMemberBase): New OptAttributes field.
4356 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
4357 the attributes as a parameter.
4358 (InterfaceProperty): Update constructor call.
4359 (InterfaceEvent): Ditto.
4360 (InterfaceMethod): Ditto.
4361 (InterfaceIndexer): Ditto.
4363 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
4364 pass the attributes too.
4365 (interface_event_declaration): Ditto.
4366 (interface_property_declaration): Ditto.
4367 (interface_method_declaration): Ditto.
4368 (interface_declaration): Ditto.
4370 2001-09-05 Miguel de Icaza <miguel@ximian.com>
4372 * class.cs (Method::Define): Track the "static Main" definition to
4373 create an entry point.
4375 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
4376 EntryPoint if we find it.
4378 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
4379 (EmitContext::ig): Make this variable public.
4381 * driver.cs: Make the default output file be the first file name
4382 with the .exe extension.
4384 Detect empty compilations
4386 Handle various kinds of output targets. Handle --target and
4387 rename -t to --dumper.
4389 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
4390 methods inherited from Expression return now an Expression. This
4391 will is used during the tree rewriting as we resolve them during
4394 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
4395 the spec. Missing entirely is the information about
4396 accessability of elements of it.
4398 (Expression::ExprClassFromMemberInfo): New constructor for
4399 Expressions that creates a fully initialized Expression based on
4400 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
4403 (Invocation::Resolve): Begin implementing resolution of invocations.
4405 * literal.cs (StringLiteral): Implement Emit.
4407 2001-09-05 Ravi Pratap <ravi@ximian.com>
4409 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
4412 2001-09-04 Ravi Pratap <ravi@ximian.com>
4414 * cs-parser.jay (attribute_arguments): Implement actions.
4415 (attribute): Fix bug in production. Implement action.
4416 (attribute_list): Implement.
4417 (attribute_target): Implement.
4418 (attribute_target_specifier, opt_target_specifier): Implement
4419 (CheckAttributeTarget): New method to check if the attribute target
4421 (attribute_section): Implement.
4422 (opt_attributes): Implement.
4424 * attribute.cs : New file to handle attributes.
4425 (Attribute): Class to hold attribute info.
4427 * cs-parser.jay (opt_attribute_target_specifier): Remove production
4428 (attribute_section): Modify production to use 2 different rules to
4429 achieve the same thing. 1 s/r conflict down !
4430 Clean out commented, useless, non-reducing dimension_separator rules.
4432 * class.cs (TypeContainer.attributes): New member to hold list
4433 of attributes for a type.
4434 (Struct::Struct): Modify to take one more argument, the attribute list.
4435 (Class::Class): Ditto.
4436 (Field::Field): Ditto.
4437 (Method::Method): Ditto.
4438 (Property::Property): Ditto.
4440 * cs-parser.jay (struct_declaration): Update constructor call to
4441 pass in the attributes too.
4442 (class_declaration): Ditto.
4443 (constant_declaration): Ditto.
4444 (field_declaration): Ditto.
4445 (method_header): Ditto.
4446 (fixed_parameter): Ditto.
4447 (parameter_array): Ditto.
4448 (property_declaration): Ditto.
4450 * constant.cs (Constant::Constant): Update constructor similarly.
4451 Use System.Collections.
4453 * parameter.cs (Parameter::Parameter): Update as above.
4455 2001-09-02 Ravi Pratap <ravi@ximian.com>
4457 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
4458 (TypeContainer.delegates): New member to hold list of delegates.
4460 * cs-parser.jay (delegate_declaration): Implement the action correctly
4461 this time as I seem to be on crack ;-)
4463 2001-09-02 Miguel de Icaza <miguel@ximian.com>
4465 * rootcontext.cs (RootContext::IsNamespace): new function, used to
4466 tell whether an identifier represents a namespace.
4468 * expression.cs (NamespaceExpr): A namespace expression, used only
4469 temporarly during expression resolution.
4470 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
4471 utility functions to resolve names on expressions.
4473 2001-09-01 Miguel de Icaza <miguel@ximian.com>
4475 * codegen.cs: Add hook for StatementExpressions.
4477 * class.cs: Fix inverted test for static flag in methods.
4479 2001-09-02 Ravi Pratap <ravi@ximian.com>
4481 * class.cs (Operator::CheckUnaryOperator): Correct error number used
4482 to make it coincide with MS' number.
4483 (Operator::CheckBinaryOperator): Ditto.
4485 * ../errors/errors.txt : Remove error numbers added earlier.
4487 * ../errors/cs1019.cs : Test case for error # 1019
4489 * ../errros/cs1020.cs : Test case for error # 1020
4491 * cs-parser.jay : Clean out commented cruft.
4492 (dimension_separators, dimension_separator): Comment out. Ostensibly not
4493 used anywhere - non-reducing rule.
4494 (namespace_declarations): Non-reducing rule - comment out.
4496 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
4497 with TypeContainer::AddEnum.
4499 * delegate.cs : New file for delegate handling classes.
4500 (Delegate): Class for declaring delegates.
4502 * makefile : Update.
4504 * cs-parser.jay (delegate_declaration): Implement.
4506 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
4508 * class.cs (Event::Define): Implement.
4509 (Event.EventBuilder): New member.
4511 * class.cs (TypeContainer::Populate): Update to define all enums and events
4513 (Events): New property for the events arraylist we hold. Shouldn't we move to using
4514 readonly fields for all these cases ?
4516 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4518 * class.cs (Property): Revamp to use the convention of making fields readonly.
4519 Accordingly modify code elsewhere.
4521 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
4522 the Define method of the Property class.
4524 * class.cs : Clean up applied patch and update references to variables etc. Fix
4526 (TypeContainer::Populate): Update to define all the properties we have. Also
4527 define all enumerations.
4529 * enum.cs (Define): Implement.
4531 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4533 * cs-parser.jay (overloadable_operator): The semantic value is an
4534 enum of the Operator class.
4535 (operator_declarator): Implement actions.
4536 (operator_declaration): Implement.
4538 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
4539 validity of definitions.
4540 (Operator::CheckBinaryOperator): Static method to check for binary operators
4541 (TypeContainer::AddOperator): New method to add an operator to a type.
4543 * cs-parser.jay (indexer_declaration): Added line to actually call the
4544 AddIndexer method so it gets added ;-)
4546 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
4547 already taken care of by the MS compiler ?
4549 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4551 * class.cs (Operator): New class for operator declarations.
4552 (Operator::OpType): Enum for the various operators.
4554 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4556 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
4557 ostensibly handle this in semantic analysis.
4559 * cs-parser.jay (general_catch_clause): Comment out
4560 (specific_catch_clauses, specific_catch_clause): Ditto.
4561 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
4562 (catch_args, opt_catch_args): New productions.
4563 (catch_clause): Rewrite to use the new productions above
4564 (catch_clauses): Modify accordingly.
4565 (opt_catch_clauses): New production to use in try_statement
4566 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
4567 and re-write the code in the actions to extract the specific and
4568 general catch clauses by being a little smart ;-)
4570 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
4571 Hooray, try and catch statements parse fine !
4573 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4575 * statement.cs (Block::GetVariableType): Fix logic to extract the type
4576 string from the hashtable of variables.
4578 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
4579 I end up making that mistake ;-)
4580 (catch_clauses): Fixed gross error which made Key and Value of the
4581 DictionaryEntry the same : $1 !!
4583 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4585 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
4587 * cs-parser.jay (event_declaration): Correct to remove the semicolon
4588 when the add and remove accessors are specified.
4590 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4592 * cs-parser.jay (IndexerDeclaration): New helper class to hold
4593 information about indexer_declarator.
4594 (indexer_declarator): Implement actions.
4595 (parsing_indexer): New local boolean used to keep track of whether
4596 we are parsing indexers or properties. This is necessary because
4597 implicit_parameters come into picture even for the get accessor in the
4599 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
4601 * class.cs (Indexer): New class for indexer declarations.
4602 (TypeContainer::AddIndexer): New method to add an indexer to a type.
4603 (TypeContainer::indexers): New member to hold list of indexers for the
4606 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4608 * cs-parser.jay (add_accessor_declaration): Implement action.
4609 (remove_accessor_declaration): Implement action.
4610 (event_accessors_declaration): Implement
4611 (variable_declarators): swap statements for first rule - trivial.
4613 * class.cs (Event): New class to hold information about event
4615 (TypeContainer::AddEvent): New method to add an event to a type
4616 (TypeContainer::events): New member to hold list of events.
4618 * cs-parser.jay (event_declaration): Implement actions.
4620 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4622 * cs-parser.jay (dim_separators): Implement. Make it a string
4623 concatenating all the commas together, just as they appear.
4624 (opt_dim_separators): Modify accordingly
4625 (rank_specifiers): Update accordingly. Basically do the same
4626 thing - instead, collect the brackets here.
4627 (opt_rank_sepcifiers): Modify accordingly.
4628 (array_type): Modify to actually return the complete type string
4629 instead of ignoring the rank_specifiers.
4630 (expression_list): Implement to collect the expressions
4631 (variable_initializer): Implement. We make it a list of expressions
4632 essentially so that we can handle the array_initializer case neatly too.
4633 (variable_initializer_list): Implement.
4634 (array_initializer): Make it a list of variable_initializers
4635 (opt_array_initializer): Modify accordingly.
4637 * expression.cs (New::NType): Add enumeration to help us
4638 keep track of whether we have an object/delegate creation
4639 or an array creation.
4640 (New:NewType, New::Rank, New::Indices, New::Initializers): New
4641 members to hold data about array creation.
4642 (New:New): Modify to update NewType
4643 (New:New): New Overloaded contructor for the array creation
4646 * cs-parser.jay (array_creation_expression): Implement to call
4647 the overloaded New constructor.
4649 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
4651 * class.cs (TypeContainer::Constructors): Return member
4652 constructors instead of returning null.
4654 2001-08-26 Miguel de Icaza <miguel@ximian.com>
4656 * typemanager.cs (InitCoreTypes): Initialize the various core
4657 types after we have populated the type manager with the user
4658 defined types (this distinction will be important later while
4659 compiling corlib.dll)
4661 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
4662 on Expression Classification. Now all expressions have a method
4663 `Resolve' and a method `Emit'.
4665 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
4666 generation from working. Also add some temporary debugging
4669 2001-08-24 Miguel de Icaza <miguel@ximian.com>
4671 * codegen.cs: Lots of code generation pieces. This is only the
4672 beginning, will continue tomorrow with more touches of polish. We
4673 handle the fundamentals of if, while, do, for, return. Others are
4674 trickier and I need to start working on invocations soon.
4676 * gen-treedump.cs: Bug fix, use s.Increment here instead of
4679 * codegen.cs (EmitContext): New struct, used during code
4680 emission to keep a context. Most of the code generation will be
4683 * cs-parser.jay: Add embedded blocks to the list of statements of
4684 this block. So code generation proceeds in a top down fashion.
4686 2001-08-23 Miguel de Icaza <miguel@ximian.com>
4688 * statement.cs: Add support for multiple child blocks.
4690 2001-08-22 Miguel de Icaza <miguel@ximian.com>
4692 * codegen.cs (EmitCode): New function, will emit the code for a
4693 Block of code given a TypeContainer and its ILGenerator.
4695 * statement.cs (Block): Standard public readonly optimization.
4696 (Block::Block constructors): Link children.
4697 (Block::Child): Child Linker.
4698 (Block::EmitVariables): Emits IL variable declarations.
4700 * class.cs: Drop support for MethodGroups here, delay until
4702 (Method::): Applied the same simplification that I did before, and
4703 move from Properties to public readonly fields.
4704 (Method::ParameterTypes): Returns the parameter types for the
4705 function, and implements a cache that will be useful later when I
4706 do error checking and the semantic analysis on the methods is
4708 (Constructor::GetCallingConvention): Renamed from CallingConvetion
4709 and made a method, optional argument tells whether this is a class
4710 or a structure to apply the `has-this' bit.
4711 (Method::GetCallingConvention): Implement, returns the calling
4713 (Method::Define): Defines the type, a second pass is performed
4714 later to populate the methods.
4716 (Constructor::ParameterTypes): implement a cache similar to the
4717 one on Method::ParameterTypes, useful later when we do semantic
4720 (TypeContainer::EmitMethod): New method. Emits methods.
4722 * expression.cs: Removed MethodGroup class from here.
4724 * parameter.cs (Parameters::GetCallingConvention): new method.
4726 2001-08-21 Miguel de Icaza <miguel@ximian.com>
4728 * class.cs (TypeContainer::Populate): Drop RootContext from the
4731 (Constructor::CallingConvention): Returns the calling convention.
4732 (Constructor::ParameterTypes): Returns the constructor parameter
4735 (TypeContainer::AddConstructor): Keep track of default constructor
4736 and the default static constructor.
4738 (Constructor::) Another class that starts using `public readonly'
4739 instead of properties.
4741 (Constructor::IsDefault): Whether this is a default constructor.
4743 (Field::) use readonly public fields instead of properties also.
4745 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
4746 track of static constructors; If none is used, turn on
4747 BeforeFieldInit in the TypeAttributes.
4749 * cs-parser.jay (opt_argument_list): now the return can be null
4750 for the cases where there are no arguments.
4752 (constructor_declarator): If there is no implicit `base' or
4753 `this', then invoke the default parent constructor.
4755 * modifiers.cs (MethodAttr): New static function maps a set of
4756 modifiers flags into a MethodAttributes enum
4757 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
4758 MethodAttr, TypeAttr to represent the various mappings where the
4760 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
4762 2001-08-19 Miguel de Icaza <miguel@ximian.com>
4764 * parameter.cs (GetParameterInfo): Fix bug where there would be no
4767 * interface.cs (PopulateIndexer): Implemented the code generator
4768 for interface indexers.
4770 2001-08-17 Miguel de Icaza <miguel@ximian.com>
4772 * interface.cs (InterfaceMemberBase): Now we track the new status
4775 (PopulateProperty): Implement property population. Woohoo! Got
4776 Methods and Properties going today.
4778 Removed all the properties for interfaces, and replaced them with
4779 `public readonly' fields.
4781 2001-08-16 Miguel de Icaza <miguel@ximian.com>
4783 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
4784 initialize their hashtables/arraylists only when they are needed
4785 instead of doing this always.
4787 * parameter.cs: Handle refs and out parameters.
4789 * cs-parser.jay: Use an ArrayList to construct the arguments
4790 instead of the ParameterCollection, and then cast that to a
4793 * parameter.cs: Drop the use of ParameterCollection and use
4794 instead arrays of Parameters.
4796 (GetParameterInfo): Use the Type, not the Name when resolving
4799 2001-08-13 Miguel de Icaza <miguel@ximian.com>
4801 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
4802 and instead use public readonly fields.
4804 * class.cs: Put back walking code for type containers.
4806 2001-08-11 Miguel de Icaza <miguel@ximian.com>
4808 * class.cs (MakeConstant): Code to define constants.
4810 * rootcontext.cs (LookupType): New function. Used to locate types
4813 2001-08-08 Miguel de Icaza <miguel@ximian.com>
4815 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
4816 this System.Reflection code is. Kudos to Microsoft
4818 * typemanager.cs: Implement a type cache and avoid loading all
4819 types at boot time. Wrap in LookupType the internals. This made
4820 the compiler so much faster. Wow. I rule!
4822 * driver.cs: Make sure we always load mscorlib first (for
4823 debugging purposes, nothing really important).
4825 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
4826 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
4828 * rootcontext.cs: Lookup types on their namespace; Lookup types
4829 on namespaces that have been imported using the `using' keyword.
4831 * class.cs (TypeContainer::TypeAttr): Virtualize.
4832 (Class::TypeAttr): Return attributes suitable for this bad boy.
4833 (Struct::TypeAttr): ditto.
4834 Handle nested classes.
4835 (TypeContainer::) Remove all the type visiting code, it is now
4836 replaced with the rootcontext.cs code
4838 * rootcontext.cs (GetClassBases): Added support for structs.
4840 2001-08-06 Miguel de Icaza <miguel@ximian.com>
4842 * interface.cs, statement.cs, class.cs, parameter.cs,
4843 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
4844 Drop use of TypeRefs, and use strings instead.
4846 2001-08-04 Miguel de Icaza <miguel@ximian.com>
4850 * class.cs (Struct::Struct): set the SEALED flags after
4851 checking the modifiers.
4852 (TypeContainer::TypeAttr): new property, returns the
4853 TypeAttributes for a class.
4855 * cs-parser.jay (type_list): Oops, list production was creating a
4856 new list of base types.
4858 * rootcontext.cs (StdLib): New property.
4859 (GetInterfaceTypeByName): returns an interface by type name, and
4860 encapsulates error handling here.
4861 (GetInterfaces): simplified.
4862 (ResolveTree): Encapsulated all the tree resolution here.
4863 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
4866 * driver.cs: Add support for --nostdlib, to avoid loading the
4868 (Main): Do not put tree resolution here.
4870 * rootcontext.cs: Beginning of the class resolution.
4872 2001-08-03 Miguel de Icaza <miguel@ximian.com>
4874 * rootcontext.cs: Provide better error reporting.
4876 * cs-parser.jay (interface_base): set our $$ to be interfaces.
4878 * rootcontext.cs (CreateInterface): Handle the case where there
4879 are no parent interfaces.
4881 (CloseTypes): Routine to flush types at the end.
4882 (CreateInterface): Track types.
4883 (GetInterfaces): Returns an array of Types from the list of
4886 * typemanager.c (AddUserType): Mechanism to track user types (puts
4887 the type on the global type hash, and allows us to close it at the
4890 2001-08-02 Miguel de Icaza <miguel@ximian.com>
4892 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
4893 RecordInterface instead.
4895 * cs-parser.jay: Updated to reflect changes above.
4897 * decl.cs (Definition): Keep track of the TypeBuilder type that
4898 represents this type here. Not sure we will use it in the long
4899 run, but wont hurt for now.
4901 * driver.cs: Smaller changes to accomodate the new code.
4903 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
4906 * rootcontext.cs (CreateInterface): New method, used to create
4907 the System.TypeBuilder type for interfaces.
4908 (ResolveInterfaces): new entry point to resolve the interface
4910 (CodeGen): Property, used to keep track of the code generator.
4912 2001-07-26 Miguel de Icaza <miguel@ximian.com>
4914 * cs-parser.jay: Add a second production for delegate_declaration
4917 (enum_body): Put an opt_comma here instead of putting it on
4918 enum_body or enum_member_declarations so we can handle trailing
4919 commas on enumeration members. Gets rid of a shift/reduce.
4921 (type_list): Need a COMMA in the middle.
4923 (indexer_declaration): Tell tokenizer to recognize get/set
4925 * Remove old targets.
4927 * Re-add the parser target.
4929 2001-07-13 Simon Cozens <simon@simon-cozens.org>
4931 * cs-parser.jay: Add precendence rules for a number of operators
4932 ot reduce the number of shift/reduce conflicts in the grammar.
4934 2001-07-17 Miguel de Icaza <miguel@ximian.com>
4936 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
4939 Get rid of old crufty code.
4941 * rootcontext.cs: Use this to keep track of the parsed
4942 representation and the defined types available to the program.
4944 * gen-treedump.cs: adjust for new convention.
4946 * type.cs: Split out the type manager, and the assembly builder
4949 * typemanager.cs: the type manager will live here now.
4951 * cil-codegen.cs: And the code generator here.
4953 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
4955 * makefile: Fixed up for easy making.
4957 2001-07-13 Simon Cozens <simon@simon-cozens.org>
4959 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
4962 (unary_expression): Expand pre_increment_expression and
4963 post_decrement_expression to reduce a shift/reduce.
4965 2001-07-11 Simon Cozens
4967 * cs-tokenizer.cs: Hex numbers should begin with a 0.
4969 Improve allow_keyword_as_indent name.
4971 2001-06-19 Miguel de Icaza <miguel@ximian.com>
4973 * Adjustments for Beta2.
4975 2001-06-13 Miguel de Icaza <miguel@ximian.com>
4977 * decl.cs: Added `Define' abstract method.
4978 (InTransit): new property, used to catch recursive definitions.
4980 * interface.cs: Implement `Define'.
4982 * modifiers.cs: Map Modifiers.constants to
4983 System.Reflection.TypeAttribute flags.
4985 * class.cs: Keep track of types and user-defined types.
4986 (BuilderInit): New method for creating an assembly
4987 (ResolveType): New function to launch the resolution process, only
4988 used by interfaces for now.
4990 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
4991 that are inserted into the name space.
4993 2001-06-08 Miguel de Icaza <miguel@ximian.com>
4995 * ARGH. I have screwed up my tree so many times due to the use of
4996 rsync rather than using CVS. Going to fix this at once.
4998 * driver.cs: Objetify driver. Load assemblies, use assemblies to
5001 2001-06-07 Miguel de Icaza <miguel@ximian.com>
5003 * Experiment successful: Use System.Type rather that our own
5006 2001-05-25 Miguel de Icaza <miguel@ximian.com>
5008 * cs-parser.jay: Removed nsAliases from here.
5010 Use new namespaces, handle `using XXX;'
5012 * namespace.cs: Reimplemented namespace handling, use a recursive
5013 definition of the class. Now we can keep track of using clauses
5014 and catch invalid using clauses.
5016 2001-05-24 Miguel de Icaza <miguel@ximian.com>
5018 * gen-treedump.cs: Adapted for all the renaming.
5020 * expression.cs (Expression): this class now has a Type property
5021 which returns an expression Type.
5023 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
5024 `Type', as this has a different meaning now in the base
5026 2001-05-22 Miguel de Icaza <miguel@ximian.com>
5028 * interface.cs, class.cs: Removed from all the sources the
5029 references to signature computation, as we can not do method
5030 signature computation during the parsing time, as we are not
5031 trying to solve at that point distinguishing:
5035 void a (NS.Blah x) {}
5038 Which depending on the context might be valid or not, as we do not
5039 know if Blah is the same thing as NS.Blah at that point.
5041 * Redid everything so the code uses TypeRefs now instead of
5042 Types. TypeRefs are just temporary type placeholders, that need
5043 to be resolved. They initially have a pointer to a string and the
5044 current scope in which they are used. This is used later by the
5045 compiler to resolve the reference to an actual Type.
5047 * DeclSpace is no longer a CIR.Type, and neither are
5048 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
5049 are all DeclSpaces, but no Types.
5051 * type.cs (TypeRefManager): This implements the TypeRef manager,
5052 which keeps track of all the types that need to be resolved after
5053 the parsing has finished.
5055 2001-05-13 Miguel de Icaza <miguel@ximian.com>
5057 * ARGH. We are going to have to store `foreach' as a class rather
5058 than resolving it, as we need to verify error 1579 after name
5059 resolution. *OR* we could keep a flag that says `This request to
5060 IEnumerator comes from a foreach statement' which we can then use
5061 to generate the error.
5063 2001-05-10 Miguel de Icaza <miguel@ximian.com>
5065 * class.cs (TypeContainer.AddMethod): we now add methods to the
5066 MethodGroup instead of the method hashtable.
5068 * expression.cs: Add MethodGroup abstraction, which gets us one
5069 step closer to the specification in the way we handle method
5072 * cs-parser.jay (primary_expression): qualified_identifier now
5073 tried to match up an identifier to a local variable reference or
5074 to a parameter reference.
5076 current_local_parameters is now a parser global variable that
5077 points to the current parameters for the block, used during name
5080 (property_declaration): Now creates an implicit `value' argument to
5083 2001-05-09 Miguel de Icaza <miguel@ximian.com>
5085 * parameter.cs: Do not use `param' arguments as part of the
5086 signature, per the spec.
5088 2001-05-08 Miguel de Icaza <miguel@ximian.com>
5090 * decl.cs: Base class for classes, structs and interfaces. This
5091 is the "Declaration Space"
5093 * cs-parser.jay: Use CheckDef for checking declaration errors
5094 instead of having one on each function.
5096 * class.cs: Factor out some code for handling error handling in
5097 accordance to the "Declarations" section in the "Basic Concepts"
5098 chapter in the ECMA C# spec.
5100 * interface.cs: Make all interface member classes derive from
5101 InterfaceMemberBase.
5103 2001-05-07 Miguel de Icaza <miguel@ximian.com>
5105 * Many things: all interfaces are parsed and generated in
5106 gen-treedump. Support for member variables, constructors,
5107 destructors, properties, constants is there.
5109 Beginning of the IL backend, but very little done, just there for
5112 2001-04-29 Miguel de Icaza <miguel@ximian.com>
5114 * cs-parser.jay: Fix labeled statement.
5116 * cs-tokenizer.cs (escape): Escape " and ' always.
5117 ref_line, ref_name: keep track of the line/filename as instructed
5118 by #line by the compiler.
5121 2001-04-27 Miguel de Icaza <miguel@ximian.com>
5123 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
5124 to match the values in System.CodeDOM.
5126 Divid renamed to Divide.
5128 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
5130 (Statements.set): remove.
5132 * System.CodeDOM/CodeCatchClause.cs: always have a valid
5135 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
5136 falseStatements always have valid values.
5138 * cs-parser.jay: Use System.CodeDOM now.