1 2002-02-13 Miguel de Icaza <miguel@ximian.com>
3 * driver.cs (GetSystemDir): Compute correctly the location of our
4 system assemblies. I was using the compiler directory instead of
7 2002-02-13 Ravi Pratap <ravi@ximian.com>
9 * expression.cs (BetterFunction): Put back in what Miguel commented out
10 since it is the correct fix. The problem is elsewhere ;-)
12 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
13 parameters of the parms method are themselves compatible or not !
15 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16 to check that a class implements an interface before saying that an implicit
17 conversion was allowed. Use ImplementsInterface to do the checking.
19 2002-02-13 Miguel de Icaza <miguel@ximian.com>
21 * class.cs (Method.Define): Track whether we are an explicit
22 implementation or not. And only call DefineMethodOverride if we
23 are an explicit implementation.
25 (Property.DefineMethod): Ditto.
27 2002-02-11 Ravi Pratap <ravi@ximian.com>
29 * expression.cs (BetterFunction): Catch hideous bug which was
30 preventing us from detecting ambiguous calls due to implicit casts i.e
33 2002-01-29 Miguel de Icaza <miguel@ximian.com>
35 * support.cs (Pair): Remove un-needed method. I figured why I was
36 getting the error in cs-parser.jay, the variable in a foreach loop
37 is readonly, and the compiler does not really treat this as a variable.
39 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
40 instead of EQUALS in grammar.
42 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
44 * expression.cs (Unary.DoResolve): Check whether the argument is
47 2002-01-28 Miguel de Icaza <miguel@ximian.com>
49 * support.cs: Api for Pair to set a value. Despite the fact that
50 the variables are public the MS C# compiler refuses to compile
51 code that accesses the field if the variable is part of a foreach
54 * statement.cs (Fixed): Begin implementation of the fixed
57 (Block.AddVariable): Return the VariableInfo on success and null
58 on failure instead of true/false.
60 * cs-parser.jay (foreach): Catch errors on variables already
61 defined (we were ignoring this value before) and properly unwind
64 (fixed_statement): grammar for the fixed statement.
66 2002-01-25 Miguel de Icaza <miguel@ximian.com>
68 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
69 pointer types to be incretemented.
73 * cs-parser.jay (pointer_member_access): Implement
74 expr->IDENTIFIER production.
76 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
77 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
80 (Unary): Implement indirection.
82 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
83 use in non-unsafe context).
85 (SimpleName.DoResolve): Check for pointers in field access on safe
88 (Expression.LoadFromPtr): Factor the load-indirect code in this
89 function. This was duplicated in UnboxCast and ParameterReference
91 2002-01-24 Miguel de Icaza <miguel@ximian.com>
93 * expression.cs (ComposedCast): report an error if a pointer cast
94 is used in a safe region.
96 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
97 pointer type casts in unsafe context.
99 * codegen.cs (EmitContext): Set up IsUnsafe.
101 * cs-parser.jay (non_expression_type): Add productions for pointer
104 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
105 code. We should not use force into static mode if the method is
106 not virtual. Fixes bug in MIS
108 * statement.cs (Do.Emit, While.Emit, For.Emit,
109 Statement.EmitBoolExpression): Add support to Do and While to
110 propagate infinite loop as `I do return' semantics.
112 Improve the For case to also test for boolean constants.
114 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
115 to the list of attributes we can add.
117 Remove `EmitContext' argument.
119 * class.cs (Method.Define): Apply parameter attributes.
120 (Constructor.Define): Apply parameter attributes.
121 (MethodCore.LabelParameters): Move here the core of labeling
124 * support.cs (ReflectionParameters.ParameterModifier,
125 InternalParameters.ParameterModifier): Use IsByRef on the type and
126 only return the OUT bit for these parameters instead of in/out/ref
129 This is because I miss-understood things. The ParameterInfo.IsIn
130 and IsOut represent whether the parameter has the [In] and [Out]
133 2002-01-22 Miguel de Icaza <miguel@ximian.com>
135 * ecore.cs (FieldExpr.Emit): Release temporaries.
137 * assign.cs (LocalTemporary.Release): new function.
139 * codegen.cs (EmitContext.GetTemporaryStorage,
140 EmitContext.FreeTemporaryStorage): Rework the way we deal with
141 temporary storage. Now we can "put back" localbuilders when we
144 2002-01-21 Miguel de Icaza <miguel@ximian.com>
146 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
147 need to make a copy of the variable to generate verifiable code.
149 2002-01-19 Miguel de Icaza <miguel@ximian.com>
151 * driver.cs: Compute dynamically the system directory.
153 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
154 Slower, but more generally useful. Used by the abstract
155 registering implementation.
157 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
158 the rules for the special rule on Type/instances. First check if
159 we have the same name, and if so, try that special static path
160 rather than the instance path.
162 2002-01-18 Miguel de Icaza <miguel@ximian.com>
164 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
167 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
168 Enum, ValueType, Delegate or Array for non-corlib compiles.
170 * cs-tokenizer.cs: Catch long identifiers (645)
172 * typemanager.cs (IndexerPropetyName): Ravi never tested this
175 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
176 fix, we were returning too early, so we were not registering
177 pending methods from abstract classes.
179 Do not register pending methods if the class is abstract.
181 * expression.cs (Conditional.DoResolve): Report circular implicit
182 conversions when we neecd to compute it for conditional
185 (Is.DoResolve): If the expression is always of the provided type,
186 flag warning 183. If the expression can not ever be of the
187 provided type flag warning 184.
189 * class.cs: Catch 169 as well.
191 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
194 2002-01-18 Nick Drochak <ndrochak@gol.com>
196 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
198 2002-01-17 Miguel de Icaza <miguel@ximian.com>
200 * interface.cs: (PopulateMethod): Check for pointers being defined
201 only if the unsafe context is active.
202 (PopulateProperty): ditto.
203 (PopulateIndexer): ditto.
205 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
206 specified. If pointers are present, make sure that they are
207 present in an unsafe context.
208 (Constructor, Constructor.Define): ditto.
209 (Field, Field.Define): ditto.
210 (Property, Property.Define): ditto.
211 (Event, Event.Define): ditto.
213 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
214 hashtable if there are classes or structs defined.
216 * expression.cs (LocalVariableReference.DoResolve): Simplify this
217 code, as the constant resolution moved.
219 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
220 the metadata, so we can flag error 133.
222 * decl.cs (MemberCore.UnsafeOK): New function to test that a
223 pointer is being declared in an unsafe context.
225 2002-01-16 Miguel de Icaza <miguel@ximian.com>
227 * modifiers.cs (Modifiers.Check): Require a Location argument.
228 Report error 227 for Unsafe use.
230 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
232 * statement.cs (For.Emit): If the test is null, then report that
233 we do `return', as we wont reach anything afterwards.
235 (Switch.SwitchGoverningType): Track the expression that matched
238 * driver.cs: Allow negative numbers as an error code to flag.
240 * cs-parser.jay: Handle 1551.
242 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
244 2002-01-15 Miguel de Icaza <miguel@ximian.com>
246 * cs-parser.jay: Report 1518 (type declaration can only contain
247 class, struct, interface, enum or delegate)
249 (switch_label): Report 1523 (keywords `case' or `default' must
252 (opt_switch_sections): Report 1522 (empty switch)
254 * driver.cs: Report 1515 (response file specified multiple times)
255 Report 1516 (Source file specified multiple times).
257 * expression.cs (Argument.Resolve): Signal 1510
259 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
260 access not allowed in static code)
262 2002-01-11 Ravi Pratap <ravi@ximian.com>
264 * typemanager.cs (IsPointerType): Utility method which we are going
267 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
268 the object type, so we take care of that.
270 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
272 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
273 added to non-params parameters :-)
275 * typemanager.cs (CSharpName): Include 'void' type too.
277 (void_ptr_type): Include in the set of core types.
279 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
282 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
285 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
286 completely forgotten about it.
288 2002-01-10 Ravi Pratap <ravi@ximian.com>
290 * cs-parser.jay (pointer_type): Add. This begins our implementation
291 of parsing rules for unsafe code.
293 (unsafe_statement): Implement.
295 (embedded_statement): Modify to include the above.
297 * statement.cs (Unsafe): Implement new class for unsafe blocks.
299 * codegen.cs (EmitContext.InUnsafe): Add. This determines
300 if the current context is an unsafe one.
302 * cs-parser.jay (local_variable_pointer_type): Since local variable types
303 are handled differently, we need separate rules for them.
305 (local_variable_declaration): Update to use local_variable_pointer_type
306 to allow variable declarations of unmanaged pointer types.
308 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
311 * ../errors/cs0214.cs : Add.
313 2002-01-16 Nick Drochak <ndrochak@gol.com>
315 * makefile: remove 'response' file when cleaning.
317 2002-01-15 Miguel de Icaza <miguel@ximian.com>
319 * cs-parser.jay: Report 1524.
321 2002-01-14 Miguel de Icaza <miguel@ximian.com>
323 * typemanager.cs (RegisterMethod): drop checking if we have
324 registered this from here
326 2002-01-12 Miguel de Icaza <miguel@ximian.com>
328 * class.cs (Method.EmitDestructor): Implement calling our base
331 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
334 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
335 this routine and will wrap the call in a try/catch block. Deal
338 2002-01-11 Miguel de Icaza <miguel@ximian.com>
340 * ecore.cs (Expression.MemberLookup): instead of taking a
341 parameter `same_type' that was used to tell whether we could
342 access private members we compute our containing type from the
345 (FieldExpr): Added partial support for volatile fields. This does
346 not work for volatile fields exposed from assemblies, as I can not
347 figure out how to extract the modreq from it.
349 Updated all the source files to use this.
351 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
352 because it is referenced by MemberLookup very often.
354 2002-01-09 Ravi Pratap <ravi@ximian.com>
356 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
357 TypeBuilder.GetCustomAttributes to retrieve what we need.
359 Get rid of redundant default_member_attr_type as this is the same as
360 default_member_type which already exists.
362 * interface.cs, attribute.cs : Update accordingly.
364 2002-01-08 Miguel de Icaza <miguel@ximian.com>
366 * typemanager.cs: Enable IndexerPropertyName again. It does not
367 work for TYpeBuilders though. Ravi, can you please fix this?
369 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
371 * expression.cs (Argument.Emit): Handle the case of ref objects
372 being passed to ref functions;
374 (ParameterReference.EmitLoad): Loads the content of the pointer
375 without dereferencing.
377 2002-01-07 Miguel de Icaza <miguel@ximian.com>
379 * cs-tokenizer.cs: Implemented the pre-processing expressions.
381 2002-01-08 Ravi Pratap <ravi@ximian.com>
383 * class.cs (Indexer.DefineMethod): Incorporate the interface
384 type in the name of the method if we are doing explicit interface
387 * expression.cs (ConversionExists): Remove as it is completely obsolete.
389 (BetterConversion): Fix extremely trivial bug where we were referring to
390 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
393 * ../errors/bug16.cs : Add although we have fixed it.
395 2002-01-07 Miguel de Icaza <miguel@ximian.com>
397 * expression.cs (BaseIndexer): Begin implementation.
399 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
401 * cs-parser.jay (indexer_declarator): Use qualified_identifier
402 production directly to remove a shift/reduce, and implement
403 explicit interface implementation.
405 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
406 after a floating point suffix.
408 * expression.cs (DoNumericPromotions): Improved the conversion for
409 uint/uint. If we have a constant, we avoid doing a typecast to a
412 * class.cs (Indexer): Implement explicit interface implementation
415 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
417 * class.cs: make the default instance constructor public and hidebysig.
419 2001-01-03 Ravi Pratap <ravi@ximian.com>
421 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
422 so we can call it from elsewhere.
424 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
425 we emit it internally if the class has a defined indexer; otherwise the user
426 emits it by decorating the class definition with the DefaultMemberAttribute.
428 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
429 attribute is not used on a type which defines an indexer.
431 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
432 character when we skip whitespace.
434 * ../errors/cs0646.cs : Add.
436 2002-01-03 Miguel de Icaza <miguel@ximian.com>
438 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
441 * makefile: Add practical target `mcs3.exe' which builds the third
444 * expression.cs (New): Fix structures constructor calling.
446 * class.cs (Property, Method, Indexer): Emit Final flag on the
447 method if we are an interface implementation and we are not
450 * ecore.cs (PropertyExpr): New public field `IsBase', tells
451 whether this property is referencing a `base' method.
453 * expression.cs (Invocation.EmitCall): take an extra argument:
454 is_base, this is used to determine whether the `call' or
455 `callvirt' opcode should be used.
458 * delegate.cs: update EmitCall.
460 * class.cs (Method.Define): Set NewSlot for the cases where we are
461 not implementing an interface method.
463 (Property.Define): ditto.
465 2002-01-02 Miguel de Icaza <miguel@ximian.com>
467 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
468 'r'. Allows mcs to parse itself fully.
470 2002-01-02 Ravi Pratap <ravi@ximian.com>
472 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
473 of the number of initializers that require the InitializeArray method.
475 (CheckIndices): Store the Expression in all cases - not the plain value. Also
476 update the above field where necessary.
478 (MakeByteBlob): Update accordingly.
480 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
483 (EmitDynamicInitializers): Update in accordance with the new optimization.
485 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
488 * cs-parser.jay : Fix some glaring errors I introduced.
490 2002-01-01 Ravi Pratap <ravi@ximian.com>
492 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
493 so that we can check for name clashes there too.
495 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
496 for interface indexers.
498 * interfaces.cs (Define): Emit the default member attribute.
500 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
501 variable was being referred to while setting the value ;-)
503 2002-01-01 Miguel de Icaza <miguel@ximian.com>
505 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
506 byte-by-byte information when we know the data is zero.
508 Make the block always a multiple of 4, because
509 DefineInitializedData has a bug.
511 * assign.cs: Fix, we should assign from the temporary, not from
514 * expression.cs (MakeByteBlob): Fix my incorrect code.
516 2001-12-31 Miguel de Icaza <miguel@ximian.com>
518 * typemanager.cs (EnumToUnderlying): This function is used to get
519 the underlying type from an enumeration, because it does not
522 * constant.cs: Use the I4_S form for values between -128 and 127.
524 * statement.cs (Block.LookupLabel): Looks up a label.
525 (Block): Drop support for labeled blocks.
527 (LabeledStatement): New kind of statement that represents a label
530 (Goto): Finally implement this bad boy.
532 * cs-parser.jay: Update to reflect new mechanism to implement
535 2001-12-30 Miguel de Icaza <miguel@ximian.com>
537 * codegen.cs (EmitContext.This): a codegen property that keeps the
538 a single instance of this instead of creating many different this
541 * delegate.cs (Delegate.DoResolve): Update to use the property;
543 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
545 * expression.cs (BaseAccess.DoResolve): Ditto.
547 2001-12-29 Ravi Pratap <ravi@ximian.com>
549 * typemanager.cs (methodimpl_attr_type): Add to hold the type
550 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
552 (InitCoreTypes): Update accordingly.
554 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
555 so we can quickly store the state.
557 (ApplyAttributes): Set the correct implementation flags
558 for InternalCall methods.
560 2001-12-29 Miguel de Icaza <miguel@ximian.com>
562 * expression.cs (EmitCall): if a method is not virtual, then do
563 not use callvirt on it.
565 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
566 user defined stuff) requires the use of stobj, which takes an
567 address on the stack instead of an array and an index. So emit
568 the Ldelema operation for it.
570 (EmitStoreOpcode): Use stobj for valuetypes.
572 (UnaryMutator.EmitCode): Use the right 1 value depending on
573 whether we are dealing with int64/uint64, float or doubles.
575 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
576 constructors that I implemented last night.
578 (Constructor.IsDefault): Fix to work properly for static
581 * cs-parser.jay (CheckDef): report method signature errors.
582 Update error number 103 to be 132.
584 * decl.cs: New AdditionResult enumeration value: MethodExists.
585 Although we do this check for methods later on in the semantic
586 analysis, catching repeated default constructors is so easy that
589 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
592 (ParameterReference.EmitAssign, Emit): handle
595 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
596 (ArrayAccess.EmitStoreOpcode): ditto.
598 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
600 * expression.cs (MakeByteBlob): Complete all the missing types
601 (uint, short, ushort, byte, sbyte)
603 * class.cs: Only init instance field initializers on instance
606 Rename `constructors' to instance_constructors.
608 (TypeContainer.AddConstructor): Only add constructors to the list
611 Make sure that we handle default_static_constructor independently
612 everywhere where we handle instance_constructors
614 2001-12-28 Miguel de Icaza <miguel@ximian.com>
616 * class.cs: Do not lookup or create a base initializer for a
619 (ConstructorInitializer.Resolve): use the proper type to lookup
622 * cs-parser.jay: Report error 1585 (modifiers between type and name).
624 * enum.cs, interface.cs: Remove CloseType, this is taken care by
627 * decl.cs: CloseType is now an virtual method, the default
628 implementation just closes this type.
630 2001-12-28 Ravi Pratap <ravi@ximian.com>
632 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
633 to PreserveSig by default. Also emit HideBySig on such methods.
635 Basically, set the defaults to standard values.
637 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
638 argument, if candidate is better, it can't be worse than the best !
640 (Invocation): Re-write bits to differentiate between methods being
641 applicable in their expanded form and their normal form - for params
644 Get rid of use_standard everywhere as only standard conversions are allowed
645 in overload resolution.
647 More spec conformance.
649 2001-12-27 Miguel de Icaza <miguel@ximian.com>
651 * driver.cs: Add --timestamp, to see where the compiler spends
654 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
655 `this' in static code.
657 (SimpleName.DoResolve): Implement in terms of a helper function
658 that allows static-references to be passed upstream to
661 (Expression.ResolveWithSimpleName): Resolve specially simple
662 names when called by MemberAccess to implement the special
665 (Expression.ImplicitReferenceConversion): Handle conversions from
666 Null to reference types before others, as Null's type is
669 * expression.cs (Invocation.EmitCall): Handle the special case of
670 calling methods declared on a reference type from a ValueType
671 (Base classes System.Object and System.Enum)
673 (MemberAccess.Resolve): Only perform lookups on Enumerations if
674 the left hand side is a TypeExpr, not on every enumeration.
676 (Binary.Resolve): If types are reference types, then do a cast to
677 object on operators != and == of both arguments.
679 * typemanager.cs (FindMembers): Extract instance and static
680 members if requested.
682 * interface.cs (PopulateProperty): Use void_type instead of null
683 as the return type for the setter method.
685 (PopulateIndexer): ditto.
687 2001-12-27 Ravi Pratap <ravi@ximian.com>
689 * support.cs (ReflectionParameters): Fix minor bug where we
690 were examining the wrong parameter for the ParamArray attribute.
692 Cope with requests for the type of the parameter at position
693 greater than the params parameter's. We now return the element
694 type of the params array as that makes more sense.
696 * expression.cs (Invocation.IsParamsMethodApplicable): Update
697 accordingly as we no longer have to extract the element type
700 (Invocation.OverloadResolve): Update.
702 2001-12-27 Miguel de Icaza <miguel@ximian.com>
704 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
705 against IEnumerator, test whether the return value is a descendant
706 of the IEnumerator interface.
708 * class.cs (Indexer.Define): Use an auxiliary method to implement
709 the other bits of the method definition. Begin support for
710 explicit interface implementation.
712 (Property.DefineMethod): Use TypeManager.void_type instead of null
713 for an empty return value.
715 2001-12-26 Miguel de Icaza <miguel@ximian.com>
717 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
718 dealing with a FieldExpr which is composed of a FieldBuilder, in
719 the code path we did extract the constant, but we should have
720 obtained the underlying value to be able to cast it (otherwise we
721 end up in an infinite loop, this is what Ravi was running into).
723 (ArrayCreation.UpdateIndices): Arrays might be empty.
725 (MemberAccess.ResolveMemberAccess): Add support for section
726 14.5.4.1 that deals with the special case of E.I when E is a type
727 and something else, that I can be a reference to a static member.
729 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
730 handle a particular array type to create byte blobs, it is just
731 something we dont generate byteblobs for.
733 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
736 * location.cs (Push): remove the key from the hashtable that we
737 are about to add. This happens for empty files.
739 * driver.cs: Dispose files after we have parsed them.
741 (tokenize): new function that only runs the tokenizer on its
742 input, for speed testing.
744 2001-12-26 Ravi Pratap <ravi@ximian.com>
746 * class.cs (Event.Define): Define the private field only if there
747 are no accessors defined.
749 * expression.cs (ResolveMemberAccess): If there is no associated
750 field with the event, that means we have an event defined with its
751 own accessors and we should flag error cs0070 since transforming
752 ourselves into a field is not valid in that case.
754 * ecore.cs (SimpleName.DoResolve): Same as above.
756 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
757 and charset to sane values.
759 2001-12-25 Ravi Pratap <ravi@ximian.com>
761 * assign.cs (DoResolve): Perform check on events only if they
762 are being accessed outside the declaring type.
764 * cs-parser.jay (event_declarations): Update rules to correctly
765 set the type of the implicit parameter etc.
767 (add_accessor, remove_accessor): Set current local parameters.
769 * expression.cs (Binary): For delegate addition and subtraction,
770 cast the return value from the method into the appropriate delegate
773 2001-12-24 Ravi Pratap <ravi@ximian.com>
775 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
776 of these as the workaround is unnecessary.
778 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
779 delegate data - none of that is needed at all.
781 Re-write bits to extract the instance expression and the delegate method
784 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
787 * attribute.cs (ApplyAttributes): New method to take care of common tasks
788 of attaching attributes instead of duplicating code everywhere.
790 * everywhere : Update code to do attribute emission using the above method.
792 2001-12-23 Miguel de Icaza <miguel@ximian.com>
794 * expression.cs (IsParamsMethodApplicable): if there are not
795 parameters, return immediately.
797 * ecore.cs: The 0 literal can be implicity converted to an enum
800 (SimpleName.DoResolve): First lookup the type, then lookup the
803 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
804 want to get its address. If the InstanceExpression is not
805 addressable, store the result in a temporary variable, then get
808 * codegen.cs: Only display 219 errors on warning level or above.
810 * expression.cs (ArrayAccess): Make it implement the
811 IMemoryLocation interface.
813 (Binary.DoResolve): handle the operator == (object a, object b)
814 and operator != (object a, object b) without incurring into a
815 BoxedCast (because 5 != o should never be performed).
817 Handle binary enumerator operators.
819 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
820 value type, otherwise use Ldelem_ref.
822 Use precomputed names;
824 (AddressOf): Implement address of
826 * cs-parser.jay (labeled_statement): Fix recursive block
827 addition by reworking the production.
829 * expression.cs (New.DoEmit): New has a special case:
831 If we are dealing with a ValueType, we have a few
832 situations to deal with:
834 * The target of New is a ValueType variable, that is
835 easy, we just pass this as the variable reference
837 * The target of New is being passed as an argument,
838 to a boxing operation or a function that takes a
841 In this case, we need to create a temporary variable
842 that is the argument of New.
845 2001-12-23 Ravi Pratap <ravi@ximian.com>
847 * rootcontext.cs (LookupType): Check that current_type is not null before
848 going about looking at nested types.
850 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
851 not implement the IAssignMethod interface any more.
853 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
854 where we tranform them into FieldExprs if they are being resolved from within
857 * ecore.cs (SimpleName.DoResolve): Do the same here.
859 * assign.cs (DoResolve, Emit): Clean up code considerably.
861 * ../errors/bug10.cs : Add.
863 * ../errors/cs0070.cs : Add.
865 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
867 * assign.cs : Get rid of EventIsLocal everywhere.
869 2001-12-23 Miguel de Icaza <miguel@ximian.com>
871 * ecore.cs (ConvertIntLiteral): finished the implementation.
873 * statement.cs (SwitchLabel): Convert the value we are using as a
874 key before looking up the table.
876 2001-12-22 Miguel de Icaza <miguel@ximian.com>
878 * codegen.cs (EmitTopBlock): Require a Location argument now.
880 * cs-parser.jay (constructor_declarator): We need to setup
881 current_local_parameters before we parse the
882 opt_constructor_initializer, to allow the variables to be bound
883 to the constructor arguments.
885 * rootcontext.cs (LookupType): First lookup nested classes in our
886 class and our parents before we go looking outside our class.
888 * expression.cs (ConstantFold): Extract/debox the values at the
891 * rootcontext.cs (EmitCode): Resolve the constants first before we
892 resolve the types. This is not really needed, but it helps debugging.
894 * statement.cs: report location.
896 * cs-parser.jay: pass location to throw statement.
898 * driver.cs: Small bug fix.
900 * report.cs: Updated format to be 4-zero filled digits.
902 2001-12-22 Ravi Pratap <ravi@ximian.com>
904 * expression.cs (CheckIndices): Fix minor bug where the wrong
905 variable was being referred to ;-)
907 (DoEmit): Do not call EmitStaticInitializers when the
908 underlying type is System.Object.
910 2001-12-21 Ravi Pratap <ravi@ximian.com>
912 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
913 and do the usual workaround for SRE.
915 * class.cs (MyEventBuilder.EventType): New member to get at the type
916 of the event, quickly.
918 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
920 * assign.cs (Assign.DoResolve): Handle the case when the target
921 is an EventExpr and perform the necessary checks.
923 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
926 (SimpleName.MemberStaticCheck): Include check for EventExpr.
928 (EventExpr): Set the type in the constructor itself since we
929 are meant to be born fully resolved.
931 (EventExpr.Define): Revert code I wrote earlier.
933 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
934 instance expression is null. The instance expression is a This in that case
935 or a null, depending on whether it is a static method or not.
937 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
938 refers to more than one method.
940 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
941 and accordingly flag errors.
943 2001-12-21 Miguel de Icaza <miguel@ximian.com>
945 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
947 2001-12-22 Miguel de Icaza <miguel@ximian.com>
949 * location.cs (ToString): Provide useful rutine.
951 2001-12-21 Miguel de Icaza <miguel@ximian.com>
953 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
954 objects, return the actual integral boxed.
956 * statement.cs (SwitchLabel): define an ILLabel for each
959 (Switch.CheckSwitch): If the value is a Literal, extract
960 the underlying literal.
962 Also in the unused hashtable we had, add the SwitchLabel so we can
963 quickly look this value up.
965 * constant.cs: Implement a bunch of new constants. Rewrite
966 Literal based on this. Made changes everywhere to adapt to this.
968 * expression.cs (Expression.MakeByteBlob): Optimize routine by
969 dereferencing array only once, and also copes with enumrations.
971 bytes are two bytes wide, not one.
973 (Cast): Perform constant conversions.
975 * ecore.cs (TryImplicitIntConversion): Return literals instead of
976 wrappers to the literals here.
978 * expression.cs (DoNumericPromotions): long literals can converted
979 to ulong implicity (this is taken care of elsewhere, but I was
982 * ecore.cs (Expression.Literalize): Make the return type Literal,
983 to improve type checking.
985 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
987 2001-12-20 Miguel de Icaza <miguel@ximian.com>
989 * literal.cs: Revert code from ravi that checked the bounds. The
990 bounds are sane by the definition of the type itself.
992 * typemanager.cs: Fix implementation of ImplementsInterface. We
993 need to actually look up in our parent hierarchy for interfaces
996 * const.cs: Use the underlying type for enumerations
998 * delegate.cs: Compute the basename for the delegate creation,
999 that should fix the delegate test case, and restore the correct
1000 Type Lookup semantics in rootcontext
1002 * rootcontext.cs: Revert Ravi's last patch. The correct way of
1003 referencing a nested type with the Reflection API is using the "+"
1006 * cs-parser.jay: Do not require EOF token at the end.
1008 2001-12-20 Ravi Pratap <ravi@ximian.com>
1010 * rootcontext.cs (LookupType): Concatenate type names with
1011 a '.' instead of a '+' The test suite passes again.
1013 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
1014 field of the enumeration.
1016 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
1017 the case when the member is an EventExpr.
1019 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
1020 static has an associated instance expression.
1022 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
1024 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
1026 * class.cs (Event.Define): Register event and perform appropriate checks
1029 We define the Add and Remove methods even if the use provides none because
1030 in that case, we provide default implementations ourselves.
1032 Define a private field of the type of the event. This is done by the CSC compiler
1033 and we should be doing it too ;-)
1035 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
1036 More methods we use in code we generate.
1038 (multicast_delegate_type, delegate_type): Two separate types since the distinction
1041 (InitCoreTypes): Update accordingly for the above.
1043 * class.cs (Event.Emit): Generate code for default accessors that we provide
1045 (EmitDefaultMethod): Do the job in the above.
1047 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
1050 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1052 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
1053 builders even if we were missing one.
1055 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
1056 pass the Basename as our class name instead of the Name. The
1057 basename will be correctly composed for us.
1059 * parameter.cs (Paramters): Now takes a Location argument.
1061 * decl.cs (DeclSpace.LookupType): Removed convenience function and
1062 make all the code call directly LookupType in RootContext and take
1063 this chance to pass the Location information everywhere.
1065 * Everywhere: pass Location information.
1067 2001-12-19 Miguel de Icaza <miguel@ximian.com>
1069 * class.cs (Constructor.Define): Updated way of detecting the
1070 length of the parameters.
1072 (TypeContainer.DefineType): Use basename as the type name for
1075 (TypeContainer.Define): Do not recursively define types here, as
1076 definition is taken care in order by the RootContext.
1078 * tree.cs: Keep track of namespaces in a per-file basis.
1080 * parameter.cs (Parameter.ComputeSignature): Update to use
1083 (Parameters.GetSignature): ditto.
1085 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
1086 instead of a TypeContainer.
1088 (Interface.SemanticAnalysis): Use `this' instead of our parent to
1089 resolve names. Because we need to be resolve in our context, not
1092 * driver.cs: Implement response files.
1094 * class.cs (TypeContainer.DefineType): If we are defined, do not
1097 (Event.Emit): Emit the code for add/remove handlers.
1098 (Event.Define): Save the MethodBuilders for add/remove.
1100 * typemanager.cs: Use pair here too.
1102 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
1103 DictionaryEntry requires the first argument to be non-null.
1105 (enum_declaration): Compute full name for registering the
1108 (delegate_declaration): Instead of using
1109 formal_parameter_list, use opt_formal_parameter_list as the list
1112 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
1113 (EventParsing): New property that controls whether `add' and
1114 `remove' are returned as tokens or identifiers (for events);
1116 2001-12-19 Ravi Pratap <ravi@ximian.com>
1118 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
1119 use MyEventBuilder only and let it wrap the real builder for us.
1121 (MyEventBuilder): Revamp constructor etc.
1123 Implement all operations that we perform on EventBuilder in precisely the same
1126 (FindMembers): Update to use the EventBuilder member.
1128 (Event.Emit): Update accordingly.
1130 2001-12-18 Ravi Pratap <ravi@ximian.com>
1132 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
1133 by calling the appropriate methods.
1135 (GetCustomAttributes): Make stubs as they cannot possibly do anything
1138 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
1140 2001-12-17 Ravi Pratap <ravi@ximian.com>
1142 * delegate.cs (Delegate.Populate): Check that the return type
1143 and various parameters types are indeed accessible.
1145 * class.cs (Constructor.Define): Same here.
1147 (Field.Define): Ditto.
1149 (Event.Define): Ditto.
1151 (Operator.Define): Check that the underlying Method defined itself
1152 correctly - so it's MethodBuilder should not be null.
1154 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
1155 expression happens to be null.
1157 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
1158 members but as of now we don't seem to be able to do anything really useful with it.
1160 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
1161 not the EventBuilder.
1163 2001-12-18 Miguel de Icaza <miguel@ximian.com>
1165 * cs-tokenizer.cs: Add support for defines.
1166 Add support for #if, #elif, #else, #endif
1168 (eval_var): evaluates a variable.
1169 (eval): stubbed for evaluating functions.
1171 * cs-parser.jay: Pass the defines information
1173 * driver.cs: Add --define command line option.
1175 * decl.cs: Move MemberCore here.
1177 Make it the base class for DeclSpace. This allows us to catch and
1178 report 108 and 109 for everything now.
1180 * class.cs (TypeContainer.Define): Extract all the members
1181 before populating and emit the warning 108 (new keyword required
1182 to override) instead of having each member implement this.
1184 (MemberCore.Define): New abstract method, we will be using this in
1185 the warning reporting engine in Populate.
1187 (Operator.Define): Adjust to new MemberCore protocol.
1189 * const.cs (Const): This does not derive from Expression, it is a
1190 temporary object we use to create fields, it is a MemberCore.
1192 * class.cs (Method.Define): Allow the entry point to be in a
1195 * driver.cs: Rewrite the argument handler to clean it up a bit.
1197 * rootcontext.cs: Made it just an auxiliary namespace feature by
1198 making everything static.
1200 * driver.cs: Adapt code to use RootContext type name instead of
1203 * delegate.cs: Remove RootContext argument.
1205 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
1208 * class.cs (Event.Define): The lookup can fail.
1210 * cs-tokenizer.cs: Begin implementation of pre-procesor.
1212 * expression.cs: Resolve the this instance before invoking the code.
1214 2001-12-17 Miguel de Icaza <miguel@ximian.com>
1216 * cs-parser.jay: Add a production in element_access that allows
1217 the thing to become a "type" reference. This way we can parse
1218 things like "(string [])" as a type.
1220 Note that this still does not handle the more complex rules of
1224 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
1226 * ecore.cs: (CopyNewMethods): new utility function used to
1227 assemble the list of methods from running FindMembers.
1229 (MemberLookup): Rework FindMembers so that
1231 2001-12-16 Miguel de Icaza <miguel@ximian.com>
1233 * class.cs (TypeContainer): Remove Delegates who fail to be
1236 * delegate.cs (Populate): Verify that we dont get null return
1237 values. TODO: Check for AsAccessible.
1239 * cs-parser.jay: Use basename to emit error 574 (destructor should
1240 have the same name as container class), not the full name.
1242 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
1243 possible representation.
1245 Also implements integer type suffixes U and L.
1247 2001-12-15 Miguel de Icaza <miguel@ximian.com>
1249 * expression.cs (ArrayCreation.DoResolve): We need to do the
1250 argument resolution *always*.
1252 * decl.cs: Make this hold the namespace. Hold the root context as
1254 (LookupType): Move here.
1256 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
1258 * location.cs (Row, Name): Fixed the code, it was always returning
1259 references to the first file.
1261 * interface.cs: Register properties defined through interfaces.
1263 * driver.cs: Add support for globbing on the command line
1265 * class.cs (Field): Make it derive from MemberCore as well.
1268 2001-12-15 Ravi Pratap <ravi@ximian.com>
1270 * class.cs (Event::Define): Check that the type of the event is a delegate
1271 type else flag error #66.
1273 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
1276 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
1277 values of EntryPoint, CharSet etc etc.
1279 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
1281 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
1282 be null and we should ignore this. I am not sure if this is really clean. Apparently,
1283 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
1284 which needs this to do its work.
1286 * ../errors/cs0066.cs : Add.
1288 2001-12-14 Miguel de Icaza <miguel@ximian.com>
1290 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
1293 * class.cs: (MethodSignature.MethodSignature): Removed hack that
1294 clears out the parameters field.
1295 (MemberSignatureCompare): Cleanup
1297 (MemberCore): New base class used to share code between MethodCore
1300 (RegisterRequiredImplementations) BindingFlags.Public requires
1301 either BindingFlags.Instace or Static. Use instance here.
1303 (Property): Refactored code to cope better with the full spec.
1305 * parameter.cs (GetParameterInfo): Return an empty array instead
1308 * class.cs (Property): Abstract or extern properties have no bodies.
1310 * parameter.cs (GetParameterInfo): return a zero-sized array.
1312 * class.cs (TypeContainer.MethodModifiersValid): Move all the
1313 method modifier validation to the typecontainer so we can reuse
1316 (MethodCore.ParameterTypes): return an empty sized array of types.
1318 (Property.Define): Test property modifier validity.
1320 Add tests for sealed/override too.
1322 (Method.Emit): abstract or extern methods have no bodies.
1324 2001-12-14 Ravi Pratap <ravi@ximian.com>
1326 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
1329 (Method::Define, ::Emit): Modify accordingly.
1331 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
1333 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
1335 * makefile: Pass in /unsafe.
1337 2001-12-13 Miguel de Icaza <miguel@ximian.com>
1339 * class.cs (MakeKey): Kill routine.
1341 * class.cs (TypeContainer.Define): Correctly define explicit
1342 method implementations (they require the full interface name plus
1345 * typemanager.cs: Deply the PtrHashtable here and stop using the
1346 lame keys. Things work so much better.
1348 This of course broke everyone who depended on `RegisterMethod' to
1349 do the `test for existance' test. This has to be done elsewhere.
1351 * support.cs (PtrHashtable): A hashtable that avoid comparing with
1352 the object stupid Equals method (because, that like fails all over
1353 the place). We still do not use it.
1355 * class.cs (TypeContainer.SetRequiredInterface,
1356 TypeContainer.RequireMethods): Killed these two routines and moved
1357 all the functionality to RegisterRequiredImplementations.
1359 (TypeContainer.RegisterRequiredImplementations): This routine now
1360 registers all the implementations required in an array for the
1361 interfaces and abstract methods. We use an array of structures
1362 which can be computed ahead of time to reduce memory usage and we
1363 also assume that lookups are cheap as most classes will not
1364 implement too many interfaces.
1366 We also avoid creating too many MethodSignatures.
1368 (TypeContainer.IsInterfaceMethod): Update and optionally does not
1369 clear the "pending" bit if we find that there are problems with
1372 (TypeContainer.VerifyPendingMethods): Update to report errors of
1373 methods that look like implementations but are not.
1375 (TypeContainer.Define): Add support for explicit interface method
1378 2001-12-12 Miguel de Icaza <miguel@ximian.com>
1380 * typemanager.cs: Keep track of the parameters here instead of
1381 being a feature of the TypeContainer.
1383 * class.cs: Drop the registration of parameters here, as
1384 InterfaceMethods are also interface declarations.
1386 * delegate.cs: Register methods with the TypeManager not only with
1387 the TypeContainer. This code was buggy.
1389 * interface.cs: Full registation here.
1391 2001-12-11 Miguel de Icaza <miguel@ximian.com>
1393 * expression.cs: Remove reducer for binary expressions, it can not
1396 * const.cs: Put here the code that used to go into constant.cs
1398 * constant.cs: Put here the code for constants, this is a new base
1401 * literal.cs: Make Literal derive from Constant.
1403 2001-12-09 Miguel de Icaza <miguel@ximian.com>
1405 * statement.cs (Return.Emit): Report error 157 if the user
1406 attempts to return from a finally block.
1408 (Return.Emit): Instead of emitting a return, jump to the end of
1411 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
1412 LocalBuilder to store the result of the function. ReturnLabel is
1413 the target where we jump.
1416 2001-12-09 Radek Doulik <rodo@ximian.com>
1418 * cs-parser.jay: remember alias in current namespace
1420 * ecore.cs (SimpleName::DoResolve): use aliases for types or
1423 * class.cs (LookupAlias): lookup alias in my_namespace
1425 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
1427 (LookupAlias): lookup alias in this and if needed in parent
1430 2001-12-08 Miguel de Icaza <miguel@ximian.com>
1434 * rootcontext.cs: (ModuleBuilder) Made static, first step into
1435 making things static. I need this to avoid passing the
1436 TypeContainer when calling ParameterType.
1438 * support.cs (InternalParameters.ParameterType): Remove ugly hack
1439 that did string manipulation to compute the type and then call
1440 GetType. Use Parameter.ParameterType instead.
1442 * cs-tokenizer.cs: Consume the suffix for floating values.
1444 * expression.cs (ParameterReference): figure out whether this is a
1445 reference parameter or not. Kill an extra variable by computing
1446 the arg_idx during emission.
1448 * parameter.cs (Parameters.GetParameterInfo): New overloaded
1449 function that returns whether a parameter is an out/ref value or not.
1451 (Parameter.ParameterType): The type of the parameter (base,
1452 without ref/out applied).
1454 (Parameter.Resolve): Perform resolution here.
1455 (Parameter.ExternalType): The full type (with ref/out applied).
1457 * statement.cs (Using.Emit, Using.EmitExpression): Implement
1458 support for expressions on the using statement.
1460 2001-12-07 Miguel de Icaza <miguel@ximian.com>
1462 * statement.cs (Using.EmitLocalVariableDecls): Split the
1463 localvariable handling of the using statement.
1465 (Block.EmitMeta): Keep track of variable count across blocks. We
1466 were reusing slots on separate branches of blocks.
1468 (Try.Emit): Emit the general code block, we were not emitting it.
1470 Check the type of the declaration to be an IDisposable or
1471 something that can be implicity converted to it.
1473 Emit conversions if required.
1475 * ecore.cs (EmptyExpression): New utility class.
1476 (Expression.ImplicitConversionExists): New utility function.
1478 2001-12-06 Miguel de Icaza <miguel@ximian.com>
1480 * statement.cs (Using): Implement.
1482 * expression.cs (LocalVariableReference): Support read only variables.
1484 * statement.cs: Remove the explicit emit for the Leave opcode.
1485 (VariableInfo): Add a readonly field.
1487 2001-12-05 Miguel de Icaza <miguel@ximian.com>
1489 * ecore.cs (ConvCast): new class used to encapsulate the various
1490 explicit integer conversions that works in both checked and
1493 (Expression.ConvertNumericExplicit): Use new ConvCast class to
1494 properly generate the overflow opcodes.
1496 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1498 * statement.cs: The correct type for the EmptyExpression is the
1499 element_type, not the variable type. Ravi pointed this out.
1501 2001-12-04 Ravi Pratap <ravi@ximian.com>
1503 * class.cs (Method::Define): Handle PInvoke methods specially
1504 by using DefinePInvokeMethod instead of the usual one.
1506 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
1507 above to do the task of extracting information and defining the method.
1509 2001-12-04 Ravi Pratap <ravi@ximian.com>
1511 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
1512 of the condition for string type.
1514 (Emit): Move that here.
1516 (ArrayCreation::CheckIndices): Keep string literals in their expression
1519 (EmitDynamicInitializers): Handle strings appropriately.
1521 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1523 * codegen.cs (EmitContext): Replace multiple variables with a
1524 single pointer to the current Switch statement.
1526 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
1529 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1533 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
1536 (Foreach.Emit): Foreach on arrays was not setting
1537 up the loop variables (for break/continue).
1539 (GotoCase): Semi-implented.
1541 2001-12-03 Ravi Pratap <ravi@ximian.com>
1543 * attribute.cs (CheckAttribute): Handle system attributes by using
1544 Attribute.GetAttributes to examine information we need.
1546 (GetValidPlaces): Same here.
1548 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
1550 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
1552 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
1554 (Method::Define): Set appropriate flags if we have a DllImport attribute.
1556 (Method::Emit): Handle the case when we are a PInvoke method.
1558 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1560 * expression.cs: Use ResolveWithSimpleName on compound names.
1562 2001-12-02 Ravi Pratap <ravi@ximian.com>
1564 * constant.cs (EmitConstant): Make sure we resolve the associated expression
1565 before trying to reduce it.
1567 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
1569 * constant.cs (LookupConstantValue): Implement.
1571 (EmitConstant): Use the above in emitting the constant.
1573 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
1574 that are user-defined by doing a LookupConstantValue on them.
1576 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
1579 2001-11-29 Miguel de Icaza <miguel@ximian.com>
1581 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
1583 (BaseAccess.DoResolve): Implement.
1585 (MemberAccess.DoResolve): Split this routine into a
1586 ResolveMemberAccess routine that can be used independently
1588 2001-11-28 Miguel de Icaza <miguel@ximian.com>
1590 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
1591 As that share bits of the implementation. Is returns a boolean,
1592 while As returns the Type that is being probed.
1594 2001-12-01 Ravi Pratap <ravi@ximian.com>
1596 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
1597 instead of a Literal - much easier.
1599 (EnumInTransit): Remove - utterly useless :-)
1601 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
1603 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
1605 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
1606 chain when we have no associated expression.
1608 2001-11-30 Ravi Pratap <ravi@ximian.com>
1610 * constant.cs (Define): Use Location while reporting the errror.
1612 Also emit a warning when 'new' is used and there is no inherited
1615 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
1618 (LookupEnumValue): Implement to lookup an enum member's value and define it
1621 (Populate): Re-write accordingly to use the above routine.
1623 2001-11-27 Miguel de Icaza <miguel@ximian.com>
1625 * expression.cs (This): Fix prototype for DoResolveLValue to
1626 override the base class DoResolveLValue.
1628 * cs-parser.cs: Report errors cs574 and cs575 (destructor
1631 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
1632 (we need to load the address of the field here). This fixes
1635 (FieldExpr.DoResolveLValue): Call the DoResolve
1636 function to initialize the Instance expression.
1638 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
1639 correctly the GetEnumerator operation on a value type.
1641 * cs-parser.jay: Add more simple parsing error catches.
1643 * statement.cs (Switch): Add support for string switches.
1644 Handle null specially.
1646 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
1648 2001-11-28 Ravi Pratap <ravi@ximian.com>
1650 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
1652 (declare_local_constant): New helper function.
1654 * statement.cs (AddConstant): Keep a separate record of constants
1656 (IsConstant): Implement to determine if a variable is a constant.
1658 (GetConstantExpression): Implement.
1660 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
1662 * statement.cs (IsVariableDefined): Re-write.
1664 2001-11-27 Ravi Pratap <ravi@ximian.com>
1666 * class.cs (TypeContainer::FindMembers): Look for constants
1667 in the case when we are looking for MemberTypes.Field
1669 * expression.cs (MemberAccess::DoResolve): Check that in the
1670 case we are a FieldExpr and a Literal, we are not being accessed
1671 by an instance reference.
1673 * cs-parser.jay (local_constant_declaration): Implement.
1675 (declaration_statement): Implement for constant declarations.
1677 2001-11-26 Miguel de Icaza <miguel@ximian.com>
1679 * statement.cs (Switch): Catch double defaults.
1681 (Switch): More work on the switch() statement
1682 implementation. It works for integral values now, need to finish
1686 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1688 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
1689 integer literals into other integer literals. To be used by
1692 2001-11-24 Ravi Pratap <ravi@ximian.com>
1694 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
1697 (EmitDynamicInitializers): Cope with the above since we extract data
1698 directly from ArrayData now.
1700 (ExpectInitializers): Keep track of whether initializers are mandatory
1703 (Bounds): Make it a hashtable to prevent the same dimension being
1704 recorded for every element in that dimension.
1706 (EmitDynamicInitializers): Fix bug which prevented the Set array method
1709 Also fix bug which was causing the indices to be emitted in the reverse
1712 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1714 * expression.cs (ArrayCreation): Implement the bits that Ravi left
1715 unfinished. They do not work, because the underlying code is
1718 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1720 * cs-parser.jay: Remove bogus fixme.
1722 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
1723 on Switch statement.
1725 2001-11-23 Ravi Pratap <ravi@ximian.com>
1727 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
1730 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
1731 parameter. Apparently, any expression is allowed.
1733 (ValidateInitializers): Update accordingly.
1735 (CheckIndices): Fix some tricky bugs thanks to recursion.
1737 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
1738 I was being completely brain-dead.
1740 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
1741 and re-write acordingly.
1743 (DelegateInvocation): Re-write accordingly.
1745 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
1747 (MakeByteBlob): Handle types more correctly.
1749 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
1750 initialization from expressions but it is incomplete because I am a complete
1753 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1755 * statement.cs (If.Emit): Fix a bug that generated incorrect code
1756 on If. Basically, we have to return `true' (ie, we do return to
1757 our caller) only if both branches of the if return.
1759 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
1760 short-circuit operators, handle them as short circuit operators.
1762 (Cast.DoResolve): Resolve type.
1763 (Cast.Cast): Take an expression as the target type.
1765 * cs-parser.jay (cast_expression): Remove old hack that only
1766 allowed a limited set of types to be handled. Now we take a
1767 unary_expression and we resolve to a type during semantic
1770 Use the grammar productions from Rhys to handle casts (this is
1771 not complete like Rhys syntax yet, we fail to handle that corner
1772 case that C# has regarding (-x), but we will get there.
1774 2001-11-22 Ravi Pratap <ravi@ximian.com>
1776 * class.cs (EmitFieldInitializer): Take care of the case when we have a
1777 field which is an array type.
1779 * cs-parser.jay (declare_local_variables): Support array initialization too.
1781 * typemanager.cs (MakeKey): Implement.
1783 (everywhere): Use the above appropriately.
1785 * cs-parser.jay (for_statement): Update for array initialization while
1786 declaring variables.
1788 * ecore.cs : The error message was correct, it's the variable's names that
1789 were misleading ;-) Make the code more readable.
1791 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
1792 the correct type etc.
1794 (ConvertExplicit): Handle Enum types by examining the underlying type.
1796 2001-11-21 Ravi Pratap <ravi@ximian.com>
1798 * parameter.cs (GetCallingConvention): Always return
1799 CallingConventions.Standard for now.
1801 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1803 * expression.cs (Binary.ResolveOperator): Update the values of `l'
1804 and `r' after calling DoNumericPromotions.
1806 * ecore.cs: Fix error message (the types were in the wrong order).
1808 * statement.cs (Foreach.ProbeCollectionType): Need to pass
1809 BindingFlags.Instance as well
1811 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
1812 implicit int literal conversion in an empty cast so that we
1813 propagate the right type upstream.
1815 (UnboxCast): new class used to unbox value types.
1816 (Expression.ConvertExplicit): Add explicit type conversions done
1819 (Expression.ImplicitNumericConversion): Oops, forgot to test for
1820 the target type before applying the implicit LongLiterals to ULong
1823 2001-11-21 Miguel de Icaza <miguel@ximian.com>
1825 * cs-parser.jay (for_statement): Reworked the way For works: now
1826 we declare manually any variables that are introduced in
1827 for_initializer to solve the problem of having out-of-band code
1828 emition (that is what got for broken).
1830 (declaration_statement): Perform the actual variable declaration
1831 that used to be done in local_variable_declaration here.
1833 (local_variable_declaration): Do not declare anything, just pass
1834 the information on a DictionaryEntry
1836 2001-11-20 Ravi Pratap <ravi@ximian.com>
1838 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
1839 re-write of the logic to now make it recursive.
1841 (UpdateIndices): Re-write accordingly.
1843 Store element data in a separate ArrayData list in the above methods.
1845 (MakeByteBlob): Implement to dump the array data into a byte array.
1847 2001-11-19 Ravi Pratap <ravi@ximian.com>
1849 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
1852 * constant.cs (Define): Implement.
1854 (EmitConstant): Re-write fully.
1856 Pass in location info.
1858 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
1861 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
1862 DictionaryEntry since we need location info too.
1864 (constant_declaration): Update accordingly.
1866 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
1867 code into another method : UpdateIndices.
1869 2001-11-18 Ravi Pratap <ravi@ximian.com>
1871 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
1872 some type checking etc.
1874 2001-11-17 Ravi Pratap <ravi@ximian.com>
1876 * expression.cs (ArrayCreation::ValidateInitializers): Implement
1877 bits to provide dimension info if the user skips doing that.
1879 Update second constructor to store the rank correctly.
1881 2001-11-16 Ravi Pratap <ravi@ximian.com>
1883 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
1884 and try to implement.
1886 * ../errors/cs0150.cs : Add.
1888 * ../errors/cs0178.cs : Add.
1890 2001-11-16 Miguel de Icaza <miguel@ximian.com>
1892 * statement.cs: Implement foreach on multi-dimensional arrays.
1894 * parameter.cs (Parameters.GetParameterByName): Also lookup the
1895 name of the params argument.
1897 * expression.cs: Use EmitStoreOpcode to get the right opcode while
1898 initializing the array.
1900 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
1901 we can use this elsewhere.
1903 * statement.cs: Finish implementation of foreach for single
1906 * cs-parser.jay: Use an out-of-band stack to pass information
1907 around, I wonder why I need this.
1909 foreach_block: Make the new foreach_block the current_block.
1911 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
1912 function used to return a static Parameters structure. Used for
1913 empty parameters, as those are created very frequently.
1915 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
1917 2001-11-15 Ravi Pratap <ravi@ximian.com>
1919 * interface.cs : Default modifier is private, not public. The
1920 make verify test passes again.
1922 2001-11-15 Ravi Pratap <ravi@ximian.com>
1924 * support.cs (ReflectionParameters): Fix logic to determine
1925 whether the last parameter is a params one. Test 9 passes again.
1927 * delegate.cs (Populate): Register the builders we define with
1928 RegisterParameterForBuilder. Test 19 passes again.
1930 * cs-parser.jay (property_declaration): Reference $6 instead
1931 of $$ to get at the location.
1933 (indexer_declaration): Similar stuff.
1937 * class.cs (Property): Register parameters for the Get and Set methods
1938 if they exist. Test 23 passes again.
1940 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
1941 call to EmitArguments as we are sure there aren't any params arguments.
1942 Test 32 passes again.
1944 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
1945 IndexOutOfRangeException.
1947 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
1948 Test 33 now passes again.
1950 2001-11-15 Miguel de Icaza <miguel@ximian.com>
1952 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
1953 broke a bunch of things. Will have to come up with a better way
1954 of tracking locations.
1956 * statement.cs: Implemented foreach for single dimension arrays.
1958 2001-11-09 Miguel de Icaza <miguel@ximian.com>
1960 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
1961 an error. This removes the lookup from the critical path.
1963 * cs-parser.jay: Removed use of temporary_loc, which is completely
1966 2001-11-14 Miguel de Icaza <miguel@ximian.com>
1968 * support.cs (ReflectionParameters.ParameterModifier): Report
1969 whether the argument is a PARAMS argument or not.
1971 * class.cs: Set the attribute `ParamArrayAttribute' on the
1974 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
1975 and cons_param_array_attribute (ConstructorInfo for
1976 ParamArrayAttribute).,
1978 * codegen.cs: Emit the return using the `Return' statement, that
1979 way we can report the error correctly for missing return values.
1981 * class.cs (Method.Emit): Clean up.
1983 * expression.cs (Argument.Resolve): Take another argument: the
1984 location where this argument is used. Notice that this is not
1985 part of the "Argument" class as to reduce the size of the
1986 structure (we know the approximate location anyways).
1988 Test if the argument is a variable-reference, if not, then
1989 complain with a 206.
1991 (Argument.Emit): Emit addresses of variables.
1993 (Argument.FullDesc): Simplify.
1995 (Invocation.DoResolve): Update for Argument.Resolve.
1997 (ElementAccess.DoResolve): ditto.
1999 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
2000 method should be virtual, as this method is always virtual.
2002 (NewDelegate.DoResolve): Update for Argument.Resolve.
2004 * class.cs (ConstructorInitializer.DoResolve): ditto.
2006 * attribute.cs (Attribute.Resolve): ditto.
2008 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2010 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
2012 * expression.cs (ParameterReference): Drop IStackStorage and implement
2013 IAssignMethod instead.
2015 (LocalVariableReference): ditto.
2017 * ecore.cs (FieldExpr): Drop IStackStorage and implement
2018 IAssignMethod instead.
2020 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2022 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
2023 enumerations that are used in heavily used structures derive from
2024 byte in a laughable and pathetic attempt to reduce memory usage.
2025 This is the kind of pre-optimzations that you should not do at
2026 home without adult supervision.
2028 * expression.cs (UnaryMutator): New class, used to handle ++ and
2029 -- separatedly from the other unary operators. Cleans up the
2030 code, and kills the ExpressionStatement dependency in Unary.
2032 (Unary): Removed `method' and `Arguments' from this class, making
2033 it smaller, and moving it all to SimpleCall, so I can reuse this
2034 code in other locations and avoid creating a lot of transient data
2035 strucutres when not required.
2037 * cs-parser.jay: Adjust for new changes.
2039 2001-11-11 Miguel de Icaza <miguel@ximian.com>
2041 * enum.cs (Enum.Populate): If there is a failure during
2044 * cs-parser.jay (opt_enum_base): we used to catch type errors
2045 here, but this is really incorrect. The type error should be
2046 catched during semantic analysis.
2048 2001-12-11 Ravi Pratap <ravi@ximian.com>
2050 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
2051 current_local_parameters as expected since I, in my stupidity, had forgotten
2054 * attribute.cs (GetValidPlaces): Fix stupid bug.
2056 * class.cs (Method::Emit): Perform check on applicability of attributes.
2058 (Constructor::Emit): Ditto.
2060 (Field::Emit): Ditto.
2062 (Field.Location): Store location information.
2064 (Property, Event, Indexer, Operator): Ditto.
2066 * cs-parser.jay (field_declaration): Pass in location for each field.
2068 * ../errors/cs0592.cs : Add.
2070 2001-11-12 Ravi Pratap <ravi@ximian.com>
2072 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
2074 (InitCoreTypes): Update accordingly.
2076 (RegisterAttrType, LookupAttr): Implement.
2078 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
2079 info about the same.
2081 (Resolve): Update to populate the above as necessary.
2085 (GetValidPlaces): Helper to the above.
2087 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
2089 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
2091 2001-11-12 Ravi Pratap <ravi@ximian.com>
2093 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
2095 * ../errors/cs0617.cs : Add.
2097 2001-11-11 Ravi Pratap <ravi@ximian.com>
2099 * enum.cs (Emit): Rename to Populate to be more consistent with what
2100 we expect it to do and when exactly it is called.
2102 * class.cs, rootcontext.cs : Update accordingly.
2104 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
2105 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
2107 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
2109 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
2110 of a fieldinfo using the above, when dealing with a FieldBuilder.
2112 2001-11-10 Ravi Pratap <ravi@ximian.com>
2114 * ../errors/cs0031.cs : Add.
2116 * ../errors/cs1008.cs : Add.
2118 * ../errrors/cs0543.cs : Add.
2120 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
2123 (FindMembers): Implement.
2125 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
2126 enums and delegates too.
2128 (enum_types): Rename to builder_to_enum.
2130 (delegate_types): Rename to builder_to_delegate.
2132 * delegate.cs (FindMembers): Implement.
2134 2001-11-09 Ravi Pratap <ravi@ximian.com>
2136 * typemanager.cs (IsEnumType): Implement.
2138 * enum.cs (Emit): Re-write parts to account for the underlying type
2139 better and perform checking etc.
2141 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
2142 of the underlying type.
2144 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
2147 * enum.cs (error31): Helper to report error #31.
2149 * cs-parser.jay (enum_declaration): Store location of each member too.
2151 * enum.cs (member_to_location): New hashtable.
2153 (AddEnumMember): Update location hashtable.
2155 (Emit): Use the location of each member while reporting errors.
2157 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2159 * cs-parser.jay: A for_initializer if is a
2160 local_variable_declaration really ammount to have an implicit
2161 block with the variable declaration and no initializer for for.
2163 * statement.cs (For.Emit): Cope with null initializers.
2165 This fixes the infinite loop on for initializers.
2167 2001-11-08 Miguel de Icaza <miguel@ximian.com>
2169 * enum.cs: More cleanup.
2171 * ecore.cs: Remove dead code.
2173 * class.cs (Property.Emit): More simplification.
2174 (Event.Emit): ditto.
2176 Reworked to have less levels of indentation.
2178 2001-11-08 Ravi Pratap <ravi@ximian.com>
2180 * class.cs (Property): Emit attributes.
2190 * enum.cs (Emit): Ditto.
2192 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
2195 * class.cs (Field, Event, etc.): Move attribute generation into the
2196 Emit method everywhere.
2198 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
2199 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
2200 as we had no way of defining nested enums !
2202 * rootcontext.cs : Adjust code accordingly.
2204 * typemanager.cs (AddEnumType): To keep track of enum types separately.
2206 2001-11-07 Ravi Pratap <ravi@ximian.com>
2208 * expression.cs (EvalConstantExpression): Move into ecore.cs
2210 * enum.cs (Enum): Rename some members and make them public and readonly
2211 according to our convention.
2213 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
2216 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
2218 (Enum::Emit): Write a simple version for now which doesn't try to compute
2219 expressions. I shall modify this to be more robust in just a while.
2221 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
2223 (TypeContainer::CloseType): Create the Enum types too.
2225 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
2227 * expression.cs (EvalConstantExpression): Get rid of completely.
2229 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
2230 user-defined values and other cases.
2232 (IsValidEnumLiteral): Helper function.
2234 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
2235 out there in the case we had a literal FieldExpr.
2237 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
2239 (Literalize): Revamp a bit to take two arguments.
2241 (EnumLiteral): New class which derives from Literal to wrap enum literals.
2243 2001-11-06 Ravi Pratap <ravi@ximian.com>
2245 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
2247 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
2249 (Resolve): Use the above to ensure we have proper initializers.
2251 2001-11-05 Ravi Pratap <ravi@ximian.com>
2253 * expression.cs (Expression::EvalConstantExpression): New method to
2254 evaluate constant expressions.
2256 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
2258 2001-11-07 Miguel de Icaza <miguel@ximian.com>
2260 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
2263 (Binary.ResolveOperator): Handle operator != (object a, object b)
2264 and operator == (object a, object b);
2266 (Binary.DoNumericPromotions): Indicate whether the numeric
2267 promotion was possible.
2269 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
2272 Made the ArrayAccess implement interface IAssignMethod instead of
2273 IStackStore as the order in which arguments are passed reflects
2276 * assign.cs: Instead of using expr.ExprClass to select the way of
2277 assinging, probe for the IStackStore/IAssignMethod interfaces.
2279 * typemanager.cs: Load InitializeArray definition.
2281 * rootcontext.cs (RootContext.MakeStaticData): Used to define
2282 static data that can be used to initialize arrays.
2284 2001-11-05 Miguel de Icaza <miguel@ximian.com>
2286 * expression.cs: Handle operator== and operator!= for booleans.
2288 (Conditioal.Reduce): Implement reducer for the ?: operator.
2290 (Conditional.Resolve): Implement dead code elimination.
2292 (Binary.Resolve): Catch string literals and return a new
2293 concatenated string.
2295 (Unary.Reduce): Implement reduction of unary expressions.
2297 * ecore.cs: Split out the expression core handling here.
2299 (Expression.Reduce): New method used to perform constant folding
2300 and CSE. This is needed to support constant-expressions.
2302 * statement.cs (Statement.EmitBoolExpression): Pass true and false
2303 targets, and optimize for !x.
2305 2001-11-04 Ravi Pratap <ravi@ximian.com>
2307 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
2308 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
2309 set custom atttributes.
2311 * literal.cs (Literal::GetValue): New abstract method to return the actual
2312 value of the literal, cast as an object.
2314 (*Literal): Implement GetValue method.
2316 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
2317 expressions to the arraylist but objects of type Argument.
2319 * class.cs (TypeContainer::Emit): Emit our attributes too.
2321 (Method::Emit, Constructor::Emit): Ditto.
2323 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
2324 to be ignoring earlier.
2326 2001-11-03 Ravi Pratap <ravi@ximian.com>
2328 * attribute.cs (AttributeSection::Define): Implement to do the business
2329 of constructing a CustomAttributeBuilder.
2331 (Attribute): New trivial class. Increases readability of code.
2333 * cs-parser.jay : Update accordingly.
2335 (positional_argument_list, named_argument_list, named_argument): New rules
2337 (attribute_arguments): Use the above so that we are more correct.
2339 2001-11-02 Ravi Pratap <ravi@ximian.com>
2341 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
2342 to perform all checks for a method with a params parameter.
2344 (Invocation::OverloadResolve): Update to use the above method and therefore
2345 cope correctly with params method invocations.
2347 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
2350 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
2351 constructors in our parent too because we can't afford to miss out on
2354 * attribute.cs (AttributeSection): New name for the class Attribute
2356 Other trivial changes to improve readability.
2358 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
2359 use the new class names.
2361 2001-11-01 Ravi Pratap <ravi@ximian.com>
2363 * class.cs (Method::Define): Complete definition for params types too
2365 (Indexer::Define): Ditto.
2367 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
2368 Cope everywhere with a request for info about the array parameter.
2370 2001-11-01 Ravi Pratap <ravi@ximian.com>
2372 * tree.cs (RecordNamespace): Fix up to check for the correct key.
2374 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
2375 local_variable_type to extract the string corresponding to the type.
2377 (local_variable_type): Fixup the action to use the new helper method.
2379 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
2382 * expression.cs : Clean out code which uses the above.
2384 2001-10-31 Ravi Pratap <ravi@ximian.com>
2386 * typemanager.cs (RegisterMethod): Check if we already have an existing key
2387 and bale out if necessary by returning a false.
2389 (RegisterProperty): Ditto.
2391 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
2392 and print out appropriate error messages.
2394 * interface.cs (everywhere): Ditto.
2396 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
2397 location to constructor.
2399 * class.cs (Property, Event, Indexer): Update accordingly.
2401 * ../errors/cs111.cs : Added.
2403 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
2404 of a method, as laid down by the spec.
2406 (Invocation::OverloadResolve): Use the above method.
2408 2001-10-31 Ravi Pratap <ravi@ximian.com>
2410 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
2411 now take a TypeContainer and a Parameters object.
2413 (ParameterData): Modify return type of ParameterModifier method to be
2414 Parameter.Modifier and not a string.
2416 (ReflectionParameters, InternalParameters): Update accordingly.
2418 * expression.cs (Argument::GetParameterModifier): Same here.
2420 * support.cs (InternalParameters::ParameterType): Find a better way of determining
2421 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
2422 symbol in it at all so maybe this is only for now.
2424 2001-10-30 Ravi Pratap <ravi@ximian.com>
2426 * support.cs (InternalParameters): Constructor now takes an extra argument
2427 which is the actual Parameters class.
2429 (ParameterDesc): Update to provide info on ref/out modifiers.
2431 * class.cs (everywhere): Update call to InternalParameters to pass in
2432 the second argument too.
2434 * support.cs (ParameterData): Add ParameterModifier, which is a method
2435 to return the modifier info [ref/out etc]
2437 (InternalParameters, ReflectionParameters): Implement the above.
2439 * expression.cs (Argument::ParameterModifier): Similar function to return
2440 info about the argument's modifiers.
2442 (Invocation::OverloadResolve): Update to take into account matching modifiers
2445 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
2446 a new SetFormalParameters object which we pass to InternalParameters.
2448 2001-10-30 Ravi Pratap <ravi@ximian.com>
2450 * expression.cs (NewArray): Merge into the ArrayCreation class.
2452 2001-10-29 Ravi Pratap <ravi@ximian.com>
2454 * expression.cs (NewArray): Merge classes NewBuiltinArray and
2455 NewUserdefinedArray into one as there wasn't much of a use in having
2458 * expression.cs (Argument): Change field's name to ArgType from Type.
2460 (Type): New readonly property which returns the proper type, taking into
2461 account ref/out modifiers.
2463 (everywhere): Adjust code accordingly for the above.
2465 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
2466 whether we are emitting for a ref or out parameter.
2468 * expression.cs (Argument::Emit): Use the above field to set the state.
2470 (LocalVariableReference::Emit): Update to honour the flag and emit the
2473 * parameter.cs (Attributes): Set the correct flags for ref parameters.
2475 * expression.cs (Argument::FullDesc): New function to provide a full desc.
2477 * support.cs (ParameterData): Add method ParameterDesc to the interface.
2479 (ReflectionParameters, InternalParameters): Implement the above method.
2481 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
2484 (Invocation::FullMethodDesc): Ditto.
2486 2001-10-29 Miguel de Icaza <miguel@ximian.com>
2488 * cs-parser.jay: Add extra production for the second form of array
2491 * expression.cs (ArrayCreation): Update to reflect the above
2494 * Small changes to prepare for Array initialization.
2496 2001-10-28 Miguel de Icaza <miguel@ximian.com>
2498 * typemanager.cs (ImplementsInterface): interface might be null;
2499 Deal with this problem;
2501 Also, we do store negative hits on the cache (null values), so use
2502 this instead of calling t.GetInterfaces on the type everytime.
2504 2001-10-28 Ravi Pratap <ravi@ximian.com>
2506 * typemanager.cs (IsBuiltinType): New method to help determine the same.
2508 * expression.cs (New::DoResolve): Get rid of array creation code and instead
2509 split functionality out into different classes.
2511 (New::FormArrayType): Move into NewBuiltinArray.
2513 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
2516 (NewBuiltinArray): New class to handle creation of built-in arrays.
2518 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
2519 account creation of one-dimensional arrays.
2521 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
2523 (NewUserdefinedArray::DoResolve): Implement.
2525 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
2527 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
2528 we maintain inside the TypeManager. This is necessary to perform lookups on the
2531 (LookupType): Update to perform GetType on the module builders too.
2533 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
2535 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
2537 2001-10-23 Ravi Pratap <ravi@ximian.com>
2539 * expression.cs (New::DoResolve): Implement guts of array creation.
2541 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
2543 2001-10-27 Miguel de Icaza <miguel@ximian.com>
2545 * expression.cs: Fix bug I introduced lsat night that broke
2548 (Expression.Resolve): Report a 246 error (can not resolve name)
2549 if we find a SimpleName in the stream.
2551 (Expression.ResolveLValue): Ditto.
2553 (Expression.ResolveWithSimpleName): This function is a variant of
2554 ResolveName, this one allows SimpleNames to be returned without a
2555 warning. The only consumer of SimpleNames is MemberAccess
2557 2001-10-26 Miguel de Icaza <miguel@ximian.com>
2559 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
2560 might arrive here. I have my doubts that this is correct.
2562 * statement.cs (Lock): Implement lock statement.
2564 * cs-parser.jay: Small fixes to support `lock' and `using'
2566 * cs-tokenizer.cs: Remove extra space
2568 * driver.cs: New flag --checked, allows to turn on integer math
2571 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
2572 Threading.Monitor.Exit
2574 2001-10-23 Miguel de Icaza <miguel@ximian.com>
2576 * expression.cs (IndexerAccess::DoResolveLValue): Set the
2577 Expression Class to be IndexerAccess.
2579 Notice that Indexer::DoResolve sets the eclass to Value.
2581 2001-10-22 Miguel de Icaza <miguel@ximian.com>
2583 * class.cs (TypeContainer::Emit): Emit code for indexers.
2585 * assign.cs (IAssignMethod): New interface implemented by Indexers
2586 and Properties for handling assignment.
2588 (Assign::Emit): Simplify and reuse code.
2590 * expression.cs (IndexerAccess, PropertyExpr): Implement
2591 IAssignMethod, clean up old code.
2593 2001-10-22 Ravi Pratap <ravi@ximian.com>
2595 * typemanager.cs (ImplementsInterface): New method to determine if a type
2596 implements a given interface. Provides a nice cache too.
2598 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
2601 (ConvertReferenceExplicit): Ditto.
2603 * delegate.cs (Delegate::Populate): Update to define the parameters on the
2604 various methods, with correct names etc.
2606 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
2607 Operator.UnaryNegation.
2609 * cs-parser.jay (operator_declarator): Be a little clever in the case where
2610 we have a unary plus or minus operator.
2612 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
2615 * everywhere : update accordingly.
2617 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
2620 * class.cs (Method::Define): For the case where we are implementing a method
2621 inherited from an interface, we need to set the MethodAttributes.Final flag too.
2622 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
2624 2001-10-21 Ravi Pratap <ravi@ximian.com>
2626 * interface.cs (FindMembers): Implement to work around S.R.E
2629 * typemanager.cs (IsInterfaceType): Implement.
2631 (FindMembers): Update to handle interface types too.
2633 * expression.cs (ImplicitReferenceConversion): Re-write bits which
2634 use IsAssignableFrom as that is not correct - it doesn't work.
2636 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
2637 and accordingly override EmitStatement.
2639 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
2640 using the correct logic :-)
2642 2001-10-19 Ravi Pratap <ravi@ximian.com>
2644 * ../errors/cs-11.cs : Add to demonstrate error -11
2646 2001-10-17 Miguel de Icaza <miguel@ximian.com>
2648 * assign.cs (Assign::Resolve): Resolve right hand side first, and
2649 then pass this as a hint to ResolveLValue.
2651 * expression.cs (FieldExpr): Add Location information
2653 (FieldExpr::LValueResolve): Report assignment to readonly
2656 (Expression::ExprClassFromMemberInfo): Pass location information.
2658 (Expression::ResolveLValue): Add new method that resolves an
2661 (Expression::DoResolveLValue): Default invocation calls
2664 (Indexers): New class used to keep track of indexers in a given
2667 (IStackStore): Renamed from LValue, as it did not really describe
2668 what this did. Also ResolveLValue is gone from this interface and
2669 now is part of Expression.
2671 (ElementAccess): Depending on the element access type
2673 * typemanager.cs: Add `indexer_name_type' as a Core type
2674 (System.Runtime.CompilerServices.IndexerNameAttribute)
2676 * statement.cs (Goto): Take a location.
2678 2001-10-18 Ravi Pratap <ravi@ximian.com>
2680 * delegate.cs (Delegate::VerifyDelegate): New method to verify
2681 if two delegates are compatible.
2683 (NewDelegate::DoResolve): Update to take care of the case when
2684 we instantiate a delegate from another delegate.
2686 * typemanager.cs (FindMembers): Don't even try to look up members
2687 of Delegate types for now.
2689 2001-10-18 Ravi Pratap <ravi@ximian.com>
2691 * delegate.cs (NewDelegate): New class to take care of delegate
2694 * expression.cs (New): Split the delegate related code out into
2695 the NewDelegate class.
2697 * delegate.cs (DelegateInvocation): New class to handle delegate
2700 * expression.cs (Invocation): Split out delegate related code into
2701 the DelegateInvocation class.
2703 2001-10-17 Ravi Pratap <ravi@ximian.com>
2705 * expression.cs (New::DoResolve): Implement delegate creation fully
2706 and according to the spec.
2708 (New::DoEmit): Update to handle delegates differently.
2710 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
2711 because of which we were printing out arguments in reverse order !
2713 * delegate.cs (VerifyMethod): Implement to check if the given method
2714 matches the delegate.
2716 (FullDelegateDesc): Implement.
2718 (VerifyApplicability): Implement.
2720 * expression.cs (Invocation::DoResolve): Update to accordingly handle
2721 delegate invocations too.
2723 (Invocation::Emit): Ditto.
2725 * ../errors/cs1593.cs : Added.
2727 * ../errors/cs1594.cs : Added.
2729 * delegate.cs (InstanceExpression, TargetMethod): New properties.
2731 2001-10-16 Ravi Pratap <ravi@ximian.com>
2733 * typemanager.cs (intptr_type): Core type for System.IntPtr
2735 (InitCoreTypes): Update for the same.
2737 (iasyncresult_type, asynccallback_type): Ditto.
2739 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
2742 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
2745 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
2746 the builders for the 4 members of a delegate type :-)
2748 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
2751 * expression.cs (New::DoResolve): Implement guts for delegate creation.
2753 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
2755 2001-10-15 Miguel de Icaza <miguel@ximian.com>
2757 * statement.cs (Break::Emit): Implement.
2758 (Continue::Emit): Implement.
2760 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
2761 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
2762 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
2763 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
2766 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
2767 properties that track the label for the current loop (begin of the
2768 loop and end of the loop).
2770 2001-10-15 Ravi Pratap <ravi@ximian.com>
2772 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
2773 use of emitting anything at all.
2775 * class.cs, rootcontext.cs : Get rid of calls to the same.
2777 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
2779 (Populate): Define the constructor correctly and set the implementation
2782 * typemanager.cs (delegate_types): New hashtable to hold delegates that
2785 (AddDelegateType): Implement.
2787 (IsDelegateType): Implement helper method.
2789 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
2791 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
2792 and accordingly handle it.
2794 * delegate.cs (Populate): Take TypeContainer argument.
2795 Implement bits to define the Invoke method. However, I still haven't figured out
2796 how to take care of the native int bit :-(
2798 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
2799 Qualify the name of the delegate, not its return type !
2801 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
2804 (StandardConversionExists): Checking for array types turns out to be recursive.
2806 (ConvertReferenceExplicit): Implement array conversion.
2808 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
2810 2001-10-12 Ravi Pratap <ravi@ximian.com>
2812 * cs-parser.jay (delegate_declaration): Store the fully qualified
2813 name as it is a type declaration.
2815 * delegate.cs (ReturnType, Name): Rename members to these. Make them
2818 (DefineDelegate): Renamed from Define. Does the same thing essentially,
2819 as TypeContainer::DefineType.
2821 (Populate): Method in which all the definition of the various methods (Invoke)
2824 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
2827 (CloseDelegate): Finally creates the delegate.
2829 * class.cs (TypeContainer::DefineType): Update to define delegates.
2830 (Populate, Emit and CloseType): Do the same thing here too.
2832 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
2833 delegates in all these operations.
2835 2001-10-14 Miguel de Icaza <miguel@ximian.com>
2837 * expression.cs: LocalTemporary: a new expression used to
2838 reference a temporary that has been created.
2840 * assign.cs: Handle PropertyAccess back here, so that we can
2841 provide the proper semantic access to properties.
2843 * expression.cs (Expression::ConvertReferenceExplicit): Implement
2844 a few more explicit conversions.
2846 * modifiers.cs: `NEW' modifier maps to HideBySig.
2848 * expression.cs (PropertyExpr): Make this into an
2849 ExpressionStatement, and support the EmitStatement code path.
2851 Perform get/set error checking, clean up the interface.
2853 * assign.cs: recognize PropertyExprs as targets, and if so, turn
2854 them into toplevel access objects.
2856 2001-10-12 Miguel de Icaza <miguel@ximian.com>
2858 * expression.cs: PropertyExpr::PropertyExpr: use work around the
2861 * typemanager.cs: Keep track here of our PropertyBuilders again to
2862 work around lameness in SRE.
2864 2001-10-11 Miguel de Icaza <miguel@ximian.com>
2866 * expression.cs (LValue::LValueResolve): New method in the
2867 interface, used to perform a second resolution pass for LValues.
2869 (This::DoResolve): Catch the use of this in static methods.
2871 (This::LValueResolve): Implement.
2873 (This::Store): Remove warning, assigning to `this' in structures
2876 (Invocation::Emit): Deal with invocation of
2877 methods on value types. We need to pass the address to structure
2878 methods rather than the object itself. (The equivalent code to
2879 emit "this" for structures leaves the entire structure on the
2880 stack instead of a pointer to it).
2882 (ParameterReference::DoResolve): Compute the real index for the
2883 argument based on whether the method takes or not a `this' pointer
2884 (ie, the method is static).
2886 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
2887 value types returned from functions when we need to invoke a
2888 method on the sturcture.
2891 2001-10-11 Ravi Pratap <ravi@ximian.com>
2893 * class.cs (TypeContainer::DefineType): Method to actually do the business of
2894 defining the type in the Modulebuilder or Typebuilder. This is to take
2895 care of nested types which need to be defined on the TypeBuilder using
2898 (TypeContainer::GetClassBases): Implement. Essentially the code from the
2899 methods in RootContext, only ported to be part of TypeContainer.
2901 (TypeContainer::GetInterfaceOrClass): Ditto.
2903 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
2905 * interface.cs (Interface::DefineInterface): New method. Does exactly
2906 what RootContext.CreateInterface did earlier, only it takes care of nested types
2909 (Interface::GetInterfaces): Move from RootContext here and port.
2911 (Interface::GetInterfaceByName): Same here.
2913 * rootcontext.cs (ResolveTree): Re-write.
2915 (PopulateTypes): Re-write.
2917 * class.cs (TypeContainer::Populate): Populate nested types too.
2918 (TypeContainer::Emit): Emit nested members too.
2920 * typemanager.cs (AddUserType): Do not make use of the FullName property,
2921 instead just use the name argument passed in as it is already fully
2924 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
2925 to TypeContainer mapping to see if a type is user-defined.
2927 * class.cs (TypeContainer::CloseType): Implement.
2929 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
2930 the default constructor.
2932 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
2935 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
2937 * interface.cs (CloseType): Create the type here.
2939 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
2942 Remove all the methods which are now in TypeContainer.
2944 2001-10-10 Ravi Pratap <ravi@ximian.com>
2946 * delegate.cs (Define): Re-write bits to define the delegate
2949 2001-10-10 Miguel de Icaza <miguel@ximian.com>
2951 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
2953 * expression.cs (ImplicitReferenceConversion): handle null as well
2954 as a source to convert to any reference type.
2956 * statement.cs (Return): Perform any implicit conversions to
2957 expected return type.
2959 Validate use of return statement.
2961 * codegen.cs (EmitContext): Pass the expected return type here.
2963 * class.cs (Method, Constructor, Property): Pass expected return
2964 type to EmitContext.
2966 2001-10-09 Miguel de Icaza <miguel@ximian.com>
2968 * expression.cs: Make DoResolve take an EmitContext instead of a
2971 Replaced `l' and `location' for `loc', for consistency.
2973 (Error, Warning): Remove unneeded Tc argument.
2975 * assign.cs, literal.cs, constant.cs: Update to new calling
2978 * codegen.cs: EmitContext now contains a flag indicating whether
2979 code is being generated in a static method or not.
2981 * cs-parser.jay: DecomposeQI, new function that replaces the old
2982 QualifiedIdentifier. Now we always decompose the assembled
2983 strings from qualified_identifier productions into a group of
2986 2001-10-08 Miguel de Icaza <miguel@ximian.com>
2988 * rootcontext.cs: Deal with field-less struct types correctly now
2989 by passing the size option to Define Type.
2991 * class.cs: Removed hack that created one static field.
2993 2001-10-07 Miguel de Icaza <miguel@ximian.com>
2995 * statement.cs: Moved most of the code generation here.
2997 2001-10-09 Ravi Pratap <ravi@ximian.com>
2999 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
3002 (ElementAccess): Remove useless bits for now - keep checks as the spec
3005 2001-10-08 Ravi Pratap <ravi@ximian.com>
3007 * expression.cs (ElementAccess::DoResolve): Remove my crap code
3008 and start performing checks according to the spec.
3010 2001-10-07 Ravi Pratap <ravi@ximian.com>
3012 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
3013 rank_specifiers instead.
3015 (rank_specifiers): Change the order in which the rank specifiers are stored
3017 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
3019 * expression.cs (ElementAccess): Implement the LValue interface too.
3021 2001-10-06 Ravi Pratap <ravi@ximian.com>
3023 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
3024 except that user defined conversions are not included.
3026 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
3027 perform the conversion of the return type, if necessary.
3029 (New::DoResolve): Check whether we are creating an array or an object
3030 and accordingly do the needful.
3032 (New::Emit): Same here.
3034 (New::DoResolve): Implement guts of array creation.
3036 (New::FormLookupType): Helper function.
3038 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3040 * codegen.cs: Removed most of the code generation here, and move the
3041 corresponding code generation bits to the statement classes.
3043 Added support for try/catch/finalize and throw.
3045 * cs-parser.jay: Added support for try/catch/finalize.
3047 * class.cs: Catch static methods having the flags override,
3048 virtual or abstract.
3050 * expression.cs (UserCast): This user cast was not really doing
3051 what it was supposed to do. Which is to be born in fully resolved
3052 state. Parts of the resolution were being performed at Emit time!
3056 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3058 * expression.cs: Implicity convert the result from UserCast.
3060 2001-10-05 Ravi Pratap <ravi@ximian.com>
3062 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
3063 prevented it from working correctly.
3065 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
3066 merely ConvertImplicit.
3068 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3070 * typemanager.cs: Make the LookupTypeContainer function static,
3071 and not per-instance.
3073 * class.cs: Make static FindMembers (the one that takes a Type
3076 * codegen.cs: Add EmitForeach here.
3078 * cs-parser.jay: Make foreach a toplevel object instead of the
3079 inline expansion, as we need to perform semantic analysis on it.
3081 2001-10-05 Ravi Pratap <ravi@ximian.com>
3083 * expression.cs (Expression::ImplicitUserConversion): Rename to
3084 UserDefinedConversion.
3086 (Expression::UserDefinedConversion): Take an extra argument specifying
3087 whether we look for explicit user conversions too.
3089 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
3091 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
3093 (ExplicitUserConversion): Make it a call to UserDefinedConversion
3094 with the appropriate arguments.
3096 * cs-parser.jay (cast_expression): Record location too.
3098 * expression.cs (Cast): Record location info.
3100 (Expression::ConvertExplicit): Take location argument.
3102 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
3103 to determine if we are doing explicit conversions.
3105 (UserCast::Emit): Update accordingly.
3107 (Expression::ConvertExplicit): Report an error if everything fails.
3109 * ../errors/cs0030.cs : Add.
3111 2001-10-04 Miguel de Icaza <miguel@ximian.com>
3113 * modifiers.cs: If the ABSTRACT keyword is present, also set the
3114 virtual and newslot bits.
3116 * class.cs (TypeContainer::RegisterRequiredImplementations):
3117 Record methods we need.
3119 (TypeContainer::MakeKey): Helper function to make keys for
3120 MethodBases, since the Methodbase key is useless.
3122 (TypeContainer::Populate): Call RegisterRequiredImplementations
3123 before defining the methods.
3125 Create a mapping for method_builders_to_methods ahead of time
3126 instead of inside a tight loop.
3128 (::RequireMethods): Accept an object as the data to set into the
3129 hashtable so we can report interface vs abstract method mismatch.
3131 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3133 * report.cs: Make all of it static.
3135 * rootcontext.cs: Drop object_type and value_type computations, as
3136 we have those in the TypeManager anyways.
3138 Drop report instance variable too, now it is a global.
3140 * driver.cs: Use try/catch on command line handling.
3142 Add --probe option to debug the error reporting system with a test
3145 * report.cs: Add support for exiting program when a probe
3146 condition is reached.
3148 2001-10-03 Ravi Pratap <ravi@ximian.com>
3150 * expression.cs (Binary::DoNumericPromotions): Fix the case when
3151 we do a forcible conversion regardless of type, to check if
3152 ForceConversion returns a null.
3154 (Binary::error19): Use location to report error.
3156 (Unary::error23): Use location here too.
3158 * ../errors/cs0019.cs : Check in.
3160 * ../errors/cs0023.cs : Check in.
3162 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
3163 case of a non-null MethodInfo object with a length of 0 !
3165 (Binary::ResolveOperator): Flag error if overload resolution fails to find
3166 an applicable member - according to the spec :-)
3167 Also fix logic to find members in base types.
3169 (Unary::ResolveOperator): Same here.
3171 (Unary::report23): Change name to error23 and make first argument a TypeContainer
3172 as I was getting thoroughly confused between this and error19 :-)
3174 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
3175 (::FindMostEncompassedType): Implement.
3176 (::FindMostEncompassingType): Implement.
3177 (::StandardConversionExists): Implement.
3179 (UserImplicitCast): Re-vamp. We now need info about most specific
3180 source and target types so that we can do the necessary conversions.
3182 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
3183 mathematical union with no duplicates.
3185 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3187 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
3188 in order from base classes to child classes, so that we can in
3189 child classes look up in our parent for method names and
3190 attributes (required for handling abstract, virtual, new, override
3191 constructs: we need to instrospect our base class, and if we dont
3192 populate the classes in order, the introspection might be
3193 incorrect. For example, a method could query its parent before
3194 the parent has any methods and would determine that the parent has
3195 no abstract methods (while it could have had them)).
3197 (RootContext::CreateType): Record the order in which we define the
3200 2001-10-02 Miguel de Icaza <miguel@ximian.com>
3202 * class.cs (TypeContainer::Populate): Also method definitions can
3203 fail now, keep track of this.
3205 (TypeContainer::FindMembers): Implement support for
3206 DeclaredOnly/noDeclaredOnly flag.
3208 (Constructor::Emit) Return the ConstructorBuilder.
3210 (Method::Emit) Return the MethodBuilder.
3211 Check for abstract or virtual methods to be public.
3213 * rootcontext.cs (RootContext::CreateType): Register all the
3214 abstract methods required for the class to be complete and the
3215 interface methods that must be implemented.
3217 * cs-parser.jay: Report error 501 (method requires body if it is
3218 not marked abstract or extern).
3220 * expression.cs (TypeOf::Emit): Implement.
3222 * typemanager.cs: runtime_handle_type, new global type.
3224 * class.cs (Property::Emit): Generate code for properties.
3226 2001-10-02 Ravi Pratap <ravi@ximian.com>
3228 * expression.cs (Unary::ResolveOperator): Find operators on base type
3229 too - we now conform exactly to the spec.
3231 (Binary::ResolveOperator): Same here.
3233 * class.cs (Operator::Define): Fix minor quirk in the tests.
3235 * ../errors/cs0215.cs : Added.
3237 * ../errors/cs0556.cs : Added.
3239 * ../errors/cs0555.cs : Added.
3241 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3243 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
3244 single integer which is really efficient
3246 2001-10-01 Ravi Pratap <ravi@ximian.com>
3248 * expression.cs (Expression::ImplicitUserConversion): Use location
3249 even in the case when we are examining True operators.
3251 * class.cs (Operator::Define): Perform extensive checks to conform
3252 with the rules for operator overloading in the spec.
3254 * expression.cs (Expression::ImplicitReferenceConversion): Implement
3255 some of the other conversions mentioned in the spec.
3257 * typemanager.cs (array_type): New static member for the System.Array built-in
3260 (cloneable_interface): For System.ICloneable interface.
3262 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
3263 we start resolving the tree and populating types.
3265 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
3267 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3269 * expression.cs (Expression::ExprClassFromMemberInfo,
3270 Expression::Literalize): Create literal expressions from
3271 FieldInfos which are literals.
3273 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
3274 type casts, because they were wrong. The test suite in tests
3277 (ImplicitNumericConversion): ushort to ulong requires a widening
3280 Int32 constant to long requires widening cast as well.
3282 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
3283 for integers because the type on the stack is not i4.
3285 2001-09-30 Miguel de Icaza <miguel@ximian.com>
3287 * expression.cs (report118): require location argument.
3289 * parameter.cs: Do not dereference potential null value.
3291 * class.cs: Catch methods that lack the `new' keyword when
3292 overriding a name. Report warnings when `new' is used without
3293 anything being there to override.
3295 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
3297 * class.cs: Only add constructor to hashtable if it is non-null
3298 (as now constructors can fail on define).
3300 (TypeManager, Class, Struct): Take location arguments.
3302 Catch field instance initialization in structs as errors.
3304 accepting_filter: a new filter for FindMembers that is static so
3305 that we dont create an instance per invocation.
3307 (Constructor::Define): Catch errors where a struct constructor is
3310 * cs-parser.jay: Pass location information for various new
3313 * delegate.cs (Delegate): take a location argument.
3315 * driver.cs: Do not call EmitCode if there were problesm in the
3316 Definition of the types, as many Builders wont be there.
3318 * decl.cs (Decl::Decl): Require a location argument.
3320 * cs-tokenizer.cs: Handle properly hex constants that can not fit
3321 into integers, and find the most appropiate integer for it.
3323 * literal.cs: Implement ULongLiteral.
3325 * rootcontext.cs: Provide better information about the location of
3326 failure when CreateType fails.
3328 2001-09-29 Miguel de Icaza <miguel@ximian.com>
3330 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
3333 * expression.cs (Binary::CheckShiftArguments): Add missing type
3335 (Binary::ResolveOperator): Add type to the logical and and logical
3336 or, Bitwise And/Or and Exclusive Or code paths, it was missing
3339 (Binary::DoNumericPromotions): In the case where either argument
3340 is ulong (and most signed types combined with ulong cause an
3341 error) perform implicit integer constant conversions as well.
3343 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3345 * expression.cs (UserImplicitCast): Method should always be
3347 (Invocation::BetterConversion): Simplified test for IntLiteral.
3349 (Expression::ImplicitNumericConversion): Split this routine out.
3350 Put the code that performs implicit constant integer conversions
3353 (Expression::Resolve): Become a wrapper around DoResolve so we can
3354 check eclass and type being set after resolve.
3356 (Invocation::Badness): Remove this dead function
3358 (Binary::ResolveOperator): Do not compute the expensive argumnets
3359 unless we have a union for it.
3361 (Probe::Emit): Is needs to do an isinst and then
3362 compare against null.
3364 (::CanConvert): Added Location argument. If the Location argument
3365 is null (Location.Null), then we do not report errors. This is
3366 used by the `probe' mechanism of the Explicit conversion. We do
3367 not want to generate an error for something that the user
3368 explicitly requested to be casted. But the pipeline for an
3369 explicit cast first tests for potential implicit casts.
3371 So for now, if the Location is null, it means `Probe only' to
3372 avoid adding another argument. Might have to revise this
3375 (ClassCast): New class used to type cast objects into arbitrary
3376 classes (used in Explicit Reference Conversions).
3378 Implement `as' as well.
3380 Reverted all the patches from Ravi below: they were broken:
3382 * The use of `level' as a mechanism to stop recursive
3383 invocations is wrong. That was there just to catch the
3384 bug with a strack trace but not as a way of addressing
3387 To fix the problem we have to *understand* what is going
3388 on and the interactions and come up with a plan, not
3389 just get things going.
3391 * The use of the type conversion cache that I proposed
3392 last night had an open topic: How does this work across
3393 protection domains. A user defined conversion might not
3394 be public in the location where we are applying the
3395 conversion, a different conversion might be selected
3396 (ie, private A->B (better) but public B->A (worse),
3397 inside A, A->B applies, but outside it, B->A will
3400 * On top of that (ie, even if the above is solved),
3401 conversions in a cache need to be abstract. Ie, `To
3402 convert from an Int to a Short use an OpcodeCast', not
3403 `To convert from an Int to a Short use the OpcodeCast on
3404 the variable 5' (which is what this patch was doing).
3406 2001-09-28 Ravi Pratap <ravi@ximian.com>
3408 * expression.cs (Invocation::ConversionExists): Re-write to use
3409 the conversion cache
3411 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
3412 cache all conversions done, not just user-defined ones.
3414 (Invocation::BetterConversion): The real culprit. Use ConversionExists
3415 to determine if a conversion exists instead of acutually trying to
3416 perform the conversion. It's faster too.
3418 (Expression::ConvertExplicit): Modify to use ConversionExists to check
3419 and only then attempt the implicit conversion.
3421 2001-09-28 Ravi Pratap <ravi@ximian.com>
3423 * expression.cs (ConvertImplicit): Use a cache for conversions
3424 already found. Check level of recursion and bail out if necessary.
3426 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3428 * typemanager.cs (string_concat_string_string, string_concat_object_object):
3429 Export standard methods that we expect for string operations.
3431 * statement.cs (Block::UsageWarning): Track usage of variables and
3432 report the errors for not used variables.
3434 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
3437 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3439 * codegen.cs: remove unnneded code
3441 * expression.cs: Removed BuiltinTypeAccess class
3443 Fix the order in which implicit conversions are
3446 The previous fixed dropped support for boxed conversions (adding a
3447 test to the test suite now)
3449 (UserImplicitCast::CanConvert): Remove test for source being null,
3450 that code is broken. We should not feed a null to begin with, if
3451 we do, then we should track the bug where the problem originates
3452 and not try to cover it up here.
3454 Return a resolved expression of type UserImplicitCast on success
3455 rather than true/false. Ravi: this is what I was talking about,
3456 the pattern is to use a static method as a "constructor" for
3459 Also, do not create arguments until the very last minute,
3460 otherwise we always create the arguments even for lookups that
3461 will never be performed.
3463 (UserImplicitCast::Resolve): Eliminate, objects of type
3464 UserImplicitCast are born in a fully resolved state.
3466 * typemanager.cs (InitCoreTypes): Init also value_type
3469 * expression.cs (Cast::Resolve): First resolve the child expression.
3471 (LValue): Add new method AddressOf to be used by
3474 Change the argument of Store to take an EmitContext instead of an
3475 ILGenerator, because things like FieldExpr need to be able to call
3476 their children expression to generate the instance code.
3478 (Expression::Error, Expression::Warning): Sugar functions for
3481 (Expression::MemberLookup): Accept a TypeContainer instead of a
3482 Report as the first argument.
3484 (Expression::ResolvePrimary): Killed. I still want to improve
3485 this as currently the code is just not right.
3487 (Expression::ResolveMemberAccess): Simplify, but it is still
3490 (Unary::Resolve): Catch errors in AddressOf operators.
3492 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
3493 index to a byte for the short-version, or the compiler will choose
3494 the wrong Emit call, which generates the wrong data.
3496 (ParameterReference::Emit, ::Store): same.
3498 (FieldExpr::AddressOf): Implement.
3500 * typemanager.cs: TypeManager: made public variable instead of
3503 * driver.cs: document --fatal.
3505 * report.cs (ErrorMessage, WarningMessage): new names for the old
3506 Error and Warning classes.
3508 * cs-parser.jay (member_access): Turn built-in access to types
3509 into a normal simplename
3511 2001-09-27 Ravi Pratap <ravi@ximian.com>
3513 * expression.cs (Invocation::BetterConversion): Fix to cope
3514 with q being null, since this was introducing a bug.
3516 * expression.cs (ConvertImplicit): Do built-in conversions first.
3518 2001-09-27 Ravi Pratap <ravi@ximian.com>
3520 * expression.cs (UserImplicitCast::Resolve): Fix bug.
3522 2001-09-27 Ravi Pratap <ravi@ximian.com>
3524 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
3525 I had introduced long ago (what's new ?).
3527 * expression.cs (UserImplicitCast::CanConvert): Static method to do
3528 the work of all the checking.
3529 (ConvertImplicit): Call CanConvert and only then create object if necessary.
3530 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
3532 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
3533 that is the right way.
3535 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
3536 overloading resolution. Use everywhere instead of cutting and pasting code.
3538 (Binary::ResolveOperator): Use MakeUnionSet.
3540 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
3541 we have to convert to bool types. Not complete yet.
3543 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3545 * typemanager.cs (TypeManager::CSharpName): support ushort.
3547 * expression.cs (Expression::TryImplicitIntConversion): Attempts
3548 to provide an expression that performsn an implicit constant int
3549 conversion (section 6.1.6).
3550 (Expression::ConvertImplicitRequired): Reworked to include
3551 implicit constant expression conversions.
3553 (Expression::ConvertNumericExplicit): Finished.
3555 (Invocation::Emit): If InstanceExpression is null, then it means
3556 that we perform a call on this.
3558 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3560 * expression.cs (Unary::Emit): Remove some dead code.
3561 (Probe): Implement Resolve and Emit for `is'.
3562 (Expression::ConvertImplicitRequired): Attempt to do constant
3563 expression conversions here. Maybe should be moved to
3564 ConvertImplicit, but I am not sure.
3565 (Expression::ImplicitLongConstantConversionPossible,
3566 Expression::ImplicitIntConstantConversionPossible): New functions
3567 that tell whether is it possible to apply an implicit constant
3568 expression conversion.
3570 (ConvertNumericExplicit): Started work on explicit numeric
3573 * cs-parser.jay: Update operator constants.
3575 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
3576 (Parameters::GetSignature): Hook up VerifyArgs here.
3577 (Parameters::VerifyArgs): Verifies that no two arguments have the
3580 * class.cs (Operator): Update the operator names to reflect the
3581 ones that the spec expects (as we are just stringizing the
3584 * expression.cs (Unary::ResolveOperator): Fix bug: Use
3585 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
3586 previous usage did only work for our methods.
3587 (Expression::ConvertImplicit): Handle decimal implicit numeric
3588 conversions as well.
3589 (Expression::InternalTypeConstructor): Used to invoke constructors
3590 on internal types for default promotions.
3592 (Unary::Emit): Implement special handling for the pre/post
3593 increment/decrement for overloaded operators, as they need to have
3594 the same semantics as the other operators.
3596 (Binary::ResolveOperator): ditto.
3597 (Invocation::ConversionExists): ditto.
3598 (UserImplicitCast::Resolve): ditto.
3600 2001-09-26 Ravi Pratap <ravi@ximian.com>
3602 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
3603 operator, return after emitting body. Regression tests pass again !
3605 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
3606 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
3607 (Invocation::OverloadResolve): Ditto.
3608 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
3610 * everywhere : update calls to the above methods accordingly.
3612 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3614 * assign.cs (Assign): Make it inherit from ExpressionStatement.
3616 * expression.cs (ExpressionStatement): New base class used for
3617 expressions that can appear in statements, so that we can provide
3618 an alternate path to generate expression that do not leave a value
3621 (Expression::Emit, and all the derivatives): We no longer return
3622 whether a value is left on the stack or not. Every expression
3623 after being emitted leaves a single value on the stack.
3625 * codegen.cs (EmitContext::EmitStatementExpression): Use the
3626 facilties of ExpressionStatement if possible.
3628 * cs-parser.jay: Update statement_expression.
3630 2001-09-25 Miguel de Icaza <miguel@ximian.com>
3632 * driver.cs: Change the wording of message
3634 2001-09-25 Ravi Pratap <ravi@ximian.com>
3636 * expression.cs (Binary::ResolveOperator): Had forgottten to set
3637 the type of the expression to the return type of the method if
3638 we have an overloaded operator match ! The regression tests pass again !
3639 (Unary::ResolveOperator): Ditto.
3641 * expression.cs (Invocation::ConversionExists): Correct the member lookup
3642 to find "op_Implicit", not "implicit" ;-)
3643 (UserImplicitCast): New class to take care of user-defined implicit conversions.
3644 (ConvertImplicit, ForceConversion): Take TypeContainer argument
3646 * everywhere : Correct calls to the above accordingly.
3648 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
3649 (ConvertImplicit): Do user-defined conversion if it exists.
3651 2001-09-24 Miguel de Icaza <miguel@ximian.com>
3653 * assign.cs: track location.
3654 (Resolve): Use implicit conversions on assignment.
3656 * literal.cs: Oops. Not good, Emit of short access values should
3657 pass (Bytes) or the wrong argument will be selected.
3659 * expression.cs (Unary::Emit): Emit code for -expr.
3661 (Unary::ResolveOperator): Handle `Substract' for non-constants
3662 (substract from zero from the non-constants).
3663 Deal with Doubles as well.
3665 (Expression::ConvertImplicitRequired): New routine that reports an
3666 error if no implicit conversion exists.
3668 (Invocation::OverloadResolve): Store the converted implicit
3669 expressions if we make them
3671 2001-09-24 Ravi Pratap <ravi@ximian.com>
3673 * class.cs (ConstructorInitializer): Take a Location argument.
3674 (ConstructorBaseInitializer): Same here.
3675 (ConstructorThisInitializer): Same here.
3677 * cs-parser.jay : Update all calls accordingly.
3679 * expression.cs (Unary, Binary, New): Take location argument.
3680 Update accordingly everywhere.
3682 * cs-parser.jay : Update all calls to the above to take a location
3687 2001-09-24 Ravi Pratap <ravi@ximian.com>
3689 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
3690 (Invocation::BetterConversion): Same here
3691 (Invocation::ConversionExists): Ditto.
3693 (Invocation::ConversionExists): Implement.
3695 2001-09-22 Ravi Pratap <ravi@ximian.com>
3697 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
3698 Also take an additional TypeContainer argument.
3700 * All over : Pass in TypeContainer as argument to OverloadResolve.
3702 * typemanager.cs (CSharpName): Update to check for the string type and return
3705 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
3708 2001-09-21 Ravi Pratap <ravi@ximian.com>
3710 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
3711 (Invocation::BetterFunction): Implement.
3712 (Invocation::BetterConversion): Implement.
3713 (Invocation::ConversionExists): Skeleton, no implementation yet.
3715 Okay, things work fine !
3717 2001-09-21 Miguel de Icaza <miguel@ximian.com>
3719 * typemanager.cs: declare and load enum_type, delegate_type and
3722 * expression.cs (Expression::Emit): Now emit returns a value that
3723 tells whether a value is left on the stack or not. This strategy
3724 might be reveted tomorrow with a mechanism that would address
3725 multiple assignments.
3726 (Expression::report118): Utility routine to report mismatches on
3729 (Unary::Report23): Report impossible type/operator combination
3732 (Unary::IsIncrementableNumber): Whether the type can be
3733 incremented or decremented with add.
3734 (Unary::ResolveOperator): Also allow enumerations to be bitwise
3736 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
3738 (Invocation::Emit): Deal with new Emit convetion.
3740 * All Expression derivatives: Updated their Emit method to return
3741 whether they leave values on the stack or not.
3743 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
3744 stack for expressions that are statements.
3746 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3748 * expression.cs (LValue): New interface. Must be implemented by
3750 (LocalVariableReference, ParameterReference, FieldExpr): Implement
3753 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
3754 interface for generating code, simplifies the code.
3756 2001-09-20 Ravi Pratap <ravi@ximian.com>
3758 * expression.cs (everywhere): Comment out return statements in ::Resolve
3759 methods to avoid the warnings.
3761 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3763 * driver.cs (parse): Report error 2001 if we can not open the
3766 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
3769 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
3772 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
3773 otherwise nested blocks end up with the same index.
3775 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
3777 * expression.cs: Instead of having FIXMEs in the Resolve
3778 functions, throw exceptions so it is obvious that we are facing a
3781 * cs-parser.jay (invocation_expression): Pass Location information.
3783 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
3784 Use a basename for those routines because .NET does not like paths
3787 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
3790 2001-09-19 Miguel de Icaza <miguel@ximian.com>
3792 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
3793 are loading the correct data types (throws an exception if not).
3794 (TypeManager::InitCoreTypes): Use CoreLookupType
3796 * expression.cs (Unary::ResolveOperator): return the child
3797 expression for expressions which are just +expr.
3798 (Unary::ResolveOperator): Return negative literals for -LITERAL
3799 expressions (otherwise they are Unary {Literal}).
3800 (Invocation::Badness): Take into account `Implicit constant
3801 expression conversions'.
3803 * literal.cs (LongLiteral): Implement long literal class.
3804 (IntLiteral): export the `Value' of the intliteral.
3806 2001-09-19 Ravi Pratap <ravi@ximian.com>
3808 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
3810 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
3811 instead of 'Operator'
3813 * expression.cs (Binary::ResolveOperator): Update accordingly.
3814 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
3817 * cs-parser.jay (unary_expression): Update to use the new names.
3819 * gen-treedump.cs (GetUnary): Same here.
3821 * expression.cs (Unary::Resolve): Implement.
3822 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
3823 operators are found instead of making noise ;-)
3824 (Unary::ResolveOperator): New method to do precisely the same thing which
3825 Binary::ResolveOperator does for Binary expressions.
3826 (Unary.method, .Arguments): Add.
3827 (Unary::OperName): Implement.
3828 (Unary::ForceConversion): Copy and Paste !
3830 * class.cs (Operator::Define): Fix a small bug for the case when we have
3833 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
3834 for the inbuilt operators. Only overloading works for now ;-)
3836 2001-09-18 Miguel de Icaza <miguel@ximian.com>
3838 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
3839 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
3841 * expression.cs (This::Emit): Implement.
3842 (This::Resolve): Implement.
3843 (TypeOf:Resolve): Implement.
3844 (Expression::ResolveSimpleName): Add an implicit this to instance
3846 (MemberAccess::Resolve): Deal with Parameters and Fields.
3847 Bind instance variable to Field expressions.
3848 (FieldExpr::Instance): New field used to track the expression that
3849 represents the object instance.
3850 (FieldExpr::Resolve): Track potential errors from MemberLookup not
3852 (FieldExpr::Emit): Implement.
3854 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
3855 the last instruction contains a return opcode to avoid generating
3856 the last `ret' instruction (this generates correct code, and it is
3857 nice to pass the peverify output).
3859 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
3860 initializer for static and instance variables.
3861 (Constructor::Emit): Allow initializer to be null in the case of
3862 static constructors. Only emit initializer for instance
3865 (TypeContainer::FindMembers): Return a null array if there are no
3868 Also fix the code for the MemberTypes.Method branch, as it was not
3869 scanning that for operators (or tried to access null variables before).
3871 * assign.cs (Assign::Emit): Handle instance and static fields.
3875 * driver.cs: Stop compilation if there are parse errors.
3877 * cs-parser.jay (constructor_declaration): Provide default base
3878 initializer for non-static constructors.
3879 (constructor_declarator): Do not provide a default base
3880 initializers if none was specified.
3881 Catch the fact that constructors should not have parameters.
3883 * class.cs: Do not emit parent class initializers for static
3884 constructors, that should be flagged as an error.
3886 2001-09-18 Ravi Pratap <ravi@ximian.com>
3888 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
3889 Move back code into TypeContainer::Populate.
3891 2001-09-18 Ravi Pratap <ravi@ximian.com>
3893 * class.cs (TypeContainer::AddConstructor): Fix the check to
3894 compare against Name, not Basename.
3895 (Operator::OpType): Change Plus and Minus to Add and Subtract.
3897 * cs-parser.jay : Update accordingly.
3899 * class.cs (TypeContainer::FindMembers): For the case where we are searching
3900 for methods, don't forget to look into the operators too.
3901 (RegisterMethodBuilder): Helper method to take care of this for
3902 methods, constructors and operators.
3903 (Operator::Define): Completely revamp.
3904 (Operator.OperatorMethod, MethodName): New fields.
3905 (TypeContainer::Populate): Move the registering of builders into
3906 RegisterMethodBuilder.
3907 (Operator::Emit): Re-write.
3909 * expression.cs (Binary::Emit): Comment out code path to emit method
3910 invocation stuff for the case when we have a user defined operator. I am
3911 just not able to get it right !
3913 2001-09-17 Miguel de Icaza <miguel@ximian.com>
3915 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
3918 (Expression::MemberLookup): Provide a version that allows to
3919 specify the MemberTypes and BindingFlags.
3921 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
3922 so it was not fetching variable information from outer blocks.
3924 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
3925 Beforefieldinit as it was buggy.
3927 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
3930 * class.cs (Constructor::Emit): Only emit if block is not null.
3931 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
3932 deal with this by semantically definining it as if the user had
3935 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
3936 constructors as we now "emit" them at a higher level.
3938 (TypeContainer::DefineDefaultConstructor): Used to define the
3939 default constructors if none was provided.
3941 (ConstructorInitializer): Add methods Resolve and Emit.
3943 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
3945 2001-09-17 Ravi Pratap <ravi@ximian.com>
3947 * class.cs (TypeContainer::EmitDefaultConstructor): Register
3948 the default constructor builder with our hashtable for methodbuilders
3951 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
3952 and argument_count is 0 in which case we have a match.
3953 (Binary::ResolveOperator): More null checking and miscellaneous coding
3956 2001-09-17 Ravi Pratap <ravi@ximian.com>
3958 * rootcontext.cs (IsNameSpace): Compare against null.
3960 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
3962 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
3963 and Unary::Operator.
3965 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
3968 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
3969 we have overloaded operators.
3970 (Binary::ResolveOperator): Implement the part which does the operator overload
3973 * class.cs (Operator::Emit): Implement.
3974 (TypeContainer::Emit): Emit the operators we have too.
3976 * expression.cs (Binary::Emit): Update to emit the appropriate code for
3977 the case when we have a user-defined operator.
3979 2001-09-17 Miguel de Icaza <miguel@ximian.com>
3981 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
3983 2001-09-16 Ravi Pratap <ravi@ximian.com>
3985 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
3986 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
3987 (Constructor::Emit): Implement.
3988 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
3989 if we have no work to do.
3990 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
3993 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
3994 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
3996 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
3999 2001-09-15 Ravi Pratap <ravi@ximian.com>
4001 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
4003 (Tree::RecordNamespace): Method to do what the name says ;-)
4004 (Tree::Namespaces): Property to get at the namespaces hashtable.
4006 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
4009 * rootcontext.cs (IsNamespace): Fixed it :-)
4011 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4013 * class.cs (TypeContainer::FindMembers): Add support for
4015 (MethodCore): New class that encapsulates both the shared aspects
4016 of a Constructor and a Method.
4017 (Method, Constructor): Factored pieces into MethodCore.
4019 * driver.cs: Added --fatal which makes errors throw exceptions.
4020 Load System assembly as well as part of the standard library.
4022 * report.cs: Allow throwing exceptions on errors for debugging.
4024 * modifiers.cs: Do not use `parent', instead use the real type
4025 container to evaluate permission settings.
4027 * class.cs: Put Ravi's patch back in. He is right, and we will
4028 have to cope with the
4030 2001-09-14 Ravi Pratap <ravi@ximian.com>
4032 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
4033 FamORAssem, not FamANDAssem.
4035 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4037 * driver.cs: Added --parse option that only parses its input files
4040 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
4041 incorrect. IsTopLevel is not used to tell whether an object is
4042 root_types or not (that can be achieved by testing this ==
4043 root_types). But to see if this is a top-level *class* (not
4044 necessarly our "toplevel" container).
4046 2001-09-14 Ravi Pratap <ravi@ximian.com>
4048 * enum.cs (Enum::Define): Modify to call the Lookup method on the
4049 parent instead of a direct call to GetType.
4051 2001-09-14 Ravi Pratap <ravi@ximian.com>
4053 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
4054 Modifiers.TypeAttr. This should just be a call to that method.
4056 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
4057 object so that we can determine if we are top-level or not.
4059 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
4062 * enum.cs (Enum::Define): Ditto.
4064 * modifiers.cs (FieldAttr): Re-write.
4066 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
4067 (TypeContainer::HaveStaticConstructor): New property to provide access
4068 to precisely that info.
4070 * modifiers.cs (MethodAttr): Re-write.
4071 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
4073 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
4074 of top-level types as claimed.
4076 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4078 * expression.cs (MemberLookup): Fruitless attempt to lookup
4079 constructors. Maybe I need to emit default constructors? That
4080 might be it (currently .NET emits this for me automatically).
4081 (Invocation::OverloadResolve): Cope with Arguments == null.
4082 (Invocation::EmitArguments): new function, shared by the new
4084 (Invocation::Emit): Handle static and instance methods. Emit
4085 proper call instruction for virtual or non-virtual invocations.
4086 (New::Emit): Implement.
4087 (New::Resolve): Implement.
4088 (MemberAccess:Resolve): Implement.
4089 (MethodGroupExpr::InstanceExpression): used conforming to the spec
4091 (FieldExpr::Resolve): Set type.
4093 * support.cs: Handle empty arguments.
4095 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
4096 SimpleLookup): Auxiliary routines to help parse a qualifier
4099 Update qualifier_identifier rule.
4101 * codegen.cs: Removed debugging messages.
4103 * class.cs: Make this a global thing, this acts just as a "key" to
4104 objects that we might have around.
4106 (Populate): Only initialize method_builders_to_methods once.
4108 * expression.cs (PropertyExpr): Initialize type from the
4111 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
4112 Resolve pattern. Attempt to implicitly convert value to boolean.
4115 * expression.cs: Set the type for the int32/int32 argument case.
4116 (Binary::ResolveOperator): Set the return type to boolean for
4117 comparission operators
4119 * typemanager.cs: Remove debugging print code.
4121 (Invocation::Resolve): resolve type.
4123 * class.cs: Allocate a MemberInfo of the correct size, as the code
4124 elsewhere depends on the test to reflect the correct contents.
4126 (Method::) Keep track of parameters, due to System.Reflection holes
4128 (TypeContainer::Populate): Keep track of MethodBuilders to Method
4131 (TypeContainer::FindMembers): Use ArrayList and then copy an array
4132 of the exact size and return that.
4134 (Class::LookupMethodByBuilder): New function that maps
4135 MethodBuilders to its methods. Required to locate the information
4136 on methods because System.Reflection bit us again.
4138 * support.cs: New file, contains an interface ParameterData and
4139 two implementations: ReflectionParameters and InternalParameters
4140 used to access Parameter information. We will need to grow this
4143 * expression.cs (Invocation::GetParameterData): implement a cache
4144 and a wrapper around the ParameterData creation for methods.
4145 (Invocation::OverloadResolve): Use new code.
4147 2001-09-13 Ravi Pratap <ravi@ximian.com>
4149 * class.cs (TypeContainer::EmitField): Remove and move into
4150 (Field::Define): here and modify accordingly.
4151 (Field.FieldBuilder): New member.
4152 (TypeContainer::Populate): Update accordingly.
4153 (TypeContainer::FindMembers): Implement.
4155 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4157 * statement.cs: (VariableInfo::VariableType): New field to be
4158 initialized with the full type once it is resolved.
4160 2001-09-12 Miguel de Icaza <miguel@ximian.com>
4162 * parameter.cs (GetParameterInfo): Use a type cache to compute
4163 things only once, and to reuse this information
4165 * expression.cs (LocalVariableReference::Emit): Implement.
4166 (OpcodeCast::Emit): fix.
4168 (ParameterReference::Resolve): Implement.
4169 (ParameterReference::Emit): Implement.
4171 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
4172 that are expressions need to stay as Expressions.
4174 * typemanager.cs (CSharpName): Returns the C# name of a type if
4177 * expression.cs (Expression::ConvertImplicit): New function that
4178 implements implicit type conversions.
4180 (Expression::ImplicitReferenceConversion): Implements implicit
4181 reference conversions.
4183 (EmptyCast): New type for transparent casts.
4185 (OpcodeCast): New type for casts of types that are performed with
4186 a sequence of bytecodes.
4188 (BoxedCast): New type used for casting value types into reference
4189 types. Emits a box opcode.
4191 (Binary::DoNumericPromotions): Implements numeric promotions of
4192 and computation of the Binary::Type.
4194 (Binary::EmitBranchable): Optimization.
4196 (Binary::Emit): Implement code emission for expressions.
4198 * typemanager.cs (TypeManager): Added two new core types: sbyte
4201 2001-09-12 Ravi Pratap <ravi@ximian.com>
4203 * class.cs (TypeContainer::FindMembers): Method which does exactly
4204 what Type.FindMembers does, only we don't have to use reflection. No
4207 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
4208 typecontainer objects as we need to get at them.
4209 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
4211 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
4212 typecontainer object.
4214 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
4215 of just a Report object.
4217 2001-09-11 Ravi Pratap <ravi@ximian.com>
4219 * class.cs (Event::Define): Go back to using the prefixes "add_" and
4221 (TypeContainer::Populate): Now define the delegates of the type too.
4222 (TypeContainer.Delegates): Property to access the list of delegates defined
4225 * delegates.cs (Delegate::Define): Implement partially.
4227 * modifiers.cs (TypeAttr): Handle more flags.
4229 2001-09-11 Ravi Pratap <ravi@ximian.com>
4231 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
4233 (Operator::Define): Re-write logic to get types by using the LookupType method
4234 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
4235 (Indexer::Define): Ditto.
4236 (Event::Define): Ditto.
4237 (Property::Define): Ditto.
4239 2001-09-10 Ravi Pratap <ravi@ximian.com>
4241 * class.cs (TypeContainer::Populate): Now define operators too.
4242 (TypeContainer.Operators): New property to access the list of operators
4244 (Operator.OperatorMethodBuilder): New member to hold the method builder
4245 for the operator we are defining.
4246 (Operator::Define): Implement.
4248 2001-09-10 Ravi Pratap <ravi@ximian.com>
4250 * class.cs (Event::Define): Make the prefixes of the accessor methods
4251 addOn_ and removeOn_
4253 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
4254 of the location being passed in too. Ideally, this should go later since all
4255 error reporting should be done through the Report object.
4257 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
4258 (Populate): Iterate thru the indexers we have and define them too.
4259 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
4260 for the get and set accessors.
4261 (Indexer::Define): Implement.
4263 2001-09-09 Miguel de Icaza <miguel@ximian.com>
4265 * expression.cs (Binary::Resolve): Beginning of it. I scratched
4266 my previous implementation, did not work.
4268 * typemanager.cs: Add a couple of missing types (the longs).
4270 * literal.cs: Use TypeManager.bool_type instead of getting it.
4272 * expression.cs (EventExpr): New kind of expressions.
4273 (Expressio::ExprClassFromMemberInfo): finish
4275 2001-09-08 Miguel de Icaza <miguel@ximian.com>
4277 * assign.cs: Emit stores to static fields differently.
4279 2001-09-08 Ravi Pratap <ravi@ximian.com>
4281 * Merge in changes and adjust code to tackle conflicts. Backed out my
4282 code in Assign::Resolve ;-)
4284 2001-09-08 Ravi Pratap <ravi@ximian.com>
4286 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
4287 instead Report.Error and also pass in the location.
4288 (CSharpParser::Lexer): New readonly property to return the reference
4289 to the Tokenizer object.
4290 (declare_local_variables): Use Report.Error with location instead of plain
4294 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
4295 (Operator.CheckBinaryOperator): Ditto.
4297 * cs-parser.jay (operator_declarator): Update accordingly.
4299 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
4300 (CheckBinaryOperator): Same here.
4302 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
4303 on the name without any prefixes of namespace names etc. This is because we
4304 already might have something already fully qualified like
4305 'System.Console.WriteLine'
4307 * assign.cs (Resolve): Begin implementation. Stuck ;-)
4309 2001-09-07 Ravi Pratap <ravi@ximian.com>
4311 * cs-tokenizer.cs (location): Return a string which also contains
4314 * expression.cs (ElementAccess): New class for expressions of the
4315 type 'element access.'
4316 (BaseAccess): New class for expressions of the type 'base access.'
4317 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
4320 * cs-parser.jay (element_access): Implement action.
4321 (base_access): Implement actions.
4322 (checked_expression, unchecked_expression): Implement.
4324 * cs-parser.jay (local_variable_type): Correct and implement.
4325 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
4327 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
4329 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
4330 name and the specifiers.
4332 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
4334 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
4335 making them all public ;-)
4337 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
4340 2001-09-07 Miguel de Icaza <miguel@ximian.com>
4342 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
4344 (FieldExpr, PropertyExprs): New resolved expressions.
4345 (SimpleName::MemberStaticCheck): Perform static checks for access
4346 to non-static fields on static methods. Maybe this should be
4347 generalized for MemberAccesses.
4348 (SimpleName::ResolveSimpleName): More work on simple name
4351 * cs-parser.jay (primary_expression/qualified_identifier): track
4352 the parameter index.
4354 * codegen.cs (CodeGen::Save): Catch save exception, report error.
4355 (EmitContext::EmitBoolExpression): Chain to expression generation
4356 instead of temporary hack.
4357 (::EmitStatementExpression): Put generic expression code generation.
4359 * assign.cs (Assign::Emit): Implement variable assignments to
4360 local variables, parameters and fields.
4362 2001-09-06 Miguel de Icaza <miguel@ximian.com>
4364 * statement.cs (Block::GetVariableInfo): New method, returns the
4365 VariableInfo for a variable name in a block.
4366 (Block::GetVariableType): Implement in terms of GetVariableInfo
4368 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
4369 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
4371 2001-09-06 Ravi Pratap <ravi@ximian.com>
4373 * cs-parser.jay (operator_declaration): Continue on my quest : update
4374 to take attributes argument.
4375 (event_declaration): Ditto.
4376 (enum_declaration): Ditto.
4377 (indexer_declaration): Ditto.
4379 * class.cs (Operator::Operator): Update constructor accordingly.
4380 (Event::Event): Ditto.
4382 * delegate.cs (Delegate::Delegate): Same here.
4384 * enum.cs (Enum::Enum): Same here.
4386 2001-09-05 Ravi Pratap <ravi@ximian.com>
4388 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
4390 * ../tests/cs0658.cs : New file to demonstrate error 0658.
4392 * attribute.cs (Attributes): New class to encapsulate all attributes which were
4393 being passed around as an arraylist.
4394 (Attributes::AddAttribute): Method to add attribute sections.
4396 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
4397 (struct_declaration): Update accordingly.
4398 (constant_declaration): Update.
4399 (field_declaration): Update.
4400 (method_header): Update.
4401 (fixed_parameter): Update.
4402 (parameter_array): Ditto.
4403 (property_declaration): Ditto.
4404 (destructor_declaration): Ditto.
4406 * class.cs (Struct::Struct): Update constructors accordingly.
4407 (Class::Class): Ditto.
4408 (Field::Field): Ditto.
4409 (Method::Method): Ditto.
4410 (Property::Property): Ditto.
4411 (TypeContainer::OptAttribute): update property's return type.
4413 * interface.cs (Interface.opt_attributes): New member.
4414 (Interface::Interface): Update to take the extra Attributes argument.
4416 * parameter.cs (Parameter::Parameter): Ditto.
4418 * constant.cs (Constant::Constant): Ditto.
4420 * interface.cs (InterfaceMemberBase): New OptAttributes field.
4421 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
4422 the attributes as a parameter.
4423 (InterfaceProperty): Update constructor call.
4424 (InterfaceEvent): Ditto.
4425 (InterfaceMethod): Ditto.
4426 (InterfaceIndexer): Ditto.
4428 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
4429 pass the attributes too.
4430 (interface_event_declaration): Ditto.
4431 (interface_property_declaration): Ditto.
4432 (interface_method_declaration): Ditto.
4433 (interface_declaration): Ditto.
4435 2001-09-05 Miguel de Icaza <miguel@ximian.com>
4437 * class.cs (Method::Define): Track the "static Main" definition to
4438 create an entry point.
4440 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
4441 EntryPoint if we find it.
4443 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
4444 (EmitContext::ig): Make this variable public.
4446 * driver.cs: Make the default output file be the first file name
4447 with the .exe extension.
4449 Detect empty compilations
4451 Handle various kinds of output targets. Handle --target and
4452 rename -t to --dumper.
4454 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
4455 methods inherited from Expression return now an Expression. This
4456 will is used during the tree rewriting as we resolve them during
4459 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
4460 the spec. Missing entirely is the information about
4461 accessability of elements of it.
4463 (Expression::ExprClassFromMemberInfo): New constructor for
4464 Expressions that creates a fully initialized Expression based on
4465 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
4468 (Invocation::Resolve): Begin implementing resolution of invocations.
4470 * literal.cs (StringLiteral): Implement Emit.
4472 2001-09-05 Ravi Pratap <ravi@ximian.com>
4474 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
4477 2001-09-04 Ravi Pratap <ravi@ximian.com>
4479 * cs-parser.jay (attribute_arguments): Implement actions.
4480 (attribute): Fix bug in production. Implement action.
4481 (attribute_list): Implement.
4482 (attribute_target): Implement.
4483 (attribute_target_specifier, opt_target_specifier): Implement
4484 (CheckAttributeTarget): New method to check if the attribute target
4486 (attribute_section): Implement.
4487 (opt_attributes): Implement.
4489 * attribute.cs : New file to handle attributes.
4490 (Attribute): Class to hold attribute info.
4492 * cs-parser.jay (opt_attribute_target_specifier): Remove production
4493 (attribute_section): Modify production to use 2 different rules to
4494 achieve the same thing. 1 s/r conflict down !
4495 Clean out commented, useless, non-reducing dimension_separator rules.
4497 * class.cs (TypeContainer.attributes): New member to hold list
4498 of attributes for a type.
4499 (Struct::Struct): Modify to take one more argument, the attribute list.
4500 (Class::Class): Ditto.
4501 (Field::Field): Ditto.
4502 (Method::Method): Ditto.
4503 (Property::Property): Ditto.
4505 * cs-parser.jay (struct_declaration): Update constructor call to
4506 pass in the attributes too.
4507 (class_declaration): Ditto.
4508 (constant_declaration): Ditto.
4509 (field_declaration): Ditto.
4510 (method_header): Ditto.
4511 (fixed_parameter): Ditto.
4512 (parameter_array): Ditto.
4513 (property_declaration): Ditto.
4515 * constant.cs (Constant::Constant): Update constructor similarly.
4516 Use System.Collections.
4518 * parameter.cs (Parameter::Parameter): Update as above.
4520 2001-09-02 Ravi Pratap <ravi@ximian.com>
4522 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
4523 (TypeContainer.delegates): New member to hold list of delegates.
4525 * cs-parser.jay (delegate_declaration): Implement the action correctly
4526 this time as I seem to be on crack ;-)
4528 2001-09-02 Miguel de Icaza <miguel@ximian.com>
4530 * rootcontext.cs (RootContext::IsNamespace): new function, used to
4531 tell whether an identifier represents a namespace.
4533 * expression.cs (NamespaceExpr): A namespace expression, used only
4534 temporarly during expression resolution.
4535 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
4536 utility functions to resolve names on expressions.
4538 2001-09-01 Miguel de Icaza <miguel@ximian.com>
4540 * codegen.cs: Add hook for StatementExpressions.
4542 * class.cs: Fix inverted test for static flag in methods.
4544 2001-09-02 Ravi Pratap <ravi@ximian.com>
4546 * class.cs (Operator::CheckUnaryOperator): Correct error number used
4547 to make it coincide with MS' number.
4548 (Operator::CheckBinaryOperator): Ditto.
4550 * ../errors/errors.txt : Remove error numbers added earlier.
4552 * ../errors/cs1019.cs : Test case for error # 1019
4554 * ../errros/cs1020.cs : Test case for error # 1020
4556 * cs-parser.jay : Clean out commented cruft.
4557 (dimension_separators, dimension_separator): Comment out. Ostensibly not
4558 used anywhere - non-reducing rule.
4559 (namespace_declarations): Non-reducing rule - comment out.
4561 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
4562 with TypeContainer::AddEnum.
4564 * delegate.cs : New file for delegate handling classes.
4565 (Delegate): Class for declaring delegates.
4567 * makefile : Update.
4569 * cs-parser.jay (delegate_declaration): Implement.
4571 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
4573 * class.cs (Event::Define): Implement.
4574 (Event.EventBuilder): New member.
4576 * class.cs (TypeContainer::Populate): Update to define all enums and events
4578 (Events): New property for the events arraylist we hold. Shouldn't we move to using
4579 readonly fields for all these cases ?
4581 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4583 * class.cs (Property): Revamp to use the convention of making fields readonly.
4584 Accordingly modify code elsewhere.
4586 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
4587 the Define method of the Property class.
4589 * class.cs : Clean up applied patch and update references to variables etc. Fix
4591 (TypeContainer::Populate): Update to define all the properties we have. Also
4592 define all enumerations.
4594 * enum.cs (Define): Implement.
4596 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4598 * cs-parser.jay (overloadable_operator): The semantic value is an
4599 enum of the Operator class.
4600 (operator_declarator): Implement actions.
4601 (operator_declaration): Implement.
4603 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
4604 validity of definitions.
4605 (Operator::CheckBinaryOperator): Static method to check for binary operators
4606 (TypeContainer::AddOperator): New method to add an operator to a type.
4608 * cs-parser.jay (indexer_declaration): Added line to actually call the
4609 AddIndexer method so it gets added ;-)
4611 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
4612 already taken care of by the MS compiler ?
4614 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4616 * class.cs (Operator): New class for operator declarations.
4617 (Operator::OpType): Enum for the various operators.
4619 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4621 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
4622 ostensibly handle this in semantic analysis.
4624 * cs-parser.jay (general_catch_clause): Comment out
4625 (specific_catch_clauses, specific_catch_clause): Ditto.
4626 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
4627 (catch_args, opt_catch_args): New productions.
4628 (catch_clause): Rewrite to use the new productions above
4629 (catch_clauses): Modify accordingly.
4630 (opt_catch_clauses): New production to use in try_statement
4631 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
4632 and re-write the code in the actions to extract the specific and
4633 general catch clauses by being a little smart ;-)
4635 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
4636 Hooray, try and catch statements parse fine !
4638 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4640 * statement.cs (Block::GetVariableType): Fix logic to extract the type
4641 string from the hashtable of variables.
4643 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
4644 I end up making that mistake ;-)
4645 (catch_clauses): Fixed gross error which made Key and Value of the
4646 DictionaryEntry the same : $1 !!
4648 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4650 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
4652 * cs-parser.jay (event_declaration): Correct to remove the semicolon
4653 when the add and remove accessors are specified.
4655 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4657 * cs-parser.jay (IndexerDeclaration): New helper class to hold
4658 information about indexer_declarator.
4659 (indexer_declarator): Implement actions.
4660 (parsing_indexer): New local boolean used to keep track of whether
4661 we are parsing indexers or properties. This is necessary because
4662 implicit_parameters come into picture even for the get accessor in the
4664 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
4666 * class.cs (Indexer): New class for indexer declarations.
4667 (TypeContainer::AddIndexer): New method to add an indexer to a type.
4668 (TypeContainer::indexers): New member to hold list of indexers for the
4671 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4673 * cs-parser.jay (add_accessor_declaration): Implement action.
4674 (remove_accessor_declaration): Implement action.
4675 (event_accessors_declaration): Implement
4676 (variable_declarators): swap statements for first rule - trivial.
4678 * class.cs (Event): New class to hold information about event
4680 (TypeContainer::AddEvent): New method to add an event to a type
4681 (TypeContainer::events): New member to hold list of events.
4683 * cs-parser.jay (event_declaration): Implement actions.
4685 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4687 * cs-parser.jay (dim_separators): Implement. Make it a string
4688 concatenating all the commas together, just as they appear.
4689 (opt_dim_separators): Modify accordingly
4690 (rank_specifiers): Update accordingly. Basically do the same
4691 thing - instead, collect the brackets here.
4692 (opt_rank_sepcifiers): Modify accordingly.
4693 (array_type): Modify to actually return the complete type string
4694 instead of ignoring the rank_specifiers.
4695 (expression_list): Implement to collect the expressions
4696 (variable_initializer): Implement. We make it a list of expressions
4697 essentially so that we can handle the array_initializer case neatly too.
4698 (variable_initializer_list): Implement.
4699 (array_initializer): Make it a list of variable_initializers
4700 (opt_array_initializer): Modify accordingly.
4702 * expression.cs (New::NType): Add enumeration to help us
4703 keep track of whether we have an object/delegate creation
4704 or an array creation.
4705 (New:NewType, New::Rank, New::Indices, New::Initializers): New
4706 members to hold data about array creation.
4707 (New:New): Modify to update NewType
4708 (New:New): New Overloaded contructor for the array creation
4711 * cs-parser.jay (array_creation_expression): Implement to call
4712 the overloaded New constructor.
4714 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
4716 * class.cs (TypeContainer::Constructors): Return member
4717 constructors instead of returning null.
4719 2001-08-26 Miguel de Icaza <miguel@ximian.com>
4721 * typemanager.cs (InitCoreTypes): Initialize the various core
4722 types after we have populated the type manager with the user
4723 defined types (this distinction will be important later while
4724 compiling corlib.dll)
4726 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
4727 on Expression Classification. Now all expressions have a method
4728 `Resolve' and a method `Emit'.
4730 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
4731 generation from working. Also add some temporary debugging
4734 2001-08-24 Miguel de Icaza <miguel@ximian.com>
4736 * codegen.cs: Lots of code generation pieces. This is only the
4737 beginning, will continue tomorrow with more touches of polish. We
4738 handle the fundamentals of if, while, do, for, return. Others are
4739 trickier and I need to start working on invocations soon.
4741 * gen-treedump.cs: Bug fix, use s.Increment here instead of
4744 * codegen.cs (EmitContext): New struct, used during code
4745 emission to keep a context. Most of the code generation will be
4748 * cs-parser.jay: Add embedded blocks to the list of statements of
4749 this block. So code generation proceeds in a top down fashion.
4751 2001-08-23 Miguel de Icaza <miguel@ximian.com>
4753 * statement.cs: Add support for multiple child blocks.
4755 2001-08-22 Miguel de Icaza <miguel@ximian.com>
4757 * codegen.cs (EmitCode): New function, will emit the code for a
4758 Block of code given a TypeContainer and its ILGenerator.
4760 * statement.cs (Block): Standard public readonly optimization.
4761 (Block::Block constructors): Link children.
4762 (Block::Child): Child Linker.
4763 (Block::EmitVariables): Emits IL variable declarations.
4765 * class.cs: Drop support for MethodGroups here, delay until
4767 (Method::): Applied the same simplification that I did before, and
4768 move from Properties to public readonly fields.
4769 (Method::ParameterTypes): Returns the parameter types for the
4770 function, and implements a cache that will be useful later when I
4771 do error checking and the semantic analysis on the methods is
4773 (Constructor::GetCallingConvention): Renamed from CallingConvetion
4774 and made a method, optional argument tells whether this is a class
4775 or a structure to apply the `has-this' bit.
4776 (Method::GetCallingConvention): Implement, returns the calling
4778 (Method::Define): Defines the type, a second pass is performed
4779 later to populate the methods.
4781 (Constructor::ParameterTypes): implement a cache similar to the
4782 one on Method::ParameterTypes, useful later when we do semantic
4785 (TypeContainer::EmitMethod): New method. Emits methods.
4787 * expression.cs: Removed MethodGroup class from here.
4789 * parameter.cs (Parameters::GetCallingConvention): new method.
4791 2001-08-21 Miguel de Icaza <miguel@ximian.com>
4793 * class.cs (TypeContainer::Populate): Drop RootContext from the
4796 (Constructor::CallingConvention): Returns the calling convention.
4797 (Constructor::ParameterTypes): Returns the constructor parameter
4800 (TypeContainer::AddConstructor): Keep track of default constructor
4801 and the default static constructor.
4803 (Constructor::) Another class that starts using `public readonly'
4804 instead of properties.
4806 (Constructor::IsDefault): Whether this is a default constructor.
4808 (Field::) use readonly public fields instead of properties also.
4810 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
4811 track of static constructors; If none is used, turn on
4812 BeforeFieldInit in the TypeAttributes.
4814 * cs-parser.jay (opt_argument_list): now the return can be null
4815 for the cases where there are no arguments.
4817 (constructor_declarator): If there is no implicit `base' or
4818 `this', then invoke the default parent constructor.
4820 * modifiers.cs (MethodAttr): New static function maps a set of
4821 modifiers flags into a MethodAttributes enum
4822 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
4823 MethodAttr, TypeAttr to represent the various mappings where the
4825 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
4827 2001-08-19 Miguel de Icaza <miguel@ximian.com>
4829 * parameter.cs (GetParameterInfo): Fix bug where there would be no
4832 * interface.cs (PopulateIndexer): Implemented the code generator
4833 for interface indexers.
4835 2001-08-17 Miguel de Icaza <miguel@ximian.com>
4837 * interface.cs (InterfaceMemberBase): Now we track the new status
4840 (PopulateProperty): Implement property population. Woohoo! Got
4841 Methods and Properties going today.
4843 Removed all the properties for interfaces, and replaced them with
4844 `public readonly' fields.
4846 2001-08-16 Miguel de Icaza <miguel@ximian.com>
4848 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
4849 initialize their hashtables/arraylists only when they are needed
4850 instead of doing this always.
4852 * parameter.cs: Handle refs and out parameters.
4854 * cs-parser.jay: Use an ArrayList to construct the arguments
4855 instead of the ParameterCollection, and then cast that to a
4858 * parameter.cs: Drop the use of ParameterCollection and use
4859 instead arrays of Parameters.
4861 (GetParameterInfo): Use the Type, not the Name when resolving
4864 2001-08-13 Miguel de Icaza <miguel@ximian.com>
4866 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
4867 and instead use public readonly fields.
4869 * class.cs: Put back walking code for type containers.
4871 2001-08-11 Miguel de Icaza <miguel@ximian.com>
4873 * class.cs (MakeConstant): Code to define constants.
4875 * rootcontext.cs (LookupType): New function. Used to locate types
4878 2001-08-08 Miguel de Icaza <miguel@ximian.com>
4880 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
4881 this System.Reflection code is. Kudos to Microsoft
4883 * typemanager.cs: Implement a type cache and avoid loading all
4884 types at boot time. Wrap in LookupType the internals. This made
4885 the compiler so much faster. Wow. I rule!
4887 * driver.cs: Make sure we always load mscorlib first (for
4888 debugging purposes, nothing really important).
4890 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
4891 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
4893 * rootcontext.cs: Lookup types on their namespace; Lookup types
4894 on namespaces that have been imported using the `using' keyword.
4896 * class.cs (TypeContainer::TypeAttr): Virtualize.
4897 (Class::TypeAttr): Return attributes suitable for this bad boy.
4898 (Struct::TypeAttr): ditto.
4899 Handle nested classes.
4900 (TypeContainer::) Remove all the type visiting code, it is now
4901 replaced with the rootcontext.cs code
4903 * rootcontext.cs (GetClassBases): Added support for structs.
4905 2001-08-06 Miguel de Icaza <miguel@ximian.com>
4907 * interface.cs, statement.cs, class.cs, parameter.cs,
4908 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
4909 Drop use of TypeRefs, and use strings instead.
4911 2001-08-04 Miguel de Icaza <miguel@ximian.com>
4915 * class.cs (Struct::Struct): set the SEALED flags after
4916 checking the modifiers.
4917 (TypeContainer::TypeAttr): new property, returns the
4918 TypeAttributes for a class.
4920 * cs-parser.jay (type_list): Oops, list production was creating a
4921 new list of base types.
4923 * rootcontext.cs (StdLib): New property.
4924 (GetInterfaceTypeByName): returns an interface by type name, and
4925 encapsulates error handling here.
4926 (GetInterfaces): simplified.
4927 (ResolveTree): Encapsulated all the tree resolution here.
4928 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
4931 * driver.cs: Add support for --nostdlib, to avoid loading the
4933 (Main): Do not put tree resolution here.
4935 * rootcontext.cs: Beginning of the class resolution.
4937 2001-08-03 Miguel de Icaza <miguel@ximian.com>
4939 * rootcontext.cs: Provide better error reporting.
4941 * cs-parser.jay (interface_base): set our $$ to be interfaces.
4943 * rootcontext.cs (CreateInterface): Handle the case where there
4944 are no parent interfaces.
4946 (CloseTypes): Routine to flush types at the end.
4947 (CreateInterface): Track types.
4948 (GetInterfaces): Returns an array of Types from the list of
4951 * typemanager.c (AddUserType): Mechanism to track user types (puts
4952 the type on the global type hash, and allows us to close it at the
4955 2001-08-02 Miguel de Icaza <miguel@ximian.com>
4957 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
4958 RecordInterface instead.
4960 * cs-parser.jay: Updated to reflect changes above.
4962 * decl.cs (Definition): Keep track of the TypeBuilder type that
4963 represents this type here. Not sure we will use it in the long
4964 run, but wont hurt for now.
4966 * driver.cs: Smaller changes to accomodate the new code.
4968 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
4971 * rootcontext.cs (CreateInterface): New method, used to create
4972 the System.TypeBuilder type for interfaces.
4973 (ResolveInterfaces): new entry point to resolve the interface
4975 (CodeGen): Property, used to keep track of the code generator.
4977 2001-07-26 Miguel de Icaza <miguel@ximian.com>
4979 * cs-parser.jay: Add a second production for delegate_declaration
4982 (enum_body): Put an opt_comma here instead of putting it on
4983 enum_body or enum_member_declarations so we can handle trailing
4984 commas on enumeration members. Gets rid of a shift/reduce.
4986 (type_list): Need a COMMA in the middle.
4988 (indexer_declaration): Tell tokenizer to recognize get/set
4990 * Remove old targets.
4992 * Re-add the parser target.
4994 2001-07-13 Simon Cozens <simon@simon-cozens.org>
4996 * cs-parser.jay: Add precendence rules for a number of operators
4997 ot reduce the number of shift/reduce conflicts in the grammar.
4999 2001-07-17 Miguel de Icaza <miguel@ximian.com>
5001 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
5004 Get rid of old crufty code.
5006 * rootcontext.cs: Use this to keep track of the parsed
5007 representation and the defined types available to the program.
5009 * gen-treedump.cs: adjust for new convention.
5011 * type.cs: Split out the type manager, and the assembly builder
5014 * typemanager.cs: the type manager will live here now.
5016 * cil-codegen.cs: And the code generator here.
5018 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
5020 * makefile: Fixed up for easy making.
5022 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5024 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
5027 (unary_expression): Expand pre_increment_expression and
5028 post_decrement_expression to reduce a shift/reduce.
5030 2001-07-11 Simon Cozens
5032 * cs-tokenizer.cs: Hex numbers should begin with a 0.
5034 Improve allow_keyword_as_indent name.
5036 2001-06-19 Miguel de Icaza <miguel@ximian.com>
5038 * Adjustments for Beta2.
5040 2001-06-13 Miguel de Icaza <miguel@ximian.com>
5042 * decl.cs: Added `Define' abstract method.
5043 (InTransit): new property, used to catch recursive definitions.
5045 * interface.cs: Implement `Define'.
5047 * modifiers.cs: Map Modifiers.constants to
5048 System.Reflection.TypeAttribute flags.
5050 * class.cs: Keep track of types and user-defined types.
5051 (BuilderInit): New method for creating an assembly
5052 (ResolveType): New function to launch the resolution process, only
5053 used by interfaces for now.
5055 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
5056 that are inserted into the name space.
5058 2001-06-08 Miguel de Icaza <miguel@ximian.com>
5060 * ARGH. I have screwed up my tree so many times due to the use of
5061 rsync rather than using CVS. Going to fix this at once.
5063 * driver.cs: Objetify driver. Load assemblies, use assemblies to
5066 2001-06-07 Miguel de Icaza <miguel@ximian.com>
5068 * Experiment successful: Use System.Type rather that our own
5071 2001-05-25 Miguel de Icaza <miguel@ximian.com>
5073 * cs-parser.jay: Removed nsAliases from here.
5075 Use new namespaces, handle `using XXX;'
5077 * namespace.cs: Reimplemented namespace handling, use a recursive
5078 definition of the class. Now we can keep track of using clauses
5079 and catch invalid using clauses.
5081 2001-05-24 Miguel de Icaza <miguel@ximian.com>
5083 * gen-treedump.cs: Adapted for all the renaming.
5085 * expression.cs (Expression): this class now has a Type property
5086 which returns an expression Type.
5088 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
5089 `Type', as this has a different meaning now in the base
5091 2001-05-22 Miguel de Icaza <miguel@ximian.com>
5093 * interface.cs, class.cs: Removed from all the sources the
5094 references to signature computation, as we can not do method
5095 signature computation during the parsing time, as we are not
5096 trying to solve at that point distinguishing:
5100 void a (NS.Blah x) {}
5103 Which depending on the context might be valid or not, as we do not
5104 know if Blah is the same thing as NS.Blah at that point.
5106 * Redid everything so the code uses TypeRefs now instead of
5107 Types. TypeRefs are just temporary type placeholders, that need
5108 to be resolved. They initially have a pointer to a string and the
5109 current scope in which they are used. This is used later by the
5110 compiler to resolve the reference to an actual Type.
5112 * DeclSpace is no longer a CIR.Type, and neither are
5113 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
5114 are all DeclSpaces, but no Types.
5116 * type.cs (TypeRefManager): This implements the TypeRef manager,
5117 which keeps track of all the types that need to be resolved after
5118 the parsing has finished.
5120 2001-05-13 Miguel de Icaza <miguel@ximian.com>
5122 * ARGH. We are going to have to store `foreach' as a class rather
5123 than resolving it, as we need to verify error 1579 after name
5124 resolution. *OR* we could keep a flag that says `This request to
5125 IEnumerator comes from a foreach statement' which we can then use
5126 to generate the error.
5128 2001-05-10 Miguel de Icaza <miguel@ximian.com>
5130 * class.cs (TypeContainer.AddMethod): we now add methods to the
5131 MethodGroup instead of the method hashtable.
5133 * expression.cs: Add MethodGroup abstraction, which gets us one
5134 step closer to the specification in the way we handle method
5137 * cs-parser.jay (primary_expression): qualified_identifier now
5138 tried to match up an identifier to a local variable reference or
5139 to a parameter reference.
5141 current_local_parameters is now a parser global variable that
5142 points to the current parameters for the block, used during name
5145 (property_declaration): Now creates an implicit `value' argument to
5148 2001-05-09 Miguel de Icaza <miguel@ximian.com>
5150 * parameter.cs: Do not use `param' arguments as part of the
5151 signature, per the spec.
5153 2001-05-08 Miguel de Icaza <miguel@ximian.com>
5155 * decl.cs: Base class for classes, structs and interfaces. This
5156 is the "Declaration Space"
5158 * cs-parser.jay: Use CheckDef for checking declaration errors
5159 instead of having one on each function.
5161 * class.cs: Factor out some code for handling error handling in
5162 accordance to the "Declarations" section in the "Basic Concepts"
5163 chapter in the ECMA C# spec.
5165 * interface.cs: Make all interface member classes derive from
5166 InterfaceMemberBase.
5168 2001-05-07 Miguel de Icaza <miguel@ximian.com>
5170 * Many things: all interfaces are parsed and generated in
5171 gen-treedump. Support for member variables, constructors,
5172 destructors, properties, constants is there.
5174 Beginning of the IL backend, but very little done, just there for
5177 2001-04-29 Miguel de Icaza <miguel@ximian.com>
5179 * cs-parser.jay: Fix labeled statement.
5181 * cs-tokenizer.cs (escape): Escape " and ' always.
5182 ref_line, ref_name: keep track of the line/filename as instructed
5183 by #line by the compiler.
5186 2001-04-27 Miguel de Icaza <miguel@ximian.com>
5188 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
5189 to match the values in System.CodeDOM.
5191 Divid renamed to Divide.
5193 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
5195 (Statements.set): remove.
5197 * System.CodeDOM/CodeCatchClause.cs: always have a valid
5200 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
5201 falseStatements always have valid values.
5203 * cs-parser.jay: Use System.CodeDOM now.