1 2001-11-14 Miguel de Icaza <miguel@ximian.com>
3 * support.cs (ReflectionParameters.ParameterModifier): Report
4 whether the argument is a PARAMS argument or not.
6 * class.cs: Set the attribute `ParamArrayAttribute' on the
9 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
10 and cons_param_array_attribute (ConstructorInfo for
11 ParamArrayAttribute).,
13 * codegen.cs: Emit the return using the `Return' statement, that
14 way we can report the error correctly for missing return values.
16 * class.cs (Method.Emit): Clean up.
18 * expression.cs (Argument.Resolve): Take another argument: the
19 location where this argument is used. Notice that this is not
20 part of the "Argument" class as to reduce the size of the
21 structure (we know the approximate location anyways).
23 Test if the argument is a variable-reference, if not, then
26 (Argument.Emit): Emit addresses of variables.
28 (Argument.FullDesc): Simplify.
30 (Invocation.DoResolve): Update for Argument.Resolve.
32 (ElementAccess.DoResolve): ditto.
34 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
35 method should be virtual, as this method is always virtual.
37 (NewDelegate.DoResolve): Update for Argument.Resolve.
39 * class.cs (ConstructorInitializer.DoResolve): ditto.
41 * attribute.cs (Attribute.Resolve): ditto.
43 2001-11-13 Miguel de Icaza <miguel@ximian.com>
45 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
47 * expression.cs (ParameterReference): Drop IStackStorage and implement
48 IAssignMethod instead.
50 (LocalVariableReference): ditto.
52 * ecore.cs (FieldExpr): Drop IStackStorage and implement
53 IAssignMethod instead.
55 2001-11-13 Miguel de Icaza <miguel@ximian.com>
57 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
58 enumerations that are used in heavily used structures derive from
59 byte in a laughable and pathetic attempt to reduce memory usage.
60 This is the kind of pre-optimzations that you should not do at
61 home without adult supervision.
63 * expression.cs (UnaryMutator): New class, used to handle ++ and
64 -- separatedly from the other unary operators. Cleans up the
65 code, and kills the ExpressionStatement dependency in Unary.
67 (Unary): Removed `method' and `Arguments' from this class, making
68 it smaller, and moving it all to SimpleCall, so I can reuse this
69 code in other locations and avoid creating a lot of transient data
70 strucutres when not required.
72 * cs-parser.jay: Adjust for new changes.
74 2001-11-11 Miguel de Icaza <miguel@ximian.com>
76 * enum.cs (Enum.Populate): If there is a failure during
79 * cs-parser.jay (opt_enum_base): we used to catch type errors
80 here, but this is really incorrect. The type error should be
81 catched during semantic analysis.
83 2001-12-11 Ravi Pratap <ravi@ximian.com>
85 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
86 current_local_parameters as expected since I, in my stupidity, had forgotten
89 * attribute.cs (GetValidPlaces): Fix stupid bug.
91 * class.cs (Method::Emit): Perform check on applicability of attributes.
93 (Constructor::Emit): Ditto.
97 (Field.Location): Store location information.
99 (Property, Event, Indexer, Operator): Ditto.
101 * cs-parser.jay (field_declaration): Pass in location for each field.
103 * ../errors/cs0592.cs : Add.
105 2001-11-12 Ravi Pratap <ravi@ximian.com>
107 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
109 (InitCoreTypes): Update accordingly.
111 (RegisterAttrType, LookupAttr): Implement.
113 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
116 (Resolve): Update to populate the above as necessary.
120 (GetValidPlaces): Helper to the above.
122 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
124 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
126 2001-11-12 Ravi Pratap <ravi@ximian.com>
128 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
130 * ../errors/cs0617.cs : Add.
132 2001-11-11 Ravi Pratap <ravi@ximian.com>
134 * enum.cs (Emit): Rename to Populate to be more consistent with what
135 we expect it to do and when exactly it is called.
137 * class.cs, rootcontext.cs : Update accordingly.
139 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
140 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
142 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
144 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
145 of a fieldinfo using the above, when dealing with a FieldBuilder.
147 2001-11-10 Ravi Pratap <ravi@ximian.com>
149 * ../errors/cs0031.cs : Add.
151 * ../errors/cs1008.cs : Add.
153 * ../errrors/cs0543.cs : Add.
155 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
158 (FindMembers): Implement.
160 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
161 enums and delegates too.
163 (enum_types): Rename to builder_to_enum.
165 (delegate_types): Rename to builder_to_delegate.
167 * delegate.cs (FindMembers): Implement.
169 2001-11-09 Ravi Pratap <ravi@ximian.com>
171 * typemanager.cs (IsEnumType): Implement.
173 * enum.cs (Emit): Re-write parts to account for the underlying type
174 better and perform checking etc.
176 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
177 of the underlying type.
179 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
182 * enum.cs (error31): Helper to report error #31.
184 * cs-parser.jay (enum_declaration): Store location of each member too.
186 * enum.cs (member_to_location): New hashtable.
188 (AddEnumMember): Update location hashtable.
190 (Emit): Use the location of each member while reporting errors.
192 2001-11-09 Miguel de Icaza <miguel@ximian.com>
194 * cs-parser.jay: A for_initializer if is a
195 local_variable_declaration really ammount to have an implicit
196 block with the variable declaration and no initializer for for.
198 * statement.cs (For.Emit): Cope with null initializers.
200 This fixes the infinite loop on for initializers.
202 2001-11-08 Miguel de Icaza <miguel@ximian.com>
204 * enum.cs: More cleanup.
206 * ecore.cs: Remove dead code.
208 * class.cs (Property.Emit): More simplification.
211 Reworked to have less levels of indentation.
213 2001-11-08 Ravi Pratap <ravi@ximian.com>
215 * class.cs (Property): Emit attributes.
225 * enum.cs (Emit): Ditto.
227 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
230 * class.cs (Field, Event, etc.): Move attribute generation into the
231 Emit method everywhere.
233 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
234 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
235 as we had no way of defining nested enums !
237 * rootcontext.cs : Adjust code accordingly.
239 * typemanager.cs (AddEnumType): To keep track of enum types separately.
241 2001-11-07 Ravi Pratap <ravi@ximian.com>
243 * expression.cs (EvalConstantExpression): Move into ecore.cs
245 * enum.cs (Enum): Rename some members and make them public and readonly
246 according to our convention.
248 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
251 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
253 (Enum::Emit): Write a simple version for now which doesn't try to compute
254 expressions. I shall modify this to be more robust in just a while.
256 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
258 (TypeContainer::CloseType): Create the Enum types too.
260 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
262 * expression.cs (EvalConstantExpression): Get rid of completely.
264 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
265 user-defined values and other cases.
267 (IsValidEnumLiteral): Helper function.
269 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
270 out there in the case we had a literal FieldExpr.
272 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
274 (Literalize): Revamp a bit to take two arguments.
276 (EnumLiteral): New class which derives from Literal to wrap enum literals.
278 2001-11-06 Ravi Pratap <ravi@ximian.com>
280 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
282 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
284 (Resolve): Use the above to ensure we have proper initializers.
286 2001-11-05 Ravi Pratap <ravi@ximian.com>
288 * expression.cs (Expression::EvalConstantExpression): New method to
289 evaluate constant expressions.
291 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
293 2001-11-07 Miguel de Icaza <miguel@ximian.com>
295 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
298 (Binary.ResolveOperator): Handle operator != (object a, object b)
299 and operator == (object a, object b);
301 (Binary.DoNumericPromotions): Indicate whether the numeric
302 promotion was possible.
304 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
307 Made the ArrayAccess implement interface IAssignMethod instead of
308 IStackStore as the order in which arguments are passed reflects
311 * assign.cs: Instead of using expr.ExprClass to select the way of
312 assinging, probe for the IStackStore/IAssignMethod interfaces.
314 * typemanager.cs: Load InitializeArray definition.
316 * rootcontext.cs (RootContext.MakeStaticData): Used to define
317 static data that can be used to initialize arrays.
319 2001-11-05 Miguel de Icaza <miguel@ximian.com>
321 * expression.cs: Handle operator== and operator!= for booleans.
323 (Conditioal.Reduce): Implement reducer for the ?: operator.
325 (Conditional.Resolve): Implement dead code elimination.
327 (Binary.Resolve): Catch string literals and return a new
330 (Unary.Reduce): Implement reduction of unary expressions.
332 * ecore.cs: Split out the expression core handling here.
334 (Expression.Reduce): New method used to perform constant folding
335 and CSE. This is needed to support constant-expressions.
337 * statement.cs (Statement.EmitBoolExpression): Pass true and false
338 targets, and optimize for !x.
340 2001-11-04 Ravi Pratap <ravi@ximian.com>
342 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
343 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
344 set custom atttributes.
346 * literal.cs (Literal::GetValue): New abstract method to return the actual
347 value of the literal, cast as an object.
349 (*Literal): Implement GetValue method.
351 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
352 expressions to the arraylist but objects of type Argument.
354 * class.cs (TypeContainer::Emit): Emit our attributes too.
356 (Method::Emit, Constructor::Emit): Ditto.
358 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
359 to be ignoring earlier.
361 2001-11-03 Ravi Pratap <ravi@ximian.com>
363 * attribute.cs (AttributeSection::Define): Implement to do the business
364 of constructing a CustomAttributeBuilder.
366 (Attribute): New trivial class. Increases readability of code.
368 * cs-parser.jay : Update accordingly.
370 (positional_argument_list, named_argument_list, named_argument): New rules
372 (attribute_arguments): Use the above so that we are more correct.
374 2001-11-02 Ravi Pratap <ravi@ximian.com>
376 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
377 to perform all checks for a method with a params parameter.
379 (Invocation::OverloadResolve): Update to use the above method and therefore
380 cope correctly with params method invocations.
382 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
385 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
386 constructors in our parent too because we can't afford to miss out on
389 * attribute.cs (AttributeSection): New name for the class Attribute
391 Other trivial changes to improve readability.
393 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
394 use the new class names.
396 2001-11-01 Ravi Pratap <ravi@ximian.com>
398 * class.cs (Method::Define): Complete definition for params types too
400 (Indexer::Define): Ditto.
402 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
403 Cope everywhere with a request for info about the array parameter.
405 2001-11-01 Ravi Pratap <ravi@ximian.com>
407 * tree.cs (RecordNamespace): Fix up to check for the correct key.
409 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
410 local_variable_type to extract the string corresponding to the type.
412 (local_variable_type): Fixup the action to use the new helper method.
414 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
417 * expression.cs : Clean out code which uses the above.
419 2001-10-31 Ravi Pratap <ravi@ximian.com>
421 * typemanager.cs (RegisterMethod): Check if we already have an existing key
422 and bale out if necessary by returning a false.
424 (RegisterProperty): Ditto.
426 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
427 and print out appropriate error messages.
429 * interface.cs (everywhere): Ditto.
431 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
432 location to constructor.
434 * class.cs (Property, Event, Indexer): Update accordingly.
436 * ../errors/cs111.cs : Added.
438 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
439 of a method, as laid down by the spec.
441 (Invocation::OverloadResolve): Use the above method.
443 2001-10-31 Ravi Pratap <ravi@ximian.com>
445 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
446 now take a TypeContainer and a Parameters object.
448 (ParameterData): Modify return type of ParameterModifier method to be
449 Parameter.Modifier and not a string.
451 (ReflectionParameters, InternalParameters): Update accordingly.
453 * expression.cs (Argument::GetParameterModifier): Same here.
455 * support.cs (InternalParameters::ParameterType): Find a better way of determining
456 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
457 symbol in it at all so maybe this is only for now.
459 2001-10-30 Ravi Pratap <ravi@ximian.com>
461 * support.cs (InternalParameters): Constructor now takes an extra argument
462 which is the actual Parameters class.
464 (ParameterDesc): Update to provide info on ref/out modifiers.
466 * class.cs (everywhere): Update call to InternalParameters to pass in
467 the second argument too.
469 * support.cs (ParameterData): Add ParameterModifier, which is a method
470 to return the modifier info [ref/out etc]
472 (InternalParameters, ReflectionParameters): Implement the above.
474 * expression.cs (Argument::ParameterModifier): Similar function to return
475 info about the argument's modifiers.
477 (Invocation::OverloadResolve): Update to take into account matching modifiers
480 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
481 a new SetFormalParameters object which we pass to InternalParameters.
483 2001-10-30 Ravi Pratap <ravi@ximian.com>
485 * expression.cs (NewArray): Merge into the ArrayCreation class.
487 2001-10-29 Ravi Pratap <ravi@ximian.com>
489 * expression.cs (NewArray): Merge classes NewBuiltinArray and
490 NewUserdefinedArray into one as there wasn't much of a use in having
493 * expression.cs (Argument): Change field's name to ArgType from Type.
495 (Type): New readonly property which returns the proper type, taking into
496 account ref/out modifiers.
498 (everywhere): Adjust code accordingly for the above.
500 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
501 whether we are emitting for a ref or out parameter.
503 * expression.cs (Argument::Emit): Use the above field to set the state.
505 (LocalVariableReference::Emit): Update to honour the flag and emit the
508 * parameter.cs (Attributes): Set the correct flags for ref parameters.
510 * expression.cs (Argument::FullDesc): New function to provide a full desc.
512 * support.cs (ParameterData): Add method ParameterDesc to the interface.
514 (ReflectionParameters, InternalParameters): Implement the above method.
516 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
519 (Invocation::FullMethodDesc): Ditto.
521 2001-10-29 Miguel de Icaza <miguel@ximian.com>
523 * cs-parser.jay: Add extra production for the second form of array
526 * expression.cs (ArrayCreation): Update to reflect the above
529 * Small changes to prepare for Array initialization.
531 2001-10-28 Miguel de Icaza <miguel@ximian.com>
533 * typemanager.cs (ImplementsInterface): interface might be null;
534 Deal with this problem;
536 Also, we do store negative hits on the cache (null values), so use
537 this instead of calling t.GetInterfaces on the type everytime.
539 2001-10-28 Ravi Pratap <ravi@ximian.com>
541 * typemanager.cs (IsBuiltinType): New method to help determine the same.
543 * expression.cs (New::DoResolve): Get rid of array creation code and instead
544 split functionality out into different classes.
546 (New::FormArrayType): Move into NewBuiltinArray.
548 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
551 (NewBuiltinArray): New class to handle creation of built-in arrays.
553 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
554 account creation of one-dimensional arrays.
556 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
558 (NewUserdefinedArray::DoResolve): Implement.
560 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
562 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
563 we maintain inside the TypeManager. This is necessary to perform lookups on the
566 (LookupType): Update to perform GetType on the module builders too.
568 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
570 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
572 2001-10-23 Ravi Pratap <ravi@ximian.com>
574 * expression.cs (New::DoResolve): Implement guts of array creation.
576 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
578 2001-10-27 Miguel de Icaza <miguel@ximian.com>
580 * expression.cs: Fix bug I introduced lsat night that broke
583 (Expression.Resolve): Report a 246 error (can not resolve name)
584 if we find a SimpleName in the stream.
586 (Expression.ResolveLValue): Ditto.
588 (Expression.ResolveWithSimpleName): This function is a variant of
589 ResolveName, this one allows SimpleNames to be returned without a
590 warning. The only consumer of SimpleNames is MemberAccess
592 2001-10-26 Miguel de Icaza <miguel@ximian.com>
594 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
595 might arrive here. I have my doubts that this is correct.
597 * statement.cs (Lock): Implement lock statement.
599 * cs-parser.jay: Small fixes to support `lock' and `using'
601 * cs-tokenizer.cs: Remove extra space
603 * driver.cs: New flag --checked, allows to turn on integer math
606 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
607 Threading.Monitor.Exit
609 2001-10-23 Miguel de Icaza <miguel@ximian.com>
611 * expression.cs (IndexerAccess::DoResolveLValue): Set the
612 Expression Class to be IndexerAccess.
614 Notice that Indexer::DoResolve sets the eclass to Value.
616 2001-10-22 Miguel de Icaza <miguel@ximian.com>
618 * class.cs (TypeContainer::Emit): Emit code for indexers.
620 * assign.cs (IAssignMethod): New interface implemented by Indexers
621 and Properties for handling assignment.
623 (Assign::Emit): Simplify and reuse code.
625 * expression.cs (IndexerAccess, PropertyExpr): Implement
626 IAssignMethod, clean up old code.
628 2001-10-22 Ravi Pratap <ravi@ximian.com>
630 * typemanager.cs (ImplementsInterface): New method to determine if a type
631 implements a given interface. Provides a nice cache too.
633 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
636 (ConvertReferenceExplicit): Ditto.
638 * delegate.cs (Delegate::Populate): Update to define the parameters on the
639 various methods, with correct names etc.
641 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
642 Operator.UnaryNegation.
644 * cs-parser.jay (operator_declarator): Be a little clever in the case where
645 we have a unary plus or minus operator.
647 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
650 * everywhere : update accordingly.
652 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
655 * class.cs (Method::Define): For the case where we are implementing a method
656 inherited from an interface, we need to set the MethodAttributes.Final flag too.
657 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
659 2001-10-21 Ravi Pratap <ravi@ximian.com>
661 * interface.cs (FindMembers): Implement to work around S.R.E
664 * typemanager.cs (IsInterfaceType): Implement.
666 (FindMembers): Update to handle interface types too.
668 * expression.cs (ImplicitReferenceConversion): Re-write bits which
669 use IsAssignableFrom as that is not correct - it doesn't work.
671 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
672 and accordingly override EmitStatement.
674 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
675 using the correct logic :-)
677 2001-10-19 Ravi Pratap <ravi@ximian.com>
679 * ../errors/cs-11.cs : Add to demonstrate error -11
681 2001-10-17 Miguel de Icaza <miguel@ximian.com>
683 * assign.cs (Assign::Resolve): Resolve right hand side first, and
684 then pass this as a hint to ResolveLValue.
686 * expression.cs (FieldExpr): Add Location information
688 (FieldExpr::LValueResolve): Report assignment to readonly
691 (Expression::ExprClassFromMemberInfo): Pass location information.
693 (Expression::ResolveLValue): Add new method that resolves an
696 (Expression::DoResolveLValue): Default invocation calls
699 (Indexers): New class used to keep track of indexers in a given
702 (IStackStore): Renamed from LValue, as it did not really describe
703 what this did. Also ResolveLValue is gone from this interface and
704 now is part of Expression.
706 (ElementAccess): Depending on the element access type
708 * typemanager.cs: Add `indexer_name_type' as a Core type
709 (System.Runtime.CompilerServices.IndexerNameAttribute)
711 * statement.cs (Goto): Take a location.
713 2001-10-18 Ravi Pratap <ravi@ximian.com>
715 * delegate.cs (Delegate::VerifyDelegate): New method to verify
716 if two delegates are compatible.
718 (NewDelegate::DoResolve): Update to take care of the case when
719 we instantiate a delegate from another delegate.
721 * typemanager.cs (FindMembers): Don't even try to look up members
722 of Delegate types for now.
724 2001-10-18 Ravi Pratap <ravi@ximian.com>
726 * delegate.cs (NewDelegate): New class to take care of delegate
729 * expression.cs (New): Split the delegate related code out into
730 the NewDelegate class.
732 * delegate.cs (DelegateInvocation): New class to handle delegate
735 * expression.cs (Invocation): Split out delegate related code into
736 the DelegateInvocation class.
738 2001-10-17 Ravi Pratap <ravi@ximian.com>
740 * expression.cs (New::DoResolve): Implement delegate creation fully
741 and according to the spec.
743 (New::DoEmit): Update to handle delegates differently.
745 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
746 because of which we were printing out arguments in reverse order !
748 * delegate.cs (VerifyMethod): Implement to check if the given method
749 matches the delegate.
751 (FullDelegateDesc): Implement.
753 (VerifyApplicability): Implement.
755 * expression.cs (Invocation::DoResolve): Update to accordingly handle
756 delegate invocations too.
758 (Invocation::Emit): Ditto.
760 * ../errors/cs1593.cs : Added.
762 * ../errors/cs1594.cs : Added.
764 * delegate.cs (InstanceExpression, TargetMethod): New properties.
766 2001-10-16 Ravi Pratap <ravi@ximian.com>
768 * typemanager.cs (intptr_type): Core type for System.IntPtr
770 (InitCoreTypes): Update for the same.
772 (iasyncresult_type, asynccallback_type): Ditto.
774 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
777 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
780 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
781 the builders for the 4 members of a delegate type :-)
783 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
786 * expression.cs (New::DoResolve): Implement guts for delegate creation.
788 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
790 2001-10-15 Miguel de Icaza <miguel@ximian.com>
792 * statement.cs (Break::Emit): Implement.
793 (Continue::Emit): Implement.
795 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
796 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
797 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
798 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
801 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
802 properties that track the label for the current loop (begin of the
803 loop and end of the loop).
805 2001-10-15 Ravi Pratap <ravi@ximian.com>
807 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
808 use of emitting anything at all.
810 * class.cs, rootcontext.cs : Get rid of calls to the same.
812 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
814 (Populate): Define the constructor correctly and set the implementation
817 * typemanager.cs (delegate_types): New hashtable to hold delegates that
820 (AddDelegateType): Implement.
822 (IsDelegateType): Implement helper method.
824 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
826 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
827 and accordingly handle it.
829 * delegate.cs (Populate): Take TypeContainer argument.
830 Implement bits to define the Invoke method. However, I still haven't figured out
831 how to take care of the native int bit :-(
833 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
834 Qualify the name of the delegate, not its return type !
836 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
839 (StandardConversionExists): Checking for array types turns out to be recursive.
841 (ConvertReferenceExplicit): Implement array conversion.
843 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
845 2001-10-12 Ravi Pratap <ravi@ximian.com>
847 * cs-parser.jay (delegate_declaration): Store the fully qualified
848 name as it is a type declaration.
850 * delegate.cs (ReturnType, Name): Rename members to these. Make them
853 (DefineDelegate): Renamed from Define. Does the same thing essentially,
854 as TypeContainer::DefineType.
856 (Populate): Method in which all the definition of the various methods (Invoke)
859 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
862 (CloseDelegate): Finally creates the delegate.
864 * class.cs (TypeContainer::DefineType): Update to define delegates.
865 (Populate, Emit and CloseType): Do the same thing here too.
867 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
868 delegates in all these operations.
870 2001-10-14 Miguel de Icaza <miguel@ximian.com>
872 * expression.cs: LocalTemporary: a new expression used to
873 reference a temporary that has been created.
875 * assign.cs: Handle PropertyAccess back here, so that we can
876 provide the proper semantic access to properties.
878 * expression.cs (Expression::ConvertReferenceExplicit): Implement
879 a few more explicit conversions.
881 * modifiers.cs: `NEW' modifier maps to HideBySig.
883 * expression.cs (PropertyExpr): Make this into an
884 ExpressionStatement, and support the EmitStatement code path.
886 Perform get/set error checking, clean up the interface.
888 * assign.cs: recognize PropertyExprs as targets, and if so, turn
889 them into toplevel access objects.
891 2001-10-12 Miguel de Icaza <miguel@ximian.com>
893 * expression.cs: PropertyExpr::PropertyExpr: use work around the
896 * typemanager.cs: Keep track here of our PropertyBuilders again to
897 work around lameness in SRE.
899 2001-10-11 Miguel de Icaza <miguel@ximian.com>
901 * expression.cs (LValue::LValueResolve): New method in the
902 interface, used to perform a second resolution pass for LValues.
904 (This::DoResolve): Catch the use of this in static methods.
906 (This::LValueResolve): Implement.
908 (This::Store): Remove warning, assigning to `this' in structures
911 (Invocation::Emit): Deal with invocation of
912 methods on value types. We need to pass the address to structure
913 methods rather than the object itself. (The equivalent code to
914 emit "this" for structures leaves the entire structure on the
915 stack instead of a pointer to it).
917 (ParameterReference::DoResolve): Compute the real index for the
918 argument based on whether the method takes or not a `this' pointer
919 (ie, the method is static).
921 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
922 value types returned from functions when we need to invoke a
923 method on the sturcture.
926 2001-10-11 Ravi Pratap <ravi@ximian.com>
928 * class.cs (TypeContainer::DefineType): Method to actually do the business of
929 defining the type in the Modulebuilder or Typebuilder. This is to take
930 care of nested types which need to be defined on the TypeBuilder using
933 (TypeContainer::GetClassBases): Implement. Essentially the code from the
934 methods in RootContext, only ported to be part of TypeContainer.
936 (TypeContainer::GetInterfaceOrClass): Ditto.
938 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
940 * interface.cs (Interface::DefineInterface): New method. Does exactly
941 what RootContext.CreateInterface did earlier, only it takes care of nested types
944 (Interface::GetInterfaces): Move from RootContext here and port.
946 (Interface::GetInterfaceByName): Same here.
948 * rootcontext.cs (ResolveTree): Re-write.
950 (PopulateTypes): Re-write.
952 * class.cs (TypeContainer::Populate): Populate nested types too.
953 (TypeContainer::Emit): Emit nested members too.
955 * typemanager.cs (AddUserType): Do not make use of the FullName property,
956 instead just use the name argument passed in as it is already fully
959 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
960 to TypeContainer mapping to see if a type is user-defined.
962 * class.cs (TypeContainer::CloseType): Implement.
964 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
965 the default constructor.
967 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
970 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
972 * interface.cs (CloseType): Create the type here.
974 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
977 Remove all the methods which are now in TypeContainer.
979 2001-10-10 Ravi Pratap <ravi@ximian.com>
981 * delegate.cs (Define): Re-write bits to define the delegate
984 2001-10-10 Miguel de Icaza <miguel@ximian.com>
986 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
988 * expression.cs (ImplicitReferenceConversion): handle null as well
989 as a source to convert to any reference type.
991 * statement.cs (Return): Perform any implicit conversions to
992 expected return type.
994 Validate use of return statement.
996 * codegen.cs (EmitContext): Pass the expected return type here.
998 * class.cs (Method, Constructor, Property): Pass expected return
1001 2001-10-09 Miguel de Icaza <miguel@ximian.com>
1003 * expression.cs: Make DoResolve take an EmitContext instead of a
1006 Replaced `l' and `location' for `loc', for consistency.
1008 (Error, Warning): Remove unneeded Tc argument.
1010 * assign.cs, literal.cs, constant.cs: Update to new calling
1013 * codegen.cs: EmitContext now contains a flag indicating whether
1014 code is being generated in a static method or not.
1016 * cs-parser.jay: DecomposeQI, new function that replaces the old
1017 QualifiedIdentifier. Now we always decompose the assembled
1018 strings from qualified_identifier productions into a group of
1021 2001-10-08 Miguel de Icaza <miguel@ximian.com>
1023 * rootcontext.cs: Deal with field-less struct types correctly now
1024 by passing the size option to Define Type.
1026 * class.cs: Removed hack that created one static field.
1028 2001-10-07 Miguel de Icaza <miguel@ximian.com>
1030 * statement.cs: Moved most of the code generation here.
1032 2001-10-09 Ravi Pratap <ravi@ximian.com>
1034 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
1037 (ElementAccess): Remove useless bits for now - keep checks as the spec
1040 2001-10-08 Ravi Pratap <ravi@ximian.com>
1042 * expression.cs (ElementAccess::DoResolve): Remove my crap code
1043 and start performing checks according to the spec.
1045 2001-10-07 Ravi Pratap <ravi@ximian.com>
1047 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
1048 rank_specifiers instead.
1050 (rank_specifiers): Change the order in which the rank specifiers are stored
1052 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
1054 * expression.cs (ElementAccess): Implement the LValue interface too.
1056 2001-10-06 Ravi Pratap <ravi@ximian.com>
1058 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
1059 except that user defined conversions are not included.
1061 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
1062 perform the conversion of the return type, if necessary.
1064 (New::DoResolve): Check whether we are creating an array or an object
1065 and accordingly do the needful.
1067 (New::Emit): Same here.
1069 (New::DoResolve): Implement guts of array creation.
1071 (New::FormLookupType): Helper function.
1073 2001-10-07 Miguel de Icaza <miguel@ximian.com>
1075 * codegen.cs: Removed most of the code generation here, and move the
1076 corresponding code generation bits to the statement classes.
1078 Added support for try/catch/finalize and throw.
1080 * cs-parser.jay: Added support for try/catch/finalize.
1082 * class.cs: Catch static methods having the flags override,
1083 virtual or abstract.
1085 * expression.cs (UserCast): This user cast was not really doing
1086 what it was supposed to do. Which is to be born in fully resolved
1087 state. Parts of the resolution were being performed at Emit time!
1091 2001-10-05 Miguel de Icaza <miguel@ximian.com>
1093 * expression.cs: Implicity convert the result from UserCast.
1095 2001-10-05 Ravi Pratap <ravi@ximian.com>
1097 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
1098 prevented it from working correctly.
1100 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
1101 merely ConvertImplicit.
1103 2001-10-05 Miguel de Icaza <miguel@ximian.com>
1105 * typemanager.cs: Make the LookupTypeContainer function static,
1106 and not per-instance.
1108 * class.cs: Make static FindMembers (the one that takes a Type
1111 * codegen.cs: Add EmitForeach here.
1113 * cs-parser.jay: Make foreach a toplevel object instead of the
1114 inline expansion, as we need to perform semantic analysis on it.
1116 2001-10-05 Ravi Pratap <ravi@ximian.com>
1118 * expression.cs (Expression::ImplicitUserConversion): Rename to
1119 UserDefinedConversion.
1121 (Expression::UserDefinedConversion): Take an extra argument specifying
1122 whether we look for explicit user conversions too.
1124 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
1126 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
1128 (ExplicitUserConversion): Make it a call to UserDefinedConversion
1129 with the appropriate arguments.
1131 * cs-parser.jay (cast_expression): Record location too.
1133 * expression.cs (Cast): Record location info.
1135 (Expression::ConvertExplicit): Take location argument.
1137 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
1138 to determine if we are doing explicit conversions.
1140 (UserCast::Emit): Update accordingly.
1142 (Expression::ConvertExplicit): Report an error if everything fails.
1144 * ../errors/cs0030.cs : Add.
1146 2001-10-04 Miguel de Icaza <miguel@ximian.com>
1148 * modifiers.cs: If the ABSTRACT keyword is present, also set the
1149 virtual and newslot bits.
1151 * class.cs (TypeContainer::RegisterRequiredImplementations):
1152 Record methods we need.
1154 (TypeContainer::MakeKey): Helper function to make keys for
1155 MethodBases, since the Methodbase key is useless.
1157 (TypeContainer::Populate): Call RegisterRequiredImplementations
1158 before defining the methods.
1160 Create a mapping for method_builders_to_methods ahead of time
1161 instead of inside a tight loop.
1163 (::RequireMethods): Accept an object as the data to set into the
1164 hashtable so we can report interface vs abstract method mismatch.
1166 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1168 * report.cs: Make all of it static.
1170 * rootcontext.cs: Drop object_type and value_type computations, as
1171 we have those in the TypeManager anyways.
1173 Drop report instance variable too, now it is a global.
1175 * driver.cs: Use try/catch on command line handling.
1177 Add --probe option to debug the error reporting system with a test
1180 * report.cs: Add support for exiting program when a probe
1181 condition is reached.
1183 2001-10-03 Ravi Pratap <ravi@ximian.com>
1185 * expression.cs (Binary::DoNumericPromotions): Fix the case when
1186 we do a forcible conversion regardless of type, to check if
1187 ForceConversion returns a null.
1189 (Binary::error19): Use location to report error.
1191 (Unary::error23): Use location here too.
1193 * ../errors/cs0019.cs : Check in.
1195 * ../errors/cs0023.cs : Check in.
1197 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
1198 case of a non-null MethodInfo object with a length of 0 !
1200 (Binary::ResolveOperator): Flag error if overload resolution fails to find
1201 an applicable member - according to the spec :-)
1202 Also fix logic to find members in base types.
1204 (Unary::ResolveOperator): Same here.
1206 (Unary::report23): Change name to error23 and make first argument a TypeContainer
1207 as I was getting thoroughly confused between this and error19 :-)
1209 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
1210 (::FindMostEncompassedType): Implement.
1211 (::FindMostEncompassingType): Implement.
1212 (::StandardConversionExists): Implement.
1214 (UserImplicitCast): Re-vamp. We now need info about most specific
1215 source and target types so that we can do the necessary conversions.
1217 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
1218 mathematical union with no duplicates.
1220 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1222 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
1223 in order from base classes to child classes, so that we can in
1224 child classes look up in our parent for method names and
1225 attributes (required for handling abstract, virtual, new, override
1226 constructs: we need to instrospect our base class, and if we dont
1227 populate the classes in order, the introspection might be
1228 incorrect. For example, a method could query its parent before
1229 the parent has any methods and would determine that the parent has
1230 no abstract methods (while it could have had them)).
1232 (RootContext::CreateType): Record the order in which we define the
1235 2001-10-02 Miguel de Icaza <miguel@ximian.com>
1237 * class.cs (TypeContainer::Populate): Also method definitions can
1238 fail now, keep track of this.
1240 (TypeContainer::FindMembers): Implement support for
1241 DeclaredOnly/noDeclaredOnly flag.
1243 (Constructor::Emit) Return the ConstructorBuilder.
1245 (Method::Emit) Return the MethodBuilder.
1246 Check for abstract or virtual methods to be public.
1248 * rootcontext.cs (RootContext::CreateType): Register all the
1249 abstract methods required for the class to be complete and the
1250 interface methods that must be implemented.
1252 * cs-parser.jay: Report error 501 (method requires body if it is
1253 not marked abstract or extern).
1255 * expression.cs (TypeOf::Emit): Implement.
1257 * typemanager.cs: runtime_handle_type, new global type.
1259 * class.cs (Property::Emit): Generate code for properties.
1261 2001-10-02 Ravi Pratap <ravi@ximian.com>
1263 * expression.cs (Unary::ResolveOperator): Find operators on base type
1264 too - we now conform exactly to the spec.
1266 (Binary::ResolveOperator): Same here.
1268 * class.cs (Operator::Define): Fix minor quirk in the tests.
1270 * ../errors/cs0215.cs : Added.
1272 * ../errors/cs0556.cs : Added.
1274 * ../errors/cs0555.cs : Added.
1276 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1278 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
1279 single integer which is really efficient
1281 2001-10-01 Ravi Pratap <ravi@ximian.com>
1283 * expression.cs (Expression::ImplicitUserConversion): Use location
1284 even in the case when we are examining True operators.
1286 * class.cs (Operator::Define): Perform extensive checks to conform
1287 with the rules for operator overloading in the spec.
1289 * expression.cs (Expression::ImplicitReferenceConversion): Implement
1290 some of the other conversions mentioned in the spec.
1292 * typemanager.cs (array_type): New static member for the System.Array built-in
1295 (cloneable_interface): For System.ICloneable interface.
1297 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
1298 we start resolving the tree and populating types.
1300 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
1302 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1304 * expression.cs (Expression::ExprClassFromMemberInfo,
1305 Expression::Literalize): Create literal expressions from
1306 FieldInfos which are literals.
1308 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
1309 type casts, because they were wrong. The test suite in tests
1312 (ImplicitNumericConversion): ushort to ulong requires a widening
1315 Int32 constant to long requires widening cast as well.
1317 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
1318 for integers because the type on the stack is not i4.
1320 2001-09-30 Miguel de Icaza <miguel@ximian.com>
1322 * expression.cs (report118): require location argument.
1324 * parameter.cs: Do not dereference potential null value.
1326 * class.cs: Catch methods that lack the `new' keyword when
1327 overriding a name. Report warnings when `new' is used without
1328 anything being there to override.
1330 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
1332 * class.cs: Only add constructor to hashtable if it is non-null
1333 (as now constructors can fail on define).
1335 (TypeManager, Class, Struct): Take location arguments.
1337 Catch field instance initialization in structs as errors.
1339 accepting_filter: a new filter for FindMembers that is static so
1340 that we dont create an instance per invocation.
1342 (Constructor::Define): Catch errors where a struct constructor is
1345 * cs-parser.jay: Pass location information for various new
1348 * delegate.cs (Delegate): take a location argument.
1350 * driver.cs: Do not call EmitCode if there were problesm in the
1351 Definition of the types, as many Builders wont be there.
1353 * decl.cs (Decl::Decl): Require a location argument.
1355 * cs-tokenizer.cs: Handle properly hex constants that can not fit
1356 into integers, and find the most appropiate integer for it.
1358 * literal.cs: Implement ULongLiteral.
1360 * rootcontext.cs: Provide better information about the location of
1361 failure when CreateType fails.
1363 2001-09-29 Miguel de Icaza <miguel@ximian.com>
1365 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
1368 * expression.cs (Binary::CheckShiftArguments): Add missing type
1370 (Binary::ResolveOperator): Add type to the logical and and logical
1371 or, Bitwise And/Or and Exclusive Or code paths, it was missing
1374 (Binary::DoNumericPromotions): In the case where either argument
1375 is ulong (and most signed types combined with ulong cause an
1376 error) perform implicit integer constant conversions as well.
1378 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1380 * expression.cs (UserImplicitCast): Method should always be
1382 (Invocation::BetterConversion): Simplified test for IntLiteral.
1384 (Expression::ImplicitNumericConversion): Split this routine out.
1385 Put the code that performs implicit constant integer conversions
1388 (Expression::Resolve): Become a wrapper around DoResolve so we can
1389 check eclass and type being set after resolve.
1391 (Invocation::Badness): Remove this dead function
1393 (Binary::ResolveOperator): Do not compute the expensive argumnets
1394 unless we have a union for it.
1396 (Probe::Emit): Is needs to do an isinst and then
1397 compare against null.
1399 (::CanConvert): Added Location argument. If the Location argument
1400 is null (Location.Null), then we do not report errors. This is
1401 used by the `probe' mechanism of the Explicit conversion. We do
1402 not want to generate an error for something that the user
1403 explicitly requested to be casted. But the pipeline for an
1404 explicit cast first tests for potential implicit casts.
1406 So for now, if the Location is null, it means `Probe only' to
1407 avoid adding another argument. Might have to revise this
1410 (ClassCast): New class used to type cast objects into arbitrary
1411 classes (used in Explicit Reference Conversions).
1413 Implement `as' as well.
1415 Reverted all the patches from Ravi below: they were broken:
1417 * The use of `level' as a mechanism to stop recursive
1418 invocations is wrong. That was there just to catch the
1419 bug with a strack trace but not as a way of addressing
1422 To fix the problem we have to *understand* what is going
1423 on and the interactions and come up with a plan, not
1424 just get things going.
1426 * The use of the type conversion cache that I proposed
1427 last night had an open topic: How does this work across
1428 protection domains. A user defined conversion might not
1429 be public in the location where we are applying the
1430 conversion, a different conversion might be selected
1431 (ie, private A->B (better) but public B->A (worse),
1432 inside A, A->B applies, but outside it, B->A will
1435 * On top of that (ie, even if the above is solved),
1436 conversions in a cache need to be abstract. Ie, `To
1437 convert from an Int to a Short use an OpcodeCast', not
1438 `To convert from an Int to a Short use the OpcodeCast on
1439 the variable 5' (which is what this patch was doing).
1441 2001-09-28 Ravi Pratap <ravi@ximian.com>
1443 * expression.cs (Invocation::ConversionExists): Re-write to use
1444 the conversion cache
1446 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
1447 cache all conversions done, not just user-defined ones.
1449 (Invocation::BetterConversion): The real culprit. Use ConversionExists
1450 to determine if a conversion exists instead of acutually trying to
1451 perform the conversion. It's faster too.
1453 (Expression::ConvertExplicit): Modify to use ConversionExists to check
1454 and only then attempt the implicit conversion.
1456 2001-09-28 Ravi Pratap <ravi@ximian.com>
1458 * expression.cs (ConvertImplicit): Use a cache for conversions
1459 already found. Check level of recursion and bail out if necessary.
1461 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1463 * typemanager.cs (string_concat_string_string, string_concat_object_object):
1464 Export standard methods that we expect for string operations.
1466 * statement.cs (Block::UsageWarning): Track usage of variables and
1467 report the errors for not used variables.
1469 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
1472 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1474 * codegen.cs: remove unnneded code
1476 * expression.cs: Removed BuiltinTypeAccess class
1478 Fix the order in which implicit conversions are
1481 The previous fixed dropped support for boxed conversions (adding a
1482 test to the test suite now)
1484 (UserImplicitCast::CanConvert): Remove test for source being null,
1485 that code is broken. We should not feed a null to begin with, if
1486 we do, then we should track the bug where the problem originates
1487 and not try to cover it up here.
1489 Return a resolved expression of type UserImplicitCast on success
1490 rather than true/false. Ravi: this is what I was talking about,
1491 the pattern is to use a static method as a "constructor" for
1494 Also, do not create arguments until the very last minute,
1495 otherwise we always create the arguments even for lookups that
1496 will never be performed.
1498 (UserImplicitCast::Resolve): Eliminate, objects of type
1499 UserImplicitCast are born in a fully resolved state.
1501 * typemanager.cs (InitCoreTypes): Init also value_type
1504 * expression.cs (Cast::Resolve): First resolve the child expression.
1506 (LValue): Add new method AddressOf to be used by
1509 Change the argument of Store to take an EmitContext instead of an
1510 ILGenerator, because things like FieldExpr need to be able to call
1511 their children expression to generate the instance code.
1513 (Expression::Error, Expression::Warning): Sugar functions for
1516 (Expression::MemberLookup): Accept a TypeContainer instead of a
1517 Report as the first argument.
1519 (Expression::ResolvePrimary): Killed. I still want to improve
1520 this as currently the code is just not right.
1522 (Expression::ResolveMemberAccess): Simplify, but it is still
1525 (Unary::Resolve): Catch errors in AddressOf operators.
1527 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
1528 index to a byte for the short-version, or the compiler will choose
1529 the wrong Emit call, which generates the wrong data.
1531 (ParameterReference::Emit, ::Store): same.
1533 (FieldExpr::AddressOf): Implement.
1535 * typemanager.cs: TypeManager: made public variable instead of
1538 * driver.cs: document --fatal.
1540 * report.cs (ErrorMessage, WarningMessage): new names for the old
1541 Error and Warning classes.
1543 * cs-parser.jay (member_access): Turn built-in access to types
1544 into a normal simplename
1546 2001-09-27 Ravi Pratap <ravi@ximian.com>
1548 * expression.cs (Invocation::BetterConversion): Fix to cope
1549 with q being null, since this was introducing a bug.
1551 * expression.cs (ConvertImplicit): Do built-in conversions first.
1553 2001-09-27 Ravi Pratap <ravi@ximian.com>
1555 * expression.cs (UserImplicitCast::Resolve): Fix bug.
1557 2001-09-27 Ravi Pratap <ravi@ximian.com>
1559 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
1560 I had introduced long ago (what's new ?).
1562 * expression.cs (UserImplicitCast::CanConvert): Static method to do
1563 the work of all the checking.
1564 (ConvertImplicit): Call CanConvert and only then create object if necessary.
1565 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
1567 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
1568 that is the right way.
1570 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
1571 overloading resolution. Use everywhere instead of cutting and pasting code.
1573 (Binary::ResolveOperator): Use MakeUnionSet.
1575 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
1576 we have to convert to bool types. Not complete yet.
1578 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1580 * typemanager.cs (TypeManager::CSharpName): support ushort.
1582 * expression.cs (Expression::TryImplicitIntConversion): Attempts
1583 to provide an expression that performsn an implicit constant int
1584 conversion (section 6.1.6).
1585 (Expression::ConvertImplicitRequired): Reworked to include
1586 implicit constant expression conversions.
1588 (Expression::ConvertNumericExplicit): Finished.
1590 (Invocation::Emit): If InstanceExpression is null, then it means
1591 that we perform a call on this.
1593 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1595 * expression.cs (Unary::Emit): Remove some dead code.
1596 (Probe): Implement Resolve and Emit for `is'.
1597 (Expression::ConvertImplicitRequired): Attempt to do constant
1598 expression conversions here. Maybe should be moved to
1599 ConvertImplicit, but I am not sure.
1600 (Expression::ImplicitLongConstantConversionPossible,
1601 Expression::ImplicitIntConstantConversionPossible): New functions
1602 that tell whether is it possible to apply an implicit constant
1603 expression conversion.
1605 (ConvertNumericExplicit): Started work on explicit numeric
1608 * cs-parser.jay: Update operator constants.
1610 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
1611 (Parameters::GetSignature): Hook up VerifyArgs here.
1612 (Parameters::VerifyArgs): Verifies that no two arguments have the
1615 * class.cs (Operator): Update the operator names to reflect the
1616 ones that the spec expects (as we are just stringizing the
1619 * expression.cs (Unary::ResolveOperator): Fix bug: Use
1620 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
1621 previous usage did only work for our methods.
1622 (Expression::ConvertImplicit): Handle decimal implicit numeric
1623 conversions as well.
1624 (Expression::InternalTypeConstructor): Used to invoke constructors
1625 on internal types for default promotions.
1627 (Unary::Emit): Implement special handling for the pre/post
1628 increment/decrement for overloaded operators, as they need to have
1629 the same semantics as the other operators.
1631 (Binary::ResolveOperator): ditto.
1632 (Invocation::ConversionExists): ditto.
1633 (UserImplicitCast::Resolve): ditto.
1635 2001-09-26 Ravi Pratap <ravi@ximian.com>
1637 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
1638 operator, return after emitting body. Regression tests pass again !
1640 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
1641 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
1642 (Invocation::OverloadResolve): Ditto.
1643 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
1645 * everywhere : update calls to the above methods accordingly.
1647 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1649 * assign.cs (Assign): Make it inherit from ExpressionStatement.
1651 * expression.cs (ExpressionStatement): New base class used for
1652 expressions that can appear in statements, so that we can provide
1653 an alternate path to generate expression that do not leave a value
1656 (Expression::Emit, and all the derivatives): We no longer return
1657 whether a value is left on the stack or not. Every expression
1658 after being emitted leaves a single value on the stack.
1660 * codegen.cs (EmitContext::EmitStatementExpression): Use the
1661 facilties of ExpressionStatement if possible.
1663 * cs-parser.jay: Update statement_expression.
1665 2001-09-25 Miguel de Icaza <miguel@ximian.com>
1667 * driver.cs: Change the wording of message
1669 2001-09-25 Ravi Pratap <ravi@ximian.com>
1671 * expression.cs (Binary::ResolveOperator): Had forgottten to set
1672 the type of the expression to the return type of the method if
1673 we have an overloaded operator match ! The regression tests pass again !
1674 (Unary::ResolveOperator): Ditto.
1676 * expression.cs (Invocation::ConversionExists): Correct the member lookup
1677 to find "op_Implicit", not "implicit" ;-)
1678 (UserImplicitCast): New class to take care of user-defined implicit conversions.
1679 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1681 * everywhere : Correct calls to the above accordingly.
1683 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1684 (ConvertImplicit): Do user-defined conversion if it exists.
1686 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1688 * assign.cs: track location.
1689 (Resolve): Use implicit conversions on assignment.
1691 * literal.cs: Oops. Not good, Emit of short access values should
1692 pass (Bytes) or the wrong argument will be selected.
1694 * expression.cs (Unary::Emit): Emit code for -expr.
1696 (Unary::ResolveOperator): Handle `Substract' for non-constants
1697 (substract from zero from the non-constants).
1698 Deal with Doubles as well.
1700 (Expression::ConvertImplicitRequired): New routine that reports an
1701 error if no implicit conversion exists.
1703 (Invocation::OverloadResolve): Store the converted implicit
1704 expressions if we make them
1706 2001-09-24 Ravi Pratap <ravi@ximian.com>
1708 * class.cs (ConstructorInitializer): Take a Location argument.
1709 (ConstructorBaseInitializer): Same here.
1710 (ConstructorThisInitializer): Same here.
1712 * cs-parser.jay : Update all calls accordingly.
1714 * expression.cs (Unary, Binary, New): Take location argument.
1715 Update accordingly everywhere.
1717 * cs-parser.jay : Update all calls to the above to take a location
1722 2001-09-24 Ravi Pratap <ravi@ximian.com>
1724 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1725 (Invocation::BetterConversion): Same here
1726 (Invocation::ConversionExists): Ditto.
1728 (Invocation::ConversionExists): Implement.
1730 2001-09-22 Ravi Pratap <ravi@ximian.com>
1732 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1733 Also take an additional TypeContainer argument.
1735 * All over : Pass in TypeContainer as argument to OverloadResolve.
1737 * typemanager.cs (CSharpName): Update to check for the string type and return
1740 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1743 2001-09-21 Ravi Pratap <ravi@ximian.com>
1745 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1746 (Invocation::BetterFunction): Implement.
1747 (Invocation::BetterConversion): Implement.
1748 (Invocation::ConversionExists): Skeleton, no implementation yet.
1750 Okay, things work fine !
1752 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1754 * typemanager.cs: declare and load enum_type, delegate_type and
1757 * expression.cs (Expression::Emit): Now emit returns a value that
1758 tells whether a value is left on the stack or not. This strategy
1759 might be reveted tomorrow with a mechanism that would address
1760 multiple assignments.
1761 (Expression::report118): Utility routine to report mismatches on
1764 (Unary::Report23): Report impossible type/operator combination
1767 (Unary::IsIncrementableNumber): Whether the type can be
1768 incremented or decremented with add.
1769 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1771 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1773 (Invocation::Emit): Deal with new Emit convetion.
1775 * All Expression derivatives: Updated their Emit method to return
1776 whether they leave values on the stack or not.
1778 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1779 stack for expressions that are statements.
1781 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1783 * expression.cs (LValue): New interface. Must be implemented by
1785 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1788 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1789 interface for generating code, simplifies the code.
1791 2001-09-20 Ravi Pratap <ravi@ximian.com>
1793 * expression.cs (everywhere): Comment out return statements in ::Resolve
1794 methods to avoid the warnings.
1796 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1798 * driver.cs (parse): Report error 2001 if we can not open the
1801 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1804 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1807 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1808 otherwise nested blocks end up with the same index.
1810 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1812 * expression.cs: Instead of having FIXMEs in the Resolve
1813 functions, throw exceptions so it is obvious that we are facing a
1816 * cs-parser.jay (invocation_expression): Pass Location information.
1818 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1819 Use a basename for those routines because .NET does not like paths
1822 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1825 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1827 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1828 are loading the correct data types (throws an exception if not).
1829 (TypeManager::InitCoreTypes): Use CoreLookupType
1831 * expression.cs (Unary::ResolveOperator): return the child
1832 expression for expressions which are just +expr.
1833 (Unary::ResolveOperator): Return negative literals for -LITERAL
1834 expressions (otherwise they are Unary {Literal}).
1835 (Invocation::Badness): Take into account `Implicit constant
1836 expression conversions'.
1838 * literal.cs (LongLiteral): Implement long literal class.
1839 (IntLiteral): export the `Value' of the intliteral.
1841 2001-09-19 Ravi Pratap <ravi@ximian.com>
1843 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1845 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1846 instead of 'Operator'
1848 * expression.cs (Binary::ResolveOperator): Update accordingly.
1849 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1852 * cs-parser.jay (unary_expression): Update to use the new names.
1854 * gen-treedump.cs (GetUnary): Same here.
1856 * expression.cs (Unary::Resolve): Implement.
1857 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1858 operators are found instead of making noise ;-)
1859 (Unary::ResolveOperator): New method to do precisely the same thing which
1860 Binary::ResolveOperator does for Binary expressions.
1861 (Unary.method, .Arguments): Add.
1862 (Unary::OperName): Implement.
1863 (Unary::ForceConversion): Copy and Paste !
1865 * class.cs (Operator::Define): Fix a small bug for the case when we have
1868 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1869 for the inbuilt operators. Only overloading works for now ;-)
1871 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1873 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1874 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1876 * expression.cs (This::Emit): Implement.
1877 (This::Resolve): Implement.
1878 (TypeOf:Resolve): Implement.
1879 (Expression::ResolveSimpleName): Add an implicit this to instance
1881 (MemberAccess::Resolve): Deal with Parameters and Fields.
1882 Bind instance variable to Field expressions.
1883 (FieldExpr::Instance): New field used to track the expression that
1884 represents the object instance.
1885 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1887 (FieldExpr::Emit): Implement.
1889 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1890 the last instruction contains a return opcode to avoid generating
1891 the last `ret' instruction (this generates correct code, and it is
1892 nice to pass the peverify output).
1894 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1895 initializer for static and instance variables.
1896 (Constructor::Emit): Allow initializer to be null in the case of
1897 static constructors. Only emit initializer for instance
1900 (TypeContainer::FindMembers): Return a null array if there are no
1903 Also fix the code for the MemberTypes.Method branch, as it was not
1904 scanning that for operators (or tried to access null variables before).
1906 * assign.cs (Assign::Emit): Handle instance and static fields.
1910 * driver.cs: Stop compilation if there are parse errors.
1912 * cs-parser.jay (constructor_declaration): Provide default base
1913 initializer for non-static constructors.
1914 (constructor_declarator): Do not provide a default base
1915 initializers if none was specified.
1916 Catch the fact that constructors should not have parameters.
1918 * class.cs: Do not emit parent class initializers for static
1919 constructors, that should be flagged as an error.
1921 2001-09-18 Ravi Pratap <ravi@ximian.com>
1923 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1924 Move back code into TypeContainer::Populate.
1926 2001-09-18 Ravi Pratap <ravi@ximian.com>
1928 * class.cs (TypeContainer::AddConstructor): Fix the check to
1929 compare against Name, not Basename.
1930 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1932 * cs-parser.jay : Update accordingly.
1934 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1935 for methods, don't forget to look into the operators too.
1936 (RegisterMethodBuilder): Helper method to take care of this for
1937 methods, constructors and operators.
1938 (Operator::Define): Completely revamp.
1939 (Operator.OperatorMethod, MethodName): New fields.
1940 (TypeContainer::Populate): Move the registering of builders into
1941 RegisterMethodBuilder.
1942 (Operator::Emit): Re-write.
1944 * expression.cs (Binary::Emit): Comment out code path to emit method
1945 invocation stuff for the case when we have a user defined operator. I am
1946 just not able to get it right !
1948 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1950 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1953 (Expression::MemberLookup): Provide a version that allows to
1954 specify the MemberTypes and BindingFlags.
1956 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1957 so it was not fetching variable information from outer blocks.
1959 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1960 Beforefieldinit as it was buggy.
1962 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1965 * class.cs (Constructor::Emit): Only emit if block is not null.
1966 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1967 deal with this by semantically definining it as if the user had
1970 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1971 constructors as we now "emit" them at a higher level.
1973 (TypeContainer::DefineDefaultConstructor): Used to define the
1974 default constructors if none was provided.
1976 (ConstructorInitializer): Add methods Resolve and Emit.
1978 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1980 2001-09-17 Ravi Pratap <ravi@ximian.com>
1982 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1983 the default constructor builder with our hashtable for methodbuilders
1986 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1987 and argument_count is 0 in which case we have a match.
1988 (Binary::ResolveOperator): More null checking and miscellaneous coding
1991 2001-09-17 Ravi Pratap <ravi@ximian.com>
1993 * rootcontext.cs (IsNameSpace): Compare against null.
1995 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1997 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1998 and Unary::Operator.
2000 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
2003 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
2004 we have overloaded operators.
2005 (Binary::ResolveOperator): Implement the part which does the operator overload
2008 * class.cs (Operator::Emit): Implement.
2009 (TypeContainer::Emit): Emit the operators we have too.
2011 * expression.cs (Binary::Emit): Update to emit the appropriate code for
2012 the case when we have a user-defined operator.
2014 2001-09-17 Miguel de Icaza <miguel@ximian.com>
2016 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
2018 2001-09-16 Ravi Pratap <ravi@ximian.com>
2020 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
2021 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
2022 (Constructor::Emit): Implement.
2023 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
2024 if we have no work to do.
2025 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
2028 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
2029 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
2031 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
2034 2001-09-15 Ravi Pratap <ravi@ximian.com>
2036 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
2038 (Tree::RecordNamespace): Method to do what the name says ;-)
2039 (Tree::Namespaces): Property to get at the namespaces hashtable.
2041 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
2044 * rootcontext.cs (IsNamespace): Fixed it :-)
2046 2001-09-14 Miguel de Icaza <miguel@ximian.com>
2048 * class.cs (TypeContainer::FindMembers): Add support for
2050 (MethodCore): New class that encapsulates both the shared aspects
2051 of a Constructor and a Method.
2052 (Method, Constructor): Factored pieces into MethodCore.
2054 * driver.cs: Added --fatal which makes errors throw exceptions.
2055 Load System assembly as well as part of the standard library.
2057 * report.cs: Allow throwing exceptions on errors for debugging.
2059 * modifiers.cs: Do not use `parent', instead use the real type
2060 container to evaluate permission settings.
2062 * class.cs: Put Ravi's patch back in. He is right, and we will
2063 have to cope with the
2065 2001-09-14 Ravi Pratap <ravi@ximian.com>
2067 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
2068 FamORAssem, not FamANDAssem.
2070 2001-09-14 Miguel de Icaza <miguel@ximian.com>
2072 * driver.cs: Added --parse option that only parses its input files
2075 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
2076 incorrect. IsTopLevel is not used to tell whether an object is
2077 root_types or not (that can be achieved by testing this ==
2078 root_types). But to see if this is a top-level *class* (not
2079 necessarly our "toplevel" container).
2081 2001-09-14 Ravi Pratap <ravi@ximian.com>
2083 * enum.cs (Enum::Define): Modify to call the Lookup method on the
2084 parent instead of a direct call to GetType.
2086 2001-09-14 Ravi Pratap <ravi@ximian.com>
2088 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
2089 Modifiers.TypeAttr. This should just be a call to that method.
2091 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
2092 object so that we can determine if we are top-level or not.
2094 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
2097 * enum.cs (Enum::Define): Ditto.
2099 * modifiers.cs (FieldAttr): Re-write.
2101 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
2102 (TypeContainer::HaveStaticConstructor): New property to provide access
2103 to precisely that info.
2105 * modifiers.cs (MethodAttr): Re-write.
2106 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
2108 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
2109 of top-level types as claimed.
2111 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2113 * expression.cs (MemberLookup): Fruitless attempt to lookup
2114 constructors. Maybe I need to emit default constructors? That
2115 might be it (currently .NET emits this for me automatically).
2116 (Invocation::OverloadResolve): Cope with Arguments == null.
2117 (Invocation::EmitArguments): new function, shared by the new
2119 (Invocation::Emit): Handle static and instance methods. Emit
2120 proper call instruction for virtual or non-virtual invocations.
2121 (New::Emit): Implement.
2122 (New::Resolve): Implement.
2123 (MemberAccess:Resolve): Implement.
2124 (MethodGroupExpr::InstanceExpression): used conforming to the spec
2126 (FieldExpr::Resolve): Set type.
2128 * support.cs: Handle empty arguments.
2130 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
2131 SimpleLookup): Auxiliary routines to help parse a qualifier
2134 Update qualifier_identifier rule.
2136 * codegen.cs: Removed debugging messages.
2138 * class.cs: Make this a global thing, this acts just as a "key" to
2139 objects that we might have around.
2141 (Populate): Only initialize method_builders_to_methods once.
2143 * expression.cs (PropertyExpr): Initialize type from the
2146 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
2147 Resolve pattern. Attempt to implicitly convert value to boolean.
2150 * expression.cs: Set the type for the int32/int32 argument case.
2151 (Binary::ResolveOperator): Set the return type to boolean for
2152 comparission operators
2154 * typemanager.cs: Remove debugging print code.
2156 (Invocation::Resolve): resolve type.
2158 * class.cs: Allocate a MemberInfo of the correct size, as the code
2159 elsewhere depends on the test to reflect the correct contents.
2161 (Method::) Keep track of parameters, due to System.Reflection holes
2163 (TypeContainer::Populate): Keep track of MethodBuilders to Method
2166 (TypeContainer::FindMembers): Use ArrayList and then copy an array
2167 of the exact size and return that.
2169 (Class::LookupMethodByBuilder): New function that maps
2170 MethodBuilders to its methods. Required to locate the information
2171 on methods because System.Reflection bit us again.
2173 * support.cs: New file, contains an interface ParameterData and
2174 two implementations: ReflectionParameters and InternalParameters
2175 used to access Parameter information. We will need to grow this
2178 * expression.cs (Invocation::GetParameterData): implement a cache
2179 and a wrapper around the ParameterData creation for methods.
2180 (Invocation::OverloadResolve): Use new code.
2182 2001-09-13 Ravi Pratap <ravi@ximian.com>
2184 * class.cs (TypeContainer::EmitField): Remove and move into
2185 (Field::Define): here and modify accordingly.
2186 (Field.FieldBuilder): New member.
2187 (TypeContainer::Populate): Update accordingly.
2188 (TypeContainer::FindMembers): Implement.
2190 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2192 * statement.cs: (VariableInfo::VariableType): New field to be
2193 initialized with the full type once it is resolved.
2195 2001-09-12 Miguel de Icaza <miguel@ximian.com>
2197 * parameter.cs (GetParameterInfo): Use a type cache to compute
2198 things only once, and to reuse this information
2200 * expression.cs (LocalVariableReference::Emit): Implement.
2201 (OpcodeCast::Emit): fix.
2203 (ParameterReference::Resolve): Implement.
2204 (ParameterReference::Emit): Implement.
2206 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
2207 that are expressions need to stay as Expressions.
2209 * typemanager.cs (CSharpName): Returns the C# name of a type if
2212 * expression.cs (Expression::ConvertImplicit): New function that
2213 implements implicit type conversions.
2215 (Expression::ImplicitReferenceConversion): Implements implicit
2216 reference conversions.
2218 (EmptyCast): New type for transparent casts.
2220 (OpcodeCast): New type for casts of types that are performed with
2221 a sequence of bytecodes.
2223 (BoxedCast): New type used for casting value types into reference
2224 types. Emits a box opcode.
2226 (Binary::DoNumericPromotions): Implements numeric promotions of
2227 and computation of the Binary::Type.
2229 (Binary::EmitBranchable): Optimization.
2231 (Binary::Emit): Implement code emission for expressions.
2233 * typemanager.cs (TypeManager): Added two new core types: sbyte
2236 2001-09-12 Ravi Pratap <ravi@ximian.com>
2238 * class.cs (TypeContainer::FindMembers): Method which does exactly
2239 what Type.FindMembers does, only we don't have to use reflection. No
2242 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
2243 typecontainer objects as we need to get at them.
2244 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
2246 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
2247 typecontainer object.
2249 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
2250 of just a Report object.
2252 2001-09-11 Ravi Pratap <ravi@ximian.com>
2254 * class.cs (Event::Define): Go back to using the prefixes "add_" and
2256 (TypeContainer::Populate): Now define the delegates of the type too.
2257 (TypeContainer.Delegates): Property to access the list of delegates defined
2260 * delegates.cs (Delegate::Define): Implement partially.
2262 * modifiers.cs (TypeAttr): Handle more flags.
2264 2001-09-11 Ravi Pratap <ravi@ximian.com>
2266 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
2268 (Operator::Define): Re-write logic to get types by using the LookupType method
2269 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
2270 (Indexer::Define): Ditto.
2271 (Event::Define): Ditto.
2272 (Property::Define): Ditto.
2274 2001-09-10 Ravi Pratap <ravi@ximian.com>
2276 * class.cs (TypeContainer::Populate): Now define operators too.
2277 (TypeContainer.Operators): New property to access the list of operators
2279 (Operator.OperatorMethodBuilder): New member to hold the method builder
2280 for the operator we are defining.
2281 (Operator::Define): Implement.
2283 2001-09-10 Ravi Pratap <ravi@ximian.com>
2285 * class.cs (Event::Define): Make the prefixes of the accessor methods
2286 addOn_ and removeOn_
2288 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
2289 of the location being passed in too. Ideally, this should go later since all
2290 error reporting should be done through the Report object.
2292 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
2293 (Populate): Iterate thru the indexers we have and define them too.
2294 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
2295 for the get and set accessors.
2296 (Indexer::Define): Implement.
2298 2001-09-09 Miguel de Icaza <miguel@ximian.com>
2300 * expression.cs (Binary::Resolve): Beginning of it. I scratched
2301 my previous implementation, did not work.
2303 * typemanager.cs: Add a couple of missing types (the longs).
2305 * literal.cs: Use TypeManager.bool_type instead of getting it.
2307 * expression.cs (EventExpr): New kind of expressions.
2308 (Expressio::ExprClassFromMemberInfo): finish
2310 2001-09-08 Miguel de Icaza <miguel@ximian.com>
2312 * assign.cs: Emit stores to static fields differently.
2314 2001-09-08 Ravi Pratap <ravi@ximian.com>
2316 * Merge in changes and adjust code to tackle conflicts. Backed out my
2317 code in Assign::Resolve ;-)
2319 2001-09-08 Ravi Pratap <ravi@ximian.com>
2321 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
2322 instead Report.Error and also pass in the location.
2323 (CSharpParser::Lexer): New readonly property to return the reference
2324 to the Tokenizer object.
2325 (declare_local_variables): Use Report.Error with location instead of plain
2329 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
2330 (Operator.CheckBinaryOperator): Ditto.
2332 * cs-parser.jay (operator_declarator): Update accordingly.
2334 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
2335 (CheckBinaryOperator): Same here.
2337 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
2338 on the name without any prefixes of namespace names etc. This is because we
2339 already might have something already fully qualified like
2340 'System.Console.WriteLine'
2342 * assign.cs (Resolve): Begin implementation. Stuck ;-)
2344 2001-09-07 Ravi Pratap <ravi@ximian.com>
2346 * cs-tokenizer.cs (location): Return a string which also contains
2349 * expression.cs (ElementAccess): New class for expressions of the
2350 type 'element access.'
2351 (BaseAccess): New class for expressions of the type 'base access.'
2352 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
2355 * cs-parser.jay (element_access): Implement action.
2356 (base_access): Implement actions.
2357 (checked_expression, unchecked_expression): Implement.
2359 * cs-parser.jay (local_variable_type): Correct and implement.
2360 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
2362 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
2364 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
2365 name and the specifiers.
2367 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
2369 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
2370 making them all public ;-)
2372 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
2375 2001-09-07 Miguel de Icaza <miguel@ximian.com>
2377 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
2379 (FieldExpr, PropertyExprs): New resolved expressions.
2380 (SimpleName::MemberStaticCheck): Perform static checks for access
2381 to non-static fields on static methods. Maybe this should be
2382 generalized for MemberAccesses.
2383 (SimpleName::ResolveSimpleName): More work on simple name
2386 * cs-parser.jay (primary_expression/qualified_identifier): track
2387 the parameter index.
2389 * codegen.cs (CodeGen::Save): Catch save exception, report error.
2390 (EmitContext::EmitBoolExpression): Chain to expression generation
2391 instead of temporary hack.
2392 (::EmitStatementExpression): Put generic expression code generation.
2394 * assign.cs (Assign::Emit): Implement variable assignments to
2395 local variables, parameters and fields.
2397 2001-09-06 Miguel de Icaza <miguel@ximian.com>
2399 * statement.cs (Block::GetVariableInfo): New method, returns the
2400 VariableInfo for a variable name in a block.
2401 (Block::GetVariableType): Implement in terms of GetVariableInfo
2403 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
2404 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
2406 2001-09-06 Ravi Pratap <ravi@ximian.com>
2408 * cs-parser.jay (operator_declaration): Continue on my quest : update
2409 to take attributes argument.
2410 (event_declaration): Ditto.
2411 (enum_declaration): Ditto.
2412 (indexer_declaration): Ditto.
2414 * class.cs (Operator::Operator): Update constructor accordingly.
2415 (Event::Event): Ditto.
2417 * delegate.cs (Delegate::Delegate): Same here.
2419 * enum.cs (Enum::Enum): Same here.
2421 2001-09-05 Ravi Pratap <ravi@ximian.com>
2423 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
2425 * ../tests/cs0658.cs : New file to demonstrate error 0658.
2427 * attribute.cs (Attributes): New class to encapsulate all attributes which were
2428 being passed around as an arraylist.
2429 (Attributes::AddAttribute): Method to add attribute sections.
2431 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
2432 (struct_declaration): Update accordingly.
2433 (constant_declaration): Update.
2434 (field_declaration): Update.
2435 (method_header): Update.
2436 (fixed_parameter): Update.
2437 (parameter_array): Ditto.
2438 (property_declaration): Ditto.
2439 (destructor_declaration): Ditto.
2441 * class.cs (Struct::Struct): Update constructors accordingly.
2442 (Class::Class): Ditto.
2443 (Field::Field): Ditto.
2444 (Method::Method): Ditto.
2445 (Property::Property): Ditto.
2446 (TypeContainer::OptAttribute): update property's return type.
2448 * interface.cs (Interface.opt_attributes): New member.
2449 (Interface::Interface): Update to take the extra Attributes argument.
2451 * parameter.cs (Parameter::Parameter): Ditto.
2453 * constant.cs (Constant::Constant): Ditto.
2455 * interface.cs (InterfaceMemberBase): New OptAttributes field.
2456 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
2457 the attributes as a parameter.
2458 (InterfaceProperty): Update constructor call.
2459 (InterfaceEvent): Ditto.
2460 (InterfaceMethod): Ditto.
2461 (InterfaceIndexer): Ditto.
2463 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
2464 pass the attributes too.
2465 (interface_event_declaration): Ditto.
2466 (interface_property_declaration): Ditto.
2467 (interface_method_declaration): Ditto.
2468 (interface_declaration): Ditto.
2470 2001-09-05 Miguel de Icaza <miguel@ximian.com>
2472 * class.cs (Method::Define): Track the "static Main" definition to
2473 create an entry point.
2475 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
2476 EntryPoint if we find it.
2478 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
2479 (EmitContext::ig): Make this variable public.
2481 * driver.cs: Make the default output file be the first file name
2482 with the .exe extension.
2484 Detect empty compilations
2486 Handle various kinds of output targets. Handle --target and
2487 rename -t to --dumper.
2489 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
2490 methods inherited from Expression return now an Expression. This
2491 will is used during the tree rewriting as we resolve them during
2494 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
2495 the spec. Missing entirely is the information about
2496 accessability of elements of it.
2498 (Expression::ExprClassFromMemberInfo): New constructor for
2499 Expressions that creates a fully initialized Expression based on
2500 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
2503 (Invocation::Resolve): Begin implementing resolution of invocations.
2505 * literal.cs (StringLiteral): Implement Emit.
2507 2001-09-05 Ravi Pratap <ravi@ximian.com>
2509 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
2512 2001-09-04 Ravi Pratap <ravi@ximian.com>
2514 * cs-parser.jay (attribute_arguments): Implement actions.
2515 (attribute): Fix bug in production. Implement action.
2516 (attribute_list): Implement.
2517 (attribute_target): Implement.
2518 (attribute_target_specifier, opt_target_specifier): Implement
2519 (CheckAttributeTarget): New method to check if the attribute target
2521 (attribute_section): Implement.
2522 (opt_attributes): Implement.
2524 * attribute.cs : New file to handle attributes.
2525 (Attribute): Class to hold attribute info.
2527 * cs-parser.jay (opt_attribute_target_specifier): Remove production
2528 (attribute_section): Modify production to use 2 different rules to
2529 achieve the same thing. 1 s/r conflict down !
2530 Clean out commented, useless, non-reducing dimension_separator rules.
2532 * class.cs (TypeContainer.attributes): New member to hold list
2533 of attributes for a type.
2534 (Struct::Struct): Modify to take one more argument, the attribute list.
2535 (Class::Class): Ditto.
2536 (Field::Field): Ditto.
2537 (Method::Method): Ditto.
2538 (Property::Property): Ditto.
2540 * cs-parser.jay (struct_declaration): Update constructor call to
2541 pass in the attributes too.
2542 (class_declaration): Ditto.
2543 (constant_declaration): Ditto.
2544 (field_declaration): Ditto.
2545 (method_header): Ditto.
2546 (fixed_parameter): Ditto.
2547 (parameter_array): Ditto.
2548 (property_declaration): Ditto.
2550 * constant.cs (Constant::Constant): Update constructor similarly.
2551 Use System.Collections.
2553 * parameter.cs (Parameter::Parameter): Update as above.
2555 2001-09-02 Ravi Pratap <ravi@ximian.com>
2557 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
2558 (TypeContainer.delegates): New member to hold list of delegates.
2560 * cs-parser.jay (delegate_declaration): Implement the action correctly
2561 this time as I seem to be on crack ;-)
2563 2001-09-02 Miguel de Icaza <miguel@ximian.com>
2565 * rootcontext.cs (RootContext::IsNamespace): new function, used to
2566 tell whether an identifier represents a namespace.
2568 * expression.cs (NamespaceExpr): A namespace expression, used only
2569 temporarly during expression resolution.
2570 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
2571 utility functions to resolve names on expressions.
2573 2001-09-01 Miguel de Icaza <miguel@ximian.com>
2575 * codegen.cs: Add hook for StatementExpressions.
2577 * class.cs: Fix inverted test for static flag in methods.
2579 2001-09-02 Ravi Pratap <ravi@ximian.com>
2581 * class.cs (Operator::CheckUnaryOperator): Correct error number used
2582 to make it coincide with MS' number.
2583 (Operator::CheckBinaryOperator): Ditto.
2585 * ../errors/errors.txt : Remove error numbers added earlier.
2587 * ../errors/cs1019.cs : Test case for error # 1019
2589 * ../errros/cs1020.cs : Test case for error # 1020
2591 * cs-parser.jay : Clean out commented cruft.
2592 (dimension_separators, dimension_separator): Comment out. Ostensibly not
2593 used anywhere - non-reducing rule.
2594 (namespace_declarations): Non-reducing rule - comment out.
2596 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
2597 with TypeContainer::AddEnum.
2599 * delegate.cs : New file for delegate handling classes.
2600 (Delegate): Class for declaring delegates.
2602 * makefile : Update.
2604 * cs-parser.jay (delegate_declaration): Implement.
2606 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
2608 * class.cs (Event::Define): Implement.
2609 (Event.EventBuilder): New member.
2611 * class.cs (TypeContainer::Populate): Update to define all enums and events
2613 (Events): New property for the events arraylist we hold. Shouldn't we move to using
2614 readonly fields for all these cases ?
2616 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2618 * class.cs (Property): Revamp to use the convention of making fields readonly.
2619 Accordingly modify code elsewhere.
2621 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
2622 the Define method of the Property class.
2624 * class.cs : Clean up applied patch and update references to variables etc. Fix
2626 (TypeContainer::Populate): Update to define all the properties we have. Also
2627 define all enumerations.
2629 * enum.cs (Define): Implement.
2631 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2633 * cs-parser.jay (overloadable_operator): The semantic value is an
2634 enum of the Operator class.
2635 (operator_declarator): Implement actions.
2636 (operator_declaration): Implement.
2638 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
2639 validity of definitions.
2640 (Operator::CheckBinaryOperator): Static method to check for binary operators
2641 (TypeContainer::AddOperator): New method to add an operator to a type.
2643 * cs-parser.jay (indexer_declaration): Added line to actually call the
2644 AddIndexer method so it gets added ;-)
2646 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
2647 already taken care of by the MS compiler ?
2649 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2651 * class.cs (Operator): New class for operator declarations.
2652 (Operator::OpType): Enum for the various operators.
2654 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2656 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
2657 ostensibly handle this in semantic analysis.
2659 * cs-parser.jay (general_catch_clause): Comment out
2660 (specific_catch_clauses, specific_catch_clause): Ditto.
2661 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
2662 (catch_args, opt_catch_args): New productions.
2663 (catch_clause): Rewrite to use the new productions above
2664 (catch_clauses): Modify accordingly.
2665 (opt_catch_clauses): New production to use in try_statement
2666 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
2667 and re-write the code in the actions to extract the specific and
2668 general catch clauses by being a little smart ;-)
2670 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
2671 Hooray, try and catch statements parse fine !
2673 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2675 * statement.cs (Block::GetVariableType): Fix logic to extract the type
2676 string from the hashtable of variables.
2678 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
2679 I end up making that mistake ;-)
2680 (catch_clauses): Fixed gross error which made Key and Value of the
2681 DictionaryEntry the same : $1 !!
2683 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2685 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2687 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2688 when the add and remove accessors are specified.
2690 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2692 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2693 information about indexer_declarator.
2694 (indexer_declarator): Implement actions.
2695 (parsing_indexer): New local boolean used to keep track of whether
2696 we are parsing indexers or properties. This is necessary because
2697 implicit_parameters come into picture even for the get accessor in the
2699 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2701 * class.cs (Indexer): New class for indexer declarations.
2702 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2703 (TypeContainer::indexers): New member to hold list of indexers for the
2706 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2708 * cs-parser.jay (add_accessor_declaration): Implement action.
2709 (remove_accessor_declaration): Implement action.
2710 (event_accessors_declaration): Implement
2711 (variable_declarators): swap statements for first rule - trivial.
2713 * class.cs (Event): New class to hold information about event
2715 (TypeContainer::AddEvent): New method to add an event to a type
2716 (TypeContainer::events): New member to hold list of events.
2718 * cs-parser.jay (event_declaration): Implement actions.
2720 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2722 * cs-parser.jay (dim_separators): Implement. Make it a string
2723 concatenating all the commas together, just as they appear.
2724 (opt_dim_separators): Modify accordingly
2725 (rank_specifiers): Update accordingly. Basically do the same
2726 thing - instead, collect the brackets here.
2727 (opt_rank_sepcifiers): Modify accordingly.
2728 (array_type): Modify to actually return the complete type string
2729 instead of ignoring the rank_specifiers.
2730 (expression_list): Implement to collect the expressions
2731 (variable_initializer): Implement. We make it a list of expressions
2732 essentially so that we can handle the array_initializer case neatly too.
2733 (variable_initializer_list): Implement.
2734 (array_initializer): Make it a list of variable_initializers
2735 (opt_array_initializer): Modify accordingly.
2737 * expression.cs (New::NType): Add enumeration to help us
2738 keep track of whether we have an object/delegate creation
2739 or an array creation.
2740 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2741 members to hold data about array creation.
2742 (New:New): Modify to update NewType
2743 (New:New): New Overloaded contructor for the array creation
2746 * cs-parser.jay (array_creation_expression): Implement to call
2747 the overloaded New constructor.
2749 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2751 * class.cs (TypeContainer::Constructors): Return member
2752 constructors instead of returning null.
2754 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2756 * typemanager.cs (InitCoreTypes): Initialize the various core
2757 types after we have populated the type manager with the user
2758 defined types (this distinction will be important later while
2759 compiling corlib.dll)
2761 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2762 on Expression Classification. Now all expressions have a method
2763 `Resolve' and a method `Emit'.
2765 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2766 generation from working. Also add some temporary debugging
2769 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2771 * codegen.cs: Lots of code generation pieces. This is only the
2772 beginning, will continue tomorrow with more touches of polish. We
2773 handle the fundamentals of if, while, do, for, return. Others are
2774 trickier and I need to start working on invocations soon.
2776 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2779 * codegen.cs (EmitContext): New struct, used during code
2780 emission to keep a context. Most of the code generation will be
2783 * cs-parser.jay: Add embedded blocks to the list of statements of
2784 this block. So code generation proceeds in a top down fashion.
2786 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2788 * statement.cs: Add support for multiple child blocks.
2790 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2792 * codegen.cs (EmitCode): New function, will emit the code for a
2793 Block of code given a TypeContainer and its ILGenerator.
2795 * statement.cs (Block): Standard public readonly optimization.
2796 (Block::Block constructors): Link children.
2797 (Block::Child): Child Linker.
2798 (Block::EmitVariables): Emits IL variable declarations.
2800 * class.cs: Drop support for MethodGroups here, delay until
2802 (Method::): Applied the same simplification that I did before, and
2803 move from Properties to public readonly fields.
2804 (Method::ParameterTypes): Returns the parameter types for the
2805 function, and implements a cache that will be useful later when I
2806 do error checking and the semantic analysis on the methods is
2808 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2809 and made a method, optional argument tells whether this is a class
2810 or a structure to apply the `has-this' bit.
2811 (Method::GetCallingConvention): Implement, returns the calling
2813 (Method::Define): Defines the type, a second pass is performed
2814 later to populate the methods.
2816 (Constructor::ParameterTypes): implement a cache similar to the
2817 one on Method::ParameterTypes, useful later when we do semantic
2820 (TypeContainer::EmitMethod): New method. Emits methods.
2822 * expression.cs: Removed MethodGroup class from here.
2824 * parameter.cs (Parameters::GetCallingConvention): new method.
2826 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2828 * class.cs (TypeContainer::Populate): Drop RootContext from the
2831 (Constructor::CallingConvention): Returns the calling convention.
2832 (Constructor::ParameterTypes): Returns the constructor parameter
2835 (TypeContainer::AddConstructor): Keep track of default constructor
2836 and the default static constructor.
2838 (Constructor::) Another class that starts using `public readonly'
2839 instead of properties.
2841 (Constructor::IsDefault): Whether this is a default constructor.
2843 (Field::) use readonly public fields instead of properties also.
2845 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2846 track of static constructors; If none is used, turn on
2847 BeforeFieldInit in the TypeAttributes.
2849 * cs-parser.jay (opt_argument_list): now the return can be null
2850 for the cases where there are no arguments.
2852 (constructor_declarator): If there is no implicit `base' or
2853 `this', then invoke the default parent constructor.
2855 * modifiers.cs (MethodAttr): New static function maps a set of
2856 modifiers flags into a MethodAttributes enum
2857 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2858 MethodAttr, TypeAttr to represent the various mappings where the
2860 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2862 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2864 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2867 * interface.cs (PopulateIndexer): Implemented the code generator
2868 for interface indexers.
2870 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2872 * interface.cs (InterfaceMemberBase): Now we track the new status
2875 (PopulateProperty): Implement property population. Woohoo! Got
2876 Methods and Properties going today.
2878 Removed all the properties for interfaces, and replaced them with
2879 `public readonly' fields.
2881 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2883 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2884 initialize their hashtables/arraylists only when they are needed
2885 instead of doing this always.
2887 * parameter.cs: Handle refs and out parameters.
2889 * cs-parser.jay: Use an ArrayList to construct the arguments
2890 instead of the ParameterCollection, and then cast that to a
2893 * parameter.cs: Drop the use of ParameterCollection and use
2894 instead arrays of Parameters.
2896 (GetParameterInfo): Use the Type, not the Name when resolving
2899 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2901 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2902 and instead use public readonly fields.
2904 * class.cs: Put back walking code for type containers.
2906 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2908 * class.cs (MakeConstant): Code to define constants.
2910 * rootcontext.cs (LookupType): New function. Used to locate types
2913 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2915 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2916 this System.Reflection code is. Kudos to Microsoft
2918 * typemanager.cs: Implement a type cache and avoid loading all
2919 types at boot time. Wrap in LookupType the internals. This made
2920 the compiler so much faster. Wow. I rule!
2922 * driver.cs: Make sure we always load mscorlib first (for
2923 debugging purposes, nothing really important).
2925 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2926 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2928 * rootcontext.cs: Lookup types on their namespace; Lookup types
2929 on namespaces that have been imported using the `using' keyword.
2931 * class.cs (TypeContainer::TypeAttr): Virtualize.
2932 (Class::TypeAttr): Return attributes suitable for this bad boy.
2933 (Struct::TypeAttr): ditto.
2934 Handle nested classes.
2935 (TypeContainer::) Remove all the type visiting code, it is now
2936 replaced with the rootcontext.cs code
2938 * rootcontext.cs (GetClassBases): Added support for structs.
2940 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2942 * interface.cs, statement.cs, class.cs, parameter.cs,
2943 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2944 Drop use of TypeRefs, and use strings instead.
2946 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2950 * class.cs (Struct::Struct): set the SEALED flags after
2951 checking the modifiers.
2952 (TypeContainer::TypeAttr): new property, returns the
2953 TypeAttributes for a class.
2955 * cs-parser.jay (type_list): Oops, list production was creating a
2956 new list of base types.
2958 * rootcontext.cs (StdLib): New property.
2959 (GetInterfaceTypeByName): returns an interface by type name, and
2960 encapsulates error handling here.
2961 (GetInterfaces): simplified.
2962 (ResolveTree): Encapsulated all the tree resolution here.
2963 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2966 * driver.cs: Add support for --nostdlib, to avoid loading the
2968 (Main): Do not put tree resolution here.
2970 * rootcontext.cs: Beginning of the class resolution.
2972 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2974 * rootcontext.cs: Provide better error reporting.
2976 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2978 * rootcontext.cs (CreateInterface): Handle the case where there
2979 are no parent interfaces.
2981 (CloseTypes): Routine to flush types at the end.
2982 (CreateInterface): Track types.
2983 (GetInterfaces): Returns an array of Types from the list of
2986 * typemanager.c (AddUserType): Mechanism to track user types (puts
2987 the type on the global type hash, and allows us to close it at the
2990 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2992 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2993 RecordInterface instead.
2995 * cs-parser.jay: Updated to reflect changes above.
2997 * decl.cs (Definition): Keep track of the TypeBuilder type that
2998 represents this type here. Not sure we will use it in the long
2999 run, but wont hurt for now.
3001 * driver.cs: Smaller changes to accomodate the new code.
3003 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
3006 * rootcontext.cs (CreateInterface): New method, used to create
3007 the System.TypeBuilder type for interfaces.
3008 (ResolveInterfaces): new entry point to resolve the interface
3010 (CodeGen): Property, used to keep track of the code generator.
3012 2001-07-26 Miguel de Icaza <miguel@ximian.com>
3014 * cs-parser.jay: Add a second production for delegate_declaration
3017 (enum_body): Put an opt_comma here instead of putting it on
3018 enum_body or enum_member_declarations so we can handle trailing
3019 commas on enumeration members. Gets rid of a shift/reduce.
3021 (type_list): Need a COMMA in the middle.
3023 (indexer_declaration): Tell tokenizer to recognize get/set
3025 * Remove old targets.
3027 * Re-add the parser target.
3029 2001-07-13 Simon Cozens <simon@simon-cozens.org>
3031 * cs-parser.jay: Add precendence rules for a number of operators
3032 ot reduce the number of shift/reduce conflicts in the grammar.
3034 2001-07-17 Miguel de Icaza <miguel@ximian.com>
3036 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
3039 Get rid of old crufty code.
3041 * rootcontext.cs: Use this to keep track of the parsed
3042 representation and the defined types available to the program.
3044 * gen-treedump.cs: adjust for new convention.
3046 * type.cs: Split out the type manager, and the assembly builder
3049 * typemanager.cs: the type manager will live here now.
3051 * cil-codegen.cs: And the code generator here.
3053 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
3055 * makefile: Fixed up for easy making.
3057 2001-07-13 Simon Cozens <simon@simon-cozens.org>
3059 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
3062 (unary_expression): Expand pre_increment_expression and
3063 post_decrement_expression to reduce a shift/reduce.
3065 2001-07-11 Simon Cozens
3067 * cs-tokenizer.cs: Hex numbers should begin with a 0.
3069 Improve allow_keyword_as_indent name.
3071 2001-06-19 Miguel de Icaza <miguel@ximian.com>
3073 * Adjustments for Beta2.
3075 2001-06-13 Miguel de Icaza <miguel@ximian.com>
3077 * decl.cs: Added `Define' abstract method.
3078 (InTransit): new property, used to catch recursive definitions.
3080 * interface.cs: Implement `Define'.
3082 * modifiers.cs: Map Modifiers.constants to
3083 System.Reflection.TypeAttribute flags.
3085 * class.cs: Keep track of types and user-defined types.
3086 (BuilderInit): New method for creating an assembly
3087 (ResolveType): New function to launch the resolution process, only
3088 used by interfaces for now.
3090 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
3091 that are inserted into the name space.
3093 2001-06-08 Miguel de Icaza <miguel@ximian.com>
3095 * ARGH. I have screwed up my tree so many times due to the use of
3096 rsync rather than using CVS. Going to fix this at once.
3098 * driver.cs: Objetify driver. Load assemblies, use assemblies to
3101 2001-06-07 Miguel de Icaza <miguel@ximian.com>
3103 * Experiment successful: Use System.Type rather that our own
3106 2001-05-25 Miguel de Icaza <miguel@ximian.com>
3108 * cs-parser.jay: Removed nsAliases from here.
3110 Use new namespaces, handle `using XXX;'
3112 * namespace.cs: Reimplemented namespace handling, use a recursive
3113 definition of the class. Now we can keep track of using clauses
3114 and catch invalid using clauses.
3116 2001-05-24 Miguel de Icaza <miguel@ximian.com>
3118 * gen-treedump.cs: Adapted for all the renaming.
3120 * expression.cs (Expression): this class now has a Type property
3121 which returns an expression Type.
3123 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
3124 `Type', as this has a different meaning now in the base
3126 2001-05-22 Miguel de Icaza <miguel@ximian.com>
3128 * interface.cs, class.cs: Removed from all the sources the
3129 references to signature computation, as we can not do method
3130 signature computation during the parsing time, as we are not
3131 trying to solve at that point distinguishing:
3135 void a (NS.Blah x) {}
3138 Which depending on the context might be valid or not, as we do not
3139 know if Blah is the same thing as NS.Blah at that point.
3141 * Redid everything so the code uses TypeRefs now instead of
3142 Types. TypeRefs are just temporary type placeholders, that need
3143 to be resolved. They initially have a pointer to a string and the
3144 current scope in which they are used. This is used later by the
3145 compiler to resolve the reference to an actual Type.
3147 * DeclSpace is no longer a CIR.Type, and neither are
3148 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
3149 are all DeclSpaces, but no Types.
3151 * type.cs (TypeRefManager): This implements the TypeRef manager,
3152 which keeps track of all the types that need to be resolved after
3153 the parsing has finished.
3155 2001-05-13 Miguel de Icaza <miguel@ximian.com>
3157 * ARGH. We are going to have to store `foreach' as a class rather
3158 than resolving it, as we need to verify error 1579 after name
3159 resolution. *OR* we could keep a flag that says `This request to
3160 IEnumerator comes from a foreach statement' which we can then use
3161 to generate the error.
3163 2001-05-10 Miguel de Icaza <miguel@ximian.com>
3165 * class.cs (TypeContainer.AddMethod): we now add methods to the
3166 MethodGroup instead of the method hashtable.
3168 * expression.cs: Add MethodGroup abstraction, which gets us one
3169 step closer to the specification in the way we handle method
3172 * cs-parser.jay (primary_expression): qualified_identifier now
3173 tried to match up an identifier to a local variable reference or
3174 to a parameter reference.
3176 current_local_parameters is now a parser global variable that
3177 points to the current parameters for the block, used during name
3180 (property_declaration): Now creates an implicit `value' argument to
3183 2001-05-09 Miguel de Icaza <miguel@ximian.com>
3185 * parameter.cs: Do not use `param' arguments as part of the
3186 signature, per the spec.
3188 2001-05-08 Miguel de Icaza <miguel@ximian.com>
3190 * decl.cs: Base class for classes, structs and interfaces. This
3191 is the "Declaration Space"
3193 * cs-parser.jay: Use CheckDef for checking declaration errors
3194 instead of having one on each function.
3196 * class.cs: Factor out some code for handling error handling in
3197 accordance to the "Declarations" section in the "Basic Concepts"
3198 chapter in the ECMA C# spec.
3200 * interface.cs: Make all interface member classes derive from
3201 InterfaceMemberBase.
3203 2001-05-07 Miguel de Icaza <miguel@ximian.com>
3205 * Many things: all interfaces are parsed and generated in
3206 gen-treedump. Support for member variables, constructors,
3207 destructors, properties, constants is there.
3209 Beginning of the IL backend, but very little done, just there for
3212 2001-04-29 Miguel de Icaza <miguel@ximian.com>
3214 * cs-parser.jay: Fix labeled statement.
3216 * cs-tokenizer.cs (escape): Escape " and ' always.
3217 ref_line, ref_name: keep track of the line/filename as instructed
3218 by #line by the compiler.
3221 2001-04-27 Miguel de Icaza <miguel@ximian.com>
3223 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
3224 to match the values in System.CodeDOM.
3226 Divid renamed to Divide.
3228 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
3230 (Statements.set): remove.
3232 * System.CodeDOM/CodeCatchClause.cs: always have a valid
3235 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
3236 falseStatements always have valid values.
3238 * cs-parser.jay: Use System.CodeDOM now.