1 2001-10-17 Ravi Pratap <ravi@ximian.com>
3 * expression.cs (New::DoResolve): Implement delegate creation fully
4 and according to the spec.
6 (New::DoEmit): Update to handle delegates differently.
8 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
9 because of which we were printing out arguments in reverse order !
11 * delegate.cs (VerifyMethod): Implement to check if the given method
14 (FullDelegateDesc): Implement.
16 (VerifyApplicability): Implement.
18 * expression.cs (Invocation::DoResolve): Update to accordingly handle
19 delegate invocations too.
21 (Invocation::Emit): Ditto.
23 * ../errors/cs1593.cs : Added.
25 * ../errors/cs1594.cs : Added.
27 * delegate.cs (InstanceExpression, TargetMethod): New properties.
29 2001-10-16 Ravi Pratap <ravi@ximian.com>
31 * typemanager.cs (intptr_type): Core type for System.IntPtr
33 (InitCoreTypes): Update for the same.
35 (iasyncresult_type, asynccallback_type): Ditto.
37 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
40 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
43 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
44 the builders for the 4 members of a delegate type :-)
46 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
49 * expression.cs (New::DoResolve): Implement guts for delegate creation.
51 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
53 2001-10-15 Miguel de Icaza <miguel@ximian.com>
55 * statement.cs (Break::Emit): Implement.
56 (Continue::Emit): Implement.
58 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
59 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
60 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
61 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
64 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
65 properties that track the label for the current loop (begin of the
66 loop and end of the loop).
68 2001-10-15 Ravi Pratap <ravi@ximian.com>
70 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
71 use of emitting anything at all.
73 * class.cs, rootcontext.cs : Get rid of calls to the same.
75 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
77 (Populate): Define the constructor correctly and set the implementation
80 * typemanager.cs (delegate_types): New hashtable to hold delegates that
83 (AddDelegateType): Implement.
85 (IsDelegateType): Implement helper method.
87 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
89 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
90 and accordingly handle it.
92 * delegate.cs (Populate): Take TypeContainer argument.
93 Implement bits to define the Invoke method. However, I still haven't figured out
94 how to take care of the native int bit :-(
96 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
97 Qualify the name of the delegate, not its return type !
99 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
102 (StandardConversionExists): Checking for array types turns out to be recursive.
104 (ConvertReferenceExplicit): Implement array conversion.
106 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
108 2001-10-12 Ravi Pratap <ravi@ximian.com>
110 * cs-parser.jay (delegate_declaration): Store the fully qualified
111 name as it is a type declaration.
113 * delegate.cs (ReturnType, Name): Rename members to these. Make them
116 (DefineDelegate): Renamed from Define. Does the same thing essentially,
117 as TypeContainer::DefineType.
119 (Populate): Method in which all the definition of the various methods (Invoke)
122 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
125 (CloseDelegate): Finally creates the delegate.
127 * class.cs (TypeContainer::DefineType): Update to define delegates.
128 (Populate, Emit and CloseType): Do the same thing here too.
130 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
131 delegates in all these operations.
133 2001-10-14 Miguel de Icaza <miguel@ximian.com>
135 * expression.cs: LocalTemporary: a new expression used to
136 reference a temporary that has been created.
138 * assign.cs: Handle PropertyAccess back here, so that we can
139 provide the proper semantic access to properties.
141 * expression.cs (Expression::ConvertReferenceExplicit): Implement
142 a few more explicit conversions.
144 * modifiers.cs: `NEW' modifier maps to HideBySig.
146 * expression.cs (PropertyExpr): Make this into an
147 ExpressionStatement, and support the EmitStatement code path.
149 Perform get/set error checking, clean up the interface.
151 * assign.cs: recognize PropertyExprs as targets, and if so, turn
152 them into toplevel access objects.
154 2001-10-12 Miguel de Icaza <miguel@ximian.com>
156 * expression.cs: PropertyExpr::PropertyExpr: use work around the
159 * typemanager.cs: Keep track here of our PropertyBuilders again to
160 work around lameness in SRE.
162 2001-10-11 Miguel de Icaza <miguel@ximian.com>
164 * expression.cs (LValue::LValueResolve): New method in the
165 interface, used to perform a second resolution pass for LValues.
167 (This::DoResolve): Catch the use of this in static methods.
169 (This::LValueResolve): Implement.
171 (This::Store): Remove warning, assigning to `this' in structures
174 (Invocation::Emit): Deal with invocation of
175 methods on value types. We need to pass the address to structure
176 methods rather than the object itself. (The equivalent code to
177 emit "this" for structures leaves the entire structure on the
178 stack instead of a pointer to it).
180 (ParameterReference::DoResolve): Compute the real index for the
181 argument based on whether the method takes or not a `this' pointer
182 (ie, the method is static).
184 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
185 value types returned from functions when we need to invoke a
186 method on the sturcture.
189 2001-10-11 Ravi Pratap <ravi@ximian.com>
191 * class.cs (TypeContainer::DefineType): Method to actually do the business of
192 defining the type in the Modulebuilder or Typebuilder. This is to take
193 care of nested types which need to be defined on the TypeBuilder using
196 (TypeContainer::GetClassBases): Implement. Essentially the code from the
197 methods in RootContext, only ported to be part of TypeContainer.
199 (TypeContainer::GetInterfaceOrClass): Ditto.
201 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
203 * interface.cs (Interface::DefineInterface): New method. Does exactly
204 what RootContext.CreateInterface did earlier, only it takes care of nested types
207 (Interface::GetInterfaces): Move from RootContext here and port.
209 (Interface::GetInterfaceByName): Same here.
211 * rootcontext.cs (ResolveTree): Re-write.
213 (PopulateTypes): Re-write.
215 * class.cs (TypeContainer::Populate): Populate nested types too.
216 (TypeContainer::Emit): Emit nested members too.
218 * typemanager.cs (AddUserType): Do not make use of the FullName property,
219 instead just use the name argument passed in as it is already fully
222 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
223 to TypeContainer mapping to see if a type is user-defined.
225 * class.cs (TypeContainer::CloseType): Implement.
227 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
228 the default constructor.
230 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
233 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
235 * interface.cs (CloseType): Create the type here.
237 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
240 Remove all the methods which are now in TypeContainer.
242 2001-10-10 Ravi Pratap <ravi@ximian.com>
244 * delegate.cs (Define): Re-write bits to define the delegate
247 2001-10-10 Miguel de Icaza <miguel@ximian.com>
249 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
251 * expression.cs (ImplicitReferenceConversion): handle null as well
252 as a source to convert to any reference type.
254 * statement.cs (Return): Perform any implicit conversions to
255 expected return type.
257 Validate use of return statement.
259 * codegen.cs (EmitContext): Pass the expected return type here.
261 * class.cs (Method, Constructor, Property): Pass expected return
264 2001-10-09 Miguel de Icaza <miguel@ximian.com>
266 * expression.cs: Make DoResolve take an EmitContext instead of a
269 Replaced `l' and `location' for `loc', for consistency.
271 (Error, Warning): Remove unneeded Tc argument.
273 * assign.cs, literal.cs, constant.cs: Update to new calling
276 * codegen.cs: EmitContext now contains a flag indicating whether
277 code is being generated in a static method or not.
279 * cs-parser.jay: DecomposeQI, new function that replaces the old
280 QualifiedIdentifier. Now we always decompose the assembled
281 strings from qualified_identifier productions into a group of
284 2001-10-08 Miguel de Icaza <miguel@ximian.com>
286 * rootcontext.cs: Deal with field-less struct types correctly now
287 by passing the size option to Define Type.
289 * class.cs: Removed hack that created one static field.
291 2001-10-07 Miguel de Icaza <miguel@ximian.com>
293 * statement.cs: Moved most of the code generation here.
295 2001-10-09 Ravi Pratap <ravi@ximian.com>
297 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
300 (ElementAccess): Remove useless bits for now - keep checks as the spec
303 2001-10-08 Ravi Pratap <ravi@ximian.com>
305 * expression.cs (ElementAccess::DoResolve): Remove my crap code
306 and start performing checks according to the spec.
308 2001-10-07 Ravi Pratap <ravi@ximian.com>
310 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
311 rank_specifiers instead.
313 (rank_specifiers): Change the order in which the rank specifiers are stored
315 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
317 * expression.cs (ElementAccess): Implement the LValue interface too.
319 2001-10-06 Ravi Pratap <ravi@ximian.com>
321 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
322 except that user defined conversions are not included.
324 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
325 perform the conversion of the return type, if necessary.
327 (New::DoResolve): Check whether we are creating an array or an object
328 and accordingly do the needful.
330 (New::Emit): Same here.
332 (New::DoResolve): Implement guts of array creation.
334 (New::FormLookupType): Helper function.
336 2001-10-07 Miguel de Icaza <miguel@ximian.com>
338 * codegen.cs: Removed most of the code generation here, and move the
339 corresponding code generation bits to the statement classes.
341 Added support for try/catch/finalize and throw.
343 * cs-parser.jay: Added support for try/catch/finalize.
345 * class.cs: Catch static methods having the flags override,
348 * expression.cs (UserCast): This user cast was not really doing
349 what it was supposed to do. Which is to be born in fully resolved
350 state. Parts of the resolution were being performed at Emit time!
354 2001-10-05 Miguel de Icaza <miguel@ximian.com>
356 * expression.cs: Implicity convert the result from UserCast.
358 2001-10-05 Ravi Pratap <ravi@ximian.com>
360 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
361 prevented it from working correctly.
363 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
364 merely ConvertImplicit.
366 2001-10-05 Miguel de Icaza <miguel@ximian.com>
368 * typemanager.cs: Make the LookupTypeContainer function static,
369 and not per-instance.
371 * class.cs: Make static FindMembers (the one that takes a Type
374 * codegen.cs: Add EmitForeach here.
376 * cs-parser.jay: Make foreach a toplevel object instead of the
377 inline expansion, as we need to perform semantic analysis on it.
379 2001-10-05 Ravi Pratap <ravi@ximian.com>
381 * expression.cs (Expression::ImplicitUserConversion): Rename to
382 UserDefinedConversion.
384 (Expression::UserDefinedConversion): Take an extra argument specifying
385 whether we look for explicit user conversions too.
387 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
389 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
391 (ExplicitUserConversion): Make it a call to UserDefinedConversion
392 with the appropriate arguments.
394 * cs-parser.jay (cast_expression): Record location too.
396 * expression.cs (Cast): Record location info.
398 (Expression::ConvertExplicit): Take location argument.
400 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
401 to determine if we are doing explicit conversions.
403 (UserCast::Emit): Update accordingly.
405 (Expression::ConvertExplicit): Report an error if everything fails.
407 * ../errors/cs0030.cs : Add.
409 2001-10-04 Miguel de Icaza <miguel@ximian.com>
411 * modifiers.cs: If the ABSTRACT keyword is present, also set the
412 virtual and newslot bits.
414 * class.cs (TypeContainer::RegisterRequiredImplementations):
415 Record methods we need.
417 (TypeContainer::MakeKey): Helper function to make keys for
418 MethodBases, since the Methodbase key is useless.
420 (TypeContainer::Populate): Call RegisterRequiredImplementations
421 before defining the methods.
423 Create a mapping for method_builders_to_methods ahead of time
424 instead of inside a tight loop.
426 (::RequireMethods): Accept an object as the data to set into the
427 hashtable so we can report interface vs abstract method mismatch.
429 2001-10-03 Miguel de Icaza <miguel@ximian.com>
431 * report.cs: Make all of it static.
433 * rootcontext.cs: Drop object_type and value_type computations, as
434 we have those in the TypeManager anyways.
436 Drop report instance variable too, now it is a global.
438 * driver.cs: Use try/catch on command line handling.
440 Add --probe option to debug the error reporting system with a test
443 * report.cs: Add support for exiting program when a probe
444 condition is reached.
446 2001-10-03 Ravi Pratap <ravi@ximian.com>
448 * expression.cs (Binary::DoNumericPromotions): Fix the case when
449 we do a forcible conversion regardless of type, to check if
450 ForceConversion returns a null.
452 (Binary::error19): Use location to report error.
454 (Unary::error23): Use location here too.
456 * ../errors/cs0019.cs : Check in.
458 * ../errors/cs0023.cs : Check in.
460 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
461 case of a non-null MethodInfo object with a length of 0 !
463 (Binary::ResolveOperator): Flag error if overload resolution fails to find
464 an applicable member - according to the spec :-)
465 Also fix logic to find members in base types.
467 (Unary::ResolveOperator): Same here.
469 (Unary::report23): Change name to error23 and make first argument a TypeContainer
470 as I was getting thoroughly confused between this and error19 :-)
472 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
473 (::FindMostEncompassedType): Implement.
474 (::FindMostEncompassingType): Implement.
475 (::StandardConversionExists): Implement.
477 (UserImplicitCast): Re-vamp. We now need info about most specific
478 source and target types so that we can do the necessary conversions.
480 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
481 mathematical union with no duplicates.
483 2001-10-03 Miguel de Icaza <miguel@ximian.com>
485 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
486 in order from base classes to child classes, so that we can in
487 child classes look up in our parent for method names and
488 attributes (required for handling abstract, virtual, new, override
489 constructs: we need to instrospect our base class, and if we dont
490 populate the classes in order, the introspection might be
491 incorrect. For example, a method could query its parent before
492 the parent has any methods and would determine that the parent has
493 no abstract methods (while it could have had them)).
495 (RootContext::CreateType): Record the order in which we define the
498 2001-10-02 Miguel de Icaza <miguel@ximian.com>
500 * class.cs (TypeContainer::Populate): Also method definitions can
501 fail now, keep track of this.
503 (TypeContainer::FindMembers): Implement support for
504 DeclaredOnly/noDeclaredOnly flag.
506 (Constructor::Emit) Return the ConstructorBuilder.
508 (Method::Emit) Return the MethodBuilder.
509 Check for abstract or virtual methods to be public.
511 * rootcontext.cs (RootContext::CreateType): Register all the
512 abstract methods required for the class to be complete and the
513 interface methods that must be implemented.
515 * cs-parser.jay: Report error 501 (method requires body if it is
516 not marked abstract or extern).
518 * expression.cs (TypeOf::Emit): Implement.
520 * typemanager.cs: runtime_handle_type, new global type.
522 * class.cs (Property::Emit): Generate code for properties.
524 2001-10-02 Ravi Pratap <ravi@ximian.com>
526 * expression.cs (Unary::ResolveOperator): Find operators on base type
527 too - we now conform exactly to the spec.
529 (Binary::ResolveOperator): Same here.
531 * class.cs (Operator::Define): Fix minor quirk in the tests.
533 * ../errors/cs0215.cs : Added.
535 * ../errors/cs0556.cs : Added.
537 * ../errors/cs0555.cs : Added.
539 2001-10-01 Miguel de Icaza <miguel@ximian.com>
541 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
542 single integer which is really efficient
544 2001-10-01 Ravi Pratap <ravi@ximian.com>
546 * expression.cs (Expression::ImplicitUserConversion): Use location
547 even in the case when we are examining True operators.
549 * class.cs (Operator::Define): Perform extensive checks to conform
550 with the rules for operator overloading in the spec.
552 * expression.cs (Expression::ImplicitReferenceConversion): Implement
553 some of the other conversions mentioned in the spec.
555 * typemanager.cs (array_type): New static member for the System.Array built-in
558 (cloneable_interface): For System.ICloneable interface.
560 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
561 we start resolving the tree and populating types.
563 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
565 2001-10-01 Miguel de Icaza <miguel@ximian.com>
567 * expression.cs (Expression::ExprClassFromMemberInfo,
568 Expression::Literalize): Create literal expressions from
569 FieldInfos which are literals.
571 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
572 type casts, because they were wrong. The test suite in tests
575 (ImplicitNumericConversion): ushort to ulong requires a widening
578 Int32 constant to long requires widening cast as well.
580 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
581 for integers because the type on the stack is not i4.
583 2001-09-30 Miguel de Icaza <miguel@ximian.com>
585 * expression.cs (report118): require location argument.
587 * parameter.cs: Do not dereference potential null value.
589 * class.cs: Catch methods that lack the `new' keyword when
590 overriding a name. Report warnings when `new' is used without
591 anything being there to override.
593 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
595 * class.cs: Only add constructor to hashtable if it is non-null
596 (as now constructors can fail on define).
598 (TypeManager, Class, Struct): Take location arguments.
600 Catch field instance initialization in structs as errors.
602 accepting_filter: a new filter for FindMembers that is static so
603 that we dont create an instance per invocation.
605 (Constructor::Define): Catch errors where a struct constructor is
608 * cs-parser.jay: Pass location information for various new
611 * delegate.cs (Delegate): take a location argument.
613 * driver.cs: Do not call EmitCode if there were problesm in the
614 Definition of the types, as many Builders wont be there.
616 * decl.cs (Decl::Decl): Require a location argument.
618 * cs-tokenizer.cs: Handle properly hex constants that can not fit
619 into integers, and find the most appropiate integer for it.
621 * literal.cs: Implement ULongLiteral.
623 * rootcontext.cs: Provide better information about the location of
624 failure when CreateType fails.
626 2001-09-29 Miguel de Icaza <miguel@ximian.com>
628 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
631 * expression.cs (Binary::CheckShiftArguments): Add missing type
633 (Binary::ResolveOperator): Add type to the logical and and logical
634 or, Bitwise And/Or and Exclusive Or code paths, it was missing
637 (Binary::DoNumericPromotions): In the case where either argument
638 is ulong (and most signed types combined with ulong cause an
639 error) perform implicit integer constant conversions as well.
641 2001-09-28 Miguel de Icaza <miguel@ximian.com>
643 * expression.cs (UserImplicitCast): Method should always be
645 (Invocation::BetterConversion): Simplified test for IntLiteral.
647 (Expression::ImplicitNumericConversion): Split this routine out.
648 Put the code that performs implicit constant integer conversions
651 (Expression::Resolve): Become a wrapper around DoResolve so we can
652 check eclass and type being set after resolve.
654 (Invocation::Badness): Remove this dead function
656 (Binary::ResolveOperator): Do not compute the expensive argumnets
657 unless we have a union for it.
659 (Probe::Emit): Is needs to do an isinst and then
660 compare against null.
662 (::CanConvert): Added Location argument. If the Location argument
663 is null (Location.Null), then we do not report errors. This is
664 used by the `probe' mechanism of the Explicit conversion. We do
665 not want to generate an error for something that the user
666 explicitly requested to be casted. But the pipeline for an
667 explicit cast first tests for potential implicit casts.
669 So for now, if the Location is null, it means `Probe only' to
670 avoid adding another argument. Might have to revise this
673 (ClassCast): New class used to type cast objects into arbitrary
674 classes (used in Explicit Reference Conversions).
676 Implement `as' as well.
678 Reverted all the patches from Ravi below: they were broken:
680 * The use of `level' as a mechanism to stop recursive
681 invocations is wrong. That was there just to catch the
682 bug with a strack trace but not as a way of addressing
685 To fix the problem we have to *understand* what is going
686 on and the interactions and come up with a plan, not
687 just get things going.
689 * The use of the type conversion cache that I proposed
690 last night had an open topic: How does this work across
691 protection domains. A user defined conversion might not
692 be public in the location where we are applying the
693 conversion, a different conversion might be selected
694 (ie, private A->B (better) but public B->A (worse),
695 inside A, A->B applies, but outside it, B->A will
698 * On top of that (ie, even if the above is solved),
699 conversions in a cache need to be abstract. Ie, `To
700 convert from an Int to a Short use an OpcodeCast', not
701 `To convert from an Int to a Short use the OpcodeCast on
702 the variable 5' (which is what this patch was doing).
704 2001-09-28 Ravi Pratap <ravi@ximian.com>
706 * expression.cs (Invocation::ConversionExists): Re-write to use
709 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
710 cache all conversions done, not just user-defined ones.
712 (Invocation::BetterConversion): The real culprit. Use ConversionExists
713 to determine if a conversion exists instead of acutually trying to
714 perform the conversion. It's faster too.
716 (Expression::ConvertExplicit): Modify to use ConversionExists to check
717 and only then attempt the implicit conversion.
719 2001-09-28 Ravi Pratap <ravi@ximian.com>
721 * expression.cs (ConvertImplicit): Use a cache for conversions
722 already found. Check level of recursion and bail out if necessary.
724 2001-09-28 Miguel de Icaza <miguel@ximian.com>
726 * typemanager.cs (string_concat_string_string, string_concat_object_object):
727 Export standard methods that we expect for string operations.
729 * statement.cs (Block::UsageWarning): Track usage of variables and
730 report the errors for not used variables.
732 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
735 2001-09-27 Miguel de Icaza <miguel@ximian.com>
737 * codegen.cs: remove unnneded code
739 * expression.cs: Removed BuiltinTypeAccess class
741 Fix the order in which implicit conversions are
744 The previous fixed dropped support for boxed conversions (adding a
745 test to the test suite now)
747 (UserImplicitCast::CanConvert): Remove test for source being null,
748 that code is broken. We should not feed a null to begin with, if
749 we do, then we should track the bug where the problem originates
750 and not try to cover it up here.
752 Return a resolved expression of type UserImplicitCast on success
753 rather than true/false. Ravi: this is what I was talking about,
754 the pattern is to use a static method as a "constructor" for
757 Also, do not create arguments until the very last minute,
758 otherwise we always create the arguments even for lookups that
759 will never be performed.
761 (UserImplicitCast::Resolve): Eliminate, objects of type
762 UserImplicitCast are born in a fully resolved state.
764 * typemanager.cs (InitCoreTypes): Init also value_type
767 * expression.cs (Cast::Resolve): First resolve the child expression.
769 (LValue): Add new method AddressOf to be used by
772 Change the argument of Store to take an EmitContext instead of an
773 ILGenerator, because things like FieldExpr need to be able to call
774 their children expression to generate the instance code.
776 (Expression::Error, Expression::Warning): Sugar functions for
779 (Expression::MemberLookup): Accept a TypeContainer instead of a
780 Report as the first argument.
782 (Expression::ResolvePrimary): Killed. I still want to improve
783 this as currently the code is just not right.
785 (Expression::ResolveMemberAccess): Simplify, but it is still
788 (Unary::Resolve): Catch errors in AddressOf operators.
790 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
791 index to a byte for the short-version, or the compiler will choose
792 the wrong Emit call, which generates the wrong data.
794 (ParameterReference::Emit, ::Store): same.
796 (FieldExpr::AddressOf): Implement.
798 * typemanager.cs: TypeManager: made public variable instead of
801 * driver.cs: document --fatal.
803 * report.cs (ErrorMessage, WarningMessage): new names for the old
804 Error and Warning classes.
806 * cs-parser.jay (member_access): Turn built-in access to types
807 into a normal simplename
809 2001-09-27 Ravi Pratap <ravi@ximian.com>
811 * expression.cs (Invocation::BetterConversion): Fix to cope
812 with q being null, since this was introducing a bug.
814 * expression.cs (ConvertImplicit): Do built-in conversions first.
816 2001-09-27 Ravi Pratap <ravi@ximian.com>
818 * expression.cs (UserImplicitCast::Resolve): Fix bug.
820 2001-09-27 Ravi Pratap <ravi@ximian.com>
822 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
823 I had introduced long ago (what's new ?).
825 * expression.cs (UserImplicitCast::CanConvert): Static method to do
826 the work of all the checking.
827 (ConvertImplicit): Call CanConvert and only then create object if necessary.
828 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
830 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
831 that is the right way.
833 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
834 overloading resolution. Use everywhere instead of cutting and pasting code.
836 (Binary::ResolveOperator): Use MakeUnionSet.
838 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
839 we have to convert to bool types. Not complete yet.
841 2001-09-27 Miguel de Icaza <miguel@ximian.com>
843 * typemanager.cs (TypeManager::CSharpName): support ushort.
845 * expression.cs (Expression::TryImplicitIntConversion): Attempts
846 to provide an expression that performsn an implicit constant int
847 conversion (section 6.1.6).
848 (Expression::ConvertImplicitRequired): Reworked to include
849 implicit constant expression conversions.
851 (Expression::ConvertNumericExplicit): Finished.
853 (Invocation::Emit): If InstanceExpression is null, then it means
854 that we perform a call on this.
856 2001-09-26 Miguel de Icaza <miguel@ximian.com>
858 * expression.cs (Unary::Emit): Remove some dead code.
859 (Probe): Implement Resolve and Emit for `is'.
860 (Expression::ConvertImplicitRequired): Attempt to do constant
861 expression conversions here. Maybe should be moved to
862 ConvertImplicit, but I am not sure.
863 (Expression::ImplicitLongConstantConversionPossible,
864 Expression::ImplicitIntConstantConversionPossible): New functions
865 that tell whether is it possible to apply an implicit constant
866 expression conversion.
868 (ConvertNumericExplicit): Started work on explicit numeric
871 * cs-parser.jay: Update operator constants.
873 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
874 (Parameters::GetSignature): Hook up VerifyArgs here.
875 (Parameters::VerifyArgs): Verifies that no two arguments have the
878 * class.cs (Operator): Update the operator names to reflect the
879 ones that the spec expects (as we are just stringizing the
882 * expression.cs (Unary::ResolveOperator): Fix bug: Use
883 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
884 previous usage did only work for our methods.
885 (Expression::ConvertImplicit): Handle decimal implicit numeric
887 (Expression::InternalTypeConstructor): Used to invoke constructors
888 on internal types for default promotions.
890 (Unary::Emit): Implement special handling for the pre/post
891 increment/decrement for overloaded operators, as they need to have
892 the same semantics as the other operators.
894 (Binary::ResolveOperator): ditto.
895 (Invocation::ConversionExists): ditto.
896 (UserImplicitCast::Resolve): ditto.
898 2001-09-26 Ravi Pratap <ravi@ximian.com>
900 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
901 operator, return after emitting body. Regression tests pass again !
903 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
904 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
905 (Invocation::OverloadResolve): Ditto.
906 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
908 * everywhere : update calls to the above methods accordingly.
910 2001-09-26 Miguel de Icaza <miguel@ximian.com>
912 * assign.cs (Assign): Make it inherit from ExpressionStatement.
914 * expression.cs (ExpressionStatement): New base class used for
915 expressions that can appear in statements, so that we can provide
916 an alternate path to generate expression that do not leave a value
919 (Expression::Emit, and all the derivatives): We no longer return
920 whether a value is left on the stack or not. Every expression
921 after being emitted leaves a single value on the stack.
923 * codegen.cs (EmitContext::EmitStatementExpression): Use the
924 facilties of ExpressionStatement if possible.
926 * cs-parser.jay: Update statement_expression.
928 2001-09-25 Miguel de Icaza <miguel@ximian.com>
930 * driver.cs: Change the wording of message
932 2001-09-25 Ravi Pratap <ravi@ximian.com>
934 * expression.cs (Binary::ResolveOperator): Had forgottten to set
935 the type of the expression to the return type of the method if
936 we have an overloaded operator match ! The regression tests pass again !
937 (Unary::ResolveOperator): Ditto.
939 * expression.cs (Invocation::ConversionExists): Correct the member lookup
940 to find "op_Implicit", not "implicit" ;-)
941 (UserImplicitCast): New class to take care of user-defined implicit conversions.
942 (ConvertImplicit, ForceConversion): Take TypeContainer argument
944 * everywhere : Correct calls to the above accordingly.
946 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
947 (ConvertImplicit): Do user-defined conversion if it exists.
949 2001-09-24 Miguel de Icaza <miguel@ximian.com>
951 * assign.cs: track location.
952 (Resolve): Use implicit conversions on assignment.
954 * literal.cs: Oops. Not good, Emit of short access values should
955 pass (Bytes) or the wrong argument will be selected.
957 * expression.cs (Unary::Emit): Emit code for -expr.
959 (Unary::ResolveOperator): Handle `Substract' for non-constants
960 (substract from zero from the non-constants).
961 Deal with Doubles as well.
963 (Expression::ConvertImplicitRequired): New routine that reports an
964 error if no implicit conversion exists.
966 (Invocation::OverloadResolve): Store the converted implicit
967 expressions if we make them
969 2001-09-24 Ravi Pratap <ravi@ximian.com>
971 * class.cs (ConstructorInitializer): Take a Location argument.
972 (ConstructorBaseInitializer): Same here.
973 (ConstructorThisInitializer): Same here.
975 * cs-parser.jay : Update all calls accordingly.
977 * expression.cs (Unary, Binary, New): Take location argument.
978 Update accordingly everywhere.
980 * cs-parser.jay : Update all calls to the above to take a location
985 2001-09-24 Ravi Pratap <ravi@ximian.com>
987 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
988 (Invocation::BetterConversion): Same here
989 (Invocation::ConversionExists): Ditto.
991 (Invocation::ConversionExists): Implement.
993 2001-09-22 Ravi Pratap <ravi@ximian.com>
995 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
996 Also take an additional TypeContainer argument.
998 * All over : Pass in TypeContainer as argument to OverloadResolve.
1000 * typemanager.cs (CSharpName): Update to check for the string type and return
1003 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1006 2001-09-21 Ravi Pratap <ravi@ximian.com>
1008 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1009 (Invocation::BetterFunction): Implement.
1010 (Invocation::BetterConversion): Implement.
1011 (Invocation::ConversionExists): Skeleton, no implementation yet.
1013 Okay, things work fine !
1015 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1017 * typemanager.cs: declare and load enum_type, delegate_type and
1020 * expression.cs (Expression::Emit): Now emit returns a value that
1021 tells whether a value is left on the stack or not. This strategy
1022 might be reveted tomorrow with a mechanism that would address
1023 multiple assignments.
1024 (Expression::report118): Utility routine to report mismatches on
1027 (Unary::Report23): Report impossible type/operator combination
1030 (Unary::IsIncrementableNumber): Whether the type can be
1031 incremented or decremented with add.
1032 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1034 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1036 (Invocation::Emit): Deal with new Emit convetion.
1038 * All Expression derivatives: Updated their Emit method to return
1039 whether they leave values on the stack or not.
1041 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1042 stack for expressions that are statements.
1044 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1046 * expression.cs (LValue): New interface. Must be implemented by
1048 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1051 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1052 interface for generating code, simplifies the code.
1054 2001-09-20 Ravi Pratap <ravi@ximian.com>
1056 * expression.cs (everywhere): Comment out return statements in ::Resolve
1057 methods to avoid the warnings.
1059 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1061 * driver.cs (parse): Report error 2001 if we can not open the
1064 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1067 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1070 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1071 otherwise nested blocks end up with the same index.
1073 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1075 * expression.cs: Instead of having FIXMEs in the Resolve
1076 functions, throw exceptions so it is obvious that we are facing a
1079 * cs-parser.jay (invocation_expression): Pass Location information.
1081 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1082 Use a basename for those routines because .NET does not like paths
1085 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1088 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1090 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1091 are loading the correct data types (throws an exception if not).
1092 (TypeManager::InitCoreTypes): Use CoreLookupType
1094 * expression.cs (Unary::ResolveOperator): return the child
1095 expression for expressions which are just +expr.
1096 (Unary::ResolveOperator): Return negative literals for -LITERAL
1097 expressions (otherwise they are Unary {Literal}).
1098 (Invocation::Badness): Take into account `Implicit constant
1099 expression conversions'.
1101 * literal.cs (LongLiteral): Implement long literal class.
1102 (IntLiteral): export the `Value' of the intliteral.
1104 2001-09-19 Ravi Pratap <ravi@ximian.com>
1106 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1108 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1109 instead of 'Operator'
1111 * expression.cs (Binary::ResolveOperator): Update accordingly.
1112 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1115 * cs-parser.jay (unary_expression): Update to use the new names.
1117 * gen-treedump.cs (GetUnary): Same here.
1119 * expression.cs (Unary::Resolve): Implement.
1120 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1121 operators are found instead of making noise ;-)
1122 (Unary::ResolveOperator): New method to do precisely the same thing which
1123 Binary::ResolveOperator does for Binary expressions.
1124 (Unary.method, .Arguments): Add.
1125 (Unary::OperName): Implement.
1126 (Unary::ForceConversion): Copy and Paste !
1128 * class.cs (Operator::Define): Fix a small bug for the case when we have
1131 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1132 for the inbuilt operators. Only overloading works for now ;-)
1134 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1136 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1137 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1139 * expression.cs (This::Emit): Implement.
1140 (This::Resolve): Implement.
1141 (TypeOf:Resolve): Implement.
1142 (Expression::ResolveSimpleName): Add an implicit this to instance
1144 (MemberAccess::Resolve): Deal with Parameters and Fields.
1145 Bind instance variable to Field expressions.
1146 (FieldExpr::Instance): New field used to track the expression that
1147 represents the object instance.
1148 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1150 (FieldExpr::Emit): Implement.
1152 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1153 the last instruction contains a return opcode to avoid generating
1154 the last `ret' instruction (this generates correct code, and it is
1155 nice to pass the peverify output).
1157 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1158 initializer for static and instance variables.
1159 (Constructor::Emit): Allow initializer to be null in the case of
1160 static constructors. Only emit initializer for instance
1163 (TypeContainer::FindMembers): Return a null array if there are no
1166 Also fix the code for the MemberTypes.Method branch, as it was not
1167 scanning that for operators (or tried to access null variables before).
1169 * assign.cs (Assign::Emit): Handle instance and static fields.
1173 * driver.cs: Stop compilation if there are parse errors.
1175 * cs-parser.jay (constructor_declaration): Provide default base
1176 initializer for non-static constructors.
1177 (constructor_declarator): Do not provide a default base
1178 initializers if none was specified.
1179 Catch the fact that constructors should not have parameters.
1181 * class.cs: Do not emit parent class initializers for static
1182 constructors, that should be flagged as an error.
1184 2001-09-18 Ravi Pratap <ravi@ximian.com>
1186 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1187 Move back code into TypeContainer::Populate.
1189 2001-09-18 Ravi Pratap <ravi@ximian.com>
1191 * class.cs (TypeContainer::AddConstructor): Fix the check to
1192 compare against Name, not Basename.
1193 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1195 * cs-parser.jay : Update accordingly.
1197 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1198 for methods, don't forget to look into the operators too.
1199 (RegisterMethodBuilder): Helper method to take care of this for
1200 methods, constructors and operators.
1201 (Operator::Define): Completely revamp.
1202 (Operator.OperatorMethod, MethodName): New fields.
1203 (TypeContainer::Populate): Move the registering of builders into
1204 RegisterMethodBuilder.
1205 (Operator::Emit): Re-write.
1207 * expression.cs (Binary::Emit): Comment out code path to emit method
1208 invocation stuff for the case when we have a user defined operator. I am
1209 just not able to get it right !
1211 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1213 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1216 (Expression::MemberLookup): Provide a version that allows to
1217 specify the MemberTypes and BindingFlags.
1219 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1220 so it was not fetching variable information from outer blocks.
1222 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1223 Beforefieldinit as it was buggy.
1225 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1228 * class.cs (Constructor::Emit): Only emit if block is not null.
1229 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1230 deal with this by semantically definining it as if the user had
1233 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1234 constructors as we now "emit" them at a higher level.
1236 (TypeContainer::DefineDefaultConstructor): Used to define the
1237 default constructors if none was provided.
1239 (ConstructorInitializer): Add methods Resolve and Emit.
1241 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1243 2001-09-17 Ravi Pratap <ravi@ximian.com>
1245 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1246 the default constructor builder with our hashtable for methodbuilders
1249 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1250 and argument_count is 0 in which case we have a match.
1251 (Binary::ResolveOperator): More null checking and miscellaneous coding
1254 2001-09-17 Ravi Pratap <ravi@ximian.com>
1256 * rootcontext.cs (IsNameSpace): Compare against null.
1258 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1260 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1261 and Unary::Operator.
1263 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1266 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1267 we have overloaded operators.
1268 (Binary::ResolveOperator): Implement the part which does the operator overload
1271 * class.cs (Operator::Emit): Implement.
1272 (TypeContainer::Emit): Emit the operators we have too.
1274 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1275 the case when we have a user-defined operator.
1277 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1279 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1281 2001-09-16 Ravi Pratap <ravi@ximian.com>
1283 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1284 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1285 (Constructor::Emit): Implement.
1286 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1287 if we have no work to do.
1288 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1291 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1292 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1294 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1297 2001-09-15 Ravi Pratap <ravi@ximian.com>
1299 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1301 (Tree::RecordNamespace): Method to do what the name says ;-)
1302 (Tree::Namespaces): Property to get at the namespaces hashtable.
1304 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1307 * rootcontext.cs (IsNamespace): Fixed it :-)
1309 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1311 * class.cs (TypeContainer::FindMembers): Add support for
1313 (MethodCore): New class that encapsulates both the shared aspects
1314 of a Constructor and a Method.
1315 (Method, Constructor): Factored pieces into MethodCore.
1317 * driver.cs: Added --fatal which makes errors throw exceptions.
1318 Load System assembly as well as part of the standard library.
1320 * report.cs: Allow throwing exceptions on errors for debugging.
1322 * modifiers.cs: Do not use `parent', instead use the real type
1323 container to evaluate permission settings.
1325 * class.cs: Put Ravi's patch back in. He is right, and we will
1326 have to cope with the
1328 2001-09-14 Ravi Pratap <ravi@ximian.com>
1330 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1331 FamORAssem, not FamANDAssem.
1333 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1335 * driver.cs: Added --parse option that only parses its input files
1338 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1339 incorrect. IsTopLevel is not used to tell whether an object is
1340 root_types or not (that can be achieved by testing this ==
1341 root_types). But to see if this is a top-level *class* (not
1342 necessarly our "toplevel" container).
1344 2001-09-14 Ravi Pratap <ravi@ximian.com>
1346 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1347 parent instead of a direct call to GetType.
1349 2001-09-14 Ravi Pratap <ravi@ximian.com>
1351 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1352 Modifiers.TypeAttr. This should just be a call to that method.
1354 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1355 object so that we can determine if we are top-level or not.
1357 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1360 * enum.cs (Enum::Define): Ditto.
1362 * modifiers.cs (FieldAttr): Re-write.
1364 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1365 (TypeContainer::HaveStaticConstructor): New property to provide access
1366 to precisely that info.
1368 * modifiers.cs (MethodAttr): Re-write.
1369 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1371 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1372 of top-level types as claimed.
1374 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1376 * expression.cs (MemberLookup): Fruitless attempt to lookup
1377 constructors. Maybe I need to emit default constructors? That
1378 might be it (currently .NET emits this for me automatically).
1379 (Invocation::OverloadResolve): Cope with Arguments == null.
1380 (Invocation::EmitArguments): new function, shared by the new
1382 (Invocation::Emit): Handle static and instance methods. Emit
1383 proper call instruction for virtual or non-virtual invocations.
1384 (New::Emit): Implement.
1385 (New::Resolve): Implement.
1386 (MemberAccess:Resolve): Implement.
1387 (MethodGroupExpr::InstanceExpression): used conforming to the spec
1389 (FieldExpr::Resolve): Set type.
1391 * support.cs: Handle empty arguments.
1393 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
1394 SimpleLookup): Auxiliary routines to help parse a qualifier
1397 Update qualifier_identifier rule.
1399 * codegen.cs: Removed debugging messages.
1401 * class.cs: Make this a global thing, this acts just as a "key" to
1402 objects that we might have around.
1404 (Populate): Only initialize method_builders_to_methods once.
1406 * expression.cs (PropertyExpr): Initialize type from the
1409 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
1410 Resolve pattern. Attempt to implicitly convert value to boolean.
1413 * expression.cs: Set the type for the int32/int32 argument case.
1414 (Binary::ResolveOperator): Set the return type to boolean for
1415 comparission operators
1417 * typemanager.cs: Remove debugging print code.
1419 (Invocation::Resolve): resolve type.
1421 * class.cs: Allocate a MemberInfo of the correct size, as the code
1422 elsewhere depends on the test to reflect the correct contents.
1424 (Method::) Keep track of parameters, due to System.Reflection holes
1426 (TypeContainer::Populate): Keep track of MethodBuilders to Method
1429 (TypeContainer::FindMembers): Use ArrayList and then copy an array
1430 of the exact size and return that.
1432 (Class::LookupMethodByBuilder): New function that maps
1433 MethodBuilders to its methods. Required to locate the information
1434 on methods because System.Reflection bit us again.
1436 * support.cs: New file, contains an interface ParameterData and
1437 two implementations: ReflectionParameters and InternalParameters
1438 used to access Parameter information. We will need to grow this
1441 * expression.cs (Invocation::GetParameterData): implement a cache
1442 and a wrapper around the ParameterData creation for methods.
1443 (Invocation::OverloadResolve): Use new code.
1445 2001-09-13 Ravi Pratap <ravi@ximian.com>
1447 * class.cs (TypeContainer::EmitField): Remove and move into
1448 (Field::Define): here and modify accordingly.
1449 (Field.FieldBuilder): New member.
1450 (TypeContainer::Populate): Update accordingly.
1451 (TypeContainer::FindMembers): Implement.
1453 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1455 * statement.cs: (VariableInfo::VariableType): New field to be
1456 initialized with the full type once it is resolved.
1458 2001-09-12 Miguel de Icaza <miguel@ximian.com>
1460 * parameter.cs (GetParameterInfo): Use a type cache to compute
1461 things only once, and to reuse this information
1463 * expression.cs (LocalVariableReference::Emit): Implement.
1464 (OpcodeCast::Emit): fix.
1466 (ParameterReference::Resolve): Implement.
1467 (ParameterReference::Emit): Implement.
1469 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
1470 that are expressions need to stay as Expressions.
1472 * typemanager.cs (CSharpName): Returns the C# name of a type if
1475 * expression.cs (Expression::ConvertImplicit): New function that
1476 implements implicit type conversions.
1478 (Expression::ImplicitReferenceConversion): Implements implicit
1479 reference conversions.
1481 (EmptyCast): New type for transparent casts.
1483 (OpcodeCast): New type for casts of types that are performed with
1484 a sequence of bytecodes.
1486 (BoxedCast): New type used for casting value types into reference
1487 types. Emits a box opcode.
1489 (Binary::DoNumericPromotions): Implements numeric promotions of
1490 and computation of the Binary::Type.
1492 (Binary::EmitBranchable): Optimization.
1494 (Binary::Emit): Implement code emission for expressions.
1496 * typemanager.cs (TypeManager): Added two new core types: sbyte
1499 2001-09-12 Ravi Pratap <ravi@ximian.com>
1501 * class.cs (TypeContainer::FindMembers): Method which does exactly
1502 what Type.FindMembers does, only we don't have to use reflection. No
1505 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
1506 typecontainer objects as we need to get at them.
1507 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
1509 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
1510 typecontainer object.
1512 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
1513 of just a Report object.
1515 2001-09-11 Ravi Pratap <ravi@ximian.com>
1517 * class.cs (Event::Define): Go back to using the prefixes "add_" and
1519 (TypeContainer::Populate): Now define the delegates of the type too.
1520 (TypeContainer.Delegates): Property to access the list of delegates defined
1523 * delegates.cs (Delegate::Define): Implement partially.
1525 * modifiers.cs (TypeAttr): Handle more flags.
1527 2001-09-11 Ravi Pratap <ravi@ximian.com>
1529 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
1531 (Operator::Define): Re-write logic to get types by using the LookupType method
1532 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
1533 (Indexer::Define): Ditto.
1534 (Event::Define): Ditto.
1535 (Property::Define): Ditto.
1537 2001-09-10 Ravi Pratap <ravi@ximian.com>
1539 * class.cs (TypeContainer::Populate): Now define operators too.
1540 (TypeContainer.Operators): New property to access the list of operators
1542 (Operator.OperatorMethodBuilder): New member to hold the method builder
1543 for the operator we are defining.
1544 (Operator::Define): Implement.
1546 2001-09-10 Ravi Pratap <ravi@ximian.com>
1548 * class.cs (Event::Define): Make the prefixes of the accessor methods
1549 addOn_ and removeOn_
1551 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
1552 of the location being passed in too. Ideally, this should go later since all
1553 error reporting should be done through the Report object.
1555 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
1556 (Populate): Iterate thru the indexers we have and define them too.
1557 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
1558 for the get and set accessors.
1559 (Indexer::Define): Implement.
1561 2001-09-09 Miguel de Icaza <miguel@ximian.com>
1563 * expression.cs (Binary::Resolve): Beginning of it. I scratched
1564 my previous implementation, did not work.
1566 * typemanager.cs: Add a couple of missing types (the longs).
1568 * literal.cs: Use TypeManager.bool_type instead of getting it.
1570 * expression.cs (EventExpr): New kind of expressions.
1571 (Expressio::ExprClassFromMemberInfo): finish
1573 2001-09-08 Miguel de Icaza <miguel@ximian.com>
1575 * assign.cs: Emit stores to static fields differently.
1577 2001-09-08 Ravi Pratap <ravi@ximian.com>
1579 * Merge in changes and adjust code to tackle conflicts. Backed out my
1580 code in Assign::Resolve ;-)
1582 2001-09-08 Ravi Pratap <ravi@ximian.com>
1584 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
1585 instead Report.Error and also pass in the location.
1586 (CSharpParser::Lexer): New readonly property to return the reference
1587 to the Tokenizer object.
1588 (declare_local_variables): Use Report.Error with location instead of plain
1592 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
1593 (Operator.CheckBinaryOperator): Ditto.
1595 * cs-parser.jay (operator_declarator): Update accordingly.
1597 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
1598 (CheckBinaryOperator): Same here.
1600 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
1601 on the name without any prefixes of namespace names etc. This is because we
1602 already might have something already fully qualified like
1603 'System.Console.WriteLine'
1605 * assign.cs (Resolve): Begin implementation. Stuck ;-)
1607 2001-09-07 Ravi Pratap <ravi@ximian.com>
1609 * cs-tokenizer.cs (location): Return a string which also contains
1612 * expression.cs (ElementAccess): New class for expressions of the
1613 type 'element access.'
1614 (BaseAccess): New class for expressions of the type 'base access.'
1615 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
1618 * cs-parser.jay (element_access): Implement action.
1619 (base_access): Implement actions.
1620 (checked_expression, unchecked_expression): Implement.
1622 * cs-parser.jay (local_variable_type): Correct and implement.
1623 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
1625 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
1627 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
1628 name and the specifiers.
1630 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
1632 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
1633 making them all public ;-)
1635 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
1638 2001-09-07 Miguel de Icaza <miguel@ximian.com>
1640 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
1642 (FieldExpr, PropertyExprs): New resolved expressions.
1643 (SimpleName::MemberStaticCheck): Perform static checks for access
1644 to non-static fields on static methods. Maybe this should be
1645 generalized for MemberAccesses.
1646 (SimpleName::ResolveSimpleName): More work on simple name
1649 * cs-parser.jay (primary_expression/qualified_identifier): track
1650 the parameter index.
1652 * codegen.cs (CodeGen::Save): Catch save exception, report error.
1653 (EmitContext::EmitBoolExpression): Chain to expression generation
1654 instead of temporary hack.
1655 (::EmitStatementExpression): Put generic expression code generation.
1657 * assign.cs (Assign::Emit): Implement variable assignments to
1658 local variables, parameters and fields.
1660 2001-09-06 Miguel de Icaza <miguel@ximian.com>
1662 * statement.cs (Block::GetVariableInfo): New method, returns the
1663 VariableInfo for a variable name in a block.
1664 (Block::GetVariableType): Implement in terms of GetVariableInfo
1666 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
1667 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
1669 2001-09-06 Ravi Pratap <ravi@ximian.com>
1671 * cs-parser.jay (operator_declaration): Continue on my quest : update
1672 to take attributes argument.
1673 (event_declaration): Ditto.
1674 (enum_declaration): Ditto.
1675 (indexer_declaration): Ditto.
1677 * class.cs (Operator::Operator): Update constructor accordingly.
1678 (Event::Event): Ditto.
1680 * delegate.cs (Delegate::Delegate): Same here.
1682 * enum.cs (Enum::Enum): Same here.
1684 2001-09-05 Ravi Pratap <ravi@ximian.com>
1686 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
1688 * ../tests/cs0658.cs : New file to demonstrate error 0658.
1690 * attribute.cs (Attributes): New class to encapsulate all attributes which were
1691 being passed around as an arraylist.
1692 (Attributes::AddAttribute): Method to add attribute sections.
1694 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
1695 (struct_declaration): Update accordingly.
1696 (constant_declaration): Update.
1697 (field_declaration): Update.
1698 (method_header): Update.
1699 (fixed_parameter): Update.
1700 (parameter_array): Ditto.
1701 (property_declaration): Ditto.
1702 (destructor_declaration): Ditto.
1704 * class.cs (Struct::Struct): Update constructors accordingly.
1705 (Class::Class): Ditto.
1706 (Field::Field): Ditto.
1707 (Method::Method): Ditto.
1708 (Property::Property): Ditto.
1709 (TypeContainer::OptAttribute): update property's return type.
1711 * interface.cs (Interface.opt_attributes): New member.
1712 (Interface::Interface): Update to take the extra Attributes argument.
1714 * parameter.cs (Parameter::Parameter): Ditto.
1716 * constant.cs (Constant::Constant): Ditto.
1718 * interface.cs (InterfaceMemberBase): New OptAttributes field.
1719 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
1720 the attributes as a parameter.
1721 (InterfaceProperty): Update constructor call.
1722 (InterfaceEvent): Ditto.
1723 (InterfaceMethod): Ditto.
1724 (InterfaceIndexer): Ditto.
1726 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
1727 pass the attributes too.
1728 (interface_event_declaration): Ditto.
1729 (interface_property_declaration): Ditto.
1730 (interface_method_declaration): Ditto.
1731 (interface_declaration): Ditto.
1733 2001-09-05 Miguel de Icaza <miguel@ximian.com>
1735 * class.cs (Method::Define): Track the "static Main" definition to
1736 create an entry point.
1738 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
1739 EntryPoint if we find it.
1741 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
1742 (EmitContext::ig): Make this variable public.
1744 * driver.cs: Make the default output file be the first file name
1745 with the .exe extension.
1747 Detect empty compilations
1749 Handle various kinds of output targets. Handle --target and
1750 rename -t to --dumper.
1752 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
1753 methods inherited from Expression return now an Expression. This
1754 will is used during the tree rewriting as we resolve them during
1757 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
1758 the spec. Missing entirely is the information about
1759 accessability of elements of it.
1761 (Expression::ExprClassFromMemberInfo): New constructor for
1762 Expressions that creates a fully initialized Expression based on
1763 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
1766 (Invocation::Resolve): Begin implementing resolution of invocations.
1768 * literal.cs (StringLiteral): Implement Emit.
1770 2001-09-05 Ravi Pratap <ravi@ximian.com>
1772 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
1775 2001-09-04 Ravi Pratap <ravi@ximian.com>
1777 * cs-parser.jay (attribute_arguments): Implement actions.
1778 (attribute): Fix bug in production. Implement action.
1779 (attribute_list): Implement.
1780 (attribute_target): Implement.
1781 (attribute_target_specifier, opt_target_specifier): Implement
1782 (CheckAttributeTarget): New method to check if the attribute target
1784 (attribute_section): Implement.
1785 (opt_attributes): Implement.
1787 * attribute.cs : New file to handle attributes.
1788 (Attribute): Class to hold attribute info.
1790 * cs-parser.jay (opt_attribute_target_specifier): Remove production
1791 (attribute_section): Modify production to use 2 different rules to
1792 achieve the same thing. 1 s/r conflict down !
1793 Clean out commented, useless, non-reducing dimension_separator rules.
1795 * class.cs (TypeContainer.attributes): New member to hold list
1796 of attributes for a type.
1797 (Struct::Struct): Modify to take one more argument, the attribute list.
1798 (Class::Class): Ditto.
1799 (Field::Field): Ditto.
1800 (Method::Method): Ditto.
1801 (Property::Property): Ditto.
1803 * cs-parser.jay (struct_declaration): Update constructor call to
1804 pass in the attributes too.
1805 (class_declaration): Ditto.
1806 (constant_declaration): Ditto.
1807 (field_declaration): Ditto.
1808 (method_header): Ditto.
1809 (fixed_parameter): Ditto.
1810 (parameter_array): Ditto.
1811 (property_declaration): Ditto.
1813 * constant.cs (Constant::Constant): Update constructor similarly.
1814 Use System.Collections.
1816 * parameter.cs (Parameter::Parameter): Update as above.
1818 2001-09-02 Ravi Pratap <ravi@ximian.com>
1820 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
1821 (TypeContainer.delegates): New member to hold list of delegates.
1823 * cs-parser.jay (delegate_declaration): Implement the action correctly
1824 this time as I seem to be on crack ;-)
1826 2001-09-02 Miguel de Icaza <miguel@ximian.com>
1828 * rootcontext.cs (RootContext::IsNamespace): new function, used to
1829 tell whether an identifier represents a namespace.
1831 * expression.cs (NamespaceExpr): A namespace expression, used only
1832 temporarly during expression resolution.
1833 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
1834 utility functions to resolve names on expressions.
1836 2001-09-01 Miguel de Icaza <miguel@ximian.com>
1838 * codegen.cs: Add hook for StatementExpressions.
1840 * class.cs: Fix inverted test for static flag in methods.
1842 2001-09-02 Ravi Pratap <ravi@ximian.com>
1844 * class.cs (Operator::CheckUnaryOperator): Correct error number used
1845 to make it coincide with MS' number.
1846 (Operator::CheckBinaryOperator): Ditto.
1848 * ../errors/errors.txt : Remove error numbers added earlier.
1850 * ../errors/cs1019.cs : Test case for error # 1019
1852 * ../errros/cs1020.cs : Test case for error # 1020
1854 * cs-parser.jay : Clean out commented cruft.
1855 (dimension_separators, dimension_separator): Comment out. Ostensibly not
1856 used anywhere - non-reducing rule.
1857 (namespace_declarations): Non-reducing rule - comment out.
1859 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
1860 with TypeContainer::AddEnum.
1862 * delegate.cs : New file for delegate handling classes.
1863 (Delegate): Class for declaring delegates.
1865 * makefile : Update.
1867 * cs-parser.jay (delegate_declaration): Implement.
1869 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
1871 * class.cs (Event::Define): Implement.
1872 (Event.EventBuilder): New member.
1874 * class.cs (TypeContainer::Populate): Update to define all enums and events
1876 (Events): New property for the events arraylist we hold. Shouldn't we move to using
1877 readonly fields for all these cases ?
1879 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1881 * class.cs (Property): Revamp to use the convention of making fields readonly.
1882 Accordingly modify code elsewhere.
1884 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
1885 the Define method of the Property class.
1887 * class.cs : Clean up applied patch and update references to variables etc. Fix
1889 (TypeContainer::Populate): Update to define all the properties we have. Also
1890 define all enumerations.
1892 * enum.cs (Define): Implement.
1894 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1896 * cs-parser.jay (overloadable_operator): The semantic value is an
1897 enum of the Operator class.
1898 (operator_declarator): Implement actions.
1899 (operator_declaration): Implement.
1901 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
1902 validity of definitions.
1903 (Operator::CheckBinaryOperator): Static method to check for binary operators
1904 (TypeContainer::AddOperator): New method to add an operator to a type.
1906 * cs-parser.jay (indexer_declaration): Added line to actually call the
1907 AddIndexer method so it gets added ;-)
1909 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
1910 already taken care of by the MS compiler ?
1912 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1914 * class.cs (Operator): New class for operator declarations.
1915 (Operator::OpType): Enum for the various operators.
1917 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1919 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
1920 ostensibly handle this in semantic analysis.
1922 * cs-parser.jay (general_catch_clause): Comment out
1923 (specific_catch_clauses, specific_catch_clause): Ditto.
1924 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
1925 (catch_args, opt_catch_args): New productions.
1926 (catch_clause): Rewrite to use the new productions above
1927 (catch_clauses): Modify accordingly.
1928 (opt_catch_clauses): New production to use in try_statement
1929 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
1930 and re-write the code in the actions to extract the specific and
1931 general catch clauses by being a little smart ;-)
1933 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
1934 Hooray, try and catch statements parse fine !
1936 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1938 * statement.cs (Block::GetVariableType): Fix logic to extract the type
1939 string from the hashtable of variables.
1941 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
1942 I end up making that mistake ;-)
1943 (catch_clauses): Fixed gross error which made Key and Value of the
1944 DictionaryEntry the same : $1 !!
1946 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1948 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
1950 * cs-parser.jay (event_declaration): Correct to remove the semicolon
1951 when the add and remove accessors are specified.
1953 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1955 * cs-parser.jay (IndexerDeclaration): New helper class to hold
1956 information about indexer_declarator.
1957 (indexer_declarator): Implement actions.
1958 (parsing_indexer): New local boolean used to keep track of whether
1959 we are parsing indexers or properties. This is necessary because
1960 implicit_parameters come into picture even for the get accessor in the
1962 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
1964 * class.cs (Indexer): New class for indexer declarations.
1965 (TypeContainer::AddIndexer): New method to add an indexer to a type.
1966 (TypeContainer::indexers): New member to hold list of indexers for the
1969 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1971 * cs-parser.jay (add_accessor_declaration): Implement action.
1972 (remove_accessor_declaration): Implement action.
1973 (event_accessors_declaration): Implement
1974 (variable_declarators): swap statements for first rule - trivial.
1976 * class.cs (Event): New class to hold information about event
1978 (TypeContainer::AddEvent): New method to add an event to a type
1979 (TypeContainer::events): New member to hold list of events.
1981 * cs-parser.jay (event_declaration): Implement actions.
1983 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1985 * cs-parser.jay (dim_separators): Implement. Make it a string
1986 concatenating all the commas together, just as they appear.
1987 (opt_dim_separators): Modify accordingly
1988 (rank_specifiers): Update accordingly. Basically do the same
1989 thing - instead, collect the brackets here.
1990 (opt_rank_sepcifiers): Modify accordingly.
1991 (array_type): Modify to actually return the complete type string
1992 instead of ignoring the rank_specifiers.
1993 (expression_list): Implement to collect the expressions
1994 (variable_initializer): Implement. We make it a list of expressions
1995 essentially so that we can handle the array_initializer case neatly too.
1996 (variable_initializer_list): Implement.
1997 (array_initializer): Make it a list of variable_initializers
1998 (opt_array_initializer): Modify accordingly.
2000 * expression.cs (New::NType): Add enumeration to help us
2001 keep track of whether we have an object/delegate creation
2002 or an array creation.
2003 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2004 members to hold data about array creation.
2005 (New:New): Modify to update NewType
2006 (New:New): New Overloaded contructor for the array creation
2009 * cs-parser.jay (array_creation_expression): Implement to call
2010 the overloaded New constructor.
2012 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2014 * class.cs (TypeContainer::Constructors): Return member
2015 constructors instead of returning null.
2017 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2019 * typemanager.cs (InitCoreTypes): Initialize the various core
2020 types after we have populated the type manager with the user
2021 defined types (this distinction will be important later while
2022 compiling corlib.dll)
2024 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2025 on Expression Classification. Now all expressions have a method
2026 `Resolve' and a method `Emit'.
2028 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2029 generation from working. Also add some temporary debugging
2032 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2034 * codegen.cs: Lots of code generation pieces. This is only the
2035 beginning, will continue tomorrow with more touches of polish. We
2036 handle the fundamentals of if, while, do, for, return. Others are
2037 trickier and I need to start working on invocations soon.
2039 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2042 * codegen.cs (EmitContext): New struct, used during code
2043 emission to keep a context. Most of the code generation will be
2046 * cs-parser.jay: Add embedded blocks to the list of statements of
2047 this block. So code generation proceeds in a top down fashion.
2049 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2051 * statement.cs: Add support for multiple child blocks.
2053 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2055 * codegen.cs (EmitCode): New function, will emit the code for a
2056 Block of code given a TypeContainer and its ILGenerator.
2058 * statement.cs (Block): Standard public readonly optimization.
2059 (Block::Block constructors): Link children.
2060 (Block::Child): Child Linker.
2061 (Block::EmitVariables): Emits IL variable declarations.
2063 * class.cs: Drop support for MethodGroups here, delay until
2065 (Method::): Applied the same simplification that I did before, and
2066 move from Properties to public readonly fields.
2067 (Method::ParameterTypes): Returns the parameter types for the
2068 function, and implements a cache that will be useful later when I
2069 do error checking and the semantic analysis on the methods is
2071 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2072 and made a method, optional argument tells whether this is a class
2073 or a structure to apply the `has-this' bit.
2074 (Method::GetCallingConvention): Implement, returns the calling
2076 (Method::Define): Defines the type, a second pass is performed
2077 later to populate the methods.
2079 (Constructor::ParameterTypes): implement a cache similar to the
2080 one on Method::ParameterTypes, useful later when we do semantic
2083 (TypeContainer::EmitMethod): New method. Emits methods.
2085 * expression.cs: Removed MethodGroup class from here.
2087 * parameter.cs (Parameters::GetCallingConvention): new method.
2089 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2091 * class.cs (TypeContainer::Populate): Drop RootContext from the
2094 (Constructor::CallingConvention): Returns the calling convention.
2095 (Constructor::ParameterTypes): Returns the constructor parameter
2098 (TypeContainer::AddConstructor): Keep track of default constructor
2099 and the default static constructor.
2101 (Constructor::) Another class that starts using `public readonly'
2102 instead of properties.
2104 (Constructor::IsDefault): Whether this is a default constructor.
2106 (Field::) use readonly public fields instead of properties also.
2108 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2109 track of static constructors; If none is used, turn on
2110 BeforeFieldInit in the TypeAttributes.
2112 * cs-parser.jay (opt_argument_list): now the return can be null
2113 for the cases where there are no arguments.
2115 (constructor_declarator): If there is no implicit `base' or
2116 `this', then invoke the default parent constructor.
2118 * modifiers.cs (MethodAttr): New static function maps a set of
2119 modifiers flags into a MethodAttributes enum
2120 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2121 MethodAttr, TypeAttr to represent the various mappings where the
2123 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2125 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2127 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2130 * interface.cs (PopulateIndexer): Implemented the code generator
2131 for interface indexers.
2133 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2135 * interface.cs (InterfaceMemberBase): Now we track the new status
2138 (PopulateProperty): Implement property population. Woohoo! Got
2139 Methods and Properties going today.
2141 Removed all the properties for interfaces, and replaced them with
2142 `public readonly' fields.
2144 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2146 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2147 initialize their hashtables/arraylists only when they are needed
2148 instead of doing this always.
2150 * parameter.cs: Handle refs and out parameters.
2152 * cs-parser.jay: Use an ArrayList to construct the arguments
2153 instead of the ParameterCollection, and then cast that to a
2156 * parameter.cs: Drop the use of ParameterCollection and use
2157 instead arrays of Parameters.
2159 (GetParameterInfo): Use the Type, not the Name when resolving
2162 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2164 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2165 and instead use public readonly fields.
2167 * class.cs: Put back walking code for type containers.
2169 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2171 * class.cs (MakeConstant): Code to define constants.
2173 * rootcontext.cs (LookupType): New function. Used to locate types
2176 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2178 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2179 this System.Reflection code is. Kudos to Microsoft
2181 * typemanager.cs: Implement a type cache and avoid loading all
2182 types at boot time. Wrap in LookupType the internals. This made
2183 the compiler so much faster. Wow. I rule!
2185 * driver.cs: Make sure we always load mscorlib first (for
2186 debugging purposes, nothing really important).
2188 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2189 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2191 * rootcontext.cs: Lookup types on their namespace; Lookup types
2192 on namespaces that have been imported using the `using' keyword.
2194 * class.cs (TypeContainer::TypeAttr): Virtualize.
2195 (Class::TypeAttr): Return attributes suitable for this bad boy.
2196 (Struct::TypeAttr): ditto.
2197 Handle nested classes.
2198 (TypeContainer::) Remove all the type visiting code, it is now
2199 replaced with the rootcontext.cs code
2201 * rootcontext.cs (GetClassBases): Added support for structs.
2203 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2205 * interface.cs, statement.cs, class.cs, parameter.cs,
2206 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2207 Drop use of TypeRefs, and use strings instead.
2209 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2213 * class.cs (Struct::Struct): set the SEALED flags after
2214 checking the modifiers.
2215 (TypeContainer::TypeAttr): new property, returns the
2216 TypeAttributes for a class.
2218 * cs-parser.jay (type_list): Oops, list production was creating a
2219 new list of base types.
2221 * rootcontext.cs (StdLib): New property.
2222 (GetInterfaceTypeByName): returns an interface by type name, and
2223 encapsulates error handling here.
2224 (GetInterfaces): simplified.
2225 (ResolveTree): Encapsulated all the tree resolution here.
2226 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2229 * driver.cs: Add support for --nostdlib, to avoid loading the
2231 (Main): Do not put tree resolution here.
2233 * rootcontext.cs: Beginning of the class resolution.
2235 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2237 * rootcontext.cs: Provide better error reporting.
2239 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2241 * rootcontext.cs (CreateInterface): Handle the case where there
2242 are no parent interfaces.
2244 (CloseTypes): Routine to flush types at the end.
2245 (CreateInterface): Track types.
2246 (GetInterfaces): Returns an array of Types from the list of
2249 * typemanager.c (AddUserType): Mechanism to track user types (puts
2250 the type on the global type hash, and allows us to close it at the
2253 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2255 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2256 RecordInterface instead.
2258 * cs-parser.jay: Updated to reflect changes above.
2260 * decl.cs (Definition): Keep track of the TypeBuilder type that
2261 represents this type here. Not sure we will use it in the long
2262 run, but wont hurt for now.
2264 * driver.cs: Smaller changes to accomodate the new code.
2266 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2269 * rootcontext.cs (CreateInterface): New method, used to create
2270 the System.TypeBuilder type for interfaces.
2271 (ResolveInterfaces): new entry point to resolve the interface
2273 (CodeGen): Property, used to keep track of the code generator.
2275 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2277 * cs-parser.jay: Add a second production for delegate_declaration
2280 (enum_body): Put an opt_comma here instead of putting it on
2281 enum_body or enum_member_declarations so we can handle trailing
2282 commas on enumeration members. Gets rid of a shift/reduce.
2284 (type_list): Need a COMMA in the middle.
2286 (indexer_declaration): Tell tokenizer to recognize get/set
2288 * Remove old targets.
2290 * Re-add the parser target.
2292 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2294 * cs-parser.jay: Add precendence rules for a number of operators
2295 ot reduce the number of shift/reduce conflicts in the grammar.
2297 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2299 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2302 Get rid of old crufty code.
2304 * rootcontext.cs: Use this to keep track of the parsed
2305 representation and the defined types available to the program.
2307 * gen-treedump.cs: adjust for new convention.
2309 * type.cs: Split out the type manager, and the assembly builder
2312 * typemanager.cs: the type manager will live here now.
2314 * cil-codegen.cs: And the code generator here.
2316 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2318 * makefile: Fixed up for easy making.
2320 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2322 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2325 (unary_expression): Expand pre_increment_expression and
2326 post_decrement_expression to reduce a shift/reduce.
2328 2001-07-11 Simon Cozens
2330 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2332 Improve allow_keyword_as_indent name.
2334 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2336 * Adjustments for Beta2.
2338 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2340 * decl.cs: Added `Define' abstract method.
2341 (InTransit): new property, used to catch recursive definitions.
2343 * interface.cs: Implement `Define'.
2345 * modifiers.cs: Map Modifiers.constants to
2346 System.Reflection.TypeAttribute flags.
2348 * class.cs: Keep track of types and user-defined types.
2349 (BuilderInit): New method for creating an assembly
2350 (ResolveType): New function to launch the resolution process, only
2351 used by interfaces for now.
2353 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2354 that are inserted into the name space.
2356 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2358 * ARGH. I have screwed up my tree so many times due to the use of
2359 rsync rather than using CVS. Going to fix this at once.
2361 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2364 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2366 * Experiment successful: Use System.Type rather that our own
2369 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2371 * cs-parser.jay: Removed nsAliases from here.
2373 Use new namespaces, handle `using XXX;'
2375 * namespace.cs: Reimplemented namespace handling, use a recursive
2376 definition of the class. Now we can keep track of using clauses
2377 and catch invalid using clauses.
2379 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2381 * gen-treedump.cs: Adapted for all the renaming.
2383 * expression.cs (Expression): this class now has a Type property
2384 which returns an expression Type.
2386 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2387 `Type', as this has a different meaning now in the base
2389 2001-05-22 Miguel de Icaza <miguel@ximian.com>
2391 * interface.cs, class.cs: Removed from all the sources the
2392 references to signature computation, as we can not do method
2393 signature computation during the parsing time, as we are not
2394 trying to solve at that point distinguishing:
2398 void a (NS.Blah x) {}
2401 Which depending on the context might be valid or not, as we do not
2402 know if Blah is the same thing as NS.Blah at that point.
2404 * Redid everything so the code uses TypeRefs now instead of
2405 Types. TypeRefs are just temporary type placeholders, that need
2406 to be resolved. They initially have a pointer to a string and the
2407 current scope in which they are used. This is used later by the
2408 compiler to resolve the reference to an actual Type.
2410 * DeclSpace is no longer a CIR.Type, and neither are
2411 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
2412 are all DeclSpaces, but no Types.
2414 * type.cs (TypeRefManager): This implements the TypeRef manager,
2415 which keeps track of all the types that need to be resolved after
2416 the parsing has finished.
2418 2001-05-13 Miguel de Icaza <miguel@ximian.com>
2420 * ARGH. We are going to have to store `foreach' as a class rather
2421 than resolving it, as we need to verify error 1579 after name
2422 resolution. *OR* we could keep a flag that says `This request to
2423 IEnumerator comes from a foreach statement' which we can then use
2424 to generate the error.
2426 2001-05-10 Miguel de Icaza <miguel@ximian.com>
2428 * class.cs (TypeContainer.AddMethod): we now add methods to the
2429 MethodGroup instead of the method hashtable.
2431 * expression.cs: Add MethodGroup abstraction, which gets us one
2432 step closer to the specification in the way we handle method
2435 * cs-parser.jay (primary_expression): qualified_identifier now
2436 tried to match up an identifier to a local variable reference or
2437 to a parameter reference.
2439 current_local_parameters is now a parser global variable that
2440 points to the current parameters for the block, used during name
2443 (property_declaration): Now creates an implicit `value' argument to
2446 2001-05-09 Miguel de Icaza <miguel@ximian.com>
2448 * parameter.cs: Do not use `param' arguments as part of the
2449 signature, per the spec.
2451 2001-05-08 Miguel de Icaza <miguel@ximian.com>
2453 * decl.cs: Base class for classes, structs and interfaces. This
2454 is the "Declaration Space"
2456 * cs-parser.jay: Use CheckDef for checking declaration errors
2457 instead of having one on each function.
2459 * class.cs: Factor out some code for handling error handling in
2460 accordance to the "Declarations" section in the "Basic Concepts"
2461 chapter in the ECMA C# spec.
2463 * interface.cs: Make all interface member classes derive from
2464 InterfaceMemberBase.
2466 2001-05-07 Miguel de Icaza <miguel@ximian.com>
2468 * Many things: all interfaces are parsed and generated in
2469 gen-treedump. Support for member variables, constructors,
2470 destructors, properties, constants is there.
2472 Beginning of the IL backend, but very little done, just there for
2475 2001-04-29 Miguel de Icaza <miguel@ximian.com>
2477 * cs-parser.jay: Fix labeled statement.
2479 * cs-tokenizer.cs (escape): Escape " and ' always.
2480 ref_line, ref_name: keep track of the line/filename as instructed
2481 by #line by the compiler.
2484 2001-04-27 Miguel de Icaza <miguel@ximian.com>
2486 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
2487 to match the values in System.CodeDOM.
2489 Divid renamed to Divide.
2491 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
2493 (Statements.set): remove.
2495 * System.CodeDOM/CodeCatchClause.cs: always have a valid
2498 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
2499 falseStatements always have valid values.
2501 * cs-parser.jay: Use System.CodeDOM now.