1 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs (Binary.ResolveOperator): Update the values of `l'
4 and `r' after calling DoNumericPromotions.
6 * ecore.cs: Fix error message (the types were in the wrong order).
8 * statement.cs (Foreach.ProbeCollectionType): Need to pass
9 BindingFlags.Instance as well
11 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
12 implicit int literal conversion in an empty cast so that we
13 propagate the right type upstream.
15 (UnboxCast): new class used to unbox value types.
16 (Expression.ConvertExplicit): Add explicit type conversions done
19 (Expression.ImplicitNumericConversion): Oops, forgot to test for
20 the target type before applying the implicit LongLiterals to ULong
23 2001-11-21 Miguel de Icaza <miguel@ximian.com>
25 * cs-parser.jay (for_statement): Reworked the way For works: now
26 we declare manually any variables that are introduced in
27 for_initializer to solve the problem of having out-of-band code
28 emition (that is what got for broken).
30 (declaration_statement): Perform the actual variable declaration
31 that used to be done in local_variable_declaration here.
33 (local_variable_declaration): Do not declare anything, just pass
34 the information on a DictionaryEntry
36 2001-11-20 Ravi Pratap <ravi@ximian.com>
38 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
39 re-write of the logic to now make it recursive.
41 (UpdateIndices): Re-write accordingly.
43 Store element data in a separate ArrayData list in the above methods.
45 (MakeByteBlob): Implement to dump the array data into a byte array.
47 2001-11-19 Ravi Pratap <ravi@ximian.com>
49 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
52 * constant.cs (Define): Implement.
54 (EmitConstant): Re-write fully.
56 Pass in location info.
58 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
61 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
62 DictionaryEntry since we need location info too.
64 (constant_declaration): Update accordingly.
66 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
67 code into another method : UpdateIndices.
69 2001-11-18 Ravi Pratap <ravi@ximian.com>
71 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
72 some type checking etc.
74 2001-11-17 Ravi Pratap <ravi@ximian.com>
76 * expression.cs (ArrayCreation::ValidateInitializers): Implement
77 bits to provide dimension info if the user skips doing that.
79 Update second constructor to store the rank correctly.
81 2001-11-16 Ravi Pratap <ravi@ximian.com>
83 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
86 * ../errors/cs0150.cs : Add.
88 * ../errors/cs0178.cs : Add.
90 2001-11-16 Miguel de Icaza <miguel@ximian.com>
92 * statement.cs: Implement foreach on multi-dimensional arrays.
94 * parameter.cs (Parameters.GetParameterByName): Also lookup the
95 name of the params argument.
97 * expression.cs: Use EmitStoreOpcode to get the right opcode while
98 initializing the array.
100 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
101 we can use this elsewhere.
103 * statement.cs: Finish implementation of foreach for single
106 * cs-parser.jay: Use an out-of-band stack to pass information
107 around, I wonder why I need this.
109 foreach_block: Make the new foreach_block the current_block.
111 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
112 function used to return a static Parameters structure. Used for
113 empty parameters, as those are created very frequently.
115 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
117 2001-11-15 Ravi Pratap <ravi@ximian.com>
119 * interface.cs : Default modifier is private, not public. The
120 make verify test passes again.
122 2001-11-15 Ravi Pratap <ravi@ximian.com>
124 * support.cs (ReflectionParameters): Fix logic to determine
125 whether the last parameter is a params one. Test 9 passes again.
127 * delegate.cs (Populate): Register the builders we define with
128 RegisterParameterForBuilder. Test 19 passes again.
130 * cs-parser.jay (property_declaration): Reference $6 instead
131 of $$ to get at the location.
133 (indexer_declaration): Similar stuff.
137 * class.cs (Property): Register parameters for the Get and Set methods
138 if they exist. Test 23 passes again.
140 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
141 call to EmitArguments as we are sure there aren't any params arguments.
142 Test 32 passes again.
144 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
145 IndexOutOfRangeException.
147 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
148 Test 33 now passes again.
150 2001-11-15 Miguel de Icaza <miguel@ximian.com>
152 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
153 broke a bunch of things. Will have to come up with a better way
154 of tracking locations.
156 * statement.cs: Implemented foreach for single dimension arrays.
158 2001-11-09 Miguel de Icaza <miguel@ximian.com>
160 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
161 an error. This removes the lookup from the critical path.
163 * cs-parser.jay: Removed use of temporary_loc, which is completely
166 2001-11-14 Miguel de Icaza <miguel@ximian.com>
168 * support.cs (ReflectionParameters.ParameterModifier): Report
169 whether the argument is a PARAMS argument or not.
171 * class.cs: Set the attribute `ParamArrayAttribute' on the
174 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
175 and cons_param_array_attribute (ConstructorInfo for
176 ParamArrayAttribute).,
178 * codegen.cs: Emit the return using the `Return' statement, that
179 way we can report the error correctly for missing return values.
181 * class.cs (Method.Emit): Clean up.
183 * expression.cs (Argument.Resolve): Take another argument: the
184 location where this argument is used. Notice that this is not
185 part of the "Argument" class as to reduce the size of the
186 structure (we know the approximate location anyways).
188 Test if the argument is a variable-reference, if not, then
191 (Argument.Emit): Emit addresses of variables.
193 (Argument.FullDesc): Simplify.
195 (Invocation.DoResolve): Update for Argument.Resolve.
197 (ElementAccess.DoResolve): ditto.
199 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
200 method should be virtual, as this method is always virtual.
202 (NewDelegate.DoResolve): Update for Argument.Resolve.
204 * class.cs (ConstructorInitializer.DoResolve): ditto.
206 * attribute.cs (Attribute.Resolve): ditto.
208 2001-11-13 Miguel de Icaza <miguel@ximian.com>
210 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
212 * expression.cs (ParameterReference): Drop IStackStorage and implement
213 IAssignMethod instead.
215 (LocalVariableReference): ditto.
217 * ecore.cs (FieldExpr): Drop IStackStorage and implement
218 IAssignMethod instead.
220 2001-11-13 Miguel de Icaza <miguel@ximian.com>
222 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
223 enumerations that are used in heavily used structures derive from
224 byte in a laughable and pathetic attempt to reduce memory usage.
225 This is the kind of pre-optimzations that you should not do at
226 home without adult supervision.
228 * expression.cs (UnaryMutator): New class, used to handle ++ and
229 -- separatedly from the other unary operators. Cleans up the
230 code, and kills the ExpressionStatement dependency in Unary.
232 (Unary): Removed `method' and `Arguments' from this class, making
233 it smaller, and moving it all to SimpleCall, so I can reuse this
234 code in other locations and avoid creating a lot of transient data
235 strucutres when not required.
237 * cs-parser.jay: Adjust for new changes.
239 2001-11-11 Miguel de Icaza <miguel@ximian.com>
241 * enum.cs (Enum.Populate): If there is a failure during
244 * cs-parser.jay (opt_enum_base): we used to catch type errors
245 here, but this is really incorrect. The type error should be
246 catched during semantic analysis.
248 2001-12-11 Ravi Pratap <ravi@ximian.com>
250 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
251 current_local_parameters as expected since I, in my stupidity, had forgotten
254 * attribute.cs (GetValidPlaces): Fix stupid bug.
256 * class.cs (Method::Emit): Perform check on applicability of attributes.
258 (Constructor::Emit): Ditto.
260 (Field::Emit): Ditto.
262 (Field.Location): Store location information.
264 (Property, Event, Indexer, Operator): Ditto.
266 * cs-parser.jay (field_declaration): Pass in location for each field.
268 * ../errors/cs0592.cs : Add.
270 2001-11-12 Ravi Pratap <ravi@ximian.com>
272 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
274 (InitCoreTypes): Update accordingly.
276 (RegisterAttrType, LookupAttr): Implement.
278 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
281 (Resolve): Update to populate the above as necessary.
285 (GetValidPlaces): Helper to the above.
287 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
289 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
291 2001-11-12 Ravi Pratap <ravi@ximian.com>
293 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
295 * ../errors/cs0617.cs : Add.
297 2001-11-11 Ravi Pratap <ravi@ximian.com>
299 * enum.cs (Emit): Rename to Populate to be more consistent with what
300 we expect it to do and when exactly it is called.
302 * class.cs, rootcontext.cs : Update accordingly.
304 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
305 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
307 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
309 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
310 of a fieldinfo using the above, when dealing with a FieldBuilder.
312 2001-11-10 Ravi Pratap <ravi@ximian.com>
314 * ../errors/cs0031.cs : Add.
316 * ../errors/cs1008.cs : Add.
318 * ../errrors/cs0543.cs : Add.
320 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
323 (FindMembers): Implement.
325 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
326 enums and delegates too.
328 (enum_types): Rename to builder_to_enum.
330 (delegate_types): Rename to builder_to_delegate.
332 * delegate.cs (FindMembers): Implement.
334 2001-11-09 Ravi Pratap <ravi@ximian.com>
336 * typemanager.cs (IsEnumType): Implement.
338 * enum.cs (Emit): Re-write parts to account for the underlying type
339 better and perform checking etc.
341 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
342 of the underlying type.
344 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
347 * enum.cs (error31): Helper to report error #31.
349 * cs-parser.jay (enum_declaration): Store location of each member too.
351 * enum.cs (member_to_location): New hashtable.
353 (AddEnumMember): Update location hashtable.
355 (Emit): Use the location of each member while reporting errors.
357 2001-11-09 Miguel de Icaza <miguel@ximian.com>
359 * cs-parser.jay: A for_initializer if is a
360 local_variable_declaration really ammount to have an implicit
361 block with the variable declaration and no initializer for for.
363 * statement.cs (For.Emit): Cope with null initializers.
365 This fixes the infinite loop on for initializers.
367 2001-11-08 Miguel de Icaza <miguel@ximian.com>
369 * enum.cs: More cleanup.
371 * ecore.cs: Remove dead code.
373 * class.cs (Property.Emit): More simplification.
376 Reworked to have less levels of indentation.
378 2001-11-08 Ravi Pratap <ravi@ximian.com>
380 * class.cs (Property): Emit attributes.
390 * enum.cs (Emit): Ditto.
392 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
395 * class.cs (Field, Event, etc.): Move attribute generation into the
396 Emit method everywhere.
398 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
399 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
400 as we had no way of defining nested enums !
402 * rootcontext.cs : Adjust code accordingly.
404 * typemanager.cs (AddEnumType): To keep track of enum types separately.
406 2001-11-07 Ravi Pratap <ravi@ximian.com>
408 * expression.cs (EvalConstantExpression): Move into ecore.cs
410 * enum.cs (Enum): Rename some members and make them public and readonly
411 according to our convention.
413 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
416 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
418 (Enum::Emit): Write a simple version for now which doesn't try to compute
419 expressions. I shall modify this to be more robust in just a while.
421 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
423 (TypeContainer::CloseType): Create the Enum types too.
425 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
427 * expression.cs (EvalConstantExpression): Get rid of completely.
429 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
430 user-defined values and other cases.
432 (IsValidEnumLiteral): Helper function.
434 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
435 out there in the case we had a literal FieldExpr.
437 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
439 (Literalize): Revamp a bit to take two arguments.
441 (EnumLiteral): New class which derives from Literal to wrap enum literals.
443 2001-11-06 Ravi Pratap <ravi@ximian.com>
445 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
447 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
449 (Resolve): Use the above to ensure we have proper initializers.
451 2001-11-05 Ravi Pratap <ravi@ximian.com>
453 * expression.cs (Expression::EvalConstantExpression): New method to
454 evaluate constant expressions.
456 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
458 2001-11-07 Miguel de Icaza <miguel@ximian.com>
460 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
463 (Binary.ResolveOperator): Handle operator != (object a, object b)
464 and operator == (object a, object b);
466 (Binary.DoNumericPromotions): Indicate whether the numeric
467 promotion was possible.
469 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
472 Made the ArrayAccess implement interface IAssignMethod instead of
473 IStackStore as the order in which arguments are passed reflects
476 * assign.cs: Instead of using expr.ExprClass to select the way of
477 assinging, probe for the IStackStore/IAssignMethod interfaces.
479 * typemanager.cs: Load InitializeArray definition.
481 * rootcontext.cs (RootContext.MakeStaticData): Used to define
482 static data that can be used to initialize arrays.
484 2001-11-05 Miguel de Icaza <miguel@ximian.com>
486 * expression.cs: Handle operator== and operator!= for booleans.
488 (Conditioal.Reduce): Implement reducer for the ?: operator.
490 (Conditional.Resolve): Implement dead code elimination.
492 (Binary.Resolve): Catch string literals and return a new
495 (Unary.Reduce): Implement reduction of unary expressions.
497 * ecore.cs: Split out the expression core handling here.
499 (Expression.Reduce): New method used to perform constant folding
500 and CSE. This is needed to support constant-expressions.
502 * statement.cs (Statement.EmitBoolExpression): Pass true and false
503 targets, and optimize for !x.
505 2001-11-04 Ravi Pratap <ravi@ximian.com>
507 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
508 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
509 set custom atttributes.
511 * literal.cs (Literal::GetValue): New abstract method to return the actual
512 value of the literal, cast as an object.
514 (*Literal): Implement GetValue method.
516 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
517 expressions to the arraylist but objects of type Argument.
519 * class.cs (TypeContainer::Emit): Emit our attributes too.
521 (Method::Emit, Constructor::Emit): Ditto.
523 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
524 to be ignoring earlier.
526 2001-11-03 Ravi Pratap <ravi@ximian.com>
528 * attribute.cs (AttributeSection::Define): Implement to do the business
529 of constructing a CustomAttributeBuilder.
531 (Attribute): New trivial class. Increases readability of code.
533 * cs-parser.jay : Update accordingly.
535 (positional_argument_list, named_argument_list, named_argument): New rules
537 (attribute_arguments): Use the above so that we are more correct.
539 2001-11-02 Ravi Pratap <ravi@ximian.com>
541 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
542 to perform all checks for a method with a params parameter.
544 (Invocation::OverloadResolve): Update to use the above method and therefore
545 cope correctly with params method invocations.
547 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
550 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
551 constructors in our parent too because we can't afford to miss out on
554 * attribute.cs (AttributeSection): New name for the class Attribute
556 Other trivial changes to improve readability.
558 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
559 use the new class names.
561 2001-11-01 Ravi Pratap <ravi@ximian.com>
563 * class.cs (Method::Define): Complete definition for params types too
565 (Indexer::Define): Ditto.
567 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
568 Cope everywhere with a request for info about the array parameter.
570 2001-11-01 Ravi Pratap <ravi@ximian.com>
572 * tree.cs (RecordNamespace): Fix up to check for the correct key.
574 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
575 local_variable_type to extract the string corresponding to the type.
577 (local_variable_type): Fixup the action to use the new helper method.
579 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
582 * expression.cs : Clean out code which uses the above.
584 2001-10-31 Ravi Pratap <ravi@ximian.com>
586 * typemanager.cs (RegisterMethod): Check if we already have an existing key
587 and bale out if necessary by returning a false.
589 (RegisterProperty): Ditto.
591 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
592 and print out appropriate error messages.
594 * interface.cs (everywhere): Ditto.
596 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
597 location to constructor.
599 * class.cs (Property, Event, Indexer): Update accordingly.
601 * ../errors/cs111.cs : Added.
603 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
604 of a method, as laid down by the spec.
606 (Invocation::OverloadResolve): Use the above method.
608 2001-10-31 Ravi Pratap <ravi@ximian.com>
610 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
611 now take a TypeContainer and a Parameters object.
613 (ParameterData): Modify return type of ParameterModifier method to be
614 Parameter.Modifier and not a string.
616 (ReflectionParameters, InternalParameters): Update accordingly.
618 * expression.cs (Argument::GetParameterModifier): Same here.
620 * support.cs (InternalParameters::ParameterType): Find a better way of determining
621 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
622 symbol in it at all so maybe this is only for now.
624 2001-10-30 Ravi Pratap <ravi@ximian.com>
626 * support.cs (InternalParameters): Constructor now takes an extra argument
627 which is the actual Parameters class.
629 (ParameterDesc): Update to provide info on ref/out modifiers.
631 * class.cs (everywhere): Update call to InternalParameters to pass in
632 the second argument too.
634 * support.cs (ParameterData): Add ParameterModifier, which is a method
635 to return the modifier info [ref/out etc]
637 (InternalParameters, ReflectionParameters): Implement the above.
639 * expression.cs (Argument::ParameterModifier): Similar function to return
640 info about the argument's modifiers.
642 (Invocation::OverloadResolve): Update to take into account matching modifiers
645 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
646 a new SetFormalParameters object which we pass to InternalParameters.
648 2001-10-30 Ravi Pratap <ravi@ximian.com>
650 * expression.cs (NewArray): Merge into the ArrayCreation class.
652 2001-10-29 Ravi Pratap <ravi@ximian.com>
654 * expression.cs (NewArray): Merge classes NewBuiltinArray and
655 NewUserdefinedArray into one as there wasn't much of a use in having
658 * expression.cs (Argument): Change field's name to ArgType from Type.
660 (Type): New readonly property which returns the proper type, taking into
661 account ref/out modifiers.
663 (everywhere): Adjust code accordingly for the above.
665 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
666 whether we are emitting for a ref or out parameter.
668 * expression.cs (Argument::Emit): Use the above field to set the state.
670 (LocalVariableReference::Emit): Update to honour the flag and emit the
673 * parameter.cs (Attributes): Set the correct flags for ref parameters.
675 * expression.cs (Argument::FullDesc): New function to provide a full desc.
677 * support.cs (ParameterData): Add method ParameterDesc to the interface.
679 (ReflectionParameters, InternalParameters): Implement the above method.
681 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
684 (Invocation::FullMethodDesc): Ditto.
686 2001-10-29 Miguel de Icaza <miguel@ximian.com>
688 * cs-parser.jay: Add extra production for the second form of array
691 * expression.cs (ArrayCreation): Update to reflect the above
694 * Small changes to prepare for Array initialization.
696 2001-10-28 Miguel de Icaza <miguel@ximian.com>
698 * typemanager.cs (ImplementsInterface): interface might be null;
699 Deal with this problem;
701 Also, we do store negative hits on the cache (null values), so use
702 this instead of calling t.GetInterfaces on the type everytime.
704 2001-10-28 Ravi Pratap <ravi@ximian.com>
706 * typemanager.cs (IsBuiltinType): New method to help determine the same.
708 * expression.cs (New::DoResolve): Get rid of array creation code and instead
709 split functionality out into different classes.
711 (New::FormArrayType): Move into NewBuiltinArray.
713 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
716 (NewBuiltinArray): New class to handle creation of built-in arrays.
718 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
719 account creation of one-dimensional arrays.
721 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
723 (NewUserdefinedArray::DoResolve): Implement.
725 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
727 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
728 we maintain inside the TypeManager. This is necessary to perform lookups on the
731 (LookupType): Update to perform GetType on the module builders too.
733 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
735 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
737 2001-10-23 Ravi Pratap <ravi@ximian.com>
739 * expression.cs (New::DoResolve): Implement guts of array creation.
741 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
743 2001-10-27 Miguel de Icaza <miguel@ximian.com>
745 * expression.cs: Fix bug I introduced lsat night that broke
748 (Expression.Resolve): Report a 246 error (can not resolve name)
749 if we find a SimpleName in the stream.
751 (Expression.ResolveLValue): Ditto.
753 (Expression.ResolveWithSimpleName): This function is a variant of
754 ResolveName, this one allows SimpleNames to be returned without a
755 warning. The only consumer of SimpleNames is MemberAccess
757 2001-10-26 Miguel de Icaza <miguel@ximian.com>
759 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
760 might arrive here. I have my doubts that this is correct.
762 * statement.cs (Lock): Implement lock statement.
764 * cs-parser.jay: Small fixes to support `lock' and `using'
766 * cs-tokenizer.cs: Remove extra space
768 * driver.cs: New flag --checked, allows to turn on integer math
771 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
772 Threading.Monitor.Exit
774 2001-10-23 Miguel de Icaza <miguel@ximian.com>
776 * expression.cs (IndexerAccess::DoResolveLValue): Set the
777 Expression Class to be IndexerAccess.
779 Notice that Indexer::DoResolve sets the eclass to Value.
781 2001-10-22 Miguel de Icaza <miguel@ximian.com>
783 * class.cs (TypeContainer::Emit): Emit code for indexers.
785 * assign.cs (IAssignMethod): New interface implemented by Indexers
786 and Properties for handling assignment.
788 (Assign::Emit): Simplify and reuse code.
790 * expression.cs (IndexerAccess, PropertyExpr): Implement
791 IAssignMethod, clean up old code.
793 2001-10-22 Ravi Pratap <ravi@ximian.com>
795 * typemanager.cs (ImplementsInterface): New method to determine if a type
796 implements a given interface. Provides a nice cache too.
798 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
801 (ConvertReferenceExplicit): Ditto.
803 * delegate.cs (Delegate::Populate): Update to define the parameters on the
804 various methods, with correct names etc.
806 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
807 Operator.UnaryNegation.
809 * cs-parser.jay (operator_declarator): Be a little clever in the case where
810 we have a unary plus or minus operator.
812 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
815 * everywhere : update accordingly.
817 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
820 * class.cs (Method::Define): For the case where we are implementing a method
821 inherited from an interface, we need to set the MethodAttributes.Final flag too.
822 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
824 2001-10-21 Ravi Pratap <ravi@ximian.com>
826 * interface.cs (FindMembers): Implement to work around S.R.E
829 * typemanager.cs (IsInterfaceType): Implement.
831 (FindMembers): Update to handle interface types too.
833 * expression.cs (ImplicitReferenceConversion): Re-write bits which
834 use IsAssignableFrom as that is not correct - it doesn't work.
836 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
837 and accordingly override EmitStatement.
839 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
840 using the correct logic :-)
842 2001-10-19 Ravi Pratap <ravi@ximian.com>
844 * ../errors/cs-11.cs : Add to demonstrate error -11
846 2001-10-17 Miguel de Icaza <miguel@ximian.com>
848 * assign.cs (Assign::Resolve): Resolve right hand side first, and
849 then pass this as a hint to ResolveLValue.
851 * expression.cs (FieldExpr): Add Location information
853 (FieldExpr::LValueResolve): Report assignment to readonly
856 (Expression::ExprClassFromMemberInfo): Pass location information.
858 (Expression::ResolveLValue): Add new method that resolves an
861 (Expression::DoResolveLValue): Default invocation calls
864 (Indexers): New class used to keep track of indexers in a given
867 (IStackStore): Renamed from LValue, as it did not really describe
868 what this did. Also ResolveLValue is gone from this interface and
869 now is part of Expression.
871 (ElementAccess): Depending on the element access type
873 * typemanager.cs: Add `indexer_name_type' as a Core type
874 (System.Runtime.CompilerServices.IndexerNameAttribute)
876 * statement.cs (Goto): Take a location.
878 2001-10-18 Ravi Pratap <ravi@ximian.com>
880 * delegate.cs (Delegate::VerifyDelegate): New method to verify
881 if two delegates are compatible.
883 (NewDelegate::DoResolve): Update to take care of the case when
884 we instantiate a delegate from another delegate.
886 * typemanager.cs (FindMembers): Don't even try to look up members
887 of Delegate types for now.
889 2001-10-18 Ravi Pratap <ravi@ximian.com>
891 * delegate.cs (NewDelegate): New class to take care of delegate
894 * expression.cs (New): Split the delegate related code out into
895 the NewDelegate class.
897 * delegate.cs (DelegateInvocation): New class to handle delegate
900 * expression.cs (Invocation): Split out delegate related code into
901 the DelegateInvocation class.
903 2001-10-17 Ravi Pratap <ravi@ximian.com>
905 * expression.cs (New::DoResolve): Implement delegate creation fully
906 and according to the spec.
908 (New::DoEmit): Update to handle delegates differently.
910 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
911 because of which we were printing out arguments in reverse order !
913 * delegate.cs (VerifyMethod): Implement to check if the given method
914 matches the delegate.
916 (FullDelegateDesc): Implement.
918 (VerifyApplicability): Implement.
920 * expression.cs (Invocation::DoResolve): Update to accordingly handle
921 delegate invocations too.
923 (Invocation::Emit): Ditto.
925 * ../errors/cs1593.cs : Added.
927 * ../errors/cs1594.cs : Added.
929 * delegate.cs (InstanceExpression, TargetMethod): New properties.
931 2001-10-16 Ravi Pratap <ravi@ximian.com>
933 * typemanager.cs (intptr_type): Core type for System.IntPtr
935 (InitCoreTypes): Update for the same.
937 (iasyncresult_type, asynccallback_type): Ditto.
939 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
942 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
945 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
946 the builders for the 4 members of a delegate type :-)
948 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
951 * expression.cs (New::DoResolve): Implement guts for delegate creation.
953 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
955 2001-10-15 Miguel de Icaza <miguel@ximian.com>
957 * statement.cs (Break::Emit): Implement.
958 (Continue::Emit): Implement.
960 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
961 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
962 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
963 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
966 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
967 properties that track the label for the current loop (begin of the
968 loop and end of the loop).
970 2001-10-15 Ravi Pratap <ravi@ximian.com>
972 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
973 use of emitting anything at all.
975 * class.cs, rootcontext.cs : Get rid of calls to the same.
977 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
979 (Populate): Define the constructor correctly and set the implementation
982 * typemanager.cs (delegate_types): New hashtable to hold delegates that
985 (AddDelegateType): Implement.
987 (IsDelegateType): Implement helper method.
989 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
991 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
992 and accordingly handle it.
994 * delegate.cs (Populate): Take TypeContainer argument.
995 Implement bits to define the Invoke method. However, I still haven't figured out
996 how to take care of the native int bit :-(
998 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
999 Qualify the name of the delegate, not its return type !
1001 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
1004 (StandardConversionExists): Checking for array types turns out to be recursive.
1006 (ConvertReferenceExplicit): Implement array conversion.
1008 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
1010 2001-10-12 Ravi Pratap <ravi@ximian.com>
1012 * cs-parser.jay (delegate_declaration): Store the fully qualified
1013 name as it is a type declaration.
1015 * delegate.cs (ReturnType, Name): Rename members to these. Make them
1018 (DefineDelegate): Renamed from Define. Does the same thing essentially,
1019 as TypeContainer::DefineType.
1021 (Populate): Method in which all the definition of the various methods (Invoke)
1024 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
1027 (CloseDelegate): Finally creates the delegate.
1029 * class.cs (TypeContainer::DefineType): Update to define delegates.
1030 (Populate, Emit and CloseType): Do the same thing here too.
1032 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
1033 delegates in all these operations.
1035 2001-10-14 Miguel de Icaza <miguel@ximian.com>
1037 * expression.cs: LocalTemporary: a new expression used to
1038 reference a temporary that has been created.
1040 * assign.cs: Handle PropertyAccess back here, so that we can
1041 provide the proper semantic access to properties.
1043 * expression.cs (Expression::ConvertReferenceExplicit): Implement
1044 a few more explicit conversions.
1046 * modifiers.cs: `NEW' modifier maps to HideBySig.
1048 * expression.cs (PropertyExpr): Make this into an
1049 ExpressionStatement, and support the EmitStatement code path.
1051 Perform get/set error checking, clean up the interface.
1053 * assign.cs: recognize PropertyExprs as targets, and if so, turn
1054 them into toplevel access objects.
1056 2001-10-12 Miguel de Icaza <miguel@ximian.com>
1058 * expression.cs: PropertyExpr::PropertyExpr: use work around the
1061 * typemanager.cs: Keep track here of our PropertyBuilders again to
1062 work around lameness in SRE.
1064 2001-10-11 Miguel de Icaza <miguel@ximian.com>
1066 * expression.cs (LValue::LValueResolve): New method in the
1067 interface, used to perform a second resolution pass for LValues.
1069 (This::DoResolve): Catch the use of this in static methods.
1071 (This::LValueResolve): Implement.
1073 (This::Store): Remove warning, assigning to `this' in structures
1076 (Invocation::Emit): Deal with invocation of
1077 methods on value types. We need to pass the address to structure
1078 methods rather than the object itself. (The equivalent code to
1079 emit "this" for structures leaves the entire structure on the
1080 stack instead of a pointer to it).
1082 (ParameterReference::DoResolve): Compute the real index for the
1083 argument based on whether the method takes or not a `this' pointer
1084 (ie, the method is static).
1086 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
1087 value types returned from functions when we need to invoke a
1088 method on the sturcture.
1091 2001-10-11 Ravi Pratap <ravi@ximian.com>
1093 * class.cs (TypeContainer::DefineType): Method to actually do the business of
1094 defining the type in the Modulebuilder or Typebuilder. This is to take
1095 care of nested types which need to be defined on the TypeBuilder using
1098 (TypeContainer::GetClassBases): Implement. Essentially the code from the
1099 methods in RootContext, only ported to be part of TypeContainer.
1101 (TypeContainer::GetInterfaceOrClass): Ditto.
1103 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
1105 * interface.cs (Interface::DefineInterface): New method. Does exactly
1106 what RootContext.CreateInterface did earlier, only it takes care of nested types
1109 (Interface::GetInterfaces): Move from RootContext here and port.
1111 (Interface::GetInterfaceByName): Same here.
1113 * rootcontext.cs (ResolveTree): Re-write.
1115 (PopulateTypes): Re-write.
1117 * class.cs (TypeContainer::Populate): Populate nested types too.
1118 (TypeContainer::Emit): Emit nested members too.
1120 * typemanager.cs (AddUserType): Do not make use of the FullName property,
1121 instead just use the name argument passed in as it is already fully
1124 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
1125 to TypeContainer mapping to see if a type is user-defined.
1127 * class.cs (TypeContainer::CloseType): Implement.
1129 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
1130 the default constructor.
1132 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
1135 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
1137 * interface.cs (CloseType): Create the type here.
1139 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
1142 Remove all the methods which are now in TypeContainer.
1144 2001-10-10 Ravi Pratap <ravi@ximian.com>
1146 * delegate.cs (Define): Re-write bits to define the delegate
1149 2001-10-10 Miguel de Icaza <miguel@ximian.com>
1151 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
1153 * expression.cs (ImplicitReferenceConversion): handle null as well
1154 as a source to convert to any reference type.
1156 * statement.cs (Return): Perform any implicit conversions to
1157 expected return type.
1159 Validate use of return statement.
1161 * codegen.cs (EmitContext): Pass the expected return type here.
1163 * class.cs (Method, Constructor, Property): Pass expected return
1164 type to EmitContext.
1166 2001-10-09 Miguel de Icaza <miguel@ximian.com>
1168 * expression.cs: Make DoResolve take an EmitContext instead of a
1171 Replaced `l' and `location' for `loc', for consistency.
1173 (Error, Warning): Remove unneeded Tc argument.
1175 * assign.cs, literal.cs, constant.cs: Update to new calling
1178 * codegen.cs: EmitContext now contains a flag indicating whether
1179 code is being generated in a static method or not.
1181 * cs-parser.jay: DecomposeQI, new function that replaces the old
1182 QualifiedIdentifier. Now we always decompose the assembled
1183 strings from qualified_identifier productions into a group of
1186 2001-10-08 Miguel de Icaza <miguel@ximian.com>
1188 * rootcontext.cs: Deal with field-less struct types correctly now
1189 by passing the size option to Define Type.
1191 * class.cs: Removed hack that created one static field.
1193 2001-10-07 Miguel de Icaza <miguel@ximian.com>
1195 * statement.cs: Moved most of the code generation here.
1197 2001-10-09 Ravi Pratap <ravi@ximian.com>
1199 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
1202 (ElementAccess): Remove useless bits for now - keep checks as the spec
1205 2001-10-08 Ravi Pratap <ravi@ximian.com>
1207 * expression.cs (ElementAccess::DoResolve): Remove my crap code
1208 and start performing checks according to the spec.
1210 2001-10-07 Ravi Pratap <ravi@ximian.com>
1212 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
1213 rank_specifiers instead.
1215 (rank_specifiers): Change the order in which the rank specifiers are stored
1217 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
1219 * expression.cs (ElementAccess): Implement the LValue interface too.
1221 2001-10-06 Ravi Pratap <ravi@ximian.com>
1223 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
1224 except that user defined conversions are not included.
1226 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
1227 perform the conversion of the return type, if necessary.
1229 (New::DoResolve): Check whether we are creating an array or an object
1230 and accordingly do the needful.
1232 (New::Emit): Same here.
1234 (New::DoResolve): Implement guts of array creation.
1236 (New::FormLookupType): Helper function.
1238 2001-10-07 Miguel de Icaza <miguel@ximian.com>
1240 * codegen.cs: Removed most of the code generation here, and move the
1241 corresponding code generation bits to the statement classes.
1243 Added support for try/catch/finalize and throw.
1245 * cs-parser.jay: Added support for try/catch/finalize.
1247 * class.cs: Catch static methods having the flags override,
1248 virtual or abstract.
1250 * expression.cs (UserCast): This user cast was not really doing
1251 what it was supposed to do. Which is to be born in fully resolved
1252 state. Parts of the resolution were being performed at Emit time!
1256 2001-10-05 Miguel de Icaza <miguel@ximian.com>
1258 * expression.cs: Implicity convert the result from UserCast.
1260 2001-10-05 Ravi Pratap <ravi@ximian.com>
1262 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
1263 prevented it from working correctly.
1265 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
1266 merely ConvertImplicit.
1268 2001-10-05 Miguel de Icaza <miguel@ximian.com>
1270 * typemanager.cs: Make the LookupTypeContainer function static,
1271 and not per-instance.
1273 * class.cs: Make static FindMembers (the one that takes a Type
1276 * codegen.cs: Add EmitForeach here.
1278 * cs-parser.jay: Make foreach a toplevel object instead of the
1279 inline expansion, as we need to perform semantic analysis on it.
1281 2001-10-05 Ravi Pratap <ravi@ximian.com>
1283 * expression.cs (Expression::ImplicitUserConversion): Rename to
1284 UserDefinedConversion.
1286 (Expression::UserDefinedConversion): Take an extra argument specifying
1287 whether we look for explicit user conversions too.
1289 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
1291 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
1293 (ExplicitUserConversion): Make it a call to UserDefinedConversion
1294 with the appropriate arguments.
1296 * cs-parser.jay (cast_expression): Record location too.
1298 * expression.cs (Cast): Record location info.
1300 (Expression::ConvertExplicit): Take location argument.
1302 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
1303 to determine if we are doing explicit conversions.
1305 (UserCast::Emit): Update accordingly.
1307 (Expression::ConvertExplicit): Report an error if everything fails.
1309 * ../errors/cs0030.cs : Add.
1311 2001-10-04 Miguel de Icaza <miguel@ximian.com>
1313 * modifiers.cs: If the ABSTRACT keyword is present, also set the
1314 virtual and newslot bits.
1316 * class.cs (TypeContainer::RegisterRequiredImplementations):
1317 Record methods we need.
1319 (TypeContainer::MakeKey): Helper function to make keys for
1320 MethodBases, since the Methodbase key is useless.
1322 (TypeContainer::Populate): Call RegisterRequiredImplementations
1323 before defining the methods.
1325 Create a mapping for method_builders_to_methods ahead of time
1326 instead of inside a tight loop.
1328 (::RequireMethods): Accept an object as the data to set into the
1329 hashtable so we can report interface vs abstract method mismatch.
1331 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1333 * report.cs: Make all of it static.
1335 * rootcontext.cs: Drop object_type and value_type computations, as
1336 we have those in the TypeManager anyways.
1338 Drop report instance variable too, now it is a global.
1340 * driver.cs: Use try/catch on command line handling.
1342 Add --probe option to debug the error reporting system with a test
1345 * report.cs: Add support for exiting program when a probe
1346 condition is reached.
1348 2001-10-03 Ravi Pratap <ravi@ximian.com>
1350 * expression.cs (Binary::DoNumericPromotions): Fix the case when
1351 we do a forcible conversion regardless of type, to check if
1352 ForceConversion returns a null.
1354 (Binary::error19): Use location to report error.
1356 (Unary::error23): Use location here too.
1358 * ../errors/cs0019.cs : Check in.
1360 * ../errors/cs0023.cs : Check in.
1362 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
1363 case of a non-null MethodInfo object with a length of 0 !
1365 (Binary::ResolveOperator): Flag error if overload resolution fails to find
1366 an applicable member - according to the spec :-)
1367 Also fix logic to find members in base types.
1369 (Unary::ResolveOperator): Same here.
1371 (Unary::report23): Change name to error23 and make first argument a TypeContainer
1372 as I was getting thoroughly confused between this and error19 :-)
1374 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
1375 (::FindMostEncompassedType): Implement.
1376 (::FindMostEncompassingType): Implement.
1377 (::StandardConversionExists): Implement.
1379 (UserImplicitCast): Re-vamp. We now need info about most specific
1380 source and target types so that we can do the necessary conversions.
1382 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
1383 mathematical union with no duplicates.
1385 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1387 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
1388 in order from base classes to child classes, so that we can in
1389 child classes look up in our parent for method names and
1390 attributes (required for handling abstract, virtual, new, override
1391 constructs: we need to instrospect our base class, and if we dont
1392 populate the classes in order, the introspection might be
1393 incorrect. For example, a method could query its parent before
1394 the parent has any methods and would determine that the parent has
1395 no abstract methods (while it could have had them)).
1397 (RootContext::CreateType): Record the order in which we define the
1400 2001-10-02 Miguel de Icaza <miguel@ximian.com>
1402 * class.cs (TypeContainer::Populate): Also method definitions can
1403 fail now, keep track of this.
1405 (TypeContainer::FindMembers): Implement support for
1406 DeclaredOnly/noDeclaredOnly flag.
1408 (Constructor::Emit) Return the ConstructorBuilder.
1410 (Method::Emit) Return the MethodBuilder.
1411 Check for abstract or virtual methods to be public.
1413 * rootcontext.cs (RootContext::CreateType): Register all the
1414 abstract methods required for the class to be complete and the
1415 interface methods that must be implemented.
1417 * cs-parser.jay: Report error 501 (method requires body if it is
1418 not marked abstract or extern).
1420 * expression.cs (TypeOf::Emit): Implement.
1422 * typemanager.cs: runtime_handle_type, new global type.
1424 * class.cs (Property::Emit): Generate code for properties.
1426 2001-10-02 Ravi Pratap <ravi@ximian.com>
1428 * expression.cs (Unary::ResolveOperator): Find operators on base type
1429 too - we now conform exactly to the spec.
1431 (Binary::ResolveOperator): Same here.
1433 * class.cs (Operator::Define): Fix minor quirk in the tests.
1435 * ../errors/cs0215.cs : Added.
1437 * ../errors/cs0556.cs : Added.
1439 * ../errors/cs0555.cs : Added.
1441 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1443 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
1444 single integer which is really efficient
1446 2001-10-01 Ravi Pratap <ravi@ximian.com>
1448 * expression.cs (Expression::ImplicitUserConversion): Use location
1449 even in the case when we are examining True operators.
1451 * class.cs (Operator::Define): Perform extensive checks to conform
1452 with the rules for operator overloading in the spec.
1454 * expression.cs (Expression::ImplicitReferenceConversion): Implement
1455 some of the other conversions mentioned in the spec.
1457 * typemanager.cs (array_type): New static member for the System.Array built-in
1460 (cloneable_interface): For System.ICloneable interface.
1462 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
1463 we start resolving the tree and populating types.
1465 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
1467 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1469 * expression.cs (Expression::ExprClassFromMemberInfo,
1470 Expression::Literalize): Create literal expressions from
1471 FieldInfos which are literals.
1473 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
1474 type casts, because they were wrong. The test suite in tests
1477 (ImplicitNumericConversion): ushort to ulong requires a widening
1480 Int32 constant to long requires widening cast as well.
1482 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
1483 for integers because the type on the stack is not i4.
1485 2001-09-30 Miguel de Icaza <miguel@ximian.com>
1487 * expression.cs (report118): require location argument.
1489 * parameter.cs: Do not dereference potential null value.
1491 * class.cs: Catch methods that lack the `new' keyword when
1492 overriding a name. Report warnings when `new' is used without
1493 anything being there to override.
1495 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
1497 * class.cs: Only add constructor to hashtable if it is non-null
1498 (as now constructors can fail on define).
1500 (TypeManager, Class, Struct): Take location arguments.
1502 Catch field instance initialization in structs as errors.
1504 accepting_filter: a new filter for FindMembers that is static so
1505 that we dont create an instance per invocation.
1507 (Constructor::Define): Catch errors where a struct constructor is
1510 * cs-parser.jay: Pass location information for various new
1513 * delegate.cs (Delegate): take a location argument.
1515 * driver.cs: Do not call EmitCode if there were problesm in the
1516 Definition of the types, as many Builders wont be there.
1518 * decl.cs (Decl::Decl): Require a location argument.
1520 * cs-tokenizer.cs: Handle properly hex constants that can not fit
1521 into integers, and find the most appropiate integer for it.
1523 * literal.cs: Implement ULongLiteral.
1525 * rootcontext.cs: Provide better information about the location of
1526 failure when CreateType fails.
1528 2001-09-29 Miguel de Icaza <miguel@ximian.com>
1530 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
1533 * expression.cs (Binary::CheckShiftArguments): Add missing type
1535 (Binary::ResolveOperator): Add type to the logical and and logical
1536 or, Bitwise And/Or and Exclusive Or code paths, it was missing
1539 (Binary::DoNumericPromotions): In the case where either argument
1540 is ulong (and most signed types combined with ulong cause an
1541 error) perform implicit integer constant conversions as well.
1543 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1545 * expression.cs (UserImplicitCast): Method should always be
1547 (Invocation::BetterConversion): Simplified test for IntLiteral.
1549 (Expression::ImplicitNumericConversion): Split this routine out.
1550 Put the code that performs implicit constant integer conversions
1553 (Expression::Resolve): Become a wrapper around DoResolve so we can
1554 check eclass and type being set after resolve.
1556 (Invocation::Badness): Remove this dead function
1558 (Binary::ResolveOperator): Do not compute the expensive argumnets
1559 unless we have a union for it.
1561 (Probe::Emit): Is needs to do an isinst and then
1562 compare against null.
1564 (::CanConvert): Added Location argument. If the Location argument
1565 is null (Location.Null), then we do not report errors. This is
1566 used by the `probe' mechanism of the Explicit conversion. We do
1567 not want to generate an error for something that the user
1568 explicitly requested to be casted. But the pipeline for an
1569 explicit cast first tests for potential implicit casts.
1571 So for now, if the Location is null, it means `Probe only' to
1572 avoid adding another argument. Might have to revise this
1575 (ClassCast): New class used to type cast objects into arbitrary
1576 classes (used in Explicit Reference Conversions).
1578 Implement `as' as well.
1580 Reverted all the patches from Ravi below: they were broken:
1582 * The use of `level' as a mechanism to stop recursive
1583 invocations is wrong. That was there just to catch the
1584 bug with a strack trace but not as a way of addressing
1587 To fix the problem we have to *understand* what is going
1588 on and the interactions and come up with a plan, not
1589 just get things going.
1591 * The use of the type conversion cache that I proposed
1592 last night had an open topic: How does this work across
1593 protection domains. A user defined conversion might not
1594 be public in the location where we are applying the
1595 conversion, a different conversion might be selected
1596 (ie, private A->B (better) but public B->A (worse),
1597 inside A, A->B applies, but outside it, B->A will
1600 * On top of that (ie, even if the above is solved),
1601 conversions in a cache need to be abstract. Ie, `To
1602 convert from an Int to a Short use an OpcodeCast', not
1603 `To convert from an Int to a Short use the OpcodeCast on
1604 the variable 5' (which is what this patch was doing).
1606 2001-09-28 Ravi Pratap <ravi@ximian.com>
1608 * expression.cs (Invocation::ConversionExists): Re-write to use
1609 the conversion cache
1611 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
1612 cache all conversions done, not just user-defined ones.
1614 (Invocation::BetterConversion): The real culprit. Use ConversionExists
1615 to determine if a conversion exists instead of acutually trying to
1616 perform the conversion. It's faster too.
1618 (Expression::ConvertExplicit): Modify to use ConversionExists to check
1619 and only then attempt the implicit conversion.
1621 2001-09-28 Ravi Pratap <ravi@ximian.com>
1623 * expression.cs (ConvertImplicit): Use a cache for conversions
1624 already found. Check level of recursion and bail out if necessary.
1626 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1628 * typemanager.cs (string_concat_string_string, string_concat_object_object):
1629 Export standard methods that we expect for string operations.
1631 * statement.cs (Block::UsageWarning): Track usage of variables and
1632 report the errors for not used variables.
1634 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
1637 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1639 * codegen.cs: remove unnneded code
1641 * expression.cs: Removed BuiltinTypeAccess class
1643 Fix the order in which implicit conversions are
1646 The previous fixed dropped support for boxed conversions (adding a
1647 test to the test suite now)
1649 (UserImplicitCast::CanConvert): Remove test for source being null,
1650 that code is broken. We should not feed a null to begin with, if
1651 we do, then we should track the bug where the problem originates
1652 and not try to cover it up here.
1654 Return a resolved expression of type UserImplicitCast on success
1655 rather than true/false. Ravi: this is what I was talking about,
1656 the pattern is to use a static method as a "constructor" for
1659 Also, do not create arguments until the very last minute,
1660 otherwise we always create the arguments even for lookups that
1661 will never be performed.
1663 (UserImplicitCast::Resolve): Eliminate, objects of type
1664 UserImplicitCast are born in a fully resolved state.
1666 * typemanager.cs (InitCoreTypes): Init also value_type
1669 * expression.cs (Cast::Resolve): First resolve the child expression.
1671 (LValue): Add new method AddressOf to be used by
1674 Change the argument of Store to take an EmitContext instead of an
1675 ILGenerator, because things like FieldExpr need to be able to call
1676 their children expression to generate the instance code.
1678 (Expression::Error, Expression::Warning): Sugar functions for
1681 (Expression::MemberLookup): Accept a TypeContainer instead of a
1682 Report as the first argument.
1684 (Expression::ResolvePrimary): Killed. I still want to improve
1685 this as currently the code is just not right.
1687 (Expression::ResolveMemberAccess): Simplify, but it is still
1690 (Unary::Resolve): Catch errors in AddressOf operators.
1692 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
1693 index to a byte for the short-version, or the compiler will choose
1694 the wrong Emit call, which generates the wrong data.
1696 (ParameterReference::Emit, ::Store): same.
1698 (FieldExpr::AddressOf): Implement.
1700 * typemanager.cs: TypeManager: made public variable instead of
1703 * driver.cs: document --fatal.
1705 * report.cs (ErrorMessage, WarningMessage): new names for the old
1706 Error and Warning classes.
1708 * cs-parser.jay (member_access): Turn built-in access to types
1709 into a normal simplename
1711 2001-09-27 Ravi Pratap <ravi@ximian.com>
1713 * expression.cs (Invocation::BetterConversion): Fix to cope
1714 with q being null, since this was introducing a bug.
1716 * expression.cs (ConvertImplicit): Do built-in conversions first.
1718 2001-09-27 Ravi Pratap <ravi@ximian.com>
1720 * expression.cs (UserImplicitCast::Resolve): Fix bug.
1722 2001-09-27 Ravi Pratap <ravi@ximian.com>
1724 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
1725 I had introduced long ago (what's new ?).
1727 * expression.cs (UserImplicitCast::CanConvert): Static method to do
1728 the work of all the checking.
1729 (ConvertImplicit): Call CanConvert and only then create object if necessary.
1730 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
1732 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
1733 that is the right way.
1735 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
1736 overloading resolution. Use everywhere instead of cutting and pasting code.
1738 (Binary::ResolveOperator): Use MakeUnionSet.
1740 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
1741 we have to convert to bool types. Not complete yet.
1743 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1745 * typemanager.cs (TypeManager::CSharpName): support ushort.
1747 * expression.cs (Expression::TryImplicitIntConversion): Attempts
1748 to provide an expression that performsn an implicit constant int
1749 conversion (section 6.1.6).
1750 (Expression::ConvertImplicitRequired): Reworked to include
1751 implicit constant expression conversions.
1753 (Expression::ConvertNumericExplicit): Finished.
1755 (Invocation::Emit): If InstanceExpression is null, then it means
1756 that we perform a call on this.
1758 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1760 * expression.cs (Unary::Emit): Remove some dead code.
1761 (Probe): Implement Resolve and Emit for `is'.
1762 (Expression::ConvertImplicitRequired): Attempt to do constant
1763 expression conversions here. Maybe should be moved to
1764 ConvertImplicit, but I am not sure.
1765 (Expression::ImplicitLongConstantConversionPossible,
1766 Expression::ImplicitIntConstantConversionPossible): New functions
1767 that tell whether is it possible to apply an implicit constant
1768 expression conversion.
1770 (ConvertNumericExplicit): Started work on explicit numeric
1773 * cs-parser.jay: Update operator constants.
1775 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
1776 (Parameters::GetSignature): Hook up VerifyArgs here.
1777 (Parameters::VerifyArgs): Verifies that no two arguments have the
1780 * class.cs (Operator): Update the operator names to reflect the
1781 ones that the spec expects (as we are just stringizing the
1784 * expression.cs (Unary::ResolveOperator): Fix bug: Use
1785 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
1786 previous usage did only work for our methods.
1787 (Expression::ConvertImplicit): Handle decimal implicit numeric
1788 conversions as well.
1789 (Expression::InternalTypeConstructor): Used to invoke constructors
1790 on internal types for default promotions.
1792 (Unary::Emit): Implement special handling for the pre/post
1793 increment/decrement for overloaded operators, as they need to have
1794 the same semantics as the other operators.
1796 (Binary::ResolveOperator): ditto.
1797 (Invocation::ConversionExists): ditto.
1798 (UserImplicitCast::Resolve): ditto.
1800 2001-09-26 Ravi Pratap <ravi@ximian.com>
1802 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
1803 operator, return after emitting body. Regression tests pass again !
1805 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
1806 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
1807 (Invocation::OverloadResolve): Ditto.
1808 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
1810 * everywhere : update calls to the above methods accordingly.
1812 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1814 * assign.cs (Assign): Make it inherit from ExpressionStatement.
1816 * expression.cs (ExpressionStatement): New base class used for
1817 expressions that can appear in statements, so that we can provide
1818 an alternate path to generate expression that do not leave a value
1821 (Expression::Emit, and all the derivatives): We no longer return
1822 whether a value is left on the stack or not. Every expression
1823 after being emitted leaves a single value on the stack.
1825 * codegen.cs (EmitContext::EmitStatementExpression): Use the
1826 facilties of ExpressionStatement if possible.
1828 * cs-parser.jay: Update statement_expression.
1830 2001-09-25 Miguel de Icaza <miguel@ximian.com>
1832 * driver.cs: Change the wording of message
1834 2001-09-25 Ravi Pratap <ravi@ximian.com>
1836 * expression.cs (Binary::ResolveOperator): Had forgottten to set
1837 the type of the expression to the return type of the method if
1838 we have an overloaded operator match ! The regression tests pass again !
1839 (Unary::ResolveOperator): Ditto.
1841 * expression.cs (Invocation::ConversionExists): Correct the member lookup
1842 to find "op_Implicit", not "implicit" ;-)
1843 (UserImplicitCast): New class to take care of user-defined implicit conversions.
1844 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1846 * everywhere : Correct calls to the above accordingly.
1848 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1849 (ConvertImplicit): Do user-defined conversion if it exists.
1851 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1853 * assign.cs: track location.
1854 (Resolve): Use implicit conversions on assignment.
1856 * literal.cs: Oops. Not good, Emit of short access values should
1857 pass (Bytes) or the wrong argument will be selected.
1859 * expression.cs (Unary::Emit): Emit code for -expr.
1861 (Unary::ResolveOperator): Handle `Substract' for non-constants
1862 (substract from zero from the non-constants).
1863 Deal with Doubles as well.
1865 (Expression::ConvertImplicitRequired): New routine that reports an
1866 error if no implicit conversion exists.
1868 (Invocation::OverloadResolve): Store the converted implicit
1869 expressions if we make them
1871 2001-09-24 Ravi Pratap <ravi@ximian.com>
1873 * class.cs (ConstructorInitializer): Take a Location argument.
1874 (ConstructorBaseInitializer): Same here.
1875 (ConstructorThisInitializer): Same here.
1877 * cs-parser.jay : Update all calls accordingly.
1879 * expression.cs (Unary, Binary, New): Take location argument.
1880 Update accordingly everywhere.
1882 * cs-parser.jay : Update all calls to the above to take a location
1887 2001-09-24 Ravi Pratap <ravi@ximian.com>
1889 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1890 (Invocation::BetterConversion): Same here
1891 (Invocation::ConversionExists): Ditto.
1893 (Invocation::ConversionExists): Implement.
1895 2001-09-22 Ravi Pratap <ravi@ximian.com>
1897 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1898 Also take an additional TypeContainer argument.
1900 * All over : Pass in TypeContainer as argument to OverloadResolve.
1902 * typemanager.cs (CSharpName): Update to check for the string type and return
1905 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1908 2001-09-21 Ravi Pratap <ravi@ximian.com>
1910 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1911 (Invocation::BetterFunction): Implement.
1912 (Invocation::BetterConversion): Implement.
1913 (Invocation::ConversionExists): Skeleton, no implementation yet.
1915 Okay, things work fine !
1917 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1919 * typemanager.cs: declare and load enum_type, delegate_type and
1922 * expression.cs (Expression::Emit): Now emit returns a value that
1923 tells whether a value is left on the stack or not. This strategy
1924 might be reveted tomorrow with a mechanism that would address
1925 multiple assignments.
1926 (Expression::report118): Utility routine to report mismatches on
1929 (Unary::Report23): Report impossible type/operator combination
1932 (Unary::IsIncrementableNumber): Whether the type can be
1933 incremented or decremented with add.
1934 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1936 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1938 (Invocation::Emit): Deal with new Emit convetion.
1940 * All Expression derivatives: Updated their Emit method to return
1941 whether they leave values on the stack or not.
1943 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1944 stack for expressions that are statements.
1946 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1948 * expression.cs (LValue): New interface. Must be implemented by
1950 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1953 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1954 interface for generating code, simplifies the code.
1956 2001-09-20 Ravi Pratap <ravi@ximian.com>
1958 * expression.cs (everywhere): Comment out return statements in ::Resolve
1959 methods to avoid the warnings.
1961 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1963 * driver.cs (parse): Report error 2001 if we can not open the
1966 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1969 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1972 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1973 otherwise nested blocks end up with the same index.
1975 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1977 * expression.cs: Instead of having FIXMEs in the Resolve
1978 functions, throw exceptions so it is obvious that we are facing a
1981 * cs-parser.jay (invocation_expression): Pass Location information.
1983 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1984 Use a basename for those routines because .NET does not like paths
1987 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1990 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1992 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1993 are loading the correct data types (throws an exception if not).
1994 (TypeManager::InitCoreTypes): Use CoreLookupType
1996 * expression.cs (Unary::ResolveOperator): return the child
1997 expression for expressions which are just +expr.
1998 (Unary::ResolveOperator): Return negative literals for -LITERAL
1999 expressions (otherwise they are Unary {Literal}).
2000 (Invocation::Badness): Take into account `Implicit constant
2001 expression conversions'.
2003 * literal.cs (LongLiteral): Implement long literal class.
2004 (IntLiteral): export the `Value' of the intliteral.
2006 2001-09-19 Ravi Pratap <ravi@ximian.com>
2008 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
2010 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
2011 instead of 'Operator'
2013 * expression.cs (Binary::ResolveOperator): Update accordingly.
2014 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
2017 * cs-parser.jay (unary_expression): Update to use the new names.
2019 * gen-treedump.cs (GetUnary): Same here.
2021 * expression.cs (Unary::Resolve): Implement.
2022 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
2023 operators are found instead of making noise ;-)
2024 (Unary::ResolveOperator): New method to do precisely the same thing which
2025 Binary::ResolveOperator does for Binary expressions.
2026 (Unary.method, .Arguments): Add.
2027 (Unary::OperName): Implement.
2028 (Unary::ForceConversion): Copy and Paste !
2030 * class.cs (Operator::Define): Fix a small bug for the case when we have
2033 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
2034 for the inbuilt operators. Only overloading works for now ;-)
2036 2001-09-18 Miguel de Icaza <miguel@ximian.com>
2038 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
2039 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
2041 * expression.cs (This::Emit): Implement.
2042 (This::Resolve): Implement.
2043 (TypeOf:Resolve): Implement.
2044 (Expression::ResolveSimpleName): Add an implicit this to instance
2046 (MemberAccess::Resolve): Deal with Parameters and Fields.
2047 Bind instance variable to Field expressions.
2048 (FieldExpr::Instance): New field used to track the expression that
2049 represents the object instance.
2050 (FieldExpr::Resolve): Track potential errors from MemberLookup not
2052 (FieldExpr::Emit): Implement.
2054 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
2055 the last instruction contains a return opcode to avoid generating
2056 the last `ret' instruction (this generates correct code, and it is
2057 nice to pass the peverify output).
2059 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
2060 initializer for static and instance variables.
2061 (Constructor::Emit): Allow initializer to be null in the case of
2062 static constructors. Only emit initializer for instance
2065 (TypeContainer::FindMembers): Return a null array if there are no
2068 Also fix the code for the MemberTypes.Method branch, as it was not
2069 scanning that for operators (or tried to access null variables before).
2071 * assign.cs (Assign::Emit): Handle instance and static fields.
2075 * driver.cs: Stop compilation if there are parse errors.
2077 * cs-parser.jay (constructor_declaration): Provide default base
2078 initializer for non-static constructors.
2079 (constructor_declarator): Do not provide a default base
2080 initializers if none was specified.
2081 Catch the fact that constructors should not have parameters.
2083 * class.cs: Do not emit parent class initializers for static
2084 constructors, that should be flagged as an error.
2086 2001-09-18 Ravi Pratap <ravi@ximian.com>
2088 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
2089 Move back code into TypeContainer::Populate.
2091 2001-09-18 Ravi Pratap <ravi@ximian.com>
2093 * class.cs (TypeContainer::AddConstructor): Fix the check to
2094 compare against Name, not Basename.
2095 (Operator::OpType): Change Plus and Minus to Add and Subtract.
2097 * cs-parser.jay : Update accordingly.
2099 * class.cs (TypeContainer::FindMembers): For the case where we are searching
2100 for methods, don't forget to look into the operators too.
2101 (RegisterMethodBuilder): Helper method to take care of this for
2102 methods, constructors and operators.
2103 (Operator::Define): Completely revamp.
2104 (Operator.OperatorMethod, MethodName): New fields.
2105 (TypeContainer::Populate): Move the registering of builders into
2106 RegisterMethodBuilder.
2107 (Operator::Emit): Re-write.
2109 * expression.cs (Binary::Emit): Comment out code path to emit method
2110 invocation stuff for the case when we have a user defined operator. I am
2111 just not able to get it right !
2113 2001-09-17 Miguel de Icaza <miguel@ximian.com>
2115 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
2118 (Expression::MemberLookup): Provide a version that allows to
2119 specify the MemberTypes and BindingFlags.
2121 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
2122 so it was not fetching variable information from outer blocks.
2124 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
2125 Beforefieldinit as it was buggy.
2127 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
2130 * class.cs (Constructor::Emit): Only emit if block is not null.
2131 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
2132 deal with this by semantically definining it as if the user had
2135 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
2136 constructors as we now "emit" them at a higher level.
2138 (TypeContainer::DefineDefaultConstructor): Used to define the
2139 default constructors if none was provided.
2141 (ConstructorInitializer): Add methods Resolve and Emit.
2143 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
2145 2001-09-17 Ravi Pratap <ravi@ximian.com>
2147 * class.cs (TypeContainer::EmitDefaultConstructor): Register
2148 the default constructor builder with our hashtable for methodbuilders
2151 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
2152 and argument_count is 0 in which case we have a match.
2153 (Binary::ResolveOperator): More null checking and miscellaneous coding
2156 2001-09-17 Ravi Pratap <ravi@ximian.com>
2158 * rootcontext.cs (IsNameSpace): Compare against null.
2160 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
2162 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
2163 and Unary::Operator.
2165 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
2168 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
2169 we have overloaded operators.
2170 (Binary::ResolveOperator): Implement the part which does the operator overload
2173 * class.cs (Operator::Emit): Implement.
2174 (TypeContainer::Emit): Emit the operators we have too.
2176 * expression.cs (Binary::Emit): Update to emit the appropriate code for
2177 the case when we have a user-defined operator.
2179 2001-09-17 Miguel de Icaza <miguel@ximian.com>
2181 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
2183 2001-09-16 Ravi Pratap <ravi@ximian.com>
2185 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
2186 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
2187 (Constructor::Emit): Implement.
2188 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
2189 if we have no work to do.
2190 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
2193 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
2194 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
2196 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
2199 2001-09-15 Ravi Pratap <ravi@ximian.com>
2201 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
2203 (Tree::RecordNamespace): Method to do what the name says ;-)
2204 (Tree::Namespaces): Property to get at the namespaces hashtable.
2206 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
2209 * rootcontext.cs (IsNamespace): Fixed it :-)
2211 2001-09-14 Miguel de Icaza <miguel@ximian.com>
2213 * class.cs (TypeContainer::FindMembers): Add support for
2215 (MethodCore): New class that encapsulates both the shared aspects
2216 of a Constructor and a Method.
2217 (Method, Constructor): Factored pieces into MethodCore.
2219 * driver.cs: Added --fatal which makes errors throw exceptions.
2220 Load System assembly as well as part of the standard library.
2222 * report.cs: Allow throwing exceptions on errors for debugging.
2224 * modifiers.cs: Do not use `parent', instead use the real type
2225 container to evaluate permission settings.
2227 * class.cs: Put Ravi's patch back in. He is right, and we will
2228 have to cope with the
2230 2001-09-14 Ravi Pratap <ravi@ximian.com>
2232 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
2233 FamORAssem, not FamANDAssem.
2235 2001-09-14 Miguel de Icaza <miguel@ximian.com>
2237 * driver.cs: Added --parse option that only parses its input files
2240 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
2241 incorrect. IsTopLevel is not used to tell whether an object is
2242 root_types or not (that can be achieved by testing this ==
2243 root_types). But to see if this is a top-level *class* (not
2244 necessarly our "toplevel" container).
2246 2001-09-14 Ravi Pratap <ravi@ximian.com>
2248 * enum.cs (Enum::Define): Modify to call the Lookup method on the
2249 parent instead of a direct call to GetType.
2251 2001-09-14 Ravi Pratap <ravi@ximian.com>
2253 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
2254 Modifiers.TypeAttr. This should just be a call to that method.
2256 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
2257 object so that we can determine if we are top-level or not.
2259 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
2262 * enum.cs (Enum::Define): Ditto.
2264 * modifiers.cs (FieldAttr): Re-write.
2266 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
2267 (TypeContainer::HaveStaticConstructor): New property to provide access
2268 to precisely that info.
2270 * modifiers.cs (MethodAttr): Re-write.
2271 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
2273 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
2274 of top-level types as claimed.
2276 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2278 * expression.cs (MemberLookup): Fruitless attempt to lookup
2279 constructors. Maybe I need to emit default constructors? That
2280 might be it (currently .NET emits this for me automatically).
2281 (Invocation::OverloadResolve): Cope with Arguments == null.
2282 (Invocation::EmitArguments): new function, shared by the new
2284 (Invocation::Emit): Handle static and instance methods. Emit
2285 proper call instruction for virtual or non-virtual invocations.
2286 (New::Emit): Implement.
2287 (New::Resolve): Implement.
2288 (MemberAccess:Resolve): Implement.
2289 (MethodGroupExpr::InstanceExpression): used conforming to the spec
2291 (FieldExpr::Resolve): Set type.
2293 * support.cs: Handle empty arguments.
2295 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
2296 SimpleLookup): Auxiliary routines to help parse a qualifier
2299 Update qualifier_identifier rule.
2301 * codegen.cs: Removed debugging messages.
2303 * class.cs: Make this a global thing, this acts just as a "key" to
2304 objects that we might have around.
2306 (Populate): Only initialize method_builders_to_methods once.
2308 * expression.cs (PropertyExpr): Initialize type from the
2311 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
2312 Resolve pattern. Attempt to implicitly convert value to boolean.
2315 * expression.cs: Set the type for the int32/int32 argument case.
2316 (Binary::ResolveOperator): Set the return type to boolean for
2317 comparission operators
2319 * typemanager.cs: Remove debugging print code.
2321 (Invocation::Resolve): resolve type.
2323 * class.cs: Allocate a MemberInfo of the correct size, as the code
2324 elsewhere depends on the test to reflect the correct contents.
2326 (Method::) Keep track of parameters, due to System.Reflection holes
2328 (TypeContainer::Populate): Keep track of MethodBuilders to Method
2331 (TypeContainer::FindMembers): Use ArrayList and then copy an array
2332 of the exact size and return that.
2334 (Class::LookupMethodByBuilder): New function that maps
2335 MethodBuilders to its methods. Required to locate the information
2336 on methods because System.Reflection bit us again.
2338 * support.cs: New file, contains an interface ParameterData and
2339 two implementations: ReflectionParameters and InternalParameters
2340 used to access Parameter information. We will need to grow this
2343 * expression.cs (Invocation::GetParameterData): implement a cache
2344 and a wrapper around the ParameterData creation for methods.
2345 (Invocation::OverloadResolve): Use new code.
2347 2001-09-13 Ravi Pratap <ravi@ximian.com>
2349 * class.cs (TypeContainer::EmitField): Remove and move into
2350 (Field::Define): here and modify accordingly.
2351 (Field.FieldBuilder): New member.
2352 (TypeContainer::Populate): Update accordingly.
2353 (TypeContainer::FindMembers): Implement.
2355 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2357 * statement.cs: (VariableInfo::VariableType): New field to be
2358 initialized with the full type once it is resolved.
2360 2001-09-12 Miguel de Icaza <miguel@ximian.com>
2362 * parameter.cs (GetParameterInfo): Use a type cache to compute
2363 things only once, and to reuse this information
2365 * expression.cs (LocalVariableReference::Emit): Implement.
2366 (OpcodeCast::Emit): fix.
2368 (ParameterReference::Resolve): Implement.
2369 (ParameterReference::Emit): Implement.
2371 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
2372 that are expressions need to stay as Expressions.
2374 * typemanager.cs (CSharpName): Returns the C# name of a type if
2377 * expression.cs (Expression::ConvertImplicit): New function that
2378 implements implicit type conversions.
2380 (Expression::ImplicitReferenceConversion): Implements implicit
2381 reference conversions.
2383 (EmptyCast): New type for transparent casts.
2385 (OpcodeCast): New type for casts of types that are performed with
2386 a sequence of bytecodes.
2388 (BoxedCast): New type used for casting value types into reference
2389 types. Emits a box opcode.
2391 (Binary::DoNumericPromotions): Implements numeric promotions of
2392 and computation of the Binary::Type.
2394 (Binary::EmitBranchable): Optimization.
2396 (Binary::Emit): Implement code emission for expressions.
2398 * typemanager.cs (TypeManager): Added two new core types: sbyte
2401 2001-09-12 Ravi Pratap <ravi@ximian.com>
2403 * class.cs (TypeContainer::FindMembers): Method which does exactly
2404 what Type.FindMembers does, only we don't have to use reflection. No
2407 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
2408 typecontainer objects as we need to get at them.
2409 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
2411 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
2412 typecontainer object.
2414 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
2415 of just a Report object.
2417 2001-09-11 Ravi Pratap <ravi@ximian.com>
2419 * class.cs (Event::Define): Go back to using the prefixes "add_" and
2421 (TypeContainer::Populate): Now define the delegates of the type too.
2422 (TypeContainer.Delegates): Property to access the list of delegates defined
2425 * delegates.cs (Delegate::Define): Implement partially.
2427 * modifiers.cs (TypeAttr): Handle more flags.
2429 2001-09-11 Ravi Pratap <ravi@ximian.com>
2431 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
2433 (Operator::Define): Re-write logic to get types by using the LookupType method
2434 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
2435 (Indexer::Define): Ditto.
2436 (Event::Define): Ditto.
2437 (Property::Define): Ditto.
2439 2001-09-10 Ravi Pratap <ravi@ximian.com>
2441 * class.cs (TypeContainer::Populate): Now define operators too.
2442 (TypeContainer.Operators): New property to access the list of operators
2444 (Operator.OperatorMethodBuilder): New member to hold the method builder
2445 for the operator we are defining.
2446 (Operator::Define): Implement.
2448 2001-09-10 Ravi Pratap <ravi@ximian.com>
2450 * class.cs (Event::Define): Make the prefixes of the accessor methods
2451 addOn_ and removeOn_
2453 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
2454 of the location being passed in too. Ideally, this should go later since all
2455 error reporting should be done through the Report object.
2457 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
2458 (Populate): Iterate thru the indexers we have and define them too.
2459 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
2460 for the get and set accessors.
2461 (Indexer::Define): Implement.
2463 2001-09-09 Miguel de Icaza <miguel@ximian.com>
2465 * expression.cs (Binary::Resolve): Beginning of it. I scratched
2466 my previous implementation, did not work.
2468 * typemanager.cs: Add a couple of missing types (the longs).
2470 * literal.cs: Use TypeManager.bool_type instead of getting it.
2472 * expression.cs (EventExpr): New kind of expressions.
2473 (Expressio::ExprClassFromMemberInfo): finish
2475 2001-09-08 Miguel de Icaza <miguel@ximian.com>
2477 * assign.cs: Emit stores to static fields differently.
2479 2001-09-08 Ravi Pratap <ravi@ximian.com>
2481 * Merge in changes and adjust code to tackle conflicts. Backed out my
2482 code in Assign::Resolve ;-)
2484 2001-09-08 Ravi Pratap <ravi@ximian.com>
2486 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
2487 instead Report.Error and also pass in the location.
2488 (CSharpParser::Lexer): New readonly property to return the reference
2489 to the Tokenizer object.
2490 (declare_local_variables): Use Report.Error with location instead of plain
2494 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
2495 (Operator.CheckBinaryOperator): Ditto.
2497 * cs-parser.jay (operator_declarator): Update accordingly.
2499 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
2500 (CheckBinaryOperator): Same here.
2502 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
2503 on the name without any prefixes of namespace names etc. This is because we
2504 already might have something already fully qualified like
2505 'System.Console.WriteLine'
2507 * assign.cs (Resolve): Begin implementation. Stuck ;-)
2509 2001-09-07 Ravi Pratap <ravi@ximian.com>
2511 * cs-tokenizer.cs (location): Return a string which also contains
2514 * expression.cs (ElementAccess): New class for expressions of the
2515 type 'element access.'
2516 (BaseAccess): New class for expressions of the type 'base access.'
2517 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
2520 * cs-parser.jay (element_access): Implement action.
2521 (base_access): Implement actions.
2522 (checked_expression, unchecked_expression): Implement.
2524 * cs-parser.jay (local_variable_type): Correct and implement.
2525 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
2527 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
2529 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
2530 name and the specifiers.
2532 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
2534 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
2535 making them all public ;-)
2537 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
2540 2001-09-07 Miguel de Icaza <miguel@ximian.com>
2542 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
2544 (FieldExpr, PropertyExprs): New resolved expressions.
2545 (SimpleName::MemberStaticCheck): Perform static checks for access
2546 to non-static fields on static methods. Maybe this should be
2547 generalized for MemberAccesses.
2548 (SimpleName::ResolveSimpleName): More work on simple name
2551 * cs-parser.jay (primary_expression/qualified_identifier): track
2552 the parameter index.
2554 * codegen.cs (CodeGen::Save): Catch save exception, report error.
2555 (EmitContext::EmitBoolExpression): Chain to expression generation
2556 instead of temporary hack.
2557 (::EmitStatementExpression): Put generic expression code generation.
2559 * assign.cs (Assign::Emit): Implement variable assignments to
2560 local variables, parameters and fields.
2562 2001-09-06 Miguel de Icaza <miguel@ximian.com>
2564 * statement.cs (Block::GetVariableInfo): New method, returns the
2565 VariableInfo for a variable name in a block.
2566 (Block::GetVariableType): Implement in terms of GetVariableInfo
2568 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
2569 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
2571 2001-09-06 Ravi Pratap <ravi@ximian.com>
2573 * cs-parser.jay (operator_declaration): Continue on my quest : update
2574 to take attributes argument.
2575 (event_declaration): Ditto.
2576 (enum_declaration): Ditto.
2577 (indexer_declaration): Ditto.
2579 * class.cs (Operator::Operator): Update constructor accordingly.
2580 (Event::Event): Ditto.
2582 * delegate.cs (Delegate::Delegate): Same here.
2584 * enum.cs (Enum::Enum): Same here.
2586 2001-09-05 Ravi Pratap <ravi@ximian.com>
2588 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
2590 * ../tests/cs0658.cs : New file to demonstrate error 0658.
2592 * attribute.cs (Attributes): New class to encapsulate all attributes which were
2593 being passed around as an arraylist.
2594 (Attributes::AddAttribute): Method to add attribute sections.
2596 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
2597 (struct_declaration): Update accordingly.
2598 (constant_declaration): Update.
2599 (field_declaration): Update.
2600 (method_header): Update.
2601 (fixed_parameter): Update.
2602 (parameter_array): Ditto.
2603 (property_declaration): Ditto.
2604 (destructor_declaration): Ditto.
2606 * class.cs (Struct::Struct): Update constructors accordingly.
2607 (Class::Class): Ditto.
2608 (Field::Field): Ditto.
2609 (Method::Method): Ditto.
2610 (Property::Property): Ditto.
2611 (TypeContainer::OptAttribute): update property's return type.
2613 * interface.cs (Interface.opt_attributes): New member.
2614 (Interface::Interface): Update to take the extra Attributes argument.
2616 * parameter.cs (Parameter::Parameter): Ditto.
2618 * constant.cs (Constant::Constant): Ditto.
2620 * interface.cs (InterfaceMemberBase): New OptAttributes field.
2621 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
2622 the attributes as a parameter.
2623 (InterfaceProperty): Update constructor call.
2624 (InterfaceEvent): Ditto.
2625 (InterfaceMethod): Ditto.
2626 (InterfaceIndexer): Ditto.
2628 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
2629 pass the attributes too.
2630 (interface_event_declaration): Ditto.
2631 (interface_property_declaration): Ditto.
2632 (interface_method_declaration): Ditto.
2633 (interface_declaration): Ditto.
2635 2001-09-05 Miguel de Icaza <miguel@ximian.com>
2637 * class.cs (Method::Define): Track the "static Main" definition to
2638 create an entry point.
2640 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
2641 EntryPoint if we find it.
2643 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
2644 (EmitContext::ig): Make this variable public.
2646 * driver.cs: Make the default output file be the first file name
2647 with the .exe extension.
2649 Detect empty compilations
2651 Handle various kinds of output targets. Handle --target and
2652 rename -t to --dumper.
2654 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
2655 methods inherited from Expression return now an Expression. This
2656 will is used during the tree rewriting as we resolve them during
2659 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
2660 the spec. Missing entirely is the information about
2661 accessability of elements of it.
2663 (Expression::ExprClassFromMemberInfo): New constructor for
2664 Expressions that creates a fully initialized Expression based on
2665 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
2668 (Invocation::Resolve): Begin implementing resolution of invocations.
2670 * literal.cs (StringLiteral): Implement Emit.
2672 2001-09-05 Ravi Pratap <ravi@ximian.com>
2674 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
2677 2001-09-04 Ravi Pratap <ravi@ximian.com>
2679 * cs-parser.jay (attribute_arguments): Implement actions.
2680 (attribute): Fix bug in production. Implement action.
2681 (attribute_list): Implement.
2682 (attribute_target): Implement.
2683 (attribute_target_specifier, opt_target_specifier): Implement
2684 (CheckAttributeTarget): New method to check if the attribute target
2686 (attribute_section): Implement.
2687 (opt_attributes): Implement.
2689 * attribute.cs : New file to handle attributes.
2690 (Attribute): Class to hold attribute info.
2692 * cs-parser.jay (opt_attribute_target_specifier): Remove production
2693 (attribute_section): Modify production to use 2 different rules to
2694 achieve the same thing. 1 s/r conflict down !
2695 Clean out commented, useless, non-reducing dimension_separator rules.
2697 * class.cs (TypeContainer.attributes): New member to hold list
2698 of attributes for a type.
2699 (Struct::Struct): Modify to take one more argument, the attribute list.
2700 (Class::Class): Ditto.
2701 (Field::Field): Ditto.
2702 (Method::Method): Ditto.
2703 (Property::Property): Ditto.
2705 * cs-parser.jay (struct_declaration): Update constructor call to
2706 pass in the attributes too.
2707 (class_declaration): Ditto.
2708 (constant_declaration): Ditto.
2709 (field_declaration): Ditto.
2710 (method_header): Ditto.
2711 (fixed_parameter): Ditto.
2712 (parameter_array): Ditto.
2713 (property_declaration): Ditto.
2715 * constant.cs (Constant::Constant): Update constructor similarly.
2716 Use System.Collections.
2718 * parameter.cs (Parameter::Parameter): Update as above.
2720 2001-09-02 Ravi Pratap <ravi@ximian.com>
2722 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
2723 (TypeContainer.delegates): New member to hold list of delegates.
2725 * cs-parser.jay (delegate_declaration): Implement the action correctly
2726 this time as I seem to be on crack ;-)
2728 2001-09-02 Miguel de Icaza <miguel@ximian.com>
2730 * rootcontext.cs (RootContext::IsNamespace): new function, used to
2731 tell whether an identifier represents a namespace.
2733 * expression.cs (NamespaceExpr): A namespace expression, used only
2734 temporarly during expression resolution.
2735 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
2736 utility functions to resolve names on expressions.
2738 2001-09-01 Miguel de Icaza <miguel@ximian.com>
2740 * codegen.cs: Add hook for StatementExpressions.
2742 * class.cs: Fix inverted test for static flag in methods.
2744 2001-09-02 Ravi Pratap <ravi@ximian.com>
2746 * class.cs (Operator::CheckUnaryOperator): Correct error number used
2747 to make it coincide with MS' number.
2748 (Operator::CheckBinaryOperator): Ditto.
2750 * ../errors/errors.txt : Remove error numbers added earlier.
2752 * ../errors/cs1019.cs : Test case for error # 1019
2754 * ../errros/cs1020.cs : Test case for error # 1020
2756 * cs-parser.jay : Clean out commented cruft.
2757 (dimension_separators, dimension_separator): Comment out. Ostensibly not
2758 used anywhere - non-reducing rule.
2759 (namespace_declarations): Non-reducing rule - comment out.
2761 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
2762 with TypeContainer::AddEnum.
2764 * delegate.cs : New file for delegate handling classes.
2765 (Delegate): Class for declaring delegates.
2767 * makefile : Update.
2769 * cs-parser.jay (delegate_declaration): Implement.
2771 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
2773 * class.cs (Event::Define): Implement.
2774 (Event.EventBuilder): New member.
2776 * class.cs (TypeContainer::Populate): Update to define all enums and events
2778 (Events): New property for the events arraylist we hold. Shouldn't we move to using
2779 readonly fields for all these cases ?
2781 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2783 * class.cs (Property): Revamp to use the convention of making fields readonly.
2784 Accordingly modify code elsewhere.
2786 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
2787 the Define method of the Property class.
2789 * class.cs : Clean up applied patch and update references to variables etc. Fix
2791 (TypeContainer::Populate): Update to define all the properties we have. Also
2792 define all enumerations.
2794 * enum.cs (Define): Implement.
2796 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2798 * cs-parser.jay (overloadable_operator): The semantic value is an
2799 enum of the Operator class.
2800 (operator_declarator): Implement actions.
2801 (operator_declaration): Implement.
2803 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
2804 validity of definitions.
2805 (Operator::CheckBinaryOperator): Static method to check for binary operators
2806 (TypeContainer::AddOperator): New method to add an operator to a type.
2808 * cs-parser.jay (indexer_declaration): Added line to actually call the
2809 AddIndexer method so it gets added ;-)
2811 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
2812 already taken care of by the MS compiler ?
2814 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2816 * class.cs (Operator): New class for operator declarations.
2817 (Operator::OpType): Enum for the various operators.
2819 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2821 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
2822 ostensibly handle this in semantic analysis.
2824 * cs-parser.jay (general_catch_clause): Comment out
2825 (specific_catch_clauses, specific_catch_clause): Ditto.
2826 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
2827 (catch_args, opt_catch_args): New productions.
2828 (catch_clause): Rewrite to use the new productions above
2829 (catch_clauses): Modify accordingly.
2830 (opt_catch_clauses): New production to use in try_statement
2831 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
2832 and re-write the code in the actions to extract the specific and
2833 general catch clauses by being a little smart ;-)
2835 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
2836 Hooray, try and catch statements parse fine !
2838 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2840 * statement.cs (Block::GetVariableType): Fix logic to extract the type
2841 string from the hashtable of variables.
2843 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
2844 I end up making that mistake ;-)
2845 (catch_clauses): Fixed gross error which made Key and Value of the
2846 DictionaryEntry the same : $1 !!
2848 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2850 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2852 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2853 when the add and remove accessors are specified.
2855 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2857 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2858 information about indexer_declarator.
2859 (indexer_declarator): Implement actions.
2860 (parsing_indexer): New local boolean used to keep track of whether
2861 we are parsing indexers or properties. This is necessary because
2862 implicit_parameters come into picture even for the get accessor in the
2864 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2866 * class.cs (Indexer): New class for indexer declarations.
2867 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2868 (TypeContainer::indexers): New member to hold list of indexers for the
2871 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2873 * cs-parser.jay (add_accessor_declaration): Implement action.
2874 (remove_accessor_declaration): Implement action.
2875 (event_accessors_declaration): Implement
2876 (variable_declarators): swap statements for first rule - trivial.
2878 * class.cs (Event): New class to hold information about event
2880 (TypeContainer::AddEvent): New method to add an event to a type
2881 (TypeContainer::events): New member to hold list of events.
2883 * cs-parser.jay (event_declaration): Implement actions.
2885 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2887 * cs-parser.jay (dim_separators): Implement. Make it a string
2888 concatenating all the commas together, just as they appear.
2889 (opt_dim_separators): Modify accordingly
2890 (rank_specifiers): Update accordingly. Basically do the same
2891 thing - instead, collect the brackets here.
2892 (opt_rank_sepcifiers): Modify accordingly.
2893 (array_type): Modify to actually return the complete type string
2894 instead of ignoring the rank_specifiers.
2895 (expression_list): Implement to collect the expressions
2896 (variable_initializer): Implement. We make it a list of expressions
2897 essentially so that we can handle the array_initializer case neatly too.
2898 (variable_initializer_list): Implement.
2899 (array_initializer): Make it a list of variable_initializers
2900 (opt_array_initializer): Modify accordingly.
2902 * expression.cs (New::NType): Add enumeration to help us
2903 keep track of whether we have an object/delegate creation
2904 or an array creation.
2905 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2906 members to hold data about array creation.
2907 (New:New): Modify to update NewType
2908 (New:New): New Overloaded contructor for the array creation
2911 * cs-parser.jay (array_creation_expression): Implement to call
2912 the overloaded New constructor.
2914 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2916 * class.cs (TypeContainer::Constructors): Return member
2917 constructors instead of returning null.
2919 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2921 * typemanager.cs (InitCoreTypes): Initialize the various core
2922 types after we have populated the type manager with the user
2923 defined types (this distinction will be important later while
2924 compiling corlib.dll)
2926 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2927 on Expression Classification. Now all expressions have a method
2928 `Resolve' and a method `Emit'.
2930 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2931 generation from working. Also add some temporary debugging
2934 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2936 * codegen.cs: Lots of code generation pieces. This is only the
2937 beginning, will continue tomorrow with more touches of polish. We
2938 handle the fundamentals of if, while, do, for, return. Others are
2939 trickier and I need to start working on invocations soon.
2941 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2944 * codegen.cs (EmitContext): New struct, used during code
2945 emission to keep a context. Most of the code generation will be
2948 * cs-parser.jay: Add embedded blocks to the list of statements of
2949 this block. So code generation proceeds in a top down fashion.
2951 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2953 * statement.cs: Add support for multiple child blocks.
2955 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2957 * codegen.cs (EmitCode): New function, will emit the code for a
2958 Block of code given a TypeContainer and its ILGenerator.
2960 * statement.cs (Block): Standard public readonly optimization.
2961 (Block::Block constructors): Link children.
2962 (Block::Child): Child Linker.
2963 (Block::EmitVariables): Emits IL variable declarations.
2965 * class.cs: Drop support for MethodGroups here, delay until
2967 (Method::): Applied the same simplification that I did before, and
2968 move from Properties to public readonly fields.
2969 (Method::ParameterTypes): Returns the parameter types for the
2970 function, and implements a cache that will be useful later when I
2971 do error checking and the semantic analysis on the methods is
2973 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2974 and made a method, optional argument tells whether this is a class
2975 or a structure to apply the `has-this' bit.
2976 (Method::GetCallingConvention): Implement, returns the calling
2978 (Method::Define): Defines the type, a second pass is performed
2979 later to populate the methods.
2981 (Constructor::ParameterTypes): implement a cache similar to the
2982 one on Method::ParameterTypes, useful later when we do semantic
2985 (TypeContainer::EmitMethod): New method. Emits methods.
2987 * expression.cs: Removed MethodGroup class from here.
2989 * parameter.cs (Parameters::GetCallingConvention): new method.
2991 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2993 * class.cs (TypeContainer::Populate): Drop RootContext from the
2996 (Constructor::CallingConvention): Returns the calling convention.
2997 (Constructor::ParameterTypes): Returns the constructor parameter
3000 (TypeContainer::AddConstructor): Keep track of default constructor
3001 and the default static constructor.
3003 (Constructor::) Another class that starts using `public readonly'
3004 instead of properties.
3006 (Constructor::IsDefault): Whether this is a default constructor.
3008 (Field::) use readonly public fields instead of properties also.
3010 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
3011 track of static constructors; If none is used, turn on
3012 BeforeFieldInit in the TypeAttributes.
3014 * cs-parser.jay (opt_argument_list): now the return can be null
3015 for the cases where there are no arguments.
3017 (constructor_declarator): If there is no implicit `base' or
3018 `this', then invoke the default parent constructor.
3020 * modifiers.cs (MethodAttr): New static function maps a set of
3021 modifiers flags into a MethodAttributes enum
3022 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
3023 MethodAttr, TypeAttr to represent the various mappings where the
3025 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
3027 2001-08-19 Miguel de Icaza <miguel@ximian.com>
3029 * parameter.cs (GetParameterInfo): Fix bug where there would be no
3032 * interface.cs (PopulateIndexer): Implemented the code generator
3033 for interface indexers.
3035 2001-08-17 Miguel de Icaza <miguel@ximian.com>
3037 * interface.cs (InterfaceMemberBase): Now we track the new status
3040 (PopulateProperty): Implement property population. Woohoo! Got
3041 Methods and Properties going today.
3043 Removed all the properties for interfaces, and replaced them with
3044 `public readonly' fields.
3046 2001-08-16 Miguel de Icaza <miguel@ximian.com>
3048 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
3049 initialize their hashtables/arraylists only when they are needed
3050 instead of doing this always.
3052 * parameter.cs: Handle refs and out parameters.
3054 * cs-parser.jay: Use an ArrayList to construct the arguments
3055 instead of the ParameterCollection, and then cast that to a
3058 * parameter.cs: Drop the use of ParameterCollection and use
3059 instead arrays of Parameters.
3061 (GetParameterInfo): Use the Type, not the Name when resolving
3064 2001-08-13 Miguel de Icaza <miguel@ximian.com>
3066 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
3067 and instead use public readonly fields.
3069 * class.cs: Put back walking code for type containers.
3071 2001-08-11 Miguel de Icaza <miguel@ximian.com>
3073 * class.cs (MakeConstant): Code to define constants.
3075 * rootcontext.cs (LookupType): New function. Used to locate types
3078 2001-08-08 Miguel de Icaza <miguel@ximian.com>
3080 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
3081 this System.Reflection code is. Kudos to Microsoft
3083 * typemanager.cs: Implement a type cache and avoid loading all
3084 types at boot time. Wrap in LookupType the internals. This made
3085 the compiler so much faster. Wow. I rule!
3087 * driver.cs: Make sure we always load mscorlib first (for
3088 debugging purposes, nothing really important).
3090 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
3091 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
3093 * rootcontext.cs: Lookup types on their namespace; Lookup types
3094 on namespaces that have been imported using the `using' keyword.
3096 * class.cs (TypeContainer::TypeAttr): Virtualize.
3097 (Class::TypeAttr): Return attributes suitable for this bad boy.
3098 (Struct::TypeAttr): ditto.
3099 Handle nested classes.
3100 (TypeContainer::) Remove all the type visiting code, it is now
3101 replaced with the rootcontext.cs code
3103 * rootcontext.cs (GetClassBases): Added support for structs.
3105 2001-08-06 Miguel de Icaza <miguel@ximian.com>
3107 * interface.cs, statement.cs, class.cs, parameter.cs,
3108 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
3109 Drop use of TypeRefs, and use strings instead.
3111 2001-08-04 Miguel de Icaza <miguel@ximian.com>
3115 * class.cs (Struct::Struct): set the SEALED flags after
3116 checking the modifiers.
3117 (TypeContainer::TypeAttr): new property, returns the
3118 TypeAttributes for a class.
3120 * cs-parser.jay (type_list): Oops, list production was creating a
3121 new list of base types.
3123 * rootcontext.cs (StdLib): New property.
3124 (GetInterfaceTypeByName): returns an interface by type name, and
3125 encapsulates error handling here.
3126 (GetInterfaces): simplified.
3127 (ResolveTree): Encapsulated all the tree resolution here.
3128 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
3131 * driver.cs: Add support for --nostdlib, to avoid loading the
3133 (Main): Do not put tree resolution here.
3135 * rootcontext.cs: Beginning of the class resolution.
3137 2001-08-03 Miguel de Icaza <miguel@ximian.com>
3139 * rootcontext.cs: Provide better error reporting.
3141 * cs-parser.jay (interface_base): set our $$ to be interfaces.
3143 * rootcontext.cs (CreateInterface): Handle the case where there
3144 are no parent interfaces.
3146 (CloseTypes): Routine to flush types at the end.
3147 (CreateInterface): Track types.
3148 (GetInterfaces): Returns an array of Types from the list of
3151 * typemanager.c (AddUserType): Mechanism to track user types (puts
3152 the type on the global type hash, and allows us to close it at the
3155 2001-08-02 Miguel de Icaza <miguel@ximian.com>
3157 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
3158 RecordInterface instead.
3160 * cs-parser.jay: Updated to reflect changes above.
3162 * decl.cs (Definition): Keep track of the TypeBuilder type that
3163 represents this type here. Not sure we will use it in the long
3164 run, but wont hurt for now.
3166 * driver.cs: Smaller changes to accomodate the new code.
3168 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
3171 * rootcontext.cs (CreateInterface): New method, used to create
3172 the System.TypeBuilder type for interfaces.
3173 (ResolveInterfaces): new entry point to resolve the interface
3175 (CodeGen): Property, used to keep track of the code generator.
3177 2001-07-26 Miguel de Icaza <miguel@ximian.com>
3179 * cs-parser.jay: Add a second production for delegate_declaration
3182 (enum_body): Put an opt_comma here instead of putting it on
3183 enum_body or enum_member_declarations so we can handle trailing
3184 commas on enumeration members. Gets rid of a shift/reduce.
3186 (type_list): Need a COMMA in the middle.
3188 (indexer_declaration): Tell tokenizer to recognize get/set
3190 * Remove old targets.
3192 * Re-add the parser target.
3194 2001-07-13 Simon Cozens <simon@simon-cozens.org>
3196 * cs-parser.jay: Add precendence rules for a number of operators
3197 ot reduce the number of shift/reduce conflicts in the grammar.
3199 2001-07-17 Miguel de Icaza <miguel@ximian.com>
3201 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
3204 Get rid of old crufty code.
3206 * rootcontext.cs: Use this to keep track of the parsed
3207 representation and the defined types available to the program.
3209 * gen-treedump.cs: adjust for new convention.
3211 * type.cs: Split out the type manager, and the assembly builder
3214 * typemanager.cs: the type manager will live here now.
3216 * cil-codegen.cs: And the code generator here.
3218 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
3220 * makefile: Fixed up for easy making.
3222 2001-07-13 Simon Cozens <simon@simon-cozens.org>
3224 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
3227 (unary_expression): Expand pre_increment_expression and
3228 post_decrement_expression to reduce a shift/reduce.
3230 2001-07-11 Simon Cozens
3232 * cs-tokenizer.cs: Hex numbers should begin with a 0.
3234 Improve allow_keyword_as_indent name.
3236 2001-06-19 Miguel de Icaza <miguel@ximian.com>
3238 * Adjustments for Beta2.
3240 2001-06-13 Miguel de Icaza <miguel@ximian.com>
3242 * decl.cs: Added `Define' abstract method.
3243 (InTransit): new property, used to catch recursive definitions.
3245 * interface.cs: Implement `Define'.
3247 * modifiers.cs: Map Modifiers.constants to
3248 System.Reflection.TypeAttribute flags.
3250 * class.cs: Keep track of types and user-defined types.
3251 (BuilderInit): New method for creating an assembly
3252 (ResolveType): New function to launch the resolution process, only
3253 used by interfaces for now.
3255 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
3256 that are inserted into the name space.
3258 2001-06-08 Miguel de Icaza <miguel@ximian.com>
3260 * ARGH. I have screwed up my tree so many times due to the use of
3261 rsync rather than using CVS. Going to fix this at once.
3263 * driver.cs: Objetify driver. Load assemblies, use assemblies to
3266 2001-06-07 Miguel de Icaza <miguel@ximian.com>
3268 * Experiment successful: Use System.Type rather that our own
3271 2001-05-25 Miguel de Icaza <miguel@ximian.com>
3273 * cs-parser.jay: Removed nsAliases from here.
3275 Use new namespaces, handle `using XXX;'
3277 * namespace.cs: Reimplemented namespace handling, use a recursive
3278 definition of the class. Now we can keep track of using clauses
3279 and catch invalid using clauses.
3281 2001-05-24 Miguel de Icaza <miguel@ximian.com>
3283 * gen-treedump.cs: Adapted for all the renaming.
3285 * expression.cs (Expression): this class now has a Type property
3286 which returns an expression Type.
3288 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
3289 `Type', as this has a different meaning now in the base
3291 2001-05-22 Miguel de Icaza <miguel@ximian.com>
3293 * interface.cs, class.cs: Removed from all the sources the
3294 references to signature computation, as we can not do method
3295 signature computation during the parsing time, as we are not
3296 trying to solve at that point distinguishing:
3300 void a (NS.Blah x) {}
3303 Which depending on the context might be valid or not, as we do not
3304 know if Blah is the same thing as NS.Blah at that point.
3306 * Redid everything so the code uses TypeRefs now instead of
3307 Types. TypeRefs are just temporary type placeholders, that need
3308 to be resolved. They initially have a pointer to a string and the
3309 current scope in which they are used. This is used later by the
3310 compiler to resolve the reference to an actual Type.
3312 * DeclSpace is no longer a CIR.Type, and neither are
3313 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
3314 are all DeclSpaces, but no Types.
3316 * type.cs (TypeRefManager): This implements the TypeRef manager,
3317 which keeps track of all the types that need to be resolved after
3318 the parsing has finished.
3320 2001-05-13 Miguel de Icaza <miguel@ximian.com>
3322 * ARGH. We are going to have to store `foreach' as a class rather
3323 than resolving it, as we need to verify error 1579 after name
3324 resolution. *OR* we could keep a flag that says `This request to
3325 IEnumerator comes from a foreach statement' which we can then use
3326 to generate the error.
3328 2001-05-10 Miguel de Icaza <miguel@ximian.com>
3330 * class.cs (TypeContainer.AddMethod): we now add methods to the
3331 MethodGroup instead of the method hashtable.
3333 * expression.cs: Add MethodGroup abstraction, which gets us one
3334 step closer to the specification in the way we handle method
3337 * cs-parser.jay (primary_expression): qualified_identifier now
3338 tried to match up an identifier to a local variable reference or
3339 to a parameter reference.
3341 current_local_parameters is now a parser global variable that
3342 points to the current parameters for the block, used during name
3345 (property_declaration): Now creates an implicit `value' argument to
3348 2001-05-09 Miguel de Icaza <miguel@ximian.com>
3350 * parameter.cs: Do not use `param' arguments as part of the
3351 signature, per the spec.
3353 2001-05-08 Miguel de Icaza <miguel@ximian.com>
3355 * decl.cs: Base class for classes, structs and interfaces. This
3356 is the "Declaration Space"
3358 * cs-parser.jay: Use CheckDef for checking declaration errors
3359 instead of having one on each function.
3361 * class.cs: Factor out some code for handling error handling in
3362 accordance to the "Declarations" section in the "Basic Concepts"
3363 chapter in the ECMA C# spec.
3365 * interface.cs: Make all interface member classes derive from
3366 InterfaceMemberBase.
3368 2001-05-07 Miguel de Icaza <miguel@ximian.com>
3370 * Many things: all interfaces are parsed and generated in
3371 gen-treedump. Support for member variables, constructors,
3372 destructors, properties, constants is there.
3374 Beginning of the IL backend, but very little done, just there for
3377 2001-04-29 Miguel de Icaza <miguel@ximian.com>
3379 * cs-parser.jay: Fix labeled statement.
3381 * cs-tokenizer.cs (escape): Escape " and ' always.
3382 ref_line, ref_name: keep track of the line/filename as instructed
3383 by #line by the compiler.
3386 2001-04-27 Miguel de Icaza <miguel@ximian.com>
3388 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
3389 to match the values in System.CodeDOM.
3391 Divid renamed to Divide.
3393 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
3395 (Statements.set): remove.
3397 * System.CodeDOM/CodeCatchClause.cs: always have a valid
3400 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
3401 falseStatements always have valid values.
3403 * cs-parser.jay: Use System.CodeDOM now.