1 2001-12-20 Miguel de Icaza <miguel@ximian.com>
3 * const.cs: Use the underlying type for enumerations
5 * delegate.cs: Compute the basename for the delegate creation,
6 that should fix the delegate test case, and restore the correct
7 Type Lookup semantics in rootcontext
9 * rootcontext.cs: Revert Ravi's last patch. The correct way of
10 referencing a nested type with the Reflection API is using the "+"
13 * cs-parser.jay: Do not require EOF token at the end.
15 2001-12-20 Ravi Pratap <ravi@ximian.com>
17 * rootcontext.cs (LookupType): Concatenate type names with
18 a '.' instead of a '+' The test suite passes again.
20 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
21 field of the enumeration.
23 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
24 the case when the member is an EventExpr.
26 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
27 static has an associated instance expression.
29 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
31 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
33 * class.cs (Event.Define): Register event and perform appropriate checks
36 We define the Add and Remove methods even if the use provides none because
37 in that case, we provide default implementations ourselves.
39 Define a private field of the type of the event. This is done by the CSC compiler
40 and we should be doing it too ;-)
42 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
43 More methods we use in code we generate.
45 (multicast_delegate_type, delegate_type): Two separate types since the distinction
48 (InitCoreTypes): Update accordingly for the above.
50 * class.cs (Event.Emit): Generate code for default accessors that we provide
52 (EmitDefaultMethod): Do the job in the above.
54 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
57 2001-12-20 Miguel de Icaza <miguel@ximian.com>
59 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
60 builders even if we were missing one.
62 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
63 pass the Basename as our class name instead of the Name. The
64 basename will be correctly composed for us.
66 * parameter.cs (Paramters): Now takes a Location argument.
68 * decl.cs (DeclSpace.LookupType): Removed convenience function and
69 make all the code call directly LookupType in RootContext and take
70 this chance to pass the Location information everywhere.
72 * Everywhere: pass Location information.
74 2001-12-19 Miguel de Icaza <miguel@ximian.com>
76 * class.cs (Constructor.Define): Updated way of detecting the
77 length of the parameters.
79 (TypeContainer.DefineType): Use basename as the type name for
82 (TypeContainer.Define): Do not recursively define types here, as
83 definition is taken care in order by the RootContext.
85 * tree.cs: Keep track of namespaces in a per-file basis.
87 * parameter.cs (Parameter.ComputeSignature): Update to use
90 (Parameters.GetSignature): ditto.
92 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
93 instead of a TypeContainer.
95 (Interface.SemanticAnalysis): Use `this' instead of our parent to
96 resolve names. Because we need to be resolve in our context, not
99 * driver.cs: Implement response files.
101 * class.cs (TypeContainer.DefineType): If we are defined, do not
104 (Event.Emit): Emit the code for add/remove handlers.
105 (Event.Define): Save the MethodBuilders for add/remove.
107 * typemanager.cs: Use pair here too.
109 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
110 DictionaryEntry requires the first argument to be non-null.
112 (enum_declaration): Compute full name for registering the
115 (delegate_declaration): Instead of using
116 formal_parameter_list, use opt_formal_parameter_list as the list
119 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
120 (EventParsing): New property that controls whether `add' and
121 `remove' are returned as tokens or identifiers (for events);
123 2001-12-19 Ravi Pratap <ravi@ximian.com>
125 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
126 use MyEventBuilder only and let it wrap the real builder for us.
128 (MyEventBuilder): Revamp constructor etc.
130 Implement all operations that we perform on EventBuilder in precisely the same
133 (FindMembers): Update to use the EventBuilder member.
135 (Event.Emit): Update accordingly.
137 2001-12-18 Ravi Pratap <ravi@ximian.com>
139 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
140 by calling the appropriate methods.
142 (GetCustomAttributes): Make stubs as they cannot possibly do anything
145 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
147 2001-12-17 Ravi Pratap <ravi@ximian.com>
149 * delegate.cs (Delegate.Populate): Check that the return type
150 and various parameters types are indeed accessible.
152 * class.cs (Constructor.Define): Same here.
154 (Field.Define): Ditto.
156 (Event.Define): Ditto.
158 (Operator.Define): Check that the underlying Method defined itself
159 correctly - so it's MethodBuilder should not be null.
161 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
162 expression happens to be null.
164 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
165 members but as of now we don't seem to be able to do anything really useful with it.
167 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
168 not the EventBuilder.
170 2001-12-18 Miguel de Icaza <miguel@ximian.com>
172 * cs-tokenizer.cs: Add support for defines.
173 Add support for #if, #elif, #else, #endif
175 (eval_var): evaluates a variable.
176 (eval): stubbed for evaluating functions.
178 * cs-parser.jay: Pass the defines information
180 * driver.cs: Add --define command line option.
182 * decl.cs: Move MemberCore here.
184 Make it the base class for DeclSpace. This allows us to catch and
185 report 108 and 109 for everything now.
187 * class.cs (TypeContainer.Define): Extract all the members
188 before populating and emit the warning 108 (new keyword required
189 to override) instead of having each member implement this.
191 (MemberCore.Define): New abstract method, we will be using this in
192 the warning reporting engine in Populate.
194 (Operator.Define): Adjust to new MemberCore protocol.
196 * const.cs (Const): This does not derive from Expression, it is a
197 temporary object we use to create fields, it is a MemberCore.
199 * class.cs (Method.Define): Allow the entry point to be in a
202 * driver.cs: Rewrite the argument handler to clean it up a bit.
204 * rootcontext.cs: Made it just an auxiliary namespace feature by
205 making everything static.
207 * driver.cs: Adapt code to use RootContext type name instead of
210 * delegate.cs: Remove RootContext argument.
212 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
215 * class.cs (Event.Define): The lookup can fail.
217 * cs-tokenizer.cs: Begin implementation of pre-procesor.
219 * expression.cs: Resolve the this instance before invoking the code.
221 2001-12-17 Miguel de Icaza <miguel@ximian.com>
223 * cs-parser.jay: Add a production in element_access that allows
224 the thing to become a "type" reference. This way we can parse
225 things like "(string [])" as a type.
227 Note that this still does not handle the more complex rules of
231 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
233 * ecore.cs: (CopyNewMethods): new utility function used to
234 assemble the list of methods from running FindMembers.
236 (MemberLookup): Rework FindMembers so that
238 2001-12-16 Miguel de Icaza <miguel@ximian.com>
240 * class.cs (TypeContainer): Remove Delegates who fail to be
243 * delegate.cs (Populate): Verify that we dont get null return
244 values. TODO: Check for AsAccessible.
246 * cs-parser.jay: Use basename to emit error 574 (destructor should
247 have the same name as container class), not the full name.
249 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
250 possible representation.
252 Also implements integer type suffixes U and L.
254 2001-12-15 Miguel de Icaza <miguel@ximian.com>
256 * expression.cs (ArrayCreation.DoResolve): We need to do the
257 argument resolution *always*.
259 * decl.cs: Make this hold the namespace. Hold the root context as
261 (LookupType): Move here.
263 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
265 * location.cs (Row, Name): Fixed the code, it was always returning
266 references to the first file.
268 * interface.cs: Register properties defined through interfaces.
270 * driver.cs: Add support for globbing on the command line
272 * class.cs (Field): Make it derive from MemberCore as well.
275 2001-12-15 Ravi Pratap <ravi@ximian.com>
277 * class.cs (Event::Define): Check that the type of the event is a delegate
278 type else flag error #66.
280 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
283 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
284 values of EntryPoint, CharSet etc etc.
286 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
288 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
289 be null and we should ignore this. I am not sure if this is really clean. Apparently,
290 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
291 which needs this to do its work.
293 * ../errors/cs0066.cs : Add.
295 2001-12-14 Miguel de Icaza <miguel@ximian.com>
297 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
300 * class.cs: (MethodSignature.MethodSignature): Removed hack that
301 clears out the parameters field.
302 (MemberSignatureCompare): Cleanup
304 (MemberCore): New base class used to share code between MethodCore
307 (RegisterRequiredImplementations) BindingFlags.Public requires
308 either BindingFlags.Instace or Static. Use instance here.
310 (Property): Refactored code to cope better with the full spec.
312 * parameter.cs (GetParameterInfo): Return an empty array instead
315 * class.cs (Property): Abstract or extern properties have no bodies.
317 * parameter.cs (GetParameterInfo): return a zero-sized array.
319 * class.cs (TypeContainer.MethodModifiersValid): Move all the
320 method modifier validation to the typecontainer so we can reuse
323 (MethodCore.ParameterTypes): return an empty sized array of types.
325 (Property.Define): Test property modifier validity.
327 Add tests for sealed/override too.
329 (Method.Emit): abstract or extern methods have no bodies.
331 2001-12-14 Ravi Pratap <ravi@ximian.com>
333 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
336 (Method::Define, ::Emit): Modify accordingly.
338 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
340 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
342 * makefile: Pass in /unsafe.
344 2001-12-13 Miguel de Icaza <miguel@ximian.com>
346 * class.cs (MakeKey): Kill routine.
348 * class.cs (TypeContainer.Define): Correctly define explicit
349 method implementations (they require the full interface name plus
352 * typemanager.cs: Deply the PtrHashtable here and stop using the
353 lame keys. Things work so much better.
355 This of course broke everyone who depended on `RegisterMethod' to
356 do the `test for existance' test. This has to be done elsewhere.
358 * support.cs (PtrHashtable): A hashtable that avoid comparing with
359 the object stupid Equals method (because, that like fails all over
360 the place). We still do not use it.
362 * class.cs (TypeContainer.SetRequiredInterface,
363 TypeContainer.RequireMethods): Killed these two routines and moved
364 all the functionality to RegisterRequiredImplementations.
366 (TypeContainer.RegisterRequiredImplementations): This routine now
367 registers all the implementations required in an array for the
368 interfaces and abstract methods. We use an array of structures
369 which can be computed ahead of time to reduce memory usage and we
370 also assume that lookups are cheap as most classes will not
371 implement too many interfaces.
373 We also avoid creating too many MethodSignatures.
375 (TypeContainer.IsInterfaceMethod): Update and optionally does not
376 clear the "pending" bit if we find that there are problems with
379 (TypeContainer.VerifyPendingMethods): Update to report errors of
380 methods that look like implementations but are not.
382 (TypeContainer.Define): Add support for explicit interface method
385 2001-12-12 Miguel de Icaza <miguel@ximian.com>
387 * typemanager.cs: Keep track of the parameters here instead of
388 being a feature of the TypeContainer.
390 * class.cs: Drop the registration of parameters here, as
391 InterfaceMethods are also interface declarations.
393 * delegate.cs: Register methods with the TypeManager not only with
394 the TypeContainer. This code was buggy.
396 * interface.cs: Full registation here.
398 2001-12-11 Miguel de Icaza <miguel@ximian.com>
400 * expression.cs: Remove reducer for binary expressions, it can not
403 * const.cs: Put here the code that used to go into constant.cs
405 * constant.cs: Put here the code for constants, this is a new base
408 * literal.cs: Make Literal derive from Constant.
410 2001-12-09 Miguel de Icaza <miguel@ximian.com>
412 * statement.cs (Return.Emit): Report error 157 if the user
413 attempts to return from a finally block.
415 (Return.Emit): Instead of emitting a return, jump to the end of
418 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
419 LocalBuilder to store the result of the function. ReturnLabel is
420 the target where we jump.
423 2001-12-09 Radek Doulik <rodo@ximian.com>
425 * cs-parser.jay: remember alias in current namespace
427 * ecore.cs (SimpleName::DoResolve): use aliases for types or
430 * class.cs (LookupAlias): lookup alias in my_namespace
432 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
434 (LookupAlias): lookup alias in this and if needed in parent
437 2001-12-08 Miguel de Icaza <miguel@ximian.com>
441 * rootcontext.cs: (ModuleBuilder) Made static, first step into
442 making things static. I need this to avoid passing the
443 TypeContainer when calling ParameterType.
445 * support.cs (InternalParameters.ParameterType): Remove ugly hack
446 that did string manipulation to compute the type and then call
447 GetType. Use Parameter.ParameterType instead.
449 * cs-tokenizer.cs: Consume the suffix for floating values.
451 * expression.cs (ParameterReference): figure out whether this is a
452 reference parameter or not. Kill an extra variable by computing
453 the arg_idx during emission.
455 * parameter.cs (Parameters.GetParameterInfo): New overloaded
456 function that returns whether a parameter is an out/ref value or not.
458 (Parameter.ParameterType): The type of the parameter (base,
459 without ref/out applied).
461 (Parameter.Resolve): Perform resolution here.
462 (Parameter.ExternalType): The full type (with ref/out applied).
464 * statement.cs (Using.Emit, Using.EmitExpression): Implement
465 support for expressions on the using statement.
467 2001-12-07 Miguel de Icaza <miguel@ximian.com>
469 * statement.cs (Using.EmitLocalVariableDecls): Split the
470 localvariable handling of the using statement.
472 (Block.EmitMeta): Keep track of variable count across blocks. We
473 were reusing slots on separate branches of blocks.
475 (Try.Emit): Emit the general code block, we were not emitting it.
477 Check the type of the declaration to be an IDisposable or
478 something that can be implicity converted to it.
480 Emit conversions if required.
482 * ecore.cs (EmptyExpression): New utility class.
483 (Expression.ImplicitConversionExists): New utility function.
485 2001-12-06 Miguel de Icaza <miguel@ximian.com>
487 * statement.cs (Using): Implement.
489 * expression.cs (LocalVariableReference): Support read only variables.
491 * statement.cs: Remove the explicit emit for the Leave opcode.
492 (VariableInfo): Add a readonly field.
494 2001-12-05 Miguel de Icaza <miguel@ximian.com>
496 * ecore.cs (ConvCast): new class used to encapsulate the various
497 explicit integer conversions that works in both checked and
500 (Expression.ConvertNumericExplicit): Use new ConvCast class to
501 properly generate the overflow opcodes.
503 2001-12-04 Miguel de Icaza <miguel@ximian.com>
505 * statement.cs: The correct type for the EmptyExpression is the
506 element_type, not the variable type. Ravi pointed this out.
508 2001-12-04 Ravi Pratap <ravi@ximian.com>
510 * class.cs (Method::Define): Handle PInvoke methods specially
511 by using DefinePInvokeMethod instead of the usual one.
513 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
514 above to do the task of extracting information and defining the method.
516 2001-12-04 Ravi Pratap <ravi@ximian.com>
518 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
519 of the condition for string type.
521 (Emit): Move that here.
523 (ArrayCreation::CheckIndices): Keep string literals in their expression
526 (EmitDynamicInitializers): Handle strings appropriately.
528 2001-12-04 Miguel de Icaza <miguel@ximian.com>
530 * codegen.cs (EmitContext): Replace multiple variables with a
531 single pointer to the current Switch statement.
533 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
536 2001-12-03 Miguel de Icaza <miguel@ximian.com>
540 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
543 (Foreach.Emit): Foreach on arrays was not setting
544 up the loop variables (for break/continue).
546 (GotoCase): Semi-implented.
548 2001-12-03 Ravi Pratap <ravi@ximian.com>
550 * attribute.cs (CheckAttribute): Handle system attributes by using
551 Attribute.GetAttributes to examine information we need.
553 (GetValidPlaces): Same here.
555 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
557 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
559 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
561 (Method::Define): Set appropriate flags if we have a DllImport attribute.
563 (Method::Emit): Handle the case when we are a PInvoke method.
565 2001-12-03 Miguel de Icaza <miguel@ximian.com>
567 * expression.cs: Use ResolveWithSimpleName on compound names.
569 2001-12-02 Ravi Pratap <ravi@ximian.com>
571 * constant.cs (EmitConstant): Make sure we resolve the associated expression
572 before trying to reduce it.
574 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
576 * constant.cs (LookupConstantValue): Implement.
578 (EmitConstant): Use the above in emitting the constant.
580 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
581 that are user-defined by doing a LookupConstantValue on them.
583 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
586 2001-11-29 Miguel de Icaza <miguel@ximian.com>
588 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
590 (BaseAccess.DoResolve): Implement.
592 (MemberAccess.DoResolve): Split this routine into a
593 ResolveMemberAccess routine that can be used independently
595 2001-11-28 Miguel de Icaza <miguel@ximian.com>
597 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
598 As that share bits of the implementation. Is returns a boolean,
599 while As returns the Type that is being probed.
601 2001-12-01 Ravi Pratap <ravi@ximian.com>
603 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
604 instead of a Literal - much easier.
606 (EnumInTransit): Remove - utterly useless :-)
608 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
610 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
612 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
613 chain when we have no associated expression.
615 2001-11-30 Ravi Pratap <ravi@ximian.com>
617 * constant.cs (Define): Use Location while reporting the errror.
619 Also emit a warning when 'new' is used and there is no inherited
622 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
625 (LookupEnumValue): Implement to lookup an enum member's value and define it
628 (Populate): Re-write accordingly to use the above routine.
630 2001-11-27 Miguel de Icaza <miguel@ximian.com>
632 * expression.cs (This): Fix prototype for DoResolveLValue to
633 override the base class DoResolveLValue.
635 * cs-parser.cs: Report errors cs574 and cs575 (destructor
638 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
639 (we need to load the address of the field here). This fixes
642 (FieldExpr.DoResolveLValue): Call the DoResolve
643 function to initialize the Instance expression.
645 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
646 correctly the GetEnumerator operation on a value type.
648 * cs-parser.jay: Add more simple parsing error catches.
650 * statement.cs (Switch): Add support for string switches.
651 Handle null specially.
653 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
655 2001-11-28 Ravi Pratap <ravi@ximian.com>
657 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
659 (declare_local_constant): New helper function.
661 * statement.cs (AddConstant): Keep a separate record of constants
663 (IsConstant): Implement to determine if a variable is a constant.
665 (GetConstantExpression): Implement.
667 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
669 * statement.cs (IsVariableDefined): Re-write.
671 2001-11-27 Ravi Pratap <ravi@ximian.com>
673 * class.cs (TypeContainer::FindMembers): Look for constants
674 in the case when we are looking for MemberTypes.Field
676 * expression.cs (MemberAccess::DoResolve): Check that in the
677 case we are a FieldExpr and a Literal, we are not being accessed
678 by an instance reference.
680 * cs-parser.jay (local_constant_declaration): Implement.
682 (declaration_statement): Implement for constant declarations.
684 2001-11-26 Miguel de Icaza <miguel@ximian.com>
686 * statement.cs (Switch): Catch double defaults.
688 (Switch): More work on the switch() statement
689 implementation. It works for integral values now, need to finish
693 2001-11-24 Miguel de Icaza <miguel@ximian.com>
695 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
696 integer literals into other integer literals. To be used by
699 2001-11-24 Ravi Pratap <ravi@ximian.com>
701 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
704 (EmitDynamicInitializers): Cope with the above since we extract data
705 directly from ArrayData now.
707 (ExpectInitializers): Keep track of whether initializers are mandatory
710 (Bounds): Make it a hashtable to prevent the same dimension being
711 recorded for every element in that dimension.
713 (EmitDynamicInitializers): Fix bug which prevented the Set array method
716 Also fix bug which was causing the indices to be emitted in the reverse
719 2001-11-24 Miguel de Icaza <miguel@ximian.com>
721 * expression.cs (ArrayCreation): Implement the bits that Ravi left
722 unfinished. They do not work, because the underlying code is
725 2001-11-22 Miguel de Icaza <miguel@ximian.com>
727 * cs-parser.jay: Remove bogus fixme.
729 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
732 2001-11-23 Ravi Pratap <ravi@ximian.com>
734 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
737 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
738 parameter. Apparently, any expression is allowed.
740 (ValidateInitializers): Update accordingly.
742 (CheckIndices): Fix some tricky bugs thanks to recursion.
744 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
745 I was being completely brain-dead.
747 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
748 and re-write acordingly.
750 (DelegateInvocation): Re-write accordingly.
752 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
754 (MakeByteBlob): Handle types more correctly.
756 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
757 initialization from expressions but it is incomplete because I am a complete
760 2001-11-22 Miguel de Icaza <miguel@ximian.com>
762 * statement.cs (If.Emit): Fix a bug that generated incorrect code
763 on If. Basically, we have to return `true' (ie, we do return to
764 our caller) only if both branches of the if return.
766 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
767 short-circuit operators, handle them as short circuit operators.
769 (Cast.DoResolve): Resolve type.
770 (Cast.Cast): Take an expression as the target type.
772 * cs-parser.jay (cast_expression): Remove old hack that only
773 allowed a limited set of types to be handled. Now we take a
774 unary_expression and we resolve to a type during semantic
777 Use the grammar productions from Rhys to handle casts (this is
778 not complete like Rhys syntax yet, we fail to handle that corner
779 case that C# has regarding (-x), but we will get there.
781 2001-11-22 Ravi Pratap <ravi@ximian.com>
783 * class.cs (EmitFieldInitializer): Take care of the case when we have a
784 field which is an array type.
786 * cs-parser.jay (declare_local_variables): Support array initialization too.
788 * typemanager.cs (MakeKey): Implement.
790 (everywhere): Use the above appropriately.
792 * cs-parser.jay (for_statement): Update for array initialization while
795 * ecore.cs : The error message was correct, it's the variable's names that
796 were misleading ;-) Make the code more readable.
798 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
799 the correct type etc.
801 (ConvertExplicit): Handle Enum types by examining the underlying type.
803 2001-11-21 Ravi Pratap <ravi@ximian.com>
805 * parameter.cs (GetCallingConvention): Always return
806 CallingConventions.Standard for now.
808 2001-11-22 Miguel de Icaza <miguel@ximian.com>
810 * expression.cs (Binary.ResolveOperator): Update the values of `l'
811 and `r' after calling DoNumericPromotions.
813 * ecore.cs: Fix error message (the types were in the wrong order).
815 * statement.cs (Foreach.ProbeCollectionType): Need to pass
816 BindingFlags.Instance as well
818 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
819 implicit int literal conversion in an empty cast so that we
820 propagate the right type upstream.
822 (UnboxCast): new class used to unbox value types.
823 (Expression.ConvertExplicit): Add explicit type conversions done
826 (Expression.ImplicitNumericConversion): Oops, forgot to test for
827 the target type before applying the implicit LongLiterals to ULong
830 2001-11-21 Miguel de Icaza <miguel@ximian.com>
832 * cs-parser.jay (for_statement): Reworked the way For works: now
833 we declare manually any variables that are introduced in
834 for_initializer to solve the problem of having out-of-band code
835 emition (that is what got for broken).
837 (declaration_statement): Perform the actual variable declaration
838 that used to be done in local_variable_declaration here.
840 (local_variable_declaration): Do not declare anything, just pass
841 the information on a DictionaryEntry
843 2001-11-20 Ravi Pratap <ravi@ximian.com>
845 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
846 re-write of the logic to now make it recursive.
848 (UpdateIndices): Re-write accordingly.
850 Store element data in a separate ArrayData list in the above methods.
852 (MakeByteBlob): Implement to dump the array data into a byte array.
854 2001-11-19 Ravi Pratap <ravi@ximian.com>
856 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
859 * constant.cs (Define): Implement.
861 (EmitConstant): Re-write fully.
863 Pass in location info.
865 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
868 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
869 DictionaryEntry since we need location info too.
871 (constant_declaration): Update accordingly.
873 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
874 code into another method : UpdateIndices.
876 2001-11-18 Ravi Pratap <ravi@ximian.com>
878 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
879 some type checking etc.
881 2001-11-17 Ravi Pratap <ravi@ximian.com>
883 * expression.cs (ArrayCreation::ValidateInitializers): Implement
884 bits to provide dimension info if the user skips doing that.
886 Update second constructor to store the rank correctly.
888 2001-11-16 Ravi Pratap <ravi@ximian.com>
890 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
891 and try to implement.
893 * ../errors/cs0150.cs : Add.
895 * ../errors/cs0178.cs : Add.
897 2001-11-16 Miguel de Icaza <miguel@ximian.com>
899 * statement.cs: Implement foreach on multi-dimensional arrays.
901 * parameter.cs (Parameters.GetParameterByName): Also lookup the
902 name of the params argument.
904 * expression.cs: Use EmitStoreOpcode to get the right opcode while
905 initializing the array.
907 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
908 we can use this elsewhere.
910 * statement.cs: Finish implementation of foreach for single
913 * cs-parser.jay: Use an out-of-band stack to pass information
914 around, I wonder why I need this.
916 foreach_block: Make the new foreach_block the current_block.
918 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
919 function used to return a static Parameters structure. Used for
920 empty parameters, as those are created very frequently.
922 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
924 2001-11-15 Ravi Pratap <ravi@ximian.com>
926 * interface.cs : Default modifier is private, not public. The
927 make verify test passes again.
929 2001-11-15 Ravi Pratap <ravi@ximian.com>
931 * support.cs (ReflectionParameters): Fix logic to determine
932 whether the last parameter is a params one. Test 9 passes again.
934 * delegate.cs (Populate): Register the builders we define with
935 RegisterParameterForBuilder. Test 19 passes again.
937 * cs-parser.jay (property_declaration): Reference $6 instead
938 of $$ to get at the location.
940 (indexer_declaration): Similar stuff.
944 * class.cs (Property): Register parameters for the Get and Set methods
945 if they exist. Test 23 passes again.
947 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
948 call to EmitArguments as we are sure there aren't any params arguments.
949 Test 32 passes again.
951 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
952 IndexOutOfRangeException.
954 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
955 Test 33 now passes again.
957 2001-11-15 Miguel de Icaza <miguel@ximian.com>
959 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
960 broke a bunch of things. Will have to come up with a better way
961 of tracking locations.
963 * statement.cs: Implemented foreach for single dimension arrays.
965 2001-11-09 Miguel de Icaza <miguel@ximian.com>
967 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
968 an error. This removes the lookup from the critical path.
970 * cs-parser.jay: Removed use of temporary_loc, which is completely
973 2001-11-14 Miguel de Icaza <miguel@ximian.com>
975 * support.cs (ReflectionParameters.ParameterModifier): Report
976 whether the argument is a PARAMS argument or not.
978 * class.cs: Set the attribute `ParamArrayAttribute' on the
981 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
982 and cons_param_array_attribute (ConstructorInfo for
983 ParamArrayAttribute).,
985 * codegen.cs: Emit the return using the `Return' statement, that
986 way we can report the error correctly for missing return values.
988 * class.cs (Method.Emit): Clean up.
990 * expression.cs (Argument.Resolve): Take another argument: the
991 location where this argument is used. Notice that this is not
992 part of the "Argument" class as to reduce the size of the
993 structure (we know the approximate location anyways).
995 Test if the argument is a variable-reference, if not, then
998 (Argument.Emit): Emit addresses of variables.
1000 (Argument.FullDesc): Simplify.
1002 (Invocation.DoResolve): Update for Argument.Resolve.
1004 (ElementAccess.DoResolve): ditto.
1006 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
1007 method should be virtual, as this method is always virtual.
1009 (NewDelegate.DoResolve): Update for Argument.Resolve.
1011 * class.cs (ConstructorInitializer.DoResolve): ditto.
1013 * attribute.cs (Attribute.Resolve): ditto.
1015 2001-11-13 Miguel de Icaza <miguel@ximian.com>
1017 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
1019 * expression.cs (ParameterReference): Drop IStackStorage and implement
1020 IAssignMethod instead.
1022 (LocalVariableReference): ditto.
1024 * ecore.cs (FieldExpr): Drop IStackStorage and implement
1025 IAssignMethod instead.
1027 2001-11-13 Miguel de Icaza <miguel@ximian.com>
1029 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
1030 enumerations that are used in heavily used structures derive from
1031 byte in a laughable and pathetic attempt to reduce memory usage.
1032 This is the kind of pre-optimzations that you should not do at
1033 home without adult supervision.
1035 * expression.cs (UnaryMutator): New class, used to handle ++ and
1036 -- separatedly from the other unary operators. Cleans up the
1037 code, and kills the ExpressionStatement dependency in Unary.
1039 (Unary): Removed `method' and `Arguments' from this class, making
1040 it smaller, and moving it all to SimpleCall, so I can reuse this
1041 code in other locations and avoid creating a lot of transient data
1042 strucutres when not required.
1044 * cs-parser.jay: Adjust for new changes.
1046 2001-11-11 Miguel de Icaza <miguel@ximian.com>
1048 * enum.cs (Enum.Populate): If there is a failure during
1051 * cs-parser.jay (opt_enum_base): we used to catch type errors
1052 here, but this is really incorrect. The type error should be
1053 catched during semantic analysis.
1055 2001-12-11 Ravi Pratap <ravi@ximian.com>
1057 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
1058 current_local_parameters as expected since I, in my stupidity, had forgotten
1061 * attribute.cs (GetValidPlaces): Fix stupid bug.
1063 * class.cs (Method::Emit): Perform check on applicability of attributes.
1065 (Constructor::Emit): Ditto.
1067 (Field::Emit): Ditto.
1069 (Field.Location): Store location information.
1071 (Property, Event, Indexer, Operator): Ditto.
1073 * cs-parser.jay (field_declaration): Pass in location for each field.
1075 * ../errors/cs0592.cs : Add.
1077 2001-11-12 Ravi Pratap <ravi@ximian.com>
1079 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
1081 (InitCoreTypes): Update accordingly.
1083 (RegisterAttrType, LookupAttr): Implement.
1085 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
1086 info about the same.
1088 (Resolve): Update to populate the above as necessary.
1092 (GetValidPlaces): Helper to the above.
1094 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
1096 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
1098 2001-11-12 Ravi Pratap <ravi@ximian.com>
1100 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
1102 * ../errors/cs0617.cs : Add.
1104 2001-11-11 Ravi Pratap <ravi@ximian.com>
1106 * enum.cs (Emit): Rename to Populate to be more consistent with what
1107 we expect it to do and when exactly it is called.
1109 * class.cs, rootcontext.cs : Update accordingly.
1111 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
1112 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
1114 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
1116 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
1117 of a fieldinfo using the above, when dealing with a FieldBuilder.
1119 2001-11-10 Ravi Pratap <ravi@ximian.com>
1121 * ../errors/cs0031.cs : Add.
1123 * ../errors/cs1008.cs : Add.
1125 * ../errrors/cs0543.cs : Add.
1127 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
1130 (FindMembers): Implement.
1132 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
1133 enums and delegates too.
1135 (enum_types): Rename to builder_to_enum.
1137 (delegate_types): Rename to builder_to_delegate.
1139 * delegate.cs (FindMembers): Implement.
1141 2001-11-09 Ravi Pratap <ravi@ximian.com>
1143 * typemanager.cs (IsEnumType): Implement.
1145 * enum.cs (Emit): Re-write parts to account for the underlying type
1146 better and perform checking etc.
1148 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
1149 of the underlying type.
1151 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
1154 * enum.cs (error31): Helper to report error #31.
1156 * cs-parser.jay (enum_declaration): Store location of each member too.
1158 * enum.cs (member_to_location): New hashtable.
1160 (AddEnumMember): Update location hashtable.
1162 (Emit): Use the location of each member while reporting errors.
1164 2001-11-09 Miguel de Icaza <miguel@ximian.com>
1166 * cs-parser.jay: A for_initializer if is a
1167 local_variable_declaration really ammount to have an implicit
1168 block with the variable declaration and no initializer for for.
1170 * statement.cs (For.Emit): Cope with null initializers.
1172 This fixes the infinite loop on for initializers.
1174 2001-11-08 Miguel de Icaza <miguel@ximian.com>
1176 * enum.cs: More cleanup.
1178 * ecore.cs: Remove dead code.
1180 * class.cs (Property.Emit): More simplification.
1181 (Event.Emit): ditto.
1183 Reworked to have less levels of indentation.
1185 2001-11-08 Ravi Pratap <ravi@ximian.com>
1187 * class.cs (Property): Emit attributes.
1197 * enum.cs (Emit): Ditto.
1199 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
1202 * class.cs (Field, Event, etc.): Move attribute generation into the
1203 Emit method everywhere.
1205 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
1206 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
1207 as we had no way of defining nested enums !
1209 * rootcontext.cs : Adjust code accordingly.
1211 * typemanager.cs (AddEnumType): To keep track of enum types separately.
1213 2001-11-07 Ravi Pratap <ravi@ximian.com>
1215 * expression.cs (EvalConstantExpression): Move into ecore.cs
1217 * enum.cs (Enum): Rename some members and make them public and readonly
1218 according to our convention.
1220 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
1223 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
1225 (Enum::Emit): Write a simple version for now which doesn't try to compute
1226 expressions. I shall modify this to be more robust in just a while.
1228 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
1230 (TypeContainer::CloseType): Create the Enum types too.
1232 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
1234 * expression.cs (EvalConstantExpression): Get rid of completely.
1236 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
1237 user-defined values and other cases.
1239 (IsValidEnumLiteral): Helper function.
1241 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
1242 out there in the case we had a literal FieldExpr.
1244 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
1246 (Literalize): Revamp a bit to take two arguments.
1248 (EnumLiteral): New class which derives from Literal to wrap enum literals.
1250 2001-11-06 Ravi Pratap <ravi@ximian.com>
1252 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
1254 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
1256 (Resolve): Use the above to ensure we have proper initializers.
1258 2001-11-05 Ravi Pratap <ravi@ximian.com>
1260 * expression.cs (Expression::EvalConstantExpression): New method to
1261 evaluate constant expressions.
1263 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
1265 2001-11-07 Miguel de Icaza <miguel@ximian.com>
1267 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
1270 (Binary.ResolveOperator): Handle operator != (object a, object b)
1271 and operator == (object a, object b);
1273 (Binary.DoNumericPromotions): Indicate whether the numeric
1274 promotion was possible.
1276 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
1279 Made the ArrayAccess implement interface IAssignMethod instead of
1280 IStackStore as the order in which arguments are passed reflects
1283 * assign.cs: Instead of using expr.ExprClass to select the way of
1284 assinging, probe for the IStackStore/IAssignMethod interfaces.
1286 * typemanager.cs: Load InitializeArray definition.
1288 * rootcontext.cs (RootContext.MakeStaticData): Used to define
1289 static data that can be used to initialize arrays.
1291 2001-11-05 Miguel de Icaza <miguel@ximian.com>
1293 * expression.cs: Handle operator== and operator!= for booleans.
1295 (Conditioal.Reduce): Implement reducer for the ?: operator.
1297 (Conditional.Resolve): Implement dead code elimination.
1299 (Binary.Resolve): Catch string literals and return a new
1300 concatenated string.
1302 (Unary.Reduce): Implement reduction of unary expressions.
1304 * ecore.cs: Split out the expression core handling here.
1306 (Expression.Reduce): New method used to perform constant folding
1307 and CSE. This is needed to support constant-expressions.
1309 * statement.cs (Statement.EmitBoolExpression): Pass true and false
1310 targets, and optimize for !x.
1312 2001-11-04 Ravi Pratap <ravi@ximian.com>
1314 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
1315 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
1316 set custom atttributes.
1318 * literal.cs (Literal::GetValue): New abstract method to return the actual
1319 value of the literal, cast as an object.
1321 (*Literal): Implement GetValue method.
1323 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
1324 expressions to the arraylist but objects of type Argument.
1326 * class.cs (TypeContainer::Emit): Emit our attributes too.
1328 (Method::Emit, Constructor::Emit): Ditto.
1330 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
1331 to be ignoring earlier.
1333 2001-11-03 Ravi Pratap <ravi@ximian.com>
1335 * attribute.cs (AttributeSection::Define): Implement to do the business
1336 of constructing a CustomAttributeBuilder.
1338 (Attribute): New trivial class. Increases readability of code.
1340 * cs-parser.jay : Update accordingly.
1342 (positional_argument_list, named_argument_list, named_argument): New rules
1344 (attribute_arguments): Use the above so that we are more correct.
1346 2001-11-02 Ravi Pratap <ravi@ximian.com>
1348 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
1349 to perform all checks for a method with a params parameter.
1351 (Invocation::OverloadResolve): Update to use the above method and therefore
1352 cope correctly with params method invocations.
1354 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
1357 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
1358 constructors in our parent too because we can't afford to miss out on
1361 * attribute.cs (AttributeSection): New name for the class Attribute
1363 Other trivial changes to improve readability.
1365 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
1366 use the new class names.
1368 2001-11-01 Ravi Pratap <ravi@ximian.com>
1370 * class.cs (Method::Define): Complete definition for params types too
1372 (Indexer::Define): Ditto.
1374 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
1375 Cope everywhere with a request for info about the array parameter.
1377 2001-11-01 Ravi Pratap <ravi@ximian.com>
1379 * tree.cs (RecordNamespace): Fix up to check for the correct key.
1381 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
1382 local_variable_type to extract the string corresponding to the type.
1384 (local_variable_type): Fixup the action to use the new helper method.
1386 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
1389 * expression.cs : Clean out code which uses the above.
1391 2001-10-31 Ravi Pratap <ravi@ximian.com>
1393 * typemanager.cs (RegisterMethod): Check if we already have an existing key
1394 and bale out if necessary by returning a false.
1396 (RegisterProperty): Ditto.
1398 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
1399 and print out appropriate error messages.
1401 * interface.cs (everywhere): Ditto.
1403 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
1404 location to constructor.
1406 * class.cs (Property, Event, Indexer): Update accordingly.
1408 * ../errors/cs111.cs : Added.
1410 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
1411 of a method, as laid down by the spec.
1413 (Invocation::OverloadResolve): Use the above method.
1415 2001-10-31 Ravi Pratap <ravi@ximian.com>
1417 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
1418 now take a TypeContainer and a Parameters object.
1420 (ParameterData): Modify return type of ParameterModifier method to be
1421 Parameter.Modifier and not a string.
1423 (ReflectionParameters, InternalParameters): Update accordingly.
1425 * expression.cs (Argument::GetParameterModifier): Same here.
1427 * support.cs (InternalParameters::ParameterType): Find a better way of determining
1428 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
1429 symbol in it at all so maybe this is only for now.
1431 2001-10-30 Ravi Pratap <ravi@ximian.com>
1433 * support.cs (InternalParameters): Constructor now takes an extra argument
1434 which is the actual Parameters class.
1436 (ParameterDesc): Update to provide info on ref/out modifiers.
1438 * class.cs (everywhere): Update call to InternalParameters to pass in
1439 the second argument too.
1441 * support.cs (ParameterData): Add ParameterModifier, which is a method
1442 to return the modifier info [ref/out etc]
1444 (InternalParameters, ReflectionParameters): Implement the above.
1446 * expression.cs (Argument::ParameterModifier): Similar function to return
1447 info about the argument's modifiers.
1449 (Invocation::OverloadResolve): Update to take into account matching modifiers
1452 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
1453 a new SetFormalParameters object which we pass to InternalParameters.
1455 2001-10-30 Ravi Pratap <ravi@ximian.com>
1457 * expression.cs (NewArray): Merge into the ArrayCreation class.
1459 2001-10-29 Ravi Pratap <ravi@ximian.com>
1461 * expression.cs (NewArray): Merge classes NewBuiltinArray and
1462 NewUserdefinedArray into one as there wasn't much of a use in having
1465 * expression.cs (Argument): Change field's name to ArgType from Type.
1467 (Type): New readonly property which returns the proper type, taking into
1468 account ref/out modifiers.
1470 (everywhere): Adjust code accordingly for the above.
1472 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
1473 whether we are emitting for a ref or out parameter.
1475 * expression.cs (Argument::Emit): Use the above field to set the state.
1477 (LocalVariableReference::Emit): Update to honour the flag and emit the
1480 * parameter.cs (Attributes): Set the correct flags for ref parameters.
1482 * expression.cs (Argument::FullDesc): New function to provide a full desc.
1484 * support.cs (ParameterData): Add method ParameterDesc to the interface.
1486 (ReflectionParameters, InternalParameters): Implement the above method.
1488 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
1491 (Invocation::FullMethodDesc): Ditto.
1493 2001-10-29 Miguel de Icaza <miguel@ximian.com>
1495 * cs-parser.jay: Add extra production for the second form of array
1498 * expression.cs (ArrayCreation): Update to reflect the above
1501 * Small changes to prepare for Array initialization.
1503 2001-10-28 Miguel de Icaza <miguel@ximian.com>
1505 * typemanager.cs (ImplementsInterface): interface might be null;
1506 Deal with this problem;
1508 Also, we do store negative hits on the cache (null values), so use
1509 this instead of calling t.GetInterfaces on the type everytime.
1511 2001-10-28 Ravi Pratap <ravi@ximian.com>
1513 * typemanager.cs (IsBuiltinType): New method to help determine the same.
1515 * expression.cs (New::DoResolve): Get rid of array creation code and instead
1516 split functionality out into different classes.
1518 (New::FormArrayType): Move into NewBuiltinArray.
1520 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
1523 (NewBuiltinArray): New class to handle creation of built-in arrays.
1525 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
1526 account creation of one-dimensional arrays.
1528 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
1530 (NewUserdefinedArray::DoResolve): Implement.
1532 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
1534 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
1535 we maintain inside the TypeManager. This is necessary to perform lookups on the
1538 (LookupType): Update to perform GetType on the module builders too.
1540 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
1542 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
1544 2001-10-23 Ravi Pratap <ravi@ximian.com>
1546 * expression.cs (New::DoResolve): Implement guts of array creation.
1548 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
1550 2001-10-27 Miguel de Icaza <miguel@ximian.com>
1552 * expression.cs: Fix bug I introduced lsat night that broke
1555 (Expression.Resolve): Report a 246 error (can not resolve name)
1556 if we find a SimpleName in the stream.
1558 (Expression.ResolveLValue): Ditto.
1560 (Expression.ResolveWithSimpleName): This function is a variant of
1561 ResolveName, this one allows SimpleNames to be returned without a
1562 warning. The only consumer of SimpleNames is MemberAccess
1564 2001-10-26 Miguel de Icaza <miguel@ximian.com>
1566 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
1567 might arrive here. I have my doubts that this is correct.
1569 * statement.cs (Lock): Implement lock statement.
1571 * cs-parser.jay: Small fixes to support `lock' and `using'
1573 * cs-tokenizer.cs: Remove extra space
1575 * driver.cs: New flag --checked, allows to turn on integer math
1578 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
1579 Threading.Monitor.Exit
1581 2001-10-23 Miguel de Icaza <miguel@ximian.com>
1583 * expression.cs (IndexerAccess::DoResolveLValue): Set the
1584 Expression Class to be IndexerAccess.
1586 Notice that Indexer::DoResolve sets the eclass to Value.
1588 2001-10-22 Miguel de Icaza <miguel@ximian.com>
1590 * class.cs (TypeContainer::Emit): Emit code for indexers.
1592 * assign.cs (IAssignMethod): New interface implemented by Indexers
1593 and Properties for handling assignment.
1595 (Assign::Emit): Simplify and reuse code.
1597 * expression.cs (IndexerAccess, PropertyExpr): Implement
1598 IAssignMethod, clean up old code.
1600 2001-10-22 Ravi Pratap <ravi@ximian.com>
1602 * typemanager.cs (ImplementsInterface): New method to determine if a type
1603 implements a given interface. Provides a nice cache too.
1605 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
1608 (ConvertReferenceExplicit): Ditto.
1610 * delegate.cs (Delegate::Populate): Update to define the parameters on the
1611 various methods, with correct names etc.
1613 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
1614 Operator.UnaryNegation.
1616 * cs-parser.jay (operator_declarator): Be a little clever in the case where
1617 we have a unary plus or minus operator.
1619 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
1622 * everywhere : update accordingly.
1624 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
1627 * class.cs (Method::Define): For the case where we are implementing a method
1628 inherited from an interface, we need to set the MethodAttributes.Final flag too.
1629 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
1631 2001-10-21 Ravi Pratap <ravi@ximian.com>
1633 * interface.cs (FindMembers): Implement to work around S.R.E
1636 * typemanager.cs (IsInterfaceType): Implement.
1638 (FindMembers): Update to handle interface types too.
1640 * expression.cs (ImplicitReferenceConversion): Re-write bits which
1641 use IsAssignableFrom as that is not correct - it doesn't work.
1643 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
1644 and accordingly override EmitStatement.
1646 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
1647 using the correct logic :-)
1649 2001-10-19 Ravi Pratap <ravi@ximian.com>
1651 * ../errors/cs-11.cs : Add to demonstrate error -11
1653 2001-10-17 Miguel de Icaza <miguel@ximian.com>
1655 * assign.cs (Assign::Resolve): Resolve right hand side first, and
1656 then pass this as a hint to ResolveLValue.
1658 * expression.cs (FieldExpr): Add Location information
1660 (FieldExpr::LValueResolve): Report assignment to readonly
1663 (Expression::ExprClassFromMemberInfo): Pass location information.
1665 (Expression::ResolveLValue): Add new method that resolves an
1668 (Expression::DoResolveLValue): Default invocation calls
1671 (Indexers): New class used to keep track of indexers in a given
1674 (IStackStore): Renamed from LValue, as it did not really describe
1675 what this did. Also ResolveLValue is gone from this interface and
1676 now is part of Expression.
1678 (ElementAccess): Depending on the element access type
1680 * typemanager.cs: Add `indexer_name_type' as a Core type
1681 (System.Runtime.CompilerServices.IndexerNameAttribute)
1683 * statement.cs (Goto): Take a location.
1685 2001-10-18 Ravi Pratap <ravi@ximian.com>
1687 * delegate.cs (Delegate::VerifyDelegate): New method to verify
1688 if two delegates are compatible.
1690 (NewDelegate::DoResolve): Update to take care of the case when
1691 we instantiate a delegate from another delegate.
1693 * typemanager.cs (FindMembers): Don't even try to look up members
1694 of Delegate types for now.
1696 2001-10-18 Ravi Pratap <ravi@ximian.com>
1698 * delegate.cs (NewDelegate): New class to take care of delegate
1701 * expression.cs (New): Split the delegate related code out into
1702 the NewDelegate class.
1704 * delegate.cs (DelegateInvocation): New class to handle delegate
1707 * expression.cs (Invocation): Split out delegate related code into
1708 the DelegateInvocation class.
1710 2001-10-17 Ravi Pratap <ravi@ximian.com>
1712 * expression.cs (New::DoResolve): Implement delegate creation fully
1713 and according to the spec.
1715 (New::DoEmit): Update to handle delegates differently.
1717 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
1718 because of which we were printing out arguments in reverse order !
1720 * delegate.cs (VerifyMethod): Implement to check if the given method
1721 matches the delegate.
1723 (FullDelegateDesc): Implement.
1725 (VerifyApplicability): Implement.
1727 * expression.cs (Invocation::DoResolve): Update to accordingly handle
1728 delegate invocations too.
1730 (Invocation::Emit): Ditto.
1732 * ../errors/cs1593.cs : Added.
1734 * ../errors/cs1594.cs : Added.
1736 * delegate.cs (InstanceExpression, TargetMethod): New properties.
1738 2001-10-16 Ravi Pratap <ravi@ximian.com>
1740 * typemanager.cs (intptr_type): Core type for System.IntPtr
1742 (InitCoreTypes): Update for the same.
1744 (iasyncresult_type, asynccallback_type): Ditto.
1746 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
1749 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
1752 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
1753 the builders for the 4 members of a delegate type :-)
1755 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
1758 * expression.cs (New::DoResolve): Implement guts for delegate creation.
1760 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
1762 2001-10-15 Miguel de Icaza <miguel@ximian.com>
1764 * statement.cs (Break::Emit): Implement.
1765 (Continue::Emit): Implement.
1767 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
1768 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
1769 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
1770 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
1773 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
1774 properties that track the label for the current loop (begin of the
1775 loop and end of the loop).
1777 2001-10-15 Ravi Pratap <ravi@ximian.com>
1779 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
1780 use of emitting anything at all.
1782 * class.cs, rootcontext.cs : Get rid of calls to the same.
1784 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
1786 (Populate): Define the constructor correctly and set the implementation
1789 * typemanager.cs (delegate_types): New hashtable to hold delegates that
1792 (AddDelegateType): Implement.
1794 (IsDelegateType): Implement helper method.
1796 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
1798 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
1799 and accordingly handle it.
1801 * delegate.cs (Populate): Take TypeContainer argument.
1802 Implement bits to define the Invoke method. However, I still haven't figured out
1803 how to take care of the native int bit :-(
1805 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
1806 Qualify the name of the delegate, not its return type !
1808 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
1811 (StandardConversionExists): Checking for array types turns out to be recursive.
1813 (ConvertReferenceExplicit): Implement array conversion.
1815 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
1817 2001-10-12 Ravi Pratap <ravi@ximian.com>
1819 * cs-parser.jay (delegate_declaration): Store the fully qualified
1820 name as it is a type declaration.
1822 * delegate.cs (ReturnType, Name): Rename members to these. Make them
1825 (DefineDelegate): Renamed from Define. Does the same thing essentially,
1826 as TypeContainer::DefineType.
1828 (Populate): Method in which all the definition of the various methods (Invoke)
1831 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
1834 (CloseDelegate): Finally creates the delegate.
1836 * class.cs (TypeContainer::DefineType): Update to define delegates.
1837 (Populate, Emit and CloseType): Do the same thing here too.
1839 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
1840 delegates in all these operations.
1842 2001-10-14 Miguel de Icaza <miguel@ximian.com>
1844 * expression.cs: LocalTemporary: a new expression used to
1845 reference a temporary that has been created.
1847 * assign.cs: Handle PropertyAccess back here, so that we can
1848 provide the proper semantic access to properties.
1850 * expression.cs (Expression::ConvertReferenceExplicit): Implement
1851 a few more explicit conversions.
1853 * modifiers.cs: `NEW' modifier maps to HideBySig.
1855 * expression.cs (PropertyExpr): Make this into an
1856 ExpressionStatement, and support the EmitStatement code path.
1858 Perform get/set error checking, clean up the interface.
1860 * assign.cs: recognize PropertyExprs as targets, and if so, turn
1861 them into toplevel access objects.
1863 2001-10-12 Miguel de Icaza <miguel@ximian.com>
1865 * expression.cs: PropertyExpr::PropertyExpr: use work around the
1868 * typemanager.cs: Keep track here of our PropertyBuilders again to
1869 work around lameness in SRE.
1871 2001-10-11 Miguel de Icaza <miguel@ximian.com>
1873 * expression.cs (LValue::LValueResolve): New method in the
1874 interface, used to perform a second resolution pass for LValues.
1876 (This::DoResolve): Catch the use of this in static methods.
1878 (This::LValueResolve): Implement.
1880 (This::Store): Remove warning, assigning to `this' in structures
1883 (Invocation::Emit): Deal with invocation of
1884 methods on value types. We need to pass the address to structure
1885 methods rather than the object itself. (The equivalent code to
1886 emit "this" for structures leaves the entire structure on the
1887 stack instead of a pointer to it).
1889 (ParameterReference::DoResolve): Compute the real index for the
1890 argument based on whether the method takes or not a `this' pointer
1891 (ie, the method is static).
1893 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
1894 value types returned from functions when we need to invoke a
1895 method on the sturcture.
1898 2001-10-11 Ravi Pratap <ravi@ximian.com>
1900 * class.cs (TypeContainer::DefineType): Method to actually do the business of
1901 defining the type in the Modulebuilder or Typebuilder. This is to take
1902 care of nested types which need to be defined on the TypeBuilder using
1905 (TypeContainer::GetClassBases): Implement. Essentially the code from the
1906 methods in RootContext, only ported to be part of TypeContainer.
1908 (TypeContainer::GetInterfaceOrClass): Ditto.
1910 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
1912 * interface.cs (Interface::DefineInterface): New method. Does exactly
1913 what RootContext.CreateInterface did earlier, only it takes care of nested types
1916 (Interface::GetInterfaces): Move from RootContext here and port.
1918 (Interface::GetInterfaceByName): Same here.
1920 * rootcontext.cs (ResolveTree): Re-write.
1922 (PopulateTypes): Re-write.
1924 * class.cs (TypeContainer::Populate): Populate nested types too.
1925 (TypeContainer::Emit): Emit nested members too.
1927 * typemanager.cs (AddUserType): Do not make use of the FullName property,
1928 instead just use the name argument passed in as it is already fully
1931 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
1932 to TypeContainer mapping to see if a type is user-defined.
1934 * class.cs (TypeContainer::CloseType): Implement.
1936 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
1937 the default constructor.
1939 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
1942 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
1944 * interface.cs (CloseType): Create the type here.
1946 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
1949 Remove all the methods which are now in TypeContainer.
1951 2001-10-10 Ravi Pratap <ravi@ximian.com>
1953 * delegate.cs (Define): Re-write bits to define the delegate
1956 2001-10-10 Miguel de Icaza <miguel@ximian.com>
1958 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
1960 * expression.cs (ImplicitReferenceConversion): handle null as well
1961 as a source to convert to any reference type.
1963 * statement.cs (Return): Perform any implicit conversions to
1964 expected return type.
1966 Validate use of return statement.
1968 * codegen.cs (EmitContext): Pass the expected return type here.
1970 * class.cs (Method, Constructor, Property): Pass expected return
1971 type to EmitContext.
1973 2001-10-09 Miguel de Icaza <miguel@ximian.com>
1975 * expression.cs: Make DoResolve take an EmitContext instead of a
1978 Replaced `l' and `location' for `loc', for consistency.
1980 (Error, Warning): Remove unneeded Tc argument.
1982 * assign.cs, literal.cs, constant.cs: Update to new calling
1985 * codegen.cs: EmitContext now contains a flag indicating whether
1986 code is being generated in a static method or not.
1988 * cs-parser.jay: DecomposeQI, new function that replaces the old
1989 QualifiedIdentifier. Now we always decompose the assembled
1990 strings from qualified_identifier productions into a group of
1993 2001-10-08 Miguel de Icaza <miguel@ximian.com>
1995 * rootcontext.cs: Deal with field-less struct types correctly now
1996 by passing the size option to Define Type.
1998 * class.cs: Removed hack that created one static field.
2000 2001-10-07 Miguel de Icaza <miguel@ximian.com>
2002 * statement.cs: Moved most of the code generation here.
2004 2001-10-09 Ravi Pratap <ravi@ximian.com>
2006 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
2009 (ElementAccess): Remove useless bits for now - keep checks as the spec
2012 2001-10-08 Ravi Pratap <ravi@ximian.com>
2014 * expression.cs (ElementAccess::DoResolve): Remove my crap code
2015 and start performing checks according to the spec.
2017 2001-10-07 Ravi Pratap <ravi@ximian.com>
2019 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
2020 rank_specifiers instead.
2022 (rank_specifiers): Change the order in which the rank specifiers are stored
2024 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
2026 * expression.cs (ElementAccess): Implement the LValue interface too.
2028 2001-10-06 Ravi Pratap <ravi@ximian.com>
2030 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
2031 except that user defined conversions are not included.
2033 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
2034 perform the conversion of the return type, if necessary.
2036 (New::DoResolve): Check whether we are creating an array or an object
2037 and accordingly do the needful.
2039 (New::Emit): Same here.
2041 (New::DoResolve): Implement guts of array creation.
2043 (New::FormLookupType): Helper function.
2045 2001-10-07 Miguel de Icaza <miguel@ximian.com>
2047 * codegen.cs: Removed most of the code generation here, and move the
2048 corresponding code generation bits to the statement classes.
2050 Added support for try/catch/finalize and throw.
2052 * cs-parser.jay: Added support for try/catch/finalize.
2054 * class.cs: Catch static methods having the flags override,
2055 virtual or abstract.
2057 * expression.cs (UserCast): This user cast was not really doing
2058 what it was supposed to do. Which is to be born in fully resolved
2059 state. Parts of the resolution were being performed at Emit time!
2063 2001-10-05 Miguel de Icaza <miguel@ximian.com>
2065 * expression.cs: Implicity convert the result from UserCast.
2067 2001-10-05 Ravi Pratap <ravi@ximian.com>
2069 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
2070 prevented it from working correctly.
2072 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
2073 merely ConvertImplicit.
2075 2001-10-05 Miguel de Icaza <miguel@ximian.com>
2077 * typemanager.cs: Make the LookupTypeContainer function static,
2078 and not per-instance.
2080 * class.cs: Make static FindMembers (the one that takes a Type
2083 * codegen.cs: Add EmitForeach here.
2085 * cs-parser.jay: Make foreach a toplevel object instead of the
2086 inline expansion, as we need to perform semantic analysis on it.
2088 2001-10-05 Ravi Pratap <ravi@ximian.com>
2090 * expression.cs (Expression::ImplicitUserConversion): Rename to
2091 UserDefinedConversion.
2093 (Expression::UserDefinedConversion): Take an extra argument specifying
2094 whether we look for explicit user conversions too.
2096 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
2098 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
2100 (ExplicitUserConversion): Make it a call to UserDefinedConversion
2101 with the appropriate arguments.
2103 * cs-parser.jay (cast_expression): Record location too.
2105 * expression.cs (Cast): Record location info.
2107 (Expression::ConvertExplicit): Take location argument.
2109 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
2110 to determine if we are doing explicit conversions.
2112 (UserCast::Emit): Update accordingly.
2114 (Expression::ConvertExplicit): Report an error if everything fails.
2116 * ../errors/cs0030.cs : Add.
2118 2001-10-04 Miguel de Icaza <miguel@ximian.com>
2120 * modifiers.cs: If the ABSTRACT keyword is present, also set the
2121 virtual and newslot bits.
2123 * class.cs (TypeContainer::RegisterRequiredImplementations):
2124 Record methods we need.
2126 (TypeContainer::MakeKey): Helper function to make keys for
2127 MethodBases, since the Methodbase key is useless.
2129 (TypeContainer::Populate): Call RegisterRequiredImplementations
2130 before defining the methods.
2132 Create a mapping for method_builders_to_methods ahead of time
2133 instead of inside a tight loop.
2135 (::RequireMethods): Accept an object as the data to set into the
2136 hashtable so we can report interface vs abstract method mismatch.
2138 2001-10-03 Miguel de Icaza <miguel@ximian.com>
2140 * report.cs: Make all of it static.
2142 * rootcontext.cs: Drop object_type and value_type computations, as
2143 we have those in the TypeManager anyways.
2145 Drop report instance variable too, now it is a global.
2147 * driver.cs: Use try/catch on command line handling.
2149 Add --probe option to debug the error reporting system with a test
2152 * report.cs: Add support for exiting program when a probe
2153 condition is reached.
2155 2001-10-03 Ravi Pratap <ravi@ximian.com>
2157 * expression.cs (Binary::DoNumericPromotions): Fix the case when
2158 we do a forcible conversion regardless of type, to check if
2159 ForceConversion returns a null.
2161 (Binary::error19): Use location to report error.
2163 (Unary::error23): Use location here too.
2165 * ../errors/cs0019.cs : Check in.
2167 * ../errors/cs0023.cs : Check in.
2169 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
2170 case of a non-null MethodInfo object with a length of 0 !
2172 (Binary::ResolveOperator): Flag error if overload resolution fails to find
2173 an applicable member - according to the spec :-)
2174 Also fix logic to find members in base types.
2176 (Unary::ResolveOperator): Same here.
2178 (Unary::report23): Change name to error23 and make first argument a TypeContainer
2179 as I was getting thoroughly confused between this and error19 :-)
2181 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
2182 (::FindMostEncompassedType): Implement.
2183 (::FindMostEncompassingType): Implement.
2184 (::StandardConversionExists): Implement.
2186 (UserImplicitCast): Re-vamp. We now need info about most specific
2187 source and target types so that we can do the necessary conversions.
2189 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
2190 mathematical union with no duplicates.
2192 2001-10-03 Miguel de Icaza <miguel@ximian.com>
2194 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
2195 in order from base classes to child classes, so that we can in
2196 child classes look up in our parent for method names and
2197 attributes (required for handling abstract, virtual, new, override
2198 constructs: we need to instrospect our base class, and if we dont
2199 populate the classes in order, the introspection might be
2200 incorrect. For example, a method could query its parent before
2201 the parent has any methods and would determine that the parent has
2202 no abstract methods (while it could have had them)).
2204 (RootContext::CreateType): Record the order in which we define the
2207 2001-10-02 Miguel de Icaza <miguel@ximian.com>
2209 * class.cs (TypeContainer::Populate): Also method definitions can
2210 fail now, keep track of this.
2212 (TypeContainer::FindMembers): Implement support for
2213 DeclaredOnly/noDeclaredOnly flag.
2215 (Constructor::Emit) Return the ConstructorBuilder.
2217 (Method::Emit) Return the MethodBuilder.
2218 Check for abstract or virtual methods to be public.
2220 * rootcontext.cs (RootContext::CreateType): Register all the
2221 abstract methods required for the class to be complete and the
2222 interface methods that must be implemented.
2224 * cs-parser.jay: Report error 501 (method requires body if it is
2225 not marked abstract or extern).
2227 * expression.cs (TypeOf::Emit): Implement.
2229 * typemanager.cs: runtime_handle_type, new global type.
2231 * class.cs (Property::Emit): Generate code for properties.
2233 2001-10-02 Ravi Pratap <ravi@ximian.com>
2235 * expression.cs (Unary::ResolveOperator): Find operators on base type
2236 too - we now conform exactly to the spec.
2238 (Binary::ResolveOperator): Same here.
2240 * class.cs (Operator::Define): Fix minor quirk in the tests.
2242 * ../errors/cs0215.cs : Added.
2244 * ../errors/cs0556.cs : Added.
2246 * ../errors/cs0555.cs : Added.
2248 2001-10-01 Miguel de Icaza <miguel@ximian.com>
2250 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
2251 single integer which is really efficient
2253 2001-10-01 Ravi Pratap <ravi@ximian.com>
2255 * expression.cs (Expression::ImplicitUserConversion): Use location
2256 even in the case when we are examining True operators.
2258 * class.cs (Operator::Define): Perform extensive checks to conform
2259 with the rules for operator overloading in the spec.
2261 * expression.cs (Expression::ImplicitReferenceConversion): Implement
2262 some of the other conversions mentioned in the spec.
2264 * typemanager.cs (array_type): New static member for the System.Array built-in
2267 (cloneable_interface): For System.ICloneable interface.
2269 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
2270 we start resolving the tree and populating types.
2272 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
2274 2001-10-01 Miguel de Icaza <miguel@ximian.com>
2276 * expression.cs (Expression::ExprClassFromMemberInfo,
2277 Expression::Literalize): Create literal expressions from
2278 FieldInfos which are literals.
2280 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
2281 type casts, because they were wrong. The test suite in tests
2284 (ImplicitNumericConversion): ushort to ulong requires a widening
2287 Int32 constant to long requires widening cast as well.
2289 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
2290 for integers because the type on the stack is not i4.
2292 2001-09-30 Miguel de Icaza <miguel@ximian.com>
2294 * expression.cs (report118): require location argument.
2296 * parameter.cs: Do not dereference potential null value.
2298 * class.cs: Catch methods that lack the `new' keyword when
2299 overriding a name. Report warnings when `new' is used without
2300 anything being there to override.
2302 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
2304 * class.cs: Only add constructor to hashtable if it is non-null
2305 (as now constructors can fail on define).
2307 (TypeManager, Class, Struct): Take location arguments.
2309 Catch field instance initialization in structs as errors.
2311 accepting_filter: a new filter for FindMembers that is static so
2312 that we dont create an instance per invocation.
2314 (Constructor::Define): Catch errors where a struct constructor is
2317 * cs-parser.jay: Pass location information for various new
2320 * delegate.cs (Delegate): take a location argument.
2322 * driver.cs: Do not call EmitCode if there were problesm in the
2323 Definition of the types, as many Builders wont be there.
2325 * decl.cs (Decl::Decl): Require a location argument.
2327 * cs-tokenizer.cs: Handle properly hex constants that can not fit
2328 into integers, and find the most appropiate integer for it.
2330 * literal.cs: Implement ULongLiteral.
2332 * rootcontext.cs: Provide better information about the location of
2333 failure when CreateType fails.
2335 2001-09-29 Miguel de Icaza <miguel@ximian.com>
2337 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
2340 * expression.cs (Binary::CheckShiftArguments): Add missing type
2342 (Binary::ResolveOperator): Add type to the logical and and logical
2343 or, Bitwise And/Or and Exclusive Or code paths, it was missing
2346 (Binary::DoNumericPromotions): In the case where either argument
2347 is ulong (and most signed types combined with ulong cause an
2348 error) perform implicit integer constant conversions as well.
2350 2001-09-28 Miguel de Icaza <miguel@ximian.com>
2352 * expression.cs (UserImplicitCast): Method should always be
2354 (Invocation::BetterConversion): Simplified test for IntLiteral.
2356 (Expression::ImplicitNumericConversion): Split this routine out.
2357 Put the code that performs implicit constant integer conversions
2360 (Expression::Resolve): Become a wrapper around DoResolve so we can
2361 check eclass and type being set after resolve.
2363 (Invocation::Badness): Remove this dead function
2365 (Binary::ResolveOperator): Do not compute the expensive argumnets
2366 unless we have a union for it.
2368 (Probe::Emit): Is needs to do an isinst and then
2369 compare against null.
2371 (::CanConvert): Added Location argument. If the Location argument
2372 is null (Location.Null), then we do not report errors. This is
2373 used by the `probe' mechanism of the Explicit conversion. We do
2374 not want to generate an error for something that the user
2375 explicitly requested to be casted. But the pipeline for an
2376 explicit cast first tests for potential implicit casts.
2378 So for now, if the Location is null, it means `Probe only' to
2379 avoid adding another argument. Might have to revise this
2382 (ClassCast): New class used to type cast objects into arbitrary
2383 classes (used in Explicit Reference Conversions).
2385 Implement `as' as well.
2387 Reverted all the patches from Ravi below: they were broken:
2389 * The use of `level' as a mechanism to stop recursive
2390 invocations is wrong. That was there just to catch the
2391 bug with a strack trace but not as a way of addressing
2394 To fix the problem we have to *understand* what is going
2395 on and the interactions and come up with a plan, not
2396 just get things going.
2398 * The use of the type conversion cache that I proposed
2399 last night had an open topic: How does this work across
2400 protection domains. A user defined conversion might not
2401 be public in the location where we are applying the
2402 conversion, a different conversion might be selected
2403 (ie, private A->B (better) but public B->A (worse),
2404 inside A, A->B applies, but outside it, B->A will
2407 * On top of that (ie, even if the above is solved),
2408 conversions in a cache need to be abstract. Ie, `To
2409 convert from an Int to a Short use an OpcodeCast', not
2410 `To convert from an Int to a Short use the OpcodeCast on
2411 the variable 5' (which is what this patch was doing).
2413 2001-09-28 Ravi Pratap <ravi@ximian.com>
2415 * expression.cs (Invocation::ConversionExists): Re-write to use
2416 the conversion cache
2418 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
2419 cache all conversions done, not just user-defined ones.
2421 (Invocation::BetterConversion): The real culprit. Use ConversionExists
2422 to determine if a conversion exists instead of acutually trying to
2423 perform the conversion. It's faster too.
2425 (Expression::ConvertExplicit): Modify to use ConversionExists to check
2426 and only then attempt the implicit conversion.
2428 2001-09-28 Ravi Pratap <ravi@ximian.com>
2430 * expression.cs (ConvertImplicit): Use a cache for conversions
2431 already found. Check level of recursion and bail out if necessary.
2433 2001-09-28 Miguel de Icaza <miguel@ximian.com>
2435 * typemanager.cs (string_concat_string_string, string_concat_object_object):
2436 Export standard methods that we expect for string operations.
2438 * statement.cs (Block::UsageWarning): Track usage of variables and
2439 report the errors for not used variables.
2441 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
2444 2001-09-27 Miguel de Icaza <miguel@ximian.com>
2446 * codegen.cs: remove unnneded code
2448 * expression.cs: Removed BuiltinTypeAccess class
2450 Fix the order in which implicit conversions are
2453 The previous fixed dropped support for boxed conversions (adding a
2454 test to the test suite now)
2456 (UserImplicitCast::CanConvert): Remove test for source being null,
2457 that code is broken. We should not feed a null to begin with, if
2458 we do, then we should track the bug where the problem originates
2459 and not try to cover it up here.
2461 Return a resolved expression of type UserImplicitCast on success
2462 rather than true/false. Ravi: this is what I was talking about,
2463 the pattern is to use a static method as a "constructor" for
2466 Also, do not create arguments until the very last minute,
2467 otherwise we always create the arguments even for lookups that
2468 will never be performed.
2470 (UserImplicitCast::Resolve): Eliminate, objects of type
2471 UserImplicitCast are born in a fully resolved state.
2473 * typemanager.cs (InitCoreTypes): Init also value_type
2476 * expression.cs (Cast::Resolve): First resolve the child expression.
2478 (LValue): Add new method AddressOf to be used by
2481 Change the argument of Store to take an EmitContext instead of an
2482 ILGenerator, because things like FieldExpr need to be able to call
2483 their children expression to generate the instance code.
2485 (Expression::Error, Expression::Warning): Sugar functions for
2488 (Expression::MemberLookup): Accept a TypeContainer instead of a
2489 Report as the first argument.
2491 (Expression::ResolvePrimary): Killed. I still want to improve
2492 this as currently the code is just not right.
2494 (Expression::ResolveMemberAccess): Simplify, but it is still
2497 (Unary::Resolve): Catch errors in AddressOf operators.
2499 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
2500 index to a byte for the short-version, or the compiler will choose
2501 the wrong Emit call, which generates the wrong data.
2503 (ParameterReference::Emit, ::Store): same.
2505 (FieldExpr::AddressOf): Implement.
2507 * typemanager.cs: TypeManager: made public variable instead of
2510 * driver.cs: document --fatal.
2512 * report.cs (ErrorMessage, WarningMessage): new names for the old
2513 Error and Warning classes.
2515 * cs-parser.jay (member_access): Turn built-in access to types
2516 into a normal simplename
2518 2001-09-27 Ravi Pratap <ravi@ximian.com>
2520 * expression.cs (Invocation::BetterConversion): Fix to cope
2521 with q being null, since this was introducing a bug.
2523 * expression.cs (ConvertImplicit): Do built-in conversions first.
2525 2001-09-27 Ravi Pratap <ravi@ximian.com>
2527 * expression.cs (UserImplicitCast::Resolve): Fix bug.
2529 2001-09-27 Ravi Pratap <ravi@ximian.com>
2531 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
2532 I had introduced long ago (what's new ?).
2534 * expression.cs (UserImplicitCast::CanConvert): Static method to do
2535 the work of all the checking.
2536 (ConvertImplicit): Call CanConvert and only then create object if necessary.
2537 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
2539 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
2540 that is the right way.
2542 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
2543 overloading resolution. Use everywhere instead of cutting and pasting code.
2545 (Binary::ResolveOperator): Use MakeUnionSet.
2547 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
2548 we have to convert to bool types. Not complete yet.
2550 2001-09-27 Miguel de Icaza <miguel@ximian.com>
2552 * typemanager.cs (TypeManager::CSharpName): support ushort.
2554 * expression.cs (Expression::TryImplicitIntConversion): Attempts
2555 to provide an expression that performsn an implicit constant int
2556 conversion (section 6.1.6).
2557 (Expression::ConvertImplicitRequired): Reworked to include
2558 implicit constant expression conversions.
2560 (Expression::ConvertNumericExplicit): Finished.
2562 (Invocation::Emit): If InstanceExpression is null, then it means
2563 that we perform a call on this.
2565 2001-09-26 Miguel de Icaza <miguel@ximian.com>
2567 * expression.cs (Unary::Emit): Remove some dead code.
2568 (Probe): Implement Resolve and Emit for `is'.
2569 (Expression::ConvertImplicitRequired): Attempt to do constant
2570 expression conversions here. Maybe should be moved to
2571 ConvertImplicit, but I am not sure.
2572 (Expression::ImplicitLongConstantConversionPossible,
2573 Expression::ImplicitIntConstantConversionPossible): New functions
2574 that tell whether is it possible to apply an implicit constant
2575 expression conversion.
2577 (ConvertNumericExplicit): Started work on explicit numeric
2580 * cs-parser.jay: Update operator constants.
2582 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
2583 (Parameters::GetSignature): Hook up VerifyArgs here.
2584 (Parameters::VerifyArgs): Verifies that no two arguments have the
2587 * class.cs (Operator): Update the operator names to reflect the
2588 ones that the spec expects (as we are just stringizing the
2591 * expression.cs (Unary::ResolveOperator): Fix bug: Use
2592 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
2593 previous usage did only work for our methods.
2594 (Expression::ConvertImplicit): Handle decimal implicit numeric
2595 conversions as well.
2596 (Expression::InternalTypeConstructor): Used to invoke constructors
2597 on internal types for default promotions.
2599 (Unary::Emit): Implement special handling for the pre/post
2600 increment/decrement for overloaded operators, as they need to have
2601 the same semantics as the other operators.
2603 (Binary::ResolveOperator): ditto.
2604 (Invocation::ConversionExists): ditto.
2605 (UserImplicitCast::Resolve): ditto.
2607 2001-09-26 Ravi Pratap <ravi@ximian.com>
2609 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
2610 operator, return after emitting body. Regression tests pass again !
2612 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
2613 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
2614 (Invocation::OverloadResolve): Ditto.
2615 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
2617 * everywhere : update calls to the above methods accordingly.
2619 2001-09-26 Miguel de Icaza <miguel@ximian.com>
2621 * assign.cs (Assign): Make it inherit from ExpressionStatement.
2623 * expression.cs (ExpressionStatement): New base class used for
2624 expressions that can appear in statements, so that we can provide
2625 an alternate path to generate expression that do not leave a value
2628 (Expression::Emit, and all the derivatives): We no longer return
2629 whether a value is left on the stack or not. Every expression
2630 after being emitted leaves a single value on the stack.
2632 * codegen.cs (EmitContext::EmitStatementExpression): Use the
2633 facilties of ExpressionStatement if possible.
2635 * cs-parser.jay: Update statement_expression.
2637 2001-09-25 Miguel de Icaza <miguel@ximian.com>
2639 * driver.cs: Change the wording of message
2641 2001-09-25 Ravi Pratap <ravi@ximian.com>
2643 * expression.cs (Binary::ResolveOperator): Had forgottten to set
2644 the type of the expression to the return type of the method if
2645 we have an overloaded operator match ! The regression tests pass again !
2646 (Unary::ResolveOperator): Ditto.
2648 * expression.cs (Invocation::ConversionExists): Correct the member lookup
2649 to find "op_Implicit", not "implicit" ;-)
2650 (UserImplicitCast): New class to take care of user-defined implicit conversions.
2651 (ConvertImplicit, ForceConversion): Take TypeContainer argument
2653 * everywhere : Correct calls to the above accordingly.
2655 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
2656 (ConvertImplicit): Do user-defined conversion if it exists.
2658 2001-09-24 Miguel de Icaza <miguel@ximian.com>
2660 * assign.cs: track location.
2661 (Resolve): Use implicit conversions on assignment.
2663 * literal.cs: Oops. Not good, Emit of short access values should
2664 pass (Bytes) or the wrong argument will be selected.
2666 * expression.cs (Unary::Emit): Emit code for -expr.
2668 (Unary::ResolveOperator): Handle `Substract' for non-constants
2669 (substract from zero from the non-constants).
2670 Deal with Doubles as well.
2672 (Expression::ConvertImplicitRequired): New routine that reports an
2673 error if no implicit conversion exists.
2675 (Invocation::OverloadResolve): Store the converted implicit
2676 expressions if we make them
2678 2001-09-24 Ravi Pratap <ravi@ximian.com>
2680 * class.cs (ConstructorInitializer): Take a Location argument.
2681 (ConstructorBaseInitializer): Same here.
2682 (ConstructorThisInitializer): Same here.
2684 * cs-parser.jay : Update all calls accordingly.
2686 * expression.cs (Unary, Binary, New): Take location argument.
2687 Update accordingly everywhere.
2689 * cs-parser.jay : Update all calls to the above to take a location
2694 2001-09-24 Ravi Pratap <ravi@ximian.com>
2696 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
2697 (Invocation::BetterConversion): Same here
2698 (Invocation::ConversionExists): Ditto.
2700 (Invocation::ConversionExists): Implement.
2702 2001-09-22 Ravi Pratap <ravi@ximian.com>
2704 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
2705 Also take an additional TypeContainer argument.
2707 * All over : Pass in TypeContainer as argument to OverloadResolve.
2709 * typemanager.cs (CSharpName): Update to check for the string type and return
2712 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
2715 2001-09-21 Ravi Pratap <ravi@ximian.com>
2717 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
2718 (Invocation::BetterFunction): Implement.
2719 (Invocation::BetterConversion): Implement.
2720 (Invocation::ConversionExists): Skeleton, no implementation yet.
2722 Okay, things work fine !
2724 2001-09-21 Miguel de Icaza <miguel@ximian.com>
2726 * typemanager.cs: declare and load enum_type, delegate_type and
2729 * expression.cs (Expression::Emit): Now emit returns a value that
2730 tells whether a value is left on the stack or not. This strategy
2731 might be reveted tomorrow with a mechanism that would address
2732 multiple assignments.
2733 (Expression::report118): Utility routine to report mismatches on
2736 (Unary::Report23): Report impossible type/operator combination
2739 (Unary::IsIncrementableNumber): Whether the type can be
2740 incremented or decremented with add.
2741 (Unary::ResolveOperator): Also allow enumerations to be bitwise
2743 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
2745 (Invocation::Emit): Deal with new Emit convetion.
2747 * All Expression derivatives: Updated their Emit method to return
2748 whether they leave values on the stack or not.
2750 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
2751 stack for expressions that are statements.
2753 2001-09-20 Miguel de Icaza <miguel@ximian.com>
2755 * expression.cs (LValue): New interface. Must be implemented by
2757 (LocalVariableReference, ParameterReference, FieldExpr): Implement
2760 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
2761 interface for generating code, simplifies the code.
2763 2001-09-20 Ravi Pratap <ravi@ximian.com>
2765 * expression.cs (everywhere): Comment out return statements in ::Resolve
2766 methods to avoid the warnings.
2768 2001-09-20 Miguel de Icaza <miguel@ximian.com>
2770 * driver.cs (parse): Report error 2001 if we can not open the
2773 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
2776 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
2779 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
2780 otherwise nested blocks end up with the same index.
2782 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
2784 * expression.cs: Instead of having FIXMEs in the Resolve
2785 functions, throw exceptions so it is obvious that we are facing a
2788 * cs-parser.jay (invocation_expression): Pass Location information.
2790 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
2791 Use a basename for those routines because .NET does not like paths
2794 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
2797 2001-09-19 Miguel de Icaza <miguel@ximian.com>
2799 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
2800 are loading the correct data types (throws an exception if not).
2801 (TypeManager::InitCoreTypes): Use CoreLookupType
2803 * expression.cs (Unary::ResolveOperator): return the child
2804 expression for expressions which are just +expr.
2805 (Unary::ResolveOperator): Return negative literals for -LITERAL
2806 expressions (otherwise they are Unary {Literal}).
2807 (Invocation::Badness): Take into account `Implicit constant
2808 expression conversions'.
2810 * literal.cs (LongLiteral): Implement long literal class.
2811 (IntLiteral): export the `Value' of the intliteral.
2813 2001-09-19 Ravi Pratap <ravi@ximian.com>
2815 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
2817 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
2818 instead of 'Operator'
2820 * expression.cs (Binary::ResolveOperator): Update accordingly.
2821 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
2824 * cs-parser.jay (unary_expression): Update to use the new names.
2826 * gen-treedump.cs (GetUnary): Same here.
2828 * expression.cs (Unary::Resolve): Implement.
2829 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
2830 operators are found instead of making noise ;-)
2831 (Unary::ResolveOperator): New method to do precisely the same thing which
2832 Binary::ResolveOperator does for Binary expressions.
2833 (Unary.method, .Arguments): Add.
2834 (Unary::OperName): Implement.
2835 (Unary::ForceConversion): Copy and Paste !
2837 * class.cs (Operator::Define): Fix a small bug for the case when we have
2840 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
2841 for the inbuilt operators. Only overloading works for now ;-)
2843 2001-09-18 Miguel de Icaza <miguel@ximian.com>
2845 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
2846 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
2848 * expression.cs (This::Emit): Implement.
2849 (This::Resolve): Implement.
2850 (TypeOf:Resolve): Implement.
2851 (Expression::ResolveSimpleName): Add an implicit this to instance
2853 (MemberAccess::Resolve): Deal with Parameters and Fields.
2854 Bind instance variable to Field expressions.
2855 (FieldExpr::Instance): New field used to track the expression that
2856 represents the object instance.
2857 (FieldExpr::Resolve): Track potential errors from MemberLookup not
2859 (FieldExpr::Emit): Implement.
2861 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
2862 the last instruction contains a return opcode to avoid generating
2863 the last `ret' instruction (this generates correct code, and it is
2864 nice to pass the peverify output).
2866 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
2867 initializer for static and instance variables.
2868 (Constructor::Emit): Allow initializer to be null in the case of
2869 static constructors. Only emit initializer for instance
2872 (TypeContainer::FindMembers): Return a null array if there are no
2875 Also fix the code for the MemberTypes.Method branch, as it was not
2876 scanning that for operators (or tried to access null variables before).
2878 * assign.cs (Assign::Emit): Handle instance and static fields.
2882 * driver.cs: Stop compilation if there are parse errors.
2884 * cs-parser.jay (constructor_declaration): Provide default base
2885 initializer for non-static constructors.
2886 (constructor_declarator): Do not provide a default base
2887 initializers if none was specified.
2888 Catch the fact that constructors should not have parameters.
2890 * class.cs: Do not emit parent class initializers for static
2891 constructors, that should be flagged as an error.
2893 2001-09-18 Ravi Pratap <ravi@ximian.com>
2895 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
2896 Move back code into TypeContainer::Populate.
2898 2001-09-18 Ravi Pratap <ravi@ximian.com>
2900 * class.cs (TypeContainer::AddConstructor): Fix the check to
2901 compare against Name, not Basename.
2902 (Operator::OpType): Change Plus and Minus to Add and Subtract.
2904 * cs-parser.jay : Update accordingly.
2906 * class.cs (TypeContainer::FindMembers): For the case where we are searching
2907 for methods, don't forget to look into the operators too.
2908 (RegisterMethodBuilder): Helper method to take care of this for
2909 methods, constructors and operators.
2910 (Operator::Define): Completely revamp.
2911 (Operator.OperatorMethod, MethodName): New fields.
2912 (TypeContainer::Populate): Move the registering of builders into
2913 RegisterMethodBuilder.
2914 (Operator::Emit): Re-write.
2916 * expression.cs (Binary::Emit): Comment out code path to emit method
2917 invocation stuff for the case when we have a user defined operator. I am
2918 just not able to get it right !
2920 2001-09-17 Miguel de Icaza <miguel@ximian.com>
2922 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
2925 (Expression::MemberLookup): Provide a version that allows to
2926 specify the MemberTypes and BindingFlags.
2928 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
2929 so it was not fetching variable information from outer blocks.
2931 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
2932 Beforefieldinit as it was buggy.
2934 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
2937 * class.cs (Constructor::Emit): Only emit if block is not null.
2938 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
2939 deal with this by semantically definining it as if the user had
2942 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
2943 constructors as we now "emit" them at a higher level.
2945 (TypeContainer::DefineDefaultConstructor): Used to define the
2946 default constructors if none was provided.
2948 (ConstructorInitializer): Add methods Resolve and Emit.
2950 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
2952 2001-09-17 Ravi Pratap <ravi@ximian.com>
2954 * class.cs (TypeContainer::EmitDefaultConstructor): Register
2955 the default constructor builder with our hashtable for methodbuilders
2958 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
2959 and argument_count is 0 in which case we have a match.
2960 (Binary::ResolveOperator): More null checking and miscellaneous coding
2963 2001-09-17 Ravi Pratap <ravi@ximian.com>
2965 * rootcontext.cs (IsNameSpace): Compare against null.
2967 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
2969 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
2970 and Unary::Operator.
2972 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
2975 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
2976 we have overloaded operators.
2977 (Binary::ResolveOperator): Implement the part which does the operator overload
2980 * class.cs (Operator::Emit): Implement.
2981 (TypeContainer::Emit): Emit the operators we have too.
2983 * expression.cs (Binary::Emit): Update to emit the appropriate code for
2984 the case when we have a user-defined operator.
2986 2001-09-17 Miguel de Icaza <miguel@ximian.com>
2988 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
2990 2001-09-16 Ravi Pratap <ravi@ximian.com>
2992 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
2993 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
2994 (Constructor::Emit): Implement.
2995 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
2996 if we have no work to do.
2997 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
3000 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
3001 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
3003 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
3006 2001-09-15 Ravi Pratap <ravi@ximian.com>
3008 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
3010 (Tree::RecordNamespace): Method to do what the name says ;-)
3011 (Tree::Namespaces): Property to get at the namespaces hashtable.
3013 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
3016 * rootcontext.cs (IsNamespace): Fixed it :-)
3018 2001-09-14 Miguel de Icaza <miguel@ximian.com>
3020 * class.cs (TypeContainer::FindMembers): Add support for
3022 (MethodCore): New class that encapsulates both the shared aspects
3023 of a Constructor and a Method.
3024 (Method, Constructor): Factored pieces into MethodCore.
3026 * driver.cs: Added --fatal which makes errors throw exceptions.
3027 Load System assembly as well as part of the standard library.
3029 * report.cs: Allow throwing exceptions on errors for debugging.
3031 * modifiers.cs: Do not use `parent', instead use the real type
3032 container to evaluate permission settings.
3034 * class.cs: Put Ravi's patch back in. He is right, and we will
3035 have to cope with the
3037 2001-09-14 Ravi Pratap <ravi@ximian.com>
3039 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
3040 FamORAssem, not FamANDAssem.
3042 2001-09-14 Miguel de Icaza <miguel@ximian.com>
3044 * driver.cs: Added --parse option that only parses its input files
3047 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
3048 incorrect. IsTopLevel is not used to tell whether an object is
3049 root_types or not (that can be achieved by testing this ==
3050 root_types). But to see if this is a top-level *class* (not
3051 necessarly our "toplevel" container).
3053 2001-09-14 Ravi Pratap <ravi@ximian.com>
3055 * enum.cs (Enum::Define): Modify to call the Lookup method on the
3056 parent instead of a direct call to GetType.
3058 2001-09-14 Ravi Pratap <ravi@ximian.com>
3060 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
3061 Modifiers.TypeAttr. This should just be a call to that method.
3063 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
3064 object so that we can determine if we are top-level or not.
3066 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
3069 * enum.cs (Enum::Define): Ditto.
3071 * modifiers.cs (FieldAttr): Re-write.
3073 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
3074 (TypeContainer::HaveStaticConstructor): New property to provide access
3075 to precisely that info.
3077 * modifiers.cs (MethodAttr): Re-write.
3078 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
3080 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
3081 of top-level types as claimed.
3083 2001-09-13 Miguel de Icaza <miguel@ximian.com>
3085 * expression.cs (MemberLookup): Fruitless attempt to lookup
3086 constructors. Maybe I need to emit default constructors? That
3087 might be it (currently .NET emits this for me automatically).
3088 (Invocation::OverloadResolve): Cope with Arguments == null.
3089 (Invocation::EmitArguments): new function, shared by the new
3091 (Invocation::Emit): Handle static and instance methods. Emit
3092 proper call instruction for virtual or non-virtual invocations.
3093 (New::Emit): Implement.
3094 (New::Resolve): Implement.
3095 (MemberAccess:Resolve): Implement.
3096 (MethodGroupExpr::InstanceExpression): used conforming to the spec
3098 (FieldExpr::Resolve): Set type.
3100 * support.cs: Handle empty arguments.
3102 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
3103 SimpleLookup): Auxiliary routines to help parse a qualifier
3106 Update qualifier_identifier rule.
3108 * codegen.cs: Removed debugging messages.
3110 * class.cs: Make this a global thing, this acts just as a "key" to
3111 objects that we might have around.
3113 (Populate): Only initialize method_builders_to_methods once.
3115 * expression.cs (PropertyExpr): Initialize type from the
3118 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
3119 Resolve pattern. Attempt to implicitly convert value to boolean.
3122 * expression.cs: Set the type for the int32/int32 argument case.
3123 (Binary::ResolveOperator): Set the return type to boolean for
3124 comparission operators
3126 * typemanager.cs: Remove debugging print code.
3128 (Invocation::Resolve): resolve type.
3130 * class.cs: Allocate a MemberInfo of the correct size, as the code
3131 elsewhere depends on the test to reflect the correct contents.
3133 (Method::) Keep track of parameters, due to System.Reflection holes
3135 (TypeContainer::Populate): Keep track of MethodBuilders to Method
3138 (TypeContainer::FindMembers): Use ArrayList and then copy an array
3139 of the exact size and return that.
3141 (Class::LookupMethodByBuilder): New function that maps
3142 MethodBuilders to its methods. Required to locate the information
3143 on methods because System.Reflection bit us again.
3145 * support.cs: New file, contains an interface ParameterData and
3146 two implementations: ReflectionParameters and InternalParameters
3147 used to access Parameter information. We will need to grow this
3150 * expression.cs (Invocation::GetParameterData): implement a cache
3151 and a wrapper around the ParameterData creation for methods.
3152 (Invocation::OverloadResolve): Use new code.
3154 2001-09-13 Ravi Pratap <ravi@ximian.com>
3156 * class.cs (TypeContainer::EmitField): Remove and move into
3157 (Field::Define): here and modify accordingly.
3158 (Field.FieldBuilder): New member.
3159 (TypeContainer::Populate): Update accordingly.
3160 (TypeContainer::FindMembers): Implement.
3162 2001-09-13 Miguel de Icaza <miguel@ximian.com>
3164 * statement.cs: (VariableInfo::VariableType): New field to be
3165 initialized with the full type once it is resolved.
3167 2001-09-12 Miguel de Icaza <miguel@ximian.com>
3169 * parameter.cs (GetParameterInfo): Use a type cache to compute
3170 things only once, and to reuse this information
3172 * expression.cs (LocalVariableReference::Emit): Implement.
3173 (OpcodeCast::Emit): fix.
3175 (ParameterReference::Resolve): Implement.
3176 (ParameterReference::Emit): Implement.
3178 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
3179 that are expressions need to stay as Expressions.
3181 * typemanager.cs (CSharpName): Returns the C# name of a type if
3184 * expression.cs (Expression::ConvertImplicit): New function that
3185 implements implicit type conversions.
3187 (Expression::ImplicitReferenceConversion): Implements implicit
3188 reference conversions.
3190 (EmptyCast): New type for transparent casts.
3192 (OpcodeCast): New type for casts of types that are performed with
3193 a sequence of bytecodes.
3195 (BoxedCast): New type used for casting value types into reference
3196 types. Emits a box opcode.
3198 (Binary::DoNumericPromotions): Implements numeric promotions of
3199 and computation of the Binary::Type.
3201 (Binary::EmitBranchable): Optimization.
3203 (Binary::Emit): Implement code emission for expressions.
3205 * typemanager.cs (TypeManager): Added two new core types: sbyte
3208 2001-09-12 Ravi Pratap <ravi@ximian.com>
3210 * class.cs (TypeContainer::FindMembers): Method which does exactly
3211 what Type.FindMembers does, only we don't have to use reflection. No
3214 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
3215 typecontainer objects as we need to get at them.
3216 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
3218 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
3219 typecontainer object.
3221 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
3222 of just a Report object.
3224 2001-09-11 Ravi Pratap <ravi@ximian.com>
3226 * class.cs (Event::Define): Go back to using the prefixes "add_" and
3228 (TypeContainer::Populate): Now define the delegates of the type too.
3229 (TypeContainer.Delegates): Property to access the list of delegates defined
3232 * delegates.cs (Delegate::Define): Implement partially.
3234 * modifiers.cs (TypeAttr): Handle more flags.
3236 2001-09-11 Ravi Pratap <ravi@ximian.com>
3238 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
3240 (Operator::Define): Re-write logic to get types by using the LookupType method
3241 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
3242 (Indexer::Define): Ditto.
3243 (Event::Define): Ditto.
3244 (Property::Define): Ditto.
3246 2001-09-10 Ravi Pratap <ravi@ximian.com>
3248 * class.cs (TypeContainer::Populate): Now define operators too.
3249 (TypeContainer.Operators): New property to access the list of operators
3251 (Operator.OperatorMethodBuilder): New member to hold the method builder
3252 for the operator we are defining.
3253 (Operator::Define): Implement.
3255 2001-09-10 Ravi Pratap <ravi@ximian.com>
3257 * class.cs (Event::Define): Make the prefixes of the accessor methods
3258 addOn_ and removeOn_
3260 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
3261 of the location being passed in too. Ideally, this should go later since all
3262 error reporting should be done through the Report object.
3264 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
3265 (Populate): Iterate thru the indexers we have and define them too.
3266 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
3267 for the get and set accessors.
3268 (Indexer::Define): Implement.
3270 2001-09-09 Miguel de Icaza <miguel@ximian.com>
3272 * expression.cs (Binary::Resolve): Beginning of it. I scratched
3273 my previous implementation, did not work.
3275 * typemanager.cs: Add a couple of missing types (the longs).
3277 * literal.cs: Use TypeManager.bool_type instead of getting it.
3279 * expression.cs (EventExpr): New kind of expressions.
3280 (Expressio::ExprClassFromMemberInfo): finish
3282 2001-09-08 Miguel de Icaza <miguel@ximian.com>
3284 * assign.cs: Emit stores to static fields differently.
3286 2001-09-08 Ravi Pratap <ravi@ximian.com>
3288 * Merge in changes and adjust code to tackle conflicts. Backed out my
3289 code in Assign::Resolve ;-)
3291 2001-09-08 Ravi Pratap <ravi@ximian.com>
3293 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
3294 instead Report.Error and also pass in the location.
3295 (CSharpParser::Lexer): New readonly property to return the reference
3296 to the Tokenizer object.
3297 (declare_local_variables): Use Report.Error with location instead of plain
3301 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
3302 (Operator.CheckBinaryOperator): Ditto.
3304 * cs-parser.jay (operator_declarator): Update accordingly.
3306 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
3307 (CheckBinaryOperator): Same here.
3309 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
3310 on the name without any prefixes of namespace names etc. This is because we
3311 already might have something already fully qualified like
3312 'System.Console.WriteLine'
3314 * assign.cs (Resolve): Begin implementation. Stuck ;-)
3316 2001-09-07 Ravi Pratap <ravi@ximian.com>
3318 * cs-tokenizer.cs (location): Return a string which also contains
3321 * expression.cs (ElementAccess): New class for expressions of the
3322 type 'element access.'
3323 (BaseAccess): New class for expressions of the type 'base access.'
3324 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
3327 * cs-parser.jay (element_access): Implement action.
3328 (base_access): Implement actions.
3329 (checked_expression, unchecked_expression): Implement.
3331 * cs-parser.jay (local_variable_type): Correct and implement.
3332 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
3334 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
3336 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
3337 name and the specifiers.
3339 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
3341 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
3342 making them all public ;-)
3344 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
3347 2001-09-07 Miguel de Icaza <miguel@ximian.com>
3349 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
3351 (FieldExpr, PropertyExprs): New resolved expressions.
3352 (SimpleName::MemberStaticCheck): Perform static checks for access
3353 to non-static fields on static methods. Maybe this should be
3354 generalized for MemberAccesses.
3355 (SimpleName::ResolveSimpleName): More work on simple name
3358 * cs-parser.jay (primary_expression/qualified_identifier): track
3359 the parameter index.
3361 * codegen.cs (CodeGen::Save): Catch save exception, report error.
3362 (EmitContext::EmitBoolExpression): Chain to expression generation
3363 instead of temporary hack.
3364 (::EmitStatementExpression): Put generic expression code generation.
3366 * assign.cs (Assign::Emit): Implement variable assignments to
3367 local variables, parameters and fields.
3369 2001-09-06 Miguel de Icaza <miguel@ximian.com>
3371 * statement.cs (Block::GetVariableInfo): New method, returns the
3372 VariableInfo for a variable name in a block.
3373 (Block::GetVariableType): Implement in terms of GetVariableInfo
3375 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
3376 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
3378 2001-09-06 Ravi Pratap <ravi@ximian.com>
3380 * cs-parser.jay (operator_declaration): Continue on my quest : update
3381 to take attributes argument.
3382 (event_declaration): Ditto.
3383 (enum_declaration): Ditto.
3384 (indexer_declaration): Ditto.
3386 * class.cs (Operator::Operator): Update constructor accordingly.
3387 (Event::Event): Ditto.
3389 * delegate.cs (Delegate::Delegate): Same here.
3391 * enum.cs (Enum::Enum): Same here.
3393 2001-09-05 Ravi Pratap <ravi@ximian.com>
3395 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
3397 * ../tests/cs0658.cs : New file to demonstrate error 0658.
3399 * attribute.cs (Attributes): New class to encapsulate all attributes which were
3400 being passed around as an arraylist.
3401 (Attributes::AddAttribute): Method to add attribute sections.
3403 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
3404 (struct_declaration): Update accordingly.
3405 (constant_declaration): Update.
3406 (field_declaration): Update.
3407 (method_header): Update.
3408 (fixed_parameter): Update.
3409 (parameter_array): Ditto.
3410 (property_declaration): Ditto.
3411 (destructor_declaration): Ditto.
3413 * class.cs (Struct::Struct): Update constructors accordingly.
3414 (Class::Class): Ditto.
3415 (Field::Field): Ditto.
3416 (Method::Method): Ditto.
3417 (Property::Property): Ditto.
3418 (TypeContainer::OptAttribute): update property's return type.
3420 * interface.cs (Interface.opt_attributes): New member.
3421 (Interface::Interface): Update to take the extra Attributes argument.
3423 * parameter.cs (Parameter::Parameter): Ditto.
3425 * constant.cs (Constant::Constant): Ditto.
3427 * interface.cs (InterfaceMemberBase): New OptAttributes field.
3428 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
3429 the attributes as a parameter.
3430 (InterfaceProperty): Update constructor call.
3431 (InterfaceEvent): Ditto.
3432 (InterfaceMethod): Ditto.
3433 (InterfaceIndexer): Ditto.
3435 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
3436 pass the attributes too.
3437 (interface_event_declaration): Ditto.
3438 (interface_property_declaration): Ditto.
3439 (interface_method_declaration): Ditto.
3440 (interface_declaration): Ditto.
3442 2001-09-05 Miguel de Icaza <miguel@ximian.com>
3444 * class.cs (Method::Define): Track the "static Main" definition to
3445 create an entry point.
3447 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
3448 EntryPoint if we find it.
3450 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
3451 (EmitContext::ig): Make this variable public.
3453 * driver.cs: Make the default output file be the first file name
3454 with the .exe extension.
3456 Detect empty compilations
3458 Handle various kinds of output targets. Handle --target and
3459 rename -t to --dumper.
3461 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
3462 methods inherited from Expression return now an Expression. This
3463 will is used during the tree rewriting as we resolve them during
3466 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
3467 the spec. Missing entirely is the information about
3468 accessability of elements of it.
3470 (Expression::ExprClassFromMemberInfo): New constructor for
3471 Expressions that creates a fully initialized Expression based on
3472 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
3475 (Invocation::Resolve): Begin implementing resolution of invocations.
3477 * literal.cs (StringLiteral): Implement Emit.
3479 2001-09-05 Ravi Pratap <ravi@ximian.com>
3481 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
3484 2001-09-04 Ravi Pratap <ravi@ximian.com>
3486 * cs-parser.jay (attribute_arguments): Implement actions.
3487 (attribute): Fix bug in production. Implement action.
3488 (attribute_list): Implement.
3489 (attribute_target): Implement.
3490 (attribute_target_specifier, opt_target_specifier): Implement
3491 (CheckAttributeTarget): New method to check if the attribute target
3493 (attribute_section): Implement.
3494 (opt_attributes): Implement.
3496 * attribute.cs : New file to handle attributes.
3497 (Attribute): Class to hold attribute info.
3499 * cs-parser.jay (opt_attribute_target_specifier): Remove production
3500 (attribute_section): Modify production to use 2 different rules to
3501 achieve the same thing. 1 s/r conflict down !
3502 Clean out commented, useless, non-reducing dimension_separator rules.
3504 * class.cs (TypeContainer.attributes): New member to hold list
3505 of attributes for a type.
3506 (Struct::Struct): Modify to take one more argument, the attribute list.
3507 (Class::Class): Ditto.
3508 (Field::Field): Ditto.
3509 (Method::Method): Ditto.
3510 (Property::Property): Ditto.
3512 * cs-parser.jay (struct_declaration): Update constructor call to
3513 pass in the attributes too.
3514 (class_declaration): Ditto.
3515 (constant_declaration): Ditto.
3516 (field_declaration): Ditto.
3517 (method_header): Ditto.
3518 (fixed_parameter): Ditto.
3519 (parameter_array): Ditto.
3520 (property_declaration): Ditto.
3522 * constant.cs (Constant::Constant): Update constructor similarly.
3523 Use System.Collections.
3525 * parameter.cs (Parameter::Parameter): Update as above.
3527 2001-09-02 Ravi Pratap <ravi@ximian.com>
3529 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
3530 (TypeContainer.delegates): New member to hold list of delegates.
3532 * cs-parser.jay (delegate_declaration): Implement the action correctly
3533 this time as I seem to be on crack ;-)
3535 2001-09-02 Miguel de Icaza <miguel@ximian.com>
3537 * rootcontext.cs (RootContext::IsNamespace): new function, used to
3538 tell whether an identifier represents a namespace.
3540 * expression.cs (NamespaceExpr): A namespace expression, used only
3541 temporarly during expression resolution.
3542 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
3543 utility functions to resolve names on expressions.
3545 2001-09-01 Miguel de Icaza <miguel@ximian.com>
3547 * codegen.cs: Add hook for StatementExpressions.
3549 * class.cs: Fix inverted test for static flag in methods.
3551 2001-09-02 Ravi Pratap <ravi@ximian.com>
3553 * class.cs (Operator::CheckUnaryOperator): Correct error number used
3554 to make it coincide with MS' number.
3555 (Operator::CheckBinaryOperator): Ditto.
3557 * ../errors/errors.txt : Remove error numbers added earlier.
3559 * ../errors/cs1019.cs : Test case for error # 1019
3561 * ../errros/cs1020.cs : Test case for error # 1020
3563 * cs-parser.jay : Clean out commented cruft.
3564 (dimension_separators, dimension_separator): Comment out. Ostensibly not
3565 used anywhere - non-reducing rule.
3566 (namespace_declarations): Non-reducing rule - comment out.
3568 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
3569 with TypeContainer::AddEnum.
3571 * delegate.cs : New file for delegate handling classes.
3572 (Delegate): Class for declaring delegates.
3574 * makefile : Update.
3576 * cs-parser.jay (delegate_declaration): Implement.
3578 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
3580 * class.cs (Event::Define): Implement.
3581 (Event.EventBuilder): New member.
3583 * class.cs (TypeContainer::Populate): Update to define all enums and events
3585 (Events): New property for the events arraylist we hold. Shouldn't we move to using
3586 readonly fields for all these cases ?
3588 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
3590 * class.cs (Property): Revamp to use the convention of making fields readonly.
3591 Accordingly modify code elsewhere.
3593 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
3594 the Define method of the Property class.
3596 * class.cs : Clean up applied patch and update references to variables etc. Fix
3598 (TypeContainer::Populate): Update to define all the properties we have. Also
3599 define all enumerations.
3601 * enum.cs (Define): Implement.
3603 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
3605 * cs-parser.jay (overloadable_operator): The semantic value is an
3606 enum of the Operator class.
3607 (operator_declarator): Implement actions.
3608 (operator_declaration): Implement.
3610 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
3611 validity of definitions.
3612 (Operator::CheckBinaryOperator): Static method to check for binary operators
3613 (TypeContainer::AddOperator): New method to add an operator to a type.
3615 * cs-parser.jay (indexer_declaration): Added line to actually call the
3616 AddIndexer method so it gets added ;-)
3618 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
3619 already taken care of by the MS compiler ?
3621 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
3623 * class.cs (Operator): New class for operator declarations.
3624 (Operator::OpType): Enum for the various operators.
3626 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
3628 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
3629 ostensibly handle this in semantic analysis.
3631 * cs-parser.jay (general_catch_clause): Comment out
3632 (specific_catch_clauses, specific_catch_clause): Ditto.
3633 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
3634 (catch_args, opt_catch_args): New productions.
3635 (catch_clause): Rewrite to use the new productions above
3636 (catch_clauses): Modify accordingly.
3637 (opt_catch_clauses): New production to use in try_statement
3638 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
3639 and re-write the code in the actions to extract the specific and
3640 general catch clauses by being a little smart ;-)
3642 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
3643 Hooray, try and catch statements parse fine !
3645 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
3647 * statement.cs (Block::GetVariableType): Fix logic to extract the type
3648 string from the hashtable of variables.
3650 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
3651 I end up making that mistake ;-)
3652 (catch_clauses): Fixed gross error which made Key and Value of the
3653 DictionaryEntry the same : $1 !!
3655 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
3657 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
3659 * cs-parser.jay (event_declaration): Correct to remove the semicolon
3660 when the add and remove accessors are specified.
3662 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
3664 * cs-parser.jay (IndexerDeclaration): New helper class to hold
3665 information about indexer_declarator.
3666 (indexer_declarator): Implement actions.
3667 (parsing_indexer): New local boolean used to keep track of whether
3668 we are parsing indexers or properties. This is necessary because
3669 implicit_parameters come into picture even for the get accessor in the
3671 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
3673 * class.cs (Indexer): New class for indexer declarations.
3674 (TypeContainer::AddIndexer): New method to add an indexer to a type.
3675 (TypeContainer::indexers): New member to hold list of indexers for the
3678 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
3680 * cs-parser.jay (add_accessor_declaration): Implement action.
3681 (remove_accessor_declaration): Implement action.
3682 (event_accessors_declaration): Implement
3683 (variable_declarators): swap statements for first rule - trivial.
3685 * class.cs (Event): New class to hold information about event
3687 (TypeContainer::AddEvent): New method to add an event to a type
3688 (TypeContainer::events): New member to hold list of events.
3690 * cs-parser.jay (event_declaration): Implement actions.
3692 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
3694 * cs-parser.jay (dim_separators): Implement. Make it a string
3695 concatenating all the commas together, just as they appear.
3696 (opt_dim_separators): Modify accordingly
3697 (rank_specifiers): Update accordingly. Basically do the same
3698 thing - instead, collect the brackets here.
3699 (opt_rank_sepcifiers): Modify accordingly.
3700 (array_type): Modify to actually return the complete type string
3701 instead of ignoring the rank_specifiers.
3702 (expression_list): Implement to collect the expressions
3703 (variable_initializer): Implement. We make it a list of expressions
3704 essentially so that we can handle the array_initializer case neatly too.
3705 (variable_initializer_list): Implement.
3706 (array_initializer): Make it a list of variable_initializers
3707 (opt_array_initializer): Modify accordingly.
3709 * expression.cs (New::NType): Add enumeration to help us
3710 keep track of whether we have an object/delegate creation
3711 or an array creation.
3712 (New:NewType, New::Rank, New::Indices, New::Initializers): New
3713 members to hold data about array creation.
3714 (New:New): Modify to update NewType
3715 (New:New): New Overloaded contructor for the array creation
3718 * cs-parser.jay (array_creation_expression): Implement to call
3719 the overloaded New constructor.
3721 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
3723 * class.cs (TypeContainer::Constructors): Return member
3724 constructors instead of returning null.
3726 2001-08-26 Miguel de Icaza <miguel@ximian.com>
3728 * typemanager.cs (InitCoreTypes): Initialize the various core
3729 types after we have populated the type manager with the user
3730 defined types (this distinction will be important later while
3731 compiling corlib.dll)
3733 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
3734 on Expression Classification. Now all expressions have a method
3735 `Resolve' and a method `Emit'.
3737 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
3738 generation from working. Also add some temporary debugging
3741 2001-08-24 Miguel de Icaza <miguel@ximian.com>
3743 * codegen.cs: Lots of code generation pieces. This is only the
3744 beginning, will continue tomorrow with more touches of polish. We
3745 handle the fundamentals of if, while, do, for, return. Others are
3746 trickier and I need to start working on invocations soon.
3748 * gen-treedump.cs: Bug fix, use s.Increment here instead of
3751 * codegen.cs (EmitContext): New struct, used during code
3752 emission to keep a context. Most of the code generation will be
3755 * cs-parser.jay: Add embedded blocks to the list of statements of
3756 this block. So code generation proceeds in a top down fashion.
3758 2001-08-23 Miguel de Icaza <miguel@ximian.com>
3760 * statement.cs: Add support for multiple child blocks.
3762 2001-08-22 Miguel de Icaza <miguel@ximian.com>
3764 * codegen.cs (EmitCode): New function, will emit the code for a
3765 Block of code given a TypeContainer and its ILGenerator.
3767 * statement.cs (Block): Standard public readonly optimization.
3768 (Block::Block constructors): Link children.
3769 (Block::Child): Child Linker.
3770 (Block::EmitVariables): Emits IL variable declarations.
3772 * class.cs: Drop support for MethodGroups here, delay until
3774 (Method::): Applied the same simplification that I did before, and
3775 move from Properties to public readonly fields.
3776 (Method::ParameterTypes): Returns the parameter types for the
3777 function, and implements a cache that will be useful later when I
3778 do error checking and the semantic analysis on the methods is
3780 (Constructor::GetCallingConvention): Renamed from CallingConvetion
3781 and made a method, optional argument tells whether this is a class
3782 or a structure to apply the `has-this' bit.
3783 (Method::GetCallingConvention): Implement, returns the calling
3785 (Method::Define): Defines the type, a second pass is performed
3786 later to populate the methods.
3788 (Constructor::ParameterTypes): implement a cache similar to the
3789 one on Method::ParameterTypes, useful later when we do semantic
3792 (TypeContainer::EmitMethod): New method. Emits methods.
3794 * expression.cs: Removed MethodGroup class from here.
3796 * parameter.cs (Parameters::GetCallingConvention): new method.
3798 2001-08-21 Miguel de Icaza <miguel@ximian.com>
3800 * class.cs (TypeContainer::Populate): Drop RootContext from the
3803 (Constructor::CallingConvention): Returns the calling convention.
3804 (Constructor::ParameterTypes): Returns the constructor parameter
3807 (TypeContainer::AddConstructor): Keep track of default constructor
3808 and the default static constructor.
3810 (Constructor::) Another class that starts using `public readonly'
3811 instead of properties.
3813 (Constructor::IsDefault): Whether this is a default constructor.
3815 (Field::) use readonly public fields instead of properties also.
3817 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
3818 track of static constructors; If none is used, turn on
3819 BeforeFieldInit in the TypeAttributes.
3821 * cs-parser.jay (opt_argument_list): now the return can be null
3822 for the cases where there are no arguments.
3824 (constructor_declarator): If there is no implicit `base' or
3825 `this', then invoke the default parent constructor.
3827 * modifiers.cs (MethodAttr): New static function maps a set of
3828 modifiers flags into a MethodAttributes enum
3829 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
3830 MethodAttr, TypeAttr to represent the various mappings where the
3832 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
3834 2001-08-19 Miguel de Icaza <miguel@ximian.com>
3836 * parameter.cs (GetParameterInfo): Fix bug where there would be no
3839 * interface.cs (PopulateIndexer): Implemented the code generator
3840 for interface indexers.
3842 2001-08-17 Miguel de Icaza <miguel@ximian.com>
3844 * interface.cs (InterfaceMemberBase): Now we track the new status
3847 (PopulateProperty): Implement property population. Woohoo! Got
3848 Methods and Properties going today.
3850 Removed all the properties for interfaces, and replaced them with
3851 `public readonly' fields.
3853 2001-08-16 Miguel de Icaza <miguel@ximian.com>
3855 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
3856 initialize their hashtables/arraylists only when they are needed
3857 instead of doing this always.
3859 * parameter.cs: Handle refs and out parameters.
3861 * cs-parser.jay: Use an ArrayList to construct the arguments
3862 instead of the ParameterCollection, and then cast that to a
3865 * parameter.cs: Drop the use of ParameterCollection and use
3866 instead arrays of Parameters.
3868 (GetParameterInfo): Use the Type, not the Name when resolving
3871 2001-08-13 Miguel de Icaza <miguel@ximian.com>
3873 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
3874 and instead use public readonly fields.
3876 * class.cs: Put back walking code for type containers.
3878 2001-08-11 Miguel de Icaza <miguel@ximian.com>
3880 * class.cs (MakeConstant): Code to define constants.
3882 * rootcontext.cs (LookupType): New function. Used to locate types
3885 2001-08-08 Miguel de Icaza <miguel@ximian.com>
3887 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
3888 this System.Reflection code is. Kudos to Microsoft
3890 * typemanager.cs: Implement a type cache and avoid loading all
3891 types at boot time. Wrap in LookupType the internals. This made
3892 the compiler so much faster. Wow. I rule!
3894 * driver.cs: Make sure we always load mscorlib first (for
3895 debugging purposes, nothing really important).
3897 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
3898 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
3900 * rootcontext.cs: Lookup types on their namespace; Lookup types
3901 on namespaces that have been imported using the `using' keyword.
3903 * class.cs (TypeContainer::TypeAttr): Virtualize.
3904 (Class::TypeAttr): Return attributes suitable for this bad boy.
3905 (Struct::TypeAttr): ditto.
3906 Handle nested classes.
3907 (TypeContainer::) Remove all the type visiting code, it is now
3908 replaced with the rootcontext.cs code
3910 * rootcontext.cs (GetClassBases): Added support for structs.
3912 2001-08-06 Miguel de Icaza <miguel@ximian.com>
3914 * interface.cs, statement.cs, class.cs, parameter.cs,
3915 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
3916 Drop use of TypeRefs, and use strings instead.
3918 2001-08-04 Miguel de Icaza <miguel@ximian.com>
3922 * class.cs (Struct::Struct): set the SEALED flags after
3923 checking the modifiers.
3924 (TypeContainer::TypeAttr): new property, returns the
3925 TypeAttributes for a class.
3927 * cs-parser.jay (type_list): Oops, list production was creating a
3928 new list of base types.
3930 * rootcontext.cs (StdLib): New property.
3931 (GetInterfaceTypeByName): returns an interface by type name, and
3932 encapsulates error handling here.
3933 (GetInterfaces): simplified.
3934 (ResolveTree): Encapsulated all the tree resolution here.
3935 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
3938 * driver.cs: Add support for --nostdlib, to avoid loading the
3940 (Main): Do not put tree resolution here.
3942 * rootcontext.cs: Beginning of the class resolution.
3944 2001-08-03 Miguel de Icaza <miguel@ximian.com>
3946 * rootcontext.cs: Provide better error reporting.
3948 * cs-parser.jay (interface_base): set our $$ to be interfaces.
3950 * rootcontext.cs (CreateInterface): Handle the case where there
3951 are no parent interfaces.
3953 (CloseTypes): Routine to flush types at the end.
3954 (CreateInterface): Track types.
3955 (GetInterfaces): Returns an array of Types from the list of
3958 * typemanager.c (AddUserType): Mechanism to track user types (puts
3959 the type on the global type hash, and allows us to close it at the
3962 2001-08-02 Miguel de Icaza <miguel@ximian.com>
3964 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
3965 RecordInterface instead.
3967 * cs-parser.jay: Updated to reflect changes above.
3969 * decl.cs (Definition): Keep track of the TypeBuilder type that
3970 represents this type here. Not sure we will use it in the long
3971 run, but wont hurt for now.
3973 * driver.cs: Smaller changes to accomodate the new code.
3975 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
3978 * rootcontext.cs (CreateInterface): New method, used to create
3979 the System.TypeBuilder type for interfaces.
3980 (ResolveInterfaces): new entry point to resolve the interface
3982 (CodeGen): Property, used to keep track of the code generator.
3984 2001-07-26 Miguel de Icaza <miguel@ximian.com>
3986 * cs-parser.jay: Add a second production for delegate_declaration
3989 (enum_body): Put an opt_comma here instead of putting it on
3990 enum_body or enum_member_declarations so we can handle trailing
3991 commas on enumeration members. Gets rid of a shift/reduce.
3993 (type_list): Need a COMMA in the middle.
3995 (indexer_declaration): Tell tokenizer to recognize get/set
3997 * Remove old targets.
3999 * Re-add the parser target.
4001 2001-07-13 Simon Cozens <simon@simon-cozens.org>
4003 * cs-parser.jay: Add precendence rules for a number of operators
4004 ot reduce the number of shift/reduce conflicts in the grammar.
4006 2001-07-17 Miguel de Icaza <miguel@ximian.com>
4008 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
4011 Get rid of old crufty code.
4013 * rootcontext.cs: Use this to keep track of the parsed
4014 representation and the defined types available to the program.
4016 * gen-treedump.cs: adjust for new convention.
4018 * type.cs: Split out the type manager, and the assembly builder
4021 * typemanager.cs: the type manager will live here now.
4023 * cil-codegen.cs: And the code generator here.
4025 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
4027 * makefile: Fixed up for easy making.
4029 2001-07-13 Simon Cozens <simon@simon-cozens.org>
4031 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
4034 (unary_expression): Expand pre_increment_expression and
4035 post_decrement_expression to reduce a shift/reduce.
4037 2001-07-11 Simon Cozens
4039 * cs-tokenizer.cs: Hex numbers should begin with a 0.
4041 Improve allow_keyword_as_indent name.
4043 2001-06-19 Miguel de Icaza <miguel@ximian.com>
4045 * Adjustments for Beta2.
4047 2001-06-13 Miguel de Icaza <miguel@ximian.com>
4049 * decl.cs: Added `Define' abstract method.
4050 (InTransit): new property, used to catch recursive definitions.
4052 * interface.cs: Implement `Define'.
4054 * modifiers.cs: Map Modifiers.constants to
4055 System.Reflection.TypeAttribute flags.
4057 * class.cs: Keep track of types and user-defined types.
4058 (BuilderInit): New method for creating an assembly
4059 (ResolveType): New function to launch the resolution process, only
4060 used by interfaces for now.
4062 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
4063 that are inserted into the name space.
4065 2001-06-08 Miguel de Icaza <miguel@ximian.com>
4067 * ARGH. I have screwed up my tree so many times due to the use of
4068 rsync rather than using CVS. Going to fix this at once.
4070 * driver.cs: Objetify driver. Load assemblies, use assemblies to
4073 2001-06-07 Miguel de Icaza <miguel@ximian.com>
4075 * Experiment successful: Use System.Type rather that our own
4078 2001-05-25 Miguel de Icaza <miguel@ximian.com>
4080 * cs-parser.jay: Removed nsAliases from here.
4082 Use new namespaces, handle `using XXX;'
4084 * namespace.cs: Reimplemented namespace handling, use a recursive
4085 definition of the class. Now we can keep track of using clauses
4086 and catch invalid using clauses.
4088 2001-05-24 Miguel de Icaza <miguel@ximian.com>
4090 * gen-treedump.cs: Adapted for all the renaming.
4092 * expression.cs (Expression): this class now has a Type property
4093 which returns an expression Type.
4095 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
4096 `Type', as this has a different meaning now in the base
4098 2001-05-22 Miguel de Icaza <miguel@ximian.com>
4100 * interface.cs, class.cs: Removed from all the sources the
4101 references to signature computation, as we can not do method
4102 signature computation during the parsing time, as we are not
4103 trying to solve at that point distinguishing:
4107 void a (NS.Blah x) {}
4110 Which depending on the context might be valid or not, as we do not
4111 know if Blah is the same thing as NS.Blah at that point.
4113 * Redid everything so the code uses TypeRefs now instead of
4114 Types. TypeRefs are just temporary type placeholders, that need
4115 to be resolved. They initially have a pointer to a string and the
4116 current scope in which they are used. This is used later by the
4117 compiler to resolve the reference to an actual Type.
4119 * DeclSpace is no longer a CIR.Type, and neither are
4120 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
4121 are all DeclSpaces, but no Types.
4123 * type.cs (TypeRefManager): This implements the TypeRef manager,
4124 which keeps track of all the types that need to be resolved after
4125 the parsing has finished.
4127 2001-05-13 Miguel de Icaza <miguel@ximian.com>
4129 * ARGH. We are going to have to store `foreach' as a class rather
4130 than resolving it, as we need to verify error 1579 after name
4131 resolution. *OR* we could keep a flag that says `This request to
4132 IEnumerator comes from a foreach statement' which we can then use
4133 to generate the error.
4135 2001-05-10 Miguel de Icaza <miguel@ximian.com>
4137 * class.cs (TypeContainer.AddMethod): we now add methods to the
4138 MethodGroup instead of the method hashtable.
4140 * expression.cs: Add MethodGroup abstraction, which gets us one
4141 step closer to the specification in the way we handle method
4144 * cs-parser.jay (primary_expression): qualified_identifier now
4145 tried to match up an identifier to a local variable reference or
4146 to a parameter reference.
4148 current_local_parameters is now a parser global variable that
4149 points to the current parameters for the block, used during name
4152 (property_declaration): Now creates an implicit `value' argument to
4155 2001-05-09 Miguel de Icaza <miguel@ximian.com>
4157 * parameter.cs: Do not use `param' arguments as part of the
4158 signature, per the spec.
4160 2001-05-08 Miguel de Icaza <miguel@ximian.com>
4162 * decl.cs: Base class for classes, structs and interfaces. This
4163 is the "Declaration Space"
4165 * cs-parser.jay: Use CheckDef for checking declaration errors
4166 instead of having one on each function.
4168 * class.cs: Factor out some code for handling error handling in
4169 accordance to the "Declarations" section in the "Basic Concepts"
4170 chapter in the ECMA C# spec.
4172 * interface.cs: Make all interface member classes derive from
4173 InterfaceMemberBase.
4175 2001-05-07 Miguel de Icaza <miguel@ximian.com>
4177 * Many things: all interfaces are parsed and generated in
4178 gen-treedump. Support for member variables, constructors,
4179 destructors, properties, constants is there.
4181 Beginning of the IL backend, but very little done, just there for
4184 2001-04-29 Miguel de Icaza <miguel@ximian.com>
4186 * cs-parser.jay: Fix labeled statement.
4188 * cs-tokenizer.cs (escape): Escape " and ' always.
4189 ref_line, ref_name: keep track of the line/filename as instructed
4190 by #line by the compiler.
4193 2001-04-27 Miguel de Icaza <miguel@ximian.com>
4195 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
4196 to match the values in System.CodeDOM.
4198 Divid renamed to Divide.
4200 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
4202 (Statements.set): remove.
4204 * System.CodeDOM/CodeCatchClause.cs: always have a valid
4207 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
4208 falseStatements always have valid values.
4210 * cs-parser.jay: Use System.CodeDOM now.