1 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3 * cs-parser.jay: A for_initializer if is a
4 local_variable_declaration really ammount to have an implicit
5 block with the variable declaration and no initializer for for.
7 * statement.cs (For.Emit): Cope with null initializers.
9 This fixes the infinite loop on for initializers.
11 2001-11-08 Miguel de Icaza <miguel@ximian.com>
13 * enum.cs: More cleanup.
15 * ecore.cs: Remove dead code.
17 * class.cs (Property.Emit): More simplification.
20 Reworked to have less levels of indentation.
22 2001-11-08 Ravi Pratap <ravi@ximian.com>
24 * class.cs (Property): Emit attributes.
34 * enum.cs (Emit): Ditto.
36 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
39 * class.cs (Field, Event, etc.): Move attribute generation into the
40 Emit method everywhere.
42 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
43 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
44 as we had no way of defining nested enums !
46 * rootcontext.cs : Adjust code accordingly.
48 * typemanager.cs (AddEnumType): To keep track of enum types separately.
50 2001-11-07 Ravi Pratap <ravi@ximian.com>
52 * expression.cs (EvalConstantExpression): Move into ecore.cs
54 * enum.cs (Enum): Rename some members and make them public and readonly
55 according to our convention.
57 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
60 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
62 (Enum::Emit): Write a simple version for now which doesn't try to compute
63 expressions. I shall modify this to be more robust in just a while.
65 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
67 (TypeContainer::CloseType): Create the Enum types too.
69 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
71 * expression.cs (EvalConstantExpression): Get rid of completely.
73 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
74 user-defined values and other cases.
76 (IsValidEnumLiteral): Helper function.
78 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
79 out there in the case we had a literal FieldExpr.
81 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
83 (Literalize): Revamp a bit to take two arguments.
85 (EnumLiteral): New class which derives from Literal to wrap enum literals.
87 2001-11-06 Ravi Pratap <ravi@ximian.com>
89 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
91 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
93 (Resolve): Use the above to ensure we have proper initializers.
95 2001-11-05 Ravi Pratap <ravi@ximian.com>
97 * expression.cs (Expression::EvalConstantExpression): New method to
98 evaluate constant expressions.
100 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
102 2001-11-07 Miguel de Icaza <miguel@ximian.com>
104 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
107 (Binary.ResolveOperator): Handle operator != (object a, object b)
108 and operator == (object a, object b);
110 (Binary.DoNumericPromotions): Indicate whether the numeric
111 promotion was possible.
113 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
116 Made the ArrayAccess implement interface IAssignMethod instead of
117 IStackStore as the order in which arguments are passed reflects
120 * assign.cs: Instead of using expr.ExprClass to select the way of
121 assinging, probe for the IStackStore/IAssignMethod interfaces.
123 * typemanager.cs: Load InitializeArray definition.
125 * rootcontext.cs (RootContext.MakeStaticData): Used to define
126 static data that can be used to initialize arrays.
128 2001-11-05 Miguel de Icaza <miguel@ximian.com>
130 * expression.cs: Handle operator== and operator!= for booleans.
132 (Conditioal.Reduce): Implement reducer for the ?: operator.
134 (Conditional.Resolve): Implement dead code elimination.
136 (Binary.Resolve): Catch string literals and return a new
139 (Unary.Reduce): Implement reduction of unary expressions.
141 * ecore.cs: Split out the expression core handling here.
143 (Expression.Reduce): New method used to perform constant folding
144 and CSE. This is needed to support constant-expressions.
146 * statement.cs (Statement.EmitBoolExpression): Pass true and false
147 targets, and optimize for !x.
149 2001-11-04 Ravi Pratap <ravi@ximian.com>
151 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
152 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
153 set custom atttributes.
155 * literal.cs (Literal::GetValue): New abstract method to return the actual
156 value of the literal, cast as an object.
158 (*Literal): Implement GetValue method.
160 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
161 expressions to the arraylist but objects of type Argument.
163 * class.cs (TypeContainer::Emit): Emit our attributes too.
165 (Method::Emit, Constructor::Emit): Ditto.
167 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
168 to be ignoring earlier.
170 2001-11-03 Ravi Pratap <ravi@ximian.com>
172 * attribute.cs (AttributeSection::Define): Implement to do the business
173 of constructing a CustomAttributeBuilder.
175 (Attribute): New trivial class. Increases readability of code.
177 * cs-parser.jay : Update accordingly.
179 (positional_argument_list, named_argument_list, named_argument): New rules
181 (attribute_arguments): Use the above so that we are more correct.
183 2001-11-02 Ravi Pratap <ravi@ximian.com>
185 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
186 to perform all checks for a method with a params parameter.
188 (Invocation::OverloadResolve): Update to use the above method and therefore
189 cope correctly with params method invocations.
191 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
194 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
195 constructors in our parent too because we can't afford to miss out on
198 * attribute.cs (AttributeSection): New name for the class Attribute
200 Other trivial changes to improve readability.
202 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
203 use the new class names.
205 2001-11-01 Ravi Pratap <ravi@ximian.com>
207 * class.cs (Method::Define): Complete definition for params types too
209 (Indexer::Define): Ditto.
211 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
212 Cope everywhere with a request for info about the array parameter.
214 2001-11-01 Ravi Pratap <ravi@ximian.com>
216 * tree.cs (RecordNamespace): Fix up to check for the correct key.
218 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
219 local_variable_type to extract the string corresponding to the type.
221 (local_variable_type): Fixup the action to use the new helper method.
223 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
226 * expression.cs : Clean out code which uses the above.
228 2001-10-31 Ravi Pratap <ravi@ximian.com>
230 * typemanager.cs (RegisterMethod): Check if we already have an existing key
231 and bale out if necessary by returning a false.
233 (RegisterProperty): Ditto.
235 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
236 and print out appropriate error messages.
238 * interface.cs (everywhere): Ditto.
240 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
241 location to constructor.
243 * class.cs (Property, Event, Indexer): Update accordingly.
245 * ../errors/cs111.cs : Added.
247 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
248 of a method, as laid down by the spec.
250 (Invocation::OverloadResolve): Use the above method.
252 2001-10-31 Ravi Pratap <ravi@ximian.com>
254 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
255 now take a TypeContainer and a Parameters object.
257 (ParameterData): Modify return type of ParameterModifier method to be
258 Parameter.Modifier and not a string.
260 (ReflectionParameters, InternalParameters): Update accordingly.
262 * expression.cs (Argument::GetParameterModifier): Same here.
264 * support.cs (InternalParameters::ParameterType): Find a better way of determining
265 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
266 symbol in it at all so maybe this is only for now.
268 2001-10-30 Ravi Pratap <ravi@ximian.com>
270 * support.cs (InternalParameters): Constructor now takes an extra argument
271 which is the actual Parameters class.
273 (ParameterDesc): Update to provide info on ref/out modifiers.
275 * class.cs (everywhere): Update call to InternalParameters to pass in
276 the second argument too.
278 * support.cs (ParameterData): Add ParameterModifier, which is a method
279 to return the modifier info [ref/out etc]
281 (InternalParameters, ReflectionParameters): Implement the above.
283 * expression.cs (Argument::ParameterModifier): Similar function to return
284 info about the argument's modifiers.
286 (Invocation::OverloadResolve): Update to take into account matching modifiers
289 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
290 a new SetFormalParameters object which we pass to InternalParameters.
292 2001-10-30 Ravi Pratap <ravi@ximian.com>
294 * expression.cs (NewArray): Merge into the ArrayCreation class.
296 2001-10-29 Ravi Pratap <ravi@ximian.com>
298 * expression.cs (NewArray): Merge classes NewBuiltinArray and
299 NewUserdefinedArray into one as there wasn't much of a use in having
302 * expression.cs (Argument): Change field's name to ArgType from Type.
304 (Type): New readonly property which returns the proper type, taking into
305 account ref/out modifiers.
307 (everywhere): Adjust code accordingly for the above.
309 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
310 whether we are emitting for a ref or out parameter.
312 * expression.cs (Argument::Emit): Use the above field to set the state.
314 (LocalVariableReference::Emit): Update to honour the flag and emit the
317 * parameter.cs (Attributes): Set the correct flags for ref parameters.
319 * expression.cs (Argument::FullDesc): New function to provide a full desc.
321 * support.cs (ParameterData): Add method ParameterDesc to the interface.
323 (ReflectionParameters, InternalParameters): Implement the above method.
325 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
328 (Invocation::FullMethodDesc): Ditto.
330 2001-10-29 Miguel de Icaza <miguel@ximian.com>
332 * cs-parser.jay: Add extra production for the second form of array
335 * expression.cs (ArrayCreation): Update to reflect the above
338 * Small changes to prepare for Array initialization.
340 2001-10-28 Miguel de Icaza <miguel@ximian.com>
342 * typemanager.cs (ImplementsInterface): interface might be null;
343 Deal with this problem;
345 Also, we do store negative hits on the cache (null values), so use
346 this instead of calling t.GetInterfaces on the type everytime.
348 2001-10-28 Ravi Pratap <ravi@ximian.com>
350 * typemanager.cs (IsBuiltinType): New method to help determine the same.
352 * expression.cs (New::DoResolve): Get rid of array creation code and instead
353 split functionality out into different classes.
355 (New::FormArrayType): Move into NewBuiltinArray.
357 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
360 (NewBuiltinArray): New class to handle creation of built-in arrays.
362 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
363 account creation of one-dimensional arrays.
365 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
367 (NewUserdefinedArray::DoResolve): Implement.
369 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
371 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
372 we maintain inside the TypeManager. This is necessary to perform lookups on the
375 (LookupType): Update to perform GetType on the module builders too.
377 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
379 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
381 2001-10-23 Ravi Pratap <ravi@ximian.com>
383 * expression.cs (New::DoResolve): Implement guts of array creation.
385 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
387 2001-10-27 Miguel de Icaza <miguel@ximian.com>
389 * expression.cs: Fix bug I introduced lsat night that broke
392 (Expression.Resolve): Report a 246 error (can not resolve name)
393 if we find a SimpleName in the stream.
395 (Expression.ResolveLValue): Ditto.
397 (Expression.ResolveWithSimpleName): This function is a variant of
398 ResolveName, this one allows SimpleNames to be returned without a
399 warning. The only consumer of SimpleNames is MemberAccess
401 2001-10-26 Miguel de Icaza <miguel@ximian.com>
403 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
404 might arrive here. I have my doubts that this is correct.
406 * statement.cs (Lock): Implement lock statement.
408 * cs-parser.jay: Small fixes to support `lock' and `using'
410 * cs-tokenizer.cs: Remove extra space
412 * driver.cs: New flag --checked, allows to turn on integer math
415 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
416 Threading.Monitor.Exit
418 2001-10-23 Miguel de Icaza <miguel@ximian.com>
420 * expression.cs (IndexerAccess::DoResolveLValue): Set the
421 Expression Class to be IndexerAccess.
423 Notice that Indexer::DoResolve sets the eclass to Value.
425 2001-10-22 Miguel de Icaza <miguel@ximian.com>
427 * class.cs (TypeContainer::Emit): Emit code for indexers.
429 * assign.cs (IAssignMethod): New interface implemented by Indexers
430 and Properties for handling assignment.
432 (Assign::Emit): Simplify and reuse code.
434 * expression.cs (IndexerAccess, PropertyExpr): Implement
435 IAssignMethod, clean up old code.
437 2001-10-22 Ravi Pratap <ravi@ximian.com>
439 * typemanager.cs (ImplementsInterface): New method to determine if a type
440 implements a given interface. Provides a nice cache too.
442 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
445 (ConvertReferenceExplicit): Ditto.
447 * delegate.cs (Delegate::Populate): Update to define the parameters on the
448 various methods, with correct names etc.
450 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
451 Operator.UnaryNegation.
453 * cs-parser.jay (operator_declarator): Be a little clever in the case where
454 we have a unary plus or minus operator.
456 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
459 * everywhere : update accordingly.
461 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
464 * class.cs (Method::Define): For the case where we are implementing a method
465 inherited from an interface, we need to set the MethodAttributes.Final flag too.
466 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
468 2001-10-21 Ravi Pratap <ravi@ximian.com>
470 * interface.cs (FindMembers): Implement to work around S.R.E
473 * typemanager.cs (IsInterfaceType): Implement.
475 (FindMembers): Update to handle interface types too.
477 * expression.cs (ImplicitReferenceConversion): Re-write bits which
478 use IsAssignableFrom as that is not correct - it doesn't work.
480 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
481 and accordingly override EmitStatement.
483 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
484 using the correct logic :-)
486 2001-10-19 Ravi Pratap <ravi@ximian.com>
488 * ../errors/cs-11.cs : Add to demonstrate error -11
490 2001-10-17 Miguel de Icaza <miguel@ximian.com>
492 * assign.cs (Assign::Resolve): Resolve right hand side first, and
493 then pass this as a hint to ResolveLValue.
495 * expression.cs (FieldExpr): Add Location information
497 (FieldExpr::LValueResolve): Report assignment to readonly
500 (Expression::ExprClassFromMemberInfo): Pass location information.
502 (Expression::ResolveLValue): Add new method that resolves an
505 (Expression::DoResolveLValue): Default invocation calls
508 (Indexers): New class used to keep track of indexers in a given
511 (IStackStore): Renamed from LValue, as it did not really describe
512 what this did. Also ResolveLValue is gone from this interface and
513 now is part of Expression.
515 (ElementAccess): Depending on the element access type
517 * typemanager.cs: Add `indexer_name_type' as a Core type
518 (System.Runtime.CompilerServices.IndexerNameAttribute)
520 * statement.cs (Goto): Take a location.
522 2001-10-18 Ravi Pratap <ravi@ximian.com>
524 * delegate.cs (Delegate::VerifyDelegate): New method to verify
525 if two delegates are compatible.
527 (NewDelegate::DoResolve): Update to take care of the case when
528 we instantiate a delegate from another delegate.
530 * typemanager.cs (FindMembers): Don't even try to look up members
531 of Delegate types for now.
533 2001-10-18 Ravi Pratap <ravi@ximian.com>
535 * delegate.cs (NewDelegate): New class to take care of delegate
538 * expression.cs (New): Split the delegate related code out into
539 the NewDelegate class.
541 * delegate.cs (DelegateInvocation): New class to handle delegate
544 * expression.cs (Invocation): Split out delegate related code into
545 the DelegateInvocation class.
547 2001-10-17 Ravi Pratap <ravi@ximian.com>
549 * expression.cs (New::DoResolve): Implement delegate creation fully
550 and according to the spec.
552 (New::DoEmit): Update to handle delegates differently.
554 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
555 because of which we were printing out arguments in reverse order !
557 * delegate.cs (VerifyMethod): Implement to check if the given method
558 matches the delegate.
560 (FullDelegateDesc): Implement.
562 (VerifyApplicability): Implement.
564 * expression.cs (Invocation::DoResolve): Update to accordingly handle
565 delegate invocations too.
567 (Invocation::Emit): Ditto.
569 * ../errors/cs1593.cs : Added.
571 * ../errors/cs1594.cs : Added.
573 * delegate.cs (InstanceExpression, TargetMethod): New properties.
575 2001-10-16 Ravi Pratap <ravi@ximian.com>
577 * typemanager.cs (intptr_type): Core type for System.IntPtr
579 (InitCoreTypes): Update for the same.
581 (iasyncresult_type, asynccallback_type): Ditto.
583 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
586 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
589 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
590 the builders for the 4 members of a delegate type :-)
592 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
595 * expression.cs (New::DoResolve): Implement guts for delegate creation.
597 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
599 2001-10-15 Miguel de Icaza <miguel@ximian.com>
601 * statement.cs (Break::Emit): Implement.
602 (Continue::Emit): Implement.
604 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
605 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
606 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
607 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
610 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
611 properties that track the label for the current loop (begin of the
612 loop and end of the loop).
614 2001-10-15 Ravi Pratap <ravi@ximian.com>
616 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
617 use of emitting anything at all.
619 * class.cs, rootcontext.cs : Get rid of calls to the same.
621 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
623 (Populate): Define the constructor correctly and set the implementation
626 * typemanager.cs (delegate_types): New hashtable to hold delegates that
629 (AddDelegateType): Implement.
631 (IsDelegateType): Implement helper method.
633 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
635 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
636 and accordingly handle it.
638 * delegate.cs (Populate): Take TypeContainer argument.
639 Implement bits to define the Invoke method. However, I still haven't figured out
640 how to take care of the native int bit :-(
642 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
643 Qualify the name of the delegate, not its return type !
645 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
648 (StandardConversionExists): Checking for array types turns out to be recursive.
650 (ConvertReferenceExplicit): Implement array conversion.
652 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
654 2001-10-12 Ravi Pratap <ravi@ximian.com>
656 * cs-parser.jay (delegate_declaration): Store the fully qualified
657 name as it is a type declaration.
659 * delegate.cs (ReturnType, Name): Rename members to these. Make them
662 (DefineDelegate): Renamed from Define. Does the same thing essentially,
663 as TypeContainer::DefineType.
665 (Populate): Method in which all the definition of the various methods (Invoke)
668 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
671 (CloseDelegate): Finally creates the delegate.
673 * class.cs (TypeContainer::DefineType): Update to define delegates.
674 (Populate, Emit and CloseType): Do the same thing here too.
676 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
677 delegates in all these operations.
679 2001-10-14 Miguel de Icaza <miguel@ximian.com>
681 * expression.cs: LocalTemporary: a new expression used to
682 reference a temporary that has been created.
684 * assign.cs: Handle PropertyAccess back here, so that we can
685 provide the proper semantic access to properties.
687 * expression.cs (Expression::ConvertReferenceExplicit): Implement
688 a few more explicit conversions.
690 * modifiers.cs: `NEW' modifier maps to HideBySig.
692 * expression.cs (PropertyExpr): Make this into an
693 ExpressionStatement, and support the EmitStatement code path.
695 Perform get/set error checking, clean up the interface.
697 * assign.cs: recognize PropertyExprs as targets, and if so, turn
698 them into toplevel access objects.
700 2001-10-12 Miguel de Icaza <miguel@ximian.com>
702 * expression.cs: PropertyExpr::PropertyExpr: use work around the
705 * typemanager.cs: Keep track here of our PropertyBuilders again to
706 work around lameness in SRE.
708 2001-10-11 Miguel de Icaza <miguel@ximian.com>
710 * expression.cs (LValue::LValueResolve): New method in the
711 interface, used to perform a second resolution pass for LValues.
713 (This::DoResolve): Catch the use of this in static methods.
715 (This::LValueResolve): Implement.
717 (This::Store): Remove warning, assigning to `this' in structures
720 (Invocation::Emit): Deal with invocation of
721 methods on value types. We need to pass the address to structure
722 methods rather than the object itself. (The equivalent code to
723 emit "this" for structures leaves the entire structure on the
724 stack instead of a pointer to it).
726 (ParameterReference::DoResolve): Compute the real index for the
727 argument based on whether the method takes or not a `this' pointer
728 (ie, the method is static).
730 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
731 value types returned from functions when we need to invoke a
732 method on the sturcture.
735 2001-10-11 Ravi Pratap <ravi@ximian.com>
737 * class.cs (TypeContainer::DefineType): Method to actually do the business of
738 defining the type in the Modulebuilder or Typebuilder. This is to take
739 care of nested types which need to be defined on the TypeBuilder using
742 (TypeContainer::GetClassBases): Implement. Essentially the code from the
743 methods in RootContext, only ported to be part of TypeContainer.
745 (TypeContainer::GetInterfaceOrClass): Ditto.
747 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
749 * interface.cs (Interface::DefineInterface): New method. Does exactly
750 what RootContext.CreateInterface did earlier, only it takes care of nested types
753 (Interface::GetInterfaces): Move from RootContext here and port.
755 (Interface::GetInterfaceByName): Same here.
757 * rootcontext.cs (ResolveTree): Re-write.
759 (PopulateTypes): Re-write.
761 * class.cs (TypeContainer::Populate): Populate nested types too.
762 (TypeContainer::Emit): Emit nested members too.
764 * typemanager.cs (AddUserType): Do not make use of the FullName property,
765 instead just use the name argument passed in as it is already fully
768 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
769 to TypeContainer mapping to see if a type is user-defined.
771 * class.cs (TypeContainer::CloseType): Implement.
773 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
774 the default constructor.
776 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
779 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
781 * interface.cs (CloseType): Create the type here.
783 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
786 Remove all the methods which are now in TypeContainer.
788 2001-10-10 Ravi Pratap <ravi@ximian.com>
790 * delegate.cs (Define): Re-write bits to define the delegate
793 2001-10-10 Miguel de Icaza <miguel@ximian.com>
795 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
797 * expression.cs (ImplicitReferenceConversion): handle null as well
798 as a source to convert to any reference type.
800 * statement.cs (Return): Perform any implicit conversions to
801 expected return type.
803 Validate use of return statement.
805 * codegen.cs (EmitContext): Pass the expected return type here.
807 * class.cs (Method, Constructor, Property): Pass expected return
810 2001-10-09 Miguel de Icaza <miguel@ximian.com>
812 * expression.cs: Make DoResolve take an EmitContext instead of a
815 Replaced `l' and `location' for `loc', for consistency.
817 (Error, Warning): Remove unneeded Tc argument.
819 * assign.cs, literal.cs, constant.cs: Update to new calling
822 * codegen.cs: EmitContext now contains a flag indicating whether
823 code is being generated in a static method or not.
825 * cs-parser.jay: DecomposeQI, new function that replaces the old
826 QualifiedIdentifier. Now we always decompose the assembled
827 strings from qualified_identifier productions into a group of
830 2001-10-08 Miguel de Icaza <miguel@ximian.com>
832 * rootcontext.cs: Deal with field-less struct types correctly now
833 by passing the size option to Define Type.
835 * class.cs: Removed hack that created one static field.
837 2001-10-07 Miguel de Icaza <miguel@ximian.com>
839 * statement.cs: Moved most of the code generation here.
841 2001-10-09 Ravi Pratap <ravi@ximian.com>
843 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
846 (ElementAccess): Remove useless bits for now - keep checks as the spec
849 2001-10-08 Ravi Pratap <ravi@ximian.com>
851 * expression.cs (ElementAccess::DoResolve): Remove my crap code
852 and start performing checks according to the spec.
854 2001-10-07 Ravi Pratap <ravi@ximian.com>
856 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
857 rank_specifiers instead.
859 (rank_specifiers): Change the order in which the rank specifiers are stored
861 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
863 * expression.cs (ElementAccess): Implement the LValue interface too.
865 2001-10-06 Ravi Pratap <ravi@ximian.com>
867 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
868 except that user defined conversions are not included.
870 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
871 perform the conversion of the return type, if necessary.
873 (New::DoResolve): Check whether we are creating an array or an object
874 and accordingly do the needful.
876 (New::Emit): Same here.
878 (New::DoResolve): Implement guts of array creation.
880 (New::FormLookupType): Helper function.
882 2001-10-07 Miguel de Icaza <miguel@ximian.com>
884 * codegen.cs: Removed most of the code generation here, and move the
885 corresponding code generation bits to the statement classes.
887 Added support for try/catch/finalize and throw.
889 * cs-parser.jay: Added support for try/catch/finalize.
891 * class.cs: Catch static methods having the flags override,
894 * expression.cs (UserCast): This user cast was not really doing
895 what it was supposed to do. Which is to be born in fully resolved
896 state. Parts of the resolution were being performed at Emit time!
900 2001-10-05 Miguel de Icaza <miguel@ximian.com>
902 * expression.cs: Implicity convert the result from UserCast.
904 2001-10-05 Ravi Pratap <ravi@ximian.com>
906 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
907 prevented it from working correctly.
909 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
910 merely ConvertImplicit.
912 2001-10-05 Miguel de Icaza <miguel@ximian.com>
914 * typemanager.cs: Make the LookupTypeContainer function static,
915 and not per-instance.
917 * class.cs: Make static FindMembers (the one that takes a Type
920 * codegen.cs: Add EmitForeach here.
922 * cs-parser.jay: Make foreach a toplevel object instead of the
923 inline expansion, as we need to perform semantic analysis on it.
925 2001-10-05 Ravi Pratap <ravi@ximian.com>
927 * expression.cs (Expression::ImplicitUserConversion): Rename to
928 UserDefinedConversion.
930 (Expression::UserDefinedConversion): Take an extra argument specifying
931 whether we look for explicit user conversions too.
933 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
935 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
937 (ExplicitUserConversion): Make it a call to UserDefinedConversion
938 with the appropriate arguments.
940 * cs-parser.jay (cast_expression): Record location too.
942 * expression.cs (Cast): Record location info.
944 (Expression::ConvertExplicit): Take location argument.
946 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
947 to determine if we are doing explicit conversions.
949 (UserCast::Emit): Update accordingly.
951 (Expression::ConvertExplicit): Report an error if everything fails.
953 * ../errors/cs0030.cs : Add.
955 2001-10-04 Miguel de Icaza <miguel@ximian.com>
957 * modifiers.cs: If the ABSTRACT keyword is present, also set the
958 virtual and newslot bits.
960 * class.cs (TypeContainer::RegisterRequiredImplementations):
961 Record methods we need.
963 (TypeContainer::MakeKey): Helper function to make keys for
964 MethodBases, since the Methodbase key is useless.
966 (TypeContainer::Populate): Call RegisterRequiredImplementations
967 before defining the methods.
969 Create a mapping for method_builders_to_methods ahead of time
970 instead of inside a tight loop.
972 (::RequireMethods): Accept an object as the data to set into the
973 hashtable so we can report interface vs abstract method mismatch.
975 2001-10-03 Miguel de Icaza <miguel@ximian.com>
977 * report.cs: Make all of it static.
979 * rootcontext.cs: Drop object_type and value_type computations, as
980 we have those in the TypeManager anyways.
982 Drop report instance variable too, now it is a global.
984 * driver.cs: Use try/catch on command line handling.
986 Add --probe option to debug the error reporting system with a test
989 * report.cs: Add support for exiting program when a probe
990 condition is reached.
992 2001-10-03 Ravi Pratap <ravi@ximian.com>
994 * expression.cs (Binary::DoNumericPromotions): Fix the case when
995 we do a forcible conversion regardless of type, to check if
996 ForceConversion returns a null.
998 (Binary::error19): Use location to report error.
1000 (Unary::error23): Use location here too.
1002 * ../errors/cs0019.cs : Check in.
1004 * ../errors/cs0023.cs : Check in.
1006 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
1007 case of a non-null MethodInfo object with a length of 0 !
1009 (Binary::ResolveOperator): Flag error if overload resolution fails to find
1010 an applicable member - according to the spec :-)
1011 Also fix logic to find members in base types.
1013 (Unary::ResolveOperator): Same here.
1015 (Unary::report23): Change name to error23 and make first argument a TypeContainer
1016 as I was getting thoroughly confused between this and error19 :-)
1018 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
1019 (::FindMostEncompassedType): Implement.
1020 (::FindMostEncompassingType): Implement.
1021 (::StandardConversionExists): Implement.
1023 (UserImplicitCast): Re-vamp. We now need info about most specific
1024 source and target types so that we can do the necessary conversions.
1026 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
1027 mathematical union with no duplicates.
1029 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1031 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
1032 in order from base classes to child classes, so that we can in
1033 child classes look up in our parent for method names and
1034 attributes (required for handling abstract, virtual, new, override
1035 constructs: we need to instrospect our base class, and if we dont
1036 populate the classes in order, the introspection might be
1037 incorrect. For example, a method could query its parent before
1038 the parent has any methods and would determine that the parent has
1039 no abstract methods (while it could have had them)).
1041 (RootContext::CreateType): Record the order in which we define the
1044 2001-10-02 Miguel de Icaza <miguel@ximian.com>
1046 * class.cs (TypeContainer::Populate): Also method definitions can
1047 fail now, keep track of this.
1049 (TypeContainer::FindMembers): Implement support for
1050 DeclaredOnly/noDeclaredOnly flag.
1052 (Constructor::Emit) Return the ConstructorBuilder.
1054 (Method::Emit) Return the MethodBuilder.
1055 Check for abstract or virtual methods to be public.
1057 * rootcontext.cs (RootContext::CreateType): Register all the
1058 abstract methods required for the class to be complete and the
1059 interface methods that must be implemented.
1061 * cs-parser.jay: Report error 501 (method requires body if it is
1062 not marked abstract or extern).
1064 * expression.cs (TypeOf::Emit): Implement.
1066 * typemanager.cs: runtime_handle_type, new global type.
1068 * class.cs (Property::Emit): Generate code for properties.
1070 2001-10-02 Ravi Pratap <ravi@ximian.com>
1072 * expression.cs (Unary::ResolveOperator): Find operators on base type
1073 too - we now conform exactly to the spec.
1075 (Binary::ResolveOperator): Same here.
1077 * class.cs (Operator::Define): Fix minor quirk in the tests.
1079 * ../errors/cs0215.cs : Added.
1081 * ../errors/cs0556.cs : Added.
1083 * ../errors/cs0555.cs : Added.
1085 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1087 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
1088 single integer which is really efficient
1090 2001-10-01 Ravi Pratap <ravi@ximian.com>
1092 * expression.cs (Expression::ImplicitUserConversion): Use location
1093 even in the case when we are examining True operators.
1095 * class.cs (Operator::Define): Perform extensive checks to conform
1096 with the rules for operator overloading in the spec.
1098 * expression.cs (Expression::ImplicitReferenceConversion): Implement
1099 some of the other conversions mentioned in the spec.
1101 * typemanager.cs (array_type): New static member for the System.Array built-in
1104 (cloneable_interface): For System.ICloneable interface.
1106 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
1107 we start resolving the tree and populating types.
1109 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
1111 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1113 * expression.cs (Expression::ExprClassFromMemberInfo,
1114 Expression::Literalize): Create literal expressions from
1115 FieldInfos which are literals.
1117 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
1118 type casts, because they were wrong. The test suite in tests
1121 (ImplicitNumericConversion): ushort to ulong requires a widening
1124 Int32 constant to long requires widening cast as well.
1126 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
1127 for integers because the type on the stack is not i4.
1129 2001-09-30 Miguel de Icaza <miguel@ximian.com>
1131 * expression.cs (report118): require location argument.
1133 * parameter.cs: Do not dereference potential null value.
1135 * class.cs: Catch methods that lack the `new' keyword when
1136 overriding a name. Report warnings when `new' is used without
1137 anything being there to override.
1139 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
1141 * class.cs: Only add constructor to hashtable if it is non-null
1142 (as now constructors can fail on define).
1144 (TypeManager, Class, Struct): Take location arguments.
1146 Catch field instance initialization in structs as errors.
1148 accepting_filter: a new filter for FindMembers that is static so
1149 that we dont create an instance per invocation.
1151 (Constructor::Define): Catch errors where a struct constructor is
1154 * cs-parser.jay: Pass location information for various new
1157 * delegate.cs (Delegate): take a location argument.
1159 * driver.cs: Do not call EmitCode if there were problesm in the
1160 Definition of the types, as many Builders wont be there.
1162 * decl.cs (Decl::Decl): Require a location argument.
1164 * cs-tokenizer.cs: Handle properly hex constants that can not fit
1165 into integers, and find the most appropiate integer for it.
1167 * literal.cs: Implement ULongLiteral.
1169 * rootcontext.cs: Provide better information about the location of
1170 failure when CreateType fails.
1172 2001-09-29 Miguel de Icaza <miguel@ximian.com>
1174 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
1177 * expression.cs (Binary::CheckShiftArguments): Add missing type
1179 (Binary::ResolveOperator): Add type to the logical and and logical
1180 or, Bitwise And/Or and Exclusive Or code paths, it was missing
1183 (Binary::DoNumericPromotions): In the case where either argument
1184 is ulong (and most signed types combined with ulong cause an
1185 error) perform implicit integer constant conversions as well.
1187 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1189 * expression.cs (UserImplicitCast): Method should always be
1191 (Invocation::BetterConversion): Simplified test for IntLiteral.
1193 (Expression::ImplicitNumericConversion): Split this routine out.
1194 Put the code that performs implicit constant integer conversions
1197 (Expression::Resolve): Become a wrapper around DoResolve so we can
1198 check eclass and type being set after resolve.
1200 (Invocation::Badness): Remove this dead function
1202 (Binary::ResolveOperator): Do not compute the expensive argumnets
1203 unless we have a union for it.
1205 (Probe::Emit): Is needs to do an isinst and then
1206 compare against null.
1208 (::CanConvert): Added Location argument. If the Location argument
1209 is null (Location.Null), then we do not report errors. This is
1210 used by the `probe' mechanism of the Explicit conversion. We do
1211 not want to generate an error for something that the user
1212 explicitly requested to be casted. But the pipeline for an
1213 explicit cast first tests for potential implicit casts.
1215 So for now, if the Location is null, it means `Probe only' to
1216 avoid adding another argument. Might have to revise this
1219 (ClassCast): New class used to type cast objects into arbitrary
1220 classes (used in Explicit Reference Conversions).
1222 Implement `as' as well.
1224 Reverted all the patches from Ravi below: they were broken:
1226 * The use of `level' as a mechanism to stop recursive
1227 invocations is wrong. That was there just to catch the
1228 bug with a strack trace but not as a way of addressing
1231 To fix the problem we have to *understand* what is going
1232 on and the interactions and come up with a plan, not
1233 just get things going.
1235 * The use of the type conversion cache that I proposed
1236 last night had an open topic: How does this work across
1237 protection domains. A user defined conversion might not
1238 be public in the location where we are applying the
1239 conversion, a different conversion might be selected
1240 (ie, private A->B (better) but public B->A (worse),
1241 inside A, A->B applies, but outside it, B->A will
1244 * On top of that (ie, even if the above is solved),
1245 conversions in a cache need to be abstract. Ie, `To
1246 convert from an Int to a Short use an OpcodeCast', not
1247 `To convert from an Int to a Short use the OpcodeCast on
1248 the variable 5' (which is what this patch was doing).
1250 2001-09-28 Ravi Pratap <ravi@ximian.com>
1252 * expression.cs (Invocation::ConversionExists): Re-write to use
1253 the conversion cache
1255 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
1256 cache all conversions done, not just user-defined ones.
1258 (Invocation::BetterConversion): The real culprit. Use ConversionExists
1259 to determine if a conversion exists instead of acutually trying to
1260 perform the conversion. It's faster too.
1262 (Expression::ConvertExplicit): Modify to use ConversionExists to check
1263 and only then attempt the implicit conversion.
1265 2001-09-28 Ravi Pratap <ravi@ximian.com>
1267 * expression.cs (ConvertImplicit): Use a cache for conversions
1268 already found. Check level of recursion and bail out if necessary.
1270 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1272 * typemanager.cs (string_concat_string_string, string_concat_object_object):
1273 Export standard methods that we expect for string operations.
1275 * statement.cs (Block::UsageWarning): Track usage of variables and
1276 report the errors for not used variables.
1278 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
1281 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1283 * codegen.cs: remove unnneded code
1285 * expression.cs: Removed BuiltinTypeAccess class
1287 Fix the order in which implicit conversions are
1290 The previous fixed dropped support for boxed conversions (adding a
1291 test to the test suite now)
1293 (UserImplicitCast::CanConvert): Remove test for source being null,
1294 that code is broken. We should not feed a null to begin with, if
1295 we do, then we should track the bug where the problem originates
1296 and not try to cover it up here.
1298 Return a resolved expression of type UserImplicitCast on success
1299 rather than true/false. Ravi: this is what I was talking about,
1300 the pattern is to use a static method as a "constructor" for
1303 Also, do not create arguments until the very last minute,
1304 otherwise we always create the arguments even for lookups that
1305 will never be performed.
1307 (UserImplicitCast::Resolve): Eliminate, objects of type
1308 UserImplicitCast are born in a fully resolved state.
1310 * typemanager.cs (InitCoreTypes): Init also value_type
1313 * expression.cs (Cast::Resolve): First resolve the child expression.
1315 (LValue): Add new method AddressOf to be used by
1318 Change the argument of Store to take an EmitContext instead of an
1319 ILGenerator, because things like FieldExpr need to be able to call
1320 their children expression to generate the instance code.
1322 (Expression::Error, Expression::Warning): Sugar functions for
1325 (Expression::MemberLookup): Accept a TypeContainer instead of a
1326 Report as the first argument.
1328 (Expression::ResolvePrimary): Killed. I still want to improve
1329 this as currently the code is just not right.
1331 (Expression::ResolveMemberAccess): Simplify, but it is still
1334 (Unary::Resolve): Catch errors in AddressOf operators.
1336 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
1337 index to a byte for the short-version, or the compiler will choose
1338 the wrong Emit call, which generates the wrong data.
1340 (ParameterReference::Emit, ::Store): same.
1342 (FieldExpr::AddressOf): Implement.
1344 * typemanager.cs: TypeManager: made public variable instead of
1347 * driver.cs: document --fatal.
1349 * report.cs (ErrorMessage, WarningMessage): new names for the old
1350 Error and Warning classes.
1352 * cs-parser.jay (member_access): Turn built-in access to types
1353 into a normal simplename
1355 2001-09-27 Ravi Pratap <ravi@ximian.com>
1357 * expression.cs (Invocation::BetterConversion): Fix to cope
1358 with q being null, since this was introducing a bug.
1360 * expression.cs (ConvertImplicit): Do built-in conversions first.
1362 2001-09-27 Ravi Pratap <ravi@ximian.com>
1364 * expression.cs (UserImplicitCast::Resolve): Fix bug.
1366 2001-09-27 Ravi Pratap <ravi@ximian.com>
1368 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
1369 I had introduced long ago (what's new ?).
1371 * expression.cs (UserImplicitCast::CanConvert): Static method to do
1372 the work of all the checking.
1373 (ConvertImplicit): Call CanConvert and only then create object if necessary.
1374 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
1376 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
1377 that is the right way.
1379 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
1380 overloading resolution. Use everywhere instead of cutting and pasting code.
1382 (Binary::ResolveOperator): Use MakeUnionSet.
1384 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
1385 we have to convert to bool types. Not complete yet.
1387 2001-09-27 Miguel de Icaza <miguel@ximian.com>
1389 * typemanager.cs (TypeManager::CSharpName): support ushort.
1391 * expression.cs (Expression::TryImplicitIntConversion): Attempts
1392 to provide an expression that performsn an implicit constant int
1393 conversion (section 6.1.6).
1394 (Expression::ConvertImplicitRequired): Reworked to include
1395 implicit constant expression conversions.
1397 (Expression::ConvertNumericExplicit): Finished.
1399 (Invocation::Emit): If InstanceExpression is null, then it means
1400 that we perform a call on this.
1402 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1404 * expression.cs (Unary::Emit): Remove some dead code.
1405 (Probe): Implement Resolve and Emit for `is'.
1406 (Expression::ConvertImplicitRequired): Attempt to do constant
1407 expression conversions here. Maybe should be moved to
1408 ConvertImplicit, but I am not sure.
1409 (Expression::ImplicitLongConstantConversionPossible,
1410 Expression::ImplicitIntConstantConversionPossible): New functions
1411 that tell whether is it possible to apply an implicit constant
1412 expression conversion.
1414 (ConvertNumericExplicit): Started work on explicit numeric
1417 * cs-parser.jay: Update operator constants.
1419 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
1420 (Parameters::GetSignature): Hook up VerifyArgs here.
1421 (Parameters::VerifyArgs): Verifies that no two arguments have the
1424 * class.cs (Operator): Update the operator names to reflect the
1425 ones that the spec expects (as we are just stringizing the
1428 * expression.cs (Unary::ResolveOperator): Fix bug: Use
1429 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
1430 previous usage did only work for our methods.
1431 (Expression::ConvertImplicit): Handle decimal implicit numeric
1432 conversions as well.
1433 (Expression::InternalTypeConstructor): Used to invoke constructors
1434 on internal types for default promotions.
1436 (Unary::Emit): Implement special handling for the pre/post
1437 increment/decrement for overloaded operators, as they need to have
1438 the same semantics as the other operators.
1440 (Binary::ResolveOperator): ditto.
1441 (Invocation::ConversionExists): ditto.
1442 (UserImplicitCast::Resolve): ditto.
1444 2001-09-26 Ravi Pratap <ravi@ximian.com>
1446 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
1447 operator, return after emitting body. Regression tests pass again !
1449 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
1450 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
1451 (Invocation::OverloadResolve): Ditto.
1452 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
1454 * everywhere : update calls to the above methods accordingly.
1456 2001-09-26 Miguel de Icaza <miguel@ximian.com>
1458 * assign.cs (Assign): Make it inherit from ExpressionStatement.
1460 * expression.cs (ExpressionStatement): New base class used for
1461 expressions that can appear in statements, so that we can provide
1462 an alternate path to generate expression that do not leave a value
1465 (Expression::Emit, and all the derivatives): We no longer return
1466 whether a value is left on the stack or not. Every expression
1467 after being emitted leaves a single value on the stack.
1469 * codegen.cs (EmitContext::EmitStatementExpression): Use the
1470 facilties of ExpressionStatement if possible.
1472 * cs-parser.jay: Update statement_expression.
1474 2001-09-25 Miguel de Icaza <miguel@ximian.com>
1476 * driver.cs: Change the wording of message
1478 2001-09-25 Ravi Pratap <ravi@ximian.com>
1480 * expression.cs (Binary::ResolveOperator): Had forgottten to set
1481 the type of the expression to the return type of the method if
1482 we have an overloaded operator match ! The regression tests pass again !
1483 (Unary::ResolveOperator): Ditto.
1485 * expression.cs (Invocation::ConversionExists): Correct the member lookup
1486 to find "op_Implicit", not "implicit" ;-)
1487 (UserImplicitCast): New class to take care of user-defined implicit conversions.
1488 (ConvertImplicit, ForceConversion): Take TypeContainer argument
1490 * everywhere : Correct calls to the above accordingly.
1492 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
1493 (ConvertImplicit): Do user-defined conversion if it exists.
1495 2001-09-24 Miguel de Icaza <miguel@ximian.com>
1497 * assign.cs: track location.
1498 (Resolve): Use implicit conversions on assignment.
1500 * literal.cs: Oops. Not good, Emit of short access values should
1501 pass (Bytes) or the wrong argument will be selected.
1503 * expression.cs (Unary::Emit): Emit code for -expr.
1505 (Unary::ResolveOperator): Handle `Substract' for non-constants
1506 (substract from zero from the non-constants).
1507 Deal with Doubles as well.
1509 (Expression::ConvertImplicitRequired): New routine that reports an
1510 error if no implicit conversion exists.
1512 (Invocation::OverloadResolve): Store the converted implicit
1513 expressions if we make them
1515 2001-09-24 Ravi Pratap <ravi@ximian.com>
1517 * class.cs (ConstructorInitializer): Take a Location argument.
1518 (ConstructorBaseInitializer): Same here.
1519 (ConstructorThisInitializer): Same here.
1521 * cs-parser.jay : Update all calls accordingly.
1523 * expression.cs (Unary, Binary, New): Take location argument.
1524 Update accordingly everywhere.
1526 * cs-parser.jay : Update all calls to the above to take a location
1531 2001-09-24 Ravi Pratap <ravi@ximian.com>
1533 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
1534 (Invocation::BetterConversion): Same here
1535 (Invocation::ConversionExists): Ditto.
1537 (Invocation::ConversionExists): Implement.
1539 2001-09-22 Ravi Pratap <ravi@ximian.com>
1541 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
1542 Also take an additional TypeContainer argument.
1544 * All over : Pass in TypeContainer as argument to OverloadResolve.
1546 * typemanager.cs (CSharpName): Update to check for the string type and return
1549 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
1552 2001-09-21 Ravi Pratap <ravi@ximian.com>
1554 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
1555 (Invocation::BetterFunction): Implement.
1556 (Invocation::BetterConversion): Implement.
1557 (Invocation::ConversionExists): Skeleton, no implementation yet.
1559 Okay, things work fine !
1561 2001-09-21 Miguel de Icaza <miguel@ximian.com>
1563 * typemanager.cs: declare and load enum_type, delegate_type and
1566 * expression.cs (Expression::Emit): Now emit returns a value that
1567 tells whether a value is left on the stack or not. This strategy
1568 might be reveted tomorrow with a mechanism that would address
1569 multiple assignments.
1570 (Expression::report118): Utility routine to report mismatches on
1573 (Unary::Report23): Report impossible type/operator combination
1576 (Unary::IsIncrementableNumber): Whether the type can be
1577 incremented or decremented with add.
1578 (Unary::ResolveOperator): Also allow enumerations to be bitwise
1580 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
1582 (Invocation::Emit): Deal with new Emit convetion.
1584 * All Expression derivatives: Updated their Emit method to return
1585 whether they leave values on the stack or not.
1587 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
1588 stack for expressions that are statements.
1590 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1592 * expression.cs (LValue): New interface. Must be implemented by
1594 (LocalVariableReference, ParameterReference, FieldExpr): Implement
1597 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
1598 interface for generating code, simplifies the code.
1600 2001-09-20 Ravi Pratap <ravi@ximian.com>
1602 * expression.cs (everywhere): Comment out return statements in ::Resolve
1603 methods to avoid the warnings.
1605 2001-09-20 Miguel de Icaza <miguel@ximian.com>
1607 * driver.cs (parse): Report error 2001 if we can not open the
1610 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
1613 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
1616 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
1617 otherwise nested blocks end up with the same index.
1619 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
1621 * expression.cs: Instead of having FIXMEs in the Resolve
1622 functions, throw exceptions so it is obvious that we are facing a
1625 * cs-parser.jay (invocation_expression): Pass Location information.
1627 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
1628 Use a basename for those routines because .NET does not like paths
1631 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
1634 2001-09-19 Miguel de Icaza <miguel@ximian.com>
1636 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
1637 are loading the correct data types (throws an exception if not).
1638 (TypeManager::InitCoreTypes): Use CoreLookupType
1640 * expression.cs (Unary::ResolveOperator): return the child
1641 expression for expressions which are just +expr.
1642 (Unary::ResolveOperator): Return negative literals for -LITERAL
1643 expressions (otherwise they are Unary {Literal}).
1644 (Invocation::Badness): Take into account `Implicit constant
1645 expression conversions'.
1647 * literal.cs (LongLiteral): Implement long literal class.
1648 (IntLiteral): export the `Value' of the intliteral.
1650 2001-09-19 Ravi Pratap <ravi@ximian.com>
1652 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
1654 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
1655 instead of 'Operator'
1657 * expression.cs (Binary::ResolveOperator): Update accordingly.
1658 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
1661 * cs-parser.jay (unary_expression): Update to use the new names.
1663 * gen-treedump.cs (GetUnary): Same here.
1665 * expression.cs (Unary::Resolve): Implement.
1666 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
1667 operators are found instead of making noise ;-)
1668 (Unary::ResolveOperator): New method to do precisely the same thing which
1669 Binary::ResolveOperator does for Binary expressions.
1670 (Unary.method, .Arguments): Add.
1671 (Unary::OperName): Implement.
1672 (Unary::ForceConversion): Copy and Paste !
1674 * class.cs (Operator::Define): Fix a small bug for the case when we have
1677 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1678 for the inbuilt operators. Only overloading works for now ;-)
1680 2001-09-18 Miguel de Icaza <miguel@ximian.com>
1682 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1683 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1685 * expression.cs (This::Emit): Implement.
1686 (This::Resolve): Implement.
1687 (TypeOf:Resolve): Implement.
1688 (Expression::ResolveSimpleName): Add an implicit this to instance
1690 (MemberAccess::Resolve): Deal with Parameters and Fields.
1691 Bind instance variable to Field expressions.
1692 (FieldExpr::Instance): New field used to track the expression that
1693 represents the object instance.
1694 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1696 (FieldExpr::Emit): Implement.
1698 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1699 the last instruction contains a return opcode to avoid generating
1700 the last `ret' instruction (this generates correct code, and it is
1701 nice to pass the peverify output).
1703 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1704 initializer for static and instance variables.
1705 (Constructor::Emit): Allow initializer to be null in the case of
1706 static constructors. Only emit initializer for instance
1709 (TypeContainer::FindMembers): Return a null array if there are no
1712 Also fix the code for the MemberTypes.Method branch, as it was not
1713 scanning that for operators (or tried to access null variables before).
1715 * assign.cs (Assign::Emit): Handle instance and static fields.
1719 * driver.cs: Stop compilation if there are parse errors.
1721 * cs-parser.jay (constructor_declaration): Provide default base
1722 initializer for non-static constructors.
1723 (constructor_declarator): Do not provide a default base
1724 initializers if none was specified.
1725 Catch the fact that constructors should not have parameters.
1727 * class.cs: Do not emit parent class initializers for static
1728 constructors, that should be flagged as an error.
1730 2001-09-18 Ravi Pratap <ravi@ximian.com>
1732 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1733 Move back code into TypeContainer::Populate.
1735 2001-09-18 Ravi Pratap <ravi@ximian.com>
1737 * class.cs (TypeContainer::AddConstructor): Fix the check to
1738 compare against Name, not Basename.
1739 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1741 * cs-parser.jay : Update accordingly.
1743 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1744 for methods, don't forget to look into the operators too.
1745 (RegisterMethodBuilder): Helper method to take care of this for
1746 methods, constructors and operators.
1747 (Operator::Define): Completely revamp.
1748 (Operator.OperatorMethod, MethodName): New fields.
1749 (TypeContainer::Populate): Move the registering of builders into
1750 RegisterMethodBuilder.
1751 (Operator::Emit): Re-write.
1753 * expression.cs (Binary::Emit): Comment out code path to emit method
1754 invocation stuff for the case when we have a user defined operator. I am
1755 just not able to get it right !
1757 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1759 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1762 (Expression::MemberLookup): Provide a version that allows to
1763 specify the MemberTypes and BindingFlags.
1765 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1766 so it was not fetching variable information from outer blocks.
1768 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1769 Beforefieldinit as it was buggy.
1771 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1774 * class.cs (Constructor::Emit): Only emit if block is not null.
1775 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1776 deal with this by semantically definining it as if the user had
1779 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1780 constructors as we now "emit" them at a higher level.
1782 (TypeContainer::DefineDefaultConstructor): Used to define the
1783 default constructors if none was provided.
1785 (ConstructorInitializer): Add methods Resolve and Emit.
1787 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1789 2001-09-17 Ravi Pratap <ravi@ximian.com>
1791 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1792 the default constructor builder with our hashtable for methodbuilders
1795 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1796 and argument_count is 0 in which case we have a match.
1797 (Binary::ResolveOperator): More null checking and miscellaneous coding
1800 2001-09-17 Ravi Pratap <ravi@ximian.com>
1802 * rootcontext.cs (IsNameSpace): Compare against null.
1804 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1806 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1807 and Unary::Operator.
1809 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1812 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1813 we have overloaded operators.
1814 (Binary::ResolveOperator): Implement the part which does the operator overload
1817 * class.cs (Operator::Emit): Implement.
1818 (TypeContainer::Emit): Emit the operators we have too.
1820 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1821 the case when we have a user-defined operator.
1823 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1825 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1827 2001-09-16 Ravi Pratap <ravi@ximian.com>
1829 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1830 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1831 (Constructor::Emit): Implement.
1832 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1833 if we have no work to do.
1834 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1837 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1838 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1840 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1843 2001-09-15 Ravi Pratap <ravi@ximian.com>
1845 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1847 (Tree::RecordNamespace): Method to do what the name says ;-)
1848 (Tree::Namespaces): Property to get at the namespaces hashtable.
1850 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1853 * rootcontext.cs (IsNamespace): Fixed it :-)
1855 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1857 * class.cs (TypeContainer::FindMembers): Add support for
1859 (MethodCore): New class that encapsulates both the shared aspects
1860 of a Constructor and a Method.
1861 (Method, Constructor): Factored pieces into MethodCore.
1863 * driver.cs: Added --fatal which makes errors throw exceptions.
1864 Load System assembly as well as part of the standard library.
1866 * report.cs: Allow throwing exceptions on errors for debugging.
1868 * modifiers.cs: Do not use `parent', instead use the real type
1869 container to evaluate permission settings.
1871 * class.cs: Put Ravi's patch back in. He is right, and we will
1872 have to cope with the
1874 2001-09-14 Ravi Pratap <ravi@ximian.com>
1876 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1877 FamORAssem, not FamANDAssem.
1879 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1881 * driver.cs: Added --parse option that only parses its input files
1884 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1885 incorrect. IsTopLevel is not used to tell whether an object is
1886 root_types or not (that can be achieved by testing this ==
1887 root_types). But to see if this is a top-level *class* (not
1888 necessarly our "toplevel" container).
1890 2001-09-14 Ravi Pratap <ravi@ximian.com>
1892 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1893 parent instead of a direct call to GetType.
1895 2001-09-14 Ravi Pratap <ravi@ximian.com>
1897 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1898 Modifiers.TypeAttr. This should just be a call to that method.
1900 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1901 object so that we can determine if we are top-level or not.
1903 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1906 * enum.cs (Enum::Define): Ditto.
1908 * modifiers.cs (FieldAttr): Re-write.
1910 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1911 (TypeContainer::HaveStaticConstructor): New property to provide access
1912 to precisely that info.
1914 * modifiers.cs (MethodAttr): Re-write.
1915 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1917 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1918 of top-level types as claimed.
1920 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1922 * expression.cs (MemberLookup): Fruitless attempt to lookup
1923 constructors. Maybe I need to emit default constructors? That
1924 might be it (currently .NET emits this for me automatically).
1925 (Invocation::OverloadResolve): Cope with Arguments == null.
1926 (Invocation::EmitArguments): new function, shared by the new
1928 (Invocation::Emit): Handle static and instance methods. Emit
1929 proper call instruction for virtual or non-virtual invocations.
1930 (New::Emit): Implement.
1931 (New::Resolve): Implement.
1932 (MemberAccess:Resolve): Implement.
1933 (MethodGroupExpr::InstanceExpression): used conforming to the spec
1935 (FieldExpr::Resolve): Set type.
1937 * support.cs: Handle empty arguments.
1939 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
1940 SimpleLookup): Auxiliary routines to help parse a qualifier
1943 Update qualifier_identifier rule.
1945 * codegen.cs: Removed debugging messages.
1947 * class.cs: Make this a global thing, this acts just as a "key" to
1948 objects that we might have around.
1950 (Populate): Only initialize method_builders_to_methods once.
1952 * expression.cs (PropertyExpr): Initialize type from the
1955 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
1956 Resolve pattern. Attempt to implicitly convert value to boolean.
1959 * expression.cs: Set the type for the int32/int32 argument case.
1960 (Binary::ResolveOperator): Set the return type to boolean for
1961 comparission operators
1963 * typemanager.cs: Remove debugging print code.
1965 (Invocation::Resolve): resolve type.
1967 * class.cs: Allocate a MemberInfo of the correct size, as the code
1968 elsewhere depends on the test to reflect the correct contents.
1970 (Method::) Keep track of parameters, due to System.Reflection holes
1972 (TypeContainer::Populate): Keep track of MethodBuilders to Method
1975 (TypeContainer::FindMembers): Use ArrayList and then copy an array
1976 of the exact size and return that.
1978 (Class::LookupMethodByBuilder): New function that maps
1979 MethodBuilders to its methods. Required to locate the information
1980 on methods because System.Reflection bit us again.
1982 * support.cs: New file, contains an interface ParameterData and
1983 two implementations: ReflectionParameters and InternalParameters
1984 used to access Parameter information. We will need to grow this
1987 * expression.cs (Invocation::GetParameterData): implement a cache
1988 and a wrapper around the ParameterData creation for methods.
1989 (Invocation::OverloadResolve): Use new code.
1991 2001-09-13 Ravi Pratap <ravi@ximian.com>
1993 * class.cs (TypeContainer::EmitField): Remove and move into
1994 (Field::Define): here and modify accordingly.
1995 (Field.FieldBuilder): New member.
1996 (TypeContainer::Populate): Update accordingly.
1997 (TypeContainer::FindMembers): Implement.
1999 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2001 * statement.cs: (VariableInfo::VariableType): New field to be
2002 initialized with the full type once it is resolved.
2004 2001-09-12 Miguel de Icaza <miguel@ximian.com>
2006 * parameter.cs (GetParameterInfo): Use a type cache to compute
2007 things only once, and to reuse this information
2009 * expression.cs (LocalVariableReference::Emit): Implement.
2010 (OpcodeCast::Emit): fix.
2012 (ParameterReference::Resolve): Implement.
2013 (ParameterReference::Emit): Implement.
2015 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
2016 that are expressions need to stay as Expressions.
2018 * typemanager.cs (CSharpName): Returns the C# name of a type if
2021 * expression.cs (Expression::ConvertImplicit): New function that
2022 implements implicit type conversions.
2024 (Expression::ImplicitReferenceConversion): Implements implicit
2025 reference conversions.
2027 (EmptyCast): New type for transparent casts.
2029 (OpcodeCast): New type for casts of types that are performed with
2030 a sequence of bytecodes.
2032 (BoxedCast): New type used for casting value types into reference
2033 types. Emits a box opcode.
2035 (Binary::DoNumericPromotions): Implements numeric promotions of
2036 and computation of the Binary::Type.
2038 (Binary::EmitBranchable): Optimization.
2040 (Binary::Emit): Implement code emission for expressions.
2042 * typemanager.cs (TypeManager): Added two new core types: sbyte
2045 2001-09-12 Ravi Pratap <ravi@ximian.com>
2047 * class.cs (TypeContainer::FindMembers): Method which does exactly
2048 what Type.FindMembers does, only we don't have to use reflection. No
2051 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
2052 typecontainer objects as we need to get at them.
2053 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
2055 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
2056 typecontainer object.
2058 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
2059 of just a Report object.
2061 2001-09-11 Ravi Pratap <ravi@ximian.com>
2063 * class.cs (Event::Define): Go back to using the prefixes "add_" and
2065 (TypeContainer::Populate): Now define the delegates of the type too.
2066 (TypeContainer.Delegates): Property to access the list of delegates defined
2069 * delegates.cs (Delegate::Define): Implement partially.
2071 * modifiers.cs (TypeAttr): Handle more flags.
2073 2001-09-11 Ravi Pratap <ravi@ximian.com>
2075 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
2077 (Operator::Define): Re-write logic to get types by using the LookupType method
2078 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
2079 (Indexer::Define): Ditto.
2080 (Event::Define): Ditto.
2081 (Property::Define): Ditto.
2083 2001-09-10 Ravi Pratap <ravi@ximian.com>
2085 * class.cs (TypeContainer::Populate): Now define operators too.
2086 (TypeContainer.Operators): New property to access the list of operators
2088 (Operator.OperatorMethodBuilder): New member to hold the method builder
2089 for the operator we are defining.
2090 (Operator::Define): Implement.
2092 2001-09-10 Ravi Pratap <ravi@ximian.com>
2094 * class.cs (Event::Define): Make the prefixes of the accessor methods
2095 addOn_ and removeOn_
2097 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
2098 of the location being passed in too. Ideally, this should go later since all
2099 error reporting should be done through the Report object.
2101 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
2102 (Populate): Iterate thru the indexers we have and define them too.
2103 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
2104 for the get and set accessors.
2105 (Indexer::Define): Implement.
2107 2001-09-09 Miguel de Icaza <miguel@ximian.com>
2109 * expression.cs (Binary::Resolve): Beginning of it. I scratched
2110 my previous implementation, did not work.
2112 * typemanager.cs: Add a couple of missing types (the longs).
2114 * literal.cs: Use TypeManager.bool_type instead of getting it.
2116 * expression.cs (EventExpr): New kind of expressions.
2117 (Expressio::ExprClassFromMemberInfo): finish
2119 2001-09-08 Miguel de Icaza <miguel@ximian.com>
2121 * assign.cs: Emit stores to static fields differently.
2123 2001-09-08 Ravi Pratap <ravi@ximian.com>
2125 * Merge in changes and adjust code to tackle conflicts. Backed out my
2126 code in Assign::Resolve ;-)
2128 2001-09-08 Ravi Pratap <ravi@ximian.com>
2130 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
2131 instead Report.Error and also pass in the location.
2132 (CSharpParser::Lexer): New readonly property to return the reference
2133 to the Tokenizer object.
2134 (declare_local_variables): Use Report.Error with location instead of plain
2138 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
2139 (Operator.CheckBinaryOperator): Ditto.
2141 * cs-parser.jay (operator_declarator): Update accordingly.
2143 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
2144 (CheckBinaryOperator): Same here.
2146 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
2147 on the name without any prefixes of namespace names etc. This is because we
2148 already might have something already fully qualified like
2149 'System.Console.WriteLine'
2151 * assign.cs (Resolve): Begin implementation. Stuck ;-)
2153 2001-09-07 Ravi Pratap <ravi@ximian.com>
2155 * cs-tokenizer.cs (location): Return a string which also contains
2158 * expression.cs (ElementAccess): New class for expressions of the
2159 type 'element access.'
2160 (BaseAccess): New class for expressions of the type 'base access.'
2161 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
2164 * cs-parser.jay (element_access): Implement action.
2165 (base_access): Implement actions.
2166 (checked_expression, unchecked_expression): Implement.
2168 * cs-parser.jay (local_variable_type): Correct and implement.
2169 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
2171 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
2173 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
2174 name and the specifiers.
2176 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
2178 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
2179 making them all public ;-)
2181 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
2184 2001-09-07 Miguel de Icaza <miguel@ximian.com>
2186 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
2188 (FieldExpr, PropertyExprs): New resolved expressions.
2189 (SimpleName::MemberStaticCheck): Perform static checks for access
2190 to non-static fields on static methods. Maybe this should be
2191 generalized for MemberAccesses.
2192 (SimpleName::ResolveSimpleName): More work on simple name
2195 * cs-parser.jay (primary_expression/qualified_identifier): track
2196 the parameter index.
2198 * codegen.cs (CodeGen::Save): Catch save exception, report error.
2199 (EmitContext::EmitBoolExpression): Chain to expression generation
2200 instead of temporary hack.
2201 (::EmitStatementExpression): Put generic expression code generation.
2203 * assign.cs (Assign::Emit): Implement variable assignments to
2204 local variables, parameters and fields.
2206 2001-09-06 Miguel de Icaza <miguel@ximian.com>
2208 * statement.cs (Block::GetVariableInfo): New method, returns the
2209 VariableInfo for a variable name in a block.
2210 (Block::GetVariableType): Implement in terms of GetVariableInfo
2212 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
2213 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
2215 2001-09-06 Ravi Pratap <ravi@ximian.com>
2217 * cs-parser.jay (operator_declaration): Continue on my quest : update
2218 to take attributes argument.
2219 (event_declaration): Ditto.
2220 (enum_declaration): Ditto.
2221 (indexer_declaration): Ditto.
2223 * class.cs (Operator::Operator): Update constructor accordingly.
2224 (Event::Event): Ditto.
2226 * delegate.cs (Delegate::Delegate): Same here.
2228 * enum.cs (Enum::Enum): Same here.
2230 2001-09-05 Ravi Pratap <ravi@ximian.com>
2232 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
2234 * ../tests/cs0658.cs : New file to demonstrate error 0658.
2236 * attribute.cs (Attributes): New class to encapsulate all attributes which were
2237 being passed around as an arraylist.
2238 (Attributes::AddAttribute): Method to add attribute sections.
2240 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
2241 (struct_declaration): Update accordingly.
2242 (constant_declaration): Update.
2243 (field_declaration): Update.
2244 (method_header): Update.
2245 (fixed_parameter): Update.
2246 (parameter_array): Ditto.
2247 (property_declaration): Ditto.
2248 (destructor_declaration): Ditto.
2250 * class.cs (Struct::Struct): Update constructors accordingly.
2251 (Class::Class): Ditto.
2252 (Field::Field): Ditto.
2253 (Method::Method): Ditto.
2254 (Property::Property): Ditto.
2255 (TypeContainer::OptAttribute): update property's return type.
2257 * interface.cs (Interface.opt_attributes): New member.
2258 (Interface::Interface): Update to take the extra Attributes argument.
2260 * parameter.cs (Parameter::Parameter): Ditto.
2262 * constant.cs (Constant::Constant): Ditto.
2264 * interface.cs (InterfaceMemberBase): New OptAttributes field.
2265 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
2266 the attributes as a parameter.
2267 (InterfaceProperty): Update constructor call.
2268 (InterfaceEvent): Ditto.
2269 (InterfaceMethod): Ditto.
2270 (InterfaceIndexer): Ditto.
2272 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
2273 pass the attributes too.
2274 (interface_event_declaration): Ditto.
2275 (interface_property_declaration): Ditto.
2276 (interface_method_declaration): Ditto.
2277 (interface_declaration): Ditto.
2279 2001-09-05 Miguel de Icaza <miguel@ximian.com>
2281 * class.cs (Method::Define): Track the "static Main" definition to
2282 create an entry point.
2284 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
2285 EntryPoint if we find it.
2287 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
2288 (EmitContext::ig): Make this variable public.
2290 * driver.cs: Make the default output file be the first file name
2291 with the .exe extension.
2293 Detect empty compilations
2295 Handle various kinds of output targets. Handle --target and
2296 rename -t to --dumper.
2298 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
2299 methods inherited from Expression return now an Expression. This
2300 will is used during the tree rewriting as we resolve them during
2303 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
2304 the spec. Missing entirely is the information about
2305 accessability of elements of it.
2307 (Expression::ExprClassFromMemberInfo): New constructor for
2308 Expressions that creates a fully initialized Expression based on
2309 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
2312 (Invocation::Resolve): Begin implementing resolution of invocations.
2314 * literal.cs (StringLiteral): Implement Emit.
2316 2001-09-05 Ravi Pratap <ravi@ximian.com>
2318 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
2321 2001-09-04 Ravi Pratap <ravi@ximian.com>
2323 * cs-parser.jay (attribute_arguments): Implement actions.
2324 (attribute): Fix bug in production. Implement action.
2325 (attribute_list): Implement.
2326 (attribute_target): Implement.
2327 (attribute_target_specifier, opt_target_specifier): Implement
2328 (CheckAttributeTarget): New method to check if the attribute target
2330 (attribute_section): Implement.
2331 (opt_attributes): Implement.
2333 * attribute.cs : New file to handle attributes.
2334 (Attribute): Class to hold attribute info.
2336 * cs-parser.jay (opt_attribute_target_specifier): Remove production
2337 (attribute_section): Modify production to use 2 different rules to
2338 achieve the same thing. 1 s/r conflict down !
2339 Clean out commented, useless, non-reducing dimension_separator rules.
2341 * class.cs (TypeContainer.attributes): New member to hold list
2342 of attributes for a type.
2343 (Struct::Struct): Modify to take one more argument, the attribute list.
2344 (Class::Class): Ditto.
2345 (Field::Field): Ditto.
2346 (Method::Method): Ditto.
2347 (Property::Property): Ditto.
2349 * cs-parser.jay (struct_declaration): Update constructor call to
2350 pass in the attributes too.
2351 (class_declaration): Ditto.
2352 (constant_declaration): Ditto.
2353 (field_declaration): Ditto.
2354 (method_header): Ditto.
2355 (fixed_parameter): Ditto.
2356 (parameter_array): Ditto.
2357 (property_declaration): Ditto.
2359 * constant.cs (Constant::Constant): Update constructor similarly.
2360 Use System.Collections.
2362 * parameter.cs (Parameter::Parameter): Update as above.
2364 2001-09-02 Ravi Pratap <ravi@ximian.com>
2366 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
2367 (TypeContainer.delegates): New member to hold list of delegates.
2369 * cs-parser.jay (delegate_declaration): Implement the action correctly
2370 this time as I seem to be on crack ;-)
2372 2001-09-02 Miguel de Icaza <miguel@ximian.com>
2374 * rootcontext.cs (RootContext::IsNamespace): new function, used to
2375 tell whether an identifier represents a namespace.
2377 * expression.cs (NamespaceExpr): A namespace expression, used only
2378 temporarly during expression resolution.
2379 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
2380 utility functions to resolve names on expressions.
2382 2001-09-01 Miguel de Icaza <miguel@ximian.com>
2384 * codegen.cs: Add hook for StatementExpressions.
2386 * class.cs: Fix inverted test for static flag in methods.
2388 2001-09-02 Ravi Pratap <ravi@ximian.com>
2390 * class.cs (Operator::CheckUnaryOperator): Correct error number used
2391 to make it coincide with MS' number.
2392 (Operator::CheckBinaryOperator): Ditto.
2394 * ../errors/errors.txt : Remove error numbers added earlier.
2396 * ../errors/cs1019.cs : Test case for error # 1019
2398 * ../errros/cs1020.cs : Test case for error # 1020
2400 * cs-parser.jay : Clean out commented cruft.
2401 (dimension_separators, dimension_separator): Comment out. Ostensibly not
2402 used anywhere - non-reducing rule.
2403 (namespace_declarations): Non-reducing rule - comment out.
2405 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
2406 with TypeContainer::AddEnum.
2408 * delegate.cs : New file for delegate handling classes.
2409 (Delegate): Class for declaring delegates.
2411 * makefile : Update.
2413 * cs-parser.jay (delegate_declaration): Implement.
2415 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
2417 * class.cs (Event::Define): Implement.
2418 (Event.EventBuilder): New member.
2420 * class.cs (TypeContainer::Populate): Update to define all enums and events
2422 (Events): New property for the events arraylist we hold. Shouldn't we move to using
2423 readonly fields for all these cases ?
2425 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2427 * class.cs (Property): Revamp to use the convention of making fields readonly.
2428 Accordingly modify code elsewhere.
2430 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
2431 the Define method of the Property class.
2433 * class.cs : Clean up applied patch and update references to variables etc. Fix
2435 (TypeContainer::Populate): Update to define all the properties we have. Also
2436 define all enumerations.
2438 * enum.cs (Define): Implement.
2440 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
2442 * cs-parser.jay (overloadable_operator): The semantic value is an
2443 enum of the Operator class.
2444 (operator_declarator): Implement actions.
2445 (operator_declaration): Implement.
2447 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
2448 validity of definitions.
2449 (Operator::CheckBinaryOperator): Static method to check for binary operators
2450 (TypeContainer::AddOperator): New method to add an operator to a type.
2452 * cs-parser.jay (indexer_declaration): Added line to actually call the
2453 AddIndexer method so it gets added ;-)
2455 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
2456 already taken care of by the MS compiler ?
2458 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2460 * class.cs (Operator): New class for operator declarations.
2461 (Operator::OpType): Enum for the various operators.
2463 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
2465 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
2466 ostensibly handle this in semantic analysis.
2468 * cs-parser.jay (general_catch_clause): Comment out
2469 (specific_catch_clauses, specific_catch_clause): Ditto.
2470 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
2471 (catch_args, opt_catch_args): New productions.
2472 (catch_clause): Rewrite to use the new productions above
2473 (catch_clauses): Modify accordingly.
2474 (opt_catch_clauses): New production to use in try_statement
2475 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
2476 and re-write the code in the actions to extract the specific and
2477 general catch clauses by being a little smart ;-)
2479 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
2480 Hooray, try and catch statements parse fine !
2482 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2484 * statement.cs (Block::GetVariableType): Fix logic to extract the type
2485 string from the hashtable of variables.
2487 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
2488 I end up making that mistake ;-)
2489 (catch_clauses): Fixed gross error which made Key and Value of the
2490 DictionaryEntry the same : $1 !!
2492 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2494 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
2496 * cs-parser.jay (event_declaration): Correct to remove the semicolon
2497 when the add and remove accessors are specified.
2499 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
2501 * cs-parser.jay (IndexerDeclaration): New helper class to hold
2502 information about indexer_declarator.
2503 (indexer_declarator): Implement actions.
2504 (parsing_indexer): New local boolean used to keep track of whether
2505 we are parsing indexers or properties. This is necessary because
2506 implicit_parameters come into picture even for the get accessor in the
2508 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
2510 * class.cs (Indexer): New class for indexer declarations.
2511 (TypeContainer::AddIndexer): New method to add an indexer to a type.
2512 (TypeContainer::indexers): New member to hold list of indexers for the
2515 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2517 * cs-parser.jay (add_accessor_declaration): Implement action.
2518 (remove_accessor_declaration): Implement action.
2519 (event_accessors_declaration): Implement
2520 (variable_declarators): swap statements for first rule - trivial.
2522 * class.cs (Event): New class to hold information about event
2524 (TypeContainer::AddEvent): New method to add an event to a type
2525 (TypeContainer::events): New member to hold list of events.
2527 * cs-parser.jay (event_declaration): Implement actions.
2529 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
2531 * cs-parser.jay (dim_separators): Implement. Make it a string
2532 concatenating all the commas together, just as they appear.
2533 (opt_dim_separators): Modify accordingly
2534 (rank_specifiers): Update accordingly. Basically do the same
2535 thing - instead, collect the brackets here.
2536 (opt_rank_sepcifiers): Modify accordingly.
2537 (array_type): Modify to actually return the complete type string
2538 instead of ignoring the rank_specifiers.
2539 (expression_list): Implement to collect the expressions
2540 (variable_initializer): Implement. We make it a list of expressions
2541 essentially so that we can handle the array_initializer case neatly too.
2542 (variable_initializer_list): Implement.
2543 (array_initializer): Make it a list of variable_initializers
2544 (opt_array_initializer): Modify accordingly.
2546 * expression.cs (New::NType): Add enumeration to help us
2547 keep track of whether we have an object/delegate creation
2548 or an array creation.
2549 (New:NewType, New::Rank, New::Indices, New::Initializers): New
2550 members to hold data about array creation.
2551 (New:New): Modify to update NewType
2552 (New:New): New Overloaded contructor for the array creation
2555 * cs-parser.jay (array_creation_expression): Implement to call
2556 the overloaded New constructor.
2558 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
2560 * class.cs (TypeContainer::Constructors): Return member
2561 constructors instead of returning null.
2563 2001-08-26 Miguel de Icaza <miguel@ximian.com>
2565 * typemanager.cs (InitCoreTypes): Initialize the various core
2566 types after we have populated the type manager with the user
2567 defined types (this distinction will be important later while
2568 compiling corlib.dll)
2570 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
2571 on Expression Classification. Now all expressions have a method
2572 `Resolve' and a method `Emit'.
2574 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
2575 generation from working. Also add some temporary debugging
2578 2001-08-24 Miguel de Icaza <miguel@ximian.com>
2580 * codegen.cs: Lots of code generation pieces. This is only the
2581 beginning, will continue tomorrow with more touches of polish. We
2582 handle the fundamentals of if, while, do, for, return. Others are
2583 trickier and I need to start working on invocations soon.
2585 * gen-treedump.cs: Bug fix, use s.Increment here instead of
2588 * codegen.cs (EmitContext): New struct, used during code
2589 emission to keep a context. Most of the code generation will be
2592 * cs-parser.jay: Add embedded blocks to the list of statements of
2593 this block. So code generation proceeds in a top down fashion.
2595 2001-08-23 Miguel de Icaza <miguel@ximian.com>
2597 * statement.cs: Add support for multiple child blocks.
2599 2001-08-22 Miguel de Icaza <miguel@ximian.com>
2601 * codegen.cs (EmitCode): New function, will emit the code for a
2602 Block of code given a TypeContainer and its ILGenerator.
2604 * statement.cs (Block): Standard public readonly optimization.
2605 (Block::Block constructors): Link children.
2606 (Block::Child): Child Linker.
2607 (Block::EmitVariables): Emits IL variable declarations.
2609 * class.cs: Drop support for MethodGroups here, delay until
2611 (Method::): Applied the same simplification that I did before, and
2612 move from Properties to public readonly fields.
2613 (Method::ParameterTypes): Returns the parameter types for the
2614 function, and implements a cache that will be useful later when I
2615 do error checking and the semantic analysis on the methods is
2617 (Constructor::GetCallingConvention): Renamed from CallingConvetion
2618 and made a method, optional argument tells whether this is a class
2619 or a structure to apply the `has-this' bit.
2620 (Method::GetCallingConvention): Implement, returns the calling
2622 (Method::Define): Defines the type, a second pass is performed
2623 later to populate the methods.
2625 (Constructor::ParameterTypes): implement a cache similar to the
2626 one on Method::ParameterTypes, useful later when we do semantic
2629 (TypeContainer::EmitMethod): New method. Emits methods.
2631 * expression.cs: Removed MethodGroup class from here.
2633 * parameter.cs (Parameters::GetCallingConvention): new method.
2635 2001-08-21 Miguel de Icaza <miguel@ximian.com>
2637 * class.cs (TypeContainer::Populate): Drop RootContext from the
2640 (Constructor::CallingConvention): Returns the calling convention.
2641 (Constructor::ParameterTypes): Returns the constructor parameter
2644 (TypeContainer::AddConstructor): Keep track of default constructor
2645 and the default static constructor.
2647 (Constructor::) Another class that starts using `public readonly'
2648 instead of properties.
2650 (Constructor::IsDefault): Whether this is a default constructor.
2652 (Field::) use readonly public fields instead of properties also.
2654 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
2655 track of static constructors; If none is used, turn on
2656 BeforeFieldInit in the TypeAttributes.
2658 * cs-parser.jay (opt_argument_list): now the return can be null
2659 for the cases where there are no arguments.
2661 (constructor_declarator): If there is no implicit `base' or
2662 `this', then invoke the default parent constructor.
2664 * modifiers.cs (MethodAttr): New static function maps a set of
2665 modifiers flags into a MethodAttributes enum
2666 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
2667 MethodAttr, TypeAttr to represent the various mappings where the
2669 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
2671 2001-08-19 Miguel de Icaza <miguel@ximian.com>
2673 * parameter.cs (GetParameterInfo): Fix bug where there would be no
2676 * interface.cs (PopulateIndexer): Implemented the code generator
2677 for interface indexers.
2679 2001-08-17 Miguel de Icaza <miguel@ximian.com>
2681 * interface.cs (InterfaceMemberBase): Now we track the new status
2684 (PopulateProperty): Implement property population. Woohoo! Got
2685 Methods and Properties going today.
2687 Removed all the properties for interfaces, and replaced them with
2688 `public readonly' fields.
2690 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2692 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2693 initialize their hashtables/arraylists only when they are needed
2694 instead of doing this always.
2696 * parameter.cs: Handle refs and out parameters.
2698 * cs-parser.jay: Use an ArrayList to construct the arguments
2699 instead of the ParameterCollection, and then cast that to a
2702 * parameter.cs: Drop the use of ParameterCollection and use
2703 instead arrays of Parameters.
2705 (GetParameterInfo): Use the Type, not the Name when resolving
2708 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2710 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2711 and instead use public readonly fields.
2713 * class.cs: Put back walking code for type containers.
2715 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2717 * class.cs (MakeConstant): Code to define constants.
2719 * rootcontext.cs (LookupType): New function. Used to locate types
2722 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2724 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2725 this System.Reflection code is. Kudos to Microsoft
2727 * typemanager.cs: Implement a type cache and avoid loading all
2728 types at boot time. Wrap in LookupType the internals. This made
2729 the compiler so much faster. Wow. I rule!
2731 * driver.cs: Make sure we always load mscorlib first (for
2732 debugging purposes, nothing really important).
2734 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2735 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2737 * rootcontext.cs: Lookup types on their namespace; Lookup types
2738 on namespaces that have been imported using the `using' keyword.
2740 * class.cs (TypeContainer::TypeAttr): Virtualize.
2741 (Class::TypeAttr): Return attributes suitable for this bad boy.
2742 (Struct::TypeAttr): ditto.
2743 Handle nested classes.
2744 (TypeContainer::) Remove all the type visiting code, it is now
2745 replaced with the rootcontext.cs code
2747 * rootcontext.cs (GetClassBases): Added support for structs.
2749 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2751 * interface.cs, statement.cs, class.cs, parameter.cs,
2752 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2753 Drop use of TypeRefs, and use strings instead.
2755 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2759 * class.cs (Struct::Struct): set the SEALED flags after
2760 checking the modifiers.
2761 (TypeContainer::TypeAttr): new property, returns the
2762 TypeAttributes for a class.
2764 * cs-parser.jay (type_list): Oops, list production was creating a
2765 new list of base types.
2767 * rootcontext.cs (StdLib): New property.
2768 (GetInterfaceTypeByName): returns an interface by type name, and
2769 encapsulates error handling here.
2770 (GetInterfaces): simplified.
2771 (ResolveTree): Encapsulated all the tree resolution here.
2772 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2775 * driver.cs: Add support for --nostdlib, to avoid loading the
2777 (Main): Do not put tree resolution here.
2779 * rootcontext.cs: Beginning of the class resolution.
2781 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2783 * rootcontext.cs: Provide better error reporting.
2785 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2787 * rootcontext.cs (CreateInterface): Handle the case where there
2788 are no parent interfaces.
2790 (CloseTypes): Routine to flush types at the end.
2791 (CreateInterface): Track types.
2792 (GetInterfaces): Returns an array of Types from the list of
2795 * typemanager.c (AddUserType): Mechanism to track user types (puts
2796 the type on the global type hash, and allows us to close it at the
2799 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2801 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2802 RecordInterface instead.
2804 * cs-parser.jay: Updated to reflect changes above.
2806 * decl.cs (Definition): Keep track of the TypeBuilder type that
2807 represents this type here. Not sure we will use it in the long
2808 run, but wont hurt for now.
2810 * driver.cs: Smaller changes to accomodate the new code.
2812 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2815 * rootcontext.cs (CreateInterface): New method, used to create
2816 the System.TypeBuilder type for interfaces.
2817 (ResolveInterfaces): new entry point to resolve the interface
2819 (CodeGen): Property, used to keep track of the code generator.
2821 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2823 * cs-parser.jay: Add a second production for delegate_declaration
2826 (enum_body): Put an opt_comma here instead of putting it on
2827 enum_body or enum_member_declarations so we can handle trailing
2828 commas on enumeration members. Gets rid of a shift/reduce.
2830 (type_list): Need a COMMA in the middle.
2832 (indexer_declaration): Tell tokenizer to recognize get/set
2834 * Remove old targets.
2836 * Re-add the parser target.
2838 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2840 * cs-parser.jay: Add precendence rules for a number of operators
2841 ot reduce the number of shift/reduce conflicts in the grammar.
2843 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2845 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2848 Get rid of old crufty code.
2850 * rootcontext.cs: Use this to keep track of the parsed
2851 representation and the defined types available to the program.
2853 * gen-treedump.cs: adjust for new convention.
2855 * type.cs: Split out the type manager, and the assembly builder
2858 * typemanager.cs: the type manager will live here now.
2860 * cil-codegen.cs: And the code generator here.
2862 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2864 * makefile: Fixed up for easy making.
2866 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2868 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2871 (unary_expression): Expand pre_increment_expression and
2872 post_decrement_expression to reduce a shift/reduce.
2874 2001-07-11 Simon Cozens
2876 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2878 Improve allow_keyword_as_indent name.
2880 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2882 * Adjustments for Beta2.
2884 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2886 * decl.cs: Added `Define' abstract method.
2887 (InTransit): new property, used to catch recursive definitions.
2889 * interface.cs: Implement `Define'.
2891 * modifiers.cs: Map Modifiers.constants to
2892 System.Reflection.TypeAttribute flags.
2894 * class.cs: Keep track of types and user-defined types.
2895 (BuilderInit): New method for creating an assembly
2896 (ResolveType): New function to launch the resolution process, only
2897 used by interfaces for now.
2899 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2900 that are inserted into the name space.
2902 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2904 * ARGH. I have screwed up my tree so many times due to the use of
2905 rsync rather than using CVS. Going to fix this at once.
2907 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2910 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2912 * Experiment successful: Use System.Type rather that our own
2915 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2917 * cs-parser.jay: Removed nsAliases from here.
2919 Use new namespaces, handle `using XXX;'
2921 * namespace.cs: Reimplemented namespace handling, use a recursive
2922 definition of the class. Now we can keep track of using clauses
2923 and catch invalid using clauses.
2925 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2927 * gen-treedump.cs: Adapted for all the renaming.
2929 * expression.cs (Expression): this class now has a Type property
2930 which returns an expression Type.
2932 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2933 `Type', as this has a different meaning now in the base
2935 2001-05-22 Miguel de Icaza <miguel@ximian.com>
2937 * interface.cs, class.cs: Removed from all the sources the
2938 references to signature computation, as we can not do method
2939 signature computation during the parsing time, as we are not
2940 trying to solve at that point distinguishing:
2944 void a (NS.Blah x) {}
2947 Which depending on the context might be valid or not, as we do not
2948 know if Blah is the same thing as NS.Blah at that point.
2950 * Redid everything so the code uses TypeRefs now instead of
2951 Types. TypeRefs are just temporary type placeholders, that need
2952 to be resolved. They initially have a pointer to a string and the
2953 current scope in which they are used. This is used later by the
2954 compiler to resolve the reference to an actual Type.
2956 * DeclSpace is no longer a CIR.Type, and neither are
2957 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
2958 are all DeclSpaces, but no Types.
2960 * type.cs (TypeRefManager): This implements the TypeRef manager,
2961 which keeps track of all the types that need to be resolved after
2962 the parsing has finished.
2964 2001-05-13 Miguel de Icaza <miguel@ximian.com>
2966 * ARGH. We are going to have to store `foreach' as a class rather
2967 than resolving it, as we need to verify error 1579 after name
2968 resolution. *OR* we could keep a flag that says `This request to
2969 IEnumerator comes from a foreach statement' which we can then use
2970 to generate the error.
2972 2001-05-10 Miguel de Icaza <miguel@ximian.com>
2974 * class.cs (TypeContainer.AddMethod): we now add methods to the
2975 MethodGroup instead of the method hashtable.
2977 * expression.cs: Add MethodGroup abstraction, which gets us one
2978 step closer to the specification in the way we handle method
2981 * cs-parser.jay (primary_expression): qualified_identifier now
2982 tried to match up an identifier to a local variable reference or
2983 to a parameter reference.
2985 current_local_parameters is now a parser global variable that
2986 points to the current parameters for the block, used during name
2989 (property_declaration): Now creates an implicit `value' argument to
2992 2001-05-09 Miguel de Icaza <miguel@ximian.com>
2994 * parameter.cs: Do not use `param' arguments as part of the
2995 signature, per the spec.
2997 2001-05-08 Miguel de Icaza <miguel@ximian.com>
2999 * decl.cs: Base class for classes, structs and interfaces. This
3000 is the "Declaration Space"
3002 * cs-parser.jay: Use CheckDef for checking declaration errors
3003 instead of having one on each function.
3005 * class.cs: Factor out some code for handling error handling in
3006 accordance to the "Declarations" section in the "Basic Concepts"
3007 chapter in the ECMA C# spec.
3009 * interface.cs: Make all interface member classes derive from
3010 InterfaceMemberBase.
3012 2001-05-07 Miguel de Icaza <miguel@ximian.com>
3014 * Many things: all interfaces are parsed and generated in
3015 gen-treedump. Support for member variables, constructors,
3016 destructors, properties, constants is there.
3018 Beginning of the IL backend, but very little done, just there for
3021 2001-04-29 Miguel de Icaza <miguel@ximian.com>
3023 * cs-parser.jay: Fix labeled statement.
3025 * cs-tokenizer.cs (escape): Escape " and ' always.
3026 ref_line, ref_name: keep track of the line/filename as instructed
3027 by #line by the compiler.
3030 2001-04-27 Miguel de Icaza <miguel@ximian.com>
3032 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
3033 to match the values in System.CodeDOM.
3035 Divid renamed to Divide.
3037 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
3039 (Statements.set): remove.
3041 * System.CodeDOM/CodeCatchClause.cs: always have a valid
3044 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
3045 falseStatements always have valid values.
3047 * cs-parser.jay: Use System.CodeDOM now.