1 2001-10-30 Ravi Pratap <ravi@ximian.com>
3 * expression.cs (NewArray): Merge into the ArrayCreation class.
5 2001-10-29 Ravi Pratap <ravi@ximian.com>
7 * expression.cs (NewArray): Merge classes NewBuiltinArray and
8 NewUserdefinedArray into one as there wasn't much of a use in having
11 * expression.cs (Argument): Change field's name to ArgType from Type.
13 (Type): New readonly property which returns the proper type, taking into
14 account ref/out modifiers.
16 (everywhere): Adjust code accordingly for the above.
18 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
19 whether we are emitting for a ref or out parameter.
21 * expression.cs (Argument::Emit): Use the above field to set the state.
23 (LocalVariableReference::Emit): Update to honour the flag and emit the
26 * parameter.cs (Attributes): Set the correct flags for ref parameters.
28 * expression.cs (Argument::FullDesc): New function to provide a full desc.
30 * support.cs (ParameterData): Add method ParameterDesc to the interface.
32 (ReflectionParameters, InternalParameters): Implement the above method.
34 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
37 (Invocation::FullMethodDesc): Ditto.
39 2001-10-29 Miguel de Icaza <miguel@ximian.com>
41 * cs-parser.jay: Add extra production for the second form of array
44 * expression.cs (ArrayCreation): Update to reflect the above
47 * Small changes to prepare for Array initialization.
49 2001-10-28 Miguel de Icaza <miguel@ximian.com>
51 * typemanager.cs (ImplementsInterface): interface might be null;
52 Deal with this problem;
54 Also, we do store negative hits on the cache (null values), so use
55 this instead of calling t.GetInterfaces on the type everytime.
57 2001-10-28 Ravi Pratap <ravi@ximian.com>
59 * typemanager.cs (IsBuiltinType): New method to help determine the same.
61 * expression.cs (New::DoResolve): Get rid of array creation code and instead
62 split functionality out into different classes.
64 (New::FormArrayType): Move into NewBuiltinArray.
66 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
69 (NewBuiltinArray): New class to handle creation of built-in arrays.
71 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
72 account creation of one-dimensional arrays.
74 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
76 (NewUserdefinedArray::DoResolve): Implement.
78 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
80 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
81 we maintain inside the TypeManager. This is necessary to perform lookups on the
84 (LookupType): Update to perform GetType on the module builders too.
86 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
88 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
90 2001-10-23 Ravi Pratap <ravi@ximian.com>
92 * expression.cs (New::DoResolve): Implement guts of array creation.
94 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
96 2001-10-27 Miguel de Icaza <miguel@ximian.com>
98 * expression.cs: Fix bug I introduced lsat night that broke
101 (Expression.Resolve): Report a 246 error (can not resolve name)
102 if we find a SimpleName in the stream.
104 (Expression.ResolveLValue): Ditto.
106 (Expression.ResolveWithSimpleName): This function is a variant of
107 ResolveName, this one allows SimpleNames to be returned without a
108 warning. The only consumer of SimpleNames is MemberAccess
110 2001-10-26 Miguel de Icaza <miguel@ximian.com>
112 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
113 might arrive here. I have my doubts that this is correct.
115 * statement.cs (Lock): Implement lock statement.
117 * cs-parser.jay: Small fixes to support `lock' and `using'
119 * cs-tokenizer.cs: Remove extra space
121 * driver.cs: New flag --checked, allows to turn on integer math
124 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
125 Threading.Monitor.Exit
127 2001-10-23 Miguel de Icaza <miguel@ximian.com>
129 * expression.cs (IndexerAccess::DoResolveLValue): Set the
130 Expression Class to be IndexerAccess.
132 Notice that Indexer::DoResolve sets the eclass to Value.
134 2001-10-22 Miguel de Icaza <miguel@ximian.com>
136 * class.cs (TypeContainer::Emit): Emit code for indexers.
138 * assign.cs (IAssignMethod): New interface implemented by Indexers
139 and Properties for handling assignment.
141 (Assign::Emit): Simplify and reuse code.
143 * expression.cs (IndexerAccess, PropertyExpr): Implement
144 IAssignMethod, clean up old code.
146 2001-10-22 Ravi Pratap <ravi@ximian.com>
148 * typemanager.cs (ImplementsInterface): New method to determine if a type
149 implements a given interface. Provides a nice cache too.
151 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
154 (ConvertReferenceExplicit): Ditto.
156 * delegate.cs (Delegate::Populate): Update to define the parameters on the
157 various methods, with correct names etc.
159 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
160 Operator.UnaryNegation.
162 * cs-parser.jay (operator_declarator): Be a little clever in the case where
163 we have a unary plus or minus operator.
165 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
168 * everywhere : update accordingly.
170 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
173 * class.cs (Method::Define): For the case where we are implementing a method
174 inherited from an interface, we need to set the MethodAttributes.Final flag too.
175 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
177 2001-10-21 Ravi Pratap <ravi@ximian.com>
179 * interface.cs (FindMembers): Implement to work around S.R.E
182 * typemanager.cs (IsInterfaceType): Implement.
184 (FindMembers): Update to handle interface types too.
186 * expression.cs (ImplicitReferenceConversion): Re-write bits which
187 use IsAssignableFrom as that is not correct - it doesn't work.
189 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
190 and accordingly override EmitStatement.
192 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
193 using the correct logic :-)
195 2001-10-19 Ravi Pratap <ravi@ximian.com>
197 * ../errors/cs-11.cs : Add to demonstrate error -11
199 2001-10-17 Miguel de Icaza <miguel@ximian.com>
201 * assign.cs (Assign::Resolve): Resolve right hand side first, and
202 then pass this as a hint to ResolveLValue.
204 * expression.cs (FieldExpr): Add Location information
206 (FieldExpr::LValueResolve): Report assignment to readonly
209 (Expression::ExprClassFromMemberInfo): Pass location information.
211 (Expression::ResolveLValue): Add new method that resolves an
214 (Expression::DoResolveLValue): Default invocation calls
217 (Indexers): New class used to keep track of indexers in a given
220 (IStackStore): Renamed from LValue, as it did not really describe
221 what this did. Also ResolveLValue is gone from this interface and
222 now is part of Expression.
224 (ElementAccess): Depending on the element access type
226 * typemanager.cs: Add `indexer_name_type' as a Core type
227 (System.Runtime.CompilerServices.IndexerNameAttribute)
229 * statement.cs (Goto): Take a location.
231 2001-10-18 Ravi Pratap <ravi@ximian.com>
233 * delegate.cs (Delegate::VerifyDelegate): New method to verify
234 if two delegates are compatible.
236 (NewDelegate::DoResolve): Update to take care of the case when
237 we instantiate a delegate from another delegate.
239 * typemanager.cs (FindMembers): Don't even try to look up members
240 of Delegate types for now.
242 2001-10-18 Ravi Pratap <ravi@ximian.com>
244 * delegate.cs (NewDelegate): New class to take care of delegate
247 * expression.cs (New): Split the delegate related code out into
248 the NewDelegate class.
250 * delegate.cs (DelegateInvocation): New class to handle delegate
253 * expression.cs (Invocation): Split out delegate related code into
254 the DelegateInvocation class.
256 2001-10-17 Ravi Pratap <ravi@ximian.com>
258 * expression.cs (New::DoResolve): Implement delegate creation fully
259 and according to the spec.
261 (New::DoEmit): Update to handle delegates differently.
263 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
264 because of which we were printing out arguments in reverse order !
266 * delegate.cs (VerifyMethod): Implement to check if the given method
267 matches the delegate.
269 (FullDelegateDesc): Implement.
271 (VerifyApplicability): Implement.
273 * expression.cs (Invocation::DoResolve): Update to accordingly handle
274 delegate invocations too.
276 (Invocation::Emit): Ditto.
278 * ../errors/cs1593.cs : Added.
280 * ../errors/cs1594.cs : Added.
282 * delegate.cs (InstanceExpression, TargetMethod): New properties.
284 2001-10-16 Ravi Pratap <ravi@ximian.com>
286 * typemanager.cs (intptr_type): Core type for System.IntPtr
288 (InitCoreTypes): Update for the same.
290 (iasyncresult_type, asynccallback_type): Ditto.
292 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
295 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
298 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
299 the builders for the 4 members of a delegate type :-)
301 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
304 * expression.cs (New::DoResolve): Implement guts for delegate creation.
306 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
308 2001-10-15 Miguel de Icaza <miguel@ximian.com>
310 * statement.cs (Break::Emit): Implement.
311 (Continue::Emit): Implement.
313 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
314 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
315 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
316 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
319 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
320 properties that track the label for the current loop (begin of the
321 loop and end of the loop).
323 2001-10-15 Ravi Pratap <ravi@ximian.com>
325 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
326 use of emitting anything at all.
328 * class.cs, rootcontext.cs : Get rid of calls to the same.
330 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
332 (Populate): Define the constructor correctly and set the implementation
335 * typemanager.cs (delegate_types): New hashtable to hold delegates that
338 (AddDelegateType): Implement.
340 (IsDelegateType): Implement helper method.
342 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
344 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
345 and accordingly handle it.
347 * delegate.cs (Populate): Take TypeContainer argument.
348 Implement bits to define the Invoke method. However, I still haven't figured out
349 how to take care of the native int bit :-(
351 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
352 Qualify the name of the delegate, not its return type !
354 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
357 (StandardConversionExists): Checking for array types turns out to be recursive.
359 (ConvertReferenceExplicit): Implement array conversion.
361 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
363 2001-10-12 Ravi Pratap <ravi@ximian.com>
365 * cs-parser.jay (delegate_declaration): Store the fully qualified
366 name as it is a type declaration.
368 * delegate.cs (ReturnType, Name): Rename members to these. Make them
371 (DefineDelegate): Renamed from Define. Does the same thing essentially,
372 as TypeContainer::DefineType.
374 (Populate): Method in which all the definition of the various methods (Invoke)
377 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
380 (CloseDelegate): Finally creates the delegate.
382 * class.cs (TypeContainer::DefineType): Update to define delegates.
383 (Populate, Emit and CloseType): Do the same thing here too.
385 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
386 delegates in all these operations.
388 2001-10-14 Miguel de Icaza <miguel@ximian.com>
390 * expression.cs: LocalTemporary: a new expression used to
391 reference a temporary that has been created.
393 * assign.cs: Handle PropertyAccess back here, so that we can
394 provide the proper semantic access to properties.
396 * expression.cs (Expression::ConvertReferenceExplicit): Implement
397 a few more explicit conversions.
399 * modifiers.cs: `NEW' modifier maps to HideBySig.
401 * expression.cs (PropertyExpr): Make this into an
402 ExpressionStatement, and support the EmitStatement code path.
404 Perform get/set error checking, clean up the interface.
406 * assign.cs: recognize PropertyExprs as targets, and if so, turn
407 them into toplevel access objects.
409 2001-10-12 Miguel de Icaza <miguel@ximian.com>
411 * expression.cs: PropertyExpr::PropertyExpr: use work around the
414 * typemanager.cs: Keep track here of our PropertyBuilders again to
415 work around lameness in SRE.
417 2001-10-11 Miguel de Icaza <miguel@ximian.com>
419 * expression.cs (LValue::LValueResolve): New method in the
420 interface, used to perform a second resolution pass for LValues.
422 (This::DoResolve): Catch the use of this in static methods.
424 (This::LValueResolve): Implement.
426 (This::Store): Remove warning, assigning to `this' in structures
429 (Invocation::Emit): Deal with invocation of
430 methods on value types. We need to pass the address to structure
431 methods rather than the object itself. (The equivalent code to
432 emit "this" for structures leaves the entire structure on the
433 stack instead of a pointer to it).
435 (ParameterReference::DoResolve): Compute the real index for the
436 argument based on whether the method takes or not a `this' pointer
437 (ie, the method is static).
439 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
440 value types returned from functions when we need to invoke a
441 method on the sturcture.
444 2001-10-11 Ravi Pratap <ravi@ximian.com>
446 * class.cs (TypeContainer::DefineType): Method to actually do the business of
447 defining the type in the Modulebuilder or Typebuilder. This is to take
448 care of nested types which need to be defined on the TypeBuilder using
451 (TypeContainer::GetClassBases): Implement. Essentially the code from the
452 methods in RootContext, only ported to be part of TypeContainer.
454 (TypeContainer::GetInterfaceOrClass): Ditto.
456 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
458 * interface.cs (Interface::DefineInterface): New method. Does exactly
459 what RootContext.CreateInterface did earlier, only it takes care of nested types
462 (Interface::GetInterfaces): Move from RootContext here and port.
464 (Interface::GetInterfaceByName): Same here.
466 * rootcontext.cs (ResolveTree): Re-write.
468 (PopulateTypes): Re-write.
470 * class.cs (TypeContainer::Populate): Populate nested types too.
471 (TypeContainer::Emit): Emit nested members too.
473 * typemanager.cs (AddUserType): Do not make use of the FullName property,
474 instead just use the name argument passed in as it is already fully
477 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
478 to TypeContainer mapping to see if a type is user-defined.
480 * class.cs (TypeContainer::CloseType): Implement.
482 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
483 the default constructor.
485 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
488 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
490 * interface.cs (CloseType): Create the type here.
492 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
495 Remove all the methods which are now in TypeContainer.
497 2001-10-10 Ravi Pratap <ravi@ximian.com>
499 * delegate.cs (Define): Re-write bits to define the delegate
502 2001-10-10 Miguel de Icaza <miguel@ximian.com>
504 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
506 * expression.cs (ImplicitReferenceConversion): handle null as well
507 as a source to convert to any reference type.
509 * statement.cs (Return): Perform any implicit conversions to
510 expected return type.
512 Validate use of return statement.
514 * codegen.cs (EmitContext): Pass the expected return type here.
516 * class.cs (Method, Constructor, Property): Pass expected return
519 2001-10-09 Miguel de Icaza <miguel@ximian.com>
521 * expression.cs: Make DoResolve take an EmitContext instead of a
524 Replaced `l' and `location' for `loc', for consistency.
526 (Error, Warning): Remove unneeded Tc argument.
528 * assign.cs, literal.cs, constant.cs: Update to new calling
531 * codegen.cs: EmitContext now contains a flag indicating whether
532 code is being generated in a static method or not.
534 * cs-parser.jay: DecomposeQI, new function that replaces the old
535 QualifiedIdentifier. Now we always decompose the assembled
536 strings from qualified_identifier productions into a group of
539 2001-10-08 Miguel de Icaza <miguel@ximian.com>
541 * rootcontext.cs: Deal with field-less struct types correctly now
542 by passing the size option to Define Type.
544 * class.cs: Removed hack that created one static field.
546 2001-10-07 Miguel de Icaza <miguel@ximian.com>
548 * statement.cs: Moved most of the code generation here.
550 2001-10-09 Ravi Pratap <ravi@ximian.com>
552 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
555 (ElementAccess): Remove useless bits for now - keep checks as the spec
558 2001-10-08 Ravi Pratap <ravi@ximian.com>
560 * expression.cs (ElementAccess::DoResolve): Remove my crap code
561 and start performing checks according to the spec.
563 2001-10-07 Ravi Pratap <ravi@ximian.com>
565 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
566 rank_specifiers instead.
568 (rank_specifiers): Change the order in which the rank specifiers are stored
570 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
572 * expression.cs (ElementAccess): Implement the LValue interface too.
574 2001-10-06 Ravi Pratap <ravi@ximian.com>
576 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
577 except that user defined conversions are not included.
579 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
580 perform the conversion of the return type, if necessary.
582 (New::DoResolve): Check whether we are creating an array or an object
583 and accordingly do the needful.
585 (New::Emit): Same here.
587 (New::DoResolve): Implement guts of array creation.
589 (New::FormLookupType): Helper function.
591 2001-10-07 Miguel de Icaza <miguel@ximian.com>
593 * codegen.cs: Removed most of the code generation here, and move the
594 corresponding code generation bits to the statement classes.
596 Added support for try/catch/finalize and throw.
598 * cs-parser.jay: Added support for try/catch/finalize.
600 * class.cs: Catch static methods having the flags override,
603 * expression.cs (UserCast): This user cast was not really doing
604 what it was supposed to do. Which is to be born in fully resolved
605 state. Parts of the resolution were being performed at Emit time!
609 2001-10-05 Miguel de Icaza <miguel@ximian.com>
611 * expression.cs: Implicity convert the result from UserCast.
613 2001-10-05 Ravi Pratap <ravi@ximian.com>
615 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
616 prevented it from working correctly.
618 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
619 merely ConvertImplicit.
621 2001-10-05 Miguel de Icaza <miguel@ximian.com>
623 * typemanager.cs: Make the LookupTypeContainer function static,
624 and not per-instance.
626 * class.cs: Make static FindMembers (the one that takes a Type
629 * codegen.cs: Add EmitForeach here.
631 * cs-parser.jay: Make foreach a toplevel object instead of the
632 inline expansion, as we need to perform semantic analysis on it.
634 2001-10-05 Ravi Pratap <ravi@ximian.com>
636 * expression.cs (Expression::ImplicitUserConversion): Rename to
637 UserDefinedConversion.
639 (Expression::UserDefinedConversion): Take an extra argument specifying
640 whether we look for explicit user conversions too.
642 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
644 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
646 (ExplicitUserConversion): Make it a call to UserDefinedConversion
647 with the appropriate arguments.
649 * cs-parser.jay (cast_expression): Record location too.
651 * expression.cs (Cast): Record location info.
653 (Expression::ConvertExplicit): Take location argument.
655 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
656 to determine if we are doing explicit conversions.
658 (UserCast::Emit): Update accordingly.
660 (Expression::ConvertExplicit): Report an error if everything fails.
662 * ../errors/cs0030.cs : Add.
664 2001-10-04 Miguel de Icaza <miguel@ximian.com>
666 * modifiers.cs: If the ABSTRACT keyword is present, also set the
667 virtual and newslot bits.
669 * class.cs (TypeContainer::RegisterRequiredImplementations):
670 Record methods we need.
672 (TypeContainer::MakeKey): Helper function to make keys for
673 MethodBases, since the Methodbase key is useless.
675 (TypeContainer::Populate): Call RegisterRequiredImplementations
676 before defining the methods.
678 Create a mapping for method_builders_to_methods ahead of time
679 instead of inside a tight loop.
681 (::RequireMethods): Accept an object as the data to set into the
682 hashtable so we can report interface vs abstract method mismatch.
684 2001-10-03 Miguel de Icaza <miguel@ximian.com>
686 * report.cs: Make all of it static.
688 * rootcontext.cs: Drop object_type and value_type computations, as
689 we have those in the TypeManager anyways.
691 Drop report instance variable too, now it is a global.
693 * driver.cs: Use try/catch on command line handling.
695 Add --probe option to debug the error reporting system with a test
698 * report.cs: Add support for exiting program when a probe
699 condition is reached.
701 2001-10-03 Ravi Pratap <ravi@ximian.com>
703 * expression.cs (Binary::DoNumericPromotions): Fix the case when
704 we do a forcible conversion regardless of type, to check if
705 ForceConversion returns a null.
707 (Binary::error19): Use location to report error.
709 (Unary::error23): Use location here too.
711 * ../errors/cs0019.cs : Check in.
713 * ../errors/cs0023.cs : Check in.
715 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
716 case of a non-null MethodInfo object with a length of 0 !
718 (Binary::ResolveOperator): Flag error if overload resolution fails to find
719 an applicable member - according to the spec :-)
720 Also fix logic to find members in base types.
722 (Unary::ResolveOperator): Same here.
724 (Unary::report23): Change name to error23 and make first argument a TypeContainer
725 as I was getting thoroughly confused between this and error19 :-)
727 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
728 (::FindMostEncompassedType): Implement.
729 (::FindMostEncompassingType): Implement.
730 (::StandardConversionExists): Implement.
732 (UserImplicitCast): Re-vamp. We now need info about most specific
733 source and target types so that we can do the necessary conversions.
735 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
736 mathematical union with no duplicates.
738 2001-10-03 Miguel de Icaza <miguel@ximian.com>
740 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
741 in order from base classes to child classes, so that we can in
742 child classes look up in our parent for method names and
743 attributes (required for handling abstract, virtual, new, override
744 constructs: we need to instrospect our base class, and if we dont
745 populate the classes in order, the introspection might be
746 incorrect. For example, a method could query its parent before
747 the parent has any methods and would determine that the parent has
748 no abstract methods (while it could have had them)).
750 (RootContext::CreateType): Record the order in which we define the
753 2001-10-02 Miguel de Icaza <miguel@ximian.com>
755 * class.cs (TypeContainer::Populate): Also method definitions can
756 fail now, keep track of this.
758 (TypeContainer::FindMembers): Implement support for
759 DeclaredOnly/noDeclaredOnly flag.
761 (Constructor::Emit) Return the ConstructorBuilder.
763 (Method::Emit) Return the MethodBuilder.
764 Check for abstract or virtual methods to be public.
766 * rootcontext.cs (RootContext::CreateType): Register all the
767 abstract methods required for the class to be complete and the
768 interface methods that must be implemented.
770 * cs-parser.jay: Report error 501 (method requires body if it is
771 not marked abstract or extern).
773 * expression.cs (TypeOf::Emit): Implement.
775 * typemanager.cs: runtime_handle_type, new global type.
777 * class.cs (Property::Emit): Generate code for properties.
779 2001-10-02 Ravi Pratap <ravi@ximian.com>
781 * expression.cs (Unary::ResolveOperator): Find operators on base type
782 too - we now conform exactly to the spec.
784 (Binary::ResolveOperator): Same here.
786 * class.cs (Operator::Define): Fix minor quirk in the tests.
788 * ../errors/cs0215.cs : Added.
790 * ../errors/cs0556.cs : Added.
792 * ../errors/cs0555.cs : Added.
794 2001-10-01 Miguel de Icaza <miguel@ximian.com>
796 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
797 single integer which is really efficient
799 2001-10-01 Ravi Pratap <ravi@ximian.com>
801 * expression.cs (Expression::ImplicitUserConversion): Use location
802 even in the case when we are examining True operators.
804 * class.cs (Operator::Define): Perform extensive checks to conform
805 with the rules for operator overloading in the spec.
807 * expression.cs (Expression::ImplicitReferenceConversion): Implement
808 some of the other conversions mentioned in the spec.
810 * typemanager.cs (array_type): New static member for the System.Array built-in
813 (cloneable_interface): For System.ICloneable interface.
815 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
816 we start resolving the tree and populating types.
818 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
820 2001-10-01 Miguel de Icaza <miguel@ximian.com>
822 * expression.cs (Expression::ExprClassFromMemberInfo,
823 Expression::Literalize): Create literal expressions from
824 FieldInfos which are literals.
826 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
827 type casts, because they were wrong. The test suite in tests
830 (ImplicitNumericConversion): ushort to ulong requires a widening
833 Int32 constant to long requires widening cast as well.
835 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
836 for integers because the type on the stack is not i4.
838 2001-09-30 Miguel de Icaza <miguel@ximian.com>
840 * expression.cs (report118): require location argument.
842 * parameter.cs: Do not dereference potential null value.
844 * class.cs: Catch methods that lack the `new' keyword when
845 overriding a name. Report warnings when `new' is used without
846 anything being there to override.
848 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
850 * class.cs: Only add constructor to hashtable if it is non-null
851 (as now constructors can fail on define).
853 (TypeManager, Class, Struct): Take location arguments.
855 Catch field instance initialization in structs as errors.
857 accepting_filter: a new filter for FindMembers that is static so
858 that we dont create an instance per invocation.
860 (Constructor::Define): Catch errors where a struct constructor is
863 * cs-parser.jay: Pass location information for various new
866 * delegate.cs (Delegate): take a location argument.
868 * driver.cs: Do not call EmitCode if there were problesm in the
869 Definition of the types, as many Builders wont be there.
871 * decl.cs (Decl::Decl): Require a location argument.
873 * cs-tokenizer.cs: Handle properly hex constants that can not fit
874 into integers, and find the most appropiate integer for it.
876 * literal.cs: Implement ULongLiteral.
878 * rootcontext.cs: Provide better information about the location of
879 failure when CreateType fails.
881 2001-09-29 Miguel de Icaza <miguel@ximian.com>
883 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
886 * expression.cs (Binary::CheckShiftArguments): Add missing type
888 (Binary::ResolveOperator): Add type to the logical and and logical
889 or, Bitwise And/Or and Exclusive Or code paths, it was missing
892 (Binary::DoNumericPromotions): In the case where either argument
893 is ulong (and most signed types combined with ulong cause an
894 error) perform implicit integer constant conversions as well.
896 2001-09-28 Miguel de Icaza <miguel@ximian.com>
898 * expression.cs (UserImplicitCast): Method should always be
900 (Invocation::BetterConversion): Simplified test for IntLiteral.
902 (Expression::ImplicitNumericConversion): Split this routine out.
903 Put the code that performs implicit constant integer conversions
906 (Expression::Resolve): Become a wrapper around DoResolve so we can
907 check eclass and type being set after resolve.
909 (Invocation::Badness): Remove this dead function
911 (Binary::ResolveOperator): Do not compute the expensive argumnets
912 unless we have a union for it.
914 (Probe::Emit): Is needs to do an isinst and then
915 compare against null.
917 (::CanConvert): Added Location argument. If the Location argument
918 is null (Location.Null), then we do not report errors. This is
919 used by the `probe' mechanism of the Explicit conversion. We do
920 not want to generate an error for something that the user
921 explicitly requested to be casted. But the pipeline for an
922 explicit cast first tests for potential implicit casts.
924 So for now, if the Location is null, it means `Probe only' to
925 avoid adding another argument. Might have to revise this
928 (ClassCast): New class used to type cast objects into arbitrary
929 classes (used in Explicit Reference Conversions).
931 Implement `as' as well.
933 Reverted all the patches from Ravi below: they were broken:
935 * The use of `level' as a mechanism to stop recursive
936 invocations is wrong. That was there just to catch the
937 bug with a strack trace but not as a way of addressing
940 To fix the problem we have to *understand* what is going
941 on and the interactions and come up with a plan, not
942 just get things going.
944 * The use of the type conversion cache that I proposed
945 last night had an open topic: How does this work across
946 protection domains. A user defined conversion might not
947 be public in the location where we are applying the
948 conversion, a different conversion might be selected
949 (ie, private A->B (better) but public B->A (worse),
950 inside A, A->B applies, but outside it, B->A will
953 * On top of that (ie, even if the above is solved),
954 conversions in a cache need to be abstract. Ie, `To
955 convert from an Int to a Short use an OpcodeCast', not
956 `To convert from an Int to a Short use the OpcodeCast on
957 the variable 5' (which is what this patch was doing).
959 2001-09-28 Ravi Pratap <ravi@ximian.com>
961 * expression.cs (Invocation::ConversionExists): Re-write to use
964 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
965 cache all conversions done, not just user-defined ones.
967 (Invocation::BetterConversion): The real culprit. Use ConversionExists
968 to determine if a conversion exists instead of acutually trying to
969 perform the conversion. It's faster too.
971 (Expression::ConvertExplicit): Modify to use ConversionExists to check
972 and only then attempt the implicit conversion.
974 2001-09-28 Ravi Pratap <ravi@ximian.com>
976 * expression.cs (ConvertImplicit): Use a cache for conversions
977 already found. Check level of recursion and bail out if necessary.
979 2001-09-28 Miguel de Icaza <miguel@ximian.com>
981 * typemanager.cs (string_concat_string_string, string_concat_object_object):
982 Export standard methods that we expect for string operations.
984 * statement.cs (Block::UsageWarning): Track usage of variables and
985 report the errors for not used variables.
987 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
990 2001-09-27 Miguel de Icaza <miguel@ximian.com>
992 * codegen.cs: remove unnneded code
994 * expression.cs: Removed BuiltinTypeAccess class
996 Fix the order in which implicit conversions are
999 The previous fixed dropped support for boxed conversions (adding a
1000 test to the test suite now)
1002 (UserImplicitCast::CanConvert): Remove test for source being null,
1003 that code is broken. We should not feed a null to begin with, if
1004 we do, then we should track the bug where the problem originates
1005 and not try to cover it up here.
1007 Return a resolved expression of type UserImplicitCast on success
1008 rather than true/false. Ravi: this is what I was talking about,
1009 the pattern is to use a static method as a "constructor" for
1012 Also, do not create arguments until the very last minute,
1013 otherwise we always create the arguments even for lookups that
1014 will never be performed.
1016 (UserImplicitCast::Resolve): Eliminate, objects of type
1017 UserImplicitCast are born in a fully resolved state.
1019 * typemanager.cs (InitCoreTypes): Init also value_type
1022 * expression.cs (Cast::Resolve): First resolve the child expression.
1024 (LValue): Add new method AddressOf to be used by
1027 Change the argument of Store to take an EmitContext instead of an
1028 ILGenerator, because things like FieldExpr need to be able to call
1029 their children expression to generate the instance code.
1031 (Expression::Error, Expression::Warning): Sugar functions for
1034 (Expression::MemberLookup): Accept a TypeContainer instead of a
1035 Report as the first argument.
1037 (Expression::ResolvePrimary): Killed. I still want to improve
1038 this as currently the code is just not right.
1040 (Expression::ResolveMemberAccess): Simplify, but it is still
1043 (Unary::Resolve): Catch errors in AddressOf operators.
1045 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
1046 index to a byte for the short-version, or the compiler will choose
1047 the wrong Emit call, which generates the wrong data.
1049 (ParameterReference::Emit, ::Store): same.
1051 (FieldExpr::AddressOf): Implement.
1053 * typemanager.cs: TypeManager: made public variable instead of
1056 * driver.cs: document --fatal.
1058 * report.cs (ErrorMessage, WarningMessage): new names for the old
1059 Error and Warning classes.
1061 * cs-parser.jay (member_access): Turn built-in access to types
1062 into a normal simplename
1064 2001-09-27 Ravi Pratap <ravi@ximian.com>
1066 * expression.cs (Invocation::BetterConversion): Fix to cope
1067 with q being null, since this was introducing a bug.
1069 * expression.cs (ConvertImplicit): Do built-in conversions first.
1071 2001-09-27 Ravi Pratap <ravi@ximian.com>
1073 * expression.cs (UserImplicitCast::Resolve): Fix bug.
1075 2001-09-27 Ravi Pratap <ravi@ximian.com>
1077 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
1078 I had introduced long ago (what's new ?).
1080 * expression.cs (UserImplicitCast::CanConvert): Static method to do
1081 the work of all the checking.
1082 (ConvertImplicit): Call CanConvert and only then create object if necessary.
1083 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
1085 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
1086 that is the right way.
1088 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
1089 overloading resolution. Use everywhere instead of cutting and pasting code.
1091 (Binary::ResolveOperator): Use MakeUnionSet.
1093 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
1094 we have to convert to bool types. Not complete yet.
1096 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1098 * typemanager.cs (TypeManager::CSharpName): support ushort.
1100 * expression.cs (Expression::TryImplicitIntConversion): Attempts
1101 to provide an expression that performsn an implicit constant int
1102 conversion (section 6.1.6).
1103 (Expression::ConvertImplicitRequired): Reworked to include
1104 implicit constant expression conversions.
1106 (Expression::ConvertNumericExplicit): Finished.
1108 (Invocation::Emit): If InstanceExpression is null, then it means
1109 that we perform a call on this.
1111 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1113 * expression.cs (Unary::Emit): Remove some dead code.
1114 (Probe): Implement Resolve and Emit for `is'.
1115 (Expression::ConvertImplicitRequired): Attempt to do constant
1116 expression conversions here. Maybe should be moved to
1117 ConvertImplicit, but I am not sure.
1118 (Expression::ImplicitLongConstantConversionPossible,
1119 Expression::ImplicitIntConstantConversionPossible): New functions
1120 that tell whether is it possible to apply an implicit constant
1121 expression conversion.
1123 (ConvertNumericExplicit): Started work on explicit numeric
1126 * cs-parser.jay: Update operator constants.
1128 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
1129 (Parameters::GetSignature): Hook up VerifyArgs here.
1130 (Parameters::VerifyArgs): Verifies that no two arguments have the
1133 * class.cs (Operator): Update the operator names to reflect the
1134 ones that the spec expects (as we are just stringizing the
1137 * expression.cs (Unary::ResolveOperator): Fix bug: Use
1138 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
1139 previous usage did only work for our methods.
1140 (Expression::ConvertImplicit): Handle decimal implicit numeric
1141 conversions as well.
1142 (Expression::InternalTypeConstructor): Used to invoke constructors
1143 on internal types for default promotions.
1145 (Unary::Emit): Implement special handling for the pre/post
1146 increment/decrement for overloaded operators, as they need to have
1147 the same semantics as the other operators.
1149 (Binary::ResolveOperator): ditto.
1150 (Invocation::ConversionExists): ditto.
1151 (UserImplicitCast::Resolve): ditto.
1153 2001-09-26 Ravi Pratap <ravi@ximian.com>
1155 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
1156 operator, return after emitting body. Regression tests pass again !
1158 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
1159 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
1160 (Invocation::OverloadResolve): Ditto.
1161 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
1163 * everywhere : update calls to the above methods accordingly.
1165 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1167 * assign.cs (Assign): Make it inherit from ExpressionStatement.
1169 * expression.cs (ExpressionStatement): New base class used for
1170 expressions that can appear in statements, so that we can provide
1171 an alternate path to generate expression that do not leave a value
1174 (Expression::Emit, and all the derivatives): We no longer return
1175 whether a value is left on the stack or not. Every expression
1176 after being emitted leaves a single value on the stack.
1178 * codegen.cs (EmitContext::EmitStatementExpression): Use the
1179 facilties of ExpressionStatement if possible.
1181 * cs-parser.jay: Update statement_expression.
1183 2001-09-25 Miguel de Icaza <miguel@ximian.com>
1185 * driver.cs: Change the wording of message
1187 2001-09-25 Ravi Pratap <ravi@ximian.com>
1189 * expression.cs (Binary::ResolveOperator): Had forgottten to set
1190 the type of the expression to the return type of the method if
1191 we have an overloaded operator match ! The regression tests pass again !
1192 (Unary::ResolveOperator): Ditto.
1194 * expression.cs (Invocation::ConversionExists): Correct the member lookup
1195 to find "op_Implicit", not "implicit" ;-)
1196 (UserImplicitCast): New class to take care of user-defined implicit conversions.
1197 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1199 * everywhere : Correct calls to the above accordingly.
1201 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1202 (ConvertImplicit): Do user-defined conversion if it exists.
1204 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1206 * assign.cs: track location.
1207 (Resolve): Use implicit conversions on assignment.
1209 * literal.cs: Oops. Not good, Emit of short access values should
1210 pass (Bytes) or the wrong argument will be selected.
1212 * expression.cs (Unary::Emit): Emit code for -expr.
1214 (Unary::ResolveOperator): Handle `Substract' for non-constants
1215 (substract from zero from the non-constants).
1216 Deal with Doubles as well.
1218 (Expression::ConvertImplicitRequired): New routine that reports an
1219 error if no implicit conversion exists.
1221 (Invocation::OverloadResolve): Store the converted implicit
1222 expressions if we make them
1224 2001-09-24 Ravi Pratap <ravi@ximian.com>
1226 * class.cs (ConstructorInitializer): Take a Location argument.
1227 (ConstructorBaseInitializer): Same here.
1228 (ConstructorThisInitializer): Same here.
1230 * cs-parser.jay : Update all calls accordingly.
1232 * expression.cs (Unary, Binary, New): Take location argument.
1233 Update accordingly everywhere.
1235 * cs-parser.jay : Update all calls to the above to take a location
1240 2001-09-24 Ravi Pratap <ravi@ximian.com>
1242 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1243 (Invocation::BetterConversion): Same here
1244 (Invocation::ConversionExists): Ditto.
1246 (Invocation::ConversionExists): Implement.
1248 2001-09-22 Ravi Pratap <ravi@ximian.com>
1250 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1251 Also take an additional TypeContainer argument.
1253 * All over : Pass in TypeContainer as argument to OverloadResolve.
1255 * typemanager.cs (CSharpName): Update to check for the string type and return
1258 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1261 2001-09-21 Ravi Pratap <ravi@ximian.com>
1263 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1264 (Invocation::BetterFunction): Implement.
1265 (Invocation::BetterConversion): Implement.
1266 (Invocation::ConversionExists): Skeleton, no implementation yet.
1268 Okay, things work fine !
1270 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1272 * typemanager.cs: declare and load enum_type, delegate_type and
1275 * expression.cs (Expression::Emit): Now emit returns a value that
1276 tells whether a value is left on the stack or not. This strategy
1277 might be reveted tomorrow with a mechanism that would address
1278 multiple assignments.
1279 (Expression::report118): Utility routine to report mismatches on
1282 (Unary::Report23): Report impossible type/operator combination
1285 (Unary::IsIncrementableNumber): Whether the type can be
1286 incremented or decremented with add.
1287 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1289 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1291 (Invocation::Emit): Deal with new Emit convetion.
1293 * All Expression derivatives: Updated their Emit method to return
1294 whether they leave values on the stack or not.
1296 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1297 stack for expressions that are statements.
1299 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1301 * expression.cs (LValue): New interface. Must be implemented by
1303 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1306 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1307 interface for generating code, simplifies the code.
1309 2001-09-20 Ravi Pratap <ravi@ximian.com>
1311 * expression.cs (everywhere): Comment out return statements in ::Resolve
1312 methods to avoid the warnings.
1314 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1316 * driver.cs (parse): Report error 2001 if we can not open the
1319 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1322 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1325 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1326 otherwise nested blocks end up with the same index.
1328 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1330 * expression.cs: Instead of having FIXMEs in the Resolve
1331 functions, throw exceptions so it is obvious that we are facing a
1334 * cs-parser.jay (invocation_expression): Pass Location information.
1336 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1337 Use a basename for those routines because .NET does not like paths
1340 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1343 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1345 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1346 are loading the correct data types (throws an exception if not).
1347 (TypeManager::InitCoreTypes): Use CoreLookupType
1349 * expression.cs (Unary::ResolveOperator): return the child
1350 expression for expressions which are just +expr.
1351 (Unary::ResolveOperator): Return negative literals for -LITERAL
1352 expressions (otherwise they are Unary {Literal}).
1353 (Invocation::Badness): Take into account `Implicit constant
1354 expression conversions'.
1356 * literal.cs (LongLiteral): Implement long literal class.
1357 (IntLiteral): export the `Value' of the intliteral.
1359 2001-09-19 Ravi Pratap <ravi@ximian.com>
1361 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1363 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1364 instead of 'Operator'
1366 * expression.cs (Binary::ResolveOperator): Update accordingly.
1367 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1370 * cs-parser.jay (unary_expression): Update to use the new names.
1372 * gen-treedump.cs (GetUnary): Same here.
1374 * expression.cs (Unary::Resolve): Implement.
1375 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1376 operators are found instead of making noise ;-)
1377 (Unary::ResolveOperator): New method to do precisely the same thing which
1378 Binary::ResolveOperator does for Binary expressions.
1379 (Unary.method, .Arguments): Add.
1380 (Unary::OperName): Implement.
1381 (Unary::ForceConversion): Copy and Paste !
1383 * class.cs (Operator::Define): Fix a small bug for the case when we have
1386 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1387 for the inbuilt operators. Only overloading works for now ;-)
1389 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1391 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1392 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1394 * expression.cs (This::Emit): Implement.
1395 (This::Resolve): Implement.
1396 (TypeOf:Resolve): Implement.
1397 (Expression::ResolveSimpleName): Add an implicit this to instance
1399 (MemberAccess::Resolve): Deal with Parameters and Fields.
1400 Bind instance variable to Field expressions.
1401 (FieldExpr::Instance): New field used to track the expression that
1402 represents the object instance.
1403 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1405 (FieldExpr::Emit): Implement.
1407 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1408 the last instruction contains a return opcode to avoid generating
1409 the last `ret' instruction (this generates correct code, and it is
1410 nice to pass the peverify output).
1412 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1413 initializer for static and instance variables.
1414 (Constructor::Emit): Allow initializer to be null in the case of
1415 static constructors. Only emit initializer for instance
1418 (TypeContainer::FindMembers): Return a null array if there are no
1421 Also fix the code for the MemberTypes.Method branch, as it was not
1422 scanning that for operators (or tried to access null variables before).
1424 * assign.cs (Assign::Emit): Handle instance and static fields.
1428 * driver.cs: Stop compilation if there are parse errors.
1430 * cs-parser.jay (constructor_declaration): Provide default base
1431 initializer for non-static constructors.
1432 (constructor_declarator): Do not provide a default base
1433 initializers if none was specified.
1434 Catch the fact that constructors should not have parameters.
1436 * class.cs: Do not emit parent class initializers for static
1437 constructors, that should be flagged as an error.
1439 2001-09-18 Ravi Pratap <ravi@ximian.com>
1441 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1442 Move back code into TypeContainer::Populate.
1444 2001-09-18 Ravi Pratap <ravi@ximian.com>
1446 * class.cs (TypeContainer::AddConstructor): Fix the check to
1447 compare against Name, not Basename.
1448 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1450 * cs-parser.jay : Update accordingly.
1452 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1453 for methods, don't forget to look into the operators too.
1454 (RegisterMethodBuilder): Helper method to take care of this for
1455 methods, constructors and operators.
1456 (Operator::Define): Completely revamp.
1457 (Operator.OperatorMethod, MethodName): New fields.
1458 (TypeContainer::Populate): Move the registering of builders into
1459 RegisterMethodBuilder.
1460 (Operator::Emit): Re-write.
1462 * expression.cs (Binary::Emit): Comment out code path to emit method
1463 invocation stuff for the case when we have a user defined operator. I am
1464 just not able to get it right !
1466 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1468 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1471 (Expression::MemberLookup): Provide a version that allows to
1472 specify the MemberTypes and BindingFlags.
1474 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1475 so it was not fetching variable information from outer blocks.
1477 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1478 Beforefieldinit as it was buggy.
1480 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1483 * class.cs (Constructor::Emit): Only emit if block is not null.
1484 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1485 deal with this by semantically definining it as if the user had
1488 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1489 constructors as we now "emit" them at a higher level.
1491 (TypeContainer::DefineDefaultConstructor): Used to define the
1492 default constructors if none was provided.
1494 (ConstructorInitializer): Add methods Resolve and Emit.
1496 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1498 2001-09-17 Ravi Pratap <ravi@ximian.com>
1500 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1501 the default constructor builder with our hashtable for methodbuilders
1504 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1505 and argument_count is 0 in which case we have a match.
1506 (Binary::ResolveOperator): More null checking and miscellaneous coding
1509 2001-09-17 Ravi Pratap <ravi@ximian.com>
1511 * rootcontext.cs (IsNameSpace): Compare against null.
1513 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1515 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1516 and Unary::Operator.
1518 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1521 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1522 we have overloaded operators.
1523 (Binary::ResolveOperator): Implement the part which does the operator overload
1526 * class.cs (Operator::Emit): Implement.
1527 (TypeContainer::Emit): Emit the operators we have too.
1529 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1530 the case when we have a user-defined operator.
1532 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1534 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1536 2001-09-16 Ravi Pratap <ravi@ximian.com>
1538 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1539 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1540 (Constructor::Emit): Implement.
1541 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1542 if we have no work to do.
1543 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1546 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1547 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1549 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1552 2001-09-15 Ravi Pratap <ravi@ximian.com>
1554 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1556 (Tree::RecordNamespace): Method to do what the name says ;-)
1557 (Tree::Namespaces): Property to get at the namespaces hashtable.
1559 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1562 * rootcontext.cs (IsNamespace): Fixed it :-)
1564 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1566 * class.cs (TypeContainer::FindMembers): Add support for
1568 (MethodCore): New class that encapsulates both the shared aspects
1569 of a Constructor and a Method.
1570 (Method, Constructor): Factored pieces into MethodCore.
1572 * driver.cs: Added --fatal which makes errors throw exceptions.
1573 Load System assembly as well as part of the standard library.
1575 * report.cs: Allow throwing exceptions on errors for debugging.
1577 * modifiers.cs: Do not use `parent', instead use the real type
1578 container to evaluate permission settings.
1580 * class.cs: Put Ravi's patch back in. He is right, and we will
1581 have to cope with the
1583 2001-09-14 Ravi Pratap <ravi@ximian.com>
1585 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1586 FamORAssem, not FamANDAssem.
1588 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1590 * driver.cs: Added --parse option that only parses its input files
1593 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1594 incorrect. IsTopLevel is not used to tell whether an object is
1595 root_types or not (that can be achieved by testing this ==
1596 root_types). But to see if this is a top-level *class* (not
1597 necessarly our "toplevel" container).
1599 2001-09-14 Ravi Pratap <ravi@ximian.com>
1601 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1602 parent instead of a direct call to GetType.
1604 2001-09-14 Ravi Pratap <ravi@ximian.com>
1606 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1607 Modifiers.TypeAttr. This should just be a call to that method.
1609 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1610 object so that we can determine if we are top-level or not.
1612 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1615 * enum.cs (Enum::Define): Ditto.
1617 * modifiers.cs (FieldAttr): Re-write.
1619 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1620 (TypeContainer::HaveStaticConstructor): New property to provide access
1621 to precisely that info.
1623 * modifiers.cs (MethodAttr): Re-write.
1624 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1626 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1627 of top-level types as claimed.
1629 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1631 * expression.cs (MemberLookup): Fruitless attempt to lookup
1632 constructors. Maybe I need to emit default constructors? That
1633 might be it (currently .NET emits this for me automatically).
1634 (Invocation::OverloadResolve): Cope with Arguments == null.
1635 (Invocation::EmitArguments): new function, shared by the new
1637 (Invocation::Emit): Handle static and instance methods. Emit
1638 proper call instruction for virtual or non-virtual invocations.
1639 (New::Emit): Implement.
1640 (New::Resolve): Implement.
1641 (MemberAccess:Resolve): Implement.
1642 (MethodGroupExpr::InstanceExpression): used conforming to the spec
1644 (FieldExpr::Resolve): Set type.
1646 * support.cs: Handle empty arguments.
1648 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
1649 SimpleLookup): Auxiliary routines to help parse a qualifier
1652 Update qualifier_identifier rule.
1654 * codegen.cs: Removed debugging messages.
1656 * class.cs: Make this a global thing, this acts just as a "key" to
1657 objects that we might have around.
1659 (Populate): Only initialize method_builders_to_methods once.
1661 * expression.cs (PropertyExpr): Initialize type from the
1664 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
1665 Resolve pattern. Attempt to implicitly convert value to boolean.
1668 * expression.cs: Set the type for the int32/int32 argument case.
1669 (Binary::ResolveOperator): Set the return type to boolean for
1670 comparission operators
1672 * typemanager.cs: Remove debugging print code.
1674 (Invocation::Resolve): resolve type.
1676 * class.cs: Allocate a MemberInfo of the correct size, as the code
1677 elsewhere depends on the test to reflect the correct contents.
1679 (Method::) Keep track of parameters, due to System.Reflection holes
1681 (TypeContainer::Populate): Keep track of MethodBuilders to Method
1684 (TypeContainer::FindMembers): Use ArrayList and then copy an array
1685 of the exact size and return that.
1687 (Class::LookupMethodByBuilder): New function that maps
1688 MethodBuilders to its methods. Required to locate the information
1689 on methods because System.Reflection bit us again.
1691 * support.cs: New file, contains an interface ParameterData and
1692 two implementations: ReflectionParameters and InternalParameters
1693 used to access Parameter information. We will need to grow this
1696 * expression.cs (Invocation::GetParameterData): implement a cache
1697 and a wrapper around the ParameterData creation for methods.
1698 (Invocation::OverloadResolve): Use new code.
1700 2001-09-13 Ravi Pratap <ravi@ximian.com>
1702 * class.cs (TypeContainer::EmitField): Remove and move into
1703 (Field::Define): here and modify accordingly.
1704 (Field.FieldBuilder): New member.
1705 (TypeContainer::Populate): Update accordingly.
1706 (TypeContainer::FindMembers): Implement.
1708 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1710 * statement.cs: (VariableInfo::VariableType): New field to be
1711 initialized with the full type once it is resolved.
1713 2001-09-12 Miguel de Icaza <miguel@ximian.com>
1715 * parameter.cs (GetParameterInfo): Use a type cache to compute
1716 things only once, and to reuse this information
1718 * expression.cs (LocalVariableReference::Emit): Implement.
1719 (OpcodeCast::Emit): fix.
1721 (ParameterReference::Resolve): Implement.
1722 (ParameterReference::Emit): Implement.
1724 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
1725 that are expressions need to stay as Expressions.
1727 * typemanager.cs (CSharpName): Returns the C# name of a type if
1730 * expression.cs (Expression::ConvertImplicit): New function that
1731 implements implicit type conversions.
1733 (Expression::ImplicitReferenceConversion): Implements implicit
1734 reference conversions.
1736 (EmptyCast): New type for transparent casts.
1738 (OpcodeCast): New type for casts of types that are performed with
1739 a sequence of bytecodes.
1741 (BoxedCast): New type used for casting value types into reference
1742 types. Emits a box opcode.
1744 (Binary::DoNumericPromotions): Implements numeric promotions of
1745 and computation of the Binary::Type.
1747 (Binary::EmitBranchable): Optimization.
1749 (Binary::Emit): Implement code emission for expressions.
1751 * typemanager.cs (TypeManager): Added two new core types: sbyte
1754 2001-09-12 Ravi Pratap <ravi@ximian.com>
1756 * class.cs (TypeContainer::FindMembers): Method which does exactly
1757 what Type.FindMembers does, only we don't have to use reflection. No
1760 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
1761 typecontainer objects as we need to get at them.
1762 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
1764 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
1765 typecontainer object.
1767 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
1768 of just a Report object.
1770 2001-09-11 Ravi Pratap <ravi@ximian.com>
1772 * class.cs (Event::Define): Go back to using the prefixes "add_" and
1774 (TypeContainer::Populate): Now define the delegates of the type too.
1775 (TypeContainer.Delegates): Property to access the list of delegates defined
1778 * delegates.cs (Delegate::Define): Implement partially.
1780 * modifiers.cs (TypeAttr): Handle more flags.
1782 2001-09-11 Ravi Pratap <ravi@ximian.com>
1784 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
1786 (Operator::Define): Re-write logic to get types by using the LookupType method
1787 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
1788 (Indexer::Define): Ditto.
1789 (Event::Define): Ditto.
1790 (Property::Define): Ditto.
1792 2001-09-10 Ravi Pratap <ravi@ximian.com>
1794 * class.cs (TypeContainer::Populate): Now define operators too.
1795 (TypeContainer.Operators): New property to access the list of operators
1797 (Operator.OperatorMethodBuilder): New member to hold the method builder
1798 for the operator we are defining.
1799 (Operator::Define): Implement.
1801 2001-09-10 Ravi Pratap <ravi@ximian.com>
1803 * class.cs (Event::Define): Make the prefixes of the accessor methods
1804 addOn_ and removeOn_
1806 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
1807 of the location being passed in too. Ideally, this should go later since all
1808 error reporting should be done through the Report object.
1810 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
1811 (Populate): Iterate thru the indexers we have and define them too.
1812 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
1813 for the get and set accessors.
1814 (Indexer::Define): Implement.
1816 2001-09-09 Miguel de Icaza <miguel@ximian.com>
1818 * expression.cs (Binary::Resolve): Beginning of it. I scratched
1819 my previous implementation, did not work.
1821 * typemanager.cs: Add a couple of missing types (the longs).
1823 * literal.cs: Use TypeManager.bool_type instead of getting it.
1825 * expression.cs (EventExpr): New kind of expressions.
1826 (Expressio::ExprClassFromMemberInfo): finish
1828 2001-09-08 Miguel de Icaza <miguel@ximian.com>
1830 * assign.cs: Emit stores to static fields differently.
1832 2001-09-08 Ravi Pratap <ravi@ximian.com>
1834 * Merge in changes and adjust code to tackle conflicts. Backed out my
1835 code in Assign::Resolve ;-)
1837 2001-09-08 Ravi Pratap <ravi@ximian.com>
1839 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
1840 instead Report.Error and also pass in the location.
1841 (CSharpParser::Lexer): New readonly property to return the reference
1842 to the Tokenizer object.
1843 (declare_local_variables): Use Report.Error with location instead of plain
1847 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
1848 (Operator.CheckBinaryOperator): Ditto.
1850 * cs-parser.jay (operator_declarator): Update accordingly.
1852 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
1853 (CheckBinaryOperator): Same here.
1855 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
1856 on the name without any prefixes of namespace names etc. This is because we
1857 already might have something already fully qualified like
1858 'System.Console.WriteLine'
1860 * assign.cs (Resolve): Begin implementation. Stuck ;-)
1862 2001-09-07 Ravi Pratap <ravi@ximian.com>
1864 * cs-tokenizer.cs (location): Return a string which also contains
1867 * expression.cs (ElementAccess): New class for expressions of the
1868 type 'element access.'
1869 (BaseAccess): New class for expressions of the type 'base access.'
1870 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
1873 * cs-parser.jay (element_access): Implement action.
1874 (base_access): Implement actions.
1875 (checked_expression, unchecked_expression): Implement.
1877 * cs-parser.jay (local_variable_type): Correct and implement.
1878 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
1880 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
1882 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
1883 name and the specifiers.
1885 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
1887 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
1888 making them all public ;-)
1890 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
1893 2001-09-07 Miguel de Icaza <miguel@ximian.com>
1895 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
1897 (FieldExpr, PropertyExprs): New resolved expressions.
1898 (SimpleName::MemberStaticCheck): Perform static checks for access
1899 to non-static fields on static methods. Maybe this should be
1900 generalized for MemberAccesses.
1901 (SimpleName::ResolveSimpleName): More work on simple name
1904 * cs-parser.jay (primary_expression/qualified_identifier): track
1905 the parameter index.
1907 * codegen.cs (CodeGen::Save): Catch save exception, report error.
1908 (EmitContext::EmitBoolExpression): Chain to expression generation
1909 instead of temporary hack.
1910 (::EmitStatementExpression): Put generic expression code generation.
1912 * assign.cs (Assign::Emit): Implement variable assignments to
1913 local variables, parameters and fields.
1915 2001-09-06 Miguel de Icaza <miguel@ximian.com>
1917 * statement.cs (Block::GetVariableInfo): New method, returns the
1918 VariableInfo for a variable name in a block.
1919 (Block::GetVariableType): Implement in terms of GetVariableInfo
1921 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
1922 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
1924 2001-09-06 Ravi Pratap <ravi@ximian.com>
1926 * cs-parser.jay (operator_declaration): Continue on my quest : update
1927 to take attributes argument.
1928 (event_declaration): Ditto.
1929 (enum_declaration): Ditto.
1930 (indexer_declaration): Ditto.
1932 * class.cs (Operator::Operator): Update constructor accordingly.
1933 (Event::Event): Ditto.
1935 * delegate.cs (Delegate::Delegate): Same here.
1937 * enum.cs (Enum::Enum): Same here.
1939 2001-09-05 Ravi Pratap <ravi@ximian.com>
1941 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
1943 * ../tests/cs0658.cs : New file to demonstrate error 0658.
1945 * attribute.cs (Attributes): New class to encapsulate all attributes which were
1946 being passed around as an arraylist.
1947 (Attributes::AddAttribute): Method to add attribute sections.
1949 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
1950 (struct_declaration): Update accordingly.
1951 (constant_declaration): Update.
1952 (field_declaration): Update.
1953 (method_header): Update.
1954 (fixed_parameter): Update.
1955 (parameter_array): Ditto.
1956 (property_declaration): Ditto.
1957 (destructor_declaration): Ditto.
1959 * class.cs (Struct::Struct): Update constructors accordingly.
1960 (Class::Class): Ditto.
1961 (Field::Field): Ditto.
1962 (Method::Method): Ditto.
1963 (Property::Property): Ditto.
1964 (TypeContainer::OptAttribute): update property's return type.
1966 * interface.cs (Interface.opt_attributes): New member.
1967 (Interface::Interface): Update to take the extra Attributes argument.
1969 * parameter.cs (Parameter::Parameter): Ditto.
1971 * constant.cs (Constant::Constant): Ditto.
1973 * interface.cs (InterfaceMemberBase): New OptAttributes field.
1974 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
1975 the attributes as a parameter.
1976 (InterfaceProperty): Update constructor call.
1977 (InterfaceEvent): Ditto.
1978 (InterfaceMethod): Ditto.
1979 (InterfaceIndexer): Ditto.
1981 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
1982 pass the attributes too.
1983 (interface_event_declaration): Ditto.
1984 (interface_property_declaration): Ditto.
1985 (interface_method_declaration): Ditto.
1986 (interface_declaration): Ditto.
1988 2001-09-05 Miguel de Icaza <miguel@ximian.com>
1990 * class.cs (Method::Define): Track the "static Main" definition to
1991 create an entry point.
1993 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
1994 EntryPoint if we find it.
1996 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
1997 (EmitContext::ig): Make this variable public.
1999 * driver.cs: Make the default output file be the first file name
2000 with the .exe extension.
2002 Detect empty compilations
2004 Handle various kinds of output targets. Handle --target and
2005 rename -t to --dumper.
2007 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
2008 methods inherited from Expression return now an Expression. This
2009 will is used during the tree rewriting as we resolve them during
2012 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
2013 the spec. Missing entirely is the information about
2014 accessability of elements of it.
2016 (Expression::ExprClassFromMemberInfo): New constructor for
2017 Expressions that creates a fully initialized Expression based on
2018 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
2021 (Invocation::Resolve): Begin implementing resolution of invocations.
2023 * literal.cs (StringLiteral): Implement Emit.
2025 2001-09-05 Ravi Pratap <ravi@ximian.com>
2027 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
2030 2001-09-04 Ravi Pratap <ravi@ximian.com>
2032 * cs-parser.jay (attribute_arguments): Implement actions.
2033 (attribute): Fix bug in production. Implement action.
2034 (attribute_list): Implement.
2035 (attribute_target): Implement.
2036 (attribute_target_specifier, opt_target_specifier): Implement
2037 (CheckAttributeTarget): New method to check if the attribute target
2039 (attribute_section): Implement.
2040 (opt_attributes): Implement.
2042 * attribute.cs : New file to handle attributes.
2043 (Attribute): Class to hold attribute info.
2045 * cs-parser.jay (opt_attribute_target_specifier): Remove production
2046 (attribute_section): Modify production to use 2 different rules to
2047 achieve the same thing. 1 s/r conflict down !
2048 Clean out commented, useless, non-reducing dimension_separator rules.
2050 * class.cs (TypeContainer.attributes): New member to hold list
2051 of attributes for a type.
2052 (Struct::Struct): Modify to take one more argument, the attribute list.
2053 (Class::Class): Ditto.
2054 (Field::Field): Ditto.
2055 (Method::Method): Ditto.
2056 (Property::Property): Ditto.
2058 * cs-parser.jay (struct_declaration): Update constructor call to
2059 pass in the attributes too.
2060 (class_declaration): Ditto.
2061 (constant_declaration): Ditto.
2062 (field_declaration): Ditto.
2063 (method_header): Ditto.
2064 (fixed_parameter): Ditto.
2065 (parameter_array): Ditto.
2066 (property_declaration): Ditto.
2068 * constant.cs (Constant::Constant): Update constructor similarly.
2069 Use System.Collections.
2071 * parameter.cs (Parameter::Parameter): Update as above.
2073 2001-09-02 Ravi Pratap <ravi@ximian.com>
2075 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
2076 (TypeContainer.delegates): New member to hold list of delegates.
2078 * cs-parser.jay (delegate_declaration): Implement the action correctly
2079 this time as I seem to be on crack ;-)
2081 2001-09-02 Miguel de Icaza <miguel@ximian.com>
2083 * rootcontext.cs (RootContext::IsNamespace): new function, used to
2084 tell whether an identifier represents a namespace.
2086 * expression.cs (NamespaceExpr): A namespace expression, used only
2087 temporarly during expression resolution.
2088 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
2089 utility functions to resolve names on expressions.
2091 2001-09-01 Miguel de Icaza <miguel@ximian.com>
2093 * codegen.cs: Add hook for StatementExpressions.
2095 * class.cs: Fix inverted test for static flag in methods.
2097 2001-09-02 Ravi Pratap <ravi@ximian.com>
2099 * class.cs (Operator::CheckUnaryOperator): Correct error number used
2100 to make it coincide with MS' number.
2101 (Operator::CheckBinaryOperator): Ditto.
2103 * ../errors/errors.txt : Remove error numbers added earlier.
2105 * ../errors/cs1019.cs : Test case for error # 1019
2107 * ../errros/cs1020.cs : Test case for error # 1020
2109 * cs-parser.jay : Clean out commented cruft.
2110 (dimension_separators, dimension_separator): Comment out. Ostensibly not
2111 used anywhere - non-reducing rule.
2112 (namespace_declarations): Non-reducing rule - comment out.
2114 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
2115 with TypeContainer::AddEnum.
2117 * delegate.cs : New file for delegate handling classes.
2118 (Delegate): Class for declaring delegates.
2120 * makefile : Update.
2122 * cs-parser.jay (delegate_declaration): Implement.
2124 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
2126 * class.cs (Event::Define): Implement.
2127 (Event.EventBuilder): New member.
2129 * class.cs (TypeContainer::Populate): Update to define all enums and events
2131 (Events): New property for the events arraylist we hold. Shouldn't we move to using
2132 readonly fields for all these cases ?
2134 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2136 * class.cs (Property): Revamp to use the convention of making fields readonly.
2137 Accordingly modify code elsewhere.
2139 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
2140 the Define method of the Property class.
2142 * class.cs : Clean up applied patch and update references to variables etc. Fix
2144 (TypeContainer::Populate): Update to define all the properties we have. Also
2145 define all enumerations.
2147 * enum.cs (Define): Implement.
2149 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2151 * cs-parser.jay (overloadable_operator): The semantic value is an
2152 enum of the Operator class.
2153 (operator_declarator): Implement actions.
2154 (operator_declaration): Implement.
2156 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
2157 validity of definitions.
2158 (Operator::CheckBinaryOperator): Static method to check for binary operators
2159 (TypeContainer::AddOperator): New method to add an operator to a type.
2161 * cs-parser.jay (indexer_declaration): Added line to actually call the
2162 AddIndexer method so it gets added ;-)
2164 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
2165 already taken care of by the MS compiler ?
2167 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2169 * class.cs (Operator): New class for operator declarations.
2170 (Operator::OpType): Enum for the various operators.
2172 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2174 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
2175 ostensibly handle this in semantic analysis.
2177 * cs-parser.jay (general_catch_clause): Comment out
2178 (specific_catch_clauses, specific_catch_clause): Ditto.
2179 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
2180 (catch_args, opt_catch_args): New productions.
2181 (catch_clause): Rewrite to use the new productions above
2182 (catch_clauses): Modify accordingly.
2183 (opt_catch_clauses): New production to use in try_statement
2184 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
2185 and re-write the code in the actions to extract the specific and
2186 general catch clauses by being a little smart ;-)
2188 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
2189 Hooray, try and catch statements parse fine !
2191 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2193 * statement.cs (Block::GetVariableType): Fix logic to extract the type
2194 string from the hashtable of variables.
2196 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
2197 I end up making that mistake ;-)
2198 (catch_clauses): Fixed gross error which made Key and Value of the
2199 DictionaryEntry the same : $1 !!
2201 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2203 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2205 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2206 when the add and remove accessors are specified.
2208 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2210 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2211 information about indexer_declarator.
2212 (indexer_declarator): Implement actions.
2213 (parsing_indexer): New local boolean used to keep track of whether
2214 we are parsing indexers or properties. This is necessary because
2215 implicit_parameters come into picture even for the get accessor in the
2217 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2219 * class.cs (Indexer): New class for indexer declarations.
2220 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2221 (TypeContainer::indexers): New member to hold list of indexers for the
2224 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2226 * cs-parser.jay (add_accessor_declaration): Implement action.
2227 (remove_accessor_declaration): Implement action.
2228 (event_accessors_declaration): Implement
2229 (variable_declarators): swap statements for first rule - trivial.
2231 * class.cs (Event): New class to hold information about event
2233 (TypeContainer::AddEvent): New method to add an event to a type
2234 (TypeContainer::events): New member to hold list of events.
2236 * cs-parser.jay (event_declaration): Implement actions.
2238 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2240 * cs-parser.jay (dim_separators): Implement. Make it a string
2241 concatenating all the commas together, just as they appear.
2242 (opt_dim_separators): Modify accordingly
2243 (rank_specifiers): Update accordingly. Basically do the same
2244 thing - instead, collect the brackets here.
2245 (opt_rank_sepcifiers): Modify accordingly.
2246 (array_type): Modify to actually return the complete type string
2247 instead of ignoring the rank_specifiers.
2248 (expression_list): Implement to collect the expressions
2249 (variable_initializer): Implement. We make it a list of expressions
2250 essentially so that we can handle the array_initializer case neatly too.
2251 (variable_initializer_list): Implement.
2252 (array_initializer): Make it a list of variable_initializers
2253 (opt_array_initializer): Modify accordingly.
2255 * expression.cs (New::NType): Add enumeration to help us
2256 keep track of whether we have an object/delegate creation
2257 or an array creation.
2258 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2259 members to hold data about array creation.
2260 (New:New): Modify to update NewType
2261 (New:New): New Overloaded contructor for the array creation
2264 * cs-parser.jay (array_creation_expression): Implement to call
2265 the overloaded New constructor.
2267 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2269 * class.cs (TypeContainer::Constructors): Return member
2270 constructors instead of returning null.
2272 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2274 * typemanager.cs (InitCoreTypes): Initialize the various core
2275 types after we have populated the type manager with the user
2276 defined types (this distinction will be important later while
2277 compiling corlib.dll)
2279 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2280 on Expression Classification. Now all expressions have a method
2281 `Resolve' and a method `Emit'.
2283 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2284 generation from working. Also add some temporary debugging
2287 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2289 * codegen.cs: Lots of code generation pieces. This is only the
2290 beginning, will continue tomorrow with more touches of polish. We
2291 handle the fundamentals of if, while, do, for, return. Others are
2292 trickier and I need to start working on invocations soon.
2294 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2297 * codegen.cs (EmitContext): New struct, used during code
2298 emission to keep a context. Most of the code generation will be
2301 * cs-parser.jay: Add embedded blocks to the list of statements of
2302 this block. So code generation proceeds in a top down fashion.
2304 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2306 * statement.cs: Add support for multiple child blocks.
2308 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2310 * codegen.cs (EmitCode): New function, will emit the code for a
2311 Block of code given a TypeContainer and its ILGenerator.
2313 * statement.cs (Block): Standard public readonly optimization.
2314 (Block::Block constructors): Link children.
2315 (Block::Child): Child Linker.
2316 (Block::EmitVariables): Emits IL variable declarations.
2318 * class.cs: Drop support for MethodGroups here, delay until
2320 (Method::): Applied the same simplification that I did before, and
2321 move from Properties to public readonly fields.
2322 (Method::ParameterTypes): Returns the parameter types for the
2323 function, and implements a cache that will be useful later when I
2324 do error checking and the semantic analysis on the methods is
2326 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2327 and made a method, optional argument tells whether this is a class
2328 or a structure to apply the `has-this' bit.
2329 (Method::GetCallingConvention): Implement, returns the calling
2331 (Method::Define): Defines the type, a second pass is performed
2332 later to populate the methods.
2334 (Constructor::ParameterTypes): implement a cache similar to the
2335 one on Method::ParameterTypes, useful later when we do semantic
2338 (TypeContainer::EmitMethod): New method. Emits methods.
2340 * expression.cs: Removed MethodGroup class from here.
2342 * parameter.cs (Parameters::GetCallingConvention): new method.
2344 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2346 * class.cs (TypeContainer::Populate): Drop RootContext from the
2349 (Constructor::CallingConvention): Returns the calling convention.
2350 (Constructor::ParameterTypes): Returns the constructor parameter
2353 (TypeContainer::AddConstructor): Keep track of default constructor
2354 and the default static constructor.
2356 (Constructor::) Another class that starts using `public readonly'
2357 instead of properties.
2359 (Constructor::IsDefault): Whether this is a default constructor.
2361 (Field::) use readonly public fields instead of properties also.
2363 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2364 track of static constructors; If none is used, turn on
2365 BeforeFieldInit in the TypeAttributes.
2367 * cs-parser.jay (opt_argument_list): now the return can be null
2368 for the cases where there are no arguments.
2370 (constructor_declarator): If there is no implicit `base' or
2371 `this', then invoke the default parent constructor.
2373 * modifiers.cs (MethodAttr): New static function maps a set of
2374 modifiers flags into a MethodAttributes enum
2375 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2376 MethodAttr, TypeAttr to represent the various mappings where the
2378 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2380 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2382 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2385 * interface.cs (PopulateIndexer): Implemented the code generator
2386 for interface indexers.
2388 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2390 * interface.cs (InterfaceMemberBase): Now we track the new status
2393 (PopulateProperty): Implement property population. Woohoo! Got
2394 Methods and Properties going today.
2396 Removed all the properties for interfaces, and replaced them with
2397 `public readonly' fields.
2399 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2401 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2402 initialize their hashtables/arraylists only when they are needed
2403 instead of doing this always.
2405 * parameter.cs: Handle refs and out parameters.
2407 * cs-parser.jay: Use an ArrayList to construct the arguments
2408 instead of the ParameterCollection, and then cast that to a
2411 * parameter.cs: Drop the use of ParameterCollection and use
2412 instead arrays of Parameters.
2414 (GetParameterInfo): Use the Type, not the Name when resolving
2417 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2419 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2420 and instead use public readonly fields.
2422 * class.cs: Put back walking code for type containers.
2424 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2426 * class.cs (MakeConstant): Code to define constants.
2428 * rootcontext.cs (LookupType): New function. Used to locate types
2431 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2433 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2434 this System.Reflection code is. Kudos to Microsoft
2436 * typemanager.cs: Implement a type cache and avoid loading all
2437 types at boot time. Wrap in LookupType the internals. This made
2438 the compiler so much faster. Wow. I rule!
2440 * driver.cs: Make sure we always load mscorlib first (for
2441 debugging purposes, nothing really important).
2443 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2444 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2446 * rootcontext.cs: Lookup types on their namespace; Lookup types
2447 on namespaces that have been imported using the `using' keyword.
2449 * class.cs (TypeContainer::TypeAttr): Virtualize.
2450 (Class::TypeAttr): Return attributes suitable for this bad boy.
2451 (Struct::TypeAttr): ditto.
2452 Handle nested classes.
2453 (TypeContainer::) Remove all the type visiting code, it is now
2454 replaced with the rootcontext.cs code
2456 * rootcontext.cs (GetClassBases): Added support for structs.
2458 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2460 * interface.cs, statement.cs, class.cs, parameter.cs,
2461 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2462 Drop use of TypeRefs, and use strings instead.
2464 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2468 * class.cs (Struct::Struct): set the SEALED flags after
2469 checking the modifiers.
2470 (TypeContainer::TypeAttr): new property, returns the
2471 TypeAttributes for a class.
2473 * cs-parser.jay (type_list): Oops, list production was creating a
2474 new list of base types.
2476 * rootcontext.cs (StdLib): New property.
2477 (GetInterfaceTypeByName): returns an interface by type name, and
2478 encapsulates error handling here.
2479 (GetInterfaces): simplified.
2480 (ResolveTree): Encapsulated all the tree resolution here.
2481 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2484 * driver.cs: Add support for --nostdlib, to avoid loading the
2486 (Main): Do not put tree resolution here.
2488 * rootcontext.cs: Beginning of the class resolution.
2490 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2492 * rootcontext.cs: Provide better error reporting.
2494 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2496 * rootcontext.cs (CreateInterface): Handle the case where there
2497 are no parent interfaces.
2499 (CloseTypes): Routine to flush types at the end.
2500 (CreateInterface): Track types.
2501 (GetInterfaces): Returns an array of Types from the list of
2504 * typemanager.c (AddUserType): Mechanism to track user types (puts
2505 the type on the global type hash, and allows us to close it at the
2508 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2510 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2511 RecordInterface instead.
2513 * cs-parser.jay: Updated to reflect changes above.
2515 * decl.cs (Definition): Keep track of the TypeBuilder type that
2516 represents this type here. Not sure we will use it in the long
2517 run, but wont hurt for now.
2519 * driver.cs: Smaller changes to accomodate the new code.
2521 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2524 * rootcontext.cs (CreateInterface): New method, used to create
2525 the System.TypeBuilder type for interfaces.
2526 (ResolveInterfaces): new entry point to resolve the interface
2528 (CodeGen): Property, used to keep track of the code generator.
2530 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2532 * cs-parser.jay: Add a second production for delegate_declaration
2535 (enum_body): Put an opt_comma here instead of putting it on
2536 enum_body or enum_member_declarations so we can handle trailing
2537 commas on enumeration members. Gets rid of a shift/reduce.
2539 (type_list): Need a COMMA in the middle.
2541 (indexer_declaration): Tell tokenizer to recognize get/set
2543 * Remove old targets.
2545 * Re-add the parser target.
2547 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2549 * cs-parser.jay: Add precendence rules for a number of operators
2550 ot reduce the number of shift/reduce conflicts in the grammar.
2552 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2554 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2557 Get rid of old crufty code.
2559 * rootcontext.cs: Use this to keep track of the parsed
2560 representation and the defined types available to the program.
2562 * gen-treedump.cs: adjust for new convention.
2564 * type.cs: Split out the type manager, and the assembly builder
2567 * typemanager.cs: the type manager will live here now.
2569 * cil-codegen.cs: And the code generator here.
2571 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2573 * makefile: Fixed up for easy making.
2575 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2577 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2580 (unary_expression): Expand pre_increment_expression and
2581 post_decrement_expression to reduce a shift/reduce.
2583 2001-07-11 Simon Cozens
2585 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2587 Improve allow_keyword_as_indent name.
2589 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2591 * Adjustments for Beta2.
2593 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2595 * decl.cs: Added `Define' abstract method.
2596 (InTransit): new property, used to catch recursive definitions.
2598 * interface.cs: Implement `Define'.
2600 * modifiers.cs: Map Modifiers.constants to
2601 System.Reflection.TypeAttribute flags.
2603 * class.cs: Keep track of types and user-defined types.
2604 (BuilderInit): New method for creating an assembly
2605 (ResolveType): New function to launch the resolution process, only
2606 used by interfaces for now.
2608 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2609 that are inserted into the name space.
2611 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2613 * ARGH. I have screwed up my tree so many times due to the use of
2614 rsync rather than using CVS. Going to fix this at once.
2616 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2619 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2621 * Experiment successful: Use System.Type rather that our own
2624 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2626 * cs-parser.jay: Removed nsAliases from here.
2628 Use new namespaces, handle `using XXX;'
2630 * namespace.cs: Reimplemented namespace handling, use a recursive
2631 definition of the class. Now we can keep track of using clauses
2632 and catch invalid using clauses.
2634 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2636 * gen-treedump.cs: Adapted for all the renaming.
2638 * expression.cs (Expression): this class now has a Type property
2639 which returns an expression Type.
2641 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2642 `Type', as this has a different meaning now in the base
2644 2001-05-22 Miguel de Icaza <miguel@ximian.com>
2646 * interface.cs, class.cs: Removed from all the sources the
2647 references to signature computation, as we can not do method
2648 signature computation during the parsing time, as we are not
2649 trying to solve at that point distinguishing:
2653 void a (NS.Blah x) {}
2656 Which depending on the context might be valid or not, as we do not
2657 know if Blah is the same thing as NS.Blah at that point.
2659 * Redid everything so the code uses TypeRefs now instead of
2660 Types. TypeRefs are just temporary type placeholders, that need
2661 to be resolved. They initially have a pointer to a string and the
2662 current scope in which they are used. This is used later by the
2663 compiler to resolve the reference to an actual Type.
2665 * DeclSpace is no longer a CIR.Type, and neither are
2666 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
2667 are all DeclSpaces, but no Types.
2669 * type.cs (TypeRefManager): This implements the TypeRef manager,
2670 which keeps track of all the types that need to be resolved after
2671 the parsing has finished.
2673 2001-05-13 Miguel de Icaza <miguel@ximian.com>
2675 * ARGH. We are going to have to store `foreach' as a class rather
2676 than resolving it, as we need to verify error 1579 after name
2677 resolution. *OR* we could keep a flag that says `This request to
2678 IEnumerator comes from a foreach statement' which we can then use
2679 to generate the error.
2681 2001-05-10 Miguel de Icaza <miguel@ximian.com>
2683 * class.cs (TypeContainer.AddMethod): we now add methods to the
2684 MethodGroup instead of the method hashtable.
2686 * expression.cs: Add MethodGroup abstraction, which gets us one
2687 step closer to the specification in the way we handle method
2690 * cs-parser.jay (primary_expression): qualified_identifier now
2691 tried to match up an identifier to a local variable reference or
2692 to a parameter reference.
2694 current_local_parameters is now a parser global variable that
2695 points to the current parameters for the block, used during name
2698 (property_declaration): Now creates an implicit `value' argument to
2701 2001-05-09 Miguel de Icaza <miguel@ximian.com>
2703 * parameter.cs: Do not use `param' arguments as part of the
2704 signature, per the spec.
2706 2001-05-08 Miguel de Icaza <miguel@ximian.com>
2708 * decl.cs: Base class for classes, structs and interfaces. This
2709 is the "Declaration Space"
2711 * cs-parser.jay: Use CheckDef for checking declaration errors
2712 instead of having one on each function.
2714 * class.cs: Factor out some code for handling error handling in
2715 accordance to the "Declarations" section in the "Basic Concepts"
2716 chapter in the ECMA C# spec.
2718 * interface.cs: Make all interface member classes derive from
2719 InterfaceMemberBase.
2721 2001-05-07 Miguel de Icaza <miguel@ximian.com>
2723 * Many things: all interfaces are parsed and generated in
2724 gen-treedump. Support for member variables, constructors,
2725 destructors, properties, constants is there.
2727 Beginning of the IL backend, but very little done, just there for
2730 2001-04-29 Miguel de Icaza <miguel@ximian.com>
2732 * cs-parser.jay: Fix labeled statement.
2734 * cs-tokenizer.cs (escape): Escape " and ' always.
2735 ref_line, ref_name: keep track of the line/filename as instructed
2736 by #line by the compiler.
2739 2001-04-27 Miguel de Icaza <miguel@ximian.com>
2741 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
2742 to match the values in System.CodeDOM.
2744 Divid renamed to Divide.
2746 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
2748 (Statements.set): remove.
2750 * System.CodeDOM/CodeCatchClause.cs: always have a valid
2753 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
2754 falseStatements always have valid values.
2756 * cs-parser.jay: Use System.CodeDOM now.