1 2002-01-24 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs (ComposedCast): report an error if a pointer cast
4 is used in a safe region.
6 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7 pointer type casts in unsafe context.
9 * codegen.cs (EmitContext): Set up IsUnsafe.
11 * cs-parser.jay (non_expression_type): Add productions for pointer
14 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
15 code. We should not use force into static mode if the method is
16 not virtual. Fixes bug in MIS
18 * statement.cs (Do.Emit, While.Emit, For.Emit,
19 Statement.EmitBoolExpression): Add support to Do and While to
20 propagate infinite loop as `I do return' semantics.
22 Improve the For case to also test for boolean constants.
24 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
25 to the list of attributes we can add.
27 Remove `EmitContext' argument.
29 * class.cs (Method.Define): Apply parameter attributes.
30 (Constructor.Define): Apply parameter attributes.
31 (MethodCore.LabelParameters): Move here the core of labeling
34 * support.cs (ReflectionParameters.ParameterModifier,
35 InternalParameters.ParameterModifier): Use IsByRef on the type and
36 only return the OUT bit for these parameters instead of in/out/ref
39 This is because I miss-understood things. The ParameterInfo.IsIn
40 and IsOut represent whether the parameter has the [In] and [Out]
43 2002-01-22 Miguel de Icaza <miguel@ximian.com>
45 * ecore.cs (FieldExpr.Emit): Release temporaries.
47 * assign.cs (LocalTemporary.Release): new function.
49 * codegen.cs (EmitContext.GetTemporaryStorage,
50 EmitContext.FreeTemporaryStorage): Rework the way we deal with
51 temporary storage. Now we can "put back" localbuilders when we
54 2002-01-21 Miguel de Icaza <miguel@ximian.com>
56 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
57 need to make a copy of the variable to generate verifiable code.
59 2002-01-19 Miguel de Icaza <miguel@ximian.com>
61 * driver.cs: Compute dynamically the system directory.
63 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
64 Slower, but more generally useful. Used by the abstract
65 registering implementation.
67 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
68 the rules for the special rule on Type/instances. First check if
69 we have the same name, and if so, try that special static path
70 rather than the instance path.
72 2002-01-18 Miguel de Icaza <miguel@ximian.com>
74 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
77 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
78 Enum, ValueType, Delegate or Array for non-corlib compiles.
80 * cs-tokenizer.cs: Catch long identifiers (645)
82 * typemanager.cs (IndexerPropetyName): Ravi never tested this
85 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
86 fix, we were returning too early, so we were not registering
87 pending methods from abstract classes.
89 Do not register pending methods if the class is abstract.
91 * expression.cs (Conditional.DoResolve): Report circular implicit
92 conversions when we neecd to compute it for conditional
95 (Is.DoResolve): If the expression is always of the provided type,
96 flag warning 183. If the expression can not ever be of the
97 provided type flag warning 184.
99 * class.cs: Catch 169 as well.
101 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
104 2002-01-18 Nick Drochak <ndrochak@gol.com>
106 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
108 2002-01-17 Miguel de Icaza <miguel@ximian.com>
110 * interface.cs: (PopulateMethod): Check for pointers being defined
111 only if the unsafe context is active.
112 (PopulateProperty): ditto.
113 (PopulateIndexer): ditto.
115 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
116 specified. If pointers are present, make sure that they are
117 present in an unsafe context.
118 (Constructor, Constructor.Define): ditto.
119 (Field, Field.Define): ditto.
120 (Property, Property.Define): ditto.
121 (Event, Event.Define): ditto.
123 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
124 hashtable if there are classes or structs defined.
126 * expression.cs (LocalVariableReference.DoResolve): Simplify this
127 code, as the constant resolution moved.
129 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
130 the metadata, so we can flag error 133.
132 * decl.cs (MemberCore.UnsafeOK): New function to test that a
133 pointer is being declared in an unsafe context.
135 2002-01-16 Miguel de Icaza <miguel@ximian.com>
137 * modifiers.cs (Modifiers.Check): Require a Location argument.
138 Report error 227 for Unsafe use.
140 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
142 * statement.cs (For.Emit): If the test is null, then report that
143 we do `return', as we wont reach anything afterwards.
145 (Switch.SwitchGoverningType): Track the expression that matched
148 * driver.cs: Allow negative numbers as an error code to flag.
150 * cs-parser.jay: Handle 1551.
152 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
154 2002-01-15 Miguel de Icaza <miguel@ximian.com>
156 * cs-parser.jay: Report 1518 (type declaration can only contain
157 class, struct, interface, enum or delegate)
159 (switch_label): Report 1523 (keywords `case' or `default' must
162 (opt_switch_sections): Report 1522 (empty switch)
164 * driver.cs: Report 1515 (response file specified multiple times)
165 Report 1516 (Source file specified multiple times).
167 * expression.cs (Argument.Resolve): Signal 1510
169 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
170 access not allowed in static code)
172 2002-01-11 Ravi Pratap <ravi@ximian.com>
174 * typemanager.cs (IsPointerType): Utility method which we are going
177 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
178 the object type, so we take care of that.
180 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
182 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
183 added to non-params parameters :-)
185 * typemanager.cs (CSharpName): Include 'void' type too.
187 (void_ptr_type): Include in the set of core types.
189 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
192 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
195 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
196 completely forgotten about it.
198 2002-01-10 Ravi Pratap <ravi@ximian.com>
200 * cs-parser.jay (pointer_type): Add. This begins our implementation
201 of parsing rules for unsafe code.
203 (unsafe_statement): Implement.
205 (embedded_statement): Modify to include the above.
207 * statement.cs (Unsafe): Implement new class for unsafe blocks.
209 * codegen.cs (EmitContext.InUnsafe): Add. This determines
210 if the current context is an unsafe one.
212 * cs-parser.jay (local_variable_pointer_type): Since local variable types
213 are handled differently, we need separate rules for them.
215 (local_variable_declaration): Update to use local_variable_pointer_type
216 to allow variable declarations of unmanaged pointer types.
218 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
221 * ../errors/cs0214.cs : Add.
223 2002-01-16 Nick Drochak <ndrochak@gol.com>
225 * makefile: remove 'response' file when cleaning.
227 2002-01-15 Miguel de Icaza <miguel@ximian.com>
229 * cs-parser.jay: Report 1524.
231 2002-01-14 Miguel de Icaza <miguel@ximian.com>
233 * typemanager.cs (RegisterMethod): drop checking if we have
234 registered this from here
236 2002-01-12 Miguel de Icaza <miguel@ximian.com>
238 * class.cs (Method.EmitDestructor): Implement calling our base
241 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
244 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
245 this routine and will wrap the call in a try/catch block. Deal
248 2002-01-11 Miguel de Icaza <miguel@ximian.com>
250 * ecore.cs (Expression.MemberLookup): instead of taking a
251 parameter `same_type' that was used to tell whether we could
252 access private members we compute our containing type from the
255 (FieldExpr): Added partial support for volatile fields. This does
256 not work for volatile fields exposed from assemblies, as I can not
257 figure out how to extract the modreq from it.
259 Updated all the source files to use this.
261 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
262 because it is referenced by MemberLookup very often.
264 2002-01-09 Ravi Pratap <ravi@ximian.com>
266 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
267 TypeBuilder.GetCustomAttributes to retrieve what we need.
269 Get rid of redundant default_member_attr_type as this is the same as
270 default_member_type which already exists.
272 * interface.cs, attribute.cs : Update accordingly.
274 2002-01-08 Miguel de Icaza <miguel@ximian.com>
276 * typemanager.cs: Enable IndexerPropertyName again. It does not
277 work for TYpeBuilders though. Ravi, can you please fix this?
279 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
281 * expression.cs (Argument.Emit): Handle the case of ref objects
282 being passed to ref functions;
284 (ParameterReference.EmitLoad): Loads the content of the pointer
285 without dereferencing.
287 2002-01-07 Miguel de Icaza <miguel@ximian.com>
289 * cs-tokenizer.cs: Implemented the pre-processing expressions.
291 2002-01-08 Ravi Pratap <ravi@ximian.com>
293 * class.cs (Indexer.DefineMethod): Incorporate the interface
294 type in the name of the method if we are doing explicit interface
297 * expression.cs (ConversionExists): Remove as it is completely obsolete.
299 (BetterConversion): Fix extremely trivial bug where we were referring to
300 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
303 * ../errors/bug16.cs : Add although we have fixed it.
305 2002-01-07 Miguel de Icaza <miguel@ximian.com>
307 * expression.cs (BaseIndexer): Begin implementation.
309 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
311 * cs-parser.jay (indexer_declarator): Use qualified_identifier
312 production directly to remove a shift/reduce, and implement
313 explicit interface implementation.
315 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
316 after a floating point suffix.
318 * expression.cs (DoNumericPromotions): Improved the conversion for
319 uint/uint. If we have a constant, we avoid doing a typecast to a
322 * class.cs (Indexer): Implement explicit interface implementation
325 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
327 * class.cs: make the default instance constructor public and hidebysig.
329 2001-01-03 Ravi Pratap <ravi@ximian.com>
331 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
332 so we can call it from elsewhere.
334 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
335 we emit it internally if the class has a defined indexer; otherwise the user
336 emits it by decorating the class definition with the DefaultMemberAttribute.
338 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
339 attribute is not used on a type which defines an indexer.
341 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
342 character when we skip whitespace.
344 * ../errors/cs0646.cs : Add.
346 2002-01-03 Miguel de Icaza <miguel@ximian.com>
348 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
351 * makefile: Add practical target `mcs3.exe' which builds the third
354 * expression.cs (New): Fix structures constructor calling.
356 * class.cs (Property, Method, Indexer): Emit Final flag on the
357 method if we are an interface implementation and we are not
360 * ecore.cs (PropertyExpr): New public field `IsBase', tells
361 whether this property is referencing a `base' method.
363 * expression.cs (Invocation.EmitCall): take an extra argument:
364 is_base, this is used to determine whether the `call' or
365 `callvirt' opcode should be used.
368 * delegate.cs: update EmitCall.
370 * class.cs (Method.Define): Set NewSlot for the cases where we are
371 not implementing an interface method.
373 (Property.Define): ditto.
375 2002-01-02 Miguel de Icaza <miguel@ximian.com>
377 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
378 'r'. Allows mcs to parse itself fully.
380 2002-01-02 Ravi Pratap <ravi@ximian.com>
382 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
383 of the number of initializers that require the InitializeArray method.
385 (CheckIndices): Store the Expression in all cases - not the plain value. Also
386 update the above field where necessary.
388 (MakeByteBlob): Update accordingly.
390 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
393 (EmitDynamicInitializers): Update in accordance with the new optimization.
395 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
398 * cs-parser.jay : Fix some glaring errors I introduced.
400 2002-01-01 Ravi Pratap <ravi@ximian.com>
402 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
403 so that we can check for name clashes there too.
405 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
406 for interface indexers.
408 * interfaces.cs (Define): Emit the default member attribute.
410 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
411 variable was being referred to while setting the value ;-)
413 2002-01-01 Miguel de Icaza <miguel@ximian.com>
415 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
416 byte-by-byte information when we know the data is zero.
418 Make the block always a multiple of 4, because
419 DefineInitializedData has a bug.
421 * assign.cs: Fix, we should assign from the temporary, not from
424 * expression.cs (MakeByteBlob): Fix my incorrect code.
426 2001-12-31 Miguel de Icaza <miguel@ximian.com>
428 * typemanager.cs (EnumToUnderlying): This function is used to get
429 the underlying type from an enumeration, because it does not
432 * constant.cs: Use the I4_S form for values between -128 and 127.
434 * statement.cs (Block.LookupLabel): Looks up a label.
435 (Block): Drop support for labeled blocks.
437 (LabeledStatement): New kind of statement that represents a label
440 (Goto): Finally implement this bad boy.
442 * cs-parser.jay: Update to reflect new mechanism to implement
445 2001-12-30 Miguel de Icaza <miguel@ximian.com>
447 * codegen.cs (EmitContext.This): a codegen property that keeps the
448 a single instance of this instead of creating many different this
451 * delegate.cs (Delegate.DoResolve): Update to use the property;
453 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
455 * expression.cs (BaseAccess.DoResolve): Ditto.
457 2001-12-29 Ravi Pratap <ravi@ximian.com>
459 * typemanager.cs (methodimpl_attr_type): Add to hold the type
460 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
462 (InitCoreTypes): Update accordingly.
464 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
465 so we can quickly store the state.
467 (ApplyAttributes): Set the correct implementation flags
468 for InternalCall methods.
470 2001-12-29 Miguel de Icaza <miguel@ximian.com>
472 * expression.cs (EmitCall): if a method is not virtual, then do
473 not use callvirt on it.
475 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
476 user defined stuff) requires the use of stobj, which takes an
477 address on the stack instead of an array and an index. So emit
478 the Ldelema operation for it.
480 (EmitStoreOpcode): Use stobj for valuetypes.
482 (UnaryMutator.EmitCode): Use the right 1 value depending on
483 whether we are dealing with int64/uint64, float or doubles.
485 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
486 constructors that I implemented last night.
488 (Constructor.IsDefault): Fix to work properly for static
491 * cs-parser.jay (CheckDef): report method signature errors.
492 Update error number 103 to be 132.
494 * decl.cs: New AdditionResult enumeration value: MethodExists.
495 Although we do this check for methods later on in the semantic
496 analysis, catching repeated default constructors is so easy that
499 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
502 (ParameterReference.EmitAssign, Emit): handle
505 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
506 (ArrayAccess.EmitStoreOpcode): ditto.
508 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
510 * expression.cs (MakeByteBlob): Complete all the missing types
511 (uint, short, ushort, byte, sbyte)
513 * class.cs: Only init instance field initializers on instance
516 Rename `constructors' to instance_constructors.
518 (TypeContainer.AddConstructor): Only add constructors to the list
521 Make sure that we handle default_static_constructor independently
522 everywhere where we handle instance_constructors
524 2001-12-28 Miguel de Icaza <miguel@ximian.com>
526 * class.cs: Do not lookup or create a base initializer for a
529 (ConstructorInitializer.Resolve): use the proper type to lookup
532 * cs-parser.jay: Report error 1585 (modifiers between type and name).
534 * enum.cs, interface.cs: Remove CloseType, this is taken care by
537 * decl.cs: CloseType is now an virtual method, the default
538 implementation just closes this type.
540 2001-12-28 Ravi Pratap <ravi@ximian.com>
542 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
543 to PreserveSig by default. Also emit HideBySig on such methods.
545 Basically, set the defaults to standard values.
547 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
548 argument, if candidate is better, it can't be worse than the best !
550 (Invocation): Re-write bits to differentiate between methods being
551 applicable in their expanded form and their normal form - for params
554 Get rid of use_standard everywhere as only standard conversions are allowed
555 in overload resolution.
557 More spec conformance.
559 2001-12-27 Miguel de Icaza <miguel@ximian.com>
561 * driver.cs: Add --timestamp, to see where the compiler spends
564 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
565 `this' in static code.
567 (SimpleName.DoResolve): Implement in terms of a helper function
568 that allows static-references to be passed upstream to
571 (Expression.ResolveWithSimpleName): Resolve specially simple
572 names when called by MemberAccess to implement the special
575 (Expression.ImplicitReferenceConversion): Handle conversions from
576 Null to reference types before others, as Null's type is
579 * expression.cs (Invocation.EmitCall): Handle the special case of
580 calling methods declared on a reference type from a ValueType
581 (Base classes System.Object and System.Enum)
583 (MemberAccess.Resolve): Only perform lookups on Enumerations if
584 the left hand side is a TypeExpr, not on every enumeration.
586 (Binary.Resolve): If types are reference types, then do a cast to
587 object on operators != and == of both arguments.
589 * typemanager.cs (FindMembers): Extract instance and static
590 members if requested.
592 * interface.cs (PopulateProperty): Use void_type instead of null
593 as the return type for the setter method.
595 (PopulateIndexer): ditto.
597 2001-12-27 Ravi Pratap <ravi@ximian.com>
599 * support.cs (ReflectionParameters): Fix minor bug where we
600 were examining the wrong parameter for the ParamArray attribute.
602 Cope with requests for the type of the parameter at position
603 greater than the params parameter's. We now return the element
604 type of the params array as that makes more sense.
606 * expression.cs (Invocation.IsParamsMethodApplicable): Update
607 accordingly as we no longer have to extract the element type
610 (Invocation.OverloadResolve): Update.
612 2001-12-27 Miguel de Icaza <miguel@ximian.com>
614 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
615 against IEnumerator, test whether the return value is a descendant
616 of the IEnumerator interface.
618 * class.cs (Indexer.Define): Use an auxiliary method to implement
619 the other bits of the method definition. Begin support for
620 explicit interface implementation.
622 (Property.DefineMethod): Use TypeManager.void_type instead of null
623 for an empty return value.
625 2001-12-26 Miguel de Icaza <miguel@ximian.com>
627 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
628 dealing with a FieldExpr which is composed of a FieldBuilder, in
629 the code path we did extract the constant, but we should have
630 obtained the underlying value to be able to cast it (otherwise we
631 end up in an infinite loop, this is what Ravi was running into).
633 (ArrayCreation.UpdateIndices): Arrays might be empty.
635 (MemberAccess.ResolveMemberAccess): Add support for section
636 14.5.4.1 that deals with the special case of E.I when E is a type
637 and something else, that I can be a reference to a static member.
639 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
640 handle a particular array type to create byte blobs, it is just
641 something we dont generate byteblobs for.
643 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
646 * location.cs (Push): remove the key from the hashtable that we
647 are about to add. This happens for empty files.
649 * driver.cs: Dispose files after we have parsed them.
651 (tokenize): new function that only runs the tokenizer on its
652 input, for speed testing.
654 2001-12-26 Ravi Pratap <ravi@ximian.com>
656 * class.cs (Event.Define): Define the private field only if there
657 are no accessors defined.
659 * expression.cs (ResolveMemberAccess): If there is no associated
660 field with the event, that means we have an event defined with its
661 own accessors and we should flag error cs0070 since transforming
662 ourselves into a field is not valid in that case.
664 * ecore.cs (SimpleName.DoResolve): Same as above.
666 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
667 and charset to sane values.
669 2001-12-25 Ravi Pratap <ravi@ximian.com>
671 * assign.cs (DoResolve): Perform check on events only if they
672 are being accessed outside the declaring type.
674 * cs-parser.jay (event_declarations): Update rules to correctly
675 set the type of the implicit parameter etc.
677 (add_accessor, remove_accessor): Set current local parameters.
679 * expression.cs (Binary): For delegate addition and subtraction,
680 cast the return value from the method into the appropriate delegate
683 2001-12-24 Ravi Pratap <ravi@ximian.com>
685 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
686 of these as the workaround is unnecessary.
688 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
689 delegate data - none of that is needed at all.
691 Re-write bits to extract the instance expression and the delegate method
694 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
697 * attribute.cs (ApplyAttributes): New method to take care of common tasks
698 of attaching attributes instead of duplicating code everywhere.
700 * everywhere : Update code to do attribute emission using the above method.
702 2001-12-23 Miguel de Icaza <miguel@ximian.com>
704 * expression.cs (IsParamsMethodApplicable): if there are not
705 parameters, return immediately.
707 * ecore.cs: The 0 literal can be implicity converted to an enum
710 (SimpleName.DoResolve): First lookup the type, then lookup the
713 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
714 want to get its address. If the InstanceExpression is not
715 addressable, store the result in a temporary variable, then get
718 * codegen.cs: Only display 219 errors on warning level or above.
720 * expression.cs (ArrayAccess): Make it implement the
721 IMemoryLocation interface.
723 (Binary.DoResolve): handle the operator == (object a, object b)
724 and operator != (object a, object b) without incurring into a
725 BoxedCast (because 5 != o should never be performed).
727 Handle binary enumerator operators.
729 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
730 value type, otherwise use Ldelem_ref.
732 Use precomputed names;
734 (AddressOf): Implement address of
736 * cs-parser.jay (labeled_statement): Fix recursive block
737 addition by reworking the production.
739 * expression.cs (New.DoEmit): New has a special case:
741 If we are dealing with a ValueType, we have a few
742 situations to deal with:
744 * The target of New is a ValueType variable, that is
745 easy, we just pass this as the variable reference
747 * The target of New is being passed as an argument,
748 to a boxing operation or a function that takes a
751 In this case, we need to create a temporary variable
752 that is the argument of New.
755 2001-12-23 Ravi Pratap <ravi@ximian.com>
757 * rootcontext.cs (LookupType): Check that current_type is not null before
758 going about looking at nested types.
760 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
761 not implement the IAssignMethod interface any more.
763 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
764 where we tranform them into FieldExprs if they are being resolved from within
767 * ecore.cs (SimpleName.DoResolve): Do the same here.
769 * assign.cs (DoResolve, Emit): Clean up code considerably.
771 * ../errors/bug10.cs : Add.
773 * ../errors/cs0070.cs : Add.
775 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
777 * assign.cs : Get rid of EventIsLocal everywhere.
779 2001-12-23 Miguel de Icaza <miguel@ximian.com>
781 * ecore.cs (ConvertIntLiteral): finished the implementation.
783 * statement.cs (SwitchLabel): Convert the value we are using as a
784 key before looking up the table.
786 2001-12-22 Miguel de Icaza <miguel@ximian.com>
788 * codegen.cs (EmitTopBlock): Require a Location argument now.
790 * cs-parser.jay (constructor_declarator): We need to setup
791 current_local_parameters before we parse the
792 opt_constructor_initializer, to allow the variables to be bound
793 to the constructor arguments.
795 * rootcontext.cs (LookupType): First lookup nested classes in our
796 class and our parents before we go looking outside our class.
798 * expression.cs (ConstantFold): Extract/debox the values at the
801 * rootcontext.cs (EmitCode): Resolve the constants first before we
802 resolve the types. This is not really needed, but it helps debugging.
804 * statement.cs: report location.
806 * cs-parser.jay: pass location to throw statement.
808 * driver.cs: Small bug fix.
810 * report.cs: Updated format to be 4-zero filled digits.
812 2001-12-22 Ravi Pratap <ravi@ximian.com>
814 * expression.cs (CheckIndices): Fix minor bug where the wrong
815 variable was being referred to ;-)
817 (DoEmit): Do not call EmitStaticInitializers when the
818 underlying type is System.Object.
820 2001-12-21 Ravi Pratap <ravi@ximian.com>
822 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
823 and do the usual workaround for SRE.
825 * class.cs (MyEventBuilder.EventType): New member to get at the type
826 of the event, quickly.
828 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
830 * assign.cs (Assign.DoResolve): Handle the case when the target
831 is an EventExpr and perform the necessary checks.
833 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
836 (SimpleName.MemberStaticCheck): Include check for EventExpr.
838 (EventExpr): Set the type in the constructor itself since we
839 are meant to be born fully resolved.
841 (EventExpr.Define): Revert code I wrote earlier.
843 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
844 instance expression is null. The instance expression is a This in that case
845 or a null, depending on whether it is a static method or not.
847 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
848 refers to more than one method.
850 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
851 and accordingly flag errors.
853 2001-12-21 Miguel de Icaza <miguel@ximian.com>
855 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
857 2001-12-22 Miguel de Icaza <miguel@ximian.com>
859 * location.cs (ToString): Provide useful rutine.
861 2001-12-21 Miguel de Icaza <miguel@ximian.com>
863 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
864 objects, return the actual integral boxed.
866 * statement.cs (SwitchLabel): define an ILLabel for each
869 (Switch.CheckSwitch): If the value is a Literal, extract
870 the underlying literal.
872 Also in the unused hashtable we had, add the SwitchLabel so we can
873 quickly look this value up.
875 * constant.cs: Implement a bunch of new constants. Rewrite
876 Literal based on this. Made changes everywhere to adapt to this.
878 * expression.cs (Expression.MakeByteBlob): Optimize routine by
879 dereferencing array only once, and also copes with enumrations.
881 bytes are two bytes wide, not one.
883 (Cast): Perform constant conversions.
885 * ecore.cs (TryImplicitIntConversion): Return literals instead of
886 wrappers to the literals here.
888 * expression.cs (DoNumericPromotions): long literals can converted
889 to ulong implicity (this is taken care of elsewhere, but I was
892 * ecore.cs (Expression.Literalize): Make the return type Literal,
893 to improve type checking.
895 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
897 2001-12-20 Miguel de Icaza <miguel@ximian.com>
899 * literal.cs: Revert code from ravi that checked the bounds. The
900 bounds are sane by the definition of the type itself.
902 * typemanager.cs: Fix implementation of ImplementsInterface. We
903 need to actually look up in our parent hierarchy for interfaces
906 * const.cs: Use the underlying type for enumerations
908 * delegate.cs: Compute the basename for the delegate creation,
909 that should fix the delegate test case, and restore the correct
910 Type Lookup semantics in rootcontext
912 * rootcontext.cs: Revert Ravi's last patch. The correct way of
913 referencing a nested type with the Reflection API is using the "+"
916 * cs-parser.jay: Do not require EOF token at the end.
918 2001-12-20 Ravi Pratap <ravi@ximian.com>
920 * rootcontext.cs (LookupType): Concatenate type names with
921 a '.' instead of a '+' The test suite passes again.
923 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
924 field of the enumeration.
926 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
927 the case when the member is an EventExpr.
929 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
930 static has an associated instance expression.
932 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
934 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
936 * class.cs (Event.Define): Register event and perform appropriate checks
939 We define the Add and Remove methods even if the use provides none because
940 in that case, we provide default implementations ourselves.
942 Define a private field of the type of the event. This is done by the CSC compiler
943 and we should be doing it too ;-)
945 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
946 More methods we use in code we generate.
948 (multicast_delegate_type, delegate_type): Two separate types since the distinction
951 (InitCoreTypes): Update accordingly for the above.
953 * class.cs (Event.Emit): Generate code for default accessors that we provide
955 (EmitDefaultMethod): Do the job in the above.
957 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
960 2001-12-20 Miguel de Icaza <miguel@ximian.com>
962 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
963 builders even if we were missing one.
965 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
966 pass the Basename as our class name instead of the Name. The
967 basename will be correctly composed for us.
969 * parameter.cs (Paramters): Now takes a Location argument.
971 * decl.cs (DeclSpace.LookupType): Removed convenience function and
972 make all the code call directly LookupType in RootContext and take
973 this chance to pass the Location information everywhere.
975 * Everywhere: pass Location information.
977 2001-12-19 Miguel de Icaza <miguel@ximian.com>
979 * class.cs (Constructor.Define): Updated way of detecting the
980 length of the parameters.
982 (TypeContainer.DefineType): Use basename as the type name for
985 (TypeContainer.Define): Do not recursively define types here, as
986 definition is taken care in order by the RootContext.
988 * tree.cs: Keep track of namespaces in a per-file basis.
990 * parameter.cs (Parameter.ComputeSignature): Update to use
993 (Parameters.GetSignature): ditto.
995 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
996 instead of a TypeContainer.
998 (Interface.SemanticAnalysis): Use `this' instead of our parent to
999 resolve names. Because we need to be resolve in our context, not
1002 * driver.cs: Implement response files.
1004 * class.cs (TypeContainer.DefineType): If we are defined, do not
1007 (Event.Emit): Emit the code for add/remove handlers.
1008 (Event.Define): Save the MethodBuilders for add/remove.
1010 * typemanager.cs: Use pair here too.
1012 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
1013 DictionaryEntry requires the first argument to be non-null.
1015 (enum_declaration): Compute full name for registering the
1018 (delegate_declaration): Instead of using
1019 formal_parameter_list, use opt_formal_parameter_list as the list
1022 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
1023 (EventParsing): New property that controls whether `add' and
1024 `remove' are returned as tokens or identifiers (for events);
1026 2001-12-19 Ravi Pratap <ravi@ximian.com>
1028 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
1029 use MyEventBuilder only and let it wrap the real builder for us.
1031 (MyEventBuilder): Revamp constructor etc.
1033 Implement all operations that we perform on EventBuilder in precisely the same
1036 (FindMembers): Update to use the EventBuilder member.
1038 (Event.Emit): Update accordingly.
1040 2001-12-18 Ravi Pratap <ravi@ximian.com>
1042 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
1043 by calling the appropriate methods.
1045 (GetCustomAttributes): Make stubs as they cannot possibly do anything
1048 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
1050 2001-12-17 Ravi Pratap <ravi@ximian.com>
1052 * delegate.cs (Delegate.Populate): Check that the return type
1053 and various parameters types are indeed accessible.
1055 * class.cs (Constructor.Define): Same here.
1057 (Field.Define): Ditto.
1059 (Event.Define): Ditto.
1061 (Operator.Define): Check that the underlying Method defined itself
1062 correctly - so it's MethodBuilder should not be null.
1064 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
1065 expression happens to be null.
1067 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
1068 members but as of now we don't seem to be able to do anything really useful with it.
1070 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
1071 not the EventBuilder.
1073 2001-12-18 Miguel de Icaza <miguel@ximian.com>
1075 * cs-tokenizer.cs: Add support for defines.
1076 Add support for #if, #elif, #else, #endif
1078 (eval_var): evaluates a variable.
1079 (eval): stubbed for evaluating functions.
1081 * cs-parser.jay: Pass the defines information
1083 * driver.cs: Add --define command line option.
1085 * decl.cs: Move MemberCore here.
1087 Make it the base class for DeclSpace. This allows us to catch and
1088 report 108 and 109 for everything now.
1090 * class.cs (TypeContainer.Define): Extract all the members
1091 before populating and emit the warning 108 (new keyword required
1092 to override) instead of having each member implement this.
1094 (MemberCore.Define): New abstract method, we will be using this in
1095 the warning reporting engine in Populate.
1097 (Operator.Define): Adjust to new MemberCore protocol.
1099 * const.cs (Const): This does not derive from Expression, it is a
1100 temporary object we use to create fields, it is a MemberCore.
1102 * class.cs (Method.Define): Allow the entry point to be in a
1105 * driver.cs: Rewrite the argument handler to clean it up a bit.
1107 * rootcontext.cs: Made it just an auxiliary namespace feature by
1108 making everything static.
1110 * driver.cs: Adapt code to use RootContext type name instead of
1113 * delegate.cs: Remove RootContext argument.
1115 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
1118 * class.cs (Event.Define): The lookup can fail.
1120 * cs-tokenizer.cs: Begin implementation of pre-procesor.
1122 * expression.cs: Resolve the this instance before invoking the code.
1124 2001-12-17 Miguel de Icaza <miguel@ximian.com>
1126 * cs-parser.jay: Add a production in element_access that allows
1127 the thing to become a "type" reference. This way we can parse
1128 things like "(string [])" as a type.
1130 Note that this still does not handle the more complex rules of
1134 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
1136 * ecore.cs: (CopyNewMethods): new utility function used to
1137 assemble the list of methods from running FindMembers.
1139 (MemberLookup): Rework FindMembers so that
1141 2001-12-16 Miguel de Icaza <miguel@ximian.com>
1143 * class.cs (TypeContainer): Remove Delegates who fail to be
1146 * delegate.cs (Populate): Verify that we dont get null return
1147 values. TODO: Check for AsAccessible.
1149 * cs-parser.jay: Use basename to emit error 574 (destructor should
1150 have the same name as container class), not the full name.
1152 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
1153 possible representation.
1155 Also implements integer type suffixes U and L.
1157 2001-12-15 Miguel de Icaza <miguel@ximian.com>
1159 * expression.cs (ArrayCreation.DoResolve): We need to do the
1160 argument resolution *always*.
1162 * decl.cs: Make this hold the namespace. Hold the root context as
1164 (LookupType): Move here.
1166 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
1168 * location.cs (Row, Name): Fixed the code, it was always returning
1169 references to the first file.
1171 * interface.cs: Register properties defined through interfaces.
1173 * driver.cs: Add support for globbing on the command line
1175 * class.cs (Field): Make it derive from MemberCore as well.
1178 2001-12-15 Ravi Pratap <ravi@ximian.com>
1180 * class.cs (Event::Define): Check that the type of the event is a delegate
1181 type else flag error #66.
1183 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
1186 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
1187 values of EntryPoint, CharSet etc etc.
1189 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
1191 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
1192 be null and we should ignore this. I am not sure if this is really clean. Apparently,
1193 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
1194 which needs this to do its work.
1196 * ../errors/cs0066.cs : Add.
1198 2001-12-14 Miguel de Icaza <miguel@ximian.com>
1200 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
1203 * class.cs: (MethodSignature.MethodSignature): Removed hack that
1204 clears out the parameters field.
1205 (MemberSignatureCompare): Cleanup
1207 (MemberCore): New base class used to share code between MethodCore
1210 (RegisterRequiredImplementations) BindingFlags.Public requires
1211 either BindingFlags.Instace or Static. Use instance here.
1213 (Property): Refactored code to cope better with the full spec.
1215 * parameter.cs (GetParameterInfo): Return an empty array instead
1218 * class.cs (Property): Abstract or extern properties have no bodies.
1220 * parameter.cs (GetParameterInfo): return a zero-sized array.
1222 * class.cs (TypeContainer.MethodModifiersValid): Move all the
1223 method modifier validation to the typecontainer so we can reuse
1226 (MethodCore.ParameterTypes): return an empty sized array of types.
1228 (Property.Define): Test property modifier validity.
1230 Add tests for sealed/override too.
1232 (Method.Emit): abstract or extern methods have no bodies.
1234 2001-12-14 Ravi Pratap <ravi@ximian.com>
1236 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
1239 (Method::Define, ::Emit): Modify accordingly.
1241 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
1243 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
1245 * makefile: Pass in /unsafe.
1247 2001-12-13 Miguel de Icaza <miguel@ximian.com>
1249 * class.cs (MakeKey): Kill routine.
1251 * class.cs (TypeContainer.Define): Correctly define explicit
1252 method implementations (they require the full interface name plus
1255 * typemanager.cs: Deply the PtrHashtable here and stop using the
1256 lame keys. Things work so much better.
1258 This of course broke everyone who depended on `RegisterMethod' to
1259 do the `test for existance' test. This has to be done elsewhere.
1261 * support.cs (PtrHashtable): A hashtable that avoid comparing with
1262 the object stupid Equals method (because, that like fails all over
1263 the place). We still do not use it.
1265 * class.cs (TypeContainer.SetRequiredInterface,
1266 TypeContainer.RequireMethods): Killed these two routines and moved
1267 all the functionality to RegisterRequiredImplementations.
1269 (TypeContainer.RegisterRequiredImplementations): This routine now
1270 registers all the implementations required in an array for the
1271 interfaces and abstract methods. We use an array of structures
1272 which can be computed ahead of time to reduce memory usage and we
1273 also assume that lookups are cheap as most classes will not
1274 implement too many interfaces.
1276 We also avoid creating too many MethodSignatures.
1278 (TypeContainer.IsInterfaceMethod): Update and optionally does not
1279 clear the "pending" bit if we find that there are problems with
1282 (TypeContainer.VerifyPendingMethods): Update to report errors of
1283 methods that look like implementations but are not.
1285 (TypeContainer.Define): Add support for explicit interface method
1288 2001-12-12 Miguel de Icaza <miguel@ximian.com>
1290 * typemanager.cs: Keep track of the parameters here instead of
1291 being a feature of the TypeContainer.
1293 * class.cs: Drop the registration of parameters here, as
1294 InterfaceMethods are also interface declarations.
1296 * delegate.cs: Register methods with the TypeManager not only with
1297 the TypeContainer. This code was buggy.
1299 * interface.cs: Full registation here.
1301 2001-12-11 Miguel de Icaza <miguel@ximian.com>
1303 * expression.cs: Remove reducer for binary expressions, it can not
1306 * const.cs: Put here the code that used to go into constant.cs
1308 * constant.cs: Put here the code for constants, this is a new base
1311 * literal.cs: Make Literal derive from Constant.
1313 2001-12-09 Miguel de Icaza <miguel@ximian.com>
1315 * statement.cs (Return.Emit): Report error 157 if the user
1316 attempts to return from a finally block.
1318 (Return.Emit): Instead of emitting a return, jump to the end of
1321 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
1322 LocalBuilder to store the result of the function. ReturnLabel is
1323 the target where we jump.
1326 2001-12-09 Radek Doulik <rodo@ximian.com>
1328 * cs-parser.jay: remember alias in current namespace
1330 * ecore.cs (SimpleName::DoResolve): use aliases for types or
1333 * class.cs (LookupAlias): lookup alias in my_namespace
1335 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
1337 (LookupAlias): lookup alias in this and if needed in parent
1340 2001-12-08 Miguel de Icaza <miguel@ximian.com>
1344 * rootcontext.cs: (ModuleBuilder) Made static, first step into
1345 making things static. I need this to avoid passing the
1346 TypeContainer when calling ParameterType.
1348 * support.cs (InternalParameters.ParameterType): Remove ugly hack
1349 that did string manipulation to compute the type and then call
1350 GetType. Use Parameter.ParameterType instead.
1352 * cs-tokenizer.cs: Consume the suffix for floating values.
1354 * expression.cs (ParameterReference): figure out whether this is a
1355 reference parameter or not. Kill an extra variable by computing
1356 the arg_idx during emission.
1358 * parameter.cs (Parameters.GetParameterInfo): New overloaded
1359 function that returns whether a parameter is an out/ref value or not.
1361 (Parameter.ParameterType): The type of the parameter (base,
1362 without ref/out applied).
1364 (Parameter.Resolve): Perform resolution here.
1365 (Parameter.ExternalType): The full type (with ref/out applied).
1367 * statement.cs (Using.Emit, Using.EmitExpression): Implement
1368 support for expressions on the using statement.
1370 2001-12-07 Miguel de Icaza <miguel@ximian.com>
1372 * statement.cs (Using.EmitLocalVariableDecls): Split the
1373 localvariable handling of the using statement.
1375 (Block.EmitMeta): Keep track of variable count across blocks. We
1376 were reusing slots on separate branches of blocks.
1378 (Try.Emit): Emit the general code block, we were not emitting it.
1380 Check the type of the declaration to be an IDisposable or
1381 something that can be implicity converted to it.
1383 Emit conversions if required.
1385 * ecore.cs (EmptyExpression): New utility class.
1386 (Expression.ImplicitConversionExists): New utility function.
1388 2001-12-06 Miguel de Icaza <miguel@ximian.com>
1390 * statement.cs (Using): Implement.
1392 * expression.cs (LocalVariableReference): Support read only variables.
1394 * statement.cs: Remove the explicit emit for the Leave opcode.
1395 (VariableInfo): Add a readonly field.
1397 2001-12-05 Miguel de Icaza <miguel@ximian.com>
1399 * ecore.cs (ConvCast): new class used to encapsulate the various
1400 explicit integer conversions that works in both checked and
1403 (Expression.ConvertNumericExplicit): Use new ConvCast class to
1404 properly generate the overflow opcodes.
1406 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1408 * statement.cs: The correct type for the EmptyExpression is the
1409 element_type, not the variable type. Ravi pointed this out.
1411 2001-12-04 Ravi Pratap <ravi@ximian.com>
1413 * class.cs (Method::Define): Handle PInvoke methods specially
1414 by using DefinePInvokeMethod instead of the usual one.
1416 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
1417 above to do the task of extracting information and defining the method.
1419 2001-12-04 Ravi Pratap <ravi@ximian.com>
1421 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
1422 of the condition for string type.
1424 (Emit): Move that here.
1426 (ArrayCreation::CheckIndices): Keep string literals in their expression
1429 (EmitDynamicInitializers): Handle strings appropriately.
1431 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1433 * codegen.cs (EmitContext): Replace multiple variables with a
1434 single pointer to the current Switch statement.
1436 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
1439 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1443 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
1446 (Foreach.Emit): Foreach on arrays was not setting
1447 up the loop variables (for break/continue).
1449 (GotoCase): Semi-implented.
1451 2001-12-03 Ravi Pratap <ravi@ximian.com>
1453 * attribute.cs (CheckAttribute): Handle system attributes by using
1454 Attribute.GetAttributes to examine information we need.
1456 (GetValidPlaces): Same here.
1458 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
1460 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
1462 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
1464 (Method::Define): Set appropriate flags if we have a DllImport attribute.
1466 (Method::Emit): Handle the case when we are a PInvoke method.
1468 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1470 * expression.cs: Use ResolveWithSimpleName on compound names.
1472 2001-12-02 Ravi Pratap <ravi@ximian.com>
1474 * constant.cs (EmitConstant): Make sure we resolve the associated expression
1475 before trying to reduce it.
1477 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
1479 * constant.cs (LookupConstantValue): Implement.
1481 (EmitConstant): Use the above in emitting the constant.
1483 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
1484 that are user-defined by doing a LookupConstantValue on them.
1486 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
1489 2001-11-29 Miguel de Icaza <miguel@ximian.com>
1491 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
1493 (BaseAccess.DoResolve): Implement.
1495 (MemberAccess.DoResolve): Split this routine into a
1496 ResolveMemberAccess routine that can be used independently
1498 2001-11-28 Miguel de Icaza <miguel@ximian.com>
1500 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
1501 As that share bits of the implementation. Is returns a boolean,
1502 while As returns the Type that is being probed.
1504 2001-12-01 Ravi Pratap <ravi@ximian.com>
1506 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
1507 instead of a Literal - much easier.
1509 (EnumInTransit): Remove - utterly useless :-)
1511 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
1513 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
1515 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
1516 chain when we have no associated expression.
1518 2001-11-30 Ravi Pratap <ravi@ximian.com>
1520 * constant.cs (Define): Use Location while reporting the errror.
1522 Also emit a warning when 'new' is used and there is no inherited
1525 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
1528 (LookupEnumValue): Implement to lookup an enum member's value and define it
1531 (Populate): Re-write accordingly to use the above routine.
1533 2001-11-27 Miguel de Icaza <miguel@ximian.com>
1535 * expression.cs (This): Fix prototype for DoResolveLValue to
1536 override the base class DoResolveLValue.
1538 * cs-parser.cs: Report errors cs574 and cs575 (destructor
1541 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
1542 (we need to load the address of the field here). This fixes
1545 (FieldExpr.DoResolveLValue): Call the DoResolve
1546 function to initialize the Instance expression.
1548 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
1549 correctly the GetEnumerator operation on a value type.
1551 * cs-parser.jay: Add more simple parsing error catches.
1553 * statement.cs (Switch): Add support for string switches.
1554 Handle null specially.
1556 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
1558 2001-11-28 Ravi Pratap <ravi@ximian.com>
1560 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
1562 (declare_local_constant): New helper function.
1564 * statement.cs (AddConstant): Keep a separate record of constants
1566 (IsConstant): Implement to determine if a variable is a constant.
1568 (GetConstantExpression): Implement.
1570 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
1572 * statement.cs (IsVariableDefined): Re-write.
1574 2001-11-27 Ravi Pratap <ravi@ximian.com>
1576 * class.cs (TypeContainer::FindMembers): Look for constants
1577 in the case when we are looking for MemberTypes.Field
1579 * expression.cs (MemberAccess::DoResolve): Check that in the
1580 case we are a FieldExpr and a Literal, we are not being accessed
1581 by an instance reference.
1583 * cs-parser.jay (local_constant_declaration): Implement.
1585 (declaration_statement): Implement for constant declarations.
1587 2001-11-26 Miguel de Icaza <miguel@ximian.com>
1589 * statement.cs (Switch): Catch double defaults.
1591 (Switch): More work on the switch() statement
1592 implementation. It works for integral values now, need to finish
1596 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1598 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
1599 integer literals into other integer literals. To be used by
1602 2001-11-24 Ravi Pratap <ravi@ximian.com>
1604 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
1607 (EmitDynamicInitializers): Cope with the above since we extract data
1608 directly from ArrayData now.
1610 (ExpectInitializers): Keep track of whether initializers are mandatory
1613 (Bounds): Make it a hashtable to prevent the same dimension being
1614 recorded for every element in that dimension.
1616 (EmitDynamicInitializers): Fix bug which prevented the Set array method
1619 Also fix bug which was causing the indices to be emitted in the reverse
1622 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1624 * expression.cs (ArrayCreation): Implement the bits that Ravi left
1625 unfinished. They do not work, because the underlying code is
1628 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1630 * cs-parser.jay: Remove bogus fixme.
1632 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
1633 on Switch statement.
1635 2001-11-23 Ravi Pratap <ravi@ximian.com>
1637 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
1640 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
1641 parameter. Apparently, any expression is allowed.
1643 (ValidateInitializers): Update accordingly.
1645 (CheckIndices): Fix some tricky bugs thanks to recursion.
1647 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
1648 I was being completely brain-dead.
1650 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
1651 and re-write acordingly.
1653 (DelegateInvocation): Re-write accordingly.
1655 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
1657 (MakeByteBlob): Handle types more correctly.
1659 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
1660 initialization from expressions but it is incomplete because I am a complete
1663 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1665 * statement.cs (If.Emit): Fix a bug that generated incorrect code
1666 on If. Basically, we have to return `true' (ie, we do return to
1667 our caller) only if both branches of the if return.
1669 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
1670 short-circuit operators, handle them as short circuit operators.
1672 (Cast.DoResolve): Resolve type.
1673 (Cast.Cast): Take an expression as the target type.
1675 * cs-parser.jay (cast_expression): Remove old hack that only
1676 allowed a limited set of types to be handled. Now we take a
1677 unary_expression and we resolve to a type during semantic
1680 Use the grammar productions from Rhys to handle casts (this is
1681 not complete like Rhys syntax yet, we fail to handle that corner
1682 case that C# has regarding (-x), but we will get there.
1684 2001-11-22 Ravi Pratap <ravi@ximian.com>
1686 * class.cs (EmitFieldInitializer): Take care of the case when we have a
1687 field which is an array type.
1689 * cs-parser.jay (declare_local_variables): Support array initialization too.
1691 * typemanager.cs (MakeKey): Implement.
1693 (everywhere): Use the above appropriately.
1695 * cs-parser.jay (for_statement): Update for array initialization while
1696 declaring variables.
1698 * ecore.cs : The error message was correct, it's the variable's names that
1699 were misleading ;-) Make the code more readable.
1701 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
1702 the correct type etc.
1704 (ConvertExplicit): Handle Enum types by examining the underlying type.
1706 2001-11-21 Ravi Pratap <ravi@ximian.com>
1708 * parameter.cs (GetCallingConvention): Always return
1709 CallingConventions.Standard for now.
1711 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1713 * expression.cs (Binary.ResolveOperator): Update the values of `l'
1714 and `r' after calling DoNumericPromotions.
1716 * ecore.cs: Fix error message (the types were in the wrong order).
1718 * statement.cs (Foreach.ProbeCollectionType): Need to pass
1719 BindingFlags.Instance as well
1721 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
1722 implicit int literal conversion in an empty cast so that we
1723 propagate the right type upstream.
1725 (UnboxCast): new class used to unbox value types.
1726 (Expression.ConvertExplicit): Add explicit type conversions done
1729 (Expression.ImplicitNumericConversion): Oops, forgot to test for
1730 the target type before applying the implicit LongLiterals to ULong
1733 2001-11-21 Miguel de Icaza <miguel@ximian.com>
1735 * cs-parser.jay (for_statement): Reworked the way For works: now
1736 we declare manually any variables that are introduced in
1737 for_initializer to solve the problem of having out-of-band code
1738 emition (that is what got for broken).
1740 (declaration_statement): Perform the actual variable declaration
1741 that used to be done in local_variable_declaration here.
1743 (local_variable_declaration): Do not declare anything, just pass
1744 the information on a DictionaryEntry
1746 2001-11-20 Ravi Pratap <ravi@ximian.com>
1748 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
1749 re-write of the logic to now make it recursive.
1751 (UpdateIndices): Re-write accordingly.
1753 Store element data in a separate ArrayData list in the above methods.
1755 (MakeByteBlob): Implement to dump the array data into a byte array.
1757 2001-11-19 Ravi Pratap <ravi@ximian.com>
1759 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
1762 * constant.cs (Define): Implement.
1764 (EmitConstant): Re-write fully.
1766 Pass in location info.
1768 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
1771 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
1772 DictionaryEntry since we need location info too.
1774 (constant_declaration): Update accordingly.
1776 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
1777 code into another method : UpdateIndices.
1779 2001-11-18 Ravi Pratap <ravi@ximian.com>
1781 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
1782 some type checking etc.
1784 2001-11-17 Ravi Pratap <ravi@ximian.com>
1786 * expression.cs (ArrayCreation::ValidateInitializers): Implement
1787 bits to provide dimension info if the user skips doing that.
1789 Update second constructor to store the rank correctly.
1791 2001-11-16 Ravi Pratap <ravi@ximian.com>
1793 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
1794 and try to implement.
1796 * ../errors/cs0150.cs : Add.
1798 * ../errors/cs0178.cs : Add.
1800 2001-11-16 Miguel de Icaza <miguel@ximian.com>
1802 * statement.cs: Implement foreach on multi-dimensional arrays.
1804 * parameter.cs (Parameters.GetParameterByName): Also lookup the
1805 name of the params argument.
1807 * expression.cs: Use EmitStoreOpcode to get the right opcode while
1808 initializing the array.
1810 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
1811 we can use this elsewhere.
1813 * statement.cs: Finish implementation of foreach for single
1816 * cs-parser.jay: Use an out-of-band stack to pass information
1817 around, I wonder why I need this.
1819 foreach_block: Make the new foreach_block the current_block.
1821 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
1822 function used to return a static Parameters structure. Used for
1823 empty parameters, as those are created very frequently.
1825 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
1827 2001-11-15 Ravi Pratap <ravi@ximian.com>
1829 * interface.cs : Default modifier is private, not public. The
1830 make verify test passes again.
1832 2001-11-15 Ravi Pratap <ravi@ximian.com>
1834 * support.cs (ReflectionParameters): Fix logic to determine
1835 whether the last parameter is a params one. Test 9 passes again.
1837 * delegate.cs (Populate): Register the builders we define with
1838 RegisterParameterForBuilder. Test 19 passes again.
1840 * cs-parser.jay (property_declaration): Reference $6 instead
1841 of $$ to get at the location.
1843 (indexer_declaration): Similar stuff.
1847 * class.cs (Property): Register parameters for the Get and Set methods
1848 if they exist. Test 23 passes again.
1850 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
1851 call to EmitArguments as we are sure there aren't any params arguments.
1852 Test 32 passes again.
1854 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
1855 IndexOutOfRangeException.
1857 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
1858 Test 33 now passes again.
1860 2001-11-15 Miguel de Icaza <miguel@ximian.com>
1862 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
1863 broke a bunch of things. Will have to come up with a better way
1864 of tracking locations.
1866 * statement.cs: Implemented foreach for single dimension arrays.
1868 2001-11-09 Miguel de Icaza <miguel@ximian.com>
1870 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
1871 an error. This removes the lookup from the critical path.
1873 * cs-parser.jay: Removed use of temporary_loc, which is completely
1876 2001-11-14 Miguel de Icaza <miguel@ximian.com>
1878 * support.cs (ReflectionParameters.ParameterModifier): Report
1879 whether the argument is a PARAMS argument or not.
1881 * class.cs: Set the attribute `ParamArrayAttribute' on the
1884 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
1885 and cons_param_array_attribute (ConstructorInfo for
1886 ParamArrayAttribute).,
1888 * codegen.cs: Emit the return using the `Return' statement, that
1889 way we can report the error correctly for missing return values.
1891 * class.cs (Method.Emit): Clean up.
1893 * expression.cs (Argument.Resolve): Take another argument: the
1894 location where this argument is used. Notice that this is not
1895 part of the "Argument" class as to reduce the size of the
1896 structure (we know the approximate location anyways).
1898 Test if the argument is a variable-reference, if not, then
1899 complain with a 206.
1901 (Argument.Emit): Emit addresses of variables.
1903 (Argument.FullDesc): Simplify.
1905 (Invocation.DoResolve): Update for Argument.Resolve.
1907 (ElementAccess.DoResolve): ditto.
1909 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
1910 method should be virtual, as this method is always virtual.
1912 (NewDelegate.DoResolve): Update for Argument.Resolve.
1914 * class.cs (ConstructorInitializer.DoResolve): ditto.
1916 * attribute.cs (Attribute.Resolve): ditto.
1918 2001-11-13 Miguel de Icaza <miguel@ximian.com>
1920 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
1922 * expression.cs (ParameterReference): Drop IStackStorage and implement
1923 IAssignMethod instead.
1925 (LocalVariableReference): ditto.
1927 * ecore.cs (FieldExpr): Drop IStackStorage and implement
1928 IAssignMethod instead.
1930 2001-11-13 Miguel de Icaza <miguel@ximian.com>
1932 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
1933 enumerations that are used in heavily used structures derive from
1934 byte in a laughable and pathetic attempt to reduce memory usage.
1935 This is the kind of pre-optimzations that you should not do at
1936 home without adult supervision.
1938 * expression.cs (UnaryMutator): New class, used to handle ++ and
1939 -- separatedly from the other unary operators. Cleans up the
1940 code, and kills the ExpressionStatement dependency in Unary.
1942 (Unary): Removed `method' and `Arguments' from this class, making
1943 it smaller, and moving it all to SimpleCall, so I can reuse this
1944 code in other locations and avoid creating a lot of transient data
1945 strucutres when not required.
1947 * cs-parser.jay: Adjust for new changes.
1949 2001-11-11 Miguel de Icaza <miguel@ximian.com>
1951 * enum.cs (Enum.Populate): If there is a failure during
1954 * cs-parser.jay (opt_enum_base): we used to catch type errors
1955 here, but this is really incorrect. The type error should be
1956 catched during semantic analysis.
1958 2001-12-11 Ravi Pratap <ravi@ximian.com>
1960 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
1961 current_local_parameters as expected since I, in my stupidity, had forgotten
1964 * attribute.cs (GetValidPlaces): Fix stupid bug.
1966 * class.cs (Method::Emit): Perform check on applicability of attributes.
1968 (Constructor::Emit): Ditto.
1970 (Field::Emit): Ditto.
1972 (Field.Location): Store location information.
1974 (Property, Event, Indexer, Operator): Ditto.
1976 * cs-parser.jay (field_declaration): Pass in location for each field.
1978 * ../errors/cs0592.cs : Add.
1980 2001-11-12 Ravi Pratap <ravi@ximian.com>
1982 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
1984 (InitCoreTypes): Update accordingly.
1986 (RegisterAttrType, LookupAttr): Implement.
1988 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
1989 info about the same.
1991 (Resolve): Update to populate the above as necessary.
1995 (GetValidPlaces): Helper to the above.
1997 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
1999 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
2001 2001-11-12 Ravi Pratap <ravi@ximian.com>
2003 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
2005 * ../errors/cs0617.cs : Add.
2007 2001-11-11 Ravi Pratap <ravi@ximian.com>
2009 * enum.cs (Emit): Rename to Populate to be more consistent with what
2010 we expect it to do and when exactly it is called.
2012 * class.cs, rootcontext.cs : Update accordingly.
2014 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
2015 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
2017 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
2019 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
2020 of a fieldinfo using the above, when dealing with a FieldBuilder.
2022 2001-11-10 Ravi Pratap <ravi@ximian.com>
2024 * ../errors/cs0031.cs : Add.
2026 * ../errors/cs1008.cs : Add.
2028 * ../errrors/cs0543.cs : Add.
2030 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
2033 (FindMembers): Implement.
2035 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
2036 enums and delegates too.
2038 (enum_types): Rename to builder_to_enum.
2040 (delegate_types): Rename to builder_to_delegate.
2042 * delegate.cs (FindMembers): Implement.
2044 2001-11-09 Ravi Pratap <ravi@ximian.com>
2046 * typemanager.cs (IsEnumType): Implement.
2048 * enum.cs (Emit): Re-write parts to account for the underlying type
2049 better and perform checking etc.
2051 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
2052 of the underlying type.
2054 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
2057 * enum.cs (error31): Helper to report error #31.
2059 * cs-parser.jay (enum_declaration): Store location of each member too.
2061 * enum.cs (member_to_location): New hashtable.
2063 (AddEnumMember): Update location hashtable.
2065 (Emit): Use the location of each member while reporting errors.
2067 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2069 * cs-parser.jay: A for_initializer if is a
2070 local_variable_declaration really ammount to have an implicit
2071 block with the variable declaration and no initializer for for.
2073 * statement.cs (For.Emit): Cope with null initializers.
2075 This fixes the infinite loop on for initializers.
2077 2001-11-08 Miguel de Icaza <miguel@ximian.com>
2079 * enum.cs: More cleanup.
2081 * ecore.cs: Remove dead code.
2083 * class.cs (Property.Emit): More simplification.
2084 (Event.Emit): ditto.
2086 Reworked to have less levels of indentation.
2088 2001-11-08 Ravi Pratap <ravi@ximian.com>
2090 * class.cs (Property): Emit attributes.
2100 * enum.cs (Emit): Ditto.
2102 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
2105 * class.cs (Field, Event, etc.): Move attribute generation into the
2106 Emit method everywhere.
2108 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
2109 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
2110 as we had no way of defining nested enums !
2112 * rootcontext.cs : Adjust code accordingly.
2114 * typemanager.cs (AddEnumType): To keep track of enum types separately.
2116 2001-11-07 Ravi Pratap <ravi@ximian.com>
2118 * expression.cs (EvalConstantExpression): Move into ecore.cs
2120 * enum.cs (Enum): Rename some members and make them public and readonly
2121 according to our convention.
2123 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
2126 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
2128 (Enum::Emit): Write a simple version for now which doesn't try to compute
2129 expressions. I shall modify this to be more robust in just a while.
2131 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
2133 (TypeContainer::CloseType): Create the Enum types too.
2135 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
2137 * expression.cs (EvalConstantExpression): Get rid of completely.
2139 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
2140 user-defined values and other cases.
2142 (IsValidEnumLiteral): Helper function.
2144 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
2145 out there in the case we had a literal FieldExpr.
2147 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
2149 (Literalize): Revamp a bit to take two arguments.
2151 (EnumLiteral): New class which derives from Literal to wrap enum literals.
2153 2001-11-06 Ravi Pratap <ravi@ximian.com>
2155 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
2157 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
2159 (Resolve): Use the above to ensure we have proper initializers.
2161 2001-11-05 Ravi Pratap <ravi@ximian.com>
2163 * expression.cs (Expression::EvalConstantExpression): New method to
2164 evaluate constant expressions.
2166 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
2168 2001-11-07 Miguel de Icaza <miguel@ximian.com>
2170 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
2173 (Binary.ResolveOperator): Handle operator != (object a, object b)
2174 and operator == (object a, object b);
2176 (Binary.DoNumericPromotions): Indicate whether the numeric
2177 promotion was possible.
2179 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
2182 Made the ArrayAccess implement interface IAssignMethod instead of
2183 IStackStore as the order in which arguments are passed reflects
2186 * assign.cs: Instead of using expr.ExprClass to select the way of
2187 assinging, probe for the IStackStore/IAssignMethod interfaces.
2189 * typemanager.cs: Load InitializeArray definition.
2191 * rootcontext.cs (RootContext.MakeStaticData): Used to define
2192 static data that can be used to initialize arrays.
2194 2001-11-05 Miguel de Icaza <miguel@ximian.com>
2196 * expression.cs: Handle operator== and operator!= for booleans.
2198 (Conditioal.Reduce): Implement reducer for the ?: operator.
2200 (Conditional.Resolve): Implement dead code elimination.
2202 (Binary.Resolve): Catch string literals and return a new
2203 concatenated string.
2205 (Unary.Reduce): Implement reduction of unary expressions.
2207 * ecore.cs: Split out the expression core handling here.
2209 (Expression.Reduce): New method used to perform constant folding
2210 and CSE. This is needed to support constant-expressions.
2212 * statement.cs (Statement.EmitBoolExpression): Pass true and false
2213 targets, and optimize for !x.
2215 2001-11-04 Ravi Pratap <ravi@ximian.com>
2217 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
2218 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
2219 set custom atttributes.
2221 * literal.cs (Literal::GetValue): New abstract method to return the actual
2222 value of the literal, cast as an object.
2224 (*Literal): Implement GetValue method.
2226 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
2227 expressions to the arraylist but objects of type Argument.
2229 * class.cs (TypeContainer::Emit): Emit our attributes too.
2231 (Method::Emit, Constructor::Emit): Ditto.
2233 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
2234 to be ignoring earlier.
2236 2001-11-03 Ravi Pratap <ravi@ximian.com>
2238 * attribute.cs (AttributeSection::Define): Implement to do the business
2239 of constructing a CustomAttributeBuilder.
2241 (Attribute): New trivial class. Increases readability of code.
2243 * cs-parser.jay : Update accordingly.
2245 (positional_argument_list, named_argument_list, named_argument): New rules
2247 (attribute_arguments): Use the above so that we are more correct.
2249 2001-11-02 Ravi Pratap <ravi@ximian.com>
2251 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
2252 to perform all checks for a method with a params parameter.
2254 (Invocation::OverloadResolve): Update to use the above method and therefore
2255 cope correctly with params method invocations.
2257 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
2260 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
2261 constructors in our parent too because we can't afford to miss out on
2264 * attribute.cs (AttributeSection): New name for the class Attribute
2266 Other trivial changes to improve readability.
2268 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
2269 use the new class names.
2271 2001-11-01 Ravi Pratap <ravi@ximian.com>
2273 * class.cs (Method::Define): Complete definition for params types too
2275 (Indexer::Define): Ditto.
2277 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
2278 Cope everywhere with a request for info about the array parameter.
2280 2001-11-01 Ravi Pratap <ravi@ximian.com>
2282 * tree.cs (RecordNamespace): Fix up to check for the correct key.
2284 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
2285 local_variable_type to extract the string corresponding to the type.
2287 (local_variable_type): Fixup the action to use the new helper method.
2289 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
2292 * expression.cs : Clean out code which uses the above.
2294 2001-10-31 Ravi Pratap <ravi@ximian.com>
2296 * typemanager.cs (RegisterMethod): Check if we already have an existing key
2297 and bale out if necessary by returning a false.
2299 (RegisterProperty): Ditto.
2301 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
2302 and print out appropriate error messages.
2304 * interface.cs (everywhere): Ditto.
2306 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
2307 location to constructor.
2309 * class.cs (Property, Event, Indexer): Update accordingly.
2311 * ../errors/cs111.cs : Added.
2313 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
2314 of a method, as laid down by the spec.
2316 (Invocation::OverloadResolve): Use the above method.
2318 2001-10-31 Ravi Pratap <ravi@ximian.com>
2320 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
2321 now take a TypeContainer and a Parameters object.
2323 (ParameterData): Modify return type of ParameterModifier method to be
2324 Parameter.Modifier and not a string.
2326 (ReflectionParameters, InternalParameters): Update accordingly.
2328 * expression.cs (Argument::GetParameterModifier): Same here.
2330 * support.cs (InternalParameters::ParameterType): Find a better way of determining
2331 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
2332 symbol in it at all so maybe this is only for now.
2334 2001-10-30 Ravi Pratap <ravi@ximian.com>
2336 * support.cs (InternalParameters): Constructor now takes an extra argument
2337 which is the actual Parameters class.
2339 (ParameterDesc): Update to provide info on ref/out modifiers.
2341 * class.cs (everywhere): Update call to InternalParameters to pass in
2342 the second argument too.
2344 * support.cs (ParameterData): Add ParameterModifier, which is a method
2345 to return the modifier info [ref/out etc]
2347 (InternalParameters, ReflectionParameters): Implement the above.
2349 * expression.cs (Argument::ParameterModifier): Similar function to return
2350 info about the argument's modifiers.
2352 (Invocation::OverloadResolve): Update to take into account matching modifiers
2355 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
2356 a new SetFormalParameters object which we pass to InternalParameters.
2358 2001-10-30 Ravi Pratap <ravi@ximian.com>
2360 * expression.cs (NewArray): Merge into the ArrayCreation class.
2362 2001-10-29 Ravi Pratap <ravi@ximian.com>
2364 * expression.cs (NewArray): Merge classes NewBuiltinArray and
2365 NewUserdefinedArray into one as there wasn't much of a use in having
2368 * expression.cs (Argument): Change field's name to ArgType from Type.
2370 (Type): New readonly property which returns the proper type, taking into
2371 account ref/out modifiers.
2373 (everywhere): Adjust code accordingly for the above.
2375 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
2376 whether we are emitting for a ref or out parameter.
2378 * expression.cs (Argument::Emit): Use the above field to set the state.
2380 (LocalVariableReference::Emit): Update to honour the flag and emit the
2383 * parameter.cs (Attributes): Set the correct flags for ref parameters.
2385 * expression.cs (Argument::FullDesc): New function to provide a full desc.
2387 * support.cs (ParameterData): Add method ParameterDesc to the interface.
2389 (ReflectionParameters, InternalParameters): Implement the above method.
2391 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
2394 (Invocation::FullMethodDesc): Ditto.
2396 2001-10-29 Miguel de Icaza <miguel@ximian.com>
2398 * cs-parser.jay: Add extra production for the second form of array
2401 * expression.cs (ArrayCreation): Update to reflect the above
2404 * Small changes to prepare for Array initialization.
2406 2001-10-28 Miguel de Icaza <miguel@ximian.com>
2408 * typemanager.cs (ImplementsInterface): interface might be null;
2409 Deal with this problem;
2411 Also, we do store negative hits on the cache (null values), so use
2412 this instead of calling t.GetInterfaces on the type everytime.
2414 2001-10-28 Ravi Pratap <ravi@ximian.com>
2416 * typemanager.cs (IsBuiltinType): New method to help determine the same.
2418 * expression.cs (New::DoResolve): Get rid of array creation code and instead
2419 split functionality out into different classes.
2421 (New::FormArrayType): Move into NewBuiltinArray.
2423 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
2426 (NewBuiltinArray): New class to handle creation of built-in arrays.
2428 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
2429 account creation of one-dimensional arrays.
2431 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
2433 (NewUserdefinedArray::DoResolve): Implement.
2435 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
2437 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
2438 we maintain inside the TypeManager. This is necessary to perform lookups on the
2441 (LookupType): Update to perform GetType on the module builders too.
2443 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
2445 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
2447 2001-10-23 Ravi Pratap <ravi@ximian.com>
2449 * expression.cs (New::DoResolve): Implement guts of array creation.
2451 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
2453 2001-10-27 Miguel de Icaza <miguel@ximian.com>
2455 * expression.cs: Fix bug I introduced lsat night that broke
2458 (Expression.Resolve): Report a 246 error (can not resolve name)
2459 if we find a SimpleName in the stream.
2461 (Expression.ResolveLValue): Ditto.
2463 (Expression.ResolveWithSimpleName): This function is a variant of
2464 ResolveName, this one allows SimpleNames to be returned without a
2465 warning. The only consumer of SimpleNames is MemberAccess
2467 2001-10-26 Miguel de Icaza <miguel@ximian.com>
2469 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
2470 might arrive here. I have my doubts that this is correct.
2472 * statement.cs (Lock): Implement lock statement.
2474 * cs-parser.jay: Small fixes to support `lock' and `using'
2476 * cs-tokenizer.cs: Remove extra space
2478 * driver.cs: New flag --checked, allows to turn on integer math
2481 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
2482 Threading.Monitor.Exit
2484 2001-10-23 Miguel de Icaza <miguel@ximian.com>
2486 * expression.cs (IndexerAccess::DoResolveLValue): Set the
2487 Expression Class to be IndexerAccess.
2489 Notice that Indexer::DoResolve sets the eclass to Value.
2491 2001-10-22 Miguel de Icaza <miguel@ximian.com>
2493 * class.cs (TypeContainer::Emit): Emit code for indexers.
2495 * assign.cs (IAssignMethod): New interface implemented by Indexers
2496 and Properties for handling assignment.
2498 (Assign::Emit): Simplify and reuse code.
2500 * expression.cs (IndexerAccess, PropertyExpr): Implement
2501 IAssignMethod, clean up old code.
2503 2001-10-22 Ravi Pratap <ravi@ximian.com>
2505 * typemanager.cs (ImplementsInterface): New method to determine if a type
2506 implements a given interface. Provides a nice cache too.
2508 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
2511 (ConvertReferenceExplicit): Ditto.
2513 * delegate.cs (Delegate::Populate): Update to define the parameters on the
2514 various methods, with correct names etc.
2516 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
2517 Operator.UnaryNegation.
2519 * cs-parser.jay (operator_declarator): Be a little clever in the case where
2520 we have a unary plus or minus operator.
2522 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
2525 * everywhere : update accordingly.
2527 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
2530 * class.cs (Method::Define): For the case where we are implementing a method
2531 inherited from an interface, we need to set the MethodAttributes.Final flag too.
2532 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
2534 2001-10-21 Ravi Pratap <ravi@ximian.com>
2536 * interface.cs (FindMembers): Implement to work around S.R.E
2539 * typemanager.cs (IsInterfaceType): Implement.
2541 (FindMembers): Update to handle interface types too.
2543 * expression.cs (ImplicitReferenceConversion): Re-write bits which
2544 use IsAssignableFrom as that is not correct - it doesn't work.
2546 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
2547 and accordingly override EmitStatement.
2549 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
2550 using the correct logic :-)
2552 2001-10-19 Ravi Pratap <ravi@ximian.com>
2554 * ../errors/cs-11.cs : Add to demonstrate error -11
2556 2001-10-17 Miguel de Icaza <miguel@ximian.com>
2558 * assign.cs (Assign::Resolve): Resolve right hand side first, and
2559 then pass this as a hint to ResolveLValue.
2561 * expression.cs (FieldExpr): Add Location information
2563 (FieldExpr::LValueResolve): Report assignment to readonly
2566 (Expression::ExprClassFromMemberInfo): Pass location information.
2568 (Expression::ResolveLValue): Add new method that resolves an
2571 (Expression::DoResolveLValue): Default invocation calls
2574 (Indexers): New class used to keep track of indexers in a given
2577 (IStackStore): Renamed from LValue, as it did not really describe
2578 what this did. Also ResolveLValue is gone from this interface and
2579 now is part of Expression.
2581 (ElementAccess): Depending on the element access type
2583 * typemanager.cs: Add `indexer_name_type' as a Core type
2584 (System.Runtime.CompilerServices.IndexerNameAttribute)
2586 * statement.cs (Goto): Take a location.
2588 2001-10-18 Ravi Pratap <ravi@ximian.com>
2590 * delegate.cs (Delegate::VerifyDelegate): New method to verify
2591 if two delegates are compatible.
2593 (NewDelegate::DoResolve): Update to take care of the case when
2594 we instantiate a delegate from another delegate.
2596 * typemanager.cs (FindMembers): Don't even try to look up members
2597 of Delegate types for now.
2599 2001-10-18 Ravi Pratap <ravi@ximian.com>
2601 * delegate.cs (NewDelegate): New class to take care of delegate
2604 * expression.cs (New): Split the delegate related code out into
2605 the NewDelegate class.
2607 * delegate.cs (DelegateInvocation): New class to handle delegate
2610 * expression.cs (Invocation): Split out delegate related code into
2611 the DelegateInvocation class.
2613 2001-10-17 Ravi Pratap <ravi@ximian.com>
2615 * expression.cs (New::DoResolve): Implement delegate creation fully
2616 and according to the spec.
2618 (New::DoEmit): Update to handle delegates differently.
2620 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
2621 because of which we were printing out arguments in reverse order !
2623 * delegate.cs (VerifyMethod): Implement to check if the given method
2624 matches the delegate.
2626 (FullDelegateDesc): Implement.
2628 (VerifyApplicability): Implement.
2630 * expression.cs (Invocation::DoResolve): Update to accordingly handle
2631 delegate invocations too.
2633 (Invocation::Emit): Ditto.
2635 * ../errors/cs1593.cs : Added.
2637 * ../errors/cs1594.cs : Added.
2639 * delegate.cs (InstanceExpression, TargetMethod): New properties.
2641 2001-10-16 Ravi Pratap <ravi@ximian.com>
2643 * typemanager.cs (intptr_type): Core type for System.IntPtr
2645 (InitCoreTypes): Update for the same.
2647 (iasyncresult_type, asynccallback_type): Ditto.
2649 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
2652 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
2655 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
2656 the builders for the 4 members of a delegate type :-)
2658 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
2661 * expression.cs (New::DoResolve): Implement guts for delegate creation.
2663 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
2665 2001-10-15 Miguel de Icaza <miguel@ximian.com>
2667 * statement.cs (Break::Emit): Implement.
2668 (Continue::Emit): Implement.
2670 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
2671 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
2672 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
2673 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
2676 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
2677 properties that track the label for the current loop (begin of the
2678 loop and end of the loop).
2680 2001-10-15 Ravi Pratap <ravi@ximian.com>
2682 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
2683 use of emitting anything at all.
2685 * class.cs, rootcontext.cs : Get rid of calls to the same.
2687 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
2689 (Populate): Define the constructor correctly and set the implementation
2692 * typemanager.cs (delegate_types): New hashtable to hold delegates that
2695 (AddDelegateType): Implement.
2697 (IsDelegateType): Implement helper method.
2699 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
2701 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
2702 and accordingly handle it.
2704 * delegate.cs (Populate): Take TypeContainer argument.
2705 Implement bits to define the Invoke method. However, I still haven't figured out
2706 how to take care of the native int bit :-(
2708 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
2709 Qualify the name of the delegate, not its return type !
2711 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
2714 (StandardConversionExists): Checking for array types turns out to be recursive.
2716 (ConvertReferenceExplicit): Implement array conversion.
2718 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
2720 2001-10-12 Ravi Pratap <ravi@ximian.com>
2722 * cs-parser.jay (delegate_declaration): Store the fully qualified
2723 name as it is a type declaration.
2725 * delegate.cs (ReturnType, Name): Rename members to these. Make them
2728 (DefineDelegate): Renamed from Define. Does the same thing essentially,
2729 as TypeContainer::DefineType.
2731 (Populate): Method in which all the definition of the various methods (Invoke)
2734 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
2737 (CloseDelegate): Finally creates the delegate.
2739 * class.cs (TypeContainer::DefineType): Update to define delegates.
2740 (Populate, Emit and CloseType): Do the same thing here too.
2742 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
2743 delegates in all these operations.
2745 2001-10-14 Miguel de Icaza <miguel@ximian.com>
2747 * expression.cs: LocalTemporary: a new expression used to
2748 reference a temporary that has been created.
2750 * assign.cs: Handle PropertyAccess back here, so that we can
2751 provide the proper semantic access to properties.
2753 * expression.cs (Expression::ConvertReferenceExplicit): Implement
2754 a few more explicit conversions.
2756 * modifiers.cs: `NEW' modifier maps to HideBySig.
2758 * expression.cs (PropertyExpr): Make this into an
2759 ExpressionStatement, and support the EmitStatement code path.
2761 Perform get/set error checking, clean up the interface.
2763 * assign.cs: recognize PropertyExprs as targets, and if so, turn
2764 them into toplevel access objects.
2766 2001-10-12 Miguel de Icaza <miguel@ximian.com>
2768 * expression.cs: PropertyExpr::PropertyExpr: use work around the
2771 * typemanager.cs: Keep track here of our PropertyBuilders again to
2772 work around lameness in SRE.
2774 2001-10-11 Miguel de Icaza <miguel@ximian.com>
2776 * expression.cs (LValue::LValueResolve): New method in the
2777 interface, used to perform a second resolution pass for LValues.
2779 (This::DoResolve): Catch the use of this in static methods.
2781 (This::LValueResolve): Implement.
2783 (This::Store): Remove warning, assigning to `this' in structures
2786 (Invocation::Emit): Deal with invocation of
2787 methods on value types. We need to pass the address to structure
2788 methods rather than the object itself. (The equivalent code to
2789 emit "this" for structures leaves the entire structure on the
2790 stack instead of a pointer to it).
2792 (ParameterReference::DoResolve): Compute the real index for the
2793 argument based on whether the method takes or not a `this' pointer
2794 (ie, the method is static).
2796 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
2797 value types returned from functions when we need to invoke a
2798 method on the sturcture.
2801 2001-10-11 Ravi Pratap <ravi@ximian.com>
2803 * class.cs (TypeContainer::DefineType): Method to actually do the business of
2804 defining the type in the Modulebuilder or Typebuilder. This is to take
2805 care of nested types which need to be defined on the TypeBuilder using
2808 (TypeContainer::GetClassBases): Implement. Essentially the code from the
2809 methods in RootContext, only ported to be part of TypeContainer.
2811 (TypeContainer::GetInterfaceOrClass): Ditto.
2813 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
2815 * interface.cs (Interface::DefineInterface): New method. Does exactly
2816 what RootContext.CreateInterface did earlier, only it takes care of nested types
2819 (Interface::GetInterfaces): Move from RootContext here and port.
2821 (Interface::GetInterfaceByName): Same here.
2823 * rootcontext.cs (ResolveTree): Re-write.
2825 (PopulateTypes): Re-write.
2827 * class.cs (TypeContainer::Populate): Populate nested types too.
2828 (TypeContainer::Emit): Emit nested members too.
2830 * typemanager.cs (AddUserType): Do not make use of the FullName property,
2831 instead just use the name argument passed in as it is already fully
2834 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
2835 to TypeContainer mapping to see if a type is user-defined.
2837 * class.cs (TypeContainer::CloseType): Implement.
2839 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
2840 the default constructor.
2842 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
2845 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
2847 * interface.cs (CloseType): Create the type here.
2849 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
2852 Remove all the methods which are now in TypeContainer.
2854 2001-10-10 Ravi Pratap <ravi@ximian.com>
2856 * delegate.cs (Define): Re-write bits to define the delegate
2859 2001-10-10 Miguel de Icaza <miguel@ximian.com>
2861 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
2863 * expression.cs (ImplicitReferenceConversion): handle null as well
2864 as a source to convert to any reference type.
2866 * statement.cs (Return): Perform any implicit conversions to
2867 expected return type.
2869 Validate use of return statement.
2871 * codegen.cs (EmitContext): Pass the expected return type here.
2873 * class.cs (Method, Constructor, Property): Pass expected return
2874 type to EmitContext.
2876 2001-10-09 Miguel de Icaza <miguel@ximian.com>
2878 * expression.cs: Make DoResolve take an EmitContext instead of a
2881 Replaced `l' and `location' for `loc', for consistency.
2883 (Error, Warning): Remove unneeded Tc argument.
2885 * assign.cs, literal.cs, constant.cs: Update to new calling
2888 * codegen.cs: EmitContext now contains a flag indicating whether
2889 code is being generated in a static method or not.
2891 * cs-parser.jay: DecomposeQI, new function that replaces the old
2892 QualifiedIdentifier. Now we always decompose the assembled
2893 strings from qualified_identifier productions into a group of
2896 2001-10-08 Miguel de Icaza <miguel@ximian.com>
2898 * rootcontext.cs: Deal with field-less struct types correctly now
2899 by passing the size option to Define Type.
2901 * class.cs: Removed hack that created one static field.
2903 2001-10-07 Miguel de Icaza <miguel@ximian.com>
2905 * statement.cs: Moved most of the code generation here.
2907 2001-10-09 Ravi Pratap <ravi@ximian.com>
2909 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
2912 (ElementAccess): Remove useless bits for now - keep checks as the spec
2915 2001-10-08 Ravi Pratap <ravi@ximian.com>
2917 * expression.cs (ElementAccess::DoResolve): Remove my crap code
2918 and start performing checks according to the spec.
2920 2001-10-07 Ravi Pratap <ravi@ximian.com>
2922 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
2923 rank_specifiers instead.
2925 (rank_specifiers): Change the order in which the rank specifiers are stored
2927 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
2929 * expression.cs (ElementAccess): Implement the LValue interface too.
2931 2001-10-06 Ravi Pratap <ravi@ximian.com>
2933 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
2934 except that user defined conversions are not included.
2936 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
2937 perform the conversion of the return type, if necessary.
2939 (New::DoResolve): Check whether we are creating an array or an object
2940 and accordingly do the needful.
2942 (New::Emit): Same here.
2944 (New::DoResolve): Implement guts of array creation.
2946 (New::FormLookupType): Helper function.
2948 2001-10-07 Miguel de Icaza <miguel@ximian.com>
2950 * codegen.cs: Removed most of the code generation here, and move the
2951 corresponding code generation bits to the statement classes.
2953 Added support for try/catch/finalize and throw.
2955 * cs-parser.jay: Added support for try/catch/finalize.
2957 * class.cs: Catch static methods having the flags override,
2958 virtual or abstract.
2960 * expression.cs (UserCast): This user cast was not really doing
2961 what it was supposed to do. Which is to be born in fully resolved
2962 state. Parts of the resolution were being performed at Emit time!
2966 2001-10-05 Miguel de Icaza <miguel@ximian.com>
2968 * expression.cs: Implicity convert the result from UserCast.
2970 2001-10-05 Ravi Pratap <ravi@ximian.com>
2972 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
2973 prevented it from working correctly.
2975 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
2976 merely ConvertImplicit.
2978 2001-10-05 Miguel de Icaza <miguel@ximian.com>
2980 * typemanager.cs: Make the LookupTypeContainer function static,
2981 and not per-instance.
2983 * class.cs: Make static FindMembers (the one that takes a Type
2986 * codegen.cs: Add EmitForeach here.
2988 * cs-parser.jay: Make foreach a toplevel object instead of the
2989 inline expansion, as we need to perform semantic analysis on it.
2991 2001-10-05 Ravi Pratap <ravi@ximian.com>
2993 * expression.cs (Expression::ImplicitUserConversion): Rename to
2994 UserDefinedConversion.
2996 (Expression::UserDefinedConversion): Take an extra argument specifying
2997 whether we look for explicit user conversions too.
2999 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
3001 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
3003 (ExplicitUserConversion): Make it a call to UserDefinedConversion
3004 with the appropriate arguments.
3006 * cs-parser.jay (cast_expression): Record location too.
3008 * expression.cs (Cast): Record location info.
3010 (Expression::ConvertExplicit): Take location argument.
3012 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
3013 to determine if we are doing explicit conversions.
3015 (UserCast::Emit): Update accordingly.
3017 (Expression::ConvertExplicit): Report an error if everything fails.
3019 * ../errors/cs0030.cs : Add.
3021 2001-10-04 Miguel de Icaza <miguel@ximian.com>
3023 * modifiers.cs: If the ABSTRACT keyword is present, also set the
3024 virtual and newslot bits.
3026 * class.cs (TypeContainer::RegisterRequiredImplementations):
3027 Record methods we need.
3029 (TypeContainer::MakeKey): Helper function to make keys for
3030 MethodBases, since the Methodbase key is useless.
3032 (TypeContainer::Populate): Call RegisterRequiredImplementations
3033 before defining the methods.
3035 Create a mapping for method_builders_to_methods ahead of time
3036 instead of inside a tight loop.
3038 (::RequireMethods): Accept an object as the data to set into the
3039 hashtable so we can report interface vs abstract method mismatch.
3041 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3043 * report.cs: Make all of it static.
3045 * rootcontext.cs: Drop object_type and value_type computations, as
3046 we have those in the TypeManager anyways.
3048 Drop report instance variable too, now it is a global.
3050 * driver.cs: Use try/catch on command line handling.
3052 Add --probe option to debug the error reporting system with a test
3055 * report.cs: Add support for exiting program when a probe
3056 condition is reached.
3058 2001-10-03 Ravi Pratap <ravi@ximian.com>
3060 * expression.cs (Binary::DoNumericPromotions): Fix the case when
3061 we do a forcible conversion regardless of type, to check if
3062 ForceConversion returns a null.
3064 (Binary::error19): Use location to report error.
3066 (Unary::error23): Use location here too.
3068 * ../errors/cs0019.cs : Check in.
3070 * ../errors/cs0023.cs : Check in.
3072 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
3073 case of a non-null MethodInfo object with a length of 0 !
3075 (Binary::ResolveOperator): Flag error if overload resolution fails to find
3076 an applicable member - according to the spec :-)
3077 Also fix logic to find members in base types.
3079 (Unary::ResolveOperator): Same here.
3081 (Unary::report23): Change name to error23 and make first argument a TypeContainer
3082 as I was getting thoroughly confused between this and error19 :-)
3084 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
3085 (::FindMostEncompassedType): Implement.
3086 (::FindMostEncompassingType): Implement.
3087 (::StandardConversionExists): Implement.
3089 (UserImplicitCast): Re-vamp. We now need info about most specific
3090 source and target types so that we can do the necessary conversions.
3092 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
3093 mathematical union with no duplicates.
3095 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3097 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
3098 in order from base classes to child classes, so that we can in
3099 child classes look up in our parent for method names and
3100 attributes (required for handling abstract, virtual, new, override
3101 constructs: we need to instrospect our base class, and if we dont
3102 populate the classes in order, the introspection might be
3103 incorrect. For example, a method could query its parent before
3104 the parent has any methods and would determine that the parent has
3105 no abstract methods (while it could have had them)).
3107 (RootContext::CreateType): Record the order in which we define the
3110 2001-10-02 Miguel de Icaza <miguel@ximian.com>
3112 * class.cs (TypeContainer::Populate): Also method definitions can
3113 fail now, keep track of this.
3115 (TypeContainer::FindMembers): Implement support for
3116 DeclaredOnly/noDeclaredOnly flag.
3118 (Constructor::Emit) Return the ConstructorBuilder.
3120 (Method::Emit) Return the MethodBuilder.
3121 Check for abstract or virtual methods to be public.
3123 * rootcontext.cs (RootContext::CreateType): Register all the
3124 abstract methods required for the class to be complete and the
3125 interface methods that must be implemented.
3127 * cs-parser.jay: Report error 501 (method requires body if it is
3128 not marked abstract or extern).
3130 * expression.cs (TypeOf::Emit): Implement.
3132 * typemanager.cs: runtime_handle_type, new global type.
3134 * class.cs (Property::Emit): Generate code for properties.
3136 2001-10-02 Ravi Pratap <ravi@ximian.com>
3138 * expression.cs (Unary::ResolveOperator): Find operators on base type
3139 too - we now conform exactly to the spec.
3141 (Binary::ResolveOperator): Same here.
3143 * class.cs (Operator::Define): Fix minor quirk in the tests.
3145 * ../errors/cs0215.cs : Added.
3147 * ../errors/cs0556.cs : Added.
3149 * ../errors/cs0555.cs : Added.
3151 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3153 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
3154 single integer which is really efficient
3156 2001-10-01 Ravi Pratap <ravi@ximian.com>
3158 * expression.cs (Expression::ImplicitUserConversion): Use location
3159 even in the case when we are examining True operators.
3161 * class.cs (Operator::Define): Perform extensive checks to conform
3162 with the rules for operator overloading in the spec.
3164 * expression.cs (Expression::ImplicitReferenceConversion): Implement
3165 some of the other conversions mentioned in the spec.
3167 * typemanager.cs (array_type): New static member for the System.Array built-in
3170 (cloneable_interface): For System.ICloneable interface.
3172 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
3173 we start resolving the tree and populating types.
3175 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
3177 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3179 * expression.cs (Expression::ExprClassFromMemberInfo,
3180 Expression::Literalize): Create literal expressions from
3181 FieldInfos which are literals.
3183 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
3184 type casts, because they were wrong. The test suite in tests
3187 (ImplicitNumericConversion): ushort to ulong requires a widening
3190 Int32 constant to long requires widening cast as well.
3192 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
3193 for integers because the type on the stack is not i4.
3195 2001-09-30 Miguel de Icaza <miguel@ximian.com>
3197 * expression.cs (report118): require location argument.
3199 * parameter.cs: Do not dereference potential null value.
3201 * class.cs: Catch methods that lack the `new' keyword when
3202 overriding a name. Report warnings when `new' is used without
3203 anything being there to override.
3205 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
3207 * class.cs: Only add constructor to hashtable if it is non-null
3208 (as now constructors can fail on define).
3210 (TypeManager, Class, Struct): Take location arguments.
3212 Catch field instance initialization in structs as errors.
3214 accepting_filter: a new filter for FindMembers that is static so
3215 that we dont create an instance per invocation.
3217 (Constructor::Define): Catch errors where a struct constructor is
3220 * cs-parser.jay: Pass location information for various new
3223 * delegate.cs (Delegate): take a location argument.
3225 * driver.cs: Do not call EmitCode if there were problesm in the
3226 Definition of the types, as many Builders wont be there.
3228 * decl.cs (Decl::Decl): Require a location argument.
3230 * cs-tokenizer.cs: Handle properly hex constants that can not fit
3231 into integers, and find the most appropiate integer for it.
3233 * literal.cs: Implement ULongLiteral.
3235 * rootcontext.cs: Provide better information about the location of
3236 failure when CreateType fails.
3238 2001-09-29 Miguel de Icaza <miguel@ximian.com>
3240 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
3243 * expression.cs (Binary::CheckShiftArguments): Add missing type
3245 (Binary::ResolveOperator): Add type to the logical and and logical
3246 or, Bitwise And/Or and Exclusive Or code paths, it was missing
3249 (Binary::DoNumericPromotions): In the case where either argument
3250 is ulong (and most signed types combined with ulong cause an
3251 error) perform implicit integer constant conversions as well.
3253 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3255 * expression.cs (UserImplicitCast): Method should always be
3257 (Invocation::BetterConversion): Simplified test for IntLiteral.
3259 (Expression::ImplicitNumericConversion): Split this routine out.
3260 Put the code that performs implicit constant integer conversions
3263 (Expression::Resolve): Become a wrapper around DoResolve so we can
3264 check eclass and type being set after resolve.
3266 (Invocation::Badness): Remove this dead function
3268 (Binary::ResolveOperator): Do not compute the expensive argumnets
3269 unless we have a union for it.
3271 (Probe::Emit): Is needs to do an isinst and then
3272 compare against null.
3274 (::CanConvert): Added Location argument. If the Location argument
3275 is null (Location.Null), then we do not report errors. This is
3276 used by the `probe' mechanism of the Explicit conversion. We do
3277 not want to generate an error for something that the user
3278 explicitly requested to be casted. But the pipeline for an
3279 explicit cast first tests for potential implicit casts.
3281 So for now, if the Location is null, it means `Probe only' to
3282 avoid adding another argument. Might have to revise this
3285 (ClassCast): New class used to type cast objects into arbitrary
3286 classes (used in Explicit Reference Conversions).
3288 Implement `as' as well.
3290 Reverted all the patches from Ravi below: they were broken:
3292 * The use of `level' as a mechanism to stop recursive
3293 invocations is wrong. That was there just to catch the
3294 bug with a strack trace but not as a way of addressing
3297 To fix the problem we have to *understand* what is going
3298 on and the interactions and come up with a plan, not
3299 just get things going.
3301 * The use of the type conversion cache that I proposed
3302 last night had an open topic: How does this work across
3303 protection domains. A user defined conversion might not
3304 be public in the location where we are applying the
3305 conversion, a different conversion might be selected
3306 (ie, private A->B (better) but public B->A (worse),
3307 inside A, A->B applies, but outside it, B->A will
3310 * On top of that (ie, even if the above is solved),
3311 conversions in a cache need to be abstract. Ie, `To
3312 convert from an Int to a Short use an OpcodeCast', not
3313 `To convert from an Int to a Short use the OpcodeCast on
3314 the variable 5' (which is what this patch was doing).
3316 2001-09-28 Ravi Pratap <ravi@ximian.com>
3318 * expression.cs (Invocation::ConversionExists): Re-write to use
3319 the conversion cache
3321 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
3322 cache all conversions done, not just user-defined ones.
3324 (Invocation::BetterConversion): The real culprit. Use ConversionExists
3325 to determine if a conversion exists instead of acutually trying to
3326 perform the conversion. It's faster too.
3328 (Expression::ConvertExplicit): Modify to use ConversionExists to check
3329 and only then attempt the implicit conversion.
3331 2001-09-28 Ravi Pratap <ravi@ximian.com>
3333 * expression.cs (ConvertImplicit): Use a cache for conversions
3334 already found. Check level of recursion and bail out if necessary.
3336 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3338 * typemanager.cs (string_concat_string_string, string_concat_object_object):
3339 Export standard methods that we expect for string operations.
3341 * statement.cs (Block::UsageWarning): Track usage of variables and
3342 report the errors for not used variables.
3344 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
3347 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3349 * codegen.cs: remove unnneded code
3351 * expression.cs: Removed BuiltinTypeAccess class
3353 Fix the order in which implicit conversions are
3356 The previous fixed dropped support for boxed conversions (adding a
3357 test to the test suite now)
3359 (UserImplicitCast::CanConvert): Remove test for source being null,
3360 that code is broken. We should not feed a null to begin with, if
3361 we do, then we should track the bug where the problem originates
3362 and not try to cover it up here.
3364 Return a resolved expression of type UserImplicitCast on success
3365 rather than true/false. Ravi: this is what I was talking about,
3366 the pattern is to use a static method as a "constructor" for
3369 Also, do not create arguments until the very last minute,
3370 otherwise we always create the arguments even for lookups that
3371 will never be performed.
3373 (UserImplicitCast::Resolve): Eliminate, objects of type
3374 UserImplicitCast are born in a fully resolved state.
3376 * typemanager.cs (InitCoreTypes): Init also value_type
3379 * expression.cs (Cast::Resolve): First resolve the child expression.
3381 (LValue): Add new method AddressOf to be used by
3384 Change the argument of Store to take an EmitContext instead of an
3385 ILGenerator, because things like FieldExpr need to be able to call
3386 their children expression to generate the instance code.
3388 (Expression::Error, Expression::Warning): Sugar functions for
3391 (Expression::MemberLookup): Accept a TypeContainer instead of a
3392 Report as the first argument.
3394 (Expression::ResolvePrimary): Killed. I still want to improve
3395 this as currently the code is just not right.
3397 (Expression::ResolveMemberAccess): Simplify, but it is still
3400 (Unary::Resolve): Catch errors in AddressOf operators.
3402 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
3403 index to a byte for the short-version, or the compiler will choose
3404 the wrong Emit call, which generates the wrong data.
3406 (ParameterReference::Emit, ::Store): same.
3408 (FieldExpr::AddressOf): Implement.
3410 * typemanager.cs: TypeManager: made public variable instead of
3413 * driver.cs: document --fatal.
3415 * report.cs (ErrorMessage, WarningMessage): new names for the old
3416 Error and Warning classes.
3418 * cs-parser.jay (member_access): Turn built-in access to types
3419 into a normal simplename
3421 2001-09-27 Ravi Pratap <ravi@ximian.com>
3423 * expression.cs (Invocation::BetterConversion): Fix to cope
3424 with q being null, since this was introducing a bug.
3426 * expression.cs (ConvertImplicit): Do built-in conversions first.
3428 2001-09-27 Ravi Pratap <ravi@ximian.com>
3430 * expression.cs (UserImplicitCast::Resolve): Fix bug.
3432 2001-09-27 Ravi Pratap <ravi@ximian.com>
3434 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
3435 I had introduced long ago (what's new ?).
3437 * expression.cs (UserImplicitCast::CanConvert): Static method to do
3438 the work of all the checking.
3439 (ConvertImplicit): Call CanConvert and only then create object if necessary.
3440 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
3442 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
3443 that is the right way.
3445 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
3446 overloading resolution. Use everywhere instead of cutting and pasting code.
3448 (Binary::ResolveOperator): Use MakeUnionSet.
3450 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
3451 we have to convert to bool types. Not complete yet.
3453 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3455 * typemanager.cs (TypeManager::CSharpName): support ushort.
3457 * expression.cs (Expression::TryImplicitIntConversion): Attempts
3458 to provide an expression that performsn an implicit constant int
3459 conversion (section 6.1.6).
3460 (Expression::ConvertImplicitRequired): Reworked to include
3461 implicit constant expression conversions.
3463 (Expression::ConvertNumericExplicit): Finished.
3465 (Invocation::Emit): If InstanceExpression is null, then it means
3466 that we perform a call on this.
3468 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3470 * expression.cs (Unary::Emit): Remove some dead code.
3471 (Probe): Implement Resolve and Emit for `is'.
3472 (Expression::ConvertImplicitRequired): Attempt to do constant
3473 expression conversions here. Maybe should be moved to
3474 ConvertImplicit, but I am not sure.
3475 (Expression::ImplicitLongConstantConversionPossible,
3476 Expression::ImplicitIntConstantConversionPossible): New functions
3477 that tell whether is it possible to apply an implicit constant
3478 expression conversion.
3480 (ConvertNumericExplicit): Started work on explicit numeric
3483 * cs-parser.jay: Update operator constants.
3485 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
3486 (Parameters::GetSignature): Hook up VerifyArgs here.
3487 (Parameters::VerifyArgs): Verifies that no two arguments have the
3490 * class.cs (Operator): Update the operator names to reflect the
3491 ones that the spec expects (as we are just stringizing the
3494 * expression.cs (Unary::ResolveOperator): Fix bug: Use
3495 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
3496 previous usage did only work for our methods.
3497 (Expression::ConvertImplicit): Handle decimal implicit numeric
3498 conversions as well.
3499 (Expression::InternalTypeConstructor): Used to invoke constructors
3500 on internal types for default promotions.
3502 (Unary::Emit): Implement special handling for the pre/post
3503 increment/decrement for overloaded operators, as they need to have
3504 the same semantics as the other operators.
3506 (Binary::ResolveOperator): ditto.
3507 (Invocation::ConversionExists): ditto.
3508 (UserImplicitCast::Resolve): ditto.
3510 2001-09-26 Ravi Pratap <ravi@ximian.com>
3512 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
3513 operator, return after emitting body. Regression tests pass again !
3515 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
3516 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
3517 (Invocation::OverloadResolve): Ditto.
3518 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
3520 * everywhere : update calls to the above methods accordingly.
3522 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3524 * assign.cs (Assign): Make it inherit from ExpressionStatement.
3526 * expression.cs (ExpressionStatement): New base class used for
3527 expressions that can appear in statements, so that we can provide
3528 an alternate path to generate expression that do not leave a value
3531 (Expression::Emit, and all the derivatives): We no longer return
3532 whether a value is left on the stack or not. Every expression
3533 after being emitted leaves a single value on the stack.
3535 * codegen.cs (EmitContext::EmitStatementExpression): Use the
3536 facilties of ExpressionStatement if possible.
3538 * cs-parser.jay: Update statement_expression.
3540 2001-09-25 Miguel de Icaza <miguel@ximian.com>
3542 * driver.cs: Change the wording of message
3544 2001-09-25 Ravi Pratap <ravi@ximian.com>
3546 * expression.cs (Binary::ResolveOperator): Had forgottten to set
3547 the type of the expression to the return type of the method if
3548 we have an overloaded operator match ! The regression tests pass again !
3549 (Unary::ResolveOperator): Ditto.
3551 * expression.cs (Invocation::ConversionExists): Correct the member lookup
3552 to find "op_Implicit", not "implicit" ;-)
3553 (UserImplicitCast): New class to take care of user-defined implicit conversions.
3554 (ConvertImplicit, ForceConversion): Take TypeContainer argument
3556 * everywhere : Correct calls to the above accordingly.
3558 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
3559 (ConvertImplicit): Do user-defined conversion if it exists.
3561 2001-09-24 Miguel de Icaza <miguel@ximian.com>
3563 * assign.cs: track location.
3564 (Resolve): Use implicit conversions on assignment.
3566 * literal.cs: Oops. Not good, Emit of short access values should
3567 pass (Bytes) or the wrong argument will be selected.
3569 * expression.cs (Unary::Emit): Emit code for -expr.
3571 (Unary::ResolveOperator): Handle `Substract' for non-constants
3572 (substract from zero from the non-constants).
3573 Deal with Doubles as well.
3575 (Expression::ConvertImplicitRequired): New routine that reports an
3576 error if no implicit conversion exists.
3578 (Invocation::OverloadResolve): Store the converted implicit
3579 expressions if we make them
3581 2001-09-24 Ravi Pratap <ravi@ximian.com>
3583 * class.cs (ConstructorInitializer): Take a Location argument.
3584 (ConstructorBaseInitializer): Same here.
3585 (ConstructorThisInitializer): Same here.
3587 * cs-parser.jay : Update all calls accordingly.
3589 * expression.cs (Unary, Binary, New): Take location argument.
3590 Update accordingly everywhere.
3592 * cs-parser.jay : Update all calls to the above to take a location
3597 2001-09-24 Ravi Pratap <ravi@ximian.com>
3599 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
3600 (Invocation::BetterConversion): Same here
3601 (Invocation::ConversionExists): Ditto.
3603 (Invocation::ConversionExists): Implement.
3605 2001-09-22 Ravi Pratap <ravi@ximian.com>
3607 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
3608 Also take an additional TypeContainer argument.
3610 * All over : Pass in TypeContainer as argument to OverloadResolve.
3612 * typemanager.cs (CSharpName): Update to check for the string type and return
3615 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
3618 2001-09-21 Ravi Pratap <ravi@ximian.com>
3620 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
3621 (Invocation::BetterFunction): Implement.
3622 (Invocation::BetterConversion): Implement.
3623 (Invocation::ConversionExists): Skeleton, no implementation yet.
3625 Okay, things work fine !
3627 2001-09-21 Miguel de Icaza <miguel@ximian.com>
3629 * typemanager.cs: declare and load enum_type, delegate_type and
3632 * expression.cs (Expression::Emit): Now emit returns a value that
3633 tells whether a value is left on the stack or not. This strategy
3634 might be reveted tomorrow with a mechanism that would address
3635 multiple assignments.
3636 (Expression::report118): Utility routine to report mismatches on
3639 (Unary::Report23): Report impossible type/operator combination
3642 (Unary::IsIncrementableNumber): Whether the type can be
3643 incremented or decremented with add.
3644 (Unary::ResolveOperator): Also allow enumerations to be bitwise
3646 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
3648 (Invocation::Emit): Deal with new Emit convetion.
3650 * All Expression derivatives: Updated their Emit method to return
3651 whether they leave values on the stack or not.
3653 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
3654 stack for expressions that are statements.
3656 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3658 * expression.cs (LValue): New interface. Must be implemented by
3660 (LocalVariableReference, ParameterReference, FieldExpr): Implement
3663 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
3664 interface for generating code, simplifies the code.
3666 2001-09-20 Ravi Pratap <ravi@ximian.com>
3668 * expression.cs (everywhere): Comment out return statements in ::Resolve
3669 methods to avoid the warnings.
3671 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3673 * driver.cs (parse): Report error 2001 if we can not open the
3676 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
3679 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
3682 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
3683 otherwise nested blocks end up with the same index.
3685 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
3687 * expression.cs: Instead of having FIXMEs in the Resolve
3688 functions, throw exceptions so it is obvious that we are facing a
3691 * cs-parser.jay (invocation_expression): Pass Location information.
3693 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
3694 Use a basename for those routines because .NET does not like paths
3697 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
3700 2001-09-19 Miguel de Icaza <miguel@ximian.com>
3702 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
3703 are loading the correct data types (throws an exception if not).
3704 (TypeManager::InitCoreTypes): Use CoreLookupType
3706 * expression.cs (Unary::ResolveOperator): return the child
3707 expression for expressions which are just +expr.
3708 (Unary::ResolveOperator): Return negative literals for -LITERAL
3709 expressions (otherwise they are Unary {Literal}).
3710 (Invocation::Badness): Take into account `Implicit constant
3711 expression conversions'.
3713 * literal.cs (LongLiteral): Implement long literal class.
3714 (IntLiteral): export the `Value' of the intliteral.
3716 2001-09-19 Ravi Pratap <ravi@ximian.com>
3718 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
3720 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
3721 instead of 'Operator'
3723 * expression.cs (Binary::ResolveOperator): Update accordingly.
3724 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
3727 * cs-parser.jay (unary_expression): Update to use the new names.
3729 * gen-treedump.cs (GetUnary): Same here.
3731 * expression.cs (Unary::Resolve): Implement.
3732 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
3733 operators are found instead of making noise ;-)
3734 (Unary::ResolveOperator): New method to do precisely the same thing which
3735 Binary::ResolveOperator does for Binary expressions.
3736 (Unary.method, .Arguments): Add.
3737 (Unary::OperName): Implement.
3738 (Unary::ForceConversion): Copy and Paste !
3740 * class.cs (Operator::Define): Fix a small bug for the case when we have
3743 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
3744 for the inbuilt operators. Only overloading works for now ;-)
3746 2001-09-18 Miguel de Icaza <miguel@ximian.com>
3748 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
3749 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
3751 * expression.cs (This::Emit): Implement.
3752 (This::Resolve): Implement.
3753 (TypeOf:Resolve): Implement.
3754 (Expression::ResolveSimpleName): Add an implicit this to instance
3756 (MemberAccess::Resolve): Deal with Parameters and Fields.
3757 Bind instance variable to Field expressions.
3758 (FieldExpr::Instance): New field used to track the expression that
3759 represents the object instance.
3760 (FieldExpr::Resolve): Track potential errors from MemberLookup not
3762 (FieldExpr::Emit): Implement.
3764 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
3765 the last instruction contains a return opcode to avoid generating
3766 the last `ret' instruction (this generates correct code, and it is
3767 nice to pass the peverify output).
3769 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
3770 initializer for static and instance variables.
3771 (Constructor::Emit): Allow initializer to be null in the case of
3772 static constructors. Only emit initializer for instance
3775 (TypeContainer::FindMembers): Return a null array if there are no
3778 Also fix the code for the MemberTypes.Method branch, as it was not
3779 scanning that for operators (or tried to access null variables before).
3781 * assign.cs (Assign::Emit): Handle instance and static fields.
3785 * driver.cs: Stop compilation if there are parse errors.
3787 * cs-parser.jay (constructor_declaration): Provide default base
3788 initializer for non-static constructors.
3789 (constructor_declarator): Do not provide a default base
3790 initializers if none was specified.
3791 Catch the fact that constructors should not have parameters.
3793 * class.cs: Do not emit parent class initializers for static
3794 constructors, that should be flagged as an error.
3796 2001-09-18 Ravi Pratap <ravi@ximian.com>
3798 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
3799 Move back code into TypeContainer::Populate.
3801 2001-09-18 Ravi Pratap <ravi@ximian.com>
3803 * class.cs (TypeContainer::AddConstructor): Fix the check to
3804 compare against Name, not Basename.
3805 (Operator::OpType): Change Plus and Minus to Add and Subtract.
3807 * cs-parser.jay : Update accordingly.
3809 * class.cs (TypeContainer::FindMembers): For the case where we are searching
3810 for methods, don't forget to look into the operators too.
3811 (RegisterMethodBuilder): Helper method to take care of this for
3812 methods, constructors and operators.
3813 (Operator::Define): Completely revamp.
3814 (Operator.OperatorMethod, MethodName): New fields.
3815 (TypeContainer::Populate): Move the registering of builders into
3816 RegisterMethodBuilder.
3817 (Operator::Emit): Re-write.
3819 * expression.cs (Binary::Emit): Comment out code path to emit method
3820 invocation stuff for the case when we have a user defined operator. I am
3821 just not able to get it right !
3823 2001-09-17 Miguel de Icaza <miguel@ximian.com>
3825 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
3828 (Expression::MemberLookup): Provide a version that allows to
3829 specify the MemberTypes and BindingFlags.
3831 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
3832 so it was not fetching variable information from outer blocks.
3834 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
3835 Beforefieldinit as it was buggy.
3837 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
3840 * class.cs (Constructor::Emit): Only emit if block is not null.
3841 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
3842 deal with this by semantically definining it as if the user had
3845 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
3846 constructors as we now "emit" them at a higher level.
3848 (TypeContainer::DefineDefaultConstructor): Used to define the
3849 default constructors if none was provided.
3851 (ConstructorInitializer): Add methods Resolve and Emit.
3853 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
3855 2001-09-17 Ravi Pratap <ravi@ximian.com>
3857 * class.cs (TypeContainer::EmitDefaultConstructor): Register
3858 the default constructor builder with our hashtable for methodbuilders
3861 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
3862 and argument_count is 0 in which case we have a match.
3863 (Binary::ResolveOperator): More null checking and miscellaneous coding
3866 2001-09-17 Ravi Pratap <ravi@ximian.com>
3868 * rootcontext.cs (IsNameSpace): Compare against null.
3870 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
3872 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
3873 and Unary::Operator.
3875 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
3878 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
3879 we have overloaded operators.
3880 (Binary::ResolveOperator): Implement the part which does the operator overload
3883 * class.cs (Operator::Emit): Implement.
3884 (TypeContainer::Emit): Emit the operators we have too.
3886 * expression.cs (Binary::Emit): Update to emit the appropriate code for
3887 the case when we have a user-defined operator.
3889 2001-09-17 Miguel de Icaza <miguel@ximian.com>
3891 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
3893 2001-09-16 Ravi Pratap <ravi@ximian.com>
3895 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
3896 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
3897 (Constructor::Emit): Implement.
3898 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
3899 if we have no work to do.
3900 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
3903 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
3904 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
3906 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
3909 2001-09-15 Ravi Pratap <ravi@ximian.com>
3911 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
3913 (Tree::RecordNamespace): Method to do what the name says ;-)
3914 (Tree::Namespaces): Property to get at the namespaces hashtable.
3916 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
3919 * rootcontext.cs (IsNamespace): Fixed it :-)
3921 2001-09-14 Miguel de Icaza <miguel@ximian.com>
3923 * class.cs (TypeContainer::FindMembers): Add support for
3925 (MethodCore): New class that encapsulates both the shared aspects
3926 of a Constructor and a Method.
3927 (Method, Constructor): Factored pieces into MethodCore.
3929 * driver.cs: Added --fatal which makes errors throw exceptions.
3930 Load System assembly as well as part of the standard library.
3932 * report.cs: Allow throwing exceptions on errors for debugging.
3934 * modifiers.cs: Do not use `parent', instead use the real type
3935 container to evaluate permission settings.
3937 * class.cs: Put Ravi's patch back in. He is right, and we will
3938 have to cope with the
3940 2001-09-14 Ravi Pratap <ravi@ximian.com>
3942 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
3943 FamORAssem, not FamANDAssem.
3945 2001-09-14 Miguel de Icaza <miguel@ximian.com>
3947 * driver.cs: Added --parse option that only parses its input files
3950 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
3951 incorrect. IsTopLevel is not used to tell whether an object is
3952 root_types or not (that can be achieved by testing this ==
3953 root_types). But to see if this is a top-level *class* (not
3954 necessarly our "toplevel" container).
3956 2001-09-14 Ravi Pratap <ravi@ximian.com>
3958 * enum.cs (Enum::Define): Modify to call the Lookup method on the
3959 parent instead of a direct call to GetType.
3961 2001-09-14 Ravi Pratap <ravi@ximian.com>
3963 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
3964 Modifiers.TypeAttr. This should just be a call to that method.
3966 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
3967 object so that we can determine if we are top-level or not.
3969 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
3972 * enum.cs (Enum::Define): Ditto.
3974 * modifiers.cs (FieldAttr): Re-write.
3976 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
3977 (TypeContainer::HaveStaticConstructor): New property to provide access
3978 to precisely that info.
3980 * modifiers.cs (MethodAttr): Re-write.
3981 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
3983 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
3984 of top-level types as claimed.
3986 2001-09-13 Miguel de Icaza <miguel@ximian.com>
3988 * expression.cs (MemberLookup): Fruitless attempt to lookup
3989 constructors. Maybe I need to emit default constructors? That
3990 might be it (currently .NET emits this for me automatically).
3991 (Invocation::OverloadResolve): Cope with Arguments == null.
3992 (Invocation::EmitArguments): new function, shared by the new
3994 (Invocation::Emit): Handle static and instance methods. Emit
3995 proper call instruction for virtual or non-virtual invocations.
3996 (New::Emit): Implement.
3997 (New::Resolve): Implement.
3998 (MemberAccess:Resolve): Implement.
3999 (MethodGroupExpr::InstanceExpression): used conforming to the spec
4001 (FieldExpr::Resolve): Set type.
4003 * support.cs: Handle empty arguments.
4005 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
4006 SimpleLookup): Auxiliary routines to help parse a qualifier
4009 Update qualifier_identifier rule.
4011 * codegen.cs: Removed debugging messages.
4013 * class.cs: Make this a global thing, this acts just as a "key" to
4014 objects that we might have around.
4016 (Populate): Only initialize method_builders_to_methods once.
4018 * expression.cs (PropertyExpr): Initialize type from the
4021 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
4022 Resolve pattern. Attempt to implicitly convert value to boolean.
4025 * expression.cs: Set the type for the int32/int32 argument case.
4026 (Binary::ResolveOperator): Set the return type to boolean for
4027 comparission operators
4029 * typemanager.cs: Remove debugging print code.
4031 (Invocation::Resolve): resolve type.
4033 * class.cs: Allocate a MemberInfo of the correct size, as the code
4034 elsewhere depends on the test to reflect the correct contents.
4036 (Method::) Keep track of parameters, due to System.Reflection holes
4038 (TypeContainer::Populate): Keep track of MethodBuilders to Method
4041 (TypeContainer::FindMembers): Use ArrayList and then copy an array
4042 of the exact size and return that.
4044 (Class::LookupMethodByBuilder): New function that maps
4045 MethodBuilders to its methods. Required to locate the information
4046 on methods because System.Reflection bit us again.
4048 * support.cs: New file, contains an interface ParameterData and
4049 two implementations: ReflectionParameters and InternalParameters
4050 used to access Parameter information. We will need to grow this
4053 * expression.cs (Invocation::GetParameterData): implement a cache
4054 and a wrapper around the ParameterData creation for methods.
4055 (Invocation::OverloadResolve): Use new code.
4057 2001-09-13 Ravi Pratap <ravi@ximian.com>
4059 * class.cs (TypeContainer::EmitField): Remove and move into
4060 (Field::Define): here and modify accordingly.
4061 (Field.FieldBuilder): New member.
4062 (TypeContainer::Populate): Update accordingly.
4063 (TypeContainer::FindMembers): Implement.
4065 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4067 * statement.cs: (VariableInfo::VariableType): New field to be
4068 initialized with the full type once it is resolved.
4070 2001-09-12 Miguel de Icaza <miguel@ximian.com>
4072 * parameter.cs (GetParameterInfo): Use a type cache to compute
4073 things only once, and to reuse this information
4075 * expression.cs (LocalVariableReference::Emit): Implement.
4076 (OpcodeCast::Emit): fix.
4078 (ParameterReference::Resolve): Implement.
4079 (ParameterReference::Emit): Implement.
4081 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
4082 that are expressions need to stay as Expressions.
4084 * typemanager.cs (CSharpName): Returns the C# name of a type if
4087 * expression.cs (Expression::ConvertImplicit): New function that
4088 implements implicit type conversions.
4090 (Expression::ImplicitReferenceConversion): Implements implicit
4091 reference conversions.
4093 (EmptyCast): New type for transparent casts.
4095 (OpcodeCast): New type for casts of types that are performed with
4096 a sequence of bytecodes.
4098 (BoxedCast): New type used for casting value types into reference
4099 types. Emits a box opcode.
4101 (Binary::DoNumericPromotions): Implements numeric promotions of
4102 and computation of the Binary::Type.
4104 (Binary::EmitBranchable): Optimization.
4106 (Binary::Emit): Implement code emission for expressions.
4108 * typemanager.cs (TypeManager): Added two new core types: sbyte
4111 2001-09-12 Ravi Pratap <ravi@ximian.com>
4113 * class.cs (TypeContainer::FindMembers): Method which does exactly
4114 what Type.FindMembers does, only we don't have to use reflection. No
4117 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
4118 typecontainer objects as we need to get at them.
4119 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
4121 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
4122 typecontainer object.
4124 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
4125 of just a Report object.
4127 2001-09-11 Ravi Pratap <ravi@ximian.com>
4129 * class.cs (Event::Define): Go back to using the prefixes "add_" and
4131 (TypeContainer::Populate): Now define the delegates of the type too.
4132 (TypeContainer.Delegates): Property to access the list of delegates defined
4135 * delegates.cs (Delegate::Define): Implement partially.
4137 * modifiers.cs (TypeAttr): Handle more flags.
4139 2001-09-11 Ravi Pratap <ravi@ximian.com>
4141 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
4143 (Operator::Define): Re-write logic to get types by using the LookupType method
4144 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
4145 (Indexer::Define): Ditto.
4146 (Event::Define): Ditto.
4147 (Property::Define): Ditto.
4149 2001-09-10 Ravi Pratap <ravi@ximian.com>
4151 * class.cs (TypeContainer::Populate): Now define operators too.
4152 (TypeContainer.Operators): New property to access the list of operators
4154 (Operator.OperatorMethodBuilder): New member to hold the method builder
4155 for the operator we are defining.
4156 (Operator::Define): Implement.
4158 2001-09-10 Ravi Pratap <ravi@ximian.com>
4160 * class.cs (Event::Define): Make the prefixes of the accessor methods
4161 addOn_ and removeOn_
4163 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
4164 of the location being passed in too. Ideally, this should go later since all
4165 error reporting should be done through the Report object.
4167 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
4168 (Populate): Iterate thru the indexers we have and define them too.
4169 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
4170 for the get and set accessors.
4171 (Indexer::Define): Implement.
4173 2001-09-09 Miguel de Icaza <miguel@ximian.com>
4175 * expression.cs (Binary::Resolve): Beginning of it. I scratched
4176 my previous implementation, did not work.
4178 * typemanager.cs: Add a couple of missing types (the longs).
4180 * literal.cs: Use TypeManager.bool_type instead of getting it.
4182 * expression.cs (EventExpr): New kind of expressions.
4183 (Expressio::ExprClassFromMemberInfo): finish
4185 2001-09-08 Miguel de Icaza <miguel@ximian.com>
4187 * assign.cs: Emit stores to static fields differently.
4189 2001-09-08 Ravi Pratap <ravi@ximian.com>
4191 * Merge in changes and adjust code to tackle conflicts. Backed out my
4192 code in Assign::Resolve ;-)
4194 2001-09-08 Ravi Pratap <ravi@ximian.com>
4196 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
4197 instead Report.Error and also pass in the location.
4198 (CSharpParser::Lexer): New readonly property to return the reference
4199 to the Tokenizer object.
4200 (declare_local_variables): Use Report.Error with location instead of plain
4204 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
4205 (Operator.CheckBinaryOperator): Ditto.
4207 * cs-parser.jay (operator_declarator): Update accordingly.
4209 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
4210 (CheckBinaryOperator): Same here.
4212 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
4213 on the name without any prefixes of namespace names etc. This is because we
4214 already might have something already fully qualified like
4215 'System.Console.WriteLine'
4217 * assign.cs (Resolve): Begin implementation. Stuck ;-)
4219 2001-09-07 Ravi Pratap <ravi@ximian.com>
4221 * cs-tokenizer.cs (location): Return a string which also contains
4224 * expression.cs (ElementAccess): New class for expressions of the
4225 type 'element access.'
4226 (BaseAccess): New class for expressions of the type 'base access.'
4227 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
4230 * cs-parser.jay (element_access): Implement action.
4231 (base_access): Implement actions.
4232 (checked_expression, unchecked_expression): Implement.
4234 * cs-parser.jay (local_variable_type): Correct and implement.
4235 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
4237 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
4239 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
4240 name and the specifiers.
4242 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
4244 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
4245 making them all public ;-)
4247 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
4250 2001-09-07 Miguel de Icaza <miguel@ximian.com>
4252 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
4254 (FieldExpr, PropertyExprs): New resolved expressions.
4255 (SimpleName::MemberStaticCheck): Perform static checks for access
4256 to non-static fields on static methods. Maybe this should be
4257 generalized for MemberAccesses.
4258 (SimpleName::ResolveSimpleName): More work on simple name
4261 * cs-parser.jay (primary_expression/qualified_identifier): track
4262 the parameter index.
4264 * codegen.cs (CodeGen::Save): Catch save exception, report error.
4265 (EmitContext::EmitBoolExpression): Chain to expression generation
4266 instead of temporary hack.
4267 (::EmitStatementExpression): Put generic expression code generation.
4269 * assign.cs (Assign::Emit): Implement variable assignments to
4270 local variables, parameters and fields.
4272 2001-09-06 Miguel de Icaza <miguel@ximian.com>
4274 * statement.cs (Block::GetVariableInfo): New method, returns the
4275 VariableInfo for a variable name in a block.
4276 (Block::GetVariableType): Implement in terms of GetVariableInfo
4278 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
4279 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
4281 2001-09-06 Ravi Pratap <ravi@ximian.com>
4283 * cs-parser.jay (operator_declaration): Continue on my quest : update
4284 to take attributes argument.
4285 (event_declaration): Ditto.
4286 (enum_declaration): Ditto.
4287 (indexer_declaration): Ditto.
4289 * class.cs (Operator::Operator): Update constructor accordingly.
4290 (Event::Event): Ditto.
4292 * delegate.cs (Delegate::Delegate): Same here.
4294 * enum.cs (Enum::Enum): Same here.
4296 2001-09-05 Ravi Pratap <ravi@ximian.com>
4298 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
4300 * ../tests/cs0658.cs : New file to demonstrate error 0658.
4302 * attribute.cs (Attributes): New class to encapsulate all attributes which were
4303 being passed around as an arraylist.
4304 (Attributes::AddAttribute): Method to add attribute sections.
4306 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
4307 (struct_declaration): Update accordingly.
4308 (constant_declaration): Update.
4309 (field_declaration): Update.
4310 (method_header): Update.
4311 (fixed_parameter): Update.
4312 (parameter_array): Ditto.
4313 (property_declaration): Ditto.
4314 (destructor_declaration): Ditto.
4316 * class.cs (Struct::Struct): Update constructors accordingly.
4317 (Class::Class): Ditto.
4318 (Field::Field): Ditto.
4319 (Method::Method): Ditto.
4320 (Property::Property): Ditto.
4321 (TypeContainer::OptAttribute): update property's return type.
4323 * interface.cs (Interface.opt_attributes): New member.
4324 (Interface::Interface): Update to take the extra Attributes argument.
4326 * parameter.cs (Parameter::Parameter): Ditto.
4328 * constant.cs (Constant::Constant): Ditto.
4330 * interface.cs (InterfaceMemberBase): New OptAttributes field.
4331 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
4332 the attributes as a parameter.
4333 (InterfaceProperty): Update constructor call.
4334 (InterfaceEvent): Ditto.
4335 (InterfaceMethod): Ditto.
4336 (InterfaceIndexer): Ditto.
4338 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
4339 pass the attributes too.
4340 (interface_event_declaration): Ditto.
4341 (interface_property_declaration): Ditto.
4342 (interface_method_declaration): Ditto.
4343 (interface_declaration): Ditto.
4345 2001-09-05 Miguel de Icaza <miguel@ximian.com>
4347 * class.cs (Method::Define): Track the "static Main" definition to
4348 create an entry point.
4350 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
4351 EntryPoint if we find it.
4353 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
4354 (EmitContext::ig): Make this variable public.
4356 * driver.cs: Make the default output file be the first file name
4357 with the .exe extension.
4359 Detect empty compilations
4361 Handle various kinds of output targets. Handle --target and
4362 rename -t to --dumper.
4364 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
4365 methods inherited from Expression return now an Expression. This
4366 will is used during the tree rewriting as we resolve them during
4369 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
4370 the spec. Missing entirely is the information about
4371 accessability of elements of it.
4373 (Expression::ExprClassFromMemberInfo): New constructor for
4374 Expressions that creates a fully initialized Expression based on
4375 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
4378 (Invocation::Resolve): Begin implementing resolution of invocations.
4380 * literal.cs (StringLiteral): Implement Emit.
4382 2001-09-05 Ravi Pratap <ravi@ximian.com>
4384 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
4387 2001-09-04 Ravi Pratap <ravi@ximian.com>
4389 * cs-parser.jay (attribute_arguments): Implement actions.
4390 (attribute): Fix bug in production. Implement action.
4391 (attribute_list): Implement.
4392 (attribute_target): Implement.
4393 (attribute_target_specifier, opt_target_specifier): Implement
4394 (CheckAttributeTarget): New method to check if the attribute target
4396 (attribute_section): Implement.
4397 (opt_attributes): Implement.
4399 * attribute.cs : New file to handle attributes.
4400 (Attribute): Class to hold attribute info.
4402 * cs-parser.jay (opt_attribute_target_specifier): Remove production
4403 (attribute_section): Modify production to use 2 different rules to
4404 achieve the same thing. 1 s/r conflict down !
4405 Clean out commented, useless, non-reducing dimension_separator rules.
4407 * class.cs (TypeContainer.attributes): New member to hold list
4408 of attributes for a type.
4409 (Struct::Struct): Modify to take one more argument, the attribute list.
4410 (Class::Class): Ditto.
4411 (Field::Field): Ditto.
4412 (Method::Method): Ditto.
4413 (Property::Property): Ditto.
4415 * cs-parser.jay (struct_declaration): Update constructor call to
4416 pass in the attributes too.
4417 (class_declaration): Ditto.
4418 (constant_declaration): Ditto.
4419 (field_declaration): Ditto.
4420 (method_header): Ditto.
4421 (fixed_parameter): Ditto.
4422 (parameter_array): Ditto.
4423 (property_declaration): Ditto.
4425 * constant.cs (Constant::Constant): Update constructor similarly.
4426 Use System.Collections.
4428 * parameter.cs (Parameter::Parameter): Update as above.
4430 2001-09-02 Ravi Pratap <ravi@ximian.com>
4432 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
4433 (TypeContainer.delegates): New member to hold list of delegates.
4435 * cs-parser.jay (delegate_declaration): Implement the action correctly
4436 this time as I seem to be on crack ;-)
4438 2001-09-02 Miguel de Icaza <miguel@ximian.com>
4440 * rootcontext.cs (RootContext::IsNamespace): new function, used to
4441 tell whether an identifier represents a namespace.
4443 * expression.cs (NamespaceExpr): A namespace expression, used only
4444 temporarly during expression resolution.
4445 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
4446 utility functions to resolve names on expressions.
4448 2001-09-01 Miguel de Icaza <miguel@ximian.com>
4450 * codegen.cs: Add hook for StatementExpressions.
4452 * class.cs: Fix inverted test for static flag in methods.
4454 2001-09-02 Ravi Pratap <ravi@ximian.com>
4456 * class.cs (Operator::CheckUnaryOperator): Correct error number used
4457 to make it coincide with MS' number.
4458 (Operator::CheckBinaryOperator): Ditto.
4460 * ../errors/errors.txt : Remove error numbers added earlier.
4462 * ../errors/cs1019.cs : Test case for error # 1019
4464 * ../errros/cs1020.cs : Test case for error # 1020
4466 * cs-parser.jay : Clean out commented cruft.
4467 (dimension_separators, dimension_separator): Comment out. Ostensibly not
4468 used anywhere - non-reducing rule.
4469 (namespace_declarations): Non-reducing rule - comment out.
4471 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
4472 with TypeContainer::AddEnum.
4474 * delegate.cs : New file for delegate handling classes.
4475 (Delegate): Class for declaring delegates.
4477 * makefile : Update.
4479 * cs-parser.jay (delegate_declaration): Implement.
4481 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
4483 * class.cs (Event::Define): Implement.
4484 (Event.EventBuilder): New member.
4486 * class.cs (TypeContainer::Populate): Update to define all enums and events
4488 (Events): New property for the events arraylist we hold. Shouldn't we move to using
4489 readonly fields for all these cases ?
4491 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4493 * class.cs (Property): Revamp to use the convention of making fields readonly.
4494 Accordingly modify code elsewhere.
4496 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
4497 the Define method of the Property class.
4499 * class.cs : Clean up applied patch and update references to variables etc. Fix
4501 (TypeContainer::Populate): Update to define all the properties we have. Also
4502 define all enumerations.
4504 * enum.cs (Define): Implement.
4506 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4508 * cs-parser.jay (overloadable_operator): The semantic value is an
4509 enum of the Operator class.
4510 (operator_declarator): Implement actions.
4511 (operator_declaration): Implement.
4513 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
4514 validity of definitions.
4515 (Operator::CheckBinaryOperator): Static method to check for binary operators
4516 (TypeContainer::AddOperator): New method to add an operator to a type.
4518 * cs-parser.jay (indexer_declaration): Added line to actually call the
4519 AddIndexer method so it gets added ;-)
4521 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
4522 already taken care of by the MS compiler ?
4524 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4526 * class.cs (Operator): New class for operator declarations.
4527 (Operator::OpType): Enum for the various operators.
4529 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4531 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
4532 ostensibly handle this in semantic analysis.
4534 * cs-parser.jay (general_catch_clause): Comment out
4535 (specific_catch_clauses, specific_catch_clause): Ditto.
4536 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
4537 (catch_args, opt_catch_args): New productions.
4538 (catch_clause): Rewrite to use the new productions above
4539 (catch_clauses): Modify accordingly.
4540 (opt_catch_clauses): New production to use in try_statement
4541 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
4542 and re-write the code in the actions to extract the specific and
4543 general catch clauses by being a little smart ;-)
4545 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
4546 Hooray, try and catch statements parse fine !
4548 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4550 * statement.cs (Block::GetVariableType): Fix logic to extract the type
4551 string from the hashtable of variables.
4553 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
4554 I end up making that mistake ;-)
4555 (catch_clauses): Fixed gross error which made Key and Value of the
4556 DictionaryEntry the same : $1 !!
4558 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4560 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
4562 * cs-parser.jay (event_declaration): Correct to remove the semicolon
4563 when the add and remove accessors are specified.
4565 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4567 * cs-parser.jay (IndexerDeclaration): New helper class to hold
4568 information about indexer_declarator.
4569 (indexer_declarator): Implement actions.
4570 (parsing_indexer): New local boolean used to keep track of whether
4571 we are parsing indexers or properties. This is necessary because
4572 implicit_parameters come into picture even for the get accessor in the
4574 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
4576 * class.cs (Indexer): New class for indexer declarations.
4577 (TypeContainer::AddIndexer): New method to add an indexer to a type.
4578 (TypeContainer::indexers): New member to hold list of indexers for the
4581 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4583 * cs-parser.jay (add_accessor_declaration): Implement action.
4584 (remove_accessor_declaration): Implement action.
4585 (event_accessors_declaration): Implement
4586 (variable_declarators): swap statements for first rule - trivial.
4588 * class.cs (Event): New class to hold information about event
4590 (TypeContainer::AddEvent): New method to add an event to a type
4591 (TypeContainer::events): New member to hold list of events.
4593 * cs-parser.jay (event_declaration): Implement actions.
4595 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4597 * cs-parser.jay (dim_separators): Implement. Make it a string
4598 concatenating all the commas together, just as they appear.
4599 (opt_dim_separators): Modify accordingly
4600 (rank_specifiers): Update accordingly. Basically do the same
4601 thing - instead, collect the brackets here.
4602 (opt_rank_sepcifiers): Modify accordingly.
4603 (array_type): Modify to actually return the complete type string
4604 instead of ignoring the rank_specifiers.
4605 (expression_list): Implement to collect the expressions
4606 (variable_initializer): Implement. We make it a list of expressions
4607 essentially so that we can handle the array_initializer case neatly too.
4608 (variable_initializer_list): Implement.
4609 (array_initializer): Make it a list of variable_initializers
4610 (opt_array_initializer): Modify accordingly.
4612 * expression.cs (New::NType): Add enumeration to help us
4613 keep track of whether we have an object/delegate creation
4614 or an array creation.
4615 (New:NewType, New::Rank, New::Indices, New::Initializers): New
4616 members to hold data about array creation.
4617 (New:New): Modify to update NewType
4618 (New:New): New Overloaded contructor for the array creation
4621 * cs-parser.jay (array_creation_expression): Implement to call
4622 the overloaded New constructor.
4624 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
4626 * class.cs (TypeContainer::Constructors): Return member
4627 constructors instead of returning null.
4629 2001-08-26 Miguel de Icaza <miguel@ximian.com>
4631 * typemanager.cs (InitCoreTypes): Initialize the various core
4632 types after we have populated the type manager with the user
4633 defined types (this distinction will be important later while
4634 compiling corlib.dll)
4636 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
4637 on Expression Classification. Now all expressions have a method
4638 `Resolve' and a method `Emit'.
4640 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
4641 generation from working. Also add some temporary debugging
4644 2001-08-24 Miguel de Icaza <miguel@ximian.com>
4646 * codegen.cs: Lots of code generation pieces. This is only the
4647 beginning, will continue tomorrow with more touches of polish. We
4648 handle the fundamentals of if, while, do, for, return. Others are
4649 trickier and I need to start working on invocations soon.
4651 * gen-treedump.cs: Bug fix, use s.Increment here instead of
4654 * codegen.cs (EmitContext): New struct, used during code
4655 emission to keep a context. Most of the code generation will be
4658 * cs-parser.jay: Add embedded blocks to the list of statements of
4659 this block. So code generation proceeds in a top down fashion.
4661 2001-08-23 Miguel de Icaza <miguel@ximian.com>
4663 * statement.cs: Add support for multiple child blocks.
4665 2001-08-22 Miguel de Icaza <miguel@ximian.com>
4667 * codegen.cs (EmitCode): New function, will emit the code for a
4668 Block of code given a TypeContainer and its ILGenerator.
4670 * statement.cs (Block): Standard public readonly optimization.
4671 (Block::Block constructors): Link children.
4672 (Block::Child): Child Linker.
4673 (Block::EmitVariables): Emits IL variable declarations.
4675 * class.cs: Drop support for MethodGroups here, delay until
4677 (Method::): Applied the same simplification that I did before, and
4678 move from Properties to public readonly fields.
4679 (Method::ParameterTypes): Returns the parameter types for the
4680 function, and implements a cache that will be useful later when I
4681 do error checking and the semantic analysis on the methods is
4683 (Constructor::GetCallingConvention): Renamed from CallingConvetion
4684 and made a method, optional argument tells whether this is a class
4685 or a structure to apply the `has-this' bit.
4686 (Method::GetCallingConvention): Implement, returns the calling
4688 (Method::Define): Defines the type, a second pass is performed
4689 later to populate the methods.
4691 (Constructor::ParameterTypes): implement a cache similar to the
4692 one on Method::ParameterTypes, useful later when we do semantic
4695 (TypeContainer::EmitMethod): New method. Emits methods.
4697 * expression.cs: Removed MethodGroup class from here.
4699 * parameter.cs (Parameters::GetCallingConvention): new method.
4701 2001-08-21 Miguel de Icaza <miguel@ximian.com>
4703 * class.cs (TypeContainer::Populate): Drop RootContext from the
4706 (Constructor::CallingConvention): Returns the calling convention.
4707 (Constructor::ParameterTypes): Returns the constructor parameter
4710 (TypeContainer::AddConstructor): Keep track of default constructor
4711 and the default static constructor.
4713 (Constructor::) Another class that starts using `public readonly'
4714 instead of properties.
4716 (Constructor::IsDefault): Whether this is a default constructor.
4718 (Field::) use readonly public fields instead of properties also.
4720 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
4721 track of static constructors; If none is used, turn on
4722 BeforeFieldInit in the TypeAttributes.
4724 * cs-parser.jay (opt_argument_list): now the return can be null
4725 for the cases where there are no arguments.
4727 (constructor_declarator): If there is no implicit `base' or
4728 `this', then invoke the default parent constructor.
4730 * modifiers.cs (MethodAttr): New static function maps a set of
4731 modifiers flags into a MethodAttributes enum
4732 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
4733 MethodAttr, TypeAttr to represent the various mappings where the
4735 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
4737 2001-08-19 Miguel de Icaza <miguel@ximian.com>
4739 * parameter.cs (GetParameterInfo): Fix bug where there would be no
4742 * interface.cs (PopulateIndexer): Implemented the code generator
4743 for interface indexers.
4745 2001-08-17 Miguel de Icaza <miguel@ximian.com>
4747 * interface.cs (InterfaceMemberBase): Now we track the new status
4750 (PopulateProperty): Implement property population. Woohoo! Got
4751 Methods and Properties going today.
4753 Removed all the properties for interfaces, and replaced them with
4754 `public readonly' fields.
4756 2001-08-16 Miguel de Icaza <miguel@ximian.com>
4758 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
4759 initialize their hashtables/arraylists only when they are needed
4760 instead of doing this always.
4762 * parameter.cs: Handle refs and out parameters.
4764 * cs-parser.jay: Use an ArrayList to construct the arguments
4765 instead of the ParameterCollection, and then cast that to a
4768 * parameter.cs: Drop the use of ParameterCollection and use
4769 instead arrays of Parameters.
4771 (GetParameterInfo): Use the Type, not the Name when resolving
4774 2001-08-13 Miguel de Icaza <miguel@ximian.com>
4776 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
4777 and instead use public readonly fields.
4779 * class.cs: Put back walking code for type containers.
4781 2001-08-11 Miguel de Icaza <miguel@ximian.com>
4783 * class.cs (MakeConstant): Code to define constants.
4785 * rootcontext.cs (LookupType): New function. Used to locate types
4788 2001-08-08 Miguel de Icaza <miguel@ximian.com>
4790 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
4791 this System.Reflection code is. Kudos to Microsoft
4793 * typemanager.cs: Implement a type cache and avoid loading all
4794 types at boot time. Wrap in LookupType the internals. This made
4795 the compiler so much faster. Wow. I rule!
4797 * driver.cs: Make sure we always load mscorlib first (for
4798 debugging purposes, nothing really important).
4800 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
4801 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
4803 * rootcontext.cs: Lookup types on their namespace; Lookup types
4804 on namespaces that have been imported using the `using' keyword.
4806 * class.cs (TypeContainer::TypeAttr): Virtualize.
4807 (Class::TypeAttr): Return attributes suitable for this bad boy.
4808 (Struct::TypeAttr): ditto.
4809 Handle nested classes.
4810 (TypeContainer::) Remove all the type visiting code, it is now
4811 replaced with the rootcontext.cs code
4813 * rootcontext.cs (GetClassBases): Added support for structs.
4815 2001-08-06 Miguel de Icaza <miguel@ximian.com>
4817 * interface.cs, statement.cs, class.cs, parameter.cs,
4818 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
4819 Drop use of TypeRefs, and use strings instead.
4821 2001-08-04 Miguel de Icaza <miguel@ximian.com>
4825 * class.cs (Struct::Struct): set the SEALED flags after
4826 checking the modifiers.
4827 (TypeContainer::TypeAttr): new property, returns the
4828 TypeAttributes for a class.
4830 * cs-parser.jay (type_list): Oops, list production was creating a
4831 new list of base types.
4833 * rootcontext.cs (StdLib): New property.
4834 (GetInterfaceTypeByName): returns an interface by type name, and
4835 encapsulates error handling here.
4836 (GetInterfaces): simplified.
4837 (ResolveTree): Encapsulated all the tree resolution here.
4838 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
4841 * driver.cs: Add support for --nostdlib, to avoid loading the
4843 (Main): Do not put tree resolution here.
4845 * rootcontext.cs: Beginning of the class resolution.
4847 2001-08-03 Miguel de Icaza <miguel@ximian.com>
4849 * rootcontext.cs: Provide better error reporting.
4851 * cs-parser.jay (interface_base): set our $$ to be interfaces.
4853 * rootcontext.cs (CreateInterface): Handle the case where there
4854 are no parent interfaces.
4856 (CloseTypes): Routine to flush types at the end.
4857 (CreateInterface): Track types.
4858 (GetInterfaces): Returns an array of Types from the list of
4861 * typemanager.c (AddUserType): Mechanism to track user types (puts
4862 the type on the global type hash, and allows us to close it at the
4865 2001-08-02 Miguel de Icaza <miguel@ximian.com>
4867 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
4868 RecordInterface instead.
4870 * cs-parser.jay: Updated to reflect changes above.
4872 * decl.cs (Definition): Keep track of the TypeBuilder type that
4873 represents this type here. Not sure we will use it in the long
4874 run, but wont hurt for now.
4876 * driver.cs: Smaller changes to accomodate the new code.
4878 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
4881 * rootcontext.cs (CreateInterface): New method, used to create
4882 the System.TypeBuilder type for interfaces.
4883 (ResolveInterfaces): new entry point to resolve the interface
4885 (CodeGen): Property, used to keep track of the code generator.
4887 2001-07-26 Miguel de Icaza <miguel@ximian.com>
4889 * cs-parser.jay: Add a second production for delegate_declaration
4892 (enum_body): Put an opt_comma here instead of putting it on
4893 enum_body or enum_member_declarations so we can handle trailing
4894 commas on enumeration members. Gets rid of a shift/reduce.
4896 (type_list): Need a COMMA in the middle.
4898 (indexer_declaration): Tell tokenizer to recognize get/set
4900 * Remove old targets.
4902 * Re-add the parser target.
4904 2001-07-13 Simon Cozens <simon@simon-cozens.org>
4906 * cs-parser.jay: Add precendence rules for a number of operators
4907 ot reduce the number of shift/reduce conflicts in the grammar.
4909 2001-07-17 Miguel de Icaza <miguel@ximian.com>
4911 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
4914 Get rid of old crufty code.
4916 * rootcontext.cs: Use this to keep track of the parsed
4917 representation and the defined types available to the program.
4919 * gen-treedump.cs: adjust for new convention.
4921 * type.cs: Split out the type manager, and the assembly builder
4924 * typemanager.cs: the type manager will live here now.
4926 * cil-codegen.cs: And the code generator here.
4928 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
4930 * makefile: Fixed up for easy making.
4932 2001-07-13 Simon Cozens <simon@simon-cozens.org>
4934 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
4937 (unary_expression): Expand pre_increment_expression and
4938 post_decrement_expression to reduce a shift/reduce.
4940 2001-07-11 Simon Cozens
4942 * cs-tokenizer.cs: Hex numbers should begin with a 0.
4944 Improve allow_keyword_as_indent name.
4946 2001-06-19 Miguel de Icaza <miguel@ximian.com>
4948 * Adjustments for Beta2.
4950 2001-06-13 Miguel de Icaza <miguel@ximian.com>
4952 * decl.cs: Added `Define' abstract method.
4953 (InTransit): new property, used to catch recursive definitions.
4955 * interface.cs: Implement `Define'.
4957 * modifiers.cs: Map Modifiers.constants to
4958 System.Reflection.TypeAttribute flags.
4960 * class.cs: Keep track of types and user-defined types.
4961 (BuilderInit): New method for creating an assembly
4962 (ResolveType): New function to launch the resolution process, only
4963 used by interfaces for now.
4965 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
4966 that are inserted into the name space.
4968 2001-06-08 Miguel de Icaza <miguel@ximian.com>
4970 * ARGH. I have screwed up my tree so many times due to the use of
4971 rsync rather than using CVS. Going to fix this at once.
4973 * driver.cs: Objetify driver. Load assemblies, use assemblies to
4976 2001-06-07 Miguel de Icaza <miguel@ximian.com>
4978 * Experiment successful: Use System.Type rather that our own
4981 2001-05-25 Miguel de Icaza <miguel@ximian.com>
4983 * cs-parser.jay: Removed nsAliases from here.
4985 Use new namespaces, handle `using XXX;'
4987 * namespace.cs: Reimplemented namespace handling, use a recursive
4988 definition of the class. Now we can keep track of using clauses
4989 and catch invalid using clauses.
4991 2001-05-24 Miguel de Icaza <miguel@ximian.com>
4993 * gen-treedump.cs: Adapted for all the renaming.
4995 * expression.cs (Expression): this class now has a Type property
4996 which returns an expression Type.
4998 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
4999 `Type', as this has a different meaning now in the base
5001 2001-05-22 Miguel de Icaza <miguel@ximian.com>
5003 * interface.cs, class.cs: Removed from all the sources the
5004 references to signature computation, as we can not do method
5005 signature computation during the parsing time, as we are not
5006 trying to solve at that point distinguishing:
5010 void a (NS.Blah x) {}
5013 Which depending on the context might be valid or not, as we do not
5014 know if Blah is the same thing as NS.Blah at that point.
5016 * Redid everything so the code uses TypeRefs now instead of
5017 Types. TypeRefs are just temporary type placeholders, that need
5018 to be resolved. They initially have a pointer to a string and the
5019 current scope in which they are used. This is used later by the
5020 compiler to resolve the reference to an actual Type.
5022 * DeclSpace is no longer a CIR.Type, and neither are
5023 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
5024 are all DeclSpaces, but no Types.
5026 * type.cs (TypeRefManager): This implements the TypeRef manager,
5027 which keeps track of all the types that need to be resolved after
5028 the parsing has finished.
5030 2001-05-13 Miguel de Icaza <miguel@ximian.com>
5032 * ARGH. We are going to have to store `foreach' as a class rather
5033 than resolving it, as we need to verify error 1579 after name
5034 resolution. *OR* we could keep a flag that says `This request to
5035 IEnumerator comes from a foreach statement' which we can then use
5036 to generate the error.
5038 2001-05-10 Miguel de Icaza <miguel@ximian.com>
5040 * class.cs (TypeContainer.AddMethod): we now add methods to the
5041 MethodGroup instead of the method hashtable.
5043 * expression.cs: Add MethodGroup abstraction, which gets us one
5044 step closer to the specification in the way we handle method
5047 * cs-parser.jay (primary_expression): qualified_identifier now
5048 tried to match up an identifier to a local variable reference or
5049 to a parameter reference.
5051 current_local_parameters is now a parser global variable that
5052 points to the current parameters for the block, used during name
5055 (property_declaration): Now creates an implicit `value' argument to
5058 2001-05-09 Miguel de Icaza <miguel@ximian.com>
5060 * parameter.cs: Do not use `param' arguments as part of the
5061 signature, per the spec.
5063 2001-05-08 Miguel de Icaza <miguel@ximian.com>
5065 * decl.cs: Base class for classes, structs and interfaces. This
5066 is the "Declaration Space"
5068 * cs-parser.jay: Use CheckDef for checking declaration errors
5069 instead of having one on each function.
5071 * class.cs: Factor out some code for handling error handling in
5072 accordance to the "Declarations" section in the "Basic Concepts"
5073 chapter in the ECMA C# spec.
5075 * interface.cs: Make all interface member classes derive from
5076 InterfaceMemberBase.
5078 2001-05-07 Miguel de Icaza <miguel@ximian.com>
5080 * Many things: all interfaces are parsed and generated in
5081 gen-treedump. Support for member variables, constructors,
5082 destructors, properties, constants is there.
5084 Beginning of the IL backend, but very little done, just there for
5087 2001-04-29 Miguel de Icaza <miguel@ximian.com>
5089 * cs-parser.jay: Fix labeled statement.
5091 * cs-tokenizer.cs (escape): Escape " and ' always.
5092 ref_line, ref_name: keep track of the line/filename as instructed
5093 by #line by the compiler.
5096 2001-04-27 Miguel de Icaza <miguel@ximian.com>
5098 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
5099 to match the values in System.CodeDOM.
5101 Divid renamed to Divide.
5103 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
5105 (Statements.set): remove.
5107 * System.CodeDOM/CodeCatchClause.cs: always have a valid
5110 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
5111 falseStatements always have valid values.
5113 * cs-parser.jay: Use System.CodeDOM now.