1 2001-12-11 Ravi Pratap <ravi@ximian.com>
3 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
5 * ../errors/cs0617.cs : Add.
7 2001-11-11 Ravi Pratap <ravi@ximian.com>
9 * enum.cs (Emit): Rename to Populate to be more consistent with what
10 we expect it to do and when exactly it is called.
12 * class.cs, rootcontext.cs : Update accordingly.
14 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
15 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
17 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
19 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
20 of a fieldinfo using the above, when dealing with a FieldBuilder.
22 2001-11-10 Ravi Pratap <ravi@ximian.com>
24 * ../errors/cs0031.cs : Add.
26 * ../errors/cs1008.cs : Add.
28 * ../errrors/cs0543.cs : Add.
30 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
33 (FindMembers): Implement.
35 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
36 enums and delegates too.
38 (enum_types): Rename to builder_to_enum.
40 (delegate_types): Rename to builder_to_delegate.
42 * delegate.cs (FindMembers): Implement.
44 2001-11-09 Ravi Pratap <ravi@ximian.com>
46 * typemanager.cs (IsEnumType): Implement.
48 * enum.cs (Emit): Re-write parts to account for the underlying type
49 better and perform checking etc.
51 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
52 of the underlying type.
54 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
57 * enum.cs (error31): Helper to report error #31.
59 * cs-parser.jay (enum_declaration): Store location of each member too.
61 * enum.cs (member_to_location): New hashtable.
63 (AddEnumMember): Update location hashtable.
65 (Emit): Use the location of each member while reporting errors.
67 2001-11-09 Miguel de Icaza <miguel@ximian.com>
69 * cs-parser.jay: A for_initializer if is a
70 local_variable_declaration really ammount to have an implicit
71 block with the variable declaration and no initializer for for.
73 * statement.cs (For.Emit): Cope with null initializers.
75 This fixes the infinite loop on for initializers.
77 2001-11-08 Miguel de Icaza <miguel@ximian.com>
79 * enum.cs: More cleanup.
81 * ecore.cs: Remove dead code.
83 * class.cs (Property.Emit): More simplification.
86 Reworked to have less levels of indentation.
88 2001-11-08 Ravi Pratap <ravi@ximian.com>
90 * class.cs (Property): Emit attributes.
100 * enum.cs (Emit): Ditto.
102 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
105 * class.cs (Field, Event, etc.): Move attribute generation into the
106 Emit method everywhere.
108 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
109 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
110 as we had no way of defining nested enums !
112 * rootcontext.cs : Adjust code accordingly.
114 * typemanager.cs (AddEnumType): To keep track of enum types separately.
116 2001-11-07 Ravi Pratap <ravi@ximian.com>
118 * expression.cs (EvalConstantExpression): Move into ecore.cs
120 * enum.cs (Enum): Rename some members and make them public and readonly
121 according to our convention.
123 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
126 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
128 (Enum::Emit): Write a simple version for now which doesn't try to compute
129 expressions. I shall modify this to be more robust in just a while.
131 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
133 (TypeContainer::CloseType): Create the Enum types too.
135 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
137 * expression.cs (EvalConstantExpression): Get rid of completely.
139 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
140 user-defined values and other cases.
142 (IsValidEnumLiteral): Helper function.
144 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
145 out there in the case we had a literal FieldExpr.
147 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
149 (Literalize): Revamp a bit to take two arguments.
151 (EnumLiteral): New class which derives from Literal to wrap enum literals.
153 2001-11-06 Ravi Pratap <ravi@ximian.com>
155 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
157 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
159 (Resolve): Use the above to ensure we have proper initializers.
161 2001-11-05 Ravi Pratap <ravi@ximian.com>
163 * expression.cs (Expression::EvalConstantExpression): New method to
164 evaluate constant expressions.
166 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
168 2001-11-07 Miguel de Icaza <miguel@ximian.com>
170 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
173 (Binary.ResolveOperator): Handle operator != (object a, object b)
174 and operator == (object a, object b);
176 (Binary.DoNumericPromotions): Indicate whether the numeric
177 promotion was possible.
179 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
182 Made the ArrayAccess implement interface IAssignMethod instead of
183 IStackStore as the order in which arguments are passed reflects
186 * assign.cs: Instead of using expr.ExprClass to select the way of
187 assinging, probe for the IStackStore/IAssignMethod interfaces.
189 * typemanager.cs: Load InitializeArray definition.
191 * rootcontext.cs (RootContext.MakeStaticData): Used to define
192 static data that can be used to initialize arrays.
194 2001-11-05 Miguel de Icaza <miguel@ximian.com>
196 * expression.cs: Handle operator== and operator!= for booleans.
198 (Conditioal.Reduce): Implement reducer for the ?: operator.
200 (Conditional.Resolve): Implement dead code elimination.
202 (Binary.Resolve): Catch string literals and return a new
205 (Unary.Reduce): Implement reduction of unary expressions.
207 * ecore.cs: Split out the expression core handling here.
209 (Expression.Reduce): New method used to perform constant folding
210 and CSE. This is needed to support constant-expressions.
212 * statement.cs (Statement.EmitBoolExpression): Pass true and false
213 targets, and optimize for !x.
215 2001-11-04 Ravi Pratap <ravi@ximian.com>
217 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
218 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
219 set custom atttributes.
221 * literal.cs (Literal::GetValue): New abstract method to return the actual
222 value of the literal, cast as an object.
224 (*Literal): Implement GetValue method.
226 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
227 expressions to the arraylist but objects of type Argument.
229 * class.cs (TypeContainer::Emit): Emit our attributes too.
231 (Method::Emit, Constructor::Emit): Ditto.
233 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
234 to be ignoring earlier.
236 2001-11-03 Ravi Pratap <ravi@ximian.com>
238 * attribute.cs (AttributeSection::Define): Implement to do the business
239 of constructing a CustomAttributeBuilder.
241 (Attribute): New trivial class. Increases readability of code.
243 * cs-parser.jay : Update accordingly.
245 (positional_argument_list, named_argument_list, named_argument): New rules
247 (attribute_arguments): Use the above so that we are more correct.
249 2001-11-02 Ravi Pratap <ravi@ximian.com>
251 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
252 to perform all checks for a method with a params parameter.
254 (Invocation::OverloadResolve): Update to use the above method and therefore
255 cope correctly with params method invocations.
257 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
260 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
261 constructors in our parent too because we can't afford to miss out on
264 * attribute.cs (AttributeSection): New name for the class Attribute
266 Other trivial changes to improve readability.
268 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
269 use the new class names.
271 2001-11-01 Ravi Pratap <ravi@ximian.com>
273 * class.cs (Method::Define): Complete definition for params types too
275 (Indexer::Define): Ditto.
277 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
278 Cope everywhere with a request for info about the array parameter.
280 2001-11-01 Ravi Pratap <ravi@ximian.com>
282 * tree.cs (RecordNamespace): Fix up to check for the correct key.
284 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
285 local_variable_type to extract the string corresponding to the type.
287 (local_variable_type): Fixup the action to use the new helper method.
289 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
292 * expression.cs : Clean out code which uses the above.
294 2001-10-31 Ravi Pratap <ravi@ximian.com>
296 * typemanager.cs (RegisterMethod): Check if we already have an existing key
297 and bale out if necessary by returning a false.
299 (RegisterProperty): Ditto.
301 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
302 and print out appropriate error messages.
304 * interface.cs (everywhere): Ditto.
306 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
307 location to constructor.
309 * class.cs (Property, Event, Indexer): Update accordingly.
311 * ../errors/cs111.cs : Added.
313 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
314 of a method, as laid down by the spec.
316 (Invocation::OverloadResolve): Use the above method.
318 2001-10-31 Ravi Pratap <ravi@ximian.com>
320 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
321 now take a TypeContainer and a Parameters object.
323 (ParameterData): Modify return type of ParameterModifier method to be
324 Parameter.Modifier and not a string.
326 (ReflectionParameters, InternalParameters): Update accordingly.
328 * expression.cs (Argument::GetParameterModifier): Same here.
330 * support.cs (InternalParameters::ParameterType): Find a better way of determining
331 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
332 symbol in it at all so maybe this is only for now.
334 2001-10-30 Ravi Pratap <ravi@ximian.com>
336 * support.cs (InternalParameters): Constructor now takes an extra argument
337 which is the actual Parameters class.
339 (ParameterDesc): Update to provide info on ref/out modifiers.
341 * class.cs (everywhere): Update call to InternalParameters to pass in
342 the second argument too.
344 * support.cs (ParameterData): Add ParameterModifier, which is a method
345 to return the modifier info [ref/out etc]
347 (InternalParameters, ReflectionParameters): Implement the above.
349 * expression.cs (Argument::ParameterModifier): Similar function to return
350 info about the argument's modifiers.
352 (Invocation::OverloadResolve): Update to take into account matching modifiers
355 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
356 a new SetFormalParameters object which we pass to InternalParameters.
358 2001-10-30 Ravi Pratap <ravi@ximian.com>
360 * expression.cs (NewArray): Merge into the ArrayCreation class.
362 2001-10-29 Ravi Pratap <ravi@ximian.com>
364 * expression.cs (NewArray): Merge classes NewBuiltinArray and
365 NewUserdefinedArray into one as there wasn't much of a use in having
368 * expression.cs (Argument): Change field's name to ArgType from Type.
370 (Type): New readonly property which returns the proper type, taking into
371 account ref/out modifiers.
373 (everywhere): Adjust code accordingly for the above.
375 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
376 whether we are emitting for a ref or out parameter.
378 * expression.cs (Argument::Emit): Use the above field to set the state.
380 (LocalVariableReference::Emit): Update to honour the flag and emit the
383 * parameter.cs (Attributes): Set the correct flags for ref parameters.
385 * expression.cs (Argument::FullDesc): New function to provide a full desc.
387 * support.cs (ParameterData): Add method ParameterDesc to the interface.
389 (ReflectionParameters, InternalParameters): Implement the above method.
391 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
394 (Invocation::FullMethodDesc): Ditto.
396 2001-10-29 Miguel de Icaza <miguel@ximian.com>
398 * cs-parser.jay: Add extra production for the second form of array
401 * expression.cs (ArrayCreation): Update to reflect the above
404 * Small changes to prepare for Array initialization.
406 2001-10-28 Miguel de Icaza <miguel@ximian.com>
408 * typemanager.cs (ImplementsInterface): interface might be null;
409 Deal with this problem;
411 Also, we do store negative hits on the cache (null values), so use
412 this instead of calling t.GetInterfaces on the type everytime.
414 2001-10-28 Ravi Pratap <ravi@ximian.com>
416 * typemanager.cs (IsBuiltinType): New method to help determine the same.
418 * expression.cs (New::DoResolve): Get rid of array creation code and instead
419 split functionality out into different classes.
421 (New::FormArrayType): Move into NewBuiltinArray.
423 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
426 (NewBuiltinArray): New class to handle creation of built-in arrays.
428 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
429 account creation of one-dimensional arrays.
431 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
433 (NewUserdefinedArray::DoResolve): Implement.
435 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
437 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
438 we maintain inside the TypeManager. This is necessary to perform lookups on the
441 (LookupType): Update to perform GetType on the module builders too.
443 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
445 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
447 2001-10-23 Ravi Pratap <ravi@ximian.com>
449 * expression.cs (New::DoResolve): Implement guts of array creation.
451 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
453 2001-10-27 Miguel de Icaza <miguel@ximian.com>
455 * expression.cs: Fix bug I introduced lsat night that broke
458 (Expression.Resolve): Report a 246 error (can not resolve name)
459 if we find a SimpleName in the stream.
461 (Expression.ResolveLValue): Ditto.
463 (Expression.ResolveWithSimpleName): This function is a variant of
464 ResolveName, this one allows SimpleNames to be returned without a
465 warning. The only consumer of SimpleNames is MemberAccess
467 2001-10-26 Miguel de Icaza <miguel@ximian.com>
469 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
470 might arrive here. I have my doubts that this is correct.
472 * statement.cs (Lock): Implement lock statement.
474 * cs-parser.jay: Small fixes to support `lock' and `using'
476 * cs-tokenizer.cs: Remove extra space
478 * driver.cs: New flag --checked, allows to turn on integer math
481 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
482 Threading.Monitor.Exit
484 2001-10-23 Miguel de Icaza <miguel@ximian.com>
486 * expression.cs (IndexerAccess::DoResolveLValue): Set the
487 Expression Class to be IndexerAccess.
489 Notice that Indexer::DoResolve sets the eclass to Value.
491 2001-10-22 Miguel de Icaza <miguel@ximian.com>
493 * class.cs (TypeContainer::Emit): Emit code for indexers.
495 * assign.cs (IAssignMethod): New interface implemented by Indexers
496 and Properties for handling assignment.
498 (Assign::Emit): Simplify and reuse code.
500 * expression.cs (IndexerAccess, PropertyExpr): Implement
501 IAssignMethod, clean up old code.
503 2001-10-22 Ravi Pratap <ravi@ximian.com>
505 * typemanager.cs (ImplementsInterface): New method to determine if a type
506 implements a given interface. Provides a nice cache too.
508 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
511 (ConvertReferenceExplicit): Ditto.
513 * delegate.cs (Delegate::Populate): Update to define the parameters on the
514 various methods, with correct names etc.
516 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
517 Operator.UnaryNegation.
519 * cs-parser.jay (operator_declarator): Be a little clever in the case where
520 we have a unary plus or minus operator.
522 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
525 * everywhere : update accordingly.
527 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
530 * class.cs (Method::Define): For the case where we are implementing a method
531 inherited from an interface, we need to set the MethodAttributes.Final flag too.
532 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
534 2001-10-21 Ravi Pratap <ravi@ximian.com>
536 * interface.cs (FindMembers): Implement to work around S.R.E
539 * typemanager.cs (IsInterfaceType): Implement.
541 (FindMembers): Update to handle interface types too.
543 * expression.cs (ImplicitReferenceConversion): Re-write bits which
544 use IsAssignableFrom as that is not correct - it doesn't work.
546 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
547 and accordingly override EmitStatement.
549 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
550 using the correct logic :-)
552 2001-10-19 Ravi Pratap <ravi@ximian.com>
554 * ../errors/cs-11.cs : Add to demonstrate error -11
556 2001-10-17 Miguel de Icaza <miguel@ximian.com>
558 * assign.cs (Assign::Resolve): Resolve right hand side first, and
559 then pass this as a hint to ResolveLValue.
561 * expression.cs (FieldExpr): Add Location information
563 (FieldExpr::LValueResolve): Report assignment to readonly
566 (Expression::ExprClassFromMemberInfo): Pass location information.
568 (Expression::ResolveLValue): Add new method that resolves an
571 (Expression::DoResolveLValue): Default invocation calls
574 (Indexers): New class used to keep track of indexers in a given
577 (IStackStore): Renamed from LValue, as it did not really describe
578 what this did. Also ResolveLValue is gone from this interface and
579 now is part of Expression.
581 (ElementAccess): Depending on the element access type
583 * typemanager.cs: Add `indexer_name_type' as a Core type
584 (System.Runtime.CompilerServices.IndexerNameAttribute)
586 * statement.cs (Goto): Take a location.
588 2001-10-18 Ravi Pratap <ravi@ximian.com>
590 * delegate.cs (Delegate::VerifyDelegate): New method to verify
591 if two delegates are compatible.
593 (NewDelegate::DoResolve): Update to take care of the case when
594 we instantiate a delegate from another delegate.
596 * typemanager.cs (FindMembers): Don't even try to look up members
597 of Delegate types for now.
599 2001-10-18 Ravi Pratap <ravi@ximian.com>
601 * delegate.cs (NewDelegate): New class to take care of delegate
604 * expression.cs (New): Split the delegate related code out into
605 the NewDelegate class.
607 * delegate.cs (DelegateInvocation): New class to handle delegate
610 * expression.cs (Invocation): Split out delegate related code into
611 the DelegateInvocation class.
613 2001-10-17 Ravi Pratap <ravi@ximian.com>
615 * expression.cs (New::DoResolve): Implement delegate creation fully
616 and according to the spec.
618 (New::DoEmit): Update to handle delegates differently.
620 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
621 because of which we were printing out arguments in reverse order !
623 * delegate.cs (VerifyMethod): Implement to check if the given method
624 matches the delegate.
626 (FullDelegateDesc): Implement.
628 (VerifyApplicability): Implement.
630 * expression.cs (Invocation::DoResolve): Update to accordingly handle
631 delegate invocations too.
633 (Invocation::Emit): Ditto.
635 * ../errors/cs1593.cs : Added.
637 * ../errors/cs1594.cs : Added.
639 * delegate.cs (InstanceExpression, TargetMethod): New properties.
641 2001-10-16 Ravi Pratap <ravi@ximian.com>
643 * typemanager.cs (intptr_type): Core type for System.IntPtr
645 (InitCoreTypes): Update for the same.
647 (iasyncresult_type, asynccallback_type): Ditto.
649 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
652 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
655 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
656 the builders for the 4 members of a delegate type :-)
658 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
661 * expression.cs (New::DoResolve): Implement guts for delegate creation.
663 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
665 2001-10-15 Miguel de Icaza <miguel@ximian.com>
667 * statement.cs (Break::Emit): Implement.
668 (Continue::Emit): Implement.
670 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
671 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
672 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
673 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
676 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
677 properties that track the label for the current loop (begin of the
678 loop and end of the loop).
680 2001-10-15 Ravi Pratap <ravi@ximian.com>
682 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
683 use of emitting anything at all.
685 * class.cs, rootcontext.cs : Get rid of calls to the same.
687 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
689 (Populate): Define the constructor correctly and set the implementation
692 * typemanager.cs (delegate_types): New hashtable to hold delegates that
695 (AddDelegateType): Implement.
697 (IsDelegateType): Implement helper method.
699 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
701 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
702 and accordingly handle it.
704 * delegate.cs (Populate): Take TypeContainer argument.
705 Implement bits to define the Invoke method. However, I still haven't figured out
706 how to take care of the native int bit :-(
708 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
709 Qualify the name of the delegate, not its return type !
711 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
714 (StandardConversionExists): Checking for array types turns out to be recursive.
716 (ConvertReferenceExplicit): Implement array conversion.
718 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
720 2001-10-12 Ravi Pratap <ravi@ximian.com>
722 * cs-parser.jay (delegate_declaration): Store the fully qualified
723 name as it is a type declaration.
725 * delegate.cs (ReturnType, Name): Rename members to these. Make them
728 (DefineDelegate): Renamed from Define. Does the same thing essentially,
729 as TypeContainer::DefineType.
731 (Populate): Method in which all the definition of the various methods (Invoke)
734 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
737 (CloseDelegate): Finally creates the delegate.
739 * class.cs (TypeContainer::DefineType): Update to define delegates.
740 (Populate, Emit and CloseType): Do the same thing here too.
742 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
743 delegates in all these operations.
745 2001-10-14 Miguel de Icaza <miguel@ximian.com>
747 * expression.cs: LocalTemporary: a new expression used to
748 reference a temporary that has been created.
750 * assign.cs: Handle PropertyAccess back here, so that we can
751 provide the proper semantic access to properties.
753 * expression.cs (Expression::ConvertReferenceExplicit): Implement
754 a few more explicit conversions.
756 * modifiers.cs: `NEW' modifier maps to HideBySig.
758 * expression.cs (PropertyExpr): Make this into an
759 ExpressionStatement, and support the EmitStatement code path.
761 Perform get/set error checking, clean up the interface.
763 * assign.cs: recognize PropertyExprs as targets, and if so, turn
764 them into toplevel access objects.
766 2001-10-12 Miguel de Icaza <miguel@ximian.com>
768 * expression.cs: PropertyExpr::PropertyExpr: use work around the
771 * typemanager.cs: Keep track here of our PropertyBuilders again to
772 work around lameness in SRE.
774 2001-10-11 Miguel de Icaza <miguel@ximian.com>
776 * expression.cs (LValue::LValueResolve): New method in the
777 interface, used to perform a second resolution pass for LValues.
779 (This::DoResolve): Catch the use of this in static methods.
781 (This::LValueResolve): Implement.
783 (This::Store): Remove warning, assigning to `this' in structures
786 (Invocation::Emit): Deal with invocation of
787 methods on value types. We need to pass the address to structure
788 methods rather than the object itself. (The equivalent code to
789 emit "this" for structures leaves the entire structure on the
790 stack instead of a pointer to it).
792 (ParameterReference::DoResolve): Compute the real index for the
793 argument based on whether the method takes or not a `this' pointer
794 (ie, the method is static).
796 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
797 value types returned from functions when we need to invoke a
798 method on the sturcture.
801 2001-10-11 Ravi Pratap <ravi@ximian.com>
803 * class.cs (TypeContainer::DefineType): Method to actually do the business of
804 defining the type in the Modulebuilder or Typebuilder. This is to take
805 care of nested types which need to be defined on the TypeBuilder using
808 (TypeContainer::GetClassBases): Implement. Essentially the code from the
809 methods in RootContext, only ported to be part of TypeContainer.
811 (TypeContainer::GetInterfaceOrClass): Ditto.
813 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
815 * interface.cs (Interface::DefineInterface): New method. Does exactly
816 what RootContext.CreateInterface did earlier, only it takes care of nested types
819 (Interface::GetInterfaces): Move from RootContext here and port.
821 (Interface::GetInterfaceByName): Same here.
823 * rootcontext.cs (ResolveTree): Re-write.
825 (PopulateTypes): Re-write.
827 * class.cs (TypeContainer::Populate): Populate nested types too.
828 (TypeContainer::Emit): Emit nested members too.
830 * typemanager.cs (AddUserType): Do not make use of the FullName property,
831 instead just use the name argument passed in as it is already fully
834 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
835 to TypeContainer mapping to see if a type is user-defined.
837 * class.cs (TypeContainer::CloseType): Implement.
839 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
840 the default constructor.
842 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
845 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
847 * interface.cs (CloseType): Create the type here.
849 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
852 Remove all the methods which are now in TypeContainer.
854 2001-10-10 Ravi Pratap <ravi@ximian.com>
856 * delegate.cs (Define): Re-write bits to define the delegate
859 2001-10-10 Miguel de Icaza <miguel@ximian.com>
861 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
863 * expression.cs (ImplicitReferenceConversion): handle null as well
864 as a source to convert to any reference type.
866 * statement.cs (Return): Perform any implicit conversions to
867 expected return type.
869 Validate use of return statement.
871 * codegen.cs (EmitContext): Pass the expected return type here.
873 * class.cs (Method, Constructor, Property): Pass expected return
876 2001-10-09 Miguel de Icaza <miguel@ximian.com>
878 * expression.cs: Make DoResolve take an EmitContext instead of a
881 Replaced `l' and `location' for `loc', for consistency.
883 (Error, Warning): Remove unneeded Tc argument.
885 * assign.cs, literal.cs, constant.cs: Update to new calling
888 * codegen.cs: EmitContext now contains a flag indicating whether
889 code is being generated in a static method or not.
891 * cs-parser.jay: DecomposeQI, new function that replaces the old
892 QualifiedIdentifier. Now we always decompose the assembled
893 strings from qualified_identifier productions into a group of
896 2001-10-08 Miguel de Icaza <miguel@ximian.com>
898 * rootcontext.cs: Deal with field-less struct types correctly now
899 by passing the size option to Define Type.
901 * class.cs: Removed hack that created one static field.
903 2001-10-07 Miguel de Icaza <miguel@ximian.com>
905 * statement.cs: Moved most of the code generation here.
907 2001-10-09 Ravi Pratap <ravi@ximian.com>
909 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
912 (ElementAccess): Remove useless bits for now - keep checks as the spec
915 2001-10-08 Ravi Pratap <ravi@ximian.com>
917 * expression.cs (ElementAccess::DoResolve): Remove my crap code
918 and start performing checks according to the spec.
920 2001-10-07 Ravi Pratap <ravi@ximian.com>
922 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
923 rank_specifiers instead.
925 (rank_specifiers): Change the order in which the rank specifiers are stored
927 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
929 * expression.cs (ElementAccess): Implement the LValue interface too.
931 2001-10-06 Ravi Pratap <ravi@ximian.com>
933 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
934 except that user defined conversions are not included.
936 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
937 perform the conversion of the return type, if necessary.
939 (New::DoResolve): Check whether we are creating an array or an object
940 and accordingly do the needful.
942 (New::Emit): Same here.
944 (New::DoResolve): Implement guts of array creation.
946 (New::FormLookupType): Helper function.
948 2001-10-07 Miguel de Icaza <miguel@ximian.com>
950 * codegen.cs: Removed most of the code generation here, and move the
951 corresponding code generation bits to the statement classes.
953 Added support for try/catch/finalize and throw.
955 * cs-parser.jay: Added support for try/catch/finalize.
957 * class.cs: Catch static methods having the flags override,
960 * expression.cs (UserCast): This user cast was not really doing
961 what it was supposed to do. Which is to be born in fully resolved
962 state. Parts of the resolution were being performed at Emit time!
966 2001-10-05 Miguel de Icaza <miguel@ximian.com>
968 * expression.cs: Implicity convert the result from UserCast.
970 2001-10-05 Ravi Pratap <ravi@ximian.com>
972 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
973 prevented it from working correctly.
975 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
976 merely ConvertImplicit.
978 2001-10-05 Miguel de Icaza <miguel@ximian.com>
980 * typemanager.cs: Make the LookupTypeContainer function static,
981 and not per-instance.
983 * class.cs: Make static FindMembers (the one that takes a Type
986 * codegen.cs: Add EmitForeach here.
988 * cs-parser.jay: Make foreach a toplevel object instead of the
989 inline expansion, as we need to perform semantic analysis on it.
991 2001-10-05 Ravi Pratap <ravi@ximian.com>
993 * expression.cs (Expression::ImplicitUserConversion): Rename to
994 UserDefinedConversion.
996 (Expression::UserDefinedConversion): Take an extra argument specifying
997 whether we look for explicit user conversions too.
999 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
1001 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
1003 (ExplicitUserConversion): Make it a call to UserDefinedConversion
1004 with the appropriate arguments.
1006 * cs-parser.jay (cast_expression): Record location too.
1008 * expression.cs (Cast): Record location info.
1010 (Expression::ConvertExplicit): Take location argument.
1012 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
1013 to determine if we are doing explicit conversions.
1015 (UserCast::Emit): Update accordingly.
1017 (Expression::ConvertExplicit): Report an error if everything fails.
1019 * ../errors/cs0030.cs : Add.
1021 2001-10-04 Miguel de Icaza <miguel@ximian.com>
1023 * modifiers.cs: If the ABSTRACT keyword is present, also set the
1024 virtual and newslot bits.
1026 * class.cs (TypeContainer::RegisterRequiredImplementations):
1027 Record methods we need.
1029 (TypeContainer::MakeKey): Helper function to make keys for
1030 MethodBases, since the Methodbase key is useless.
1032 (TypeContainer::Populate): Call RegisterRequiredImplementations
1033 before defining the methods.
1035 Create a mapping for method_builders_to_methods ahead of time
1036 instead of inside a tight loop.
1038 (::RequireMethods): Accept an object as the data to set into the
1039 hashtable so we can report interface vs abstract method mismatch.
1041 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1043 * report.cs: Make all of it static.
1045 * rootcontext.cs: Drop object_type and value_type computations, as
1046 we have those in the TypeManager anyways.
1048 Drop report instance variable too, now it is a global.
1050 * driver.cs: Use try/catch on command line handling.
1052 Add --probe option to debug the error reporting system with a test
1055 * report.cs: Add support for exiting program when a probe
1056 condition is reached.
1058 2001-10-03 Ravi Pratap <ravi@ximian.com>
1060 * expression.cs (Binary::DoNumericPromotions): Fix the case when
1061 we do a forcible conversion regardless of type, to check if
1062 ForceConversion returns a null.
1064 (Binary::error19): Use location to report error.
1066 (Unary::error23): Use location here too.
1068 * ../errors/cs0019.cs : Check in.
1070 * ../errors/cs0023.cs : Check in.
1072 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
1073 case of a non-null MethodInfo object with a length of 0 !
1075 (Binary::ResolveOperator): Flag error if overload resolution fails to find
1076 an applicable member - according to the spec :-)
1077 Also fix logic to find members in base types.
1079 (Unary::ResolveOperator): Same here.
1081 (Unary::report23): Change name to error23 and make first argument a TypeContainer
1082 as I was getting thoroughly confused between this and error19 :-)
1084 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
1085 (::FindMostEncompassedType): Implement.
1086 (::FindMostEncompassingType): Implement.
1087 (::StandardConversionExists): Implement.
1089 (UserImplicitCast): Re-vamp. We now need info about most specific
1090 source and target types so that we can do the necessary conversions.
1092 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
1093 mathematical union with no duplicates.
1095 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1097 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
1098 in order from base classes to child classes, so that we can in
1099 child classes look up in our parent for method names and
1100 attributes (required for handling abstract, virtual, new, override
1101 constructs: we need to instrospect our base class, and if we dont
1102 populate the classes in order, the introspection might be
1103 incorrect. For example, a method could query its parent before
1104 the parent has any methods and would determine that the parent has
1105 no abstract methods (while it could have had them)).
1107 (RootContext::CreateType): Record the order in which we define the
1110 2001-10-02 Miguel de Icaza <miguel@ximian.com>
1112 * class.cs (TypeContainer::Populate): Also method definitions can
1113 fail now, keep track of this.
1115 (TypeContainer::FindMembers): Implement support for
1116 DeclaredOnly/noDeclaredOnly flag.
1118 (Constructor::Emit) Return the ConstructorBuilder.
1120 (Method::Emit) Return the MethodBuilder.
1121 Check for abstract or virtual methods to be public.
1123 * rootcontext.cs (RootContext::CreateType): Register all the
1124 abstract methods required for the class to be complete and the
1125 interface methods that must be implemented.
1127 * cs-parser.jay: Report error 501 (method requires body if it is
1128 not marked abstract or extern).
1130 * expression.cs (TypeOf::Emit): Implement.
1132 * typemanager.cs: runtime_handle_type, new global type.
1134 * class.cs (Property::Emit): Generate code for properties.
1136 2001-10-02 Ravi Pratap <ravi@ximian.com>
1138 * expression.cs (Unary::ResolveOperator): Find operators on base type
1139 too - we now conform exactly to the spec.
1141 (Binary::ResolveOperator): Same here.
1143 * class.cs (Operator::Define): Fix minor quirk in the tests.
1145 * ../errors/cs0215.cs : Added.
1147 * ../errors/cs0556.cs : Added.
1149 * ../errors/cs0555.cs : Added.
1151 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1153 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
1154 single integer which is really efficient
1156 2001-10-01 Ravi Pratap <ravi@ximian.com>
1158 * expression.cs (Expression::ImplicitUserConversion): Use location
1159 even in the case when we are examining True operators.
1161 * class.cs (Operator::Define): Perform extensive checks to conform
1162 with the rules for operator overloading in the spec.
1164 * expression.cs (Expression::ImplicitReferenceConversion): Implement
1165 some of the other conversions mentioned in the spec.
1167 * typemanager.cs (array_type): New static member for the System.Array built-in
1170 (cloneable_interface): For System.ICloneable interface.
1172 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
1173 we start resolving the tree and populating types.
1175 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
1177 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1179 * expression.cs (Expression::ExprClassFromMemberInfo,
1180 Expression::Literalize): Create literal expressions from
1181 FieldInfos which are literals.
1183 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
1184 type casts, because they were wrong. The test suite in tests
1187 (ImplicitNumericConversion): ushort to ulong requires a widening
1190 Int32 constant to long requires widening cast as well.
1192 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
1193 for integers because the type on the stack is not i4.
1195 2001-09-30 Miguel de Icaza <miguel@ximian.com>
1197 * expression.cs (report118): require location argument.
1199 * parameter.cs: Do not dereference potential null value.
1201 * class.cs: Catch methods that lack the `new' keyword when
1202 overriding a name. Report warnings when `new' is used without
1203 anything being there to override.
1205 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
1207 * class.cs: Only add constructor to hashtable if it is non-null
1208 (as now constructors can fail on define).
1210 (TypeManager, Class, Struct): Take location arguments.
1212 Catch field instance initialization in structs as errors.
1214 accepting_filter: a new filter for FindMembers that is static so
1215 that we dont create an instance per invocation.
1217 (Constructor::Define): Catch errors where a struct constructor is
1220 * cs-parser.jay: Pass location information for various new
1223 * delegate.cs (Delegate): take a location argument.
1225 * driver.cs: Do not call EmitCode if there were problesm in the
1226 Definition of the types, as many Builders wont be there.
1228 * decl.cs (Decl::Decl): Require a location argument.
1230 * cs-tokenizer.cs: Handle properly hex constants that can not fit
1231 into integers, and find the most appropiate integer for it.
1233 * literal.cs: Implement ULongLiteral.
1235 * rootcontext.cs: Provide better information about the location of
1236 failure when CreateType fails.
1238 2001-09-29 Miguel de Icaza <miguel@ximian.com>
1240 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
1243 * expression.cs (Binary::CheckShiftArguments): Add missing type
1245 (Binary::ResolveOperator): Add type to the logical and and logical
1246 or, Bitwise And/Or and Exclusive Or code paths, it was missing
1249 (Binary::DoNumericPromotions): In the case where either argument
1250 is ulong (and most signed types combined with ulong cause an
1251 error) perform implicit integer constant conversions as well.
1253 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1255 * expression.cs (UserImplicitCast): Method should always be
1257 (Invocation::BetterConversion): Simplified test for IntLiteral.
1259 (Expression::ImplicitNumericConversion): Split this routine out.
1260 Put the code that performs implicit constant integer conversions
1263 (Expression::Resolve): Become a wrapper around DoResolve so we can
1264 check eclass and type being set after resolve.
1266 (Invocation::Badness): Remove this dead function
1268 (Binary::ResolveOperator): Do not compute the expensive argumnets
1269 unless we have a union for it.
1271 (Probe::Emit): Is needs to do an isinst and then
1272 compare against null.
1274 (::CanConvert): Added Location argument. If the Location argument
1275 is null (Location.Null), then we do not report errors. This is
1276 used by the `probe' mechanism of the Explicit conversion. We do
1277 not want to generate an error for something that the user
1278 explicitly requested to be casted. But the pipeline for an
1279 explicit cast first tests for potential implicit casts.
1281 So for now, if the Location is null, it means `Probe only' to
1282 avoid adding another argument. Might have to revise this
1285 (ClassCast): New class used to type cast objects into arbitrary
1286 classes (used in Explicit Reference Conversions).
1288 Implement `as' as well.
1290 Reverted all the patches from Ravi below: they were broken:
1292 * The use of `level' as a mechanism to stop recursive
1293 invocations is wrong. That was there just to catch the
1294 bug with a strack trace but not as a way of addressing
1297 To fix the problem we have to *understand* what is going
1298 on and the interactions and come up with a plan, not
1299 just get things going.
1301 * The use of the type conversion cache that I proposed
1302 last night had an open topic: How does this work across
1303 protection domains. A user defined conversion might not
1304 be public in the location where we are applying the
1305 conversion, a different conversion might be selected
1306 (ie, private A->B (better) but public B->A (worse),
1307 inside A, A->B applies, but outside it, B->A will
1310 * On top of that (ie, even if the above is solved),
1311 conversions in a cache need to be abstract. Ie, `To
1312 convert from an Int to a Short use an OpcodeCast', not
1313 `To convert from an Int to a Short use the OpcodeCast on
1314 the variable 5' (which is what this patch was doing).
1316 2001-09-28 Ravi Pratap <ravi@ximian.com>
1318 * expression.cs (Invocation::ConversionExists): Re-write to use
1319 the conversion cache
1321 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
1322 cache all conversions done, not just user-defined ones.
1324 (Invocation::BetterConversion): The real culprit. Use ConversionExists
1325 to determine if a conversion exists instead of acutually trying to
1326 perform the conversion. It's faster too.
1328 (Expression::ConvertExplicit): Modify to use ConversionExists to check
1329 and only then attempt the implicit conversion.
1331 2001-09-28 Ravi Pratap <ravi@ximian.com>
1333 * expression.cs (ConvertImplicit): Use a cache for conversions
1334 already found. Check level of recursion and bail out if necessary.
1336 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1338 * typemanager.cs (string_concat_string_string, string_concat_object_object):
1339 Export standard methods that we expect for string operations.
1341 * statement.cs (Block::UsageWarning): Track usage of variables and
1342 report the errors for not used variables.
1344 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
1347 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1349 * codegen.cs: remove unnneded code
1351 * expression.cs: Removed BuiltinTypeAccess class
1353 Fix the order in which implicit conversions are
1356 The previous fixed dropped support for boxed conversions (adding a
1357 test to the test suite now)
1359 (UserImplicitCast::CanConvert): Remove test for source being null,
1360 that code is broken. We should not feed a null to begin with, if
1361 we do, then we should track the bug where the problem originates
1362 and not try to cover it up here.
1364 Return a resolved expression of type UserImplicitCast on success
1365 rather than true/false. Ravi: this is what I was talking about,
1366 the pattern is to use a static method as a "constructor" for
1369 Also, do not create arguments until the very last minute,
1370 otherwise we always create the arguments even for lookups that
1371 will never be performed.
1373 (UserImplicitCast::Resolve): Eliminate, objects of type
1374 UserImplicitCast are born in a fully resolved state.
1376 * typemanager.cs (InitCoreTypes): Init also value_type
1379 * expression.cs (Cast::Resolve): First resolve the child expression.
1381 (LValue): Add new method AddressOf to be used by
1384 Change the argument of Store to take an EmitContext instead of an
1385 ILGenerator, because things like FieldExpr need to be able to call
1386 their children expression to generate the instance code.
1388 (Expression::Error, Expression::Warning): Sugar functions for
1391 (Expression::MemberLookup): Accept a TypeContainer instead of a
1392 Report as the first argument.
1394 (Expression::ResolvePrimary): Killed. I still want to improve
1395 this as currently the code is just not right.
1397 (Expression::ResolveMemberAccess): Simplify, but it is still
1400 (Unary::Resolve): Catch errors in AddressOf operators.
1402 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
1403 index to a byte for the short-version, or the compiler will choose
1404 the wrong Emit call, which generates the wrong data.
1406 (ParameterReference::Emit, ::Store): same.
1408 (FieldExpr::AddressOf): Implement.
1410 * typemanager.cs: TypeManager: made public variable instead of
1413 * driver.cs: document --fatal.
1415 * report.cs (ErrorMessage, WarningMessage): new names for the old
1416 Error and Warning classes.
1418 * cs-parser.jay (member_access): Turn built-in access to types
1419 into a normal simplename
1421 2001-09-27 Ravi Pratap <ravi@ximian.com>
1423 * expression.cs (Invocation::BetterConversion): Fix to cope
1424 with q being null, since this was introducing a bug.
1426 * expression.cs (ConvertImplicit): Do built-in conversions first.
1428 2001-09-27 Ravi Pratap <ravi@ximian.com>
1430 * expression.cs (UserImplicitCast::Resolve): Fix bug.
1432 2001-09-27 Ravi Pratap <ravi@ximian.com>
1434 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
1435 I had introduced long ago (what's new ?).
1437 * expression.cs (UserImplicitCast::CanConvert): Static method to do
1438 the work of all the checking.
1439 (ConvertImplicit): Call CanConvert and only then create object if necessary.
1440 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
1442 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
1443 that is the right way.
1445 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
1446 overloading resolution. Use everywhere instead of cutting and pasting code.
1448 (Binary::ResolveOperator): Use MakeUnionSet.
1450 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
1451 we have to convert to bool types. Not complete yet.
1453 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1455 * typemanager.cs (TypeManager::CSharpName): support ushort.
1457 * expression.cs (Expression::TryImplicitIntConversion): Attempts
1458 to provide an expression that performsn an implicit constant int
1459 conversion (section 6.1.6).
1460 (Expression::ConvertImplicitRequired): Reworked to include
1461 implicit constant expression conversions.
1463 (Expression::ConvertNumericExplicit): Finished.
1465 (Invocation::Emit): If InstanceExpression is null, then it means
1466 that we perform a call on this.
1468 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1470 * expression.cs (Unary::Emit): Remove some dead code.
1471 (Probe): Implement Resolve and Emit for `is'.
1472 (Expression::ConvertImplicitRequired): Attempt to do constant
1473 expression conversions here. Maybe should be moved to
1474 ConvertImplicit, but I am not sure.
1475 (Expression::ImplicitLongConstantConversionPossible,
1476 Expression::ImplicitIntConstantConversionPossible): New functions
1477 that tell whether is it possible to apply an implicit constant
1478 expression conversion.
1480 (ConvertNumericExplicit): Started work on explicit numeric
1483 * cs-parser.jay: Update operator constants.
1485 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
1486 (Parameters::GetSignature): Hook up VerifyArgs here.
1487 (Parameters::VerifyArgs): Verifies that no two arguments have the
1490 * class.cs (Operator): Update the operator names to reflect the
1491 ones that the spec expects (as we are just stringizing the
1494 * expression.cs (Unary::ResolveOperator): Fix bug: Use
1495 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
1496 previous usage did only work for our methods.
1497 (Expression::ConvertImplicit): Handle decimal implicit numeric
1498 conversions as well.
1499 (Expression::InternalTypeConstructor): Used to invoke constructors
1500 on internal types for default promotions.
1502 (Unary::Emit): Implement special handling for the pre/post
1503 increment/decrement for overloaded operators, as they need to have
1504 the same semantics as the other operators.
1506 (Binary::ResolveOperator): ditto.
1507 (Invocation::ConversionExists): ditto.
1508 (UserImplicitCast::Resolve): ditto.
1510 2001-09-26 Ravi Pratap <ravi@ximian.com>
1512 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
1513 operator, return after emitting body. Regression tests pass again !
1515 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
1516 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
1517 (Invocation::OverloadResolve): Ditto.
1518 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
1520 * everywhere : update calls to the above methods accordingly.
1522 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1524 * assign.cs (Assign): Make it inherit from ExpressionStatement.
1526 * expression.cs (ExpressionStatement): New base class used for
1527 expressions that can appear in statements, so that we can provide
1528 an alternate path to generate expression that do not leave a value
1531 (Expression::Emit, and all the derivatives): We no longer return
1532 whether a value is left on the stack or not. Every expression
1533 after being emitted leaves a single value on the stack.
1535 * codegen.cs (EmitContext::EmitStatementExpression): Use the
1536 facilties of ExpressionStatement if possible.
1538 * cs-parser.jay: Update statement_expression.
1540 2001-09-25 Miguel de Icaza <miguel@ximian.com>
1542 * driver.cs: Change the wording of message
1544 2001-09-25 Ravi Pratap <ravi@ximian.com>
1546 * expression.cs (Binary::ResolveOperator): Had forgottten to set
1547 the type of the expression to the return type of the method if
1548 we have an overloaded operator match ! The regression tests pass again !
1549 (Unary::ResolveOperator): Ditto.
1551 * expression.cs (Invocation::ConversionExists): Correct the member lookup
1552 to find "op_Implicit", not "implicit" ;-)
1553 (UserImplicitCast): New class to take care of user-defined implicit conversions.
1554 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1556 * everywhere : Correct calls to the above accordingly.
1558 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1559 (ConvertImplicit): Do user-defined conversion if it exists.
1561 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1563 * assign.cs: track location.
1564 (Resolve): Use implicit conversions on assignment.
1566 * literal.cs: Oops. Not good, Emit of short access values should
1567 pass (Bytes) or the wrong argument will be selected.
1569 * expression.cs (Unary::Emit): Emit code for -expr.
1571 (Unary::ResolveOperator): Handle `Substract' for non-constants
1572 (substract from zero from the non-constants).
1573 Deal with Doubles as well.
1575 (Expression::ConvertImplicitRequired): New routine that reports an
1576 error if no implicit conversion exists.
1578 (Invocation::OverloadResolve): Store the converted implicit
1579 expressions if we make them
1581 2001-09-24 Ravi Pratap <ravi@ximian.com>
1583 * class.cs (ConstructorInitializer): Take a Location argument.
1584 (ConstructorBaseInitializer): Same here.
1585 (ConstructorThisInitializer): Same here.
1587 * cs-parser.jay : Update all calls accordingly.
1589 * expression.cs (Unary, Binary, New): Take location argument.
1590 Update accordingly everywhere.
1592 * cs-parser.jay : Update all calls to the above to take a location
1597 2001-09-24 Ravi Pratap <ravi@ximian.com>
1599 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1600 (Invocation::BetterConversion): Same here
1601 (Invocation::ConversionExists): Ditto.
1603 (Invocation::ConversionExists): Implement.
1605 2001-09-22 Ravi Pratap <ravi@ximian.com>
1607 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1608 Also take an additional TypeContainer argument.
1610 * All over : Pass in TypeContainer as argument to OverloadResolve.
1612 * typemanager.cs (CSharpName): Update to check for the string type and return
1615 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1618 2001-09-21 Ravi Pratap <ravi@ximian.com>
1620 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1621 (Invocation::BetterFunction): Implement.
1622 (Invocation::BetterConversion): Implement.
1623 (Invocation::ConversionExists): Skeleton, no implementation yet.
1625 Okay, things work fine !
1627 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1629 * typemanager.cs: declare and load enum_type, delegate_type and
1632 * expression.cs (Expression::Emit): Now emit returns a value that
1633 tells whether a value is left on the stack or not. This strategy
1634 might be reveted tomorrow with a mechanism that would address
1635 multiple assignments.
1636 (Expression::report118): Utility routine to report mismatches on
1639 (Unary::Report23): Report impossible type/operator combination
1642 (Unary::IsIncrementableNumber): Whether the type can be
1643 incremented or decremented with add.
1644 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1646 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1648 (Invocation::Emit): Deal with new Emit convetion.
1650 * All Expression derivatives: Updated their Emit method to return
1651 whether they leave values on the stack or not.
1653 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1654 stack for expressions that are statements.
1656 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1658 * expression.cs (LValue): New interface. Must be implemented by
1660 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1663 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1664 interface for generating code, simplifies the code.
1666 2001-09-20 Ravi Pratap <ravi@ximian.com>
1668 * expression.cs (everywhere): Comment out return statements in ::Resolve
1669 methods to avoid the warnings.
1671 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1673 * driver.cs (parse): Report error 2001 if we can not open the
1676 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1679 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1682 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1683 otherwise nested blocks end up with the same index.
1685 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1687 * expression.cs: Instead of having FIXMEs in the Resolve
1688 functions, throw exceptions so it is obvious that we are facing a
1691 * cs-parser.jay (invocation_expression): Pass Location information.
1693 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1694 Use a basename for those routines because .NET does not like paths
1697 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1700 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1702 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1703 are loading the correct data types (throws an exception if not).
1704 (TypeManager::InitCoreTypes): Use CoreLookupType
1706 * expression.cs (Unary::ResolveOperator): return the child
1707 expression for expressions which are just +expr.
1708 (Unary::ResolveOperator): Return negative literals for -LITERAL
1709 expressions (otherwise they are Unary {Literal}).
1710 (Invocation::Badness): Take into account `Implicit constant
1711 expression conversions'.
1713 * literal.cs (LongLiteral): Implement long literal class.
1714 (IntLiteral): export the `Value' of the intliteral.
1716 2001-09-19 Ravi Pratap <ravi@ximian.com>
1718 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1720 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1721 instead of 'Operator'
1723 * expression.cs (Binary::ResolveOperator): Update accordingly.
1724 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1727 * cs-parser.jay (unary_expression): Update to use the new names.
1729 * gen-treedump.cs (GetUnary): Same here.
1731 * expression.cs (Unary::Resolve): Implement.
1732 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1733 operators are found instead of making noise ;-)
1734 (Unary::ResolveOperator): New method to do precisely the same thing which
1735 Binary::ResolveOperator does for Binary expressions.
1736 (Unary.method, .Arguments): Add.
1737 (Unary::OperName): Implement.
1738 (Unary::ForceConversion): Copy and Paste !
1740 * class.cs (Operator::Define): Fix a small bug for the case when we have
1743 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1744 for the inbuilt operators. Only overloading works for now ;-)
1746 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1748 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1749 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1751 * expression.cs (This::Emit): Implement.
1752 (This::Resolve): Implement.
1753 (TypeOf:Resolve): Implement.
1754 (Expression::ResolveSimpleName): Add an implicit this to instance
1756 (MemberAccess::Resolve): Deal with Parameters and Fields.
1757 Bind instance variable to Field expressions.
1758 (FieldExpr::Instance): New field used to track the expression that
1759 represents the object instance.
1760 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1762 (FieldExpr::Emit): Implement.
1764 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1765 the last instruction contains a return opcode to avoid generating
1766 the last `ret' instruction (this generates correct code, and it is
1767 nice to pass the peverify output).
1769 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1770 initializer for static and instance variables.
1771 (Constructor::Emit): Allow initializer to be null in the case of
1772 static constructors. Only emit initializer for instance
1775 (TypeContainer::FindMembers): Return a null array if there are no
1778 Also fix the code for the MemberTypes.Method branch, as it was not
1779 scanning that for operators (or tried to access null variables before).
1781 * assign.cs (Assign::Emit): Handle instance and static fields.
1785 * driver.cs: Stop compilation if there are parse errors.
1787 * cs-parser.jay (constructor_declaration): Provide default base
1788 initializer for non-static constructors.
1789 (constructor_declarator): Do not provide a default base
1790 initializers if none was specified.
1791 Catch the fact that constructors should not have parameters.
1793 * class.cs: Do not emit parent class initializers for static
1794 constructors, that should be flagged as an error.
1796 2001-09-18 Ravi Pratap <ravi@ximian.com>
1798 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1799 Move back code into TypeContainer::Populate.
1801 2001-09-18 Ravi Pratap <ravi@ximian.com>
1803 * class.cs (TypeContainer::AddConstructor): Fix the check to
1804 compare against Name, not Basename.
1805 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1807 * cs-parser.jay : Update accordingly.
1809 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1810 for methods, don't forget to look into the operators too.
1811 (RegisterMethodBuilder): Helper method to take care of this for
1812 methods, constructors and operators.
1813 (Operator::Define): Completely revamp.
1814 (Operator.OperatorMethod, MethodName): New fields.
1815 (TypeContainer::Populate): Move the registering of builders into
1816 RegisterMethodBuilder.
1817 (Operator::Emit): Re-write.
1819 * expression.cs (Binary::Emit): Comment out code path to emit method
1820 invocation stuff for the case when we have a user defined operator. I am
1821 just not able to get it right !
1823 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1825 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1828 (Expression::MemberLookup): Provide a version that allows to
1829 specify the MemberTypes and BindingFlags.
1831 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1832 so it was not fetching variable information from outer blocks.
1834 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1835 Beforefieldinit as it was buggy.
1837 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1840 * class.cs (Constructor::Emit): Only emit if block is not null.
1841 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1842 deal with this by semantically definining it as if the user had
1845 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1846 constructors as we now "emit" them at a higher level.
1848 (TypeContainer::DefineDefaultConstructor): Used to define the
1849 default constructors if none was provided.
1851 (ConstructorInitializer): Add methods Resolve and Emit.
1853 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1855 2001-09-17 Ravi Pratap <ravi@ximian.com>
1857 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1858 the default constructor builder with our hashtable for methodbuilders
1861 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1862 and argument_count is 0 in which case we have a match.
1863 (Binary::ResolveOperator): More null checking and miscellaneous coding
1866 2001-09-17 Ravi Pratap <ravi@ximian.com>
1868 * rootcontext.cs (IsNameSpace): Compare against null.
1870 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1872 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1873 and Unary::Operator.
1875 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1878 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1879 we have overloaded operators.
1880 (Binary::ResolveOperator): Implement the part which does the operator overload
1883 * class.cs (Operator::Emit): Implement.
1884 (TypeContainer::Emit): Emit the operators we have too.
1886 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1887 the case when we have a user-defined operator.
1889 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1891 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1893 2001-09-16 Ravi Pratap <ravi@ximian.com>
1895 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1896 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1897 (Constructor::Emit): Implement.
1898 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1899 if we have no work to do.
1900 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1903 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1904 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1906 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1909 2001-09-15 Ravi Pratap <ravi@ximian.com>
1911 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1913 (Tree::RecordNamespace): Method to do what the name says ;-)
1914 (Tree::Namespaces): Property to get at the namespaces hashtable.
1916 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1919 * rootcontext.cs (IsNamespace): Fixed it :-)
1921 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1923 * class.cs (TypeContainer::FindMembers): Add support for
1925 (MethodCore): New class that encapsulates both the shared aspects
1926 of a Constructor and a Method.
1927 (Method, Constructor): Factored pieces into MethodCore.
1929 * driver.cs: Added --fatal which makes errors throw exceptions.
1930 Load System assembly as well as part of the standard library.
1932 * report.cs: Allow throwing exceptions on errors for debugging.
1934 * modifiers.cs: Do not use `parent', instead use the real type
1935 container to evaluate permission settings.
1937 * class.cs: Put Ravi's patch back in. He is right, and we will
1938 have to cope with the
1940 2001-09-14 Ravi Pratap <ravi@ximian.com>
1942 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1943 FamORAssem, not FamANDAssem.
1945 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1947 * driver.cs: Added --parse option that only parses its input files
1950 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1951 incorrect. IsTopLevel is not used to tell whether an object is
1952 root_types or not (that can be achieved by testing this ==
1953 root_types). But to see if this is a top-level *class* (not
1954 necessarly our "toplevel" container).
1956 2001-09-14 Ravi Pratap <ravi@ximian.com>
1958 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1959 parent instead of a direct call to GetType.
1961 2001-09-14 Ravi Pratap <ravi@ximian.com>
1963 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1964 Modifiers.TypeAttr. This should just be a call to that method.
1966 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1967 object so that we can determine if we are top-level or not.
1969 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1972 * enum.cs (Enum::Define): Ditto.
1974 * modifiers.cs (FieldAttr): Re-write.
1976 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1977 (TypeContainer::HaveStaticConstructor): New property to provide access
1978 to precisely that info.
1980 * modifiers.cs (MethodAttr): Re-write.
1981 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1983 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1984 of top-level types as claimed.
1986 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1988 * expression.cs (MemberLookup): Fruitless attempt to lookup
1989 constructors. Maybe I need to emit default constructors? That
1990 might be it (currently .NET emits this for me automatically).
1991 (Invocation::OverloadResolve): Cope with Arguments == null.
1992 (Invocation::EmitArguments): new function, shared by the new
1994 (Invocation::Emit): Handle static and instance methods. Emit
1995 proper call instruction for virtual or non-virtual invocations.
1996 (New::Emit): Implement.
1997 (New::Resolve): Implement.
1998 (MemberAccess:Resolve): Implement.
1999 (MethodGroupExpr::InstanceExpression): used conforming to the spec
2001 (FieldExpr::Resolve): Set type.
2003 * support.cs: Handle empty arguments.
2005 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
2006 SimpleLookup): Auxiliary routines to help parse a qualifier
2009 Update qualifier_identifier rule.
2011 * codegen.cs: Removed debugging messages.
2013 * class.cs: Make this a global thing, this acts just as a "key" to
2014 objects that we might have around.
2016 (Populate): Only initialize method_builders_to_methods once.
2018 * expression.cs (PropertyExpr): Initialize type from the
2021 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
2022 Resolve pattern. Attempt to implicitly convert value to boolean.
2025 * expression.cs: Set the type for the int32/int32 argument case.
2026 (Binary::ResolveOperator): Set the return type to boolean for
2027 comparission operators
2029 * typemanager.cs: Remove debugging print code.
2031 (Invocation::Resolve): resolve type.
2033 * class.cs: Allocate a MemberInfo of the correct size, as the code
2034 elsewhere depends on the test to reflect the correct contents.
2036 (Method::) Keep track of parameters, due to System.Reflection holes
2038 (TypeContainer::Populate): Keep track of MethodBuilders to Method
2041 (TypeContainer::FindMembers): Use ArrayList and then copy an array
2042 of the exact size and return that.
2044 (Class::LookupMethodByBuilder): New function that maps
2045 MethodBuilders to its methods. Required to locate the information
2046 on methods because System.Reflection bit us again.
2048 * support.cs: New file, contains an interface ParameterData and
2049 two implementations: ReflectionParameters and InternalParameters
2050 used to access Parameter information. We will need to grow this
2053 * expression.cs (Invocation::GetParameterData): implement a cache
2054 and a wrapper around the ParameterData creation for methods.
2055 (Invocation::OverloadResolve): Use new code.
2057 2001-09-13 Ravi Pratap <ravi@ximian.com>
2059 * class.cs (TypeContainer::EmitField): Remove and move into
2060 (Field::Define): here and modify accordingly.
2061 (Field.FieldBuilder): New member.
2062 (TypeContainer::Populate): Update accordingly.
2063 (TypeContainer::FindMembers): Implement.
2065 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2067 * statement.cs: (VariableInfo::VariableType): New field to be
2068 initialized with the full type once it is resolved.
2070 2001-09-12 Miguel de Icaza <miguel@ximian.com>
2072 * parameter.cs (GetParameterInfo): Use a type cache to compute
2073 things only once, and to reuse this information
2075 * expression.cs (LocalVariableReference::Emit): Implement.
2076 (OpcodeCast::Emit): fix.
2078 (ParameterReference::Resolve): Implement.
2079 (ParameterReference::Emit): Implement.
2081 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
2082 that are expressions need to stay as Expressions.
2084 * typemanager.cs (CSharpName): Returns the C# name of a type if
2087 * expression.cs (Expression::ConvertImplicit): New function that
2088 implements implicit type conversions.
2090 (Expression::ImplicitReferenceConversion): Implements implicit
2091 reference conversions.
2093 (EmptyCast): New type for transparent casts.
2095 (OpcodeCast): New type for casts of types that are performed with
2096 a sequence of bytecodes.
2098 (BoxedCast): New type used for casting value types into reference
2099 types. Emits a box opcode.
2101 (Binary::DoNumericPromotions): Implements numeric promotions of
2102 and computation of the Binary::Type.
2104 (Binary::EmitBranchable): Optimization.
2106 (Binary::Emit): Implement code emission for expressions.
2108 * typemanager.cs (TypeManager): Added two new core types: sbyte
2111 2001-09-12 Ravi Pratap <ravi@ximian.com>
2113 * class.cs (TypeContainer::FindMembers): Method which does exactly
2114 what Type.FindMembers does, only we don't have to use reflection. No
2117 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
2118 typecontainer objects as we need to get at them.
2119 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
2121 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
2122 typecontainer object.
2124 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
2125 of just a Report object.
2127 2001-09-11 Ravi Pratap <ravi@ximian.com>
2129 * class.cs (Event::Define): Go back to using the prefixes "add_" and
2131 (TypeContainer::Populate): Now define the delegates of the type too.
2132 (TypeContainer.Delegates): Property to access the list of delegates defined
2135 * delegates.cs (Delegate::Define): Implement partially.
2137 * modifiers.cs (TypeAttr): Handle more flags.
2139 2001-09-11 Ravi Pratap <ravi@ximian.com>
2141 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
2143 (Operator::Define): Re-write logic to get types by using the LookupType method
2144 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
2145 (Indexer::Define): Ditto.
2146 (Event::Define): Ditto.
2147 (Property::Define): Ditto.
2149 2001-09-10 Ravi Pratap <ravi@ximian.com>
2151 * class.cs (TypeContainer::Populate): Now define operators too.
2152 (TypeContainer.Operators): New property to access the list of operators
2154 (Operator.OperatorMethodBuilder): New member to hold the method builder
2155 for the operator we are defining.
2156 (Operator::Define): Implement.
2158 2001-09-10 Ravi Pratap <ravi@ximian.com>
2160 * class.cs (Event::Define): Make the prefixes of the accessor methods
2161 addOn_ and removeOn_
2163 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
2164 of the location being passed in too. Ideally, this should go later since all
2165 error reporting should be done through the Report object.
2167 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
2168 (Populate): Iterate thru the indexers we have and define them too.
2169 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
2170 for the get and set accessors.
2171 (Indexer::Define): Implement.
2173 2001-09-09 Miguel de Icaza <miguel@ximian.com>
2175 * expression.cs (Binary::Resolve): Beginning of it. I scratched
2176 my previous implementation, did not work.
2178 * typemanager.cs: Add a couple of missing types (the longs).
2180 * literal.cs: Use TypeManager.bool_type instead of getting it.
2182 * expression.cs (EventExpr): New kind of expressions.
2183 (Expressio::ExprClassFromMemberInfo): finish
2185 2001-09-08 Miguel de Icaza <miguel@ximian.com>
2187 * assign.cs: Emit stores to static fields differently.
2189 2001-09-08 Ravi Pratap <ravi@ximian.com>
2191 * Merge in changes and adjust code to tackle conflicts. Backed out my
2192 code in Assign::Resolve ;-)
2194 2001-09-08 Ravi Pratap <ravi@ximian.com>
2196 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
2197 instead Report.Error and also pass in the location.
2198 (CSharpParser::Lexer): New readonly property to return the reference
2199 to the Tokenizer object.
2200 (declare_local_variables): Use Report.Error with location instead of plain
2204 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
2205 (Operator.CheckBinaryOperator): Ditto.
2207 * cs-parser.jay (operator_declarator): Update accordingly.
2209 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
2210 (CheckBinaryOperator): Same here.
2212 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
2213 on the name without any prefixes of namespace names etc. This is because we
2214 already might have something already fully qualified like
2215 'System.Console.WriteLine'
2217 * assign.cs (Resolve): Begin implementation. Stuck ;-)
2219 2001-09-07 Ravi Pratap <ravi@ximian.com>
2221 * cs-tokenizer.cs (location): Return a string which also contains
2224 * expression.cs (ElementAccess): New class for expressions of the
2225 type 'element access.'
2226 (BaseAccess): New class for expressions of the type 'base access.'
2227 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
2230 * cs-parser.jay (element_access): Implement action.
2231 (base_access): Implement actions.
2232 (checked_expression, unchecked_expression): Implement.
2234 * cs-parser.jay (local_variable_type): Correct and implement.
2235 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
2237 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
2239 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
2240 name and the specifiers.
2242 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
2244 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
2245 making them all public ;-)
2247 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
2250 2001-09-07 Miguel de Icaza <miguel@ximian.com>
2252 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
2254 (FieldExpr, PropertyExprs): New resolved expressions.
2255 (SimpleName::MemberStaticCheck): Perform static checks for access
2256 to non-static fields on static methods. Maybe this should be
2257 generalized for MemberAccesses.
2258 (SimpleName::ResolveSimpleName): More work on simple name
2261 * cs-parser.jay (primary_expression/qualified_identifier): track
2262 the parameter index.
2264 * codegen.cs (CodeGen::Save): Catch save exception, report error.
2265 (EmitContext::EmitBoolExpression): Chain to expression generation
2266 instead of temporary hack.
2267 (::EmitStatementExpression): Put generic expression code generation.
2269 * assign.cs (Assign::Emit): Implement variable assignments to
2270 local variables, parameters and fields.
2272 2001-09-06 Miguel de Icaza <miguel@ximian.com>
2274 * statement.cs (Block::GetVariableInfo): New method, returns the
2275 VariableInfo for a variable name in a block.
2276 (Block::GetVariableType): Implement in terms of GetVariableInfo
2278 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
2279 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
2281 2001-09-06 Ravi Pratap <ravi@ximian.com>
2283 * cs-parser.jay (operator_declaration): Continue on my quest : update
2284 to take attributes argument.
2285 (event_declaration): Ditto.
2286 (enum_declaration): Ditto.
2287 (indexer_declaration): Ditto.
2289 * class.cs (Operator::Operator): Update constructor accordingly.
2290 (Event::Event): Ditto.
2292 * delegate.cs (Delegate::Delegate): Same here.
2294 * enum.cs (Enum::Enum): Same here.
2296 2001-09-05 Ravi Pratap <ravi@ximian.com>
2298 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
2300 * ../tests/cs0658.cs : New file to demonstrate error 0658.
2302 * attribute.cs (Attributes): New class to encapsulate all attributes which were
2303 being passed around as an arraylist.
2304 (Attributes::AddAttribute): Method to add attribute sections.
2306 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
2307 (struct_declaration): Update accordingly.
2308 (constant_declaration): Update.
2309 (field_declaration): Update.
2310 (method_header): Update.
2311 (fixed_parameter): Update.
2312 (parameter_array): Ditto.
2313 (property_declaration): Ditto.
2314 (destructor_declaration): Ditto.
2316 * class.cs (Struct::Struct): Update constructors accordingly.
2317 (Class::Class): Ditto.
2318 (Field::Field): Ditto.
2319 (Method::Method): Ditto.
2320 (Property::Property): Ditto.
2321 (TypeContainer::OptAttribute): update property's return type.
2323 * interface.cs (Interface.opt_attributes): New member.
2324 (Interface::Interface): Update to take the extra Attributes argument.
2326 * parameter.cs (Parameter::Parameter): Ditto.
2328 * constant.cs (Constant::Constant): Ditto.
2330 * interface.cs (InterfaceMemberBase): New OptAttributes field.
2331 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
2332 the attributes as a parameter.
2333 (InterfaceProperty): Update constructor call.
2334 (InterfaceEvent): Ditto.
2335 (InterfaceMethod): Ditto.
2336 (InterfaceIndexer): Ditto.
2338 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
2339 pass the attributes too.
2340 (interface_event_declaration): Ditto.
2341 (interface_property_declaration): Ditto.
2342 (interface_method_declaration): Ditto.
2343 (interface_declaration): Ditto.
2345 2001-09-05 Miguel de Icaza <miguel@ximian.com>
2347 * class.cs (Method::Define): Track the "static Main" definition to
2348 create an entry point.
2350 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
2351 EntryPoint if we find it.
2353 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
2354 (EmitContext::ig): Make this variable public.
2356 * driver.cs: Make the default output file be the first file name
2357 with the .exe extension.
2359 Detect empty compilations
2361 Handle various kinds of output targets. Handle --target and
2362 rename -t to --dumper.
2364 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
2365 methods inherited from Expression return now an Expression. This
2366 will is used during the tree rewriting as we resolve them during
2369 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
2370 the spec. Missing entirely is the information about
2371 accessability of elements of it.
2373 (Expression::ExprClassFromMemberInfo): New constructor for
2374 Expressions that creates a fully initialized Expression based on
2375 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
2378 (Invocation::Resolve): Begin implementing resolution of invocations.
2380 * literal.cs (StringLiteral): Implement Emit.
2382 2001-09-05 Ravi Pratap <ravi@ximian.com>
2384 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
2387 2001-09-04 Ravi Pratap <ravi@ximian.com>
2389 * cs-parser.jay (attribute_arguments): Implement actions.
2390 (attribute): Fix bug in production. Implement action.
2391 (attribute_list): Implement.
2392 (attribute_target): Implement.
2393 (attribute_target_specifier, opt_target_specifier): Implement
2394 (CheckAttributeTarget): New method to check if the attribute target
2396 (attribute_section): Implement.
2397 (opt_attributes): Implement.
2399 * attribute.cs : New file to handle attributes.
2400 (Attribute): Class to hold attribute info.
2402 * cs-parser.jay (opt_attribute_target_specifier): Remove production
2403 (attribute_section): Modify production to use 2 different rules to
2404 achieve the same thing. 1 s/r conflict down !
2405 Clean out commented, useless, non-reducing dimension_separator rules.
2407 * class.cs (TypeContainer.attributes): New member to hold list
2408 of attributes for a type.
2409 (Struct::Struct): Modify to take one more argument, the attribute list.
2410 (Class::Class): Ditto.
2411 (Field::Field): Ditto.
2412 (Method::Method): Ditto.
2413 (Property::Property): Ditto.
2415 * cs-parser.jay (struct_declaration): Update constructor call to
2416 pass in the attributes too.
2417 (class_declaration): Ditto.
2418 (constant_declaration): Ditto.
2419 (field_declaration): Ditto.
2420 (method_header): Ditto.
2421 (fixed_parameter): Ditto.
2422 (parameter_array): Ditto.
2423 (property_declaration): Ditto.
2425 * constant.cs (Constant::Constant): Update constructor similarly.
2426 Use System.Collections.
2428 * parameter.cs (Parameter::Parameter): Update as above.
2430 2001-09-02 Ravi Pratap <ravi@ximian.com>
2432 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
2433 (TypeContainer.delegates): New member to hold list of delegates.
2435 * cs-parser.jay (delegate_declaration): Implement the action correctly
2436 this time as I seem to be on crack ;-)
2438 2001-09-02 Miguel de Icaza <miguel@ximian.com>
2440 * rootcontext.cs (RootContext::IsNamespace): new function, used to
2441 tell whether an identifier represents a namespace.
2443 * expression.cs (NamespaceExpr): A namespace expression, used only
2444 temporarly during expression resolution.
2445 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
2446 utility functions to resolve names on expressions.
2448 2001-09-01 Miguel de Icaza <miguel@ximian.com>
2450 * codegen.cs: Add hook for StatementExpressions.
2452 * class.cs: Fix inverted test for static flag in methods.
2454 2001-09-02 Ravi Pratap <ravi@ximian.com>
2456 * class.cs (Operator::CheckUnaryOperator): Correct error number used
2457 to make it coincide with MS' number.
2458 (Operator::CheckBinaryOperator): Ditto.
2460 * ../errors/errors.txt : Remove error numbers added earlier.
2462 * ../errors/cs1019.cs : Test case for error # 1019
2464 * ../errros/cs1020.cs : Test case for error # 1020
2466 * cs-parser.jay : Clean out commented cruft.
2467 (dimension_separators, dimension_separator): Comment out. Ostensibly not
2468 used anywhere - non-reducing rule.
2469 (namespace_declarations): Non-reducing rule - comment out.
2471 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
2472 with TypeContainer::AddEnum.
2474 * delegate.cs : New file for delegate handling classes.
2475 (Delegate): Class for declaring delegates.
2477 * makefile : Update.
2479 * cs-parser.jay (delegate_declaration): Implement.
2481 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
2483 * class.cs (Event::Define): Implement.
2484 (Event.EventBuilder): New member.
2486 * class.cs (TypeContainer::Populate): Update to define all enums and events
2488 (Events): New property for the events arraylist we hold. Shouldn't we move to using
2489 readonly fields for all these cases ?
2491 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2493 * class.cs (Property): Revamp to use the convention of making fields readonly.
2494 Accordingly modify code elsewhere.
2496 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
2497 the Define method of the Property class.
2499 * class.cs : Clean up applied patch and update references to variables etc. Fix
2501 (TypeContainer::Populate): Update to define all the properties we have. Also
2502 define all enumerations.
2504 * enum.cs (Define): Implement.
2506 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2508 * cs-parser.jay (overloadable_operator): The semantic value is an
2509 enum of the Operator class.
2510 (operator_declarator): Implement actions.
2511 (operator_declaration): Implement.
2513 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
2514 validity of definitions.
2515 (Operator::CheckBinaryOperator): Static method to check for binary operators
2516 (TypeContainer::AddOperator): New method to add an operator to a type.
2518 * cs-parser.jay (indexer_declaration): Added line to actually call the
2519 AddIndexer method so it gets added ;-)
2521 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
2522 already taken care of by the MS compiler ?
2524 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2526 * class.cs (Operator): New class for operator declarations.
2527 (Operator::OpType): Enum for the various operators.
2529 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2531 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
2532 ostensibly handle this in semantic analysis.
2534 * cs-parser.jay (general_catch_clause): Comment out
2535 (specific_catch_clauses, specific_catch_clause): Ditto.
2536 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
2537 (catch_args, opt_catch_args): New productions.
2538 (catch_clause): Rewrite to use the new productions above
2539 (catch_clauses): Modify accordingly.
2540 (opt_catch_clauses): New production to use in try_statement
2541 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
2542 and re-write the code in the actions to extract the specific and
2543 general catch clauses by being a little smart ;-)
2545 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
2546 Hooray, try and catch statements parse fine !
2548 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2550 * statement.cs (Block::GetVariableType): Fix logic to extract the type
2551 string from the hashtable of variables.
2553 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
2554 I end up making that mistake ;-)
2555 (catch_clauses): Fixed gross error which made Key and Value of the
2556 DictionaryEntry the same : $1 !!
2558 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2560 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2562 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2563 when the add and remove accessors are specified.
2565 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2567 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2568 information about indexer_declarator.
2569 (indexer_declarator): Implement actions.
2570 (parsing_indexer): New local boolean used to keep track of whether
2571 we are parsing indexers or properties. This is necessary because
2572 implicit_parameters come into picture even for the get accessor in the
2574 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2576 * class.cs (Indexer): New class for indexer declarations.
2577 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2578 (TypeContainer::indexers): New member to hold list of indexers for the
2581 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2583 * cs-parser.jay (add_accessor_declaration): Implement action.
2584 (remove_accessor_declaration): Implement action.
2585 (event_accessors_declaration): Implement
2586 (variable_declarators): swap statements for first rule - trivial.
2588 * class.cs (Event): New class to hold information about event
2590 (TypeContainer::AddEvent): New method to add an event to a type
2591 (TypeContainer::events): New member to hold list of events.
2593 * cs-parser.jay (event_declaration): Implement actions.
2595 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2597 * cs-parser.jay (dim_separators): Implement. Make it a string
2598 concatenating all the commas together, just as they appear.
2599 (opt_dim_separators): Modify accordingly
2600 (rank_specifiers): Update accordingly. Basically do the same
2601 thing - instead, collect the brackets here.
2602 (opt_rank_sepcifiers): Modify accordingly.
2603 (array_type): Modify to actually return the complete type string
2604 instead of ignoring the rank_specifiers.
2605 (expression_list): Implement to collect the expressions
2606 (variable_initializer): Implement. We make it a list of expressions
2607 essentially so that we can handle the array_initializer case neatly too.
2608 (variable_initializer_list): Implement.
2609 (array_initializer): Make it a list of variable_initializers
2610 (opt_array_initializer): Modify accordingly.
2612 * expression.cs (New::NType): Add enumeration to help us
2613 keep track of whether we have an object/delegate creation
2614 or an array creation.
2615 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2616 members to hold data about array creation.
2617 (New:New): Modify to update NewType
2618 (New:New): New Overloaded contructor for the array creation
2621 * cs-parser.jay (array_creation_expression): Implement to call
2622 the overloaded New constructor.
2624 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2626 * class.cs (TypeContainer::Constructors): Return member
2627 constructors instead of returning null.
2629 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2631 * typemanager.cs (InitCoreTypes): Initialize the various core
2632 types after we have populated the type manager with the user
2633 defined types (this distinction will be important later while
2634 compiling corlib.dll)
2636 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2637 on Expression Classification. Now all expressions have a method
2638 `Resolve' and a method `Emit'.
2640 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2641 generation from working. Also add some temporary debugging
2644 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2646 * codegen.cs: Lots of code generation pieces. This is only the
2647 beginning, will continue tomorrow with more touches of polish. We
2648 handle the fundamentals of if, while, do, for, return. Others are
2649 trickier and I need to start working on invocations soon.
2651 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2654 * codegen.cs (EmitContext): New struct, used during code
2655 emission to keep a context. Most of the code generation will be
2658 * cs-parser.jay: Add embedded blocks to the list of statements of
2659 this block. So code generation proceeds in a top down fashion.
2661 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2663 * statement.cs: Add support for multiple child blocks.
2665 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2667 * codegen.cs (EmitCode): New function, will emit the code for a
2668 Block of code given a TypeContainer and its ILGenerator.
2670 * statement.cs (Block): Standard public readonly optimization.
2671 (Block::Block constructors): Link children.
2672 (Block::Child): Child Linker.
2673 (Block::EmitVariables): Emits IL variable declarations.
2675 * class.cs: Drop support for MethodGroups here, delay until
2677 (Method::): Applied the same simplification that I did before, and
2678 move from Properties to public readonly fields.
2679 (Method::ParameterTypes): Returns the parameter types for the
2680 function, and implements a cache that will be useful later when I
2681 do error checking and the semantic analysis on the methods is
2683 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2684 and made a method, optional argument tells whether this is a class
2685 or a structure to apply the `has-this' bit.
2686 (Method::GetCallingConvention): Implement, returns the calling
2688 (Method::Define): Defines the type, a second pass is performed
2689 later to populate the methods.
2691 (Constructor::ParameterTypes): implement a cache similar to the
2692 one on Method::ParameterTypes, useful later when we do semantic
2695 (TypeContainer::EmitMethod): New method. Emits methods.
2697 * expression.cs: Removed MethodGroup class from here.
2699 * parameter.cs (Parameters::GetCallingConvention): new method.
2701 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2703 * class.cs (TypeContainer::Populate): Drop RootContext from the
2706 (Constructor::CallingConvention): Returns the calling convention.
2707 (Constructor::ParameterTypes): Returns the constructor parameter
2710 (TypeContainer::AddConstructor): Keep track of default constructor
2711 and the default static constructor.
2713 (Constructor::) Another class that starts using `public readonly'
2714 instead of properties.
2716 (Constructor::IsDefault): Whether this is a default constructor.
2718 (Field::) use readonly public fields instead of properties also.
2720 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2721 track of static constructors; If none is used, turn on
2722 BeforeFieldInit in the TypeAttributes.
2724 * cs-parser.jay (opt_argument_list): now the return can be null
2725 for the cases where there are no arguments.
2727 (constructor_declarator): If there is no implicit `base' or
2728 `this', then invoke the default parent constructor.
2730 * modifiers.cs (MethodAttr): New static function maps a set of
2731 modifiers flags into a MethodAttributes enum
2732 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2733 MethodAttr, TypeAttr to represent the various mappings where the
2735 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2737 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2739 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2742 * interface.cs (PopulateIndexer): Implemented the code generator
2743 for interface indexers.
2745 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2747 * interface.cs (InterfaceMemberBase): Now we track the new status
2750 (PopulateProperty): Implement property population. Woohoo! Got
2751 Methods and Properties going today.
2753 Removed all the properties for interfaces, and replaced them with
2754 `public readonly' fields.
2756 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2758 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2759 initialize their hashtables/arraylists only when they are needed
2760 instead of doing this always.
2762 * parameter.cs: Handle refs and out parameters.
2764 * cs-parser.jay: Use an ArrayList to construct the arguments
2765 instead of the ParameterCollection, and then cast that to a
2768 * parameter.cs: Drop the use of ParameterCollection and use
2769 instead arrays of Parameters.
2771 (GetParameterInfo): Use the Type, not the Name when resolving
2774 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2776 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2777 and instead use public readonly fields.
2779 * class.cs: Put back walking code for type containers.
2781 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2783 * class.cs (MakeConstant): Code to define constants.
2785 * rootcontext.cs (LookupType): New function. Used to locate types
2788 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2790 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2791 this System.Reflection code is. Kudos to Microsoft
2793 * typemanager.cs: Implement a type cache and avoid loading all
2794 types at boot time. Wrap in LookupType the internals. This made
2795 the compiler so much faster. Wow. I rule!
2797 * driver.cs: Make sure we always load mscorlib first (for
2798 debugging purposes, nothing really important).
2800 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2801 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2803 * rootcontext.cs: Lookup types on their namespace; Lookup types
2804 on namespaces that have been imported using the `using' keyword.
2806 * class.cs (TypeContainer::TypeAttr): Virtualize.
2807 (Class::TypeAttr): Return attributes suitable for this bad boy.
2808 (Struct::TypeAttr): ditto.
2809 Handle nested classes.
2810 (TypeContainer::) Remove all the type visiting code, it is now
2811 replaced with the rootcontext.cs code
2813 * rootcontext.cs (GetClassBases): Added support for structs.
2815 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2817 * interface.cs, statement.cs, class.cs, parameter.cs,
2818 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2819 Drop use of TypeRefs, and use strings instead.
2821 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2825 * class.cs (Struct::Struct): set the SEALED flags after
2826 checking the modifiers.
2827 (TypeContainer::TypeAttr): new property, returns the
2828 TypeAttributes for a class.
2830 * cs-parser.jay (type_list): Oops, list production was creating a
2831 new list of base types.
2833 * rootcontext.cs (StdLib): New property.
2834 (GetInterfaceTypeByName): returns an interface by type name, and
2835 encapsulates error handling here.
2836 (GetInterfaces): simplified.
2837 (ResolveTree): Encapsulated all the tree resolution here.
2838 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2841 * driver.cs: Add support for --nostdlib, to avoid loading the
2843 (Main): Do not put tree resolution here.
2845 * rootcontext.cs: Beginning of the class resolution.
2847 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2849 * rootcontext.cs: Provide better error reporting.
2851 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2853 * rootcontext.cs (CreateInterface): Handle the case where there
2854 are no parent interfaces.
2856 (CloseTypes): Routine to flush types at the end.
2857 (CreateInterface): Track types.
2858 (GetInterfaces): Returns an array of Types from the list of
2861 * typemanager.c (AddUserType): Mechanism to track user types (puts
2862 the type on the global type hash, and allows us to close it at the
2865 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2867 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2868 RecordInterface instead.
2870 * cs-parser.jay: Updated to reflect changes above.
2872 * decl.cs (Definition): Keep track of the TypeBuilder type that
2873 represents this type here. Not sure we will use it in the long
2874 run, but wont hurt for now.
2876 * driver.cs: Smaller changes to accomodate the new code.
2878 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2881 * rootcontext.cs (CreateInterface): New method, used to create
2882 the System.TypeBuilder type for interfaces.
2883 (ResolveInterfaces): new entry point to resolve the interface
2885 (CodeGen): Property, used to keep track of the code generator.
2887 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2889 * cs-parser.jay: Add a second production for delegate_declaration
2892 (enum_body): Put an opt_comma here instead of putting it on
2893 enum_body or enum_member_declarations so we can handle trailing
2894 commas on enumeration members. Gets rid of a shift/reduce.
2896 (type_list): Need a COMMA in the middle.
2898 (indexer_declaration): Tell tokenizer to recognize get/set
2900 * Remove old targets.
2902 * Re-add the parser target.
2904 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2906 * cs-parser.jay: Add precendence rules for a number of operators
2907 ot reduce the number of shift/reduce conflicts in the grammar.
2909 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2911 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2914 Get rid of old crufty code.
2916 * rootcontext.cs: Use this to keep track of the parsed
2917 representation and the defined types available to the program.
2919 * gen-treedump.cs: adjust for new convention.
2921 * type.cs: Split out the type manager, and the assembly builder
2924 * typemanager.cs: the type manager will live here now.
2926 * cil-codegen.cs: And the code generator here.
2928 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2930 * makefile: Fixed up for easy making.
2932 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2934 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2937 (unary_expression): Expand pre_increment_expression and
2938 post_decrement_expression to reduce a shift/reduce.
2940 2001-07-11 Simon Cozens
2942 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2944 Improve allow_keyword_as_indent name.
2946 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2948 * Adjustments for Beta2.
2950 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2952 * decl.cs: Added `Define' abstract method.
2953 (InTransit): new property, used to catch recursive definitions.
2955 * interface.cs: Implement `Define'.
2957 * modifiers.cs: Map Modifiers.constants to
2958 System.Reflection.TypeAttribute flags.
2960 * class.cs: Keep track of types and user-defined types.
2961 (BuilderInit): New method for creating an assembly
2962 (ResolveType): New function to launch the resolution process, only
2963 used by interfaces for now.
2965 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2966 that are inserted into the name space.
2968 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2970 * ARGH. I have screwed up my tree so many times due to the use of
2971 rsync rather than using CVS. Going to fix this at once.
2973 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2976 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2978 * Experiment successful: Use System.Type rather that our own
2981 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2983 * cs-parser.jay: Removed nsAliases from here.
2985 Use new namespaces, handle `using XXX;'
2987 * namespace.cs: Reimplemented namespace handling, use a recursive
2988 definition of the class. Now we can keep track of using clauses
2989 and catch invalid using clauses.
2991 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2993 * gen-treedump.cs: Adapted for all the renaming.
2995 * expression.cs (Expression): this class now has a Type property
2996 which returns an expression Type.
2998 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2999 `Type', as this has a different meaning now in the base
3001 2001-05-22 Miguel de Icaza <miguel@ximian.com>
3003 * interface.cs, class.cs: Removed from all the sources the
3004 references to signature computation, as we can not do method
3005 signature computation during the parsing time, as we are not
3006 trying to solve at that point distinguishing:
3010 void a (NS.Blah x) {}
3013 Which depending on the context might be valid or not, as we do not
3014 know if Blah is the same thing as NS.Blah at that point.
3016 * Redid everything so the code uses TypeRefs now instead of
3017 Types. TypeRefs are just temporary type placeholders, that need
3018 to be resolved. They initially have a pointer to a string and the
3019 current scope in which they are used. This is used later by the
3020 compiler to resolve the reference to an actual Type.
3022 * DeclSpace is no longer a CIR.Type, and neither are
3023 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
3024 are all DeclSpaces, but no Types.
3026 * type.cs (TypeRefManager): This implements the TypeRef manager,
3027 which keeps track of all the types that need to be resolved after
3028 the parsing has finished.
3030 2001-05-13 Miguel de Icaza <miguel@ximian.com>
3032 * ARGH. We are going to have to store `foreach' as a class rather
3033 than resolving it, as we need to verify error 1579 after name
3034 resolution. *OR* we could keep a flag that says `This request to
3035 IEnumerator comes from a foreach statement' which we can then use
3036 to generate the error.
3038 2001-05-10 Miguel de Icaza <miguel@ximian.com>
3040 * class.cs (TypeContainer.AddMethod): we now add methods to the
3041 MethodGroup instead of the method hashtable.
3043 * expression.cs: Add MethodGroup abstraction, which gets us one
3044 step closer to the specification in the way we handle method
3047 * cs-parser.jay (primary_expression): qualified_identifier now
3048 tried to match up an identifier to a local variable reference or
3049 to a parameter reference.
3051 current_local_parameters is now a parser global variable that
3052 points to the current parameters for the block, used during name
3055 (property_declaration): Now creates an implicit `value' argument to
3058 2001-05-09 Miguel de Icaza <miguel@ximian.com>
3060 * parameter.cs: Do not use `param' arguments as part of the
3061 signature, per the spec.
3063 2001-05-08 Miguel de Icaza <miguel@ximian.com>
3065 * decl.cs: Base class for classes, structs and interfaces. This
3066 is the "Declaration Space"
3068 * cs-parser.jay: Use CheckDef for checking declaration errors
3069 instead of having one on each function.
3071 * class.cs: Factor out some code for handling error handling in
3072 accordance to the "Declarations" section in the "Basic Concepts"
3073 chapter in the ECMA C# spec.
3075 * interface.cs: Make all interface member classes derive from
3076 InterfaceMemberBase.
3078 2001-05-07 Miguel de Icaza <miguel@ximian.com>
3080 * Many things: all interfaces are parsed and generated in
3081 gen-treedump. Support for member variables, constructors,
3082 destructors, properties, constants is there.
3084 Beginning of the IL backend, but very little done, just there for
3087 2001-04-29 Miguel de Icaza <miguel@ximian.com>
3089 * cs-parser.jay: Fix labeled statement.
3091 * cs-tokenizer.cs (escape): Escape " and ' always.
3092 ref_line, ref_name: keep track of the line/filename as instructed
3093 by #line by the compiler.
3096 2001-04-27 Miguel de Icaza <miguel@ximian.com>
3098 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
3099 to match the values in System.CodeDOM.
3101 Divid renamed to Divide.
3103 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
3105 (Statements.set): remove.
3107 * System.CodeDOM/CodeCatchClause.cs: always have a valid
3110 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
3111 falseStatements always have valid values.
3113 * cs-parser.jay: Use System.CodeDOM now.