1 2001-11-11 Ravi Pratap <ravi@ximian.com>
3 * enum.cs (Emit): Rename to Populate to be more consistent with what
4 we expect it to do and when exactly it is called.
6 * class.cs, rootcontext.cs : Update accordingly.
8 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
11 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
13 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
14 of a fieldinfo using the above, when dealing with a FieldBuilder.
16 2001-11-10 Ravi Pratap <ravi@ximian.com>
18 * ../errors/cs0031.cs : Add.
20 * ../errors/cs1008.cs : Add.
22 * ../errrors/cs0543.cs : Add.
24 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
27 (FindMembers): Implement.
29 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
30 enums and delegates too.
32 (enum_types): Rename to builder_to_enum.
34 (delegate_types): Rename to builder_to_delegate.
36 * delegate.cs (FindMembers): Implement.
38 2001-11-09 Ravi Pratap <ravi@ximian.com>
40 * typemanager.cs (IsEnumType): Implement.
42 * enum.cs (Emit): Re-write parts to account for the underlying type
43 better and perform checking etc.
45 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
46 of the underlying type.
48 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
51 * enum.cs (error31): Helper to report error #31.
53 * cs-parser.jay (enum_declaration): Store location of each member too.
55 * enum.cs (member_to_location): New hashtable.
57 (AddEnumMember): Update location hashtable.
59 (Emit): Use the location of each member while reporting errors.
61 2001-11-09 Miguel de Icaza <miguel@ximian.com>
63 * cs-parser.jay: A for_initializer if is a
64 local_variable_declaration really ammount to have an implicit
65 block with the variable declaration and no initializer for for.
67 * statement.cs (For.Emit): Cope with null initializers.
69 This fixes the infinite loop on for initializers.
71 2001-11-08 Miguel de Icaza <miguel@ximian.com>
73 * enum.cs: More cleanup.
75 * ecore.cs: Remove dead code.
77 * class.cs (Property.Emit): More simplification.
80 Reworked to have less levels of indentation.
82 2001-11-08 Ravi Pratap <ravi@ximian.com>
84 * class.cs (Property): Emit attributes.
94 * enum.cs (Emit): Ditto.
96 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
99 * class.cs (Field, Event, etc.): Move attribute generation into the
100 Emit method everywhere.
102 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
103 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
104 as we had no way of defining nested enums !
106 * rootcontext.cs : Adjust code accordingly.
108 * typemanager.cs (AddEnumType): To keep track of enum types separately.
110 2001-11-07 Ravi Pratap <ravi@ximian.com>
112 * expression.cs (EvalConstantExpression): Move into ecore.cs
114 * enum.cs (Enum): Rename some members and make them public and readonly
115 according to our convention.
117 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
120 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
122 (Enum::Emit): Write a simple version for now which doesn't try to compute
123 expressions. I shall modify this to be more robust in just a while.
125 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
127 (TypeContainer::CloseType): Create the Enum types too.
129 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
131 * expression.cs (EvalConstantExpression): Get rid of completely.
133 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
134 user-defined values and other cases.
136 (IsValidEnumLiteral): Helper function.
138 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
139 out there in the case we had a literal FieldExpr.
141 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
143 (Literalize): Revamp a bit to take two arguments.
145 (EnumLiteral): New class which derives from Literal to wrap enum literals.
147 2001-11-06 Ravi Pratap <ravi@ximian.com>
149 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
151 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
153 (Resolve): Use the above to ensure we have proper initializers.
155 2001-11-05 Ravi Pratap <ravi@ximian.com>
157 * expression.cs (Expression::EvalConstantExpression): New method to
158 evaluate constant expressions.
160 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
162 2001-11-07 Miguel de Icaza <miguel@ximian.com>
164 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
167 (Binary.ResolveOperator): Handle operator != (object a, object b)
168 and operator == (object a, object b);
170 (Binary.DoNumericPromotions): Indicate whether the numeric
171 promotion was possible.
173 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
176 Made the ArrayAccess implement interface IAssignMethod instead of
177 IStackStore as the order in which arguments are passed reflects
180 * assign.cs: Instead of using expr.ExprClass to select the way of
181 assinging, probe for the IStackStore/IAssignMethod interfaces.
183 * typemanager.cs: Load InitializeArray definition.
185 * rootcontext.cs (RootContext.MakeStaticData): Used to define
186 static data that can be used to initialize arrays.
188 2001-11-05 Miguel de Icaza <miguel@ximian.com>
190 * expression.cs: Handle operator== and operator!= for booleans.
192 (Conditioal.Reduce): Implement reducer for the ?: operator.
194 (Conditional.Resolve): Implement dead code elimination.
196 (Binary.Resolve): Catch string literals and return a new
199 (Unary.Reduce): Implement reduction of unary expressions.
201 * ecore.cs: Split out the expression core handling here.
203 (Expression.Reduce): New method used to perform constant folding
204 and CSE. This is needed to support constant-expressions.
206 * statement.cs (Statement.EmitBoolExpression): Pass true and false
207 targets, and optimize for !x.
209 2001-11-04 Ravi Pratap <ravi@ximian.com>
211 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
212 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
213 set custom atttributes.
215 * literal.cs (Literal::GetValue): New abstract method to return the actual
216 value of the literal, cast as an object.
218 (*Literal): Implement GetValue method.
220 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
221 expressions to the arraylist but objects of type Argument.
223 * class.cs (TypeContainer::Emit): Emit our attributes too.
225 (Method::Emit, Constructor::Emit): Ditto.
227 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
228 to be ignoring earlier.
230 2001-11-03 Ravi Pratap <ravi@ximian.com>
232 * attribute.cs (AttributeSection::Define): Implement to do the business
233 of constructing a CustomAttributeBuilder.
235 (Attribute): New trivial class. Increases readability of code.
237 * cs-parser.jay : Update accordingly.
239 (positional_argument_list, named_argument_list, named_argument): New rules
241 (attribute_arguments): Use the above so that we are more correct.
243 2001-11-02 Ravi Pratap <ravi@ximian.com>
245 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
246 to perform all checks for a method with a params parameter.
248 (Invocation::OverloadResolve): Update to use the above method and therefore
249 cope correctly with params method invocations.
251 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
254 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
255 constructors in our parent too because we can't afford to miss out on
258 * attribute.cs (AttributeSection): New name for the class Attribute
260 Other trivial changes to improve readability.
262 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
263 use the new class names.
265 2001-11-01 Ravi Pratap <ravi@ximian.com>
267 * class.cs (Method::Define): Complete definition for params types too
269 (Indexer::Define): Ditto.
271 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
272 Cope everywhere with a request for info about the array parameter.
274 2001-11-01 Ravi Pratap <ravi@ximian.com>
276 * tree.cs (RecordNamespace): Fix up to check for the correct key.
278 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
279 local_variable_type to extract the string corresponding to the type.
281 (local_variable_type): Fixup the action to use the new helper method.
283 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
286 * expression.cs : Clean out code which uses the above.
288 2001-10-31 Ravi Pratap <ravi@ximian.com>
290 * typemanager.cs (RegisterMethod): Check if we already have an existing key
291 and bale out if necessary by returning a false.
293 (RegisterProperty): Ditto.
295 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
296 and print out appropriate error messages.
298 * interface.cs (everywhere): Ditto.
300 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
301 location to constructor.
303 * class.cs (Property, Event, Indexer): Update accordingly.
305 * ../errors/cs111.cs : Added.
307 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
308 of a method, as laid down by the spec.
310 (Invocation::OverloadResolve): Use the above method.
312 2001-10-31 Ravi Pratap <ravi@ximian.com>
314 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
315 now take a TypeContainer and a Parameters object.
317 (ParameterData): Modify return type of ParameterModifier method to be
318 Parameter.Modifier and not a string.
320 (ReflectionParameters, InternalParameters): Update accordingly.
322 * expression.cs (Argument::GetParameterModifier): Same here.
324 * support.cs (InternalParameters::ParameterType): Find a better way of determining
325 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
326 symbol in it at all so maybe this is only for now.
328 2001-10-30 Ravi Pratap <ravi@ximian.com>
330 * support.cs (InternalParameters): Constructor now takes an extra argument
331 which is the actual Parameters class.
333 (ParameterDesc): Update to provide info on ref/out modifiers.
335 * class.cs (everywhere): Update call to InternalParameters to pass in
336 the second argument too.
338 * support.cs (ParameterData): Add ParameterModifier, which is a method
339 to return the modifier info [ref/out etc]
341 (InternalParameters, ReflectionParameters): Implement the above.
343 * expression.cs (Argument::ParameterModifier): Similar function to return
344 info about the argument's modifiers.
346 (Invocation::OverloadResolve): Update to take into account matching modifiers
349 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
350 a new SetFormalParameters object which we pass to InternalParameters.
352 2001-10-30 Ravi Pratap <ravi@ximian.com>
354 * expression.cs (NewArray): Merge into the ArrayCreation class.
356 2001-10-29 Ravi Pratap <ravi@ximian.com>
358 * expression.cs (NewArray): Merge classes NewBuiltinArray and
359 NewUserdefinedArray into one as there wasn't much of a use in having
362 * expression.cs (Argument): Change field's name to ArgType from Type.
364 (Type): New readonly property which returns the proper type, taking into
365 account ref/out modifiers.
367 (everywhere): Adjust code accordingly for the above.
369 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
370 whether we are emitting for a ref or out parameter.
372 * expression.cs (Argument::Emit): Use the above field to set the state.
374 (LocalVariableReference::Emit): Update to honour the flag and emit the
377 * parameter.cs (Attributes): Set the correct flags for ref parameters.
379 * expression.cs (Argument::FullDesc): New function to provide a full desc.
381 * support.cs (ParameterData): Add method ParameterDesc to the interface.
383 (ReflectionParameters, InternalParameters): Implement the above method.
385 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
388 (Invocation::FullMethodDesc): Ditto.
390 2001-10-29 Miguel de Icaza <miguel@ximian.com>
392 * cs-parser.jay: Add extra production for the second form of array
395 * expression.cs (ArrayCreation): Update to reflect the above
398 * Small changes to prepare for Array initialization.
400 2001-10-28 Miguel de Icaza <miguel@ximian.com>
402 * typemanager.cs (ImplementsInterface): interface might be null;
403 Deal with this problem;
405 Also, we do store negative hits on the cache (null values), so use
406 this instead of calling t.GetInterfaces on the type everytime.
408 2001-10-28 Ravi Pratap <ravi@ximian.com>
410 * typemanager.cs (IsBuiltinType): New method to help determine the same.
412 * expression.cs (New::DoResolve): Get rid of array creation code and instead
413 split functionality out into different classes.
415 (New::FormArrayType): Move into NewBuiltinArray.
417 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
420 (NewBuiltinArray): New class to handle creation of built-in arrays.
422 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
423 account creation of one-dimensional arrays.
425 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
427 (NewUserdefinedArray::DoResolve): Implement.
429 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
431 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
432 we maintain inside the TypeManager. This is necessary to perform lookups on the
435 (LookupType): Update to perform GetType on the module builders too.
437 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
439 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
441 2001-10-23 Ravi Pratap <ravi@ximian.com>
443 * expression.cs (New::DoResolve): Implement guts of array creation.
445 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
447 2001-10-27 Miguel de Icaza <miguel@ximian.com>
449 * expression.cs: Fix bug I introduced lsat night that broke
452 (Expression.Resolve): Report a 246 error (can not resolve name)
453 if we find a SimpleName in the stream.
455 (Expression.ResolveLValue): Ditto.
457 (Expression.ResolveWithSimpleName): This function is a variant of
458 ResolveName, this one allows SimpleNames to be returned without a
459 warning. The only consumer of SimpleNames is MemberAccess
461 2001-10-26 Miguel de Icaza <miguel@ximian.com>
463 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
464 might arrive here. I have my doubts that this is correct.
466 * statement.cs (Lock): Implement lock statement.
468 * cs-parser.jay: Small fixes to support `lock' and `using'
470 * cs-tokenizer.cs: Remove extra space
472 * driver.cs: New flag --checked, allows to turn on integer math
475 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
476 Threading.Monitor.Exit
478 2001-10-23 Miguel de Icaza <miguel@ximian.com>
480 * expression.cs (IndexerAccess::DoResolveLValue): Set the
481 Expression Class to be IndexerAccess.
483 Notice that Indexer::DoResolve sets the eclass to Value.
485 2001-10-22 Miguel de Icaza <miguel@ximian.com>
487 * class.cs (TypeContainer::Emit): Emit code for indexers.
489 * assign.cs (IAssignMethod): New interface implemented by Indexers
490 and Properties for handling assignment.
492 (Assign::Emit): Simplify and reuse code.
494 * expression.cs (IndexerAccess, PropertyExpr): Implement
495 IAssignMethod, clean up old code.
497 2001-10-22 Ravi Pratap <ravi@ximian.com>
499 * typemanager.cs (ImplementsInterface): New method to determine if a type
500 implements a given interface. Provides a nice cache too.
502 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
505 (ConvertReferenceExplicit): Ditto.
507 * delegate.cs (Delegate::Populate): Update to define the parameters on the
508 various methods, with correct names etc.
510 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
511 Operator.UnaryNegation.
513 * cs-parser.jay (operator_declarator): Be a little clever in the case where
514 we have a unary plus or minus operator.
516 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
519 * everywhere : update accordingly.
521 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
524 * class.cs (Method::Define): For the case where we are implementing a method
525 inherited from an interface, we need to set the MethodAttributes.Final flag too.
526 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
528 2001-10-21 Ravi Pratap <ravi@ximian.com>
530 * interface.cs (FindMembers): Implement to work around S.R.E
533 * typemanager.cs (IsInterfaceType): Implement.
535 (FindMembers): Update to handle interface types too.
537 * expression.cs (ImplicitReferenceConversion): Re-write bits which
538 use IsAssignableFrom as that is not correct - it doesn't work.
540 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
541 and accordingly override EmitStatement.
543 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
544 using the correct logic :-)
546 2001-10-19 Ravi Pratap <ravi@ximian.com>
548 * ../errors/cs-11.cs : Add to demonstrate error -11
550 2001-10-17 Miguel de Icaza <miguel@ximian.com>
552 * assign.cs (Assign::Resolve): Resolve right hand side first, and
553 then pass this as a hint to ResolveLValue.
555 * expression.cs (FieldExpr): Add Location information
557 (FieldExpr::LValueResolve): Report assignment to readonly
560 (Expression::ExprClassFromMemberInfo): Pass location information.
562 (Expression::ResolveLValue): Add new method that resolves an
565 (Expression::DoResolveLValue): Default invocation calls
568 (Indexers): New class used to keep track of indexers in a given
571 (IStackStore): Renamed from LValue, as it did not really describe
572 what this did. Also ResolveLValue is gone from this interface and
573 now is part of Expression.
575 (ElementAccess): Depending on the element access type
577 * typemanager.cs: Add `indexer_name_type' as a Core type
578 (System.Runtime.CompilerServices.IndexerNameAttribute)
580 * statement.cs (Goto): Take a location.
582 2001-10-18 Ravi Pratap <ravi@ximian.com>
584 * delegate.cs (Delegate::VerifyDelegate): New method to verify
585 if two delegates are compatible.
587 (NewDelegate::DoResolve): Update to take care of the case when
588 we instantiate a delegate from another delegate.
590 * typemanager.cs (FindMembers): Don't even try to look up members
591 of Delegate types for now.
593 2001-10-18 Ravi Pratap <ravi@ximian.com>
595 * delegate.cs (NewDelegate): New class to take care of delegate
598 * expression.cs (New): Split the delegate related code out into
599 the NewDelegate class.
601 * delegate.cs (DelegateInvocation): New class to handle delegate
604 * expression.cs (Invocation): Split out delegate related code into
605 the DelegateInvocation class.
607 2001-10-17 Ravi Pratap <ravi@ximian.com>
609 * expression.cs (New::DoResolve): Implement delegate creation fully
610 and according to the spec.
612 (New::DoEmit): Update to handle delegates differently.
614 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
615 because of which we were printing out arguments in reverse order !
617 * delegate.cs (VerifyMethod): Implement to check if the given method
618 matches the delegate.
620 (FullDelegateDesc): Implement.
622 (VerifyApplicability): Implement.
624 * expression.cs (Invocation::DoResolve): Update to accordingly handle
625 delegate invocations too.
627 (Invocation::Emit): Ditto.
629 * ../errors/cs1593.cs : Added.
631 * ../errors/cs1594.cs : Added.
633 * delegate.cs (InstanceExpression, TargetMethod): New properties.
635 2001-10-16 Ravi Pratap <ravi@ximian.com>
637 * typemanager.cs (intptr_type): Core type for System.IntPtr
639 (InitCoreTypes): Update for the same.
641 (iasyncresult_type, asynccallback_type): Ditto.
643 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
646 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
649 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
650 the builders for the 4 members of a delegate type :-)
652 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
655 * expression.cs (New::DoResolve): Implement guts for delegate creation.
657 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
659 2001-10-15 Miguel de Icaza <miguel@ximian.com>
661 * statement.cs (Break::Emit): Implement.
662 (Continue::Emit): Implement.
664 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
665 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
666 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
667 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
670 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
671 properties that track the label for the current loop (begin of the
672 loop and end of the loop).
674 2001-10-15 Ravi Pratap <ravi@ximian.com>
676 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
677 use of emitting anything at all.
679 * class.cs, rootcontext.cs : Get rid of calls to the same.
681 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
683 (Populate): Define the constructor correctly and set the implementation
686 * typemanager.cs (delegate_types): New hashtable to hold delegates that
689 (AddDelegateType): Implement.
691 (IsDelegateType): Implement helper method.
693 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
695 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
696 and accordingly handle it.
698 * delegate.cs (Populate): Take TypeContainer argument.
699 Implement bits to define the Invoke method. However, I still haven't figured out
700 how to take care of the native int bit :-(
702 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
703 Qualify the name of the delegate, not its return type !
705 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
708 (StandardConversionExists): Checking for array types turns out to be recursive.
710 (ConvertReferenceExplicit): Implement array conversion.
712 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
714 2001-10-12 Ravi Pratap <ravi@ximian.com>
716 * cs-parser.jay (delegate_declaration): Store the fully qualified
717 name as it is a type declaration.
719 * delegate.cs (ReturnType, Name): Rename members to these. Make them
722 (DefineDelegate): Renamed from Define. Does the same thing essentially,
723 as TypeContainer::DefineType.
725 (Populate): Method in which all the definition of the various methods (Invoke)
728 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
731 (CloseDelegate): Finally creates the delegate.
733 * class.cs (TypeContainer::DefineType): Update to define delegates.
734 (Populate, Emit and CloseType): Do the same thing here too.
736 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
737 delegates in all these operations.
739 2001-10-14 Miguel de Icaza <miguel@ximian.com>
741 * expression.cs: LocalTemporary: a new expression used to
742 reference a temporary that has been created.
744 * assign.cs: Handle PropertyAccess back here, so that we can
745 provide the proper semantic access to properties.
747 * expression.cs (Expression::ConvertReferenceExplicit): Implement
748 a few more explicit conversions.
750 * modifiers.cs: `NEW' modifier maps to HideBySig.
752 * expression.cs (PropertyExpr): Make this into an
753 ExpressionStatement, and support the EmitStatement code path.
755 Perform get/set error checking, clean up the interface.
757 * assign.cs: recognize PropertyExprs as targets, and if so, turn
758 them into toplevel access objects.
760 2001-10-12 Miguel de Icaza <miguel@ximian.com>
762 * expression.cs: PropertyExpr::PropertyExpr: use work around the
765 * typemanager.cs: Keep track here of our PropertyBuilders again to
766 work around lameness in SRE.
768 2001-10-11 Miguel de Icaza <miguel@ximian.com>
770 * expression.cs (LValue::LValueResolve): New method in the
771 interface, used to perform a second resolution pass for LValues.
773 (This::DoResolve): Catch the use of this in static methods.
775 (This::LValueResolve): Implement.
777 (This::Store): Remove warning, assigning to `this' in structures
780 (Invocation::Emit): Deal with invocation of
781 methods on value types. We need to pass the address to structure
782 methods rather than the object itself. (The equivalent code to
783 emit "this" for structures leaves the entire structure on the
784 stack instead of a pointer to it).
786 (ParameterReference::DoResolve): Compute the real index for the
787 argument based on whether the method takes or not a `this' pointer
788 (ie, the method is static).
790 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
791 value types returned from functions when we need to invoke a
792 method on the sturcture.
795 2001-10-11 Ravi Pratap <ravi@ximian.com>
797 * class.cs (TypeContainer::DefineType): Method to actually do the business of
798 defining the type in the Modulebuilder or Typebuilder. This is to take
799 care of nested types which need to be defined on the TypeBuilder using
802 (TypeContainer::GetClassBases): Implement. Essentially the code from the
803 methods in RootContext, only ported to be part of TypeContainer.
805 (TypeContainer::GetInterfaceOrClass): Ditto.
807 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
809 * interface.cs (Interface::DefineInterface): New method. Does exactly
810 what RootContext.CreateInterface did earlier, only it takes care of nested types
813 (Interface::GetInterfaces): Move from RootContext here and port.
815 (Interface::GetInterfaceByName): Same here.
817 * rootcontext.cs (ResolveTree): Re-write.
819 (PopulateTypes): Re-write.
821 * class.cs (TypeContainer::Populate): Populate nested types too.
822 (TypeContainer::Emit): Emit nested members too.
824 * typemanager.cs (AddUserType): Do not make use of the FullName property,
825 instead just use the name argument passed in as it is already fully
828 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
829 to TypeContainer mapping to see if a type is user-defined.
831 * class.cs (TypeContainer::CloseType): Implement.
833 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
834 the default constructor.
836 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
839 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
841 * interface.cs (CloseType): Create the type here.
843 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
846 Remove all the methods which are now in TypeContainer.
848 2001-10-10 Ravi Pratap <ravi@ximian.com>
850 * delegate.cs (Define): Re-write bits to define the delegate
853 2001-10-10 Miguel de Icaza <miguel@ximian.com>
855 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
857 * expression.cs (ImplicitReferenceConversion): handle null as well
858 as a source to convert to any reference type.
860 * statement.cs (Return): Perform any implicit conversions to
861 expected return type.
863 Validate use of return statement.
865 * codegen.cs (EmitContext): Pass the expected return type here.
867 * class.cs (Method, Constructor, Property): Pass expected return
870 2001-10-09 Miguel de Icaza <miguel@ximian.com>
872 * expression.cs: Make DoResolve take an EmitContext instead of a
875 Replaced `l' and `location' for `loc', for consistency.
877 (Error, Warning): Remove unneeded Tc argument.
879 * assign.cs, literal.cs, constant.cs: Update to new calling
882 * codegen.cs: EmitContext now contains a flag indicating whether
883 code is being generated in a static method or not.
885 * cs-parser.jay: DecomposeQI, new function that replaces the old
886 QualifiedIdentifier. Now we always decompose the assembled
887 strings from qualified_identifier productions into a group of
890 2001-10-08 Miguel de Icaza <miguel@ximian.com>
892 * rootcontext.cs: Deal with field-less struct types correctly now
893 by passing the size option to Define Type.
895 * class.cs: Removed hack that created one static field.
897 2001-10-07 Miguel de Icaza <miguel@ximian.com>
899 * statement.cs: Moved most of the code generation here.
901 2001-10-09 Ravi Pratap <ravi@ximian.com>
903 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
906 (ElementAccess): Remove useless bits for now - keep checks as the spec
909 2001-10-08 Ravi Pratap <ravi@ximian.com>
911 * expression.cs (ElementAccess::DoResolve): Remove my crap code
912 and start performing checks according to the spec.
914 2001-10-07 Ravi Pratap <ravi@ximian.com>
916 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
917 rank_specifiers instead.
919 (rank_specifiers): Change the order in which the rank specifiers are stored
921 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
923 * expression.cs (ElementAccess): Implement the LValue interface too.
925 2001-10-06 Ravi Pratap <ravi@ximian.com>
927 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
928 except that user defined conversions are not included.
930 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
931 perform the conversion of the return type, if necessary.
933 (New::DoResolve): Check whether we are creating an array or an object
934 and accordingly do the needful.
936 (New::Emit): Same here.
938 (New::DoResolve): Implement guts of array creation.
940 (New::FormLookupType): Helper function.
942 2001-10-07 Miguel de Icaza <miguel@ximian.com>
944 * codegen.cs: Removed most of the code generation here, and move the
945 corresponding code generation bits to the statement classes.
947 Added support for try/catch/finalize and throw.
949 * cs-parser.jay: Added support for try/catch/finalize.
951 * class.cs: Catch static methods having the flags override,
954 * expression.cs (UserCast): This user cast was not really doing
955 what it was supposed to do. Which is to be born in fully resolved
956 state. Parts of the resolution were being performed at Emit time!
960 2001-10-05 Miguel de Icaza <miguel@ximian.com>
962 * expression.cs: Implicity convert the result from UserCast.
964 2001-10-05 Ravi Pratap <ravi@ximian.com>
966 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
967 prevented it from working correctly.
969 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
970 merely ConvertImplicit.
972 2001-10-05 Miguel de Icaza <miguel@ximian.com>
974 * typemanager.cs: Make the LookupTypeContainer function static,
975 and not per-instance.
977 * class.cs: Make static FindMembers (the one that takes a Type
980 * codegen.cs: Add EmitForeach here.
982 * cs-parser.jay: Make foreach a toplevel object instead of the
983 inline expansion, as we need to perform semantic analysis on it.
985 2001-10-05 Ravi Pratap <ravi@ximian.com>
987 * expression.cs (Expression::ImplicitUserConversion): Rename to
988 UserDefinedConversion.
990 (Expression::UserDefinedConversion): Take an extra argument specifying
991 whether we look for explicit user conversions too.
993 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
995 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
997 (ExplicitUserConversion): Make it a call to UserDefinedConversion
998 with the appropriate arguments.
1000 * cs-parser.jay (cast_expression): Record location too.
1002 * expression.cs (Cast): Record location info.
1004 (Expression::ConvertExplicit): Take location argument.
1006 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
1007 to determine if we are doing explicit conversions.
1009 (UserCast::Emit): Update accordingly.
1011 (Expression::ConvertExplicit): Report an error if everything fails.
1013 * ../errors/cs0030.cs : Add.
1015 2001-10-04 Miguel de Icaza <miguel@ximian.com>
1017 * modifiers.cs: If the ABSTRACT keyword is present, also set the
1018 virtual and newslot bits.
1020 * class.cs (TypeContainer::RegisterRequiredImplementations):
1021 Record methods we need.
1023 (TypeContainer::MakeKey): Helper function to make keys for
1024 MethodBases, since the Methodbase key is useless.
1026 (TypeContainer::Populate): Call RegisterRequiredImplementations
1027 before defining the methods.
1029 Create a mapping for method_builders_to_methods ahead of time
1030 instead of inside a tight loop.
1032 (::RequireMethods): Accept an object as the data to set into the
1033 hashtable so we can report interface vs abstract method mismatch.
1035 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1037 * report.cs: Make all of it static.
1039 * rootcontext.cs: Drop object_type and value_type computations, as
1040 we have those in the TypeManager anyways.
1042 Drop report instance variable too, now it is a global.
1044 * driver.cs: Use try/catch on command line handling.
1046 Add --probe option to debug the error reporting system with a test
1049 * report.cs: Add support for exiting program when a probe
1050 condition is reached.
1052 2001-10-03 Ravi Pratap <ravi@ximian.com>
1054 * expression.cs (Binary::DoNumericPromotions): Fix the case when
1055 we do a forcible conversion regardless of type, to check if
1056 ForceConversion returns a null.
1058 (Binary::error19): Use location to report error.
1060 (Unary::error23): Use location here too.
1062 * ../errors/cs0019.cs : Check in.
1064 * ../errors/cs0023.cs : Check in.
1066 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
1067 case of a non-null MethodInfo object with a length of 0 !
1069 (Binary::ResolveOperator): Flag error if overload resolution fails to find
1070 an applicable member - according to the spec :-)
1071 Also fix logic to find members in base types.
1073 (Unary::ResolveOperator): Same here.
1075 (Unary::report23): Change name to error23 and make first argument a TypeContainer
1076 as I was getting thoroughly confused between this and error19 :-)
1078 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
1079 (::FindMostEncompassedType): Implement.
1080 (::FindMostEncompassingType): Implement.
1081 (::StandardConversionExists): Implement.
1083 (UserImplicitCast): Re-vamp. We now need info about most specific
1084 source and target types so that we can do the necessary conversions.
1086 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
1087 mathematical union with no duplicates.
1089 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1091 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
1092 in order from base classes to child classes, so that we can in
1093 child classes look up in our parent for method names and
1094 attributes (required for handling abstract, virtual, new, override
1095 constructs: we need to instrospect our base class, and if we dont
1096 populate the classes in order, the introspection might be
1097 incorrect. For example, a method could query its parent before
1098 the parent has any methods and would determine that the parent has
1099 no abstract methods (while it could have had them)).
1101 (RootContext::CreateType): Record the order in which we define the
1104 2001-10-02 Miguel de Icaza <miguel@ximian.com>
1106 * class.cs (TypeContainer::Populate): Also method definitions can
1107 fail now, keep track of this.
1109 (TypeContainer::FindMembers): Implement support for
1110 DeclaredOnly/noDeclaredOnly flag.
1112 (Constructor::Emit) Return the ConstructorBuilder.
1114 (Method::Emit) Return the MethodBuilder.
1115 Check for abstract or virtual methods to be public.
1117 * rootcontext.cs (RootContext::CreateType): Register all the
1118 abstract methods required for the class to be complete and the
1119 interface methods that must be implemented.
1121 * cs-parser.jay: Report error 501 (method requires body if it is
1122 not marked abstract or extern).
1124 * expression.cs (TypeOf::Emit): Implement.
1126 * typemanager.cs: runtime_handle_type, new global type.
1128 * class.cs (Property::Emit): Generate code for properties.
1130 2001-10-02 Ravi Pratap <ravi@ximian.com>
1132 * expression.cs (Unary::ResolveOperator): Find operators on base type
1133 too - we now conform exactly to the spec.
1135 (Binary::ResolveOperator): Same here.
1137 * class.cs (Operator::Define): Fix minor quirk in the tests.
1139 * ../errors/cs0215.cs : Added.
1141 * ../errors/cs0556.cs : Added.
1143 * ../errors/cs0555.cs : Added.
1145 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1147 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
1148 single integer which is really efficient
1150 2001-10-01 Ravi Pratap <ravi@ximian.com>
1152 * expression.cs (Expression::ImplicitUserConversion): Use location
1153 even in the case when we are examining True operators.
1155 * class.cs (Operator::Define): Perform extensive checks to conform
1156 with the rules for operator overloading in the spec.
1158 * expression.cs (Expression::ImplicitReferenceConversion): Implement
1159 some of the other conversions mentioned in the spec.
1161 * typemanager.cs (array_type): New static member for the System.Array built-in
1164 (cloneable_interface): For System.ICloneable interface.
1166 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
1167 we start resolving the tree and populating types.
1169 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
1171 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1173 * expression.cs (Expression::ExprClassFromMemberInfo,
1174 Expression::Literalize): Create literal expressions from
1175 FieldInfos which are literals.
1177 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
1178 type casts, because they were wrong. The test suite in tests
1181 (ImplicitNumericConversion): ushort to ulong requires a widening
1184 Int32 constant to long requires widening cast as well.
1186 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
1187 for integers because the type on the stack is not i4.
1189 2001-09-30 Miguel de Icaza <miguel@ximian.com>
1191 * expression.cs (report118): require location argument.
1193 * parameter.cs: Do not dereference potential null value.
1195 * class.cs: Catch methods that lack the `new' keyword when
1196 overriding a name. Report warnings when `new' is used without
1197 anything being there to override.
1199 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
1201 * class.cs: Only add constructor to hashtable if it is non-null
1202 (as now constructors can fail on define).
1204 (TypeManager, Class, Struct): Take location arguments.
1206 Catch field instance initialization in structs as errors.
1208 accepting_filter: a new filter for FindMembers that is static so
1209 that we dont create an instance per invocation.
1211 (Constructor::Define): Catch errors where a struct constructor is
1214 * cs-parser.jay: Pass location information for various new
1217 * delegate.cs (Delegate): take a location argument.
1219 * driver.cs: Do not call EmitCode if there were problesm in the
1220 Definition of the types, as many Builders wont be there.
1222 * decl.cs (Decl::Decl): Require a location argument.
1224 * cs-tokenizer.cs: Handle properly hex constants that can not fit
1225 into integers, and find the most appropiate integer for it.
1227 * literal.cs: Implement ULongLiteral.
1229 * rootcontext.cs: Provide better information about the location of
1230 failure when CreateType fails.
1232 2001-09-29 Miguel de Icaza <miguel@ximian.com>
1234 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
1237 * expression.cs (Binary::CheckShiftArguments): Add missing type
1239 (Binary::ResolveOperator): Add type to the logical and and logical
1240 or, Bitwise And/Or and Exclusive Or code paths, it was missing
1243 (Binary::DoNumericPromotions): In the case where either argument
1244 is ulong (and most signed types combined with ulong cause an
1245 error) perform implicit integer constant conversions as well.
1247 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1249 * expression.cs (UserImplicitCast): Method should always be
1251 (Invocation::BetterConversion): Simplified test for IntLiteral.
1253 (Expression::ImplicitNumericConversion): Split this routine out.
1254 Put the code that performs implicit constant integer conversions
1257 (Expression::Resolve): Become a wrapper around DoResolve so we can
1258 check eclass and type being set after resolve.
1260 (Invocation::Badness): Remove this dead function
1262 (Binary::ResolveOperator): Do not compute the expensive argumnets
1263 unless we have a union for it.
1265 (Probe::Emit): Is needs to do an isinst and then
1266 compare against null.
1268 (::CanConvert): Added Location argument. If the Location argument
1269 is null (Location.Null), then we do not report errors. This is
1270 used by the `probe' mechanism of the Explicit conversion. We do
1271 not want to generate an error for something that the user
1272 explicitly requested to be casted. But the pipeline for an
1273 explicit cast first tests for potential implicit casts.
1275 So for now, if the Location is null, it means `Probe only' to
1276 avoid adding another argument. Might have to revise this
1279 (ClassCast): New class used to type cast objects into arbitrary
1280 classes (used in Explicit Reference Conversions).
1282 Implement `as' as well.
1284 Reverted all the patches from Ravi below: they were broken:
1286 * The use of `level' as a mechanism to stop recursive
1287 invocations is wrong. That was there just to catch the
1288 bug with a strack trace but not as a way of addressing
1291 To fix the problem we have to *understand* what is going
1292 on and the interactions and come up with a plan, not
1293 just get things going.
1295 * The use of the type conversion cache that I proposed
1296 last night had an open topic: How does this work across
1297 protection domains. A user defined conversion might not
1298 be public in the location where we are applying the
1299 conversion, a different conversion might be selected
1300 (ie, private A->B (better) but public B->A (worse),
1301 inside A, A->B applies, but outside it, B->A will
1304 * On top of that (ie, even if the above is solved),
1305 conversions in a cache need to be abstract. Ie, `To
1306 convert from an Int to a Short use an OpcodeCast', not
1307 `To convert from an Int to a Short use the OpcodeCast on
1308 the variable 5' (which is what this patch was doing).
1310 2001-09-28 Ravi Pratap <ravi@ximian.com>
1312 * expression.cs (Invocation::ConversionExists): Re-write to use
1313 the conversion cache
1315 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
1316 cache all conversions done, not just user-defined ones.
1318 (Invocation::BetterConversion): The real culprit. Use ConversionExists
1319 to determine if a conversion exists instead of acutually trying to
1320 perform the conversion. It's faster too.
1322 (Expression::ConvertExplicit): Modify to use ConversionExists to check
1323 and only then attempt the implicit conversion.
1325 2001-09-28 Ravi Pratap <ravi@ximian.com>
1327 * expression.cs (ConvertImplicit): Use a cache for conversions
1328 already found. Check level of recursion and bail out if necessary.
1330 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1332 * typemanager.cs (string_concat_string_string, string_concat_object_object):
1333 Export standard methods that we expect for string operations.
1335 * statement.cs (Block::UsageWarning): Track usage of variables and
1336 report the errors for not used variables.
1338 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
1341 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1343 * codegen.cs: remove unnneded code
1345 * expression.cs: Removed BuiltinTypeAccess class
1347 Fix the order in which implicit conversions are
1350 The previous fixed dropped support for boxed conversions (adding a
1351 test to the test suite now)
1353 (UserImplicitCast::CanConvert): Remove test for source being null,
1354 that code is broken. We should not feed a null to begin with, if
1355 we do, then we should track the bug where the problem originates
1356 and not try to cover it up here.
1358 Return a resolved expression of type UserImplicitCast on success
1359 rather than true/false. Ravi: this is what I was talking about,
1360 the pattern is to use a static method as a "constructor" for
1363 Also, do not create arguments until the very last minute,
1364 otherwise we always create the arguments even for lookups that
1365 will never be performed.
1367 (UserImplicitCast::Resolve): Eliminate, objects of type
1368 UserImplicitCast are born in a fully resolved state.
1370 * typemanager.cs (InitCoreTypes): Init also value_type
1373 * expression.cs (Cast::Resolve): First resolve the child expression.
1375 (LValue): Add new method AddressOf to be used by
1378 Change the argument of Store to take an EmitContext instead of an
1379 ILGenerator, because things like FieldExpr need to be able to call
1380 their children expression to generate the instance code.
1382 (Expression::Error, Expression::Warning): Sugar functions for
1385 (Expression::MemberLookup): Accept a TypeContainer instead of a
1386 Report as the first argument.
1388 (Expression::ResolvePrimary): Killed. I still want to improve
1389 this as currently the code is just not right.
1391 (Expression::ResolveMemberAccess): Simplify, but it is still
1394 (Unary::Resolve): Catch errors in AddressOf operators.
1396 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
1397 index to a byte for the short-version, or the compiler will choose
1398 the wrong Emit call, which generates the wrong data.
1400 (ParameterReference::Emit, ::Store): same.
1402 (FieldExpr::AddressOf): Implement.
1404 * typemanager.cs: TypeManager: made public variable instead of
1407 * driver.cs: document --fatal.
1409 * report.cs (ErrorMessage, WarningMessage): new names for the old
1410 Error and Warning classes.
1412 * cs-parser.jay (member_access): Turn built-in access to types
1413 into a normal simplename
1415 2001-09-27 Ravi Pratap <ravi@ximian.com>
1417 * expression.cs (Invocation::BetterConversion): Fix to cope
1418 with q being null, since this was introducing a bug.
1420 * expression.cs (ConvertImplicit): Do built-in conversions first.
1422 2001-09-27 Ravi Pratap <ravi@ximian.com>
1424 * expression.cs (UserImplicitCast::Resolve): Fix bug.
1426 2001-09-27 Ravi Pratap <ravi@ximian.com>
1428 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
1429 I had introduced long ago (what's new ?).
1431 * expression.cs (UserImplicitCast::CanConvert): Static method to do
1432 the work of all the checking.
1433 (ConvertImplicit): Call CanConvert and only then create object if necessary.
1434 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
1436 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
1437 that is the right way.
1439 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
1440 overloading resolution. Use everywhere instead of cutting and pasting code.
1442 (Binary::ResolveOperator): Use MakeUnionSet.
1444 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
1445 we have to convert to bool types. Not complete yet.
1447 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1449 * typemanager.cs (TypeManager::CSharpName): support ushort.
1451 * expression.cs (Expression::TryImplicitIntConversion): Attempts
1452 to provide an expression that performsn an implicit constant int
1453 conversion (section 6.1.6).
1454 (Expression::ConvertImplicitRequired): Reworked to include
1455 implicit constant expression conversions.
1457 (Expression::ConvertNumericExplicit): Finished.
1459 (Invocation::Emit): If InstanceExpression is null, then it means
1460 that we perform a call on this.
1462 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1464 * expression.cs (Unary::Emit): Remove some dead code.
1465 (Probe): Implement Resolve and Emit for `is'.
1466 (Expression::ConvertImplicitRequired): Attempt to do constant
1467 expression conversions here. Maybe should be moved to
1468 ConvertImplicit, but I am not sure.
1469 (Expression::ImplicitLongConstantConversionPossible,
1470 Expression::ImplicitIntConstantConversionPossible): New functions
1471 that tell whether is it possible to apply an implicit constant
1472 expression conversion.
1474 (ConvertNumericExplicit): Started work on explicit numeric
1477 * cs-parser.jay: Update operator constants.
1479 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
1480 (Parameters::GetSignature): Hook up VerifyArgs here.
1481 (Parameters::VerifyArgs): Verifies that no two arguments have the
1484 * class.cs (Operator): Update the operator names to reflect the
1485 ones that the spec expects (as we are just stringizing the
1488 * expression.cs (Unary::ResolveOperator): Fix bug: Use
1489 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
1490 previous usage did only work for our methods.
1491 (Expression::ConvertImplicit): Handle decimal implicit numeric
1492 conversions as well.
1493 (Expression::InternalTypeConstructor): Used to invoke constructors
1494 on internal types for default promotions.
1496 (Unary::Emit): Implement special handling for the pre/post
1497 increment/decrement for overloaded operators, as they need to have
1498 the same semantics as the other operators.
1500 (Binary::ResolveOperator): ditto.
1501 (Invocation::ConversionExists): ditto.
1502 (UserImplicitCast::Resolve): ditto.
1504 2001-09-26 Ravi Pratap <ravi@ximian.com>
1506 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
1507 operator, return after emitting body. Regression tests pass again !
1509 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
1510 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
1511 (Invocation::OverloadResolve): Ditto.
1512 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
1514 * everywhere : update calls to the above methods accordingly.
1516 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1518 * assign.cs (Assign): Make it inherit from ExpressionStatement.
1520 * expression.cs (ExpressionStatement): New base class used for
1521 expressions that can appear in statements, so that we can provide
1522 an alternate path to generate expression that do not leave a value
1525 (Expression::Emit, and all the derivatives): We no longer return
1526 whether a value is left on the stack or not. Every expression
1527 after being emitted leaves a single value on the stack.
1529 * codegen.cs (EmitContext::EmitStatementExpression): Use the
1530 facilties of ExpressionStatement if possible.
1532 * cs-parser.jay: Update statement_expression.
1534 2001-09-25 Miguel de Icaza <miguel@ximian.com>
1536 * driver.cs: Change the wording of message
1538 2001-09-25 Ravi Pratap <ravi@ximian.com>
1540 * expression.cs (Binary::ResolveOperator): Had forgottten to set
1541 the type of the expression to the return type of the method if
1542 we have an overloaded operator match ! The regression tests pass again !
1543 (Unary::ResolveOperator): Ditto.
1545 * expression.cs (Invocation::ConversionExists): Correct the member lookup
1546 to find "op_Implicit", not "implicit" ;-)
1547 (UserImplicitCast): New class to take care of user-defined implicit conversions.
1548 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1550 * everywhere : Correct calls to the above accordingly.
1552 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1553 (ConvertImplicit): Do user-defined conversion if it exists.
1555 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1557 * assign.cs: track location.
1558 (Resolve): Use implicit conversions on assignment.
1560 * literal.cs: Oops. Not good, Emit of short access values should
1561 pass (Bytes) or the wrong argument will be selected.
1563 * expression.cs (Unary::Emit): Emit code for -expr.
1565 (Unary::ResolveOperator): Handle `Substract' for non-constants
1566 (substract from zero from the non-constants).
1567 Deal with Doubles as well.
1569 (Expression::ConvertImplicitRequired): New routine that reports an
1570 error if no implicit conversion exists.
1572 (Invocation::OverloadResolve): Store the converted implicit
1573 expressions if we make them
1575 2001-09-24 Ravi Pratap <ravi@ximian.com>
1577 * class.cs (ConstructorInitializer): Take a Location argument.
1578 (ConstructorBaseInitializer): Same here.
1579 (ConstructorThisInitializer): Same here.
1581 * cs-parser.jay : Update all calls accordingly.
1583 * expression.cs (Unary, Binary, New): Take location argument.
1584 Update accordingly everywhere.
1586 * cs-parser.jay : Update all calls to the above to take a location
1591 2001-09-24 Ravi Pratap <ravi@ximian.com>
1593 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1594 (Invocation::BetterConversion): Same here
1595 (Invocation::ConversionExists): Ditto.
1597 (Invocation::ConversionExists): Implement.
1599 2001-09-22 Ravi Pratap <ravi@ximian.com>
1601 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1602 Also take an additional TypeContainer argument.
1604 * All over : Pass in TypeContainer as argument to OverloadResolve.
1606 * typemanager.cs (CSharpName): Update to check for the string type and return
1609 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1612 2001-09-21 Ravi Pratap <ravi@ximian.com>
1614 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1615 (Invocation::BetterFunction): Implement.
1616 (Invocation::BetterConversion): Implement.
1617 (Invocation::ConversionExists): Skeleton, no implementation yet.
1619 Okay, things work fine !
1621 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1623 * typemanager.cs: declare and load enum_type, delegate_type and
1626 * expression.cs (Expression::Emit): Now emit returns a value that
1627 tells whether a value is left on the stack or not. This strategy
1628 might be reveted tomorrow with a mechanism that would address
1629 multiple assignments.
1630 (Expression::report118): Utility routine to report mismatches on
1633 (Unary::Report23): Report impossible type/operator combination
1636 (Unary::IsIncrementableNumber): Whether the type can be
1637 incremented or decremented with add.
1638 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1640 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1642 (Invocation::Emit): Deal with new Emit convetion.
1644 * All Expression derivatives: Updated their Emit method to return
1645 whether they leave values on the stack or not.
1647 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1648 stack for expressions that are statements.
1650 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1652 * expression.cs (LValue): New interface. Must be implemented by
1654 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1657 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1658 interface for generating code, simplifies the code.
1660 2001-09-20 Ravi Pratap <ravi@ximian.com>
1662 * expression.cs (everywhere): Comment out return statements in ::Resolve
1663 methods to avoid the warnings.
1665 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1667 * driver.cs (parse): Report error 2001 if we can not open the
1670 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1673 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1676 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1677 otherwise nested blocks end up with the same index.
1679 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1681 * expression.cs: Instead of having FIXMEs in the Resolve
1682 functions, throw exceptions so it is obvious that we are facing a
1685 * cs-parser.jay (invocation_expression): Pass Location information.
1687 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1688 Use a basename for those routines because .NET does not like paths
1691 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1694 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1696 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1697 are loading the correct data types (throws an exception if not).
1698 (TypeManager::InitCoreTypes): Use CoreLookupType
1700 * expression.cs (Unary::ResolveOperator): return the child
1701 expression for expressions which are just +expr.
1702 (Unary::ResolveOperator): Return negative literals for -LITERAL
1703 expressions (otherwise they are Unary {Literal}).
1704 (Invocation::Badness): Take into account `Implicit constant
1705 expression conversions'.
1707 * literal.cs (LongLiteral): Implement long literal class.
1708 (IntLiteral): export the `Value' of the intliteral.
1710 2001-09-19 Ravi Pratap <ravi@ximian.com>
1712 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1714 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1715 instead of 'Operator'
1717 * expression.cs (Binary::ResolveOperator): Update accordingly.
1718 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1721 * cs-parser.jay (unary_expression): Update to use the new names.
1723 * gen-treedump.cs (GetUnary): Same here.
1725 * expression.cs (Unary::Resolve): Implement.
1726 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1727 operators are found instead of making noise ;-)
1728 (Unary::ResolveOperator): New method to do precisely the same thing which
1729 Binary::ResolveOperator does for Binary expressions.
1730 (Unary.method, .Arguments): Add.
1731 (Unary::OperName): Implement.
1732 (Unary::ForceConversion): Copy and Paste !
1734 * class.cs (Operator::Define): Fix a small bug for the case when we have
1737 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1738 for the inbuilt operators. Only overloading works for now ;-)
1740 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1742 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1743 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1745 * expression.cs (This::Emit): Implement.
1746 (This::Resolve): Implement.
1747 (TypeOf:Resolve): Implement.
1748 (Expression::ResolveSimpleName): Add an implicit this to instance
1750 (MemberAccess::Resolve): Deal with Parameters and Fields.
1751 Bind instance variable to Field expressions.
1752 (FieldExpr::Instance): New field used to track the expression that
1753 represents the object instance.
1754 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1756 (FieldExpr::Emit): Implement.
1758 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1759 the last instruction contains a return opcode to avoid generating
1760 the last `ret' instruction (this generates correct code, and it is
1761 nice to pass the peverify output).
1763 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1764 initializer for static and instance variables.
1765 (Constructor::Emit): Allow initializer to be null in the case of
1766 static constructors. Only emit initializer for instance
1769 (TypeContainer::FindMembers): Return a null array if there are no
1772 Also fix the code for the MemberTypes.Method branch, as it was not
1773 scanning that for operators (or tried to access null variables before).
1775 * assign.cs (Assign::Emit): Handle instance and static fields.
1779 * driver.cs: Stop compilation if there are parse errors.
1781 * cs-parser.jay (constructor_declaration): Provide default base
1782 initializer for non-static constructors.
1783 (constructor_declarator): Do not provide a default base
1784 initializers if none was specified.
1785 Catch the fact that constructors should not have parameters.
1787 * class.cs: Do not emit parent class initializers for static
1788 constructors, that should be flagged as an error.
1790 2001-09-18 Ravi Pratap <ravi@ximian.com>
1792 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1793 Move back code into TypeContainer::Populate.
1795 2001-09-18 Ravi Pratap <ravi@ximian.com>
1797 * class.cs (TypeContainer::AddConstructor): Fix the check to
1798 compare against Name, not Basename.
1799 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1801 * cs-parser.jay : Update accordingly.
1803 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1804 for methods, don't forget to look into the operators too.
1805 (RegisterMethodBuilder): Helper method to take care of this for
1806 methods, constructors and operators.
1807 (Operator::Define): Completely revamp.
1808 (Operator.OperatorMethod, MethodName): New fields.
1809 (TypeContainer::Populate): Move the registering of builders into
1810 RegisterMethodBuilder.
1811 (Operator::Emit): Re-write.
1813 * expression.cs (Binary::Emit): Comment out code path to emit method
1814 invocation stuff for the case when we have a user defined operator. I am
1815 just not able to get it right !
1817 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1819 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1822 (Expression::MemberLookup): Provide a version that allows to
1823 specify the MemberTypes and BindingFlags.
1825 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1826 so it was not fetching variable information from outer blocks.
1828 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1829 Beforefieldinit as it was buggy.
1831 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1834 * class.cs (Constructor::Emit): Only emit if block is not null.
1835 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1836 deal with this by semantically definining it as if the user had
1839 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1840 constructors as we now "emit" them at a higher level.
1842 (TypeContainer::DefineDefaultConstructor): Used to define the
1843 default constructors if none was provided.
1845 (ConstructorInitializer): Add methods Resolve and Emit.
1847 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1849 2001-09-17 Ravi Pratap <ravi@ximian.com>
1851 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1852 the default constructor builder with our hashtable for methodbuilders
1855 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1856 and argument_count is 0 in which case we have a match.
1857 (Binary::ResolveOperator): More null checking and miscellaneous coding
1860 2001-09-17 Ravi Pratap <ravi@ximian.com>
1862 * rootcontext.cs (IsNameSpace): Compare against null.
1864 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1866 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1867 and Unary::Operator.
1869 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1872 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1873 we have overloaded operators.
1874 (Binary::ResolveOperator): Implement the part which does the operator overload
1877 * class.cs (Operator::Emit): Implement.
1878 (TypeContainer::Emit): Emit the operators we have too.
1880 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1881 the case when we have a user-defined operator.
1883 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1885 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1887 2001-09-16 Ravi Pratap <ravi@ximian.com>
1889 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1890 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1891 (Constructor::Emit): Implement.
1892 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1893 if we have no work to do.
1894 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1897 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1898 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1900 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1903 2001-09-15 Ravi Pratap <ravi@ximian.com>
1905 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1907 (Tree::RecordNamespace): Method to do what the name says ;-)
1908 (Tree::Namespaces): Property to get at the namespaces hashtable.
1910 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1913 * rootcontext.cs (IsNamespace): Fixed it :-)
1915 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1917 * class.cs (TypeContainer::FindMembers): Add support for
1919 (MethodCore): New class that encapsulates both the shared aspects
1920 of a Constructor and a Method.
1921 (Method, Constructor): Factored pieces into MethodCore.
1923 * driver.cs: Added --fatal which makes errors throw exceptions.
1924 Load System assembly as well as part of the standard library.
1926 * report.cs: Allow throwing exceptions on errors for debugging.
1928 * modifiers.cs: Do not use `parent', instead use the real type
1929 container to evaluate permission settings.
1931 * class.cs: Put Ravi's patch back in. He is right, and we will
1932 have to cope with the
1934 2001-09-14 Ravi Pratap <ravi@ximian.com>
1936 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1937 FamORAssem, not FamANDAssem.
1939 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1941 * driver.cs: Added --parse option that only parses its input files
1944 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1945 incorrect. IsTopLevel is not used to tell whether an object is
1946 root_types or not (that can be achieved by testing this ==
1947 root_types). But to see if this is a top-level *class* (not
1948 necessarly our "toplevel" container).
1950 2001-09-14 Ravi Pratap <ravi@ximian.com>
1952 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1953 parent instead of a direct call to GetType.
1955 2001-09-14 Ravi Pratap <ravi@ximian.com>
1957 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1958 Modifiers.TypeAttr. This should just be a call to that method.
1960 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1961 object so that we can determine if we are top-level or not.
1963 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1966 * enum.cs (Enum::Define): Ditto.
1968 * modifiers.cs (FieldAttr): Re-write.
1970 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1971 (TypeContainer::HaveStaticConstructor): New property to provide access
1972 to precisely that info.
1974 * modifiers.cs (MethodAttr): Re-write.
1975 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1977 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1978 of top-level types as claimed.
1980 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1982 * expression.cs (MemberLookup): Fruitless attempt to lookup
1983 constructors. Maybe I need to emit default constructors? That
1984 might be it (currently .NET emits this for me automatically).
1985 (Invocation::OverloadResolve): Cope with Arguments == null.
1986 (Invocation::EmitArguments): new function, shared by the new
1988 (Invocation::Emit): Handle static and instance methods. Emit
1989 proper call instruction for virtual or non-virtual invocations.
1990 (New::Emit): Implement.
1991 (New::Resolve): Implement.
1992 (MemberAccess:Resolve): Implement.
1993 (MethodGroupExpr::InstanceExpression): used conforming to the spec
1995 (FieldExpr::Resolve): Set type.
1997 * support.cs: Handle empty arguments.
1999 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
2000 SimpleLookup): Auxiliary routines to help parse a qualifier
2003 Update qualifier_identifier rule.
2005 * codegen.cs: Removed debugging messages.
2007 * class.cs: Make this a global thing, this acts just as a "key" to
2008 objects that we might have around.
2010 (Populate): Only initialize method_builders_to_methods once.
2012 * expression.cs (PropertyExpr): Initialize type from the
2015 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
2016 Resolve pattern. Attempt to implicitly convert value to boolean.
2019 * expression.cs: Set the type for the int32/int32 argument case.
2020 (Binary::ResolveOperator): Set the return type to boolean for
2021 comparission operators
2023 * typemanager.cs: Remove debugging print code.
2025 (Invocation::Resolve): resolve type.
2027 * class.cs: Allocate a MemberInfo of the correct size, as the code
2028 elsewhere depends on the test to reflect the correct contents.
2030 (Method::) Keep track of parameters, due to System.Reflection holes
2032 (TypeContainer::Populate): Keep track of MethodBuilders to Method
2035 (TypeContainer::FindMembers): Use ArrayList and then copy an array
2036 of the exact size and return that.
2038 (Class::LookupMethodByBuilder): New function that maps
2039 MethodBuilders to its methods. Required to locate the information
2040 on methods because System.Reflection bit us again.
2042 * support.cs: New file, contains an interface ParameterData and
2043 two implementations: ReflectionParameters and InternalParameters
2044 used to access Parameter information. We will need to grow this
2047 * expression.cs (Invocation::GetParameterData): implement a cache
2048 and a wrapper around the ParameterData creation for methods.
2049 (Invocation::OverloadResolve): Use new code.
2051 2001-09-13 Ravi Pratap <ravi@ximian.com>
2053 * class.cs (TypeContainer::EmitField): Remove and move into
2054 (Field::Define): here and modify accordingly.
2055 (Field.FieldBuilder): New member.
2056 (TypeContainer::Populate): Update accordingly.
2057 (TypeContainer::FindMembers): Implement.
2059 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2061 * statement.cs: (VariableInfo::VariableType): New field to be
2062 initialized with the full type once it is resolved.
2064 2001-09-12 Miguel de Icaza <miguel@ximian.com>
2066 * parameter.cs (GetParameterInfo): Use a type cache to compute
2067 things only once, and to reuse this information
2069 * expression.cs (LocalVariableReference::Emit): Implement.
2070 (OpcodeCast::Emit): fix.
2072 (ParameterReference::Resolve): Implement.
2073 (ParameterReference::Emit): Implement.
2075 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
2076 that are expressions need to stay as Expressions.
2078 * typemanager.cs (CSharpName): Returns the C# name of a type if
2081 * expression.cs (Expression::ConvertImplicit): New function that
2082 implements implicit type conversions.
2084 (Expression::ImplicitReferenceConversion): Implements implicit
2085 reference conversions.
2087 (EmptyCast): New type for transparent casts.
2089 (OpcodeCast): New type for casts of types that are performed with
2090 a sequence of bytecodes.
2092 (BoxedCast): New type used for casting value types into reference
2093 types. Emits a box opcode.
2095 (Binary::DoNumericPromotions): Implements numeric promotions of
2096 and computation of the Binary::Type.
2098 (Binary::EmitBranchable): Optimization.
2100 (Binary::Emit): Implement code emission for expressions.
2102 * typemanager.cs (TypeManager): Added two new core types: sbyte
2105 2001-09-12 Ravi Pratap <ravi@ximian.com>
2107 * class.cs (TypeContainer::FindMembers): Method which does exactly
2108 what Type.FindMembers does, only we don't have to use reflection. No
2111 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
2112 typecontainer objects as we need to get at them.
2113 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
2115 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
2116 typecontainer object.
2118 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
2119 of just a Report object.
2121 2001-09-11 Ravi Pratap <ravi@ximian.com>
2123 * class.cs (Event::Define): Go back to using the prefixes "add_" and
2125 (TypeContainer::Populate): Now define the delegates of the type too.
2126 (TypeContainer.Delegates): Property to access the list of delegates defined
2129 * delegates.cs (Delegate::Define): Implement partially.
2131 * modifiers.cs (TypeAttr): Handle more flags.
2133 2001-09-11 Ravi Pratap <ravi@ximian.com>
2135 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
2137 (Operator::Define): Re-write logic to get types by using the LookupType method
2138 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
2139 (Indexer::Define): Ditto.
2140 (Event::Define): Ditto.
2141 (Property::Define): Ditto.
2143 2001-09-10 Ravi Pratap <ravi@ximian.com>
2145 * class.cs (TypeContainer::Populate): Now define operators too.
2146 (TypeContainer.Operators): New property to access the list of operators
2148 (Operator.OperatorMethodBuilder): New member to hold the method builder
2149 for the operator we are defining.
2150 (Operator::Define): Implement.
2152 2001-09-10 Ravi Pratap <ravi@ximian.com>
2154 * class.cs (Event::Define): Make the prefixes of the accessor methods
2155 addOn_ and removeOn_
2157 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
2158 of the location being passed in too. Ideally, this should go later since all
2159 error reporting should be done through the Report object.
2161 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
2162 (Populate): Iterate thru the indexers we have and define them too.
2163 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
2164 for the get and set accessors.
2165 (Indexer::Define): Implement.
2167 2001-09-09 Miguel de Icaza <miguel@ximian.com>
2169 * expression.cs (Binary::Resolve): Beginning of it. I scratched
2170 my previous implementation, did not work.
2172 * typemanager.cs: Add a couple of missing types (the longs).
2174 * literal.cs: Use TypeManager.bool_type instead of getting it.
2176 * expression.cs (EventExpr): New kind of expressions.
2177 (Expressio::ExprClassFromMemberInfo): finish
2179 2001-09-08 Miguel de Icaza <miguel@ximian.com>
2181 * assign.cs: Emit stores to static fields differently.
2183 2001-09-08 Ravi Pratap <ravi@ximian.com>
2185 * Merge in changes and adjust code to tackle conflicts. Backed out my
2186 code in Assign::Resolve ;-)
2188 2001-09-08 Ravi Pratap <ravi@ximian.com>
2190 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
2191 instead Report.Error and also pass in the location.
2192 (CSharpParser::Lexer): New readonly property to return the reference
2193 to the Tokenizer object.
2194 (declare_local_variables): Use Report.Error with location instead of plain
2198 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
2199 (Operator.CheckBinaryOperator): Ditto.
2201 * cs-parser.jay (operator_declarator): Update accordingly.
2203 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
2204 (CheckBinaryOperator): Same here.
2206 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
2207 on the name without any prefixes of namespace names etc. This is because we
2208 already might have something already fully qualified like
2209 'System.Console.WriteLine'
2211 * assign.cs (Resolve): Begin implementation. Stuck ;-)
2213 2001-09-07 Ravi Pratap <ravi@ximian.com>
2215 * cs-tokenizer.cs (location): Return a string which also contains
2218 * expression.cs (ElementAccess): New class for expressions of the
2219 type 'element access.'
2220 (BaseAccess): New class for expressions of the type 'base access.'
2221 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
2224 * cs-parser.jay (element_access): Implement action.
2225 (base_access): Implement actions.
2226 (checked_expression, unchecked_expression): Implement.
2228 * cs-parser.jay (local_variable_type): Correct and implement.
2229 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
2231 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
2233 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
2234 name and the specifiers.
2236 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
2238 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
2239 making them all public ;-)
2241 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
2244 2001-09-07 Miguel de Icaza <miguel@ximian.com>
2246 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
2248 (FieldExpr, PropertyExprs): New resolved expressions.
2249 (SimpleName::MemberStaticCheck): Perform static checks for access
2250 to non-static fields on static methods. Maybe this should be
2251 generalized for MemberAccesses.
2252 (SimpleName::ResolveSimpleName): More work on simple name
2255 * cs-parser.jay (primary_expression/qualified_identifier): track
2256 the parameter index.
2258 * codegen.cs (CodeGen::Save): Catch save exception, report error.
2259 (EmitContext::EmitBoolExpression): Chain to expression generation
2260 instead of temporary hack.
2261 (::EmitStatementExpression): Put generic expression code generation.
2263 * assign.cs (Assign::Emit): Implement variable assignments to
2264 local variables, parameters and fields.
2266 2001-09-06 Miguel de Icaza <miguel@ximian.com>
2268 * statement.cs (Block::GetVariableInfo): New method, returns the
2269 VariableInfo for a variable name in a block.
2270 (Block::GetVariableType): Implement in terms of GetVariableInfo
2272 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
2273 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
2275 2001-09-06 Ravi Pratap <ravi@ximian.com>
2277 * cs-parser.jay (operator_declaration): Continue on my quest : update
2278 to take attributes argument.
2279 (event_declaration): Ditto.
2280 (enum_declaration): Ditto.
2281 (indexer_declaration): Ditto.
2283 * class.cs (Operator::Operator): Update constructor accordingly.
2284 (Event::Event): Ditto.
2286 * delegate.cs (Delegate::Delegate): Same here.
2288 * enum.cs (Enum::Enum): Same here.
2290 2001-09-05 Ravi Pratap <ravi@ximian.com>
2292 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
2294 * ../tests/cs0658.cs : New file to demonstrate error 0658.
2296 * attribute.cs (Attributes): New class to encapsulate all attributes which were
2297 being passed around as an arraylist.
2298 (Attributes::AddAttribute): Method to add attribute sections.
2300 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
2301 (struct_declaration): Update accordingly.
2302 (constant_declaration): Update.
2303 (field_declaration): Update.
2304 (method_header): Update.
2305 (fixed_parameter): Update.
2306 (parameter_array): Ditto.
2307 (property_declaration): Ditto.
2308 (destructor_declaration): Ditto.
2310 * class.cs (Struct::Struct): Update constructors accordingly.
2311 (Class::Class): Ditto.
2312 (Field::Field): Ditto.
2313 (Method::Method): Ditto.
2314 (Property::Property): Ditto.
2315 (TypeContainer::OptAttribute): update property's return type.
2317 * interface.cs (Interface.opt_attributes): New member.
2318 (Interface::Interface): Update to take the extra Attributes argument.
2320 * parameter.cs (Parameter::Parameter): Ditto.
2322 * constant.cs (Constant::Constant): Ditto.
2324 * interface.cs (InterfaceMemberBase): New OptAttributes field.
2325 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
2326 the attributes as a parameter.
2327 (InterfaceProperty): Update constructor call.
2328 (InterfaceEvent): Ditto.
2329 (InterfaceMethod): Ditto.
2330 (InterfaceIndexer): Ditto.
2332 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
2333 pass the attributes too.
2334 (interface_event_declaration): Ditto.
2335 (interface_property_declaration): Ditto.
2336 (interface_method_declaration): Ditto.
2337 (interface_declaration): Ditto.
2339 2001-09-05 Miguel de Icaza <miguel@ximian.com>
2341 * class.cs (Method::Define): Track the "static Main" definition to
2342 create an entry point.
2344 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
2345 EntryPoint if we find it.
2347 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
2348 (EmitContext::ig): Make this variable public.
2350 * driver.cs: Make the default output file be the first file name
2351 with the .exe extension.
2353 Detect empty compilations
2355 Handle various kinds of output targets. Handle --target and
2356 rename -t to --dumper.
2358 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
2359 methods inherited from Expression return now an Expression. This
2360 will is used during the tree rewriting as we resolve them during
2363 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
2364 the spec. Missing entirely is the information about
2365 accessability of elements of it.
2367 (Expression::ExprClassFromMemberInfo): New constructor for
2368 Expressions that creates a fully initialized Expression based on
2369 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
2372 (Invocation::Resolve): Begin implementing resolution of invocations.
2374 * literal.cs (StringLiteral): Implement Emit.
2376 2001-09-05 Ravi Pratap <ravi@ximian.com>
2378 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
2381 2001-09-04 Ravi Pratap <ravi@ximian.com>
2383 * cs-parser.jay (attribute_arguments): Implement actions.
2384 (attribute): Fix bug in production. Implement action.
2385 (attribute_list): Implement.
2386 (attribute_target): Implement.
2387 (attribute_target_specifier, opt_target_specifier): Implement
2388 (CheckAttributeTarget): New method to check if the attribute target
2390 (attribute_section): Implement.
2391 (opt_attributes): Implement.
2393 * attribute.cs : New file to handle attributes.
2394 (Attribute): Class to hold attribute info.
2396 * cs-parser.jay (opt_attribute_target_specifier): Remove production
2397 (attribute_section): Modify production to use 2 different rules to
2398 achieve the same thing. 1 s/r conflict down !
2399 Clean out commented, useless, non-reducing dimension_separator rules.
2401 * class.cs (TypeContainer.attributes): New member to hold list
2402 of attributes for a type.
2403 (Struct::Struct): Modify to take one more argument, the attribute list.
2404 (Class::Class): Ditto.
2405 (Field::Field): Ditto.
2406 (Method::Method): Ditto.
2407 (Property::Property): Ditto.
2409 * cs-parser.jay (struct_declaration): Update constructor call to
2410 pass in the attributes too.
2411 (class_declaration): Ditto.
2412 (constant_declaration): Ditto.
2413 (field_declaration): Ditto.
2414 (method_header): Ditto.
2415 (fixed_parameter): Ditto.
2416 (parameter_array): Ditto.
2417 (property_declaration): Ditto.
2419 * constant.cs (Constant::Constant): Update constructor similarly.
2420 Use System.Collections.
2422 * parameter.cs (Parameter::Parameter): Update as above.
2424 2001-09-02 Ravi Pratap <ravi@ximian.com>
2426 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
2427 (TypeContainer.delegates): New member to hold list of delegates.
2429 * cs-parser.jay (delegate_declaration): Implement the action correctly
2430 this time as I seem to be on crack ;-)
2432 2001-09-02 Miguel de Icaza <miguel@ximian.com>
2434 * rootcontext.cs (RootContext::IsNamespace): new function, used to
2435 tell whether an identifier represents a namespace.
2437 * expression.cs (NamespaceExpr): A namespace expression, used only
2438 temporarly during expression resolution.
2439 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
2440 utility functions to resolve names on expressions.
2442 2001-09-01 Miguel de Icaza <miguel@ximian.com>
2444 * codegen.cs: Add hook for StatementExpressions.
2446 * class.cs: Fix inverted test for static flag in methods.
2448 2001-09-02 Ravi Pratap <ravi@ximian.com>
2450 * class.cs (Operator::CheckUnaryOperator): Correct error number used
2451 to make it coincide with MS' number.
2452 (Operator::CheckBinaryOperator): Ditto.
2454 * ../errors/errors.txt : Remove error numbers added earlier.
2456 * ../errors/cs1019.cs : Test case for error # 1019
2458 * ../errros/cs1020.cs : Test case for error # 1020
2460 * cs-parser.jay : Clean out commented cruft.
2461 (dimension_separators, dimension_separator): Comment out. Ostensibly not
2462 used anywhere - non-reducing rule.
2463 (namespace_declarations): Non-reducing rule - comment out.
2465 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
2466 with TypeContainer::AddEnum.
2468 * delegate.cs : New file for delegate handling classes.
2469 (Delegate): Class for declaring delegates.
2471 * makefile : Update.
2473 * cs-parser.jay (delegate_declaration): Implement.
2475 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
2477 * class.cs (Event::Define): Implement.
2478 (Event.EventBuilder): New member.
2480 * class.cs (TypeContainer::Populate): Update to define all enums and events
2482 (Events): New property for the events arraylist we hold. Shouldn't we move to using
2483 readonly fields for all these cases ?
2485 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2487 * class.cs (Property): Revamp to use the convention of making fields readonly.
2488 Accordingly modify code elsewhere.
2490 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
2491 the Define method of the Property class.
2493 * class.cs : Clean up applied patch and update references to variables etc. Fix
2495 (TypeContainer::Populate): Update to define all the properties we have. Also
2496 define all enumerations.
2498 * enum.cs (Define): Implement.
2500 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2502 * cs-parser.jay (overloadable_operator): The semantic value is an
2503 enum of the Operator class.
2504 (operator_declarator): Implement actions.
2505 (operator_declaration): Implement.
2507 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
2508 validity of definitions.
2509 (Operator::CheckBinaryOperator): Static method to check for binary operators
2510 (TypeContainer::AddOperator): New method to add an operator to a type.
2512 * cs-parser.jay (indexer_declaration): Added line to actually call the
2513 AddIndexer method so it gets added ;-)
2515 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
2516 already taken care of by the MS compiler ?
2518 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2520 * class.cs (Operator): New class for operator declarations.
2521 (Operator::OpType): Enum for the various operators.
2523 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2525 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
2526 ostensibly handle this in semantic analysis.
2528 * cs-parser.jay (general_catch_clause): Comment out
2529 (specific_catch_clauses, specific_catch_clause): Ditto.
2530 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
2531 (catch_args, opt_catch_args): New productions.
2532 (catch_clause): Rewrite to use the new productions above
2533 (catch_clauses): Modify accordingly.
2534 (opt_catch_clauses): New production to use in try_statement
2535 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
2536 and re-write the code in the actions to extract the specific and
2537 general catch clauses by being a little smart ;-)
2539 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
2540 Hooray, try and catch statements parse fine !
2542 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2544 * statement.cs (Block::GetVariableType): Fix logic to extract the type
2545 string from the hashtable of variables.
2547 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
2548 I end up making that mistake ;-)
2549 (catch_clauses): Fixed gross error which made Key and Value of the
2550 DictionaryEntry the same : $1 !!
2552 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2554 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2556 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2557 when the add and remove accessors are specified.
2559 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2561 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2562 information about indexer_declarator.
2563 (indexer_declarator): Implement actions.
2564 (parsing_indexer): New local boolean used to keep track of whether
2565 we are parsing indexers or properties. This is necessary because
2566 implicit_parameters come into picture even for the get accessor in the
2568 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2570 * class.cs (Indexer): New class for indexer declarations.
2571 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2572 (TypeContainer::indexers): New member to hold list of indexers for the
2575 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2577 * cs-parser.jay (add_accessor_declaration): Implement action.
2578 (remove_accessor_declaration): Implement action.
2579 (event_accessors_declaration): Implement
2580 (variable_declarators): swap statements for first rule - trivial.
2582 * class.cs (Event): New class to hold information about event
2584 (TypeContainer::AddEvent): New method to add an event to a type
2585 (TypeContainer::events): New member to hold list of events.
2587 * cs-parser.jay (event_declaration): Implement actions.
2589 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2591 * cs-parser.jay (dim_separators): Implement. Make it a string
2592 concatenating all the commas together, just as they appear.
2593 (opt_dim_separators): Modify accordingly
2594 (rank_specifiers): Update accordingly. Basically do the same
2595 thing - instead, collect the brackets here.
2596 (opt_rank_sepcifiers): Modify accordingly.
2597 (array_type): Modify to actually return the complete type string
2598 instead of ignoring the rank_specifiers.
2599 (expression_list): Implement to collect the expressions
2600 (variable_initializer): Implement. We make it a list of expressions
2601 essentially so that we can handle the array_initializer case neatly too.
2602 (variable_initializer_list): Implement.
2603 (array_initializer): Make it a list of variable_initializers
2604 (opt_array_initializer): Modify accordingly.
2606 * expression.cs (New::NType): Add enumeration to help us
2607 keep track of whether we have an object/delegate creation
2608 or an array creation.
2609 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2610 members to hold data about array creation.
2611 (New:New): Modify to update NewType
2612 (New:New): New Overloaded contructor for the array creation
2615 * cs-parser.jay (array_creation_expression): Implement to call
2616 the overloaded New constructor.
2618 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2620 * class.cs (TypeContainer::Constructors): Return member
2621 constructors instead of returning null.
2623 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2625 * typemanager.cs (InitCoreTypes): Initialize the various core
2626 types after we have populated the type manager with the user
2627 defined types (this distinction will be important later while
2628 compiling corlib.dll)
2630 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2631 on Expression Classification. Now all expressions have a method
2632 `Resolve' and a method `Emit'.
2634 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2635 generation from working. Also add some temporary debugging
2638 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2640 * codegen.cs: Lots of code generation pieces. This is only the
2641 beginning, will continue tomorrow with more touches of polish. We
2642 handle the fundamentals of if, while, do, for, return. Others are
2643 trickier and I need to start working on invocations soon.
2645 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2648 * codegen.cs (EmitContext): New struct, used during code
2649 emission to keep a context. Most of the code generation will be
2652 * cs-parser.jay: Add embedded blocks to the list of statements of
2653 this block. So code generation proceeds in a top down fashion.
2655 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2657 * statement.cs: Add support for multiple child blocks.
2659 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2661 * codegen.cs (EmitCode): New function, will emit the code for a
2662 Block of code given a TypeContainer and its ILGenerator.
2664 * statement.cs (Block): Standard public readonly optimization.
2665 (Block::Block constructors): Link children.
2666 (Block::Child): Child Linker.
2667 (Block::EmitVariables): Emits IL variable declarations.
2669 * class.cs: Drop support for MethodGroups here, delay until
2671 (Method::): Applied the same simplification that I did before, and
2672 move from Properties to public readonly fields.
2673 (Method::ParameterTypes): Returns the parameter types for the
2674 function, and implements a cache that will be useful later when I
2675 do error checking and the semantic analysis on the methods is
2677 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2678 and made a method, optional argument tells whether this is a class
2679 or a structure to apply the `has-this' bit.
2680 (Method::GetCallingConvention): Implement, returns the calling
2682 (Method::Define): Defines the type, a second pass is performed
2683 later to populate the methods.
2685 (Constructor::ParameterTypes): implement a cache similar to the
2686 one on Method::ParameterTypes, useful later when we do semantic
2689 (TypeContainer::EmitMethod): New method. Emits methods.
2691 * expression.cs: Removed MethodGroup class from here.
2693 * parameter.cs (Parameters::GetCallingConvention): new method.
2695 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2697 * class.cs (TypeContainer::Populate): Drop RootContext from the
2700 (Constructor::CallingConvention): Returns the calling convention.
2701 (Constructor::ParameterTypes): Returns the constructor parameter
2704 (TypeContainer::AddConstructor): Keep track of default constructor
2705 and the default static constructor.
2707 (Constructor::) Another class that starts using `public readonly'
2708 instead of properties.
2710 (Constructor::IsDefault): Whether this is a default constructor.
2712 (Field::) use readonly public fields instead of properties also.
2714 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2715 track of static constructors; If none is used, turn on
2716 BeforeFieldInit in the TypeAttributes.
2718 * cs-parser.jay (opt_argument_list): now the return can be null
2719 for the cases where there are no arguments.
2721 (constructor_declarator): If there is no implicit `base' or
2722 `this', then invoke the default parent constructor.
2724 * modifiers.cs (MethodAttr): New static function maps a set of
2725 modifiers flags into a MethodAttributes enum
2726 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2727 MethodAttr, TypeAttr to represent the various mappings where the
2729 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2731 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2733 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2736 * interface.cs (PopulateIndexer): Implemented the code generator
2737 for interface indexers.
2739 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2741 * interface.cs (InterfaceMemberBase): Now we track the new status
2744 (PopulateProperty): Implement property population. Woohoo! Got
2745 Methods and Properties going today.
2747 Removed all the properties for interfaces, and replaced them with
2748 `public readonly' fields.
2750 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2752 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2753 initialize their hashtables/arraylists only when they are needed
2754 instead of doing this always.
2756 * parameter.cs: Handle refs and out parameters.
2758 * cs-parser.jay: Use an ArrayList to construct the arguments
2759 instead of the ParameterCollection, and then cast that to a
2762 * parameter.cs: Drop the use of ParameterCollection and use
2763 instead arrays of Parameters.
2765 (GetParameterInfo): Use the Type, not the Name when resolving
2768 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2770 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2771 and instead use public readonly fields.
2773 * class.cs: Put back walking code for type containers.
2775 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2777 * class.cs (MakeConstant): Code to define constants.
2779 * rootcontext.cs (LookupType): New function. Used to locate types
2782 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2784 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2785 this System.Reflection code is. Kudos to Microsoft
2787 * typemanager.cs: Implement a type cache and avoid loading all
2788 types at boot time. Wrap in LookupType the internals. This made
2789 the compiler so much faster. Wow. I rule!
2791 * driver.cs: Make sure we always load mscorlib first (for
2792 debugging purposes, nothing really important).
2794 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2795 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2797 * rootcontext.cs: Lookup types on their namespace; Lookup types
2798 on namespaces that have been imported using the `using' keyword.
2800 * class.cs (TypeContainer::TypeAttr): Virtualize.
2801 (Class::TypeAttr): Return attributes suitable for this bad boy.
2802 (Struct::TypeAttr): ditto.
2803 Handle nested classes.
2804 (TypeContainer::) Remove all the type visiting code, it is now
2805 replaced with the rootcontext.cs code
2807 * rootcontext.cs (GetClassBases): Added support for structs.
2809 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2811 * interface.cs, statement.cs, class.cs, parameter.cs,
2812 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2813 Drop use of TypeRefs, and use strings instead.
2815 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2819 * class.cs (Struct::Struct): set the SEALED flags after
2820 checking the modifiers.
2821 (TypeContainer::TypeAttr): new property, returns the
2822 TypeAttributes for a class.
2824 * cs-parser.jay (type_list): Oops, list production was creating a
2825 new list of base types.
2827 * rootcontext.cs (StdLib): New property.
2828 (GetInterfaceTypeByName): returns an interface by type name, and
2829 encapsulates error handling here.
2830 (GetInterfaces): simplified.
2831 (ResolveTree): Encapsulated all the tree resolution here.
2832 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2835 * driver.cs: Add support for --nostdlib, to avoid loading the
2837 (Main): Do not put tree resolution here.
2839 * rootcontext.cs: Beginning of the class resolution.
2841 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2843 * rootcontext.cs: Provide better error reporting.
2845 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2847 * rootcontext.cs (CreateInterface): Handle the case where there
2848 are no parent interfaces.
2850 (CloseTypes): Routine to flush types at the end.
2851 (CreateInterface): Track types.
2852 (GetInterfaces): Returns an array of Types from the list of
2855 * typemanager.c (AddUserType): Mechanism to track user types (puts
2856 the type on the global type hash, and allows us to close it at the
2859 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2861 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2862 RecordInterface instead.
2864 * cs-parser.jay: Updated to reflect changes above.
2866 * decl.cs (Definition): Keep track of the TypeBuilder type that
2867 represents this type here. Not sure we will use it in the long
2868 run, but wont hurt for now.
2870 * driver.cs: Smaller changes to accomodate the new code.
2872 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2875 * rootcontext.cs (CreateInterface): New method, used to create
2876 the System.TypeBuilder type for interfaces.
2877 (ResolveInterfaces): new entry point to resolve the interface
2879 (CodeGen): Property, used to keep track of the code generator.
2881 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2883 * cs-parser.jay: Add a second production for delegate_declaration
2886 (enum_body): Put an opt_comma here instead of putting it on
2887 enum_body or enum_member_declarations so we can handle trailing
2888 commas on enumeration members. Gets rid of a shift/reduce.
2890 (type_list): Need a COMMA in the middle.
2892 (indexer_declaration): Tell tokenizer to recognize get/set
2894 * Remove old targets.
2896 * Re-add the parser target.
2898 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2900 * cs-parser.jay: Add precendence rules for a number of operators
2901 ot reduce the number of shift/reduce conflicts in the grammar.
2903 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2905 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2908 Get rid of old crufty code.
2910 * rootcontext.cs: Use this to keep track of the parsed
2911 representation and the defined types available to the program.
2913 * gen-treedump.cs: adjust for new convention.
2915 * type.cs: Split out the type manager, and the assembly builder
2918 * typemanager.cs: the type manager will live here now.
2920 * cil-codegen.cs: And the code generator here.
2922 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2924 * makefile: Fixed up for easy making.
2926 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2928 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2931 (unary_expression): Expand pre_increment_expression and
2932 post_decrement_expression to reduce a shift/reduce.
2934 2001-07-11 Simon Cozens
2936 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2938 Improve allow_keyword_as_indent name.
2940 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2942 * Adjustments for Beta2.
2944 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2946 * decl.cs: Added `Define' abstract method.
2947 (InTransit): new property, used to catch recursive definitions.
2949 * interface.cs: Implement `Define'.
2951 * modifiers.cs: Map Modifiers.constants to
2952 System.Reflection.TypeAttribute flags.
2954 * class.cs: Keep track of types and user-defined types.
2955 (BuilderInit): New method for creating an assembly
2956 (ResolveType): New function to launch the resolution process, only
2957 used by interfaces for now.
2959 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2960 that are inserted into the name space.
2962 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2964 * ARGH. I have screwed up my tree so many times due to the use of
2965 rsync rather than using CVS. Going to fix this at once.
2967 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2970 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2972 * Experiment successful: Use System.Type rather that our own
2975 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2977 * cs-parser.jay: Removed nsAliases from here.
2979 Use new namespaces, handle `using XXX;'
2981 * namespace.cs: Reimplemented namespace handling, use a recursive
2982 definition of the class. Now we can keep track of using clauses
2983 and catch invalid using clauses.
2985 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2987 * gen-treedump.cs: Adapted for all the renaming.
2989 * expression.cs (Expression): this class now has a Type property
2990 which returns an expression Type.
2992 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2993 `Type', as this has a different meaning now in the base
2995 2001-05-22 Miguel de Icaza <miguel@ximian.com>
2997 * interface.cs, class.cs: Removed from all the sources the
2998 references to signature computation, as we can not do method
2999 signature computation during the parsing time, as we are not
3000 trying to solve at that point distinguishing:
3004 void a (NS.Blah x) {}
3007 Which depending on the context might be valid or not, as we do not
3008 know if Blah is the same thing as NS.Blah at that point.
3010 * Redid everything so the code uses TypeRefs now instead of
3011 Types. TypeRefs are just temporary type placeholders, that need
3012 to be resolved. They initially have a pointer to a string and the
3013 current scope in which they are used. This is used later by the
3014 compiler to resolve the reference to an actual Type.
3016 * DeclSpace is no longer a CIR.Type, and neither are
3017 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
3018 are all DeclSpaces, but no Types.
3020 * type.cs (TypeRefManager): This implements the TypeRef manager,
3021 which keeps track of all the types that need to be resolved after
3022 the parsing has finished.
3024 2001-05-13 Miguel de Icaza <miguel@ximian.com>
3026 * ARGH. We are going to have to store `foreach' as a class rather
3027 than resolving it, as we need to verify error 1579 after name
3028 resolution. *OR* we could keep a flag that says `This request to
3029 IEnumerator comes from a foreach statement' which we can then use
3030 to generate the error.
3032 2001-05-10 Miguel de Icaza <miguel@ximian.com>
3034 * class.cs (TypeContainer.AddMethod): we now add methods to the
3035 MethodGroup instead of the method hashtable.
3037 * expression.cs: Add MethodGroup abstraction, which gets us one
3038 step closer to the specification in the way we handle method
3041 * cs-parser.jay (primary_expression): qualified_identifier now
3042 tried to match up an identifier to a local variable reference or
3043 to a parameter reference.
3045 current_local_parameters is now a parser global variable that
3046 points to the current parameters for the block, used during name
3049 (property_declaration): Now creates an implicit `value' argument to
3052 2001-05-09 Miguel de Icaza <miguel@ximian.com>
3054 * parameter.cs: Do not use `param' arguments as part of the
3055 signature, per the spec.
3057 2001-05-08 Miguel de Icaza <miguel@ximian.com>
3059 * decl.cs: Base class for classes, structs and interfaces. This
3060 is the "Declaration Space"
3062 * cs-parser.jay: Use CheckDef for checking declaration errors
3063 instead of having one on each function.
3065 * class.cs: Factor out some code for handling error handling in
3066 accordance to the "Declarations" section in the "Basic Concepts"
3067 chapter in the ECMA C# spec.
3069 * interface.cs: Make all interface member classes derive from
3070 InterfaceMemberBase.
3072 2001-05-07 Miguel de Icaza <miguel@ximian.com>
3074 * Many things: all interfaces are parsed and generated in
3075 gen-treedump. Support for member variables, constructors,
3076 destructors, properties, constants is there.
3078 Beginning of the IL backend, but very little done, just there for
3081 2001-04-29 Miguel de Icaza <miguel@ximian.com>
3083 * cs-parser.jay: Fix labeled statement.
3085 * cs-tokenizer.cs (escape): Escape " and ' always.
3086 ref_line, ref_name: keep track of the line/filename as instructed
3087 by #line by the compiler.
3090 2001-04-27 Miguel de Icaza <miguel@ximian.com>
3092 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
3093 to match the values in System.CodeDOM.
3095 Divid renamed to Divide.
3097 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
3099 (Statements.set): remove.
3101 * System.CodeDOM/CodeCatchClause.cs: always have a valid
3104 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
3105 falseStatements always have valid values.
3107 * cs-parser.jay: Use System.CodeDOM now.