1 2002-02-21 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs (Binary.ResolveOperator): Remove redundant
4 MemberLookup pn parent type.
5 Optimize union call, we do not need a union if the types are the same.
6 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
9 Specialize the use of MemberLookup everywhere, instead of using
12 (StackAlloc): Implement stackalloc keyword.
14 * cs-parser.jay: Add rule to parse stackalloc.
16 * driver.cs: Handle /h, /help, /?
18 * expression.cs (MakeByteBlob): Removed the hacks we had in place
19 before we supported unsafe code.
21 * makefile: add --unsafe to the self compilation of mcs.
23 2002-02-20 Miguel de Icaza <miguel@ximian.com>
25 * expression.cs (PointerArithmetic): New class that is used to
26 perform pointer arithmetic.
27 (Binary.Resolve): Handle pointer arithmetic
28 Handle pointer comparission.
29 (ArrayPtr): Utility expression class that is used to take the
32 (ElementAccess): Implement array access for pointers
34 * statement.cs (Fixed): Implement fixed statement for arrays, we
35 are missing one more case before we are done.
37 * expression.cs (Indirection): Implement EmitAssign and set the
38 ExprClass to Variable. This allows pointer dereferences to be
39 treated as variables, and to have values assigned to them.
41 * ecore.cs (Expression.StoreFromPtr): New utility function to
42 store values dereferencing.
44 2002-02-20 Ravi Pratap <ravi@ximian.com>
46 * expression.cs (Binary.ResolveOperator): Ensure that we are
47 not trying to operate on a void type - this fixes the reported
50 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
51 the parent implementation is sealed.
53 * ../errors/cs0239.cs : Add.
55 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
57 * typemanager.cs (unverifiable_code_type): Corresponds to
58 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
59 which have unsafe code in them.
61 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
64 2002-02-19 Miguel de Icaza <miguel@ximian.com>
66 * cs-tokenizer.cs: Add support for @"litreal strings"
68 Make tokenizer accept pre-processor directives
69 on any column (remove the old C-like limitation).
71 * rootcontext.cs (EmitCode): Emit any global attributes.
72 (AddGlobalAttributes): Used to keep track of assembly attributes.
74 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
76 * cs-parser.jay: Add support for global attributes.
78 2002-02-17 Miguel de Icaza <miguel@ximian.com>
80 * expression.cs (Indirection): New helper class. Unary will
81 create Indirection classes to be able to implement the
82 IMemoryLocation interface on it.
84 2002-02-16 Miguel de Icaza <miguel@ximian.com>
86 * cs-parser.jay (fixed_statement): reference the right statement.
88 * statement.cs (Fixed.Emit): Finish implementing the fixed
89 statement for the &x case.
91 2002-02-14 Miguel de Icaza <miguel@ximian.com>
93 * class.cs (Property.Define, Method.Define): Remove newslot when
96 * modifiers.cs: My use of NewSlot when `Abstract' was set was
97 wrong. NewSlot should only be used if the `new' keyword is present.
99 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
100 locating our system dir. Sorry about this.
102 2002-02-13 Miguel de Icaza <miguel@ximian.com>
104 * driver.cs (GetSystemDir): Compute correctly the location of our
105 system assemblies. I was using the compiler directory instead of
106 the library directory.
108 2002-02-13 Ravi Pratap <ravi@ximian.com>
110 * expression.cs (BetterFunction): Put back in what Miguel commented out
111 since it is the correct fix. The problem is elsewhere ;-)
113 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
114 parameters of the parms method are themselves compatible or not !
116 (StandardConversionExists): Fix very dangerous bug where we were forgetting
117 to check that a class implements an interface before saying that an implicit
118 conversion was allowed. Use ImplementsInterface to do the checking.
120 2002-02-13 Miguel de Icaza <miguel@ximian.com>
122 * class.cs (Method.Define): Track whether we are an explicit
123 implementation or not. And only call DefineMethodOverride if we
124 are an explicit implementation.
126 (Property.DefineMethod): Ditto.
128 2002-02-11 Ravi Pratap <ravi@ximian.com>
130 * expression.cs (BetterFunction): Catch hideous bug which was
131 preventing us from detecting ambiguous calls due to implicit casts i.e
134 2002-01-29 Miguel de Icaza <miguel@ximian.com>
136 * support.cs (Pair): Remove un-needed method. I figured why I was
137 getting the error in cs-parser.jay, the variable in a foreach loop
138 is readonly, and the compiler does not really treat this as a variable.
140 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
141 instead of EQUALS in grammar.
143 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
145 * expression.cs (Unary.DoResolve): Check whether the argument is
148 2002-01-28 Miguel de Icaza <miguel@ximian.com>
150 * support.cs: Api for Pair to set a value. Despite the fact that
151 the variables are public the MS C# compiler refuses to compile
152 code that accesses the field if the variable is part of a foreach
155 * statement.cs (Fixed): Begin implementation of the fixed
158 (Block.AddVariable): Return the VariableInfo on success and null
159 on failure instead of true/false.
161 * cs-parser.jay (foreach): Catch errors on variables already
162 defined (we were ignoring this value before) and properly unwind
165 (fixed_statement): grammar for the fixed statement.
167 2002-01-25 Miguel de Icaza <miguel@ximian.com>
169 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
170 pointer types to be incretemented.
174 * cs-parser.jay (pointer_member_access): Implement
175 expr->IDENTIFIER production.
177 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
178 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
181 (Unary): Implement indirection.
183 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
184 use in non-unsafe context).
186 (SimpleName.DoResolve): Check for pointers in field access on safe
189 (Expression.LoadFromPtr): Factor the load-indirect code in this
190 function. This was duplicated in UnboxCast and ParameterReference
192 2002-01-24 Miguel de Icaza <miguel@ximian.com>
194 * expression.cs (ComposedCast): report an error if a pointer cast
195 is used in a safe region.
197 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
198 pointer type casts in unsafe context.
200 * codegen.cs (EmitContext): Set up IsUnsafe.
202 * cs-parser.jay (non_expression_type): Add productions for pointer
205 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
206 code. We should not use force into static mode if the method is
207 not virtual. Fixes bug in MIS
209 * statement.cs (Do.Emit, While.Emit, For.Emit,
210 Statement.EmitBoolExpression): Add support to Do and While to
211 propagate infinite loop as `I do return' semantics.
213 Improve the For case to also test for boolean constants.
215 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
216 to the list of attributes we can add.
218 Remove `EmitContext' argument.
220 * class.cs (Method.Define): Apply parameter attributes.
221 (Constructor.Define): Apply parameter attributes.
222 (MethodCore.LabelParameters): Move here the core of labeling
225 * support.cs (ReflectionParameters.ParameterModifier,
226 InternalParameters.ParameterModifier): Use IsByRef on the type and
227 only return the OUT bit for these parameters instead of in/out/ref
230 This is because I miss-understood things. The ParameterInfo.IsIn
231 and IsOut represent whether the parameter has the [In] and [Out]
234 2002-01-22 Miguel de Icaza <miguel@ximian.com>
236 * ecore.cs (FieldExpr.Emit): Release temporaries.
238 * assign.cs (LocalTemporary.Release): new function.
240 * codegen.cs (EmitContext.GetTemporaryStorage,
241 EmitContext.FreeTemporaryStorage): Rework the way we deal with
242 temporary storage. Now we can "put back" localbuilders when we
245 2002-01-21 Miguel de Icaza <miguel@ximian.com>
247 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
248 need to make a copy of the variable to generate verifiable code.
250 2002-01-19 Miguel de Icaza <miguel@ximian.com>
252 * driver.cs: Compute dynamically the system directory.
254 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
255 Slower, but more generally useful. Used by the abstract
256 registering implementation.
258 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
259 the rules for the special rule on Type/instances. First check if
260 we have the same name, and if so, try that special static path
261 rather than the instance path.
263 2002-01-18 Miguel de Icaza <miguel@ximian.com>
265 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
268 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
269 Enum, ValueType, Delegate or Array for non-corlib compiles.
271 * cs-tokenizer.cs: Catch long identifiers (645)
273 * typemanager.cs (IndexerPropetyName): Ravi never tested this
276 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
277 fix, we were returning too early, so we were not registering
278 pending methods from abstract classes.
280 Do not register pending methods if the class is abstract.
282 * expression.cs (Conditional.DoResolve): Report circular implicit
283 conversions when we neecd to compute it for conditional
286 (Is.DoResolve): If the expression is always of the provided type,
287 flag warning 183. If the expression can not ever be of the
288 provided type flag warning 184.
290 * class.cs: Catch 169 as well.
292 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
295 2002-01-18 Nick Drochak <ndrochak@gol.com>
297 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
299 2002-01-17 Miguel de Icaza <miguel@ximian.com>
301 * interface.cs: (PopulateMethod): Check for pointers being defined
302 only if the unsafe context is active.
303 (PopulateProperty): ditto.
304 (PopulateIndexer): ditto.
306 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
307 specified. If pointers are present, make sure that they are
308 present in an unsafe context.
309 (Constructor, Constructor.Define): ditto.
310 (Field, Field.Define): ditto.
311 (Property, Property.Define): ditto.
312 (Event, Event.Define): ditto.
314 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
315 hashtable if there are classes or structs defined.
317 * expression.cs (LocalVariableReference.DoResolve): Simplify this
318 code, as the constant resolution moved.
320 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
321 the metadata, so we can flag error 133.
323 * decl.cs (MemberCore.UnsafeOK): New function to test that a
324 pointer is being declared in an unsafe context.
326 2002-01-16 Miguel de Icaza <miguel@ximian.com>
328 * modifiers.cs (Modifiers.Check): Require a Location argument.
329 Report error 227 for Unsafe use.
331 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
333 * statement.cs (For.Emit): If the test is null, then report that
334 we do `return', as we wont reach anything afterwards.
336 (Switch.SwitchGoverningType): Track the expression that matched
339 * driver.cs: Allow negative numbers as an error code to flag.
341 * cs-parser.jay: Handle 1551.
343 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
345 2002-01-15 Miguel de Icaza <miguel@ximian.com>
347 * cs-parser.jay: Report 1518 (type declaration can only contain
348 class, struct, interface, enum or delegate)
350 (switch_label): Report 1523 (keywords `case' or `default' must
353 (opt_switch_sections): Report 1522 (empty switch)
355 * driver.cs: Report 1515 (response file specified multiple times)
356 Report 1516 (Source file specified multiple times).
358 * expression.cs (Argument.Resolve): Signal 1510
360 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
361 access not allowed in static code)
363 2002-01-11 Ravi Pratap <ravi@ximian.com>
365 * typemanager.cs (IsPointerType): Utility method which we are going
368 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
369 the object type, so we take care of that.
371 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
373 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
374 added to non-params parameters :-)
376 * typemanager.cs (CSharpName): Include 'void' type too.
378 (void_ptr_type): Include in the set of core types.
380 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
383 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
386 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
387 completely forgotten about it.
389 2002-01-10 Ravi Pratap <ravi@ximian.com>
391 * cs-parser.jay (pointer_type): Add. This begins our implementation
392 of parsing rules for unsafe code.
394 (unsafe_statement): Implement.
396 (embedded_statement): Modify to include the above.
398 * statement.cs (Unsafe): Implement new class for unsafe blocks.
400 * codegen.cs (EmitContext.InUnsafe): Add. This determines
401 if the current context is an unsafe one.
403 * cs-parser.jay (local_variable_pointer_type): Since local variable types
404 are handled differently, we need separate rules for them.
406 (local_variable_declaration): Update to use local_variable_pointer_type
407 to allow variable declarations of unmanaged pointer types.
409 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
412 * ../errors/cs0214.cs : Add.
414 2002-01-16 Nick Drochak <ndrochak@gol.com>
416 * makefile: remove 'response' file when cleaning.
418 2002-01-15 Miguel de Icaza <miguel@ximian.com>
420 * cs-parser.jay: Report 1524.
422 2002-01-14 Miguel de Icaza <miguel@ximian.com>
424 * typemanager.cs (RegisterMethod): drop checking if we have
425 registered this from here
427 2002-01-12 Miguel de Icaza <miguel@ximian.com>
429 * class.cs (Method.EmitDestructor): Implement calling our base
432 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
435 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
436 this routine and will wrap the call in a try/catch block. Deal
439 2002-01-11 Miguel de Icaza <miguel@ximian.com>
441 * ecore.cs (Expression.MemberLookup): instead of taking a
442 parameter `same_type' that was used to tell whether we could
443 access private members we compute our containing type from the
446 (FieldExpr): Added partial support for volatile fields. This does
447 not work for volatile fields exposed from assemblies, as I can not
448 figure out how to extract the modreq from it.
450 Updated all the source files to use this.
452 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
453 because it is referenced by MemberLookup very often.
455 2002-01-09 Ravi Pratap <ravi@ximian.com>
457 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
458 TypeBuilder.GetCustomAttributes to retrieve what we need.
460 Get rid of redundant default_member_attr_type as this is the same as
461 default_member_type which already exists.
463 * interface.cs, attribute.cs : Update accordingly.
465 2002-01-08 Miguel de Icaza <miguel@ximian.com>
467 * typemanager.cs: Enable IndexerPropertyName again. It does not
468 work for TYpeBuilders though. Ravi, can you please fix this?
470 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
472 * expression.cs (Argument.Emit): Handle the case of ref objects
473 being passed to ref functions;
475 (ParameterReference.EmitLoad): Loads the content of the pointer
476 without dereferencing.
478 2002-01-07 Miguel de Icaza <miguel@ximian.com>
480 * cs-tokenizer.cs: Implemented the pre-processing expressions.
482 2002-01-08 Ravi Pratap <ravi@ximian.com>
484 * class.cs (Indexer.DefineMethod): Incorporate the interface
485 type in the name of the method if we are doing explicit interface
488 * expression.cs (ConversionExists): Remove as it is completely obsolete.
490 (BetterConversion): Fix extremely trivial bug where we were referring to
491 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
494 * ../errors/bug16.cs : Add although we have fixed it.
496 2002-01-07 Miguel de Icaza <miguel@ximian.com>
498 * expression.cs (BaseIndexer): Begin implementation.
500 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
502 * cs-parser.jay (indexer_declarator): Use qualified_identifier
503 production directly to remove a shift/reduce, and implement
504 explicit interface implementation.
506 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
507 after a floating point suffix.
509 * expression.cs (DoNumericPromotions): Improved the conversion for
510 uint/uint. If we have a constant, we avoid doing a typecast to a
513 * class.cs (Indexer): Implement explicit interface implementation
516 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
518 * class.cs: make the default instance constructor public and hidebysig.
520 2001-01-03 Ravi Pratap <ravi@ximian.com>
522 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
523 so we can call it from elsewhere.
525 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
526 we emit it internally if the class has a defined indexer; otherwise the user
527 emits it by decorating the class definition with the DefaultMemberAttribute.
529 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
530 attribute is not used on a type which defines an indexer.
532 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
533 character when we skip whitespace.
535 * ../errors/cs0646.cs : Add.
537 2002-01-03 Miguel de Icaza <miguel@ximian.com>
539 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
542 * makefile: Add practical target `mcs3.exe' which builds the third
545 * expression.cs (New): Fix structures constructor calling.
547 * class.cs (Property, Method, Indexer): Emit Final flag on the
548 method if we are an interface implementation and we are not
551 * ecore.cs (PropertyExpr): New public field `IsBase', tells
552 whether this property is referencing a `base' method.
554 * expression.cs (Invocation.EmitCall): take an extra argument:
555 is_base, this is used to determine whether the `call' or
556 `callvirt' opcode should be used.
559 * delegate.cs: update EmitCall.
561 * class.cs (Method.Define): Set NewSlot for the cases where we are
562 not implementing an interface method.
564 (Property.Define): ditto.
566 2002-01-02 Miguel de Icaza <miguel@ximian.com>
568 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
569 'r'. Allows mcs to parse itself fully.
571 2002-01-02 Ravi Pratap <ravi@ximian.com>
573 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
574 of the number of initializers that require the InitializeArray method.
576 (CheckIndices): Store the Expression in all cases - not the plain value. Also
577 update the above field where necessary.
579 (MakeByteBlob): Update accordingly.
581 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
584 (EmitDynamicInitializers): Update in accordance with the new optimization.
586 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
589 * cs-parser.jay : Fix some glaring errors I introduced.
591 2002-01-01 Ravi Pratap <ravi@ximian.com>
593 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
594 so that we can check for name clashes there too.
596 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
597 for interface indexers.
599 * interfaces.cs (Define): Emit the default member attribute.
601 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
602 variable was being referred to while setting the value ;-)
604 2002-01-01 Miguel de Icaza <miguel@ximian.com>
606 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
607 byte-by-byte information when we know the data is zero.
609 Make the block always a multiple of 4, because
610 DefineInitializedData has a bug.
612 * assign.cs: Fix, we should assign from the temporary, not from
615 * expression.cs (MakeByteBlob): Fix my incorrect code.
617 2001-12-31 Miguel de Icaza <miguel@ximian.com>
619 * typemanager.cs (EnumToUnderlying): This function is used to get
620 the underlying type from an enumeration, because it does not
623 * constant.cs: Use the I4_S form for values between -128 and 127.
625 * statement.cs (Block.LookupLabel): Looks up a label.
626 (Block): Drop support for labeled blocks.
628 (LabeledStatement): New kind of statement that represents a label
631 (Goto): Finally implement this bad boy.
633 * cs-parser.jay: Update to reflect new mechanism to implement
636 2001-12-30 Miguel de Icaza <miguel@ximian.com>
638 * codegen.cs (EmitContext.This): a codegen property that keeps the
639 a single instance of this instead of creating many different this
642 * delegate.cs (Delegate.DoResolve): Update to use the property;
644 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
646 * expression.cs (BaseAccess.DoResolve): Ditto.
648 2001-12-29 Ravi Pratap <ravi@ximian.com>
650 * typemanager.cs (methodimpl_attr_type): Add to hold the type
651 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
653 (InitCoreTypes): Update accordingly.
655 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
656 so we can quickly store the state.
658 (ApplyAttributes): Set the correct implementation flags
659 for InternalCall methods.
661 2001-12-29 Miguel de Icaza <miguel@ximian.com>
663 * expression.cs (EmitCall): if a method is not virtual, then do
664 not use callvirt on it.
666 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
667 user defined stuff) requires the use of stobj, which takes an
668 address on the stack instead of an array and an index. So emit
669 the Ldelema operation for it.
671 (EmitStoreOpcode): Use stobj for valuetypes.
673 (UnaryMutator.EmitCode): Use the right 1 value depending on
674 whether we are dealing with int64/uint64, float or doubles.
676 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
677 constructors that I implemented last night.
679 (Constructor.IsDefault): Fix to work properly for static
682 * cs-parser.jay (CheckDef): report method signature errors.
683 Update error number 103 to be 132.
685 * decl.cs: New AdditionResult enumeration value: MethodExists.
686 Although we do this check for methods later on in the semantic
687 analysis, catching repeated default constructors is so easy that
690 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
693 (ParameterReference.EmitAssign, Emit): handle
696 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
697 (ArrayAccess.EmitStoreOpcode): ditto.
699 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
701 * expression.cs (MakeByteBlob): Complete all the missing types
702 (uint, short, ushort, byte, sbyte)
704 * class.cs: Only init instance field initializers on instance
707 Rename `constructors' to instance_constructors.
709 (TypeContainer.AddConstructor): Only add constructors to the list
712 Make sure that we handle default_static_constructor independently
713 everywhere where we handle instance_constructors
715 2001-12-28 Miguel de Icaza <miguel@ximian.com>
717 * class.cs: Do not lookup or create a base initializer for a
720 (ConstructorInitializer.Resolve): use the proper type to lookup
723 * cs-parser.jay: Report error 1585 (modifiers between type and name).
725 * enum.cs, interface.cs: Remove CloseType, this is taken care by
728 * decl.cs: CloseType is now an virtual method, the default
729 implementation just closes this type.
731 2001-12-28 Ravi Pratap <ravi@ximian.com>
733 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
734 to PreserveSig by default. Also emit HideBySig on such methods.
736 Basically, set the defaults to standard values.
738 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
739 argument, if candidate is better, it can't be worse than the best !
741 (Invocation): Re-write bits to differentiate between methods being
742 applicable in their expanded form and their normal form - for params
745 Get rid of use_standard everywhere as only standard conversions are allowed
746 in overload resolution.
748 More spec conformance.
750 2001-12-27 Miguel de Icaza <miguel@ximian.com>
752 * driver.cs: Add --timestamp, to see where the compiler spends
755 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
756 `this' in static code.
758 (SimpleName.DoResolve): Implement in terms of a helper function
759 that allows static-references to be passed upstream to
762 (Expression.ResolveWithSimpleName): Resolve specially simple
763 names when called by MemberAccess to implement the special
766 (Expression.ImplicitReferenceConversion): Handle conversions from
767 Null to reference types before others, as Null's type is
770 * expression.cs (Invocation.EmitCall): Handle the special case of
771 calling methods declared on a reference type from a ValueType
772 (Base classes System.Object and System.Enum)
774 (MemberAccess.Resolve): Only perform lookups on Enumerations if
775 the left hand side is a TypeExpr, not on every enumeration.
777 (Binary.Resolve): If types are reference types, then do a cast to
778 object on operators != and == of both arguments.
780 * typemanager.cs (FindMembers): Extract instance and static
781 members if requested.
783 * interface.cs (PopulateProperty): Use void_type instead of null
784 as the return type for the setter method.
786 (PopulateIndexer): ditto.
788 2001-12-27 Ravi Pratap <ravi@ximian.com>
790 * support.cs (ReflectionParameters): Fix minor bug where we
791 were examining the wrong parameter for the ParamArray attribute.
793 Cope with requests for the type of the parameter at position
794 greater than the params parameter's. We now return the element
795 type of the params array as that makes more sense.
797 * expression.cs (Invocation.IsParamsMethodApplicable): Update
798 accordingly as we no longer have to extract the element type
801 (Invocation.OverloadResolve): Update.
803 2001-12-27 Miguel de Icaza <miguel@ximian.com>
805 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
806 against IEnumerator, test whether the return value is a descendant
807 of the IEnumerator interface.
809 * class.cs (Indexer.Define): Use an auxiliary method to implement
810 the other bits of the method definition. Begin support for
811 explicit interface implementation.
813 (Property.DefineMethod): Use TypeManager.void_type instead of null
814 for an empty return value.
816 2001-12-26 Miguel de Icaza <miguel@ximian.com>
818 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
819 dealing with a FieldExpr which is composed of a FieldBuilder, in
820 the code path we did extract the constant, but we should have
821 obtained the underlying value to be able to cast it (otherwise we
822 end up in an infinite loop, this is what Ravi was running into).
824 (ArrayCreation.UpdateIndices): Arrays might be empty.
826 (MemberAccess.ResolveMemberAccess): Add support for section
827 14.5.4.1 that deals with the special case of E.I when E is a type
828 and something else, that I can be a reference to a static member.
830 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
831 handle a particular array type to create byte blobs, it is just
832 something we dont generate byteblobs for.
834 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
837 * location.cs (Push): remove the key from the hashtable that we
838 are about to add. This happens for empty files.
840 * driver.cs: Dispose files after we have parsed them.
842 (tokenize): new function that only runs the tokenizer on its
843 input, for speed testing.
845 2001-12-26 Ravi Pratap <ravi@ximian.com>
847 * class.cs (Event.Define): Define the private field only if there
848 are no accessors defined.
850 * expression.cs (ResolveMemberAccess): If there is no associated
851 field with the event, that means we have an event defined with its
852 own accessors and we should flag error cs0070 since transforming
853 ourselves into a field is not valid in that case.
855 * ecore.cs (SimpleName.DoResolve): Same as above.
857 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
858 and charset to sane values.
860 2001-12-25 Ravi Pratap <ravi@ximian.com>
862 * assign.cs (DoResolve): Perform check on events only if they
863 are being accessed outside the declaring type.
865 * cs-parser.jay (event_declarations): Update rules to correctly
866 set the type of the implicit parameter etc.
868 (add_accessor, remove_accessor): Set current local parameters.
870 * expression.cs (Binary): For delegate addition and subtraction,
871 cast the return value from the method into the appropriate delegate
874 2001-12-24 Ravi Pratap <ravi@ximian.com>
876 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
877 of these as the workaround is unnecessary.
879 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
880 delegate data - none of that is needed at all.
882 Re-write bits to extract the instance expression and the delegate method
885 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
888 * attribute.cs (ApplyAttributes): New method to take care of common tasks
889 of attaching attributes instead of duplicating code everywhere.
891 * everywhere : Update code to do attribute emission using the above method.
893 2001-12-23 Miguel de Icaza <miguel@ximian.com>
895 * expression.cs (IsParamsMethodApplicable): if there are not
896 parameters, return immediately.
898 * ecore.cs: The 0 literal can be implicity converted to an enum
901 (SimpleName.DoResolve): First lookup the type, then lookup the
904 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
905 want to get its address. If the InstanceExpression is not
906 addressable, store the result in a temporary variable, then get
909 * codegen.cs: Only display 219 errors on warning level or above.
911 * expression.cs (ArrayAccess): Make it implement the
912 IMemoryLocation interface.
914 (Binary.DoResolve): handle the operator == (object a, object b)
915 and operator != (object a, object b) without incurring into a
916 BoxedCast (because 5 != o should never be performed).
918 Handle binary enumerator operators.
920 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
921 value type, otherwise use Ldelem_ref.
923 Use precomputed names;
925 (AddressOf): Implement address of
927 * cs-parser.jay (labeled_statement): Fix recursive block
928 addition by reworking the production.
930 * expression.cs (New.DoEmit): New has a special case:
932 If we are dealing with a ValueType, we have a few
933 situations to deal with:
935 * The target of New is a ValueType variable, that is
936 easy, we just pass this as the variable reference
938 * The target of New is being passed as an argument,
939 to a boxing operation or a function that takes a
942 In this case, we need to create a temporary variable
943 that is the argument of New.
946 2001-12-23 Ravi Pratap <ravi@ximian.com>
948 * rootcontext.cs (LookupType): Check that current_type is not null before
949 going about looking at nested types.
951 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
952 not implement the IAssignMethod interface any more.
954 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
955 where we tranform them into FieldExprs if they are being resolved from within
958 * ecore.cs (SimpleName.DoResolve): Do the same here.
960 * assign.cs (DoResolve, Emit): Clean up code considerably.
962 * ../errors/bug10.cs : Add.
964 * ../errors/cs0070.cs : Add.
966 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
968 * assign.cs : Get rid of EventIsLocal everywhere.
970 2001-12-23 Miguel de Icaza <miguel@ximian.com>
972 * ecore.cs (ConvertIntLiteral): finished the implementation.
974 * statement.cs (SwitchLabel): Convert the value we are using as a
975 key before looking up the table.
977 2001-12-22 Miguel de Icaza <miguel@ximian.com>
979 * codegen.cs (EmitTopBlock): Require a Location argument now.
981 * cs-parser.jay (constructor_declarator): We need to setup
982 current_local_parameters before we parse the
983 opt_constructor_initializer, to allow the variables to be bound
984 to the constructor arguments.
986 * rootcontext.cs (LookupType): First lookup nested classes in our
987 class and our parents before we go looking outside our class.
989 * expression.cs (ConstantFold): Extract/debox the values at the
992 * rootcontext.cs (EmitCode): Resolve the constants first before we
993 resolve the types. This is not really needed, but it helps debugging.
995 * statement.cs: report location.
997 * cs-parser.jay: pass location to throw statement.
999 * driver.cs: Small bug fix.
1001 * report.cs: Updated format to be 4-zero filled digits.
1003 2001-12-22 Ravi Pratap <ravi@ximian.com>
1005 * expression.cs (CheckIndices): Fix minor bug where the wrong
1006 variable was being referred to ;-)
1008 (DoEmit): Do not call EmitStaticInitializers when the
1009 underlying type is System.Object.
1011 2001-12-21 Ravi Pratap <ravi@ximian.com>
1013 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
1014 and do the usual workaround for SRE.
1016 * class.cs (MyEventBuilder.EventType): New member to get at the type
1017 of the event, quickly.
1019 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
1021 * assign.cs (Assign.DoResolve): Handle the case when the target
1022 is an EventExpr and perform the necessary checks.
1024 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
1027 (SimpleName.MemberStaticCheck): Include check for EventExpr.
1029 (EventExpr): Set the type in the constructor itself since we
1030 are meant to be born fully resolved.
1032 (EventExpr.Define): Revert code I wrote earlier.
1034 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
1035 instance expression is null. The instance expression is a This in that case
1036 or a null, depending on whether it is a static method or not.
1038 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
1039 refers to more than one method.
1041 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
1042 and accordingly flag errors.
1044 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1046 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
1048 2001-12-22 Miguel de Icaza <miguel@ximian.com>
1050 * location.cs (ToString): Provide useful rutine.
1052 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1054 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
1055 objects, return the actual integral boxed.
1057 * statement.cs (SwitchLabel): define an ILLabel for each
1060 (Switch.CheckSwitch): If the value is a Literal, extract
1061 the underlying literal.
1063 Also in the unused hashtable we had, add the SwitchLabel so we can
1064 quickly look this value up.
1066 * constant.cs: Implement a bunch of new constants. Rewrite
1067 Literal based on this. Made changes everywhere to adapt to this.
1069 * expression.cs (Expression.MakeByteBlob): Optimize routine by
1070 dereferencing array only once, and also copes with enumrations.
1072 bytes are two bytes wide, not one.
1074 (Cast): Perform constant conversions.
1076 * ecore.cs (TryImplicitIntConversion): Return literals instead of
1077 wrappers to the literals here.
1079 * expression.cs (DoNumericPromotions): long literals can converted
1080 to ulong implicity (this is taken care of elsewhere, but I was
1083 * ecore.cs (Expression.Literalize): Make the return type Literal,
1084 to improve type checking.
1086 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
1088 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1090 * literal.cs: Revert code from ravi that checked the bounds. The
1091 bounds are sane by the definition of the type itself.
1093 * typemanager.cs: Fix implementation of ImplementsInterface. We
1094 need to actually look up in our parent hierarchy for interfaces
1097 * const.cs: Use the underlying type for enumerations
1099 * delegate.cs: Compute the basename for the delegate creation,
1100 that should fix the delegate test case, and restore the correct
1101 Type Lookup semantics in rootcontext
1103 * rootcontext.cs: Revert Ravi's last patch. The correct way of
1104 referencing a nested type with the Reflection API is using the "+"
1107 * cs-parser.jay: Do not require EOF token at the end.
1109 2001-12-20 Ravi Pratap <ravi@ximian.com>
1111 * rootcontext.cs (LookupType): Concatenate type names with
1112 a '.' instead of a '+' The test suite passes again.
1114 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
1115 field of the enumeration.
1117 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
1118 the case when the member is an EventExpr.
1120 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
1121 static has an associated instance expression.
1123 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
1125 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
1127 * class.cs (Event.Define): Register event and perform appropriate checks
1130 We define the Add and Remove methods even if the use provides none because
1131 in that case, we provide default implementations ourselves.
1133 Define a private field of the type of the event. This is done by the CSC compiler
1134 and we should be doing it too ;-)
1136 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
1137 More methods we use in code we generate.
1139 (multicast_delegate_type, delegate_type): Two separate types since the distinction
1142 (InitCoreTypes): Update accordingly for the above.
1144 * class.cs (Event.Emit): Generate code for default accessors that we provide
1146 (EmitDefaultMethod): Do the job in the above.
1148 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
1151 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1153 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
1154 builders even if we were missing one.
1156 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
1157 pass the Basename as our class name instead of the Name. The
1158 basename will be correctly composed for us.
1160 * parameter.cs (Paramters): Now takes a Location argument.
1162 * decl.cs (DeclSpace.LookupType): Removed convenience function and
1163 make all the code call directly LookupType in RootContext and take
1164 this chance to pass the Location information everywhere.
1166 * Everywhere: pass Location information.
1168 2001-12-19 Miguel de Icaza <miguel@ximian.com>
1170 * class.cs (Constructor.Define): Updated way of detecting the
1171 length of the parameters.
1173 (TypeContainer.DefineType): Use basename as the type name for
1176 (TypeContainer.Define): Do not recursively define types here, as
1177 definition is taken care in order by the RootContext.
1179 * tree.cs: Keep track of namespaces in a per-file basis.
1181 * parameter.cs (Parameter.ComputeSignature): Update to use
1184 (Parameters.GetSignature): ditto.
1186 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
1187 instead of a TypeContainer.
1189 (Interface.SemanticAnalysis): Use `this' instead of our parent to
1190 resolve names. Because we need to be resolve in our context, not
1193 * driver.cs: Implement response files.
1195 * class.cs (TypeContainer.DefineType): If we are defined, do not
1198 (Event.Emit): Emit the code for add/remove handlers.
1199 (Event.Define): Save the MethodBuilders for add/remove.
1201 * typemanager.cs: Use pair here too.
1203 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
1204 DictionaryEntry requires the first argument to be non-null.
1206 (enum_declaration): Compute full name for registering the
1209 (delegate_declaration): Instead of using
1210 formal_parameter_list, use opt_formal_parameter_list as the list
1213 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
1214 (EventParsing): New property that controls whether `add' and
1215 `remove' are returned as tokens or identifiers (for events);
1217 2001-12-19 Ravi Pratap <ravi@ximian.com>
1219 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
1220 use MyEventBuilder only and let it wrap the real builder for us.
1222 (MyEventBuilder): Revamp constructor etc.
1224 Implement all operations that we perform on EventBuilder in precisely the same
1227 (FindMembers): Update to use the EventBuilder member.
1229 (Event.Emit): Update accordingly.
1231 2001-12-18 Ravi Pratap <ravi@ximian.com>
1233 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
1234 by calling the appropriate methods.
1236 (GetCustomAttributes): Make stubs as they cannot possibly do anything
1239 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
1241 2001-12-17 Ravi Pratap <ravi@ximian.com>
1243 * delegate.cs (Delegate.Populate): Check that the return type
1244 and various parameters types are indeed accessible.
1246 * class.cs (Constructor.Define): Same here.
1248 (Field.Define): Ditto.
1250 (Event.Define): Ditto.
1252 (Operator.Define): Check that the underlying Method defined itself
1253 correctly - so it's MethodBuilder should not be null.
1255 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
1256 expression happens to be null.
1258 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
1259 members but as of now we don't seem to be able to do anything really useful with it.
1261 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
1262 not the EventBuilder.
1264 2001-12-18 Miguel de Icaza <miguel@ximian.com>
1266 * cs-tokenizer.cs: Add support for defines.
1267 Add support for #if, #elif, #else, #endif
1269 (eval_var): evaluates a variable.
1270 (eval): stubbed for evaluating functions.
1272 * cs-parser.jay: Pass the defines information
1274 * driver.cs: Add --define command line option.
1276 * decl.cs: Move MemberCore here.
1278 Make it the base class for DeclSpace. This allows us to catch and
1279 report 108 and 109 for everything now.
1281 * class.cs (TypeContainer.Define): Extract all the members
1282 before populating and emit the warning 108 (new keyword required
1283 to override) instead of having each member implement this.
1285 (MemberCore.Define): New abstract method, we will be using this in
1286 the warning reporting engine in Populate.
1288 (Operator.Define): Adjust to new MemberCore protocol.
1290 * const.cs (Const): This does not derive from Expression, it is a
1291 temporary object we use to create fields, it is a MemberCore.
1293 * class.cs (Method.Define): Allow the entry point to be in a
1296 * driver.cs: Rewrite the argument handler to clean it up a bit.
1298 * rootcontext.cs: Made it just an auxiliary namespace feature by
1299 making everything static.
1301 * driver.cs: Adapt code to use RootContext type name instead of
1304 * delegate.cs: Remove RootContext argument.
1306 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
1309 * class.cs (Event.Define): The lookup can fail.
1311 * cs-tokenizer.cs: Begin implementation of pre-procesor.
1313 * expression.cs: Resolve the this instance before invoking the code.
1315 2001-12-17 Miguel de Icaza <miguel@ximian.com>
1317 * cs-parser.jay: Add a production in element_access that allows
1318 the thing to become a "type" reference. This way we can parse
1319 things like "(string [])" as a type.
1321 Note that this still does not handle the more complex rules of
1325 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
1327 * ecore.cs: (CopyNewMethods): new utility function used to
1328 assemble the list of methods from running FindMembers.
1330 (MemberLookup): Rework FindMembers so that
1332 2001-12-16 Miguel de Icaza <miguel@ximian.com>
1334 * class.cs (TypeContainer): Remove Delegates who fail to be
1337 * delegate.cs (Populate): Verify that we dont get null return
1338 values. TODO: Check for AsAccessible.
1340 * cs-parser.jay: Use basename to emit error 574 (destructor should
1341 have the same name as container class), not the full name.
1343 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
1344 possible representation.
1346 Also implements integer type suffixes U and L.
1348 2001-12-15 Miguel de Icaza <miguel@ximian.com>
1350 * expression.cs (ArrayCreation.DoResolve): We need to do the
1351 argument resolution *always*.
1353 * decl.cs: Make this hold the namespace. Hold the root context as
1355 (LookupType): Move here.
1357 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
1359 * location.cs (Row, Name): Fixed the code, it was always returning
1360 references to the first file.
1362 * interface.cs: Register properties defined through interfaces.
1364 * driver.cs: Add support for globbing on the command line
1366 * class.cs (Field): Make it derive from MemberCore as well.
1369 2001-12-15 Ravi Pratap <ravi@ximian.com>
1371 * class.cs (Event::Define): Check that the type of the event is a delegate
1372 type else flag error #66.
1374 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
1377 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
1378 values of EntryPoint, CharSet etc etc.
1380 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
1382 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
1383 be null and we should ignore this. I am not sure if this is really clean. Apparently,
1384 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
1385 which needs this to do its work.
1387 * ../errors/cs0066.cs : Add.
1389 2001-12-14 Miguel de Icaza <miguel@ximian.com>
1391 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
1394 * class.cs: (MethodSignature.MethodSignature): Removed hack that
1395 clears out the parameters field.
1396 (MemberSignatureCompare): Cleanup
1398 (MemberCore): New base class used to share code between MethodCore
1401 (RegisterRequiredImplementations) BindingFlags.Public requires
1402 either BindingFlags.Instace or Static. Use instance here.
1404 (Property): Refactored code to cope better with the full spec.
1406 * parameter.cs (GetParameterInfo): Return an empty array instead
1409 * class.cs (Property): Abstract or extern properties have no bodies.
1411 * parameter.cs (GetParameterInfo): return a zero-sized array.
1413 * class.cs (TypeContainer.MethodModifiersValid): Move all the
1414 method modifier validation to the typecontainer so we can reuse
1417 (MethodCore.ParameterTypes): return an empty sized array of types.
1419 (Property.Define): Test property modifier validity.
1421 Add tests for sealed/override too.
1423 (Method.Emit): abstract or extern methods have no bodies.
1425 2001-12-14 Ravi Pratap <ravi@ximian.com>
1427 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
1430 (Method::Define, ::Emit): Modify accordingly.
1432 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
1434 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
1436 * makefile: Pass in /unsafe.
1438 2001-12-13 Miguel de Icaza <miguel@ximian.com>
1440 * class.cs (MakeKey): Kill routine.
1442 * class.cs (TypeContainer.Define): Correctly define explicit
1443 method implementations (they require the full interface name plus
1446 * typemanager.cs: Deply the PtrHashtable here and stop using the
1447 lame keys. Things work so much better.
1449 This of course broke everyone who depended on `RegisterMethod' to
1450 do the `test for existance' test. This has to be done elsewhere.
1452 * support.cs (PtrHashtable): A hashtable that avoid comparing with
1453 the object stupid Equals method (because, that like fails all over
1454 the place). We still do not use it.
1456 * class.cs (TypeContainer.SetRequiredInterface,
1457 TypeContainer.RequireMethods): Killed these two routines and moved
1458 all the functionality to RegisterRequiredImplementations.
1460 (TypeContainer.RegisterRequiredImplementations): This routine now
1461 registers all the implementations required in an array for the
1462 interfaces and abstract methods. We use an array of structures
1463 which can be computed ahead of time to reduce memory usage and we
1464 also assume that lookups are cheap as most classes will not
1465 implement too many interfaces.
1467 We also avoid creating too many MethodSignatures.
1469 (TypeContainer.IsInterfaceMethod): Update and optionally does not
1470 clear the "pending" bit if we find that there are problems with
1473 (TypeContainer.VerifyPendingMethods): Update to report errors of
1474 methods that look like implementations but are not.
1476 (TypeContainer.Define): Add support for explicit interface method
1479 2001-12-12 Miguel de Icaza <miguel@ximian.com>
1481 * typemanager.cs: Keep track of the parameters here instead of
1482 being a feature of the TypeContainer.
1484 * class.cs: Drop the registration of parameters here, as
1485 InterfaceMethods are also interface declarations.
1487 * delegate.cs: Register methods with the TypeManager not only with
1488 the TypeContainer. This code was buggy.
1490 * interface.cs: Full registation here.
1492 2001-12-11 Miguel de Icaza <miguel@ximian.com>
1494 * expression.cs: Remove reducer for binary expressions, it can not
1497 * const.cs: Put here the code that used to go into constant.cs
1499 * constant.cs: Put here the code for constants, this is a new base
1502 * literal.cs: Make Literal derive from Constant.
1504 2001-12-09 Miguel de Icaza <miguel@ximian.com>
1506 * statement.cs (Return.Emit): Report error 157 if the user
1507 attempts to return from a finally block.
1509 (Return.Emit): Instead of emitting a return, jump to the end of
1512 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
1513 LocalBuilder to store the result of the function. ReturnLabel is
1514 the target where we jump.
1517 2001-12-09 Radek Doulik <rodo@ximian.com>
1519 * cs-parser.jay: remember alias in current namespace
1521 * ecore.cs (SimpleName::DoResolve): use aliases for types or
1524 * class.cs (LookupAlias): lookup alias in my_namespace
1526 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
1528 (LookupAlias): lookup alias in this and if needed in parent
1531 2001-12-08 Miguel de Icaza <miguel@ximian.com>
1535 * rootcontext.cs: (ModuleBuilder) Made static, first step into
1536 making things static. I need this to avoid passing the
1537 TypeContainer when calling ParameterType.
1539 * support.cs (InternalParameters.ParameterType): Remove ugly hack
1540 that did string manipulation to compute the type and then call
1541 GetType. Use Parameter.ParameterType instead.
1543 * cs-tokenizer.cs: Consume the suffix for floating values.
1545 * expression.cs (ParameterReference): figure out whether this is a
1546 reference parameter or not. Kill an extra variable by computing
1547 the arg_idx during emission.
1549 * parameter.cs (Parameters.GetParameterInfo): New overloaded
1550 function that returns whether a parameter is an out/ref value or not.
1552 (Parameter.ParameterType): The type of the parameter (base,
1553 without ref/out applied).
1555 (Parameter.Resolve): Perform resolution here.
1556 (Parameter.ExternalType): The full type (with ref/out applied).
1558 * statement.cs (Using.Emit, Using.EmitExpression): Implement
1559 support for expressions on the using statement.
1561 2001-12-07 Miguel de Icaza <miguel@ximian.com>
1563 * statement.cs (Using.EmitLocalVariableDecls): Split the
1564 localvariable handling of the using statement.
1566 (Block.EmitMeta): Keep track of variable count across blocks. We
1567 were reusing slots on separate branches of blocks.
1569 (Try.Emit): Emit the general code block, we were not emitting it.
1571 Check the type of the declaration to be an IDisposable or
1572 something that can be implicity converted to it.
1574 Emit conversions if required.
1576 * ecore.cs (EmptyExpression): New utility class.
1577 (Expression.ImplicitConversionExists): New utility function.
1579 2001-12-06 Miguel de Icaza <miguel@ximian.com>
1581 * statement.cs (Using): Implement.
1583 * expression.cs (LocalVariableReference): Support read only variables.
1585 * statement.cs: Remove the explicit emit for the Leave opcode.
1586 (VariableInfo): Add a readonly field.
1588 2001-12-05 Miguel de Icaza <miguel@ximian.com>
1590 * ecore.cs (ConvCast): new class used to encapsulate the various
1591 explicit integer conversions that works in both checked and
1594 (Expression.ConvertNumericExplicit): Use new ConvCast class to
1595 properly generate the overflow opcodes.
1597 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1599 * statement.cs: The correct type for the EmptyExpression is the
1600 element_type, not the variable type. Ravi pointed this out.
1602 2001-12-04 Ravi Pratap <ravi@ximian.com>
1604 * class.cs (Method::Define): Handle PInvoke methods specially
1605 by using DefinePInvokeMethod instead of the usual one.
1607 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
1608 above to do the task of extracting information and defining the method.
1610 2001-12-04 Ravi Pratap <ravi@ximian.com>
1612 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
1613 of the condition for string type.
1615 (Emit): Move that here.
1617 (ArrayCreation::CheckIndices): Keep string literals in their expression
1620 (EmitDynamicInitializers): Handle strings appropriately.
1622 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1624 * codegen.cs (EmitContext): Replace multiple variables with a
1625 single pointer to the current Switch statement.
1627 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
1630 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1634 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
1637 (Foreach.Emit): Foreach on arrays was not setting
1638 up the loop variables (for break/continue).
1640 (GotoCase): Semi-implented.
1642 2001-12-03 Ravi Pratap <ravi@ximian.com>
1644 * attribute.cs (CheckAttribute): Handle system attributes by using
1645 Attribute.GetAttributes to examine information we need.
1647 (GetValidPlaces): Same here.
1649 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
1651 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
1653 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
1655 (Method::Define): Set appropriate flags if we have a DllImport attribute.
1657 (Method::Emit): Handle the case when we are a PInvoke method.
1659 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1661 * expression.cs: Use ResolveWithSimpleName on compound names.
1663 2001-12-02 Ravi Pratap <ravi@ximian.com>
1665 * constant.cs (EmitConstant): Make sure we resolve the associated expression
1666 before trying to reduce it.
1668 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
1670 * constant.cs (LookupConstantValue): Implement.
1672 (EmitConstant): Use the above in emitting the constant.
1674 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
1675 that are user-defined by doing a LookupConstantValue on them.
1677 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
1680 2001-11-29 Miguel de Icaza <miguel@ximian.com>
1682 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
1684 (BaseAccess.DoResolve): Implement.
1686 (MemberAccess.DoResolve): Split this routine into a
1687 ResolveMemberAccess routine that can be used independently
1689 2001-11-28 Miguel de Icaza <miguel@ximian.com>
1691 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
1692 As that share bits of the implementation. Is returns a boolean,
1693 while As returns the Type that is being probed.
1695 2001-12-01 Ravi Pratap <ravi@ximian.com>
1697 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
1698 instead of a Literal - much easier.
1700 (EnumInTransit): Remove - utterly useless :-)
1702 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
1704 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
1706 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
1707 chain when we have no associated expression.
1709 2001-11-30 Ravi Pratap <ravi@ximian.com>
1711 * constant.cs (Define): Use Location while reporting the errror.
1713 Also emit a warning when 'new' is used and there is no inherited
1716 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
1719 (LookupEnumValue): Implement to lookup an enum member's value and define it
1722 (Populate): Re-write accordingly to use the above routine.
1724 2001-11-27 Miguel de Icaza <miguel@ximian.com>
1726 * expression.cs (This): Fix prototype for DoResolveLValue to
1727 override the base class DoResolveLValue.
1729 * cs-parser.cs: Report errors cs574 and cs575 (destructor
1732 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
1733 (we need to load the address of the field here). This fixes
1736 (FieldExpr.DoResolveLValue): Call the DoResolve
1737 function to initialize the Instance expression.
1739 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
1740 correctly the GetEnumerator operation on a value type.
1742 * cs-parser.jay: Add more simple parsing error catches.
1744 * statement.cs (Switch): Add support for string switches.
1745 Handle null specially.
1747 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
1749 2001-11-28 Ravi Pratap <ravi@ximian.com>
1751 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
1753 (declare_local_constant): New helper function.
1755 * statement.cs (AddConstant): Keep a separate record of constants
1757 (IsConstant): Implement to determine if a variable is a constant.
1759 (GetConstantExpression): Implement.
1761 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
1763 * statement.cs (IsVariableDefined): Re-write.
1765 2001-11-27 Ravi Pratap <ravi@ximian.com>
1767 * class.cs (TypeContainer::FindMembers): Look for constants
1768 in the case when we are looking for MemberTypes.Field
1770 * expression.cs (MemberAccess::DoResolve): Check that in the
1771 case we are a FieldExpr and a Literal, we are not being accessed
1772 by an instance reference.
1774 * cs-parser.jay (local_constant_declaration): Implement.
1776 (declaration_statement): Implement for constant declarations.
1778 2001-11-26 Miguel de Icaza <miguel@ximian.com>
1780 * statement.cs (Switch): Catch double defaults.
1782 (Switch): More work on the switch() statement
1783 implementation. It works for integral values now, need to finish
1787 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1789 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
1790 integer literals into other integer literals. To be used by
1793 2001-11-24 Ravi Pratap <ravi@ximian.com>
1795 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
1798 (EmitDynamicInitializers): Cope with the above since we extract data
1799 directly from ArrayData now.
1801 (ExpectInitializers): Keep track of whether initializers are mandatory
1804 (Bounds): Make it a hashtable to prevent the same dimension being
1805 recorded for every element in that dimension.
1807 (EmitDynamicInitializers): Fix bug which prevented the Set array method
1810 Also fix bug which was causing the indices to be emitted in the reverse
1813 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1815 * expression.cs (ArrayCreation): Implement the bits that Ravi left
1816 unfinished. They do not work, because the underlying code is
1819 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1821 * cs-parser.jay: Remove bogus fixme.
1823 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
1824 on Switch statement.
1826 2001-11-23 Ravi Pratap <ravi@ximian.com>
1828 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
1831 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
1832 parameter. Apparently, any expression is allowed.
1834 (ValidateInitializers): Update accordingly.
1836 (CheckIndices): Fix some tricky bugs thanks to recursion.
1838 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
1839 I was being completely brain-dead.
1841 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
1842 and re-write acordingly.
1844 (DelegateInvocation): Re-write accordingly.
1846 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
1848 (MakeByteBlob): Handle types more correctly.
1850 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
1851 initialization from expressions but it is incomplete because I am a complete
1854 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1856 * statement.cs (If.Emit): Fix a bug that generated incorrect code
1857 on If. Basically, we have to return `true' (ie, we do return to
1858 our caller) only if both branches of the if return.
1860 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
1861 short-circuit operators, handle them as short circuit operators.
1863 (Cast.DoResolve): Resolve type.
1864 (Cast.Cast): Take an expression as the target type.
1866 * cs-parser.jay (cast_expression): Remove old hack that only
1867 allowed a limited set of types to be handled. Now we take a
1868 unary_expression and we resolve to a type during semantic
1871 Use the grammar productions from Rhys to handle casts (this is
1872 not complete like Rhys syntax yet, we fail to handle that corner
1873 case that C# has regarding (-x), but we will get there.
1875 2001-11-22 Ravi Pratap <ravi@ximian.com>
1877 * class.cs (EmitFieldInitializer): Take care of the case when we have a
1878 field which is an array type.
1880 * cs-parser.jay (declare_local_variables): Support array initialization too.
1882 * typemanager.cs (MakeKey): Implement.
1884 (everywhere): Use the above appropriately.
1886 * cs-parser.jay (for_statement): Update for array initialization while
1887 declaring variables.
1889 * ecore.cs : The error message was correct, it's the variable's names that
1890 were misleading ;-) Make the code more readable.
1892 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
1893 the correct type etc.
1895 (ConvertExplicit): Handle Enum types by examining the underlying type.
1897 2001-11-21 Ravi Pratap <ravi@ximian.com>
1899 * parameter.cs (GetCallingConvention): Always return
1900 CallingConventions.Standard for now.
1902 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1904 * expression.cs (Binary.ResolveOperator): Update the values of `l'
1905 and `r' after calling DoNumericPromotions.
1907 * ecore.cs: Fix error message (the types were in the wrong order).
1909 * statement.cs (Foreach.ProbeCollectionType): Need to pass
1910 BindingFlags.Instance as well
1912 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
1913 implicit int literal conversion in an empty cast so that we
1914 propagate the right type upstream.
1916 (UnboxCast): new class used to unbox value types.
1917 (Expression.ConvertExplicit): Add explicit type conversions done
1920 (Expression.ImplicitNumericConversion): Oops, forgot to test for
1921 the target type before applying the implicit LongLiterals to ULong
1924 2001-11-21 Miguel de Icaza <miguel@ximian.com>
1926 * cs-parser.jay (for_statement): Reworked the way For works: now
1927 we declare manually any variables that are introduced in
1928 for_initializer to solve the problem of having out-of-band code
1929 emition (that is what got for broken).
1931 (declaration_statement): Perform the actual variable declaration
1932 that used to be done in local_variable_declaration here.
1934 (local_variable_declaration): Do not declare anything, just pass
1935 the information on a DictionaryEntry
1937 2001-11-20 Ravi Pratap <ravi@ximian.com>
1939 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
1940 re-write of the logic to now make it recursive.
1942 (UpdateIndices): Re-write accordingly.
1944 Store element data in a separate ArrayData list in the above methods.
1946 (MakeByteBlob): Implement to dump the array data into a byte array.
1948 2001-11-19 Ravi Pratap <ravi@ximian.com>
1950 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
1953 * constant.cs (Define): Implement.
1955 (EmitConstant): Re-write fully.
1957 Pass in location info.
1959 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
1962 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
1963 DictionaryEntry since we need location info too.
1965 (constant_declaration): Update accordingly.
1967 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
1968 code into another method : UpdateIndices.
1970 2001-11-18 Ravi Pratap <ravi@ximian.com>
1972 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
1973 some type checking etc.
1975 2001-11-17 Ravi Pratap <ravi@ximian.com>
1977 * expression.cs (ArrayCreation::ValidateInitializers): Implement
1978 bits to provide dimension info if the user skips doing that.
1980 Update second constructor to store the rank correctly.
1982 2001-11-16 Ravi Pratap <ravi@ximian.com>
1984 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
1985 and try to implement.
1987 * ../errors/cs0150.cs : Add.
1989 * ../errors/cs0178.cs : Add.
1991 2001-11-16 Miguel de Icaza <miguel@ximian.com>
1993 * statement.cs: Implement foreach on multi-dimensional arrays.
1995 * parameter.cs (Parameters.GetParameterByName): Also lookup the
1996 name of the params argument.
1998 * expression.cs: Use EmitStoreOpcode to get the right opcode while
1999 initializing the array.
2001 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
2002 we can use this elsewhere.
2004 * statement.cs: Finish implementation of foreach for single
2007 * cs-parser.jay: Use an out-of-band stack to pass information
2008 around, I wonder why I need this.
2010 foreach_block: Make the new foreach_block the current_block.
2012 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
2013 function used to return a static Parameters structure. Used for
2014 empty parameters, as those are created very frequently.
2016 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
2018 2001-11-15 Ravi Pratap <ravi@ximian.com>
2020 * interface.cs : Default modifier is private, not public. The
2021 make verify test passes again.
2023 2001-11-15 Ravi Pratap <ravi@ximian.com>
2025 * support.cs (ReflectionParameters): Fix logic to determine
2026 whether the last parameter is a params one. Test 9 passes again.
2028 * delegate.cs (Populate): Register the builders we define with
2029 RegisterParameterForBuilder. Test 19 passes again.
2031 * cs-parser.jay (property_declaration): Reference $6 instead
2032 of $$ to get at the location.
2034 (indexer_declaration): Similar stuff.
2038 * class.cs (Property): Register parameters for the Get and Set methods
2039 if they exist. Test 23 passes again.
2041 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
2042 call to EmitArguments as we are sure there aren't any params arguments.
2043 Test 32 passes again.
2045 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
2046 IndexOutOfRangeException.
2048 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
2049 Test 33 now passes again.
2051 2001-11-15 Miguel de Icaza <miguel@ximian.com>
2053 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
2054 broke a bunch of things. Will have to come up with a better way
2055 of tracking locations.
2057 * statement.cs: Implemented foreach for single dimension arrays.
2059 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2061 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
2062 an error. This removes the lookup from the critical path.
2064 * cs-parser.jay: Removed use of temporary_loc, which is completely
2067 2001-11-14 Miguel de Icaza <miguel@ximian.com>
2069 * support.cs (ReflectionParameters.ParameterModifier): Report
2070 whether the argument is a PARAMS argument or not.
2072 * class.cs: Set the attribute `ParamArrayAttribute' on the
2075 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
2076 and cons_param_array_attribute (ConstructorInfo for
2077 ParamArrayAttribute).,
2079 * codegen.cs: Emit the return using the `Return' statement, that
2080 way we can report the error correctly for missing return values.
2082 * class.cs (Method.Emit): Clean up.
2084 * expression.cs (Argument.Resolve): Take another argument: the
2085 location where this argument is used. Notice that this is not
2086 part of the "Argument" class as to reduce the size of the
2087 structure (we know the approximate location anyways).
2089 Test if the argument is a variable-reference, if not, then
2090 complain with a 206.
2092 (Argument.Emit): Emit addresses of variables.
2094 (Argument.FullDesc): Simplify.
2096 (Invocation.DoResolve): Update for Argument.Resolve.
2098 (ElementAccess.DoResolve): ditto.
2100 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
2101 method should be virtual, as this method is always virtual.
2103 (NewDelegate.DoResolve): Update for Argument.Resolve.
2105 * class.cs (ConstructorInitializer.DoResolve): ditto.
2107 * attribute.cs (Attribute.Resolve): ditto.
2109 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2111 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
2113 * expression.cs (ParameterReference): Drop IStackStorage and implement
2114 IAssignMethod instead.
2116 (LocalVariableReference): ditto.
2118 * ecore.cs (FieldExpr): Drop IStackStorage and implement
2119 IAssignMethod instead.
2121 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2123 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
2124 enumerations that are used in heavily used structures derive from
2125 byte in a laughable and pathetic attempt to reduce memory usage.
2126 This is the kind of pre-optimzations that you should not do at
2127 home without adult supervision.
2129 * expression.cs (UnaryMutator): New class, used to handle ++ and
2130 -- separatedly from the other unary operators. Cleans up the
2131 code, and kills the ExpressionStatement dependency in Unary.
2133 (Unary): Removed `method' and `Arguments' from this class, making
2134 it smaller, and moving it all to SimpleCall, so I can reuse this
2135 code in other locations and avoid creating a lot of transient data
2136 strucutres when not required.
2138 * cs-parser.jay: Adjust for new changes.
2140 2001-11-11 Miguel de Icaza <miguel@ximian.com>
2142 * enum.cs (Enum.Populate): If there is a failure during
2145 * cs-parser.jay (opt_enum_base): we used to catch type errors
2146 here, but this is really incorrect. The type error should be
2147 catched during semantic analysis.
2149 2001-12-11 Ravi Pratap <ravi@ximian.com>
2151 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
2152 current_local_parameters as expected since I, in my stupidity, had forgotten
2155 * attribute.cs (GetValidPlaces): Fix stupid bug.
2157 * class.cs (Method::Emit): Perform check on applicability of attributes.
2159 (Constructor::Emit): Ditto.
2161 (Field::Emit): Ditto.
2163 (Field.Location): Store location information.
2165 (Property, Event, Indexer, Operator): Ditto.
2167 * cs-parser.jay (field_declaration): Pass in location for each field.
2169 * ../errors/cs0592.cs : Add.
2171 2001-11-12 Ravi Pratap <ravi@ximian.com>
2173 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
2175 (InitCoreTypes): Update accordingly.
2177 (RegisterAttrType, LookupAttr): Implement.
2179 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
2180 info about the same.
2182 (Resolve): Update to populate the above as necessary.
2186 (GetValidPlaces): Helper to the above.
2188 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
2190 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
2192 2001-11-12 Ravi Pratap <ravi@ximian.com>
2194 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
2196 * ../errors/cs0617.cs : Add.
2198 2001-11-11 Ravi Pratap <ravi@ximian.com>
2200 * enum.cs (Emit): Rename to Populate to be more consistent with what
2201 we expect it to do and when exactly it is called.
2203 * class.cs, rootcontext.cs : Update accordingly.
2205 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
2206 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
2208 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
2210 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
2211 of a fieldinfo using the above, when dealing with a FieldBuilder.
2213 2001-11-10 Ravi Pratap <ravi@ximian.com>
2215 * ../errors/cs0031.cs : Add.
2217 * ../errors/cs1008.cs : Add.
2219 * ../errrors/cs0543.cs : Add.
2221 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
2224 (FindMembers): Implement.
2226 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
2227 enums and delegates too.
2229 (enum_types): Rename to builder_to_enum.
2231 (delegate_types): Rename to builder_to_delegate.
2233 * delegate.cs (FindMembers): Implement.
2235 2001-11-09 Ravi Pratap <ravi@ximian.com>
2237 * typemanager.cs (IsEnumType): Implement.
2239 * enum.cs (Emit): Re-write parts to account for the underlying type
2240 better and perform checking etc.
2242 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
2243 of the underlying type.
2245 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
2248 * enum.cs (error31): Helper to report error #31.
2250 * cs-parser.jay (enum_declaration): Store location of each member too.
2252 * enum.cs (member_to_location): New hashtable.
2254 (AddEnumMember): Update location hashtable.
2256 (Emit): Use the location of each member while reporting errors.
2258 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2260 * cs-parser.jay: A for_initializer if is a
2261 local_variable_declaration really ammount to have an implicit
2262 block with the variable declaration and no initializer for for.
2264 * statement.cs (For.Emit): Cope with null initializers.
2266 This fixes the infinite loop on for initializers.
2268 2001-11-08 Miguel de Icaza <miguel@ximian.com>
2270 * enum.cs: More cleanup.
2272 * ecore.cs: Remove dead code.
2274 * class.cs (Property.Emit): More simplification.
2275 (Event.Emit): ditto.
2277 Reworked to have less levels of indentation.
2279 2001-11-08 Ravi Pratap <ravi@ximian.com>
2281 * class.cs (Property): Emit attributes.
2291 * enum.cs (Emit): Ditto.
2293 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
2296 * class.cs (Field, Event, etc.): Move attribute generation into the
2297 Emit method everywhere.
2299 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
2300 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
2301 as we had no way of defining nested enums !
2303 * rootcontext.cs : Adjust code accordingly.
2305 * typemanager.cs (AddEnumType): To keep track of enum types separately.
2307 2001-11-07 Ravi Pratap <ravi@ximian.com>
2309 * expression.cs (EvalConstantExpression): Move into ecore.cs
2311 * enum.cs (Enum): Rename some members and make them public and readonly
2312 according to our convention.
2314 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
2317 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
2319 (Enum::Emit): Write a simple version for now which doesn't try to compute
2320 expressions. I shall modify this to be more robust in just a while.
2322 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
2324 (TypeContainer::CloseType): Create the Enum types too.
2326 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
2328 * expression.cs (EvalConstantExpression): Get rid of completely.
2330 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
2331 user-defined values and other cases.
2333 (IsValidEnumLiteral): Helper function.
2335 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
2336 out there in the case we had a literal FieldExpr.
2338 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
2340 (Literalize): Revamp a bit to take two arguments.
2342 (EnumLiteral): New class which derives from Literal to wrap enum literals.
2344 2001-11-06 Ravi Pratap <ravi@ximian.com>
2346 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
2348 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
2350 (Resolve): Use the above to ensure we have proper initializers.
2352 2001-11-05 Ravi Pratap <ravi@ximian.com>
2354 * expression.cs (Expression::EvalConstantExpression): New method to
2355 evaluate constant expressions.
2357 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
2359 2001-11-07 Miguel de Icaza <miguel@ximian.com>
2361 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
2364 (Binary.ResolveOperator): Handle operator != (object a, object b)
2365 and operator == (object a, object b);
2367 (Binary.DoNumericPromotions): Indicate whether the numeric
2368 promotion was possible.
2370 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
2373 Made the ArrayAccess implement interface IAssignMethod instead of
2374 IStackStore as the order in which arguments are passed reflects
2377 * assign.cs: Instead of using expr.ExprClass to select the way of
2378 assinging, probe for the IStackStore/IAssignMethod interfaces.
2380 * typemanager.cs: Load InitializeArray definition.
2382 * rootcontext.cs (RootContext.MakeStaticData): Used to define
2383 static data that can be used to initialize arrays.
2385 2001-11-05 Miguel de Icaza <miguel@ximian.com>
2387 * expression.cs: Handle operator== and operator!= for booleans.
2389 (Conditioal.Reduce): Implement reducer for the ?: operator.
2391 (Conditional.Resolve): Implement dead code elimination.
2393 (Binary.Resolve): Catch string literals and return a new
2394 concatenated string.
2396 (Unary.Reduce): Implement reduction of unary expressions.
2398 * ecore.cs: Split out the expression core handling here.
2400 (Expression.Reduce): New method used to perform constant folding
2401 and CSE. This is needed to support constant-expressions.
2403 * statement.cs (Statement.EmitBoolExpression): Pass true and false
2404 targets, and optimize for !x.
2406 2001-11-04 Ravi Pratap <ravi@ximian.com>
2408 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
2409 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
2410 set custom atttributes.
2412 * literal.cs (Literal::GetValue): New abstract method to return the actual
2413 value of the literal, cast as an object.
2415 (*Literal): Implement GetValue method.
2417 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
2418 expressions to the arraylist but objects of type Argument.
2420 * class.cs (TypeContainer::Emit): Emit our attributes too.
2422 (Method::Emit, Constructor::Emit): Ditto.
2424 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
2425 to be ignoring earlier.
2427 2001-11-03 Ravi Pratap <ravi@ximian.com>
2429 * attribute.cs (AttributeSection::Define): Implement to do the business
2430 of constructing a CustomAttributeBuilder.
2432 (Attribute): New trivial class. Increases readability of code.
2434 * cs-parser.jay : Update accordingly.
2436 (positional_argument_list, named_argument_list, named_argument): New rules
2438 (attribute_arguments): Use the above so that we are more correct.
2440 2001-11-02 Ravi Pratap <ravi@ximian.com>
2442 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
2443 to perform all checks for a method with a params parameter.
2445 (Invocation::OverloadResolve): Update to use the above method and therefore
2446 cope correctly with params method invocations.
2448 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
2451 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
2452 constructors in our parent too because we can't afford to miss out on
2455 * attribute.cs (AttributeSection): New name for the class Attribute
2457 Other trivial changes to improve readability.
2459 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
2460 use the new class names.
2462 2001-11-01 Ravi Pratap <ravi@ximian.com>
2464 * class.cs (Method::Define): Complete definition for params types too
2466 (Indexer::Define): Ditto.
2468 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
2469 Cope everywhere with a request for info about the array parameter.
2471 2001-11-01 Ravi Pratap <ravi@ximian.com>
2473 * tree.cs (RecordNamespace): Fix up to check for the correct key.
2475 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
2476 local_variable_type to extract the string corresponding to the type.
2478 (local_variable_type): Fixup the action to use the new helper method.
2480 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
2483 * expression.cs : Clean out code which uses the above.
2485 2001-10-31 Ravi Pratap <ravi@ximian.com>
2487 * typemanager.cs (RegisterMethod): Check if we already have an existing key
2488 and bale out if necessary by returning a false.
2490 (RegisterProperty): Ditto.
2492 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
2493 and print out appropriate error messages.
2495 * interface.cs (everywhere): Ditto.
2497 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
2498 location to constructor.
2500 * class.cs (Property, Event, Indexer): Update accordingly.
2502 * ../errors/cs111.cs : Added.
2504 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
2505 of a method, as laid down by the spec.
2507 (Invocation::OverloadResolve): Use the above method.
2509 2001-10-31 Ravi Pratap <ravi@ximian.com>
2511 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
2512 now take a TypeContainer and a Parameters object.
2514 (ParameterData): Modify return type of ParameterModifier method to be
2515 Parameter.Modifier and not a string.
2517 (ReflectionParameters, InternalParameters): Update accordingly.
2519 * expression.cs (Argument::GetParameterModifier): Same here.
2521 * support.cs (InternalParameters::ParameterType): Find a better way of determining
2522 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
2523 symbol in it at all so maybe this is only for now.
2525 2001-10-30 Ravi Pratap <ravi@ximian.com>
2527 * support.cs (InternalParameters): Constructor now takes an extra argument
2528 which is the actual Parameters class.
2530 (ParameterDesc): Update to provide info on ref/out modifiers.
2532 * class.cs (everywhere): Update call to InternalParameters to pass in
2533 the second argument too.
2535 * support.cs (ParameterData): Add ParameterModifier, which is a method
2536 to return the modifier info [ref/out etc]
2538 (InternalParameters, ReflectionParameters): Implement the above.
2540 * expression.cs (Argument::ParameterModifier): Similar function to return
2541 info about the argument's modifiers.
2543 (Invocation::OverloadResolve): Update to take into account matching modifiers
2546 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
2547 a new SetFormalParameters object which we pass to InternalParameters.
2549 2001-10-30 Ravi Pratap <ravi@ximian.com>
2551 * expression.cs (NewArray): Merge into the ArrayCreation class.
2553 2001-10-29 Ravi Pratap <ravi@ximian.com>
2555 * expression.cs (NewArray): Merge classes NewBuiltinArray and
2556 NewUserdefinedArray into one as there wasn't much of a use in having
2559 * expression.cs (Argument): Change field's name to ArgType from Type.
2561 (Type): New readonly property which returns the proper type, taking into
2562 account ref/out modifiers.
2564 (everywhere): Adjust code accordingly for the above.
2566 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
2567 whether we are emitting for a ref or out parameter.
2569 * expression.cs (Argument::Emit): Use the above field to set the state.
2571 (LocalVariableReference::Emit): Update to honour the flag and emit the
2574 * parameter.cs (Attributes): Set the correct flags for ref parameters.
2576 * expression.cs (Argument::FullDesc): New function to provide a full desc.
2578 * support.cs (ParameterData): Add method ParameterDesc to the interface.
2580 (ReflectionParameters, InternalParameters): Implement the above method.
2582 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
2585 (Invocation::FullMethodDesc): Ditto.
2587 2001-10-29 Miguel de Icaza <miguel@ximian.com>
2589 * cs-parser.jay: Add extra production for the second form of array
2592 * expression.cs (ArrayCreation): Update to reflect the above
2595 * Small changes to prepare for Array initialization.
2597 2001-10-28 Miguel de Icaza <miguel@ximian.com>
2599 * typemanager.cs (ImplementsInterface): interface might be null;
2600 Deal with this problem;
2602 Also, we do store negative hits on the cache (null values), so use
2603 this instead of calling t.GetInterfaces on the type everytime.
2605 2001-10-28 Ravi Pratap <ravi@ximian.com>
2607 * typemanager.cs (IsBuiltinType): New method to help determine the same.
2609 * expression.cs (New::DoResolve): Get rid of array creation code and instead
2610 split functionality out into different classes.
2612 (New::FormArrayType): Move into NewBuiltinArray.
2614 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
2617 (NewBuiltinArray): New class to handle creation of built-in arrays.
2619 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
2620 account creation of one-dimensional arrays.
2622 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
2624 (NewUserdefinedArray::DoResolve): Implement.
2626 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
2628 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
2629 we maintain inside the TypeManager. This is necessary to perform lookups on the
2632 (LookupType): Update to perform GetType on the module builders too.
2634 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
2636 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
2638 2001-10-23 Ravi Pratap <ravi@ximian.com>
2640 * expression.cs (New::DoResolve): Implement guts of array creation.
2642 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
2644 2001-10-27 Miguel de Icaza <miguel@ximian.com>
2646 * expression.cs: Fix bug I introduced lsat night that broke
2649 (Expression.Resolve): Report a 246 error (can not resolve name)
2650 if we find a SimpleName in the stream.
2652 (Expression.ResolveLValue): Ditto.
2654 (Expression.ResolveWithSimpleName): This function is a variant of
2655 ResolveName, this one allows SimpleNames to be returned without a
2656 warning. The only consumer of SimpleNames is MemberAccess
2658 2001-10-26 Miguel de Icaza <miguel@ximian.com>
2660 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
2661 might arrive here. I have my doubts that this is correct.
2663 * statement.cs (Lock): Implement lock statement.
2665 * cs-parser.jay: Small fixes to support `lock' and `using'
2667 * cs-tokenizer.cs: Remove extra space
2669 * driver.cs: New flag --checked, allows to turn on integer math
2672 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
2673 Threading.Monitor.Exit
2675 2001-10-23 Miguel de Icaza <miguel@ximian.com>
2677 * expression.cs (IndexerAccess::DoResolveLValue): Set the
2678 Expression Class to be IndexerAccess.
2680 Notice that Indexer::DoResolve sets the eclass to Value.
2682 2001-10-22 Miguel de Icaza <miguel@ximian.com>
2684 * class.cs (TypeContainer::Emit): Emit code for indexers.
2686 * assign.cs (IAssignMethod): New interface implemented by Indexers
2687 and Properties for handling assignment.
2689 (Assign::Emit): Simplify and reuse code.
2691 * expression.cs (IndexerAccess, PropertyExpr): Implement
2692 IAssignMethod, clean up old code.
2694 2001-10-22 Ravi Pratap <ravi@ximian.com>
2696 * typemanager.cs (ImplementsInterface): New method to determine if a type
2697 implements a given interface. Provides a nice cache too.
2699 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
2702 (ConvertReferenceExplicit): Ditto.
2704 * delegate.cs (Delegate::Populate): Update to define the parameters on the
2705 various methods, with correct names etc.
2707 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
2708 Operator.UnaryNegation.
2710 * cs-parser.jay (operator_declarator): Be a little clever in the case where
2711 we have a unary plus or minus operator.
2713 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
2716 * everywhere : update accordingly.
2718 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
2721 * class.cs (Method::Define): For the case where we are implementing a method
2722 inherited from an interface, we need to set the MethodAttributes.Final flag too.
2723 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
2725 2001-10-21 Ravi Pratap <ravi@ximian.com>
2727 * interface.cs (FindMembers): Implement to work around S.R.E
2730 * typemanager.cs (IsInterfaceType): Implement.
2732 (FindMembers): Update to handle interface types too.
2734 * expression.cs (ImplicitReferenceConversion): Re-write bits which
2735 use IsAssignableFrom as that is not correct - it doesn't work.
2737 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
2738 and accordingly override EmitStatement.
2740 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
2741 using the correct logic :-)
2743 2001-10-19 Ravi Pratap <ravi@ximian.com>
2745 * ../errors/cs-11.cs : Add to demonstrate error -11
2747 2001-10-17 Miguel de Icaza <miguel@ximian.com>
2749 * assign.cs (Assign::Resolve): Resolve right hand side first, and
2750 then pass this as a hint to ResolveLValue.
2752 * expression.cs (FieldExpr): Add Location information
2754 (FieldExpr::LValueResolve): Report assignment to readonly
2757 (Expression::ExprClassFromMemberInfo): Pass location information.
2759 (Expression::ResolveLValue): Add new method that resolves an
2762 (Expression::DoResolveLValue): Default invocation calls
2765 (Indexers): New class used to keep track of indexers in a given
2768 (IStackStore): Renamed from LValue, as it did not really describe
2769 what this did. Also ResolveLValue is gone from this interface and
2770 now is part of Expression.
2772 (ElementAccess): Depending on the element access type
2774 * typemanager.cs: Add `indexer_name_type' as a Core type
2775 (System.Runtime.CompilerServices.IndexerNameAttribute)
2777 * statement.cs (Goto): Take a location.
2779 2001-10-18 Ravi Pratap <ravi@ximian.com>
2781 * delegate.cs (Delegate::VerifyDelegate): New method to verify
2782 if two delegates are compatible.
2784 (NewDelegate::DoResolve): Update to take care of the case when
2785 we instantiate a delegate from another delegate.
2787 * typemanager.cs (FindMembers): Don't even try to look up members
2788 of Delegate types for now.
2790 2001-10-18 Ravi Pratap <ravi@ximian.com>
2792 * delegate.cs (NewDelegate): New class to take care of delegate
2795 * expression.cs (New): Split the delegate related code out into
2796 the NewDelegate class.
2798 * delegate.cs (DelegateInvocation): New class to handle delegate
2801 * expression.cs (Invocation): Split out delegate related code into
2802 the DelegateInvocation class.
2804 2001-10-17 Ravi Pratap <ravi@ximian.com>
2806 * expression.cs (New::DoResolve): Implement delegate creation fully
2807 and according to the spec.
2809 (New::DoEmit): Update to handle delegates differently.
2811 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
2812 because of which we were printing out arguments in reverse order !
2814 * delegate.cs (VerifyMethod): Implement to check if the given method
2815 matches the delegate.
2817 (FullDelegateDesc): Implement.
2819 (VerifyApplicability): Implement.
2821 * expression.cs (Invocation::DoResolve): Update to accordingly handle
2822 delegate invocations too.
2824 (Invocation::Emit): Ditto.
2826 * ../errors/cs1593.cs : Added.
2828 * ../errors/cs1594.cs : Added.
2830 * delegate.cs (InstanceExpression, TargetMethod): New properties.
2832 2001-10-16 Ravi Pratap <ravi@ximian.com>
2834 * typemanager.cs (intptr_type): Core type for System.IntPtr
2836 (InitCoreTypes): Update for the same.
2838 (iasyncresult_type, asynccallback_type): Ditto.
2840 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
2843 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
2846 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
2847 the builders for the 4 members of a delegate type :-)
2849 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
2852 * expression.cs (New::DoResolve): Implement guts for delegate creation.
2854 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
2856 2001-10-15 Miguel de Icaza <miguel@ximian.com>
2858 * statement.cs (Break::Emit): Implement.
2859 (Continue::Emit): Implement.
2861 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
2862 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
2863 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
2864 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
2867 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
2868 properties that track the label for the current loop (begin of the
2869 loop and end of the loop).
2871 2001-10-15 Ravi Pratap <ravi@ximian.com>
2873 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
2874 use of emitting anything at all.
2876 * class.cs, rootcontext.cs : Get rid of calls to the same.
2878 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
2880 (Populate): Define the constructor correctly and set the implementation
2883 * typemanager.cs (delegate_types): New hashtable to hold delegates that
2886 (AddDelegateType): Implement.
2888 (IsDelegateType): Implement helper method.
2890 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
2892 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
2893 and accordingly handle it.
2895 * delegate.cs (Populate): Take TypeContainer argument.
2896 Implement bits to define the Invoke method. However, I still haven't figured out
2897 how to take care of the native int bit :-(
2899 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
2900 Qualify the name of the delegate, not its return type !
2902 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
2905 (StandardConversionExists): Checking for array types turns out to be recursive.
2907 (ConvertReferenceExplicit): Implement array conversion.
2909 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
2911 2001-10-12 Ravi Pratap <ravi@ximian.com>
2913 * cs-parser.jay (delegate_declaration): Store the fully qualified
2914 name as it is a type declaration.
2916 * delegate.cs (ReturnType, Name): Rename members to these. Make them
2919 (DefineDelegate): Renamed from Define. Does the same thing essentially,
2920 as TypeContainer::DefineType.
2922 (Populate): Method in which all the definition of the various methods (Invoke)
2925 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
2928 (CloseDelegate): Finally creates the delegate.
2930 * class.cs (TypeContainer::DefineType): Update to define delegates.
2931 (Populate, Emit and CloseType): Do the same thing here too.
2933 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
2934 delegates in all these operations.
2936 2001-10-14 Miguel de Icaza <miguel@ximian.com>
2938 * expression.cs: LocalTemporary: a new expression used to
2939 reference a temporary that has been created.
2941 * assign.cs: Handle PropertyAccess back here, so that we can
2942 provide the proper semantic access to properties.
2944 * expression.cs (Expression::ConvertReferenceExplicit): Implement
2945 a few more explicit conversions.
2947 * modifiers.cs: `NEW' modifier maps to HideBySig.
2949 * expression.cs (PropertyExpr): Make this into an
2950 ExpressionStatement, and support the EmitStatement code path.
2952 Perform get/set error checking, clean up the interface.
2954 * assign.cs: recognize PropertyExprs as targets, and if so, turn
2955 them into toplevel access objects.
2957 2001-10-12 Miguel de Icaza <miguel@ximian.com>
2959 * expression.cs: PropertyExpr::PropertyExpr: use work around the
2962 * typemanager.cs: Keep track here of our PropertyBuilders again to
2963 work around lameness in SRE.
2965 2001-10-11 Miguel de Icaza <miguel@ximian.com>
2967 * expression.cs (LValue::LValueResolve): New method in the
2968 interface, used to perform a second resolution pass for LValues.
2970 (This::DoResolve): Catch the use of this in static methods.
2972 (This::LValueResolve): Implement.
2974 (This::Store): Remove warning, assigning to `this' in structures
2977 (Invocation::Emit): Deal with invocation of
2978 methods on value types. We need to pass the address to structure
2979 methods rather than the object itself. (The equivalent code to
2980 emit "this" for structures leaves the entire structure on the
2981 stack instead of a pointer to it).
2983 (ParameterReference::DoResolve): Compute the real index for the
2984 argument based on whether the method takes or not a `this' pointer
2985 (ie, the method is static).
2987 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
2988 value types returned from functions when we need to invoke a
2989 method on the sturcture.
2992 2001-10-11 Ravi Pratap <ravi@ximian.com>
2994 * class.cs (TypeContainer::DefineType): Method to actually do the business of
2995 defining the type in the Modulebuilder or Typebuilder. This is to take
2996 care of nested types which need to be defined on the TypeBuilder using
2999 (TypeContainer::GetClassBases): Implement. Essentially the code from the
3000 methods in RootContext, only ported to be part of TypeContainer.
3002 (TypeContainer::GetInterfaceOrClass): Ditto.
3004 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
3006 * interface.cs (Interface::DefineInterface): New method. Does exactly
3007 what RootContext.CreateInterface did earlier, only it takes care of nested types
3010 (Interface::GetInterfaces): Move from RootContext here and port.
3012 (Interface::GetInterfaceByName): Same here.
3014 * rootcontext.cs (ResolveTree): Re-write.
3016 (PopulateTypes): Re-write.
3018 * class.cs (TypeContainer::Populate): Populate nested types too.
3019 (TypeContainer::Emit): Emit nested members too.
3021 * typemanager.cs (AddUserType): Do not make use of the FullName property,
3022 instead just use the name argument passed in as it is already fully
3025 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
3026 to TypeContainer mapping to see if a type is user-defined.
3028 * class.cs (TypeContainer::CloseType): Implement.
3030 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
3031 the default constructor.
3033 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
3036 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
3038 * interface.cs (CloseType): Create the type here.
3040 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
3043 Remove all the methods which are now in TypeContainer.
3045 2001-10-10 Ravi Pratap <ravi@ximian.com>
3047 * delegate.cs (Define): Re-write bits to define the delegate
3050 2001-10-10 Miguel de Icaza <miguel@ximian.com>
3052 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
3054 * expression.cs (ImplicitReferenceConversion): handle null as well
3055 as a source to convert to any reference type.
3057 * statement.cs (Return): Perform any implicit conversions to
3058 expected return type.
3060 Validate use of return statement.
3062 * codegen.cs (EmitContext): Pass the expected return type here.
3064 * class.cs (Method, Constructor, Property): Pass expected return
3065 type to EmitContext.
3067 2001-10-09 Miguel de Icaza <miguel@ximian.com>
3069 * expression.cs: Make DoResolve take an EmitContext instead of a
3072 Replaced `l' and `location' for `loc', for consistency.
3074 (Error, Warning): Remove unneeded Tc argument.
3076 * assign.cs, literal.cs, constant.cs: Update to new calling
3079 * codegen.cs: EmitContext now contains a flag indicating whether
3080 code is being generated in a static method or not.
3082 * cs-parser.jay: DecomposeQI, new function that replaces the old
3083 QualifiedIdentifier. Now we always decompose the assembled
3084 strings from qualified_identifier productions into a group of
3087 2001-10-08 Miguel de Icaza <miguel@ximian.com>
3089 * rootcontext.cs: Deal with field-less struct types correctly now
3090 by passing the size option to Define Type.
3092 * class.cs: Removed hack that created one static field.
3094 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3096 * statement.cs: Moved most of the code generation here.
3098 2001-10-09 Ravi Pratap <ravi@ximian.com>
3100 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
3103 (ElementAccess): Remove useless bits for now - keep checks as the spec
3106 2001-10-08 Ravi Pratap <ravi@ximian.com>
3108 * expression.cs (ElementAccess::DoResolve): Remove my crap code
3109 and start performing checks according to the spec.
3111 2001-10-07 Ravi Pratap <ravi@ximian.com>
3113 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
3114 rank_specifiers instead.
3116 (rank_specifiers): Change the order in which the rank specifiers are stored
3118 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
3120 * expression.cs (ElementAccess): Implement the LValue interface too.
3122 2001-10-06 Ravi Pratap <ravi@ximian.com>
3124 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
3125 except that user defined conversions are not included.
3127 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
3128 perform the conversion of the return type, if necessary.
3130 (New::DoResolve): Check whether we are creating an array or an object
3131 and accordingly do the needful.
3133 (New::Emit): Same here.
3135 (New::DoResolve): Implement guts of array creation.
3137 (New::FormLookupType): Helper function.
3139 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3141 * codegen.cs: Removed most of the code generation here, and move the
3142 corresponding code generation bits to the statement classes.
3144 Added support for try/catch/finalize and throw.
3146 * cs-parser.jay: Added support for try/catch/finalize.
3148 * class.cs: Catch static methods having the flags override,
3149 virtual or abstract.
3151 * expression.cs (UserCast): This user cast was not really doing
3152 what it was supposed to do. Which is to be born in fully resolved
3153 state. Parts of the resolution were being performed at Emit time!
3157 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3159 * expression.cs: Implicity convert the result from UserCast.
3161 2001-10-05 Ravi Pratap <ravi@ximian.com>
3163 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
3164 prevented it from working correctly.
3166 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
3167 merely ConvertImplicit.
3169 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3171 * typemanager.cs: Make the LookupTypeContainer function static,
3172 and not per-instance.
3174 * class.cs: Make static FindMembers (the one that takes a Type
3177 * codegen.cs: Add EmitForeach here.
3179 * cs-parser.jay: Make foreach a toplevel object instead of the
3180 inline expansion, as we need to perform semantic analysis on it.
3182 2001-10-05 Ravi Pratap <ravi@ximian.com>
3184 * expression.cs (Expression::ImplicitUserConversion): Rename to
3185 UserDefinedConversion.
3187 (Expression::UserDefinedConversion): Take an extra argument specifying
3188 whether we look for explicit user conversions too.
3190 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
3192 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
3194 (ExplicitUserConversion): Make it a call to UserDefinedConversion
3195 with the appropriate arguments.
3197 * cs-parser.jay (cast_expression): Record location too.
3199 * expression.cs (Cast): Record location info.
3201 (Expression::ConvertExplicit): Take location argument.
3203 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
3204 to determine if we are doing explicit conversions.
3206 (UserCast::Emit): Update accordingly.
3208 (Expression::ConvertExplicit): Report an error if everything fails.
3210 * ../errors/cs0030.cs : Add.
3212 2001-10-04 Miguel de Icaza <miguel@ximian.com>
3214 * modifiers.cs: If the ABSTRACT keyword is present, also set the
3215 virtual and newslot bits.
3217 * class.cs (TypeContainer::RegisterRequiredImplementations):
3218 Record methods we need.
3220 (TypeContainer::MakeKey): Helper function to make keys for
3221 MethodBases, since the Methodbase key is useless.
3223 (TypeContainer::Populate): Call RegisterRequiredImplementations
3224 before defining the methods.
3226 Create a mapping for method_builders_to_methods ahead of time
3227 instead of inside a tight loop.
3229 (::RequireMethods): Accept an object as the data to set into the
3230 hashtable so we can report interface vs abstract method mismatch.
3232 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3234 * report.cs: Make all of it static.
3236 * rootcontext.cs: Drop object_type and value_type computations, as
3237 we have those in the TypeManager anyways.
3239 Drop report instance variable too, now it is a global.
3241 * driver.cs: Use try/catch on command line handling.
3243 Add --probe option to debug the error reporting system with a test
3246 * report.cs: Add support for exiting program when a probe
3247 condition is reached.
3249 2001-10-03 Ravi Pratap <ravi@ximian.com>
3251 * expression.cs (Binary::DoNumericPromotions): Fix the case when
3252 we do a forcible conversion regardless of type, to check if
3253 ForceConversion returns a null.
3255 (Binary::error19): Use location to report error.
3257 (Unary::error23): Use location here too.
3259 * ../errors/cs0019.cs : Check in.
3261 * ../errors/cs0023.cs : Check in.
3263 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
3264 case of a non-null MethodInfo object with a length of 0 !
3266 (Binary::ResolveOperator): Flag error if overload resolution fails to find
3267 an applicable member - according to the spec :-)
3268 Also fix logic to find members in base types.
3270 (Unary::ResolveOperator): Same here.
3272 (Unary::report23): Change name to error23 and make first argument a TypeContainer
3273 as I was getting thoroughly confused between this and error19 :-)
3275 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
3276 (::FindMostEncompassedType): Implement.
3277 (::FindMostEncompassingType): Implement.
3278 (::StandardConversionExists): Implement.
3280 (UserImplicitCast): Re-vamp. We now need info about most specific
3281 source and target types so that we can do the necessary conversions.
3283 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
3284 mathematical union with no duplicates.
3286 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3288 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
3289 in order from base classes to child classes, so that we can in
3290 child classes look up in our parent for method names and
3291 attributes (required for handling abstract, virtual, new, override
3292 constructs: we need to instrospect our base class, and if we dont
3293 populate the classes in order, the introspection might be
3294 incorrect. For example, a method could query its parent before
3295 the parent has any methods and would determine that the parent has
3296 no abstract methods (while it could have had them)).
3298 (RootContext::CreateType): Record the order in which we define the
3301 2001-10-02 Miguel de Icaza <miguel@ximian.com>
3303 * class.cs (TypeContainer::Populate): Also method definitions can
3304 fail now, keep track of this.
3306 (TypeContainer::FindMembers): Implement support for
3307 DeclaredOnly/noDeclaredOnly flag.
3309 (Constructor::Emit) Return the ConstructorBuilder.
3311 (Method::Emit) Return the MethodBuilder.
3312 Check for abstract or virtual methods to be public.
3314 * rootcontext.cs (RootContext::CreateType): Register all the
3315 abstract methods required for the class to be complete and the
3316 interface methods that must be implemented.
3318 * cs-parser.jay: Report error 501 (method requires body if it is
3319 not marked abstract or extern).
3321 * expression.cs (TypeOf::Emit): Implement.
3323 * typemanager.cs: runtime_handle_type, new global type.
3325 * class.cs (Property::Emit): Generate code for properties.
3327 2001-10-02 Ravi Pratap <ravi@ximian.com>
3329 * expression.cs (Unary::ResolveOperator): Find operators on base type
3330 too - we now conform exactly to the spec.
3332 (Binary::ResolveOperator): Same here.
3334 * class.cs (Operator::Define): Fix minor quirk in the tests.
3336 * ../errors/cs0215.cs : Added.
3338 * ../errors/cs0556.cs : Added.
3340 * ../errors/cs0555.cs : Added.
3342 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3344 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
3345 single integer which is really efficient
3347 2001-10-01 Ravi Pratap <ravi@ximian.com>
3349 * expression.cs (Expression::ImplicitUserConversion): Use location
3350 even in the case when we are examining True operators.
3352 * class.cs (Operator::Define): Perform extensive checks to conform
3353 with the rules for operator overloading in the spec.
3355 * expression.cs (Expression::ImplicitReferenceConversion): Implement
3356 some of the other conversions mentioned in the spec.
3358 * typemanager.cs (array_type): New static member for the System.Array built-in
3361 (cloneable_interface): For System.ICloneable interface.
3363 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
3364 we start resolving the tree and populating types.
3366 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
3368 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3370 * expression.cs (Expression::ExprClassFromMemberInfo,
3371 Expression::Literalize): Create literal expressions from
3372 FieldInfos which are literals.
3374 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
3375 type casts, because they were wrong. The test suite in tests
3378 (ImplicitNumericConversion): ushort to ulong requires a widening
3381 Int32 constant to long requires widening cast as well.
3383 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
3384 for integers because the type on the stack is not i4.
3386 2001-09-30 Miguel de Icaza <miguel@ximian.com>
3388 * expression.cs (report118): require location argument.
3390 * parameter.cs: Do not dereference potential null value.
3392 * class.cs: Catch methods that lack the `new' keyword when
3393 overriding a name. Report warnings when `new' is used without
3394 anything being there to override.
3396 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
3398 * class.cs: Only add constructor to hashtable if it is non-null
3399 (as now constructors can fail on define).
3401 (TypeManager, Class, Struct): Take location arguments.
3403 Catch field instance initialization in structs as errors.
3405 accepting_filter: a new filter for FindMembers that is static so
3406 that we dont create an instance per invocation.
3408 (Constructor::Define): Catch errors where a struct constructor is
3411 * cs-parser.jay: Pass location information for various new
3414 * delegate.cs (Delegate): take a location argument.
3416 * driver.cs: Do not call EmitCode if there were problesm in the
3417 Definition of the types, as many Builders wont be there.
3419 * decl.cs (Decl::Decl): Require a location argument.
3421 * cs-tokenizer.cs: Handle properly hex constants that can not fit
3422 into integers, and find the most appropiate integer for it.
3424 * literal.cs: Implement ULongLiteral.
3426 * rootcontext.cs: Provide better information about the location of
3427 failure when CreateType fails.
3429 2001-09-29 Miguel de Icaza <miguel@ximian.com>
3431 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
3434 * expression.cs (Binary::CheckShiftArguments): Add missing type
3436 (Binary::ResolveOperator): Add type to the logical and and logical
3437 or, Bitwise And/Or and Exclusive Or code paths, it was missing
3440 (Binary::DoNumericPromotions): In the case where either argument
3441 is ulong (and most signed types combined with ulong cause an
3442 error) perform implicit integer constant conversions as well.
3444 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3446 * expression.cs (UserImplicitCast): Method should always be
3448 (Invocation::BetterConversion): Simplified test for IntLiteral.
3450 (Expression::ImplicitNumericConversion): Split this routine out.
3451 Put the code that performs implicit constant integer conversions
3454 (Expression::Resolve): Become a wrapper around DoResolve so we can
3455 check eclass and type being set after resolve.
3457 (Invocation::Badness): Remove this dead function
3459 (Binary::ResolveOperator): Do not compute the expensive argumnets
3460 unless we have a union for it.
3462 (Probe::Emit): Is needs to do an isinst and then
3463 compare against null.
3465 (::CanConvert): Added Location argument. If the Location argument
3466 is null (Location.Null), then we do not report errors. This is
3467 used by the `probe' mechanism of the Explicit conversion. We do
3468 not want to generate an error for something that the user
3469 explicitly requested to be casted. But the pipeline for an
3470 explicit cast first tests for potential implicit casts.
3472 So for now, if the Location is null, it means `Probe only' to
3473 avoid adding another argument. Might have to revise this
3476 (ClassCast): New class used to type cast objects into arbitrary
3477 classes (used in Explicit Reference Conversions).
3479 Implement `as' as well.
3481 Reverted all the patches from Ravi below: they were broken:
3483 * The use of `level' as a mechanism to stop recursive
3484 invocations is wrong. That was there just to catch the
3485 bug with a strack trace but not as a way of addressing
3488 To fix the problem we have to *understand* what is going
3489 on and the interactions and come up with a plan, not
3490 just get things going.
3492 * The use of the type conversion cache that I proposed
3493 last night had an open topic: How does this work across
3494 protection domains. A user defined conversion might not
3495 be public in the location where we are applying the
3496 conversion, a different conversion might be selected
3497 (ie, private A->B (better) but public B->A (worse),
3498 inside A, A->B applies, but outside it, B->A will
3501 * On top of that (ie, even if the above is solved),
3502 conversions in a cache need to be abstract. Ie, `To
3503 convert from an Int to a Short use an OpcodeCast', not
3504 `To convert from an Int to a Short use the OpcodeCast on
3505 the variable 5' (which is what this patch was doing).
3507 2001-09-28 Ravi Pratap <ravi@ximian.com>
3509 * expression.cs (Invocation::ConversionExists): Re-write to use
3510 the conversion cache
3512 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
3513 cache all conversions done, not just user-defined ones.
3515 (Invocation::BetterConversion): The real culprit. Use ConversionExists
3516 to determine if a conversion exists instead of acutually trying to
3517 perform the conversion. It's faster too.
3519 (Expression::ConvertExplicit): Modify to use ConversionExists to check
3520 and only then attempt the implicit conversion.
3522 2001-09-28 Ravi Pratap <ravi@ximian.com>
3524 * expression.cs (ConvertImplicit): Use a cache for conversions
3525 already found. Check level of recursion and bail out if necessary.
3527 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3529 * typemanager.cs (string_concat_string_string, string_concat_object_object):
3530 Export standard methods that we expect for string operations.
3532 * statement.cs (Block::UsageWarning): Track usage of variables and
3533 report the errors for not used variables.
3535 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
3538 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3540 * codegen.cs: remove unnneded code
3542 * expression.cs: Removed BuiltinTypeAccess class
3544 Fix the order in which implicit conversions are
3547 The previous fixed dropped support for boxed conversions (adding a
3548 test to the test suite now)
3550 (UserImplicitCast::CanConvert): Remove test for source being null,
3551 that code is broken. We should not feed a null to begin with, if
3552 we do, then we should track the bug where the problem originates
3553 and not try to cover it up here.
3555 Return a resolved expression of type UserImplicitCast on success
3556 rather than true/false. Ravi: this is what I was talking about,
3557 the pattern is to use a static method as a "constructor" for
3560 Also, do not create arguments until the very last minute,
3561 otherwise we always create the arguments even for lookups that
3562 will never be performed.
3564 (UserImplicitCast::Resolve): Eliminate, objects of type
3565 UserImplicitCast are born in a fully resolved state.
3567 * typemanager.cs (InitCoreTypes): Init also value_type
3570 * expression.cs (Cast::Resolve): First resolve the child expression.
3572 (LValue): Add new method AddressOf to be used by
3575 Change the argument of Store to take an EmitContext instead of an
3576 ILGenerator, because things like FieldExpr need to be able to call
3577 their children expression to generate the instance code.
3579 (Expression::Error, Expression::Warning): Sugar functions for
3582 (Expression::MemberLookup): Accept a TypeContainer instead of a
3583 Report as the first argument.
3585 (Expression::ResolvePrimary): Killed. I still want to improve
3586 this as currently the code is just not right.
3588 (Expression::ResolveMemberAccess): Simplify, but it is still
3591 (Unary::Resolve): Catch errors in AddressOf operators.
3593 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
3594 index to a byte for the short-version, or the compiler will choose
3595 the wrong Emit call, which generates the wrong data.
3597 (ParameterReference::Emit, ::Store): same.
3599 (FieldExpr::AddressOf): Implement.
3601 * typemanager.cs: TypeManager: made public variable instead of
3604 * driver.cs: document --fatal.
3606 * report.cs (ErrorMessage, WarningMessage): new names for the old
3607 Error and Warning classes.
3609 * cs-parser.jay (member_access): Turn built-in access to types
3610 into a normal simplename
3612 2001-09-27 Ravi Pratap <ravi@ximian.com>
3614 * expression.cs (Invocation::BetterConversion): Fix to cope
3615 with q being null, since this was introducing a bug.
3617 * expression.cs (ConvertImplicit): Do built-in conversions first.
3619 2001-09-27 Ravi Pratap <ravi@ximian.com>
3621 * expression.cs (UserImplicitCast::Resolve): Fix bug.
3623 2001-09-27 Ravi Pratap <ravi@ximian.com>
3625 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
3626 I had introduced long ago (what's new ?).
3628 * expression.cs (UserImplicitCast::CanConvert): Static method to do
3629 the work of all the checking.
3630 (ConvertImplicit): Call CanConvert and only then create object if necessary.
3631 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
3633 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
3634 that is the right way.
3636 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
3637 overloading resolution. Use everywhere instead of cutting and pasting code.
3639 (Binary::ResolveOperator): Use MakeUnionSet.
3641 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
3642 we have to convert to bool types. Not complete yet.
3644 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3646 * typemanager.cs (TypeManager::CSharpName): support ushort.
3648 * expression.cs (Expression::TryImplicitIntConversion): Attempts
3649 to provide an expression that performsn an implicit constant int
3650 conversion (section 6.1.6).
3651 (Expression::ConvertImplicitRequired): Reworked to include
3652 implicit constant expression conversions.
3654 (Expression::ConvertNumericExplicit): Finished.
3656 (Invocation::Emit): If InstanceExpression is null, then it means
3657 that we perform a call on this.
3659 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3661 * expression.cs (Unary::Emit): Remove some dead code.
3662 (Probe): Implement Resolve and Emit for `is'.
3663 (Expression::ConvertImplicitRequired): Attempt to do constant
3664 expression conversions here. Maybe should be moved to
3665 ConvertImplicit, but I am not sure.
3666 (Expression::ImplicitLongConstantConversionPossible,
3667 Expression::ImplicitIntConstantConversionPossible): New functions
3668 that tell whether is it possible to apply an implicit constant
3669 expression conversion.
3671 (ConvertNumericExplicit): Started work on explicit numeric
3674 * cs-parser.jay: Update operator constants.
3676 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
3677 (Parameters::GetSignature): Hook up VerifyArgs here.
3678 (Parameters::VerifyArgs): Verifies that no two arguments have the
3681 * class.cs (Operator): Update the operator names to reflect the
3682 ones that the spec expects (as we are just stringizing the
3685 * expression.cs (Unary::ResolveOperator): Fix bug: Use
3686 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
3687 previous usage did only work for our methods.
3688 (Expression::ConvertImplicit): Handle decimal implicit numeric
3689 conversions as well.
3690 (Expression::InternalTypeConstructor): Used to invoke constructors
3691 on internal types for default promotions.
3693 (Unary::Emit): Implement special handling for the pre/post
3694 increment/decrement for overloaded operators, as they need to have
3695 the same semantics as the other operators.
3697 (Binary::ResolveOperator): ditto.
3698 (Invocation::ConversionExists): ditto.
3699 (UserImplicitCast::Resolve): ditto.
3701 2001-09-26 Ravi Pratap <ravi@ximian.com>
3703 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
3704 operator, return after emitting body. Regression tests pass again !
3706 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
3707 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
3708 (Invocation::OverloadResolve): Ditto.
3709 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
3711 * everywhere : update calls to the above methods accordingly.
3713 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3715 * assign.cs (Assign): Make it inherit from ExpressionStatement.
3717 * expression.cs (ExpressionStatement): New base class used for
3718 expressions that can appear in statements, so that we can provide
3719 an alternate path to generate expression that do not leave a value
3722 (Expression::Emit, and all the derivatives): We no longer return
3723 whether a value is left on the stack or not. Every expression
3724 after being emitted leaves a single value on the stack.
3726 * codegen.cs (EmitContext::EmitStatementExpression): Use the
3727 facilties of ExpressionStatement if possible.
3729 * cs-parser.jay: Update statement_expression.
3731 2001-09-25 Miguel de Icaza <miguel@ximian.com>
3733 * driver.cs: Change the wording of message
3735 2001-09-25 Ravi Pratap <ravi@ximian.com>
3737 * expression.cs (Binary::ResolveOperator): Had forgottten to set
3738 the type of the expression to the return type of the method if
3739 we have an overloaded operator match ! The regression tests pass again !
3740 (Unary::ResolveOperator): Ditto.
3742 * expression.cs (Invocation::ConversionExists): Correct the member lookup
3743 to find "op_Implicit", not "implicit" ;-)
3744 (UserImplicitCast): New class to take care of user-defined implicit conversions.
3745 (ConvertImplicit, ForceConversion): Take TypeContainer argument
3747 * everywhere : Correct calls to the above accordingly.
3749 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
3750 (ConvertImplicit): Do user-defined conversion if it exists.
3752 2001-09-24 Miguel de Icaza <miguel@ximian.com>
3754 * assign.cs: track location.
3755 (Resolve): Use implicit conversions on assignment.
3757 * literal.cs: Oops. Not good, Emit of short access values should
3758 pass (Bytes) or the wrong argument will be selected.
3760 * expression.cs (Unary::Emit): Emit code for -expr.
3762 (Unary::ResolveOperator): Handle `Substract' for non-constants
3763 (substract from zero from the non-constants).
3764 Deal with Doubles as well.
3766 (Expression::ConvertImplicitRequired): New routine that reports an
3767 error if no implicit conversion exists.
3769 (Invocation::OverloadResolve): Store the converted implicit
3770 expressions if we make them
3772 2001-09-24 Ravi Pratap <ravi@ximian.com>
3774 * class.cs (ConstructorInitializer): Take a Location argument.
3775 (ConstructorBaseInitializer): Same here.
3776 (ConstructorThisInitializer): Same here.
3778 * cs-parser.jay : Update all calls accordingly.
3780 * expression.cs (Unary, Binary, New): Take location argument.
3781 Update accordingly everywhere.
3783 * cs-parser.jay : Update all calls to the above to take a location
3788 2001-09-24 Ravi Pratap <ravi@ximian.com>
3790 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
3791 (Invocation::BetterConversion): Same here
3792 (Invocation::ConversionExists): Ditto.
3794 (Invocation::ConversionExists): Implement.
3796 2001-09-22 Ravi Pratap <ravi@ximian.com>
3798 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
3799 Also take an additional TypeContainer argument.
3801 * All over : Pass in TypeContainer as argument to OverloadResolve.
3803 * typemanager.cs (CSharpName): Update to check for the string type and return
3806 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
3809 2001-09-21 Ravi Pratap <ravi@ximian.com>
3811 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
3812 (Invocation::BetterFunction): Implement.
3813 (Invocation::BetterConversion): Implement.
3814 (Invocation::ConversionExists): Skeleton, no implementation yet.
3816 Okay, things work fine !
3818 2001-09-21 Miguel de Icaza <miguel@ximian.com>
3820 * typemanager.cs: declare and load enum_type, delegate_type and
3823 * expression.cs (Expression::Emit): Now emit returns a value that
3824 tells whether a value is left on the stack or not. This strategy
3825 might be reveted tomorrow with a mechanism that would address
3826 multiple assignments.
3827 (Expression::report118): Utility routine to report mismatches on
3830 (Unary::Report23): Report impossible type/operator combination
3833 (Unary::IsIncrementableNumber): Whether the type can be
3834 incremented or decremented with add.
3835 (Unary::ResolveOperator): Also allow enumerations to be bitwise
3837 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
3839 (Invocation::Emit): Deal with new Emit convetion.
3841 * All Expression derivatives: Updated their Emit method to return
3842 whether they leave values on the stack or not.
3844 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
3845 stack for expressions that are statements.
3847 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3849 * expression.cs (LValue): New interface. Must be implemented by
3851 (LocalVariableReference, ParameterReference, FieldExpr): Implement
3854 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
3855 interface for generating code, simplifies the code.
3857 2001-09-20 Ravi Pratap <ravi@ximian.com>
3859 * expression.cs (everywhere): Comment out return statements in ::Resolve
3860 methods to avoid the warnings.
3862 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3864 * driver.cs (parse): Report error 2001 if we can not open the
3867 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
3870 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
3873 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
3874 otherwise nested blocks end up with the same index.
3876 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
3878 * expression.cs: Instead of having FIXMEs in the Resolve
3879 functions, throw exceptions so it is obvious that we are facing a
3882 * cs-parser.jay (invocation_expression): Pass Location information.
3884 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
3885 Use a basename for those routines because .NET does not like paths
3888 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
3891 2001-09-19 Miguel de Icaza <miguel@ximian.com>
3893 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
3894 are loading the correct data types (throws an exception if not).
3895 (TypeManager::InitCoreTypes): Use CoreLookupType
3897 * expression.cs (Unary::ResolveOperator): return the child
3898 expression for expressions which are just +expr.
3899 (Unary::ResolveOperator): Return negative literals for -LITERAL
3900 expressions (otherwise they are Unary {Literal}).
3901 (Invocation::Badness): Take into account `Implicit constant
3902 expression conversions'.
3904 * literal.cs (LongLiteral): Implement long literal class.
3905 (IntLiteral): export the `Value' of the intliteral.
3907 2001-09-19 Ravi Pratap <ravi@ximian.com>
3909 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
3911 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
3912 instead of 'Operator'
3914 * expression.cs (Binary::ResolveOperator): Update accordingly.
3915 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
3918 * cs-parser.jay (unary_expression): Update to use the new names.
3920 * gen-treedump.cs (GetUnary): Same here.
3922 * expression.cs (Unary::Resolve): Implement.
3923 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
3924 operators are found instead of making noise ;-)
3925 (Unary::ResolveOperator): New method to do precisely the same thing which
3926 Binary::ResolveOperator does for Binary expressions.
3927 (Unary.method, .Arguments): Add.
3928 (Unary::OperName): Implement.
3929 (Unary::ForceConversion): Copy and Paste !
3931 * class.cs (Operator::Define): Fix a small bug for the case when we have
3934 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
3935 for the inbuilt operators. Only overloading works for now ;-)
3937 2001-09-18 Miguel de Icaza <miguel@ximian.com>
3939 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
3940 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
3942 * expression.cs (This::Emit): Implement.
3943 (This::Resolve): Implement.
3944 (TypeOf:Resolve): Implement.
3945 (Expression::ResolveSimpleName): Add an implicit this to instance
3947 (MemberAccess::Resolve): Deal with Parameters and Fields.
3948 Bind instance variable to Field expressions.
3949 (FieldExpr::Instance): New field used to track the expression that
3950 represents the object instance.
3951 (FieldExpr::Resolve): Track potential errors from MemberLookup not
3953 (FieldExpr::Emit): Implement.
3955 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
3956 the last instruction contains a return opcode to avoid generating
3957 the last `ret' instruction (this generates correct code, and it is
3958 nice to pass the peverify output).
3960 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
3961 initializer for static and instance variables.
3962 (Constructor::Emit): Allow initializer to be null in the case of
3963 static constructors. Only emit initializer for instance
3966 (TypeContainer::FindMembers): Return a null array if there are no
3969 Also fix the code for the MemberTypes.Method branch, as it was not
3970 scanning that for operators (or tried to access null variables before).
3972 * assign.cs (Assign::Emit): Handle instance and static fields.
3976 * driver.cs: Stop compilation if there are parse errors.
3978 * cs-parser.jay (constructor_declaration): Provide default base
3979 initializer for non-static constructors.
3980 (constructor_declarator): Do not provide a default base
3981 initializers if none was specified.
3982 Catch the fact that constructors should not have parameters.
3984 * class.cs: Do not emit parent class initializers for static
3985 constructors, that should be flagged as an error.
3987 2001-09-18 Ravi Pratap <ravi@ximian.com>
3989 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
3990 Move back code into TypeContainer::Populate.
3992 2001-09-18 Ravi Pratap <ravi@ximian.com>
3994 * class.cs (TypeContainer::AddConstructor): Fix the check to
3995 compare against Name, not Basename.
3996 (Operator::OpType): Change Plus and Minus to Add and Subtract.
3998 * cs-parser.jay : Update accordingly.
4000 * class.cs (TypeContainer::FindMembers): For the case where we are searching
4001 for methods, don't forget to look into the operators too.
4002 (RegisterMethodBuilder): Helper method to take care of this for
4003 methods, constructors and operators.
4004 (Operator::Define): Completely revamp.
4005 (Operator.OperatorMethod, MethodName): New fields.
4006 (TypeContainer::Populate): Move the registering of builders into
4007 RegisterMethodBuilder.
4008 (Operator::Emit): Re-write.
4010 * expression.cs (Binary::Emit): Comment out code path to emit method
4011 invocation stuff for the case when we have a user defined operator. I am
4012 just not able to get it right !
4014 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4016 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
4019 (Expression::MemberLookup): Provide a version that allows to
4020 specify the MemberTypes and BindingFlags.
4022 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
4023 so it was not fetching variable information from outer blocks.
4025 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
4026 Beforefieldinit as it was buggy.
4028 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
4031 * class.cs (Constructor::Emit): Only emit if block is not null.
4032 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
4033 deal with this by semantically definining it as if the user had
4036 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
4037 constructors as we now "emit" them at a higher level.
4039 (TypeContainer::DefineDefaultConstructor): Used to define the
4040 default constructors if none was provided.
4042 (ConstructorInitializer): Add methods Resolve and Emit.
4044 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
4046 2001-09-17 Ravi Pratap <ravi@ximian.com>
4048 * class.cs (TypeContainer::EmitDefaultConstructor): Register
4049 the default constructor builder with our hashtable for methodbuilders
4052 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
4053 and argument_count is 0 in which case we have a match.
4054 (Binary::ResolveOperator): More null checking and miscellaneous coding
4057 2001-09-17 Ravi Pratap <ravi@ximian.com>
4059 * rootcontext.cs (IsNameSpace): Compare against null.
4061 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
4063 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
4064 and Unary::Operator.
4066 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
4069 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
4070 we have overloaded operators.
4071 (Binary::ResolveOperator): Implement the part which does the operator overload
4074 * class.cs (Operator::Emit): Implement.
4075 (TypeContainer::Emit): Emit the operators we have too.
4077 * expression.cs (Binary::Emit): Update to emit the appropriate code for
4078 the case when we have a user-defined operator.
4080 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4082 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
4084 2001-09-16 Ravi Pratap <ravi@ximian.com>
4086 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
4087 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
4088 (Constructor::Emit): Implement.
4089 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
4090 if we have no work to do.
4091 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
4094 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
4095 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
4097 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
4100 2001-09-15 Ravi Pratap <ravi@ximian.com>
4102 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
4104 (Tree::RecordNamespace): Method to do what the name says ;-)
4105 (Tree::Namespaces): Property to get at the namespaces hashtable.
4107 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
4110 * rootcontext.cs (IsNamespace): Fixed it :-)
4112 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4114 * class.cs (TypeContainer::FindMembers): Add support for
4116 (MethodCore): New class that encapsulates both the shared aspects
4117 of a Constructor and a Method.
4118 (Method, Constructor): Factored pieces into MethodCore.
4120 * driver.cs: Added --fatal which makes errors throw exceptions.
4121 Load System assembly as well as part of the standard library.
4123 * report.cs: Allow throwing exceptions on errors for debugging.
4125 * modifiers.cs: Do not use `parent', instead use the real type
4126 container to evaluate permission settings.
4128 * class.cs: Put Ravi's patch back in. He is right, and we will
4129 have to cope with the
4131 2001-09-14 Ravi Pratap <ravi@ximian.com>
4133 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
4134 FamORAssem, not FamANDAssem.
4136 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4138 * driver.cs: Added --parse option that only parses its input files
4141 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
4142 incorrect. IsTopLevel is not used to tell whether an object is
4143 root_types or not (that can be achieved by testing this ==
4144 root_types). But to see if this is a top-level *class* (not
4145 necessarly our "toplevel" container).
4147 2001-09-14 Ravi Pratap <ravi@ximian.com>
4149 * enum.cs (Enum::Define): Modify to call the Lookup method on the
4150 parent instead of a direct call to GetType.
4152 2001-09-14 Ravi Pratap <ravi@ximian.com>
4154 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
4155 Modifiers.TypeAttr. This should just be a call to that method.
4157 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
4158 object so that we can determine if we are top-level or not.
4160 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
4163 * enum.cs (Enum::Define): Ditto.
4165 * modifiers.cs (FieldAttr): Re-write.
4167 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
4168 (TypeContainer::HaveStaticConstructor): New property to provide access
4169 to precisely that info.
4171 * modifiers.cs (MethodAttr): Re-write.
4172 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
4174 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
4175 of top-level types as claimed.
4177 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4179 * expression.cs (MemberLookup): Fruitless attempt to lookup
4180 constructors. Maybe I need to emit default constructors? That
4181 might be it (currently .NET emits this for me automatically).
4182 (Invocation::OverloadResolve): Cope with Arguments == null.
4183 (Invocation::EmitArguments): new function, shared by the new
4185 (Invocation::Emit): Handle static and instance methods. Emit
4186 proper call instruction for virtual or non-virtual invocations.
4187 (New::Emit): Implement.
4188 (New::Resolve): Implement.
4189 (MemberAccess:Resolve): Implement.
4190 (MethodGroupExpr::InstanceExpression): used conforming to the spec
4192 (FieldExpr::Resolve): Set type.
4194 * support.cs: Handle empty arguments.
4196 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
4197 SimpleLookup): Auxiliary routines to help parse a qualifier
4200 Update qualifier_identifier rule.
4202 * codegen.cs: Removed debugging messages.
4204 * class.cs: Make this a global thing, this acts just as a "key" to
4205 objects that we might have around.
4207 (Populate): Only initialize method_builders_to_methods once.
4209 * expression.cs (PropertyExpr): Initialize type from the
4212 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
4213 Resolve pattern. Attempt to implicitly convert value to boolean.
4216 * expression.cs: Set the type for the int32/int32 argument case.
4217 (Binary::ResolveOperator): Set the return type to boolean for
4218 comparission operators
4220 * typemanager.cs: Remove debugging print code.
4222 (Invocation::Resolve): resolve type.
4224 * class.cs: Allocate a MemberInfo of the correct size, as the code
4225 elsewhere depends on the test to reflect the correct contents.
4227 (Method::) Keep track of parameters, due to System.Reflection holes
4229 (TypeContainer::Populate): Keep track of MethodBuilders to Method
4232 (TypeContainer::FindMembers): Use ArrayList and then copy an array
4233 of the exact size and return that.
4235 (Class::LookupMethodByBuilder): New function that maps
4236 MethodBuilders to its methods. Required to locate the information
4237 on methods because System.Reflection bit us again.
4239 * support.cs: New file, contains an interface ParameterData and
4240 two implementations: ReflectionParameters and InternalParameters
4241 used to access Parameter information. We will need to grow this
4244 * expression.cs (Invocation::GetParameterData): implement a cache
4245 and a wrapper around the ParameterData creation for methods.
4246 (Invocation::OverloadResolve): Use new code.
4248 2001-09-13 Ravi Pratap <ravi@ximian.com>
4250 * class.cs (TypeContainer::EmitField): Remove and move into
4251 (Field::Define): here and modify accordingly.
4252 (Field.FieldBuilder): New member.
4253 (TypeContainer::Populate): Update accordingly.
4254 (TypeContainer::FindMembers): Implement.
4256 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4258 * statement.cs: (VariableInfo::VariableType): New field to be
4259 initialized with the full type once it is resolved.
4261 2001-09-12 Miguel de Icaza <miguel@ximian.com>
4263 * parameter.cs (GetParameterInfo): Use a type cache to compute
4264 things only once, and to reuse this information
4266 * expression.cs (LocalVariableReference::Emit): Implement.
4267 (OpcodeCast::Emit): fix.
4269 (ParameterReference::Resolve): Implement.
4270 (ParameterReference::Emit): Implement.
4272 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
4273 that are expressions need to stay as Expressions.
4275 * typemanager.cs (CSharpName): Returns the C# name of a type if
4278 * expression.cs (Expression::ConvertImplicit): New function that
4279 implements implicit type conversions.
4281 (Expression::ImplicitReferenceConversion): Implements implicit
4282 reference conversions.
4284 (EmptyCast): New type for transparent casts.
4286 (OpcodeCast): New type for casts of types that are performed with
4287 a sequence of bytecodes.
4289 (BoxedCast): New type used for casting value types into reference
4290 types. Emits a box opcode.
4292 (Binary::DoNumericPromotions): Implements numeric promotions of
4293 and computation of the Binary::Type.
4295 (Binary::EmitBranchable): Optimization.
4297 (Binary::Emit): Implement code emission for expressions.
4299 * typemanager.cs (TypeManager): Added two new core types: sbyte
4302 2001-09-12 Ravi Pratap <ravi@ximian.com>
4304 * class.cs (TypeContainer::FindMembers): Method which does exactly
4305 what Type.FindMembers does, only we don't have to use reflection. No
4308 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
4309 typecontainer objects as we need to get at them.
4310 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
4312 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
4313 typecontainer object.
4315 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
4316 of just a Report object.
4318 2001-09-11 Ravi Pratap <ravi@ximian.com>
4320 * class.cs (Event::Define): Go back to using the prefixes "add_" and
4322 (TypeContainer::Populate): Now define the delegates of the type too.
4323 (TypeContainer.Delegates): Property to access the list of delegates defined
4326 * delegates.cs (Delegate::Define): Implement partially.
4328 * modifiers.cs (TypeAttr): Handle more flags.
4330 2001-09-11 Ravi Pratap <ravi@ximian.com>
4332 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
4334 (Operator::Define): Re-write logic to get types by using the LookupType method
4335 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
4336 (Indexer::Define): Ditto.
4337 (Event::Define): Ditto.
4338 (Property::Define): Ditto.
4340 2001-09-10 Ravi Pratap <ravi@ximian.com>
4342 * class.cs (TypeContainer::Populate): Now define operators too.
4343 (TypeContainer.Operators): New property to access the list of operators
4345 (Operator.OperatorMethodBuilder): New member to hold the method builder
4346 for the operator we are defining.
4347 (Operator::Define): Implement.
4349 2001-09-10 Ravi Pratap <ravi@ximian.com>
4351 * class.cs (Event::Define): Make the prefixes of the accessor methods
4352 addOn_ and removeOn_
4354 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
4355 of the location being passed in too. Ideally, this should go later since all
4356 error reporting should be done through the Report object.
4358 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
4359 (Populate): Iterate thru the indexers we have and define them too.
4360 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
4361 for the get and set accessors.
4362 (Indexer::Define): Implement.
4364 2001-09-09 Miguel de Icaza <miguel@ximian.com>
4366 * expression.cs (Binary::Resolve): Beginning of it. I scratched
4367 my previous implementation, did not work.
4369 * typemanager.cs: Add a couple of missing types (the longs).
4371 * literal.cs: Use TypeManager.bool_type instead of getting it.
4373 * expression.cs (EventExpr): New kind of expressions.
4374 (Expressio::ExprClassFromMemberInfo): finish
4376 2001-09-08 Miguel de Icaza <miguel@ximian.com>
4378 * assign.cs: Emit stores to static fields differently.
4380 2001-09-08 Ravi Pratap <ravi@ximian.com>
4382 * Merge in changes and adjust code to tackle conflicts. Backed out my
4383 code in Assign::Resolve ;-)
4385 2001-09-08 Ravi Pratap <ravi@ximian.com>
4387 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
4388 instead Report.Error and also pass in the location.
4389 (CSharpParser::Lexer): New readonly property to return the reference
4390 to the Tokenizer object.
4391 (declare_local_variables): Use Report.Error with location instead of plain
4395 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
4396 (Operator.CheckBinaryOperator): Ditto.
4398 * cs-parser.jay (operator_declarator): Update accordingly.
4400 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
4401 (CheckBinaryOperator): Same here.
4403 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
4404 on the name without any prefixes of namespace names etc. This is because we
4405 already might have something already fully qualified like
4406 'System.Console.WriteLine'
4408 * assign.cs (Resolve): Begin implementation. Stuck ;-)
4410 2001-09-07 Ravi Pratap <ravi@ximian.com>
4412 * cs-tokenizer.cs (location): Return a string which also contains
4415 * expression.cs (ElementAccess): New class for expressions of the
4416 type 'element access.'
4417 (BaseAccess): New class for expressions of the type 'base access.'
4418 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
4421 * cs-parser.jay (element_access): Implement action.
4422 (base_access): Implement actions.
4423 (checked_expression, unchecked_expression): Implement.
4425 * cs-parser.jay (local_variable_type): Correct and implement.
4426 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
4428 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
4430 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
4431 name and the specifiers.
4433 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
4435 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
4436 making them all public ;-)
4438 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
4441 2001-09-07 Miguel de Icaza <miguel@ximian.com>
4443 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
4445 (FieldExpr, PropertyExprs): New resolved expressions.
4446 (SimpleName::MemberStaticCheck): Perform static checks for access
4447 to non-static fields on static methods. Maybe this should be
4448 generalized for MemberAccesses.
4449 (SimpleName::ResolveSimpleName): More work on simple name
4452 * cs-parser.jay (primary_expression/qualified_identifier): track
4453 the parameter index.
4455 * codegen.cs (CodeGen::Save): Catch save exception, report error.
4456 (EmitContext::EmitBoolExpression): Chain to expression generation
4457 instead of temporary hack.
4458 (::EmitStatementExpression): Put generic expression code generation.
4460 * assign.cs (Assign::Emit): Implement variable assignments to
4461 local variables, parameters and fields.
4463 2001-09-06 Miguel de Icaza <miguel@ximian.com>
4465 * statement.cs (Block::GetVariableInfo): New method, returns the
4466 VariableInfo for a variable name in a block.
4467 (Block::GetVariableType): Implement in terms of GetVariableInfo
4469 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
4470 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
4472 2001-09-06 Ravi Pratap <ravi@ximian.com>
4474 * cs-parser.jay (operator_declaration): Continue on my quest : update
4475 to take attributes argument.
4476 (event_declaration): Ditto.
4477 (enum_declaration): Ditto.
4478 (indexer_declaration): Ditto.
4480 * class.cs (Operator::Operator): Update constructor accordingly.
4481 (Event::Event): Ditto.
4483 * delegate.cs (Delegate::Delegate): Same here.
4485 * enum.cs (Enum::Enum): Same here.
4487 2001-09-05 Ravi Pratap <ravi@ximian.com>
4489 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
4491 * ../tests/cs0658.cs : New file to demonstrate error 0658.
4493 * attribute.cs (Attributes): New class to encapsulate all attributes which were
4494 being passed around as an arraylist.
4495 (Attributes::AddAttribute): Method to add attribute sections.
4497 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
4498 (struct_declaration): Update accordingly.
4499 (constant_declaration): Update.
4500 (field_declaration): Update.
4501 (method_header): Update.
4502 (fixed_parameter): Update.
4503 (parameter_array): Ditto.
4504 (property_declaration): Ditto.
4505 (destructor_declaration): Ditto.
4507 * class.cs (Struct::Struct): Update constructors accordingly.
4508 (Class::Class): Ditto.
4509 (Field::Field): Ditto.
4510 (Method::Method): Ditto.
4511 (Property::Property): Ditto.
4512 (TypeContainer::OptAttribute): update property's return type.
4514 * interface.cs (Interface.opt_attributes): New member.
4515 (Interface::Interface): Update to take the extra Attributes argument.
4517 * parameter.cs (Parameter::Parameter): Ditto.
4519 * constant.cs (Constant::Constant): Ditto.
4521 * interface.cs (InterfaceMemberBase): New OptAttributes field.
4522 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
4523 the attributes as a parameter.
4524 (InterfaceProperty): Update constructor call.
4525 (InterfaceEvent): Ditto.
4526 (InterfaceMethod): Ditto.
4527 (InterfaceIndexer): Ditto.
4529 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
4530 pass the attributes too.
4531 (interface_event_declaration): Ditto.
4532 (interface_property_declaration): Ditto.
4533 (interface_method_declaration): Ditto.
4534 (interface_declaration): Ditto.
4536 2001-09-05 Miguel de Icaza <miguel@ximian.com>
4538 * class.cs (Method::Define): Track the "static Main" definition to
4539 create an entry point.
4541 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
4542 EntryPoint if we find it.
4544 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
4545 (EmitContext::ig): Make this variable public.
4547 * driver.cs: Make the default output file be the first file name
4548 with the .exe extension.
4550 Detect empty compilations
4552 Handle various kinds of output targets. Handle --target and
4553 rename -t to --dumper.
4555 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
4556 methods inherited from Expression return now an Expression. This
4557 will is used during the tree rewriting as we resolve them during
4560 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
4561 the spec. Missing entirely is the information about
4562 accessability of elements of it.
4564 (Expression::ExprClassFromMemberInfo): New constructor for
4565 Expressions that creates a fully initialized Expression based on
4566 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
4569 (Invocation::Resolve): Begin implementing resolution of invocations.
4571 * literal.cs (StringLiteral): Implement Emit.
4573 2001-09-05 Ravi Pratap <ravi@ximian.com>
4575 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
4578 2001-09-04 Ravi Pratap <ravi@ximian.com>
4580 * cs-parser.jay (attribute_arguments): Implement actions.
4581 (attribute): Fix bug in production. Implement action.
4582 (attribute_list): Implement.
4583 (attribute_target): Implement.
4584 (attribute_target_specifier, opt_target_specifier): Implement
4585 (CheckAttributeTarget): New method to check if the attribute target
4587 (attribute_section): Implement.
4588 (opt_attributes): Implement.
4590 * attribute.cs : New file to handle attributes.
4591 (Attribute): Class to hold attribute info.
4593 * cs-parser.jay (opt_attribute_target_specifier): Remove production
4594 (attribute_section): Modify production to use 2 different rules to
4595 achieve the same thing. 1 s/r conflict down !
4596 Clean out commented, useless, non-reducing dimension_separator rules.
4598 * class.cs (TypeContainer.attributes): New member to hold list
4599 of attributes for a type.
4600 (Struct::Struct): Modify to take one more argument, the attribute list.
4601 (Class::Class): Ditto.
4602 (Field::Field): Ditto.
4603 (Method::Method): Ditto.
4604 (Property::Property): Ditto.
4606 * cs-parser.jay (struct_declaration): Update constructor call to
4607 pass in the attributes too.
4608 (class_declaration): Ditto.
4609 (constant_declaration): Ditto.
4610 (field_declaration): Ditto.
4611 (method_header): Ditto.
4612 (fixed_parameter): Ditto.
4613 (parameter_array): Ditto.
4614 (property_declaration): Ditto.
4616 * constant.cs (Constant::Constant): Update constructor similarly.
4617 Use System.Collections.
4619 * parameter.cs (Parameter::Parameter): Update as above.
4621 2001-09-02 Ravi Pratap <ravi@ximian.com>
4623 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
4624 (TypeContainer.delegates): New member to hold list of delegates.
4626 * cs-parser.jay (delegate_declaration): Implement the action correctly
4627 this time as I seem to be on crack ;-)
4629 2001-09-02 Miguel de Icaza <miguel@ximian.com>
4631 * rootcontext.cs (RootContext::IsNamespace): new function, used to
4632 tell whether an identifier represents a namespace.
4634 * expression.cs (NamespaceExpr): A namespace expression, used only
4635 temporarly during expression resolution.
4636 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
4637 utility functions to resolve names on expressions.
4639 2001-09-01 Miguel de Icaza <miguel@ximian.com>
4641 * codegen.cs: Add hook for StatementExpressions.
4643 * class.cs: Fix inverted test for static flag in methods.
4645 2001-09-02 Ravi Pratap <ravi@ximian.com>
4647 * class.cs (Operator::CheckUnaryOperator): Correct error number used
4648 to make it coincide with MS' number.
4649 (Operator::CheckBinaryOperator): Ditto.
4651 * ../errors/errors.txt : Remove error numbers added earlier.
4653 * ../errors/cs1019.cs : Test case for error # 1019
4655 * ../errros/cs1020.cs : Test case for error # 1020
4657 * cs-parser.jay : Clean out commented cruft.
4658 (dimension_separators, dimension_separator): Comment out. Ostensibly not
4659 used anywhere - non-reducing rule.
4660 (namespace_declarations): Non-reducing rule - comment out.
4662 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
4663 with TypeContainer::AddEnum.
4665 * delegate.cs : New file for delegate handling classes.
4666 (Delegate): Class for declaring delegates.
4668 * makefile : Update.
4670 * cs-parser.jay (delegate_declaration): Implement.
4672 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
4674 * class.cs (Event::Define): Implement.
4675 (Event.EventBuilder): New member.
4677 * class.cs (TypeContainer::Populate): Update to define all enums and events
4679 (Events): New property for the events arraylist we hold. Shouldn't we move to using
4680 readonly fields for all these cases ?
4682 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4684 * class.cs (Property): Revamp to use the convention of making fields readonly.
4685 Accordingly modify code elsewhere.
4687 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
4688 the Define method of the Property class.
4690 * class.cs : Clean up applied patch and update references to variables etc. Fix
4692 (TypeContainer::Populate): Update to define all the properties we have. Also
4693 define all enumerations.
4695 * enum.cs (Define): Implement.
4697 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4699 * cs-parser.jay (overloadable_operator): The semantic value is an
4700 enum of the Operator class.
4701 (operator_declarator): Implement actions.
4702 (operator_declaration): Implement.
4704 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
4705 validity of definitions.
4706 (Operator::CheckBinaryOperator): Static method to check for binary operators
4707 (TypeContainer::AddOperator): New method to add an operator to a type.
4709 * cs-parser.jay (indexer_declaration): Added line to actually call the
4710 AddIndexer method so it gets added ;-)
4712 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
4713 already taken care of by the MS compiler ?
4715 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4717 * class.cs (Operator): New class for operator declarations.
4718 (Operator::OpType): Enum for the various operators.
4720 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4722 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
4723 ostensibly handle this in semantic analysis.
4725 * cs-parser.jay (general_catch_clause): Comment out
4726 (specific_catch_clauses, specific_catch_clause): Ditto.
4727 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
4728 (catch_args, opt_catch_args): New productions.
4729 (catch_clause): Rewrite to use the new productions above
4730 (catch_clauses): Modify accordingly.
4731 (opt_catch_clauses): New production to use in try_statement
4732 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
4733 and re-write the code in the actions to extract the specific and
4734 general catch clauses by being a little smart ;-)
4736 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
4737 Hooray, try and catch statements parse fine !
4739 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4741 * statement.cs (Block::GetVariableType): Fix logic to extract the type
4742 string from the hashtable of variables.
4744 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
4745 I end up making that mistake ;-)
4746 (catch_clauses): Fixed gross error which made Key and Value of the
4747 DictionaryEntry the same : $1 !!
4749 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4751 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
4753 * cs-parser.jay (event_declaration): Correct to remove the semicolon
4754 when the add and remove accessors are specified.
4756 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4758 * cs-parser.jay (IndexerDeclaration): New helper class to hold
4759 information about indexer_declarator.
4760 (indexer_declarator): Implement actions.
4761 (parsing_indexer): New local boolean used to keep track of whether
4762 we are parsing indexers or properties. This is necessary because
4763 implicit_parameters come into picture even for the get accessor in the
4765 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
4767 * class.cs (Indexer): New class for indexer declarations.
4768 (TypeContainer::AddIndexer): New method to add an indexer to a type.
4769 (TypeContainer::indexers): New member to hold list of indexers for the
4772 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4774 * cs-parser.jay (add_accessor_declaration): Implement action.
4775 (remove_accessor_declaration): Implement action.
4776 (event_accessors_declaration): Implement
4777 (variable_declarators): swap statements for first rule - trivial.
4779 * class.cs (Event): New class to hold information about event
4781 (TypeContainer::AddEvent): New method to add an event to a type
4782 (TypeContainer::events): New member to hold list of events.
4784 * cs-parser.jay (event_declaration): Implement actions.
4786 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4788 * cs-parser.jay (dim_separators): Implement. Make it a string
4789 concatenating all the commas together, just as they appear.
4790 (opt_dim_separators): Modify accordingly
4791 (rank_specifiers): Update accordingly. Basically do the same
4792 thing - instead, collect the brackets here.
4793 (opt_rank_sepcifiers): Modify accordingly.
4794 (array_type): Modify to actually return the complete type string
4795 instead of ignoring the rank_specifiers.
4796 (expression_list): Implement to collect the expressions
4797 (variable_initializer): Implement. We make it a list of expressions
4798 essentially so that we can handle the array_initializer case neatly too.
4799 (variable_initializer_list): Implement.
4800 (array_initializer): Make it a list of variable_initializers
4801 (opt_array_initializer): Modify accordingly.
4803 * expression.cs (New::NType): Add enumeration to help us
4804 keep track of whether we have an object/delegate creation
4805 or an array creation.
4806 (New:NewType, New::Rank, New::Indices, New::Initializers): New
4807 members to hold data about array creation.
4808 (New:New): Modify to update NewType
4809 (New:New): New Overloaded contructor for the array creation
4812 * cs-parser.jay (array_creation_expression): Implement to call
4813 the overloaded New constructor.
4815 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
4817 * class.cs (TypeContainer::Constructors): Return member
4818 constructors instead of returning null.
4820 2001-08-26 Miguel de Icaza <miguel@ximian.com>
4822 * typemanager.cs (InitCoreTypes): Initialize the various core
4823 types after we have populated the type manager with the user
4824 defined types (this distinction will be important later while
4825 compiling corlib.dll)
4827 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
4828 on Expression Classification. Now all expressions have a method
4829 `Resolve' and a method `Emit'.
4831 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
4832 generation from working. Also add some temporary debugging
4835 2001-08-24 Miguel de Icaza <miguel@ximian.com>
4837 * codegen.cs: Lots of code generation pieces. This is only the
4838 beginning, will continue tomorrow with more touches of polish. We
4839 handle the fundamentals of if, while, do, for, return. Others are
4840 trickier and I need to start working on invocations soon.
4842 * gen-treedump.cs: Bug fix, use s.Increment here instead of
4845 * codegen.cs (EmitContext): New struct, used during code
4846 emission to keep a context. Most of the code generation will be
4849 * cs-parser.jay: Add embedded blocks to the list of statements of
4850 this block. So code generation proceeds in a top down fashion.
4852 2001-08-23 Miguel de Icaza <miguel@ximian.com>
4854 * statement.cs: Add support for multiple child blocks.
4856 2001-08-22 Miguel de Icaza <miguel@ximian.com>
4858 * codegen.cs (EmitCode): New function, will emit the code for a
4859 Block of code given a TypeContainer and its ILGenerator.
4861 * statement.cs (Block): Standard public readonly optimization.
4862 (Block::Block constructors): Link children.
4863 (Block::Child): Child Linker.
4864 (Block::EmitVariables): Emits IL variable declarations.
4866 * class.cs: Drop support for MethodGroups here, delay until
4868 (Method::): Applied the same simplification that I did before, and
4869 move from Properties to public readonly fields.
4870 (Method::ParameterTypes): Returns the parameter types for the
4871 function, and implements a cache that will be useful later when I
4872 do error checking and the semantic analysis on the methods is
4874 (Constructor::GetCallingConvention): Renamed from CallingConvetion
4875 and made a method, optional argument tells whether this is a class
4876 or a structure to apply the `has-this' bit.
4877 (Method::GetCallingConvention): Implement, returns the calling
4879 (Method::Define): Defines the type, a second pass is performed
4880 later to populate the methods.
4882 (Constructor::ParameterTypes): implement a cache similar to the
4883 one on Method::ParameterTypes, useful later when we do semantic
4886 (TypeContainer::EmitMethod): New method. Emits methods.
4888 * expression.cs: Removed MethodGroup class from here.
4890 * parameter.cs (Parameters::GetCallingConvention): new method.
4892 2001-08-21 Miguel de Icaza <miguel@ximian.com>
4894 * class.cs (TypeContainer::Populate): Drop RootContext from the
4897 (Constructor::CallingConvention): Returns the calling convention.
4898 (Constructor::ParameterTypes): Returns the constructor parameter
4901 (TypeContainer::AddConstructor): Keep track of default constructor
4902 and the default static constructor.
4904 (Constructor::) Another class that starts using `public readonly'
4905 instead of properties.
4907 (Constructor::IsDefault): Whether this is a default constructor.
4909 (Field::) use readonly public fields instead of properties also.
4911 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
4912 track of static constructors; If none is used, turn on
4913 BeforeFieldInit in the TypeAttributes.
4915 * cs-parser.jay (opt_argument_list): now the return can be null
4916 for the cases where there are no arguments.
4918 (constructor_declarator): If there is no implicit `base' or
4919 `this', then invoke the default parent constructor.
4921 * modifiers.cs (MethodAttr): New static function maps a set of
4922 modifiers flags into a MethodAttributes enum
4923 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
4924 MethodAttr, TypeAttr to represent the various mappings where the
4926 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
4928 2001-08-19 Miguel de Icaza <miguel@ximian.com>
4930 * parameter.cs (GetParameterInfo): Fix bug where there would be no
4933 * interface.cs (PopulateIndexer): Implemented the code generator
4934 for interface indexers.
4936 2001-08-17 Miguel de Icaza <miguel@ximian.com>
4938 * interface.cs (InterfaceMemberBase): Now we track the new status
4941 (PopulateProperty): Implement property population. Woohoo! Got
4942 Methods and Properties going today.
4944 Removed all the properties for interfaces, and replaced them with
4945 `public readonly' fields.
4947 2001-08-16 Miguel de Icaza <miguel@ximian.com>
4949 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
4950 initialize their hashtables/arraylists only when they are needed
4951 instead of doing this always.
4953 * parameter.cs: Handle refs and out parameters.
4955 * cs-parser.jay: Use an ArrayList to construct the arguments
4956 instead of the ParameterCollection, and then cast that to a
4959 * parameter.cs: Drop the use of ParameterCollection and use
4960 instead arrays of Parameters.
4962 (GetParameterInfo): Use the Type, not the Name when resolving
4965 2001-08-13 Miguel de Icaza <miguel@ximian.com>
4967 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
4968 and instead use public readonly fields.
4970 * class.cs: Put back walking code for type containers.
4972 2001-08-11 Miguel de Icaza <miguel@ximian.com>
4974 * class.cs (MakeConstant): Code to define constants.
4976 * rootcontext.cs (LookupType): New function. Used to locate types
4979 2001-08-08 Miguel de Icaza <miguel@ximian.com>
4981 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
4982 this System.Reflection code is. Kudos to Microsoft
4984 * typemanager.cs: Implement a type cache and avoid loading all
4985 types at boot time. Wrap in LookupType the internals. This made
4986 the compiler so much faster. Wow. I rule!
4988 * driver.cs: Make sure we always load mscorlib first (for
4989 debugging purposes, nothing really important).
4991 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
4992 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
4994 * rootcontext.cs: Lookup types on their namespace; Lookup types
4995 on namespaces that have been imported using the `using' keyword.
4997 * class.cs (TypeContainer::TypeAttr): Virtualize.
4998 (Class::TypeAttr): Return attributes suitable for this bad boy.
4999 (Struct::TypeAttr): ditto.
5000 Handle nested classes.
5001 (TypeContainer::) Remove all the type visiting code, it is now
5002 replaced with the rootcontext.cs code
5004 * rootcontext.cs (GetClassBases): Added support for structs.
5006 2001-08-06 Miguel de Icaza <miguel@ximian.com>
5008 * interface.cs, statement.cs, class.cs, parameter.cs,
5009 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
5010 Drop use of TypeRefs, and use strings instead.
5012 2001-08-04 Miguel de Icaza <miguel@ximian.com>
5016 * class.cs (Struct::Struct): set the SEALED flags after
5017 checking the modifiers.
5018 (TypeContainer::TypeAttr): new property, returns the
5019 TypeAttributes for a class.
5021 * cs-parser.jay (type_list): Oops, list production was creating a
5022 new list of base types.
5024 * rootcontext.cs (StdLib): New property.
5025 (GetInterfaceTypeByName): returns an interface by type name, and
5026 encapsulates error handling here.
5027 (GetInterfaces): simplified.
5028 (ResolveTree): Encapsulated all the tree resolution here.
5029 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
5032 * driver.cs: Add support for --nostdlib, to avoid loading the
5034 (Main): Do not put tree resolution here.
5036 * rootcontext.cs: Beginning of the class resolution.
5038 2001-08-03 Miguel de Icaza <miguel@ximian.com>
5040 * rootcontext.cs: Provide better error reporting.
5042 * cs-parser.jay (interface_base): set our $$ to be interfaces.
5044 * rootcontext.cs (CreateInterface): Handle the case where there
5045 are no parent interfaces.
5047 (CloseTypes): Routine to flush types at the end.
5048 (CreateInterface): Track types.
5049 (GetInterfaces): Returns an array of Types from the list of
5052 * typemanager.c (AddUserType): Mechanism to track user types (puts
5053 the type on the global type hash, and allows us to close it at the
5056 2001-08-02 Miguel de Icaza <miguel@ximian.com>
5058 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
5059 RecordInterface instead.
5061 * cs-parser.jay: Updated to reflect changes above.
5063 * decl.cs (Definition): Keep track of the TypeBuilder type that
5064 represents this type here. Not sure we will use it in the long
5065 run, but wont hurt for now.
5067 * driver.cs: Smaller changes to accomodate the new code.
5069 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
5072 * rootcontext.cs (CreateInterface): New method, used to create
5073 the System.TypeBuilder type for interfaces.
5074 (ResolveInterfaces): new entry point to resolve the interface
5076 (CodeGen): Property, used to keep track of the code generator.
5078 2001-07-26 Miguel de Icaza <miguel@ximian.com>
5080 * cs-parser.jay: Add a second production for delegate_declaration
5083 (enum_body): Put an opt_comma here instead of putting it on
5084 enum_body or enum_member_declarations so we can handle trailing
5085 commas on enumeration members. Gets rid of a shift/reduce.
5087 (type_list): Need a COMMA in the middle.
5089 (indexer_declaration): Tell tokenizer to recognize get/set
5091 * Remove old targets.
5093 * Re-add the parser target.
5095 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5097 * cs-parser.jay: Add precendence rules for a number of operators
5098 ot reduce the number of shift/reduce conflicts in the grammar.
5100 2001-07-17 Miguel de Icaza <miguel@ximian.com>
5102 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
5105 Get rid of old crufty code.
5107 * rootcontext.cs: Use this to keep track of the parsed
5108 representation and the defined types available to the program.
5110 * gen-treedump.cs: adjust for new convention.
5112 * type.cs: Split out the type manager, and the assembly builder
5115 * typemanager.cs: the type manager will live here now.
5117 * cil-codegen.cs: And the code generator here.
5119 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
5121 * makefile: Fixed up for easy making.
5123 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5125 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
5128 (unary_expression): Expand pre_increment_expression and
5129 post_decrement_expression to reduce a shift/reduce.
5131 2001-07-11 Simon Cozens
5133 * cs-tokenizer.cs: Hex numbers should begin with a 0.
5135 Improve allow_keyword_as_indent name.
5137 2001-06-19 Miguel de Icaza <miguel@ximian.com>
5139 * Adjustments for Beta2.
5141 2001-06-13 Miguel de Icaza <miguel@ximian.com>
5143 * decl.cs: Added `Define' abstract method.
5144 (InTransit): new property, used to catch recursive definitions.
5146 * interface.cs: Implement `Define'.
5148 * modifiers.cs: Map Modifiers.constants to
5149 System.Reflection.TypeAttribute flags.
5151 * class.cs: Keep track of types and user-defined types.
5152 (BuilderInit): New method for creating an assembly
5153 (ResolveType): New function to launch the resolution process, only
5154 used by interfaces for now.
5156 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
5157 that are inserted into the name space.
5159 2001-06-08 Miguel de Icaza <miguel@ximian.com>
5161 * ARGH. I have screwed up my tree so many times due to the use of
5162 rsync rather than using CVS. Going to fix this at once.
5164 * driver.cs: Objetify driver. Load assemblies, use assemblies to
5167 2001-06-07 Miguel de Icaza <miguel@ximian.com>
5169 * Experiment successful: Use System.Type rather that our own
5172 2001-05-25 Miguel de Icaza <miguel@ximian.com>
5174 * cs-parser.jay: Removed nsAliases from here.
5176 Use new namespaces, handle `using XXX;'
5178 * namespace.cs: Reimplemented namespace handling, use a recursive
5179 definition of the class. Now we can keep track of using clauses
5180 and catch invalid using clauses.
5182 2001-05-24 Miguel de Icaza <miguel@ximian.com>
5184 * gen-treedump.cs: Adapted for all the renaming.
5186 * expression.cs (Expression): this class now has a Type property
5187 which returns an expression Type.
5189 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
5190 `Type', as this has a different meaning now in the base
5192 2001-05-22 Miguel de Icaza <miguel@ximian.com>
5194 * interface.cs, class.cs: Removed from all the sources the
5195 references to signature computation, as we can not do method
5196 signature computation during the parsing time, as we are not
5197 trying to solve at that point distinguishing:
5201 void a (NS.Blah x) {}
5204 Which depending on the context might be valid or not, as we do not
5205 know if Blah is the same thing as NS.Blah at that point.
5207 * Redid everything so the code uses TypeRefs now instead of
5208 Types. TypeRefs are just temporary type placeholders, that need
5209 to be resolved. They initially have a pointer to a string and the
5210 current scope in which they are used. This is used later by the
5211 compiler to resolve the reference to an actual Type.
5213 * DeclSpace is no longer a CIR.Type, and neither are
5214 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
5215 are all DeclSpaces, but no Types.
5217 * type.cs (TypeRefManager): This implements the TypeRef manager,
5218 which keeps track of all the types that need to be resolved after
5219 the parsing has finished.
5221 2001-05-13 Miguel de Icaza <miguel@ximian.com>
5223 * ARGH. We are going to have to store `foreach' as a class rather
5224 than resolving it, as we need to verify error 1579 after name
5225 resolution. *OR* we could keep a flag that says `This request to
5226 IEnumerator comes from a foreach statement' which we can then use
5227 to generate the error.
5229 2001-05-10 Miguel de Icaza <miguel@ximian.com>
5231 * class.cs (TypeContainer.AddMethod): we now add methods to the
5232 MethodGroup instead of the method hashtable.
5234 * expression.cs: Add MethodGroup abstraction, which gets us one
5235 step closer to the specification in the way we handle method
5238 * cs-parser.jay (primary_expression): qualified_identifier now
5239 tried to match up an identifier to a local variable reference or
5240 to a parameter reference.
5242 current_local_parameters is now a parser global variable that
5243 points to the current parameters for the block, used during name
5246 (property_declaration): Now creates an implicit `value' argument to
5249 2001-05-09 Miguel de Icaza <miguel@ximian.com>
5251 * parameter.cs: Do not use `param' arguments as part of the
5252 signature, per the spec.
5254 2001-05-08 Miguel de Icaza <miguel@ximian.com>
5256 * decl.cs: Base class for classes, structs and interfaces. This
5257 is the "Declaration Space"
5259 * cs-parser.jay: Use CheckDef for checking declaration errors
5260 instead of having one on each function.
5262 * class.cs: Factor out some code for handling error handling in
5263 accordance to the "Declarations" section in the "Basic Concepts"
5264 chapter in the ECMA C# spec.
5266 * interface.cs: Make all interface member classes derive from
5267 InterfaceMemberBase.
5269 2001-05-07 Miguel de Icaza <miguel@ximian.com>
5271 * Many things: all interfaces are parsed and generated in
5272 gen-treedump. Support for member variables, constructors,
5273 destructors, properties, constants is there.
5275 Beginning of the IL backend, but very little done, just there for
5278 2001-04-29 Miguel de Icaza <miguel@ximian.com>
5280 * cs-parser.jay: Fix labeled statement.
5282 * cs-tokenizer.cs (escape): Escape " and ' always.
5283 ref_line, ref_name: keep track of the line/filename as instructed
5284 by #line by the compiler.
5287 2001-04-27 Miguel de Icaza <miguel@ximian.com>
5289 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
5290 to match the values in System.CodeDOM.
5292 Divid renamed to Divide.
5294 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
5296 (Statements.set): remove.
5298 * System.CodeDOM/CodeCatchClause.cs: always have a valid
5301 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
5302 falseStatements always have valid values.
5304 * cs-parser.jay: Use System.CodeDOM now.