1 2001-12-11 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs: Remove reducer for binary expressions, it can not
6 * const.cs: Put here the code that used to go into constant.cs
8 * constant.cs: Put here the code for constants, this is a new base
11 * literal.cs: Make Literal derive from Constant.
13 2001-12-09 Miguel de Icaza <miguel@ximian.com>
15 * statement.cs (Return.Emit): Report error 157 if the user
16 attempts to return from a finally block.
18 (Return.Emit): Instead of emitting a return, jump to the end of
21 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
22 LocalBuilder to store the result of the function. ReturnLabel is
23 the target where we jump.
26 2001-12-09 Radek Doulik <rodo@ximian.com>
28 * cs-parser.jay: remember alias in current namespace
30 * ecore.cs (SimpleName::DoResolve): use aliases for types or
33 * class.cs (LookupAlias): lookup alias in my_namespace
35 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
37 (LookupAlias): lookup alias in this and if needed in parent
40 2001-12-08 Miguel de Icaza <miguel@ximian.com>
44 * rootcontext.cs: (ModuleBuilder) Made static, first step into
45 making things static. I need this to avoid passing the
46 TypeContainer when calling ParameterType.
48 * support.cs (InternalParameters.ParameterType): Remove ugly hack
49 that did string manipulation to compute the type and then call
50 GetType. Use Parameter.ParameterType instead.
52 * cs-tokenizer.cs: Consume the suffix for floating values.
54 * expression.cs (ParameterReference): figure out whether this is a
55 reference parameter or not. Kill an extra variable by computing
56 the arg_idx during emission.
58 * parameter.cs (Parameters.GetParameterInfo): New overloaded
59 function that returns whether a parameter is an out/ref value or not.
61 (Parameter.ParameterType): The type of the parameter (base,
62 without ref/out applied).
64 (Parameter.Resolve): Perform resolution here.
65 (Parameter.ExternalType): The full type (with ref/out applied).
67 * statement.cs (Using.Emit, Using.EmitExpression): Implement
68 support for expressions on the using statement.
70 2001-12-07 Miguel de Icaza <miguel@ximian.com>
72 * statement.cs (Using.EmitLocalVariableDecls): Split the
73 localvariable handling of the using statement.
75 (Block.EmitMeta): Keep track of variable count across blocks. We
76 were reusing slots on separate branches of blocks.
78 (Try.Emit): Emit the general code block, we were not emitting it.
80 Check the type of the declaration to be an IDisposable or
81 something that can be implicity converted to it.
83 Emit conversions if required.
85 * ecore.cs (EmptyExpression): New utility class.
86 (Expression.ImplicitConversionExists): New utility function.
88 2001-12-06 Miguel de Icaza <miguel@ximian.com>
90 * statement.cs (Using): Implement.
92 * expression.cs (LocalVariableReference): Support read only variables.
94 * statement.cs: Remove the explicit emit for the Leave opcode.
95 (VariableInfo): Add a readonly field.
97 2001-12-05 Miguel de Icaza <miguel@ximian.com>
99 * ecore.cs (ConvCast): new class used to encapsulate the various
100 explicit integer conversions that works in both checked and
103 (Expression.ConvertNumericExplicit): Use new ConvCast class to
104 properly generate the overflow opcodes.
106 2001-12-04 Miguel de Icaza <miguel@ximian.com>
108 * statement.cs: The correct type for the EmptyExpression is the
109 element_type, not the variable type. Ravi pointed this out.
111 2001-12-04 Ravi Pratap <ravi@ximian.com>
113 * class.cs (Method::Define): Handle PInvoke methods specially
114 by using DefinePInvokeMethod instead of the usual one.
116 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
117 above to do the task of extracting information and defining the method.
119 2001-12-04 Ravi Pratap <ravi@ximian.com>
121 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
122 of the condition for string type.
124 (Emit): Move that here.
126 (ArrayCreation::CheckIndices): Keep string literals in their expression
129 (EmitDynamicInitializers): Handle strings appropriately.
131 2001-12-04 Miguel de Icaza <miguel@ximian.com>
133 * codegen.cs (EmitContext): Replace multiple variables with a
134 single pointer to the current Switch statement.
136 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
139 2001-12-03 Miguel de Icaza <miguel@ximian.com>
143 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
146 (Foreach.Emit): Foreach on arrays was not setting
147 up the loop variables (for break/continue).
149 (GotoCase): Semi-implented.
151 2001-12-03 Ravi Pratap <ravi@ximian.com>
153 * attribute.cs (CheckAttribute): Handle system attributes by using
154 Attribute.GetAttributes to examine information we need.
156 (GetValidPlaces): Same here.
158 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
160 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
162 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
164 (Method::Define): Set appropriate flags if we have a DllImport attribute.
166 (Method::Emit): Handle the case when we are a PInvoke method.
168 2001-12-03 Miguel de Icaza <miguel@ximian.com>
170 * expression.cs: Use ResolveWithSimpleName on compound names.
172 2001-12-02 Ravi Pratap <ravi@ximian.com>
174 * constant.cs (EmitConstant): Make sure we resolve the associated expression
175 before trying to reduce it.
177 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
179 * constant.cs (LookupConstantValue): Implement.
181 (EmitConstant): Use the above in emitting the constant.
183 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
184 that are user-defined by doing a LookupConstantValue on them.
186 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
189 2001-11-29 Miguel de Icaza <miguel@ximian.com>
191 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
193 (BaseAccess.DoResolve): Implement.
195 (MemberAccess.DoResolve): Split this routine into a
196 ResolveMemberAccess routine that can be used independently
198 2001-11-28 Miguel de Icaza <miguel@ximian.com>
200 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
201 As that share bits of the implementation. Is returns a boolean,
202 while As returns the Type that is being probed.
204 2001-12-01 Ravi Pratap <ravi@ximian.com>
206 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
207 instead of a Literal - much easier.
209 (EnumInTransit): Remove - utterly useless :-)
211 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
213 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
215 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
216 chain when we have no associated expression.
218 2001-11-30 Ravi Pratap <ravi@ximian.com>
220 * constant.cs (Define): Use Location while reporting the errror.
222 Also emit a warning when 'new' is used and there is no inherited
225 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
228 (LookupEnumValue): Implement to lookup an enum member's value and define it
231 (Populate): Re-write accordingly to use the above routine.
233 2001-11-27 Miguel de Icaza <miguel@ximian.com>
235 * expression.cs (This): Fix prototype for DoResolveLValue to
236 override the base class DoResolveLValue.
238 * cs-parser.cs: Report errors cs574 and cs575 (destructor
241 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
242 (we need to load the address of the field here). This fixes
245 (FieldExpr.DoResolveLValue): Call the DoResolve
246 function to initialize the Instance expression.
248 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
249 correctly the GetEnumerator operation on a value type.
251 * cs-parser.jay: Add more simple parsing error catches.
253 * statement.cs (Switch): Add support for string switches.
254 Handle null specially.
256 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
258 2001-11-28 Ravi Pratap <ravi@ximian.com>
260 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
262 (declare_local_constant): New helper function.
264 * statement.cs (AddConstant): Keep a separate record of constants
266 (IsConstant): Implement to determine if a variable is a constant.
268 (GetConstantExpression): Implement.
270 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
272 * statement.cs (IsVariableDefined): Re-write.
274 2001-11-27 Ravi Pratap <ravi@ximian.com>
276 * class.cs (TypeContainer::FindMembers): Look for constants
277 in the case when we are looking for MemberTypes.Field
279 * expression.cs (MemberAccess::DoResolve): Check that in the
280 case we are a FieldExpr and a Literal, we are not being accessed
281 by an instance reference.
283 * cs-parser.jay (local_constant_declaration): Implement.
285 (declaration_statement): Implement for constant declarations.
287 2001-11-26 Miguel de Icaza <miguel@ximian.com>
289 * statement.cs (Switch): Catch double defaults.
291 (Switch): More work on the switch() statement
292 implementation. It works for integral values now, need to finish
296 2001-11-24 Miguel de Icaza <miguel@ximian.com>
298 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
299 integer literals into other integer literals. To be used by
302 2001-11-24 Ravi Pratap <ravi@ximian.com>
304 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
307 (EmitDynamicInitializers): Cope with the above since we extract data
308 directly from ArrayData now.
310 (ExpectInitializers): Keep track of whether initializers are mandatory
313 (Bounds): Make it a hashtable to prevent the same dimension being
314 recorded for every element in that dimension.
316 (EmitDynamicInitializers): Fix bug which prevented the Set array method
319 Also fix bug which was causing the indices to be emitted in the reverse
322 2001-11-24 Miguel de Icaza <miguel@ximian.com>
324 * expression.cs (ArrayCreation): Implement the bits that Ravi left
325 unfinished. They do not work, because the underlying code is
328 2001-11-22 Miguel de Icaza <miguel@ximian.com>
330 * cs-parser.jay: Remove bogus fixme.
332 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
335 2001-11-23 Ravi Pratap <ravi@ximian.com>
337 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
340 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
341 parameter. Apparently, any expression is allowed.
343 (ValidateInitializers): Update accordingly.
345 (CheckIndices): Fix some tricky bugs thanks to recursion.
347 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
348 I was being completely brain-dead.
350 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
351 and re-write acordingly.
353 (DelegateInvocation): Re-write accordingly.
355 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
357 (MakeByteBlob): Handle types more correctly.
359 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
360 initialization from expressions but it is incomplete because I am a complete
363 2001-11-22 Miguel de Icaza <miguel@ximian.com>
365 * statement.cs (If.Emit): Fix a bug that generated incorrect code
366 on If. Basically, we have to return `true' (ie, we do return to
367 our caller) only if both branches of the if return.
369 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
370 short-circuit operators, handle them as short circuit operators.
372 (Cast.DoResolve): Resolve type.
373 (Cast.Cast): Take an expression as the target type.
375 * cs-parser.jay (cast_expression): Remove old hack that only
376 allowed a limited set of types to be handled. Now we take a
377 unary_expression and we resolve to a type during semantic
380 Use the grammar productions from Rhys to handle casts (this is
381 not complete like Rhys syntax yet, we fail to handle that corner
382 case that C# has regarding (-x), but we will get there.
384 2001-11-22 Ravi Pratap <ravi@ximian.com>
386 * class.cs (EmitFieldInitializer): Take care of the case when we have a
387 field which is an array type.
389 * cs-parser.jay (declare_local_variables): Support array initialization too.
391 * typemanager.cs (MakeKey): Implement.
393 (everywhere): Use the above appropriately.
395 * cs-parser.jay (for_statement): Update for array initialization while
398 * ecore.cs : The error message was correct, it's the variable's names that
399 were misleading ;-) Make the code more readable.
401 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
402 the correct type etc.
404 (ConvertExplicit): Handle Enum types by examining the underlying type.
406 2001-11-21 Ravi Pratap <ravi@ximian.com>
408 * parameter.cs (GetCallingConvention): Always return
409 CallingConventions.Standard for now.
411 2001-11-22 Miguel de Icaza <miguel@ximian.com>
413 * expression.cs (Binary.ResolveOperator): Update the values of `l'
414 and `r' after calling DoNumericPromotions.
416 * ecore.cs: Fix error message (the types were in the wrong order).
418 * statement.cs (Foreach.ProbeCollectionType): Need to pass
419 BindingFlags.Instance as well
421 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
422 implicit int literal conversion in an empty cast so that we
423 propagate the right type upstream.
425 (UnboxCast): new class used to unbox value types.
426 (Expression.ConvertExplicit): Add explicit type conversions done
429 (Expression.ImplicitNumericConversion): Oops, forgot to test for
430 the target type before applying the implicit LongLiterals to ULong
433 2001-11-21 Miguel de Icaza <miguel@ximian.com>
435 * cs-parser.jay (for_statement): Reworked the way For works: now
436 we declare manually any variables that are introduced in
437 for_initializer to solve the problem of having out-of-band code
438 emition (that is what got for broken).
440 (declaration_statement): Perform the actual variable declaration
441 that used to be done in local_variable_declaration here.
443 (local_variable_declaration): Do not declare anything, just pass
444 the information on a DictionaryEntry
446 2001-11-20 Ravi Pratap <ravi@ximian.com>
448 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
449 re-write of the logic to now make it recursive.
451 (UpdateIndices): Re-write accordingly.
453 Store element data in a separate ArrayData list in the above methods.
455 (MakeByteBlob): Implement to dump the array data into a byte array.
457 2001-11-19 Ravi Pratap <ravi@ximian.com>
459 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
462 * constant.cs (Define): Implement.
464 (EmitConstant): Re-write fully.
466 Pass in location info.
468 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
471 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
472 DictionaryEntry since we need location info too.
474 (constant_declaration): Update accordingly.
476 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
477 code into another method : UpdateIndices.
479 2001-11-18 Ravi Pratap <ravi@ximian.com>
481 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
482 some type checking etc.
484 2001-11-17 Ravi Pratap <ravi@ximian.com>
486 * expression.cs (ArrayCreation::ValidateInitializers): Implement
487 bits to provide dimension info if the user skips doing that.
489 Update second constructor to store the rank correctly.
491 2001-11-16 Ravi Pratap <ravi@ximian.com>
493 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
494 and try to implement.
496 * ../errors/cs0150.cs : Add.
498 * ../errors/cs0178.cs : Add.
500 2001-11-16 Miguel de Icaza <miguel@ximian.com>
502 * statement.cs: Implement foreach on multi-dimensional arrays.
504 * parameter.cs (Parameters.GetParameterByName): Also lookup the
505 name of the params argument.
507 * expression.cs: Use EmitStoreOpcode to get the right opcode while
508 initializing the array.
510 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
511 we can use this elsewhere.
513 * statement.cs: Finish implementation of foreach for single
516 * cs-parser.jay: Use an out-of-band stack to pass information
517 around, I wonder why I need this.
519 foreach_block: Make the new foreach_block the current_block.
521 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
522 function used to return a static Parameters structure. Used for
523 empty parameters, as those are created very frequently.
525 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
527 2001-11-15 Ravi Pratap <ravi@ximian.com>
529 * interface.cs : Default modifier is private, not public. The
530 make verify test passes again.
532 2001-11-15 Ravi Pratap <ravi@ximian.com>
534 * support.cs (ReflectionParameters): Fix logic to determine
535 whether the last parameter is a params one. Test 9 passes again.
537 * delegate.cs (Populate): Register the builders we define with
538 RegisterParameterForBuilder. Test 19 passes again.
540 * cs-parser.jay (property_declaration): Reference $6 instead
541 of $$ to get at the location.
543 (indexer_declaration): Similar stuff.
547 * class.cs (Property): Register parameters for the Get and Set methods
548 if they exist. Test 23 passes again.
550 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
551 call to EmitArguments as we are sure there aren't any params arguments.
552 Test 32 passes again.
554 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
555 IndexOutOfRangeException.
557 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
558 Test 33 now passes again.
560 2001-11-15 Miguel de Icaza <miguel@ximian.com>
562 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
563 broke a bunch of things. Will have to come up with a better way
564 of tracking locations.
566 * statement.cs: Implemented foreach for single dimension arrays.
568 2001-11-09 Miguel de Icaza <miguel@ximian.com>
570 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
571 an error. This removes the lookup from the critical path.
573 * cs-parser.jay: Removed use of temporary_loc, which is completely
576 2001-11-14 Miguel de Icaza <miguel@ximian.com>
578 * support.cs (ReflectionParameters.ParameterModifier): Report
579 whether the argument is a PARAMS argument or not.
581 * class.cs: Set the attribute `ParamArrayAttribute' on the
584 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
585 and cons_param_array_attribute (ConstructorInfo for
586 ParamArrayAttribute).,
588 * codegen.cs: Emit the return using the `Return' statement, that
589 way we can report the error correctly for missing return values.
591 * class.cs (Method.Emit): Clean up.
593 * expression.cs (Argument.Resolve): Take another argument: the
594 location where this argument is used. Notice that this is not
595 part of the "Argument" class as to reduce the size of the
596 structure (we know the approximate location anyways).
598 Test if the argument is a variable-reference, if not, then
601 (Argument.Emit): Emit addresses of variables.
603 (Argument.FullDesc): Simplify.
605 (Invocation.DoResolve): Update for Argument.Resolve.
607 (ElementAccess.DoResolve): ditto.
609 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
610 method should be virtual, as this method is always virtual.
612 (NewDelegate.DoResolve): Update for Argument.Resolve.
614 * class.cs (ConstructorInitializer.DoResolve): ditto.
616 * attribute.cs (Attribute.Resolve): ditto.
618 2001-11-13 Miguel de Icaza <miguel@ximian.com>
620 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
622 * expression.cs (ParameterReference): Drop IStackStorage and implement
623 IAssignMethod instead.
625 (LocalVariableReference): ditto.
627 * ecore.cs (FieldExpr): Drop IStackStorage and implement
628 IAssignMethod instead.
630 2001-11-13 Miguel de Icaza <miguel@ximian.com>
632 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
633 enumerations that are used in heavily used structures derive from
634 byte in a laughable and pathetic attempt to reduce memory usage.
635 This is the kind of pre-optimzations that you should not do at
636 home without adult supervision.
638 * expression.cs (UnaryMutator): New class, used to handle ++ and
639 -- separatedly from the other unary operators. Cleans up the
640 code, and kills the ExpressionStatement dependency in Unary.
642 (Unary): Removed `method' and `Arguments' from this class, making
643 it smaller, and moving it all to SimpleCall, so I can reuse this
644 code in other locations and avoid creating a lot of transient data
645 strucutres when not required.
647 * cs-parser.jay: Adjust for new changes.
649 2001-11-11 Miguel de Icaza <miguel@ximian.com>
651 * enum.cs (Enum.Populate): If there is a failure during
654 * cs-parser.jay (opt_enum_base): we used to catch type errors
655 here, but this is really incorrect. The type error should be
656 catched during semantic analysis.
658 2001-12-11 Ravi Pratap <ravi@ximian.com>
660 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
661 current_local_parameters as expected since I, in my stupidity, had forgotten
664 * attribute.cs (GetValidPlaces): Fix stupid bug.
666 * class.cs (Method::Emit): Perform check on applicability of attributes.
668 (Constructor::Emit): Ditto.
670 (Field::Emit): Ditto.
672 (Field.Location): Store location information.
674 (Property, Event, Indexer, Operator): Ditto.
676 * cs-parser.jay (field_declaration): Pass in location for each field.
678 * ../errors/cs0592.cs : Add.
680 2001-11-12 Ravi Pratap <ravi@ximian.com>
682 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
684 (InitCoreTypes): Update accordingly.
686 (RegisterAttrType, LookupAttr): Implement.
688 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
691 (Resolve): Update to populate the above as necessary.
695 (GetValidPlaces): Helper to the above.
697 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
699 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
701 2001-11-12 Ravi Pratap <ravi@ximian.com>
703 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
705 * ../errors/cs0617.cs : Add.
707 2001-11-11 Ravi Pratap <ravi@ximian.com>
709 * enum.cs (Emit): Rename to Populate to be more consistent with what
710 we expect it to do and when exactly it is called.
712 * class.cs, rootcontext.cs : Update accordingly.
714 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
715 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
717 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
719 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
720 of a fieldinfo using the above, when dealing with a FieldBuilder.
722 2001-11-10 Ravi Pratap <ravi@ximian.com>
724 * ../errors/cs0031.cs : Add.
726 * ../errors/cs1008.cs : Add.
728 * ../errrors/cs0543.cs : Add.
730 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
733 (FindMembers): Implement.
735 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
736 enums and delegates too.
738 (enum_types): Rename to builder_to_enum.
740 (delegate_types): Rename to builder_to_delegate.
742 * delegate.cs (FindMembers): Implement.
744 2001-11-09 Ravi Pratap <ravi@ximian.com>
746 * typemanager.cs (IsEnumType): Implement.
748 * enum.cs (Emit): Re-write parts to account for the underlying type
749 better and perform checking etc.
751 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
752 of the underlying type.
754 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
757 * enum.cs (error31): Helper to report error #31.
759 * cs-parser.jay (enum_declaration): Store location of each member too.
761 * enum.cs (member_to_location): New hashtable.
763 (AddEnumMember): Update location hashtable.
765 (Emit): Use the location of each member while reporting errors.
767 2001-11-09 Miguel de Icaza <miguel@ximian.com>
769 * cs-parser.jay: A for_initializer if is a
770 local_variable_declaration really ammount to have an implicit
771 block with the variable declaration and no initializer for for.
773 * statement.cs (For.Emit): Cope with null initializers.
775 This fixes the infinite loop on for initializers.
777 2001-11-08 Miguel de Icaza <miguel@ximian.com>
779 * enum.cs: More cleanup.
781 * ecore.cs: Remove dead code.
783 * class.cs (Property.Emit): More simplification.
786 Reworked to have less levels of indentation.
788 2001-11-08 Ravi Pratap <ravi@ximian.com>
790 * class.cs (Property): Emit attributes.
800 * enum.cs (Emit): Ditto.
802 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
805 * class.cs (Field, Event, etc.): Move attribute generation into the
806 Emit method everywhere.
808 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
809 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
810 as we had no way of defining nested enums !
812 * rootcontext.cs : Adjust code accordingly.
814 * typemanager.cs (AddEnumType): To keep track of enum types separately.
816 2001-11-07 Ravi Pratap <ravi@ximian.com>
818 * expression.cs (EvalConstantExpression): Move into ecore.cs
820 * enum.cs (Enum): Rename some members and make them public and readonly
821 according to our convention.
823 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
826 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
828 (Enum::Emit): Write a simple version for now which doesn't try to compute
829 expressions. I shall modify this to be more robust in just a while.
831 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
833 (TypeContainer::CloseType): Create the Enum types too.
835 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
837 * expression.cs (EvalConstantExpression): Get rid of completely.
839 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
840 user-defined values and other cases.
842 (IsValidEnumLiteral): Helper function.
844 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
845 out there in the case we had a literal FieldExpr.
847 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
849 (Literalize): Revamp a bit to take two arguments.
851 (EnumLiteral): New class which derives from Literal to wrap enum literals.
853 2001-11-06 Ravi Pratap <ravi@ximian.com>
855 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
857 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
859 (Resolve): Use the above to ensure we have proper initializers.
861 2001-11-05 Ravi Pratap <ravi@ximian.com>
863 * expression.cs (Expression::EvalConstantExpression): New method to
864 evaluate constant expressions.
866 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
868 2001-11-07 Miguel de Icaza <miguel@ximian.com>
870 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
873 (Binary.ResolveOperator): Handle operator != (object a, object b)
874 and operator == (object a, object b);
876 (Binary.DoNumericPromotions): Indicate whether the numeric
877 promotion was possible.
879 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
882 Made the ArrayAccess implement interface IAssignMethod instead of
883 IStackStore as the order in which arguments are passed reflects
886 * assign.cs: Instead of using expr.ExprClass to select the way of
887 assinging, probe for the IStackStore/IAssignMethod interfaces.
889 * typemanager.cs: Load InitializeArray definition.
891 * rootcontext.cs (RootContext.MakeStaticData): Used to define
892 static data that can be used to initialize arrays.
894 2001-11-05 Miguel de Icaza <miguel@ximian.com>
896 * expression.cs: Handle operator== and operator!= for booleans.
898 (Conditioal.Reduce): Implement reducer for the ?: operator.
900 (Conditional.Resolve): Implement dead code elimination.
902 (Binary.Resolve): Catch string literals and return a new
905 (Unary.Reduce): Implement reduction of unary expressions.
907 * ecore.cs: Split out the expression core handling here.
909 (Expression.Reduce): New method used to perform constant folding
910 and CSE. This is needed to support constant-expressions.
912 * statement.cs (Statement.EmitBoolExpression): Pass true and false
913 targets, and optimize for !x.
915 2001-11-04 Ravi Pratap <ravi@ximian.com>
917 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
918 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
919 set custom atttributes.
921 * literal.cs (Literal::GetValue): New abstract method to return the actual
922 value of the literal, cast as an object.
924 (*Literal): Implement GetValue method.
926 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
927 expressions to the arraylist but objects of type Argument.
929 * class.cs (TypeContainer::Emit): Emit our attributes too.
931 (Method::Emit, Constructor::Emit): Ditto.
933 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
934 to be ignoring earlier.
936 2001-11-03 Ravi Pratap <ravi@ximian.com>
938 * attribute.cs (AttributeSection::Define): Implement to do the business
939 of constructing a CustomAttributeBuilder.
941 (Attribute): New trivial class. Increases readability of code.
943 * cs-parser.jay : Update accordingly.
945 (positional_argument_list, named_argument_list, named_argument): New rules
947 (attribute_arguments): Use the above so that we are more correct.
949 2001-11-02 Ravi Pratap <ravi@ximian.com>
951 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
952 to perform all checks for a method with a params parameter.
954 (Invocation::OverloadResolve): Update to use the above method and therefore
955 cope correctly with params method invocations.
957 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
960 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
961 constructors in our parent too because we can't afford to miss out on
964 * attribute.cs (AttributeSection): New name for the class Attribute
966 Other trivial changes to improve readability.
968 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
969 use the new class names.
971 2001-11-01 Ravi Pratap <ravi@ximian.com>
973 * class.cs (Method::Define): Complete definition for params types too
975 (Indexer::Define): Ditto.
977 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
978 Cope everywhere with a request for info about the array parameter.
980 2001-11-01 Ravi Pratap <ravi@ximian.com>
982 * tree.cs (RecordNamespace): Fix up to check for the correct key.
984 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
985 local_variable_type to extract the string corresponding to the type.
987 (local_variable_type): Fixup the action to use the new helper method.
989 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
992 * expression.cs : Clean out code which uses the above.
994 2001-10-31 Ravi Pratap <ravi@ximian.com>
996 * typemanager.cs (RegisterMethod): Check if we already have an existing key
997 and bale out if necessary by returning a false.
999 (RegisterProperty): Ditto.
1001 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
1002 and print out appropriate error messages.
1004 * interface.cs (everywhere): Ditto.
1006 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
1007 location to constructor.
1009 * class.cs (Property, Event, Indexer): Update accordingly.
1011 * ../errors/cs111.cs : Added.
1013 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
1014 of a method, as laid down by the spec.
1016 (Invocation::OverloadResolve): Use the above method.
1018 2001-10-31 Ravi Pratap <ravi@ximian.com>
1020 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
1021 now take a TypeContainer and a Parameters object.
1023 (ParameterData): Modify return type of ParameterModifier method to be
1024 Parameter.Modifier and not a string.
1026 (ReflectionParameters, InternalParameters): Update accordingly.
1028 * expression.cs (Argument::GetParameterModifier): Same here.
1030 * support.cs (InternalParameters::ParameterType): Find a better way of determining
1031 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
1032 symbol in it at all so maybe this is only for now.
1034 2001-10-30 Ravi Pratap <ravi@ximian.com>
1036 * support.cs (InternalParameters): Constructor now takes an extra argument
1037 which is the actual Parameters class.
1039 (ParameterDesc): Update to provide info on ref/out modifiers.
1041 * class.cs (everywhere): Update call to InternalParameters to pass in
1042 the second argument too.
1044 * support.cs (ParameterData): Add ParameterModifier, which is a method
1045 to return the modifier info [ref/out etc]
1047 (InternalParameters, ReflectionParameters): Implement the above.
1049 * expression.cs (Argument::ParameterModifier): Similar function to return
1050 info about the argument's modifiers.
1052 (Invocation::OverloadResolve): Update to take into account matching modifiers
1055 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
1056 a new SetFormalParameters object which we pass to InternalParameters.
1058 2001-10-30 Ravi Pratap <ravi@ximian.com>
1060 * expression.cs (NewArray): Merge into the ArrayCreation class.
1062 2001-10-29 Ravi Pratap <ravi@ximian.com>
1064 * expression.cs (NewArray): Merge classes NewBuiltinArray and
1065 NewUserdefinedArray into one as there wasn't much of a use in having
1068 * expression.cs (Argument): Change field's name to ArgType from Type.
1070 (Type): New readonly property which returns the proper type, taking into
1071 account ref/out modifiers.
1073 (everywhere): Adjust code accordingly for the above.
1075 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
1076 whether we are emitting for a ref or out parameter.
1078 * expression.cs (Argument::Emit): Use the above field to set the state.
1080 (LocalVariableReference::Emit): Update to honour the flag and emit the
1083 * parameter.cs (Attributes): Set the correct flags for ref parameters.
1085 * expression.cs (Argument::FullDesc): New function to provide a full desc.
1087 * support.cs (ParameterData): Add method ParameterDesc to the interface.
1089 (ReflectionParameters, InternalParameters): Implement the above method.
1091 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
1094 (Invocation::FullMethodDesc): Ditto.
1096 2001-10-29 Miguel de Icaza <miguel@ximian.com>
1098 * cs-parser.jay: Add extra production for the second form of array
1101 * expression.cs (ArrayCreation): Update to reflect the above
1104 * Small changes to prepare for Array initialization.
1106 2001-10-28 Miguel de Icaza <miguel@ximian.com>
1108 * typemanager.cs (ImplementsInterface): interface might be null;
1109 Deal with this problem;
1111 Also, we do store negative hits on the cache (null values), so use
1112 this instead of calling t.GetInterfaces on the type everytime.
1114 2001-10-28 Ravi Pratap <ravi@ximian.com>
1116 * typemanager.cs (IsBuiltinType): New method to help determine the same.
1118 * expression.cs (New::DoResolve): Get rid of array creation code and instead
1119 split functionality out into different classes.
1121 (New::FormArrayType): Move into NewBuiltinArray.
1123 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
1126 (NewBuiltinArray): New class to handle creation of built-in arrays.
1128 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
1129 account creation of one-dimensional arrays.
1131 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
1133 (NewUserdefinedArray::DoResolve): Implement.
1135 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
1137 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
1138 we maintain inside the TypeManager. This is necessary to perform lookups on the
1141 (LookupType): Update to perform GetType on the module builders too.
1143 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
1145 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
1147 2001-10-23 Ravi Pratap <ravi@ximian.com>
1149 * expression.cs (New::DoResolve): Implement guts of array creation.
1151 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
1153 2001-10-27 Miguel de Icaza <miguel@ximian.com>
1155 * expression.cs: Fix bug I introduced lsat night that broke
1158 (Expression.Resolve): Report a 246 error (can not resolve name)
1159 if we find a SimpleName in the stream.
1161 (Expression.ResolveLValue): Ditto.
1163 (Expression.ResolveWithSimpleName): This function is a variant of
1164 ResolveName, this one allows SimpleNames to be returned without a
1165 warning. The only consumer of SimpleNames is MemberAccess
1167 2001-10-26 Miguel de Icaza <miguel@ximian.com>
1169 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
1170 might arrive here. I have my doubts that this is correct.
1172 * statement.cs (Lock): Implement lock statement.
1174 * cs-parser.jay: Small fixes to support `lock' and `using'
1176 * cs-tokenizer.cs: Remove extra space
1178 * driver.cs: New flag --checked, allows to turn on integer math
1181 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
1182 Threading.Monitor.Exit
1184 2001-10-23 Miguel de Icaza <miguel@ximian.com>
1186 * expression.cs (IndexerAccess::DoResolveLValue): Set the
1187 Expression Class to be IndexerAccess.
1189 Notice that Indexer::DoResolve sets the eclass to Value.
1191 2001-10-22 Miguel de Icaza <miguel@ximian.com>
1193 * class.cs (TypeContainer::Emit): Emit code for indexers.
1195 * assign.cs (IAssignMethod): New interface implemented by Indexers
1196 and Properties for handling assignment.
1198 (Assign::Emit): Simplify and reuse code.
1200 * expression.cs (IndexerAccess, PropertyExpr): Implement
1201 IAssignMethod, clean up old code.
1203 2001-10-22 Ravi Pratap <ravi@ximian.com>
1205 * typemanager.cs (ImplementsInterface): New method to determine if a type
1206 implements a given interface. Provides a nice cache too.
1208 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
1211 (ConvertReferenceExplicit): Ditto.
1213 * delegate.cs (Delegate::Populate): Update to define the parameters on the
1214 various methods, with correct names etc.
1216 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
1217 Operator.UnaryNegation.
1219 * cs-parser.jay (operator_declarator): Be a little clever in the case where
1220 we have a unary plus or minus operator.
1222 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
1225 * everywhere : update accordingly.
1227 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
1230 * class.cs (Method::Define): For the case where we are implementing a method
1231 inherited from an interface, we need to set the MethodAttributes.Final flag too.
1232 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
1234 2001-10-21 Ravi Pratap <ravi@ximian.com>
1236 * interface.cs (FindMembers): Implement to work around S.R.E
1239 * typemanager.cs (IsInterfaceType): Implement.
1241 (FindMembers): Update to handle interface types too.
1243 * expression.cs (ImplicitReferenceConversion): Re-write bits which
1244 use IsAssignableFrom as that is not correct - it doesn't work.
1246 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
1247 and accordingly override EmitStatement.
1249 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
1250 using the correct logic :-)
1252 2001-10-19 Ravi Pratap <ravi@ximian.com>
1254 * ../errors/cs-11.cs : Add to demonstrate error -11
1256 2001-10-17 Miguel de Icaza <miguel@ximian.com>
1258 * assign.cs (Assign::Resolve): Resolve right hand side first, and
1259 then pass this as a hint to ResolveLValue.
1261 * expression.cs (FieldExpr): Add Location information
1263 (FieldExpr::LValueResolve): Report assignment to readonly
1266 (Expression::ExprClassFromMemberInfo): Pass location information.
1268 (Expression::ResolveLValue): Add new method that resolves an
1271 (Expression::DoResolveLValue): Default invocation calls
1274 (Indexers): New class used to keep track of indexers in a given
1277 (IStackStore): Renamed from LValue, as it did not really describe
1278 what this did. Also ResolveLValue is gone from this interface and
1279 now is part of Expression.
1281 (ElementAccess): Depending on the element access type
1283 * typemanager.cs: Add `indexer_name_type' as a Core type
1284 (System.Runtime.CompilerServices.IndexerNameAttribute)
1286 * statement.cs (Goto): Take a location.
1288 2001-10-18 Ravi Pratap <ravi@ximian.com>
1290 * delegate.cs (Delegate::VerifyDelegate): New method to verify
1291 if two delegates are compatible.
1293 (NewDelegate::DoResolve): Update to take care of the case when
1294 we instantiate a delegate from another delegate.
1296 * typemanager.cs (FindMembers): Don't even try to look up members
1297 of Delegate types for now.
1299 2001-10-18 Ravi Pratap <ravi@ximian.com>
1301 * delegate.cs (NewDelegate): New class to take care of delegate
1304 * expression.cs (New): Split the delegate related code out into
1305 the NewDelegate class.
1307 * delegate.cs (DelegateInvocation): New class to handle delegate
1310 * expression.cs (Invocation): Split out delegate related code into
1311 the DelegateInvocation class.
1313 2001-10-17 Ravi Pratap <ravi@ximian.com>
1315 * expression.cs (New::DoResolve): Implement delegate creation fully
1316 and according to the spec.
1318 (New::DoEmit): Update to handle delegates differently.
1320 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
1321 because of which we were printing out arguments in reverse order !
1323 * delegate.cs (VerifyMethod): Implement to check if the given method
1324 matches the delegate.
1326 (FullDelegateDesc): Implement.
1328 (VerifyApplicability): Implement.
1330 * expression.cs (Invocation::DoResolve): Update to accordingly handle
1331 delegate invocations too.
1333 (Invocation::Emit): Ditto.
1335 * ../errors/cs1593.cs : Added.
1337 * ../errors/cs1594.cs : Added.
1339 * delegate.cs (InstanceExpression, TargetMethod): New properties.
1341 2001-10-16 Ravi Pratap <ravi@ximian.com>
1343 * typemanager.cs (intptr_type): Core type for System.IntPtr
1345 (InitCoreTypes): Update for the same.
1347 (iasyncresult_type, asynccallback_type): Ditto.
1349 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
1352 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
1355 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
1356 the builders for the 4 members of a delegate type :-)
1358 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
1361 * expression.cs (New::DoResolve): Implement guts for delegate creation.
1363 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
1365 2001-10-15 Miguel de Icaza <miguel@ximian.com>
1367 * statement.cs (Break::Emit): Implement.
1368 (Continue::Emit): Implement.
1370 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
1371 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
1372 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
1373 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
1376 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
1377 properties that track the label for the current loop (begin of the
1378 loop and end of the loop).
1380 2001-10-15 Ravi Pratap <ravi@ximian.com>
1382 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
1383 use of emitting anything at all.
1385 * class.cs, rootcontext.cs : Get rid of calls to the same.
1387 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
1389 (Populate): Define the constructor correctly and set the implementation
1392 * typemanager.cs (delegate_types): New hashtable to hold delegates that
1395 (AddDelegateType): Implement.
1397 (IsDelegateType): Implement helper method.
1399 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
1401 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
1402 and accordingly handle it.
1404 * delegate.cs (Populate): Take TypeContainer argument.
1405 Implement bits to define the Invoke method. However, I still haven't figured out
1406 how to take care of the native int bit :-(
1408 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
1409 Qualify the name of the delegate, not its return type !
1411 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
1414 (StandardConversionExists): Checking for array types turns out to be recursive.
1416 (ConvertReferenceExplicit): Implement array conversion.
1418 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
1420 2001-10-12 Ravi Pratap <ravi@ximian.com>
1422 * cs-parser.jay (delegate_declaration): Store the fully qualified
1423 name as it is a type declaration.
1425 * delegate.cs (ReturnType, Name): Rename members to these. Make them
1428 (DefineDelegate): Renamed from Define. Does the same thing essentially,
1429 as TypeContainer::DefineType.
1431 (Populate): Method in which all the definition of the various methods (Invoke)
1434 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
1437 (CloseDelegate): Finally creates the delegate.
1439 * class.cs (TypeContainer::DefineType): Update to define delegates.
1440 (Populate, Emit and CloseType): Do the same thing here too.
1442 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
1443 delegates in all these operations.
1445 2001-10-14 Miguel de Icaza <miguel@ximian.com>
1447 * expression.cs: LocalTemporary: a new expression used to
1448 reference a temporary that has been created.
1450 * assign.cs: Handle PropertyAccess back here, so that we can
1451 provide the proper semantic access to properties.
1453 * expression.cs (Expression::ConvertReferenceExplicit): Implement
1454 a few more explicit conversions.
1456 * modifiers.cs: `NEW' modifier maps to HideBySig.
1458 * expression.cs (PropertyExpr): Make this into an
1459 ExpressionStatement, and support the EmitStatement code path.
1461 Perform get/set error checking, clean up the interface.
1463 * assign.cs: recognize PropertyExprs as targets, and if so, turn
1464 them into toplevel access objects.
1466 2001-10-12 Miguel de Icaza <miguel@ximian.com>
1468 * expression.cs: PropertyExpr::PropertyExpr: use work around the
1471 * typemanager.cs: Keep track here of our PropertyBuilders again to
1472 work around lameness in SRE.
1474 2001-10-11 Miguel de Icaza <miguel@ximian.com>
1476 * expression.cs (LValue::LValueResolve): New method in the
1477 interface, used to perform a second resolution pass for LValues.
1479 (This::DoResolve): Catch the use of this in static methods.
1481 (This::LValueResolve): Implement.
1483 (This::Store): Remove warning, assigning to `this' in structures
1486 (Invocation::Emit): Deal with invocation of
1487 methods on value types. We need to pass the address to structure
1488 methods rather than the object itself. (The equivalent code to
1489 emit "this" for structures leaves the entire structure on the
1490 stack instead of a pointer to it).
1492 (ParameterReference::DoResolve): Compute the real index for the
1493 argument based on whether the method takes or not a `this' pointer
1494 (ie, the method is static).
1496 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
1497 value types returned from functions when we need to invoke a
1498 method on the sturcture.
1501 2001-10-11 Ravi Pratap <ravi@ximian.com>
1503 * class.cs (TypeContainer::DefineType): Method to actually do the business of
1504 defining the type in the Modulebuilder or Typebuilder. This is to take
1505 care of nested types which need to be defined on the TypeBuilder using
1508 (TypeContainer::GetClassBases): Implement. Essentially the code from the
1509 methods in RootContext, only ported to be part of TypeContainer.
1511 (TypeContainer::GetInterfaceOrClass): Ditto.
1513 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
1515 * interface.cs (Interface::DefineInterface): New method. Does exactly
1516 what RootContext.CreateInterface did earlier, only it takes care of nested types
1519 (Interface::GetInterfaces): Move from RootContext here and port.
1521 (Interface::GetInterfaceByName): Same here.
1523 * rootcontext.cs (ResolveTree): Re-write.
1525 (PopulateTypes): Re-write.
1527 * class.cs (TypeContainer::Populate): Populate nested types too.
1528 (TypeContainer::Emit): Emit nested members too.
1530 * typemanager.cs (AddUserType): Do not make use of the FullName property,
1531 instead just use the name argument passed in as it is already fully
1534 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
1535 to TypeContainer mapping to see if a type is user-defined.
1537 * class.cs (TypeContainer::CloseType): Implement.
1539 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
1540 the default constructor.
1542 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
1545 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
1547 * interface.cs (CloseType): Create the type here.
1549 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
1552 Remove all the methods which are now in TypeContainer.
1554 2001-10-10 Ravi Pratap <ravi@ximian.com>
1556 * delegate.cs (Define): Re-write bits to define the delegate
1559 2001-10-10 Miguel de Icaza <miguel@ximian.com>
1561 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
1563 * expression.cs (ImplicitReferenceConversion): handle null as well
1564 as a source to convert to any reference type.
1566 * statement.cs (Return): Perform any implicit conversions to
1567 expected return type.
1569 Validate use of return statement.
1571 * codegen.cs (EmitContext): Pass the expected return type here.
1573 * class.cs (Method, Constructor, Property): Pass expected return
1574 type to EmitContext.
1576 2001-10-09 Miguel de Icaza <miguel@ximian.com>
1578 * expression.cs: Make DoResolve take an EmitContext instead of a
1581 Replaced `l' and `location' for `loc', for consistency.
1583 (Error, Warning): Remove unneeded Tc argument.
1585 * assign.cs, literal.cs, constant.cs: Update to new calling
1588 * codegen.cs: EmitContext now contains a flag indicating whether
1589 code is being generated in a static method or not.
1591 * cs-parser.jay: DecomposeQI, new function that replaces the old
1592 QualifiedIdentifier. Now we always decompose the assembled
1593 strings from qualified_identifier productions into a group of
1596 2001-10-08 Miguel de Icaza <miguel@ximian.com>
1598 * rootcontext.cs: Deal with field-less struct types correctly now
1599 by passing the size option to Define Type.
1601 * class.cs: Removed hack that created one static field.
1603 2001-10-07 Miguel de Icaza <miguel@ximian.com>
1605 * statement.cs: Moved most of the code generation here.
1607 2001-10-09 Ravi Pratap <ravi@ximian.com>
1609 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
1612 (ElementAccess): Remove useless bits for now - keep checks as the spec
1615 2001-10-08 Ravi Pratap <ravi@ximian.com>
1617 * expression.cs (ElementAccess::DoResolve): Remove my crap code
1618 and start performing checks according to the spec.
1620 2001-10-07 Ravi Pratap <ravi@ximian.com>
1622 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
1623 rank_specifiers instead.
1625 (rank_specifiers): Change the order in which the rank specifiers are stored
1627 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
1629 * expression.cs (ElementAccess): Implement the LValue interface too.
1631 2001-10-06 Ravi Pratap <ravi@ximian.com>
1633 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
1634 except that user defined conversions are not included.
1636 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
1637 perform the conversion of the return type, if necessary.
1639 (New::DoResolve): Check whether we are creating an array or an object
1640 and accordingly do the needful.
1642 (New::Emit): Same here.
1644 (New::DoResolve): Implement guts of array creation.
1646 (New::FormLookupType): Helper function.
1648 2001-10-07 Miguel de Icaza <miguel@ximian.com>
1650 * codegen.cs: Removed most of the code generation here, and move the
1651 corresponding code generation bits to the statement classes.
1653 Added support for try/catch/finalize and throw.
1655 * cs-parser.jay: Added support for try/catch/finalize.
1657 * class.cs: Catch static methods having the flags override,
1658 virtual or abstract.
1660 * expression.cs (UserCast): This user cast was not really doing
1661 what it was supposed to do. Which is to be born in fully resolved
1662 state. Parts of the resolution were being performed at Emit time!
1666 2001-10-05 Miguel de Icaza <miguel@ximian.com>
1668 * expression.cs: Implicity convert the result from UserCast.
1670 2001-10-05 Ravi Pratap <ravi@ximian.com>
1672 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
1673 prevented it from working correctly.
1675 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
1676 merely ConvertImplicit.
1678 2001-10-05 Miguel de Icaza <miguel@ximian.com>
1680 * typemanager.cs: Make the LookupTypeContainer function static,
1681 and not per-instance.
1683 * class.cs: Make static FindMembers (the one that takes a Type
1686 * codegen.cs: Add EmitForeach here.
1688 * cs-parser.jay: Make foreach a toplevel object instead of the
1689 inline expansion, as we need to perform semantic analysis on it.
1691 2001-10-05 Ravi Pratap <ravi@ximian.com>
1693 * expression.cs (Expression::ImplicitUserConversion): Rename to
1694 UserDefinedConversion.
1696 (Expression::UserDefinedConversion): Take an extra argument specifying
1697 whether we look for explicit user conversions too.
1699 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
1701 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
1703 (ExplicitUserConversion): Make it a call to UserDefinedConversion
1704 with the appropriate arguments.
1706 * cs-parser.jay (cast_expression): Record location too.
1708 * expression.cs (Cast): Record location info.
1710 (Expression::ConvertExplicit): Take location argument.
1712 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
1713 to determine if we are doing explicit conversions.
1715 (UserCast::Emit): Update accordingly.
1717 (Expression::ConvertExplicit): Report an error if everything fails.
1719 * ../errors/cs0030.cs : Add.
1721 2001-10-04 Miguel de Icaza <miguel@ximian.com>
1723 * modifiers.cs: If the ABSTRACT keyword is present, also set the
1724 virtual and newslot bits.
1726 * class.cs (TypeContainer::RegisterRequiredImplementations):
1727 Record methods we need.
1729 (TypeContainer::MakeKey): Helper function to make keys for
1730 MethodBases, since the Methodbase key is useless.
1732 (TypeContainer::Populate): Call RegisterRequiredImplementations
1733 before defining the methods.
1735 Create a mapping for method_builders_to_methods ahead of time
1736 instead of inside a tight loop.
1738 (::RequireMethods): Accept an object as the data to set into the
1739 hashtable so we can report interface vs abstract method mismatch.
1741 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1743 * report.cs: Make all of it static.
1745 * rootcontext.cs: Drop object_type and value_type computations, as
1746 we have those in the TypeManager anyways.
1748 Drop report instance variable too, now it is a global.
1750 * driver.cs: Use try/catch on command line handling.
1752 Add --probe option to debug the error reporting system with a test
1755 * report.cs: Add support for exiting program when a probe
1756 condition is reached.
1758 2001-10-03 Ravi Pratap <ravi@ximian.com>
1760 * expression.cs (Binary::DoNumericPromotions): Fix the case when
1761 we do a forcible conversion regardless of type, to check if
1762 ForceConversion returns a null.
1764 (Binary::error19): Use location to report error.
1766 (Unary::error23): Use location here too.
1768 * ../errors/cs0019.cs : Check in.
1770 * ../errors/cs0023.cs : Check in.
1772 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
1773 case of a non-null MethodInfo object with a length of 0 !
1775 (Binary::ResolveOperator): Flag error if overload resolution fails to find
1776 an applicable member - according to the spec :-)
1777 Also fix logic to find members in base types.
1779 (Unary::ResolveOperator): Same here.
1781 (Unary::report23): Change name to error23 and make first argument a TypeContainer
1782 as I was getting thoroughly confused between this and error19 :-)
1784 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
1785 (::FindMostEncompassedType): Implement.
1786 (::FindMostEncompassingType): Implement.
1787 (::StandardConversionExists): Implement.
1789 (UserImplicitCast): Re-vamp. We now need info about most specific
1790 source and target types so that we can do the necessary conversions.
1792 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
1793 mathematical union with no duplicates.
1795 2001-10-03 Miguel de Icaza <miguel@ximian.com>
1797 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
1798 in order from base classes to child classes, so that we can in
1799 child classes look up in our parent for method names and
1800 attributes (required for handling abstract, virtual, new, override
1801 constructs: we need to instrospect our base class, and if we dont
1802 populate the classes in order, the introspection might be
1803 incorrect. For example, a method could query its parent before
1804 the parent has any methods and would determine that the parent has
1805 no abstract methods (while it could have had them)).
1807 (RootContext::CreateType): Record the order in which we define the
1810 2001-10-02 Miguel de Icaza <miguel@ximian.com>
1812 * class.cs (TypeContainer::Populate): Also method definitions can
1813 fail now, keep track of this.
1815 (TypeContainer::FindMembers): Implement support for
1816 DeclaredOnly/noDeclaredOnly flag.
1818 (Constructor::Emit) Return the ConstructorBuilder.
1820 (Method::Emit) Return the MethodBuilder.
1821 Check for abstract or virtual methods to be public.
1823 * rootcontext.cs (RootContext::CreateType): Register all the
1824 abstract methods required for the class to be complete and the
1825 interface methods that must be implemented.
1827 * cs-parser.jay: Report error 501 (method requires body if it is
1828 not marked abstract or extern).
1830 * expression.cs (TypeOf::Emit): Implement.
1832 * typemanager.cs: runtime_handle_type, new global type.
1834 * class.cs (Property::Emit): Generate code for properties.
1836 2001-10-02 Ravi Pratap <ravi@ximian.com>
1838 * expression.cs (Unary::ResolveOperator): Find operators on base type
1839 too - we now conform exactly to the spec.
1841 (Binary::ResolveOperator): Same here.
1843 * class.cs (Operator::Define): Fix minor quirk in the tests.
1845 * ../errors/cs0215.cs : Added.
1847 * ../errors/cs0556.cs : Added.
1849 * ../errors/cs0555.cs : Added.
1851 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1853 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
1854 single integer which is really efficient
1856 2001-10-01 Ravi Pratap <ravi@ximian.com>
1858 * expression.cs (Expression::ImplicitUserConversion): Use location
1859 even in the case when we are examining True operators.
1861 * class.cs (Operator::Define): Perform extensive checks to conform
1862 with the rules for operator overloading in the spec.
1864 * expression.cs (Expression::ImplicitReferenceConversion): Implement
1865 some of the other conversions mentioned in the spec.
1867 * typemanager.cs (array_type): New static member for the System.Array built-in
1870 (cloneable_interface): For System.ICloneable interface.
1872 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
1873 we start resolving the tree and populating types.
1875 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
1877 2001-10-01 Miguel de Icaza <miguel@ximian.com>
1879 * expression.cs (Expression::ExprClassFromMemberInfo,
1880 Expression::Literalize): Create literal expressions from
1881 FieldInfos which are literals.
1883 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
1884 type casts, because they were wrong. The test suite in tests
1887 (ImplicitNumericConversion): ushort to ulong requires a widening
1890 Int32 constant to long requires widening cast as well.
1892 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
1893 for integers because the type on the stack is not i4.
1895 2001-09-30 Miguel de Icaza <miguel@ximian.com>
1897 * expression.cs (report118): require location argument.
1899 * parameter.cs: Do not dereference potential null value.
1901 * class.cs: Catch methods that lack the `new' keyword when
1902 overriding a name. Report warnings when `new' is used without
1903 anything being there to override.
1905 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
1907 * class.cs: Only add constructor to hashtable if it is non-null
1908 (as now constructors can fail on define).
1910 (TypeManager, Class, Struct): Take location arguments.
1912 Catch field instance initialization in structs as errors.
1914 accepting_filter: a new filter for FindMembers that is static so
1915 that we dont create an instance per invocation.
1917 (Constructor::Define): Catch errors where a struct constructor is
1920 * cs-parser.jay: Pass location information for various new
1923 * delegate.cs (Delegate): take a location argument.
1925 * driver.cs: Do not call EmitCode if there were problesm in the
1926 Definition of the types, as many Builders wont be there.
1928 * decl.cs (Decl::Decl): Require a location argument.
1930 * cs-tokenizer.cs: Handle properly hex constants that can not fit
1931 into integers, and find the most appropiate integer for it.
1933 * literal.cs: Implement ULongLiteral.
1935 * rootcontext.cs: Provide better information about the location of
1936 failure when CreateType fails.
1938 2001-09-29 Miguel de Icaza <miguel@ximian.com>
1940 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
1943 * expression.cs (Binary::CheckShiftArguments): Add missing type
1945 (Binary::ResolveOperator): Add type to the logical and and logical
1946 or, Bitwise And/Or and Exclusive Or code paths, it was missing
1949 (Binary::DoNumericPromotions): In the case where either argument
1950 is ulong (and most signed types combined with ulong cause an
1951 error) perform implicit integer constant conversions as well.
1953 2001-09-28 Miguel de Icaza <miguel@ximian.com>
1955 * expression.cs (UserImplicitCast): Method should always be
1957 (Invocation::BetterConversion): Simplified test for IntLiteral.
1959 (Expression::ImplicitNumericConversion): Split this routine out.
1960 Put the code that performs implicit constant integer conversions
1963 (Expression::Resolve): Become a wrapper around DoResolve so we can
1964 check eclass and type being set after resolve.
1966 (Invocation::Badness): Remove this dead function
1968 (Binary::ResolveOperator): Do not compute the expensive argumnets
1969 unless we have a union for it.
1971 (Probe::Emit): Is needs to do an isinst and then
1972 compare against null.
1974 (::CanConvert): Added Location argument. If the Location argument
1975 is null (Location.Null), then we do not report errors. This is
1976 used by the `probe' mechanism of the Explicit conversion. We do
1977 not want to generate an error for something that the user
1978 explicitly requested to be casted. But the pipeline for an
1979 explicit cast first tests for potential implicit casts.
1981 So for now, if the Location is null, it means `Probe only' to
1982 avoid adding another argument. Might have to revise this
1985 (ClassCast): New class used to type cast objects into arbitrary
1986 classes (used in Explicit Reference Conversions).
1988 Implement `as' as well.
1990 Reverted all the patches from Ravi below: they were broken:
1992 * The use of `level' as a mechanism to stop recursive
1993 invocations is wrong. That was there just to catch the
1994 bug with a strack trace but not as a way of addressing
1997 To fix the problem we have to *understand* what is going
1998 on and the interactions and come up with a plan, not
1999 just get things going.
2001 * The use of the type conversion cache that I proposed
2002 last night had an open topic: How does this work across
2003 protection domains. A user defined conversion might not
2004 be public in the location where we are applying the
2005 conversion, a different conversion might be selected
2006 (ie, private A->B (better) but public B->A (worse),
2007 inside A, A->B applies, but outside it, B->A will
2010 * On top of that (ie, even if the above is solved),
2011 conversions in a cache need to be abstract. Ie, `To
2012 convert from an Int to a Short use an OpcodeCast', not
2013 `To convert from an Int to a Short use the OpcodeCast on
2014 the variable 5' (which is what this patch was doing).
2016 2001-09-28 Ravi Pratap <ravi@ximian.com>
2018 * expression.cs (Invocation::ConversionExists): Re-write to use
2019 the conversion cache
2021 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
2022 cache all conversions done, not just user-defined ones.
2024 (Invocation::BetterConversion): The real culprit. Use ConversionExists
2025 to determine if a conversion exists instead of acutually trying to
2026 perform the conversion. It's faster too.
2028 (Expression::ConvertExplicit): Modify to use ConversionExists to check
2029 and only then attempt the implicit conversion.
2031 2001-09-28 Ravi Pratap <ravi@ximian.com>
2033 * expression.cs (ConvertImplicit): Use a cache for conversions
2034 already found. Check level of recursion and bail out if necessary.
2036 2001-09-28 Miguel de Icaza <miguel@ximian.com>
2038 * typemanager.cs (string_concat_string_string, string_concat_object_object):
2039 Export standard methods that we expect for string operations.
2041 * statement.cs (Block::UsageWarning): Track usage of variables and
2042 report the errors for not used variables.
2044 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
2047 2001-09-27 Miguel de Icaza <miguel@ximian.com>
2049 * codegen.cs: remove unnneded code
2051 * expression.cs: Removed BuiltinTypeAccess class
2053 Fix the order in which implicit conversions are
2056 The previous fixed dropped support for boxed conversions (adding a
2057 test to the test suite now)
2059 (UserImplicitCast::CanConvert): Remove test for source being null,
2060 that code is broken. We should not feed a null to begin with, if
2061 we do, then we should track the bug where the problem originates
2062 and not try to cover it up here.
2064 Return a resolved expression of type UserImplicitCast on success
2065 rather than true/false. Ravi: this is what I was talking about,
2066 the pattern is to use a static method as a "constructor" for
2069 Also, do not create arguments until the very last minute,
2070 otherwise we always create the arguments even for lookups that
2071 will never be performed.
2073 (UserImplicitCast::Resolve): Eliminate, objects of type
2074 UserImplicitCast are born in a fully resolved state.
2076 * typemanager.cs (InitCoreTypes): Init also value_type
2079 * expression.cs (Cast::Resolve): First resolve the child expression.
2081 (LValue): Add new method AddressOf to be used by
2084 Change the argument of Store to take an EmitContext instead of an
2085 ILGenerator, because things like FieldExpr need to be able to call
2086 their children expression to generate the instance code.
2088 (Expression::Error, Expression::Warning): Sugar functions for
2091 (Expression::MemberLookup): Accept a TypeContainer instead of a
2092 Report as the first argument.
2094 (Expression::ResolvePrimary): Killed. I still want to improve
2095 this as currently the code is just not right.
2097 (Expression::ResolveMemberAccess): Simplify, but it is still
2100 (Unary::Resolve): Catch errors in AddressOf operators.
2102 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
2103 index to a byte for the short-version, or the compiler will choose
2104 the wrong Emit call, which generates the wrong data.
2106 (ParameterReference::Emit, ::Store): same.
2108 (FieldExpr::AddressOf): Implement.
2110 * typemanager.cs: TypeManager: made public variable instead of
2113 * driver.cs: document --fatal.
2115 * report.cs (ErrorMessage, WarningMessage): new names for the old
2116 Error and Warning classes.
2118 * cs-parser.jay (member_access): Turn built-in access to types
2119 into a normal simplename
2121 2001-09-27 Ravi Pratap <ravi@ximian.com>
2123 * expression.cs (Invocation::BetterConversion): Fix to cope
2124 with q being null, since this was introducing a bug.
2126 * expression.cs (ConvertImplicit): Do built-in conversions first.
2128 2001-09-27 Ravi Pratap <ravi@ximian.com>
2130 * expression.cs (UserImplicitCast::Resolve): Fix bug.
2132 2001-09-27 Ravi Pratap <ravi@ximian.com>
2134 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
2135 I had introduced long ago (what's new ?).
2137 * expression.cs (UserImplicitCast::CanConvert): Static method to do
2138 the work of all the checking.
2139 (ConvertImplicit): Call CanConvert and only then create object if necessary.
2140 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
2142 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
2143 that is the right way.
2145 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
2146 overloading resolution. Use everywhere instead of cutting and pasting code.
2148 (Binary::ResolveOperator): Use MakeUnionSet.
2150 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
2151 we have to convert to bool types. Not complete yet.
2153 2001-09-27 Miguel de Icaza <miguel@ximian.com>
2155 * typemanager.cs (TypeManager::CSharpName): support ushort.
2157 * expression.cs (Expression::TryImplicitIntConversion): Attempts
2158 to provide an expression that performsn an implicit constant int
2159 conversion (section 6.1.6).
2160 (Expression::ConvertImplicitRequired): Reworked to include
2161 implicit constant expression conversions.
2163 (Expression::ConvertNumericExplicit): Finished.
2165 (Invocation::Emit): If InstanceExpression is null, then it means
2166 that we perform a call on this.
2168 2001-09-26 Miguel de Icaza <miguel@ximian.com>
2170 * expression.cs (Unary::Emit): Remove some dead code.
2171 (Probe): Implement Resolve and Emit for `is'.
2172 (Expression::ConvertImplicitRequired): Attempt to do constant
2173 expression conversions here. Maybe should be moved to
2174 ConvertImplicit, but I am not sure.
2175 (Expression::ImplicitLongConstantConversionPossible,
2176 Expression::ImplicitIntConstantConversionPossible): New functions
2177 that tell whether is it possible to apply an implicit constant
2178 expression conversion.
2180 (ConvertNumericExplicit): Started work on explicit numeric
2183 * cs-parser.jay: Update operator constants.
2185 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
2186 (Parameters::GetSignature): Hook up VerifyArgs here.
2187 (Parameters::VerifyArgs): Verifies that no two arguments have the
2190 * class.cs (Operator): Update the operator names to reflect the
2191 ones that the spec expects (as we are just stringizing the
2194 * expression.cs (Unary::ResolveOperator): Fix bug: Use
2195 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
2196 previous usage did only work for our methods.
2197 (Expression::ConvertImplicit): Handle decimal implicit numeric
2198 conversions as well.
2199 (Expression::InternalTypeConstructor): Used to invoke constructors
2200 on internal types for default promotions.
2202 (Unary::Emit): Implement special handling for the pre/post
2203 increment/decrement for overloaded operators, as they need to have
2204 the same semantics as the other operators.
2206 (Binary::ResolveOperator): ditto.
2207 (Invocation::ConversionExists): ditto.
2208 (UserImplicitCast::Resolve): ditto.
2210 2001-09-26 Ravi Pratap <ravi@ximian.com>
2212 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
2213 operator, return after emitting body. Regression tests pass again !
2215 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
2216 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
2217 (Invocation::OverloadResolve): Ditto.
2218 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
2220 * everywhere : update calls to the above methods accordingly.
2222 2001-09-26 Miguel de Icaza <miguel@ximian.com>
2224 * assign.cs (Assign): Make it inherit from ExpressionStatement.
2226 * expression.cs (ExpressionStatement): New base class used for
2227 expressions that can appear in statements, so that we can provide
2228 an alternate path to generate expression that do not leave a value
2231 (Expression::Emit, and all the derivatives): We no longer return
2232 whether a value is left on the stack or not. Every expression
2233 after being emitted leaves a single value on the stack.
2235 * codegen.cs (EmitContext::EmitStatementExpression): Use the
2236 facilties of ExpressionStatement if possible.
2238 * cs-parser.jay: Update statement_expression.
2240 2001-09-25 Miguel de Icaza <miguel@ximian.com>
2242 * driver.cs: Change the wording of message
2244 2001-09-25 Ravi Pratap <ravi@ximian.com>
2246 * expression.cs (Binary::ResolveOperator): Had forgottten to set
2247 the type of the expression to the return type of the method if
2248 we have an overloaded operator match ! The regression tests pass again !
2249 (Unary::ResolveOperator): Ditto.
2251 * expression.cs (Invocation::ConversionExists): Correct the member lookup
2252 to find "op_Implicit", not "implicit" ;-)
2253 (UserImplicitCast): New class to take care of user-defined implicit conversions.
2254 (ConvertImplicit, ForceConversion): Take TypeContainer argument
2256 * everywhere : Correct calls to the above accordingly.
2258 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
2259 (ConvertImplicit): Do user-defined conversion if it exists.
2261 2001-09-24 Miguel de Icaza <miguel@ximian.com>
2263 * assign.cs: track location.
2264 (Resolve): Use implicit conversions on assignment.
2266 * literal.cs: Oops. Not good, Emit of short access values should
2267 pass (Bytes) or the wrong argument will be selected.
2269 * expression.cs (Unary::Emit): Emit code for -expr.
2271 (Unary::ResolveOperator): Handle `Substract' for non-constants
2272 (substract from zero from the non-constants).
2273 Deal with Doubles as well.
2275 (Expression::ConvertImplicitRequired): New routine that reports an
2276 error if no implicit conversion exists.
2278 (Invocation::OverloadResolve): Store the converted implicit
2279 expressions if we make them
2281 2001-09-24 Ravi Pratap <ravi@ximian.com>
2283 * class.cs (ConstructorInitializer): Take a Location argument.
2284 (ConstructorBaseInitializer): Same here.
2285 (ConstructorThisInitializer): Same here.
2287 * cs-parser.jay : Update all calls accordingly.
2289 * expression.cs (Unary, Binary, New): Take location argument.
2290 Update accordingly everywhere.
2292 * cs-parser.jay : Update all calls to the above to take a location
2297 2001-09-24 Ravi Pratap <ravi@ximian.com>
2299 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
2300 (Invocation::BetterConversion): Same here
2301 (Invocation::ConversionExists): Ditto.
2303 (Invocation::ConversionExists): Implement.
2305 2001-09-22 Ravi Pratap <ravi@ximian.com>
2307 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
2308 Also take an additional TypeContainer argument.
2310 * All over : Pass in TypeContainer as argument to OverloadResolve.
2312 * typemanager.cs (CSharpName): Update to check for the string type and return
2315 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
2318 2001-09-21 Ravi Pratap <ravi@ximian.com>
2320 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
2321 (Invocation::BetterFunction): Implement.
2322 (Invocation::BetterConversion): Implement.
2323 (Invocation::ConversionExists): Skeleton, no implementation yet.
2325 Okay, things work fine !
2327 2001-09-21 Miguel de Icaza <miguel@ximian.com>
2329 * typemanager.cs: declare and load enum_type, delegate_type and
2332 * expression.cs (Expression::Emit): Now emit returns a value that
2333 tells whether a value is left on the stack or not. This strategy
2334 might be reveted tomorrow with a mechanism that would address
2335 multiple assignments.
2336 (Expression::report118): Utility routine to report mismatches on
2339 (Unary::Report23): Report impossible type/operator combination
2342 (Unary::IsIncrementableNumber): Whether the type can be
2343 incremented or decremented with add.
2344 (Unary::ResolveOperator): Also allow enumerations to be bitwise
2346 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
2348 (Invocation::Emit): Deal with new Emit convetion.
2350 * All Expression derivatives: Updated their Emit method to return
2351 whether they leave values on the stack or not.
2353 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
2354 stack for expressions that are statements.
2356 2001-09-20 Miguel de Icaza <miguel@ximian.com>
2358 * expression.cs (LValue): New interface. Must be implemented by
2360 (LocalVariableReference, ParameterReference, FieldExpr): Implement
2363 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
2364 interface for generating code, simplifies the code.
2366 2001-09-20 Ravi Pratap <ravi@ximian.com>
2368 * expression.cs (everywhere): Comment out return statements in ::Resolve
2369 methods to avoid the warnings.
2371 2001-09-20 Miguel de Icaza <miguel@ximian.com>
2373 * driver.cs (parse): Report error 2001 if we can not open the
2376 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
2379 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
2382 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
2383 otherwise nested blocks end up with the same index.
2385 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
2387 * expression.cs: Instead of having FIXMEs in the Resolve
2388 functions, throw exceptions so it is obvious that we are facing a
2391 * cs-parser.jay (invocation_expression): Pass Location information.
2393 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
2394 Use a basename for those routines because .NET does not like paths
2397 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
2400 2001-09-19 Miguel de Icaza <miguel@ximian.com>
2402 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
2403 are loading the correct data types (throws an exception if not).
2404 (TypeManager::InitCoreTypes): Use CoreLookupType
2406 * expression.cs (Unary::ResolveOperator): return the child
2407 expression for expressions which are just +expr.
2408 (Unary::ResolveOperator): Return negative literals for -LITERAL
2409 expressions (otherwise they are Unary {Literal}).
2410 (Invocation::Badness): Take into account `Implicit constant
2411 expression conversions'.
2413 * literal.cs (LongLiteral): Implement long literal class.
2414 (IntLiteral): export the `Value' of the intliteral.
2416 2001-09-19 Ravi Pratap <ravi@ximian.com>
2418 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
2420 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
2421 instead of 'Operator'
2423 * expression.cs (Binary::ResolveOperator): Update accordingly.
2424 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
2427 * cs-parser.jay (unary_expression): Update to use the new names.
2429 * gen-treedump.cs (GetUnary): Same here.
2431 * expression.cs (Unary::Resolve): Implement.
2432 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
2433 operators are found instead of making noise ;-)
2434 (Unary::ResolveOperator): New method to do precisely the same thing which
2435 Binary::ResolveOperator does for Binary expressions.
2436 (Unary.method, .Arguments): Add.
2437 (Unary::OperName): Implement.
2438 (Unary::ForceConversion): Copy and Paste !
2440 * class.cs (Operator::Define): Fix a small bug for the case when we have
2443 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
2444 for the inbuilt operators. Only overloading works for now ;-)
2446 2001-09-18 Miguel de Icaza <miguel@ximian.com>
2448 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
2449 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
2451 * expression.cs (This::Emit): Implement.
2452 (This::Resolve): Implement.
2453 (TypeOf:Resolve): Implement.
2454 (Expression::ResolveSimpleName): Add an implicit this to instance
2456 (MemberAccess::Resolve): Deal with Parameters and Fields.
2457 Bind instance variable to Field expressions.
2458 (FieldExpr::Instance): New field used to track the expression that
2459 represents the object instance.
2460 (FieldExpr::Resolve): Track potential errors from MemberLookup not
2462 (FieldExpr::Emit): Implement.
2464 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
2465 the last instruction contains a return opcode to avoid generating
2466 the last `ret' instruction (this generates correct code, and it is
2467 nice to pass the peverify output).
2469 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
2470 initializer for static and instance variables.
2471 (Constructor::Emit): Allow initializer to be null in the case of
2472 static constructors. Only emit initializer for instance
2475 (TypeContainer::FindMembers): Return a null array if there are no
2478 Also fix the code for the MemberTypes.Method branch, as it was not
2479 scanning that for operators (or tried to access null variables before).
2481 * assign.cs (Assign::Emit): Handle instance and static fields.
2485 * driver.cs: Stop compilation if there are parse errors.
2487 * cs-parser.jay (constructor_declaration): Provide default base
2488 initializer for non-static constructors.
2489 (constructor_declarator): Do not provide a default base
2490 initializers if none was specified.
2491 Catch the fact that constructors should not have parameters.
2493 * class.cs: Do not emit parent class initializers for static
2494 constructors, that should be flagged as an error.
2496 2001-09-18 Ravi Pratap <ravi@ximian.com>
2498 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
2499 Move back code into TypeContainer::Populate.
2501 2001-09-18 Ravi Pratap <ravi@ximian.com>
2503 * class.cs (TypeContainer::AddConstructor): Fix the check to
2504 compare against Name, not Basename.
2505 (Operator::OpType): Change Plus and Minus to Add and Subtract.
2507 * cs-parser.jay : Update accordingly.
2509 * class.cs (TypeContainer::FindMembers): For the case where we are searching
2510 for methods, don't forget to look into the operators too.
2511 (RegisterMethodBuilder): Helper method to take care of this for
2512 methods, constructors and operators.
2513 (Operator::Define): Completely revamp.
2514 (Operator.OperatorMethod, MethodName): New fields.
2515 (TypeContainer::Populate): Move the registering of builders into
2516 RegisterMethodBuilder.
2517 (Operator::Emit): Re-write.
2519 * expression.cs (Binary::Emit): Comment out code path to emit method
2520 invocation stuff for the case when we have a user defined operator. I am
2521 just not able to get it right !
2523 2001-09-17 Miguel de Icaza <miguel@ximian.com>
2525 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
2528 (Expression::MemberLookup): Provide a version that allows to
2529 specify the MemberTypes and BindingFlags.
2531 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
2532 so it was not fetching variable information from outer blocks.
2534 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
2535 Beforefieldinit as it was buggy.
2537 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
2540 * class.cs (Constructor::Emit): Only emit if block is not null.
2541 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
2542 deal with this by semantically definining it as if the user had
2545 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
2546 constructors as we now "emit" them at a higher level.
2548 (TypeContainer::DefineDefaultConstructor): Used to define the
2549 default constructors if none was provided.
2551 (ConstructorInitializer): Add methods Resolve and Emit.
2553 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
2555 2001-09-17 Ravi Pratap <ravi@ximian.com>
2557 * class.cs (TypeContainer::EmitDefaultConstructor): Register
2558 the default constructor builder with our hashtable for methodbuilders
2561 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
2562 and argument_count is 0 in which case we have a match.
2563 (Binary::ResolveOperator): More null checking and miscellaneous coding
2566 2001-09-17 Ravi Pratap <ravi@ximian.com>
2568 * rootcontext.cs (IsNameSpace): Compare against null.
2570 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
2572 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
2573 and Unary::Operator.
2575 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
2578 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
2579 we have overloaded operators.
2580 (Binary::ResolveOperator): Implement the part which does the operator overload
2583 * class.cs (Operator::Emit): Implement.
2584 (TypeContainer::Emit): Emit the operators we have too.
2586 * expression.cs (Binary::Emit): Update to emit the appropriate code for
2587 the case when we have a user-defined operator.
2589 2001-09-17 Miguel de Icaza <miguel@ximian.com>
2591 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
2593 2001-09-16 Ravi Pratap <ravi@ximian.com>
2595 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
2596 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
2597 (Constructor::Emit): Implement.
2598 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
2599 if we have no work to do.
2600 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
2603 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
2604 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
2606 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
2609 2001-09-15 Ravi Pratap <ravi@ximian.com>
2611 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
2613 (Tree::RecordNamespace): Method to do what the name says ;-)
2614 (Tree::Namespaces): Property to get at the namespaces hashtable.
2616 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
2619 * rootcontext.cs (IsNamespace): Fixed it :-)
2621 2001-09-14 Miguel de Icaza <miguel@ximian.com>
2623 * class.cs (TypeContainer::FindMembers): Add support for
2625 (MethodCore): New class that encapsulates both the shared aspects
2626 of a Constructor and a Method.
2627 (Method, Constructor): Factored pieces into MethodCore.
2629 * driver.cs: Added --fatal which makes errors throw exceptions.
2630 Load System assembly as well as part of the standard library.
2632 * report.cs: Allow throwing exceptions on errors for debugging.
2634 * modifiers.cs: Do not use `parent', instead use the real type
2635 container to evaluate permission settings.
2637 * class.cs: Put Ravi's patch back in. He is right, and we will
2638 have to cope with the
2640 2001-09-14 Ravi Pratap <ravi@ximian.com>
2642 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
2643 FamORAssem, not FamANDAssem.
2645 2001-09-14 Miguel de Icaza <miguel@ximian.com>
2647 * driver.cs: Added --parse option that only parses its input files
2650 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
2651 incorrect. IsTopLevel is not used to tell whether an object is
2652 root_types or not (that can be achieved by testing this ==
2653 root_types). But to see if this is a top-level *class* (not
2654 necessarly our "toplevel" container).
2656 2001-09-14 Ravi Pratap <ravi@ximian.com>
2658 * enum.cs (Enum::Define): Modify to call the Lookup method on the
2659 parent instead of a direct call to GetType.
2661 2001-09-14 Ravi Pratap <ravi@ximian.com>
2663 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
2664 Modifiers.TypeAttr. This should just be a call to that method.
2666 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
2667 object so that we can determine if we are top-level or not.
2669 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
2672 * enum.cs (Enum::Define): Ditto.
2674 * modifiers.cs (FieldAttr): Re-write.
2676 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
2677 (TypeContainer::HaveStaticConstructor): New property to provide access
2678 to precisely that info.
2680 * modifiers.cs (MethodAttr): Re-write.
2681 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
2683 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
2684 of top-level types as claimed.
2686 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2688 * expression.cs (MemberLookup): Fruitless attempt to lookup
2689 constructors. Maybe I need to emit default constructors? That
2690 might be it (currently .NET emits this for me automatically).
2691 (Invocation::OverloadResolve): Cope with Arguments == null.
2692 (Invocation::EmitArguments): new function, shared by the new
2694 (Invocation::Emit): Handle static and instance methods. Emit
2695 proper call instruction for virtual or non-virtual invocations.
2696 (New::Emit): Implement.
2697 (New::Resolve): Implement.
2698 (MemberAccess:Resolve): Implement.
2699 (MethodGroupExpr::InstanceExpression): used conforming to the spec
2701 (FieldExpr::Resolve): Set type.
2703 * support.cs: Handle empty arguments.
2705 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
2706 SimpleLookup): Auxiliary routines to help parse a qualifier
2709 Update qualifier_identifier rule.
2711 * codegen.cs: Removed debugging messages.
2713 * class.cs: Make this a global thing, this acts just as a "key" to
2714 objects that we might have around.
2716 (Populate): Only initialize method_builders_to_methods once.
2718 * expression.cs (PropertyExpr): Initialize type from the
2721 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
2722 Resolve pattern. Attempt to implicitly convert value to boolean.
2725 * expression.cs: Set the type for the int32/int32 argument case.
2726 (Binary::ResolveOperator): Set the return type to boolean for
2727 comparission operators
2729 * typemanager.cs: Remove debugging print code.
2731 (Invocation::Resolve): resolve type.
2733 * class.cs: Allocate a MemberInfo of the correct size, as the code
2734 elsewhere depends on the test to reflect the correct contents.
2736 (Method::) Keep track of parameters, due to System.Reflection holes
2738 (TypeContainer::Populate): Keep track of MethodBuilders to Method
2741 (TypeContainer::FindMembers): Use ArrayList and then copy an array
2742 of the exact size and return that.
2744 (Class::LookupMethodByBuilder): New function that maps
2745 MethodBuilders to its methods. Required to locate the information
2746 on methods because System.Reflection bit us again.
2748 * support.cs: New file, contains an interface ParameterData and
2749 two implementations: ReflectionParameters and InternalParameters
2750 used to access Parameter information. We will need to grow this
2753 * expression.cs (Invocation::GetParameterData): implement a cache
2754 and a wrapper around the ParameterData creation for methods.
2755 (Invocation::OverloadResolve): Use new code.
2757 2001-09-13 Ravi Pratap <ravi@ximian.com>
2759 * class.cs (TypeContainer::EmitField): Remove and move into
2760 (Field::Define): here and modify accordingly.
2761 (Field.FieldBuilder): New member.
2762 (TypeContainer::Populate): Update accordingly.
2763 (TypeContainer::FindMembers): Implement.
2765 2001-09-13 Miguel de Icaza <miguel@ximian.com>
2767 * statement.cs: (VariableInfo::VariableType): New field to be
2768 initialized with the full type once it is resolved.
2770 2001-09-12 Miguel de Icaza <miguel@ximian.com>
2772 * parameter.cs (GetParameterInfo): Use a type cache to compute
2773 things only once, and to reuse this information
2775 * expression.cs (LocalVariableReference::Emit): Implement.
2776 (OpcodeCast::Emit): fix.
2778 (ParameterReference::Resolve): Implement.
2779 (ParameterReference::Emit): Implement.
2781 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
2782 that are expressions need to stay as Expressions.
2784 * typemanager.cs (CSharpName): Returns the C# name of a type if
2787 * expression.cs (Expression::ConvertImplicit): New function that
2788 implements implicit type conversions.
2790 (Expression::ImplicitReferenceConversion): Implements implicit
2791 reference conversions.
2793 (EmptyCast): New type for transparent casts.
2795 (OpcodeCast): New type for casts of types that are performed with
2796 a sequence of bytecodes.
2798 (BoxedCast): New type used for casting value types into reference
2799 types. Emits a box opcode.
2801 (Binary::DoNumericPromotions): Implements numeric promotions of
2802 and computation of the Binary::Type.
2804 (Binary::EmitBranchable): Optimization.
2806 (Binary::Emit): Implement code emission for expressions.
2808 * typemanager.cs (TypeManager): Added two new core types: sbyte
2811 2001-09-12 Ravi Pratap <ravi@ximian.com>
2813 * class.cs (TypeContainer::FindMembers): Method which does exactly
2814 what Type.FindMembers does, only we don't have to use reflection. No
2817 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
2818 typecontainer objects as we need to get at them.
2819 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
2821 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
2822 typecontainer object.
2824 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
2825 of just a Report object.
2827 2001-09-11 Ravi Pratap <ravi@ximian.com>
2829 * class.cs (Event::Define): Go back to using the prefixes "add_" and
2831 (TypeContainer::Populate): Now define the delegates of the type too.
2832 (TypeContainer.Delegates): Property to access the list of delegates defined
2835 * delegates.cs (Delegate::Define): Implement partially.
2837 * modifiers.cs (TypeAttr): Handle more flags.
2839 2001-09-11 Ravi Pratap <ravi@ximian.com>
2841 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
2843 (Operator::Define): Re-write logic to get types by using the LookupType method
2844 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
2845 (Indexer::Define): Ditto.
2846 (Event::Define): Ditto.
2847 (Property::Define): Ditto.
2849 2001-09-10 Ravi Pratap <ravi@ximian.com>
2851 * class.cs (TypeContainer::Populate): Now define operators too.
2852 (TypeContainer.Operators): New property to access the list of operators
2854 (Operator.OperatorMethodBuilder): New member to hold the method builder
2855 for the operator we are defining.
2856 (Operator::Define): Implement.
2858 2001-09-10 Ravi Pratap <ravi@ximian.com>
2860 * class.cs (Event::Define): Make the prefixes of the accessor methods
2861 addOn_ and removeOn_
2863 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
2864 of the location being passed in too. Ideally, this should go later since all
2865 error reporting should be done through the Report object.
2867 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
2868 (Populate): Iterate thru the indexers we have and define them too.
2869 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
2870 for the get and set accessors.
2871 (Indexer::Define): Implement.
2873 2001-09-09 Miguel de Icaza <miguel@ximian.com>
2875 * expression.cs (Binary::Resolve): Beginning of it. I scratched
2876 my previous implementation, did not work.
2878 * typemanager.cs: Add a couple of missing types (the longs).
2880 * literal.cs: Use TypeManager.bool_type instead of getting it.
2882 * expression.cs (EventExpr): New kind of expressions.
2883 (Expressio::ExprClassFromMemberInfo): finish
2885 2001-09-08 Miguel de Icaza <miguel@ximian.com>
2887 * assign.cs: Emit stores to static fields differently.
2889 2001-09-08 Ravi Pratap <ravi@ximian.com>
2891 * Merge in changes and adjust code to tackle conflicts. Backed out my
2892 code in Assign::Resolve ;-)
2894 2001-09-08 Ravi Pratap <ravi@ximian.com>
2896 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
2897 instead Report.Error and also pass in the location.
2898 (CSharpParser::Lexer): New readonly property to return the reference
2899 to the Tokenizer object.
2900 (declare_local_variables): Use Report.Error with location instead of plain
2904 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
2905 (Operator.CheckBinaryOperator): Ditto.
2907 * cs-parser.jay (operator_declarator): Update accordingly.
2909 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
2910 (CheckBinaryOperator): Same here.
2912 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
2913 on the name without any prefixes of namespace names etc. This is because we
2914 already might have something already fully qualified like
2915 'System.Console.WriteLine'
2917 * assign.cs (Resolve): Begin implementation. Stuck ;-)
2919 2001-09-07 Ravi Pratap <ravi@ximian.com>
2921 * cs-tokenizer.cs (location): Return a string which also contains
2924 * expression.cs (ElementAccess): New class for expressions of the
2925 type 'element access.'
2926 (BaseAccess): New class for expressions of the type 'base access.'
2927 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
2930 * cs-parser.jay (element_access): Implement action.
2931 (base_access): Implement actions.
2932 (checked_expression, unchecked_expression): Implement.
2934 * cs-parser.jay (local_variable_type): Correct and implement.
2935 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
2937 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
2939 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
2940 name and the specifiers.
2942 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
2944 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
2945 making them all public ;-)
2947 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
2950 2001-09-07 Miguel de Icaza <miguel@ximian.com>
2952 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
2954 (FieldExpr, PropertyExprs): New resolved expressions.
2955 (SimpleName::MemberStaticCheck): Perform static checks for access
2956 to non-static fields on static methods. Maybe this should be
2957 generalized for MemberAccesses.
2958 (SimpleName::ResolveSimpleName): More work on simple name
2961 * cs-parser.jay (primary_expression/qualified_identifier): track
2962 the parameter index.
2964 * codegen.cs (CodeGen::Save): Catch save exception, report error.
2965 (EmitContext::EmitBoolExpression): Chain to expression generation
2966 instead of temporary hack.
2967 (::EmitStatementExpression): Put generic expression code generation.
2969 * assign.cs (Assign::Emit): Implement variable assignments to
2970 local variables, parameters and fields.
2972 2001-09-06 Miguel de Icaza <miguel@ximian.com>
2974 * statement.cs (Block::GetVariableInfo): New method, returns the
2975 VariableInfo for a variable name in a block.
2976 (Block::GetVariableType): Implement in terms of GetVariableInfo
2978 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
2979 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
2981 2001-09-06 Ravi Pratap <ravi@ximian.com>
2983 * cs-parser.jay (operator_declaration): Continue on my quest : update
2984 to take attributes argument.
2985 (event_declaration): Ditto.
2986 (enum_declaration): Ditto.
2987 (indexer_declaration): Ditto.
2989 * class.cs (Operator::Operator): Update constructor accordingly.
2990 (Event::Event): Ditto.
2992 * delegate.cs (Delegate::Delegate): Same here.
2994 * enum.cs (Enum::Enum): Same here.
2996 2001-09-05 Ravi Pratap <ravi@ximian.com>
2998 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
3000 * ../tests/cs0658.cs : New file to demonstrate error 0658.
3002 * attribute.cs (Attributes): New class to encapsulate all attributes which were
3003 being passed around as an arraylist.
3004 (Attributes::AddAttribute): Method to add attribute sections.
3006 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
3007 (struct_declaration): Update accordingly.
3008 (constant_declaration): Update.
3009 (field_declaration): Update.
3010 (method_header): Update.
3011 (fixed_parameter): Update.
3012 (parameter_array): Ditto.
3013 (property_declaration): Ditto.
3014 (destructor_declaration): Ditto.
3016 * class.cs (Struct::Struct): Update constructors accordingly.
3017 (Class::Class): Ditto.
3018 (Field::Field): Ditto.
3019 (Method::Method): Ditto.
3020 (Property::Property): Ditto.
3021 (TypeContainer::OptAttribute): update property's return type.
3023 * interface.cs (Interface.opt_attributes): New member.
3024 (Interface::Interface): Update to take the extra Attributes argument.
3026 * parameter.cs (Parameter::Parameter): Ditto.
3028 * constant.cs (Constant::Constant): Ditto.
3030 * interface.cs (InterfaceMemberBase): New OptAttributes field.
3031 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
3032 the attributes as a parameter.
3033 (InterfaceProperty): Update constructor call.
3034 (InterfaceEvent): Ditto.
3035 (InterfaceMethod): Ditto.
3036 (InterfaceIndexer): Ditto.
3038 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
3039 pass the attributes too.
3040 (interface_event_declaration): Ditto.
3041 (interface_property_declaration): Ditto.
3042 (interface_method_declaration): Ditto.
3043 (interface_declaration): Ditto.
3045 2001-09-05 Miguel de Icaza <miguel@ximian.com>
3047 * class.cs (Method::Define): Track the "static Main" definition to
3048 create an entry point.
3050 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
3051 EntryPoint if we find it.
3053 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
3054 (EmitContext::ig): Make this variable public.
3056 * driver.cs: Make the default output file be the first file name
3057 with the .exe extension.
3059 Detect empty compilations
3061 Handle various kinds of output targets. Handle --target and
3062 rename -t to --dumper.
3064 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
3065 methods inherited from Expression return now an Expression. This
3066 will is used during the tree rewriting as we resolve them during
3069 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
3070 the spec. Missing entirely is the information about
3071 accessability of elements of it.
3073 (Expression::ExprClassFromMemberInfo): New constructor for
3074 Expressions that creates a fully initialized Expression based on
3075 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
3078 (Invocation::Resolve): Begin implementing resolution of invocations.
3080 * literal.cs (StringLiteral): Implement Emit.
3082 2001-09-05 Ravi Pratap <ravi@ximian.com>
3084 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
3087 2001-09-04 Ravi Pratap <ravi@ximian.com>
3089 * cs-parser.jay (attribute_arguments): Implement actions.
3090 (attribute): Fix bug in production. Implement action.
3091 (attribute_list): Implement.
3092 (attribute_target): Implement.
3093 (attribute_target_specifier, opt_target_specifier): Implement
3094 (CheckAttributeTarget): New method to check if the attribute target
3096 (attribute_section): Implement.
3097 (opt_attributes): Implement.
3099 * attribute.cs : New file to handle attributes.
3100 (Attribute): Class to hold attribute info.
3102 * cs-parser.jay (opt_attribute_target_specifier): Remove production
3103 (attribute_section): Modify production to use 2 different rules to
3104 achieve the same thing. 1 s/r conflict down !
3105 Clean out commented, useless, non-reducing dimension_separator rules.
3107 * class.cs (TypeContainer.attributes): New member to hold list
3108 of attributes for a type.
3109 (Struct::Struct): Modify to take one more argument, the attribute list.
3110 (Class::Class): Ditto.
3111 (Field::Field): Ditto.
3112 (Method::Method): Ditto.
3113 (Property::Property): Ditto.
3115 * cs-parser.jay (struct_declaration): Update constructor call to
3116 pass in the attributes too.
3117 (class_declaration): Ditto.
3118 (constant_declaration): Ditto.
3119 (field_declaration): Ditto.
3120 (method_header): Ditto.
3121 (fixed_parameter): Ditto.
3122 (parameter_array): Ditto.
3123 (property_declaration): Ditto.
3125 * constant.cs (Constant::Constant): Update constructor similarly.
3126 Use System.Collections.
3128 * parameter.cs (Parameter::Parameter): Update as above.
3130 2001-09-02 Ravi Pratap <ravi@ximian.com>
3132 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
3133 (TypeContainer.delegates): New member to hold list of delegates.
3135 * cs-parser.jay (delegate_declaration): Implement the action correctly
3136 this time as I seem to be on crack ;-)
3138 2001-09-02 Miguel de Icaza <miguel@ximian.com>
3140 * rootcontext.cs (RootContext::IsNamespace): new function, used to
3141 tell whether an identifier represents a namespace.
3143 * expression.cs (NamespaceExpr): A namespace expression, used only
3144 temporarly during expression resolution.
3145 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
3146 utility functions to resolve names on expressions.
3148 2001-09-01 Miguel de Icaza <miguel@ximian.com>
3150 * codegen.cs: Add hook for StatementExpressions.
3152 * class.cs: Fix inverted test for static flag in methods.
3154 2001-09-02 Ravi Pratap <ravi@ximian.com>
3156 * class.cs (Operator::CheckUnaryOperator): Correct error number used
3157 to make it coincide with MS' number.
3158 (Operator::CheckBinaryOperator): Ditto.
3160 * ../errors/errors.txt : Remove error numbers added earlier.
3162 * ../errors/cs1019.cs : Test case for error # 1019
3164 * ../errros/cs1020.cs : Test case for error # 1020
3166 * cs-parser.jay : Clean out commented cruft.
3167 (dimension_separators, dimension_separator): Comment out. Ostensibly not
3168 used anywhere - non-reducing rule.
3169 (namespace_declarations): Non-reducing rule - comment out.
3171 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
3172 with TypeContainer::AddEnum.
3174 * delegate.cs : New file for delegate handling classes.
3175 (Delegate): Class for declaring delegates.
3177 * makefile : Update.
3179 * cs-parser.jay (delegate_declaration): Implement.
3181 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
3183 * class.cs (Event::Define): Implement.
3184 (Event.EventBuilder): New member.
3186 * class.cs (TypeContainer::Populate): Update to define all enums and events
3188 (Events): New property for the events arraylist we hold. Shouldn't we move to using
3189 readonly fields for all these cases ?
3191 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
3193 * class.cs (Property): Revamp to use the convention of making fields readonly.
3194 Accordingly modify code elsewhere.
3196 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
3197 the Define method of the Property class.
3199 * class.cs : Clean up applied patch and update references to variables etc. Fix
3201 (TypeContainer::Populate): Update to define all the properties we have. Also
3202 define all enumerations.
3204 * enum.cs (Define): Implement.
3206 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
3208 * cs-parser.jay (overloadable_operator): The semantic value is an
3209 enum of the Operator class.
3210 (operator_declarator): Implement actions.
3211 (operator_declaration): Implement.
3213 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
3214 validity of definitions.
3215 (Operator::CheckBinaryOperator): Static method to check for binary operators
3216 (TypeContainer::AddOperator): New method to add an operator to a type.
3218 * cs-parser.jay (indexer_declaration): Added line to actually call the
3219 AddIndexer method so it gets added ;-)
3221 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
3222 already taken care of by the MS compiler ?
3224 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
3226 * class.cs (Operator): New class for operator declarations.
3227 (Operator::OpType): Enum for the various operators.
3229 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
3231 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
3232 ostensibly handle this in semantic analysis.
3234 * cs-parser.jay (general_catch_clause): Comment out
3235 (specific_catch_clauses, specific_catch_clause): Ditto.
3236 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
3237 (catch_args, opt_catch_args): New productions.
3238 (catch_clause): Rewrite to use the new productions above
3239 (catch_clauses): Modify accordingly.
3240 (opt_catch_clauses): New production to use in try_statement
3241 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
3242 and re-write the code in the actions to extract the specific and
3243 general catch clauses by being a little smart ;-)
3245 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
3246 Hooray, try and catch statements parse fine !
3248 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
3250 * statement.cs (Block::GetVariableType): Fix logic to extract the type
3251 string from the hashtable of variables.
3253 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
3254 I end up making that mistake ;-)
3255 (catch_clauses): Fixed gross error which made Key and Value of the
3256 DictionaryEntry the same : $1 !!
3258 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
3260 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
3262 * cs-parser.jay (event_declaration): Correct to remove the semicolon
3263 when the add and remove accessors are specified.
3265 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
3267 * cs-parser.jay (IndexerDeclaration): New helper class to hold
3268 information about indexer_declarator.
3269 (indexer_declarator): Implement actions.
3270 (parsing_indexer): New local boolean used to keep track of whether
3271 we are parsing indexers or properties. This is necessary because
3272 implicit_parameters come into picture even for the get accessor in the
3274 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
3276 * class.cs (Indexer): New class for indexer declarations.
3277 (TypeContainer::AddIndexer): New method to add an indexer to a type.
3278 (TypeContainer::indexers): New member to hold list of indexers for the
3281 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
3283 * cs-parser.jay (add_accessor_declaration): Implement action.
3284 (remove_accessor_declaration): Implement action.
3285 (event_accessors_declaration): Implement
3286 (variable_declarators): swap statements for first rule - trivial.
3288 * class.cs (Event): New class to hold information about event
3290 (TypeContainer::AddEvent): New method to add an event to a type
3291 (TypeContainer::events): New member to hold list of events.
3293 * cs-parser.jay (event_declaration): Implement actions.
3295 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
3297 * cs-parser.jay (dim_separators): Implement. Make it a string
3298 concatenating all the commas together, just as they appear.
3299 (opt_dim_separators): Modify accordingly
3300 (rank_specifiers): Update accordingly. Basically do the same
3301 thing - instead, collect the brackets here.
3302 (opt_rank_sepcifiers): Modify accordingly.
3303 (array_type): Modify to actually return the complete type string
3304 instead of ignoring the rank_specifiers.
3305 (expression_list): Implement to collect the expressions
3306 (variable_initializer): Implement. We make it a list of expressions
3307 essentially so that we can handle the array_initializer case neatly too.
3308 (variable_initializer_list): Implement.
3309 (array_initializer): Make it a list of variable_initializers
3310 (opt_array_initializer): Modify accordingly.
3312 * expression.cs (New::NType): Add enumeration to help us
3313 keep track of whether we have an object/delegate creation
3314 or an array creation.
3315 (New:NewType, New::Rank, New::Indices, New::Initializers): New
3316 members to hold data about array creation.
3317 (New:New): Modify to update NewType
3318 (New:New): New Overloaded contructor for the array creation
3321 * cs-parser.jay (array_creation_expression): Implement to call
3322 the overloaded New constructor.
3324 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
3326 * class.cs (TypeContainer::Constructors): Return member
3327 constructors instead of returning null.
3329 2001-08-26 Miguel de Icaza <miguel@ximian.com>
3331 * typemanager.cs (InitCoreTypes): Initialize the various core
3332 types after we have populated the type manager with the user
3333 defined types (this distinction will be important later while
3334 compiling corlib.dll)
3336 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
3337 on Expression Classification. Now all expressions have a method
3338 `Resolve' and a method `Emit'.
3340 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
3341 generation from working. Also add some temporary debugging
3344 2001-08-24 Miguel de Icaza <miguel@ximian.com>
3346 * codegen.cs: Lots of code generation pieces. This is only the
3347 beginning, will continue tomorrow with more touches of polish. We
3348 handle the fundamentals of if, while, do, for, return. Others are
3349 trickier and I need to start working on invocations soon.
3351 * gen-treedump.cs: Bug fix, use s.Increment here instead of
3354 * codegen.cs (EmitContext): New struct, used during code
3355 emission to keep a context. Most of the code generation will be
3358 * cs-parser.jay: Add embedded blocks to the list of statements of
3359 this block. So code generation proceeds in a top down fashion.
3361 2001-08-23 Miguel de Icaza <miguel@ximian.com>
3363 * statement.cs: Add support for multiple child blocks.
3365 2001-08-22 Miguel de Icaza <miguel@ximian.com>
3367 * codegen.cs (EmitCode): New function, will emit the code for a
3368 Block of code given a TypeContainer and its ILGenerator.
3370 * statement.cs (Block): Standard public readonly optimization.
3371 (Block::Block constructors): Link children.
3372 (Block::Child): Child Linker.
3373 (Block::EmitVariables): Emits IL variable declarations.
3375 * class.cs: Drop support for MethodGroups here, delay until
3377 (Method::): Applied the same simplification that I did before, and
3378 move from Properties to public readonly fields.
3379 (Method::ParameterTypes): Returns the parameter types for the
3380 function, and implements a cache that will be useful later when I
3381 do error checking and the semantic analysis on the methods is
3383 (Constructor::GetCallingConvention): Renamed from CallingConvetion
3384 and made a method, optional argument tells whether this is a class
3385 or a structure to apply the `has-this' bit.
3386 (Method::GetCallingConvention): Implement, returns the calling
3388 (Method::Define): Defines the type, a second pass is performed
3389 later to populate the methods.
3391 (Constructor::ParameterTypes): implement a cache similar to the
3392 one on Method::ParameterTypes, useful later when we do semantic
3395 (TypeContainer::EmitMethod): New method. Emits methods.
3397 * expression.cs: Removed MethodGroup class from here.
3399 * parameter.cs (Parameters::GetCallingConvention): new method.
3401 2001-08-21 Miguel de Icaza <miguel@ximian.com>
3403 * class.cs (TypeContainer::Populate): Drop RootContext from the
3406 (Constructor::CallingConvention): Returns the calling convention.
3407 (Constructor::ParameterTypes): Returns the constructor parameter
3410 (TypeContainer::AddConstructor): Keep track of default constructor
3411 and the default static constructor.
3413 (Constructor::) Another class that starts using `public readonly'
3414 instead of properties.
3416 (Constructor::IsDefault): Whether this is a default constructor.
3418 (Field::) use readonly public fields instead of properties also.
3420 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
3421 track of static constructors; If none is used, turn on
3422 BeforeFieldInit in the TypeAttributes.
3424 * cs-parser.jay (opt_argument_list): now the return can be null
3425 for the cases where there are no arguments.
3427 (constructor_declarator): If there is no implicit `base' or
3428 `this', then invoke the default parent constructor.
3430 * modifiers.cs (MethodAttr): New static function maps a set of
3431 modifiers flags into a MethodAttributes enum
3432 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
3433 MethodAttr, TypeAttr to represent the various mappings where the
3435 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
3437 2001-08-19 Miguel de Icaza <miguel@ximian.com>
3439 * parameter.cs (GetParameterInfo): Fix bug where there would be no
3442 * interface.cs (PopulateIndexer): Implemented the code generator
3443 for interface indexers.
3445 2001-08-17 Miguel de Icaza <miguel@ximian.com>
3447 * interface.cs (InterfaceMemberBase): Now we track the new status
3450 (PopulateProperty): Implement property population. Woohoo! Got
3451 Methods and Properties going today.
3453 Removed all the properties for interfaces, and replaced them with
3454 `public readonly' fields.
3456 2001-08-16 Miguel de Icaza <miguel@ximian.com>
3458 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
3459 initialize their hashtables/arraylists only when they are needed
3460 instead of doing this always.
3462 * parameter.cs: Handle refs and out parameters.
3464 * cs-parser.jay: Use an ArrayList to construct the arguments
3465 instead of the ParameterCollection, and then cast that to a
3468 * parameter.cs: Drop the use of ParameterCollection and use
3469 instead arrays of Parameters.
3471 (GetParameterInfo): Use the Type, not the Name when resolving
3474 2001-08-13 Miguel de Icaza <miguel@ximian.com>
3476 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
3477 and instead use public readonly fields.
3479 * class.cs: Put back walking code for type containers.
3481 2001-08-11 Miguel de Icaza <miguel@ximian.com>
3483 * class.cs (MakeConstant): Code to define constants.
3485 * rootcontext.cs (LookupType): New function. Used to locate types
3488 2001-08-08 Miguel de Icaza <miguel@ximian.com>
3490 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
3491 this System.Reflection code is. Kudos to Microsoft
3493 * typemanager.cs: Implement a type cache and avoid loading all
3494 types at boot time. Wrap in LookupType the internals. This made
3495 the compiler so much faster. Wow. I rule!
3497 * driver.cs: Make sure we always load mscorlib first (for
3498 debugging purposes, nothing really important).
3500 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
3501 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
3503 * rootcontext.cs: Lookup types on their namespace; Lookup types
3504 on namespaces that have been imported using the `using' keyword.
3506 * class.cs (TypeContainer::TypeAttr): Virtualize.
3507 (Class::TypeAttr): Return attributes suitable for this bad boy.
3508 (Struct::TypeAttr): ditto.
3509 Handle nested classes.
3510 (TypeContainer::) Remove all the type visiting code, it is now
3511 replaced with the rootcontext.cs code
3513 * rootcontext.cs (GetClassBases): Added support for structs.
3515 2001-08-06 Miguel de Icaza <miguel@ximian.com>
3517 * interface.cs, statement.cs, class.cs, parameter.cs,
3518 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
3519 Drop use of TypeRefs, and use strings instead.
3521 2001-08-04 Miguel de Icaza <miguel@ximian.com>
3525 * class.cs (Struct::Struct): set the SEALED flags after
3526 checking the modifiers.
3527 (TypeContainer::TypeAttr): new property, returns the
3528 TypeAttributes for a class.
3530 * cs-parser.jay (type_list): Oops, list production was creating a
3531 new list of base types.
3533 * rootcontext.cs (StdLib): New property.
3534 (GetInterfaceTypeByName): returns an interface by type name, and
3535 encapsulates error handling here.
3536 (GetInterfaces): simplified.
3537 (ResolveTree): Encapsulated all the tree resolution here.
3538 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
3541 * driver.cs: Add support for --nostdlib, to avoid loading the
3543 (Main): Do not put tree resolution here.
3545 * rootcontext.cs: Beginning of the class resolution.
3547 2001-08-03 Miguel de Icaza <miguel@ximian.com>
3549 * rootcontext.cs: Provide better error reporting.
3551 * cs-parser.jay (interface_base): set our $$ to be interfaces.
3553 * rootcontext.cs (CreateInterface): Handle the case where there
3554 are no parent interfaces.
3556 (CloseTypes): Routine to flush types at the end.
3557 (CreateInterface): Track types.
3558 (GetInterfaces): Returns an array of Types from the list of
3561 * typemanager.c (AddUserType): Mechanism to track user types (puts
3562 the type on the global type hash, and allows us to close it at the
3565 2001-08-02 Miguel de Icaza <miguel@ximian.com>
3567 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
3568 RecordInterface instead.
3570 * cs-parser.jay: Updated to reflect changes above.
3572 * decl.cs (Definition): Keep track of the TypeBuilder type that
3573 represents this type here. Not sure we will use it in the long
3574 run, but wont hurt for now.
3576 * driver.cs: Smaller changes to accomodate the new code.
3578 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
3581 * rootcontext.cs (CreateInterface): New method, used to create
3582 the System.TypeBuilder type for interfaces.
3583 (ResolveInterfaces): new entry point to resolve the interface
3585 (CodeGen): Property, used to keep track of the code generator.
3587 2001-07-26 Miguel de Icaza <miguel@ximian.com>
3589 * cs-parser.jay: Add a second production for delegate_declaration
3592 (enum_body): Put an opt_comma here instead of putting it on
3593 enum_body or enum_member_declarations so we can handle trailing
3594 commas on enumeration members. Gets rid of a shift/reduce.
3596 (type_list): Need a COMMA in the middle.
3598 (indexer_declaration): Tell tokenizer to recognize get/set
3600 * Remove old targets.
3602 * Re-add the parser target.
3604 2001-07-13 Simon Cozens <simon@simon-cozens.org>
3606 * cs-parser.jay: Add precendence rules for a number of operators
3607 ot reduce the number of shift/reduce conflicts in the grammar.
3609 2001-07-17 Miguel de Icaza <miguel@ximian.com>
3611 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
3614 Get rid of old crufty code.
3616 * rootcontext.cs: Use this to keep track of the parsed
3617 representation and the defined types available to the program.
3619 * gen-treedump.cs: adjust for new convention.
3621 * type.cs: Split out the type manager, and the assembly builder
3624 * typemanager.cs: the type manager will live here now.
3626 * cil-codegen.cs: And the code generator here.
3628 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
3630 * makefile: Fixed up for easy making.
3632 2001-07-13 Simon Cozens <simon@simon-cozens.org>
3634 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
3637 (unary_expression): Expand pre_increment_expression and
3638 post_decrement_expression to reduce a shift/reduce.
3640 2001-07-11 Simon Cozens
3642 * cs-tokenizer.cs: Hex numbers should begin with a 0.
3644 Improve allow_keyword_as_indent name.
3646 2001-06-19 Miguel de Icaza <miguel@ximian.com>
3648 * Adjustments for Beta2.
3650 2001-06-13 Miguel de Icaza <miguel@ximian.com>
3652 * decl.cs: Added `Define' abstract method.
3653 (InTransit): new property, used to catch recursive definitions.
3655 * interface.cs: Implement `Define'.
3657 * modifiers.cs: Map Modifiers.constants to
3658 System.Reflection.TypeAttribute flags.
3660 * class.cs: Keep track of types and user-defined types.
3661 (BuilderInit): New method for creating an assembly
3662 (ResolveType): New function to launch the resolution process, only
3663 used by interfaces for now.
3665 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
3666 that are inserted into the name space.
3668 2001-06-08 Miguel de Icaza <miguel@ximian.com>
3670 * ARGH. I have screwed up my tree so many times due to the use of
3671 rsync rather than using CVS. Going to fix this at once.
3673 * driver.cs: Objetify driver. Load assemblies, use assemblies to
3676 2001-06-07 Miguel de Icaza <miguel@ximian.com>
3678 * Experiment successful: Use System.Type rather that our own
3681 2001-05-25 Miguel de Icaza <miguel@ximian.com>
3683 * cs-parser.jay: Removed nsAliases from here.
3685 Use new namespaces, handle `using XXX;'
3687 * namespace.cs: Reimplemented namespace handling, use a recursive
3688 definition of the class. Now we can keep track of using clauses
3689 and catch invalid using clauses.
3691 2001-05-24 Miguel de Icaza <miguel@ximian.com>
3693 * gen-treedump.cs: Adapted for all the renaming.
3695 * expression.cs (Expression): this class now has a Type property
3696 which returns an expression Type.
3698 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
3699 `Type', as this has a different meaning now in the base
3701 2001-05-22 Miguel de Icaza <miguel@ximian.com>
3703 * interface.cs, class.cs: Removed from all the sources the
3704 references to signature computation, as we can not do method
3705 signature computation during the parsing time, as we are not
3706 trying to solve at that point distinguishing:
3710 void a (NS.Blah x) {}
3713 Which depending on the context might be valid or not, as we do not
3714 know if Blah is the same thing as NS.Blah at that point.
3716 * Redid everything so the code uses TypeRefs now instead of
3717 Types. TypeRefs are just temporary type placeholders, that need
3718 to be resolved. They initially have a pointer to a string and the
3719 current scope in which they are used. This is used later by the
3720 compiler to resolve the reference to an actual Type.
3722 * DeclSpace is no longer a CIR.Type, and neither are
3723 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
3724 are all DeclSpaces, but no Types.
3726 * type.cs (TypeRefManager): This implements the TypeRef manager,
3727 which keeps track of all the types that need to be resolved after
3728 the parsing has finished.
3730 2001-05-13 Miguel de Icaza <miguel@ximian.com>
3732 * ARGH. We are going to have to store `foreach' as a class rather
3733 than resolving it, as we need to verify error 1579 after name
3734 resolution. *OR* we could keep a flag that says `This request to
3735 IEnumerator comes from a foreach statement' which we can then use
3736 to generate the error.
3738 2001-05-10 Miguel de Icaza <miguel@ximian.com>
3740 * class.cs (TypeContainer.AddMethod): we now add methods to the
3741 MethodGroup instead of the method hashtable.
3743 * expression.cs: Add MethodGroup abstraction, which gets us one
3744 step closer to the specification in the way we handle method
3747 * cs-parser.jay (primary_expression): qualified_identifier now
3748 tried to match up an identifier to a local variable reference or
3749 to a parameter reference.
3751 current_local_parameters is now a parser global variable that
3752 points to the current parameters for the block, used during name
3755 (property_declaration): Now creates an implicit `value' argument to
3758 2001-05-09 Miguel de Icaza <miguel@ximian.com>
3760 * parameter.cs: Do not use `param' arguments as part of the
3761 signature, per the spec.
3763 2001-05-08 Miguel de Icaza <miguel@ximian.com>
3765 * decl.cs: Base class for classes, structs and interfaces. This
3766 is the "Declaration Space"
3768 * cs-parser.jay: Use CheckDef for checking declaration errors
3769 instead of having one on each function.
3771 * class.cs: Factor out some code for handling error handling in
3772 accordance to the "Declarations" section in the "Basic Concepts"
3773 chapter in the ECMA C# spec.
3775 * interface.cs: Make all interface member classes derive from
3776 InterfaceMemberBase.
3778 2001-05-07 Miguel de Icaza <miguel@ximian.com>
3780 * Many things: all interfaces are parsed and generated in
3781 gen-treedump. Support for member variables, constructors,
3782 destructors, properties, constants is there.
3784 Beginning of the IL backend, but very little done, just there for
3787 2001-04-29 Miguel de Icaza <miguel@ximian.com>
3789 * cs-parser.jay: Fix labeled statement.
3791 * cs-tokenizer.cs (escape): Escape " and ' always.
3792 ref_line, ref_name: keep track of the line/filename as instructed
3793 by #line by the compiler.
3796 2001-04-27 Miguel de Icaza <miguel@ximian.com>
3798 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
3799 to match the values in System.CodeDOM.
3801 Divid renamed to Divide.
3803 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
3805 (Statements.set): remove.
3807 * System.CodeDOM/CodeCatchClause.cs: always have a valid
3810 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
3811 falseStatements always have valid values.
3813 * cs-parser.jay: Use System.CodeDOM now.