1 2002-06-29 Martin Baulig <martin@gnome.org>
3 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
4 is the NullLiteral, we also need to make sure that target_type is not
7 2002-06-29 Martin Baulig <martin@gnome.org>
9 * rootcontext.cs (RootContext.ResolveCore): We must initialize
10 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
11 before calling BootstrapCorlib_ResolveDelegate ().
13 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15 * statement.cs: fixed build-breaker. All tests passed ok.
17 2002-06-27 Martin Baulig <martin@gnome.org>
19 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
20 for System.Decimal when compiling corlib.
22 2002-06-27 Martin Baulig <martin@gnome.org>
24 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
25 switch blocks which contain nothing but a default clause.
27 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
29 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
31 2002-06-27 Martin Baulig <martin@gnome.org>
33 * ecore.cs (PropertyExpr.PropertyExpr): Call
34 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
36 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
37 is already a TypeBuilder.
39 2002-06-27 Martin Baulig <martin@gnome.org>
41 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
42 `target_type == TypeManager.array_type', not IsAssignableFrom() in
43 the "from an array-type to System.Array" case. This makes it work
44 when compiling corlib.
46 2002-06-27 Martin Baulig <martin@gnome.org>
48 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
49 non-static PropertyExpr, set its InstanceExpression. This makes
50 the `ICollection.Count' property work in System/Array.cs.
52 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
54 * driver.cs: Made error handling more consistent. Errors now
55 tracked by Report class, so many methods which used to return int
56 now return void. Main() now prints success/failure and
57 errors/warnings message.
59 Renamed '--probe' compiler argument to '--expect-error'. Removed
60 the magic number return values (123 and 124). Now, if the
61 expected error occurs, the compiler exits with success (exit value
62 0). If the compilation completes without seeing that particular
63 error, the compiler exits with failure (exit value 1). The
64 makefile in mcs/errors has been changed to handle the new behaviour.
66 * report.cs: Made 'expected error' number a property and renamed
67 it from 'Probe' to 'ExpectedError'.
69 * genericparser.cs: Removed error handling support, since it is
70 now all done by Report class.
72 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
73 class, so parse() no longer returns an int.
75 * namespace.cs: Use Report.Error instead of GenericParser.error
78 2002-06-22 Miguel de Icaza <miguel@ximian.com>
80 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
81 TypeContainer.AddOperator): At the front of the list put the
82 explicit implementations, so they get resolved/defined first.
84 2002-06-21 Miguel de Icaza <miguel@ximian.com>
86 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
87 interface type is implemented by this TypeContainer. Used during
88 explicit interface implementation.
90 (Property.Define, Indexer.Define, Method.Define): Validate that
91 the given interface in the explicit implementation is one of the
92 base classes for the containing type.
94 Also if we are explicitly implementing an interface, but there is
95 no match in the pending implementation table, report an error.
97 (Property.Define): Only define the property if we are
98 not explicitly implementing a property from an interface. Use the
99 correct name also for those properties (the same CSC uses,
100 although that is really not needed).
102 (Property.Emit): Do not emit attributes for explicitly implemented
103 properties, as there is no TypeBuilder.
105 (Indexer.Emit): ditto.
107 Hiding then means that we do not really *implement* a pending
108 implementation, which makes code fail.
110 2002-06-22 Martin Baulig <martin@gnome.org>
112 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
113 the return value of Object.GetType(). [FIXME: we need to do this whenever
114 we get a type back from the reflection library].
116 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
118 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
120 2002-06-20 Miguel de Icaza <miguel@ximian.com>
122 * attribute.cs: Return null if we can not look up the type.
124 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
125 the interface types found.
127 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
128 interface types found.
130 * typemanager.cs (GetInterfaces): Make this routine returns alll
131 the interfaces and work around the lame differences between
132 System.Type and System.Reflection.Emit.TypeBuilder in the results
133 result for GetInterfaces.
135 (ExpandInterfaces): Given an array of interface types, expand and
136 eliminate repeated ocurrences of an interface. This expands in
137 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
140 2002-06-21 Martin Baulig <martin@gnome.org>
142 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
145 2002-06-21 Martin Baulig <martin@gnome.org>
147 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
148 and called with one of the core types, return the corresponding typebuilder for
151 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
154 2002-06-21 Martin Baulig <martin@gnome.org>
156 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
157 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
158 (Expression.ConvertReferenceExplicit): Likewise.
160 * expression.cs (ElementAccess.DoResolve): Likewise.
161 (ElementAccess.DoResolveLValue): Likewise.
163 2002-06-10 Martin Baulig <martin@gnome.org>
165 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
166 add the "value" parameter to the parameter list.
168 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
171 2002-06-19 Miguel de Icaza <miguel@ximian.com>
173 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
174 the argument to an int, uint, long or ulong, per the spec. Also
175 catch negative constants in array creation.
177 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
179 * class.cs: do not allow the same interface to appear twice in
182 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
184 * ecore.cs: don't use ldlen with System.Array.
186 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
188 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
190 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
192 * modifiers.cs: produce correct field attributes for protected
193 internal. Easy fix so miguel can work on ther harder stuff:-)
195 2002-06-18 Miguel de Icaza <miguel@ximian.com>
197 * pending.cs: New file. Move the code from class.cs here.
198 Support clearning the pending flag for all methods (when not doing
199 explicit interface implementation).
201 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
203 * rootcontext.cs: added a couple more types needed to bootstrap.
205 2002-06-17 Miguel de Icaza <miguel@ximian.com>
207 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
208 constructor in the type, instead of any constructor in the type
209 hierarchy. Thanks to Paolo for finding this bug (it showed up as
210 a bug in the Mono runtime when applying the params attribute).
212 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
213 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
215 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
217 * expression.cs (Unary.ResolveOperator): Use TypeManager
220 2002-06-13 Ravi Pratap <ravi@ximian.com>
222 * cs-parser.jay (enum_member_declaration): Pass in the attributes
225 * enum.cs (AddEnumMember): Add support to store the attributes associated
226 with each member too.
228 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
229 field builders too - this takes care of the enum member case.
231 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
233 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
234 address-of operator on both value types and pointers.
236 2002-06-10 Martin Baulig <martin@gnome.org>
238 * interface.cs (Interface.PopulateIndexer): Add the indexer's
239 PropertyBuilder to the `property_builders' list.
241 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
242 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
243 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
244 find any indexers which are inherited from an interface.
246 2002-06-09 Martin Baulig <martin@gnome.org>
248 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
249 the same type as the constant if necessary. There's also a test-130.cs
252 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
254 * typemanager.cs (TypeManager.ChangeType): Previously known as
255 Enum.ChangeEnumType().
257 2002-06-09 Martin Baulig <martin@gnome.org>
259 * expression.cs (Cast.TryReduce): Added support for consts.
261 2002-06-08 Ravi Pratap <ravi@ximian.com>
263 * class.cs (Accessor): Hold attributes information so we can pass
266 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
267 Modify to pass in attributes attached to the methods.
269 (add_accessor_declaration, remove_accessor_declaration): Ditto.
271 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
272 to handle the Accessor kind :-)
274 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
276 2002-06-08 Martin Baulig <martin@gnome.org>
278 * expression.cs (Unary.TryReduceNegative): Added support for
281 2002-06-08 Martin Baulig <martin@gnome.org>
283 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
284 name can't be found in the `defined_names' - the caller will do a
285 MemberLookup in this case and thus find methods in System.Enum
286 such as Enum.IsDefined().
288 2002-06-08 Martin Baulig <martin@gnome.org>
290 * enum.cs (Enum.ChangeEnumType): This is a custom version of
291 Convert.ChangeType() which works with TypeBuilder created types.
292 (Enum.LookupEnumValue, Enum.Define): Use it here.
294 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
295 `TypeBuilder.BaseType != null' check.
296 (TypeContainer.FindMembers): Only lookup parent members if we
297 actually have a parent.
298 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
299 (ConstructorInitializer.Resolve): Likewise.
301 * interface.cs (Interface.FindMembers): Added
302 `TypeBuilder.BaseType != null' check.
304 * rootcontext.cs (RootContext.ResolveCore): Added
305 "System.Runtime.CompilerServices.IndexerNameAttribute" to
306 classes_second_stage.
308 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
309 debug_type and trace_type when compiling with --nostdlib.
311 2002-06-07 Martin Baulig <martin@gnome.org>
313 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
314 (AddField): Set it to true when adding a non-static field.
315 (DefineType): Use `have_nonstatic_fields' to find out whether we
316 have non-static fields, not `Fields != null'.
318 2002-06-02 Miguel de Icaza <miguel@ximian.com>
320 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
321 dereferencing a null on the static-field code path)
323 2002-05-30 Martin Baulig <martin@gnome.org>
325 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
326 to take command line arguments. Use reflection to call the new
327 custom `Initialize' function on the symbol writer and pass it the
328 command line arguments.
330 * driver.cs (--debug-args): New command line argument to pass command
331 line arguments to the symbol writer.
333 2002-05-28 Miguel de Icaza <miguel@ximian.com>
335 * assign.cs (DoResolve): Forgot to do the implicit conversion to
336 the target type for indexers and properties. Thanks to Joe for
339 2002-05-27 Miguel de Icaza <miguel@ximian.com>
341 * typemanager.cs (MethodFlags): returns the method flags
342 (Obsolete/ShouldIgnore) that control warning emission and whether
343 the invocation should be made, or ignored.
345 * expression.cs (Invocation.Emit): Remove previous hack, we should
346 not do this on matching a base type, we should do this based on an attribute
348 Only emit calls to System.Diagnostics.Debug and
349 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
352 * rootcontext.cs: Global settings for tracing and debugging.
354 * cs-tokenizer.cs (define): New utility function to track
355 defines. Set the global settings for TRACE and DEBUG if found.
357 2002-05-25 Ravi Pratap <ravi@ximian.com>
359 * interface.cs (Populate*): Pass in the TypeContainer as well as
360 the DeclSpace as parameters so that we can create EmitContexts and
361 then use that to apply attributes etc.
363 (PopulateMethod, PopulateEvent, PopulateProperty)
364 (PopulateIndexer): Apply attributes everywhere.
366 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
369 (ApplyAttributes): Update accordingly.
371 We now apply interface attributes for all members too.
373 2002-05-26 Miguel de Icaza <miguel@ximian.com>
375 * class.cs (Indexer.Define); Correctly check if we are explicit
376 implementation (instead of checking the Name for a ".", we
377 directly look up if the InterfaceType was specified).
379 Delay the creation of the PropertyBuilder.
381 Only create the PropertyBuilder if we are not an explicit
382 interface implementation. This means that explicit interface
383 implementation members do not participate in regular function
384 lookups, and hence fixes another major ambiguity problem in
385 overload resolution (that was the visible effect).
387 (DefineMethod): Return whether we are doing an interface
390 * typemanager.cs: Temporary hack until we get attributes in
391 interfaces (Ravi is working on that) and we get IndexerName
392 support in interfaces.
394 * interface.cs: Register the indexers as properties.
396 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
397 warning, I have verified that this is a bug in the .NET runtime
398 (JavaScript suffers of the same problem).
400 * typemanager.cs (MemberLookup): When looking up members for
401 interfaces, the parent of an interface is the implicit
402 System.Object (so we succeed in searches of Object methods in an
403 interface method invocation. Example: IEnumerable x; x.ToString
406 2002-05-25 Miguel de Icaza <miguel@ximian.com>
408 * class.cs (Event): Events should also register if they do
409 implement the methods that an interface requires.
411 * typemanager.cs (MemberLookup); use the new GetInterfaces
414 (GetInterfaces): The code used to lookup interfaces for a type is
415 used in more than one place, factor it here.
417 * driver.cs: Track the errors at the bottom of the file, we kept
420 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
421 instance if the method we are calling is static!
423 2002-05-24 Miguel de Icaza <miguel@ximian.com>
425 * attribute.cs (ApplyAttributes): Make this function filter out
426 the IndexerName attribute (as that attribute in reality is never
427 applied) and return the string constant for the IndexerName
430 * class.cs (TypeContainer.Emit): Validate that all the indexers
431 have the same IndexerName attribute, and if so, set the
432 DefaultName attribute on the class.
434 * typemanager.cs: The return value might contain other stuff (not
435 only methods). For instance, consider a method with an "Item"
436 property and an Item method.
438 * class.cs: If there is a problem with the parameter types,
441 2002-05-24 Ravi Pratap <ravi@ximian.com>
443 * ecore.cs (ImplicitConversionExists): Wrapper function which also
444 looks at user defined conversion after making a call to
445 StandardConversionExists - we need this for overload resolution.
447 * expression.cs : Update accordingly the various method calls.
449 This fixes 2 bugs filed against implicit user defined conversions
451 2002-05-22 Miguel de Icaza <miguel@ximian.com>
453 * statement.cs: Track the result of the assignment.
455 2002-05-21 Miguel de Icaza <miguel@ximian.com>
457 * expression.cs (MemberAccess): Improved error reporting for
458 inaccessible members.
460 2002-05-22 Martin Baulig <martin@gnome.org>
462 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
463 itself with debugging support.
465 2002-05-22 Martin Baulig <martin@gnome.org>
467 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
468 Removed, this isn't needed anymore.
470 2002-05-20 Martin Baulig <martin@gnome.org>
472 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
473 be underlying type for an enum.
475 2002-05-20 Miguel de Icaza <miguel@ximian.com>
477 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
478 that splits out the loading of just the core types.
480 * rootcontext.cs (ResolveCore): Split the struct resolution in
481 two, so we can load the enumeration underlying types before any
484 * expression.cs (Is): Bandaid until we fix properly Switch (see
485 bug #24985 for details).
487 * typemanager.cs (ImplementsInterface): The hashtable will contain
488 a null if there are no interfaces implemented.
490 2002-05-18 Miguel de Icaza <miguel@ximian.com>
492 * cs-parser.jay (indexer_declarator): It is fine to have array
495 2002-05-17 Miguel de Icaza <miguel@ximian.com>
497 * typemanager.cs: (RegisterBuilder): New function used to register
498 TypeBuilders that implement interfaces. Since
499 TypeBuilder.GetInterfaces (as usual) does not work with lame
501 (AddUserType): register interfaces.
503 (ImplementsInterface): Use the builder_to_ifaces hash if we are
504 dealing with TypeBuilder. Also, arrays are showing up as
505 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
506 methods can not be invoked on them!
508 * ecore.cs (ExplicitReferenceConversionExists): Made public.
509 (ImplicitReferenceConversionExists): Split out from
510 StandardConversionExists.
512 * expression.cs (As): We were only implementing one of the three
513 cases for the as operator. We now implement them all.
514 (Is): Implement the various other cases for Is as well.
516 * typemanager.cs (CACHE): New define used to control if we want or
517 not the FindMembers cache. Seems to have a negative impact on
518 performance currently
520 (MemberLookup): Nested types have full acess to
521 enclosing type members
523 Remove code that coped with instance/static returns for events, we
524 now catch this in RealFindMembers.
526 (RealFindMembers): only perform static lookup if the instance
527 lookup did not return a type or an event.
529 2002-05-17 Miguel de Icaza <miguel@ximian.com>
531 * assign.cs (CompoundAssign): We pass more semantic information
532 now to Compound Assignments than we did before: now we have all
533 the information at hand, and now we resolve the target *before* we
534 do the expression expansion, which allows the "CacheValue" method
535 to have the effect we intended (before, a [x] += 1 would generate
536 two differen ArrayAccess expressions from the ElementAccess,
537 during the resolution process).
539 (CompoundAssign.DoResolve): Resolve target and original_source here.
541 2002-05-16 Miguel de Icaza <miguel@ximian.com>
543 * expression.cs (ArrayAccess): dropped debugging information.
545 * typemanager.cs: Small bug fix: I was always returning i_members,
546 instead of one of i_members or s_members (depending on which had
549 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
550 method is invoked before any code generation takes place, and it
551 is a mechanism to inform that the expression will be invoked more
552 than once, and that the method should use temporary values to
553 avoid having side effects
555 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
557 * ecore.cs (Expression.CacheTemporaries): Provide empty default
560 * expression.cs (Indirection, ArrayAccess): Add support for
561 CacheTemporaries in these two bad boys.
563 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
565 (StoreFromPtr): Handle stobj as well.
567 * expression.cs (UnaryMutator): Share more code.
569 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
570 down: I was not tracking the Filter function as well, which
571 was affecting the results of the cache.
573 2002-05-15 Miguel de Icaza <miguel@ximian.com>
575 * attribute.cs: Remove the hack to handle the CharSet property on
578 2002-05-14 Miguel de Icaza <miguel@ximian.com>
580 * attribute.cs (DoResolve): More uglyness, we now only try to
581 resolve the attribute partially, to extract the CharSet
582 information (only if we are a StructLayout attribute). Otherwise
584 (GetExtraTypeInfo): Add some code to conditionally kill in the
585 future this. I am more and more convinced that the .NET
586 framework has special code to handle the attribute setting on
589 * expression.cs (IsParamsMethodApplicable): Revert my previous
590 foreach change here, it was wrong.
592 2002-05-13 Miguel de Icaza <miguel@ximian.com>
594 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
595 (pp_expr): do not abort on unknown input, just return.
596 (eval): abort if there are pending chars.
598 * attribute.cs (Attribute.Resolve): Positional parameters are
599 optional. Deal with that case.
601 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
602 the Ansi/Unicode/Auto information for the type.
604 (TypeContainer.DefineType): instantiate the EmitContext here, as
605 we will be using it during the type definition (to resolve
606 attributes) and during the emit phase.
608 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
609 to pull type information out of the attributes
611 (Attribute.Resolve): track the constructor builder, and allow for
612 multiple invocations (structs and classes will use this).
614 * ecore.cs (MemberLookupFinal): new version with all the
615 parameters customizable.
617 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
618 constructors. Return if the result value is null (as the error
619 would have been flagged already by MemberLookupFinal)
621 Do not allow instances of abstract classes or interfaces to be
624 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
625 We have to compare the assembly property here when dealing with
626 FamANDAssem and Assembly access modifiers, because we might be
627 creating an assembly from *modules* (that means that we are not
628 getting TypeBuilders for types defined in other modules that are
629 part of this assembly).
631 (Method.Emit): If the method is marked abstract and has a body,
634 (TypeContainer.DefineMembers): If both the defined member and the
635 parent name match are methods, then do not emit any warnings: let
636 the Method.Define routine take care of flagging warnings. But if
637 there is a mismatch (method overrides something else, or method is
638 overriwritten by something, then emit warning).
640 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
641 set to null, this means `do not check for the return type on the
644 (Method.Define): set the return type for the method signature to
645 null, so that we get methods with the same name and parameters and
646 different return types. This is used to flag warning 114 (you are
647 hiding a method, and you probably want to use the new/override
650 * typemanager.cs (MemberLookup): Implemented proper access
651 control, closing a long standing set of bug reports. The problem
652 was that the Framework only has two bits: Public and NonPublic,
653 and NonPublic includes private and protected methods, but we need
654 to enforce the FamANDAssem, FamOrAssem and Family.
656 2002-05-11 Miguel de Icaza <miguel@ximian.com>
658 * statement.cs (GotoCase): Return true: Ammounts to giving up
659 knowledge on whether we return or not, and letting the other case
660 be responsible for it.
662 2002-05-10 Miguel de Icaza <miguel@ximian.com>
664 * driver.cs: Do not load directories for each file processed, only
665 do it if there is a pattern.
667 * ecore.cs: Report readonly assigns here as well, as we might have
668 been resolved only by MemberAccess.
670 (SimpleName.SimpleNameResolve): Also be useful for LValue
671 resolution. We need this to propagate assign to local readonly variables
673 * typemanager.cs: Use a ptrhashtable for the criteria, because we
674 do not want to reuse potential criteria memory.
676 * class.cs (MyEventBuilder): Set reflected_type;
678 * ecore.cs (Constantify): Added support for constifying bools.
680 (RootContext.LookupType): Added a cache for values looked up in
681 the declaration space.
683 * typemanager.cs (FindMembers): Now is a front-end to
684 RealFindMembers, and provides a two-level hashtable-based cache to
687 15% performance improvement: from 22.5 to 19.2 seconds.
689 * expression.cs (IsParamsMethodApplicable): use foreach.
690 (Invocation.DoResolve): ditto.
691 (New.DoResolve): ditto.
692 (ArrayCreation.DoResolve): ditto.
694 * ecore.cs (FindMostEncompassingType): use foreach.
696 * delegate.cs (NewDelegate.DoResolve): Use foreach
698 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
699 (RemoveMethods): use foreach.
701 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
702 nested foreach statements instead of for, and also break out of
703 the inner loop once a match is found.
705 (Invocation.OverloadResolve): Use foreach, simplify the code.
707 2002-05-08 Miguel de Icaza <miguel@ximian.com>
709 * cfold.cs (BinaryFold): During an enumeration evaluation context,
710 we actually unwrap the expression to allow for extra information
713 * expression.cs: Use Shr_Un on unsigned operations.
715 2002-05-08 Ravi Pratap <ravi@ximian.com>
717 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
718 applicable operators was not being considered correctly. This closes
719 the bug Miguel reported.
721 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
723 * attribute.cs: check that the type derives from System.Attribute
724 and report the correct error in that case (moved the duplicate code to
725 its own method, too).
727 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
729 * attribute.cs: lookup attribute type name as the spec says: first the
730 bare attribute name and then name + "Attribute" (nant compiles with
733 2002-05-07 Miguel de Icaza <miguel@ximian.com>
735 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
736 Because of the way we parse things, we should try to see if a
737 UIntConstant can fit in an integer.
739 2002-05-07 Ravi Pratap <ravi@ximian.com>
741 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
742 when we are in an explicit context.
744 (ConvertReferenceExplicit): When converting from Iface type S to Class
745 T make sure the rules are implemented as an OR.
747 * parameter.cs (ParameterType): Make it a property for now although the
748 purpose really isn't anything immediate.
750 * expression.cs (Is*Applicable): Do better checking on the parameter type
751 of a ref/out parameter. The ones from the system assemblies are already
752 marked with the correct type so we don't need to do any correction.
754 * ecore.cs (StandardConversionExists): Conversion from Interface types to
755 the object type is standard too so include that.
757 2002-05-06 Miguel de Icaza <miguel@ximian.com>
759 * ecore.cs (StandardConversionExists): Augment with missing code:
760 deal with IntConstant, LongConstants and Enumerations.
762 * assign.cs: Report the error, instead of failing silently
764 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
765 typecontainer that they are declared, because the
766 typecontainer/namespace will have the list of using clauses that
769 Assembly Attributes were escaping the normal registration
772 (EmitCode): Apply attributes within an EmitContext that represents
773 the container they were declared on.
775 * cs-parser.jay: Track bases for structs. How did I get this wrong?
777 2002-05-06 Ravi Pratap <ravi@ximian.com>
779 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
780 Revamp completely - make much cleaner as we now operate only
783 (FindMostSpecificSource, FindMostSpecificTarget): New methods
784 to implement the logic detailed in the spec more correctly.
786 (UserDefinedConversion): Update accordingly.
788 2002-05-06 Miguel de Icaza <miguel@ximian.com>
790 * statement.cs: Return flow analysis information up.
792 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
795 (token): Do not consume an extra character before calling
798 2002-05-06 Piers Haken <piersh@friskit.com>
800 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
802 2002-05-06 Miguel de Icaza <miguel@ximian.com>
804 * class.cs (Constructor.Emit): Set the IsStatic flag in the
805 EmitContext during the instance constructor initializer
806 resolution, to stop access to instance variables.
808 This is mandated by the spec, last paragraph of the `constructor
809 initializers' section.
811 2002-05-05 Miguel de Icaza <miguel@ximian.com>
813 * cs-parser.jay, class.cs (Accessor): new class used to represent
814 an accessor (get or set). In the past we used `null' to represent
815 a missing accessor. But this is ambiguous because there was no
816 way to tell in abstract indexers/properties if one of them was
819 Now there is a way of addressing that.
821 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
822 instead of FindMembers.
824 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
825 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
827 * attribute.cs: Treat indexers and properties as the same in terms
828 of applying attributes
830 * ecore.cs (FindMostEncompassedType): Use statically initialized
831 EmptyExpressions()s like we do elsewhere to avoid creating useless
832 objects (and we take this out of the tight loop).
834 (GetConversionOperators): Move the code to extract the actual
835 operators to a separate routine to clean things up.
837 2002-05-04 Miguel de Icaza <miguel@ximian.com>
839 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
840 events are always registered FieldBuilders.
842 * class.cs (FieldBase): New class shared by Fields
844 * delegate.cs: If we are a toplevel delegate, use our full name.
845 If we are a nested delegate, then only use our tail name.
847 2002-05-02 Ravi Pratap <ravi@ximian.com>
849 * expression.cs (IsApplicable): Ensure that we add the "&" to
850 ref/out types before comparing it with the type of the argument.
852 (IsParamsMethodApplicable): Ditto.
854 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
857 * delegate.cs : Handle the case when we have more than one applicable
858 method. Flag an error only when we finish checking all.
860 2002-05-02 Miguel de Icaza <miguel@ximian.com>
862 * expression.cs: Add support for boolean static initializers.
864 2002-05-01 Miguel de Icaza <miguel@ximian.com>
866 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
868 * parameter.cs (ComputeParameterTypes,
869 ComputeAndDefineParameterTypes): Better error handling: now we
870 clear the `types' cache if we fail during any of the type lookups.
871 We also return the status code correctly to our caller
873 * delegate.cs: If we fail to define a delegate, abort the extra
876 * expression.cs (Binary.ResolveOperator): for
877 operator==(object,object) and operator !=(object, object) we also
878 have to verify that there is an implicit conversion from one to
881 (ArrayAccess.DoResolve): Array Access can operate on
884 2002-04-30 Miguel de Icaza <miguel@ximian.com>
886 * assign.cs (CompoundAssign): A new class used as a "flag" that
887 the assignment actually is happening as part of a compound
890 During compound assignment, a few new rules exist to enable things
897 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
898 to the type of x) if y is implicitly convertible to the type of x,
899 and the operator is a builtin operator and the return type of the
900 operator is explicitly convertible to the type of x.
902 * rootcontext.cs: Reset warning level to 2. 4 catches various
903 "interesting" features in mcs, we must clean this up at some
904 point, but currently am trying to kill other bugs ;-)
906 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
907 in container classes as well.
909 * expression.cs (Binary.ResolveOperator): Handle string case
910 before anything else (as operator overloading does emit an error
911 before doing anything else).
913 This code could go away when we move to a table driven model, but
914 i could not come up with a good plan last night.
916 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
918 * typemanager.cs (CSharpName): reimplementation using regex.
919 * class.cs: added null check for fields in Emit
920 * rootcontext.cs: set warninglevel to 4
922 2002-04-29 Miguel de Icaza <miguel@ximian.com>
924 * typemanager.cs (CSharpName): reimplemented with Lupus
927 2002-04-28 Miguel de Icaza <miguel@ximian.com>
929 * statement.cs (If): correclty implement Resolve, because we were
930 not catching sem errors in there. The same process is needed
932 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
935 (Statement.Warning_DeadCodeFound): Factorize code.
936 (While): Report dead code here too.
938 (Statement): Added Resolve virtual method to allow
939 for resolution split from the emit code.
941 2002-04-26 Miguel de Icaza <miguel@ximian.com>
943 * statement.cs (EmitBoolExpression): No longer try to resolve the
945 (MakeBoolean): New utility function that resolve, implicitly
946 converts to boolean and tags the expression.
949 (If, Do): Implement dead code elimination.
950 (While): Implement loop inversion
952 (Do, While, For, If): Resolve the expression prior to calling our
955 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
958 - added method Report28 (warning: program has more than one entry point)
959 - added method IsEntryPoint, implements paragraph 10.1 of the spec
960 - modified method Method.Define, the part at the end of the method
962 * rootcontext.cs: added static public Location EntryPointLocation;
964 * ../errors/cs0028.cs : Add test case for the above warning.
967 - modified method CSharpName to allow arrays of primitive type to
968 be printed nicely (e.g. instead of System.Int32[][] it now prints
970 - added method CSharpSignature: returns the signature of a method
971 in string format to be used in reporting errors, warnings, etc.
973 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
976 2002-04-26 Ravi Pratap <ravi@ximian.com>
978 * delegate.cs (Define): Fix extremely silly bug where I was
979 setting the type of the 'object' parameter of the BeginInvoke
980 method to System.IAsyncResult instead of System.Object ;-)
982 2002-04-26 Miguel de Icaza <miguel@ximian.com>
984 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
987 (Constructor.Emit): return if we fail to initialize the
988 constructor. Another door closed!
990 * expression.cs (New.DoResolve): Improve error message (from -6 to
991 1501). Use DeclaredOnly lookup to find the exact constructor.
993 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
994 loop. This is useful.
996 * cs-parser.jay: Adjust the default parameters so that destructors
997 have the proper signature.
999 2002-04-26 Martin Baulig <martin@gnome.org>
1001 * driver.cs (LoadAssembly): If `assembly' contains any characters
1002 which are only valid in path names and not in assembly names
1003 (currently slash, backslash and point), use Assembly.LoadFrom ()
1004 instead of Assembly.Load () on the `assembly' (before iteration
1005 over the link_paths).
1007 2002-04-26 Martin Baulig <martin@gnome.org>
1009 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
1011 2002-04-25 Miguel de Icaza <miguel@ximian.com>
1013 * class.cs (Property): use the new typemanager.MemberLookup
1015 (TypeContainer.MemberLookup): Implement using the
1016 TypeManager.MemberLookup now.
1018 * typemanager.cs: Make MemberLookup a function of the TypeManager,
1019 and return MemberInfos, so that these can be used without an
1020 EmitContext (what we had before).
1022 2002-04-24 Miguel de Icaza <miguel@ximian.com>
1024 * expression.cs: Fix the case where the argument to params if the
1025 type of the params. I omitted handling this before. Fixed
1027 2002-04-22 Miguel de Icaza <miguel@ximian.com>
1029 * driver.cs: Call BootCorlib_PopulateCoreType
1031 * class.cs (Property.CheckBase): Check for properties only, not
1034 * interface.cs: Temporary hack: try/catch around the
1035 CustomAttributeBuilder, because I am getting an exception that I
1038 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
1039 types whose definitions are required to be there (attributes are
1040 defined before standard types).
1042 Compute definitions as we boot the various types, as they are used
1043 immediately (value_type class will need object_type, but if we do
1044 not initialize object_type, we will pass a null, which will let
1045 the runtime pick the System.Object from the existing corlib, which
1046 is not what we want).
1048 2002-04-22 Patrik Torstensson <totte@labs2.com>
1050 * cs-tokenizer.cs: fixed a number of trim() issues.
1052 2002-04-22 Ravi Pratap <ravi@ximian.com>
1054 * expression.cs (Argument.Type): Ensure that we return the correct
1055 type when we have out or ref parameters [in which case we
1058 2002-04-22 Miguel de Icaza <miguel@ximian.com>
1060 * class.cs (Property, Indexer): Allow extern modifier in there.
1062 * typemanager.cs (InitBaseTypes): Initializes object_type and
1063 value_type, since those will be used early on during the bootstrap
1064 process to compile corlib.
1066 (InitCoreTypes): Move code from here to InitBaseTypes.
1068 2002-04-21 Miguel de Icaza <miguel@ximian.com>
1070 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
1071 single-dimension arrays as using the ldlen opcode.
1073 Daniel Lewis discovered this optimization.
1075 * typemanager.cs: Add signature for System.Array::get_Length
1077 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1079 * statement.cs: report the error when the foreach does not apply to an
1080 array nor a collection.
1082 2002-04-19 Miguel de Icaza <miguel@ximian.com>
1084 * expression.cs: Add implicit conversions to the operator ~.
1086 * constant.cs (DecimalConstant.Emit): Emit decimal value.
1088 * typemanager.cs: Locate the decimal constructor.
1090 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1092 * attribute.cs: use the new property of TypeOf.
1093 * expression.cs: added 'get' property around typearg.
1095 These changes fix a build breaker reported by NickD. Is this the
1096 correct way to fix? If not, please, revert my changes and make it
1099 2002-04-17 Miguel de Icaza <miguel@ximian.com>
1101 * attribute.cs: Add support for typeof in attribute invocations.
1102 I am not sure that this is right though.
1104 2002-04-14 Duncan Mak <duncan@ximian.com>
1106 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
1107 Binary.Operator.Division case.
1109 2002-04-13 Ravi Pratap <ravi@ximian.com>
1111 * class.cs (DefineType): Ensure that we do a proper check on
1112 attribute types and also register it with the TypeManager.
1114 (TypeContainer.Targets): The default for attribute types is
1115 AttributeTargets.All.
1117 * attribute.cs (ApplyAttributes): Registering the attribute type
1118 is done elsewhere, not when we discover we have a Usage attribute.
1120 2002-04-12 Ravi Pratap <ravi@ximian.com>
1122 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
1123 and get rid of is_delegate parameter.
1125 * everywhere : update.
1127 2002-04-12 Ravi Pratap <ravi@ximian.com>
1129 * cs-parser.jay (compilation_unit): Revamp completely to use
1130 some new ideas that I got from Rhys' grammar to solve the problems
1131 with assembly level attributes.
1133 (outer_declaration): New grammar production.
1135 (attribute_sections): Add.
1137 (opt_attributes): Base on attribute_sections
1139 (namespace_declaration): Allow opt_attributes to tackle the case
1140 when we have assembly level attributes - we are clever in this
1143 * attribute.cs (ApplyAttributes): Do not worry about assembly
1144 attributes in the non-global context.
1146 * rootcontext.cs (AddGlobalAttributes): Go back to using this
1147 instead of SetGlobalAttributes.
1149 * class.cs, rootcontext.cs : Ensure we define and generate
1150 attribute types before anything else.
1152 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
1153 and flag the new error -20 for the case when the attribute type
1154 does not have valid targets specified. csc does not catch this.
1156 * ../errors/errors.txt : update for error # -20
1158 2002-04-11 Ravi Pratap <ravi@ximian.com>
1160 * support.cs (InternalParameters.ParameterModifier): Do some null
1161 checking and return sane values.
1163 * class.cs (Method.Define): If we are a PInvoke method, ensure
1164 that we are static and extern. Report error # 601
1166 * ../errors/cs0601.cs : Add test case for the above error.
1168 2002-04-07 Ravi Pratap <ravi@ximian.com>
1170 * rootcontext.cs (attribute_types): We need to keep type of
1171 all attribute types separately and emit code for them first.
1173 (RegisterAttribute) : Implement.
1175 * class.cs (DefineType): Check if the current Type is a custom
1176 attribute type and register it accordingly.
1178 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
1179 adding the first attribute twice and rename to
1181 (SetGlobalAttributes): this.
1183 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
1186 * attribute.cs (ApplyAttributes): Take an additional argument telling us
1187 if we are processing global arguments. Hmm, I am unsure of this.
1189 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1191 * expression.cs: added static array of strings to avoid calling
1192 Enum.ToString () for Operator in Binary. Significant recover of
1195 2002-04-10 Miguel de Icaza <miguel@ximian.com>
1197 * class.cs (FindMembers): Allow the Builders of the various
1198 members to be null. If they are skip them. This only happens
1199 during the PInvoke declaration.
1201 2002-04-09 Miguel de Icaza <miguel@ximian.com>
1203 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
1204 failure, so we do not keep going afterwards.
1206 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
1207 wanted to pass `false' as the `is_delegate' argument. If this is
1208 the case, why not use delegate_type == null to mean `is_delegate =
1209 false' and anything else as is_delegate = true.
1211 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
1213 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
1214 code for the section, not the beginning of the tests.
1216 2002-04-08 Miguel de Icaza <miguel@ximian.com>
1218 * cfold.cs: Handle operator + (Enum x, Underlying x)
1220 * expression.cs (Binary): same. Warn about errors where we have
1221 Enum/Enum in operator + as well.
1223 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
1226 - added support for switch(bool)
1227 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
1228 - add TableSwitchEmit() to handle table-based switch statements
1230 2002-04-05 Ravi Pratap <ravi@ximian.com>
1232 * expression.cs (Invocation.OverloadResolve): Factor out code which
1233 does parameter compatibility checking with arguments so that we can
1234 re-use the code even from Delegate.VerifyApplicability
1236 (VerifyArgumentsCompat): Move above code here.
1238 * delegate.cs (VerifyApplicability): Get rid of duplicate code
1239 and instead make a call to the above method.
1241 2002-03-31 Ravi Pratap <ravi@ximian.com>
1243 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
1244 We use it to keep track of classes which are attribute types.
1246 2002-04-02 Miguel de Icaza <miguel@ximian.com>
1248 * delegate.cs (Delegate.Define): Correctly define the types in the
1249 presence of fixed and array parameters.
1251 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
1254 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
1255 include NonPublic after the first iteration.
1257 * class.cs (Indexer.CheckBase): Only check if both parents are
1260 * cs-parser.jay (accessor_body): If empty, set to null.
1262 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
1263 same code path here to resolve constants names that we did have in
1264 MemberAccess.DoResolve. There is too much code duplicated here.
1266 2002-04-01 Miguel de Icaza <miguel@ximian.com>
1268 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
1270 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
1273 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
1274 tokens, numbers and strings.
1276 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
1279 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
1280 asyncronous parameters and the regular parameters.
1282 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
1283 specify the target directory.
1285 * expression.cs: (This.DoResolve): Simplify
1286 (As.Emit): Optimize, do not generate IsInst if the expression is
1287 always of the given type.
1289 (Is.DoResolve): Bug fix, we were reporting both always/never for
1292 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
1293 creating too many unnecessary arrays.
1295 2002-03-31 Miguel de Icaza <miguel@ximian.com>
1297 * class.cs (EmitFieldInitializer): Use Assign expression to assign
1298 fields instead of rolling our own initializer. Takes care of all
1299 implicit conversions, and drops unnecessary static checks/argument.
1301 2002-03-31 Dick Porter <dick@ximian.com>
1303 * driver.cs: use the GetDirectories() return values properly, and
1304 use "/" as path separator.
1306 2002-03-30 Miguel de Icaza <miguel@ximian.com>
1308 * expression.cs (Unary): Optimize - - expr into expr.
1309 (Binary): Optimize a + (-b) into a -b.
1311 * codegen.cs (CodeGen): Made all methods static.
1313 2002-03-29 Miguel de Icaza <miguel@ximian.com>
1317 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
1318 TypeBuilder property.
1320 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
1323 * tree.cs: Removed the various RecordXXXX, and replaced with a
1324 single RecordDecl. Removed all the accessor methods, and just
1325 left a single access point Type
1327 * enum.cs: Rename DefineEnum to DefineType.
1329 * decl.cs: New abstract method `DefineType' used to unify the
1330 Defines for Enumerations, Interfaces, TypeContainers and
1333 (FindType): Moved LookupInterfaceOrClass here. Moved the
1334 LookupBaseClasses method that used to live in class.cs and
1335 interface.cs here, and renamed to FindType.
1337 * delegate.cs: Implement DefineType. Take advantage of the
1338 refactored pattern for locating the parent builder without taking
1339 the parent_builder argument (which we know does not work if we are
1340 nested, and triggering a toplevel definition).
1342 2002-03-28 Miguel de Icaza <miguel@ximian.com>
1344 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
1345 accessibility of a member has changed during override and report
1348 * class.cs (Method.Define, Property.Define): Only complain on
1349 overrides if the method is private, any other accessibility is
1350 fine (and since we just checked the permission is the same, we are
1353 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
1354 and elif are processed always. The other pre-processing
1355 directives are only processed if we are "taking" the path
1357 2002-03-29 Martin Baulig <martin@gnome.org>
1359 * class.cs (Method.Emit): Only emit symbolic debugging info if the
1360 current location is not Null.
1362 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
1363 a separate method so we can profile it.
1365 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
1366 `span.Seconds' are just seconds, but no minutes or hours.
1367 (MainDriver): Profile the CodeGen.SaveSymbols calls.
1369 2002-03-28 Miguel de Icaza <miguel@ximian.com>
1371 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
1372 Remove the gratuitous set of Final:
1374 // If an interface implementation, then we can set Final.
1375 if (((flags & MethodAttributes.Abstract) == 0) &&
1376 implementing.DeclaringType.IsInterface)
1377 flags |= MethodAttributes.Final;
1379 I do not know what I was smoking when I used that.
1382 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
1383 step into fixing the name resolution issues for delegates and
1384 unifying the toplevel name resolution.
1386 2002-03-28 Martin Baulig <martin@gnome.org>
1388 * class.cs (Method.Emit): If we have a symbol writer, call its
1389 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
1390 tell it about the current method.
1392 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
1393 writer that we're going to emit the first byte of IL code for a new
1394 statement (a new source line).
1395 (EmitContext.EmitTopBlock): If we have a symbol writer, call
1396 EmitContext.Mark() before emitting any code.
1398 * location.cs (SymbolDocument): Return null when we're Null.
1400 * statement.cs (Statement): Moved the `Location loc' variable here.
1401 (Statement.EmitBoolExpression): If we have a symbol writer, call
1402 ec.Mark() before emitting any code to tell it that we're at the
1403 beginning of a new statement.
1404 (StatementExpression): Added `Location' argument to the constructor.
1405 (Block): Added public readonly variable `StartLocation' and public
1406 variable `EndLocation'. The latter is to be set using SetEndLocation().
1407 (Block): Added constructor which takes a start and end location.
1408 (Block.SetEndLocation): New method. This sets the end location.
1409 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
1410 local variables we create.
1411 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
1412 each statement and do also mark the begin and end of the block.
1414 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
1415 tell it the current lexer.Location, use Location.Null for the end of the
1417 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
1418 current block, set its end location using SetEndLocation().
1419 (statement_expression): StatementExpression constructor now takes the
1420 lexer.Location as additional argument.
1421 (for_statement, declare_local_variables): Likewise.
1422 (declare_local_variables): When creating a new implicit block, use the
1423 new Block constructor and pass it the lexer.Location.
1425 2002-03-28 Miguel de Icaza <miguel@ximian.com>
1427 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
1428 members also on the parent interfaces recursively.
1430 2002-03-27 Miguel de Icaza <miguel@ximian.com>
1432 * report.cs: Use new formats, since Gonzalo finished the missing
1435 * expression.cs (Binary.ResolveOperator): added missing operator|
1436 operator& and operator^ for bool/bool.
1438 * cs-parser.jay: CheckDef now takes a Location argument that is
1439 used to report errors more precisly (instead of reporting the end
1440 of a definition, we try to track something which is a lot closer
1441 to the source of the problem).
1443 * cs-tokenizer.cs: Track global token use, so we can properly flag
1444 the use of #define/#undef after the first token has been seen.
1446 Also, rename the reportXXXX to Error_DescriptiveName
1448 * decl.cs (DeclSpace.IsTopLevel): Move property here from
1449 TypeContainer, so that Enum and Interface can use this too.
1451 * class.cs (TypeContainer.LookupInterfaceOrClass,
1452 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
1453 `builder' argument. Typically this was used to pass the parent
1454 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
1457 The problem is that a nested class could trigger the definition of
1458 a toplevel class, and the builder would be obviously wrong in that
1461 So we drop this argument, and we compute dynamically the
1462 TypeBuilder/ModuleBuilder (the correct information was available
1463 to us anyways from DeclSpace.Parent)
1465 * interface.cs (Interface.DefineInterface): Drop builder
1466 parameter cleanup like class.cs
1468 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
1471 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
1474 (Try.Emit): Propagate the returns value from the statement.
1476 (Return.Emit): Even if we are leavning
1478 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
1480 * modifiers.cs: Fix the computation of MethodAttributes flags.
1482 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
1484 * driver.cs: allow compilation of files that start with '/'.
1485 Add a default case when checking the argument of --target.
1487 2002-03-25 Miguel de Icaza <miguel@ximian.com>
1489 * interface.cs: Implement the same search algorithm for types in
1492 * delegate.cs: Do not allow multiple definition.
1494 * Recovered ChangeLog that got accidentally amputated
1496 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
1498 * rootcontext.cs: Load manually enum to allow core classes to
1499 contain enumerations.
1501 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
1502 Update to new static methods in TypeManager.
1504 * typemanager.cs (GetMethod, GetConstructor): Use our
1505 implementation of FindMembers to find the members, since during
1506 corlib compilation, the types are TypeBuilders and GetMethod and
1507 GetConstructor do not work.
1509 Make all methods in TypeManager static.
1511 (InitCodeHelpers): Split the functionality from
1512 the InitCodeTypes function.
1514 * driver.cs: Call InitCodeHelpers after we have populated the
1517 * cs-parser.jay (delegate_declaration): we did not used to compute
1518 the delegate name correctly for void delegates.
1520 2002-03-24 Miguel de Icaza <miguel@ximian.com>
1522 * rootcontext.cs (RootContext): Init the interface_resolve_order
1523 and type_container_resolve_order always.
1525 (ResolveCore, BootstrapCorlib_ResolveClass,
1526 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
1527 compiler when compiling with --nostdlib
1529 * class.cs (TypeContainer.DefineType): Check that our parent is
1530 not null. This test is most important when we are bootstraping
1533 * codegen.cs: Split out the symbol writing code.
1535 2002-03-25 Martin Baulig <martin@gnome.org>
1537 * driver.cs (-g): Made -g an alias for --debug.
1539 2002-03-24 Martin Baulig <martin@gnome.org>
1541 * codegen.cs (SymbolWriter): New public variable. Returns the
1542 current symbol writer.
1543 (CodeGen): Added `bool want_debugging_support' argument to the
1544 constructor. If true, tell the ModuleBuild that we want debugging
1545 support and ask it for the ISymbolWriter.
1546 (Save): If we have a symbol writer, call it's Close() method after
1547 saving the assembly.
1549 * driver.c (--debug): New command line argument to create a
1550 debugger information file.
1552 * location.cs (SymbolDocument): New public property. Returns an
1553 ISymbolDocumentWriter object for the current source file or null
1554 if we don't have a symbol writer.
1556 2002-03-21 Miguel de Icaza <miguel@ximian.com>
1558 * driver.cs (LoadAssembly): Correctly return when all the paths
1559 have been tried and not before.
1561 * statement.cs (Switch.Emit): return the actual coverage for this
1562 statement (returns/not-returns)
1564 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
1565 switch of the statement if we are the last switch section. That
1566 kills two problems: try/catch problems (we used to emit an empty
1567 nop at the end) and switch statements where all branches would
1570 2002-03-19 Miguel de Icaza <miguel@ximian.com>
1572 * driver.cs: Add default assemblies (the equivalent to the
1573 Microsoft CSC.RSP file)
1575 * cs-tokenizer.cs: When updating `cols and setting it to zero,
1576 also update tokens_seen and set it to false.
1578 * driver.cs: Implement --recurse for Mike.
1580 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
1581 correctly splitting out the paths.
1583 2002-03-18 Miguel de Icaza <miguel@ximian.com>
1585 * interface.cs (Interface.PopulateProperty): Instead of using
1586 `parent' as the declaration space for the set parameters, use
1589 * support.cs (InternalParameters): InternalParameters constructor
1590 takes a DeclSpace instead of a TypeContainer.
1592 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
1593 types are being initialized, load the address of it before calling
1596 (New): Provide a mechanism to disable the generation of local
1597 value type temporaries when the caller will be providing us with
1598 an address to store it.
1600 (ArrayCreation.EmitDynamicInitializers): Use it.
1602 2002-03-17 Miguel de Icaza <miguel@ximian.com>
1604 * expression.cs (Invocation.EmitArguments): Only probe for array
1605 property if there is more than one argument. Sorry about that.
1607 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
1610 * class.cs (Method.LabelParameters): Fix incorrect code path that
1611 prevented the `ParamArrayAttribute' from being applied to the
1614 2002-03-16 Miguel de Icaza <miguel@ximian.com>
1616 * support.cs (ReflectionParameters): Correctly compute whether the
1617 last argument is a params array. Fixes the problem with
1620 * typemanager.cs: Make the assemblies array always be non-null
1621 (empty, but non-null)
1623 * tree.cs (RecordDecl): New function that abstracts the recording
1624 of names. This reports error 101, and provides a pointer to the
1625 previous declaration. Fixes a crash in the compiler.
1627 * cs-parser.jay (constructor_declaration): Update to new grammar,
1628 and provide a constructor_body that can be empty.
1630 2002-03-15 Miguel de Icaza <miguel@ximian.com>
1632 * driver.cs: Add support for --resources.
1634 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
1635 Make all types for the various array helper methods be integer.
1637 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
1638 CheckState to ConvCast.
1640 (ConvCast): Now it takes a `checked' state argument, to avoid
1641 depending on the emit context for the conversion, and just using
1642 the resolve time setting.
1644 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
1645 instead of Invocation.EmitArguments. We do not emit the original
1646 arguments, instead we emit those which have been converted to
1647 unsigned int expressions.
1649 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
1651 * codegen.cs: ditto.
1653 * expression.cs (LocalVariableReference): Drop the use of the
1654 Store function that depended on the variable index.
1656 * statement.cs (VariableInfo): Drop the `Idx' property from this
1657 class, as this is not taking into account the indexes for
1658 temporaries tat we generate during the execution, getting the
1661 * class.cs: First emit class initializers, then call the parent
1664 * expression.cs (Binary): Fix opcode emision.
1665 (UnaryMutator.EmitCode): Support checked code generation
1667 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
1668 matches for events for both the Static and Instance scans,
1669 pointing to the same element. Fix that.
1671 2002-03-14 Miguel de Icaza <miguel@ximian.com>
1673 * rootcontext.cs (ResolveTree): Always set the
1674 interface_resolve_order, because nested interfaces will be calling
1677 * class.cs (GetInterfaceOrClass): Track the same resolution
1678 process used by TypeManager.LookupType. This fixes the nested
1679 type lookups in class declarations (separate path from
1682 (TypeContainer.DefineType): Also define nested interfaces.
1683 (TypeContainer.RegisterOrder): New public function used to
1684 register the order in which child interfaces need to be closed.
1686 Nested interfaces need to be closed after their parents have been
1689 * interface.cs (InterfaceAttr): Put all the logic for computing
1690 the interface attribute here.
1692 (DefineInterface): Register our interface order with the
1693 RootContext or with the TypeContainer depending on the case.
1695 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1697 * cs-parser.jay: rework foreach statement to work with the new
1698 changes to the policy on SimpleNames.
1700 * report.cs: support Stacktrace on warnings as well.
1702 * makefile: drop --unsafe and /unsafe from the compile.
1704 2002-03-13 Ravi Pratap <ravi@ximian.com>
1706 * ecore.cs (StandardConversionExists): Modify to take an Expression
1707 as the first parameter. Ensure we do null -> reference type conversion
1710 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
1711 temporary Expression objects.
1713 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
1715 * interface.cs: workaround bug in method overloading resolution
1716 (there is already a bugzilla bug for it).
1718 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1720 We could also solve this problem by having a separate path for
1721 performing type lookups, instead of DoResolve, we could have a
1722 ResolveType entry point, and only participating pieces of the
1723 production (simplename, deref, array) would implement this.
1725 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
1726 signal SimpleName to only resolve type names and not attempt to
1727 resolve anything else.
1729 * expression.cs (Cast): Set the flag.
1731 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
1733 * class.cs: Only report 108 if there is no `new' modifier.
1735 * cs-parser.jay: rework foreach statement to work with the new
1736 changes to the policy on SimpleNames.
1738 * report.cs: support Stacktrace on warnings as well.
1740 * makefile: drop --unsafe and /unsafe from the compile.
1742 2002-03-11 Miguel de Icaza <miguel@ximian.com>
1744 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1745 lookups here, instead of doing that at parse time. This means
1746 that our grammar will not introduce `LocalVariableReferences' as
1747 expressions at this point. That solves the problem of code like
1755 This is only half the fix. The full fix requires parameters to
1756 also be handled in this way.
1758 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
1759 makes the use more obvious of the DeclSpace. The
1760 ec.TypeContainer.TypeBuilder is now only used to pull the
1763 My theory is that I can get rid of the TypeBuilder completely from
1764 the EmitContext, and have typecasts where it is used (from
1765 DeclSpace to where it matters).
1767 The only pending problem is that the code that implements Aliases
1768 is on TypeContainer, and probably should go in DeclSpace.
1770 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1771 lookups here, instead of doing that at parse time. This means
1772 that our grammar will not introduce `LocalVariableReferences' as
1773 expressions at this point. That solves the problem of code like
1781 This is only half the fix. The full fix requires parameters to
1782 also be handled in this way.
1784 * class.cs (Property.DefineMethod): When implementing an interface
1785 method, set newslot, when implementing an abstract method, do not
1786 set the flag (before we tried never setting it, or always setting
1787 it, which is the difference).
1788 (Indexer.DefineMethod): same.
1789 (Method.DefineMethod): same.
1791 * ecore.cs: Only set the status used flag if we get back a Field.
1793 * attribute.cs: Temporary hack, so Paolo can keep working.
1795 2002-03-08 Ravi Pratap <ravi@ximian.com>
1797 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
1798 the unmanaged type in the case we have a MarshalAs attribute.
1800 (Resolve): Handle the case when we are parsing the special MarshalAs
1801 attribute [we need to store the unmanaged type to use later]
1803 * typemanager.cs (marshal_as_attr_type): Built in type for the
1804 MarshalAs Attribute.
1806 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
1807 on parameters and accordingly set the marshalling info.
1809 2002-03-09 Miguel de Icaza <miguel@ximian.com>
1811 * class.cs: Optimizing slightly by removing redundant code after
1812 we switched to the `NoTypes' return value.
1813 (Property.DefineMethod): use NoTypes here too.
1815 This fixes the bug I introduced in my last batch of changes.
1817 2002-03-05 Ravi Pratap <ravi@ximian.com>
1819 * tree.cs (RecordEnum): Add. We now keep track of enums too.
1821 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
1822 Enums since those are types too.
1824 * cs-parser.jay (enum_declaration): Record enums as we parse them.
1826 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
1827 thanks to a call during the lookup process.
1829 2002-03-07 Miguel de Icaza <miguel@ximian.com>
1831 * statement.cs (Foreach): Lots of work to accomodate a particular
1832 kind of foreach statement that I had not kept in mind. It is
1833 possible to have foreachs on classes that provide a GetEnumerator
1834 method that return objects that implement the "pattern" for using
1835 a foreach, there is no need to support GetEnumerator
1838 This is needed to compile nant.
1840 * decl.cs: Only report 114 if the member is not `Finalize' and if
1841 the warning level is at least 2.
1843 * class.cs: Moved the compare function from Method to
1846 (MethodSignature.InheritableMemberSignatureCompare): Add new
1847 filter function that is used to extract inheritable methods from a
1850 (Method.Define): Use the new `inheritable_method_signature_filter'
1853 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
1856 2002-03-06 Miguel de Icaza <miguel@ximian.com>
1858 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
1860 * cs-parser.jay: Add opt_semicolon to the interface declaration.
1862 * expression.cs: Pass location information to
1863 ConvertImplicitStandard.
1865 * class.cs: Added debugging code to track return values from
1868 2002-03-05 Miguel de Icaza <miguel@ximian.com>
1870 * expression.cs (Is.DoResolve): If either side of the `is' is an
1871 interface, do not flag the warning.
1873 * ecore.cs (ImplicitReferenceConversion): We need a separate test
1876 * report.cs: Allow for --fatal to be used with --probe.
1878 * typemanager.cs (NoTypes): Move the definition for the empty Type
1881 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
1883 (TypeContainer.DefineProxy): New function used to proxy to parent
1884 implementations when implementing interfaces.
1885 (TypeContainer.ParentImplements): used to lookup if our parent
1886 implements a public function that is required by an interface.
1887 (TypeContainer.VerifyPendingMethods): Hook this up.
1889 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
1890 `modules' and `assemblies' arraylists into arrays. We only grow
1891 these are the very early start up of the program, so this improves
1892 the speedof LookupType (nicely measured).
1894 * expression.cs (MakeByteBlob): Replaced unsafe code with
1895 BitConverter, as suggested by Paolo.
1897 * cfold.cs (ConstantFold.Binary): Special case: perform constant
1898 folding of string concatenation, but if either side is a string,
1899 and the other is not, then return null, and let the runtime use
1900 the concatenation on the string plus the object (using
1903 2002-03-04 Miguel de Icaza <miguel@ximian.com>
1905 Constant Folding has been implemented now.
1907 * expression.cs (Unary.Reduce): Do not throw an exception, catch
1908 the error instead on types that are not supported in one's
1911 * constant.cs (Constant and all children): New set of functions to
1912 perform implict and explicit conversions.
1914 * ecore.cs (EnumConstant): Implement the new functions to perform
1915 conversion by proxying to the child expression.
1917 * codegen.cs: (ConstantCheckState): Constant evaluation has its
1918 own separate setting that can not be turned off from the command
1919 line using --unchecked or --checked and is only controlled using
1920 the checked/unchecked statements and expressions. This setting is
1921 used by the constant folder to flag errors.
1923 * expression.cs (CheckedExpr, UncheckedExpr): Set the
1924 ConstantCheckState as well.
1926 During Resolve, they also have to flag the state, because the
1927 constant folder runs completely in the Resolve phase.
1929 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1932 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1934 * cfold.cs: New file, this file contains the constant folder.
1936 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1937 argument to track whether we are using the resulting address to
1938 load or store a value and provide better error messages.
1940 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1941 new AddressOf arguments.
1943 * statement.cs (Foreach.EmitCollectionForeach): Update
1945 * expression.cs (Argument.Emit): Call AddressOf with proper
1946 arguments to track usage.
1948 (New.DoEmit): Call AddressOf with new arguments.
1950 (Unary.Emit): Adjust AddressOf call.
1952 2002-03-01 Ravi Pratap <ravi@ximian.com>
1954 * cs-parser.jay (member_access): Change the case for pre-defined types
1955 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
1958 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1961 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1962 essentially like methods and apply attributes like MethodImplOptions to them too.
1964 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1967 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1968 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1971 * Update code everywhere accordingly.
1973 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1975 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1977 2002-02-28 Ravi Pratap <ravi@ximian.com>
1979 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1980 try performing lookups against those instead of jumping straight into using
1981 the 'using' clauses.
1983 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1985 (LookupType): Perform lookups in implicit parents too.
1987 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1988 sequence as RootContext.LookupType.
1990 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
1991 the various cases of namespace lookups into this method.
1993 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1995 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1996 in positional arguments)
1998 * class.cs (Operator): Update the AllowedModifiers to contain
2001 * cs-parser.jay: Update operator declaration to allow for the
2002 operator body to be empty.
2004 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
2007 2002-02-27 Miguel de Icaza <miguel@ximian.com>
2009 * class.cs (Method.Emit): Label parameters.
2011 * driver.cs: Return 1 or 0 as the program exit code.
2013 2002-02-26 Miguel de Icaza <miguel@ximian.com>
2015 * expression.cs: Special case the `null' object when trying to
2016 auto-compute the type, as anything can be explicitly converted to
2019 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
2020 spotting this Paolo.
2022 (Expression.ImplicitNumericConversion): Perform comparissions of
2023 the type using the underlying type in the case of an enumeration
2024 rather than using the enumeration type for the compare.
2026 Cope with the underlying == type case, which is not possible to
2029 (Expression.ConvertNumericExplicit): Perform comparissions of
2030 the type using the underlying type in the case of an enumeration
2031 rather than using the enumeration type for the compare.
2033 * driver.cs: If the user does not supply an extension, assume .exe
2035 * cs-parser.jay (if_statement): Rewrote so that we can track the
2036 location for the if statement.
2038 * expression.cs (Binary.ConstantFold): Only concat strings when
2039 the operation is "+", not everything ;-)
2041 * statement.cs (Statement.EmitBoolExpression): Take a location
2043 (If, While, Do): Track location.
2045 * expression.cs (Binary.ResolveOperator): In the object + string
2046 case, I was missing a call to ConvertImplicit
2048 2002-02-25 Ravi Pratap <ravi@ximian.com>
2050 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
2051 Location arguments. Ensure we use RootContext.LookupType to do our work
2052 and not try to do a direct Type.GetType and ModuleBuilder.GetType
2054 * interface.cs (PopulateMethod): Handle the type of the parameter being
2057 * expression.cs (Invocation.BetterFunction): Handle the case when we
2058 have a params method with no fixed arguments and a call is made with no
2061 2002-02-25 Miguel de Icaza <miguel@ximian.com>
2063 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
2064 the verbatim-string-literal
2066 * support.cs (InternalParameters.ParameterModifier): handle null
2068 (InternalParameters.ParameterType): ditto.
2070 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
2071 duplicating the name of the variable parameter.
2072 (GetParameterByName): Fix bug where we were not looking up array
2073 paramters if they were the only present (thanks Paolo!).
2074 (GetParameterInfo): We only have an empty set of types if both
2075 fixed and array are set to null.
2076 (GetParameterInfo-idx): Handle FixedParameter == null
2078 * cs-parser.jay: Handle the case where there is no catch
2079 statements (missing null test).
2081 2002-02-22 Miguel de Icaza <miguel@ximian.com>
2083 * driver.cs (MainDriver): Be conservative on our command line
2086 Catch DirectoryNotFoundException when calling GetFiles.
2088 (SplitPathAndPattern): Used to split the input specification into
2089 a path and a pattern that we can feed to Directory.GetFiles.
2091 2002-02-21 Miguel de Icaza <miguel@ximian.com>
2093 * statement.cs (Fixed): Implement the last case of the Fixed
2094 statement (string handling).
2096 * expression.cs (StringPtr): New class used to return a char * to
2097 a string; Used by the Fixed statement.
2099 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
2101 * expression.cs (Binary.ResolveOperator): Remove redundant
2102 MemberLookup pn parent type.
2103 Optimize union call, we do not need a union if the types are the same.
2104 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
2107 Specialize the use of MemberLookup everywhere, instead of using
2108 the default settings.
2110 (StackAlloc): Implement stackalloc keyword.
2112 * cs-parser.jay: Add rule to parse stackalloc.
2114 * driver.cs: Handle /h, /help, /?
2116 * expression.cs (MakeByteBlob): Removed the hacks we had in place
2117 before we supported unsafe code.
2119 * makefile: add --unsafe to the self compilation of mcs.
2121 2002-02-20 Miguel de Icaza <miguel@ximian.com>
2123 * expression.cs (PointerArithmetic): New class that is used to
2124 perform pointer arithmetic.
2125 (Binary.Resolve): Handle pointer arithmetic
2126 Handle pointer comparission.
2127 (ArrayPtr): Utility expression class that is used to take the
2128 address of an array.
2130 (ElementAccess): Implement array access for pointers
2132 * statement.cs (Fixed): Implement fixed statement for arrays, we
2133 are missing one more case before we are done.
2135 * expression.cs (Indirection): Implement EmitAssign and set the
2136 ExprClass to Variable. This allows pointer dereferences to be
2137 treated as variables, and to have values assigned to them.
2139 * ecore.cs (Expression.StoreFromPtr): New utility function to
2140 store values dereferencing.
2142 2002-02-20 Ravi Pratap <ravi@ximian.com>
2144 * expression.cs (Binary.ResolveOperator): Ensure that we are
2145 not trying to operate on a void type - this fixes the reported
2148 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
2149 the parent implementation is sealed.
2151 * ../errors/cs0239.cs : Add.
2153 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
2155 * typemanager.cs (unverifiable_code_type): Corresponds to
2156 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
2157 which have unsafe code in them.
2159 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
2162 2002-02-19 Miguel de Icaza <miguel@ximian.com>
2164 * cs-tokenizer.cs: Add support for @"litreal strings"
2166 Make tokenizer accept pre-processor directives
2167 on any column (remove the old C-like limitation).
2169 * rootcontext.cs (EmitCode): Emit any global attributes.
2170 (AddGlobalAttributes): Used to keep track of assembly attributes.
2172 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
2174 * cs-parser.jay: Add support for global attributes.
2176 2002-02-17 Miguel de Icaza <miguel@ximian.com>
2178 * expression.cs (Indirection): New helper class. Unary will
2179 create Indirection classes to be able to implement the
2180 IMemoryLocation interface on it.
2182 2002-02-16 Miguel de Icaza <miguel@ximian.com>
2184 * cs-parser.jay (fixed_statement): reference the right statement.
2186 * statement.cs (Fixed.Emit): Finish implementing the fixed
2187 statement for the &x case.
2189 2002-02-14 Miguel de Icaza <miguel@ximian.com>
2191 * class.cs (Property.Define, Method.Define): Remove newslot when
2194 * modifiers.cs: My use of NewSlot when `Abstract' was set was
2195 wrong. NewSlot should only be used if the `new' keyword is present.
2197 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
2198 locating our system dir. Sorry about this.
2200 2002-02-13 Miguel de Icaza <miguel@ximian.com>
2202 * driver.cs (GetSystemDir): Compute correctly the location of our
2203 system assemblies. I was using the compiler directory instead of
2204 the library directory.
2206 2002-02-13 Ravi Pratap <ravi@ximian.com>
2208 * expression.cs (BetterFunction): Put back in what Miguel commented out
2209 since it is the correct fix. The problem is elsewhere ;-)
2211 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
2212 parameters of the parms method are themselves compatible or not !
2214 (StandardConversionExists): Fix very dangerous bug where we were forgetting
2215 to check that a class implements an interface before saying that an implicit
2216 conversion was allowed. Use ImplementsInterface to do the checking.
2218 2002-02-13 Miguel de Icaza <miguel@ximian.com>
2220 * class.cs (Method.Define): Track whether we are an explicit
2221 implementation or not. And only call DefineMethodOverride if we
2222 are an explicit implementation.
2224 (Property.DefineMethod): Ditto.
2226 2002-02-11 Ravi Pratap <ravi@ximian.com>
2228 * expression.cs (BetterFunction): Catch hideous bug which was
2229 preventing us from detecting ambiguous calls due to implicit casts i.e
2232 2002-01-29 Miguel de Icaza <miguel@ximian.com>
2234 * support.cs (Pair): Remove un-needed method. I figured why I was
2235 getting the error in cs-parser.jay, the variable in a foreach loop
2236 is readonly, and the compiler does not really treat this as a variable.
2238 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
2239 instead of EQUALS in grammar.
2241 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
2243 * expression.cs (Unary.DoResolve): Check whether the argument is
2246 2002-01-28 Miguel de Icaza <miguel@ximian.com>
2248 * support.cs: Api for Pair to set a value. Despite the fact that
2249 the variables are public the MS C# compiler refuses to compile
2250 code that accesses the field if the variable is part of a foreach
2253 * statement.cs (Fixed): Begin implementation of the fixed
2256 (Block.AddVariable): Return the VariableInfo on success and null
2257 on failure instead of true/false.
2259 * cs-parser.jay (foreach): Catch errors on variables already
2260 defined (we were ignoring this value before) and properly unwind
2263 (fixed_statement): grammar for the fixed statement.
2265 2002-01-25 Miguel de Icaza <miguel@ximian.com>
2267 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
2268 pointer types to be incretemented.
2270 (SizeOf): Implement.
2272 * cs-parser.jay (pointer_member_access): Implement
2273 expr->IDENTIFIER production.
2275 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
2276 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
2279 (Unary): Implement indirection.
2281 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
2282 use in non-unsafe context).
2284 (SimpleName.DoResolve): Check for pointers in field access on safe
2287 (Expression.LoadFromPtr): Factor the load-indirect code in this
2288 function. This was duplicated in UnboxCast and ParameterReference
2290 2002-01-24 Miguel de Icaza <miguel@ximian.com>
2292 * expression.cs (ComposedCast): report an error if a pointer cast
2293 is used in a safe region.
2295 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
2296 pointer type casts in unsafe context.
2298 * codegen.cs (EmitContext): Set up IsUnsafe.
2300 * cs-parser.jay (non_expression_type): Add productions for pointer
2303 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
2304 code. We should not use force into static mode if the method is
2305 not virtual. Fixes bug in MIS
2307 * statement.cs (Do.Emit, While.Emit, For.Emit,
2308 Statement.EmitBoolExpression): Add support to Do and While to
2309 propagate infinite loop as `I do return' semantics.
2311 Improve the For case to also test for boolean constants.
2313 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
2314 to the list of attributes we can add.
2316 Remove `EmitContext' argument.
2318 * class.cs (Method.Define): Apply parameter attributes.
2319 (Constructor.Define): Apply parameter attributes.
2320 (MethodCore.LabelParameters): Move here the core of labeling
2323 * support.cs (ReflectionParameters.ParameterModifier,
2324 InternalParameters.ParameterModifier): Use IsByRef on the type and
2325 only return the OUT bit for these parameters instead of in/out/ref
2328 This is because I miss-understood things. The ParameterInfo.IsIn
2329 and IsOut represent whether the parameter has the [In] and [Out]
2332 2002-01-22 Miguel de Icaza <miguel@ximian.com>
2334 * ecore.cs (FieldExpr.Emit): Release temporaries.
2336 * assign.cs (LocalTemporary.Release): new function.
2338 * codegen.cs (EmitContext.GetTemporaryStorage,
2339 EmitContext.FreeTemporaryStorage): Rework the way we deal with
2340 temporary storage. Now we can "put back" localbuilders when we
2343 2002-01-21 Miguel de Icaza <miguel@ximian.com>
2345 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
2346 need to make a copy of the variable to generate verifiable code.
2348 2002-01-19 Miguel de Icaza <miguel@ximian.com>
2350 * driver.cs: Compute dynamically the system directory.
2352 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
2353 Slower, but more generally useful. Used by the abstract
2354 registering implementation.
2356 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
2357 the rules for the special rule on Type/instances. First check if
2358 we have the same name, and if so, try that special static path
2359 rather than the instance path.
2361 2002-01-18 Miguel de Icaza <miguel@ximian.com>
2363 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
2366 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
2367 Enum, ValueType, Delegate or Array for non-corlib compiles.
2369 * cs-tokenizer.cs: Catch long identifiers (645)
2371 * typemanager.cs (IndexerPropetyName): Ravi never tested this
2374 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
2375 fix, we were returning too early, so we were not registering
2376 pending methods from abstract classes.
2378 Do not register pending methods if the class is abstract.
2380 * expression.cs (Conditional.DoResolve): Report circular implicit
2381 conversions when we neecd to compute it for conditional
2384 (Is.DoResolve): If the expression is always of the provided type,
2385 flag warning 183. If the expression can not ever be of the
2386 provided type flag warning 184.
2388 * class.cs: Catch 169 as well.
2390 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
2393 2002-01-18 Nick Drochak <ndrochak@gol.com>
2395 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
2397 2002-01-17 Miguel de Icaza <miguel@ximian.com>
2399 * interface.cs: (PopulateMethod): Check for pointers being defined
2400 only if the unsafe context is active.
2401 (PopulateProperty): ditto.
2402 (PopulateIndexer): ditto.
2404 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
2405 specified. If pointers are present, make sure that they are
2406 present in an unsafe context.
2407 (Constructor, Constructor.Define): ditto.
2408 (Field, Field.Define): ditto.
2409 (Property, Property.Define): ditto.
2410 (Event, Event.Define): ditto.
2412 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
2413 hashtable if there are classes or structs defined.
2415 * expression.cs (LocalVariableReference.DoResolve): Simplify this
2416 code, as the constant resolution moved.
2418 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
2419 the metadata, so we can flag error 133.
2421 * decl.cs (MemberCore.UnsafeOK): New function to test that a
2422 pointer is being declared in an unsafe context.
2424 2002-01-16 Miguel de Icaza <miguel@ximian.com>
2426 * modifiers.cs (Modifiers.Check): Require a Location argument.
2427 Report error 227 for Unsafe use.
2429 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
2431 * statement.cs (For.Emit): If the test is null, then report that
2432 we do `return', as we wont reach anything afterwards.
2434 (Switch.SwitchGoverningType): Track the expression that matched
2437 * driver.cs: Allow negative numbers as an error code to flag.
2439 * cs-parser.jay: Handle 1551.
2441 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
2443 2002-01-15 Miguel de Icaza <miguel@ximian.com>
2445 * cs-parser.jay: Report 1518 (type declaration can only contain
2446 class, struct, interface, enum or delegate)
2448 (switch_label): Report 1523 (keywords `case' or `default' must
2451 (opt_switch_sections): Report 1522 (empty switch)
2453 * driver.cs: Report 1515 (response file specified multiple times)
2454 Report 1516 (Source file specified multiple times).
2456 * expression.cs (Argument.Resolve): Signal 1510
2458 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
2459 access not allowed in static code)
2461 2002-01-11 Ravi Pratap <ravi@ximian.com>
2463 * typemanager.cs (IsPointerType): Utility method which we are going
2466 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
2467 the object type, so we take care of that.
2469 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
2471 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
2472 added to non-params parameters :-)
2474 * typemanager.cs (CSharpName): Include 'void' type too.
2476 (void_ptr_type): Include in the set of core types.
2478 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
2481 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
2484 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
2485 completely forgotten about it.
2487 2002-01-10 Ravi Pratap <ravi@ximian.com>
2489 * cs-parser.jay (pointer_type): Add. This begins our implementation
2490 of parsing rules for unsafe code.
2492 (unsafe_statement): Implement.
2494 (embedded_statement): Modify to include the above.
2496 * statement.cs (Unsafe): Implement new class for unsafe blocks.
2498 * codegen.cs (EmitContext.InUnsafe): Add. This determines
2499 if the current context is an unsafe one.
2501 * cs-parser.jay (local_variable_pointer_type): Since local variable types
2502 are handled differently, we need separate rules for them.
2504 (local_variable_declaration): Update to use local_variable_pointer_type
2505 to allow variable declarations of unmanaged pointer types.
2507 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
2510 * ../errors/cs0214.cs : Add.
2512 2002-01-16 Nick Drochak <ndrochak@gol.com>
2514 * makefile: remove 'response' file when cleaning.
2516 2002-01-15 Miguel de Icaza <miguel@ximian.com>
2518 * cs-parser.jay: Report 1524.
2520 2002-01-14 Miguel de Icaza <miguel@ximian.com>
2522 * typemanager.cs (RegisterMethod): drop checking if we have
2523 registered this from here
2525 2002-01-12 Miguel de Icaza <miguel@ximian.com>
2527 * class.cs (Method.EmitDestructor): Implement calling our base
2530 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
2533 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
2534 this routine and will wrap the call in a try/catch block. Deal
2537 2002-01-11 Miguel de Icaza <miguel@ximian.com>
2539 * ecore.cs (Expression.MemberLookup): instead of taking a
2540 parameter `same_type' that was used to tell whether we could
2541 access private members we compute our containing type from the
2544 (FieldExpr): Added partial support for volatile fields. This does
2545 not work for volatile fields exposed from assemblies, as I can not
2546 figure out how to extract the modreq from it.
2548 Updated all the source files to use this.
2550 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
2551 because it is referenced by MemberLookup very often.
2553 2002-01-09 Ravi Pratap <ravi@ximian.com>
2555 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
2556 TypeBuilder.GetCustomAttributes to retrieve what we need.
2558 Get rid of redundant default_member_attr_type as this is the same as
2559 default_member_type which already exists.
2561 * interface.cs, attribute.cs : Update accordingly.
2563 2002-01-08 Miguel de Icaza <miguel@ximian.com>
2565 * typemanager.cs: Enable IndexerPropertyName again. It does not
2566 work for TYpeBuilders though. Ravi, can you please fix this?
2568 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
2570 * expression.cs (Argument.Emit): Handle the case of ref objects
2571 being passed to ref functions;
2573 (ParameterReference.EmitLoad): Loads the content of the pointer
2574 without dereferencing.
2576 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2578 * cs-tokenizer.cs: Implemented the pre-processing expressions.
2580 2002-01-08 Ravi Pratap <ravi@ximian.com>
2582 * class.cs (Indexer.DefineMethod): Incorporate the interface
2583 type in the name of the method if we are doing explicit interface
2586 * expression.cs (ConversionExists): Remove as it is completely obsolete.
2588 (BetterConversion): Fix extremely trivial bug where we were referring to
2589 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
2592 * ../errors/bug16.cs : Add although we have fixed it.
2594 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2596 * expression.cs (BaseIndexer): Begin implementation.
2598 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
2600 * cs-parser.jay (indexer_declarator): Use qualified_identifier
2601 production directly to remove a shift/reduce, and implement
2602 explicit interface implementation.
2604 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
2605 after a floating point suffix.
2607 * expression.cs (DoNumericPromotions): Improved the conversion for
2608 uint/uint. If we have a constant, we avoid doing a typecast to a
2611 * class.cs (Indexer): Implement explicit interface implementation
2614 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
2616 * class.cs: make the default instance constructor public and hidebysig.
2618 2001-01-03 Ravi Pratap <ravi@ximian.com>
2620 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
2621 so we can call it from elsewhere.
2623 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
2624 we emit it internally if the class has a defined indexer; otherwise the user
2625 emits it by decorating the class definition with the DefaultMemberAttribute.
2627 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
2628 attribute is not used on a type which defines an indexer.
2630 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
2631 character when we skip whitespace.
2633 * ../errors/cs0646.cs : Add.
2635 2002-01-03 Miguel de Icaza <miguel@ximian.com>
2637 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
2640 * makefile: Add practical target `mcs3.exe' which builds the third
2641 generation compiler.
2643 * expression.cs (New): Fix structures constructor calling.
2645 * class.cs (Property, Method, Indexer): Emit Final flag on the
2646 method if we are an interface implementation and we are not
2649 * ecore.cs (PropertyExpr): New public field `IsBase', tells
2650 whether this property is referencing a `base' method.
2652 * expression.cs (Invocation.EmitCall): take an extra argument:
2653 is_base, this is used to determine whether the `call' or
2654 `callvirt' opcode should be used.
2657 * delegate.cs: update EmitCall.
2659 * class.cs (Method.Define): Set NewSlot for the cases where we are
2660 not implementing an interface method.
2662 (Property.Define): ditto.
2664 2002-01-02 Miguel de Icaza <miguel@ximian.com>
2666 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
2667 'r'. Allows mcs to parse itself fully.
2669 2002-01-02 Ravi Pratap <ravi@ximian.com>
2671 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
2672 of the number of initializers that require the InitializeArray method.
2674 (CheckIndices): Store the Expression in all cases - not the plain value. Also
2675 update the above field where necessary.
2677 (MakeByteBlob): Update accordingly.
2679 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
2682 (EmitDynamicInitializers): Update in accordance with the new optimization.
2684 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
2685 same OpCode applies.
2687 * cs-parser.jay : Fix some glaring errors I introduced.
2689 2002-01-01 Ravi Pratap <ravi@ximian.com>
2691 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
2692 so that we can check for name clashes there too.
2694 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
2695 for interface indexers.
2697 * interfaces.cs (Define): Emit the default member attribute.
2699 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
2700 variable was being referred to while setting the value ;-)
2702 2002-01-01 Miguel de Icaza <miguel@ximian.com>
2704 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
2705 byte-by-byte information when we know the data is zero.
2707 Make the block always a multiple of 4, because
2708 DefineInitializedData has a bug.
2710 * assign.cs: Fix, we should assign from the temporary, not from
2713 * expression.cs (MakeByteBlob): Fix my incorrect code.
2715 2001-12-31 Miguel de Icaza <miguel@ximian.com>
2717 * typemanager.cs (EnumToUnderlying): This function is used to get
2718 the underlying type from an enumeration, because it does not
2721 * constant.cs: Use the I4_S form for values between -128 and 127.
2723 * statement.cs (Block.LookupLabel): Looks up a label.
2724 (Block): Drop support for labeled blocks.
2726 (LabeledStatement): New kind of statement that represents a label
2729 (Goto): Finally implement this bad boy.
2731 * cs-parser.jay: Update to reflect new mechanism to implement
2734 2001-12-30 Miguel de Icaza <miguel@ximian.com>
2736 * codegen.cs (EmitContext.This): a codegen property that keeps the
2737 a single instance of this instead of creating many different this
2740 * delegate.cs (Delegate.DoResolve): Update to use the property;
2742 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
2744 * expression.cs (BaseAccess.DoResolve): Ditto.
2746 2001-12-29 Ravi Pratap <ravi@ximian.com>
2748 * typemanager.cs (methodimpl_attr_type): Add to hold the type
2749 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
2751 (InitCoreTypes): Update accordingly.
2753 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
2754 so we can quickly store the state.
2756 (ApplyAttributes): Set the correct implementation flags
2757 for InternalCall methods.
2759 2001-12-29 Miguel de Icaza <miguel@ximian.com>
2761 * expression.cs (EmitCall): if a method is not virtual, then do
2762 not use callvirt on it.
2764 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
2765 user defined stuff) requires the use of stobj, which takes an
2766 address on the stack instead of an array and an index. So emit
2767 the Ldelema operation for it.
2769 (EmitStoreOpcode): Use stobj for valuetypes.
2771 (UnaryMutator.EmitCode): Use the right 1 value depending on
2772 whether we are dealing with int64/uint64, float or doubles.
2774 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
2775 constructors that I implemented last night.
2777 (Constructor.IsDefault): Fix to work properly for static
2780 * cs-parser.jay (CheckDef): report method signature errors.
2781 Update error number 103 to be 132.
2783 * decl.cs: New AdditionResult enumeration value: MethodExists.
2784 Although we do this check for methods later on in the semantic
2785 analysis, catching repeated default constructors is so easy that
2786 we catch these here.
2788 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
2791 (ParameterReference.EmitAssign, Emit): handle
2794 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
2795 (ArrayAccess.EmitStoreOpcode): ditto.
2797 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
2799 * expression.cs (MakeByteBlob): Complete all the missing types
2800 (uint, short, ushort, byte, sbyte)
2802 * class.cs: Only init instance field initializers on instance
2805 Rename `constructors' to instance_constructors.
2807 (TypeContainer.AddConstructor): Only add constructors to the list
2808 if it is not static.
2810 Make sure that we handle default_static_constructor independently
2811 everywhere where we handle instance_constructors
2813 2001-12-28 Miguel de Icaza <miguel@ximian.com>
2815 * class.cs: Do not lookup or create a base initializer for a
2818 (ConstructorInitializer.Resolve): use the proper type to lookup
2821 * cs-parser.jay: Report error 1585 (modifiers between type and name).
2823 * enum.cs, interface.cs: Remove CloseType, this is taken care by
2826 * decl.cs: CloseType is now an virtual method, the default
2827 implementation just closes this type.
2829 2001-12-28 Ravi Pratap <ravi@ximian.com>
2831 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
2832 to PreserveSig by default. Also emit HideBySig on such methods.
2834 Basically, set the defaults to standard values.
2836 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
2837 argument, if candidate is better, it can't be worse than the best !
2839 (Invocation): Re-write bits to differentiate between methods being
2840 applicable in their expanded form and their normal form - for params
2843 Get rid of use_standard everywhere as only standard conversions are allowed
2844 in overload resolution.
2846 More spec conformance.
2848 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2850 * driver.cs: Add --timestamp, to see where the compiler spends
2853 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
2854 `this' in static code.
2856 (SimpleName.DoResolve): Implement in terms of a helper function
2857 that allows static-references to be passed upstream to
2860 (Expression.ResolveWithSimpleName): Resolve specially simple
2861 names when called by MemberAccess to implement the special
2864 (Expression.ImplicitReferenceConversion): Handle conversions from
2865 Null to reference types before others, as Null's type is
2868 * expression.cs (Invocation.EmitCall): Handle the special case of
2869 calling methods declared on a reference type from a ValueType
2870 (Base classes System.Object and System.Enum)
2872 (MemberAccess.Resolve): Only perform lookups on Enumerations if
2873 the left hand side is a TypeExpr, not on every enumeration.
2875 (Binary.Resolve): If types are reference types, then do a cast to
2876 object on operators != and == of both arguments.
2878 * typemanager.cs (FindMembers): Extract instance and static
2879 members if requested.
2881 * interface.cs (PopulateProperty): Use void_type instead of null
2882 as the return type for the setter method.
2884 (PopulateIndexer): ditto.
2886 2001-12-27 Ravi Pratap <ravi@ximian.com>
2888 * support.cs (ReflectionParameters): Fix minor bug where we
2889 were examining the wrong parameter for the ParamArray attribute.
2891 Cope with requests for the type of the parameter at position
2892 greater than the params parameter's. We now return the element
2893 type of the params array as that makes more sense.
2895 * expression.cs (Invocation.IsParamsMethodApplicable): Update
2896 accordingly as we no longer have to extract the element type
2899 (Invocation.OverloadResolve): Update.
2901 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2903 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
2904 against IEnumerator, test whether the return value is a descendant
2905 of the IEnumerator interface.
2907 * class.cs (Indexer.Define): Use an auxiliary method to implement
2908 the other bits of the method definition. Begin support for
2909 explicit interface implementation.
2911 (Property.DefineMethod): Use TypeManager.void_type instead of null
2912 for an empty return value.
2914 2001-12-26 Miguel de Icaza <miguel@ximian.com>
2916 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
2917 dealing with a FieldExpr which is composed of a FieldBuilder, in
2918 the code path we did extract the constant, but we should have
2919 obtained the underlying value to be able to cast it (otherwise we
2920 end up in an infinite loop, this is what Ravi was running into).
2922 (ArrayCreation.UpdateIndices): Arrays might be empty.
2924 (MemberAccess.ResolveMemberAccess): Add support for section
2925 14.5.4.1 that deals with the special case of E.I when E is a type
2926 and something else, that I can be a reference to a static member.
2928 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
2929 handle a particular array type to create byte blobs, it is just
2930 something we dont generate byteblobs for.
2932 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2935 * location.cs (Push): remove the key from the hashtable that we
2936 are about to add. This happens for empty files.
2938 * driver.cs: Dispose files after we have parsed them.
2940 (tokenize): new function that only runs the tokenizer on its
2941 input, for speed testing.
2943 2001-12-26 Ravi Pratap <ravi@ximian.com>
2945 * class.cs (Event.Define): Define the private field only if there
2946 are no accessors defined.
2948 * expression.cs (ResolveMemberAccess): If there is no associated
2949 field with the event, that means we have an event defined with its
2950 own accessors and we should flag error cs0070 since transforming
2951 ourselves into a field is not valid in that case.
2953 * ecore.cs (SimpleName.DoResolve): Same as above.
2955 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2956 and charset to sane values.
2958 2001-12-25 Ravi Pratap <ravi@ximian.com>
2960 * assign.cs (DoResolve): Perform check on events only if they
2961 are being accessed outside the declaring type.
2963 * cs-parser.jay (event_declarations): Update rules to correctly
2964 set the type of the implicit parameter etc.
2966 (add_accessor, remove_accessor): Set current local parameters.
2968 * expression.cs (Binary): For delegate addition and subtraction,
2969 cast the return value from the method into the appropriate delegate
2972 2001-12-24 Ravi Pratap <ravi@ximian.com>
2974 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2975 of these as the workaround is unnecessary.
2977 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2978 delegate data - none of that is needed at all.
2980 Re-write bits to extract the instance expression and the delegate method
2983 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
2986 * attribute.cs (ApplyAttributes): New method to take care of common tasks
2987 of attaching attributes instead of duplicating code everywhere.
2989 * everywhere : Update code to do attribute emission using the above method.
2991 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2993 * expression.cs (IsParamsMethodApplicable): if there are not
2994 parameters, return immediately.
2996 * ecore.cs: The 0 literal can be implicity converted to an enum
2999 (SimpleName.DoResolve): First lookup the type, then lookup the
3002 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
3003 want to get its address. If the InstanceExpression is not
3004 addressable, store the result in a temporary variable, then get
3007 * codegen.cs: Only display 219 errors on warning level or above.
3009 * expression.cs (ArrayAccess): Make it implement the
3010 IMemoryLocation interface.
3012 (Binary.DoResolve): handle the operator == (object a, object b)
3013 and operator != (object a, object b) without incurring into a
3014 BoxedCast (because 5 != o should never be performed).
3016 Handle binary enumerator operators.
3018 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
3019 value type, otherwise use Ldelem_ref.
3021 Use precomputed names;
3023 (AddressOf): Implement address of
3025 * cs-parser.jay (labeled_statement): Fix recursive block
3026 addition by reworking the production.
3028 * expression.cs (New.DoEmit): New has a special case:
3030 If we are dealing with a ValueType, we have a few
3031 situations to deal with:
3033 * The target of New is a ValueType variable, that is
3034 easy, we just pass this as the variable reference
3036 * The target of New is being passed as an argument,
3037 to a boxing operation or a function that takes a
3040 In this case, we need to create a temporary variable
3041 that is the argument of New.
3044 2001-12-23 Ravi Pratap <ravi@ximian.com>
3046 * rootcontext.cs (LookupType): Check that current_type is not null before
3047 going about looking at nested types.
3049 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
3050 not implement the IAssignMethod interface any more.
3052 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
3053 where we tranform them into FieldExprs if they are being resolved from within
3056 * ecore.cs (SimpleName.DoResolve): Do the same here.
3058 * assign.cs (DoResolve, Emit): Clean up code considerably.
3060 * ../errors/bug10.cs : Add.
3062 * ../errors/cs0070.cs : Add.
3064 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
3066 * assign.cs : Get rid of EventIsLocal everywhere.
3068 2001-12-23 Miguel de Icaza <miguel@ximian.com>
3070 * ecore.cs (ConvertIntLiteral): finished the implementation.
3072 * statement.cs (SwitchLabel): Convert the value we are using as a
3073 key before looking up the table.
3075 2001-12-22 Miguel de Icaza <miguel@ximian.com>
3077 * codegen.cs (EmitTopBlock): Require a Location argument now.
3079 * cs-parser.jay (constructor_declarator): We need to setup
3080 current_local_parameters before we parse the
3081 opt_constructor_initializer, to allow the variables to be bound
3082 to the constructor arguments.
3084 * rootcontext.cs (LookupType): First lookup nested classes in our
3085 class and our parents before we go looking outside our class.
3087 * expression.cs (ConstantFold): Extract/debox the values at the
3090 * rootcontext.cs (EmitCode): Resolve the constants first before we
3091 resolve the types. This is not really needed, but it helps debugging.
3093 * statement.cs: report location.
3095 * cs-parser.jay: pass location to throw statement.
3097 * driver.cs: Small bug fix.
3099 * report.cs: Updated format to be 4-zero filled digits.
3101 2001-12-22 Ravi Pratap <ravi@ximian.com>
3103 * expression.cs (CheckIndices): Fix minor bug where the wrong
3104 variable was being referred to ;-)
3106 (DoEmit): Do not call EmitStaticInitializers when the
3107 underlying type is System.Object.
3109 2001-12-21 Ravi Pratap <ravi@ximian.com>
3111 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
3112 and do the usual workaround for SRE.
3114 * class.cs (MyEventBuilder.EventType): New member to get at the type
3115 of the event, quickly.
3117 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
3119 * assign.cs (Assign.DoResolve): Handle the case when the target
3120 is an EventExpr and perform the necessary checks.
3122 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
3125 (SimpleName.MemberStaticCheck): Include check for EventExpr.
3127 (EventExpr): Set the type in the constructor itself since we
3128 are meant to be born fully resolved.
3130 (EventExpr.Define): Revert code I wrote earlier.
3132 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
3133 instance expression is null. The instance expression is a This in that case
3134 or a null, depending on whether it is a static method or not.
3136 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
3137 refers to more than one method.
3139 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
3140 and accordingly flag errors.
3142 2001-12-21 Miguel de Icaza <miguel@ximian.com>
3144 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
3146 2001-12-22 Miguel de Icaza <miguel@ximian.com>
3148 * location.cs (ToString): Provide useful rutine.
3150 2001-12-21 Miguel de Icaza <miguel@ximian.com>
3152 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
3153 objects, return the actual integral boxed.
3155 * statement.cs (SwitchLabel): define an ILLabel for each
3158 (Switch.CheckSwitch): If the value is a Literal, extract
3159 the underlying literal.
3161 Also in the unused hashtable we had, add the SwitchLabel so we can
3162 quickly look this value up.
3164 * constant.cs: Implement a bunch of new constants. Rewrite
3165 Literal based on this. Made changes everywhere to adapt to this.
3167 * expression.cs (Expression.MakeByteBlob): Optimize routine by
3168 dereferencing array only once, and also copes with enumrations.
3170 bytes are two bytes wide, not one.
3172 (Cast): Perform constant conversions.
3174 * ecore.cs (TryImplicitIntConversion): Return literals instead of
3175 wrappers to the literals here.
3177 * expression.cs (DoNumericPromotions): long literals can converted
3178 to ulong implicity (this is taken care of elsewhere, but I was
3181 * ecore.cs (Expression.Literalize): Make the return type Literal,
3182 to improve type checking.
3184 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
3186 2001-12-20 Miguel de Icaza <miguel@ximian.com>
3188 * literal.cs: Revert code from ravi that checked the bounds. The
3189 bounds are sane by the definition of the type itself.
3191 * typemanager.cs: Fix implementation of ImplementsInterface. We
3192 need to actually look up in our parent hierarchy for interfaces
3195 * const.cs: Use the underlying type for enumerations
3197 * delegate.cs: Compute the basename for the delegate creation,
3198 that should fix the delegate test case, and restore the correct
3199 Type Lookup semantics in rootcontext
3201 * rootcontext.cs: Revert Ravi's last patch. The correct way of
3202 referencing a nested type with the Reflection API is using the "+"
3205 * cs-parser.jay: Do not require EOF token at the end.
3207 2001-12-20 Ravi Pratap <ravi@ximian.com>
3209 * rootcontext.cs (LookupType): Concatenate type names with
3210 a '.' instead of a '+' The test suite passes again.
3212 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
3213 field of the enumeration.
3215 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
3216 the case when the member is an EventExpr.
3218 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
3219 static has an associated instance expression.
3221 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
3223 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
3225 * class.cs (Event.Define): Register event and perform appropriate checks
3228 We define the Add and Remove methods even if the use provides none because
3229 in that case, we provide default implementations ourselves.
3231 Define a private field of the type of the event. This is done by the CSC compiler
3232 and we should be doing it too ;-)
3234 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
3235 More methods we use in code we generate.
3237 (multicast_delegate_type, delegate_type): Two separate types since the distinction
3240 (InitCoreTypes): Update accordingly for the above.
3242 * class.cs (Event.Emit): Generate code for default accessors that we provide
3244 (EmitDefaultMethod): Do the job in the above.
3246 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
3249 2001-12-20 Miguel de Icaza <miguel@ximian.com>
3251 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
3252 builders even if we were missing one.
3254 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
3255 pass the Basename as our class name instead of the Name. The
3256 basename will be correctly composed for us.
3258 * parameter.cs (Paramters): Now takes a Location argument.
3260 * decl.cs (DeclSpace.LookupType): Removed convenience function and
3261 make all the code call directly LookupType in RootContext and take
3262 this chance to pass the Location information everywhere.
3264 * Everywhere: pass Location information.
3266 2001-12-19 Miguel de Icaza <miguel@ximian.com>
3268 * class.cs (Constructor.Define): Updated way of detecting the
3269 length of the parameters.
3271 (TypeContainer.DefineType): Use basename as the type name for
3274 (TypeContainer.Define): Do not recursively define types here, as
3275 definition is taken care in order by the RootContext.
3277 * tree.cs: Keep track of namespaces in a per-file basis.
3279 * parameter.cs (Parameter.ComputeSignature): Update to use
3282 (Parameters.GetSignature): ditto.
3284 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
3285 instead of a TypeContainer.
3287 (Interface.SemanticAnalysis): Use `this' instead of our parent to
3288 resolve names. Because we need to be resolve in our context, not
3291 * driver.cs: Implement response files.
3293 * class.cs (TypeContainer.DefineType): If we are defined, do not
3296 (Event.Emit): Emit the code for add/remove handlers.
3297 (Event.Define): Save the MethodBuilders for add/remove.
3299 * typemanager.cs: Use pair here too.
3301 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
3302 DictionaryEntry requires the first argument to be non-null.
3304 (enum_declaration): Compute full name for registering the
3307 (delegate_declaration): Instead of using
3308 formal_parameter_list, use opt_formal_parameter_list as the list
3311 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
3312 (EventParsing): New property that controls whether `add' and
3313 `remove' are returned as tokens or identifiers (for events);
3315 2001-12-19 Ravi Pratap <ravi@ximian.com>
3317 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
3318 use MyEventBuilder only and let it wrap the real builder for us.
3320 (MyEventBuilder): Revamp constructor etc.
3322 Implement all operations that we perform on EventBuilder in precisely the same
3325 (FindMembers): Update to use the EventBuilder member.
3327 (Event.Emit): Update accordingly.
3329 2001-12-18 Ravi Pratap <ravi@ximian.com>
3331 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
3332 by calling the appropriate methods.
3334 (GetCustomAttributes): Make stubs as they cannot possibly do anything
3337 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
3339 2001-12-17 Ravi Pratap <ravi@ximian.com>
3341 * delegate.cs (Delegate.Populate): Check that the return type
3342 and various parameters types are indeed accessible.
3344 * class.cs (Constructor.Define): Same here.
3346 (Field.Define): Ditto.
3348 (Event.Define): Ditto.
3350 (Operator.Define): Check that the underlying Method defined itself
3351 correctly - so it's MethodBuilder should not be null.
3353 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
3354 expression happens to be null.
3356 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
3357 members but as of now we don't seem to be able to do anything really useful with it.
3359 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
3360 not the EventBuilder.
3362 2001-12-18 Miguel de Icaza <miguel@ximian.com>
3364 * cs-tokenizer.cs: Add support for defines.
3365 Add support for #if, #elif, #else, #endif
3367 (eval_var): evaluates a variable.
3368 (eval): stubbed for evaluating functions.
3370 * cs-parser.jay: Pass the defines information
3372 * driver.cs: Add --define command line option.
3374 * decl.cs: Move MemberCore here.
3376 Make it the base class for DeclSpace. This allows us to catch and
3377 report 108 and 109 for everything now.
3379 * class.cs (TypeContainer.Define): Extract all the members
3380 before populating and emit the warning 108 (new keyword required
3381 to override) instead of having each member implement this.
3383 (MemberCore.Define): New abstract method, we will be using this in
3384 the warning reporting engine in Populate.
3386 (Operator.Define): Adjust to new MemberCore protocol.
3388 * const.cs (Const): This does not derive from Expression, it is a
3389 temporary object we use to create fields, it is a MemberCore.
3391 * class.cs (Method.Define): Allow the entry point to be in a
3394 * driver.cs: Rewrite the argument handler to clean it up a bit.
3396 * rootcontext.cs: Made it just an auxiliary namespace feature by
3397 making everything static.
3399 * driver.cs: Adapt code to use RootContext type name instead of
3402 * delegate.cs: Remove RootContext argument.
3404 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
3407 * class.cs (Event.Define): The lookup can fail.
3409 * cs-tokenizer.cs: Begin implementation of pre-procesor.
3411 * expression.cs: Resolve the this instance before invoking the code.
3413 2001-12-17 Miguel de Icaza <miguel@ximian.com>
3415 * cs-parser.jay: Add a production in element_access that allows
3416 the thing to become a "type" reference. This way we can parse
3417 things like "(string [])" as a type.
3419 Note that this still does not handle the more complex rules of
3423 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
3425 * ecore.cs: (CopyNewMethods): new utility function used to
3426 assemble the list of methods from running FindMembers.
3428 (MemberLookup): Rework FindMembers so that
3430 2001-12-16 Miguel de Icaza <miguel@ximian.com>
3432 * class.cs (TypeContainer): Remove Delegates who fail to be
3435 * delegate.cs (Populate): Verify that we dont get null return
3436 values. TODO: Check for AsAccessible.
3438 * cs-parser.jay: Use basename to emit error 574 (destructor should
3439 have the same name as container class), not the full name.
3441 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
3442 possible representation.
3444 Also implements integer type suffixes U and L.
3446 2001-12-15 Miguel de Icaza <miguel@ximian.com>
3448 * expression.cs (ArrayCreation.DoResolve): We need to do the
3449 argument resolution *always*.
3451 * decl.cs: Make this hold the namespace. Hold the root context as
3453 (LookupType): Move here.
3455 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
3457 * location.cs (Row, Name): Fixed the code, it was always returning
3458 references to the first file.
3460 * interface.cs: Register properties defined through interfaces.
3462 * driver.cs: Add support for globbing on the command line
3464 * class.cs (Field): Make it derive from MemberCore as well.
3467 2001-12-15 Ravi Pratap <ravi@ximian.com>
3469 * class.cs (Event::Define): Check that the type of the event is a delegate
3470 type else flag error #66.
3472 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
3475 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
3476 values of EntryPoint, CharSet etc etc.
3478 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
3480 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
3481 be null and we should ignore this. I am not sure if this is really clean. Apparently,
3482 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
3483 which needs this to do its work.
3485 * ../errors/cs0066.cs : Add.
3487 2001-12-14 Miguel de Icaza <miguel@ximian.com>
3489 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
3492 * class.cs: (MethodSignature.MethodSignature): Removed hack that
3493 clears out the parameters field.
3494 (MemberSignatureCompare): Cleanup
3496 (MemberCore): New base class used to share code between MethodCore
3499 (RegisterRequiredImplementations) BindingFlags.Public requires
3500 either BindingFlags.Instace or Static. Use instance here.
3502 (Property): Refactored code to cope better with the full spec.
3504 * parameter.cs (GetParameterInfo): Return an empty array instead
3507 * class.cs (Property): Abstract or extern properties have no bodies.
3509 * parameter.cs (GetParameterInfo): return a zero-sized array.
3511 * class.cs (TypeContainer.MethodModifiersValid): Move all the
3512 method modifier validation to the typecontainer so we can reuse
3515 (MethodCore.ParameterTypes): return an empty sized array of types.
3517 (Property.Define): Test property modifier validity.
3519 Add tests for sealed/override too.
3521 (Method.Emit): abstract or extern methods have no bodies.
3523 2001-12-14 Ravi Pratap <ravi@ximian.com>
3525 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
3528 (Method::Define, ::Emit): Modify accordingly.
3530 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
3532 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
3534 * makefile: Pass in /unsafe.
3536 2001-12-13 Miguel de Icaza <miguel@ximian.com>
3538 * class.cs (MakeKey): Kill routine.
3540 * class.cs (TypeContainer.Define): Correctly define explicit
3541 method implementations (they require the full interface name plus
3544 * typemanager.cs: Deply the PtrHashtable here and stop using the
3545 lame keys. Things work so much better.
3547 This of course broke everyone who depended on `RegisterMethod' to
3548 do the `test for existance' test. This has to be done elsewhere.
3550 * support.cs (PtrHashtable): A hashtable that avoid comparing with
3551 the object stupid Equals method (because, that like fails all over
3552 the place). We still do not use it.
3554 * class.cs (TypeContainer.SetRequiredInterface,
3555 TypeContainer.RequireMethods): Killed these two routines and moved
3556 all the functionality to RegisterRequiredImplementations.
3558 (TypeContainer.RegisterRequiredImplementations): This routine now
3559 registers all the implementations required in an array for the
3560 interfaces and abstract methods. We use an array of structures
3561 which can be computed ahead of time to reduce memory usage and we
3562 also assume that lookups are cheap as most classes will not
3563 implement too many interfaces.
3565 We also avoid creating too many MethodSignatures.
3567 (TypeContainer.IsInterfaceMethod): Update and optionally does not
3568 clear the "pending" bit if we find that there are problems with
3571 (TypeContainer.VerifyPendingMethods): Update to report errors of
3572 methods that look like implementations but are not.
3574 (TypeContainer.Define): Add support for explicit interface method
3577 2001-12-12 Miguel de Icaza <miguel@ximian.com>
3579 * typemanager.cs: Keep track of the parameters here instead of
3580 being a feature of the TypeContainer.
3582 * class.cs: Drop the registration of parameters here, as
3583 InterfaceMethods are also interface declarations.
3585 * delegate.cs: Register methods with the TypeManager not only with
3586 the TypeContainer. This code was buggy.
3588 * interface.cs: Full registation here.
3590 2001-12-11 Miguel de Icaza <miguel@ximian.com>
3592 * expression.cs: Remove reducer for binary expressions, it can not
3595 * const.cs: Put here the code that used to go into constant.cs
3597 * constant.cs: Put here the code for constants, this is a new base
3600 * literal.cs: Make Literal derive from Constant.
3602 2001-12-09 Miguel de Icaza <miguel@ximian.com>
3604 * statement.cs (Return.Emit): Report error 157 if the user
3605 attempts to return from a finally block.
3607 (Return.Emit): Instead of emitting a return, jump to the end of
3610 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
3611 LocalBuilder to store the result of the function. ReturnLabel is
3612 the target where we jump.
3615 2001-12-09 Radek Doulik <rodo@ximian.com>
3617 * cs-parser.jay: remember alias in current namespace
3619 * ecore.cs (SimpleName::DoResolve): use aliases for types or
3622 * class.cs (LookupAlias): lookup alias in my_namespace
3624 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
3626 (LookupAlias): lookup alias in this and if needed in parent
3629 2001-12-08 Miguel de Icaza <miguel@ximian.com>
3633 * rootcontext.cs: (ModuleBuilder) Made static, first step into
3634 making things static. I need this to avoid passing the
3635 TypeContainer when calling ParameterType.
3637 * support.cs (InternalParameters.ParameterType): Remove ugly hack
3638 that did string manipulation to compute the type and then call
3639 GetType. Use Parameter.ParameterType instead.
3641 * cs-tokenizer.cs: Consume the suffix for floating values.
3643 * expression.cs (ParameterReference): figure out whether this is a
3644 reference parameter or not. Kill an extra variable by computing
3645 the arg_idx during emission.
3647 * parameter.cs (Parameters.GetParameterInfo): New overloaded
3648 function that returns whether a parameter is an out/ref value or not.
3650 (Parameter.ParameterType): The type of the parameter (base,
3651 without ref/out applied).
3653 (Parameter.Resolve): Perform resolution here.
3654 (Parameter.ExternalType): The full type (with ref/out applied).
3656 * statement.cs (Using.Emit, Using.EmitExpression): Implement
3657 support for expressions on the using statement.
3659 2001-12-07 Miguel de Icaza <miguel@ximian.com>
3661 * statement.cs (Using.EmitLocalVariableDecls): Split the
3662 localvariable handling of the using statement.
3664 (Block.EmitMeta): Keep track of variable count across blocks. We
3665 were reusing slots on separate branches of blocks.
3667 (Try.Emit): Emit the general code block, we were not emitting it.
3669 Check the type of the declaration to be an IDisposable or
3670 something that can be implicity converted to it.
3672 Emit conversions if required.
3674 * ecore.cs (EmptyExpression): New utility class.
3675 (Expression.ImplicitConversionExists): New utility function.
3677 2001-12-06 Miguel de Icaza <miguel@ximian.com>
3679 * statement.cs (Using): Implement.
3681 * expression.cs (LocalVariableReference): Support read only variables.
3683 * statement.cs: Remove the explicit emit for the Leave opcode.
3684 (VariableInfo): Add a readonly field.
3686 2001-12-05 Miguel de Icaza <miguel@ximian.com>
3688 * ecore.cs (ConvCast): new class used to encapsulate the various
3689 explicit integer conversions that works in both checked and
3692 (Expression.ConvertNumericExplicit): Use new ConvCast class to
3693 properly generate the overflow opcodes.
3695 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3697 * statement.cs: The correct type for the EmptyExpression is the
3698 element_type, not the variable type. Ravi pointed this out.
3700 2001-12-04 Ravi Pratap <ravi@ximian.com>
3702 * class.cs (Method::Define): Handle PInvoke methods specially
3703 by using DefinePInvokeMethod instead of the usual one.
3705 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
3706 above to do the task of extracting information and defining the method.
3708 2001-12-04 Ravi Pratap <ravi@ximian.com>
3710 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
3711 of the condition for string type.
3713 (Emit): Move that here.
3715 (ArrayCreation::CheckIndices): Keep string literals in their expression
3718 (EmitDynamicInitializers): Handle strings appropriately.
3720 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3722 * codegen.cs (EmitContext): Replace multiple variables with a
3723 single pointer to the current Switch statement.
3725 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
3728 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3732 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
3735 (Foreach.Emit): Foreach on arrays was not setting
3736 up the loop variables (for break/continue).
3738 (GotoCase): Semi-implented.
3740 2001-12-03 Ravi Pratap <ravi@ximian.com>
3742 * attribute.cs (CheckAttribute): Handle system attributes by using
3743 Attribute.GetAttributes to examine information we need.
3745 (GetValidPlaces): Same here.
3747 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
3749 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
3751 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
3753 (Method::Define): Set appropriate flags if we have a DllImport attribute.
3755 (Method::Emit): Handle the case when we are a PInvoke method.
3757 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3759 * expression.cs: Use ResolveWithSimpleName on compound names.
3761 2001-12-02 Ravi Pratap <ravi@ximian.com>
3763 * constant.cs (EmitConstant): Make sure we resolve the associated expression
3764 before trying to reduce it.
3766 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
3768 * constant.cs (LookupConstantValue): Implement.
3770 (EmitConstant): Use the above in emitting the constant.
3772 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
3773 that are user-defined by doing a LookupConstantValue on them.
3775 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
3778 2001-11-29 Miguel de Icaza <miguel@ximian.com>
3780 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
3782 (BaseAccess.DoResolve): Implement.
3784 (MemberAccess.DoResolve): Split this routine into a
3785 ResolveMemberAccess routine that can be used independently
3787 2001-11-28 Miguel de Icaza <miguel@ximian.com>
3789 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
3790 As that share bits of the implementation. Is returns a boolean,
3791 while As returns the Type that is being probed.
3793 2001-12-01 Ravi Pratap <ravi@ximian.com>
3795 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
3796 instead of a Literal - much easier.
3798 (EnumInTransit): Remove - utterly useless :-)
3800 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
3802 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
3804 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
3805 chain when we have no associated expression.
3807 2001-11-30 Ravi Pratap <ravi@ximian.com>
3809 * constant.cs (Define): Use Location while reporting the errror.
3811 Also emit a warning when 'new' is used and there is no inherited
3814 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
3817 (LookupEnumValue): Implement to lookup an enum member's value and define it
3820 (Populate): Re-write accordingly to use the above routine.
3822 2001-11-27 Miguel de Icaza <miguel@ximian.com>
3824 * expression.cs (This): Fix prototype for DoResolveLValue to
3825 override the base class DoResolveLValue.
3827 * cs-parser.cs: Report errors cs574 and cs575 (destructor
3830 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
3831 (we need to load the address of the field here). This fixes
3834 (FieldExpr.DoResolveLValue): Call the DoResolve
3835 function to initialize the Instance expression.
3837 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
3838 correctly the GetEnumerator operation on a value type.
3840 * cs-parser.jay: Add more simple parsing error catches.
3842 * statement.cs (Switch): Add support for string switches.
3843 Handle null specially.
3845 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
3847 2001-11-28 Ravi Pratap <ravi@ximian.com>
3849 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
3851 (declare_local_constant): New helper function.
3853 * statement.cs (AddConstant): Keep a separate record of constants
3855 (IsConstant): Implement to determine if a variable is a constant.
3857 (GetConstantExpression): Implement.
3859 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
3861 * statement.cs (IsVariableDefined): Re-write.
3863 2001-11-27 Ravi Pratap <ravi@ximian.com>
3865 * class.cs (TypeContainer::FindMembers): Look for constants
3866 in the case when we are looking for MemberTypes.Field
3868 * expression.cs (MemberAccess::DoResolve): Check that in the
3869 case we are a FieldExpr and a Literal, we are not being accessed
3870 by an instance reference.
3872 * cs-parser.jay (local_constant_declaration): Implement.
3874 (declaration_statement): Implement for constant declarations.
3876 2001-11-26 Miguel de Icaza <miguel@ximian.com>
3878 * statement.cs (Switch): Catch double defaults.
3880 (Switch): More work on the switch() statement
3881 implementation. It works for integral values now, need to finish
3885 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3887 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
3888 integer literals into other integer literals. To be used by
3891 2001-11-24 Ravi Pratap <ravi@ximian.com>
3893 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
3896 (EmitDynamicInitializers): Cope with the above since we extract data
3897 directly from ArrayData now.
3899 (ExpectInitializers): Keep track of whether initializers are mandatory
3902 (Bounds): Make it a hashtable to prevent the same dimension being
3903 recorded for every element in that dimension.
3905 (EmitDynamicInitializers): Fix bug which prevented the Set array method
3908 Also fix bug which was causing the indices to be emitted in the reverse
3911 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3913 * expression.cs (ArrayCreation): Implement the bits that Ravi left
3914 unfinished. They do not work, because the underlying code is
3917 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3919 * cs-parser.jay: Remove bogus fixme.
3921 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
3922 on Switch statement.
3924 2001-11-23 Ravi Pratap <ravi@ximian.com>
3926 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
3929 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
3930 parameter. Apparently, any expression is allowed.
3932 (ValidateInitializers): Update accordingly.
3934 (CheckIndices): Fix some tricky bugs thanks to recursion.
3936 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
3937 I was being completely brain-dead.
3939 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3940 and re-write acordingly.
3942 (DelegateInvocation): Re-write accordingly.
3944 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3946 (MakeByteBlob): Handle types more correctly.
3948 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3949 initialization from expressions but it is incomplete because I am a complete
3952 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3954 * statement.cs (If.Emit): Fix a bug that generated incorrect code
3955 on If. Basically, we have to return `true' (ie, we do return to
3956 our caller) only if both branches of the if return.
3958 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3959 short-circuit operators, handle them as short circuit operators.
3961 (Cast.DoResolve): Resolve type.
3962 (Cast.Cast): Take an expression as the target type.
3964 * cs-parser.jay (cast_expression): Remove old hack that only
3965 allowed a limited set of types to be handled. Now we take a
3966 unary_expression and we resolve to a type during semantic
3969 Use the grammar productions from Rhys to handle casts (this is
3970 not complete like Rhys syntax yet, we fail to handle that corner
3971 case that C# has regarding (-x), but we will get there.
3973 2001-11-22 Ravi Pratap <ravi@ximian.com>
3975 * class.cs (EmitFieldInitializer): Take care of the case when we have a
3976 field which is an array type.
3978 * cs-parser.jay (declare_local_variables): Support array initialization too.
3980 * typemanager.cs (MakeKey): Implement.
3982 (everywhere): Use the above appropriately.
3984 * cs-parser.jay (for_statement): Update for array initialization while
3985 declaring variables.
3987 * ecore.cs : The error message was correct, it's the variable's names that
3988 were misleading ;-) Make the code more readable.
3990 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3991 the correct type etc.
3993 (ConvertExplicit): Handle Enum types by examining the underlying type.
3995 2001-11-21 Ravi Pratap <ravi@ximian.com>
3997 * parameter.cs (GetCallingConvention): Always return
3998 CallingConventions.Standard for now.
4000 2001-11-22 Miguel de Icaza <miguel@ximian.com>
4002 * expression.cs (Binary.ResolveOperator): Update the values of `l'
4003 and `r' after calling DoNumericPromotions.
4005 * ecore.cs: Fix error message (the types were in the wrong order).
4007 * statement.cs (Foreach.ProbeCollectionType): Need to pass
4008 BindingFlags.Instance as well
4010 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
4011 implicit int literal conversion in an empty cast so that we
4012 propagate the right type upstream.
4014 (UnboxCast): new class used to unbox value types.
4015 (Expression.ConvertExplicit): Add explicit type conversions done
4018 (Expression.ImplicitNumericConversion): Oops, forgot to test for
4019 the target type before applying the implicit LongLiterals to ULong
4022 2001-11-21 Miguel de Icaza <miguel@ximian.com>
4024 * cs-parser.jay (for_statement): Reworked the way For works: now
4025 we declare manually any variables that are introduced in
4026 for_initializer to solve the problem of having out-of-band code
4027 emition (that is what got for broken).
4029 (declaration_statement): Perform the actual variable declaration
4030 that used to be done in local_variable_declaration here.
4032 (local_variable_declaration): Do not declare anything, just pass
4033 the information on a DictionaryEntry
4035 2001-11-20 Ravi Pratap <ravi@ximian.com>
4037 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
4038 re-write of the logic to now make it recursive.
4040 (UpdateIndices): Re-write accordingly.
4042 Store element data in a separate ArrayData list in the above methods.
4044 (MakeByteBlob): Implement to dump the array data into a byte array.
4046 2001-11-19 Ravi Pratap <ravi@ximian.com>
4048 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
4051 * constant.cs (Define): Implement.
4053 (EmitConstant): Re-write fully.
4055 Pass in location info.
4057 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
4060 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
4061 DictionaryEntry since we need location info too.
4063 (constant_declaration): Update accordingly.
4065 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
4066 code into another method : UpdateIndices.
4068 2001-11-18 Ravi Pratap <ravi@ximian.com>
4070 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
4071 some type checking etc.
4073 2001-11-17 Ravi Pratap <ravi@ximian.com>
4075 * expression.cs (ArrayCreation::ValidateInitializers): Implement
4076 bits to provide dimension info if the user skips doing that.
4078 Update second constructor to store the rank correctly.
4080 2001-11-16 Ravi Pratap <ravi@ximian.com>
4082 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
4083 and try to implement.
4085 * ../errors/cs0150.cs : Add.
4087 * ../errors/cs0178.cs : Add.
4089 2001-11-16 Miguel de Icaza <miguel@ximian.com>
4091 * statement.cs: Implement foreach on multi-dimensional arrays.
4093 * parameter.cs (Parameters.GetParameterByName): Also lookup the
4094 name of the params argument.
4096 * expression.cs: Use EmitStoreOpcode to get the right opcode while
4097 initializing the array.
4099 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
4100 we can use this elsewhere.
4102 * statement.cs: Finish implementation of foreach for single
4105 * cs-parser.jay: Use an out-of-band stack to pass information
4106 around, I wonder why I need this.
4108 foreach_block: Make the new foreach_block the current_block.
4110 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
4111 function used to return a static Parameters structure. Used for
4112 empty parameters, as those are created very frequently.
4114 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
4116 2001-11-15 Ravi Pratap <ravi@ximian.com>
4118 * interface.cs : Default modifier is private, not public. The
4119 make verify test passes again.
4121 2001-11-15 Ravi Pratap <ravi@ximian.com>
4123 * support.cs (ReflectionParameters): Fix logic to determine
4124 whether the last parameter is a params one. Test 9 passes again.
4126 * delegate.cs (Populate): Register the builders we define with
4127 RegisterParameterForBuilder. Test 19 passes again.
4129 * cs-parser.jay (property_declaration): Reference $6 instead
4130 of $$ to get at the location.
4132 (indexer_declaration): Similar stuff.
4136 * class.cs (Property): Register parameters for the Get and Set methods
4137 if they exist. Test 23 passes again.
4139 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
4140 call to EmitArguments as we are sure there aren't any params arguments.
4141 Test 32 passes again.
4143 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
4144 IndexOutOfRangeException.
4146 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
4147 Test 33 now passes again.
4149 2001-11-15 Miguel de Icaza <miguel@ximian.com>
4151 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
4152 broke a bunch of things. Will have to come up with a better way
4153 of tracking locations.
4155 * statement.cs: Implemented foreach for single dimension arrays.
4157 2001-11-09 Miguel de Icaza <miguel@ximian.com>
4159 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
4160 an error. This removes the lookup from the critical path.
4162 * cs-parser.jay: Removed use of temporary_loc, which is completely
4165 2001-11-14 Miguel de Icaza <miguel@ximian.com>
4167 * support.cs (ReflectionParameters.ParameterModifier): Report
4168 whether the argument is a PARAMS argument or not.
4170 * class.cs: Set the attribute `ParamArrayAttribute' on the
4173 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
4174 and cons_param_array_attribute (ConstructorInfo for
4175 ParamArrayAttribute).,
4177 * codegen.cs: Emit the return using the `Return' statement, that
4178 way we can report the error correctly for missing return values.
4180 * class.cs (Method.Emit): Clean up.
4182 * expression.cs (Argument.Resolve): Take another argument: the
4183 location where this argument is used. Notice that this is not
4184 part of the "Argument" class as to reduce the size of the
4185 structure (we know the approximate location anyways).
4187 Test if the argument is a variable-reference, if not, then
4188 complain with a 206.
4190 (Argument.Emit): Emit addresses of variables.
4192 (Argument.FullDesc): Simplify.
4194 (Invocation.DoResolve): Update for Argument.Resolve.
4196 (ElementAccess.DoResolve): ditto.
4198 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
4199 method should be virtual, as this method is always virtual.
4201 (NewDelegate.DoResolve): Update for Argument.Resolve.
4203 * class.cs (ConstructorInitializer.DoResolve): ditto.
4205 * attribute.cs (Attribute.Resolve): ditto.
4207 2001-11-13 Miguel de Icaza <miguel@ximian.com>
4209 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
4211 * expression.cs (ParameterReference): Drop IStackStorage and implement
4212 IAssignMethod instead.
4214 (LocalVariableReference): ditto.
4216 * ecore.cs (FieldExpr): Drop IStackStorage and implement
4217 IAssignMethod instead.
4219 2001-11-13 Miguel de Icaza <miguel@ximian.com>
4221 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
4222 enumerations that are used in heavily used structures derive from
4223 byte in a laughable and pathetic attempt to reduce memory usage.
4224 This is the kind of pre-optimzations that you should not do at
4225 home without adult supervision.
4227 * expression.cs (UnaryMutator): New class, used to handle ++ and
4228 -- separatedly from the other unary operators. Cleans up the
4229 code, and kills the ExpressionStatement dependency in Unary.
4231 (Unary): Removed `method' and `Arguments' from this class, making
4232 it smaller, and moving it all to SimpleCall, so I can reuse this
4233 code in other locations and avoid creating a lot of transient data
4234 strucutres when not required.
4236 * cs-parser.jay: Adjust for new changes.
4238 2001-11-11 Miguel de Icaza <miguel@ximian.com>
4240 * enum.cs (Enum.Populate): If there is a failure during
4243 * cs-parser.jay (opt_enum_base): we used to catch type errors
4244 here, but this is really incorrect. The type error should be
4245 catched during semantic analysis.
4247 2001-12-11 Ravi Pratap <ravi@ximian.com>
4249 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
4250 current_local_parameters as expected since I, in my stupidity, had forgotten
4253 * attribute.cs (GetValidPlaces): Fix stupid bug.
4255 * class.cs (Method::Emit): Perform check on applicability of attributes.
4257 (Constructor::Emit): Ditto.
4259 (Field::Emit): Ditto.
4261 (Field.Location): Store location information.
4263 (Property, Event, Indexer, Operator): Ditto.
4265 * cs-parser.jay (field_declaration): Pass in location for each field.
4267 * ../errors/cs0592.cs : Add.
4269 2001-11-12 Ravi Pratap <ravi@ximian.com>
4271 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
4273 (InitCoreTypes): Update accordingly.
4275 (RegisterAttrType, LookupAttr): Implement.
4277 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
4278 info about the same.
4280 (Resolve): Update to populate the above as necessary.
4284 (GetValidPlaces): Helper to the above.
4286 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
4288 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
4290 2001-11-12 Ravi Pratap <ravi@ximian.com>
4292 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
4294 * ../errors/cs0617.cs : Add.
4296 2001-11-11 Ravi Pratap <ravi@ximian.com>
4298 * enum.cs (Emit): Rename to Populate to be more consistent with what
4299 we expect it to do and when exactly it is called.
4301 * class.cs, rootcontext.cs : Update accordingly.
4303 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
4304 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
4306 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
4308 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
4309 of a fieldinfo using the above, when dealing with a FieldBuilder.
4311 2001-11-10 Ravi Pratap <ravi@ximian.com>
4313 * ../errors/cs0031.cs : Add.
4315 * ../errors/cs1008.cs : Add.
4317 * ../errrors/cs0543.cs : Add.
4319 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
4322 (FindMembers): Implement.
4324 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
4325 enums and delegates too.
4327 (enum_types): Rename to builder_to_enum.
4329 (delegate_types): Rename to builder_to_delegate.
4331 * delegate.cs (FindMembers): Implement.
4333 2001-11-09 Ravi Pratap <ravi@ximian.com>
4335 * typemanager.cs (IsEnumType): Implement.
4337 * enum.cs (Emit): Re-write parts to account for the underlying type
4338 better and perform checking etc.
4340 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
4341 of the underlying type.
4343 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
4346 * enum.cs (error31): Helper to report error #31.
4348 * cs-parser.jay (enum_declaration): Store location of each member too.
4350 * enum.cs (member_to_location): New hashtable.
4352 (AddEnumMember): Update location hashtable.
4354 (Emit): Use the location of each member while reporting errors.
4356 2001-11-09 Miguel de Icaza <miguel@ximian.com>
4358 * cs-parser.jay: A for_initializer if is a
4359 local_variable_declaration really ammount to have an implicit
4360 block with the variable declaration and no initializer for for.
4362 * statement.cs (For.Emit): Cope with null initializers.
4364 This fixes the infinite loop on for initializers.
4366 2001-11-08 Miguel de Icaza <miguel@ximian.com>
4368 * enum.cs: More cleanup.
4370 * ecore.cs: Remove dead code.
4372 * class.cs (Property.Emit): More simplification.
4373 (Event.Emit): ditto.
4375 Reworked to have less levels of indentation.
4377 2001-11-08 Ravi Pratap <ravi@ximian.com>
4379 * class.cs (Property): Emit attributes.
4389 * enum.cs (Emit): Ditto.
4391 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
4394 * class.cs (Field, Event, etc.): Move attribute generation into the
4395 Emit method everywhere.
4397 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
4398 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
4399 as we had no way of defining nested enums !
4401 * rootcontext.cs : Adjust code accordingly.
4403 * typemanager.cs (AddEnumType): To keep track of enum types separately.
4405 2001-11-07 Ravi Pratap <ravi@ximian.com>
4407 * expression.cs (EvalConstantExpression): Move into ecore.cs
4409 * enum.cs (Enum): Rename some members and make them public and readonly
4410 according to our convention.
4412 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
4415 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
4417 (Enum::Emit): Write a simple version for now which doesn't try to compute
4418 expressions. I shall modify this to be more robust in just a while.
4420 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
4422 (TypeContainer::CloseType): Create the Enum types too.
4424 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
4426 * expression.cs (EvalConstantExpression): Get rid of completely.
4428 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
4429 user-defined values and other cases.
4431 (IsValidEnumLiteral): Helper function.
4433 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
4434 out there in the case we had a literal FieldExpr.
4436 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
4438 (Literalize): Revamp a bit to take two arguments.
4440 (EnumLiteral): New class which derives from Literal to wrap enum literals.
4442 2001-11-06 Ravi Pratap <ravi@ximian.com>
4444 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
4446 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
4448 (Resolve): Use the above to ensure we have proper initializers.
4450 2001-11-05 Ravi Pratap <ravi@ximian.com>
4452 * expression.cs (Expression::EvalConstantExpression): New method to
4453 evaluate constant expressions.
4455 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
4457 2001-11-07 Miguel de Icaza <miguel@ximian.com>
4459 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
4462 (Binary.ResolveOperator): Handle operator != (object a, object b)
4463 and operator == (object a, object b);
4465 (Binary.DoNumericPromotions): Indicate whether the numeric
4466 promotion was possible.
4468 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
4471 Made the ArrayAccess implement interface IAssignMethod instead of
4472 IStackStore as the order in which arguments are passed reflects
4475 * assign.cs: Instead of using expr.ExprClass to select the way of
4476 assinging, probe for the IStackStore/IAssignMethod interfaces.
4478 * typemanager.cs: Load InitializeArray definition.
4480 * rootcontext.cs (RootContext.MakeStaticData): Used to define
4481 static data that can be used to initialize arrays.
4483 2001-11-05 Miguel de Icaza <miguel@ximian.com>
4485 * expression.cs: Handle operator== and operator!= for booleans.
4487 (Conditioal.Reduce): Implement reducer for the ?: operator.
4489 (Conditional.Resolve): Implement dead code elimination.
4491 (Binary.Resolve): Catch string literals and return a new
4492 concatenated string.
4494 (Unary.Reduce): Implement reduction of unary expressions.
4496 * ecore.cs: Split out the expression core handling here.
4498 (Expression.Reduce): New method used to perform constant folding
4499 and CSE. This is needed to support constant-expressions.
4501 * statement.cs (Statement.EmitBoolExpression): Pass true and false
4502 targets, and optimize for !x.
4504 2001-11-04 Ravi Pratap <ravi@ximian.com>
4506 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
4507 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
4508 set custom atttributes.
4510 * literal.cs (Literal::GetValue): New abstract method to return the actual
4511 value of the literal, cast as an object.
4513 (*Literal): Implement GetValue method.
4515 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
4516 expressions to the arraylist but objects of type Argument.
4518 * class.cs (TypeContainer::Emit): Emit our attributes too.
4520 (Method::Emit, Constructor::Emit): Ditto.
4522 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
4523 to be ignoring earlier.
4525 2001-11-03 Ravi Pratap <ravi@ximian.com>
4527 * attribute.cs (AttributeSection::Define): Implement to do the business
4528 of constructing a CustomAttributeBuilder.
4530 (Attribute): New trivial class. Increases readability of code.
4532 * cs-parser.jay : Update accordingly.
4534 (positional_argument_list, named_argument_list, named_argument): New rules
4536 (attribute_arguments): Use the above so that we are more correct.
4538 2001-11-02 Ravi Pratap <ravi@ximian.com>
4540 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
4541 to perform all checks for a method with a params parameter.
4543 (Invocation::OverloadResolve): Update to use the above method and therefore
4544 cope correctly with params method invocations.
4546 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
4549 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
4550 constructors in our parent too because we can't afford to miss out on
4553 * attribute.cs (AttributeSection): New name for the class Attribute
4555 Other trivial changes to improve readability.
4557 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
4558 use the new class names.
4560 2001-11-01 Ravi Pratap <ravi@ximian.com>
4562 * class.cs (Method::Define): Complete definition for params types too
4564 (Indexer::Define): Ditto.
4566 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
4567 Cope everywhere with a request for info about the array parameter.
4569 2001-11-01 Ravi Pratap <ravi@ximian.com>
4571 * tree.cs (RecordNamespace): Fix up to check for the correct key.
4573 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
4574 local_variable_type to extract the string corresponding to the type.
4576 (local_variable_type): Fixup the action to use the new helper method.
4578 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
4581 * expression.cs : Clean out code which uses the above.
4583 2001-10-31 Ravi Pratap <ravi@ximian.com>
4585 * typemanager.cs (RegisterMethod): Check if we already have an existing key
4586 and bale out if necessary by returning a false.
4588 (RegisterProperty): Ditto.
4590 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
4591 and print out appropriate error messages.
4593 * interface.cs (everywhere): Ditto.
4595 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
4596 location to constructor.
4598 * class.cs (Property, Event, Indexer): Update accordingly.
4600 * ../errors/cs111.cs : Added.
4602 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
4603 of a method, as laid down by the spec.
4605 (Invocation::OverloadResolve): Use the above method.
4607 2001-10-31 Ravi Pratap <ravi@ximian.com>
4609 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
4610 now take a TypeContainer and a Parameters object.
4612 (ParameterData): Modify return type of ParameterModifier method to be
4613 Parameter.Modifier and not a string.
4615 (ReflectionParameters, InternalParameters): Update accordingly.
4617 * expression.cs (Argument::GetParameterModifier): Same here.
4619 * support.cs (InternalParameters::ParameterType): Find a better way of determining
4620 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
4621 symbol in it at all so maybe this is only for now.
4623 2001-10-30 Ravi Pratap <ravi@ximian.com>
4625 * support.cs (InternalParameters): Constructor now takes an extra argument
4626 which is the actual Parameters class.
4628 (ParameterDesc): Update to provide info on ref/out modifiers.
4630 * class.cs (everywhere): Update call to InternalParameters to pass in
4631 the second argument too.
4633 * support.cs (ParameterData): Add ParameterModifier, which is a method
4634 to return the modifier info [ref/out etc]
4636 (InternalParameters, ReflectionParameters): Implement the above.
4638 * expression.cs (Argument::ParameterModifier): Similar function to return
4639 info about the argument's modifiers.
4641 (Invocation::OverloadResolve): Update to take into account matching modifiers
4644 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
4645 a new SetFormalParameters object which we pass to InternalParameters.
4647 2001-10-30 Ravi Pratap <ravi@ximian.com>
4649 * expression.cs (NewArray): Merge into the ArrayCreation class.
4651 2001-10-29 Ravi Pratap <ravi@ximian.com>
4653 * expression.cs (NewArray): Merge classes NewBuiltinArray and
4654 NewUserdefinedArray into one as there wasn't much of a use in having
4657 * expression.cs (Argument): Change field's name to ArgType from Type.
4659 (Type): New readonly property which returns the proper type, taking into
4660 account ref/out modifiers.
4662 (everywhere): Adjust code accordingly for the above.
4664 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
4665 whether we are emitting for a ref or out parameter.
4667 * expression.cs (Argument::Emit): Use the above field to set the state.
4669 (LocalVariableReference::Emit): Update to honour the flag and emit the
4672 * parameter.cs (Attributes): Set the correct flags for ref parameters.
4674 * expression.cs (Argument::FullDesc): New function to provide a full desc.
4676 * support.cs (ParameterData): Add method ParameterDesc to the interface.
4678 (ReflectionParameters, InternalParameters): Implement the above method.
4680 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
4683 (Invocation::FullMethodDesc): Ditto.
4685 2001-10-29 Miguel de Icaza <miguel@ximian.com>
4687 * cs-parser.jay: Add extra production for the second form of array
4690 * expression.cs (ArrayCreation): Update to reflect the above
4693 * Small changes to prepare for Array initialization.
4695 2001-10-28 Miguel de Icaza <miguel@ximian.com>
4697 * typemanager.cs (ImplementsInterface): interface might be null;
4698 Deal with this problem;
4700 Also, we do store negative hits on the cache (null values), so use
4701 this instead of calling t.GetInterfaces on the type everytime.
4703 2001-10-28 Ravi Pratap <ravi@ximian.com>
4705 * typemanager.cs (IsBuiltinType): New method to help determine the same.
4707 * expression.cs (New::DoResolve): Get rid of array creation code and instead
4708 split functionality out into different classes.
4710 (New::FormArrayType): Move into NewBuiltinArray.
4712 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
4715 (NewBuiltinArray): New class to handle creation of built-in arrays.
4717 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
4718 account creation of one-dimensional arrays.
4720 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
4722 (NewUserdefinedArray::DoResolve): Implement.
4724 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
4726 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
4727 we maintain inside the TypeManager. This is necessary to perform lookups on the
4730 (LookupType): Update to perform GetType on the module builders too.
4732 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
4734 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
4736 2001-10-23 Ravi Pratap <ravi@ximian.com>
4738 * expression.cs (New::DoResolve): Implement guts of array creation.
4740 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
4742 2001-10-27 Miguel de Icaza <miguel@ximian.com>
4744 * expression.cs: Fix bug I introduced lsat night that broke
4747 (Expression.Resolve): Report a 246 error (can not resolve name)
4748 if we find a SimpleName in the stream.
4750 (Expression.ResolveLValue): Ditto.
4752 (Expression.ResolveWithSimpleName): This function is a variant of
4753 ResolveName, this one allows SimpleNames to be returned without a
4754 warning. The only consumer of SimpleNames is MemberAccess
4756 2001-10-26 Miguel de Icaza <miguel@ximian.com>
4758 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
4759 might arrive here. I have my doubts that this is correct.
4761 * statement.cs (Lock): Implement lock statement.
4763 * cs-parser.jay: Small fixes to support `lock' and `using'
4765 * cs-tokenizer.cs: Remove extra space
4767 * driver.cs: New flag --checked, allows to turn on integer math
4770 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
4771 Threading.Monitor.Exit
4773 2001-10-23 Miguel de Icaza <miguel@ximian.com>
4775 * expression.cs (IndexerAccess::DoResolveLValue): Set the
4776 Expression Class to be IndexerAccess.
4778 Notice that Indexer::DoResolve sets the eclass to Value.
4780 2001-10-22 Miguel de Icaza <miguel@ximian.com>
4782 * class.cs (TypeContainer::Emit): Emit code for indexers.
4784 * assign.cs (IAssignMethod): New interface implemented by Indexers
4785 and Properties for handling assignment.
4787 (Assign::Emit): Simplify and reuse code.
4789 * expression.cs (IndexerAccess, PropertyExpr): Implement
4790 IAssignMethod, clean up old code.
4792 2001-10-22 Ravi Pratap <ravi@ximian.com>
4794 * typemanager.cs (ImplementsInterface): New method to determine if a type
4795 implements a given interface. Provides a nice cache too.
4797 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
4800 (ConvertReferenceExplicit): Ditto.
4802 * delegate.cs (Delegate::Populate): Update to define the parameters on the
4803 various methods, with correct names etc.
4805 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
4806 Operator.UnaryNegation.
4808 * cs-parser.jay (operator_declarator): Be a little clever in the case where
4809 we have a unary plus or minus operator.
4811 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
4814 * everywhere : update accordingly.
4816 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
4819 * class.cs (Method::Define): For the case where we are implementing a method
4820 inherited from an interface, we need to set the MethodAttributes.Final flag too.
4821 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
4823 2001-10-21 Ravi Pratap <ravi@ximian.com>
4825 * interface.cs (FindMembers): Implement to work around S.R.E
4828 * typemanager.cs (IsInterfaceType): Implement.
4830 (FindMembers): Update to handle interface types too.
4832 * expression.cs (ImplicitReferenceConversion): Re-write bits which
4833 use IsAssignableFrom as that is not correct - it doesn't work.
4835 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
4836 and accordingly override EmitStatement.
4838 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
4839 using the correct logic :-)
4841 2001-10-19 Ravi Pratap <ravi@ximian.com>
4843 * ../errors/cs-11.cs : Add to demonstrate error -11
4845 2001-10-17 Miguel de Icaza <miguel@ximian.com>
4847 * assign.cs (Assign::Resolve): Resolve right hand side first, and
4848 then pass this as a hint to ResolveLValue.
4850 * expression.cs (FieldExpr): Add Location information
4852 (FieldExpr::LValueResolve): Report assignment to readonly
4855 (Expression::ExprClassFromMemberInfo): Pass location information.
4857 (Expression::ResolveLValue): Add new method that resolves an
4860 (Expression::DoResolveLValue): Default invocation calls
4863 (Indexers): New class used to keep track of indexers in a given
4866 (IStackStore): Renamed from LValue, as it did not really describe
4867 what this did. Also ResolveLValue is gone from this interface and
4868 now is part of Expression.
4870 (ElementAccess): Depending on the element access type
4872 * typemanager.cs: Add `indexer_name_type' as a Core type
4873 (System.Runtime.CompilerServices.IndexerNameAttribute)
4875 * statement.cs (Goto): Take a location.
4877 2001-10-18 Ravi Pratap <ravi@ximian.com>
4879 * delegate.cs (Delegate::VerifyDelegate): New method to verify
4880 if two delegates are compatible.
4882 (NewDelegate::DoResolve): Update to take care of the case when
4883 we instantiate a delegate from another delegate.
4885 * typemanager.cs (FindMembers): Don't even try to look up members
4886 of Delegate types for now.
4888 2001-10-18 Ravi Pratap <ravi@ximian.com>
4890 * delegate.cs (NewDelegate): New class to take care of delegate
4893 * expression.cs (New): Split the delegate related code out into
4894 the NewDelegate class.
4896 * delegate.cs (DelegateInvocation): New class to handle delegate
4899 * expression.cs (Invocation): Split out delegate related code into
4900 the DelegateInvocation class.
4902 2001-10-17 Ravi Pratap <ravi@ximian.com>
4904 * expression.cs (New::DoResolve): Implement delegate creation fully
4905 and according to the spec.
4907 (New::DoEmit): Update to handle delegates differently.
4909 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
4910 because of which we were printing out arguments in reverse order !
4912 * delegate.cs (VerifyMethod): Implement to check if the given method
4913 matches the delegate.
4915 (FullDelegateDesc): Implement.
4917 (VerifyApplicability): Implement.
4919 * expression.cs (Invocation::DoResolve): Update to accordingly handle
4920 delegate invocations too.
4922 (Invocation::Emit): Ditto.
4924 * ../errors/cs1593.cs : Added.
4926 * ../errors/cs1594.cs : Added.
4928 * delegate.cs (InstanceExpression, TargetMethod): New properties.
4930 2001-10-16 Ravi Pratap <ravi@ximian.com>
4932 * typemanager.cs (intptr_type): Core type for System.IntPtr
4934 (InitCoreTypes): Update for the same.
4936 (iasyncresult_type, asynccallback_type): Ditto.
4938 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4941 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4944 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4945 the builders for the 4 members of a delegate type :-)
4947 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4950 * expression.cs (New::DoResolve): Implement guts for delegate creation.
4952 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4954 2001-10-15 Miguel de Icaza <miguel@ximian.com>
4956 * statement.cs (Break::Emit): Implement.
4957 (Continue::Emit): Implement.
4959 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
4960 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
4961 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
4962 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
4965 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4966 properties that track the label for the current loop (begin of the
4967 loop and end of the loop).
4969 2001-10-15 Ravi Pratap <ravi@ximian.com>
4971 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4972 use of emitting anything at all.
4974 * class.cs, rootcontext.cs : Get rid of calls to the same.
4976 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4978 (Populate): Define the constructor correctly and set the implementation
4981 * typemanager.cs (delegate_types): New hashtable to hold delegates that
4984 (AddDelegateType): Implement.
4986 (IsDelegateType): Implement helper method.
4988 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4990 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4991 and accordingly handle it.
4993 * delegate.cs (Populate): Take TypeContainer argument.
4994 Implement bits to define the Invoke method. However, I still haven't figured out
4995 how to take care of the native int bit :-(
4997 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
4998 Qualify the name of the delegate, not its return type !
5000 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
5003 (StandardConversionExists): Checking for array types turns out to be recursive.
5005 (ConvertReferenceExplicit): Implement array conversion.
5007 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
5009 2001-10-12 Ravi Pratap <ravi@ximian.com>
5011 * cs-parser.jay (delegate_declaration): Store the fully qualified
5012 name as it is a type declaration.
5014 * delegate.cs (ReturnType, Name): Rename members to these. Make them
5017 (DefineDelegate): Renamed from Define. Does the same thing essentially,
5018 as TypeContainer::DefineType.
5020 (Populate): Method in which all the definition of the various methods (Invoke)
5023 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
5026 (CloseDelegate): Finally creates the delegate.
5028 * class.cs (TypeContainer::DefineType): Update to define delegates.
5029 (Populate, Emit and CloseType): Do the same thing here too.
5031 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
5032 delegates in all these operations.
5034 2001-10-14 Miguel de Icaza <miguel@ximian.com>
5036 * expression.cs: LocalTemporary: a new expression used to
5037 reference a temporary that has been created.
5039 * assign.cs: Handle PropertyAccess back here, so that we can
5040 provide the proper semantic access to properties.
5042 * expression.cs (Expression::ConvertReferenceExplicit): Implement
5043 a few more explicit conversions.
5045 * modifiers.cs: `NEW' modifier maps to HideBySig.
5047 * expression.cs (PropertyExpr): Make this into an
5048 ExpressionStatement, and support the EmitStatement code path.
5050 Perform get/set error checking, clean up the interface.
5052 * assign.cs: recognize PropertyExprs as targets, and if so, turn
5053 them into toplevel access objects.
5055 2001-10-12 Miguel de Icaza <miguel@ximian.com>
5057 * expression.cs: PropertyExpr::PropertyExpr: use work around the
5060 * typemanager.cs: Keep track here of our PropertyBuilders again to
5061 work around lameness in SRE.
5063 2001-10-11 Miguel de Icaza <miguel@ximian.com>
5065 * expression.cs (LValue::LValueResolve): New method in the
5066 interface, used to perform a second resolution pass for LValues.
5068 (This::DoResolve): Catch the use of this in static methods.
5070 (This::LValueResolve): Implement.
5072 (This::Store): Remove warning, assigning to `this' in structures
5075 (Invocation::Emit): Deal with invocation of
5076 methods on value types. We need to pass the address to structure
5077 methods rather than the object itself. (The equivalent code to
5078 emit "this" for structures leaves the entire structure on the
5079 stack instead of a pointer to it).
5081 (ParameterReference::DoResolve): Compute the real index for the
5082 argument based on whether the method takes or not a `this' pointer
5083 (ie, the method is static).
5085 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
5086 value types returned from functions when we need to invoke a
5087 method on the sturcture.
5090 2001-10-11 Ravi Pratap <ravi@ximian.com>
5092 * class.cs (TypeContainer::DefineType): Method to actually do the business of
5093 defining the type in the Modulebuilder or Typebuilder. This is to take
5094 care of nested types which need to be defined on the TypeBuilder using
5097 (TypeContainer::GetClassBases): Implement. Essentially the code from the
5098 methods in RootContext, only ported to be part of TypeContainer.
5100 (TypeContainer::GetInterfaceOrClass): Ditto.
5102 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
5104 * interface.cs (Interface::DefineInterface): New method. Does exactly
5105 what RootContext.CreateInterface did earlier, only it takes care of nested types
5108 (Interface::GetInterfaces): Move from RootContext here and port.
5110 (Interface::GetInterfaceByName): Same here.
5112 * rootcontext.cs (ResolveTree): Re-write.
5114 (PopulateTypes): Re-write.
5116 * class.cs (TypeContainer::Populate): Populate nested types too.
5117 (TypeContainer::Emit): Emit nested members too.
5119 * typemanager.cs (AddUserType): Do not make use of the FullName property,
5120 instead just use the name argument passed in as it is already fully
5123 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
5124 to TypeContainer mapping to see if a type is user-defined.
5126 * class.cs (TypeContainer::CloseType): Implement.
5128 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
5129 the default constructor.
5131 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
5134 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
5136 * interface.cs (CloseType): Create the type here.
5138 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
5141 Remove all the methods which are now in TypeContainer.
5143 2001-10-10 Ravi Pratap <ravi@ximian.com>
5145 * delegate.cs (Define): Re-write bits to define the delegate
5148 2001-10-10 Miguel de Icaza <miguel@ximian.com>
5150 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
5152 * expression.cs (ImplicitReferenceConversion): handle null as well
5153 as a source to convert to any reference type.
5155 * statement.cs (Return): Perform any implicit conversions to
5156 expected return type.
5158 Validate use of return statement.
5160 * codegen.cs (EmitContext): Pass the expected return type here.
5162 * class.cs (Method, Constructor, Property): Pass expected return
5163 type to EmitContext.
5165 2001-10-09 Miguel de Icaza <miguel@ximian.com>
5167 * expression.cs: Make DoResolve take an EmitContext instead of a
5170 Replaced `l' and `location' for `loc', for consistency.
5172 (Error, Warning): Remove unneeded Tc argument.
5174 * assign.cs, literal.cs, constant.cs: Update to new calling
5177 * codegen.cs: EmitContext now contains a flag indicating whether
5178 code is being generated in a static method or not.
5180 * cs-parser.jay: DecomposeQI, new function that replaces the old
5181 QualifiedIdentifier. Now we always decompose the assembled
5182 strings from qualified_identifier productions into a group of
5185 2001-10-08 Miguel de Icaza <miguel@ximian.com>
5187 * rootcontext.cs: Deal with field-less struct types correctly now
5188 by passing the size option to Define Type.
5190 * class.cs: Removed hack that created one static field.
5192 2001-10-07 Miguel de Icaza <miguel@ximian.com>
5194 * statement.cs: Moved most of the code generation here.
5196 2001-10-09 Ravi Pratap <ravi@ximian.com>
5198 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
5201 (ElementAccess): Remove useless bits for now - keep checks as the spec
5204 2001-10-08 Ravi Pratap <ravi@ximian.com>
5206 * expression.cs (ElementAccess::DoResolve): Remove my crap code
5207 and start performing checks according to the spec.
5209 2001-10-07 Ravi Pratap <ravi@ximian.com>
5211 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
5212 rank_specifiers instead.
5214 (rank_specifiers): Change the order in which the rank specifiers are stored
5216 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
5218 * expression.cs (ElementAccess): Implement the LValue interface too.
5220 2001-10-06 Ravi Pratap <ravi@ximian.com>
5222 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
5223 except that user defined conversions are not included.
5225 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
5226 perform the conversion of the return type, if necessary.
5228 (New::DoResolve): Check whether we are creating an array or an object
5229 and accordingly do the needful.
5231 (New::Emit): Same here.
5233 (New::DoResolve): Implement guts of array creation.
5235 (New::FormLookupType): Helper function.
5237 2001-10-07 Miguel de Icaza <miguel@ximian.com>
5239 * codegen.cs: Removed most of the code generation here, and move the
5240 corresponding code generation bits to the statement classes.
5242 Added support for try/catch/finalize and throw.
5244 * cs-parser.jay: Added support for try/catch/finalize.
5246 * class.cs: Catch static methods having the flags override,
5247 virtual or abstract.
5249 * expression.cs (UserCast): This user cast was not really doing
5250 what it was supposed to do. Which is to be born in fully resolved
5251 state. Parts of the resolution were being performed at Emit time!
5255 2001-10-05 Miguel de Icaza <miguel@ximian.com>
5257 * expression.cs: Implicity convert the result from UserCast.
5259 2001-10-05 Ravi Pratap <ravi@ximian.com>
5261 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
5262 prevented it from working correctly.
5264 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
5265 merely ConvertImplicit.
5267 2001-10-05 Miguel de Icaza <miguel@ximian.com>
5269 * typemanager.cs: Make the LookupTypeContainer function static,
5270 and not per-instance.
5272 * class.cs: Make static FindMembers (the one that takes a Type
5275 * codegen.cs: Add EmitForeach here.
5277 * cs-parser.jay: Make foreach a toplevel object instead of the
5278 inline expansion, as we need to perform semantic analysis on it.
5280 2001-10-05 Ravi Pratap <ravi@ximian.com>
5282 * expression.cs (Expression::ImplicitUserConversion): Rename to
5283 UserDefinedConversion.
5285 (Expression::UserDefinedConversion): Take an extra argument specifying
5286 whether we look for explicit user conversions too.
5288 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
5290 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
5292 (ExplicitUserConversion): Make it a call to UserDefinedConversion
5293 with the appropriate arguments.
5295 * cs-parser.jay (cast_expression): Record location too.
5297 * expression.cs (Cast): Record location info.
5299 (Expression::ConvertExplicit): Take location argument.
5301 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
5302 to determine if we are doing explicit conversions.
5304 (UserCast::Emit): Update accordingly.
5306 (Expression::ConvertExplicit): Report an error if everything fails.
5308 * ../errors/cs0030.cs : Add.
5310 2001-10-04 Miguel de Icaza <miguel@ximian.com>
5312 * modifiers.cs: If the ABSTRACT keyword is present, also set the
5313 virtual and newslot bits.
5315 * class.cs (TypeContainer::RegisterRequiredImplementations):
5316 Record methods we need.
5318 (TypeContainer::MakeKey): Helper function to make keys for
5319 MethodBases, since the Methodbase key is useless.
5321 (TypeContainer::Populate): Call RegisterRequiredImplementations
5322 before defining the methods.
5324 Create a mapping for method_builders_to_methods ahead of time
5325 instead of inside a tight loop.
5327 (::RequireMethods): Accept an object as the data to set into the
5328 hashtable so we can report interface vs abstract method mismatch.
5330 2001-10-03 Miguel de Icaza <miguel@ximian.com>
5332 * report.cs: Make all of it static.
5334 * rootcontext.cs: Drop object_type and value_type computations, as
5335 we have those in the TypeManager anyways.
5337 Drop report instance variable too, now it is a global.
5339 * driver.cs: Use try/catch on command line handling.
5341 Add --probe option to debug the error reporting system with a test
5344 * report.cs: Add support for exiting program when a probe
5345 condition is reached.
5347 2001-10-03 Ravi Pratap <ravi@ximian.com>
5349 * expression.cs (Binary::DoNumericPromotions): Fix the case when
5350 we do a forcible conversion regardless of type, to check if
5351 ForceConversion returns a null.
5353 (Binary::error19): Use location to report error.
5355 (Unary::error23): Use location here too.
5357 * ../errors/cs0019.cs : Check in.
5359 * ../errors/cs0023.cs : Check in.
5361 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
5362 case of a non-null MethodInfo object with a length of 0 !
5364 (Binary::ResolveOperator): Flag error if overload resolution fails to find
5365 an applicable member - according to the spec :-)
5366 Also fix logic to find members in base types.
5368 (Unary::ResolveOperator): Same here.
5370 (Unary::report23): Change name to error23 and make first argument a TypeContainer
5371 as I was getting thoroughly confused between this and error19 :-)
5373 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
5374 (::FindMostEncompassedType): Implement.
5375 (::FindMostEncompassingType): Implement.
5376 (::StandardConversionExists): Implement.
5378 (UserImplicitCast): Re-vamp. We now need info about most specific
5379 source and target types so that we can do the necessary conversions.
5381 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
5382 mathematical union with no duplicates.
5384 2001-10-03 Miguel de Icaza <miguel@ximian.com>
5386 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
5387 in order from base classes to child classes, so that we can in
5388 child classes look up in our parent for method names and
5389 attributes (required for handling abstract, virtual, new, override
5390 constructs: we need to instrospect our base class, and if we dont
5391 populate the classes in order, the introspection might be
5392 incorrect. For example, a method could query its parent before
5393 the parent has any methods and would determine that the parent has
5394 no abstract methods (while it could have had them)).
5396 (RootContext::CreateType): Record the order in which we define the
5399 2001-10-02 Miguel de Icaza <miguel@ximian.com>
5401 * class.cs (TypeContainer::Populate): Also method definitions can
5402 fail now, keep track of this.
5404 (TypeContainer::FindMembers): Implement support for
5405 DeclaredOnly/noDeclaredOnly flag.
5407 (Constructor::Emit) Return the ConstructorBuilder.
5409 (Method::Emit) Return the MethodBuilder.
5410 Check for abstract or virtual methods to be public.
5412 * rootcontext.cs (RootContext::CreateType): Register all the
5413 abstract methods required for the class to be complete and the
5414 interface methods that must be implemented.
5416 * cs-parser.jay: Report error 501 (method requires body if it is
5417 not marked abstract or extern).
5419 * expression.cs (TypeOf::Emit): Implement.
5421 * typemanager.cs: runtime_handle_type, new global type.
5423 * class.cs (Property::Emit): Generate code for properties.
5425 2001-10-02 Ravi Pratap <ravi@ximian.com>
5427 * expression.cs (Unary::ResolveOperator): Find operators on base type
5428 too - we now conform exactly to the spec.
5430 (Binary::ResolveOperator): Same here.
5432 * class.cs (Operator::Define): Fix minor quirk in the tests.
5434 * ../errors/cs0215.cs : Added.
5436 * ../errors/cs0556.cs : Added.
5438 * ../errors/cs0555.cs : Added.
5440 2001-10-01 Miguel de Icaza <miguel@ximian.com>
5442 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
5443 single integer which is really efficient
5445 2001-10-01 Ravi Pratap <ravi@ximian.com>
5447 * expression.cs (Expression::ImplicitUserConversion): Use location
5448 even in the case when we are examining True operators.
5450 * class.cs (Operator::Define): Perform extensive checks to conform
5451 with the rules for operator overloading in the spec.
5453 * expression.cs (Expression::ImplicitReferenceConversion): Implement
5454 some of the other conversions mentioned in the spec.
5456 * typemanager.cs (array_type): New static member for the System.Array built-in
5459 (cloneable_interface): For System.ICloneable interface.
5461 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
5462 we start resolving the tree and populating types.
5464 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
5466 2001-10-01 Miguel de Icaza <miguel@ximian.com>
5468 * expression.cs (Expression::ExprClassFromMemberInfo,
5469 Expression::Literalize): Create literal expressions from
5470 FieldInfos which are literals.
5472 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
5473 type casts, because they were wrong. The test suite in tests
5476 (ImplicitNumericConversion): ushort to ulong requires a widening
5479 Int32 constant to long requires widening cast as well.
5481 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
5482 for integers because the type on the stack is not i4.
5484 2001-09-30 Miguel de Icaza <miguel@ximian.com>
5486 * expression.cs (report118): require location argument.
5488 * parameter.cs: Do not dereference potential null value.
5490 * class.cs: Catch methods that lack the `new' keyword when
5491 overriding a name. Report warnings when `new' is used without
5492 anything being there to override.
5494 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
5496 * class.cs: Only add constructor to hashtable if it is non-null
5497 (as now constructors can fail on define).
5499 (TypeManager, Class, Struct): Take location arguments.
5501 Catch field instance initialization in structs as errors.
5503 accepting_filter: a new filter for FindMembers that is static so
5504 that we dont create an instance per invocation.
5506 (Constructor::Define): Catch errors where a struct constructor is
5509 * cs-parser.jay: Pass location information for various new
5512 * delegate.cs (Delegate): take a location argument.
5514 * driver.cs: Do not call EmitCode if there were problesm in the
5515 Definition of the types, as many Builders wont be there.
5517 * decl.cs (Decl::Decl): Require a location argument.
5519 * cs-tokenizer.cs: Handle properly hex constants that can not fit
5520 into integers, and find the most appropiate integer for it.
5522 * literal.cs: Implement ULongLiteral.
5524 * rootcontext.cs: Provide better information about the location of
5525 failure when CreateType fails.
5527 2001-09-29 Miguel de Icaza <miguel@ximian.com>
5529 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
5532 * expression.cs (Binary::CheckShiftArguments): Add missing type
5534 (Binary::ResolveOperator): Add type to the logical and and logical
5535 or, Bitwise And/Or and Exclusive Or code paths, it was missing
5538 (Binary::DoNumericPromotions): In the case where either argument
5539 is ulong (and most signed types combined with ulong cause an
5540 error) perform implicit integer constant conversions as well.
5542 2001-09-28 Miguel de Icaza <miguel@ximian.com>
5544 * expression.cs (UserImplicitCast): Method should always be
5546 (Invocation::BetterConversion): Simplified test for IntLiteral.
5548 (Expression::ImplicitNumericConversion): Split this routine out.
5549 Put the code that performs implicit constant integer conversions
5552 (Expression::Resolve): Become a wrapper around DoResolve so we can
5553 check eclass and type being set after resolve.
5555 (Invocation::Badness): Remove this dead function
5557 (Binary::ResolveOperator): Do not compute the expensive argumnets
5558 unless we have a union for it.
5560 (Probe::Emit): Is needs to do an isinst and then
5561 compare against null.
5563 (::CanConvert): Added Location argument. If the Location argument
5564 is null (Location.Null), then we do not report errors. This is
5565 used by the `probe' mechanism of the Explicit conversion. We do
5566 not want to generate an error for something that the user
5567 explicitly requested to be casted. But the pipeline for an
5568 explicit cast first tests for potential implicit casts.
5570 So for now, if the Location is null, it means `Probe only' to
5571 avoid adding another argument. Might have to revise this
5574 (ClassCast): New class used to type cast objects into arbitrary
5575 classes (used in Explicit Reference Conversions).
5577 Implement `as' as well.
5579 Reverted all the patches from Ravi below: they were broken:
5581 * The use of `level' as a mechanism to stop recursive
5582 invocations is wrong. That was there just to catch the
5583 bug with a strack trace but not as a way of addressing
5586 To fix the problem we have to *understand* what is going
5587 on and the interactions and come up with a plan, not
5588 just get things going.
5590 * The use of the type conversion cache that I proposed
5591 last night had an open topic: How does this work across
5592 protection domains. A user defined conversion might not
5593 be public in the location where we are applying the
5594 conversion, a different conversion might be selected
5595 (ie, private A->B (better) but public B->A (worse),
5596 inside A, A->B applies, but outside it, B->A will
5599 * On top of that (ie, even if the above is solved),
5600 conversions in a cache need to be abstract. Ie, `To
5601 convert from an Int to a Short use an OpcodeCast', not
5602 `To convert from an Int to a Short use the OpcodeCast on
5603 the variable 5' (which is what this patch was doing).
5605 2001-09-28 Ravi Pratap <ravi@ximian.com>
5607 * expression.cs (Invocation::ConversionExists): Re-write to use
5608 the conversion cache
5610 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
5611 cache all conversions done, not just user-defined ones.
5613 (Invocation::BetterConversion): The real culprit. Use ConversionExists
5614 to determine if a conversion exists instead of acutually trying to
5615 perform the conversion. It's faster too.
5617 (Expression::ConvertExplicit): Modify to use ConversionExists to check
5618 and only then attempt the implicit conversion.
5620 2001-09-28 Ravi Pratap <ravi@ximian.com>
5622 * expression.cs (ConvertImplicit): Use a cache for conversions
5623 already found. Check level of recursion and bail out if necessary.
5625 2001-09-28 Miguel de Icaza <miguel@ximian.com>
5627 * typemanager.cs (string_concat_string_string, string_concat_object_object):
5628 Export standard methods that we expect for string operations.
5630 * statement.cs (Block::UsageWarning): Track usage of variables and
5631 report the errors for not used variables.
5633 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
5636 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5638 * codegen.cs: remove unnneded code
5640 * expression.cs: Removed BuiltinTypeAccess class
5642 Fix the order in which implicit conversions are
5645 The previous fixed dropped support for boxed conversions (adding a
5646 test to the test suite now)
5648 (UserImplicitCast::CanConvert): Remove test for source being null,
5649 that code is broken. We should not feed a null to begin with, if
5650 we do, then we should track the bug where the problem originates
5651 and not try to cover it up here.
5653 Return a resolved expression of type UserImplicitCast on success
5654 rather than true/false. Ravi: this is what I was talking about,
5655 the pattern is to use a static method as a "constructor" for
5658 Also, do not create arguments until the very last minute,
5659 otherwise we always create the arguments even for lookups that
5660 will never be performed.
5662 (UserImplicitCast::Resolve): Eliminate, objects of type
5663 UserImplicitCast are born in a fully resolved state.
5665 * typemanager.cs (InitCoreTypes): Init also value_type
5668 * expression.cs (Cast::Resolve): First resolve the child expression.
5670 (LValue): Add new method AddressOf to be used by
5673 Change the argument of Store to take an EmitContext instead of an
5674 ILGenerator, because things like FieldExpr need to be able to call
5675 their children expression to generate the instance code.
5677 (Expression::Error, Expression::Warning): Sugar functions for
5680 (Expression::MemberLookup): Accept a TypeContainer instead of a
5681 Report as the first argument.
5683 (Expression::ResolvePrimary): Killed. I still want to improve
5684 this as currently the code is just not right.
5686 (Expression::ResolveMemberAccess): Simplify, but it is still
5689 (Unary::Resolve): Catch errors in AddressOf operators.
5691 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
5692 index to a byte for the short-version, or the compiler will choose
5693 the wrong Emit call, which generates the wrong data.
5695 (ParameterReference::Emit, ::Store): same.
5697 (FieldExpr::AddressOf): Implement.
5699 * typemanager.cs: TypeManager: made public variable instead of
5702 * driver.cs: document --fatal.
5704 * report.cs (ErrorMessage, WarningMessage): new names for the old
5705 Error and Warning classes.
5707 * cs-parser.jay (member_access): Turn built-in access to types
5708 into a normal simplename
5710 2001-09-27 Ravi Pratap <ravi@ximian.com>
5712 * expression.cs (Invocation::BetterConversion): Fix to cope
5713 with q being null, since this was introducing a bug.
5715 * expression.cs (ConvertImplicit): Do built-in conversions first.
5717 2001-09-27 Ravi Pratap <ravi@ximian.com>
5719 * expression.cs (UserImplicitCast::Resolve): Fix bug.
5721 2001-09-27 Ravi Pratap <ravi@ximian.com>
5723 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
5724 I had introduced long ago (what's new ?).
5726 * expression.cs (UserImplicitCast::CanConvert): Static method to do
5727 the work of all the checking.
5728 (ConvertImplicit): Call CanConvert and only then create object if necessary.
5729 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
5731 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
5732 that is the right way.
5734 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
5735 overloading resolution. Use everywhere instead of cutting and pasting code.
5737 (Binary::ResolveOperator): Use MakeUnionSet.
5739 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
5740 we have to convert to bool types. Not complete yet.
5742 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5744 * typemanager.cs (TypeManager::CSharpName): support ushort.
5746 * expression.cs (Expression::TryImplicitIntConversion): Attempts
5747 to provide an expression that performsn an implicit constant int
5748 conversion (section 6.1.6).
5749 (Expression::ConvertImplicitRequired): Reworked to include
5750 implicit constant expression conversions.
5752 (Expression::ConvertNumericExplicit): Finished.
5754 (Invocation::Emit): If InstanceExpression is null, then it means
5755 that we perform a call on this.
5757 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5759 * expression.cs (Unary::Emit): Remove some dead code.
5760 (Probe): Implement Resolve and Emit for `is'.
5761 (Expression::ConvertImplicitRequired): Attempt to do constant
5762 expression conversions here. Maybe should be moved to
5763 ConvertImplicit, but I am not sure.
5764 (Expression::ImplicitLongConstantConversionPossible,
5765 Expression::ImplicitIntConstantConversionPossible): New functions
5766 that tell whether is it possible to apply an implicit constant
5767 expression conversion.
5769 (ConvertNumericExplicit): Started work on explicit numeric
5772 * cs-parser.jay: Update operator constants.
5774 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
5775 (Parameters::GetSignature): Hook up VerifyArgs here.
5776 (Parameters::VerifyArgs): Verifies that no two arguments have the
5779 * class.cs (Operator): Update the operator names to reflect the
5780 ones that the spec expects (as we are just stringizing the
5783 * expression.cs (Unary::ResolveOperator): Fix bug: Use
5784 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
5785 previous usage did only work for our methods.
5786 (Expression::ConvertImplicit): Handle decimal implicit numeric
5787 conversions as well.
5788 (Expression::InternalTypeConstructor): Used to invoke constructors
5789 on internal types for default promotions.
5791 (Unary::Emit): Implement special handling for the pre/post
5792 increment/decrement for overloaded operators, as they need to have
5793 the same semantics as the other operators.
5795 (Binary::ResolveOperator): ditto.
5796 (Invocation::ConversionExists): ditto.
5797 (UserImplicitCast::Resolve): ditto.
5799 2001-09-26 Ravi Pratap <ravi@ximian.com>
5801 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
5802 operator, return after emitting body. Regression tests pass again !
5804 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
5805 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
5806 (Invocation::OverloadResolve): Ditto.
5807 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
5809 * everywhere : update calls to the above methods accordingly.
5811 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5813 * assign.cs (Assign): Make it inherit from ExpressionStatement.
5815 * expression.cs (ExpressionStatement): New base class used for
5816 expressions that can appear in statements, so that we can provide
5817 an alternate path to generate expression that do not leave a value
5820 (Expression::Emit, and all the derivatives): We no longer return
5821 whether a value is left on the stack or not. Every expression
5822 after being emitted leaves a single value on the stack.
5824 * codegen.cs (EmitContext::EmitStatementExpression): Use the
5825 facilties of ExpressionStatement if possible.
5827 * cs-parser.jay: Update statement_expression.
5829 2001-09-25 Miguel de Icaza <miguel@ximian.com>
5831 * driver.cs: Change the wording of message
5833 2001-09-25 Ravi Pratap <ravi@ximian.com>
5835 * expression.cs (Binary::ResolveOperator): Had forgottten to set
5836 the type of the expression to the return type of the method if
5837 we have an overloaded operator match ! The regression tests pass again !
5838 (Unary::ResolveOperator): Ditto.
5840 * expression.cs (Invocation::ConversionExists): Correct the member lookup
5841 to find "op_Implicit", not "implicit" ;-)
5842 (UserImplicitCast): New class to take care of user-defined implicit conversions.
5843 (ConvertImplicit, ForceConversion): Take TypeContainer argument
5845 * everywhere : Correct calls to the above accordingly.
5847 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
5848 (ConvertImplicit): Do user-defined conversion if it exists.
5850 2001-09-24 Miguel de Icaza <miguel@ximian.com>
5852 * assign.cs: track location.
5853 (Resolve): Use implicit conversions on assignment.
5855 * literal.cs: Oops. Not good, Emit of short access values should
5856 pass (Bytes) or the wrong argument will be selected.
5858 * expression.cs (Unary::Emit): Emit code for -expr.
5860 (Unary::ResolveOperator): Handle `Substract' for non-constants
5861 (substract from zero from the non-constants).
5862 Deal with Doubles as well.
5864 (Expression::ConvertImplicitRequired): New routine that reports an
5865 error if no implicit conversion exists.
5867 (Invocation::OverloadResolve): Store the converted implicit
5868 expressions if we make them
5870 2001-09-24 Ravi Pratap <ravi@ximian.com>
5872 * class.cs (ConstructorInitializer): Take a Location argument.
5873 (ConstructorBaseInitializer): Same here.
5874 (ConstructorThisInitializer): Same here.
5876 * cs-parser.jay : Update all calls accordingly.
5878 * expression.cs (Unary, Binary, New): Take location argument.
5879 Update accordingly everywhere.
5881 * cs-parser.jay : Update all calls to the above to take a location
5886 2001-09-24 Ravi Pratap <ravi@ximian.com>
5888 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
5889 (Invocation::BetterConversion): Same here
5890 (Invocation::ConversionExists): Ditto.
5892 (Invocation::ConversionExists): Implement.
5894 2001-09-22 Ravi Pratap <ravi@ximian.com>
5896 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
5897 Also take an additional TypeContainer argument.
5899 * All over : Pass in TypeContainer as argument to OverloadResolve.
5901 * typemanager.cs (CSharpName): Update to check for the string type and return
5904 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
5907 2001-09-21 Ravi Pratap <ravi@ximian.com>
5909 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
5910 (Invocation::BetterFunction): Implement.
5911 (Invocation::BetterConversion): Implement.
5912 (Invocation::ConversionExists): Skeleton, no implementation yet.
5914 Okay, things work fine !
5916 2001-09-21 Miguel de Icaza <miguel@ximian.com>
5918 * typemanager.cs: declare and load enum_type, delegate_type and
5921 * expression.cs (Expression::Emit): Now emit returns a value that
5922 tells whether a value is left on the stack or not. This strategy
5923 might be reveted tomorrow with a mechanism that would address
5924 multiple assignments.
5925 (Expression::report118): Utility routine to report mismatches on
5928 (Unary::Report23): Report impossible type/operator combination
5931 (Unary::IsIncrementableNumber): Whether the type can be
5932 incremented or decremented with add.
5933 (Unary::ResolveOperator): Also allow enumerations to be bitwise
5935 (Unary::ResolveOperator): Implement ++, !, ~,
5937 (Invocation::Emit): Deal with new Emit convetion.
5939 * All Expression derivatives: Updated their Emit method to return
5940 whether they leave values on the stack or not.
5942 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5943 stack for expressions that are statements.
5945 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5947 * expression.cs (LValue): New interface. Must be implemented by
5949 (LocalVariableReference, ParameterReference, FieldExpr): Implement
5952 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5953 interface for generating code, simplifies the code.
5955 2001-09-20 Ravi Pratap <ravi@ximian.com>
5957 * expression.cs (everywhere): Comment out return statements in ::Resolve
5958 methods to avoid the warnings.
5960 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5962 * driver.cs (parse): Report error 2001 if we can not open the
5965 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5968 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5971 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5972 otherwise nested blocks end up with the same index.
5974 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5976 * expression.cs: Instead of having FIXMEs in the Resolve
5977 functions, throw exceptions so it is obvious that we are facing a
5980 * cs-parser.jay (invocation_expression): Pass Location information.
5982 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5983 Use a basename for those routines because .NET does not like paths
5986 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5989 2001-09-19 Miguel de Icaza <miguel@ximian.com>
5991 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5992 are loading the correct data types (throws an exception if not).
5993 (TypeManager::InitCoreTypes): Use CoreLookupType
5995 * expression.cs (Unary::ResolveOperator): return the child
5996 expression for expressions which are just +expr.
5997 (Unary::ResolveOperator): Return negative literals for -LITERAL
5998 expressions (otherwise they are Unary {Literal}).
5999 (Invocation::Badness): Take into account `Implicit constant
6000 expression conversions'.
6002 * literal.cs (LongLiteral): Implement long literal class.
6003 (IntLiteral): export the `Value' of the intliteral.
6005 2001-09-19 Ravi Pratap <ravi@ximian.com>
6007 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
6009 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
6010 instead of 'Operator'
6012 * expression.cs (Binary::ResolveOperator): Update accordingly.
6013 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
6016 * cs-parser.jay (unary_expression): Update to use the new names.
6018 * gen-treedump.cs (GetUnary): Same here.
6020 * expression.cs (Unary::Resolve): Implement.
6021 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
6022 operators are found instead of making noise ;-)
6023 (Unary::ResolveOperator): New method to do precisely the same thing which
6024 Binary::ResolveOperator does for Binary expressions.
6025 (Unary.method, .Arguments): Add.
6026 (Unary::OperName): Implement.
6027 (Unary::ForceConversion): Copy and Paste !
6029 * class.cs (Operator::Define): Fix a small bug for the case when we have
6032 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
6033 for the inbuilt operators. Only overloading works for now ;-)
6035 2001-09-18 Miguel de Icaza <miguel@ximian.com>
6037 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
6038 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
6040 * expression.cs (This::Emit): Implement.
6041 (This::Resolve): Implement.
6042 (TypeOf:Resolve): Implement.
6043 (Expression::ResolveSimpleName): Add an implicit this to instance
6045 (MemberAccess::Resolve): Deal with Parameters and Fields.
6046 Bind instance variable to Field expressions.
6047 (FieldExpr::Instance): New field used to track the expression that
6048 represents the object instance.
6049 (FieldExpr::Resolve): Track potential errors from MemberLookup not
6051 (FieldExpr::Emit): Implement.
6053 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
6054 the last instruction contains a return opcode to avoid generating
6055 the last `ret' instruction (this generates correct code, and it is
6056 nice to pass the peverify output).
6058 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
6059 initializer for static and instance variables.
6060 (Constructor::Emit): Allow initializer to be null in the case of
6061 static constructors. Only emit initializer for instance
6064 (TypeContainer::FindMembers): Return a null array if there are no
6067 Also fix the code for the MemberTypes.Method branch, as it was not
6068 scanning that for operators (or tried to access null variables before).
6070 * assign.cs (Assign::Emit): Handle instance and static fields.
6074 * driver.cs: Stop compilation if there are parse errors.
6076 * cs-parser.jay (constructor_declaration): Provide default base
6077 initializer for non-static constructors.
6078 (constructor_declarator): Do not provide a default base
6079 initializers if none was specified.
6080 Catch the fact that constructors should not have parameters.
6082 * class.cs: Do not emit parent class initializers for static
6083 constructors, that should be flagged as an error.
6085 2001-09-18 Ravi Pratap <ravi@ximian.com>
6087 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
6088 Move back code into TypeContainer::Populate.
6090 2001-09-18 Ravi Pratap <ravi@ximian.com>
6092 * class.cs (TypeContainer::AddConstructor): Fix the check to
6093 compare against Name, not Basename.
6094 (Operator::OpType): Change Plus and Minus to Add and Subtract.
6096 * cs-parser.jay : Update accordingly.
6098 * class.cs (TypeContainer::FindMembers): For the case where we are searching
6099 for methods, don't forget to look into the operators too.
6100 (RegisterMethodBuilder): Helper method to take care of this for
6101 methods, constructors and operators.
6102 (Operator::Define): Completely revamp.
6103 (Operator.OperatorMethod, MethodName): New fields.
6104 (TypeContainer::Populate): Move the registering of builders into
6105 RegisterMethodBuilder.
6106 (Operator::Emit): Re-write.
6108 * expression.cs (Binary::Emit): Comment out code path to emit method
6109 invocation stuff for the case when we have a user defined operator. I am
6110 just not able to get it right !
6112 2001-09-17 Miguel de Icaza <miguel@ximian.com>
6114 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
6117 (Expression::MemberLookup): Provide a version that allows to
6118 specify the MemberTypes and BindingFlags.
6120 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
6121 so it was not fetching variable information from outer blocks.
6123 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
6124 Beforefieldinit as it was buggy.
6126 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
6129 * class.cs (Constructor::Emit): Only emit if block is not null.
6130 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
6131 deal with this by semantically definining it as if the user had
6134 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
6135 constructors as we now "emit" them at a higher level.
6137 (TypeContainer::DefineDefaultConstructor): Used to define the
6138 default constructors if none was provided.
6140 (ConstructorInitializer): Add methods Resolve and Emit.
6142 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
6144 2001-09-17 Ravi Pratap <ravi@ximian.com>
6146 * class.cs (TypeContainer::EmitDefaultConstructor): Register
6147 the default constructor builder with our hashtable for methodbuilders
6150 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
6151 and argument_count is 0 in which case we have a match.
6152 (Binary::ResolveOperator): More null checking and miscellaneous coding
6155 2001-09-17 Ravi Pratap <ravi@ximian.com>
6157 * rootcontext.cs (IsNameSpace): Compare against null.
6159 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
6161 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
6162 and Unary::Operator.
6164 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
6167 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
6168 we have overloaded operators.
6169 (Binary::ResolveOperator): Implement the part which does the operator overload
6172 * class.cs (Operator::Emit): Implement.
6173 (TypeContainer::Emit): Emit the operators we have too.
6175 * expression.cs (Binary::Emit): Update to emit the appropriate code for
6176 the case when we have a user-defined operator.
6178 2001-09-17 Miguel de Icaza <miguel@ximian.com>
6180 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
6182 2001-09-16 Ravi Pratap <ravi@ximian.com>
6184 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
6185 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
6186 (Constructor::Emit): Implement.
6187 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
6188 if we have no work to do.
6189 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
6192 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
6193 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
6195 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
6198 2001-09-15 Ravi Pratap <ravi@ximian.com>
6200 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
6202 (Tree::RecordNamespace): Method to do what the name says ;-)
6203 (Tree::Namespaces): Property to get at the namespaces hashtable.
6205 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
6208 * rootcontext.cs (IsNamespace): Fixed it :-)
6210 2001-09-14 Miguel de Icaza <miguel@ximian.com>
6212 * class.cs (TypeContainer::FindMembers): Add support for
6214 (MethodCore): New class that encapsulates both the shared aspects
6215 of a Constructor and a Method.
6216 (Method, Constructor): Factored pieces into MethodCore.
6218 * driver.cs: Added --fatal which makes errors throw exceptions.
6219 Load System assembly as well as part of the standard library.
6221 * report.cs: Allow throwing exceptions on errors for debugging.
6223 * modifiers.cs: Do not use `parent', instead use the real type
6224 container to evaluate permission settings.
6226 * class.cs: Put Ravi's patch back in. He is right, and we will
6227 have to cope with the
6229 2001-09-14 Ravi Pratap <ravi@ximian.com>
6231 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
6232 FamORAssem, not FamANDAssem.
6234 2001-09-14 Miguel de Icaza <miguel@ximian.com>
6236 * driver.cs: Added --parse option that only parses its input files
6239 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
6240 incorrect. IsTopLevel is not used to tell whether an object is
6241 root_types or not (that can be achieved by testing this ==
6242 root_types). But to see if this is a top-level *class* (not
6243 necessarly our "toplevel" container).
6245 2001-09-14 Ravi Pratap <ravi@ximian.com>
6247 * enum.cs (Enum::Define): Modify to call the Lookup method on the
6248 parent instead of a direct call to GetType.
6250 2001-09-14 Ravi Pratap <ravi@ximian.com>
6252 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
6253 Modifiers.TypeAttr. This should just be a call to that method.
6255 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
6256 object so that we can determine if we are top-level or not.
6258 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
6261 * enum.cs (Enum::Define): Ditto.
6263 * modifiers.cs (FieldAttr): Re-write.
6265 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
6266 (TypeContainer::HaveStaticConstructor): New property to provide access
6267 to precisely that info.
6269 * modifiers.cs (MethodAttr): Re-write.
6270 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
6272 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
6273 of top-level types as claimed.
6275 2001-09-13 Miguel de Icaza <miguel@ximian.com>
6277 * expression.cs (MemberLookup): Fruitless attempt to lookup
6278 constructors. Maybe I need to emit default constructors? That
6279 might be it (currently .NET emits this for me automatically).
6280 (Invocation::OverloadResolve): Cope with Arguments == null.
6281 (Invocation::EmitArguments): new function, shared by the new
6283 (Invocation::Emit): Handle static and instance methods. Emit
6284 proper call instruction for virtual or non-virtual invocations.
6285 (New::Emit): Implement.
6286 (New::Resolve): Implement.
6287 (MemberAccess:Resolve): Implement.
6288 (MethodGroupExpr::InstanceExpression): used conforming to the spec
6290 (FieldExpr::Resolve): Set type.
6292 * support.cs: Handle empty arguments.
6294 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
6295 SimpleLookup): Auxiliary routines to help parse a qualifier
6298 Update qualifier_identifier rule.
6300 * codegen.cs: Removed debugging messages.
6302 * class.cs: Make this a global thing, this acts just as a "key" to
6303 objects that we might have around.
6305 (Populate): Only initialize method_builders_to_methods once.
6307 * expression.cs (PropertyExpr): Initialize type from the
6310 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
6311 Resolve pattern. Attempt to implicitly convert value to boolean.
6314 * expression.cs: Set the type for the int32/int32 argument case.
6315 (Binary::ResolveOperator): Set the return type to boolean for
6316 comparission operators
6318 * typemanager.cs: Remove debugging print code.
6320 (Invocation::Resolve): resolve type.
6322 * class.cs: Allocate a MemberInfo of the correct size, as the code
6323 elsewhere depends on the test to reflect the correct contents.
6325 (Method::) Keep track of parameters, due to System.Reflection holes
6327 (TypeContainer::Populate): Keep track of MethodBuilders to Method
6330 (TypeContainer::FindMembers): Use ArrayList and then copy an array
6331 of the exact size and return that.
6333 (Class::LookupMethodByBuilder): New function that maps
6334 MethodBuilders to its methods. Required to locate the information
6335 on methods because System.Reflection bit us again.
6337 * support.cs: New file, contains an interface ParameterData and
6338 two implementations: ReflectionParameters and InternalParameters
6339 used to access Parameter information. We will need to grow this
6342 * expression.cs (Invocation::GetParameterData): implement a cache
6343 and a wrapper around the ParameterData creation for methods.
6344 (Invocation::OverloadResolve): Use new code.
6346 2001-09-13 Ravi Pratap <ravi@ximian.com>
6348 * class.cs (TypeContainer::EmitField): Remove and move into
6349 (Field::Define): here and modify accordingly.
6350 (Field.FieldBuilder): New member.
6351 (TypeContainer::Populate): Update accordingly.
6352 (TypeContainer::FindMembers): Implement.
6354 2001-09-13 Miguel de Icaza <miguel@ximian.com>
6356 * statement.cs: (VariableInfo::VariableType): New field to be
6357 initialized with the full type once it is resolved.
6359 2001-09-12 Miguel de Icaza <miguel@ximian.com>
6361 * parameter.cs (GetParameterInfo): Use a type cache to compute
6362 things only once, and to reuse this information
6364 * expression.cs (LocalVariableReference::Emit): Implement.
6365 (OpcodeCast::Emit): fix.
6367 (ParameterReference::Resolve): Implement.
6368 (ParameterReference::Emit): Implement.
6370 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
6371 that are expressions need to stay as Expressions.
6373 * typemanager.cs (CSharpName): Returns the C# name of a type if
6376 * expression.cs (Expression::ConvertImplicit): New function that
6377 implements implicit type conversions.
6379 (Expression::ImplicitReferenceConversion): Implements implicit
6380 reference conversions.
6382 (EmptyCast): New type for transparent casts.
6384 (OpcodeCast): New type for casts of types that are performed with
6385 a sequence of bytecodes.
6387 (BoxedCast): New type used for casting value types into reference
6388 types. Emits a box opcode.
6390 (Binary::DoNumericPromotions): Implements numeric promotions of
6391 and computation of the Binary::Type.
6393 (Binary::EmitBranchable): Optimization.
6395 (Binary::Emit): Implement code emission for expressions.
6397 * typemanager.cs (TypeManager): Added two new core types: sbyte
6400 2001-09-12 Ravi Pratap <ravi@ximian.com>
6402 * class.cs (TypeContainer::FindMembers): Method which does exactly
6403 what Type.FindMembers does, only we don't have to use reflection. No
6406 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
6407 typecontainer objects as we need to get at them.
6408 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
6410 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
6411 typecontainer object.
6413 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
6414 of just a Report object.
6416 2001-09-11 Ravi Pratap <ravi@ximian.com>
6418 * class.cs (Event::Define): Go back to using the prefixes "add_" and
6420 (TypeContainer::Populate): Now define the delegates of the type too.
6421 (TypeContainer.Delegates): Property to access the list of delegates defined
6424 * delegates.cs (Delegate::Define): Implement partially.
6426 * modifiers.cs (TypeAttr): Handle more flags.
6428 2001-09-11 Ravi Pratap <ravi@ximian.com>
6430 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
6432 (Operator::Define): Re-write logic to get types by using the LookupType method
6433 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
6434 (Indexer::Define): Ditto.
6435 (Event::Define): Ditto.
6436 (Property::Define): Ditto.
6438 2001-09-10 Ravi Pratap <ravi@ximian.com>
6440 * class.cs (TypeContainer::Populate): Now define operators too.
6441 (TypeContainer.Operators): New property to access the list of operators
6443 (Operator.OperatorMethodBuilder): New member to hold the method builder
6444 for the operator we are defining.
6445 (Operator::Define): Implement.
6447 2001-09-10 Ravi Pratap <ravi@ximian.com>
6449 * class.cs (Event::Define): Make the prefixes of the accessor methods
6450 addOn_ and removeOn_
6452 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
6453 of the location being passed in too. Ideally, this should go later since all
6454 error reporting should be done through the Report object.
6456 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
6457 (Populate): Iterate thru the indexers we have and define them too.
6458 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
6459 for the get and set accessors.
6460 (Indexer::Define): Implement.
6462 2001-09-09 Miguel de Icaza <miguel@ximian.com>
6464 * expression.cs (Binary::Resolve): Beginning of it. I scratched
6465 my previous implementation, did not work.
6467 * typemanager.cs: Add a couple of missing types (the longs).
6469 * literal.cs: Use TypeManager.bool_type instead of getting it.
6471 * expression.cs (EventExpr): New kind of expressions.
6472 (Expressio::ExprClassFromMemberInfo): finish
6474 2001-09-08 Miguel de Icaza <miguel@ximian.com>
6476 * assign.cs: Emit stores to static fields differently.
6478 2001-09-08 Ravi Pratap <ravi@ximian.com>
6480 * Merge in changes and adjust code to tackle conflicts. Backed out my
6481 code in Assign::Resolve ;-)
6483 2001-09-08 Ravi Pratap <ravi@ximian.com>
6485 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
6486 instead Report.Error and also pass in the location.
6487 (CSharpParser::Lexer): New readonly property to return the reference
6488 to the Tokenizer object.
6489 (declare_local_variables): Use Report.Error with location instead of plain
6493 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
6494 (Operator.CheckBinaryOperator): Ditto.
6496 * cs-parser.jay (operator_declarator): Update accordingly.
6498 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
6499 (CheckBinaryOperator): Same here.
6501 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
6502 on the name without any prefixes of namespace names etc. This is because we
6503 already might have something already fully qualified like
6504 'System.Console.WriteLine'
6506 * assign.cs (Resolve): Begin implementation. Stuck ;-)
6508 2001-09-07 Ravi Pratap <ravi@ximian.com>
6510 * cs-tokenizer.cs (location): Return a string which also contains
6513 * expression.cs (ElementAccess): New class for expressions of the
6514 type 'element access.'
6515 (BaseAccess): New class for expressions of the type 'base access.'
6516 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
6519 * cs-parser.jay (element_access): Implement action.
6520 (base_access): Implement actions.
6521 (checked_expression, unchecked_expression): Implement.
6523 * cs-parser.jay (local_variable_type): Correct and implement.
6524 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
6526 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
6528 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
6529 name and the specifiers.
6531 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
6533 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
6534 making them all public ;-)
6536 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
6539 2001-09-07 Miguel de Icaza <miguel@ximian.com>
6541 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
6543 (FieldExpr, PropertyExprs): New resolved expressions.
6544 (SimpleName::MemberStaticCheck): Perform static checks for access
6545 to non-static fields on static methods. Maybe this should be
6546 generalized for MemberAccesses.
6547 (SimpleName::ResolveSimpleName): More work on simple name
6550 * cs-parser.jay (primary_expression/qualified_identifier): track
6551 the parameter index.
6553 * codegen.cs (CodeGen::Save): Catch save exception, report error.
6554 (EmitContext::EmitBoolExpression): Chain to expression generation
6555 instead of temporary hack.
6556 (::EmitStatementExpression): Put generic expression code generation.
6558 * assign.cs (Assign::Emit): Implement variable assignments to
6559 local variables, parameters and fields.
6561 2001-09-06 Miguel de Icaza <miguel@ximian.com>
6563 * statement.cs (Block::GetVariableInfo): New method, returns the
6564 VariableInfo for a variable name in a block.
6565 (Block::GetVariableType): Implement in terms of GetVariableInfo
6567 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
6568 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
6570 2001-09-06 Ravi Pratap <ravi@ximian.com>
6572 * cs-parser.jay (operator_declaration): Continue on my quest : update
6573 to take attributes argument.
6574 (event_declaration): Ditto.
6575 (enum_declaration): Ditto.
6576 (indexer_declaration): Ditto.
6578 * class.cs (Operator::Operator): Update constructor accordingly.
6579 (Event::Event): Ditto.
6581 * delegate.cs (Delegate::Delegate): Same here.
6583 * enum.cs (Enum::Enum): Same here.
6585 2001-09-05 Ravi Pratap <ravi@ximian.com>
6587 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
6589 * ../tests/cs0658.cs : New file to demonstrate error 0658.
6591 * attribute.cs (Attributes): New class to encapsulate all attributes which were
6592 being passed around as an arraylist.
6593 (Attributes::AddAttribute): Method to add attribute sections.
6595 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
6596 (struct_declaration): Update accordingly.
6597 (constant_declaration): Update.
6598 (field_declaration): Update.
6599 (method_header): Update.
6600 (fixed_parameter): Update.
6601 (parameter_array): Ditto.
6602 (property_declaration): Ditto.
6603 (destructor_declaration): Ditto.
6605 * class.cs (Struct::Struct): Update constructors accordingly.
6606 (Class::Class): Ditto.
6607 (Field::Field): Ditto.
6608 (Method::Method): Ditto.
6609 (Property::Property): Ditto.
6610 (TypeContainer::OptAttribute): update property's return type.
6612 * interface.cs (Interface.opt_attributes): New member.
6613 (Interface::Interface): Update to take the extra Attributes argument.
6615 * parameter.cs (Parameter::Parameter): Ditto.
6617 * constant.cs (Constant::Constant): Ditto.
6619 * interface.cs (InterfaceMemberBase): New OptAttributes field.
6620 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
6621 the attributes as a parameter.
6622 (InterfaceProperty): Update constructor call.
6623 (InterfaceEvent): Ditto.
6624 (InterfaceMethod): Ditto.
6625 (InterfaceIndexer): Ditto.
6627 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
6628 pass the attributes too.
6629 (interface_event_declaration): Ditto.
6630 (interface_property_declaration): Ditto.
6631 (interface_method_declaration): Ditto.
6632 (interface_declaration): Ditto.
6634 2001-09-05 Miguel de Icaza <miguel@ximian.com>
6636 * class.cs (Method::Define): Track the "static Main" definition to
6637 create an entry point.
6639 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
6640 EntryPoint if we find it.
6642 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
6643 (EmitContext::ig): Make this variable public.
6645 * driver.cs: Make the default output file be the first file name
6646 with the .exe extension.
6648 Detect empty compilations
6650 Handle various kinds of output targets. Handle --target and
6651 rename -t to --dumper.
6653 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
6654 methods inherited from Expression return now an Expression. This
6655 will is used during the tree rewriting as we resolve them during
6658 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
6659 the spec. Missing entirely is the information about
6660 accessability of elements of it.
6662 (Expression::ExprClassFromMemberInfo): New constructor for
6663 Expressions that creates a fully initialized Expression based on
6664 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
6667 (Invocation::Resolve): Begin implementing resolution of invocations.
6669 * literal.cs (StringLiteral): Implement Emit.
6671 2001-09-05 Ravi Pratap <ravi@ximian.com>
6673 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
6676 2001-09-04 Ravi Pratap <ravi@ximian.com>
6678 * cs-parser.jay (attribute_arguments): Implement actions.
6679 (attribute): Fix bug in production. Implement action.
6680 (attribute_list): Implement.
6681 (attribute_target): Implement.
6682 (attribute_target_specifier, opt_target_specifier): Implement
6683 (CheckAttributeTarget): New method to check if the attribute target
6685 (attribute_section): Implement.
6686 (opt_attributes): Implement.
6688 * attribute.cs : New file to handle attributes.
6689 (Attribute): Class to hold attribute info.
6691 * cs-parser.jay (opt_attribute_target_specifier): Remove production
6692 (attribute_section): Modify production to use 2 different rules to
6693 achieve the same thing. 1 s/r conflict down !
6694 Clean out commented, useless, non-reducing dimension_separator rules.
6696 * class.cs (TypeContainer.attributes): New member to hold list
6697 of attributes for a type.
6698 (Struct::Struct): Modify to take one more argument, the attribute list.
6699 (Class::Class): Ditto.
6700 (Field::Field): Ditto.
6701 (Method::Method): Ditto.
6702 (Property::Property): Ditto.
6704 * cs-parser.jay (struct_declaration): Update constructor call to
6705 pass in the attributes too.
6706 (class_declaration): Ditto.
6707 (constant_declaration): Ditto.
6708 (field_declaration): Ditto.
6709 (method_header): Ditto.
6710 (fixed_parameter): Ditto.
6711 (parameter_array): Ditto.
6712 (property_declaration): Ditto.
6714 * constant.cs (Constant::Constant): Update constructor similarly.
6715 Use System.Collections.
6717 * parameter.cs (Parameter::Parameter): Update as above.
6719 2001-09-02 Ravi Pratap <ravi@ximian.com>
6721 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
6722 (TypeContainer.delegates): New member to hold list of delegates.
6724 * cs-parser.jay (delegate_declaration): Implement the action correctly
6725 this time as I seem to be on crack ;-)
6727 2001-09-02 Miguel de Icaza <miguel@ximian.com>
6729 * rootcontext.cs (RootContext::IsNamespace): new function, used to
6730 tell whether an identifier represents a namespace.
6732 * expression.cs (NamespaceExpr): A namespace expression, used only
6733 temporarly during expression resolution.
6734 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
6735 utility functions to resolve names on expressions.
6737 2001-09-01 Miguel de Icaza <miguel@ximian.com>
6739 * codegen.cs: Add hook for StatementExpressions.
6741 * class.cs: Fix inverted test for static flag in methods.
6743 2001-09-02 Ravi Pratap <ravi@ximian.com>
6745 * class.cs (Operator::CheckUnaryOperator): Correct error number used
6746 to make it coincide with MS' number.
6747 (Operator::CheckBinaryOperator): Ditto.
6749 * ../errors/errors.txt : Remove error numbers added earlier.
6751 * ../errors/cs1019.cs : Test case for error # 1019
6753 * ../errros/cs1020.cs : Test case for error # 1020
6755 * cs-parser.jay : Clean out commented cruft.
6756 (dimension_separators, dimension_separator): Comment out. Ostensibly not
6757 used anywhere - non-reducing rule.
6758 (namespace_declarations): Non-reducing rule - comment out.
6760 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
6761 with TypeContainer::AddEnum.
6763 * delegate.cs : New file for delegate handling classes.
6764 (Delegate): Class for declaring delegates.
6766 * makefile : Update.
6768 * cs-parser.jay (delegate_declaration): Implement.
6770 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
6772 * class.cs (Event::Define): Implement.
6773 (Event.EventBuilder): New member.
6775 * class.cs (TypeContainer::Populate): Update to define all enums and events
6777 (Events): New property for the events arraylist we hold. Shouldn't we move to using
6778 readonly fields for all these cases ?
6780 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6782 * class.cs (Property): Revamp to use the convention of making fields readonly.
6783 Accordingly modify code elsewhere.
6785 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
6786 the Define method of the Property class.
6788 * class.cs : Clean up applied patch and update references to variables etc. Fix
6790 (TypeContainer::Populate): Update to define all the properties we have. Also
6791 define all enumerations.
6793 * enum.cs (Define): Implement.
6795 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6797 * cs-parser.jay (overloadable_operator): The semantic value is an
6798 enum of the Operator class.
6799 (operator_declarator): Implement actions.
6800 (operator_declaration): Implement.
6802 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
6803 validity of definitions.
6804 (Operator::CheckBinaryOperator): Static method to check for binary operators
6805 (TypeContainer::AddOperator): New method to add an operator to a type.
6807 * cs-parser.jay (indexer_declaration): Added line to actually call the
6808 AddIndexer method so it gets added ;-)
6810 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
6811 already taken care of by the MS compiler ?
6813 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6815 * class.cs (Operator): New class for operator declarations.
6816 (Operator::OpType): Enum for the various operators.
6818 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6820 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
6821 ostensibly handle this in semantic analysis.
6823 * cs-parser.jay (general_catch_clause): Comment out
6824 (specific_catch_clauses, specific_catch_clause): Ditto.
6825 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
6826 (catch_args, opt_catch_args): New productions.
6827 (catch_clause): Rewrite to use the new productions above
6828 (catch_clauses): Modify accordingly.
6829 (opt_catch_clauses): New production to use in try_statement
6830 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
6831 and re-write the code in the actions to extract the specific and
6832 general catch clauses by being a little smart ;-)
6834 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
6835 Hooray, try and catch statements parse fine !
6837 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6839 * statement.cs (Block::GetVariableType): Fix logic to extract the type
6840 string from the hashtable of variables.
6842 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
6843 I end up making that mistake ;-)
6844 (catch_clauses): Fixed gross error which made Key and Value of the
6845 DictionaryEntry the same : $1 !!
6847 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6849 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
6851 * cs-parser.jay (event_declaration): Correct to remove the semicolon
6852 when the add and remove accessors are specified.
6854 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6856 * cs-parser.jay (IndexerDeclaration): New helper class to hold
6857 information about indexer_declarator.
6858 (indexer_declarator): Implement actions.
6859 (parsing_indexer): New local boolean used to keep track of whether
6860 we are parsing indexers or properties. This is necessary because
6861 implicit_parameters come into picture even for the get accessor in the
6863 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
6865 * class.cs (Indexer): New class for indexer declarations.
6866 (TypeContainer::AddIndexer): New method to add an indexer to a type.
6867 (TypeContainer::indexers): New member to hold list of indexers for the
6870 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6872 * cs-parser.jay (add_accessor_declaration): Implement action.
6873 (remove_accessor_declaration): Implement action.
6874 (event_accessors_declaration): Implement
6875 (variable_declarators): swap statements for first rule - trivial.
6877 * class.cs (Event): New class to hold information about event
6879 (TypeContainer::AddEvent): New method to add an event to a type
6880 (TypeContainer::events): New member to hold list of events.
6882 * cs-parser.jay (event_declaration): Implement actions.
6884 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6886 * cs-parser.jay (dim_separators): Implement. Make it a string
6887 concatenating all the commas together, just as they appear.
6888 (opt_dim_separators): Modify accordingly
6889 (rank_specifiers): Update accordingly. Basically do the same
6890 thing - instead, collect the brackets here.
6891 (opt_rank_sepcifiers): Modify accordingly.
6892 (array_type): Modify to actually return the complete type string
6893 instead of ignoring the rank_specifiers.
6894 (expression_list): Implement to collect the expressions
6895 (variable_initializer): Implement. We make it a list of expressions
6896 essentially so that we can handle the array_initializer case neatly too.
6897 (variable_initializer_list): Implement.
6898 (array_initializer): Make it a list of variable_initializers
6899 (opt_array_initializer): Modify accordingly.
6901 * expression.cs (New::NType): Add enumeration to help us
6902 keep track of whether we have an object/delegate creation
6903 or an array creation.
6904 (New:NewType, New::Rank, New::Indices, New::Initializers): New
6905 members to hold data about array creation.
6906 (New:New): Modify to update NewType
6907 (New:New): New Overloaded contructor for the array creation
6910 * cs-parser.jay (array_creation_expression): Implement to call
6911 the overloaded New constructor.
6913 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
6915 * class.cs (TypeContainer::Constructors): Return member
6916 constructors instead of returning null.
6918 2001-08-26 Miguel de Icaza <miguel@ximian.com>
6920 * typemanager.cs (InitCoreTypes): Initialize the various core
6921 types after we have populated the type manager with the user
6922 defined types (this distinction will be important later while
6923 compiling corlib.dll)
6925 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
6926 on Expression Classification. Now all expressions have a method
6927 `Resolve' and a method `Emit'.
6929 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
6930 generation from working. Also add some temporary debugging
6933 2001-08-24 Miguel de Icaza <miguel@ximian.com>
6935 * codegen.cs: Lots of code generation pieces. This is only the
6936 beginning, will continue tomorrow with more touches of polish. We
6937 handle the fundamentals of if, while, do, for, return. Others are
6938 trickier and I need to start working on invocations soon.
6940 * gen-treedump.cs: Bug fix, use s.Increment here instead of
6943 * codegen.cs (EmitContext): New struct, used during code
6944 emission to keep a context. Most of the code generation will be
6947 * cs-parser.jay: Add embedded blocks to the list of statements of
6948 this block. So code generation proceeds in a top down fashion.
6950 2001-08-23 Miguel de Icaza <miguel@ximian.com>
6952 * statement.cs: Add support for multiple child blocks.
6954 2001-08-22 Miguel de Icaza <miguel@ximian.com>
6956 * codegen.cs (EmitCode): New function, will emit the code for a
6957 Block of code given a TypeContainer and its ILGenerator.
6959 * statement.cs (Block): Standard public readonly optimization.
6960 (Block::Block constructors): Link children.
6961 (Block::Child): Child Linker.
6962 (Block::EmitVariables): Emits IL variable declarations.
6964 * class.cs: Drop support for MethodGroups here, delay until
6966 (Method::): Applied the same simplification that I did before, and
6967 move from Properties to public readonly fields.
6968 (Method::ParameterTypes): Returns the parameter types for the
6969 function, and implements a cache that will be useful later when I
6970 do error checking and the semantic analysis on the methods is
6972 (Constructor::GetCallingConvention): Renamed from CallingConvetion
6973 and made a method, optional argument tells whether this is a class
6974 or a structure to apply the `has-this' bit.
6975 (Method::GetCallingConvention): Implement, returns the calling
6977 (Method::Define): Defines the type, a second pass is performed
6978 later to populate the methods.
6980 (Constructor::ParameterTypes): implement a cache similar to the
6981 one on Method::ParameterTypes, useful later when we do semantic
6984 (TypeContainer::EmitMethod): New method. Emits methods.
6986 * expression.cs: Removed MethodGroup class from here.
6988 * parameter.cs (Parameters::GetCallingConvention): new method.
6990 2001-08-21 Miguel de Icaza <miguel@ximian.com>
6992 * class.cs (TypeContainer::Populate): Drop RootContext from the
6995 (Constructor::CallingConvention): Returns the calling convention.
6996 (Constructor::ParameterTypes): Returns the constructor parameter
6999 (TypeContainer::AddConstructor): Keep track of default constructor
7000 and the default static constructor.
7002 (Constructor::) Another class that starts using `public readonly'
7003 instead of properties.
7005 (Constructor::IsDefault): Whether this is a default constructor.
7007 (Field::) use readonly public fields instead of properties also.
7009 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
7010 track of static constructors; If none is used, turn on
7011 BeforeFieldInit in the TypeAttributes.
7013 * cs-parser.jay (opt_argument_list): now the return can be null
7014 for the cases where there are no arguments.
7016 (constructor_declarator): If there is no implicit `base' or
7017 `this', then invoke the default parent constructor.
7019 * modifiers.cs (MethodAttr): New static function maps a set of
7020 modifiers flags into a MethodAttributes enum
7021 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
7022 MethodAttr, TypeAttr to represent the various mappings where the
7024 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
7026 2001-08-19 Miguel de Icaza <miguel@ximian.com>
7028 * parameter.cs (GetParameterInfo): Fix bug where there would be no
7031 * interface.cs (PopulateIndexer): Implemented the code generator
7032 for interface indexers.
7034 2001-08-17 Miguel de Icaza <miguel@ximian.com>
7036 * interface.cs (InterfaceMemberBase): Now we track the new status
7039 (PopulateProperty): Implement property population. Woohoo! Got
7040 Methods and Properties going today.
7042 Removed all the properties for interfaces, and replaced them with
7043 `public readonly' fields.
7045 2001-08-16 Miguel de Icaza <miguel@ximian.com>
7047 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
7048 initialize their hashtables/arraylists only when they are needed
7049 instead of doing this always.
7051 * parameter.cs: Handle refs and out parameters.
7053 * cs-parser.jay: Use an ArrayList to construct the arguments
7054 instead of the ParameterCollection, and then cast that to a
7057 * parameter.cs: Drop the use of ParameterCollection and use
7058 instead arrays of Parameters.
7060 (GetParameterInfo): Use the Type, not the Name when resolving
7063 2001-08-13 Miguel de Icaza <miguel@ximian.com>
7065 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
7066 and instead use public readonly fields.
7068 * class.cs: Put back walking code for type containers.
7070 2001-08-11 Miguel de Icaza <miguel@ximian.com>
7072 * class.cs (MakeConstant): Code to define constants.
7074 * rootcontext.cs (LookupType): New function. Used to locate types
7077 2001-08-08 Miguel de Icaza <miguel@ximian.com>
7079 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
7080 this System.Reflection code is. Kudos to Microsoft
7082 * typemanager.cs: Implement a type cache and avoid loading all
7083 types at boot time. Wrap in LookupType the internals. This made
7084 the compiler so much faster. Wow. I rule!
7086 * driver.cs: Make sure we always load mscorlib first (for
7087 debugging purposes, nothing really important).
7089 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
7090 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
7092 * rootcontext.cs: Lookup types on their namespace; Lookup types
7093 on namespaces that have been imported using the `using' keyword.
7095 * class.cs (TypeContainer::TypeAttr): Virtualize.
7096 (Class::TypeAttr): Return attributes suitable for this bad boy.
7097 (Struct::TypeAttr): ditto.
7098 Handle nested classes.
7099 (TypeContainer::) Remove all the type visiting code, it is now
7100 replaced with the rootcontext.cs code
7102 * rootcontext.cs (GetClassBases): Added support for structs.
7104 2001-08-06 Miguel de Icaza <miguel@ximian.com>
7106 * interface.cs, statement.cs, class.cs, parameter.cs,
7107 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
7108 Drop use of TypeRefs, and use strings instead.
7110 2001-08-04 Miguel de Icaza <miguel@ximian.com>
7114 * class.cs (Struct::Struct): set the SEALED flags after
7115 checking the modifiers.
7116 (TypeContainer::TypeAttr): new property, returns the
7117 TypeAttributes for a class.
7119 * cs-parser.jay (type_list): Oops, list production was creating a
7120 new list of base types.
7122 * rootcontext.cs (StdLib): New property.
7123 (GetInterfaceTypeByName): returns an interface by type name, and
7124 encapsulates error handling here.
7125 (GetInterfaces): simplified.
7126 (ResolveTree): Encapsulated all the tree resolution here.
7127 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
7130 * driver.cs: Add support for --nostdlib, to avoid loading the
7132 (Main): Do not put tree resolution here.
7134 * rootcontext.cs: Beginning of the class resolution.
7136 2001-08-03 Miguel de Icaza <miguel@ximian.com>
7138 * rootcontext.cs: Provide better error reporting.
7140 * cs-parser.jay (interface_base): set our $$ to be interfaces.
7142 * rootcontext.cs (CreateInterface): Handle the case where there
7143 are no parent interfaces.
7145 (CloseTypes): Routine to flush types at the end.
7146 (CreateInterface): Track types.
7147 (GetInterfaces): Returns an array of Types from the list of
7150 * typemanager.c (AddUserType): Mechanism to track user types (puts
7151 the type on the global type hash, and allows us to close it at the
7154 2001-08-02 Miguel de Icaza <miguel@ximian.com>
7156 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
7157 RecordInterface instead.
7159 * cs-parser.jay: Updated to reflect changes above.
7161 * decl.cs (Definition): Keep track of the TypeBuilder type that
7162 represents this type here. Not sure we will use it in the long
7163 run, but wont hurt for now.
7165 * driver.cs: Smaller changes to accomodate the new code.
7167 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
7170 * rootcontext.cs (CreateInterface): New method, used to create
7171 the System.TypeBuilder type for interfaces.
7172 (ResolveInterfaces): new entry point to resolve the interface
7174 (CodeGen): Property, used to keep track of the code generator.
7176 2001-07-26 Miguel de Icaza <miguel@ximian.com>
7178 * cs-parser.jay: Add a second production for delegate_declaration
7181 (enum_body): Put an opt_comma here instead of putting it on
7182 enum_body or enum_member_declarations so we can handle trailing
7183 commas on enumeration members. Gets rid of a shift/reduce.
7185 (type_list): Need a COMMA in the middle.
7187 (indexer_declaration): Tell tokenizer to recognize get/set
7189 * Remove old targets.
7191 * Re-add the parser target.
7193 2001-07-13 Simon Cozens <simon@simon-cozens.org>
7195 * cs-parser.jay: Add precendence rules for a number of operators
7196 ot reduce the number of shift/reduce conflicts in the grammar.
7198 2001-07-17 Miguel de Icaza <miguel@ximian.com>
7200 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
7203 Get rid of old crufty code.
7205 * rootcontext.cs: Use this to keep track of the parsed
7206 representation and the defined types available to the program.
7208 * gen-treedump.cs: adjust for new convention.
7210 * type.cs: Split out the type manager, and the assembly builder
7213 * typemanager.cs: the type manager will live here now.
7215 * cil-codegen.cs: And the code generator here.
7217 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
7219 * makefile: Fixed up for easy making.
7221 2001-07-13 Simon Cozens <simon@simon-cozens.org>
7223 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
7226 (unary_expression): Expand pre_increment_expression and
7227 post_decrement_expression to reduce a shift/reduce.
7229 2001-07-11 Simon Cozens
7231 * cs-tokenizer.cs: Hex numbers should begin with a 0.
7233 Improve allow_keyword_as_indent name.
7235 2001-06-19 Miguel de Icaza <miguel@ximian.com>
7237 * Adjustments for Beta2.
7239 2001-06-13 Miguel de Icaza <miguel@ximian.com>
7241 * decl.cs: Added `Define' abstract method.
7242 (InTransit): new property, used to catch recursive definitions.
7244 * interface.cs: Implement `Define'.
7246 * modifiers.cs: Map Modifiers.constants to
7247 System.Reflection.TypeAttribute flags.
7249 * class.cs: Keep track of types and user-defined types.
7250 (BuilderInit): New method for creating an assembly
7251 (ResolveType): New function to launch the resolution process, only
7252 used by interfaces for now.
7254 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
7255 that are inserted into the name space.
7257 2001-06-08 Miguel de Icaza <miguel@ximian.com>
7259 * ARGH. I have screwed up my tree so many times due to the use of
7260 rsync rather than using CVS. Going to fix this at once.
7262 * driver.cs: Objetify driver. Load assemblies, use assemblies to
7265 2001-06-07 Miguel de Icaza <miguel@ximian.com>
7267 * Experiment successful: Use System.Type rather that our own
7270 2001-05-25 Miguel de Icaza <miguel@ximian.com>
7272 * cs-parser.jay: Removed nsAliases from here.
7274 Use new namespaces, handle `using XXX;'
7276 * namespace.cs: Reimplemented namespace handling, use a recursive
7277 definition of the class. Now we can keep track of using clauses
7278 and catch invalid using clauses.
7280 2001-05-24 Miguel de Icaza <miguel@ximian.com>
7282 * gen-treedump.cs: Adapted for all the renaming.
7284 * expression.cs (Expression): this class now has a Type property
7285 which returns an expression Type.
7287 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
7288 `Type', as this has a different meaning now in the base
7290 2001-05-22 Miguel de Icaza <miguel@ximian.com>
7292 * interface.cs, class.cs: Removed from all the sources the
7293 references to signature computation, as we can not do method
7294 signature computation during the parsing time, as we are not
7295 trying to solve at that point distinguishing:
7299 void a (NS.Blah x) {}
7302 Which depending on the context might be valid or not, as we do not
7303 know if Blah is the same thing as NS.Blah at that point.
7305 * Redid everything so the code uses TypeRefs now instead of
7306 Types. TypeRefs are just temporary type placeholders, that need
7307 to be resolved. They initially have a pointer to a string and the
7308 current scope in which they are used. This is used later by the
7309 compiler to resolve the reference to an actual Type.
7311 * DeclSpace is no longer a CIR.Type, and neither are
7312 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
7313 are all DeclSpaces, but no Types.
7315 * type.cs (TypeRefManager): This implements the TypeRef manager,
7316 which keeps track of all the types that need to be resolved after
7317 the parsing has finished.
7319 2001-05-13 Miguel de Icaza <miguel@ximian.com>
7321 * ARGH. We are going to have to store `foreach' as a class rather
7322 than resolving it, as we need to verify error 1579 after name
7323 resolution. *OR* we could keep a flag that says `This request to
7324 IEnumerator comes from a foreach statement' which we can then use
7325 to generate the error.
7327 2001-05-10 Miguel de Icaza <miguel@ximian.com>
7329 * class.cs (TypeContainer.AddMethod): we now add methods to the
7330 MethodGroup instead of the method hashtable.
7332 * expression.cs: Add MethodGroup abstraction, which gets us one
7333 step closer to the specification in the way we handle method
7336 * cs-parser.jay (primary_expression): qualified_identifier now
7337 tried to match up an identifier to a local variable reference or
7338 to a parameter reference.
7340 current_local_parameters is now a parser global variable that
7341 points to the current parameters for the block, used during name
7344 (property_declaration): Now creates an implicit `value' argument to
7347 2001-05-09 Miguel de Icaza <miguel@ximian.com>
7349 * parameter.cs: Do not use `param' arguments as part of the
7350 signature, per the spec.
7352 2001-05-08 Miguel de Icaza <miguel@ximian.com>
7354 * decl.cs: Base class for classes, structs and interfaces. This
7355 is the "Declaration Space"
7357 * cs-parser.jay: Use CheckDef for checking declaration errors
7358 instead of having one on each function.
7360 * class.cs: Factor out some code for handling error handling in
7361 accordance to the "Declarations" section in the "Basic Concepts"
7362 chapter in the ECMA C# spec.
7364 * interface.cs: Make all interface member classes derive from
7365 InterfaceMemberBase.
7367 2001-05-07 Miguel de Icaza <miguel@ximian.com>
7369 * Many things: all interfaces are parsed and generated in
7370 gen-treedump. Support for member variables, constructors,
7371 destructors, properties, constants is there.
7373 Beginning of the IL backend, but very little done, just there for
7376 2001-04-29 Miguel de Icaza <miguel@ximian.com>
7378 * cs-parser.jay: Fix labeled statement.
7380 * cs-tokenizer.cs (escape): Escape " and ' always.
7381 ref_line, ref_name: keep track of the line/filename as instructed
7382 by #line by the compiler.
7385 2001-04-27 Miguel de Icaza <miguel@ximian.com>
7387 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
7388 to match the values in System.CodeDOM.
7390 Divid renamed to Divide.
7392 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
7394 (Statements.set): remove.
7396 * System.CodeDOM/CodeCatchClause.cs: always have a valid
7399 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
7400 falseStatements always have valid values.
7402 * cs-parser.jay: Use System.CodeDOM now.