1 2001-10-29 Miguel de Icaza <miguel@ximian.com>
3 * cs-parser.jay: Add extra production for the second form of array
6 * expression.cs (ArrayCreation): Update to reflect the above
9 * Small changes to prepare for Array initialization.
11 2001-10-28 Miguel de Icaza <miguel@ximian.com>
13 * typemanager.cs (ImplementsInterface): interface might be null;
14 Deal with this problem;
16 Also, we do store negative hits on the cache (null values), so use
17 this instead of calling t.GetInterfaces on the type everytime.
19 2001-10-28 Ravi Pratap <ravi@ximian.com>
21 * typemanager.cs (IsBuiltinType): New method to help determine the same.
23 * expression.cs (New::DoResolve): Get rid of array creation code and instead
24 split functionality out into different classes.
26 (New::FormArrayType): Move into NewBuiltinArray.
28 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
31 (NewBuiltinArray): New class to handle creation of built-in arrays.
33 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
34 account creation of one-dimensional arrays.
36 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
38 (NewUserdefinedArray::DoResolve): Implement.
40 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
42 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
43 we maintain inside the TypeManager. This is necessary to perform lookups on the
46 (LookupType): Update to perform GetType on the module builders too.
48 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
50 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
52 2001-10-23 Ravi Pratap <ravi@ximian.com>
54 * expression.cs (New::DoResolve): Implement guts of array creation.
56 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
58 2001-10-27 Miguel de Icaza <miguel@ximian.com>
60 * expression.cs: Fix bug I introduced lsat night that broke
63 (Expression.Resolve): Report a 246 error (can not resolve name)
64 if we find a SimpleName in the stream.
66 (Expression.ResolveLValue): Ditto.
68 (Expression.ResolveWithSimpleName): This function is a variant of
69 ResolveName, this one allows SimpleNames to be returned without a
70 warning. The only consumer of SimpleNames is MemberAccess
72 2001-10-26 Miguel de Icaza <miguel@ximian.com>
74 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
75 might arrive here. I have my doubts that this is correct.
77 * statement.cs (Lock): Implement lock statement.
79 * cs-parser.jay: Small fixes to support `lock' and `using'
81 * cs-tokenizer.cs: Remove extra space
83 * driver.cs: New flag --checked, allows to turn on integer math
86 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
87 Threading.Monitor.Exit
89 2001-10-23 Miguel de Icaza <miguel@ximian.com>
91 * expression.cs (IndexerAccess::DoResolveLValue): Set the
92 Expression Class to be IndexerAccess.
94 Notice that Indexer::DoResolve sets the eclass to Value.
96 2001-10-22 Miguel de Icaza <miguel@ximian.com>
98 * class.cs (TypeContainer::Emit): Emit code for indexers.
100 * assign.cs (IAssignMethod): New interface implemented by Indexers
101 and Properties for handling assignment.
103 (Assign::Emit): Simplify and reuse code.
105 * expression.cs (IndexerAccess, PropertyExpr): Implement
106 IAssignMethod, clean up old code.
108 2001-10-22 Ravi Pratap <ravi@ximian.com>
110 * typemanager.cs (ImplementsInterface): New method to determine if a type
111 implements a given interface. Provides a nice cache too.
113 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
116 (ConvertReferenceExplicit): Ditto.
118 * delegate.cs (Delegate::Populate): Update to define the parameters on the
119 various methods, with correct names etc.
121 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
122 Operator.UnaryNegation.
124 * cs-parser.jay (operator_declarator): Be a little clever in the case where
125 we have a unary plus or minus operator.
127 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
130 * everywhere : update accordingly.
132 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
135 * class.cs (Method::Define): For the case where we are implementing a method
136 inherited from an interface, we need to set the MethodAttributes.Final flag too.
137 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
139 2001-10-21 Ravi Pratap <ravi@ximian.com>
141 * interface.cs (FindMembers): Implement to work around S.R.E
144 * typemanager.cs (IsInterfaceType): Implement.
146 (FindMembers): Update to handle interface types too.
148 * expression.cs (ImplicitReferenceConversion): Re-write bits which
149 use IsAssignableFrom as that is not correct - it doesn't work.
151 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
152 and accordingly override EmitStatement.
154 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
155 using the correct logic :-)
157 2001-10-19 Ravi Pratap <ravi@ximian.com>
159 * ../errors/cs-11.cs : Add to demonstrate error -11
161 2001-10-17 Miguel de Icaza <miguel@ximian.com>
163 * assign.cs (Assign::Resolve): Resolve right hand side first, and
164 then pass this as a hint to ResolveLValue.
166 * expression.cs (FieldExpr): Add Location information
168 (FieldExpr::LValueResolve): Report assignment to readonly
171 (Expression::ExprClassFromMemberInfo): Pass location information.
173 (Expression::ResolveLValue): Add new method that resolves an
176 (Expression::DoResolveLValue): Default invocation calls
179 (Indexers): New class used to keep track of indexers in a given
182 (IStackStore): Renamed from LValue, as it did not really describe
183 what this did. Also ResolveLValue is gone from this interface and
184 now is part of Expression.
186 (ElementAccess): Depending on the element access type
188 * typemanager.cs: Add `indexer_name_type' as a Core type
189 (System.Runtime.CompilerServices.IndexerNameAttribute)
191 * statement.cs (Goto): Take a location.
193 2001-10-18 Ravi Pratap <ravi@ximian.com>
195 * delegate.cs (Delegate::VerifyDelegate): New method to verify
196 if two delegates are compatible.
198 (NewDelegate::DoResolve): Update to take care of the case when
199 we instantiate a delegate from another delegate.
201 * typemanager.cs (FindMembers): Don't even try to look up members
202 of Delegate types for now.
204 2001-10-18 Ravi Pratap <ravi@ximian.com>
206 * delegate.cs (NewDelegate): New class to take care of delegate
209 * expression.cs (New): Split the delegate related code out into
210 the NewDelegate class.
212 * delegate.cs (DelegateInvocation): New class to handle delegate
215 * expression.cs (Invocation): Split out delegate related code into
216 the DelegateInvocation class.
218 2001-10-17 Ravi Pratap <ravi@ximian.com>
220 * expression.cs (New::DoResolve): Implement delegate creation fully
221 and according to the spec.
223 (New::DoEmit): Update to handle delegates differently.
225 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
226 because of which we were printing out arguments in reverse order !
228 * delegate.cs (VerifyMethod): Implement to check if the given method
229 matches the delegate.
231 (FullDelegateDesc): Implement.
233 (VerifyApplicability): Implement.
235 * expression.cs (Invocation::DoResolve): Update to accordingly handle
236 delegate invocations too.
238 (Invocation::Emit): Ditto.
240 * ../errors/cs1593.cs : Added.
242 * ../errors/cs1594.cs : Added.
244 * delegate.cs (InstanceExpression, TargetMethod): New properties.
246 2001-10-16 Ravi Pratap <ravi@ximian.com>
248 * typemanager.cs (intptr_type): Core type for System.IntPtr
250 (InitCoreTypes): Update for the same.
252 (iasyncresult_type, asynccallback_type): Ditto.
254 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
257 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
260 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
261 the builders for the 4 members of a delegate type :-)
263 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
266 * expression.cs (New::DoResolve): Implement guts for delegate creation.
268 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
270 2001-10-15 Miguel de Icaza <miguel@ximian.com>
272 * statement.cs (Break::Emit): Implement.
273 (Continue::Emit): Implement.
275 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
276 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
277 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
278 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
281 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
282 properties that track the label for the current loop (begin of the
283 loop and end of the loop).
285 2001-10-15 Ravi Pratap <ravi@ximian.com>
287 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
288 use of emitting anything at all.
290 * class.cs, rootcontext.cs : Get rid of calls to the same.
292 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
294 (Populate): Define the constructor correctly and set the implementation
297 * typemanager.cs (delegate_types): New hashtable to hold delegates that
300 (AddDelegateType): Implement.
302 (IsDelegateType): Implement helper method.
304 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
306 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
307 and accordingly handle it.
309 * delegate.cs (Populate): Take TypeContainer argument.
310 Implement bits to define the Invoke method. However, I still haven't figured out
311 how to take care of the native int bit :-(
313 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
314 Qualify the name of the delegate, not its return type !
316 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
319 (StandardConversionExists): Checking for array types turns out to be recursive.
321 (ConvertReferenceExplicit): Implement array conversion.
323 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
325 2001-10-12 Ravi Pratap <ravi@ximian.com>
327 * cs-parser.jay (delegate_declaration): Store the fully qualified
328 name as it is a type declaration.
330 * delegate.cs (ReturnType, Name): Rename members to these. Make them
333 (DefineDelegate): Renamed from Define. Does the same thing essentially,
334 as TypeContainer::DefineType.
336 (Populate): Method in which all the definition of the various methods (Invoke)
339 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
342 (CloseDelegate): Finally creates the delegate.
344 * class.cs (TypeContainer::DefineType): Update to define delegates.
345 (Populate, Emit and CloseType): Do the same thing here too.
347 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
348 delegates in all these operations.
350 2001-10-14 Miguel de Icaza <miguel@ximian.com>
352 * expression.cs: LocalTemporary: a new expression used to
353 reference a temporary that has been created.
355 * assign.cs: Handle PropertyAccess back here, so that we can
356 provide the proper semantic access to properties.
358 * expression.cs (Expression::ConvertReferenceExplicit): Implement
359 a few more explicit conversions.
361 * modifiers.cs: `NEW' modifier maps to HideBySig.
363 * expression.cs (PropertyExpr): Make this into an
364 ExpressionStatement, and support the EmitStatement code path.
366 Perform get/set error checking, clean up the interface.
368 * assign.cs: recognize PropertyExprs as targets, and if so, turn
369 them into toplevel access objects.
371 2001-10-12 Miguel de Icaza <miguel@ximian.com>
373 * expression.cs: PropertyExpr::PropertyExpr: use work around the
376 * typemanager.cs: Keep track here of our PropertyBuilders again to
377 work around lameness in SRE.
379 2001-10-11 Miguel de Icaza <miguel@ximian.com>
381 * expression.cs (LValue::LValueResolve): New method in the
382 interface, used to perform a second resolution pass for LValues.
384 (This::DoResolve): Catch the use of this in static methods.
386 (This::LValueResolve): Implement.
388 (This::Store): Remove warning, assigning to `this' in structures
391 (Invocation::Emit): Deal with invocation of
392 methods on value types. We need to pass the address to structure
393 methods rather than the object itself. (The equivalent code to
394 emit "this" for structures leaves the entire structure on the
395 stack instead of a pointer to it).
397 (ParameterReference::DoResolve): Compute the real index for the
398 argument based on whether the method takes or not a `this' pointer
399 (ie, the method is static).
401 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
402 value types returned from functions when we need to invoke a
403 method on the sturcture.
406 2001-10-11 Ravi Pratap <ravi@ximian.com>
408 * class.cs (TypeContainer::DefineType): Method to actually do the business of
409 defining the type in the Modulebuilder or Typebuilder. This is to take
410 care of nested types which need to be defined on the TypeBuilder using
413 (TypeContainer::GetClassBases): Implement. Essentially the code from the
414 methods in RootContext, only ported to be part of TypeContainer.
416 (TypeContainer::GetInterfaceOrClass): Ditto.
418 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
420 * interface.cs (Interface::DefineInterface): New method. Does exactly
421 what RootContext.CreateInterface did earlier, only it takes care of nested types
424 (Interface::GetInterfaces): Move from RootContext here and port.
426 (Interface::GetInterfaceByName): Same here.
428 * rootcontext.cs (ResolveTree): Re-write.
430 (PopulateTypes): Re-write.
432 * class.cs (TypeContainer::Populate): Populate nested types too.
433 (TypeContainer::Emit): Emit nested members too.
435 * typemanager.cs (AddUserType): Do not make use of the FullName property,
436 instead just use the name argument passed in as it is already fully
439 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
440 to TypeContainer mapping to see if a type is user-defined.
442 * class.cs (TypeContainer::CloseType): Implement.
444 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
445 the default constructor.
447 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
450 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
452 * interface.cs (CloseType): Create the type here.
454 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
457 Remove all the methods which are now in TypeContainer.
459 2001-10-10 Ravi Pratap <ravi@ximian.com>
461 * delegate.cs (Define): Re-write bits to define the delegate
464 2001-10-10 Miguel de Icaza <miguel@ximian.com>
466 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
468 * expression.cs (ImplicitReferenceConversion): handle null as well
469 as a source to convert to any reference type.
471 * statement.cs (Return): Perform any implicit conversions to
472 expected return type.
474 Validate use of return statement.
476 * codegen.cs (EmitContext): Pass the expected return type here.
478 * class.cs (Method, Constructor, Property): Pass expected return
481 2001-10-09 Miguel de Icaza <miguel@ximian.com>
483 * expression.cs: Make DoResolve take an EmitContext instead of a
486 Replaced `l' and `location' for `loc', for consistency.
488 (Error, Warning): Remove unneeded Tc argument.
490 * assign.cs, literal.cs, constant.cs: Update to new calling
493 * codegen.cs: EmitContext now contains a flag indicating whether
494 code is being generated in a static method or not.
496 * cs-parser.jay: DecomposeQI, new function that replaces the old
497 QualifiedIdentifier. Now we always decompose the assembled
498 strings from qualified_identifier productions into a group of
501 2001-10-08 Miguel de Icaza <miguel@ximian.com>
503 * rootcontext.cs: Deal with field-less struct types correctly now
504 by passing the size option to Define Type.
506 * class.cs: Removed hack that created one static field.
508 2001-10-07 Miguel de Icaza <miguel@ximian.com>
510 * statement.cs: Moved most of the code generation here.
512 2001-10-09 Ravi Pratap <ravi@ximian.com>
514 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
517 (ElementAccess): Remove useless bits for now - keep checks as the spec
520 2001-10-08 Ravi Pratap <ravi@ximian.com>
522 * expression.cs (ElementAccess::DoResolve): Remove my crap code
523 and start performing checks according to the spec.
525 2001-10-07 Ravi Pratap <ravi@ximian.com>
527 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
528 rank_specifiers instead.
530 (rank_specifiers): Change the order in which the rank specifiers are stored
532 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
534 * expression.cs (ElementAccess): Implement the LValue interface too.
536 2001-10-06 Ravi Pratap <ravi@ximian.com>
538 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
539 except that user defined conversions are not included.
541 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
542 perform the conversion of the return type, if necessary.
544 (New::DoResolve): Check whether we are creating an array or an object
545 and accordingly do the needful.
547 (New::Emit): Same here.
549 (New::DoResolve): Implement guts of array creation.
551 (New::FormLookupType): Helper function.
553 2001-10-07 Miguel de Icaza <miguel@ximian.com>
555 * codegen.cs: Removed most of the code generation here, and move the
556 corresponding code generation bits to the statement classes.
558 Added support for try/catch/finalize and throw.
560 * cs-parser.jay: Added support for try/catch/finalize.
562 * class.cs: Catch static methods having the flags override,
565 * expression.cs (UserCast): This user cast was not really doing
566 what it was supposed to do. Which is to be born in fully resolved
567 state. Parts of the resolution were being performed at Emit time!
571 2001-10-05 Miguel de Icaza <miguel@ximian.com>
573 * expression.cs: Implicity convert the result from UserCast.
575 2001-10-05 Ravi Pratap <ravi@ximian.com>
577 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
578 prevented it from working correctly.
580 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
581 merely ConvertImplicit.
583 2001-10-05 Miguel de Icaza <miguel@ximian.com>
585 * typemanager.cs: Make the LookupTypeContainer function static,
586 and not per-instance.
588 * class.cs: Make static FindMembers (the one that takes a Type
591 * codegen.cs: Add EmitForeach here.
593 * cs-parser.jay: Make foreach a toplevel object instead of the
594 inline expansion, as we need to perform semantic analysis on it.
596 2001-10-05 Ravi Pratap <ravi@ximian.com>
598 * expression.cs (Expression::ImplicitUserConversion): Rename to
599 UserDefinedConversion.
601 (Expression::UserDefinedConversion): Take an extra argument specifying
602 whether we look for explicit user conversions too.
604 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
606 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
608 (ExplicitUserConversion): Make it a call to UserDefinedConversion
609 with the appropriate arguments.
611 * cs-parser.jay (cast_expression): Record location too.
613 * expression.cs (Cast): Record location info.
615 (Expression::ConvertExplicit): Take location argument.
617 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
618 to determine if we are doing explicit conversions.
620 (UserCast::Emit): Update accordingly.
622 (Expression::ConvertExplicit): Report an error if everything fails.
624 * ../errors/cs0030.cs : Add.
626 2001-10-04 Miguel de Icaza <miguel@ximian.com>
628 * modifiers.cs: If the ABSTRACT keyword is present, also set the
629 virtual and newslot bits.
631 * class.cs (TypeContainer::RegisterRequiredImplementations):
632 Record methods we need.
634 (TypeContainer::MakeKey): Helper function to make keys for
635 MethodBases, since the Methodbase key is useless.
637 (TypeContainer::Populate): Call RegisterRequiredImplementations
638 before defining the methods.
640 Create a mapping for method_builders_to_methods ahead of time
641 instead of inside a tight loop.
643 (::RequireMethods): Accept an object as the data to set into the
644 hashtable so we can report interface vs abstract method mismatch.
646 2001-10-03 Miguel de Icaza <miguel@ximian.com>
648 * report.cs: Make all of it static.
650 * rootcontext.cs: Drop object_type and value_type computations, as
651 we have those in the TypeManager anyways.
653 Drop report instance variable too, now it is a global.
655 * driver.cs: Use try/catch on command line handling.
657 Add --probe option to debug the error reporting system with a test
660 * report.cs: Add support for exiting program when a probe
661 condition is reached.
663 2001-10-03 Ravi Pratap <ravi@ximian.com>
665 * expression.cs (Binary::DoNumericPromotions): Fix the case when
666 we do a forcible conversion regardless of type, to check if
667 ForceConversion returns a null.
669 (Binary::error19): Use location to report error.
671 (Unary::error23): Use location here too.
673 * ../errors/cs0019.cs : Check in.
675 * ../errors/cs0023.cs : Check in.
677 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
678 case of a non-null MethodInfo object with a length of 0 !
680 (Binary::ResolveOperator): Flag error if overload resolution fails to find
681 an applicable member - according to the spec :-)
682 Also fix logic to find members in base types.
684 (Unary::ResolveOperator): Same here.
686 (Unary::report23): Change name to error23 and make first argument a TypeContainer
687 as I was getting thoroughly confused between this and error19 :-)
689 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
690 (::FindMostEncompassedType): Implement.
691 (::FindMostEncompassingType): Implement.
692 (::StandardConversionExists): Implement.
694 (UserImplicitCast): Re-vamp. We now need info about most specific
695 source and target types so that we can do the necessary conversions.
697 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
698 mathematical union with no duplicates.
700 2001-10-03 Miguel de Icaza <miguel@ximian.com>
702 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
703 in order from base classes to child classes, so that we can in
704 child classes look up in our parent for method names and
705 attributes (required for handling abstract, virtual, new, override
706 constructs: we need to instrospect our base class, and if we dont
707 populate the classes in order, the introspection might be
708 incorrect. For example, a method could query its parent before
709 the parent has any methods and would determine that the parent has
710 no abstract methods (while it could have had them)).
712 (RootContext::CreateType): Record the order in which we define the
715 2001-10-02 Miguel de Icaza <miguel@ximian.com>
717 * class.cs (TypeContainer::Populate): Also method definitions can
718 fail now, keep track of this.
720 (TypeContainer::FindMembers): Implement support for
721 DeclaredOnly/noDeclaredOnly flag.
723 (Constructor::Emit) Return the ConstructorBuilder.
725 (Method::Emit) Return the MethodBuilder.
726 Check for abstract or virtual methods to be public.
728 * rootcontext.cs (RootContext::CreateType): Register all the
729 abstract methods required for the class to be complete and the
730 interface methods that must be implemented.
732 * cs-parser.jay: Report error 501 (method requires body if it is
733 not marked abstract or extern).
735 * expression.cs (TypeOf::Emit): Implement.
737 * typemanager.cs: runtime_handle_type, new global type.
739 * class.cs (Property::Emit): Generate code for properties.
741 2001-10-02 Ravi Pratap <ravi@ximian.com>
743 * expression.cs (Unary::ResolveOperator): Find operators on base type
744 too - we now conform exactly to the spec.
746 (Binary::ResolveOperator): Same here.
748 * class.cs (Operator::Define): Fix minor quirk in the tests.
750 * ../errors/cs0215.cs : Added.
752 * ../errors/cs0556.cs : Added.
754 * ../errors/cs0555.cs : Added.
756 2001-10-01 Miguel de Icaza <miguel@ximian.com>
758 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
759 single integer which is really efficient
761 2001-10-01 Ravi Pratap <ravi@ximian.com>
763 * expression.cs (Expression::ImplicitUserConversion): Use location
764 even in the case when we are examining True operators.
766 * class.cs (Operator::Define): Perform extensive checks to conform
767 with the rules for operator overloading in the spec.
769 * expression.cs (Expression::ImplicitReferenceConversion): Implement
770 some of the other conversions mentioned in the spec.
772 * typemanager.cs (array_type): New static member for the System.Array built-in
775 (cloneable_interface): For System.ICloneable interface.
777 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
778 we start resolving the tree and populating types.
780 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
782 2001-10-01 Miguel de Icaza <miguel@ximian.com>
784 * expression.cs (Expression::ExprClassFromMemberInfo,
785 Expression::Literalize): Create literal expressions from
786 FieldInfos which are literals.
788 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
789 type casts, because they were wrong. The test suite in tests
792 (ImplicitNumericConversion): ushort to ulong requires a widening
795 Int32 constant to long requires widening cast as well.
797 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
798 for integers because the type on the stack is not i4.
800 2001-09-30 Miguel de Icaza <miguel@ximian.com>
802 * expression.cs (report118): require location argument.
804 * parameter.cs: Do not dereference potential null value.
806 * class.cs: Catch methods that lack the `new' keyword when
807 overriding a name. Report warnings when `new' is used without
808 anything being there to override.
810 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
812 * class.cs: Only add constructor to hashtable if it is non-null
813 (as now constructors can fail on define).
815 (TypeManager, Class, Struct): Take location arguments.
817 Catch field instance initialization in structs as errors.
819 accepting_filter: a new filter for FindMembers that is static so
820 that we dont create an instance per invocation.
822 (Constructor::Define): Catch errors where a struct constructor is
825 * cs-parser.jay: Pass location information for various new
828 * delegate.cs (Delegate): take a location argument.
830 * driver.cs: Do not call EmitCode if there were problesm in the
831 Definition of the types, as many Builders wont be there.
833 * decl.cs (Decl::Decl): Require a location argument.
835 * cs-tokenizer.cs: Handle properly hex constants that can not fit
836 into integers, and find the most appropiate integer for it.
838 * literal.cs: Implement ULongLiteral.
840 * rootcontext.cs: Provide better information about the location of
841 failure when CreateType fails.
843 2001-09-29 Miguel de Icaza <miguel@ximian.com>
845 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
848 * expression.cs (Binary::CheckShiftArguments): Add missing type
850 (Binary::ResolveOperator): Add type to the logical and and logical
851 or, Bitwise And/Or and Exclusive Or code paths, it was missing
854 (Binary::DoNumericPromotions): In the case where either argument
855 is ulong (and most signed types combined with ulong cause an
856 error) perform implicit integer constant conversions as well.
858 2001-09-28 Miguel de Icaza <miguel@ximian.com>
860 * expression.cs (UserImplicitCast): Method should always be
862 (Invocation::BetterConversion): Simplified test for IntLiteral.
864 (Expression::ImplicitNumericConversion): Split this routine out.
865 Put the code that performs implicit constant integer conversions
868 (Expression::Resolve): Become a wrapper around DoResolve so we can
869 check eclass and type being set after resolve.
871 (Invocation::Badness): Remove this dead function
873 (Binary::ResolveOperator): Do not compute the expensive argumnets
874 unless we have a union for it.
876 (Probe::Emit): Is needs to do an isinst and then
877 compare against null.
879 (::CanConvert): Added Location argument. If the Location argument
880 is null (Location.Null), then we do not report errors. This is
881 used by the `probe' mechanism of the Explicit conversion. We do
882 not want to generate an error for something that the user
883 explicitly requested to be casted. But the pipeline for an
884 explicit cast first tests for potential implicit casts.
886 So for now, if the Location is null, it means `Probe only' to
887 avoid adding another argument. Might have to revise this
890 (ClassCast): New class used to type cast objects into arbitrary
891 classes (used in Explicit Reference Conversions).
893 Implement `as' as well.
895 Reverted all the patches from Ravi below: they were broken:
897 * The use of `level' as a mechanism to stop recursive
898 invocations is wrong. That was there just to catch the
899 bug with a strack trace but not as a way of addressing
902 To fix the problem we have to *understand* what is going
903 on and the interactions and come up with a plan, not
904 just get things going.
906 * The use of the type conversion cache that I proposed
907 last night had an open topic: How does this work across
908 protection domains. A user defined conversion might not
909 be public in the location where we are applying the
910 conversion, a different conversion might be selected
911 (ie, private A->B (better) but public B->A (worse),
912 inside A, A->B applies, but outside it, B->A will
915 * On top of that (ie, even if the above is solved),
916 conversions in a cache need to be abstract. Ie, `To
917 convert from an Int to a Short use an OpcodeCast', not
918 `To convert from an Int to a Short use the OpcodeCast on
919 the variable 5' (which is what this patch was doing).
921 2001-09-28 Ravi Pratap <ravi@ximian.com>
923 * expression.cs (Invocation::ConversionExists): Re-write to use
926 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
927 cache all conversions done, not just user-defined ones.
929 (Invocation::BetterConversion): The real culprit. Use ConversionExists
930 to determine if a conversion exists instead of acutually trying to
931 perform the conversion. It's faster too.
933 (Expression::ConvertExplicit): Modify to use ConversionExists to check
934 and only then attempt the implicit conversion.
936 2001-09-28 Ravi Pratap <ravi@ximian.com>
938 * expression.cs (ConvertImplicit): Use a cache for conversions
939 already found. Check level of recursion and bail out if necessary.
941 2001-09-28 Miguel de Icaza <miguel@ximian.com>
943 * typemanager.cs (string_concat_string_string, string_concat_object_object):
944 Export standard methods that we expect for string operations.
946 * statement.cs (Block::UsageWarning): Track usage of variables and
947 report the errors for not used variables.
949 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
952 2001-09-27 Miguel de Icaza <miguel@ximian.com>
954 * codegen.cs: remove unnneded code
956 * expression.cs: Removed BuiltinTypeAccess class
958 Fix the order in which implicit conversions are
961 The previous fixed dropped support for boxed conversions (adding a
962 test to the test suite now)
964 (UserImplicitCast::CanConvert): Remove test for source being null,
965 that code is broken. We should not feed a null to begin with, if
966 we do, then we should track the bug where the problem originates
967 and not try to cover it up here.
969 Return a resolved expression of type UserImplicitCast on success
970 rather than true/false. Ravi: this is what I was talking about,
971 the pattern is to use a static method as a "constructor" for
974 Also, do not create arguments until the very last minute,
975 otherwise we always create the arguments even for lookups that
976 will never be performed.
978 (UserImplicitCast::Resolve): Eliminate, objects of type
979 UserImplicitCast are born in a fully resolved state.
981 * typemanager.cs (InitCoreTypes): Init also value_type
984 * expression.cs (Cast::Resolve): First resolve the child expression.
986 (LValue): Add new method AddressOf to be used by
989 Change the argument of Store to take an EmitContext instead of an
990 ILGenerator, because things like FieldExpr need to be able to call
991 their children expression to generate the instance code.
993 (Expression::Error, Expression::Warning): Sugar functions for
996 (Expression::MemberLookup): Accept a TypeContainer instead of a
997 Report as the first argument.
999 (Expression::ResolvePrimary): Killed. I still want to improve
1000 this as currently the code is just not right.
1002 (Expression::ResolveMemberAccess): Simplify, but it is still
1005 (Unary::Resolve): Catch errors in AddressOf operators.
1007 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
1008 index to a byte for the short-version, or the compiler will choose
1009 the wrong Emit call, which generates the wrong data.
1011 (ParameterReference::Emit, ::Store): same.
1013 (FieldExpr::AddressOf): Implement.
1015 * typemanager.cs: TypeManager: made public variable instead of
1018 * driver.cs: document --fatal.
1020 * report.cs (ErrorMessage, WarningMessage): new names for the old
1021 Error and Warning classes.
1023 * cs-parser.jay (member_access): Turn built-in access to types
1024 into a normal simplename
1026 2001-09-27 Ravi Pratap <ravi@ximian.com>
1028 * expression.cs (Invocation::BetterConversion): Fix to cope
1029 with q being null, since this was introducing a bug.
1031 * expression.cs (ConvertImplicit): Do built-in conversions first.
1033 2001-09-27 Ravi Pratap <ravi@ximian.com>
1035 * expression.cs (UserImplicitCast::Resolve): Fix bug.
1037 2001-09-27 Ravi Pratap <ravi@ximian.com>
1039 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
1040 I had introduced long ago (what's new ?).
1042 * expression.cs (UserImplicitCast::CanConvert): Static method to do
1043 the work of all the checking.
1044 (ConvertImplicit): Call CanConvert and only then create object if necessary.
1045 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
1047 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
1048 that is the right way.
1050 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
1051 overloading resolution. Use everywhere instead of cutting and pasting code.
1053 (Binary::ResolveOperator): Use MakeUnionSet.
1055 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
1056 we have to convert to bool types. Not complete yet.
1058 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1060 * typemanager.cs (TypeManager::CSharpName): support ushort.
1062 * expression.cs (Expression::TryImplicitIntConversion): Attempts
1063 to provide an expression that performsn an implicit constant int
1064 conversion (section 6.1.6).
1065 (Expression::ConvertImplicitRequired): Reworked to include
1066 implicit constant expression conversions.
1068 (Expression::ConvertNumericExplicit): Finished.
1070 (Invocation::Emit): If InstanceExpression is null, then it means
1071 that we perform a call on this.
1073 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1075 * expression.cs (Unary::Emit): Remove some dead code.
1076 (Probe): Implement Resolve and Emit for `is'.
1077 (Expression::ConvertImplicitRequired): Attempt to do constant
1078 expression conversions here. Maybe should be moved to
1079 ConvertImplicit, but I am not sure.
1080 (Expression::ImplicitLongConstantConversionPossible,
1081 Expression::ImplicitIntConstantConversionPossible): New functions
1082 that tell whether is it possible to apply an implicit constant
1083 expression conversion.
1085 (ConvertNumericExplicit): Started work on explicit numeric
1088 * cs-parser.jay: Update operator constants.
1090 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
1091 (Parameters::GetSignature): Hook up VerifyArgs here.
1092 (Parameters::VerifyArgs): Verifies that no two arguments have the
1095 * class.cs (Operator): Update the operator names to reflect the
1096 ones that the spec expects (as we are just stringizing the
1099 * expression.cs (Unary::ResolveOperator): Fix bug: Use
1100 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
1101 previous usage did only work for our methods.
1102 (Expression::ConvertImplicit): Handle decimal implicit numeric
1103 conversions as well.
1104 (Expression::InternalTypeConstructor): Used to invoke constructors
1105 on internal types for default promotions.
1107 (Unary::Emit): Implement special handling for the pre/post
1108 increment/decrement for overloaded operators, as they need to have
1109 the same semantics as the other operators.
1111 (Binary::ResolveOperator): ditto.
1112 (Invocation::ConversionExists): ditto.
1113 (UserImplicitCast::Resolve): ditto.
1115 2001-09-26 Ravi Pratap <ravi@ximian.com>
1117 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
1118 operator, return after emitting body. Regression tests pass again !
1120 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
1121 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
1122 (Invocation::OverloadResolve): Ditto.
1123 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
1125 * everywhere : update calls to the above methods accordingly.
1127 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1129 * assign.cs (Assign): Make it inherit from ExpressionStatement.
1131 * expression.cs (ExpressionStatement): New base class used for
1132 expressions that can appear in statements, so that we can provide
1133 an alternate path to generate expression that do not leave a value
1136 (Expression::Emit, and all the derivatives): We no longer return
1137 whether a value is left on the stack or not. Every expression
1138 after being emitted leaves a single value on the stack.
1140 * codegen.cs (EmitContext::EmitStatementExpression): Use the
1141 facilties of ExpressionStatement if possible.
1143 * cs-parser.jay: Update statement_expression.
1145 2001-09-25 Miguel de Icaza <miguel@ximian.com>
1147 * driver.cs: Change the wording of message
1149 2001-09-25 Ravi Pratap <ravi@ximian.com>
1151 * expression.cs (Binary::ResolveOperator): Had forgottten to set
1152 the type of the expression to the return type of the method if
1153 we have an overloaded operator match ! The regression tests pass again !
1154 (Unary::ResolveOperator): Ditto.
1156 * expression.cs (Invocation::ConversionExists): Correct the member lookup
1157 to find "op_Implicit", not "implicit" ;-)
1158 (UserImplicitCast): New class to take care of user-defined implicit conversions.
1159 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1161 * everywhere : Correct calls to the above accordingly.
1163 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1164 (ConvertImplicit): Do user-defined conversion if it exists.
1166 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1168 * assign.cs: track location.
1169 (Resolve): Use implicit conversions on assignment.
1171 * literal.cs: Oops. Not good, Emit of short access values should
1172 pass (Bytes) or the wrong argument will be selected.
1174 * expression.cs (Unary::Emit): Emit code for -expr.
1176 (Unary::ResolveOperator): Handle `Substract' for non-constants
1177 (substract from zero from the non-constants).
1178 Deal with Doubles as well.
1180 (Expression::ConvertImplicitRequired): New routine that reports an
1181 error if no implicit conversion exists.
1183 (Invocation::OverloadResolve): Store the converted implicit
1184 expressions if we make them
1186 2001-09-24 Ravi Pratap <ravi@ximian.com>
1188 * class.cs (ConstructorInitializer): Take a Location argument.
1189 (ConstructorBaseInitializer): Same here.
1190 (ConstructorThisInitializer): Same here.
1192 * cs-parser.jay : Update all calls accordingly.
1194 * expression.cs (Unary, Binary, New): Take location argument.
1195 Update accordingly everywhere.
1197 * cs-parser.jay : Update all calls to the above to take a location
1202 2001-09-24 Ravi Pratap <ravi@ximian.com>
1204 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1205 (Invocation::BetterConversion): Same here
1206 (Invocation::ConversionExists): Ditto.
1208 (Invocation::ConversionExists): Implement.
1210 2001-09-22 Ravi Pratap <ravi@ximian.com>
1212 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1213 Also take an additional TypeContainer argument.
1215 * All over : Pass in TypeContainer as argument to OverloadResolve.
1217 * typemanager.cs (CSharpName): Update to check for the string type and return
1220 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1223 2001-09-21 Ravi Pratap <ravi@ximian.com>
1225 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1226 (Invocation::BetterFunction): Implement.
1227 (Invocation::BetterConversion): Implement.
1228 (Invocation::ConversionExists): Skeleton, no implementation yet.
1230 Okay, things work fine !
1232 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1234 * typemanager.cs: declare and load enum_type, delegate_type and
1237 * expression.cs (Expression::Emit): Now emit returns a value that
1238 tells whether a value is left on the stack or not. This strategy
1239 might be reveted tomorrow with a mechanism that would address
1240 multiple assignments.
1241 (Expression::report118): Utility routine to report mismatches on
1244 (Unary::Report23): Report impossible type/operator combination
1247 (Unary::IsIncrementableNumber): Whether the type can be
1248 incremented or decremented with add.
1249 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1251 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1253 (Invocation::Emit): Deal with new Emit convetion.
1255 * All Expression derivatives: Updated their Emit method to return
1256 whether they leave values on the stack or not.
1258 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1259 stack for expressions that are statements.
1261 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1263 * expression.cs (LValue): New interface. Must be implemented by
1265 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1268 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1269 interface for generating code, simplifies the code.
1271 2001-09-20 Ravi Pratap <ravi@ximian.com>
1273 * expression.cs (everywhere): Comment out return statements in ::Resolve
1274 methods to avoid the warnings.
1276 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1278 * driver.cs (parse): Report error 2001 if we can not open the
1281 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1284 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1287 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1288 otherwise nested blocks end up with the same index.
1290 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1292 * expression.cs: Instead of having FIXMEs in the Resolve
1293 functions, throw exceptions so it is obvious that we are facing a
1296 * cs-parser.jay (invocation_expression): Pass Location information.
1298 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1299 Use a basename for those routines because .NET does not like paths
1302 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1305 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1307 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1308 are loading the correct data types (throws an exception if not).
1309 (TypeManager::InitCoreTypes): Use CoreLookupType
1311 * expression.cs (Unary::ResolveOperator): return the child
1312 expression for expressions which are just +expr.
1313 (Unary::ResolveOperator): Return negative literals for -LITERAL
1314 expressions (otherwise they are Unary {Literal}).
1315 (Invocation::Badness): Take into account `Implicit constant
1316 expression conversions'.
1318 * literal.cs (LongLiteral): Implement long literal class.
1319 (IntLiteral): export the `Value' of the intliteral.
1321 2001-09-19 Ravi Pratap <ravi@ximian.com>
1323 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1325 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1326 instead of 'Operator'
1328 * expression.cs (Binary::ResolveOperator): Update accordingly.
1329 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1332 * cs-parser.jay (unary_expression): Update to use the new names.
1334 * gen-treedump.cs (GetUnary): Same here.
1336 * expression.cs (Unary::Resolve): Implement.
1337 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1338 operators are found instead of making noise ;-)
1339 (Unary::ResolveOperator): New method to do precisely the same thing which
1340 Binary::ResolveOperator does for Binary expressions.
1341 (Unary.method, .Arguments): Add.
1342 (Unary::OperName): Implement.
1343 (Unary::ForceConversion): Copy and Paste !
1345 * class.cs (Operator::Define): Fix a small bug for the case when we have
1348 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1349 for the inbuilt operators. Only overloading works for now ;-)
1351 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1353 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1354 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1356 * expression.cs (This::Emit): Implement.
1357 (This::Resolve): Implement.
1358 (TypeOf:Resolve): Implement.
1359 (Expression::ResolveSimpleName): Add an implicit this to instance
1361 (MemberAccess::Resolve): Deal with Parameters and Fields.
1362 Bind instance variable to Field expressions.
1363 (FieldExpr::Instance): New field used to track the expression that
1364 represents the object instance.
1365 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1367 (FieldExpr::Emit): Implement.
1369 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1370 the last instruction contains a return opcode to avoid generating
1371 the last `ret' instruction (this generates correct code, and it is
1372 nice to pass the peverify output).
1374 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1375 initializer for static and instance variables.
1376 (Constructor::Emit): Allow initializer to be null in the case of
1377 static constructors. Only emit initializer for instance
1380 (TypeContainer::FindMembers): Return a null array if there are no
1383 Also fix the code for the MemberTypes.Method branch, as it was not
1384 scanning that for operators (or tried to access null variables before).
1386 * assign.cs (Assign::Emit): Handle instance and static fields.
1390 * driver.cs: Stop compilation if there are parse errors.
1392 * cs-parser.jay (constructor_declaration): Provide default base
1393 initializer for non-static constructors.
1394 (constructor_declarator): Do not provide a default base
1395 initializers if none was specified.
1396 Catch the fact that constructors should not have parameters.
1398 * class.cs: Do not emit parent class initializers for static
1399 constructors, that should be flagged as an error.
1401 2001-09-18 Ravi Pratap <ravi@ximian.com>
1403 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1404 Move back code into TypeContainer::Populate.
1406 2001-09-18 Ravi Pratap <ravi@ximian.com>
1408 * class.cs (TypeContainer::AddConstructor): Fix the check to
1409 compare against Name, not Basename.
1410 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1412 * cs-parser.jay : Update accordingly.
1414 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1415 for methods, don't forget to look into the operators too.
1416 (RegisterMethodBuilder): Helper method to take care of this for
1417 methods, constructors and operators.
1418 (Operator::Define): Completely revamp.
1419 (Operator.OperatorMethod, MethodName): New fields.
1420 (TypeContainer::Populate): Move the registering of builders into
1421 RegisterMethodBuilder.
1422 (Operator::Emit): Re-write.
1424 * expression.cs (Binary::Emit): Comment out code path to emit method
1425 invocation stuff for the case when we have a user defined operator. I am
1426 just not able to get it right !
1428 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1430 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1433 (Expression::MemberLookup): Provide a version that allows to
1434 specify the MemberTypes and BindingFlags.
1436 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1437 so it was not fetching variable information from outer blocks.
1439 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1440 Beforefieldinit as it was buggy.
1442 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1445 * class.cs (Constructor::Emit): Only emit if block is not null.
1446 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1447 deal with this by semantically definining it as if the user had
1450 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1451 constructors as we now "emit" them at a higher level.
1453 (TypeContainer::DefineDefaultConstructor): Used to define the
1454 default constructors if none was provided.
1456 (ConstructorInitializer): Add methods Resolve and Emit.
1458 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1460 2001-09-17 Ravi Pratap <ravi@ximian.com>
1462 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1463 the default constructor builder with our hashtable for methodbuilders
1466 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1467 and argument_count is 0 in which case we have a match.
1468 (Binary::ResolveOperator): More null checking and miscellaneous coding
1471 2001-09-17 Ravi Pratap <ravi@ximian.com>
1473 * rootcontext.cs (IsNameSpace): Compare against null.
1475 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1477 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1478 and Unary::Operator.
1480 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1483 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1484 we have overloaded operators.
1485 (Binary::ResolveOperator): Implement the part which does the operator overload
1488 * class.cs (Operator::Emit): Implement.
1489 (TypeContainer::Emit): Emit the operators we have too.
1491 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1492 the case when we have a user-defined operator.
1494 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1496 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1498 2001-09-16 Ravi Pratap <ravi@ximian.com>
1500 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1501 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1502 (Constructor::Emit): Implement.
1503 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1504 if we have no work to do.
1505 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1508 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1509 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1511 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1514 2001-09-15 Ravi Pratap <ravi@ximian.com>
1516 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1518 (Tree::RecordNamespace): Method to do what the name says ;-)
1519 (Tree::Namespaces): Property to get at the namespaces hashtable.
1521 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1524 * rootcontext.cs (IsNamespace): Fixed it :-)
1526 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1528 * class.cs (TypeContainer::FindMembers): Add support for
1530 (MethodCore): New class that encapsulates both the shared aspects
1531 of a Constructor and a Method.
1532 (Method, Constructor): Factored pieces into MethodCore.
1534 * driver.cs: Added --fatal which makes errors throw exceptions.
1535 Load System assembly as well as part of the standard library.
1537 * report.cs: Allow throwing exceptions on errors for debugging.
1539 * modifiers.cs: Do not use `parent', instead use the real type
1540 container to evaluate permission settings.
1542 * class.cs: Put Ravi's patch back in. He is right, and we will
1543 have to cope with the
1545 2001-09-14 Ravi Pratap <ravi@ximian.com>
1547 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1548 FamORAssem, not FamANDAssem.
1550 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1552 * driver.cs: Added --parse option that only parses its input files
1555 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1556 incorrect. IsTopLevel is not used to tell whether an object is
1557 root_types or not (that can be achieved by testing this ==
1558 root_types). But to see if this is a top-level *class* (not
1559 necessarly our "toplevel" container).
1561 2001-09-14 Ravi Pratap <ravi@ximian.com>
1563 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1564 parent instead of a direct call to GetType.
1566 2001-09-14 Ravi Pratap <ravi@ximian.com>
1568 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1569 Modifiers.TypeAttr. This should just be a call to that method.
1571 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1572 object so that we can determine if we are top-level or not.
1574 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1577 * enum.cs (Enum::Define): Ditto.
1579 * modifiers.cs (FieldAttr): Re-write.
1581 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1582 (TypeContainer::HaveStaticConstructor): New property to provide access
1583 to precisely that info.
1585 * modifiers.cs (MethodAttr): Re-write.
1586 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1588 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1589 of top-level types as claimed.
1591 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1593 * expression.cs (MemberLookup): Fruitless attempt to lookup
1594 constructors. Maybe I need to emit default constructors? That
1595 might be it (currently .NET emits this for me automatically).
1596 (Invocation::OverloadResolve): Cope with Arguments == null.
1597 (Invocation::EmitArguments): new function, shared by the new
1599 (Invocation::Emit): Handle static and instance methods. Emit
1600 proper call instruction for virtual or non-virtual invocations.
1601 (New::Emit): Implement.
1602 (New::Resolve): Implement.
1603 (MemberAccess:Resolve): Implement.
1604 (MethodGroupExpr::InstanceExpression): used conforming to the spec
1606 (FieldExpr::Resolve): Set type.
1608 * support.cs: Handle empty arguments.
1610 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
1611 SimpleLookup): Auxiliary routines to help parse a qualifier
1614 Update qualifier_identifier rule.
1616 * codegen.cs: Removed debugging messages.
1618 * class.cs: Make this a global thing, this acts just as a "key" to
1619 objects that we might have around.
1621 (Populate): Only initialize method_builders_to_methods once.
1623 * expression.cs (PropertyExpr): Initialize type from the
1626 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
1627 Resolve pattern. Attempt to implicitly convert value to boolean.
1630 * expression.cs: Set the type for the int32/int32 argument case.
1631 (Binary::ResolveOperator): Set the return type to boolean for
1632 comparission operators
1634 * typemanager.cs: Remove debugging print code.
1636 (Invocation::Resolve): resolve type.
1638 * class.cs: Allocate a MemberInfo of the correct size, as the code
1639 elsewhere depends on the test to reflect the correct contents.
1641 (Method::) Keep track of parameters, due to System.Reflection holes
1643 (TypeContainer::Populate): Keep track of MethodBuilders to Method
1646 (TypeContainer::FindMembers): Use ArrayList and then copy an array
1647 of the exact size and return that.
1649 (Class::LookupMethodByBuilder): New function that maps
1650 MethodBuilders to its methods. Required to locate the information
1651 on methods because System.Reflection bit us again.
1653 * support.cs: New file, contains an interface ParameterData and
1654 two implementations: ReflectionParameters and InternalParameters
1655 used to access Parameter information. We will need to grow this
1658 * expression.cs (Invocation::GetParameterData): implement a cache
1659 and a wrapper around the ParameterData creation for methods.
1660 (Invocation::OverloadResolve): Use new code.
1662 2001-09-13 Ravi Pratap <ravi@ximian.com>
1664 * class.cs (TypeContainer::EmitField): Remove and move into
1665 (Field::Define): here and modify accordingly.
1666 (Field.FieldBuilder): New member.
1667 (TypeContainer::Populate): Update accordingly.
1668 (TypeContainer::FindMembers): Implement.
1670 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1672 * statement.cs: (VariableInfo::VariableType): New field to be
1673 initialized with the full type once it is resolved.
1675 2001-09-12 Miguel de Icaza <miguel@ximian.com>
1677 * parameter.cs (GetParameterInfo): Use a type cache to compute
1678 things only once, and to reuse this information
1680 * expression.cs (LocalVariableReference::Emit): Implement.
1681 (OpcodeCast::Emit): fix.
1683 (ParameterReference::Resolve): Implement.
1684 (ParameterReference::Emit): Implement.
1686 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
1687 that are expressions need to stay as Expressions.
1689 * typemanager.cs (CSharpName): Returns the C# name of a type if
1692 * expression.cs (Expression::ConvertImplicit): New function that
1693 implements implicit type conversions.
1695 (Expression::ImplicitReferenceConversion): Implements implicit
1696 reference conversions.
1698 (EmptyCast): New type for transparent casts.
1700 (OpcodeCast): New type for casts of types that are performed with
1701 a sequence of bytecodes.
1703 (BoxedCast): New type used for casting value types into reference
1704 types. Emits a box opcode.
1706 (Binary::DoNumericPromotions): Implements numeric promotions of
1707 and computation of the Binary::Type.
1709 (Binary::EmitBranchable): Optimization.
1711 (Binary::Emit): Implement code emission for expressions.
1713 * typemanager.cs (TypeManager): Added two new core types: sbyte
1716 2001-09-12 Ravi Pratap <ravi@ximian.com>
1718 * class.cs (TypeContainer::FindMembers): Method which does exactly
1719 what Type.FindMembers does, only we don't have to use reflection. No
1722 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
1723 typecontainer objects as we need to get at them.
1724 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
1726 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
1727 typecontainer object.
1729 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
1730 of just a Report object.
1732 2001-09-11 Ravi Pratap <ravi@ximian.com>
1734 * class.cs (Event::Define): Go back to using the prefixes "add_" and
1736 (TypeContainer::Populate): Now define the delegates of the type too.
1737 (TypeContainer.Delegates): Property to access the list of delegates defined
1740 * delegates.cs (Delegate::Define): Implement partially.
1742 * modifiers.cs (TypeAttr): Handle more flags.
1744 2001-09-11 Ravi Pratap <ravi@ximian.com>
1746 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
1748 (Operator::Define): Re-write logic to get types by using the LookupType method
1749 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
1750 (Indexer::Define): Ditto.
1751 (Event::Define): Ditto.
1752 (Property::Define): Ditto.
1754 2001-09-10 Ravi Pratap <ravi@ximian.com>
1756 * class.cs (TypeContainer::Populate): Now define operators too.
1757 (TypeContainer.Operators): New property to access the list of operators
1759 (Operator.OperatorMethodBuilder): New member to hold the method builder
1760 for the operator we are defining.
1761 (Operator::Define): Implement.
1763 2001-09-10 Ravi Pratap <ravi@ximian.com>
1765 * class.cs (Event::Define): Make the prefixes of the accessor methods
1766 addOn_ and removeOn_
1768 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
1769 of the location being passed in too. Ideally, this should go later since all
1770 error reporting should be done through the Report object.
1772 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
1773 (Populate): Iterate thru the indexers we have and define them too.
1774 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
1775 for the get and set accessors.
1776 (Indexer::Define): Implement.
1778 2001-09-09 Miguel de Icaza <miguel@ximian.com>
1780 * expression.cs (Binary::Resolve): Beginning of it. I scratched
1781 my previous implementation, did not work.
1783 * typemanager.cs: Add a couple of missing types (the longs).
1785 * literal.cs: Use TypeManager.bool_type instead of getting it.
1787 * expression.cs (EventExpr): New kind of expressions.
1788 (Expressio::ExprClassFromMemberInfo): finish
1790 2001-09-08 Miguel de Icaza <miguel@ximian.com>
1792 * assign.cs: Emit stores to static fields differently.
1794 2001-09-08 Ravi Pratap <ravi@ximian.com>
1796 * Merge in changes and adjust code to tackle conflicts. Backed out my
1797 code in Assign::Resolve ;-)
1799 2001-09-08 Ravi Pratap <ravi@ximian.com>
1801 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
1802 instead Report.Error and also pass in the location.
1803 (CSharpParser::Lexer): New readonly property to return the reference
1804 to the Tokenizer object.
1805 (declare_local_variables): Use Report.Error with location instead of plain
1809 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
1810 (Operator.CheckBinaryOperator): Ditto.
1812 * cs-parser.jay (operator_declarator): Update accordingly.
1814 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
1815 (CheckBinaryOperator): Same here.
1817 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
1818 on the name without any prefixes of namespace names etc. This is because we
1819 already might have something already fully qualified like
1820 'System.Console.WriteLine'
1822 * assign.cs (Resolve): Begin implementation. Stuck ;-)
1824 2001-09-07 Ravi Pratap <ravi@ximian.com>
1826 * cs-tokenizer.cs (location): Return a string which also contains
1829 * expression.cs (ElementAccess): New class for expressions of the
1830 type 'element access.'
1831 (BaseAccess): New class for expressions of the type 'base access.'
1832 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
1835 * cs-parser.jay (element_access): Implement action.
1836 (base_access): Implement actions.
1837 (checked_expression, unchecked_expression): Implement.
1839 * cs-parser.jay (local_variable_type): Correct and implement.
1840 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
1842 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
1844 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
1845 name and the specifiers.
1847 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
1849 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
1850 making them all public ;-)
1852 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
1855 2001-09-07 Miguel de Icaza <miguel@ximian.com>
1857 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
1859 (FieldExpr, PropertyExprs): New resolved expressions.
1860 (SimpleName::MemberStaticCheck): Perform static checks for access
1861 to non-static fields on static methods. Maybe this should be
1862 generalized for MemberAccesses.
1863 (SimpleName::ResolveSimpleName): More work on simple name
1866 * cs-parser.jay (primary_expression/qualified_identifier): track
1867 the parameter index.
1869 * codegen.cs (CodeGen::Save): Catch save exception, report error.
1870 (EmitContext::EmitBoolExpression): Chain to expression generation
1871 instead of temporary hack.
1872 (::EmitStatementExpression): Put generic expression code generation.
1874 * assign.cs (Assign::Emit): Implement variable assignments to
1875 local variables, parameters and fields.
1877 2001-09-06 Miguel de Icaza <miguel@ximian.com>
1879 * statement.cs (Block::GetVariableInfo): New method, returns the
1880 VariableInfo for a variable name in a block.
1881 (Block::GetVariableType): Implement in terms of GetVariableInfo
1883 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
1884 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
1886 2001-09-06 Ravi Pratap <ravi@ximian.com>
1888 * cs-parser.jay (operator_declaration): Continue on my quest : update
1889 to take attributes argument.
1890 (event_declaration): Ditto.
1891 (enum_declaration): Ditto.
1892 (indexer_declaration): Ditto.
1894 * class.cs (Operator::Operator): Update constructor accordingly.
1895 (Event::Event): Ditto.
1897 * delegate.cs (Delegate::Delegate): Same here.
1899 * enum.cs (Enum::Enum): Same here.
1901 2001-09-05 Ravi Pratap <ravi@ximian.com>
1903 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
1905 * ../tests/cs0658.cs : New file to demonstrate error 0658.
1907 * attribute.cs (Attributes): New class to encapsulate all attributes which were
1908 being passed around as an arraylist.
1909 (Attributes::AddAttribute): Method to add attribute sections.
1911 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
1912 (struct_declaration): Update accordingly.
1913 (constant_declaration): Update.
1914 (field_declaration): Update.
1915 (method_header): Update.
1916 (fixed_parameter): Update.
1917 (parameter_array): Ditto.
1918 (property_declaration): Ditto.
1919 (destructor_declaration): Ditto.
1921 * class.cs (Struct::Struct): Update constructors accordingly.
1922 (Class::Class): Ditto.
1923 (Field::Field): Ditto.
1924 (Method::Method): Ditto.
1925 (Property::Property): Ditto.
1926 (TypeContainer::OptAttribute): update property's return type.
1928 * interface.cs (Interface.opt_attributes): New member.
1929 (Interface::Interface): Update to take the extra Attributes argument.
1931 * parameter.cs (Parameter::Parameter): Ditto.
1933 * constant.cs (Constant::Constant): Ditto.
1935 * interface.cs (InterfaceMemberBase): New OptAttributes field.
1936 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
1937 the attributes as a parameter.
1938 (InterfaceProperty): Update constructor call.
1939 (InterfaceEvent): Ditto.
1940 (InterfaceMethod): Ditto.
1941 (InterfaceIndexer): Ditto.
1943 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
1944 pass the attributes too.
1945 (interface_event_declaration): Ditto.
1946 (interface_property_declaration): Ditto.
1947 (interface_method_declaration): Ditto.
1948 (interface_declaration): Ditto.
1950 2001-09-05 Miguel de Icaza <miguel@ximian.com>
1952 * class.cs (Method::Define): Track the "static Main" definition to
1953 create an entry point.
1955 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
1956 EntryPoint if we find it.
1958 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
1959 (EmitContext::ig): Make this variable public.
1961 * driver.cs: Make the default output file be the first file name
1962 with the .exe extension.
1964 Detect empty compilations
1966 Handle various kinds of output targets. Handle --target and
1967 rename -t to --dumper.
1969 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
1970 methods inherited from Expression return now an Expression. This
1971 will is used during the tree rewriting as we resolve them during
1974 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
1975 the spec. Missing entirely is the information about
1976 accessability of elements of it.
1978 (Expression::ExprClassFromMemberInfo): New constructor for
1979 Expressions that creates a fully initialized Expression based on
1980 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
1983 (Invocation::Resolve): Begin implementing resolution of invocations.
1985 * literal.cs (StringLiteral): Implement Emit.
1987 2001-09-05 Ravi Pratap <ravi@ximian.com>
1989 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
1992 2001-09-04 Ravi Pratap <ravi@ximian.com>
1994 * cs-parser.jay (attribute_arguments): Implement actions.
1995 (attribute): Fix bug in production. Implement action.
1996 (attribute_list): Implement.
1997 (attribute_target): Implement.
1998 (attribute_target_specifier, opt_target_specifier): Implement
1999 (CheckAttributeTarget): New method to check if the attribute target
2001 (attribute_section): Implement.
2002 (opt_attributes): Implement.
2004 * attribute.cs : New file to handle attributes.
2005 (Attribute): Class to hold attribute info.
2007 * cs-parser.jay (opt_attribute_target_specifier): Remove production
2008 (attribute_section): Modify production to use 2 different rules to
2009 achieve the same thing. 1 s/r conflict down !
2010 Clean out commented, useless, non-reducing dimension_separator rules.
2012 * class.cs (TypeContainer.attributes): New member to hold list
2013 of attributes for a type.
2014 (Struct::Struct): Modify to take one more argument, the attribute list.
2015 (Class::Class): Ditto.
2016 (Field::Field): Ditto.
2017 (Method::Method): Ditto.
2018 (Property::Property): Ditto.
2020 * cs-parser.jay (struct_declaration): Update constructor call to
2021 pass in the attributes too.
2022 (class_declaration): Ditto.
2023 (constant_declaration): Ditto.
2024 (field_declaration): Ditto.
2025 (method_header): Ditto.
2026 (fixed_parameter): Ditto.
2027 (parameter_array): Ditto.
2028 (property_declaration): Ditto.
2030 * constant.cs (Constant::Constant): Update constructor similarly.
2031 Use System.Collections.
2033 * parameter.cs (Parameter::Parameter): Update as above.
2035 2001-09-02 Ravi Pratap <ravi@ximian.com>
2037 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
2038 (TypeContainer.delegates): New member to hold list of delegates.
2040 * cs-parser.jay (delegate_declaration): Implement the action correctly
2041 this time as I seem to be on crack ;-)
2043 2001-09-02 Miguel de Icaza <miguel@ximian.com>
2045 * rootcontext.cs (RootContext::IsNamespace): new function, used to
2046 tell whether an identifier represents a namespace.
2048 * expression.cs (NamespaceExpr): A namespace expression, used only
2049 temporarly during expression resolution.
2050 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
2051 utility functions to resolve names on expressions.
2053 2001-09-01 Miguel de Icaza <miguel@ximian.com>
2055 * codegen.cs: Add hook for StatementExpressions.
2057 * class.cs: Fix inverted test for static flag in methods.
2059 2001-09-02 Ravi Pratap <ravi@ximian.com>
2061 * class.cs (Operator::CheckUnaryOperator): Correct error number used
2062 to make it coincide with MS' number.
2063 (Operator::CheckBinaryOperator): Ditto.
2065 * ../errors/errors.txt : Remove error numbers added earlier.
2067 * ../errors/cs1019.cs : Test case for error # 1019
2069 * ../errros/cs1020.cs : Test case for error # 1020
2071 * cs-parser.jay : Clean out commented cruft.
2072 (dimension_separators, dimension_separator): Comment out. Ostensibly not
2073 used anywhere - non-reducing rule.
2074 (namespace_declarations): Non-reducing rule - comment out.
2076 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
2077 with TypeContainer::AddEnum.
2079 * delegate.cs : New file for delegate handling classes.
2080 (Delegate): Class for declaring delegates.
2082 * makefile : Update.
2084 * cs-parser.jay (delegate_declaration): Implement.
2086 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
2088 * class.cs (Event::Define): Implement.
2089 (Event.EventBuilder): New member.
2091 * class.cs (TypeContainer::Populate): Update to define all enums and events
2093 (Events): New property for the events arraylist we hold. Shouldn't we move to using
2094 readonly fields for all these cases ?
2096 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2098 * class.cs (Property): Revamp to use the convention of making fields readonly.
2099 Accordingly modify code elsewhere.
2101 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
2102 the Define method of the Property class.
2104 * class.cs : Clean up applied patch and update references to variables etc. Fix
2106 (TypeContainer::Populate): Update to define all the properties we have. Also
2107 define all enumerations.
2109 * enum.cs (Define): Implement.
2111 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2113 * cs-parser.jay (overloadable_operator): The semantic value is an
2114 enum of the Operator class.
2115 (operator_declarator): Implement actions.
2116 (operator_declaration): Implement.
2118 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
2119 validity of definitions.
2120 (Operator::CheckBinaryOperator): Static method to check for binary operators
2121 (TypeContainer::AddOperator): New method to add an operator to a type.
2123 * cs-parser.jay (indexer_declaration): Added line to actually call the
2124 AddIndexer method so it gets added ;-)
2126 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
2127 already taken care of by the MS compiler ?
2129 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2131 * class.cs (Operator): New class for operator declarations.
2132 (Operator::OpType): Enum for the various operators.
2134 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2136 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
2137 ostensibly handle this in semantic analysis.
2139 * cs-parser.jay (general_catch_clause): Comment out
2140 (specific_catch_clauses, specific_catch_clause): Ditto.
2141 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
2142 (catch_args, opt_catch_args): New productions.
2143 (catch_clause): Rewrite to use the new productions above
2144 (catch_clauses): Modify accordingly.
2145 (opt_catch_clauses): New production to use in try_statement
2146 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
2147 and re-write the code in the actions to extract the specific and
2148 general catch clauses by being a little smart ;-)
2150 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
2151 Hooray, try and catch statements parse fine !
2153 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2155 * statement.cs (Block::GetVariableType): Fix logic to extract the type
2156 string from the hashtable of variables.
2158 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
2159 I end up making that mistake ;-)
2160 (catch_clauses): Fixed gross error which made Key and Value of the
2161 DictionaryEntry the same : $1 !!
2163 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2165 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2167 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2168 when the add and remove accessors are specified.
2170 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2172 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2173 information about indexer_declarator.
2174 (indexer_declarator): Implement actions.
2175 (parsing_indexer): New local boolean used to keep track of whether
2176 we are parsing indexers or properties. This is necessary because
2177 implicit_parameters come into picture even for the get accessor in the
2179 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2181 * class.cs (Indexer): New class for indexer declarations.
2182 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2183 (TypeContainer::indexers): New member to hold list of indexers for the
2186 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2188 * cs-parser.jay (add_accessor_declaration): Implement action.
2189 (remove_accessor_declaration): Implement action.
2190 (event_accessors_declaration): Implement
2191 (variable_declarators): swap statements for first rule - trivial.
2193 * class.cs (Event): New class to hold information about event
2195 (TypeContainer::AddEvent): New method to add an event to a type
2196 (TypeContainer::events): New member to hold list of events.
2198 * cs-parser.jay (event_declaration): Implement actions.
2200 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2202 * cs-parser.jay (dim_separators): Implement. Make it a string
2203 concatenating all the commas together, just as they appear.
2204 (opt_dim_separators): Modify accordingly
2205 (rank_specifiers): Update accordingly. Basically do the same
2206 thing - instead, collect the brackets here.
2207 (opt_rank_sepcifiers): Modify accordingly.
2208 (array_type): Modify to actually return the complete type string
2209 instead of ignoring the rank_specifiers.
2210 (expression_list): Implement to collect the expressions
2211 (variable_initializer): Implement. We make it a list of expressions
2212 essentially so that we can handle the array_initializer case neatly too.
2213 (variable_initializer_list): Implement.
2214 (array_initializer): Make it a list of variable_initializers
2215 (opt_array_initializer): Modify accordingly.
2217 * expression.cs (New::NType): Add enumeration to help us
2218 keep track of whether we have an object/delegate creation
2219 or an array creation.
2220 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2221 members to hold data about array creation.
2222 (New:New): Modify to update NewType
2223 (New:New): New Overloaded contructor for the array creation
2226 * cs-parser.jay (array_creation_expression): Implement to call
2227 the overloaded New constructor.
2229 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2231 * class.cs (TypeContainer::Constructors): Return member
2232 constructors instead of returning null.
2234 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2236 * typemanager.cs (InitCoreTypes): Initialize the various core
2237 types after we have populated the type manager with the user
2238 defined types (this distinction will be important later while
2239 compiling corlib.dll)
2241 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2242 on Expression Classification. Now all expressions have a method
2243 `Resolve' and a method `Emit'.
2245 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2246 generation from working. Also add some temporary debugging
2249 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2251 * codegen.cs: Lots of code generation pieces. This is only the
2252 beginning, will continue tomorrow with more touches of polish. We
2253 handle the fundamentals of if, while, do, for, return. Others are
2254 trickier and I need to start working on invocations soon.
2256 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2259 * codegen.cs (EmitContext): New struct, used during code
2260 emission to keep a context. Most of the code generation will be
2263 * cs-parser.jay: Add embedded blocks to the list of statements of
2264 this block. So code generation proceeds in a top down fashion.
2266 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2268 * statement.cs: Add support for multiple child blocks.
2270 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2272 * codegen.cs (EmitCode): New function, will emit the code for a
2273 Block of code given a TypeContainer and its ILGenerator.
2275 * statement.cs (Block): Standard public readonly optimization.
2276 (Block::Block constructors): Link children.
2277 (Block::Child): Child Linker.
2278 (Block::EmitVariables): Emits IL variable declarations.
2280 * class.cs: Drop support for MethodGroups here, delay until
2282 (Method::): Applied the same simplification that I did before, and
2283 move from Properties to public readonly fields.
2284 (Method::ParameterTypes): Returns the parameter types for the
2285 function, and implements a cache that will be useful later when I
2286 do error checking and the semantic analysis on the methods is
2288 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2289 and made a method, optional argument tells whether this is a class
2290 or a structure to apply the `has-this' bit.
2291 (Method::GetCallingConvention): Implement, returns the calling
2293 (Method::Define): Defines the type, a second pass is performed
2294 later to populate the methods.
2296 (Constructor::ParameterTypes): implement a cache similar to the
2297 one on Method::ParameterTypes, useful later when we do semantic
2300 (TypeContainer::EmitMethod): New method. Emits methods.
2302 * expression.cs: Removed MethodGroup class from here.
2304 * parameter.cs (Parameters::GetCallingConvention): new method.
2306 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2308 * class.cs (TypeContainer::Populate): Drop RootContext from the
2311 (Constructor::CallingConvention): Returns the calling convention.
2312 (Constructor::ParameterTypes): Returns the constructor parameter
2315 (TypeContainer::AddConstructor): Keep track of default constructor
2316 and the default static constructor.
2318 (Constructor::) Another class that starts using `public readonly'
2319 instead of properties.
2321 (Constructor::IsDefault): Whether this is a default constructor.
2323 (Field::) use readonly public fields instead of properties also.
2325 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2326 track of static constructors; If none is used, turn on
2327 BeforeFieldInit in the TypeAttributes.
2329 * cs-parser.jay (opt_argument_list): now the return can be null
2330 for the cases where there are no arguments.
2332 (constructor_declarator): If there is no implicit `base' or
2333 `this', then invoke the default parent constructor.
2335 * modifiers.cs (MethodAttr): New static function maps a set of
2336 modifiers flags into a MethodAttributes enum
2337 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2338 MethodAttr, TypeAttr to represent the various mappings where the
2340 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2342 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2344 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2347 * interface.cs (PopulateIndexer): Implemented the code generator
2348 for interface indexers.
2350 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2352 * interface.cs (InterfaceMemberBase): Now we track the new status
2355 (PopulateProperty): Implement property population. Woohoo! Got
2356 Methods and Properties going today.
2358 Removed all the properties for interfaces, and replaced them with
2359 `public readonly' fields.
2361 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2363 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2364 initialize their hashtables/arraylists only when they are needed
2365 instead of doing this always.
2367 * parameter.cs: Handle refs and out parameters.
2369 * cs-parser.jay: Use an ArrayList to construct the arguments
2370 instead of the ParameterCollection, and then cast that to a
2373 * parameter.cs: Drop the use of ParameterCollection and use
2374 instead arrays of Parameters.
2376 (GetParameterInfo): Use the Type, not the Name when resolving
2379 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2381 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2382 and instead use public readonly fields.
2384 * class.cs: Put back walking code for type containers.
2386 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2388 * class.cs (MakeConstant): Code to define constants.
2390 * rootcontext.cs (LookupType): New function. Used to locate types
2393 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2395 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2396 this System.Reflection code is. Kudos to Microsoft
2398 * typemanager.cs: Implement a type cache and avoid loading all
2399 types at boot time. Wrap in LookupType the internals. This made
2400 the compiler so much faster. Wow. I rule!
2402 * driver.cs: Make sure we always load mscorlib first (for
2403 debugging purposes, nothing really important).
2405 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2406 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2408 * rootcontext.cs: Lookup types on their namespace; Lookup types
2409 on namespaces that have been imported using the `using' keyword.
2411 * class.cs (TypeContainer::TypeAttr): Virtualize.
2412 (Class::TypeAttr): Return attributes suitable for this bad boy.
2413 (Struct::TypeAttr): ditto.
2414 Handle nested classes.
2415 (TypeContainer::) Remove all the type visiting code, it is now
2416 replaced with the rootcontext.cs code
2418 * rootcontext.cs (GetClassBases): Added support for structs.
2420 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2422 * interface.cs, statement.cs, class.cs, parameter.cs,
2423 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2424 Drop use of TypeRefs, and use strings instead.
2426 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2430 * class.cs (Struct::Struct): set the SEALED flags after
2431 checking the modifiers.
2432 (TypeContainer::TypeAttr): new property, returns the
2433 TypeAttributes for a class.
2435 * cs-parser.jay (type_list): Oops, list production was creating a
2436 new list of base types.
2438 * rootcontext.cs (StdLib): New property.
2439 (GetInterfaceTypeByName): returns an interface by type name, and
2440 encapsulates error handling here.
2441 (GetInterfaces): simplified.
2442 (ResolveTree): Encapsulated all the tree resolution here.
2443 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2446 * driver.cs: Add support for --nostdlib, to avoid loading the
2448 (Main): Do not put tree resolution here.
2450 * rootcontext.cs: Beginning of the class resolution.
2452 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2454 * rootcontext.cs: Provide better error reporting.
2456 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2458 * rootcontext.cs (CreateInterface): Handle the case where there
2459 are no parent interfaces.
2461 (CloseTypes): Routine to flush types at the end.
2462 (CreateInterface): Track types.
2463 (GetInterfaces): Returns an array of Types from the list of
2466 * typemanager.c (AddUserType): Mechanism to track user types (puts
2467 the type on the global type hash, and allows us to close it at the
2470 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2472 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2473 RecordInterface instead.
2475 * cs-parser.jay: Updated to reflect changes above.
2477 * decl.cs (Definition): Keep track of the TypeBuilder type that
2478 represents this type here. Not sure we will use it in the long
2479 run, but wont hurt for now.
2481 * driver.cs: Smaller changes to accomodate the new code.
2483 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2486 * rootcontext.cs (CreateInterface): New method, used to create
2487 the System.TypeBuilder type for interfaces.
2488 (ResolveInterfaces): new entry point to resolve the interface
2490 (CodeGen): Property, used to keep track of the code generator.
2492 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2494 * cs-parser.jay: Add a second production for delegate_declaration
2497 (enum_body): Put an opt_comma here instead of putting it on
2498 enum_body or enum_member_declarations so we can handle trailing
2499 commas on enumeration members. Gets rid of a shift/reduce.
2501 (type_list): Need a COMMA in the middle.
2503 (indexer_declaration): Tell tokenizer to recognize get/set
2505 * Remove old targets.
2507 * Re-add the parser target.
2509 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2511 * cs-parser.jay: Add precendence rules for a number of operators
2512 ot reduce the number of shift/reduce conflicts in the grammar.
2514 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2516 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2519 Get rid of old crufty code.
2521 * rootcontext.cs: Use this to keep track of the parsed
2522 representation and the defined types available to the program.
2524 * gen-treedump.cs: adjust for new convention.
2526 * type.cs: Split out the type manager, and the assembly builder
2529 * typemanager.cs: the type manager will live here now.
2531 * cil-codegen.cs: And the code generator here.
2533 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2535 * makefile: Fixed up for easy making.
2537 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2539 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2542 (unary_expression): Expand pre_increment_expression and
2543 post_decrement_expression to reduce a shift/reduce.
2545 2001-07-11 Simon Cozens
2547 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2549 Improve allow_keyword_as_indent name.
2551 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2553 * Adjustments for Beta2.
2555 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2557 * decl.cs: Added `Define' abstract method.
2558 (InTransit): new property, used to catch recursive definitions.
2560 * interface.cs: Implement `Define'.
2562 * modifiers.cs: Map Modifiers.constants to
2563 System.Reflection.TypeAttribute flags.
2565 * class.cs: Keep track of types and user-defined types.
2566 (BuilderInit): New method for creating an assembly
2567 (ResolveType): New function to launch the resolution process, only
2568 used by interfaces for now.
2570 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2571 that are inserted into the name space.
2573 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2575 * ARGH. I have screwed up my tree so many times due to the use of
2576 rsync rather than using CVS. Going to fix this at once.
2578 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2581 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2583 * Experiment successful: Use System.Type rather that our own
2586 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2588 * cs-parser.jay: Removed nsAliases from here.
2590 Use new namespaces, handle `using XXX;'
2592 * namespace.cs: Reimplemented namespace handling, use a recursive
2593 definition of the class. Now we can keep track of using clauses
2594 and catch invalid using clauses.
2596 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2598 * gen-treedump.cs: Adapted for all the renaming.
2600 * expression.cs (Expression): this class now has a Type property
2601 which returns an expression Type.
2603 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2604 `Type', as this has a different meaning now in the base
2606 2001-05-22 Miguel de Icaza <miguel@ximian.com>
2608 * interface.cs, class.cs: Removed from all the sources the
2609 references to signature computation, as we can not do method
2610 signature computation during the parsing time, as we are not
2611 trying to solve at that point distinguishing:
2615 void a (NS.Blah x) {}
2618 Which depending on the context might be valid or not, as we do not
2619 know if Blah is the same thing as NS.Blah at that point.
2621 * Redid everything so the code uses TypeRefs now instead of
2622 Types. TypeRefs are just temporary type placeholders, that need
2623 to be resolved. They initially have a pointer to a string and the
2624 current scope in which they are used. This is used later by the
2625 compiler to resolve the reference to an actual Type.
2627 * DeclSpace is no longer a CIR.Type, and neither are
2628 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
2629 are all DeclSpaces, but no Types.
2631 * type.cs (TypeRefManager): This implements the TypeRef manager,
2632 which keeps track of all the types that need to be resolved after
2633 the parsing has finished.
2635 2001-05-13 Miguel de Icaza <miguel@ximian.com>
2637 * ARGH. We are going to have to store `foreach' as a class rather
2638 than resolving it, as we need to verify error 1579 after name
2639 resolution. *OR* we could keep a flag that says `This request to
2640 IEnumerator comes from a foreach statement' which we can then use
2641 to generate the error.
2643 2001-05-10 Miguel de Icaza <miguel@ximian.com>
2645 * class.cs (TypeContainer.AddMethod): we now add methods to the
2646 MethodGroup instead of the method hashtable.
2648 * expression.cs: Add MethodGroup abstraction, which gets us one
2649 step closer to the specification in the way we handle method
2652 * cs-parser.jay (primary_expression): qualified_identifier now
2653 tried to match up an identifier to a local variable reference or
2654 to a parameter reference.
2656 current_local_parameters is now a parser global variable that
2657 points to the current parameters for the block, used during name
2660 (property_declaration): Now creates an implicit `value' argument to
2663 2001-05-09 Miguel de Icaza <miguel@ximian.com>
2665 * parameter.cs: Do not use `param' arguments as part of the
2666 signature, per the spec.
2668 2001-05-08 Miguel de Icaza <miguel@ximian.com>
2670 * decl.cs: Base class for classes, structs and interfaces. This
2671 is the "Declaration Space"
2673 * cs-parser.jay: Use CheckDef for checking declaration errors
2674 instead of having one on each function.
2676 * class.cs: Factor out some code for handling error handling in
2677 accordance to the "Declarations" section in the "Basic Concepts"
2678 chapter in the ECMA C# spec.
2680 * interface.cs: Make all interface member classes derive from
2681 InterfaceMemberBase.
2683 2001-05-07 Miguel de Icaza <miguel@ximian.com>
2685 * Many things: all interfaces are parsed and generated in
2686 gen-treedump. Support for member variables, constructors,
2687 destructors, properties, constants is there.
2689 Beginning of the IL backend, but very little done, just there for
2692 2001-04-29 Miguel de Icaza <miguel@ximian.com>
2694 * cs-parser.jay: Fix labeled statement.
2696 * cs-tokenizer.cs (escape): Escape " and ' always.
2697 ref_line, ref_name: keep track of the line/filename as instructed
2698 by #line by the compiler.
2701 2001-04-27 Miguel de Icaza <miguel@ximian.com>
2703 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
2704 to match the values in System.CodeDOM.
2706 Divid renamed to Divide.
2708 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
2710 (Statements.set): remove.
2712 * System.CodeDOM/CodeCatchClause.cs: always have a valid
2715 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
2716 falseStatements always have valid values.
2718 * cs-parser.jay: Use System.CodeDOM now.