1 2001-10-17 Miguel de Icaza <miguel@ximian.com>
3 * assign.cs (Assign::Resolve): Resolve right hand side first, and
4 then pass this as a hint to ResolveLValue.
6 * expression.cs (FieldExpr): Add Location information
8 (FieldExpr::LValueResolve): Report assignment to readonly
11 (Expression::ExprClassFromMemberInfo): Pass location information.
13 (Expression::ResolveLValue): Add new method that resolves an
16 (Expression::DoResolveLValue): Default invocation calls
19 (Indexers): New class used to keep track of indexers in a given
22 (IStackStore): Renamed from LValue, as it did not really describe
23 what this did. Also ResolveLValue is gone from this interface and
24 now is part of Expression.
26 (ElementAccess): Depending on the element access type
28 * typemanager.cs: Add `indexer_name_type' as a Core type
29 (System.Runtime.CompilerServices.IndexerNameAttribute)
31 * statement.cs (Goto): Take a location.
33 2001-10-18 Ravi Pratap <ravi@ximian.com>
35 * delegate.cs (Delegate::VerifyDelegate): New method to verify
36 if two delegates are compatible.
38 (NewDelegate::DoResolve): Update to take care of the case when
39 we instantiate a delegate from another delegate.
41 * typemanager.cs (FindMembers): Don't even try to look up members
42 of Delegate types for now.
44 2001-10-18 Ravi Pratap <ravi@ximian.com>
46 * delegate.cs (NewDelegate): New class to take care of delegate
49 * expression.cs (New): Split the delegate related code out into
50 the NewDelegate class.
52 * delegate.cs (DelegateInvocation): New class to handle delegate
55 * expression.cs (Invocation): Split out delegate related code into
56 the DelegateInvocation class.
58 2001-10-17 Ravi Pratap <ravi@ximian.com>
60 * expression.cs (New::DoResolve): Implement delegate creation fully
61 and according to the spec.
63 (New::DoEmit): Update to handle delegates differently.
65 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
66 because of which we were printing out arguments in reverse order !
68 * delegate.cs (VerifyMethod): Implement to check if the given method
71 (FullDelegateDesc): Implement.
73 (VerifyApplicability): Implement.
75 * expression.cs (Invocation::DoResolve): Update to accordingly handle
76 delegate invocations too.
78 (Invocation::Emit): Ditto.
80 * ../errors/cs1593.cs : Added.
82 * ../errors/cs1594.cs : Added.
84 * delegate.cs (InstanceExpression, TargetMethod): New properties.
86 2001-10-16 Ravi Pratap <ravi@ximian.com>
88 * typemanager.cs (intptr_type): Core type for System.IntPtr
90 (InitCoreTypes): Update for the same.
92 (iasyncresult_type, asynccallback_type): Ditto.
94 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
97 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
100 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
101 the builders for the 4 members of a delegate type :-)
103 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
106 * expression.cs (New::DoResolve): Implement guts for delegate creation.
108 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
110 2001-10-15 Miguel de Icaza <miguel@ximian.com>
112 * statement.cs (Break::Emit): Implement.
113 (Continue::Emit): Implement.
115 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
116 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
117 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
118 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
121 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
122 properties that track the label for the current loop (begin of the
123 loop and end of the loop).
125 2001-10-15 Ravi Pratap <ravi@ximian.com>
127 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
128 use of emitting anything at all.
130 * class.cs, rootcontext.cs : Get rid of calls to the same.
132 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
134 (Populate): Define the constructor correctly and set the implementation
137 * typemanager.cs (delegate_types): New hashtable to hold delegates that
140 (AddDelegateType): Implement.
142 (IsDelegateType): Implement helper method.
144 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
146 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
147 and accordingly handle it.
149 * delegate.cs (Populate): Take TypeContainer argument.
150 Implement bits to define the Invoke method. However, I still haven't figured out
151 how to take care of the native int bit :-(
153 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
154 Qualify the name of the delegate, not its return type !
156 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
159 (StandardConversionExists): Checking for array types turns out to be recursive.
161 (ConvertReferenceExplicit): Implement array conversion.
163 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
165 2001-10-12 Ravi Pratap <ravi@ximian.com>
167 * cs-parser.jay (delegate_declaration): Store the fully qualified
168 name as it is a type declaration.
170 * delegate.cs (ReturnType, Name): Rename members to these. Make them
173 (DefineDelegate): Renamed from Define. Does the same thing essentially,
174 as TypeContainer::DefineType.
176 (Populate): Method in which all the definition of the various methods (Invoke)
179 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
182 (CloseDelegate): Finally creates the delegate.
184 * class.cs (TypeContainer::DefineType): Update to define delegates.
185 (Populate, Emit and CloseType): Do the same thing here too.
187 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
188 delegates in all these operations.
190 2001-10-14 Miguel de Icaza <miguel@ximian.com>
192 * expression.cs: LocalTemporary: a new expression used to
193 reference a temporary that has been created.
195 * assign.cs: Handle PropertyAccess back here, so that we can
196 provide the proper semantic access to properties.
198 * expression.cs (Expression::ConvertReferenceExplicit): Implement
199 a few more explicit conversions.
201 * modifiers.cs: `NEW' modifier maps to HideBySig.
203 * expression.cs (PropertyExpr): Make this into an
204 ExpressionStatement, and support the EmitStatement code path.
206 Perform get/set error checking, clean up the interface.
208 * assign.cs: recognize PropertyExprs as targets, and if so, turn
209 them into toplevel access objects.
211 2001-10-12 Miguel de Icaza <miguel@ximian.com>
213 * expression.cs: PropertyExpr::PropertyExpr: use work around the
216 * typemanager.cs: Keep track here of our PropertyBuilders again to
217 work around lameness in SRE.
219 2001-10-11 Miguel de Icaza <miguel@ximian.com>
221 * expression.cs (LValue::LValueResolve): New method in the
222 interface, used to perform a second resolution pass for LValues.
224 (This::DoResolve): Catch the use of this in static methods.
226 (This::LValueResolve): Implement.
228 (This::Store): Remove warning, assigning to `this' in structures
231 (Invocation::Emit): Deal with invocation of
232 methods on value types. We need to pass the address to structure
233 methods rather than the object itself. (The equivalent code to
234 emit "this" for structures leaves the entire structure on the
235 stack instead of a pointer to it).
237 (ParameterReference::DoResolve): Compute the real index for the
238 argument based on whether the method takes or not a `this' pointer
239 (ie, the method is static).
241 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
242 value types returned from functions when we need to invoke a
243 method on the sturcture.
246 2001-10-11 Ravi Pratap <ravi@ximian.com>
248 * class.cs (TypeContainer::DefineType): Method to actually do the business of
249 defining the type in the Modulebuilder or Typebuilder. This is to take
250 care of nested types which need to be defined on the TypeBuilder using
253 (TypeContainer::GetClassBases): Implement. Essentially the code from the
254 methods in RootContext, only ported to be part of TypeContainer.
256 (TypeContainer::GetInterfaceOrClass): Ditto.
258 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
260 * interface.cs (Interface::DefineInterface): New method. Does exactly
261 what RootContext.CreateInterface did earlier, only it takes care of nested types
264 (Interface::GetInterfaces): Move from RootContext here and port.
266 (Interface::GetInterfaceByName): Same here.
268 * rootcontext.cs (ResolveTree): Re-write.
270 (PopulateTypes): Re-write.
272 * class.cs (TypeContainer::Populate): Populate nested types too.
273 (TypeContainer::Emit): Emit nested members too.
275 * typemanager.cs (AddUserType): Do not make use of the FullName property,
276 instead just use the name argument passed in as it is already fully
279 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
280 to TypeContainer mapping to see if a type is user-defined.
282 * class.cs (TypeContainer::CloseType): Implement.
284 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
285 the default constructor.
287 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
290 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
292 * interface.cs (CloseType): Create the type here.
294 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
297 Remove all the methods which are now in TypeContainer.
299 2001-10-10 Ravi Pratap <ravi@ximian.com>
301 * delegate.cs (Define): Re-write bits to define the delegate
304 2001-10-10 Miguel de Icaza <miguel@ximian.com>
306 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
308 * expression.cs (ImplicitReferenceConversion): handle null as well
309 as a source to convert to any reference type.
311 * statement.cs (Return): Perform any implicit conversions to
312 expected return type.
314 Validate use of return statement.
316 * codegen.cs (EmitContext): Pass the expected return type here.
318 * class.cs (Method, Constructor, Property): Pass expected return
321 2001-10-09 Miguel de Icaza <miguel@ximian.com>
323 * expression.cs: Make DoResolve take an EmitContext instead of a
326 Replaced `l' and `location' for `loc', for consistency.
328 (Error, Warning): Remove unneeded Tc argument.
330 * assign.cs, literal.cs, constant.cs: Update to new calling
333 * codegen.cs: EmitContext now contains a flag indicating whether
334 code is being generated in a static method or not.
336 * cs-parser.jay: DecomposeQI, new function that replaces the old
337 QualifiedIdentifier. Now we always decompose the assembled
338 strings from qualified_identifier productions into a group of
341 2001-10-08 Miguel de Icaza <miguel@ximian.com>
343 * rootcontext.cs: Deal with field-less struct types correctly now
344 by passing the size option to Define Type.
346 * class.cs: Removed hack that created one static field.
348 2001-10-07 Miguel de Icaza <miguel@ximian.com>
350 * statement.cs: Moved most of the code generation here.
352 2001-10-09 Ravi Pratap <ravi@ximian.com>
354 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
357 (ElementAccess): Remove useless bits for now - keep checks as the spec
360 2001-10-08 Ravi Pratap <ravi@ximian.com>
362 * expression.cs (ElementAccess::DoResolve): Remove my crap code
363 and start performing checks according to the spec.
365 2001-10-07 Ravi Pratap <ravi@ximian.com>
367 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
368 rank_specifiers instead.
370 (rank_specifiers): Change the order in which the rank specifiers are stored
372 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
374 * expression.cs (ElementAccess): Implement the LValue interface too.
376 2001-10-06 Ravi Pratap <ravi@ximian.com>
378 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
379 except that user defined conversions are not included.
381 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
382 perform the conversion of the return type, if necessary.
384 (New::DoResolve): Check whether we are creating an array or an object
385 and accordingly do the needful.
387 (New::Emit): Same here.
389 (New::DoResolve): Implement guts of array creation.
391 (New::FormLookupType): Helper function.
393 2001-10-07 Miguel de Icaza <miguel@ximian.com>
395 * codegen.cs: Removed most of the code generation here, and move the
396 corresponding code generation bits to the statement classes.
398 Added support for try/catch/finalize and throw.
400 * cs-parser.jay: Added support for try/catch/finalize.
402 * class.cs: Catch static methods having the flags override,
405 * expression.cs (UserCast): This user cast was not really doing
406 what it was supposed to do. Which is to be born in fully resolved
407 state. Parts of the resolution were being performed at Emit time!
411 2001-10-05 Miguel de Icaza <miguel@ximian.com>
413 * expression.cs: Implicity convert the result from UserCast.
415 2001-10-05 Ravi Pratap <ravi@ximian.com>
417 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
418 prevented it from working correctly.
420 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
421 merely ConvertImplicit.
423 2001-10-05 Miguel de Icaza <miguel@ximian.com>
425 * typemanager.cs: Make the LookupTypeContainer function static,
426 and not per-instance.
428 * class.cs: Make static FindMembers (the one that takes a Type
431 * codegen.cs: Add EmitForeach here.
433 * cs-parser.jay: Make foreach a toplevel object instead of the
434 inline expansion, as we need to perform semantic analysis on it.
436 2001-10-05 Ravi Pratap <ravi@ximian.com>
438 * expression.cs (Expression::ImplicitUserConversion): Rename to
439 UserDefinedConversion.
441 (Expression::UserDefinedConversion): Take an extra argument specifying
442 whether we look for explicit user conversions too.
444 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
446 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
448 (ExplicitUserConversion): Make it a call to UserDefinedConversion
449 with the appropriate arguments.
451 * cs-parser.jay (cast_expression): Record location too.
453 * expression.cs (Cast): Record location info.
455 (Expression::ConvertExplicit): Take location argument.
457 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
458 to determine if we are doing explicit conversions.
460 (UserCast::Emit): Update accordingly.
462 (Expression::ConvertExplicit): Report an error if everything fails.
464 * ../errors/cs0030.cs : Add.
466 2001-10-04 Miguel de Icaza <miguel@ximian.com>
468 * modifiers.cs: If the ABSTRACT keyword is present, also set the
469 virtual and newslot bits.
471 * class.cs (TypeContainer::RegisterRequiredImplementations):
472 Record methods we need.
474 (TypeContainer::MakeKey): Helper function to make keys for
475 MethodBases, since the Methodbase key is useless.
477 (TypeContainer::Populate): Call RegisterRequiredImplementations
478 before defining the methods.
480 Create a mapping for method_builders_to_methods ahead of time
481 instead of inside a tight loop.
483 (::RequireMethods): Accept an object as the data to set into the
484 hashtable so we can report interface vs abstract method mismatch.
486 2001-10-03 Miguel de Icaza <miguel@ximian.com>
488 * report.cs: Make all of it static.
490 * rootcontext.cs: Drop object_type and value_type computations, as
491 we have those in the TypeManager anyways.
493 Drop report instance variable too, now it is a global.
495 * driver.cs: Use try/catch on command line handling.
497 Add --probe option to debug the error reporting system with a test
500 * report.cs: Add support for exiting program when a probe
501 condition is reached.
503 2001-10-03 Ravi Pratap <ravi@ximian.com>
505 * expression.cs (Binary::DoNumericPromotions): Fix the case when
506 we do a forcible conversion regardless of type, to check if
507 ForceConversion returns a null.
509 (Binary::error19): Use location to report error.
511 (Unary::error23): Use location here too.
513 * ../errors/cs0019.cs : Check in.
515 * ../errors/cs0023.cs : Check in.
517 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
518 case of a non-null MethodInfo object with a length of 0 !
520 (Binary::ResolveOperator): Flag error if overload resolution fails to find
521 an applicable member - according to the spec :-)
522 Also fix logic to find members in base types.
524 (Unary::ResolveOperator): Same here.
526 (Unary::report23): Change name to error23 and make first argument a TypeContainer
527 as I was getting thoroughly confused between this and error19 :-)
529 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
530 (::FindMostEncompassedType): Implement.
531 (::FindMostEncompassingType): Implement.
532 (::StandardConversionExists): Implement.
534 (UserImplicitCast): Re-vamp. We now need info about most specific
535 source and target types so that we can do the necessary conversions.
537 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
538 mathematical union with no duplicates.
540 2001-10-03 Miguel de Icaza <miguel@ximian.com>
542 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
543 in order from base classes to child classes, so that we can in
544 child classes look up in our parent for method names and
545 attributes (required for handling abstract, virtual, new, override
546 constructs: we need to instrospect our base class, and if we dont
547 populate the classes in order, the introspection might be
548 incorrect. For example, a method could query its parent before
549 the parent has any methods and would determine that the parent has
550 no abstract methods (while it could have had them)).
552 (RootContext::CreateType): Record the order in which we define the
555 2001-10-02 Miguel de Icaza <miguel@ximian.com>
557 * class.cs (TypeContainer::Populate): Also method definitions can
558 fail now, keep track of this.
560 (TypeContainer::FindMembers): Implement support for
561 DeclaredOnly/noDeclaredOnly flag.
563 (Constructor::Emit) Return the ConstructorBuilder.
565 (Method::Emit) Return the MethodBuilder.
566 Check for abstract or virtual methods to be public.
568 * rootcontext.cs (RootContext::CreateType): Register all the
569 abstract methods required for the class to be complete and the
570 interface methods that must be implemented.
572 * cs-parser.jay: Report error 501 (method requires body if it is
573 not marked abstract or extern).
575 * expression.cs (TypeOf::Emit): Implement.
577 * typemanager.cs: runtime_handle_type, new global type.
579 * class.cs (Property::Emit): Generate code for properties.
581 2001-10-02 Ravi Pratap <ravi@ximian.com>
583 * expression.cs (Unary::ResolveOperator): Find operators on base type
584 too - we now conform exactly to the spec.
586 (Binary::ResolveOperator): Same here.
588 * class.cs (Operator::Define): Fix minor quirk in the tests.
590 * ../errors/cs0215.cs : Added.
592 * ../errors/cs0556.cs : Added.
594 * ../errors/cs0555.cs : Added.
596 2001-10-01 Miguel de Icaza <miguel@ximian.com>
598 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
599 single integer which is really efficient
601 2001-10-01 Ravi Pratap <ravi@ximian.com>
603 * expression.cs (Expression::ImplicitUserConversion): Use location
604 even in the case when we are examining True operators.
606 * class.cs (Operator::Define): Perform extensive checks to conform
607 with the rules for operator overloading in the spec.
609 * expression.cs (Expression::ImplicitReferenceConversion): Implement
610 some of the other conversions mentioned in the spec.
612 * typemanager.cs (array_type): New static member for the System.Array built-in
615 (cloneable_interface): For System.ICloneable interface.
617 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
618 we start resolving the tree and populating types.
620 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
622 2001-10-01 Miguel de Icaza <miguel@ximian.com>
624 * expression.cs (Expression::ExprClassFromMemberInfo,
625 Expression::Literalize): Create literal expressions from
626 FieldInfos which are literals.
628 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
629 type casts, because they were wrong. The test suite in tests
632 (ImplicitNumericConversion): ushort to ulong requires a widening
635 Int32 constant to long requires widening cast as well.
637 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
638 for integers because the type on the stack is not i4.
640 2001-09-30 Miguel de Icaza <miguel@ximian.com>
642 * expression.cs (report118): require location argument.
644 * parameter.cs: Do not dereference potential null value.
646 * class.cs: Catch methods that lack the `new' keyword when
647 overriding a name. Report warnings when `new' is used without
648 anything being there to override.
650 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
652 * class.cs: Only add constructor to hashtable if it is non-null
653 (as now constructors can fail on define).
655 (TypeManager, Class, Struct): Take location arguments.
657 Catch field instance initialization in structs as errors.
659 accepting_filter: a new filter for FindMembers that is static so
660 that we dont create an instance per invocation.
662 (Constructor::Define): Catch errors where a struct constructor is
665 * cs-parser.jay: Pass location information for various new
668 * delegate.cs (Delegate): take a location argument.
670 * driver.cs: Do not call EmitCode if there were problesm in the
671 Definition of the types, as many Builders wont be there.
673 * decl.cs (Decl::Decl): Require a location argument.
675 * cs-tokenizer.cs: Handle properly hex constants that can not fit
676 into integers, and find the most appropiate integer for it.
678 * literal.cs: Implement ULongLiteral.
680 * rootcontext.cs: Provide better information about the location of
681 failure when CreateType fails.
683 2001-09-29 Miguel de Icaza <miguel@ximian.com>
685 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
688 * expression.cs (Binary::CheckShiftArguments): Add missing type
690 (Binary::ResolveOperator): Add type to the logical and and logical
691 or, Bitwise And/Or and Exclusive Or code paths, it was missing
694 (Binary::DoNumericPromotions): In the case where either argument
695 is ulong (and most signed types combined with ulong cause an
696 error) perform implicit integer constant conversions as well.
698 2001-09-28 Miguel de Icaza <miguel@ximian.com>
700 * expression.cs (UserImplicitCast): Method should always be
702 (Invocation::BetterConversion): Simplified test for IntLiteral.
704 (Expression::ImplicitNumericConversion): Split this routine out.
705 Put the code that performs implicit constant integer conversions
708 (Expression::Resolve): Become a wrapper around DoResolve so we can
709 check eclass and type being set after resolve.
711 (Invocation::Badness): Remove this dead function
713 (Binary::ResolveOperator): Do not compute the expensive argumnets
714 unless we have a union for it.
716 (Probe::Emit): Is needs to do an isinst and then
717 compare against null.
719 (::CanConvert): Added Location argument. If the Location argument
720 is null (Location.Null), then we do not report errors. This is
721 used by the `probe' mechanism of the Explicit conversion. We do
722 not want to generate an error for something that the user
723 explicitly requested to be casted. But the pipeline for an
724 explicit cast first tests for potential implicit casts.
726 So for now, if the Location is null, it means `Probe only' to
727 avoid adding another argument. Might have to revise this
730 (ClassCast): New class used to type cast objects into arbitrary
731 classes (used in Explicit Reference Conversions).
733 Implement `as' as well.
735 Reverted all the patches from Ravi below: they were broken:
737 * The use of `level' as a mechanism to stop recursive
738 invocations is wrong. That was there just to catch the
739 bug with a strack trace but not as a way of addressing
742 To fix the problem we have to *understand* what is going
743 on and the interactions and come up with a plan, not
744 just get things going.
746 * The use of the type conversion cache that I proposed
747 last night had an open topic: How does this work across
748 protection domains. A user defined conversion might not
749 be public in the location where we are applying the
750 conversion, a different conversion might be selected
751 (ie, private A->B (better) but public B->A (worse),
752 inside A, A->B applies, but outside it, B->A will
755 * On top of that (ie, even if the above is solved),
756 conversions in a cache need to be abstract. Ie, `To
757 convert from an Int to a Short use an OpcodeCast', not
758 `To convert from an Int to a Short use the OpcodeCast on
759 the variable 5' (which is what this patch was doing).
761 2001-09-28 Ravi Pratap <ravi@ximian.com>
763 * expression.cs (Invocation::ConversionExists): Re-write to use
766 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
767 cache all conversions done, not just user-defined ones.
769 (Invocation::BetterConversion): The real culprit. Use ConversionExists
770 to determine if a conversion exists instead of acutually trying to
771 perform the conversion. It's faster too.
773 (Expression::ConvertExplicit): Modify to use ConversionExists to check
774 and only then attempt the implicit conversion.
776 2001-09-28 Ravi Pratap <ravi@ximian.com>
778 * expression.cs (ConvertImplicit): Use a cache for conversions
779 already found. Check level of recursion and bail out if necessary.
781 2001-09-28 Miguel de Icaza <miguel@ximian.com>
783 * typemanager.cs (string_concat_string_string, string_concat_object_object):
784 Export standard methods that we expect for string operations.
786 * statement.cs (Block::UsageWarning): Track usage of variables and
787 report the errors for not used variables.
789 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
792 2001-09-27 Miguel de Icaza <miguel@ximian.com>
794 * codegen.cs: remove unnneded code
796 * expression.cs: Removed BuiltinTypeAccess class
798 Fix the order in which implicit conversions are
801 The previous fixed dropped support for boxed conversions (adding a
802 test to the test suite now)
804 (UserImplicitCast::CanConvert): Remove test for source being null,
805 that code is broken. We should not feed a null to begin with, if
806 we do, then we should track the bug where the problem originates
807 and not try to cover it up here.
809 Return a resolved expression of type UserImplicitCast on success
810 rather than true/false. Ravi: this is what I was talking about,
811 the pattern is to use a static method as a "constructor" for
814 Also, do not create arguments until the very last minute,
815 otherwise we always create the arguments even for lookups that
816 will never be performed.
818 (UserImplicitCast::Resolve): Eliminate, objects of type
819 UserImplicitCast are born in a fully resolved state.
821 * typemanager.cs (InitCoreTypes): Init also value_type
824 * expression.cs (Cast::Resolve): First resolve the child expression.
826 (LValue): Add new method AddressOf to be used by
829 Change the argument of Store to take an EmitContext instead of an
830 ILGenerator, because things like FieldExpr need to be able to call
831 their children expression to generate the instance code.
833 (Expression::Error, Expression::Warning): Sugar functions for
836 (Expression::MemberLookup): Accept a TypeContainer instead of a
837 Report as the first argument.
839 (Expression::ResolvePrimary): Killed. I still want to improve
840 this as currently the code is just not right.
842 (Expression::ResolveMemberAccess): Simplify, but it is still
845 (Unary::Resolve): Catch errors in AddressOf operators.
847 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
848 index to a byte for the short-version, or the compiler will choose
849 the wrong Emit call, which generates the wrong data.
851 (ParameterReference::Emit, ::Store): same.
853 (FieldExpr::AddressOf): Implement.
855 * typemanager.cs: TypeManager: made public variable instead of
858 * driver.cs: document --fatal.
860 * report.cs (ErrorMessage, WarningMessage): new names for the old
861 Error and Warning classes.
863 * cs-parser.jay (member_access): Turn built-in access to types
864 into a normal simplename
866 2001-09-27 Ravi Pratap <ravi@ximian.com>
868 * expression.cs (Invocation::BetterConversion): Fix to cope
869 with q being null, since this was introducing a bug.
871 * expression.cs (ConvertImplicit): Do built-in conversions first.
873 2001-09-27 Ravi Pratap <ravi@ximian.com>
875 * expression.cs (UserImplicitCast::Resolve): Fix bug.
877 2001-09-27 Ravi Pratap <ravi@ximian.com>
879 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
880 I had introduced long ago (what's new ?).
882 * expression.cs (UserImplicitCast::CanConvert): Static method to do
883 the work of all the checking.
884 (ConvertImplicit): Call CanConvert and only then create object if necessary.
885 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
887 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
888 that is the right way.
890 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
891 overloading resolution. Use everywhere instead of cutting and pasting code.
893 (Binary::ResolveOperator): Use MakeUnionSet.
895 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
896 we have to convert to bool types. Not complete yet.
898 2001-09-27 Miguel de Icaza <miguel@ximian.com>
900 * typemanager.cs (TypeManager::CSharpName): support ushort.
902 * expression.cs (Expression::TryImplicitIntConversion): Attempts
903 to provide an expression that performsn an implicit constant int
904 conversion (section 6.1.6).
905 (Expression::ConvertImplicitRequired): Reworked to include
906 implicit constant expression conversions.
908 (Expression::ConvertNumericExplicit): Finished.
910 (Invocation::Emit): If InstanceExpression is null, then it means
911 that we perform a call on this.
913 2001-09-26 Miguel de Icaza <miguel@ximian.com>
915 * expression.cs (Unary::Emit): Remove some dead code.
916 (Probe): Implement Resolve and Emit for `is'.
917 (Expression::ConvertImplicitRequired): Attempt to do constant
918 expression conversions here. Maybe should be moved to
919 ConvertImplicit, but I am not sure.
920 (Expression::ImplicitLongConstantConversionPossible,
921 Expression::ImplicitIntConstantConversionPossible): New functions
922 that tell whether is it possible to apply an implicit constant
923 expression conversion.
925 (ConvertNumericExplicit): Started work on explicit numeric
928 * cs-parser.jay: Update operator constants.
930 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
931 (Parameters::GetSignature): Hook up VerifyArgs here.
932 (Parameters::VerifyArgs): Verifies that no two arguments have the
935 * class.cs (Operator): Update the operator names to reflect the
936 ones that the spec expects (as we are just stringizing the
939 * expression.cs (Unary::ResolveOperator): Fix bug: Use
940 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
941 previous usage did only work for our methods.
942 (Expression::ConvertImplicit): Handle decimal implicit numeric
944 (Expression::InternalTypeConstructor): Used to invoke constructors
945 on internal types for default promotions.
947 (Unary::Emit): Implement special handling for the pre/post
948 increment/decrement for overloaded operators, as they need to have
949 the same semantics as the other operators.
951 (Binary::ResolveOperator): ditto.
952 (Invocation::ConversionExists): ditto.
953 (UserImplicitCast::Resolve): ditto.
955 2001-09-26 Ravi Pratap <ravi@ximian.com>
957 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
958 operator, return after emitting body. Regression tests pass again !
960 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
961 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
962 (Invocation::OverloadResolve): Ditto.
963 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
965 * everywhere : update calls to the above methods accordingly.
967 2001-09-26 Miguel de Icaza <miguel@ximian.com>
969 * assign.cs (Assign): Make it inherit from ExpressionStatement.
971 * expression.cs (ExpressionStatement): New base class used for
972 expressions that can appear in statements, so that we can provide
973 an alternate path to generate expression that do not leave a value
976 (Expression::Emit, and all the derivatives): We no longer return
977 whether a value is left on the stack or not. Every expression
978 after being emitted leaves a single value on the stack.
980 * codegen.cs (EmitContext::EmitStatementExpression): Use the
981 facilties of ExpressionStatement if possible.
983 * cs-parser.jay: Update statement_expression.
985 2001-09-25 Miguel de Icaza <miguel@ximian.com>
987 * driver.cs: Change the wording of message
989 2001-09-25 Ravi Pratap <ravi@ximian.com>
991 * expression.cs (Binary::ResolveOperator): Had forgottten to set
992 the type of the expression to the return type of the method if
993 we have an overloaded operator match ! The regression tests pass again !
994 (Unary::ResolveOperator): Ditto.
996 * expression.cs (Invocation::ConversionExists): Correct the member lookup
997 to find "op_Implicit", not "implicit" ;-)
998 (UserImplicitCast): New class to take care of user-defined implicit conversions.
999 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1001 * everywhere : Correct calls to the above accordingly.
1003 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1004 (ConvertImplicit): Do user-defined conversion if it exists.
1006 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1008 * assign.cs: track location.
1009 (Resolve): Use implicit conversions on assignment.
1011 * literal.cs: Oops. Not good, Emit of short access values should
1012 pass (Bytes) or the wrong argument will be selected.
1014 * expression.cs (Unary::Emit): Emit code for -expr.
1016 (Unary::ResolveOperator): Handle `Substract' for non-constants
1017 (substract from zero from the non-constants).
1018 Deal with Doubles as well.
1020 (Expression::ConvertImplicitRequired): New routine that reports an
1021 error if no implicit conversion exists.
1023 (Invocation::OverloadResolve): Store the converted implicit
1024 expressions if we make them
1026 2001-09-24 Ravi Pratap <ravi@ximian.com>
1028 * class.cs (ConstructorInitializer): Take a Location argument.
1029 (ConstructorBaseInitializer): Same here.
1030 (ConstructorThisInitializer): Same here.
1032 * cs-parser.jay : Update all calls accordingly.
1034 * expression.cs (Unary, Binary, New): Take location argument.
1035 Update accordingly everywhere.
1037 * cs-parser.jay : Update all calls to the above to take a location
1042 2001-09-24 Ravi Pratap <ravi@ximian.com>
1044 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1045 (Invocation::BetterConversion): Same here
1046 (Invocation::ConversionExists): Ditto.
1048 (Invocation::ConversionExists): Implement.
1050 2001-09-22 Ravi Pratap <ravi@ximian.com>
1052 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1053 Also take an additional TypeContainer argument.
1055 * All over : Pass in TypeContainer as argument to OverloadResolve.
1057 * typemanager.cs (CSharpName): Update to check for the string type and return
1060 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1063 2001-09-21 Ravi Pratap <ravi@ximian.com>
1065 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1066 (Invocation::BetterFunction): Implement.
1067 (Invocation::BetterConversion): Implement.
1068 (Invocation::ConversionExists): Skeleton, no implementation yet.
1070 Okay, things work fine !
1072 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1074 * typemanager.cs: declare and load enum_type, delegate_type and
1077 * expression.cs (Expression::Emit): Now emit returns a value that
1078 tells whether a value is left on the stack or not. This strategy
1079 might be reveted tomorrow with a mechanism that would address
1080 multiple assignments.
1081 (Expression::report118): Utility routine to report mismatches on
1084 (Unary::Report23): Report impossible type/operator combination
1087 (Unary::IsIncrementableNumber): Whether the type can be
1088 incremented or decremented with add.
1089 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1091 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1093 (Invocation::Emit): Deal with new Emit convetion.
1095 * All Expression derivatives: Updated their Emit method to return
1096 whether they leave values on the stack or not.
1098 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1099 stack for expressions that are statements.
1101 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1103 * expression.cs (LValue): New interface. Must be implemented by
1105 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1108 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1109 interface for generating code, simplifies the code.
1111 2001-09-20 Ravi Pratap <ravi@ximian.com>
1113 * expression.cs (everywhere): Comment out return statements in ::Resolve
1114 methods to avoid the warnings.
1116 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1118 * driver.cs (parse): Report error 2001 if we can not open the
1121 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1124 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1127 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1128 otherwise nested blocks end up with the same index.
1130 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1132 * expression.cs: Instead of having FIXMEs in the Resolve
1133 functions, throw exceptions so it is obvious that we are facing a
1136 * cs-parser.jay (invocation_expression): Pass Location information.
1138 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1139 Use a basename for those routines because .NET does not like paths
1142 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1145 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1147 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1148 are loading the correct data types (throws an exception if not).
1149 (TypeManager::InitCoreTypes): Use CoreLookupType
1151 * expression.cs (Unary::ResolveOperator): return the child
1152 expression for expressions which are just +expr.
1153 (Unary::ResolveOperator): Return negative literals for -LITERAL
1154 expressions (otherwise they are Unary {Literal}).
1155 (Invocation::Badness): Take into account `Implicit constant
1156 expression conversions'.
1158 * literal.cs (LongLiteral): Implement long literal class.
1159 (IntLiteral): export the `Value' of the intliteral.
1161 2001-09-19 Ravi Pratap <ravi@ximian.com>
1163 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1165 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1166 instead of 'Operator'
1168 * expression.cs (Binary::ResolveOperator): Update accordingly.
1169 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1172 * cs-parser.jay (unary_expression): Update to use the new names.
1174 * gen-treedump.cs (GetUnary): Same here.
1176 * expression.cs (Unary::Resolve): Implement.
1177 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1178 operators are found instead of making noise ;-)
1179 (Unary::ResolveOperator): New method to do precisely the same thing which
1180 Binary::ResolveOperator does for Binary expressions.
1181 (Unary.method, .Arguments): Add.
1182 (Unary::OperName): Implement.
1183 (Unary::ForceConversion): Copy and Paste !
1185 * class.cs (Operator::Define): Fix a small bug for the case when we have
1188 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1189 for the inbuilt operators. Only overloading works for now ;-)
1191 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1193 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1194 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1196 * expression.cs (This::Emit): Implement.
1197 (This::Resolve): Implement.
1198 (TypeOf:Resolve): Implement.
1199 (Expression::ResolveSimpleName): Add an implicit this to instance
1201 (MemberAccess::Resolve): Deal with Parameters and Fields.
1202 Bind instance variable to Field expressions.
1203 (FieldExpr::Instance): New field used to track the expression that
1204 represents the object instance.
1205 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1207 (FieldExpr::Emit): Implement.
1209 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1210 the last instruction contains a return opcode to avoid generating
1211 the last `ret' instruction (this generates correct code, and it is
1212 nice to pass the peverify output).
1214 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1215 initializer for static and instance variables.
1216 (Constructor::Emit): Allow initializer to be null in the case of
1217 static constructors. Only emit initializer for instance
1220 (TypeContainer::FindMembers): Return a null array if there are no
1223 Also fix the code for the MemberTypes.Method branch, as it was not
1224 scanning that for operators (or tried to access null variables before).
1226 * assign.cs (Assign::Emit): Handle instance and static fields.
1230 * driver.cs: Stop compilation if there are parse errors.
1232 * cs-parser.jay (constructor_declaration): Provide default base
1233 initializer for non-static constructors.
1234 (constructor_declarator): Do not provide a default base
1235 initializers if none was specified.
1236 Catch the fact that constructors should not have parameters.
1238 * class.cs: Do not emit parent class initializers for static
1239 constructors, that should be flagged as an error.
1241 2001-09-18 Ravi Pratap <ravi@ximian.com>
1243 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1244 Move back code into TypeContainer::Populate.
1246 2001-09-18 Ravi Pratap <ravi@ximian.com>
1248 * class.cs (TypeContainer::AddConstructor): Fix the check to
1249 compare against Name, not Basename.
1250 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1252 * cs-parser.jay : Update accordingly.
1254 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1255 for methods, don't forget to look into the operators too.
1256 (RegisterMethodBuilder): Helper method to take care of this for
1257 methods, constructors and operators.
1258 (Operator::Define): Completely revamp.
1259 (Operator.OperatorMethod, MethodName): New fields.
1260 (TypeContainer::Populate): Move the registering of builders into
1261 RegisterMethodBuilder.
1262 (Operator::Emit): Re-write.
1264 * expression.cs (Binary::Emit): Comment out code path to emit method
1265 invocation stuff for the case when we have a user defined operator. I am
1266 just not able to get it right !
1268 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1270 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1273 (Expression::MemberLookup): Provide a version that allows to
1274 specify the MemberTypes and BindingFlags.
1276 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1277 so it was not fetching variable information from outer blocks.
1279 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1280 Beforefieldinit as it was buggy.
1282 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1285 * class.cs (Constructor::Emit): Only emit if block is not null.
1286 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1287 deal with this by semantically definining it as if the user had
1290 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1291 constructors as we now "emit" them at a higher level.
1293 (TypeContainer::DefineDefaultConstructor): Used to define the
1294 default constructors if none was provided.
1296 (ConstructorInitializer): Add methods Resolve and Emit.
1298 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1300 2001-09-17 Ravi Pratap <ravi@ximian.com>
1302 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1303 the default constructor builder with our hashtable for methodbuilders
1306 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1307 and argument_count is 0 in which case we have a match.
1308 (Binary::ResolveOperator): More null checking and miscellaneous coding
1311 2001-09-17 Ravi Pratap <ravi@ximian.com>
1313 * rootcontext.cs (IsNameSpace): Compare against null.
1315 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1317 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1318 and Unary::Operator.
1320 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1323 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1324 we have overloaded operators.
1325 (Binary::ResolveOperator): Implement the part which does the operator overload
1328 * class.cs (Operator::Emit): Implement.
1329 (TypeContainer::Emit): Emit the operators we have too.
1331 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1332 the case when we have a user-defined operator.
1334 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1336 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1338 2001-09-16 Ravi Pratap <ravi@ximian.com>
1340 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1341 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1342 (Constructor::Emit): Implement.
1343 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1344 if we have no work to do.
1345 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1348 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1349 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1351 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1354 2001-09-15 Ravi Pratap <ravi@ximian.com>
1356 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1358 (Tree::RecordNamespace): Method to do what the name says ;-)
1359 (Tree::Namespaces): Property to get at the namespaces hashtable.
1361 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1364 * rootcontext.cs (IsNamespace): Fixed it :-)
1366 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1368 * class.cs (TypeContainer::FindMembers): Add support for
1370 (MethodCore): New class that encapsulates both the shared aspects
1371 of a Constructor and a Method.
1372 (Method, Constructor): Factored pieces into MethodCore.
1374 * driver.cs: Added --fatal which makes errors throw exceptions.
1375 Load System assembly as well as part of the standard library.
1377 * report.cs: Allow throwing exceptions on errors for debugging.
1379 * modifiers.cs: Do not use `parent', instead use the real type
1380 container to evaluate permission settings.
1382 * class.cs: Put Ravi's patch back in. He is right, and we will
1383 have to cope with the
1385 2001-09-14 Ravi Pratap <ravi@ximian.com>
1387 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1388 FamORAssem, not FamANDAssem.
1390 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1392 * driver.cs: Added --parse option that only parses its input files
1395 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1396 incorrect. IsTopLevel is not used to tell whether an object is
1397 root_types or not (that can be achieved by testing this ==
1398 root_types). But to see if this is a top-level *class* (not
1399 necessarly our "toplevel" container).
1401 2001-09-14 Ravi Pratap <ravi@ximian.com>
1403 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1404 parent instead of a direct call to GetType.
1406 2001-09-14 Ravi Pratap <ravi@ximian.com>
1408 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1409 Modifiers.TypeAttr. This should just be a call to that method.
1411 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1412 object so that we can determine if we are top-level or not.
1414 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1417 * enum.cs (Enum::Define): Ditto.
1419 * modifiers.cs (FieldAttr): Re-write.
1421 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1422 (TypeContainer::HaveStaticConstructor): New property to provide access
1423 to precisely that info.
1425 * modifiers.cs (MethodAttr): Re-write.
1426 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1428 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1429 of top-level types as claimed.
1431 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1433 * expression.cs (MemberLookup): Fruitless attempt to lookup
1434 constructors. Maybe I need to emit default constructors? That
1435 might be it (currently .NET emits this for me automatically).
1436 (Invocation::OverloadResolve): Cope with Arguments == null.
1437 (Invocation::EmitArguments): new function, shared by the new
1439 (Invocation::Emit): Handle static and instance methods. Emit
1440 proper call instruction for virtual or non-virtual invocations.
1441 (New::Emit): Implement.
1442 (New::Resolve): Implement.
1443 (MemberAccess:Resolve): Implement.
1444 (MethodGroupExpr::InstanceExpression): used conforming to the spec
1446 (FieldExpr::Resolve): Set type.
1448 * support.cs: Handle empty arguments.
1450 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
1451 SimpleLookup): Auxiliary routines to help parse a qualifier
1454 Update qualifier_identifier rule.
1456 * codegen.cs: Removed debugging messages.
1458 * class.cs: Make this a global thing, this acts just as a "key" to
1459 objects that we might have around.
1461 (Populate): Only initialize method_builders_to_methods once.
1463 * expression.cs (PropertyExpr): Initialize type from the
1466 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
1467 Resolve pattern. Attempt to implicitly convert value to boolean.
1470 * expression.cs: Set the type for the int32/int32 argument case.
1471 (Binary::ResolveOperator): Set the return type to boolean for
1472 comparission operators
1474 * typemanager.cs: Remove debugging print code.
1476 (Invocation::Resolve): resolve type.
1478 * class.cs: Allocate a MemberInfo of the correct size, as the code
1479 elsewhere depends on the test to reflect the correct contents.
1481 (Method::) Keep track of parameters, due to System.Reflection holes
1483 (TypeContainer::Populate): Keep track of MethodBuilders to Method
1486 (TypeContainer::FindMembers): Use ArrayList and then copy an array
1487 of the exact size and return that.
1489 (Class::LookupMethodByBuilder): New function that maps
1490 MethodBuilders to its methods. Required to locate the information
1491 on methods because System.Reflection bit us again.
1493 * support.cs: New file, contains an interface ParameterData and
1494 two implementations: ReflectionParameters and InternalParameters
1495 used to access Parameter information. We will need to grow this
1498 * expression.cs (Invocation::GetParameterData): implement a cache
1499 and a wrapper around the ParameterData creation for methods.
1500 (Invocation::OverloadResolve): Use new code.
1502 2001-09-13 Ravi Pratap <ravi@ximian.com>
1504 * class.cs (TypeContainer::EmitField): Remove and move into
1505 (Field::Define): here and modify accordingly.
1506 (Field.FieldBuilder): New member.
1507 (TypeContainer::Populate): Update accordingly.
1508 (TypeContainer::FindMembers): Implement.
1510 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1512 * statement.cs: (VariableInfo::VariableType): New field to be
1513 initialized with the full type once it is resolved.
1515 2001-09-12 Miguel de Icaza <miguel@ximian.com>
1517 * parameter.cs (GetParameterInfo): Use a type cache to compute
1518 things only once, and to reuse this information
1520 * expression.cs (LocalVariableReference::Emit): Implement.
1521 (OpcodeCast::Emit): fix.
1523 (ParameterReference::Resolve): Implement.
1524 (ParameterReference::Emit): Implement.
1526 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
1527 that are expressions need to stay as Expressions.
1529 * typemanager.cs (CSharpName): Returns the C# name of a type if
1532 * expression.cs (Expression::ConvertImplicit): New function that
1533 implements implicit type conversions.
1535 (Expression::ImplicitReferenceConversion): Implements implicit
1536 reference conversions.
1538 (EmptyCast): New type for transparent casts.
1540 (OpcodeCast): New type for casts of types that are performed with
1541 a sequence of bytecodes.
1543 (BoxedCast): New type used for casting value types into reference
1544 types. Emits a box opcode.
1546 (Binary::DoNumericPromotions): Implements numeric promotions of
1547 and computation of the Binary::Type.
1549 (Binary::EmitBranchable): Optimization.
1551 (Binary::Emit): Implement code emission for expressions.
1553 * typemanager.cs (TypeManager): Added two new core types: sbyte
1556 2001-09-12 Ravi Pratap <ravi@ximian.com>
1558 * class.cs (TypeContainer::FindMembers): Method which does exactly
1559 what Type.FindMembers does, only we don't have to use reflection. No
1562 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
1563 typecontainer objects as we need to get at them.
1564 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
1566 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
1567 typecontainer object.
1569 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
1570 of just a Report object.
1572 2001-09-11 Ravi Pratap <ravi@ximian.com>
1574 * class.cs (Event::Define): Go back to using the prefixes "add_" and
1576 (TypeContainer::Populate): Now define the delegates of the type too.
1577 (TypeContainer.Delegates): Property to access the list of delegates defined
1580 * delegates.cs (Delegate::Define): Implement partially.
1582 * modifiers.cs (TypeAttr): Handle more flags.
1584 2001-09-11 Ravi Pratap <ravi@ximian.com>
1586 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
1588 (Operator::Define): Re-write logic to get types by using the LookupType method
1589 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
1590 (Indexer::Define): Ditto.
1591 (Event::Define): Ditto.
1592 (Property::Define): Ditto.
1594 2001-09-10 Ravi Pratap <ravi@ximian.com>
1596 * class.cs (TypeContainer::Populate): Now define operators too.
1597 (TypeContainer.Operators): New property to access the list of operators
1599 (Operator.OperatorMethodBuilder): New member to hold the method builder
1600 for the operator we are defining.
1601 (Operator::Define): Implement.
1603 2001-09-10 Ravi Pratap <ravi@ximian.com>
1605 * class.cs (Event::Define): Make the prefixes of the accessor methods
1606 addOn_ and removeOn_
1608 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
1609 of the location being passed in too. Ideally, this should go later since all
1610 error reporting should be done through the Report object.
1612 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
1613 (Populate): Iterate thru the indexers we have and define them too.
1614 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
1615 for the get and set accessors.
1616 (Indexer::Define): Implement.
1618 2001-09-09 Miguel de Icaza <miguel@ximian.com>
1620 * expression.cs (Binary::Resolve): Beginning of it. I scratched
1621 my previous implementation, did not work.
1623 * typemanager.cs: Add a couple of missing types (the longs).
1625 * literal.cs: Use TypeManager.bool_type instead of getting it.
1627 * expression.cs (EventExpr): New kind of expressions.
1628 (Expressio::ExprClassFromMemberInfo): finish
1630 2001-09-08 Miguel de Icaza <miguel@ximian.com>
1632 * assign.cs: Emit stores to static fields differently.
1634 2001-09-08 Ravi Pratap <ravi@ximian.com>
1636 * Merge in changes and adjust code to tackle conflicts. Backed out my
1637 code in Assign::Resolve ;-)
1639 2001-09-08 Ravi Pratap <ravi@ximian.com>
1641 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
1642 instead Report.Error and also pass in the location.
1643 (CSharpParser::Lexer): New readonly property to return the reference
1644 to the Tokenizer object.
1645 (declare_local_variables): Use Report.Error with location instead of plain
1649 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
1650 (Operator.CheckBinaryOperator): Ditto.
1652 * cs-parser.jay (operator_declarator): Update accordingly.
1654 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
1655 (CheckBinaryOperator): Same here.
1657 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
1658 on the name without any prefixes of namespace names etc. This is because we
1659 already might have something already fully qualified like
1660 'System.Console.WriteLine'
1662 * assign.cs (Resolve): Begin implementation. Stuck ;-)
1664 2001-09-07 Ravi Pratap <ravi@ximian.com>
1666 * cs-tokenizer.cs (location): Return a string which also contains
1669 * expression.cs (ElementAccess): New class for expressions of the
1670 type 'element access.'
1671 (BaseAccess): New class for expressions of the type 'base access.'
1672 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
1675 * cs-parser.jay (element_access): Implement action.
1676 (base_access): Implement actions.
1677 (checked_expression, unchecked_expression): Implement.
1679 * cs-parser.jay (local_variable_type): Correct and implement.
1680 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
1682 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
1684 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
1685 name and the specifiers.
1687 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
1689 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
1690 making them all public ;-)
1692 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
1695 2001-09-07 Miguel de Icaza <miguel@ximian.com>
1697 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
1699 (FieldExpr, PropertyExprs): New resolved expressions.
1700 (SimpleName::MemberStaticCheck): Perform static checks for access
1701 to non-static fields on static methods. Maybe this should be
1702 generalized for MemberAccesses.
1703 (SimpleName::ResolveSimpleName): More work on simple name
1706 * cs-parser.jay (primary_expression/qualified_identifier): track
1707 the parameter index.
1709 * codegen.cs (CodeGen::Save): Catch save exception, report error.
1710 (EmitContext::EmitBoolExpression): Chain to expression generation
1711 instead of temporary hack.
1712 (::EmitStatementExpression): Put generic expression code generation.
1714 * assign.cs (Assign::Emit): Implement variable assignments to
1715 local variables, parameters and fields.
1717 2001-09-06 Miguel de Icaza <miguel@ximian.com>
1719 * statement.cs (Block::GetVariableInfo): New method, returns the
1720 VariableInfo for a variable name in a block.
1721 (Block::GetVariableType): Implement in terms of GetVariableInfo
1723 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
1724 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
1726 2001-09-06 Ravi Pratap <ravi@ximian.com>
1728 * cs-parser.jay (operator_declaration): Continue on my quest : update
1729 to take attributes argument.
1730 (event_declaration): Ditto.
1731 (enum_declaration): Ditto.
1732 (indexer_declaration): Ditto.
1734 * class.cs (Operator::Operator): Update constructor accordingly.
1735 (Event::Event): Ditto.
1737 * delegate.cs (Delegate::Delegate): Same here.
1739 * enum.cs (Enum::Enum): Same here.
1741 2001-09-05 Ravi Pratap <ravi@ximian.com>
1743 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
1745 * ../tests/cs0658.cs : New file to demonstrate error 0658.
1747 * attribute.cs (Attributes): New class to encapsulate all attributes which were
1748 being passed around as an arraylist.
1749 (Attributes::AddAttribute): Method to add attribute sections.
1751 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
1752 (struct_declaration): Update accordingly.
1753 (constant_declaration): Update.
1754 (field_declaration): Update.
1755 (method_header): Update.
1756 (fixed_parameter): Update.
1757 (parameter_array): Ditto.
1758 (property_declaration): Ditto.
1759 (destructor_declaration): Ditto.
1761 * class.cs (Struct::Struct): Update constructors accordingly.
1762 (Class::Class): Ditto.
1763 (Field::Field): Ditto.
1764 (Method::Method): Ditto.
1765 (Property::Property): Ditto.
1766 (TypeContainer::OptAttribute): update property's return type.
1768 * interface.cs (Interface.opt_attributes): New member.
1769 (Interface::Interface): Update to take the extra Attributes argument.
1771 * parameter.cs (Parameter::Parameter): Ditto.
1773 * constant.cs (Constant::Constant): Ditto.
1775 * interface.cs (InterfaceMemberBase): New OptAttributes field.
1776 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
1777 the attributes as a parameter.
1778 (InterfaceProperty): Update constructor call.
1779 (InterfaceEvent): Ditto.
1780 (InterfaceMethod): Ditto.
1781 (InterfaceIndexer): Ditto.
1783 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
1784 pass the attributes too.
1785 (interface_event_declaration): Ditto.
1786 (interface_property_declaration): Ditto.
1787 (interface_method_declaration): Ditto.
1788 (interface_declaration): Ditto.
1790 2001-09-05 Miguel de Icaza <miguel@ximian.com>
1792 * class.cs (Method::Define): Track the "static Main" definition to
1793 create an entry point.
1795 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
1796 EntryPoint if we find it.
1798 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
1799 (EmitContext::ig): Make this variable public.
1801 * driver.cs: Make the default output file be the first file name
1802 with the .exe extension.
1804 Detect empty compilations
1806 Handle various kinds of output targets. Handle --target and
1807 rename -t to --dumper.
1809 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
1810 methods inherited from Expression return now an Expression. This
1811 will is used during the tree rewriting as we resolve them during
1814 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
1815 the spec. Missing entirely is the information about
1816 accessability of elements of it.
1818 (Expression::ExprClassFromMemberInfo): New constructor for
1819 Expressions that creates a fully initialized Expression based on
1820 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
1823 (Invocation::Resolve): Begin implementing resolution of invocations.
1825 * literal.cs (StringLiteral): Implement Emit.
1827 2001-09-05 Ravi Pratap <ravi@ximian.com>
1829 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
1832 2001-09-04 Ravi Pratap <ravi@ximian.com>
1834 * cs-parser.jay (attribute_arguments): Implement actions.
1835 (attribute): Fix bug in production. Implement action.
1836 (attribute_list): Implement.
1837 (attribute_target): Implement.
1838 (attribute_target_specifier, opt_target_specifier): Implement
1839 (CheckAttributeTarget): New method to check if the attribute target
1841 (attribute_section): Implement.
1842 (opt_attributes): Implement.
1844 * attribute.cs : New file to handle attributes.
1845 (Attribute): Class to hold attribute info.
1847 * cs-parser.jay (opt_attribute_target_specifier): Remove production
1848 (attribute_section): Modify production to use 2 different rules to
1849 achieve the same thing. 1 s/r conflict down !
1850 Clean out commented, useless, non-reducing dimension_separator rules.
1852 * class.cs (TypeContainer.attributes): New member to hold list
1853 of attributes for a type.
1854 (Struct::Struct): Modify to take one more argument, the attribute list.
1855 (Class::Class): Ditto.
1856 (Field::Field): Ditto.
1857 (Method::Method): Ditto.
1858 (Property::Property): Ditto.
1860 * cs-parser.jay (struct_declaration): Update constructor call to
1861 pass in the attributes too.
1862 (class_declaration): Ditto.
1863 (constant_declaration): Ditto.
1864 (field_declaration): Ditto.
1865 (method_header): Ditto.
1866 (fixed_parameter): Ditto.
1867 (parameter_array): Ditto.
1868 (property_declaration): Ditto.
1870 * constant.cs (Constant::Constant): Update constructor similarly.
1871 Use System.Collections.
1873 * parameter.cs (Parameter::Parameter): Update as above.
1875 2001-09-02 Ravi Pratap <ravi@ximian.com>
1877 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
1878 (TypeContainer.delegates): New member to hold list of delegates.
1880 * cs-parser.jay (delegate_declaration): Implement the action correctly
1881 this time as I seem to be on crack ;-)
1883 2001-09-02 Miguel de Icaza <miguel@ximian.com>
1885 * rootcontext.cs (RootContext::IsNamespace): new function, used to
1886 tell whether an identifier represents a namespace.
1888 * expression.cs (NamespaceExpr): A namespace expression, used only
1889 temporarly during expression resolution.
1890 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
1891 utility functions to resolve names on expressions.
1893 2001-09-01 Miguel de Icaza <miguel@ximian.com>
1895 * codegen.cs: Add hook for StatementExpressions.
1897 * class.cs: Fix inverted test for static flag in methods.
1899 2001-09-02 Ravi Pratap <ravi@ximian.com>
1901 * class.cs (Operator::CheckUnaryOperator): Correct error number used
1902 to make it coincide with MS' number.
1903 (Operator::CheckBinaryOperator): Ditto.
1905 * ../errors/errors.txt : Remove error numbers added earlier.
1907 * ../errors/cs1019.cs : Test case for error # 1019
1909 * ../errros/cs1020.cs : Test case for error # 1020
1911 * cs-parser.jay : Clean out commented cruft.
1912 (dimension_separators, dimension_separator): Comment out. Ostensibly not
1913 used anywhere - non-reducing rule.
1914 (namespace_declarations): Non-reducing rule - comment out.
1916 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
1917 with TypeContainer::AddEnum.
1919 * delegate.cs : New file for delegate handling classes.
1920 (Delegate): Class for declaring delegates.
1922 * makefile : Update.
1924 * cs-parser.jay (delegate_declaration): Implement.
1926 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
1928 * class.cs (Event::Define): Implement.
1929 (Event.EventBuilder): New member.
1931 * class.cs (TypeContainer::Populate): Update to define all enums and events
1933 (Events): New property for the events arraylist we hold. Shouldn't we move to using
1934 readonly fields for all these cases ?
1936 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1938 * class.cs (Property): Revamp to use the convention of making fields readonly.
1939 Accordingly modify code elsewhere.
1941 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
1942 the Define method of the Property class.
1944 * class.cs : Clean up applied patch and update references to variables etc. Fix
1946 (TypeContainer::Populate): Update to define all the properties we have. Also
1947 define all enumerations.
1949 * enum.cs (Define): Implement.
1951 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1953 * cs-parser.jay (overloadable_operator): The semantic value is an
1954 enum of the Operator class.
1955 (operator_declarator): Implement actions.
1956 (operator_declaration): Implement.
1958 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
1959 validity of definitions.
1960 (Operator::CheckBinaryOperator): Static method to check for binary operators
1961 (TypeContainer::AddOperator): New method to add an operator to a type.
1963 * cs-parser.jay (indexer_declaration): Added line to actually call the
1964 AddIndexer method so it gets added ;-)
1966 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
1967 already taken care of by the MS compiler ?
1969 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1971 * class.cs (Operator): New class for operator declarations.
1972 (Operator::OpType): Enum for the various operators.
1974 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1976 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
1977 ostensibly handle this in semantic analysis.
1979 * cs-parser.jay (general_catch_clause): Comment out
1980 (specific_catch_clauses, specific_catch_clause): Ditto.
1981 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
1982 (catch_args, opt_catch_args): New productions.
1983 (catch_clause): Rewrite to use the new productions above
1984 (catch_clauses): Modify accordingly.
1985 (opt_catch_clauses): New production to use in try_statement
1986 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
1987 and re-write the code in the actions to extract the specific and
1988 general catch clauses by being a little smart ;-)
1990 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
1991 Hooray, try and catch statements parse fine !
1993 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1995 * statement.cs (Block::GetVariableType): Fix logic to extract the type
1996 string from the hashtable of variables.
1998 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
1999 I end up making that mistake ;-)
2000 (catch_clauses): Fixed gross error which made Key and Value of the
2001 DictionaryEntry the same : $1 !!
2003 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2005 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2007 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2008 when the add and remove accessors are specified.
2010 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2012 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2013 information about indexer_declarator.
2014 (indexer_declarator): Implement actions.
2015 (parsing_indexer): New local boolean used to keep track of whether
2016 we are parsing indexers or properties. This is necessary because
2017 implicit_parameters come into picture even for the get accessor in the
2019 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2021 * class.cs (Indexer): New class for indexer declarations.
2022 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2023 (TypeContainer::indexers): New member to hold list of indexers for the
2026 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2028 * cs-parser.jay (add_accessor_declaration): Implement action.
2029 (remove_accessor_declaration): Implement action.
2030 (event_accessors_declaration): Implement
2031 (variable_declarators): swap statements for first rule - trivial.
2033 * class.cs (Event): New class to hold information about event
2035 (TypeContainer::AddEvent): New method to add an event to a type
2036 (TypeContainer::events): New member to hold list of events.
2038 * cs-parser.jay (event_declaration): Implement actions.
2040 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2042 * cs-parser.jay (dim_separators): Implement. Make it a string
2043 concatenating all the commas together, just as they appear.
2044 (opt_dim_separators): Modify accordingly
2045 (rank_specifiers): Update accordingly. Basically do the same
2046 thing - instead, collect the brackets here.
2047 (opt_rank_sepcifiers): Modify accordingly.
2048 (array_type): Modify to actually return the complete type string
2049 instead of ignoring the rank_specifiers.
2050 (expression_list): Implement to collect the expressions
2051 (variable_initializer): Implement. We make it a list of expressions
2052 essentially so that we can handle the array_initializer case neatly too.
2053 (variable_initializer_list): Implement.
2054 (array_initializer): Make it a list of variable_initializers
2055 (opt_array_initializer): Modify accordingly.
2057 * expression.cs (New::NType): Add enumeration to help us
2058 keep track of whether we have an object/delegate creation
2059 or an array creation.
2060 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2061 members to hold data about array creation.
2062 (New:New): Modify to update NewType
2063 (New:New): New Overloaded contructor for the array creation
2066 * cs-parser.jay (array_creation_expression): Implement to call
2067 the overloaded New constructor.
2069 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2071 * class.cs (TypeContainer::Constructors): Return member
2072 constructors instead of returning null.
2074 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2076 * typemanager.cs (InitCoreTypes): Initialize the various core
2077 types after we have populated the type manager with the user
2078 defined types (this distinction will be important later while
2079 compiling corlib.dll)
2081 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2082 on Expression Classification. Now all expressions have a method
2083 `Resolve' and a method `Emit'.
2085 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2086 generation from working. Also add some temporary debugging
2089 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2091 * codegen.cs: Lots of code generation pieces. This is only the
2092 beginning, will continue tomorrow with more touches of polish. We
2093 handle the fundamentals of if, while, do, for, return. Others are
2094 trickier and I need to start working on invocations soon.
2096 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2099 * codegen.cs (EmitContext): New struct, used during code
2100 emission to keep a context. Most of the code generation will be
2103 * cs-parser.jay: Add embedded blocks to the list of statements of
2104 this block. So code generation proceeds in a top down fashion.
2106 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2108 * statement.cs: Add support for multiple child blocks.
2110 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2112 * codegen.cs (EmitCode): New function, will emit the code for a
2113 Block of code given a TypeContainer and its ILGenerator.
2115 * statement.cs (Block): Standard public readonly optimization.
2116 (Block::Block constructors): Link children.
2117 (Block::Child): Child Linker.
2118 (Block::EmitVariables): Emits IL variable declarations.
2120 * class.cs: Drop support for MethodGroups here, delay until
2122 (Method::): Applied the same simplification that I did before, and
2123 move from Properties to public readonly fields.
2124 (Method::ParameterTypes): Returns the parameter types for the
2125 function, and implements a cache that will be useful later when I
2126 do error checking and the semantic analysis on the methods is
2128 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2129 and made a method, optional argument tells whether this is a class
2130 or a structure to apply the `has-this' bit.
2131 (Method::GetCallingConvention): Implement, returns the calling
2133 (Method::Define): Defines the type, a second pass is performed
2134 later to populate the methods.
2136 (Constructor::ParameterTypes): implement a cache similar to the
2137 one on Method::ParameterTypes, useful later when we do semantic
2140 (TypeContainer::EmitMethod): New method. Emits methods.
2142 * expression.cs: Removed MethodGroup class from here.
2144 * parameter.cs (Parameters::GetCallingConvention): new method.
2146 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2148 * class.cs (TypeContainer::Populate): Drop RootContext from the
2151 (Constructor::CallingConvention): Returns the calling convention.
2152 (Constructor::ParameterTypes): Returns the constructor parameter
2155 (TypeContainer::AddConstructor): Keep track of default constructor
2156 and the default static constructor.
2158 (Constructor::) Another class that starts using `public readonly'
2159 instead of properties.
2161 (Constructor::IsDefault): Whether this is a default constructor.
2163 (Field::) use readonly public fields instead of properties also.
2165 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2166 track of static constructors; If none is used, turn on
2167 BeforeFieldInit in the TypeAttributes.
2169 * cs-parser.jay (opt_argument_list): now the return can be null
2170 for the cases where there are no arguments.
2172 (constructor_declarator): If there is no implicit `base' or
2173 `this', then invoke the default parent constructor.
2175 * modifiers.cs (MethodAttr): New static function maps a set of
2176 modifiers flags into a MethodAttributes enum
2177 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2178 MethodAttr, TypeAttr to represent the various mappings where the
2180 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2182 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2184 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2187 * interface.cs (PopulateIndexer): Implemented the code generator
2188 for interface indexers.
2190 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2192 * interface.cs (InterfaceMemberBase): Now we track the new status
2195 (PopulateProperty): Implement property population. Woohoo! Got
2196 Methods and Properties going today.
2198 Removed all the properties for interfaces, and replaced them with
2199 `public readonly' fields.
2201 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2203 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2204 initialize their hashtables/arraylists only when they are needed
2205 instead of doing this always.
2207 * parameter.cs: Handle refs and out parameters.
2209 * cs-parser.jay: Use an ArrayList to construct the arguments
2210 instead of the ParameterCollection, and then cast that to a
2213 * parameter.cs: Drop the use of ParameterCollection and use
2214 instead arrays of Parameters.
2216 (GetParameterInfo): Use the Type, not the Name when resolving
2219 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2221 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2222 and instead use public readonly fields.
2224 * class.cs: Put back walking code for type containers.
2226 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2228 * class.cs (MakeConstant): Code to define constants.
2230 * rootcontext.cs (LookupType): New function. Used to locate types
2233 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2235 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2236 this System.Reflection code is. Kudos to Microsoft
2238 * typemanager.cs: Implement a type cache and avoid loading all
2239 types at boot time. Wrap in LookupType the internals. This made
2240 the compiler so much faster. Wow. I rule!
2242 * driver.cs: Make sure we always load mscorlib first (for
2243 debugging purposes, nothing really important).
2245 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2246 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2248 * rootcontext.cs: Lookup types on their namespace; Lookup types
2249 on namespaces that have been imported using the `using' keyword.
2251 * class.cs (TypeContainer::TypeAttr): Virtualize.
2252 (Class::TypeAttr): Return attributes suitable for this bad boy.
2253 (Struct::TypeAttr): ditto.
2254 Handle nested classes.
2255 (TypeContainer::) Remove all the type visiting code, it is now
2256 replaced with the rootcontext.cs code
2258 * rootcontext.cs (GetClassBases): Added support for structs.
2260 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2262 * interface.cs, statement.cs, class.cs, parameter.cs,
2263 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2264 Drop use of TypeRefs, and use strings instead.
2266 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2270 * class.cs (Struct::Struct): set the SEALED flags after
2271 checking the modifiers.
2272 (TypeContainer::TypeAttr): new property, returns the
2273 TypeAttributes for a class.
2275 * cs-parser.jay (type_list): Oops, list production was creating a
2276 new list of base types.
2278 * rootcontext.cs (StdLib): New property.
2279 (GetInterfaceTypeByName): returns an interface by type name, and
2280 encapsulates error handling here.
2281 (GetInterfaces): simplified.
2282 (ResolveTree): Encapsulated all the tree resolution here.
2283 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2286 * driver.cs: Add support for --nostdlib, to avoid loading the
2288 (Main): Do not put tree resolution here.
2290 * rootcontext.cs: Beginning of the class resolution.
2292 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2294 * rootcontext.cs: Provide better error reporting.
2296 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2298 * rootcontext.cs (CreateInterface): Handle the case where there
2299 are no parent interfaces.
2301 (CloseTypes): Routine to flush types at the end.
2302 (CreateInterface): Track types.
2303 (GetInterfaces): Returns an array of Types from the list of
2306 * typemanager.c (AddUserType): Mechanism to track user types (puts
2307 the type on the global type hash, and allows us to close it at the
2310 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2312 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2313 RecordInterface instead.
2315 * cs-parser.jay: Updated to reflect changes above.
2317 * decl.cs (Definition): Keep track of the TypeBuilder type that
2318 represents this type here. Not sure we will use it in the long
2319 run, but wont hurt for now.
2321 * driver.cs: Smaller changes to accomodate the new code.
2323 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2326 * rootcontext.cs (CreateInterface): New method, used to create
2327 the System.TypeBuilder type for interfaces.
2328 (ResolveInterfaces): new entry point to resolve the interface
2330 (CodeGen): Property, used to keep track of the code generator.
2332 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2334 * cs-parser.jay: Add a second production for delegate_declaration
2337 (enum_body): Put an opt_comma here instead of putting it on
2338 enum_body or enum_member_declarations so we can handle trailing
2339 commas on enumeration members. Gets rid of a shift/reduce.
2341 (type_list): Need a COMMA in the middle.
2343 (indexer_declaration): Tell tokenizer to recognize get/set
2345 * Remove old targets.
2347 * Re-add the parser target.
2349 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2351 * cs-parser.jay: Add precendence rules for a number of operators
2352 ot reduce the number of shift/reduce conflicts in the grammar.
2354 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2356 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2359 Get rid of old crufty code.
2361 * rootcontext.cs: Use this to keep track of the parsed
2362 representation and the defined types available to the program.
2364 * gen-treedump.cs: adjust for new convention.
2366 * type.cs: Split out the type manager, and the assembly builder
2369 * typemanager.cs: the type manager will live here now.
2371 * cil-codegen.cs: And the code generator here.
2373 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2375 * makefile: Fixed up for easy making.
2377 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2379 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2382 (unary_expression): Expand pre_increment_expression and
2383 post_decrement_expression to reduce a shift/reduce.
2385 2001-07-11 Simon Cozens
2387 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2389 Improve allow_keyword_as_indent name.
2391 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2393 * Adjustments for Beta2.
2395 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2397 * decl.cs: Added `Define' abstract method.
2398 (InTransit): new property, used to catch recursive definitions.
2400 * interface.cs: Implement `Define'.
2402 * modifiers.cs: Map Modifiers.constants to
2403 System.Reflection.TypeAttribute flags.
2405 * class.cs: Keep track of types and user-defined types.
2406 (BuilderInit): New method for creating an assembly
2407 (ResolveType): New function to launch the resolution process, only
2408 used by interfaces for now.
2410 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2411 that are inserted into the name space.
2413 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2415 * ARGH. I have screwed up my tree so many times due to the use of
2416 rsync rather than using CVS. Going to fix this at once.
2418 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2421 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2423 * Experiment successful: Use System.Type rather that our own
2426 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2428 * cs-parser.jay: Removed nsAliases from here.
2430 Use new namespaces, handle `using XXX;'
2432 * namespace.cs: Reimplemented namespace handling, use a recursive
2433 definition of the class. Now we can keep track of using clauses
2434 and catch invalid using clauses.
2436 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2438 * gen-treedump.cs: Adapted for all the renaming.
2440 * expression.cs (Expression): this class now has a Type property
2441 which returns an expression Type.
2443 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2444 `Type', as this has a different meaning now in the base
2446 2001-05-22 Miguel de Icaza <miguel@ximian.com>
2448 * interface.cs, class.cs: Removed from all the sources the
2449 references to signature computation, as we can not do method
2450 signature computation during the parsing time, as we are not
2451 trying to solve at that point distinguishing:
2455 void a (NS.Blah x) {}
2458 Which depending on the context might be valid or not, as we do not
2459 know if Blah is the same thing as NS.Blah at that point.
2461 * Redid everything so the code uses TypeRefs now instead of
2462 Types. TypeRefs are just temporary type placeholders, that need
2463 to be resolved. They initially have a pointer to a string and the
2464 current scope in which they are used. This is used later by the
2465 compiler to resolve the reference to an actual Type.
2467 * DeclSpace is no longer a CIR.Type, and neither are
2468 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
2469 are all DeclSpaces, but no Types.
2471 * type.cs (TypeRefManager): This implements the TypeRef manager,
2472 which keeps track of all the types that need to be resolved after
2473 the parsing has finished.
2475 2001-05-13 Miguel de Icaza <miguel@ximian.com>
2477 * ARGH. We are going to have to store `foreach' as a class rather
2478 than resolving it, as we need to verify error 1579 after name
2479 resolution. *OR* we could keep a flag that says `This request to
2480 IEnumerator comes from a foreach statement' which we can then use
2481 to generate the error.
2483 2001-05-10 Miguel de Icaza <miguel@ximian.com>
2485 * class.cs (TypeContainer.AddMethod): we now add methods to the
2486 MethodGroup instead of the method hashtable.
2488 * expression.cs: Add MethodGroup abstraction, which gets us one
2489 step closer to the specification in the way we handle method
2492 * cs-parser.jay (primary_expression): qualified_identifier now
2493 tried to match up an identifier to a local variable reference or
2494 to a parameter reference.
2496 current_local_parameters is now a parser global variable that
2497 points to the current parameters for the block, used during name
2500 (property_declaration): Now creates an implicit `value' argument to
2503 2001-05-09 Miguel de Icaza <miguel@ximian.com>
2505 * parameter.cs: Do not use `param' arguments as part of the
2506 signature, per the spec.
2508 2001-05-08 Miguel de Icaza <miguel@ximian.com>
2510 * decl.cs: Base class for classes, structs and interfaces. This
2511 is the "Declaration Space"
2513 * cs-parser.jay: Use CheckDef for checking declaration errors
2514 instead of having one on each function.
2516 * class.cs: Factor out some code for handling error handling in
2517 accordance to the "Declarations" section in the "Basic Concepts"
2518 chapter in the ECMA C# spec.
2520 * interface.cs: Make all interface member classes derive from
2521 InterfaceMemberBase.
2523 2001-05-07 Miguel de Icaza <miguel@ximian.com>
2525 * Many things: all interfaces are parsed and generated in
2526 gen-treedump. Support for member variables, constructors,
2527 destructors, properties, constants is there.
2529 Beginning of the IL backend, but very little done, just there for
2532 2001-04-29 Miguel de Icaza <miguel@ximian.com>
2534 * cs-parser.jay: Fix labeled statement.
2536 * cs-tokenizer.cs (escape): Escape " and ' always.
2537 ref_line, ref_name: keep track of the line/filename as instructed
2538 by #line by the compiler.
2541 2001-04-27 Miguel de Icaza <miguel@ximian.com>
2543 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
2544 to match the values in System.CodeDOM.
2546 Divid renamed to Divide.
2548 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
2550 (Statements.set): remove.
2552 * System.CodeDOM/CodeCatchClause.cs: always have a valid
2555 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
2556 falseStatements always have valid values.
2558 * cs-parser.jay: Use System.CodeDOM now.