1 2002-02-27 Miguel de Icaza <miguel@ximian.com>
3 * class.cs (Method.Emit): Label parameters.
5 * driver.cs: Return 1 or 0 as the program exit code.
7 2002-02-26 Miguel de Icaza <miguel@ximian.com>
9 * expression.cs: Special case the `null' object when trying to
10 auto-compute the type, as anything can be explicitly converted to
13 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16 (Expression.ImplicitNumericConversion): Perform comparissions of
17 the type using the underlying type in the case of an enumeration
18 rather than using the enumeration type for the compare.
20 Cope with the underlying == type case, which is not possible to
23 (Expression.ConvertNumericExplicit): Perform comparissions of
24 the type using the underlying type in the case of an enumeration
25 rather than using the enumeration type for the compare.
27 * driver.cs: If the user does not supply an extension, assume .exe
29 * cs-parser.jay (if_statement): Rewrote so that we can track the
30 location for the if statement.
32 * expression.cs (Binary.ConstantFold): Only concat strings when
33 the operation is "+", not everything ;-)
35 * statement.cs (Statement.EmitBoolExpression): Take a location
37 (If, While, Do): Track location.
39 * expression.cs (Binary.ResolveOperator): In the object + string
40 case, I was missing a call to ConvertImplicit
42 2002-02-25 Ravi Pratap <ravi@ximian.com>
44 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
45 Location arguments. Ensure we use RootContext.LookupType to do our work
46 and not try to do a direct Type.GetType and ModuleBuilder.GetType
48 * interface.cs (PopulateMethod): Handle the type of the parameter being
51 * expression.cs (Invocation.BetterFunction): Handle the case when we
52 have a params method with no fixed arguments and a call is made with no
55 2002-02-25 Miguel de Icaza <miguel@ximian.com>
57 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
58 the verbatim-string-literal
60 * support.cs (InternalParameters.ParameterModifier): handle null
62 (InternalParameters.ParameterType): ditto.
64 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
65 duplicating the name of the variable parameter.
66 (GetParameterByName): Fix bug where we were not looking up array
67 paramters if they were the only present (thanks Paolo!).
68 (GetParameterInfo): We only have an empty set of types if both
69 fixed and array are set to null.
70 (GetParameterInfo-idx): Handle FixedParameter == null
72 * cs-parser.jay: Handle the case where there is no catch
73 statements (missing null test).
75 2002-02-22 Miguel de Icaza <miguel@ximian.com>
77 * driver.cs (MainDriver): Be conservative on our command line
80 Catch DirectoryNotFoundException when calling GetFiles.
82 (SplitPathAndPattern): Used to split the input specification into
83 a path and a pattern that we can feed to Directory.GetFiles.
85 2002-02-21 Miguel de Icaza <miguel@ximian.com>
87 * statement.cs (Fixed): Implement the last case of the Fixed
88 statement (string handling).
90 * expression.cs (StringPtr): New class used to return a char * to
91 a string; Used by the Fixed statement.
93 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
95 * expression.cs (Binary.ResolveOperator): Remove redundant
96 MemberLookup pn parent type.
97 Optimize union call, we do not need a union if the types are the same.
98 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
101 Specialize the use of MemberLookup everywhere, instead of using
102 the default settings.
104 (StackAlloc): Implement stackalloc keyword.
106 * cs-parser.jay: Add rule to parse stackalloc.
108 * driver.cs: Handle /h, /help, /?
110 * expression.cs (MakeByteBlob): Removed the hacks we had in place
111 before we supported unsafe code.
113 * makefile: add --unsafe to the self compilation of mcs.
115 2002-02-20 Miguel de Icaza <miguel@ximian.com>
117 * expression.cs (PointerArithmetic): New class that is used to
118 perform pointer arithmetic.
119 (Binary.Resolve): Handle pointer arithmetic
120 Handle pointer comparission.
121 (ArrayPtr): Utility expression class that is used to take the
124 (ElementAccess): Implement array access for pointers
126 * statement.cs (Fixed): Implement fixed statement for arrays, we
127 are missing one more case before we are done.
129 * expression.cs (Indirection): Implement EmitAssign and set the
130 ExprClass to Variable. This allows pointer dereferences to be
131 treated as variables, and to have values assigned to them.
133 * ecore.cs (Expression.StoreFromPtr): New utility function to
134 store values dereferencing.
136 2002-02-20 Ravi Pratap <ravi@ximian.com>
138 * expression.cs (Binary.ResolveOperator): Ensure that we are
139 not trying to operate on a void type - this fixes the reported
142 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
143 the parent implementation is sealed.
145 * ../errors/cs0239.cs : Add.
147 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
149 * typemanager.cs (unverifiable_code_type): Corresponds to
150 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
151 which have unsafe code in them.
153 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
156 2002-02-19 Miguel de Icaza <miguel@ximian.com>
158 * cs-tokenizer.cs: Add support for @"litreal strings"
160 Make tokenizer accept pre-processor directives
161 on any column (remove the old C-like limitation).
163 * rootcontext.cs (EmitCode): Emit any global attributes.
164 (AddGlobalAttributes): Used to keep track of assembly attributes.
166 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
168 * cs-parser.jay: Add support for global attributes.
170 2002-02-17 Miguel de Icaza <miguel@ximian.com>
172 * expression.cs (Indirection): New helper class. Unary will
173 create Indirection classes to be able to implement the
174 IMemoryLocation interface on it.
176 2002-02-16 Miguel de Icaza <miguel@ximian.com>
178 * cs-parser.jay (fixed_statement): reference the right statement.
180 * statement.cs (Fixed.Emit): Finish implementing the fixed
181 statement for the &x case.
183 2002-02-14 Miguel de Icaza <miguel@ximian.com>
185 * class.cs (Property.Define, Method.Define): Remove newslot when
188 * modifiers.cs: My use of NewSlot when `Abstract' was set was
189 wrong. NewSlot should only be used if the `new' keyword is present.
191 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
192 locating our system dir. Sorry about this.
194 2002-02-13 Miguel de Icaza <miguel@ximian.com>
196 * driver.cs (GetSystemDir): Compute correctly the location of our
197 system assemblies. I was using the compiler directory instead of
198 the library directory.
200 2002-02-13 Ravi Pratap <ravi@ximian.com>
202 * expression.cs (BetterFunction): Put back in what Miguel commented out
203 since it is the correct fix. The problem is elsewhere ;-)
205 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
206 parameters of the parms method are themselves compatible or not !
208 (StandardConversionExists): Fix very dangerous bug where we were forgetting
209 to check that a class implements an interface before saying that an implicit
210 conversion was allowed. Use ImplementsInterface to do the checking.
212 2002-02-13 Miguel de Icaza <miguel@ximian.com>
214 * class.cs (Method.Define): Track whether we are an explicit
215 implementation or not. And only call DefineMethodOverride if we
216 are an explicit implementation.
218 (Property.DefineMethod): Ditto.
220 2002-02-11 Ravi Pratap <ravi@ximian.com>
222 * expression.cs (BetterFunction): Catch hideous bug which was
223 preventing us from detecting ambiguous calls due to implicit casts i.e
226 2002-01-29 Miguel de Icaza <miguel@ximian.com>
228 * support.cs (Pair): Remove un-needed method. I figured why I was
229 getting the error in cs-parser.jay, the variable in a foreach loop
230 is readonly, and the compiler does not really treat this as a variable.
232 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
233 instead of EQUALS in grammar.
235 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
237 * expression.cs (Unary.DoResolve): Check whether the argument is
240 2002-01-28 Miguel de Icaza <miguel@ximian.com>
242 * support.cs: Api for Pair to set a value. Despite the fact that
243 the variables are public the MS C# compiler refuses to compile
244 code that accesses the field if the variable is part of a foreach
247 * statement.cs (Fixed): Begin implementation of the fixed
250 (Block.AddVariable): Return the VariableInfo on success and null
251 on failure instead of true/false.
253 * cs-parser.jay (foreach): Catch errors on variables already
254 defined (we were ignoring this value before) and properly unwind
257 (fixed_statement): grammar for the fixed statement.
259 2002-01-25 Miguel de Icaza <miguel@ximian.com>
261 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
262 pointer types to be incretemented.
266 * cs-parser.jay (pointer_member_access): Implement
267 expr->IDENTIFIER production.
269 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
270 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
273 (Unary): Implement indirection.
275 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
276 use in non-unsafe context).
278 (SimpleName.DoResolve): Check for pointers in field access on safe
281 (Expression.LoadFromPtr): Factor the load-indirect code in this
282 function. This was duplicated in UnboxCast and ParameterReference
284 2002-01-24 Miguel de Icaza <miguel@ximian.com>
286 * expression.cs (ComposedCast): report an error if a pointer cast
287 is used in a safe region.
289 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
290 pointer type casts in unsafe context.
292 * codegen.cs (EmitContext): Set up IsUnsafe.
294 * cs-parser.jay (non_expression_type): Add productions for pointer
297 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
298 code. We should not use force into static mode if the method is
299 not virtual. Fixes bug in MIS
301 * statement.cs (Do.Emit, While.Emit, For.Emit,
302 Statement.EmitBoolExpression): Add support to Do and While to
303 propagate infinite loop as `I do return' semantics.
305 Improve the For case to also test for boolean constants.
307 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
308 to the list of attributes we can add.
310 Remove `EmitContext' argument.
312 * class.cs (Method.Define): Apply parameter attributes.
313 (Constructor.Define): Apply parameter attributes.
314 (MethodCore.LabelParameters): Move here the core of labeling
317 * support.cs (ReflectionParameters.ParameterModifier,
318 InternalParameters.ParameterModifier): Use IsByRef on the type and
319 only return the OUT bit for these parameters instead of in/out/ref
322 This is because I miss-understood things. The ParameterInfo.IsIn
323 and IsOut represent whether the parameter has the [In] and [Out]
326 2002-01-22 Miguel de Icaza <miguel@ximian.com>
328 * ecore.cs (FieldExpr.Emit): Release temporaries.
330 * assign.cs (LocalTemporary.Release): new function.
332 * codegen.cs (EmitContext.GetTemporaryStorage,
333 EmitContext.FreeTemporaryStorage): Rework the way we deal with
334 temporary storage. Now we can "put back" localbuilders when we
337 2002-01-21 Miguel de Icaza <miguel@ximian.com>
339 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
340 need to make a copy of the variable to generate verifiable code.
342 2002-01-19 Miguel de Icaza <miguel@ximian.com>
344 * driver.cs: Compute dynamically the system directory.
346 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
347 Slower, but more generally useful. Used by the abstract
348 registering implementation.
350 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
351 the rules for the special rule on Type/instances. First check if
352 we have the same name, and if so, try that special static path
353 rather than the instance path.
355 2002-01-18 Miguel de Icaza <miguel@ximian.com>
357 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
360 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
361 Enum, ValueType, Delegate or Array for non-corlib compiles.
363 * cs-tokenizer.cs: Catch long identifiers (645)
365 * typemanager.cs (IndexerPropetyName): Ravi never tested this
368 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
369 fix, we were returning too early, so we were not registering
370 pending methods from abstract classes.
372 Do not register pending methods if the class is abstract.
374 * expression.cs (Conditional.DoResolve): Report circular implicit
375 conversions when we neecd to compute it for conditional
378 (Is.DoResolve): If the expression is always of the provided type,
379 flag warning 183. If the expression can not ever be of the
380 provided type flag warning 184.
382 * class.cs: Catch 169 as well.
384 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
387 2002-01-18 Nick Drochak <ndrochak@gol.com>
389 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
391 2002-01-17 Miguel de Icaza <miguel@ximian.com>
393 * interface.cs: (PopulateMethod): Check for pointers being defined
394 only if the unsafe context is active.
395 (PopulateProperty): ditto.
396 (PopulateIndexer): ditto.
398 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
399 specified. If pointers are present, make sure that they are
400 present in an unsafe context.
401 (Constructor, Constructor.Define): ditto.
402 (Field, Field.Define): ditto.
403 (Property, Property.Define): ditto.
404 (Event, Event.Define): ditto.
406 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
407 hashtable if there are classes or structs defined.
409 * expression.cs (LocalVariableReference.DoResolve): Simplify this
410 code, as the constant resolution moved.
412 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
413 the metadata, so we can flag error 133.
415 * decl.cs (MemberCore.UnsafeOK): New function to test that a
416 pointer is being declared in an unsafe context.
418 2002-01-16 Miguel de Icaza <miguel@ximian.com>
420 * modifiers.cs (Modifiers.Check): Require a Location argument.
421 Report error 227 for Unsafe use.
423 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
425 * statement.cs (For.Emit): If the test is null, then report that
426 we do `return', as we wont reach anything afterwards.
428 (Switch.SwitchGoverningType): Track the expression that matched
431 * driver.cs: Allow negative numbers as an error code to flag.
433 * cs-parser.jay: Handle 1551.
435 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
437 2002-01-15 Miguel de Icaza <miguel@ximian.com>
439 * cs-parser.jay: Report 1518 (type declaration can only contain
440 class, struct, interface, enum or delegate)
442 (switch_label): Report 1523 (keywords `case' or `default' must
445 (opt_switch_sections): Report 1522 (empty switch)
447 * driver.cs: Report 1515 (response file specified multiple times)
448 Report 1516 (Source file specified multiple times).
450 * expression.cs (Argument.Resolve): Signal 1510
452 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
453 access not allowed in static code)
455 2002-01-11 Ravi Pratap <ravi@ximian.com>
457 * typemanager.cs (IsPointerType): Utility method which we are going
460 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
461 the object type, so we take care of that.
463 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
465 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
466 added to non-params parameters :-)
468 * typemanager.cs (CSharpName): Include 'void' type too.
470 (void_ptr_type): Include in the set of core types.
472 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
475 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
478 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
479 completely forgotten about it.
481 2002-01-10 Ravi Pratap <ravi@ximian.com>
483 * cs-parser.jay (pointer_type): Add. This begins our implementation
484 of parsing rules for unsafe code.
486 (unsafe_statement): Implement.
488 (embedded_statement): Modify to include the above.
490 * statement.cs (Unsafe): Implement new class for unsafe blocks.
492 * codegen.cs (EmitContext.InUnsafe): Add. This determines
493 if the current context is an unsafe one.
495 * cs-parser.jay (local_variable_pointer_type): Since local variable types
496 are handled differently, we need separate rules for them.
498 (local_variable_declaration): Update to use local_variable_pointer_type
499 to allow variable declarations of unmanaged pointer types.
501 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
504 * ../errors/cs0214.cs : Add.
506 2002-01-16 Nick Drochak <ndrochak@gol.com>
508 * makefile: remove 'response' file when cleaning.
510 2002-01-15 Miguel de Icaza <miguel@ximian.com>
512 * cs-parser.jay: Report 1524.
514 2002-01-14 Miguel de Icaza <miguel@ximian.com>
516 * typemanager.cs (RegisterMethod): drop checking if we have
517 registered this from here
519 2002-01-12 Miguel de Icaza <miguel@ximian.com>
521 * class.cs (Method.EmitDestructor): Implement calling our base
524 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
527 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
528 this routine and will wrap the call in a try/catch block. Deal
531 2002-01-11 Miguel de Icaza <miguel@ximian.com>
533 * ecore.cs (Expression.MemberLookup): instead of taking a
534 parameter `same_type' that was used to tell whether we could
535 access private members we compute our containing type from the
538 (FieldExpr): Added partial support for volatile fields. This does
539 not work for volatile fields exposed from assemblies, as I can not
540 figure out how to extract the modreq from it.
542 Updated all the source files to use this.
544 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
545 because it is referenced by MemberLookup very often.
547 2002-01-09 Ravi Pratap <ravi@ximian.com>
549 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
550 TypeBuilder.GetCustomAttributes to retrieve what we need.
552 Get rid of redundant default_member_attr_type as this is the same as
553 default_member_type which already exists.
555 * interface.cs, attribute.cs : Update accordingly.
557 2002-01-08 Miguel de Icaza <miguel@ximian.com>
559 * typemanager.cs: Enable IndexerPropertyName again. It does not
560 work for TYpeBuilders though. Ravi, can you please fix this?
562 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
564 * expression.cs (Argument.Emit): Handle the case of ref objects
565 being passed to ref functions;
567 (ParameterReference.EmitLoad): Loads the content of the pointer
568 without dereferencing.
570 2002-01-07 Miguel de Icaza <miguel@ximian.com>
572 * cs-tokenizer.cs: Implemented the pre-processing expressions.
574 2002-01-08 Ravi Pratap <ravi@ximian.com>
576 * class.cs (Indexer.DefineMethod): Incorporate the interface
577 type in the name of the method if we are doing explicit interface
580 * expression.cs (ConversionExists): Remove as it is completely obsolete.
582 (BetterConversion): Fix extremely trivial bug where we were referring to
583 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
586 * ../errors/bug16.cs : Add although we have fixed it.
588 2002-01-07 Miguel de Icaza <miguel@ximian.com>
590 * expression.cs (BaseIndexer): Begin implementation.
592 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
594 * cs-parser.jay (indexer_declarator): Use qualified_identifier
595 production directly to remove a shift/reduce, and implement
596 explicit interface implementation.
598 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
599 after a floating point suffix.
601 * expression.cs (DoNumericPromotions): Improved the conversion for
602 uint/uint. If we have a constant, we avoid doing a typecast to a
605 * class.cs (Indexer): Implement explicit interface implementation
608 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
610 * class.cs: make the default instance constructor public and hidebysig.
612 2001-01-03 Ravi Pratap <ravi@ximian.com>
614 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
615 so we can call it from elsewhere.
617 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
618 we emit it internally if the class has a defined indexer; otherwise the user
619 emits it by decorating the class definition with the DefaultMemberAttribute.
621 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
622 attribute is not used on a type which defines an indexer.
624 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
625 character when we skip whitespace.
627 * ../errors/cs0646.cs : Add.
629 2002-01-03 Miguel de Icaza <miguel@ximian.com>
631 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
634 * makefile: Add practical target `mcs3.exe' which builds the third
637 * expression.cs (New): Fix structures constructor calling.
639 * class.cs (Property, Method, Indexer): Emit Final flag on the
640 method if we are an interface implementation and we are not
643 * ecore.cs (PropertyExpr): New public field `IsBase', tells
644 whether this property is referencing a `base' method.
646 * expression.cs (Invocation.EmitCall): take an extra argument:
647 is_base, this is used to determine whether the `call' or
648 `callvirt' opcode should be used.
651 * delegate.cs: update EmitCall.
653 * class.cs (Method.Define): Set NewSlot for the cases where we are
654 not implementing an interface method.
656 (Property.Define): ditto.
658 2002-01-02 Miguel de Icaza <miguel@ximian.com>
660 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
661 'r'. Allows mcs to parse itself fully.
663 2002-01-02 Ravi Pratap <ravi@ximian.com>
665 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
666 of the number of initializers that require the InitializeArray method.
668 (CheckIndices): Store the Expression in all cases - not the plain value. Also
669 update the above field where necessary.
671 (MakeByteBlob): Update accordingly.
673 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
676 (EmitDynamicInitializers): Update in accordance with the new optimization.
678 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
681 * cs-parser.jay : Fix some glaring errors I introduced.
683 2002-01-01 Ravi Pratap <ravi@ximian.com>
685 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
686 so that we can check for name clashes there too.
688 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
689 for interface indexers.
691 * interfaces.cs (Define): Emit the default member attribute.
693 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
694 variable was being referred to while setting the value ;-)
696 2002-01-01 Miguel de Icaza <miguel@ximian.com>
698 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
699 byte-by-byte information when we know the data is zero.
701 Make the block always a multiple of 4, because
702 DefineInitializedData has a bug.
704 * assign.cs: Fix, we should assign from the temporary, not from
707 * expression.cs (MakeByteBlob): Fix my incorrect code.
709 2001-12-31 Miguel de Icaza <miguel@ximian.com>
711 * typemanager.cs (EnumToUnderlying): This function is used to get
712 the underlying type from an enumeration, because it does not
715 * constant.cs: Use the I4_S form for values between -128 and 127.
717 * statement.cs (Block.LookupLabel): Looks up a label.
718 (Block): Drop support for labeled blocks.
720 (LabeledStatement): New kind of statement that represents a label
723 (Goto): Finally implement this bad boy.
725 * cs-parser.jay: Update to reflect new mechanism to implement
728 2001-12-30 Miguel de Icaza <miguel@ximian.com>
730 * codegen.cs (EmitContext.This): a codegen property that keeps the
731 a single instance of this instead of creating many different this
734 * delegate.cs (Delegate.DoResolve): Update to use the property;
736 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
738 * expression.cs (BaseAccess.DoResolve): Ditto.
740 2001-12-29 Ravi Pratap <ravi@ximian.com>
742 * typemanager.cs (methodimpl_attr_type): Add to hold the type
743 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
745 (InitCoreTypes): Update accordingly.
747 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
748 so we can quickly store the state.
750 (ApplyAttributes): Set the correct implementation flags
751 for InternalCall methods.
753 2001-12-29 Miguel de Icaza <miguel@ximian.com>
755 * expression.cs (EmitCall): if a method is not virtual, then do
756 not use callvirt on it.
758 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
759 user defined stuff) requires the use of stobj, which takes an
760 address on the stack instead of an array and an index. So emit
761 the Ldelema operation for it.
763 (EmitStoreOpcode): Use stobj for valuetypes.
765 (UnaryMutator.EmitCode): Use the right 1 value depending on
766 whether we are dealing with int64/uint64, float or doubles.
768 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
769 constructors that I implemented last night.
771 (Constructor.IsDefault): Fix to work properly for static
774 * cs-parser.jay (CheckDef): report method signature errors.
775 Update error number 103 to be 132.
777 * decl.cs: New AdditionResult enumeration value: MethodExists.
778 Although we do this check for methods later on in the semantic
779 analysis, catching repeated default constructors is so easy that
782 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
785 (ParameterReference.EmitAssign, Emit): handle
788 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
789 (ArrayAccess.EmitStoreOpcode): ditto.
791 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
793 * expression.cs (MakeByteBlob): Complete all the missing types
794 (uint, short, ushort, byte, sbyte)
796 * class.cs: Only init instance field initializers on instance
799 Rename `constructors' to instance_constructors.
801 (TypeContainer.AddConstructor): Only add constructors to the list
804 Make sure that we handle default_static_constructor independently
805 everywhere where we handle instance_constructors
807 2001-12-28 Miguel de Icaza <miguel@ximian.com>
809 * class.cs: Do not lookup or create a base initializer for a
812 (ConstructorInitializer.Resolve): use the proper type to lookup
815 * cs-parser.jay: Report error 1585 (modifiers between type and name).
817 * enum.cs, interface.cs: Remove CloseType, this is taken care by
820 * decl.cs: CloseType is now an virtual method, the default
821 implementation just closes this type.
823 2001-12-28 Ravi Pratap <ravi@ximian.com>
825 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
826 to PreserveSig by default. Also emit HideBySig on such methods.
828 Basically, set the defaults to standard values.
830 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
831 argument, if candidate is better, it can't be worse than the best !
833 (Invocation): Re-write bits to differentiate between methods being
834 applicable in their expanded form and their normal form - for params
837 Get rid of use_standard everywhere as only standard conversions are allowed
838 in overload resolution.
840 More spec conformance.
842 2001-12-27 Miguel de Icaza <miguel@ximian.com>
844 * driver.cs: Add --timestamp, to see where the compiler spends
847 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
848 `this' in static code.
850 (SimpleName.DoResolve): Implement in terms of a helper function
851 that allows static-references to be passed upstream to
854 (Expression.ResolveWithSimpleName): Resolve specially simple
855 names when called by MemberAccess to implement the special
858 (Expression.ImplicitReferenceConversion): Handle conversions from
859 Null to reference types before others, as Null's type is
862 * expression.cs (Invocation.EmitCall): Handle the special case of
863 calling methods declared on a reference type from a ValueType
864 (Base classes System.Object and System.Enum)
866 (MemberAccess.Resolve): Only perform lookups on Enumerations if
867 the left hand side is a TypeExpr, not on every enumeration.
869 (Binary.Resolve): If types are reference types, then do a cast to
870 object on operators != and == of both arguments.
872 * typemanager.cs (FindMembers): Extract instance and static
873 members if requested.
875 * interface.cs (PopulateProperty): Use void_type instead of null
876 as the return type for the setter method.
878 (PopulateIndexer): ditto.
880 2001-12-27 Ravi Pratap <ravi@ximian.com>
882 * support.cs (ReflectionParameters): Fix minor bug where we
883 were examining the wrong parameter for the ParamArray attribute.
885 Cope with requests for the type of the parameter at position
886 greater than the params parameter's. We now return the element
887 type of the params array as that makes more sense.
889 * expression.cs (Invocation.IsParamsMethodApplicable): Update
890 accordingly as we no longer have to extract the element type
893 (Invocation.OverloadResolve): Update.
895 2001-12-27 Miguel de Icaza <miguel@ximian.com>
897 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
898 against IEnumerator, test whether the return value is a descendant
899 of the IEnumerator interface.
901 * class.cs (Indexer.Define): Use an auxiliary method to implement
902 the other bits of the method definition. Begin support for
903 explicit interface implementation.
905 (Property.DefineMethod): Use TypeManager.void_type instead of null
906 for an empty return value.
908 2001-12-26 Miguel de Icaza <miguel@ximian.com>
910 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
911 dealing with a FieldExpr which is composed of a FieldBuilder, in
912 the code path we did extract the constant, but we should have
913 obtained the underlying value to be able to cast it (otherwise we
914 end up in an infinite loop, this is what Ravi was running into).
916 (ArrayCreation.UpdateIndices): Arrays might be empty.
918 (MemberAccess.ResolveMemberAccess): Add support for section
919 14.5.4.1 that deals with the special case of E.I when E is a type
920 and something else, that I can be a reference to a static member.
922 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
923 handle a particular array type to create byte blobs, it is just
924 something we dont generate byteblobs for.
926 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
929 * location.cs (Push): remove the key from the hashtable that we
930 are about to add. This happens for empty files.
932 * driver.cs: Dispose files after we have parsed them.
934 (tokenize): new function that only runs the tokenizer on its
935 input, for speed testing.
937 2001-12-26 Ravi Pratap <ravi@ximian.com>
939 * class.cs (Event.Define): Define the private field only if there
940 are no accessors defined.
942 * expression.cs (ResolveMemberAccess): If there is no associated
943 field with the event, that means we have an event defined with its
944 own accessors and we should flag error cs0070 since transforming
945 ourselves into a field is not valid in that case.
947 * ecore.cs (SimpleName.DoResolve): Same as above.
949 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
950 and charset to sane values.
952 2001-12-25 Ravi Pratap <ravi@ximian.com>
954 * assign.cs (DoResolve): Perform check on events only if they
955 are being accessed outside the declaring type.
957 * cs-parser.jay (event_declarations): Update rules to correctly
958 set the type of the implicit parameter etc.
960 (add_accessor, remove_accessor): Set current local parameters.
962 * expression.cs (Binary): For delegate addition and subtraction,
963 cast the return value from the method into the appropriate delegate
966 2001-12-24 Ravi Pratap <ravi@ximian.com>
968 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
969 of these as the workaround is unnecessary.
971 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
972 delegate data - none of that is needed at all.
974 Re-write bits to extract the instance expression and the delegate method
977 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
980 * attribute.cs (ApplyAttributes): New method to take care of common tasks
981 of attaching attributes instead of duplicating code everywhere.
983 * everywhere : Update code to do attribute emission using the above method.
985 2001-12-23 Miguel de Icaza <miguel@ximian.com>
987 * expression.cs (IsParamsMethodApplicable): if there are not
988 parameters, return immediately.
990 * ecore.cs: The 0 literal can be implicity converted to an enum
993 (SimpleName.DoResolve): First lookup the type, then lookup the
996 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
997 want to get its address. If the InstanceExpression is not
998 addressable, store the result in a temporary variable, then get
1001 * codegen.cs: Only display 219 errors on warning level or above.
1003 * expression.cs (ArrayAccess): Make it implement the
1004 IMemoryLocation interface.
1006 (Binary.DoResolve): handle the operator == (object a, object b)
1007 and operator != (object a, object b) without incurring into a
1008 BoxedCast (because 5 != o should never be performed).
1010 Handle binary enumerator operators.
1012 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
1013 value type, otherwise use Ldelem_ref.
1015 Use precomputed names;
1017 (AddressOf): Implement address of
1019 * cs-parser.jay (labeled_statement): Fix recursive block
1020 addition by reworking the production.
1022 * expression.cs (New.DoEmit): New has a special case:
1024 If we are dealing with a ValueType, we have a few
1025 situations to deal with:
1027 * The target of New is a ValueType variable, that is
1028 easy, we just pass this as the variable reference
1030 * The target of New is being passed as an argument,
1031 to a boxing operation or a function that takes a
1034 In this case, we need to create a temporary variable
1035 that is the argument of New.
1038 2001-12-23 Ravi Pratap <ravi@ximian.com>
1040 * rootcontext.cs (LookupType): Check that current_type is not null before
1041 going about looking at nested types.
1043 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
1044 not implement the IAssignMethod interface any more.
1046 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
1047 where we tranform them into FieldExprs if they are being resolved from within
1050 * ecore.cs (SimpleName.DoResolve): Do the same here.
1052 * assign.cs (DoResolve, Emit): Clean up code considerably.
1054 * ../errors/bug10.cs : Add.
1056 * ../errors/cs0070.cs : Add.
1058 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
1060 * assign.cs : Get rid of EventIsLocal everywhere.
1062 2001-12-23 Miguel de Icaza <miguel@ximian.com>
1064 * ecore.cs (ConvertIntLiteral): finished the implementation.
1066 * statement.cs (SwitchLabel): Convert the value we are using as a
1067 key before looking up the table.
1069 2001-12-22 Miguel de Icaza <miguel@ximian.com>
1071 * codegen.cs (EmitTopBlock): Require a Location argument now.
1073 * cs-parser.jay (constructor_declarator): We need to setup
1074 current_local_parameters before we parse the
1075 opt_constructor_initializer, to allow the variables to be bound
1076 to the constructor arguments.
1078 * rootcontext.cs (LookupType): First lookup nested classes in our
1079 class and our parents before we go looking outside our class.
1081 * expression.cs (ConstantFold): Extract/debox the values at the
1084 * rootcontext.cs (EmitCode): Resolve the constants first before we
1085 resolve the types. This is not really needed, but it helps debugging.
1087 * statement.cs: report location.
1089 * cs-parser.jay: pass location to throw statement.
1091 * driver.cs: Small bug fix.
1093 * report.cs: Updated format to be 4-zero filled digits.
1095 2001-12-22 Ravi Pratap <ravi@ximian.com>
1097 * expression.cs (CheckIndices): Fix minor bug where the wrong
1098 variable was being referred to ;-)
1100 (DoEmit): Do not call EmitStaticInitializers when the
1101 underlying type is System.Object.
1103 2001-12-21 Ravi Pratap <ravi@ximian.com>
1105 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
1106 and do the usual workaround for SRE.
1108 * class.cs (MyEventBuilder.EventType): New member to get at the type
1109 of the event, quickly.
1111 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
1113 * assign.cs (Assign.DoResolve): Handle the case when the target
1114 is an EventExpr and perform the necessary checks.
1116 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
1119 (SimpleName.MemberStaticCheck): Include check for EventExpr.
1121 (EventExpr): Set the type in the constructor itself since we
1122 are meant to be born fully resolved.
1124 (EventExpr.Define): Revert code I wrote earlier.
1126 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
1127 instance expression is null. The instance expression is a This in that case
1128 or a null, depending on whether it is a static method or not.
1130 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
1131 refers to more than one method.
1133 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
1134 and accordingly flag errors.
1136 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1138 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
1140 2001-12-22 Miguel de Icaza <miguel@ximian.com>
1142 * location.cs (ToString): Provide useful rutine.
1144 2001-12-21 Miguel de Icaza <miguel@ximian.com>
1146 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
1147 objects, return the actual integral boxed.
1149 * statement.cs (SwitchLabel): define an ILLabel for each
1152 (Switch.CheckSwitch): If the value is a Literal, extract
1153 the underlying literal.
1155 Also in the unused hashtable we had, add the SwitchLabel so we can
1156 quickly look this value up.
1158 * constant.cs: Implement a bunch of new constants. Rewrite
1159 Literal based on this. Made changes everywhere to adapt to this.
1161 * expression.cs (Expression.MakeByteBlob): Optimize routine by
1162 dereferencing array only once, and also copes with enumrations.
1164 bytes are two bytes wide, not one.
1166 (Cast): Perform constant conversions.
1168 * ecore.cs (TryImplicitIntConversion): Return literals instead of
1169 wrappers to the literals here.
1171 * expression.cs (DoNumericPromotions): long literals can converted
1172 to ulong implicity (this is taken care of elsewhere, but I was
1175 * ecore.cs (Expression.Literalize): Make the return type Literal,
1176 to improve type checking.
1178 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
1180 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1182 * literal.cs: Revert code from ravi that checked the bounds. The
1183 bounds are sane by the definition of the type itself.
1185 * typemanager.cs: Fix implementation of ImplementsInterface. We
1186 need to actually look up in our parent hierarchy for interfaces
1189 * const.cs: Use the underlying type for enumerations
1191 * delegate.cs: Compute the basename for the delegate creation,
1192 that should fix the delegate test case, and restore the correct
1193 Type Lookup semantics in rootcontext
1195 * rootcontext.cs: Revert Ravi's last patch. The correct way of
1196 referencing a nested type with the Reflection API is using the "+"
1199 * cs-parser.jay: Do not require EOF token at the end.
1201 2001-12-20 Ravi Pratap <ravi@ximian.com>
1203 * rootcontext.cs (LookupType): Concatenate type names with
1204 a '.' instead of a '+' The test suite passes again.
1206 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
1207 field of the enumeration.
1209 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
1210 the case when the member is an EventExpr.
1212 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
1213 static has an associated instance expression.
1215 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
1217 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
1219 * class.cs (Event.Define): Register event and perform appropriate checks
1222 We define the Add and Remove methods even if the use provides none because
1223 in that case, we provide default implementations ourselves.
1225 Define a private field of the type of the event. This is done by the CSC compiler
1226 and we should be doing it too ;-)
1228 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
1229 More methods we use in code we generate.
1231 (multicast_delegate_type, delegate_type): Two separate types since the distinction
1234 (InitCoreTypes): Update accordingly for the above.
1236 * class.cs (Event.Emit): Generate code for default accessors that we provide
1238 (EmitDefaultMethod): Do the job in the above.
1240 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
1243 2001-12-20 Miguel de Icaza <miguel@ximian.com>
1245 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
1246 builders even if we were missing one.
1248 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
1249 pass the Basename as our class name instead of the Name. The
1250 basename will be correctly composed for us.
1252 * parameter.cs (Paramters): Now takes a Location argument.
1254 * decl.cs (DeclSpace.LookupType): Removed convenience function and
1255 make all the code call directly LookupType in RootContext and take
1256 this chance to pass the Location information everywhere.
1258 * Everywhere: pass Location information.
1260 2001-12-19 Miguel de Icaza <miguel@ximian.com>
1262 * class.cs (Constructor.Define): Updated way of detecting the
1263 length of the parameters.
1265 (TypeContainer.DefineType): Use basename as the type name for
1268 (TypeContainer.Define): Do not recursively define types here, as
1269 definition is taken care in order by the RootContext.
1271 * tree.cs: Keep track of namespaces in a per-file basis.
1273 * parameter.cs (Parameter.ComputeSignature): Update to use
1276 (Parameters.GetSignature): ditto.
1278 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
1279 instead of a TypeContainer.
1281 (Interface.SemanticAnalysis): Use `this' instead of our parent to
1282 resolve names. Because we need to be resolve in our context, not
1285 * driver.cs: Implement response files.
1287 * class.cs (TypeContainer.DefineType): If we are defined, do not
1290 (Event.Emit): Emit the code for add/remove handlers.
1291 (Event.Define): Save the MethodBuilders for add/remove.
1293 * typemanager.cs: Use pair here too.
1295 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
1296 DictionaryEntry requires the first argument to be non-null.
1298 (enum_declaration): Compute full name for registering the
1301 (delegate_declaration): Instead of using
1302 formal_parameter_list, use opt_formal_parameter_list as the list
1305 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
1306 (EventParsing): New property that controls whether `add' and
1307 `remove' are returned as tokens or identifiers (for events);
1309 2001-12-19 Ravi Pratap <ravi@ximian.com>
1311 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
1312 use MyEventBuilder only and let it wrap the real builder for us.
1314 (MyEventBuilder): Revamp constructor etc.
1316 Implement all operations that we perform on EventBuilder in precisely the same
1319 (FindMembers): Update to use the EventBuilder member.
1321 (Event.Emit): Update accordingly.
1323 2001-12-18 Ravi Pratap <ravi@ximian.com>
1325 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
1326 by calling the appropriate methods.
1328 (GetCustomAttributes): Make stubs as they cannot possibly do anything
1331 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
1333 2001-12-17 Ravi Pratap <ravi@ximian.com>
1335 * delegate.cs (Delegate.Populate): Check that the return type
1336 and various parameters types are indeed accessible.
1338 * class.cs (Constructor.Define): Same here.
1340 (Field.Define): Ditto.
1342 (Event.Define): Ditto.
1344 (Operator.Define): Check that the underlying Method defined itself
1345 correctly - so it's MethodBuilder should not be null.
1347 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
1348 expression happens to be null.
1350 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
1351 members but as of now we don't seem to be able to do anything really useful with it.
1353 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
1354 not the EventBuilder.
1356 2001-12-18 Miguel de Icaza <miguel@ximian.com>
1358 * cs-tokenizer.cs: Add support for defines.
1359 Add support for #if, #elif, #else, #endif
1361 (eval_var): evaluates a variable.
1362 (eval): stubbed for evaluating functions.
1364 * cs-parser.jay: Pass the defines information
1366 * driver.cs: Add --define command line option.
1368 * decl.cs: Move MemberCore here.
1370 Make it the base class for DeclSpace. This allows us to catch and
1371 report 108 and 109 for everything now.
1373 * class.cs (TypeContainer.Define): Extract all the members
1374 before populating and emit the warning 108 (new keyword required
1375 to override) instead of having each member implement this.
1377 (MemberCore.Define): New abstract method, we will be using this in
1378 the warning reporting engine in Populate.
1380 (Operator.Define): Adjust to new MemberCore protocol.
1382 * const.cs (Const): This does not derive from Expression, it is a
1383 temporary object we use to create fields, it is a MemberCore.
1385 * class.cs (Method.Define): Allow the entry point to be in a
1388 * driver.cs: Rewrite the argument handler to clean it up a bit.
1390 * rootcontext.cs: Made it just an auxiliary namespace feature by
1391 making everything static.
1393 * driver.cs: Adapt code to use RootContext type name instead of
1396 * delegate.cs: Remove RootContext argument.
1398 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
1401 * class.cs (Event.Define): The lookup can fail.
1403 * cs-tokenizer.cs: Begin implementation of pre-procesor.
1405 * expression.cs: Resolve the this instance before invoking the code.
1407 2001-12-17 Miguel de Icaza <miguel@ximian.com>
1409 * cs-parser.jay: Add a production in element_access that allows
1410 the thing to become a "type" reference. This way we can parse
1411 things like "(string [])" as a type.
1413 Note that this still does not handle the more complex rules of
1417 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
1419 * ecore.cs: (CopyNewMethods): new utility function used to
1420 assemble the list of methods from running FindMembers.
1422 (MemberLookup): Rework FindMembers so that
1424 2001-12-16 Miguel de Icaza <miguel@ximian.com>
1426 * class.cs (TypeContainer): Remove Delegates who fail to be
1429 * delegate.cs (Populate): Verify that we dont get null return
1430 values. TODO: Check for AsAccessible.
1432 * cs-parser.jay: Use basename to emit error 574 (destructor should
1433 have the same name as container class), not the full name.
1435 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
1436 possible representation.
1438 Also implements integer type suffixes U and L.
1440 2001-12-15 Miguel de Icaza <miguel@ximian.com>
1442 * expression.cs (ArrayCreation.DoResolve): We need to do the
1443 argument resolution *always*.
1445 * decl.cs: Make this hold the namespace. Hold the root context as
1447 (LookupType): Move here.
1449 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
1451 * location.cs (Row, Name): Fixed the code, it was always returning
1452 references to the first file.
1454 * interface.cs: Register properties defined through interfaces.
1456 * driver.cs: Add support for globbing on the command line
1458 * class.cs (Field): Make it derive from MemberCore as well.
1461 2001-12-15 Ravi Pratap <ravi@ximian.com>
1463 * class.cs (Event::Define): Check that the type of the event is a delegate
1464 type else flag error #66.
1466 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
1469 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
1470 values of EntryPoint, CharSet etc etc.
1472 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
1474 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
1475 be null and we should ignore this. I am not sure if this is really clean. Apparently,
1476 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
1477 which needs this to do its work.
1479 * ../errors/cs0066.cs : Add.
1481 2001-12-14 Miguel de Icaza <miguel@ximian.com>
1483 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
1486 * class.cs: (MethodSignature.MethodSignature): Removed hack that
1487 clears out the parameters field.
1488 (MemberSignatureCompare): Cleanup
1490 (MemberCore): New base class used to share code between MethodCore
1493 (RegisterRequiredImplementations) BindingFlags.Public requires
1494 either BindingFlags.Instace or Static. Use instance here.
1496 (Property): Refactored code to cope better with the full spec.
1498 * parameter.cs (GetParameterInfo): Return an empty array instead
1501 * class.cs (Property): Abstract or extern properties have no bodies.
1503 * parameter.cs (GetParameterInfo): return a zero-sized array.
1505 * class.cs (TypeContainer.MethodModifiersValid): Move all the
1506 method modifier validation to the typecontainer so we can reuse
1509 (MethodCore.ParameterTypes): return an empty sized array of types.
1511 (Property.Define): Test property modifier validity.
1513 Add tests for sealed/override too.
1515 (Method.Emit): abstract or extern methods have no bodies.
1517 2001-12-14 Ravi Pratap <ravi@ximian.com>
1519 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
1522 (Method::Define, ::Emit): Modify accordingly.
1524 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
1526 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
1528 * makefile: Pass in /unsafe.
1530 2001-12-13 Miguel de Icaza <miguel@ximian.com>
1532 * class.cs (MakeKey): Kill routine.
1534 * class.cs (TypeContainer.Define): Correctly define explicit
1535 method implementations (they require the full interface name plus
1538 * typemanager.cs: Deply the PtrHashtable here and stop using the
1539 lame keys. Things work so much better.
1541 This of course broke everyone who depended on `RegisterMethod' to
1542 do the `test for existance' test. This has to be done elsewhere.
1544 * support.cs (PtrHashtable): A hashtable that avoid comparing with
1545 the object stupid Equals method (because, that like fails all over
1546 the place). We still do not use it.
1548 * class.cs (TypeContainer.SetRequiredInterface,
1549 TypeContainer.RequireMethods): Killed these two routines and moved
1550 all the functionality to RegisterRequiredImplementations.
1552 (TypeContainer.RegisterRequiredImplementations): This routine now
1553 registers all the implementations required in an array for the
1554 interfaces and abstract methods. We use an array of structures
1555 which can be computed ahead of time to reduce memory usage and we
1556 also assume that lookups are cheap as most classes will not
1557 implement too many interfaces.
1559 We also avoid creating too many MethodSignatures.
1561 (TypeContainer.IsInterfaceMethod): Update and optionally does not
1562 clear the "pending" bit if we find that there are problems with
1565 (TypeContainer.VerifyPendingMethods): Update to report errors of
1566 methods that look like implementations but are not.
1568 (TypeContainer.Define): Add support for explicit interface method
1571 2001-12-12 Miguel de Icaza <miguel@ximian.com>
1573 * typemanager.cs: Keep track of the parameters here instead of
1574 being a feature of the TypeContainer.
1576 * class.cs: Drop the registration of parameters here, as
1577 InterfaceMethods are also interface declarations.
1579 * delegate.cs: Register methods with the TypeManager not only with
1580 the TypeContainer. This code was buggy.
1582 * interface.cs: Full registation here.
1584 2001-12-11 Miguel de Icaza <miguel@ximian.com>
1586 * expression.cs: Remove reducer for binary expressions, it can not
1589 * const.cs: Put here the code that used to go into constant.cs
1591 * constant.cs: Put here the code for constants, this is a new base
1594 * literal.cs: Make Literal derive from Constant.
1596 2001-12-09 Miguel de Icaza <miguel@ximian.com>
1598 * statement.cs (Return.Emit): Report error 157 if the user
1599 attempts to return from a finally block.
1601 (Return.Emit): Instead of emitting a return, jump to the end of
1604 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
1605 LocalBuilder to store the result of the function. ReturnLabel is
1606 the target where we jump.
1609 2001-12-09 Radek Doulik <rodo@ximian.com>
1611 * cs-parser.jay: remember alias in current namespace
1613 * ecore.cs (SimpleName::DoResolve): use aliases for types or
1616 * class.cs (LookupAlias): lookup alias in my_namespace
1618 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
1620 (LookupAlias): lookup alias in this and if needed in parent
1623 2001-12-08 Miguel de Icaza <miguel@ximian.com>
1627 * rootcontext.cs: (ModuleBuilder) Made static, first step into
1628 making things static. I need this to avoid passing the
1629 TypeContainer when calling ParameterType.
1631 * support.cs (InternalParameters.ParameterType): Remove ugly hack
1632 that did string manipulation to compute the type and then call
1633 GetType. Use Parameter.ParameterType instead.
1635 * cs-tokenizer.cs: Consume the suffix for floating values.
1637 * expression.cs (ParameterReference): figure out whether this is a
1638 reference parameter or not. Kill an extra variable by computing
1639 the arg_idx during emission.
1641 * parameter.cs (Parameters.GetParameterInfo): New overloaded
1642 function that returns whether a parameter is an out/ref value or not.
1644 (Parameter.ParameterType): The type of the parameter (base,
1645 without ref/out applied).
1647 (Parameter.Resolve): Perform resolution here.
1648 (Parameter.ExternalType): The full type (with ref/out applied).
1650 * statement.cs (Using.Emit, Using.EmitExpression): Implement
1651 support for expressions on the using statement.
1653 2001-12-07 Miguel de Icaza <miguel@ximian.com>
1655 * statement.cs (Using.EmitLocalVariableDecls): Split the
1656 localvariable handling of the using statement.
1658 (Block.EmitMeta): Keep track of variable count across blocks. We
1659 were reusing slots on separate branches of blocks.
1661 (Try.Emit): Emit the general code block, we were not emitting it.
1663 Check the type of the declaration to be an IDisposable or
1664 something that can be implicity converted to it.
1666 Emit conversions if required.
1668 * ecore.cs (EmptyExpression): New utility class.
1669 (Expression.ImplicitConversionExists): New utility function.
1671 2001-12-06 Miguel de Icaza <miguel@ximian.com>
1673 * statement.cs (Using): Implement.
1675 * expression.cs (LocalVariableReference): Support read only variables.
1677 * statement.cs: Remove the explicit emit for the Leave opcode.
1678 (VariableInfo): Add a readonly field.
1680 2001-12-05 Miguel de Icaza <miguel@ximian.com>
1682 * ecore.cs (ConvCast): new class used to encapsulate the various
1683 explicit integer conversions that works in both checked and
1686 (Expression.ConvertNumericExplicit): Use new ConvCast class to
1687 properly generate the overflow opcodes.
1689 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1691 * statement.cs: The correct type for the EmptyExpression is the
1692 element_type, not the variable type. Ravi pointed this out.
1694 2001-12-04 Ravi Pratap <ravi@ximian.com>
1696 * class.cs (Method::Define): Handle PInvoke methods specially
1697 by using DefinePInvokeMethod instead of the usual one.
1699 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
1700 above to do the task of extracting information and defining the method.
1702 2001-12-04 Ravi Pratap <ravi@ximian.com>
1704 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
1705 of the condition for string type.
1707 (Emit): Move that here.
1709 (ArrayCreation::CheckIndices): Keep string literals in their expression
1712 (EmitDynamicInitializers): Handle strings appropriately.
1714 2001-12-04 Miguel de Icaza <miguel@ximian.com>
1716 * codegen.cs (EmitContext): Replace multiple variables with a
1717 single pointer to the current Switch statement.
1719 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
1722 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1726 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
1729 (Foreach.Emit): Foreach on arrays was not setting
1730 up the loop variables (for break/continue).
1732 (GotoCase): Semi-implented.
1734 2001-12-03 Ravi Pratap <ravi@ximian.com>
1736 * attribute.cs (CheckAttribute): Handle system attributes by using
1737 Attribute.GetAttributes to examine information we need.
1739 (GetValidPlaces): Same here.
1741 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
1743 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
1745 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
1747 (Method::Define): Set appropriate flags if we have a DllImport attribute.
1749 (Method::Emit): Handle the case when we are a PInvoke method.
1751 2001-12-03 Miguel de Icaza <miguel@ximian.com>
1753 * expression.cs: Use ResolveWithSimpleName on compound names.
1755 2001-12-02 Ravi Pratap <ravi@ximian.com>
1757 * constant.cs (EmitConstant): Make sure we resolve the associated expression
1758 before trying to reduce it.
1760 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
1762 * constant.cs (LookupConstantValue): Implement.
1764 (EmitConstant): Use the above in emitting the constant.
1766 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
1767 that are user-defined by doing a LookupConstantValue on them.
1769 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
1772 2001-11-29 Miguel de Icaza <miguel@ximian.com>
1774 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
1776 (BaseAccess.DoResolve): Implement.
1778 (MemberAccess.DoResolve): Split this routine into a
1779 ResolveMemberAccess routine that can be used independently
1781 2001-11-28 Miguel de Icaza <miguel@ximian.com>
1783 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
1784 As that share bits of the implementation. Is returns a boolean,
1785 while As returns the Type that is being probed.
1787 2001-12-01 Ravi Pratap <ravi@ximian.com>
1789 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
1790 instead of a Literal - much easier.
1792 (EnumInTransit): Remove - utterly useless :-)
1794 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
1796 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
1798 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
1799 chain when we have no associated expression.
1801 2001-11-30 Ravi Pratap <ravi@ximian.com>
1803 * constant.cs (Define): Use Location while reporting the errror.
1805 Also emit a warning when 'new' is used and there is no inherited
1808 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
1811 (LookupEnumValue): Implement to lookup an enum member's value and define it
1814 (Populate): Re-write accordingly to use the above routine.
1816 2001-11-27 Miguel de Icaza <miguel@ximian.com>
1818 * expression.cs (This): Fix prototype for DoResolveLValue to
1819 override the base class DoResolveLValue.
1821 * cs-parser.cs: Report errors cs574 and cs575 (destructor
1824 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
1825 (we need to load the address of the field here). This fixes
1828 (FieldExpr.DoResolveLValue): Call the DoResolve
1829 function to initialize the Instance expression.
1831 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
1832 correctly the GetEnumerator operation on a value type.
1834 * cs-parser.jay: Add more simple parsing error catches.
1836 * statement.cs (Switch): Add support for string switches.
1837 Handle null specially.
1839 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
1841 2001-11-28 Ravi Pratap <ravi@ximian.com>
1843 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
1845 (declare_local_constant): New helper function.
1847 * statement.cs (AddConstant): Keep a separate record of constants
1849 (IsConstant): Implement to determine if a variable is a constant.
1851 (GetConstantExpression): Implement.
1853 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
1855 * statement.cs (IsVariableDefined): Re-write.
1857 2001-11-27 Ravi Pratap <ravi@ximian.com>
1859 * class.cs (TypeContainer::FindMembers): Look for constants
1860 in the case when we are looking for MemberTypes.Field
1862 * expression.cs (MemberAccess::DoResolve): Check that in the
1863 case we are a FieldExpr and a Literal, we are not being accessed
1864 by an instance reference.
1866 * cs-parser.jay (local_constant_declaration): Implement.
1868 (declaration_statement): Implement for constant declarations.
1870 2001-11-26 Miguel de Icaza <miguel@ximian.com>
1872 * statement.cs (Switch): Catch double defaults.
1874 (Switch): More work on the switch() statement
1875 implementation. It works for integral values now, need to finish
1879 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1881 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
1882 integer literals into other integer literals. To be used by
1885 2001-11-24 Ravi Pratap <ravi@ximian.com>
1887 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
1890 (EmitDynamicInitializers): Cope with the above since we extract data
1891 directly from ArrayData now.
1893 (ExpectInitializers): Keep track of whether initializers are mandatory
1896 (Bounds): Make it a hashtable to prevent the same dimension being
1897 recorded for every element in that dimension.
1899 (EmitDynamicInitializers): Fix bug which prevented the Set array method
1902 Also fix bug which was causing the indices to be emitted in the reverse
1905 2001-11-24 Miguel de Icaza <miguel@ximian.com>
1907 * expression.cs (ArrayCreation): Implement the bits that Ravi left
1908 unfinished. They do not work, because the underlying code is
1911 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1913 * cs-parser.jay: Remove bogus fixme.
1915 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
1916 on Switch statement.
1918 2001-11-23 Ravi Pratap <ravi@ximian.com>
1920 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
1923 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
1924 parameter. Apparently, any expression is allowed.
1926 (ValidateInitializers): Update accordingly.
1928 (CheckIndices): Fix some tricky bugs thanks to recursion.
1930 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
1931 I was being completely brain-dead.
1933 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
1934 and re-write acordingly.
1936 (DelegateInvocation): Re-write accordingly.
1938 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
1940 (MakeByteBlob): Handle types more correctly.
1942 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
1943 initialization from expressions but it is incomplete because I am a complete
1946 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1948 * statement.cs (If.Emit): Fix a bug that generated incorrect code
1949 on If. Basically, we have to return `true' (ie, we do return to
1950 our caller) only if both branches of the if return.
1952 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
1953 short-circuit operators, handle them as short circuit operators.
1955 (Cast.DoResolve): Resolve type.
1956 (Cast.Cast): Take an expression as the target type.
1958 * cs-parser.jay (cast_expression): Remove old hack that only
1959 allowed a limited set of types to be handled. Now we take a
1960 unary_expression and we resolve to a type during semantic
1963 Use the grammar productions from Rhys to handle casts (this is
1964 not complete like Rhys syntax yet, we fail to handle that corner
1965 case that C# has regarding (-x), but we will get there.
1967 2001-11-22 Ravi Pratap <ravi@ximian.com>
1969 * class.cs (EmitFieldInitializer): Take care of the case when we have a
1970 field which is an array type.
1972 * cs-parser.jay (declare_local_variables): Support array initialization too.
1974 * typemanager.cs (MakeKey): Implement.
1976 (everywhere): Use the above appropriately.
1978 * cs-parser.jay (for_statement): Update for array initialization while
1979 declaring variables.
1981 * ecore.cs : The error message was correct, it's the variable's names that
1982 were misleading ;-) Make the code more readable.
1984 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
1985 the correct type etc.
1987 (ConvertExplicit): Handle Enum types by examining the underlying type.
1989 2001-11-21 Ravi Pratap <ravi@ximian.com>
1991 * parameter.cs (GetCallingConvention): Always return
1992 CallingConventions.Standard for now.
1994 2001-11-22 Miguel de Icaza <miguel@ximian.com>
1996 * expression.cs (Binary.ResolveOperator): Update the values of `l'
1997 and `r' after calling DoNumericPromotions.
1999 * ecore.cs: Fix error message (the types were in the wrong order).
2001 * statement.cs (Foreach.ProbeCollectionType): Need to pass
2002 BindingFlags.Instance as well
2004 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
2005 implicit int literal conversion in an empty cast so that we
2006 propagate the right type upstream.
2008 (UnboxCast): new class used to unbox value types.
2009 (Expression.ConvertExplicit): Add explicit type conversions done
2012 (Expression.ImplicitNumericConversion): Oops, forgot to test for
2013 the target type before applying the implicit LongLiterals to ULong
2016 2001-11-21 Miguel de Icaza <miguel@ximian.com>
2018 * cs-parser.jay (for_statement): Reworked the way For works: now
2019 we declare manually any variables that are introduced in
2020 for_initializer to solve the problem of having out-of-band code
2021 emition (that is what got for broken).
2023 (declaration_statement): Perform the actual variable declaration
2024 that used to be done in local_variable_declaration here.
2026 (local_variable_declaration): Do not declare anything, just pass
2027 the information on a DictionaryEntry
2029 2001-11-20 Ravi Pratap <ravi@ximian.com>
2031 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
2032 re-write of the logic to now make it recursive.
2034 (UpdateIndices): Re-write accordingly.
2036 Store element data in a separate ArrayData list in the above methods.
2038 (MakeByteBlob): Implement to dump the array data into a byte array.
2040 2001-11-19 Ravi Pratap <ravi@ximian.com>
2042 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
2045 * constant.cs (Define): Implement.
2047 (EmitConstant): Re-write fully.
2049 Pass in location info.
2051 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
2054 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
2055 DictionaryEntry since we need location info too.
2057 (constant_declaration): Update accordingly.
2059 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
2060 code into another method : UpdateIndices.
2062 2001-11-18 Ravi Pratap <ravi@ximian.com>
2064 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
2065 some type checking etc.
2067 2001-11-17 Ravi Pratap <ravi@ximian.com>
2069 * expression.cs (ArrayCreation::ValidateInitializers): Implement
2070 bits to provide dimension info if the user skips doing that.
2072 Update second constructor to store the rank correctly.
2074 2001-11-16 Ravi Pratap <ravi@ximian.com>
2076 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
2077 and try to implement.
2079 * ../errors/cs0150.cs : Add.
2081 * ../errors/cs0178.cs : Add.
2083 2001-11-16 Miguel de Icaza <miguel@ximian.com>
2085 * statement.cs: Implement foreach on multi-dimensional arrays.
2087 * parameter.cs (Parameters.GetParameterByName): Also lookup the
2088 name of the params argument.
2090 * expression.cs: Use EmitStoreOpcode to get the right opcode while
2091 initializing the array.
2093 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
2094 we can use this elsewhere.
2096 * statement.cs: Finish implementation of foreach for single
2099 * cs-parser.jay: Use an out-of-band stack to pass information
2100 around, I wonder why I need this.
2102 foreach_block: Make the new foreach_block the current_block.
2104 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
2105 function used to return a static Parameters structure. Used for
2106 empty parameters, as those are created very frequently.
2108 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
2110 2001-11-15 Ravi Pratap <ravi@ximian.com>
2112 * interface.cs : Default modifier is private, not public. The
2113 make verify test passes again.
2115 2001-11-15 Ravi Pratap <ravi@ximian.com>
2117 * support.cs (ReflectionParameters): Fix logic to determine
2118 whether the last parameter is a params one. Test 9 passes again.
2120 * delegate.cs (Populate): Register the builders we define with
2121 RegisterParameterForBuilder. Test 19 passes again.
2123 * cs-parser.jay (property_declaration): Reference $6 instead
2124 of $$ to get at the location.
2126 (indexer_declaration): Similar stuff.
2130 * class.cs (Property): Register parameters for the Get and Set methods
2131 if they exist. Test 23 passes again.
2133 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
2134 call to EmitArguments as we are sure there aren't any params arguments.
2135 Test 32 passes again.
2137 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
2138 IndexOutOfRangeException.
2140 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
2141 Test 33 now passes again.
2143 2001-11-15 Miguel de Icaza <miguel@ximian.com>
2145 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
2146 broke a bunch of things. Will have to come up with a better way
2147 of tracking locations.
2149 * statement.cs: Implemented foreach for single dimension arrays.
2151 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2153 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
2154 an error. This removes the lookup from the critical path.
2156 * cs-parser.jay: Removed use of temporary_loc, which is completely
2159 2001-11-14 Miguel de Icaza <miguel@ximian.com>
2161 * support.cs (ReflectionParameters.ParameterModifier): Report
2162 whether the argument is a PARAMS argument or not.
2164 * class.cs: Set the attribute `ParamArrayAttribute' on the
2167 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
2168 and cons_param_array_attribute (ConstructorInfo for
2169 ParamArrayAttribute).,
2171 * codegen.cs: Emit the return using the `Return' statement, that
2172 way we can report the error correctly for missing return values.
2174 * class.cs (Method.Emit): Clean up.
2176 * expression.cs (Argument.Resolve): Take another argument: the
2177 location where this argument is used. Notice that this is not
2178 part of the "Argument" class as to reduce the size of the
2179 structure (we know the approximate location anyways).
2181 Test if the argument is a variable-reference, if not, then
2182 complain with a 206.
2184 (Argument.Emit): Emit addresses of variables.
2186 (Argument.FullDesc): Simplify.
2188 (Invocation.DoResolve): Update for Argument.Resolve.
2190 (ElementAccess.DoResolve): ditto.
2192 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
2193 method should be virtual, as this method is always virtual.
2195 (NewDelegate.DoResolve): Update for Argument.Resolve.
2197 * class.cs (ConstructorInitializer.DoResolve): ditto.
2199 * attribute.cs (Attribute.Resolve): ditto.
2201 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2203 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
2205 * expression.cs (ParameterReference): Drop IStackStorage and implement
2206 IAssignMethod instead.
2208 (LocalVariableReference): ditto.
2210 * ecore.cs (FieldExpr): Drop IStackStorage and implement
2211 IAssignMethod instead.
2213 2001-11-13 Miguel de Icaza <miguel@ximian.com>
2215 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
2216 enumerations that are used in heavily used structures derive from
2217 byte in a laughable and pathetic attempt to reduce memory usage.
2218 This is the kind of pre-optimzations that you should not do at
2219 home without adult supervision.
2221 * expression.cs (UnaryMutator): New class, used to handle ++ and
2222 -- separatedly from the other unary operators. Cleans up the
2223 code, and kills the ExpressionStatement dependency in Unary.
2225 (Unary): Removed `method' and `Arguments' from this class, making
2226 it smaller, and moving it all to SimpleCall, so I can reuse this
2227 code in other locations and avoid creating a lot of transient data
2228 strucutres when not required.
2230 * cs-parser.jay: Adjust for new changes.
2232 2001-11-11 Miguel de Icaza <miguel@ximian.com>
2234 * enum.cs (Enum.Populate): If there is a failure during
2237 * cs-parser.jay (opt_enum_base): we used to catch type errors
2238 here, but this is really incorrect. The type error should be
2239 catched during semantic analysis.
2241 2001-12-11 Ravi Pratap <ravi@ximian.com>
2243 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
2244 current_local_parameters as expected since I, in my stupidity, had forgotten
2247 * attribute.cs (GetValidPlaces): Fix stupid bug.
2249 * class.cs (Method::Emit): Perform check on applicability of attributes.
2251 (Constructor::Emit): Ditto.
2253 (Field::Emit): Ditto.
2255 (Field.Location): Store location information.
2257 (Property, Event, Indexer, Operator): Ditto.
2259 * cs-parser.jay (field_declaration): Pass in location for each field.
2261 * ../errors/cs0592.cs : Add.
2263 2001-11-12 Ravi Pratap <ravi@ximian.com>
2265 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
2267 (InitCoreTypes): Update accordingly.
2269 (RegisterAttrType, LookupAttr): Implement.
2271 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
2272 info about the same.
2274 (Resolve): Update to populate the above as necessary.
2278 (GetValidPlaces): Helper to the above.
2280 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
2282 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
2284 2001-11-12 Ravi Pratap <ravi@ximian.com>
2286 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
2288 * ../errors/cs0617.cs : Add.
2290 2001-11-11 Ravi Pratap <ravi@ximian.com>
2292 * enum.cs (Emit): Rename to Populate to be more consistent with what
2293 we expect it to do and when exactly it is called.
2295 * class.cs, rootcontext.cs : Update accordingly.
2297 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
2298 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
2300 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
2302 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
2303 of a fieldinfo using the above, when dealing with a FieldBuilder.
2305 2001-11-10 Ravi Pratap <ravi@ximian.com>
2307 * ../errors/cs0031.cs : Add.
2309 * ../errors/cs1008.cs : Add.
2311 * ../errrors/cs0543.cs : Add.
2313 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
2316 (FindMembers): Implement.
2318 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
2319 enums and delegates too.
2321 (enum_types): Rename to builder_to_enum.
2323 (delegate_types): Rename to builder_to_delegate.
2325 * delegate.cs (FindMembers): Implement.
2327 2001-11-09 Ravi Pratap <ravi@ximian.com>
2329 * typemanager.cs (IsEnumType): Implement.
2331 * enum.cs (Emit): Re-write parts to account for the underlying type
2332 better and perform checking etc.
2334 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
2335 of the underlying type.
2337 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
2340 * enum.cs (error31): Helper to report error #31.
2342 * cs-parser.jay (enum_declaration): Store location of each member too.
2344 * enum.cs (member_to_location): New hashtable.
2346 (AddEnumMember): Update location hashtable.
2348 (Emit): Use the location of each member while reporting errors.
2350 2001-11-09 Miguel de Icaza <miguel@ximian.com>
2352 * cs-parser.jay: A for_initializer if is a
2353 local_variable_declaration really ammount to have an implicit
2354 block with the variable declaration and no initializer for for.
2356 * statement.cs (For.Emit): Cope with null initializers.
2358 This fixes the infinite loop on for initializers.
2360 2001-11-08 Miguel de Icaza <miguel@ximian.com>
2362 * enum.cs: More cleanup.
2364 * ecore.cs: Remove dead code.
2366 * class.cs (Property.Emit): More simplification.
2367 (Event.Emit): ditto.
2369 Reworked to have less levels of indentation.
2371 2001-11-08 Ravi Pratap <ravi@ximian.com>
2373 * class.cs (Property): Emit attributes.
2383 * enum.cs (Emit): Ditto.
2385 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
2388 * class.cs (Field, Event, etc.): Move attribute generation into the
2389 Emit method everywhere.
2391 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
2392 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
2393 as we had no way of defining nested enums !
2395 * rootcontext.cs : Adjust code accordingly.
2397 * typemanager.cs (AddEnumType): To keep track of enum types separately.
2399 2001-11-07 Ravi Pratap <ravi@ximian.com>
2401 * expression.cs (EvalConstantExpression): Move into ecore.cs
2403 * enum.cs (Enum): Rename some members and make them public and readonly
2404 according to our convention.
2406 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
2409 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
2411 (Enum::Emit): Write a simple version for now which doesn't try to compute
2412 expressions. I shall modify this to be more robust in just a while.
2414 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
2416 (TypeContainer::CloseType): Create the Enum types too.
2418 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
2420 * expression.cs (EvalConstantExpression): Get rid of completely.
2422 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
2423 user-defined values and other cases.
2425 (IsValidEnumLiteral): Helper function.
2427 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
2428 out there in the case we had a literal FieldExpr.
2430 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
2432 (Literalize): Revamp a bit to take two arguments.
2434 (EnumLiteral): New class which derives from Literal to wrap enum literals.
2436 2001-11-06 Ravi Pratap <ravi@ximian.com>
2438 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
2440 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
2442 (Resolve): Use the above to ensure we have proper initializers.
2444 2001-11-05 Ravi Pratap <ravi@ximian.com>
2446 * expression.cs (Expression::EvalConstantExpression): New method to
2447 evaluate constant expressions.
2449 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
2451 2001-11-07 Miguel de Icaza <miguel@ximian.com>
2453 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
2456 (Binary.ResolveOperator): Handle operator != (object a, object b)
2457 and operator == (object a, object b);
2459 (Binary.DoNumericPromotions): Indicate whether the numeric
2460 promotion was possible.
2462 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
2465 Made the ArrayAccess implement interface IAssignMethod instead of
2466 IStackStore as the order in which arguments are passed reflects
2469 * assign.cs: Instead of using expr.ExprClass to select the way of
2470 assinging, probe for the IStackStore/IAssignMethod interfaces.
2472 * typemanager.cs: Load InitializeArray definition.
2474 * rootcontext.cs (RootContext.MakeStaticData): Used to define
2475 static data that can be used to initialize arrays.
2477 2001-11-05 Miguel de Icaza <miguel@ximian.com>
2479 * expression.cs: Handle operator== and operator!= for booleans.
2481 (Conditioal.Reduce): Implement reducer for the ?: operator.
2483 (Conditional.Resolve): Implement dead code elimination.
2485 (Binary.Resolve): Catch string literals and return a new
2486 concatenated string.
2488 (Unary.Reduce): Implement reduction of unary expressions.
2490 * ecore.cs: Split out the expression core handling here.
2492 (Expression.Reduce): New method used to perform constant folding
2493 and CSE. This is needed to support constant-expressions.
2495 * statement.cs (Statement.EmitBoolExpression): Pass true and false
2496 targets, and optimize for !x.
2498 2001-11-04 Ravi Pratap <ravi@ximian.com>
2500 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
2501 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
2502 set custom atttributes.
2504 * literal.cs (Literal::GetValue): New abstract method to return the actual
2505 value of the literal, cast as an object.
2507 (*Literal): Implement GetValue method.
2509 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
2510 expressions to the arraylist but objects of type Argument.
2512 * class.cs (TypeContainer::Emit): Emit our attributes too.
2514 (Method::Emit, Constructor::Emit): Ditto.
2516 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
2517 to be ignoring earlier.
2519 2001-11-03 Ravi Pratap <ravi@ximian.com>
2521 * attribute.cs (AttributeSection::Define): Implement to do the business
2522 of constructing a CustomAttributeBuilder.
2524 (Attribute): New trivial class. Increases readability of code.
2526 * cs-parser.jay : Update accordingly.
2528 (positional_argument_list, named_argument_list, named_argument): New rules
2530 (attribute_arguments): Use the above so that we are more correct.
2532 2001-11-02 Ravi Pratap <ravi@ximian.com>
2534 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
2535 to perform all checks for a method with a params parameter.
2537 (Invocation::OverloadResolve): Update to use the above method and therefore
2538 cope correctly with params method invocations.
2540 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
2543 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
2544 constructors in our parent too because we can't afford to miss out on
2547 * attribute.cs (AttributeSection): New name for the class Attribute
2549 Other trivial changes to improve readability.
2551 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
2552 use the new class names.
2554 2001-11-01 Ravi Pratap <ravi@ximian.com>
2556 * class.cs (Method::Define): Complete definition for params types too
2558 (Indexer::Define): Ditto.
2560 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
2561 Cope everywhere with a request for info about the array parameter.
2563 2001-11-01 Ravi Pratap <ravi@ximian.com>
2565 * tree.cs (RecordNamespace): Fix up to check for the correct key.
2567 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
2568 local_variable_type to extract the string corresponding to the type.
2570 (local_variable_type): Fixup the action to use the new helper method.
2572 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
2575 * expression.cs : Clean out code which uses the above.
2577 2001-10-31 Ravi Pratap <ravi@ximian.com>
2579 * typemanager.cs (RegisterMethod): Check if we already have an existing key
2580 and bale out if necessary by returning a false.
2582 (RegisterProperty): Ditto.
2584 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
2585 and print out appropriate error messages.
2587 * interface.cs (everywhere): Ditto.
2589 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
2590 location to constructor.
2592 * class.cs (Property, Event, Indexer): Update accordingly.
2594 * ../errors/cs111.cs : Added.
2596 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
2597 of a method, as laid down by the spec.
2599 (Invocation::OverloadResolve): Use the above method.
2601 2001-10-31 Ravi Pratap <ravi@ximian.com>
2603 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
2604 now take a TypeContainer and a Parameters object.
2606 (ParameterData): Modify return type of ParameterModifier method to be
2607 Parameter.Modifier and not a string.
2609 (ReflectionParameters, InternalParameters): Update accordingly.
2611 * expression.cs (Argument::GetParameterModifier): Same here.
2613 * support.cs (InternalParameters::ParameterType): Find a better way of determining
2614 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
2615 symbol in it at all so maybe this is only for now.
2617 2001-10-30 Ravi Pratap <ravi@ximian.com>
2619 * support.cs (InternalParameters): Constructor now takes an extra argument
2620 which is the actual Parameters class.
2622 (ParameterDesc): Update to provide info on ref/out modifiers.
2624 * class.cs (everywhere): Update call to InternalParameters to pass in
2625 the second argument too.
2627 * support.cs (ParameterData): Add ParameterModifier, which is a method
2628 to return the modifier info [ref/out etc]
2630 (InternalParameters, ReflectionParameters): Implement the above.
2632 * expression.cs (Argument::ParameterModifier): Similar function to return
2633 info about the argument's modifiers.
2635 (Invocation::OverloadResolve): Update to take into account matching modifiers
2638 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
2639 a new SetFormalParameters object which we pass to InternalParameters.
2641 2001-10-30 Ravi Pratap <ravi@ximian.com>
2643 * expression.cs (NewArray): Merge into the ArrayCreation class.
2645 2001-10-29 Ravi Pratap <ravi@ximian.com>
2647 * expression.cs (NewArray): Merge classes NewBuiltinArray and
2648 NewUserdefinedArray into one as there wasn't much of a use in having
2651 * expression.cs (Argument): Change field's name to ArgType from Type.
2653 (Type): New readonly property which returns the proper type, taking into
2654 account ref/out modifiers.
2656 (everywhere): Adjust code accordingly for the above.
2658 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
2659 whether we are emitting for a ref or out parameter.
2661 * expression.cs (Argument::Emit): Use the above field to set the state.
2663 (LocalVariableReference::Emit): Update to honour the flag and emit the
2666 * parameter.cs (Attributes): Set the correct flags for ref parameters.
2668 * expression.cs (Argument::FullDesc): New function to provide a full desc.
2670 * support.cs (ParameterData): Add method ParameterDesc to the interface.
2672 (ReflectionParameters, InternalParameters): Implement the above method.
2674 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
2677 (Invocation::FullMethodDesc): Ditto.
2679 2001-10-29 Miguel de Icaza <miguel@ximian.com>
2681 * cs-parser.jay: Add extra production for the second form of array
2684 * expression.cs (ArrayCreation): Update to reflect the above
2687 * Small changes to prepare for Array initialization.
2689 2001-10-28 Miguel de Icaza <miguel@ximian.com>
2691 * typemanager.cs (ImplementsInterface): interface might be null;
2692 Deal with this problem;
2694 Also, we do store negative hits on the cache (null values), so use
2695 this instead of calling t.GetInterfaces on the type everytime.
2697 2001-10-28 Ravi Pratap <ravi@ximian.com>
2699 * typemanager.cs (IsBuiltinType): New method to help determine the same.
2701 * expression.cs (New::DoResolve): Get rid of array creation code and instead
2702 split functionality out into different classes.
2704 (New::FormArrayType): Move into NewBuiltinArray.
2706 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
2709 (NewBuiltinArray): New class to handle creation of built-in arrays.
2711 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
2712 account creation of one-dimensional arrays.
2714 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
2716 (NewUserdefinedArray::DoResolve): Implement.
2718 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
2720 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
2721 we maintain inside the TypeManager. This is necessary to perform lookups on the
2724 (LookupType): Update to perform GetType on the module builders too.
2726 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
2728 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
2730 2001-10-23 Ravi Pratap <ravi@ximian.com>
2732 * expression.cs (New::DoResolve): Implement guts of array creation.
2734 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
2736 2001-10-27 Miguel de Icaza <miguel@ximian.com>
2738 * expression.cs: Fix bug I introduced lsat night that broke
2741 (Expression.Resolve): Report a 246 error (can not resolve name)
2742 if we find a SimpleName in the stream.
2744 (Expression.ResolveLValue): Ditto.
2746 (Expression.ResolveWithSimpleName): This function is a variant of
2747 ResolveName, this one allows SimpleNames to be returned without a
2748 warning. The only consumer of SimpleNames is MemberAccess
2750 2001-10-26 Miguel de Icaza <miguel@ximian.com>
2752 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
2753 might arrive here. I have my doubts that this is correct.
2755 * statement.cs (Lock): Implement lock statement.
2757 * cs-parser.jay: Small fixes to support `lock' and `using'
2759 * cs-tokenizer.cs: Remove extra space
2761 * driver.cs: New flag --checked, allows to turn on integer math
2764 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
2765 Threading.Monitor.Exit
2767 2001-10-23 Miguel de Icaza <miguel@ximian.com>
2769 * expression.cs (IndexerAccess::DoResolveLValue): Set the
2770 Expression Class to be IndexerAccess.
2772 Notice that Indexer::DoResolve sets the eclass to Value.
2774 2001-10-22 Miguel de Icaza <miguel@ximian.com>
2776 * class.cs (TypeContainer::Emit): Emit code for indexers.
2778 * assign.cs (IAssignMethod): New interface implemented by Indexers
2779 and Properties for handling assignment.
2781 (Assign::Emit): Simplify and reuse code.
2783 * expression.cs (IndexerAccess, PropertyExpr): Implement
2784 IAssignMethod, clean up old code.
2786 2001-10-22 Ravi Pratap <ravi@ximian.com>
2788 * typemanager.cs (ImplementsInterface): New method to determine if a type
2789 implements a given interface. Provides a nice cache too.
2791 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
2794 (ConvertReferenceExplicit): Ditto.
2796 * delegate.cs (Delegate::Populate): Update to define the parameters on the
2797 various methods, with correct names etc.
2799 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
2800 Operator.UnaryNegation.
2802 * cs-parser.jay (operator_declarator): Be a little clever in the case where
2803 we have a unary plus or minus operator.
2805 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
2808 * everywhere : update accordingly.
2810 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
2813 * class.cs (Method::Define): For the case where we are implementing a method
2814 inherited from an interface, we need to set the MethodAttributes.Final flag too.
2815 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
2817 2001-10-21 Ravi Pratap <ravi@ximian.com>
2819 * interface.cs (FindMembers): Implement to work around S.R.E
2822 * typemanager.cs (IsInterfaceType): Implement.
2824 (FindMembers): Update to handle interface types too.
2826 * expression.cs (ImplicitReferenceConversion): Re-write bits which
2827 use IsAssignableFrom as that is not correct - it doesn't work.
2829 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
2830 and accordingly override EmitStatement.
2832 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
2833 using the correct logic :-)
2835 2001-10-19 Ravi Pratap <ravi@ximian.com>
2837 * ../errors/cs-11.cs : Add to demonstrate error -11
2839 2001-10-17 Miguel de Icaza <miguel@ximian.com>
2841 * assign.cs (Assign::Resolve): Resolve right hand side first, and
2842 then pass this as a hint to ResolveLValue.
2844 * expression.cs (FieldExpr): Add Location information
2846 (FieldExpr::LValueResolve): Report assignment to readonly
2849 (Expression::ExprClassFromMemberInfo): Pass location information.
2851 (Expression::ResolveLValue): Add new method that resolves an
2854 (Expression::DoResolveLValue): Default invocation calls
2857 (Indexers): New class used to keep track of indexers in a given
2860 (IStackStore): Renamed from LValue, as it did not really describe
2861 what this did. Also ResolveLValue is gone from this interface and
2862 now is part of Expression.
2864 (ElementAccess): Depending on the element access type
2866 * typemanager.cs: Add `indexer_name_type' as a Core type
2867 (System.Runtime.CompilerServices.IndexerNameAttribute)
2869 * statement.cs (Goto): Take a location.
2871 2001-10-18 Ravi Pratap <ravi@ximian.com>
2873 * delegate.cs (Delegate::VerifyDelegate): New method to verify
2874 if two delegates are compatible.
2876 (NewDelegate::DoResolve): Update to take care of the case when
2877 we instantiate a delegate from another delegate.
2879 * typemanager.cs (FindMembers): Don't even try to look up members
2880 of Delegate types for now.
2882 2001-10-18 Ravi Pratap <ravi@ximian.com>
2884 * delegate.cs (NewDelegate): New class to take care of delegate
2887 * expression.cs (New): Split the delegate related code out into
2888 the NewDelegate class.
2890 * delegate.cs (DelegateInvocation): New class to handle delegate
2893 * expression.cs (Invocation): Split out delegate related code into
2894 the DelegateInvocation class.
2896 2001-10-17 Ravi Pratap <ravi@ximian.com>
2898 * expression.cs (New::DoResolve): Implement delegate creation fully
2899 and according to the spec.
2901 (New::DoEmit): Update to handle delegates differently.
2903 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
2904 because of which we were printing out arguments in reverse order !
2906 * delegate.cs (VerifyMethod): Implement to check if the given method
2907 matches the delegate.
2909 (FullDelegateDesc): Implement.
2911 (VerifyApplicability): Implement.
2913 * expression.cs (Invocation::DoResolve): Update to accordingly handle
2914 delegate invocations too.
2916 (Invocation::Emit): Ditto.
2918 * ../errors/cs1593.cs : Added.
2920 * ../errors/cs1594.cs : Added.
2922 * delegate.cs (InstanceExpression, TargetMethod): New properties.
2924 2001-10-16 Ravi Pratap <ravi@ximian.com>
2926 * typemanager.cs (intptr_type): Core type for System.IntPtr
2928 (InitCoreTypes): Update for the same.
2930 (iasyncresult_type, asynccallback_type): Ditto.
2932 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
2935 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
2938 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
2939 the builders for the 4 members of a delegate type :-)
2941 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
2944 * expression.cs (New::DoResolve): Implement guts for delegate creation.
2946 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
2948 2001-10-15 Miguel de Icaza <miguel@ximian.com>
2950 * statement.cs (Break::Emit): Implement.
2951 (Continue::Emit): Implement.
2953 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
2954 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
2955 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
2956 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
2959 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
2960 properties that track the label for the current loop (begin of the
2961 loop and end of the loop).
2963 2001-10-15 Ravi Pratap <ravi@ximian.com>
2965 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
2966 use of emitting anything at all.
2968 * class.cs, rootcontext.cs : Get rid of calls to the same.
2970 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
2972 (Populate): Define the constructor correctly and set the implementation
2975 * typemanager.cs (delegate_types): New hashtable to hold delegates that
2978 (AddDelegateType): Implement.
2980 (IsDelegateType): Implement helper method.
2982 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
2984 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
2985 and accordingly handle it.
2987 * delegate.cs (Populate): Take TypeContainer argument.
2988 Implement bits to define the Invoke method. However, I still haven't figured out
2989 how to take care of the native int bit :-(
2991 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
2992 Qualify the name of the delegate, not its return type !
2994 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
2997 (StandardConversionExists): Checking for array types turns out to be recursive.
2999 (ConvertReferenceExplicit): Implement array conversion.
3001 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
3003 2001-10-12 Ravi Pratap <ravi@ximian.com>
3005 * cs-parser.jay (delegate_declaration): Store the fully qualified
3006 name as it is a type declaration.
3008 * delegate.cs (ReturnType, Name): Rename members to these. Make them
3011 (DefineDelegate): Renamed from Define. Does the same thing essentially,
3012 as TypeContainer::DefineType.
3014 (Populate): Method in which all the definition of the various methods (Invoke)
3017 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
3020 (CloseDelegate): Finally creates the delegate.
3022 * class.cs (TypeContainer::DefineType): Update to define delegates.
3023 (Populate, Emit and CloseType): Do the same thing here too.
3025 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
3026 delegates in all these operations.
3028 2001-10-14 Miguel de Icaza <miguel@ximian.com>
3030 * expression.cs: LocalTemporary: a new expression used to
3031 reference a temporary that has been created.
3033 * assign.cs: Handle PropertyAccess back here, so that we can
3034 provide the proper semantic access to properties.
3036 * expression.cs (Expression::ConvertReferenceExplicit): Implement
3037 a few more explicit conversions.
3039 * modifiers.cs: `NEW' modifier maps to HideBySig.
3041 * expression.cs (PropertyExpr): Make this into an
3042 ExpressionStatement, and support the EmitStatement code path.
3044 Perform get/set error checking, clean up the interface.
3046 * assign.cs: recognize PropertyExprs as targets, and if so, turn
3047 them into toplevel access objects.
3049 2001-10-12 Miguel de Icaza <miguel@ximian.com>
3051 * expression.cs: PropertyExpr::PropertyExpr: use work around the
3054 * typemanager.cs: Keep track here of our PropertyBuilders again to
3055 work around lameness in SRE.
3057 2001-10-11 Miguel de Icaza <miguel@ximian.com>
3059 * expression.cs (LValue::LValueResolve): New method in the
3060 interface, used to perform a second resolution pass for LValues.
3062 (This::DoResolve): Catch the use of this in static methods.
3064 (This::LValueResolve): Implement.
3066 (This::Store): Remove warning, assigning to `this' in structures
3069 (Invocation::Emit): Deal with invocation of
3070 methods on value types. We need to pass the address to structure
3071 methods rather than the object itself. (The equivalent code to
3072 emit "this" for structures leaves the entire structure on the
3073 stack instead of a pointer to it).
3075 (ParameterReference::DoResolve): Compute the real index for the
3076 argument based on whether the method takes or not a `this' pointer
3077 (ie, the method is static).
3079 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
3080 value types returned from functions when we need to invoke a
3081 method on the sturcture.
3084 2001-10-11 Ravi Pratap <ravi@ximian.com>
3086 * class.cs (TypeContainer::DefineType): Method to actually do the business of
3087 defining the type in the Modulebuilder or Typebuilder. This is to take
3088 care of nested types which need to be defined on the TypeBuilder using
3091 (TypeContainer::GetClassBases): Implement. Essentially the code from the
3092 methods in RootContext, only ported to be part of TypeContainer.
3094 (TypeContainer::GetInterfaceOrClass): Ditto.
3096 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
3098 * interface.cs (Interface::DefineInterface): New method. Does exactly
3099 what RootContext.CreateInterface did earlier, only it takes care of nested types
3102 (Interface::GetInterfaces): Move from RootContext here and port.
3104 (Interface::GetInterfaceByName): Same here.
3106 * rootcontext.cs (ResolveTree): Re-write.
3108 (PopulateTypes): Re-write.
3110 * class.cs (TypeContainer::Populate): Populate nested types too.
3111 (TypeContainer::Emit): Emit nested members too.
3113 * typemanager.cs (AddUserType): Do not make use of the FullName property,
3114 instead just use the name argument passed in as it is already fully
3117 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
3118 to TypeContainer mapping to see if a type is user-defined.
3120 * class.cs (TypeContainer::CloseType): Implement.
3122 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
3123 the default constructor.
3125 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
3128 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
3130 * interface.cs (CloseType): Create the type here.
3132 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
3135 Remove all the methods which are now in TypeContainer.
3137 2001-10-10 Ravi Pratap <ravi@ximian.com>
3139 * delegate.cs (Define): Re-write bits to define the delegate
3142 2001-10-10 Miguel de Icaza <miguel@ximian.com>
3144 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
3146 * expression.cs (ImplicitReferenceConversion): handle null as well
3147 as a source to convert to any reference type.
3149 * statement.cs (Return): Perform any implicit conversions to
3150 expected return type.
3152 Validate use of return statement.
3154 * codegen.cs (EmitContext): Pass the expected return type here.
3156 * class.cs (Method, Constructor, Property): Pass expected return
3157 type to EmitContext.
3159 2001-10-09 Miguel de Icaza <miguel@ximian.com>
3161 * expression.cs: Make DoResolve take an EmitContext instead of a
3164 Replaced `l' and `location' for `loc', for consistency.
3166 (Error, Warning): Remove unneeded Tc argument.
3168 * assign.cs, literal.cs, constant.cs: Update to new calling
3171 * codegen.cs: EmitContext now contains a flag indicating whether
3172 code is being generated in a static method or not.
3174 * cs-parser.jay: DecomposeQI, new function that replaces the old
3175 QualifiedIdentifier. Now we always decompose the assembled
3176 strings from qualified_identifier productions into a group of
3179 2001-10-08 Miguel de Icaza <miguel@ximian.com>
3181 * rootcontext.cs: Deal with field-less struct types correctly now
3182 by passing the size option to Define Type.
3184 * class.cs: Removed hack that created one static field.
3186 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3188 * statement.cs: Moved most of the code generation here.
3190 2001-10-09 Ravi Pratap <ravi@ximian.com>
3192 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
3195 (ElementAccess): Remove useless bits for now - keep checks as the spec
3198 2001-10-08 Ravi Pratap <ravi@ximian.com>
3200 * expression.cs (ElementAccess::DoResolve): Remove my crap code
3201 and start performing checks according to the spec.
3203 2001-10-07 Ravi Pratap <ravi@ximian.com>
3205 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
3206 rank_specifiers instead.
3208 (rank_specifiers): Change the order in which the rank specifiers are stored
3210 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
3212 * expression.cs (ElementAccess): Implement the LValue interface too.
3214 2001-10-06 Ravi Pratap <ravi@ximian.com>
3216 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
3217 except that user defined conversions are not included.
3219 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
3220 perform the conversion of the return type, if necessary.
3222 (New::DoResolve): Check whether we are creating an array or an object
3223 and accordingly do the needful.
3225 (New::Emit): Same here.
3227 (New::DoResolve): Implement guts of array creation.
3229 (New::FormLookupType): Helper function.
3231 2001-10-07 Miguel de Icaza <miguel@ximian.com>
3233 * codegen.cs: Removed most of the code generation here, and move the
3234 corresponding code generation bits to the statement classes.
3236 Added support for try/catch/finalize and throw.
3238 * cs-parser.jay: Added support for try/catch/finalize.
3240 * class.cs: Catch static methods having the flags override,
3241 virtual or abstract.
3243 * expression.cs (UserCast): This user cast was not really doing
3244 what it was supposed to do. Which is to be born in fully resolved
3245 state. Parts of the resolution were being performed at Emit time!
3249 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3251 * expression.cs: Implicity convert the result from UserCast.
3253 2001-10-05 Ravi Pratap <ravi@ximian.com>
3255 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
3256 prevented it from working correctly.
3258 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
3259 merely ConvertImplicit.
3261 2001-10-05 Miguel de Icaza <miguel@ximian.com>
3263 * typemanager.cs: Make the LookupTypeContainer function static,
3264 and not per-instance.
3266 * class.cs: Make static FindMembers (the one that takes a Type
3269 * codegen.cs: Add EmitForeach here.
3271 * cs-parser.jay: Make foreach a toplevel object instead of the
3272 inline expansion, as we need to perform semantic analysis on it.
3274 2001-10-05 Ravi Pratap <ravi@ximian.com>
3276 * expression.cs (Expression::ImplicitUserConversion): Rename to
3277 UserDefinedConversion.
3279 (Expression::UserDefinedConversion): Take an extra argument specifying
3280 whether we look for explicit user conversions too.
3282 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
3284 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
3286 (ExplicitUserConversion): Make it a call to UserDefinedConversion
3287 with the appropriate arguments.
3289 * cs-parser.jay (cast_expression): Record location too.
3291 * expression.cs (Cast): Record location info.
3293 (Expression::ConvertExplicit): Take location argument.
3295 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
3296 to determine if we are doing explicit conversions.
3298 (UserCast::Emit): Update accordingly.
3300 (Expression::ConvertExplicit): Report an error if everything fails.
3302 * ../errors/cs0030.cs : Add.
3304 2001-10-04 Miguel de Icaza <miguel@ximian.com>
3306 * modifiers.cs: If the ABSTRACT keyword is present, also set the
3307 virtual and newslot bits.
3309 * class.cs (TypeContainer::RegisterRequiredImplementations):
3310 Record methods we need.
3312 (TypeContainer::MakeKey): Helper function to make keys for
3313 MethodBases, since the Methodbase key is useless.
3315 (TypeContainer::Populate): Call RegisterRequiredImplementations
3316 before defining the methods.
3318 Create a mapping for method_builders_to_methods ahead of time
3319 instead of inside a tight loop.
3321 (::RequireMethods): Accept an object as the data to set into the
3322 hashtable so we can report interface vs abstract method mismatch.
3324 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3326 * report.cs: Make all of it static.
3328 * rootcontext.cs: Drop object_type and value_type computations, as
3329 we have those in the TypeManager anyways.
3331 Drop report instance variable too, now it is a global.
3333 * driver.cs: Use try/catch on command line handling.
3335 Add --probe option to debug the error reporting system with a test
3338 * report.cs: Add support for exiting program when a probe
3339 condition is reached.
3341 2001-10-03 Ravi Pratap <ravi@ximian.com>
3343 * expression.cs (Binary::DoNumericPromotions): Fix the case when
3344 we do a forcible conversion regardless of type, to check if
3345 ForceConversion returns a null.
3347 (Binary::error19): Use location to report error.
3349 (Unary::error23): Use location here too.
3351 * ../errors/cs0019.cs : Check in.
3353 * ../errors/cs0023.cs : Check in.
3355 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
3356 case of a non-null MethodInfo object with a length of 0 !
3358 (Binary::ResolveOperator): Flag error if overload resolution fails to find
3359 an applicable member - according to the spec :-)
3360 Also fix logic to find members in base types.
3362 (Unary::ResolveOperator): Same here.
3364 (Unary::report23): Change name to error23 and make first argument a TypeContainer
3365 as I was getting thoroughly confused between this and error19 :-)
3367 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
3368 (::FindMostEncompassedType): Implement.
3369 (::FindMostEncompassingType): Implement.
3370 (::StandardConversionExists): Implement.
3372 (UserImplicitCast): Re-vamp. We now need info about most specific
3373 source and target types so that we can do the necessary conversions.
3375 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
3376 mathematical union with no duplicates.
3378 2001-10-03 Miguel de Icaza <miguel@ximian.com>
3380 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
3381 in order from base classes to child classes, so that we can in
3382 child classes look up in our parent for method names and
3383 attributes (required for handling abstract, virtual, new, override
3384 constructs: we need to instrospect our base class, and if we dont
3385 populate the classes in order, the introspection might be
3386 incorrect. For example, a method could query its parent before
3387 the parent has any methods and would determine that the parent has
3388 no abstract methods (while it could have had them)).
3390 (RootContext::CreateType): Record the order in which we define the
3393 2001-10-02 Miguel de Icaza <miguel@ximian.com>
3395 * class.cs (TypeContainer::Populate): Also method definitions can
3396 fail now, keep track of this.
3398 (TypeContainer::FindMembers): Implement support for
3399 DeclaredOnly/noDeclaredOnly flag.
3401 (Constructor::Emit) Return the ConstructorBuilder.
3403 (Method::Emit) Return the MethodBuilder.
3404 Check for abstract or virtual methods to be public.
3406 * rootcontext.cs (RootContext::CreateType): Register all the
3407 abstract methods required for the class to be complete and the
3408 interface methods that must be implemented.
3410 * cs-parser.jay: Report error 501 (method requires body if it is
3411 not marked abstract or extern).
3413 * expression.cs (TypeOf::Emit): Implement.
3415 * typemanager.cs: runtime_handle_type, new global type.
3417 * class.cs (Property::Emit): Generate code for properties.
3419 2001-10-02 Ravi Pratap <ravi@ximian.com>
3421 * expression.cs (Unary::ResolveOperator): Find operators on base type
3422 too - we now conform exactly to the spec.
3424 (Binary::ResolveOperator): Same here.
3426 * class.cs (Operator::Define): Fix minor quirk in the tests.
3428 * ../errors/cs0215.cs : Added.
3430 * ../errors/cs0556.cs : Added.
3432 * ../errors/cs0555.cs : Added.
3434 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3436 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
3437 single integer which is really efficient
3439 2001-10-01 Ravi Pratap <ravi@ximian.com>
3441 * expression.cs (Expression::ImplicitUserConversion): Use location
3442 even in the case when we are examining True operators.
3444 * class.cs (Operator::Define): Perform extensive checks to conform
3445 with the rules for operator overloading in the spec.
3447 * expression.cs (Expression::ImplicitReferenceConversion): Implement
3448 some of the other conversions mentioned in the spec.
3450 * typemanager.cs (array_type): New static member for the System.Array built-in
3453 (cloneable_interface): For System.ICloneable interface.
3455 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
3456 we start resolving the tree and populating types.
3458 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
3460 2001-10-01 Miguel de Icaza <miguel@ximian.com>
3462 * expression.cs (Expression::ExprClassFromMemberInfo,
3463 Expression::Literalize): Create literal expressions from
3464 FieldInfos which are literals.
3466 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
3467 type casts, because they were wrong. The test suite in tests
3470 (ImplicitNumericConversion): ushort to ulong requires a widening
3473 Int32 constant to long requires widening cast as well.
3475 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
3476 for integers because the type on the stack is not i4.
3478 2001-09-30 Miguel de Icaza <miguel@ximian.com>
3480 * expression.cs (report118): require location argument.
3482 * parameter.cs: Do not dereference potential null value.
3484 * class.cs: Catch methods that lack the `new' keyword when
3485 overriding a name. Report warnings when `new' is used without
3486 anything being there to override.
3488 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
3490 * class.cs: Only add constructor to hashtable if it is non-null
3491 (as now constructors can fail on define).
3493 (TypeManager, Class, Struct): Take location arguments.
3495 Catch field instance initialization in structs as errors.
3497 accepting_filter: a new filter for FindMembers that is static so
3498 that we dont create an instance per invocation.
3500 (Constructor::Define): Catch errors where a struct constructor is
3503 * cs-parser.jay: Pass location information for various new
3506 * delegate.cs (Delegate): take a location argument.
3508 * driver.cs: Do not call EmitCode if there were problesm in the
3509 Definition of the types, as many Builders wont be there.
3511 * decl.cs (Decl::Decl): Require a location argument.
3513 * cs-tokenizer.cs: Handle properly hex constants that can not fit
3514 into integers, and find the most appropiate integer for it.
3516 * literal.cs: Implement ULongLiteral.
3518 * rootcontext.cs: Provide better information about the location of
3519 failure when CreateType fails.
3521 2001-09-29 Miguel de Icaza <miguel@ximian.com>
3523 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
3526 * expression.cs (Binary::CheckShiftArguments): Add missing type
3528 (Binary::ResolveOperator): Add type to the logical and and logical
3529 or, Bitwise And/Or and Exclusive Or code paths, it was missing
3532 (Binary::DoNumericPromotions): In the case where either argument
3533 is ulong (and most signed types combined with ulong cause an
3534 error) perform implicit integer constant conversions as well.
3536 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3538 * expression.cs (UserImplicitCast): Method should always be
3540 (Invocation::BetterConversion): Simplified test for IntLiteral.
3542 (Expression::ImplicitNumericConversion): Split this routine out.
3543 Put the code that performs implicit constant integer conversions
3546 (Expression::Resolve): Become a wrapper around DoResolve so we can
3547 check eclass and type being set after resolve.
3549 (Invocation::Badness): Remove this dead function
3551 (Binary::ResolveOperator): Do not compute the expensive argumnets
3552 unless we have a union for it.
3554 (Probe::Emit): Is needs to do an isinst and then
3555 compare against null.
3557 (::CanConvert): Added Location argument. If the Location argument
3558 is null (Location.Null), then we do not report errors. This is
3559 used by the `probe' mechanism of the Explicit conversion. We do
3560 not want to generate an error for something that the user
3561 explicitly requested to be casted. But the pipeline for an
3562 explicit cast first tests for potential implicit casts.
3564 So for now, if the Location is null, it means `Probe only' to
3565 avoid adding another argument. Might have to revise this
3568 (ClassCast): New class used to type cast objects into arbitrary
3569 classes (used in Explicit Reference Conversions).
3571 Implement `as' as well.
3573 Reverted all the patches from Ravi below: they were broken:
3575 * The use of `level' as a mechanism to stop recursive
3576 invocations is wrong. That was there just to catch the
3577 bug with a strack trace but not as a way of addressing
3580 To fix the problem we have to *understand* what is going
3581 on and the interactions and come up with a plan, not
3582 just get things going.
3584 * The use of the type conversion cache that I proposed
3585 last night had an open topic: How does this work across
3586 protection domains. A user defined conversion might not
3587 be public in the location where we are applying the
3588 conversion, a different conversion might be selected
3589 (ie, private A->B (better) but public B->A (worse),
3590 inside A, A->B applies, but outside it, B->A will
3593 * On top of that (ie, even if the above is solved),
3594 conversions in a cache need to be abstract. Ie, `To
3595 convert from an Int to a Short use an OpcodeCast', not
3596 `To convert from an Int to a Short use the OpcodeCast on
3597 the variable 5' (which is what this patch was doing).
3599 2001-09-28 Ravi Pratap <ravi@ximian.com>
3601 * expression.cs (Invocation::ConversionExists): Re-write to use
3602 the conversion cache
3604 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
3605 cache all conversions done, not just user-defined ones.
3607 (Invocation::BetterConversion): The real culprit. Use ConversionExists
3608 to determine if a conversion exists instead of acutually trying to
3609 perform the conversion. It's faster too.
3611 (Expression::ConvertExplicit): Modify to use ConversionExists to check
3612 and only then attempt the implicit conversion.
3614 2001-09-28 Ravi Pratap <ravi@ximian.com>
3616 * expression.cs (ConvertImplicit): Use a cache for conversions
3617 already found. Check level of recursion and bail out if necessary.
3619 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3621 * typemanager.cs (string_concat_string_string, string_concat_object_object):
3622 Export standard methods that we expect for string operations.
3624 * statement.cs (Block::UsageWarning): Track usage of variables and
3625 report the errors for not used variables.
3627 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
3630 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3632 * codegen.cs: remove unnneded code
3634 * expression.cs: Removed BuiltinTypeAccess class
3636 Fix the order in which implicit conversions are
3639 The previous fixed dropped support for boxed conversions (adding a
3640 test to the test suite now)
3642 (UserImplicitCast::CanConvert): Remove test for source being null,
3643 that code is broken. We should not feed a null to begin with, if
3644 we do, then we should track the bug where the problem originates
3645 and not try to cover it up here.
3647 Return a resolved expression of type UserImplicitCast on success
3648 rather than true/false. Ravi: this is what I was talking about,
3649 the pattern is to use a static method as a "constructor" for
3652 Also, do not create arguments until the very last minute,
3653 otherwise we always create the arguments even for lookups that
3654 will never be performed.
3656 (UserImplicitCast::Resolve): Eliminate, objects of type
3657 UserImplicitCast are born in a fully resolved state.
3659 * typemanager.cs (InitCoreTypes): Init also value_type
3662 * expression.cs (Cast::Resolve): First resolve the child expression.
3664 (LValue): Add new method AddressOf to be used by
3667 Change the argument of Store to take an EmitContext instead of an
3668 ILGenerator, because things like FieldExpr need to be able to call
3669 their children expression to generate the instance code.
3671 (Expression::Error, Expression::Warning): Sugar functions for
3674 (Expression::MemberLookup): Accept a TypeContainer instead of a
3675 Report as the first argument.
3677 (Expression::ResolvePrimary): Killed. I still want to improve
3678 this as currently the code is just not right.
3680 (Expression::ResolveMemberAccess): Simplify, but it is still
3683 (Unary::Resolve): Catch errors in AddressOf operators.
3685 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
3686 index to a byte for the short-version, or the compiler will choose
3687 the wrong Emit call, which generates the wrong data.
3689 (ParameterReference::Emit, ::Store): same.
3691 (FieldExpr::AddressOf): Implement.
3693 * typemanager.cs: TypeManager: made public variable instead of
3696 * driver.cs: document --fatal.
3698 * report.cs (ErrorMessage, WarningMessage): new names for the old
3699 Error and Warning classes.
3701 * cs-parser.jay (member_access): Turn built-in access to types
3702 into a normal simplename
3704 2001-09-27 Ravi Pratap <ravi@ximian.com>
3706 * expression.cs (Invocation::BetterConversion): Fix to cope
3707 with q being null, since this was introducing a bug.
3709 * expression.cs (ConvertImplicit): Do built-in conversions first.
3711 2001-09-27 Ravi Pratap <ravi@ximian.com>
3713 * expression.cs (UserImplicitCast::Resolve): Fix bug.
3715 2001-09-27 Ravi Pratap <ravi@ximian.com>
3717 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
3718 I had introduced long ago (what's new ?).
3720 * expression.cs (UserImplicitCast::CanConvert): Static method to do
3721 the work of all the checking.
3722 (ConvertImplicit): Call CanConvert and only then create object if necessary.
3723 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
3725 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
3726 that is the right way.
3728 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
3729 overloading resolution. Use everywhere instead of cutting and pasting code.
3731 (Binary::ResolveOperator): Use MakeUnionSet.
3733 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
3734 we have to convert to bool types. Not complete yet.
3736 2001-09-27 Miguel de Icaza <miguel@ximian.com>
3738 * typemanager.cs (TypeManager::CSharpName): support ushort.
3740 * expression.cs (Expression::TryImplicitIntConversion): Attempts
3741 to provide an expression that performsn an implicit constant int
3742 conversion (section 6.1.6).
3743 (Expression::ConvertImplicitRequired): Reworked to include
3744 implicit constant expression conversions.
3746 (Expression::ConvertNumericExplicit): Finished.
3748 (Invocation::Emit): If InstanceExpression is null, then it means
3749 that we perform a call on this.
3751 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3753 * expression.cs (Unary::Emit): Remove some dead code.
3754 (Probe): Implement Resolve and Emit for `is'.
3755 (Expression::ConvertImplicitRequired): Attempt to do constant
3756 expression conversions here. Maybe should be moved to
3757 ConvertImplicit, but I am not sure.
3758 (Expression::ImplicitLongConstantConversionPossible,
3759 Expression::ImplicitIntConstantConversionPossible): New functions
3760 that tell whether is it possible to apply an implicit constant
3761 expression conversion.
3763 (ConvertNumericExplicit): Started work on explicit numeric
3766 * cs-parser.jay: Update operator constants.
3768 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
3769 (Parameters::GetSignature): Hook up VerifyArgs here.
3770 (Parameters::VerifyArgs): Verifies that no two arguments have the
3773 * class.cs (Operator): Update the operator names to reflect the
3774 ones that the spec expects (as we are just stringizing the
3777 * expression.cs (Unary::ResolveOperator): Fix bug: Use
3778 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
3779 previous usage did only work for our methods.
3780 (Expression::ConvertImplicit): Handle decimal implicit numeric
3781 conversions as well.
3782 (Expression::InternalTypeConstructor): Used to invoke constructors
3783 on internal types for default promotions.
3785 (Unary::Emit): Implement special handling for the pre/post
3786 increment/decrement for overloaded operators, as they need to have
3787 the same semantics as the other operators.
3789 (Binary::ResolveOperator): ditto.
3790 (Invocation::ConversionExists): ditto.
3791 (UserImplicitCast::Resolve): ditto.
3793 2001-09-26 Ravi Pratap <ravi@ximian.com>
3795 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
3796 operator, return after emitting body. Regression tests pass again !
3798 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
3799 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
3800 (Invocation::OverloadResolve): Ditto.
3801 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
3803 * everywhere : update calls to the above methods accordingly.
3805 2001-09-26 Miguel de Icaza <miguel@ximian.com>
3807 * assign.cs (Assign): Make it inherit from ExpressionStatement.
3809 * expression.cs (ExpressionStatement): New base class used for
3810 expressions that can appear in statements, so that we can provide
3811 an alternate path to generate expression that do not leave a value
3814 (Expression::Emit, and all the derivatives): We no longer return
3815 whether a value is left on the stack or not. Every expression
3816 after being emitted leaves a single value on the stack.
3818 * codegen.cs (EmitContext::EmitStatementExpression): Use the
3819 facilties of ExpressionStatement if possible.
3821 * cs-parser.jay: Update statement_expression.
3823 2001-09-25 Miguel de Icaza <miguel@ximian.com>
3825 * driver.cs: Change the wording of message
3827 2001-09-25 Ravi Pratap <ravi@ximian.com>
3829 * expression.cs (Binary::ResolveOperator): Had forgottten to set
3830 the type of the expression to the return type of the method if
3831 we have an overloaded operator match ! The regression tests pass again !
3832 (Unary::ResolveOperator): Ditto.
3834 * expression.cs (Invocation::ConversionExists): Correct the member lookup
3835 to find "op_Implicit", not "implicit" ;-)
3836 (UserImplicitCast): New class to take care of user-defined implicit conversions.
3837 (ConvertImplicit, ForceConversion): Take TypeContainer argument
3839 * everywhere : Correct calls to the above accordingly.
3841 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
3842 (ConvertImplicit): Do user-defined conversion if it exists.
3844 2001-09-24 Miguel de Icaza <miguel@ximian.com>
3846 * assign.cs: track location.
3847 (Resolve): Use implicit conversions on assignment.
3849 * literal.cs: Oops. Not good, Emit of short access values should
3850 pass (Bytes) or the wrong argument will be selected.
3852 * expression.cs (Unary::Emit): Emit code for -expr.
3854 (Unary::ResolveOperator): Handle `Substract' for non-constants
3855 (substract from zero from the non-constants).
3856 Deal with Doubles as well.
3858 (Expression::ConvertImplicitRequired): New routine that reports an
3859 error if no implicit conversion exists.
3861 (Invocation::OverloadResolve): Store the converted implicit
3862 expressions if we make them
3864 2001-09-24 Ravi Pratap <ravi@ximian.com>
3866 * class.cs (ConstructorInitializer): Take a Location argument.
3867 (ConstructorBaseInitializer): Same here.
3868 (ConstructorThisInitializer): Same here.
3870 * cs-parser.jay : Update all calls accordingly.
3872 * expression.cs (Unary, Binary, New): Take location argument.
3873 Update accordingly everywhere.
3875 * cs-parser.jay : Update all calls to the above to take a location
3880 2001-09-24 Ravi Pratap <ravi@ximian.com>
3882 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
3883 (Invocation::BetterConversion): Same here
3884 (Invocation::ConversionExists): Ditto.
3886 (Invocation::ConversionExists): Implement.
3888 2001-09-22 Ravi Pratap <ravi@ximian.com>
3890 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
3891 Also take an additional TypeContainer argument.
3893 * All over : Pass in TypeContainer as argument to OverloadResolve.
3895 * typemanager.cs (CSharpName): Update to check for the string type and return
3898 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
3901 2001-09-21 Ravi Pratap <ravi@ximian.com>
3903 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
3904 (Invocation::BetterFunction): Implement.
3905 (Invocation::BetterConversion): Implement.
3906 (Invocation::ConversionExists): Skeleton, no implementation yet.
3908 Okay, things work fine !
3910 2001-09-21 Miguel de Icaza <miguel@ximian.com>
3912 * typemanager.cs: declare and load enum_type, delegate_type and
3915 * expression.cs (Expression::Emit): Now emit returns a value that
3916 tells whether a value is left on the stack or not. This strategy
3917 might be reveted tomorrow with a mechanism that would address
3918 multiple assignments.
3919 (Expression::report118): Utility routine to report mismatches on
3922 (Unary::Report23): Report impossible type/operator combination
3925 (Unary::IsIncrementableNumber): Whether the type can be
3926 incremented or decremented with add.
3927 (Unary::ResolveOperator): Also allow enumerations to be bitwise
3929 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
3931 (Invocation::Emit): Deal with new Emit convetion.
3933 * All Expression derivatives: Updated their Emit method to return
3934 whether they leave values on the stack or not.
3936 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
3937 stack for expressions that are statements.
3939 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3941 * expression.cs (LValue): New interface. Must be implemented by
3943 (LocalVariableReference, ParameterReference, FieldExpr): Implement
3946 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
3947 interface for generating code, simplifies the code.
3949 2001-09-20 Ravi Pratap <ravi@ximian.com>
3951 * expression.cs (everywhere): Comment out return statements in ::Resolve
3952 methods to avoid the warnings.
3954 2001-09-20 Miguel de Icaza <miguel@ximian.com>
3956 * driver.cs (parse): Report error 2001 if we can not open the
3959 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
3962 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
3965 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
3966 otherwise nested blocks end up with the same index.
3968 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
3970 * expression.cs: Instead of having FIXMEs in the Resolve
3971 functions, throw exceptions so it is obvious that we are facing a
3974 * cs-parser.jay (invocation_expression): Pass Location information.
3976 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
3977 Use a basename for those routines because .NET does not like paths
3980 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
3983 2001-09-19 Miguel de Icaza <miguel@ximian.com>
3985 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
3986 are loading the correct data types (throws an exception if not).
3987 (TypeManager::InitCoreTypes): Use CoreLookupType
3989 * expression.cs (Unary::ResolveOperator): return the child
3990 expression for expressions which are just +expr.
3991 (Unary::ResolveOperator): Return negative literals for -LITERAL
3992 expressions (otherwise they are Unary {Literal}).
3993 (Invocation::Badness): Take into account `Implicit constant
3994 expression conversions'.
3996 * literal.cs (LongLiteral): Implement long literal class.
3997 (IntLiteral): export the `Value' of the intliteral.
3999 2001-09-19 Ravi Pratap <ravi@ximian.com>
4001 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
4003 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
4004 instead of 'Operator'
4006 * expression.cs (Binary::ResolveOperator): Update accordingly.
4007 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
4010 * cs-parser.jay (unary_expression): Update to use the new names.
4012 * gen-treedump.cs (GetUnary): Same here.
4014 * expression.cs (Unary::Resolve): Implement.
4015 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
4016 operators are found instead of making noise ;-)
4017 (Unary::ResolveOperator): New method to do precisely the same thing which
4018 Binary::ResolveOperator does for Binary expressions.
4019 (Unary.method, .Arguments): Add.
4020 (Unary::OperName): Implement.
4021 (Unary::ForceConversion): Copy and Paste !
4023 * class.cs (Operator::Define): Fix a small bug for the case when we have
4026 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
4027 for the inbuilt operators. Only overloading works for now ;-)
4029 2001-09-18 Miguel de Icaza <miguel@ximian.com>
4031 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
4032 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
4034 * expression.cs (This::Emit): Implement.
4035 (This::Resolve): Implement.
4036 (TypeOf:Resolve): Implement.
4037 (Expression::ResolveSimpleName): Add an implicit this to instance
4039 (MemberAccess::Resolve): Deal with Parameters and Fields.
4040 Bind instance variable to Field expressions.
4041 (FieldExpr::Instance): New field used to track the expression that
4042 represents the object instance.
4043 (FieldExpr::Resolve): Track potential errors from MemberLookup not
4045 (FieldExpr::Emit): Implement.
4047 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
4048 the last instruction contains a return opcode to avoid generating
4049 the last `ret' instruction (this generates correct code, and it is
4050 nice to pass the peverify output).
4052 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
4053 initializer for static and instance variables.
4054 (Constructor::Emit): Allow initializer to be null in the case of
4055 static constructors. Only emit initializer for instance
4058 (TypeContainer::FindMembers): Return a null array if there are no
4061 Also fix the code for the MemberTypes.Method branch, as it was not
4062 scanning that for operators (or tried to access null variables before).
4064 * assign.cs (Assign::Emit): Handle instance and static fields.
4068 * driver.cs: Stop compilation if there are parse errors.
4070 * cs-parser.jay (constructor_declaration): Provide default base
4071 initializer for non-static constructors.
4072 (constructor_declarator): Do not provide a default base
4073 initializers if none was specified.
4074 Catch the fact that constructors should not have parameters.
4076 * class.cs: Do not emit parent class initializers for static
4077 constructors, that should be flagged as an error.
4079 2001-09-18 Ravi Pratap <ravi@ximian.com>
4081 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
4082 Move back code into TypeContainer::Populate.
4084 2001-09-18 Ravi Pratap <ravi@ximian.com>
4086 * class.cs (TypeContainer::AddConstructor): Fix the check to
4087 compare against Name, not Basename.
4088 (Operator::OpType): Change Plus and Minus to Add and Subtract.
4090 * cs-parser.jay : Update accordingly.
4092 * class.cs (TypeContainer::FindMembers): For the case where we are searching
4093 for methods, don't forget to look into the operators too.
4094 (RegisterMethodBuilder): Helper method to take care of this for
4095 methods, constructors and operators.
4096 (Operator::Define): Completely revamp.
4097 (Operator.OperatorMethod, MethodName): New fields.
4098 (TypeContainer::Populate): Move the registering of builders into
4099 RegisterMethodBuilder.
4100 (Operator::Emit): Re-write.
4102 * expression.cs (Binary::Emit): Comment out code path to emit method
4103 invocation stuff for the case when we have a user defined operator. I am
4104 just not able to get it right !
4106 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4108 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
4111 (Expression::MemberLookup): Provide a version that allows to
4112 specify the MemberTypes and BindingFlags.
4114 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
4115 so it was not fetching variable information from outer blocks.
4117 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
4118 Beforefieldinit as it was buggy.
4120 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
4123 * class.cs (Constructor::Emit): Only emit if block is not null.
4124 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
4125 deal with this by semantically definining it as if the user had
4128 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
4129 constructors as we now "emit" them at a higher level.
4131 (TypeContainer::DefineDefaultConstructor): Used to define the
4132 default constructors if none was provided.
4134 (ConstructorInitializer): Add methods Resolve and Emit.
4136 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
4138 2001-09-17 Ravi Pratap <ravi@ximian.com>
4140 * class.cs (TypeContainer::EmitDefaultConstructor): Register
4141 the default constructor builder with our hashtable for methodbuilders
4144 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
4145 and argument_count is 0 in which case we have a match.
4146 (Binary::ResolveOperator): More null checking and miscellaneous coding
4149 2001-09-17 Ravi Pratap <ravi@ximian.com>
4151 * rootcontext.cs (IsNameSpace): Compare against null.
4153 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
4155 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
4156 and Unary::Operator.
4158 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
4161 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
4162 we have overloaded operators.
4163 (Binary::ResolveOperator): Implement the part which does the operator overload
4166 * class.cs (Operator::Emit): Implement.
4167 (TypeContainer::Emit): Emit the operators we have too.
4169 * expression.cs (Binary::Emit): Update to emit the appropriate code for
4170 the case when we have a user-defined operator.
4172 2001-09-17 Miguel de Icaza <miguel@ximian.com>
4174 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
4176 2001-09-16 Ravi Pratap <ravi@ximian.com>
4178 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
4179 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
4180 (Constructor::Emit): Implement.
4181 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
4182 if we have no work to do.
4183 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
4186 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
4187 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
4189 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
4192 2001-09-15 Ravi Pratap <ravi@ximian.com>
4194 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
4196 (Tree::RecordNamespace): Method to do what the name says ;-)
4197 (Tree::Namespaces): Property to get at the namespaces hashtable.
4199 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
4202 * rootcontext.cs (IsNamespace): Fixed it :-)
4204 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4206 * class.cs (TypeContainer::FindMembers): Add support for
4208 (MethodCore): New class that encapsulates both the shared aspects
4209 of a Constructor and a Method.
4210 (Method, Constructor): Factored pieces into MethodCore.
4212 * driver.cs: Added --fatal which makes errors throw exceptions.
4213 Load System assembly as well as part of the standard library.
4215 * report.cs: Allow throwing exceptions on errors for debugging.
4217 * modifiers.cs: Do not use `parent', instead use the real type
4218 container to evaluate permission settings.
4220 * class.cs: Put Ravi's patch back in. He is right, and we will
4221 have to cope with the
4223 2001-09-14 Ravi Pratap <ravi@ximian.com>
4225 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
4226 FamORAssem, not FamANDAssem.
4228 2001-09-14 Miguel de Icaza <miguel@ximian.com>
4230 * driver.cs: Added --parse option that only parses its input files
4233 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
4234 incorrect. IsTopLevel is not used to tell whether an object is
4235 root_types or not (that can be achieved by testing this ==
4236 root_types). But to see if this is a top-level *class* (not
4237 necessarly our "toplevel" container).
4239 2001-09-14 Ravi Pratap <ravi@ximian.com>
4241 * enum.cs (Enum::Define): Modify to call the Lookup method on the
4242 parent instead of a direct call to GetType.
4244 2001-09-14 Ravi Pratap <ravi@ximian.com>
4246 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
4247 Modifiers.TypeAttr. This should just be a call to that method.
4249 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
4250 object so that we can determine if we are top-level or not.
4252 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
4255 * enum.cs (Enum::Define): Ditto.
4257 * modifiers.cs (FieldAttr): Re-write.
4259 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
4260 (TypeContainer::HaveStaticConstructor): New property to provide access
4261 to precisely that info.
4263 * modifiers.cs (MethodAttr): Re-write.
4264 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
4266 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
4267 of top-level types as claimed.
4269 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4271 * expression.cs (MemberLookup): Fruitless attempt to lookup
4272 constructors. Maybe I need to emit default constructors? That
4273 might be it (currently .NET emits this for me automatically).
4274 (Invocation::OverloadResolve): Cope with Arguments == null.
4275 (Invocation::EmitArguments): new function, shared by the new
4277 (Invocation::Emit): Handle static and instance methods. Emit
4278 proper call instruction for virtual or non-virtual invocations.
4279 (New::Emit): Implement.
4280 (New::Resolve): Implement.
4281 (MemberAccess:Resolve): Implement.
4282 (MethodGroupExpr::InstanceExpression): used conforming to the spec
4284 (FieldExpr::Resolve): Set type.
4286 * support.cs: Handle empty arguments.
4288 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
4289 SimpleLookup): Auxiliary routines to help parse a qualifier
4292 Update qualifier_identifier rule.
4294 * codegen.cs: Removed debugging messages.
4296 * class.cs: Make this a global thing, this acts just as a "key" to
4297 objects that we might have around.
4299 (Populate): Only initialize method_builders_to_methods once.
4301 * expression.cs (PropertyExpr): Initialize type from the
4304 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
4305 Resolve pattern. Attempt to implicitly convert value to boolean.
4308 * expression.cs: Set the type for the int32/int32 argument case.
4309 (Binary::ResolveOperator): Set the return type to boolean for
4310 comparission operators
4312 * typemanager.cs: Remove debugging print code.
4314 (Invocation::Resolve): resolve type.
4316 * class.cs: Allocate a MemberInfo of the correct size, as the code
4317 elsewhere depends on the test to reflect the correct contents.
4319 (Method::) Keep track of parameters, due to System.Reflection holes
4321 (TypeContainer::Populate): Keep track of MethodBuilders to Method
4324 (TypeContainer::FindMembers): Use ArrayList and then copy an array
4325 of the exact size and return that.
4327 (Class::LookupMethodByBuilder): New function that maps
4328 MethodBuilders to its methods. Required to locate the information
4329 on methods because System.Reflection bit us again.
4331 * support.cs: New file, contains an interface ParameterData and
4332 two implementations: ReflectionParameters and InternalParameters
4333 used to access Parameter information. We will need to grow this
4336 * expression.cs (Invocation::GetParameterData): implement a cache
4337 and a wrapper around the ParameterData creation for methods.
4338 (Invocation::OverloadResolve): Use new code.
4340 2001-09-13 Ravi Pratap <ravi@ximian.com>
4342 * class.cs (TypeContainer::EmitField): Remove and move into
4343 (Field::Define): here and modify accordingly.
4344 (Field.FieldBuilder): New member.
4345 (TypeContainer::Populate): Update accordingly.
4346 (TypeContainer::FindMembers): Implement.
4348 2001-09-13 Miguel de Icaza <miguel@ximian.com>
4350 * statement.cs: (VariableInfo::VariableType): New field to be
4351 initialized with the full type once it is resolved.
4353 2001-09-12 Miguel de Icaza <miguel@ximian.com>
4355 * parameter.cs (GetParameterInfo): Use a type cache to compute
4356 things only once, and to reuse this information
4358 * expression.cs (LocalVariableReference::Emit): Implement.
4359 (OpcodeCast::Emit): fix.
4361 (ParameterReference::Resolve): Implement.
4362 (ParameterReference::Emit): Implement.
4364 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
4365 that are expressions need to stay as Expressions.
4367 * typemanager.cs (CSharpName): Returns the C# name of a type if
4370 * expression.cs (Expression::ConvertImplicit): New function that
4371 implements implicit type conversions.
4373 (Expression::ImplicitReferenceConversion): Implements implicit
4374 reference conversions.
4376 (EmptyCast): New type for transparent casts.
4378 (OpcodeCast): New type for casts of types that are performed with
4379 a sequence of bytecodes.
4381 (BoxedCast): New type used for casting value types into reference
4382 types. Emits a box opcode.
4384 (Binary::DoNumericPromotions): Implements numeric promotions of
4385 and computation of the Binary::Type.
4387 (Binary::EmitBranchable): Optimization.
4389 (Binary::Emit): Implement code emission for expressions.
4391 * typemanager.cs (TypeManager): Added two new core types: sbyte
4394 2001-09-12 Ravi Pratap <ravi@ximian.com>
4396 * class.cs (TypeContainer::FindMembers): Method which does exactly
4397 what Type.FindMembers does, only we don't have to use reflection. No
4400 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
4401 typecontainer objects as we need to get at them.
4402 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
4404 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
4405 typecontainer object.
4407 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
4408 of just a Report object.
4410 2001-09-11 Ravi Pratap <ravi@ximian.com>
4412 * class.cs (Event::Define): Go back to using the prefixes "add_" and
4414 (TypeContainer::Populate): Now define the delegates of the type too.
4415 (TypeContainer.Delegates): Property to access the list of delegates defined
4418 * delegates.cs (Delegate::Define): Implement partially.
4420 * modifiers.cs (TypeAttr): Handle more flags.
4422 2001-09-11 Ravi Pratap <ravi@ximian.com>
4424 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
4426 (Operator::Define): Re-write logic to get types by using the LookupType method
4427 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
4428 (Indexer::Define): Ditto.
4429 (Event::Define): Ditto.
4430 (Property::Define): Ditto.
4432 2001-09-10 Ravi Pratap <ravi@ximian.com>
4434 * class.cs (TypeContainer::Populate): Now define operators too.
4435 (TypeContainer.Operators): New property to access the list of operators
4437 (Operator.OperatorMethodBuilder): New member to hold the method builder
4438 for the operator we are defining.
4439 (Operator::Define): Implement.
4441 2001-09-10 Ravi Pratap <ravi@ximian.com>
4443 * class.cs (Event::Define): Make the prefixes of the accessor methods
4444 addOn_ and removeOn_
4446 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
4447 of the location being passed in too. Ideally, this should go later since all
4448 error reporting should be done through the Report object.
4450 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
4451 (Populate): Iterate thru the indexers we have and define them too.
4452 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
4453 for the get and set accessors.
4454 (Indexer::Define): Implement.
4456 2001-09-09 Miguel de Icaza <miguel@ximian.com>
4458 * expression.cs (Binary::Resolve): Beginning of it. I scratched
4459 my previous implementation, did not work.
4461 * typemanager.cs: Add a couple of missing types (the longs).
4463 * literal.cs: Use TypeManager.bool_type instead of getting it.
4465 * expression.cs (EventExpr): New kind of expressions.
4466 (Expressio::ExprClassFromMemberInfo): finish
4468 2001-09-08 Miguel de Icaza <miguel@ximian.com>
4470 * assign.cs: Emit stores to static fields differently.
4472 2001-09-08 Ravi Pratap <ravi@ximian.com>
4474 * Merge in changes and adjust code to tackle conflicts. Backed out my
4475 code in Assign::Resolve ;-)
4477 2001-09-08 Ravi Pratap <ravi@ximian.com>
4479 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
4480 instead Report.Error and also pass in the location.
4481 (CSharpParser::Lexer): New readonly property to return the reference
4482 to the Tokenizer object.
4483 (declare_local_variables): Use Report.Error with location instead of plain
4487 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
4488 (Operator.CheckBinaryOperator): Ditto.
4490 * cs-parser.jay (operator_declarator): Update accordingly.
4492 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
4493 (CheckBinaryOperator): Same here.
4495 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
4496 on the name without any prefixes of namespace names etc. This is because we
4497 already might have something already fully qualified like
4498 'System.Console.WriteLine'
4500 * assign.cs (Resolve): Begin implementation. Stuck ;-)
4502 2001-09-07 Ravi Pratap <ravi@ximian.com>
4504 * cs-tokenizer.cs (location): Return a string which also contains
4507 * expression.cs (ElementAccess): New class for expressions of the
4508 type 'element access.'
4509 (BaseAccess): New class for expressions of the type 'base access.'
4510 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
4513 * cs-parser.jay (element_access): Implement action.
4514 (base_access): Implement actions.
4515 (checked_expression, unchecked_expression): Implement.
4517 * cs-parser.jay (local_variable_type): Correct and implement.
4518 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
4520 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
4522 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
4523 name and the specifiers.
4525 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
4527 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
4528 making them all public ;-)
4530 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
4533 2001-09-07 Miguel de Icaza <miguel@ximian.com>
4535 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
4537 (FieldExpr, PropertyExprs): New resolved expressions.
4538 (SimpleName::MemberStaticCheck): Perform static checks for access
4539 to non-static fields on static methods. Maybe this should be
4540 generalized for MemberAccesses.
4541 (SimpleName::ResolveSimpleName): More work on simple name
4544 * cs-parser.jay (primary_expression/qualified_identifier): track
4545 the parameter index.
4547 * codegen.cs (CodeGen::Save): Catch save exception, report error.
4548 (EmitContext::EmitBoolExpression): Chain to expression generation
4549 instead of temporary hack.
4550 (::EmitStatementExpression): Put generic expression code generation.
4552 * assign.cs (Assign::Emit): Implement variable assignments to
4553 local variables, parameters and fields.
4555 2001-09-06 Miguel de Icaza <miguel@ximian.com>
4557 * statement.cs (Block::GetVariableInfo): New method, returns the
4558 VariableInfo for a variable name in a block.
4559 (Block::GetVariableType): Implement in terms of GetVariableInfo
4561 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
4562 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
4564 2001-09-06 Ravi Pratap <ravi@ximian.com>
4566 * cs-parser.jay (operator_declaration): Continue on my quest : update
4567 to take attributes argument.
4568 (event_declaration): Ditto.
4569 (enum_declaration): Ditto.
4570 (indexer_declaration): Ditto.
4572 * class.cs (Operator::Operator): Update constructor accordingly.
4573 (Event::Event): Ditto.
4575 * delegate.cs (Delegate::Delegate): Same here.
4577 * enum.cs (Enum::Enum): Same here.
4579 2001-09-05 Ravi Pratap <ravi@ximian.com>
4581 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
4583 * ../tests/cs0658.cs : New file to demonstrate error 0658.
4585 * attribute.cs (Attributes): New class to encapsulate all attributes which were
4586 being passed around as an arraylist.
4587 (Attributes::AddAttribute): Method to add attribute sections.
4589 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
4590 (struct_declaration): Update accordingly.
4591 (constant_declaration): Update.
4592 (field_declaration): Update.
4593 (method_header): Update.
4594 (fixed_parameter): Update.
4595 (parameter_array): Ditto.
4596 (property_declaration): Ditto.
4597 (destructor_declaration): Ditto.
4599 * class.cs (Struct::Struct): Update constructors accordingly.
4600 (Class::Class): Ditto.
4601 (Field::Field): Ditto.
4602 (Method::Method): Ditto.
4603 (Property::Property): Ditto.
4604 (TypeContainer::OptAttribute): update property's return type.
4606 * interface.cs (Interface.opt_attributes): New member.
4607 (Interface::Interface): Update to take the extra Attributes argument.
4609 * parameter.cs (Parameter::Parameter): Ditto.
4611 * constant.cs (Constant::Constant): Ditto.
4613 * interface.cs (InterfaceMemberBase): New OptAttributes field.
4614 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
4615 the attributes as a parameter.
4616 (InterfaceProperty): Update constructor call.
4617 (InterfaceEvent): Ditto.
4618 (InterfaceMethod): Ditto.
4619 (InterfaceIndexer): Ditto.
4621 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
4622 pass the attributes too.
4623 (interface_event_declaration): Ditto.
4624 (interface_property_declaration): Ditto.
4625 (interface_method_declaration): Ditto.
4626 (interface_declaration): Ditto.
4628 2001-09-05 Miguel de Icaza <miguel@ximian.com>
4630 * class.cs (Method::Define): Track the "static Main" definition to
4631 create an entry point.
4633 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
4634 EntryPoint if we find it.
4636 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
4637 (EmitContext::ig): Make this variable public.
4639 * driver.cs: Make the default output file be the first file name
4640 with the .exe extension.
4642 Detect empty compilations
4644 Handle various kinds of output targets. Handle --target and
4645 rename -t to --dumper.
4647 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
4648 methods inherited from Expression return now an Expression. This
4649 will is used during the tree rewriting as we resolve them during
4652 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
4653 the spec. Missing entirely is the information about
4654 accessability of elements of it.
4656 (Expression::ExprClassFromMemberInfo): New constructor for
4657 Expressions that creates a fully initialized Expression based on
4658 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
4661 (Invocation::Resolve): Begin implementing resolution of invocations.
4663 * literal.cs (StringLiteral): Implement Emit.
4665 2001-09-05 Ravi Pratap <ravi@ximian.com>
4667 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
4670 2001-09-04 Ravi Pratap <ravi@ximian.com>
4672 * cs-parser.jay (attribute_arguments): Implement actions.
4673 (attribute): Fix bug in production. Implement action.
4674 (attribute_list): Implement.
4675 (attribute_target): Implement.
4676 (attribute_target_specifier, opt_target_specifier): Implement
4677 (CheckAttributeTarget): New method to check if the attribute target
4679 (attribute_section): Implement.
4680 (opt_attributes): Implement.
4682 * attribute.cs : New file to handle attributes.
4683 (Attribute): Class to hold attribute info.
4685 * cs-parser.jay (opt_attribute_target_specifier): Remove production
4686 (attribute_section): Modify production to use 2 different rules to
4687 achieve the same thing. 1 s/r conflict down !
4688 Clean out commented, useless, non-reducing dimension_separator rules.
4690 * class.cs (TypeContainer.attributes): New member to hold list
4691 of attributes for a type.
4692 (Struct::Struct): Modify to take one more argument, the attribute list.
4693 (Class::Class): Ditto.
4694 (Field::Field): Ditto.
4695 (Method::Method): Ditto.
4696 (Property::Property): Ditto.
4698 * cs-parser.jay (struct_declaration): Update constructor call to
4699 pass in the attributes too.
4700 (class_declaration): Ditto.
4701 (constant_declaration): Ditto.
4702 (field_declaration): Ditto.
4703 (method_header): Ditto.
4704 (fixed_parameter): Ditto.
4705 (parameter_array): Ditto.
4706 (property_declaration): Ditto.
4708 * constant.cs (Constant::Constant): Update constructor similarly.
4709 Use System.Collections.
4711 * parameter.cs (Parameter::Parameter): Update as above.
4713 2001-09-02 Ravi Pratap <ravi@ximian.com>
4715 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
4716 (TypeContainer.delegates): New member to hold list of delegates.
4718 * cs-parser.jay (delegate_declaration): Implement the action correctly
4719 this time as I seem to be on crack ;-)
4721 2001-09-02 Miguel de Icaza <miguel@ximian.com>
4723 * rootcontext.cs (RootContext::IsNamespace): new function, used to
4724 tell whether an identifier represents a namespace.
4726 * expression.cs (NamespaceExpr): A namespace expression, used only
4727 temporarly during expression resolution.
4728 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
4729 utility functions to resolve names on expressions.
4731 2001-09-01 Miguel de Icaza <miguel@ximian.com>
4733 * codegen.cs: Add hook for StatementExpressions.
4735 * class.cs: Fix inverted test for static flag in methods.
4737 2001-09-02 Ravi Pratap <ravi@ximian.com>
4739 * class.cs (Operator::CheckUnaryOperator): Correct error number used
4740 to make it coincide with MS' number.
4741 (Operator::CheckBinaryOperator): Ditto.
4743 * ../errors/errors.txt : Remove error numbers added earlier.
4745 * ../errors/cs1019.cs : Test case for error # 1019
4747 * ../errros/cs1020.cs : Test case for error # 1020
4749 * cs-parser.jay : Clean out commented cruft.
4750 (dimension_separators, dimension_separator): Comment out. Ostensibly not
4751 used anywhere - non-reducing rule.
4752 (namespace_declarations): Non-reducing rule - comment out.
4754 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
4755 with TypeContainer::AddEnum.
4757 * delegate.cs : New file for delegate handling classes.
4758 (Delegate): Class for declaring delegates.
4760 * makefile : Update.
4762 * cs-parser.jay (delegate_declaration): Implement.
4764 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
4766 * class.cs (Event::Define): Implement.
4767 (Event.EventBuilder): New member.
4769 * class.cs (TypeContainer::Populate): Update to define all enums and events
4771 (Events): New property for the events arraylist we hold. Shouldn't we move to using
4772 readonly fields for all these cases ?
4774 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4776 * class.cs (Property): Revamp to use the convention of making fields readonly.
4777 Accordingly modify code elsewhere.
4779 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
4780 the Define method of the Property class.
4782 * class.cs : Clean up applied patch and update references to variables etc. Fix
4784 (TypeContainer::Populate): Update to define all the properties we have. Also
4785 define all enumerations.
4787 * enum.cs (Define): Implement.
4789 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
4791 * cs-parser.jay (overloadable_operator): The semantic value is an
4792 enum of the Operator class.
4793 (operator_declarator): Implement actions.
4794 (operator_declaration): Implement.
4796 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
4797 validity of definitions.
4798 (Operator::CheckBinaryOperator): Static method to check for binary operators
4799 (TypeContainer::AddOperator): New method to add an operator to a type.
4801 * cs-parser.jay (indexer_declaration): Added line to actually call the
4802 AddIndexer method so it gets added ;-)
4804 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
4805 already taken care of by the MS compiler ?
4807 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4809 * class.cs (Operator): New class for operator declarations.
4810 (Operator::OpType): Enum for the various operators.
4812 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
4814 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
4815 ostensibly handle this in semantic analysis.
4817 * cs-parser.jay (general_catch_clause): Comment out
4818 (specific_catch_clauses, specific_catch_clause): Ditto.
4819 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
4820 (catch_args, opt_catch_args): New productions.
4821 (catch_clause): Rewrite to use the new productions above
4822 (catch_clauses): Modify accordingly.
4823 (opt_catch_clauses): New production to use in try_statement
4824 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
4825 and re-write the code in the actions to extract the specific and
4826 general catch clauses by being a little smart ;-)
4828 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
4829 Hooray, try and catch statements parse fine !
4831 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4833 * statement.cs (Block::GetVariableType): Fix logic to extract the type
4834 string from the hashtable of variables.
4836 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
4837 I end up making that mistake ;-)
4838 (catch_clauses): Fixed gross error which made Key and Value of the
4839 DictionaryEntry the same : $1 !!
4841 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4843 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
4845 * cs-parser.jay (event_declaration): Correct to remove the semicolon
4846 when the add and remove accessors are specified.
4848 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
4850 * cs-parser.jay (IndexerDeclaration): New helper class to hold
4851 information about indexer_declarator.
4852 (indexer_declarator): Implement actions.
4853 (parsing_indexer): New local boolean used to keep track of whether
4854 we are parsing indexers or properties. This is necessary because
4855 implicit_parameters come into picture even for the get accessor in the
4857 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
4859 * class.cs (Indexer): New class for indexer declarations.
4860 (TypeContainer::AddIndexer): New method to add an indexer to a type.
4861 (TypeContainer::indexers): New member to hold list of indexers for the
4864 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4866 * cs-parser.jay (add_accessor_declaration): Implement action.
4867 (remove_accessor_declaration): Implement action.
4868 (event_accessors_declaration): Implement
4869 (variable_declarators): swap statements for first rule - trivial.
4871 * class.cs (Event): New class to hold information about event
4873 (TypeContainer::AddEvent): New method to add an event to a type
4874 (TypeContainer::events): New member to hold list of events.
4876 * cs-parser.jay (event_declaration): Implement actions.
4878 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
4880 * cs-parser.jay (dim_separators): Implement. Make it a string
4881 concatenating all the commas together, just as they appear.
4882 (opt_dim_separators): Modify accordingly
4883 (rank_specifiers): Update accordingly. Basically do the same
4884 thing - instead, collect the brackets here.
4885 (opt_rank_sepcifiers): Modify accordingly.
4886 (array_type): Modify to actually return the complete type string
4887 instead of ignoring the rank_specifiers.
4888 (expression_list): Implement to collect the expressions
4889 (variable_initializer): Implement. We make it a list of expressions
4890 essentially so that we can handle the array_initializer case neatly too.
4891 (variable_initializer_list): Implement.
4892 (array_initializer): Make it a list of variable_initializers
4893 (opt_array_initializer): Modify accordingly.
4895 * expression.cs (New::NType): Add enumeration to help us
4896 keep track of whether we have an object/delegate creation
4897 or an array creation.
4898 (New:NewType, New::Rank, New::Indices, New::Initializers): New
4899 members to hold data about array creation.
4900 (New:New): Modify to update NewType
4901 (New:New): New Overloaded contructor for the array creation
4904 * cs-parser.jay (array_creation_expression): Implement to call
4905 the overloaded New constructor.
4907 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
4909 * class.cs (TypeContainer::Constructors): Return member
4910 constructors instead of returning null.
4912 2001-08-26 Miguel de Icaza <miguel@ximian.com>
4914 * typemanager.cs (InitCoreTypes): Initialize the various core
4915 types after we have populated the type manager with the user
4916 defined types (this distinction will be important later while
4917 compiling corlib.dll)
4919 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
4920 on Expression Classification. Now all expressions have a method
4921 `Resolve' and a method `Emit'.
4923 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
4924 generation from working. Also add some temporary debugging
4927 2001-08-24 Miguel de Icaza <miguel@ximian.com>
4929 * codegen.cs: Lots of code generation pieces. This is only the
4930 beginning, will continue tomorrow with more touches of polish. We
4931 handle the fundamentals of if, while, do, for, return. Others are
4932 trickier and I need to start working on invocations soon.
4934 * gen-treedump.cs: Bug fix, use s.Increment here instead of
4937 * codegen.cs (EmitContext): New struct, used during code
4938 emission to keep a context. Most of the code generation will be
4941 * cs-parser.jay: Add embedded blocks to the list of statements of
4942 this block. So code generation proceeds in a top down fashion.
4944 2001-08-23 Miguel de Icaza <miguel@ximian.com>
4946 * statement.cs: Add support for multiple child blocks.
4948 2001-08-22 Miguel de Icaza <miguel@ximian.com>
4950 * codegen.cs (EmitCode): New function, will emit the code for a
4951 Block of code given a TypeContainer and its ILGenerator.
4953 * statement.cs (Block): Standard public readonly optimization.
4954 (Block::Block constructors): Link children.
4955 (Block::Child): Child Linker.
4956 (Block::EmitVariables): Emits IL variable declarations.
4958 * class.cs: Drop support for MethodGroups here, delay until
4960 (Method::): Applied the same simplification that I did before, and
4961 move from Properties to public readonly fields.
4962 (Method::ParameterTypes): Returns the parameter types for the
4963 function, and implements a cache that will be useful later when I
4964 do error checking and the semantic analysis on the methods is
4966 (Constructor::GetCallingConvention): Renamed from CallingConvetion
4967 and made a method, optional argument tells whether this is a class
4968 or a structure to apply the `has-this' bit.
4969 (Method::GetCallingConvention): Implement, returns the calling
4971 (Method::Define): Defines the type, a second pass is performed
4972 later to populate the methods.
4974 (Constructor::ParameterTypes): implement a cache similar to the
4975 one on Method::ParameterTypes, useful later when we do semantic
4978 (TypeContainer::EmitMethod): New method. Emits methods.
4980 * expression.cs: Removed MethodGroup class from here.
4982 * parameter.cs (Parameters::GetCallingConvention): new method.
4984 2001-08-21 Miguel de Icaza <miguel@ximian.com>
4986 * class.cs (TypeContainer::Populate): Drop RootContext from the
4989 (Constructor::CallingConvention): Returns the calling convention.
4990 (Constructor::ParameterTypes): Returns the constructor parameter
4993 (TypeContainer::AddConstructor): Keep track of default constructor
4994 and the default static constructor.
4996 (Constructor::) Another class that starts using `public readonly'
4997 instead of properties.
4999 (Constructor::IsDefault): Whether this is a default constructor.
5001 (Field::) use readonly public fields instead of properties also.
5003 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
5004 track of static constructors; If none is used, turn on
5005 BeforeFieldInit in the TypeAttributes.
5007 * cs-parser.jay (opt_argument_list): now the return can be null
5008 for the cases where there are no arguments.
5010 (constructor_declarator): If there is no implicit `base' or
5011 `this', then invoke the default parent constructor.
5013 * modifiers.cs (MethodAttr): New static function maps a set of
5014 modifiers flags into a MethodAttributes enum
5015 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
5016 MethodAttr, TypeAttr to represent the various mappings where the
5018 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
5020 2001-08-19 Miguel de Icaza <miguel@ximian.com>
5022 * parameter.cs (GetParameterInfo): Fix bug where there would be no
5025 * interface.cs (PopulateIndexer): Implemented the code generator
5026 for interface indexers.
5028 2001-08-17 Miguel de Icaza <miguel@ximian.com>
5030 * interface.cs (InterfaceMemberBase): Now we track the new status
5033 (PopulateProperty): Implement property population. Woohoo! Got
5034 Methods and Properties going today.
5036 Removed all the properties for interfaces, and replaced them with
5037 `public readonly' fields.
5039 2001-08-16 Miguel de Icaza <miguel@ximian.com>
5041 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
5042 initialize their hashtables/arraylists only when they are needed
5043 instead of doing this always.
5045 * parameter.cs: Handle refs and out parameters.
5047 * cs-parser.jay: Use an ArrayList to construct the arguments
5048 instead of the ParameterCollection, and then cast that to a
5051 * parameter.cs: Drop the use of ParameterCollection and use
5052 instead arrays of Parameters.
5054 (GetParameterInfo): Use the Type, not the Name when resolving
5057 2001-08-13 Miguel de Icaza <miguel@ximian.com>
5059 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
5060 and instead use public readonly fields.
5062 * class.cs: Put back walking code for type containers.
5064 2001-08-11 Miguel de Icaza <miguel@ximian.com>
5066 * class.cs (MakeConstant): Code to define constants.
5068 * rootcontext.cs (LookupType): New function. Used to locate types
5071 2001-08-08 Miguel de Icaza <miguel@ximian.com>
5073 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
5074 this System.Reflection code is. Kudos to Microsoft
5076 * typemanager.cs: Implement a type cache and avoid loading all
5077 types at boot time. Wrap in LookupType the internals. This made
5078 the compiler so much faster. Wow. I rule!
5080 * driver.cs: Make sure we always load mscorlib first (for
5081 debugging purposes, nothing really important).
5083 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
5084 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
5086 * rootcontext.cs: Lookup types on their namespace; Lookup types
5087 on namespaces that have been imported using the `using' keyword.
5089 * class.cs (TypeContainer::TypeAttr): Virtualize.
5090 (Class::TypeAttr): Return attributes suitable for this bad boy.
5091 (Struct::TypeAttr): ditto.
5092 Handle nested classes.
5093 (TypeContainer::) Remove all the type visiting code, it is now
5094 replaced with the rootcontext.cs code
5096 * rootcontext.cs (GetClassBases): Added support for structs.
5098 2001-08-06 Miguel de Icaza <miguel@ximian.com>
5100 * interface.cs, statement.cs, class.cs, parameter.cs,
5101 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
5102 Drop use of TypeRefs, and use strings instead.
5104 2001-08-04 Miguel de Icaza <miguel@ximian.com>
5108 * class.cs (Struct::Struct): set the SEALED flags after
5109 checking the modifiers.
5110 (TypeContainer::TypeAttr): new property, returns the
5111 TypeAttributes for a class.
5113 * cs-parser.jay (type_list): Oops, list production was creating a
5114 new list of base types.
5116 * rootcontext.cs (StdLib): New property.
5117 (GetInterfaceTypeByName): returns an interface by type name, and
5118 encapsulates error handling here.
5119 (GetInterfaces): simplified.
5120 (ResolveTree): Encapsulated all the tree resolution here.
5121 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
5124 * driver.cs: Add support for --nostdlib, to avoid loading the
5126 (Main): Do not put tree resolution here.
5128 * rootcontext.cs: Beginning of the class resolution.
5130 2001-08-03 Miguel de Icaza <miguel@ximian.com>
5132 * rootcontext.cs: Provide better error reporting.
5134 * cs-parser.jay (interface_base): set our $$ to be interfaces.
5136 * rootcontext.cs (CreateInterface): Handle the case where there
5137 are no parent interfaces.
5139 (CloseTypes): Routine to flush types at the end.
5140 (CreateInterface): Track types.
5141 (GetInterfaces): Returns an array of Types from the list of
5144 * typemanager.c (AddUserType): Mechanism to track user types (puts
5145 the type on the global type hash, and allows us to close it at the
5148 2001-08-02 Miguel de Icaza <miguel@ximian.com>
5150 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
5151 RecordInterface instead.
5153 * cs-parser.jay: Updated to reflect changes above.
5155 * decl.cs (Definition): Keep track of the TypeBuilder type that
5156 represents this type here. Not sure we will use it in the long
5157 run, but wont hurt for now.
5159 * driver.cs: Smaller changes to accomodate the new code.
5161 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
5164 * rootcontext.cs (CreateInterface): New method, used to create
5165 the System.TypeBuilder type for interfaces.
5166 (ResolveInterfaces): new entry point to resolve the interface
5168 (CodeGen): Property, used to keep track of the code generator.
5170 2001-07-26 Miguel de Icaza <miguel@ximian.com>
5172 * cs-parser.jay: Add a second production for delegate_declaration
5175 (enum_body): Put an opt_comma here instead of putting it on
5176 enum_body or enum_member_declarations so we can handle trailing
5177 commas on enumeration members. Gets rid of a shift/reduce.
5179 (type_list): Need a COMMA in the middle.
5181 (indexer_declaration): Tell tokenizer to recognize get/set
5183 * Remove old targets.
5185 * Re-add the parser target.
5187 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5189 * cs-parser.jay: Add precendence rules for a number of operators
5190 ot reduce the number of shift/reduce conflicts in the grammar.
5192 2001-07-17 Miguel de Icaza <miguel@ximian.com>
5194 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
5197 Get rid of old crufty code.
5199 * rootcontext.cs: Use this to keep track of the parsed
5200 representation and the defined types available to the program.
5202 * gen-treedump.cs: adjust for new convention.
5204 * type.cs: Split out the type manager, and the assembly builder
5207 * typemanager.cs: the type manager will live here now.
5209 * cil-codegen.cs: And the code generator here.
5211 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
5213 * makefile: Fixed up for easy making.
5215 2001-07-13 Simon Cozens <simon@simon-cozens.org>
5217 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
5220 (unary_expression): Expand pre_increment_expression and
5221 post_decrement_expression to reduce a shift/reduce.
5223 2001-07-11 Simon Cozens
5225 * cs-tokenizer.cs: Hex numbers should begin with a 0.
5227 Improve allow_keyword_as_indent name.
5229 2001-06-19 Miguel de Icaza <miguel@ximian.com>
5231 * Adjustments for Beta2.
5233 2001-06-13 Miguel de Icaza <miguel@ximian.com>
5235 * decl.cs: Added `Define' abstract method.
5236 (InTransit): new property, used to catch recursive definitions.
5238 * interface.cs: Implement `Define'.
5240 * modifiers.cs: Map Modifiers.constants to
5241 System.Reflection.TypeAttribute flags.
5243 * class.cs: Keep track of types and user-defined types.
5244 (BuilderInit): New method for creating an assembly
5245 (ResolveType): New function to launch the resolution process, only
5246 used by interfaces for now.
5248 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
5249 that are inserted into the name space.
5251 2001-06-08 Miguel de Icaza <miguel@ximian.com>
5253 * ARGH. I have screwed up my tree so many times due to the use of
5254 rsync rather than using CVS. Going to fix this at once.
5256 * driver.cs: Objetify driver. Load assemblies, use assemblies to
5259 2001-06-07 Miguel de Icaza <miguel@ximian.com>
5261 * Experiment successful: Use System.Type rather that our own
5264 2001-05-25 Miguel de Icaza <miguel@ximian.com>
5266 * cs-parser.jay: Removed nsAliases from here.
5268 Use new namespaces, handle `using XXX;'
5270 * namespace.cs: Reimplemented namespace handling, use a recursive
5271 definition of the class. Now we can keep track of using clauses
5272 and catch invalid using clauses.
5274 2001-05-24 Miguel de Icaza <miguel@ximian.com>
5276 * gen-treedump.cs: Adapted for all the renaming.
5278 * expression.cs (Expression): this class now has a Type property
5279 which returns an expression Type.
5281 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
5282 `Type', as this has a different meaning now in the base
5284 2001-05-22 Miguel de Icaza <miguel@ximian.com>
5286 * interface.cs, class.cs: Removed from all the sources the
5287 references to signature computation, as we can not do method
5288 signature computation during the parsing time, as we are not
5289 trying to solve at that point distinguishing:
5293 void a (NS.Blah x) {}
5296 Which depending on the context might be valid or not, as we do not
5297 know if Blah is the same thing as NS.Blah at that point.
5299 * Redid everything so the code uses TypeRefs now instead of
5300 Types. TypeRefs are just temporary type placeholders, that need
5301 to be resolved. They initially have a pointer to a string and the
5302 current scope in which they are used. This is used later by the
5303 compiler to resolve the reference to an actual Type.
5305 * DeclSpace is no longer a CIR.Type, and neither are
5306 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
5307 are all DeclSpaces, but no Types.
5309 * type.cs (TypeRefManager): This implements the TypeRef manager,
5310 which keeps track of all the types that need to be resolved after
5311 the parsing has finished.
5313 2001-05-13 Miguel de Icaza <miguel@ximian.com>
5315 * ARGH. We are going to have to store `foreach' as a class rather
5316 than resolving it, as we need to verify error 1579 after name
5317 resolution. *OR* we could keep a flag that says `This request to
5318 IEnumerator comes from a foreach statement' which we can then use
5319 to generate the error.
5321 2001-05-10 Miguel de Icaza <miguel@ximian.com>
5323 * class.cs (TypeContainer.AddMethod): we now add methods to the
5324 MethodGroup instead of the method hashtable.
5326 * expression.cs: Add MethodGroup abstraction, which gets us one
5327 step closer to the specification in the way we handle method
5330 * cs-parser.jay (primary_expression): qualified_identifier now
5331 tried to match up an identifier to a local variable reference or
5332 to a parameter reference.
5334 current_local_parameters is now a parser global variable that
5335 points to the current parameters for the block, used during name
5338 (property_declaration): Now creates an implicit `value' argument to
5341 2001-05-09 Miguel de Icaza <miguel@ximian.com>
5343 * parameter.cs: Do not use `param' arguments as part of the
5344 signature, per the spec.
5346 2001-05-08 Miguel de Icaza <miguel@ximian.com>
5348 * decl.cs: Base class for classes, structs and interfaces. This
5349 is the "Declaration Space"
5351 * cs-parser.jay: Use CheckDef for checking declaration errors
5352 instead of having one on each function.
5354 * class.cs: Factor out some code for handling error handling in
5355 accordance to the "Declarations" section in the "Basic Concepts"
5356 chapter in the ECMA C# spec.
5358 * interface.cs: Make all interface member classes derive from
5359 InterfaceMemberBase.
5361 2001-05-07 Miguel de Icaza <miguel@ximian.com>
5363 * Many things: all interfaces are parsed and generated in
5364 gen-treedump. Support for member variables, constructors,
5365 destructors, properties, constants is there.
5367 Beginning of the IL backend, but very little done, just there for
5370 2001-04-29 Miguel de Icaza <miguel@ximian.com>
5372 * cs-parser.jay: Fix labeled statement.
5374 * cs-tokenizer.cs (escape): Escape " and ' always.
5375 ref_line, ref_name: keep track of the line/filename as instructed
5376 by #line by the compiler.
5379 2001-04-27 Miguel de Icaza <miguel@ximian.com>
5381 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
5382 to match the values in System.CodeDOM.
5384 Divid renamed to Divide.
5386 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
5388 (Statements.set): remove.
5390 * System.CodeDOM/CodeCatchClause.cs: always have a valid
5393 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
5394 falseStatements always have valid values.
5396 * cs-parser.jay: Use System.CodeDOM now.