1 2004-06-03 Martin Baulig <martin@ximian.com>
3 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
4 GetSimpleName() and return a SimpleName.
6 * ecore.cs (SimpleName.Arguments): New public field.
7 (SimpleName): Added overloaded ctor which takes an additional
8 TypeArguments argument.
9 (SimpleName.SimpleNameResolve): Added support for generic methods.
10 (MethodGroupExpr.ResolveGeneric): New public method. The code was
11 formerly in MemberAccess.DoResolve(), but we also need it in
14 * expression.cs (MemberAccess.DoResolve): Use the new
15 MethodGroupExpr.ResolveGeneric().
17 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
19 * decl.cs: If possible, use lookuptypedirect here. We can only do
20 this if there is no `.' after the namespace. Avoids using
21 LookupType, which does lots of slow processing.
22 (FindNestedType) New method, does what it says :-).
23 * namespace.cs: use LookupTypeDirect.
24 * rootcontext.cs: use membercache, if possible.
25 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
27 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
30 According to the spec,
32 In a member access of the form E.I, if E is a single identifier,
33 and if the meaning of E as a simple-name (§7.5.2) is a constant,
34 field, property, localvariable, or parameter with the same type as
35 the meaning of E as a type-name (§3.8), then both possible
36 meanings of E are permitted.
38 We did not check that E as a simple-name had the same type as E as
41 This trivial check gives us 5-7% on bootstrap time.
43 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
45 * expression.cs (Invocation.OverloadResolve): Avoid the
46 use of hashtables and boxing here by allocating on demand.
48 2004-05-30 Martin Baulig <martin@ximian.com>
50 * rootcontext.cs (RootContext.LookupType): Don't cache things if
51 we're doing a silent lookup. Don't try to lookup nested types in
52 TypeManager.object_type (thanks to Ben Maurer).
54 2004-05-30 Martin Baulig <martin@ximian.com>
56 Committing a patch from Ben Maurer.
58 * rootcontext.cs (RootContext.LookupType): Cache negative results.
60 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
62 * convert.cs: add a trivial cache for overload operator resolution.
64 2004-05-31 Marek Safar <marek.safar@seznam.cz>
67 (AttributeTester.GetObsoleteAttribute): Returns instance of
68 ObsoleteAttribute when type is obsolete.
71 (TypeContainer.VerifyObsoleteAttribute): Override.
72 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
73 (MethodCode.VerifyObsoleteAttribute): Override.
74 (MemberBase.VerifyObsoleteAttribute): Override.
77 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
78 and report proper error.
81 (Delegate.VerifyObsoleteAttribute): Override.
84 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
85 and report proper error.
86 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
89 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
93 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
94 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
95 Added test for ObsoleteAttribute.
98 (Catch): Derived from Statement.
100 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
102 * decl.cs: If possible, use lookuptypedirect here. We can only do
103 this if there is no `.' after the namespace. Avoids using
104 LookupType, which does lots of slow processing.
105 (FindNestedType) New method, does what it says :-).
106 * namespace.cs: use LookupTypeDirect.
107 * rootcontext.cs: use membercache, if possible.
108 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
110 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
113 According to the spec,
115 In a member access of the form E.I, if E is a single identifier,
116 and if the meaning of E as a simple-name (§7.5.2) is a constant,
117 field, property, localvariable, or parameter with the same type as
118 the meaning of E as a type-name (§3.8), then both possible
119 meanings of E are permitted.
121 We did not check that E as a simple-name had the same type as E as
124 This trivial check gives us 5-7% on bootstrap time.
126 2004-05-30 Marek Safar <marek.safar@seznam.cz>
128 Fixed bug #59071 & cs0160.cs
129 * statement.cs (Try.Resolve): Check here whether order of catch
130 clauses matches their dependencies.
132 2004-05-30 Marek Safar <marek.safar@seznam.cz>
135 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
138 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
140 * expression.cs (Invocation.OverloadResolve): Avoid the
141 use of hashtables and boxing here by allocating on demand.
143 2004-05-30 Martin Baulig <martin@ximian.com>
145 * rootcontext.cs (RootContext.LookupType): Don't cache things if
146 we're doing a silent lookup. Don't try to lookup nested types in
147 TypeManager.object_type (thanks to Ben Maurer).
149 2004-05-30 Martin Baulig <martin@ximian.com>
151 Committing a patch from Ben Maurer.
153 * rootcontext.cs (RootContext.LookupType): Cache negative results.
155 2004-05-29 Martin Baulig <martin@ximian.com>
157 * class.cs (IMethodData.ShouldIgnore): New method.
159 * typemanager.cs (TypeManager.MethodFlags): Don't take a
160 `Location' argument, we don't need it anywhere. Use
161 `IMethodData.ShouldIgnore ()' instead of
162 `MethodData.GetMethodFlags ()'.
163 (TypeManager.AddMethod): Removed.
164 (TypeManager.AddMethod2): Renamed to AddMethod.
166 2004-05-29 Martin Baulig <martin@ximian.com>
168 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
170 * convert.cs (Convert.ImplicitReferenceConversion): If we're
171 converting from a class type S to an interface type and we already
172 have an object on the stack, don't box it again. Fixes #52578.
174 2004-05-29 Martin Baulig <martin@ximian.com>
176 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
177 Added support for `params' parameters. Fixes #59267.
179 2004-05-29 Martin Baulig <martin@ximian.com>
181 * literal.cs (NullPointer): Provide a private .ctor which sets
182 `type' to TypeManager.object_type. Fixes #59048.
184 2004-05-29 Martin Baulig <martin@ximian.com>
186 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
187 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
189 * ecore.cs (EventExpr.instance_expr): Make the field private.
191 2004-05-26 Marek Safar <marek.safar@seznam.cz>
193 Fixed bug #50080 & cs0214-2.cs
194 * expression.cs (Cast.DoResolve): Check unsafe context here.
196 * statement.cs (Resolve.DoResolve): Likewise.
198 2004-05-26 Martin Baulig <martin@ximian.com>
200 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
202 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
203 (RootContext.LookupType): Pass down the `silent' flag.
205 2004-05-25 Martin Baulig <martin@ximian.com>
208 (MethodGroupExpr.IdenticalTypeName): New public property.
209 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
210 expression actually refers to a type.
212 2004-05-25 Martin Baulig <martin@ximian.com>
214 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
215 for #56176 and made it actually work.
217 2004-05-25 Martin Baulig <martin@ximian.com>
219 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
220 (FieldExpr, PropertyExpr): Override and implement
221 CacheTemporaries. Fixes #52279.
223 2004-05-25 Miguel de Icaza <miguel@ximian.com>
225 * location.cs: In the new compiler listing a file twice is a
226 warning, not an error.
228 2004-05-24 Martin Baulig <martin@ximian.com>
230 * enum.cs (Enum.DefineType): For the `BaseType' to be a
231 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
233 2004-05-24 Martin Baulig <martin@ximian.com>
235 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
236 walking the `using' list. Fixes #53921.
238 2004-05-24 Martin Baulig <martin@ximian.com>
240 * const.cs (Const.LookupConstantValue): Added support for
241 EmptyCast's; fixes #55251.
243 2004-05-24 Martin Baulig <martin@ximian.com>
245 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
246 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
247 which does the CS0135 check. The reason is that we first need to
248 check whether the variable actually exists.
250 2004-05-24 Martin Baulig <martin@ximian.com>
252 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
253 than RootContext.LookupType() to find the explicit interface
256 2004-05-24 Raja R Harinath <rharinath@novell.com>
258 * Makefile: Simplify. Use executable.make.
259 * mcs.exe.sources: New file. List of sources of mcs.exe.
261 2004-05-24 Anders Carlsson <andersca@gnome.org>
265 Use the invariant culture when doing String.Compare for CLS case
268 2004-05-23 Martin Baulig <martin@ximian.com>
270 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
271 don't have any dots. Fixes #52622, added cs0246-8.cs.
273 * namespace.cs (NamespaceEntry.Lookup): Likewise.
275 2004-05-23 Marek Safar <marek.safar@seznam.cz>
277 * class.cs (MemberBase.Define): Reuse MemberType member for
278 resolved type. Other methods can use it too.
280 2004-05-23 Martin Baulig <martin@ximian.com>
282 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
283 the variable also exists in the current block (otherwise, we need
284 to report a CS0103). Fixes #58670.
286 2004-05-23 Martin Baulig <martin@ximian.com>
288 * flowanalysis.cs (Reachability.Reachable): Compute this
289 on-the-fly rather than storing it as a field.
291 2004-05-23 Martin Baulig <martin@ximian.com>
293 * flowanalysis.cs (Reachability.And): Manually compute the
294 resulting `barrier' from the reachability.
296 2004-05-23 Marek Safar <marek.safar@seznam.cz>
299 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
300 instance of ObsoleteAttribute when symbol is obsolete.
303 (IMethodData): Extended interface for ObsoleteAttribute support.
305 2004-05-22 Marek Safar <marek.safar@seznam.cz>
307 * attribute.cs: Fix bug #55970
309 2004-05-22 Marek Safar <marek.safar@seznam.cz>
313 (GetObsoleteAttribute): New method. Creates the instance of
315 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
316 ObsoleteAttribute when member is obsolete.
317 (AttributeTester.Report_ObsoleteMessage): Common method for
318 Obsolete error/warning reporting.
321 (TypeContainer.base_classs_type): New member for storing parent type.
324 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
327 2004-05-21 Marek Safar <marek.safar@seznam.cz>
329 * attribute.cs, const.cs: Fix bug #58590
331 2004-05-21 Martin Baulig <martin@ximian.com>
333 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
334 out parameters if the end of the method is unreachable. Fixes
337 2004-05-21 Marek Safar <marek.safar@seznam.cz>
339 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
340 Hari was right, why extra method.
342 2004-05-21 Marek Safar <marek.safar@seznam.cz>
344 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
346 2004-05-20 Martin Baulig <martin@ximian.com>
348 * delegate.cs: Convert this file to Unix mode - like the original
351 2004-05-20 Martin Baulig <martin@ximian.com>
353 * attribute.cs: Convert this file to Unix mode - like the original
356 2004-05-19 Marek Safar <marek.safar@seznam.cz>
358 Fix bug #58688 (MCS does not report error when the same attribute
361 * attribute.cs (Attribute.Emit): Distinction between null and default.
363 2004-05-19 Raja R Harinath <rharinath@novell.com>
365 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
366 of a top-level attribute without an attribute target.
367 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
369 (Attribute.Conditional_GetConditionName),
370 (Attribute.Obsolete_GetObsoleteMessage): Update.
371 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
372 part of ScanForIndexerName.
373 (Attribute.CanIgnoreInvalidAttribute): New function.
374 (Attribute.ScanForIndexerName): Move to ...
375 (Attributes.ScanForIndexerName): ... here.
376 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
377 (Attributes.Search): New internal variant that can choose not to
378 complain if types aren't resolved. The original signature now
380 (Attributes.GetClsCompliantAttribute): Use internal variant, with
381 complaints suppressed.
382 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
383 only if it not useful.
384 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
385 top-level for attributes that are shared between the assembly
386 and a top-level class.
387 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
388 * class.cs: Update to reflect changes.
389 (DefineIndexers): Fuse loops.
390 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
391 a couple more variants of attribute names.
393 2004-05-18 Marek Safar <marek.safar@seznam.cz>
395 Fix bug #52585 (Implemented explicit attribute declaration)
398 (Attributable.ValidAttributeTargets): New abstract method. It gets
399 list of valid attribute targets for explicit target declaration.
400 (Attribute.Target): It holds target itself.
401 (AttributeSection): Removed.
402 (Attribute.CheckTargets): New method. It checks whether attribute
403 target is valid for the current element.
406 (EventProperty): New class. For events that are declared like
407 property (with add and remove accessors).
408 (EventField): New class. For events that are declared like field.
411 * cs-parser.jay: Implemented explicit attribute target declaration.
413 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
414 Override ValidAttributeTargets.
417 (ReturnParameter): Class for applying custom attributes on
419 (ParameterAtribute): New class. Class for applying custom
420 attributes on the parameter type.
422 2004-05-17 Miguel de Icaza <miguel@ximian.com>
424 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
427 (Method): Allow UNSAFE here.
429 * modifiers.cs: Support unsafe reporting.
431 2004-05-17 Marek Safar <marek.safar@seznam.cz>
433 * decl.cs: Fix bug #58478.
435 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
437 * statement.cs: When checking for unreachable code on an EmptyStatement,
438 set the location. Fixes bug #58488.
440 2004-05-13 Miguel de Icaza <miguel@ximian.com>
442 * driver.cs: Add -pkg handling.
444 From Gonzalo: UseShelLExecute=false
446 2004-05-12 Marek Safar <marek.safar@seznam.cz>
449 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
451 (Attribute.IsClsCompliaceRequired): Moved to base for better
453 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
454 when attribute is AttributeUsageAttribute.
455 (Attribute.GetValidTargets): Simplified.
456 (Attribute.GetAttributeUsage): New method returns AttributeUsage
457 attribute for this type.
458 (Attribute.ApplyAttributes): Method renamed to Emit and make
460 (GlobalAttributeSection): New class for special handling of global
461 attributes (assembly, module).
462 (AttributeSection.Emit): New method.
464 * class.cs: Implemented Attributable abstract methods.
465 (MethodCore.LabelParameters): Moved to Parameter class.
466 (Accessor): Is back simple class.
467 (PropertyMethod): Implemented Attributable abstract class.
468 (DelegateMethod): Implemented Attributable abstract class.
469 (Event): New constructor for disctintion between normal Event
470 and Event with accessors.
472 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
474 * codegen.cs, const.cs, decl.cs, delegate.cs:
475 (CommonAssemblyModulClass): Implemented Attributable abstract class
478 * enum.cs: Implement IAttributeSupport interface.
479 (EnumMember): New class for emum members. Implemented Attributable
483 (ParameterBase): Is abstract.
484 (ReturnParameter): New class for easier [return:] attribute handling.
486 * typemanager.cs: Removed builder_to_attr.
488 2004-05-11 Raja R Harinath <rharinath@novell.com>
491 * attribute.cs (Attribute.GetPositionalValue): New function.
492 * class.cs (TypeContainer.VerifyMembers): New function.
493 (TypeContainer.Emit): Use it.
494 (ClassOrStruct): New base class for Class and Struct.
495 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
496 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
498 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
499 then each non-static field should have a FieldOffset attribute.
500 Otherwise, none of the fields should have a FieldOffset attribute.
501 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
502 and FieldOffset attributes.
503 * typemanager.cs (TypeManager.struct_layout_attribute_type)
504 (TypeManager.field_offset_attribute_type): New core types.
505 (TypeManager.InitCoreTypes): Initialize them.
507 2004-05-11 Michal Moskal <malekith@pld-linux.org>
509 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
513 2004-05-09 Miguel de Icaza <miguel@ximian.com>
515 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
516 be implicitly converted to ulong.
518 * expression.cs: The logic for allowing operator &, | and ^ worked
519 was wrong, it worked before because we did not report an error in
520 an else branch. Fixes 57895.
522 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
523 allow volatile fields to be reference types.
525 2004-05-07 Miguel de Icaza <miguel@ximian.com>
527 * driver.cs: Add support for /debug-
529 2004-05-07 Raja R Harinath <rharinath@novell.com>
531 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
532 Add a 'complain' parameter to silence errors.
533 (Attribute.Resolve): Update to changes. Put in sanity check to catch
534 silently overlooked type-resolutions.
535 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
537 (Attributes.Search): New function.
538 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
539 (Attributes.GetAttributeFullName): Remove hack.
540 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
541 Update to reflect changes.
542 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
543 Use Attributes.Search instead of nested loops.
545 2004-05-07 Marek Safar <marek.safar@seznam.cz>
548 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
549 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
550 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
552 * report.cs: (Report.Warning): Renamed to Warning_T because of
555 2004-05-05 Raja R Harinath <rharinath@novell.com>
557 * expression.cs (MemberAccess.ResolveMemberAccess):
558 Exit with non-zero status after Report.Error.
559 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
561 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
563 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
565 * support.cs: Don't hang when the file is empty.
567 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
569 * support.cs: In SeekableStreamReader, compute the preamble size of the
570 underlying stream. Position changes should take into account that initial
573 2004-05-03 Todd Berman <tberman@sevenl.net>
575 * driver.cs: remove unused GetSysVersion function.
577 2004-05-03 Todd Berman <tberman@sevenl.net>
579 * driver.cs: Remove the hack from saturday, as well as the hack
580 from jackson (LoadAssemblyFromGac), also adds the CWD to the
581 link_paths to get that bit proper.
583 2004-05-01 Todd Berman <tberman@sevenl.net>
585 * driver.cs: Try a LoadFrom before a Load, this checks the current
586 path. This is currently a bug in mono that is be fixed, however, this
587 provides a workaround for now. This will be removed when the bug
590 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
592 * CryptoConvert.cs: Updated to latest version. Fix issue with
593 incomplete key pairs (#57941).
595 2004-05-01 Todd Berman <tberman@sevenl.net>
597 * driver.cs: Remove '.' from path_chars, now System.* loads properly
600 2004-04-30 Jackson Harper <jackson@ximian.com>
602 * codegen.cs: Open keys readonly.
604 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
606 * typemanager.cs: don't report cyclic struct layout when a struct
607 contains 2 or more fields of the same type. Failed for Pango.AttrShape
608 which has 2 Pango.Rectangle fields.
610 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
612 * expression.cs: Handle IntPtr comparisons with IL code
613 rather than a method call.
615 2004-04-29 Martin Baulig <martin@ximian.com>
617 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
618 the list of PropertyInfo's in class hierarchy and find the
619 accessor. Fixes #56013.
621 2004-04-29 Martin Baulig <martin@ximian.com>
623 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
625 2004-04-29 Martin Baulig <martin@ximian.com>
627 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
629 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
631 2004-04-29 Martin Baulig <martin@ximian.com>
633 * class.cs (ConstructorInitializer.Resolve): Check whether the
634 parent .ctor is accessible. Fixes #52146.
636 2004-04-29 Martin Baulig <martin@ximian.com>
638 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
640 * statement.cs (Using.EmitLocalVariableDecls): Use
641 TypeManager.idisposable_type, not typeof (IDisposable).
642 (Foreach.EmitCollectionForeach): Added support for valuetypes.
644 2004-04-29 Martin Baulig <martin@ximian.com>
646 * class.cs (Event.Define): Don't emit the field and don't set
647 RTSpecialName and SpecialName for events on interfaces. Fixes
650 2004-04-29 Raja R Harinath <rharinath@novell.com>
652 Refactor Attribute.ApplyAttributes.
653 * attribute.cs (Attributable): New base class for objects that can
654 have Attributes applied on them.
655 (Attribute): Make AttributeUsage fields public.
656 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
657 (Attribute.IsInternalCall): New property.
658 (Attribute.UsageAttr): Convert to a public read-only property.
659 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
660 (Attribute.ResolveType, Attribute.Resolve)
661 (Attribute.ScanForIndexerName): Update to reflect changes.
662 (Attribute.CheckAttributeTarget): Re-format.
663 (Attribute.ApplyAttributes): Refactor, to various
664 Attributable.ApplyAttributeBuilder methods.
665 * decl.cs (MemberCore): Make Attributable.
666 * class.cs (Accessor): Make Attributable.
667 (MethodData.ApplyAttributes): Use proper attribute types, not
669 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
670 (TypeContainer.ApplyAttributeBuilder)
671 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
672 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
673 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
674 (Operator.ApplyAttributeBuilder): New factored-out methods.
675 * const.cs (Const.ApplyAttributeBuilder): Likewise.
676 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
677 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
678 * parameter.cs (ParameterBase): New Attributable base class
679 that can also represent Return types.
680 (Parameter): Update to the changes.
682 2004-04-29 Jackson Harper <jackson@ximian.com>
684 * driver.cs: Prefer the corlib system version when looking for
685 assemblies in the GAC. This is still a hack, but its a better hack
688 2004-04-29 Marek Safar <marek.safar@seznam.cz>
690 * decl.cs, enum.cs: Improved error 3005 reporting.
692 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
693 (related_symbols): New private member for list of symbols
694 related to reported error/warning.
696 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
698 2004-04-29 Martin Baulig <martin@ximian.com>
700 * ecore.cs (Expression.Constantify): If we're an enum and
701 TypeManager.TypeToCoreType() doesn't give us another type, use
702 t.UnderlyingSystemType. Fixes #56178.
704 2004-04-29 Martin Baulig <martin@ximian.com>
706 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
707 interfaces and for each interface, only add members directly
708 declared in that interface. Fixes #53255.
710 2004-04-28 Martin Baulig <martin@ximian.com>
712 * expression.cs (ConditionalLogicalOperator): Use a temporary
713 variable for `left' to avoid that we evaluate it more than once;
716 2004-04-28 Martin Baulig <martin@ximian.com>
718 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
721 2004-04-28 Martin Baulig <martin@ximian.com>
723 * statement.cs (LocalInfo.Resolve): Check whether the type is not
726 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
727 whether the type is not void (CS1547).
729 2004-04-28 Martin Baulig <martin@ximian.com>
731 * expression.cs (Unary.DoResolveLValue): Override this and report
732 CS0131 for anything but Operator.Indirection.
734 2004-04-28 Martin Baulig <martin@ximian.com>
736 Committing a patch from Ben Maurer; see bug #50820.
738 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
741 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
744 2004-04-28 Martin Baulig <martin@ximian.com>
746 Committing a patch from Ben Maurer; see bug #50820.
748 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
751 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
754 2004-04-28 Martin Baulig <martin@ximian.com>
756 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
757 (Block.AddLabel): Call DoLookupLabel() to only search in the
760 2004-04-28 Martin Baulig <martin@ximian.com>
762 * cfold.cs (ConstantFold.BinaryFold): Added special support for
763 comparing StringConstants and NullLiterals in Equality and Inequality.
765 2004-04-28 Jackson Harper <jackson@ximian.com>
767 * driver.cs: Attempt to load referenced assemblies from the
768 GAC. This is the quick and dirty version of this method that
769 doesnt take into account versions and just takes the first
770 canidate found. Will be good enough for now as we will not have more
771 then one version installed into the GAC until I update this method.
773 2004-04-28 Martin Baulig <martin@ximian.com>
775 * typemanager.cs (TypeManager.CheckStructCycles): New public
776 static method to check for cycles in the struct layout.
778 * rootcontext.cs (RootContext.PopulateTypes): Call
779 TypeManager.CheckStructCycles() for each TypeContainer.
780 [Note: We only need to visit each type once.]
782 2004-04-28 Martin Baulig <martin@ximian.com>
784 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
786 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
787 success and added `out object value'. Use a `bool resolved' field
788 to check whether we've already been called rather than
789 `ConstantValue != null' since this breaks for NullLiterals.
791 2004-04-28 Raja R Harinath <rharinath@novell.com>
793 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
794 setting of this flag, since the 'set' method may be non-public.
796 2004-04-28 Raja R Harinath <rharinath@novell.com>
798 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
799 check on current_vector.Block.
801 2004-04-27 Martin Baulig <martin@ximian.com>
803 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
804 a field initializer. Fixes #56459.
806 2004-04-27 Martin Baulig <martin@ximian.com>
808 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
809 we're not attempting to use an indexer. Fixes #52154.
811 2004-04-27 Martin Baulig <martin@ximian.com>
813 * statement.cs (Return): Don't create a return label if we don't
814 need it; reverts my change from January 20th. Thanks to Ben
817 2004-04-27 Martin Baulig <martin@ximian.com>
819 According to the spec, `goto' can only leave a nested scope, but
822 * statement.cs (Block.LookupLabel): Only lookup in the current
823 block, don't recurse into parent or child blocks.
824 (Block.AddLabel): Check in parent and child blocks, report
825 CS0140/CS0158 if we find a duplicate.
826 (Block): Removed this indexer for label lookups.
827 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
828 this already does the error reporting for us.
831 (FlowBranching.UsageVector.Block): New public variable; may be null.
832 (FlowBranching.CreateSibling): Added `Block' argument.
833 (FlowBranching.LookupLabel): New public virtual method. Lookup a
834 label for the target of a `goto' and check whether we're not
837 2004-04-27 Martin Baulig <martin@ximian.com>
839 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
840 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
843 2004-04-27 Martin Baulig <martin@ximian.com>
845 * statement.cs (Block.AddLabel): Also check for implicit blocks
846 and added a CS0158 check.
848 2004-04-27 Martin Baulig <martin@ximian.com>
850 * flowanalysis.cs (FlowBranchingLoop): New class.
851 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
852 UsageVector's instead of an ArrayList.
853 (FlowBranching.Label): Likewise.
854 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
855 (FlowBranching.AddBreakVector): New method.
857 2004-04-27 Miguel de Icaza <miguel@ximian.com>
859 * attribute.cs: Small regression fix: only convert the type if we
860 the type is different, fixes System.Drawing build.
862 2004-04-27 Martin Baulig <martin@ximian.com>
864 * attribute.cs (Attribute.Resolve): If we have a constant value
865 for a named field or property, implicity convert it to the correct
868 2004-04-27 Raja R Harinath <rharinath@novell.com>
870 * statement.cs (Block.Block): Implicit blocks share
871 'child_variable_names' fields with parent blocks.
872 (Block.AddChildVariableNames): Remove.
873 (Block.AddVariable): Mark variable as "used by a child block" in
874 every surrounding block.
875 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
876 been used in a child block, complain about violation of "Invariant
877 meaning in blocks" rule.
878 * cs-parser.jay (declare_local_variables): Don't use
879 AddChildVariableNames.
880 (foreach_statement): Don't create an implicit block: 'foreach'
883 2004-04-23 Miguel de Icaza <miguel@ximian.com>
885 * convert.cs (ImplicitNumericConversion): 0 is also positive when
886 converting from 0L to ulong. Fixes 57522.
888 2004-04-22 Marek Safar <marek.safar@seznam.cz>
890 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
891 derived class hides via 'new' keyword field from base class (test-242.cs).
892 TODO: Handle this in the more general way.
894 * class.cs (CheckBase): Ditto.
896 2004-04-22 Marek Safar <marek.safar@seznam.cz>
898 * decl.cs (caching_flags): New member for storing cached values
900 (MemberCore.Flags): New enum where bit flags for caching_flags
902 (MemberCore.cls_compliance): Moved to caching_flags.
903 (DeclSpace.Created): Moved to caching_flags.
905 * class.cs: Use caching_flags instead of DeclSpace.Created
907 2004-04-21 Miguel de Icaza <miguel@ximian.com>
909 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
910 if we are only a derived class, not a nested class.
912 * typemanager.cs: Same as above, but do this at the MemberLookup
913 level (used by field and methods, properties are handled in
914 PropertyExpr). Allow for the qualified access if we are a nested
917 2004-04-21 Marek Safar <marek.safar@seznam.cz>
919 * class.cs: Refactoring.
920 (IMethodData): New inteface; Holds links to parent members
921 to avoid member duplication (reduced memory allocation).
922 (Method): Implemented IMethodData interface.
923 (PropertyBase): New inner classes for get/set methods.
924 (PropertyBase.PropertyMethod): Implemented IMethodData interface
925 (Event): New inner classes for add/remove methods.
926 (Event.DelegateMethod): Implemented IMethodData interface.
928 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
929 EmitContext (related to class.cs refactoring).
931 2004-04-21 Raja R Harinath <rharinath@novell.com>
933 * delegate.cs (Delegate.VerifyApplicability): If the number of
934 arguments are the same as the number of parameters, first try to
935 verify applicability ignoring any 'params' modifier on the last
939 2004-04-08 Martin Baulig <martin@ximian.com>
941 Merged latest changes into gmcs. Please keep this comment in
942 here, it makes it easier for me to see what changed in MCS since
943 the last time I merged.
945 2004-04-16 Raja R Harinath <rharinath@novell.com>
947 * class.cs (TypeContainer.AddIndexer): Use
948 'ExplicitInterfaceName' to determine if interface name was
949 explicitly specified. 'InterfaceType' is not initialized at this time.
950 (TypeContainer.DefineIndexers): Remove use of temporary list. The
951 Indexers array is already in the required order. Initialize
952 'IndexerName' only if there are normal indexers.
953 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
954 (TypeContainer.Emit): Emit DefaultMember attribute only if
955 IndexerName is initialized.
958 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
960 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
963 2004-04-15 Raja R Harinath <rharinath@novell.com>
965 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
969 * attribute.cs (Attribute.Resolve): Check for duplicate named
973 2004-04-15 Miguel de Icaza <miguel@ximian.com>
975 * iterators.cs (MarkYield): track whether we are in an exception,
976 and generate code accordingly. Use a temporary value to store the
977 result for our state.
979 I had ignored a bit the interaction of try/catch with iterators
980 since their behavior was not entirely obvious, but now it is
981 possible to verify that our behavior is the same as MS .NET 2.0
985 2004-04-14 Miguel de Icaza <miguel@ximian.com>
987 * iterators.cs: Avoid creating temporaries if there is no work to
990 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
991 Enumerations, use TypeManager.EnumToUnderlying and call
994 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
997 (This.Emit): Use EmitContext.EmitThis to emit our
1000 (This.EmitAssign): Ditto.
1002 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
1003 codepaths, we will move all the functionality into
1006 (FieldExpr.EmitAssign): Ditto.
1008 This fixes several hidden bugs that I uncovered while doing a code
1009 review of this today.
1011 * codegen.cs (EmitThis): reworked so the semantics are more clear
1012 and also support value types "this" instances.
1014 * iterators.cs: Changed so that for iterators in value types, we
1015 do not pass the value type as a parameter.
1017 Initialization of the enumerator helpers is now done in the caller
1018 instead of passing the parameters to the constructors and having
1019 the constructor set the fields.
1021 The fields have now `assembly' visibility instead of private.
1023 2004-04-11 Miguel de Icaza <miguel@ximian.com>
1025 * expression.cs (Argument.Resolve): Check if fields passed as ref
1026 or out are contained in a MarshalByRefObject.
1028 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
1029 another compiler type.
1031 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
1033 * class.cs (Indexer.Define): use the new name checking method.
1034 Also, return false on an error.
1035 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
1036 (is_identifier_[start/part]_character): make static.
1038 2004-04-10 Miguel de Icaza <miguel@ximian.com>
1040 * expression.cs (Binary.ResolveOperator): Do no append strings
1041 twice: since we can be invoked more than once (array evaluation)
1042 on the same concatenation, take care of this here. Based on a fix
1043 from Ben (bug #56454)
1045 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
1047 * codegen.cs: Fix another case where CS1548 must be reported (when
1048 delay-sign isn't specified and no private is available #56564). Fix
1049 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
1050 error when MCS is used on the MS runtime and we need to delay-sign
1051 (which seems unsupported by AssemblyBuilder - see #56621).
1053 2004-04-08 Marek Safar <marek.safar@seznam.cz>
1055 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
1056 (TypeManager.ComputeNamespaces): Faster implementation for
1059 * compiler.csproj: Updated AssemblyName to mcs.
1061 2004-05-11 Jackson Harper <jackson@ximian.com>
1063 * Makefile: Preserve MONO_PATH
1065 2004-05-11 Jackson Harper <jackson@ximian.com>
1067 * Makefile: Use mono and mcs to build gmcs
1069 2004-05-03 Miguel de Icaza <miguel@ximian.com>
1071 * codegen.cs: Add patch from Robert Shade
1072 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
1075 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
1077 * CryptoConvert.cs: Updated to latest version. Fix issue with
1078 incomplete key pairs (#57941).
1080 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
1082 * codegen.cs: Fix another case where CS1548 must be reported (when
1083 delay-sign isn't specified and no private is available #56564). Fix
1084 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
1085 error when MCS is used on the MS runtime and we need to delay-sign
1086 (which seems unsupported by AssemblyBuilder - see #56621).
1088 2004-04-29 Jackson Harper <jackson@ximian.com>
1090 * Makefile: Set MONO_PATH to use the bootstrap corlib
1091 * driver.cs: Check the GAC for referenced assemblies.
1093 2004-04-29 Martin Baulig <martin@ximian.com>
1095 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
1097 2004-04-07 Martin Baulig <martin@ximian.com>
1099 * expression.cs (Binary.ResolveOperator): Added special case for
1100 Equality/Inequality between a type parameter and a null literal.
1102 2004-04-07 Martin Baulig <martin@ximian.com>
1104 * convert.cs: Check null literal -> type parameter conversions.
1106 2004-04-07 Martin Baulig <martin@ximian.com>
1108 * generic.cs (ConstructedType.CheckConstraints): Enforce the
1109 `class' and `struct' constraints.
1111 2004-04-07 Martin Baulig <martin@ximian.com>
1113 * generic.cs (SpecialConstraint): New public enum.
1114 (Constraints.Resolve): Added support for the `class' and `struct'
1117 * cs-parser.jay (type_parameter_constraint): Added support for the
1118 `class' and `struct' constraints.
1120 2004-04-07 Martin Baulig <martin@ximian.com>
1122 * support.cs (GenericConstraints): Replaced `Types' by
1123 `ClassConstraint' and `InterfaceConstraints'; added
1124 `HasClassConstraint'.
1126 2004-04-07 Martin Baulig <martin@ximian.com>
1129 (Constraints.InterfaceConstraints): New public property.
1130 (Constraints.Types): Make this property public
1131 (TypeParameter): Implement IMemberContainer.
1132 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
1133 instead of a TypeBuilder/MethodBuilder; pass the interface
1134 constraints to TypeManager.AddTypeParameter().
1135 (TypeParameter.DefineType): Just take an EmitContext and no
1136 TypeBuilder/MethodBuilder. Use the new public API.
1138 * typemanager.cs (TypeManager.AddTypeParameter): Added
1139 `TypeExpr[]' argument; add the interfaces to the
1140 `builder_to_ifaces' hash.
1141 (TypeManager.LookupMemberContainer): For
1142 GenericTypeParameterBuilders, get the TypeParameter from the
1143 `builder_to_type_param'.
1144 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
1145 the TypeParameter and call FindMembers on it.
1147 2004-04-07 Martin Baulig <martin@ximian.com>
1150 (MethodCore.GenericMethod): Moved this field here from Method.
1151 (MethodCore.IsDuplicateImplementation): Take the number of type
1152 parameters into account if we're a generic method.
1154 * expression.cs (Invocation.InferTypeArguments): Don't return true
1155 if `arguments' is null; we still need to check whether we actually
1156 don't need to infer anything in this case.
1157 (MemberAccess): Merged the functionality from GenericMemberAccess
1160 * generic.cs (GenericMemberAccess): Removed.
1162 2004-04-05 Martin Baulig <martin@ximian.com>
1164 * decl.cs (MemberCore): For generic classes, interfaces and
1165 structs, `Name' now includes the number of type parameters
1167 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
1168 encode the number of type arguments in the type name.
1170 * expression.cs (Expression.MemberLookup): Removed the
1171 `num_type_args' argument; we now encode the number of type
1172 arguments in the type name.
1174 * ecore.cs (SimpleName): Encode the number of type arguments in
1175 the type name itself.
1177 * generic.cs (ConstructedType): Likewise.
1179 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
1180 `MemberName'; we now include the number of type parameters in the
1183 * typemanager.cs (TypeManager.CheckGeneric): Removed.
1184 (TypeManager.MemberLookup): Removed the
1185 `num_type_args' argument; we now encode the number of type
1186 arguments in the type name.
1188 2004-04-03 Martin Baulig <martin@ximian.com>
1190 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
1191 (MemberCore.MemberName): Moved here from MemberBase.
1192 (DeclSpace.SetParameterInfo): Just take the constraints as an
1193 ArrayList; we already have the type parameters in our
1194 `MemberName'; also do the CS0080 reporting here.
1196 * cs-parser.jay (struct_declaration): Use `member_name' instead of
1197 `IDENTIFIER opt_type_parameter_list'; when constructing our
1198 `MemberName', it'll already include our type parameters.
1199 (class_declaration, interface_declaration): Likewise.
1200 (delegate_declaration): Likewise.
1201 (MakeName): Take a MemberName and return a MemberName.
1202 The following two changes are required to avoid shift/reduce conflicts:
1203 (member_name): Don't include a TypeName anymore; ie. this is now
1204 just 'IDENTIFIER opt_type_parameter_list'.
1205 (property_declaration, event_declaration): Use a
1206 `namespace_or_type_name' instead of a `member_name'.
1208 2004-04-03 Martin Baulig <martin@ximian.com>
1210 * decl.cs (MemberName): Renamed to `TypeName' and created a new
1212 (TypeName): Formerly known as MemberName.
1214 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
1215 instead of a `MemberName'.
1217 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
1218 (member_name): New rule; create a MemberName.
1220 2004-04-02 Martin Baulig <martin@ximian.com>
1222 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
1223 (CS0305 and CS0308).
1225 2004-04-02 Martin Baulig <martin@ximian.com>
1227 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
1228 support for nested types.
1230 2004-04-02 Martin Baulig <martin@ximian.com>
1232 * ecore.cs (IAlias): New public interface.
1233 (TypeExpr, TypeExpression): Implement IAlias.
1234 (TypeAliasExpression): New public class.
1236 * namespace.cs (Namespace): Implement IAlias.
1237 (Namespace.Lookup): Return an IAlias instead on an object.
1238 (Namespace.DefineName): Take an IAlias instead of an object.
1239 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
1241 (NamespaceEntry.UsingAlias): Take a Membername instead of an
1243 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
1245 (NamespaceEntry.Lookup): Likewise.
1247 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
1250 * decl.cs (DeclSpace): Implement IAlias.
1251 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
1253 * generic.cs (ConstructedType): Improved error checking.
1255 2004-04-02 Martin Baulig <martin@ximian.com>
1257 * convert.cs: Added type parameter conversions.
1260 (UnboxCast.Emit): Emit an `unbox.any' for type params.
1261 (ClassCast.Emit): If the source type is a type parameter, box it.
1262 If the target type is a type parameter, emit an `unbox.any'
1263 instead of a `classcast'.1
1265 2004-04-01 Martin Baulig <martin@ximian.com>
1267 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
1269 2004-04-01 Martin Baulig <martin@ximian.com>
1271 * expression.cs (Invocation.EmitCall): If we're invoking a method
1272 on a type parameter, use the new `Constrained' prefix opcode.
1274 2004-04-01 Martin Baulig <martin@ximian.com>
1276 * generic.cs (ConstructedType.CheckConstraints): Use
1277 Convert.ImplicitStandardConversionExists(); user-defined implicit
1278 conversions are not allowed according to the spec.
1280 2004-03-30 Martin Baulig <martin@ximian.com>
1282 * expression.cs (New): Added support for type parameters.
1285 (TypeManager.activator_type): New public static field.
1286 (TypeManager.activator_create_instance): Likewise.
1288 2004-03-30 Martin Baulig <martin@ximian.com>
1290 * typemanager.cs (TypeManager.HasConstructorConstraint): New
1293 2004-03-30 Martin Baulig <martin@ximian.com>
1295 * generic.cs (ConstructedType.CheckConstraints): Actually follow
1296 the spec here: the argument type must be convertible to the
1299 2004-03-30 Martin Baulig <martin@ximian.com>
1302 (TypeParameter.Define, TypeParameter.DefineMethod): Call
1303 TypeManager.AddTypeParameter().
1304 (ConstructedType.CheckConstraints): Re-enable this and actually
1305 check whether we have a constructor constraint.
1308 (TypeManager.builder_to_type_param): New static field.
1309 (TypeManager.AddTypeParameter): New static method.
1310 (TypeManager.LookupTypeParameter): New public method.
1312 2004-03-30 Martin Baulig <martin@ximian.com>
1314 * generic.cs (TypeParameter.DefineType): Return a boolean and use
1315 the new API to actually define the constructor constraint.
1318 (TypeManager.new_constraint_attr_type): New static field.
1319 (TypeManager.InitCoreTypes): Initialize it.
1321 2004-03-30 Martin Baulig <martin@ximian.com>
1323 * generic.cs (Constraints): Completed error checking, use correct
1326 2004-03-29 Martin Baulig <martin@ximian.com>
1328 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
1330 * expression.cs (Invocation.InferTypeArguments): Added overloaded
1331 public version which takes a `ParameterData pd' instead of an
1334 2004-03-29 Martin Baulig <martin@ximian.com>
1336 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
1339 2004-03-29 Martin Baulig <martin@ximian.com>
1341 * expression.cs (Argument.ResolveMethodGroup): If we're a
1342 ConstructedType, call GetMemberAccess() on it.
1344 2004-03-29 Martin Baulig <martin@ximian.com>
1346 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
1347 (MethodCore.CheckGenericOverride): When overriding a generic
1348 method, check whether the constraints match.
1350 * support.cs (GenericConstraints): New public interface.
1351 (ParameterData.GenericConstraints): New public method.
1353 * parameter.cs (Parameter.Resolve): Check whether we're a generic
1354 method parameter and compute our constraints if appropriate.
1355 (Parameter.GenericConstraints): New public property.
1357 * generic.cs (Constraints): Implement GenericConstraints.
1359 2004-03-29 Martin Baulig <martin@ximian.com>
1361 * decl.cs (MemberCache.FindMemberToOverride): Use
1362 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
1364 2004-03-29 Martin Baulig <martin@ximian.com>
1366 * generic.cs (GenericMethod.Define): Resolve our type parameters.
1368 2004-03-29 Martin Baulig <martin@ximian.com>
1370 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
1371 not allowed on non-generic declarations").
1373 2004-03-29 Martin Baulig <martin@ximian.com>
1375 * expression.cs (Invocation.InferTypeArguments): Added overloaded
1376 public version of this method.
1378 * class.cs (MethodCore.IsDuplicateImplementation): Use
1379 Invocation.InferTypeArguments() to check this.
1381 2004-03-29 Martin Baulig <martin@ximian.com>
1383 * convert.cs: Use TypeManager.IsDelegateType() instead of
1384 comparing types correctly.
1386 2004-03-29 Martin Baulig <martin@ximian.com>
1388 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
1389 types directly to make it work for generic instances.
1391 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
1393 2004-03-29 Martin Baulig <martin@ximian.com>
1395 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
1398 2004-03-24 Martin Baulig <martin@ximian.com>
1400 * decl.cs (DeclSpace.FindType): Also use
1401 TypeManager.CheckGeneric() for types from the using clauses.
1403 2004-03-23 Martin Baulig <martin@ximian.com>
1405 * expression.cs (Invocation.OverloadResolve): Added `bool
1406 may_fail' argument and use it instead of the Location.IsNull() hack.
1408 2004-03-23 Martin Baulig <martin@ximian.com>
1410 * expression.cs (Invocation.InferType): Use correct type inference
1413 2004-03-23 Martin Baulig <martin@ximian.com>
1415 * ecore.cs (MethodGroupExpr.Name): Use
1416 TypeManager.CSharpSignature() instead of just the name.
1418 * expression.cs (Invocation.OverloadResolve): Provide better error
1420 (Invocation.DoResolve): OverloadResolve() never returns null
1421 without reporting an error, so removed the error -6 reporting here.
1423 2004-03-23 Martin Baulig <martin@ximian.com>
1425 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
1428 * cs-parser.jay (delegate_declaration): Support generic delegates.
1430 * delegate.cs: Support generic delegates.
1432 2004-03-22 Martin Baulig <martin@ximian.com>
1434 * expression.cs (Invocation.InferParamsTypeArguments): New static
1435 method; does type inference for params arguments.
1437 2004-03-21 Martin Baulig <martin@ximian.com>
1439 * typemanager.cs (TypeManager.IsGenericMethod): New public static
1440 method; checks whether a method is a generic method.
1442 * expression.cs (Invocation.InferTypeArguments): New static method;
1443 infer type arguments for generic method invocation.
1445 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
1446 property; we set this to true if we're resolving a generic method
1447 invocation and the user specified type arguments, ie. we're not
1448 doing type inference.
1450 2004-03-20 Martin Baulig <martin@ximian.com>
1452 * class.cs (MethodData.DeclaringType): New public property.
1453 (MethodData.Define): Set DeclaringType here.
1454 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
1455 instead of OperatorMethodBuilder.DeclaringType.
1457 2004-03-20 Martin Baulig <martin@ximian.com>
1459 * cs-tokenizer.cs (xtoken): Return a special
1460 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
1462 * cs-parser.jay (default_value_expression): Switch to the new
1465 2004-03-19 Martin Baulig <martin@ximian.com>
1467 * decl.cs (MemberName): New class. We use this to "construct"
1468 namespace_or_type_name's.
1470 * generics.cs (TypeArguments.GetDeclarations): New public method;
1471 returns the type arguments as a string[] and reports a CS0081 if
1472 one of them is not an identifier.
1474 * class.cs (MemberBase): The .ctor now takes the name as a
1475 MemberName instead of a string.
1476 (MemberBase.ExplicitInterfaceName): Changed type from string to
1478 (MemberBase.DoDefine): If we're an explicit implementation, the
1479 InterfaceType may be a generic instance.
1481 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
1482 (namespace_name): Call MemberName.GetName () to transform the
1483 MemberName into a string and ensure we don't have any type
1485 (type_name): Call MemberName.GetTypeExpression() to transfrom the
1486 MemberName into an expression.
1487 (method_header): Use namespace_or_type_name instead of member_name.
1489 2004-04-07 Miguel de Icaza <miguel@ximian.com>
1491 * rootcontext.cs: Add new types to the boot resolution.
1493 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
1494 MulticastDelegate is not allowed.
1496 * typemanager.cs: Add new types to lookup: System.TypedReference
1499 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
1500 check for TypedReference or ArgIterator, they are not allowed.
1502 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
1503 makes us properly catch 1510 in some conditions (see bug 56016 for
1506 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
1508 * CryptoConvert.cs: update from corlib version
1511 2004-04-05 Miguel de Icaza <miguel@ximian.com>
1513 * class.cs (Indexer.Define): Check indexername declaration
1515 2004-04-05 Marek Safar <marek.safar@seznam.cz>
1517 * attribute.cs (IsClsCompliant): Fixed problem with handling
1518 all three states (compliant, not-compliant, undetected).
1520 2004-03-30 Marek Safar <marek.safar@seznam.cz>
1522 * attribute.cs (Attribute): Location is now public.
1523 (Resolve): Store resolved arguments (pos_values) in attribute class.
1524 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
1525 (GetClsCompliantAttributeValue): New method that gets
1526 CLSCompliantAttribute value.
1527 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
1528 if exists else null.
1529 (AttributeTester): New class for CLS-Compliant verification routines.
1531 * class.cs (Emit): Add CLS-Compliant verification.
1532 (Method.GetSignatureForError): Implemented.
1533 (Constructor.GetSignatureForError): Implemented
1534 (Constructor.HasCompliantArgs): Returns if constructor has
1535 CLS-Compliant arguments.
1536 (Constructor.Emit): Override.
1537 (Construcor.IsIdentifierClsCompliant): New method; For constructors
1538 is needed to test only parameters.
1539 (FieldBase.GetSignatureForError): Implemented.
1540 (TypeContainer): New member for storing base interfaces.
1541 (TypeContainer.FindMembers): Search in base interfaces too.
1543 * codegen.cs (GetClsComplianceAttribute): New method that gets
1544 assembly or module CLSCompliantAttribute value.
1545 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
1547 (ModuleClass.Emit): Add error 3012 test.
1549 * const.cs (Emit): Override and call base for CLS-Compliant tests.
1551 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
1552 state for all decl types.
1553 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
1554 if CLS-Compliant tests are required.
1555 (IsClsCompliaceRequired): New method. Analyze whether code
1556 must be CLS-Compliant.
1557 (IsExposedFromAssembly): New method. Returns true when MemberCore
1558 is exposed from assembly.
1559 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
1560 value or gets cached value.
1561 (HasClsCompliantAttribute): New method. Returns true if MemberCore
1562 is explicitly marked with CLSCompliantAttribute.
1563 (IsIdentifierClsCompliant): New abstract method. This method is
1564 used to testing error 3005.
1565 (IsIdentifierAndParamClsCompliant): New method. Common helper method
1566 for identifier and parameters CLS-Compliant testing.
1567 (VerifyClsCompliance): New method. The main virtual method for
1568 CLS-Compliant verifications.
1569 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
1570 null. I don't know why is null (too many public members !).
1571 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
1572 and get value of first CLSCompliantAttribute that found.
1574 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
1575 (VerifyClsCompliance): Override and add extra tests.
1577 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
1578 clscheck- disable CLS-Compliant verification event if assembly is has
1579 CLSCompliantAttribute(true).
1581 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
1582 ApllyAttribute is now called in emit section as in the other cases.
1583 Possible future Emit integration.
1584 (IsIdentifierClsCompliant): New override.
1585 (VerifyClsCompliance): New override.
1586 (GetEnumeratorName): Returns full enum name.
1588 * parameter.cs (GetSignatureForError): Implemented.
1590 * report.cs (WarningData): New struct for Warning message information.
1591 (LocationOfPreviousError): New method.
1592 (Warning): New method. Reports warning based on the warning table.
1593 (Error_T): New method. Reports error based on the error table.
1595 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
1596 verifications are done here.
1598 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
1600 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
1601 CLSCompliantAttribute.
1602 (all_imported_types): New member holds all imported types from other
1604 (LoadAllImportedTypes): New method fills static table with exported types
1605 from all referenced assemblies.
1606 (Modules): New property returns all assembly modules.
1608 2004-03-30 Miguel de Icaza <miguel@ximian.com>
1610 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
1611 throwing a parser error.
1613 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
1614 which removes the hardcoded get_/set_ prefixes for properties, as
1615 IL allows for the properties to be named something else.
1619 * expression.cs: Do not override operand before we know if it is
1622 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1624 * typemanager.cs: support for pinned variables.
1626 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1628 * decl.cs, typemanager.cs: Avoid using an arraylist
1629 as a buffer if there is only one result set.
1631 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1633 * expression.cs: Make sure you cant call a static method
1634 with an instance expression, bug #56174.
1636 2004-03-29 Miguel de Icaza <miguel@ximian.com>
1638 * class.cs (IsDuplicateImplementation): Improve error reporting to
1639 flag 663 (method only differs in parameter modifier).
1641 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
1642 in preprocessor directives.
1644 * location.cs (LookupFile): Allow for the empty path.
1646 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
1647 better approach for some of that patch, but its failing with the
1648 CharSet enumeration. For now try/catch will do.
1650 * typemanager.cs: Do not crash if a struct does not have fields.
1653 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1655 * expression.cs: cs0213, cant fix a fixed expression.
1658 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1660 * cs-parser.jay: detect invalid embeded statements gracefully.
1663 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1665 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
1668 the invocation type may not be a subclass of the tye of the item/
1669 The type of the item must be a subclass of the invocation item.
1674 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
1676 * attribute.cs: Added methods to get a string and a bool from an
1677 attribute. Required to information from AssemblyKeyFileAttribute,
1678 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
1679 * codegen.cs: Modified AssemblyName creation to include support for
1680 strongnames. Catch additional exceptions to report them as CS1548.
1681 * compiler.csproj: Updated include CryptoConvert.cs.
1682 * compiler.csproj.user: Removed file - user specific configuration.
1683 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
1684 Mono.Security assembly. The original class is maintained and tested in
1685 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
1686 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
1687 like CSC 8.0 (C# v2) supports.
1688 * Makefile: Added CryptoConvert.cs to mcs sources.
1689 * rootcontext.cs: Added new options for strongnames.
1691 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
1693 * driver.cs: For --expect-error, report error code `2'
1694 if the program compiled with no errors, error code `1' if
1695 it compiled with an error other than the one expected.
1697 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
1699 * compiler.csproj: Updated for Visual Studio .NET 2003.
1700 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
1701 * compiler.sln: Updated for Visual Studio .NET 2003.
1703 2004-03-24 Ravi Pratap M <ravi@ximian.com>
1705 * expression.cs: Fix bug #47234. We basically need to apply the
1706 rule that we prefer the conversion of null to a reference type
1707 when faced with a conversion to 'object' (csc behaviour).
1709 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1711 * statement.cs: Shorter form for foreach, eliminates
1712 a local variable. r=Martin.
1714 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1716 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
1717 checks if we can use brtrue/brfalse to test for 0.
1718 * expression.cs: use the above in the test for using brtrue/brfalse.
1721 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1723 * expression.cs: Rewrite string concat stuff. Benefits:
1725 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
1726 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
1727 rather than a concat chain.
1729 * typemanager.cs: Add lookups for more concat overloads.
1731 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1733 * expression.cs: Emit shorter il code for array init.
1750 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
1752 * statement.cs: Before, two switch blocks would be merged if the
1753 total size of the blocks (end_item - begin_item + 1) was less than
1754 two times the combined sizes of the blocks.
1756 Now, it will only merge if after the merge at least half of the
1761 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
1763 * class.cs : csc build fix for GetMethods(). See bug #52503.
1765 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
1767 * expression.cs: Make sure fp comparisons work with NaN.
1768 This fixes bug #54303. Mig approved this patch a long
1769 time ago, but we were not able to test b/c the runtime
1772 2004-03-19 Miguel de Icaza <miguel@ximian.com>
1774 * ecore.cs (TypExpr.GetHashCode): implement this overload.
1776 2004-03-19 Martin Baulig <martin@ximian.com>
1778 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
1779 two overloads may unify for some type parameter substitutions and
1780 report a CS0408 if appropriate.
1782 2004-03-19 Martin Baulig <martin@ximian.com>
1784 * class.cs (MemberCore.IsDuplicateImplementation): Report the
1785 error here and not in our caller.
1787 2004-03-19 Martin Baulig <martin@ximian.com>
1789 * interface.cs: Completely killed this file.
1790 (Interface): We're now a TypeContainer and live in class.cs.
1792 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
1793 argument; we're now also called for interfaces.
1794 (TypeContainer.DefineMembers): Allow this method being called
1796 (TypeContainer.GetMethods): New public method; formerly known as
1797 Interface.GetMethod(). This is used by PendingImplementation.
1798 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
1799 it's now private and non-static.
1800 (Interface): Moved this here; it's now implemented similar to
1802 (Method, Property, Event, Indexer): Added `bool is_interface'
1803 argument to their .ctor's.
1804 (MemberBase.IsInterface): New public field.
1806 * cs-parser.jay: Create normal Method, Property, Event, Indexer
1807 instances instead of InterfaceMethod, InterfaceProperty, etc.
1808 (opt_interface_base): Removed; we now use `opt_class_base' instead.
1809 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
1811 2004-03-19 Martin Baulig <martin@ximian.com>
1813 * class.cs (MethodCore.IsDuplicateImplementation): New private
1814 method which does the CS0111 checking.
1815 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
1816 Use IsDuplicateImplementation().
1818 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
1820 * decl.cs (FindMemberToOverride): New method to find the correct
1821 method or property to override in the base class.
1823 - Make Method/Property use the above method to find the
1824 version in the base class.
1825 - Remove the InheritableMemberSignatureCompare as it is now
1828 This patch makes large code bases much faster to compile, as it is
1829 O(n) rather than O(n^2) to do this validation.
1831 Also, it fixes bug 52458 which is that nested classes are not
1832 taken into account when finding the base class member.
1834 Reviewed/Approved by Martin.
1836 2004-03-17 Martin Baulig <martin@ximian.com>
1838 * expression.cs (MemberAccess.DoResolve): Take the parent's number
1839 of type arguments into account; use the `real_num_type_args'
1840 approach like in DoResolveAsTypeStep().
1842 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
1845 2004-03-17 Marek Safar <marek.safar@seznam.cz>
1847 * interface.cs: In all interface classes removed redundant
1848 member initialization.
1850 2004-03-16 Martin Baulig <martin@ximian.com>
1852 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1854 2004-03-15 Miguel de Icaza <miguel@ximian.com>
1856 * decl.cs (DefineTypeAndParents): New helper method to define a
1857 type's containers before the type itself is defined; This is a
1858 bug exposed by the recent changes to Windows.Forms when an
1859 implemented interface was defined inside a class that had not been
1862 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
1864 (Check): Loop correctly to report errors modifiers
1865 (UNSAFE was not in the loop, since it was the same as TOP).
1867 * interface.cs: Every interface member now takes a ModFlags,
1868 instead of a "is_new" bool, which we set on the base MemberCore.
1870 Every place where we called "UnsafeOk" in the interface, now we
1871 call the proper member (InterfaceMethod.UnsafeOK) instead to get
1872 the unsafe settings from the member declaration instead of the
1873 container interface.
1875 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
1877 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1878 `set_indexer_name' to the pending bits (one per type).
1880 We fixed a bug today that was picking the wrong method to
1881 override, since for properties the existing InterfaceMethod code
1882 basically ignored the method name. Now we make sure that the
1883 method name is one of the valid indexer names.
1885 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
1887 * support.cs (SeekableStreamReader): Keep track of stream byte
1888 positions and don't mix them with character offsets to the buffer.
1890 Patch from Gustavo Giráldez
1892 2004-03-15 Marek Safar <marek.safar@seznam.cz>
1894 * interface.cs (InterfaceSetGetBase): Removed double member
1895 initialization, base class does it as well.
1897 2004-03-13 Martin Baulig <martin@ximian.com>
1899 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
1900 when compiling corlib.
1902 2004-03-13 Miguel de Icaza <miguel@ximian.com>
1904 * convert.cs (ExplicitConversion): We were reporting an error on
1905 certain conversions (object_type source to a value type, when the
1906 expression was `null') before we had a chance to pass it through
1907 the user defined conversions.
1909 * driver.cs: Replace / and \ in resource specifications to dots.
1912 * class.cs: Add check for duplicate operators. Fixes 52477
1914 2004-03-11 Miguel de Icaza <miguel@ximian.com>
1916 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
1917 that are in the middle of the statements, not only at the end.
1920 * class.cs (TypeContainer.AddField): No longer set the
1921 `HaveStaticConstructor' flag, now we call it
1922 `UserDefineStaticConstructor' to diferentiate the slightly
1923 semantic difference.
1925 The situation is that we were not adding BeforeFieldInit (from
1926 Modifiers.TypeAttr) to classes that could have it.
1927 BeforeFieldInit should be set to classes that have no static
1932 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
1934 And most importantly Zoltan's comment:
1936 http://bugzilla.ximian.com/show_bug.cgi?id=44229
1938 "I think beforefieldinit means 'it's ok to initialize the type sometime
1939 before its static fields are used', i.e. initialization does not need
1940 to be triggered by the first access to the type. Setting this flag
1941 helps the JIT to compile better code, since it can run the static
1942 constructor at JIT time, and does not need to generate code to call it
1943 (possibly lots of times) at runtime. Unfortunately, mcs does not set
1944 this flag for lots of classes like String.
1946 csc sets this flag if the type does not have an explicit static
1947 constructor. The reasoning seems to be that if there are only static
1948 initalizers for a type, and no static constructor, then the programmer
1949 does not care when this initialization happens, so beforefieldinit
1952 This bug prevents the AOT compiler from being usable, since it
1953 generates so many calls to mono_runtime_class_init that the AOT code
1954 is much slower than the JITted code. The JITted code is faster,
1955 because it does not generate these calls if the vtable is type is
1956 already initialized, which is true in the majority of cases. But the
1957 AOT compiler can't do this."
1959 2004-03-10 Miguel de Icaza <miguel@ximian.com>
1961 * class.cs (MethodData.Emit): Refactor the code so symbolic
1962 information is generated for destructors; For some reasons we
1963 were taking a code path that did not generate symbolic information
1966 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
1968 * class.cs: Create a Constructor.CheckBase method that
1969 takes care of all validation type code. The method
1970 contains some code that was moved from Define.
1972 It also includes new code that checks for duplicate ctors.
1973 This fixes bug #55148.
1975 2004-03-09 Joshua Tauberer <tauberer@for.net>
1977 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
1978 a { ... }-style array creation invokes EmitStaticInitializers
1979 which is not good for reference-type arrays. String, decimal
1980 and now null constants (NullCast) are not counted toward
1981 static initializers.
1983 2004-03-05 Martin Baulig <martin@ximian.com>
1985 * location.cs (SourceFile.HasLineDirective): New public field;
1986 specifies whether the file contains or is referenced by a "#line"
1988 (Location.DefineSymbolDocuments): Ignore source files which
1989 either contain or are referenced by a "#line" directive.
1991 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
1993 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
1994 direct access to our parent, so check the method inline there.
1996 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
1998 * expression.cs (Invocation.EmitCall): Miguel's last commit
1999 caused a regression. If you had:
2004 In Foo the implict this would be null.
2006 2004-02-27 Miguel de Icaza <miguel@ximian.com>
2008 * expression.cs (Invocation.EmitCall): If the method is not
2009 virtual, do not emit a CallVirt to it, use Call.
2011 * typemanager.cs (GetFullNameSignature): Improve the method to
2012 cope with ".ctor" and replace it with the type name.
2014 * class.cs (ConstructorInitializer.Resolve): Now the method takes
2015 as an argument the ConstructorBuilder where it is being defined,
2016 to catch the recursive constructor invocations.
2018 2004-03-16 Martin Baulig <martin@ximian.com>
2020 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
2021 ConstructedType, call ResolveType() on it to get the type rather
2022 than just using `expr.Type'.
2024 2004-03-16 Martin Baulig <martin@ximian.com>
2026 * generics.cs (ConstructedType.GetMemberAccess): Take the
2027 EmitContext instead on the TypeExpr and use
2028 ec.TypeContainer.CurrentType/ec.ContainerType.
2030 2004-03-16 Martin Baulig <martin@ximian.com>
2032 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
2033 parameters before aliases.
2035 2004-03-16 Martin Baulig <martin@ximian.com>
2037 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
2038 New oublic function; checks whether two generic instances may become
2039 equal under some instantiations (26.3.1).
2041 * class.cs (TypeContainer.Define): Call
2042 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
2045 2004-03-16 Martin Baulig <martin@ximian.com>
2047 * class.cs (TypeContainer.GetClassBases): Moved
2048 Error_TypeParameterAsBase() here and also check whether the base
2049 class is not an attribute.
2051 2004-03-16 Martin Baulig <martin@ximian.com>
2053 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
2055 2004-03-16 Martin Baulig <martin@ximian.com>
2057 * class.cs (Error_TypeParameterAsBase): Use correct error number
2060 2004-03-16 Martin Baulig <martin@ximian.com>
2062 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
2065 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
2068 2004-03-15 Martin Baulig <martin@ximian.com>
2070 * typemanager.cs (TypeManager.GetFullName): New public method.
2071 (TypeManager.MemberLookup): Added `int_num_type_arguments'
2072 argument; only return members with the correct number of type
2074 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
2075 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
2076 whether the number of type arguments matches.
2078 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
2079 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
2081 * expression.cs (MemberAccess): Added public `NumTypeArguments'
2082 field; it's set by the protected .ctor when we're actually a
2083 GenericMemberAccess.
2084 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
2085 arguments and pass it to MemberLookupFinal ().
2087 * ecore.cs (Expression.MemberLookup): Added `int
2088 num_type_arguments' argument; only return members with the correct
2089 number of type arguments.
2090 (Expression.MemberLookupFailed): Check whether the MemberLookup
2091 failed because we did not have the correct number of type
2092 arguments; report CS0305 in this case.
2094 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
2095 `e.ResolveAsTypeTerminal()' already did so.
2097 2004-03-15 Martin Baulig <martin@ximian.com>
2099 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
2100 we're a ConstructedType; in this case, the caller must report an
2101 error (for instance CS0131).
2103 * generic.cs (TypeArguments): Added Location argument to the .ctor.
2104 (TypeArguments.Resolve): Actually report errors here.
2106 2004-03-15 Miguel de Icaza <miguel@ximian.com>
2108 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
2109 `set_indexer_name' to the pending bits (one per type).
2111 We fixed a bug today that was picking the wrong method to
2112 override, since for properties the existing InterfaceMethod code
2113 basically ignored the method name. Now we make sure that the
2114 method name is one of the valid indexer names.
2116 2004-03-15 Martin Baulig <martin@ximian.com>
2118 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
2119 for generic instances.
2121 2004-03-13 Martin Baulig <martin@ximian.com>
2123 * class.cs (TypeContainer.DefineType): Call
2124 TypeManager.AddUserType() immediately after creating the
2125 TypeBuilder; pass all type parameters when creating the
2128 * decl.cs (DeclSpace.FindNestedType): New public method.
2129 (DeclSpace.FindType): Added `int num_type_args' argument; only
2130 return types with the correct number of type parameters.
2131 (DeclSpace.CountTypeParams): New public property.
2133 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
2134 the number of type parameters; defaults to zero.
2136 * generic.cs (TypeArguments.Count): New public property.
2137 (ConstructedType.DoResolveAsTypeStep): First call
2138 ds.FindNestedType() to find out whether we're nested in the
2139 current generic type; in this case, we inherit all type parameters
2140 from the current class.
2142 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
2143 num_type_args' argument.
2144 (RootContext.LookupType): Added overloaded version which takes the
2145 number of type arguments; only return types with the correct
2146 number of type arguments.
2148 * typemanager.cs (TypeManager.CheckGeneric): New public function;
2149 checks whether `Type t' has `int num_type_args'.
2151 2004-03-13 Martin Baulig <martin@ximian.com>
2153 * generic.cs (GenericMethod.DefineType): New method; calls
2154 DefineType() on all the type parameters.
2156 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
2157 (MethodData.Define): If we're a generic method, call
2158 GenericMethod.DefineType() to define the type parameters.
2160 2004-03-10 Martin Baulig <martin@ximian.com>
2162 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
2163 instead of IsAssignableFrom.
2165 2004-03-10 Martin Baulig <martin@ximian.com>
2167 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
2169 * support.cs (ParameterData.HasArrayParameter): New property.
2170 (ReflectionParameters.ctor): Take a MethodBase instead of a
2171 ParameterInfo[]. If we have any type parameters, get the generic
2172 method definition and ask it whether we have variable arguments.
2174 2004-02-26 Miguel de Icaza <miguel@ximian.com>
2176 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
2177 routines to check if a type is an enumerable/enumerator allow
2178 classes that implement the IEnumerable or IEnumerator interfaces.
2180 * class.cs (Property, Operator): Implement IIteratorContainer, and
2181 implement SetYields.
2183 (Property.Define): Do the block swapping for get_methods in the
2184 context of iterators. We need to check if Properties also
2185 include indexers or not.
2187 (Operator): Assign the Block before invoking the
2188 OperatorMethod.Define, so we can trigger the Iterator code
2191 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
2192 Property and Operator classes are not created when we parse the
2193 declarator but until we have the block completed, so we use a
2194 singleton SimpleIteratorContainer.Simple to flag whether the
2195 SetYields has been invoked.
2197 We propagate this setting then to the Property or the Operator to
2198 allow the `yield' to function.
2200 2004-02-25 Marek Safar <marek.safar@seznam.cz>
2202 * codegen.cs: Implemented attribute support for modules.
2203 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
2204 Assembly/Module functionality.
2206 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
2207 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
2208 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
2210 2004-02-16 Marek Safar <marek.safar@seznam.cz>
2212 * interface.cs (FindMembers): The operation is performed on all base
2213 interfaces and not only on the first. It is required for future CLS Compliance patch.
2215 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
2217 * statement.cs, codegen.cs:
2218 This patch deals with patterns such as:
2220 public class List : IEnumerable {
2222 public MyEnumerator GetEnumerator () {
2223 return new MyEnumerator(this);
2226 IEnumerator IEnumerable.GetEnumerator () {
2230 public struct MyEnumerator : IEnumerator {
2235 Before, there were a few things we did wrong:
2236 1) we would emit callvirt on a struct, which is illegal
2237 2) we emited ldarg when we needed to emit ldarga
2238 3) we would mistakenly call the interface methods on an enumerator
2239 type that derived from IEnumerator and was in another assembly. For example:
2241 public class MyEnumerator : IEnumerator
2243 Would have the interface methods called, even if there were public impls of the
2244 method. In a struct, this lead to invalid IL code.
2246 2004-02-11 Marek Safar <marek.safar@seznam.cz>
2248 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
2251 * delegate.cs (Define): Fixed crash when delegate type is undefined.
2253 2004-02-11 Miguel de Icaza <miguel@ximian.com>
2255 * cs-parser.jay: Fix small regression: we were not testing V2
2256 compiler features correctly.
2258 * interface.cs: If the emit context is null, then create one
2260 2004-02-09 Marek Safar <marek.safar@seznam.cz>
2262 * decl.cs (GetSignatureForError): New virtual method to get full name
2265 * attribute.cs (IAttributeSupport): New interface for attribute setting.
2266 Now it is possible to rewrite ApplyAttributes method to be less if/else.
2268 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
2269 Duplicated members and code in these classes has been removed.
2270 Better encapsulation in these classes.
2272 2004-02-07 Miguel de Icaza <miguel@ximian.com>
2274 * assign.cs (Assign.DoResolve): When dealing with compound
2275 assignments, there is a new rule in ECMA C# 2.4 (might have been
2276 there before, but it is documented here) that states that in:
2280 If b is of type int, and the `op' is a shift-operator, then the
2281 above is evaluated as:
2285 * expression.cs (Binary.ResolveOperator): Instead of testing for
2286 int/uint/long/ulong, try to implicitly convert to any of those
2287 types and use that in pointer arithmetic.
2289 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
2290 method to print information for from the type, not from the
2291 null-method we were given.
2293 2004-02-01 Duncan Mak <duncan@ximian.com>
2295 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
2296 parsing for cmd, fixes bug #53694.
2298 2004-02-04 Marek Safar <marek.safar@seznam.cz>
2300 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
2301 in the member name duplication tests. Property and operator name duplication
2302 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
2304 2004-02-03 Marek Safar <marek.safar@seznam.cz>
2306 * interface.cs (PopulateMethod): Fixed crash when interface method
2307 returns not existing type (error test cs0246-3.cs).
2309 2004-02-02 Ravi Pratap M <ravi@ximian.com>
2311 * cs-parser.jay (interface_accessors): Re-write actions to also
2312 store attributes attached to get and set methods. Fix spelling
2315 (inteface_property_declaration): Modify accordingly.
2317 (InterfaceAccessorInfo): New helper class to store information to pass
2318 around between rules that use interface_accessors.
2320 * interface.cs (Emit): Apply attributes on the get and set
2321 accessors of properties and indexers too.
2323 * attribute.cs (ApplyAttributes): Modify accordingly to use the
2324 right MethodBuilder when applying attributes to the get and set accessors.
2326 2004-01-31 Miguel de Icaza <miguel@ximian.com>
2328 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
2330 2004-01-26 Miguel de Icaza <miguel@ximian.com>
2332 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
2334 2004-01-25 Miguel de Icaza <miguel@ximian.com>
2336 * cs-parser.jay: Remove YIELD token, instead use the new grammar
2337 changes that treat `yield' specially when present before `break'
2340 * cs-tokenizer.cs: yield is no longer a keyword.
2342 2004-01-23 Marek Safar <marek.safar@seznam.cz>
2344 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
2345 setting for default constructors.
2346 For default constructors are almost every time set wrong Modifier. The
2347 generated IL code has been alright. But inside mcs this values was
2348 wrong and this was reason why several of my CLS Compliance tests
2351 2004-02-27 Martin Baulig <martin@ximian.com>
2353 * generics.cs (ConstructedType.ResolveType): Make the nested type
2354 stuff actually work.
2356 2004-02-25 Martin Baulig <martin@ximian.com>
2358 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
2359 property; returns the type parameters just from the current type,
2360 ie. with the ones from outer classes.
2361 (DeclSpace.LookupGeneric): First search in the current class, then
2363 (DeclSpace.initialize_type_params): When hiding a type parameter
2364 from an outer class, put it into the `type_param_list' anyways.
2366 * expression.cs (MemberAccess.expr): Made this field protected.
2368 * class.cs (TypeContainer.Define): The `CurrentType' just contains
2369 the type parameters from the current class.
2371 * generic.cs (ConstructedType.ResolveType): Support nested generic
2372 types by taking the type parameters which we inherit from outer
2373 classes into account.
2374 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
2375 support for nested generic types.
2377 2004-02-23 Martin Baulig <martin@ximian.com>
2379 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
2380 field and check whether we're nested inside a generic type.
2381 (DeclSpace.ResolveType): If we're resolving to a generic type
2382 definition, create a ConstructedType and return its resolved type.
2383 (DeclSpace.initialize_type_params): New private method;
2384 initializes the `type_param_list' field from the type parameters
2385 from this and all enclosing classes.
2386 (DeclSpace.TypeParameters): Call initialize_type_params() unless
2387 we're already initialized.
2389 2004-02-23 Martin Baulig <martin@ximian.com>
2391 * class.cs (Method.Define): Create the generic method before
2393 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
2394 the TypeContainer one); we use this for generic methods.
2396 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
2397 parent's TypeBuilder.
2399 2004-02-18 Martin Baulig <martin@ximian.com>
2401 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
2402 to check for equality.
2404 2004-02-05 Martin Baulig <martin@ximian.com>
2406 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
2407 `ec.TypeContainer.CurrentType', use it instead of
2408 `ec.ContainerType' to check whether we're in the type's ctor.
2410 2004-01-29 Martin Baulig <martin@ximian.com>
2412 * expression.cs (Invocation.DoResolve): If we're a
2413 `ConstructedType', then we're actually a generic method, so
2414 rewrite the expr as a GenericMemberAccess.
2416 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
2417 here; manually parse it into a string.
2419 2004-01-28 Martin Baulig <martin@ximian.com>
2421 * typemanager.cs (TypeManager.IsEqual): New static method.
2422 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
2423 check for equality instead of using `=='.
2425 2004-01-26 Martin Baulig <martin@ximian.com>
2427 * decl.cs (DeclSpace.CurrentType): New public field.
2429 * expression.cs (This.ResolveBase): If we have an
2430 `ec.TypeContainer.CurrentType', use it instead of
2433 * class.cs (TypeContainer.DefineType): If we're a generic type,
2434 create the `CurrentType' (unresolved).
2435 (TypeContainer.GenericType): New private field.
2436 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
2437 it and store it in `GenericType' before creating the MemberCache.
2438 (TypeContainer.GetMembers): If we have a `GenericType', call
2439 TypeManager.FindMembers() on it.
2441 * interface.cs (Interface.GenericType): New private field.
2442 (Interface.DefineType): If we're a generic type, create the
2443 `CurrentType' (unresolved).
2444 (Interface.DefineMembers): If we have a `CurrentType', resolve it
2445 and store it in `GenericType' before creating the MemberCache.
2446 (Interface.GetMembers): If we have a `GenericType', call
2447 TypeManager.FindMembers() on it.
2449 2004-01-22 Martin Baulig <martin@ximian.com>
2451 * cs-parser.jay (namespace_or_type_name): Return an Expression,
2452 not a QualifiedIdentifier. This is what `type_name_expression'
2453 was previously doing.
2454 (type_name_expression): Removed; the code is now in
2455 `namespace_or_type_name'.
2456 (qualified_identifier): Removed, use `namespace_or_type_name'
2458 (QualifiedIdentifier): Removed this class.
2460 2004-01-22 Martin Baulig <martin@ximian.com>
2462 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
2463 not a string as alias name.
2465 2004-01-21 Miguel de Icaza <miguel@ximian.com>
2467 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
2468 #52730 bug, and instead compute correctly the need to use a
2469 temporary variable when requesting an address based on the
2470 static/instace modified of the field and the constructor.
2472 2004-01-21 Martin Baulig <martin@ximian.com>
2474 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
2475 class and namespace before looking up aliases. Fixes #52517.
2477 2004-01-21 Martin Baulig <martin@ximian.com>
2479 * flowanalysis.cs (UsageVector.Merge): Allow variables being
2480 assinged in a 'try'; fixes exception4.cs.
2482 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2483 * class.cs : Implemented parameter-less constructor for TypeContainer
2485 * decl.cs: Attributes are now stored here. New property OptAttributes
2487 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
2489 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
2491 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2493 * typemanager.cs (CSharpSignature): Now reports also inner class name.
2494 (CSharpSignature): New method for indexer and property signature.
2496 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2498 * pending.cs (IsVirtualFilter): Faster implementation.
2500 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2502 * typemanager.cs: Avoid inclusion of same assembly more than once.
2504 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2506 * cs-parser.jay: Fixed problem where the last assembly attribute
2507 has been applied also to following declaration (class, struct, etc.)
2509 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2511 * class.cs: Added error CS0538, CS0539 reporting.
2512 Fixed crash on Microsoft runtime when field type is void.
2514 * cs-parser.jay: Added error CS0537 reporting.
2516 * pending.cs: Added error CS0535 reporting.
2517 Improved error report for errors CS0536, CS0534.
2519 2004-01-20 Miguel de Icaza <miguel@ximian.com>
2521 Merge a few bits from the Anonymous Method MCS tree.
2523 * statement.cs (ToplevelBlock): New class for toplevel methods,
2524 will hold anonymous methods, lifted variables.
2526 * cs-parser.jay: Create toplevel blocks for delegates and for
2527 regular blocks of code.
2529 2004-01-20 Martin Baulig <martin@ximian.com>
2531 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
2532 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
2533 and `NeedExplicitReturn'; added `IsLastStatement'.
2534 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
2535 have a `ReturnLabel' or we're not unreachable.
2537 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
2538 child's reachability; don't just override ours with it. Fixes
2539 #58058 (lluis's example).
2540 (FlowBranching): Added public InTryOrCatch(), InCatch(),
2541 InFinally(), InLoop(), InSwitch() and
2542 BreakCrossesTryCatchBoundary() methods.
2544 * statement.cs (Return): Do all error checking in Resolve().
2545 Unless we are the last statement in a top-level block, always
2546 create a return label and jump to it.
2547 (Break, Continue): Do all error checking in Resolve(); also make
2548 sure we aren't leaving a `finally'.
2549 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
2550 statement in a top-level block.
2551 (Block.Flags): Added `IsDestructor'.
2552 (Block.IsDestructor): New public property.
2554 2004-01-20 Martin Baulig <martin@ximian.com>
2556 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
2558 2004-01-20 Martin Baulig <martin@ximian.com>
2560 * statement.cs (Statement.ResolveUnreachable): New public method.
2561 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
2562 (Block.Resolve): Resolve unreachable statements.
2564 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
2566 * expression.cs: We need to fix the case where we do
2567 not have a temp variable here.
2569 * assign.cs: Only expression compound assignments need
2570 temporary variables.
2572 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
2574 * flowanalysis.cs: Reduce memory allocation in a few ways:
2575 - A block with no variables should not allocate a bit
2577 - A method with no out parameters does not need any tracking
2578 for assignment of the parameters, so we need not allocate
2581 public readonly Type[] VariableTypes;
2582 public readonly string[] VariableNames;
2583 Are redundant. The data is already stored in the variable
2584 map, so we need not allocate another array for it.
2585 - We need to add alot of checks for if (params | locals) == null
2586 due to the first two changes.
2588 2004-01-18 Miguel de Icaza <miguel@ximian.com>
2590 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
2591 implement IMemoryLocation, we store a copy on a local variable and
2592 take the address of it. Patch from Benjamin Jemlich
2594 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
2595 to use a special "type_name_expression" rule which reduces the
2596 number of "QualifiedIdentifier" classes created, and instead
2597 directly creates MemberAccess expressions.
2599 2004-01-17 Miguel de Icaza <miguel@ximian.com>
2601 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
2602 that fixes #52853. Null literal assignment to ValueType
2604 * class.cs (MethodData.Emit): Instead of checking the name of the
2605 method to determine if its a destructor, create a new derived
2606 class from Method called Destructor, and test for that.
2608 * cs-parser.jay: Create a Destructor object instead of a Method.
2610 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
2614 2004-01-16 Miguel de Icaza <miguel@ximian.com>
2616 * expression.cs (Binary.ResolveOperator): Perform an implicit
2617 conversion from MethodGroups to their delegate types on the
2620 * delegate.cs: Introduce a new class DelegateCreation that is the
2621 base class for `NewDelegate' and `ImplicitDelegateCreation',
2622 factor some code in here.
2624 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
2625 conversion from MethodGroups to compatible delegate types.
2627 * ecore.cs (Expression.Resolve): Do not flag error 654
2628 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
2629 we allow conversions from MethodGroups to delegate types now.
2631 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
2632 assignments in v2 either.
2634 2004-01-10 Miguel de Icaza <miguel@ximian.com>
2636 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
2637 static read-only fields in ctors.
2639 Applied patch from Benjamin Jemlich
2641 * expression.cs (UnaryMutator): Avoid leaking local variables.
2643 2004-01-09 Miguel de Icaza <miguel@ximian.com>
2645 * cs-tokenizer.cs (IsCastToken): Allow the various native types
2646 here to return true, as they can be used like this:
2650 Fixed 49836 and all the other dups
2652 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
2654 * driver.cs: Implement /win32res and /win32icon.
2656 2004-01-08 Miguel de Icaza <miguel@ximian.com>
2658 * cs-parser.jay: Add a rule to improve error handling for the
2659 common mistake of placing modifiers after the type.
2661 2004-01-07 Miguel de Icaza <miguel@ximian.com>
2663 * cs-parser.jay (interface_event_declaration): Catch
2664 initialization of events on interfaces, and report cs0068
2666 * cs-parser.jay (interface_event_declaration): Catch
2667 initialization of events.
2669 * ecore.cs: Better report missing constructors.
2671 * expression.cs (Binary.ResolveOperator): My previous bug fix had
2672 the error reporting done in the wrong place. Fix.
2674 * expression.cs (Binary.ResolveOperator): Catch the
2675 operator + (E x, E y) error earlier, and later allow for implicit
2676 conversions in operator +/- (E e, U x) from U to the underlying
2679 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
2680 52596, if the container class is abstract, the default constructor
2681 is protected otherwise its public (before, we were always public).
2683 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
2686 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
2687 Jemlich that fixes bug #52597, MCS was generating invalid code for
2688 idisposable structs. Thanks to Ben for following up with this
2691 2004-01-06 Miguel de Icaza <miguel@ximian.com>
2693 * driver.cs: Allow assemblies without code to be generated, fixes
2696 2004-01-07 Nick Drochak <ndrochak@gol.com>
2698 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
2700 2004-01-05 Miguel de Icaza <miguel@ximian.com>
2702 * cs-parser.jay: Add rules to improve error reporting if fields or
2703 methods are declared at the namespace level (error 116)
2705 * Add rules to catch event add/remove
2707 2004-01-04 David Sheldon <dave-mono@earth.li>
2709 * expression.cs: Added matching ")" to error message for
2712 2004-01-03 Todd Berman <tberman@gentoo.org>
2714 * ecore.cs, attribute.cs:
2715 Applying fix from #52429.
2717 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2719 * ecore.cs, expression.cs, statement.cs:
2720 Total rewrite of how we handle branching. We
2721 now handle complex boolean expressions with fewer
2722 jumps. As well if (x == 0) no longer emits a ceq.
2724 if (x is Foo) is much faster now, because we generate
2727 Overall, we get a pretty big improvement on our benchmark
2728 tests. The code we generate is smaller and more readable.
2730 I did a full two-stage bootstrap. The patch was reviewed
2731 by Martin and Miguel.
2733 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2735 * cs-parser.jay: Make primary_expression not take a QI.
2736 we dont need this because the member_access rule covers
2737 us here. So we replace the rule with just IDENTIFIER.
2739 This has two good effects. First, we remove a s/r conflict.
2740 Second, we allocate many fewer QualifiedIdentifier objects.
2742 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2744 * attribute.cs: Handle MarshalAs attributes as pseudo, and
2745 set the correct information via SRE. This prevents
2746 hanging on the MS runtime. Fixes #29374.
2748 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2750 * convert.cs: correctly handle conversions to value types
2751 from Enum and ValueType as unboxing conversions.
2753 Fixes bug #52569. Patch by Benjamin Jemlich.
2755 2004-01-02 Ravi Pratap <ravi@ximian.com>
2757 * expression.cs (BetterConversion): Prefer int -> uint
2758 over int -> ulong (csc's behaviour). This fixed bug #52046.
2760 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
2762 * decl.cs (MemberCache.FindMembers): now returns a
2765 * typemanager.cs: In general, go with with ^^.
2766 (CopyNewMethods): take an IList.
2767 (RealMemberLookup): Only allocate an arraylist
2768 if we copy from two sets of methods.
2770 This change basically does two things:
2771 1) Fewer array lists allocated due to CopyNewMethods.
2772 2) the explicit cast in MemberList costed ALOT.
2774 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
2776 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
2777 a hashtable to avoid needless string allocations when an identifier is
2778 used more than once (the common case).
2780 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2782 * pending.cs: MS's TypeBuilder.GetInterfaces ()
2783 is broken, it will not return anything. So, we
2784 have to use the information we have in mcs to
2787 * typemanager.cs: Add a cache for GetInterfaces,
2788 since this will now be used more often (due to ^^)
2790 (GetExplicitInterfaces) New method that gets the
2791 declared, not effective, interfaces on a type
2792 builder (eg, if you have interface IFoo, interface
2793 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
2796 This patch makes MCS able to bootstrap itself on
2799 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2801 * expression.cs: Remove the Nop's that Miguel put
2804 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2806 * report.cs, codegen.cs: Give the real stack trace to
2807 the error when an exception is thrown.
2809 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2811 * decl.cs: only allocate hashtables for ifaces if
2814 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2816 * expression.cs: fix the error from cs0121-2.cs
2817 (a parent interface has two child interfaces that
2818 have a function with the same name and 0 params
2819 and the function is called through the parent).
2821 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
2823 * class.cs, rootcontext.cs, typmanager.cs: do not
2826 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
2828 * codegen.cs: remove stack for the ec flow branching.
2829 It is already a linked list, so no need.
2831 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
2833 * Makefile: Allow custom profiler here.
2835 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2837 * typemanager.cs (LookupType):
2838 - Use a static char [], because split takes
2839 a param array for args, so it was allocating
2841 - Do not store true in a hashtable, it boxes.
2843 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2845 * flowanalysis.cs: bytify common enums.
2847 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2849 * modifiers.cs: Add a new set of flags for the
2850 flags allowed on explicit interface impls.
2851 * cs-parser.jay: catch the use of modifiers in
2852 interfaces correctly.
2853 * class.cs: catch private void IFoo.Blah ().
2855 All related to bug #50572.
2857 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2859 * decl.cs: Rewrite the consistant accessability checking.
2860 Accessability is not linear, it must be implemented in
2861 a tableish way. Fixes #49704.
2863 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2865 * expression.cs: Handle negation in a checked context.
2866 We must use subtraction from zero. Fixes #38674.
2868 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2870 * class.cs: Ignore static void main in DLLs.
2871 * rootcontext.cs: Handle the target type here,
2872 since we are have to access it from class.cs
2873 * driver.cs: account for the above.
2875 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2877 * report.cs: Give line numbers and files if available.
2879 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
2881 * driver.cs: Implement /addmodule.
2883 * typemanager.cs: Change 'modules' field so it now contains Modules not
2886 2003-12-20 Martin Baulig <martin@ximian.com>
2888 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
2889 (FieldBase.IsAssigned): Removed this field.
2890 (FieldBase.SetAssigned): New public method.
2891 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
2893 2003-12-20 Martin Baulig <martin@ximian.com>
2895 * expression.cs (LocalVariableReference.DoResolve): Don't set
2896 `vi.Used' if we're called from DoResolveLValue().
2898 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
2899 returns the usage vector it just merged into the current one -
2900 pass this one to UsageWarning().
2901 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
2902 of the `EmitContext', don't call this recursively on our children.
2904 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
2906 * driver.cs: Implement /target:module.
2908 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
2910 * support.cs (CharArrayHashtable): New helper class.
2912 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
2913 char arrays, not strings, so we can avoid creating a string in
2914 consume_identifier if the identifier is a keyword.
2916 2003-12-16 Martin Baulig <martin@ximian.com>
2918 * statement.cs (LocalInfo.Assigned): Removed this property.
2919 (LocalInfo.Flags): Removed `Assigned'.
2920 (LocalInfo.IsAssigned): New public method; takes the EmitContext
2921 and uses flow analysis.
2922 (Block.UsageWarning): Made this method private.
2923 (Block.Resolve): Call UsageWarning() if appropriate.
2925 * expression.cs (LocalVariableReference.DoResolve): Always set
2926 LocalInfo.Used here.
2928 2003-12-13 Martin Baulig <martin@ximian.com>
2930 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
2931 any value here; we're now using flow analysis to figure out
2932 whether a statement/block returns a value.
2934 2003-12-13 Martin Baulig <martin@ximian.com>
2936 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
2938 (FlowBranching.MergeFinally): Don't call
2939 `branching.CheckOutParameters()' here, this is called in
2941 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
2942 when adding the `finally' vector.
2944 2003-12-13 Martin Baulig <martin@ximian.com>
2947 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
2948 actually work and also fix #48962.
2950 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
2952 * decl.cs: Do not check System.Object for nested types,
2953 since we know it does not have any. Big bang for buck:
2958 corlib: 17.99 seconds
2962 corlib: 17.39 seconds
2964 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
2966 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
2967 time we are returning 0 members, so we save alot here.
2969 2003-12-11 Martin Baulig <martin@ximian.com>
2971 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
2972 `MergeChild()', also just take the `FlowBranching' as argument;
2973 call Merge() on it and return the result.
2974 (FlowBranching.Merge): We don't need to do anything if we just
2977 2003-12-11 Martin Baulig <martin@ximian.com>
2979 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
2980 them in an `ArrayList' to reduce memory usage. Thanks to Ben
2981 Maurer for this idea.
2983 2003-12-11 Martin Baulig <martin@ximian.com>
2985 * flowanalysis.cs (MergeResult): This class is now gone; we now
2986 use the `UsageVector' for this. The reason for this is that if a
2987 branching just has one sibling, we don't need to "merge" them at
2988 all - that's the next step to do.
2989 (FlowBranching.Merge): We now return a `UsageVector' instead of a
2992 2003-12-11 Martin Baulig <martin@ximian.com>
2994 Reworked flow analyis and made it more precise and bug-free. The
2995 most important change is that we're now using a special `Reachability'
2996 class instead of having "magic" meanings of `FlowReturns'. I'll
2997 do some more cleanups and optimizations and also add some more
2998 documentation this week.
3000 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
3001 largely reworked this class.
3002 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
3003 the new `Reachability' class instead of having "magic" values here.
3004 (FlowBranching): We're now using an instance of `Reachability'
3005 instead of having separate `Returns', `Breaks' etc. fields.
3007 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
3008 based on flow analysis; ignore the return value of block.Emit ().
3010 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
3012 * driver.cs typemanager.cs: Find the mono extensions to corlib even
3013 if they are private.
3015 2003-12-09 Martin Baulig <martin@ximian.com>
3017 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
3018 call them directly on the UsageVector.
3020 2003-12-09 Martin Baulig <martin@ximian.com>
3022 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
3023 Changed return type from `FlowReturns' to `Reachability'.
3025 2003-12-09 Martin Baulig <martin@ximian.com>
3027 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
3028 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
3029 `Reachable' fields with a single `Reachability' one.
3031 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3033 * class.cs (FindMembers): Remove foreach's.
3046 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3051 This patch does a few things:
3052 1. EmptyStatement is now a singleton, so it is never reallocated.
3053 2. All blah is EmptyStatement constructs have been changed to
3054 blah == EmptyStatement.Value, which is much faster and valid
3055 now that EmptyStatement is a singleton.
3056 3. When resolving a block, rather than allocating a new array for
3057 the non-empty statements, empty statements are replaced with
3058 EmptyStatement.Value
3059 4. Some recursive functions have been made non-recursive.
3060 Mainly the performance impact is from (3), however (1) and (2) are needed for
3061 this to work. (4) does not make a big difference in normal situations, however
3062 it makes the profile look saner.
3067 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3068 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3069 Total memory allocated: 56397 KB
3072 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
3073 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
3074 Total memory allocated: 55666 KB
3076 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3078 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
3079 than the hashtable in a hashtable version
3081 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
3082 we always end up concating a string. This results in a huge perf
3083 loss, because many strings have to be tracked by the GC. In this
3084 patch, we first use a hashtable that works with two keys, so that
3085 the strings do not need to be concat'ed.
3096 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3098 * Makefile: Add a new target `do-time' that does a quick and simple
3099 profile, leaving easy to parse output.
3101 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
3103 * codegen.cs (Init): Create the dynamic assembly with
3104 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
3106 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
3108 * support.cs: Make the PtrHashtable use only one
3109 instance of its comparer.
3111 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
3113 * typemanager.cs: Fix lookup of GetNamespaces.
3115 2003-11-29 Miguel de Icaza <miguel@ximian.com>
3117 * expression.cs: Removed redundant line.
3119 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
3120 ArrayLists, use for loops with bounds.
3122 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
3125 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
3126 arraylists, use for loop with bounds.
3128 The above three changes give us a 0.071 second performance
3129 improvement out of 3.294 seconds down to 3.223. On my machine
3130 the above changes reduced the memory usage by 1,387 KB during
3133 * cs-parser.jay (QualifiedIdentifier): New class used to represent
3134 QualifiedIdentifiers. Before we created a new string through
3135 concatenation, and mostly later on, the result would be
3136 manipulated by DecomposeQI through string manipulation.
3138 This reduced the compiler memory usage for bootstrapping from
3139 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
3140 compile times in 0.05 seconds.
3142 2003-11-28 Dick Porter <dick@ximian.com>
3144 * support.cs: Do string compares with the Invariant culture.
3152 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
3153 the comparison is done with the Invariant culture.
3155 2003-11-27 Miguel de Icaza <miguel@ximian.com>
3157 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
3158 GetEnumerator method.
3160 (ProbeCollectionType): Iterate starting at the most specific type
3161 upwards looking for a GetEnumerator
3163 * expression.cs: Shift count can be up to 31 for int/uint and 63
3166 2003-11-26 Miguel de Icaza <miguel@ximian.com>
3168 * statement.cs (Block.LookupLabel): Also look for the label on the
3169 children blocks. Use a hash table to keep track of visited
3172 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
3173 we actually did transform the other operand, otherwise fall back
3174 to the common codepath that casts to long.
3176 * cs-tokenizer.cs: Use the same code pattern as the int case.
3177 Maybe I should do the parsing myself, and avoid depending on the
3178 Parse routines to get this done.
3180 2003-11-25 Miguel de Icaza <miguel@ximian.com>
3182 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
3183 which fixes bug 51347. This time test it.
3185 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
3186 attributes for example can not tell the difference between these.
3187 The difference was only a syntax feature of the language.
3189 * attribute.cs: Apply attributes to delegates.
3191 * delegate.cs: Call the apply attributes method.
3193 2003-11-24 Miguel de Icaza <miguel@ximian.com>
3195 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
3196 comparing 0 vs Byte.MinValue, not the value
3198 (ImplicitConversionRequired): When reporting a conversion error,
3199 use error 31 to print out the constant error instead of the
3202 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
3203 which fixes bug 51347.
3205 2003-11-22 Miguel de Icaza <miguel@ximian.com>
3207 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
3208 which fixes the -warnaserror command line option.
3210 2003-11-21 Miguel de Icaza <miguel@ximian.com>
3212 * cfold.cs (DoNumericPromotions): During constant folding of
3213 additions on UIntConstant, special case intconstants with
3214 IntConstants like we do on the expression binary operator.
3216 2003-11-12 Miguel de Icaza <miguel@ximian.com>
3218 * convert.cs (ImplicitReferenceConversion): We were missing a case
3219 (System.Enum are not value types or class types, so we need to
3220 classify them separatedly).
3222 * driver.cs: We do not support error 2007.
3224 2003-11-12 Jackson Harper <jackson@ximian.com>
3226 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
3227 system directory. Also use the full file name so users can
3228 libraries names mscorlib-o-tron.dll in a non system dir.
3230 2004-01-04 David Sheldon <dave-mono@earth.li>
3232 * expression.cs: Added matching ")" to error message for CS0077.
3234 2003-12-19 Martin Baulig <martin@ximian.com>
3236 * typemanager.cs (TypeManager.IsEqualGenericType): New public
3237 static method; see documentation in the method.
3238 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
3240 * convert.cs (Convert.ImplicitReferenceConversion,
3241 Convert.ImplicitReferenceConversionExists): Add support for
3242 generic type declarations; see gen-36.cs.
3244 2003-12-19 Martin Baulig <martin@ximian.com>
3246 * pending.cs (Pending.InterfaceMethod): Use
3247 `Type.IsAssignableFrom()' instead of `=='.
3249 2003-12-18 Martin Baulig <martin@ximian.com>
3251 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
3254 * convert.cs (Convert.ImplicitStandardConversionExists): Use
3255 `expr_type.Equals (target_type)' instead of `=='.
3257 2003-12-08 Martin Baulig <martin@ximian.com>
3259 * generics.cs (Constraints.Types): Removed.
3260 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
3262 (Constraints.ResolveTypes): New public method; resolves the
3263 TypeExpr's to Type's.
3264 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
3265 longer takes the constraints.
3266 (TypeParameter.DefineMethod): Likewise.
3267 (TypeParameter.DefineType): New public method. Calls
3268 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
3271 2003-12-08 Martin Baulig <martin@ximian.com>
3273 * convert.cs (Convert.ImplicitConversionStandard): Use
3274 `expr_type.Equals (target_type)' instead of `=='.
3276 2003-12-08 Martin Baulig <martin@ximian.com>
3278 * typemanager.cs (TypeManager.GetReferenceType): Call
3279 `Type.MakeByRefType ()'.
3281 2003-12-08 Martin Baulig <martin@ximian.com>
3283 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
3284 just has some special meaning in some situations. For instance,
3285 it is allowed to use `where' as the name of a variable etc.
3287 2003-12-04 Martin Baulig <martin@ximian.com>
3289 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
3290 `Type.MakeArrayType()' for array types.
3292 2003-11-18 Miguel de Icaza <miguel@ximian.com>
3294 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
3297 (SizeOf.DoResolve): assign the `type_queried' field. This gets
3300 2003-11-16 Martin Baulig <martin@ximian.com>
3302 * codegen.cs (EmitContext.IsGeneric): Removed.
3304 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
3305 ResolveGeneric() on the DeclSpace.
3307 2003-11-16 Martin Baulig <martin@ximian.com>
3309 * generic.cs (TypeArguments.Resolve):
3310 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
3311 `ResolveType()' on it to get the Type.
3313 2003-11-15 Martin Baulig <martin@ximian.com>
3315 * generic.cs (ConstructedType.GetInterfaces): Override this.
3317 2003-11-14 Martin Baulig <martin@ximian.com>
3319 * interface.cs (Interface.DefineType): Define all type parameters
3320 before adding the interfaces we inherit.
3322 2003-11-11 Martin Baulig <martin@ximian.com>
3324 * generic.cs (ConstructedType.ResolveType): Always call
3325 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
3327 2003-11-10 Martin Baulig <martin@ximian.com>
3329 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
3330 (TypeManager.InitCoreTypes): Initialize them here, but instead of
3331 calling `ResolveType()' on them, directly assign their `Type'.
3333 2003-11-08 Martin Baulig <martin@ximian.com>
3335 * generic.cs (ConstructedType): Override `IsClass' etc.
3337 2003-11-08 Martin Baulig <martin@ximian.com>
3339 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
3340 return value and the `out parent' parameter.
3341 (TypeContainer.DefineType): Moved the CS0644 check into
3342 GetClassBases(). Don't pass the interface types to the
3343 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
3344 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
3346 * ecore.cs (TypeExpr.IsAttribute): New property.
3347 (TypeExpr.GetInterfaces): New method.
3349 * interface.cs (Interface.GetInterfaceTypeByName): Return a
3350 TypeExpr instead of a Type.
3351 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
3352 (Interface.DefineType): Don't pass the interface types to the
3353 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
3354 them later and then call `TypeBulider.AddInterfaceImplementation()'.
3356 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
3357 instead of a `Type[]'.
3358 (TypeManager.RegisterBuilder): Likewise.
3359 (TypeManager.AddUserInterface): Likewise.
3360 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
3361 `Type[]' and also return a `TypeExpr[]'.
3362 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
3364 2003-11-08 Martin Baulig <martin@ximian.com>
3366 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
3369 2003-11-08 Martin Baulig <martin@ximian.com>
3371 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
3372 TypeManager.ResolveExpressionTypes().
3374 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
3375 instead of an Expression.
3376 (TypeExpr): This is now an abstract base class for `TypeExpression'.
3377 (TypeExpression): New public class; formerly known as `TypeExpr'.
3379 * expression.cs (ComposedCast): Derive from TypeExpr.
3381 * typemanager.cs (TypeManager.system_*_expr): These are now
3382 TypExpr's instead of Expression's.
3383 (TypeManager.ResolveExpressionTypes): New public static function;
3384 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
3387 2003-11-06 Miguel de Icaza <miguel@ximian.com>
3389 * expression.cs (New.DoResolve): Do not dereference value that
3390 might be a null return.
3392 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
3393 sure that the constant value has the right type. Fixes an
3394 unreported bug, similar to 50425.
3396 * const.cs (Const.LookupConstantValue): Call
3397 ImplicitStandardConversionExists before doing a conversion to
3398 avoid havng the TypeManager.ChangeType do conversions.
3400 Reduced the number of casts used
3402 (Const.ChangeType): New routine to enable reuse of the constant
3403 type changing code from statement.
3405 * typemanager.cs (ChangeType): Move common initialization to
3406 static global variables.
3410 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
3411 every value type to go through, even if it was void. Fix that.
3413 * cs-tokenizer.cs: Use is_identifier_start_character on the start
3414 character of the define, and the is_identifier_part_character for
3415 the rest of the string.
3417 2003-11-05 Miguel de Icaza <miguel@ximian.com>
3419 * expression.cs (UnaryMutator.EmitCode): When I updated
3420 LocalVariableReference.DoResolve, I overdid it, and dropped an
3421 optimization done on local variable references.
3423 2003-11-04 Miguel de Icaza <miguel@ximian.com>
3425 * ecore.cs: Convert the return from Ldlen into an int.
3427 2003-10-20 Miguel de Icaza <miguel@ximian.com>
3429 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
3430 the accessibility, this is a special case for toplevel non-public
3431 classes (internal for instance).
3433 2003-10-20 Nick Drochak <ndrochak@gol.com>
3435 * ecore.cs: Fix typo and build. Needed another right paren.
3437 2003-10-19 Miguel de Icaza <miguel@ximian.com>
3439 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
3440 `internal' case regular and protected, but not allowing protected
3441 to be evaluated later. Bug 49840
3443 2003-10-15 Miguel de Icaza <miguel@ximian.com>
3445 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
3446 to kb.Nlast, and not the kb.nFirst to isolate the switch
3449 Extract the underlying type, so enumerations of long/ulong are
3450 treated like long/ulong.
3452 2003-10-14 Miguel de Icaza <miguel@ximian.com>
3454 * expression.cs (New): Overload the meaning of RequestedType to
3455 track the possible creation of the NewDelegate type, since
3456 DoResolve is invoked more than once for new constructors on field
3459 See bugs: #48800 and #37014
3461 * cs-parser.jay (declare_local_constants): Take an arraylist
3462 instead of a single constant.
3464 (local_constant_declaration): It should take a
3465 constant_declarators, not a constant_declarator. Fixes 49487
3467 * convert.cs: Fix error report.
3469 2003-10-13 Jackson Harper <jackson@ximian.com>
3471 * typemanager.cs (TypeToCoreType): Add float and double this fixes
3474 2003-11-03 Martin Baulig <martin@ximian.com>
3476 * expression.cs (ArrayAccess.GetStoreOpcode): Added
3477 `out bool has_type_arg'; if set, we need to pass the type to
3479 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
3480 Stelem_Any/Ldelem_Any for generic parameters.
3482 2003-11-02 Martin Baulig <martin@ximian.com>
3484 * expression.cs (Invocation.EmitCall): Use
3485 `TypeManager.IsValueType()' to check whether it's a value type.
3486 Don't set `struct_call' when calling a method on a type parameter.
3488 2003-11-02 Martin Baulig <martin@ximian.com>
3490 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
3491 and removed the TypeBuilder argument.
3493 * typemanager.cs (TypeManager.IsValueType): Return
3494 `t.IsGenericParameter || t.IsValueType'.
3496 2003-10-25 Martin Baulig <martin@ximian.com>
3498 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
3499 call ConstructedType.Resolve() on it.
3501 * generic.cs (ConstructedType.Resolve): Set `type' on success.
3503 2003-10-25 Martin Baulig <martin@ximian.com>
3505 * class.cs (TypeContainer.GetClassBases): Changed
3506 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
3507 CS8214 reporting here.
3508 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
3509 instead of a `Type' for our parent. In case of a recursive
3510 declaration (see tests/gen-23.cs for an example), our parent is a
3511 ConstructedType and it doesn't have its type set. So, first
3512 create our own TypeBuilder, then call constructed.Resolve() to get
3513 the parent's type and finally TypeBuilder.SetParent() it.
3515 * ecore.cs (TypeExpr.Name): New public virtual property.
3518 (ConstructedType): We're now a TypeExpr and not just an Expression.
3519 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
3520 arguments here; this is done later.
3521 (ConstructedType.Resolve): New public method to resolve the type
3522 arguments and bind them.
3524 2003-10-21 Martin Baulig <martin@ximian.com>
3526 * convert.cs: Use `TypeManager.IsValueType' instead of
3527 'type.IsValueType' everywhere.
3529 * typemanager.cs (TypeManager.IsValueType): Return true for type
3530 parameters. The reason for this is that we need to box a type
3531 parameter when converting it to a reference type.
3533 * cs-parser.jay: Added support for default value expressions.
3535 * generics.cs (DefaultValueExpression): New public class.
3537 2003-10-17 Martin Baulig <martin@ximian.com>
3539 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
3540 TypeContainer so we can also use this for Interfaces.
3541 (TypeParameter.Resolve): Likewise.
3543 * interface.cs (Interface.DefineType): Added support for generic
3546 * cs-parser.jay: Added support for generic structs and interfaces.
3548 2003-10-17 Martin Baulig <martin@ximian.com>
3550 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
3551 call generic methods :-)
3553 2003-10-16 Martin Baulig <martin@ximian.com>
3555 * cs-parser.jay (namespace_or_type_name): Only create a
3556 GenericMemberAccess if we actually have type arguments.
3558 2003-10-13 Martin Baulig <martin@ximian.com>
3560 * class.cs (Method.Define): If we're a generic method, call
3561 TypeBuilder.DefineGenericMethod () before resolving
3563 (MethodData): Added .ctor which takes an additional MethodBuilder
3564 argument; this is used for generic methods.
3565 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
3566 we already have a MethodBuilder.
3568 2003-10-10 Martin Baulig <martin@ximian.com>
3570 * class.cs (Method): Added .ctor which takes a `GenericMethod'
3571 instead of a `DeclSpace'. This is used for generic methods.
3573 * cs-parser.jay (method_header): Added support for generic
3574 methods; create a `GenericMethod' instance and pass it to the
3575 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
3576 parameters and locals.
3578 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
3579 since we already have the location. Check whether we're a generic
3580 type declaration or a generic method and create the correct type
3583 * generic.cs (TypeParameter.DefineMethod): New public method.
3584 (GenericMethod): New public class; derives from DeclSpace and is
3585 used for generic methods.
3587 2003-10-09 Martin Baulig <martin@ximian.com>
3589 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
3591 (MethodCore.DoDefineParameters): Removed the TypeContainer
3592 argument; use the DeclSpace which was passed to the .ctor instead.
3593 (MethodCore.CheckParameter): Take a DeclSpace instead of a
3594 TypeContainer; we only need a DeclSpace here.
3596 2003-10-09 Martin Baulig <martin@ximian.com>
3598 * class.cs (MethodData): Added additional `DeclSpace ds' argument
3600 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
3601 EmitContext's .ctor.
3603 2003-10-09 Martin Baulig <martin@ximian.com>
3605 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
3606 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
3607 AsAccessible(), moved them as well.
3609 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
3611 2003-10-07 Miguel de Icaza <miguel@ximian.com>
3613 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
3614 generation for >=, as spotted by Paolo, bug 48679.
3615 Patch from David Waite.
3617 * cs-tokenizer.cs: Add handling for #pragma.
3619 * cs-parser.jay: Allow for both yield and yield return in the
3620 syntax. The anti-cobolization of C# fight will go on!
3622 * class.cs (TypeBuilder.DefineType): Catch error condition here
3623 (Parent.DefineType erroring out and returning null).
3625 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3626 coping with enumerations variables, we were mistakenly processing
3627 them as a regular value type instead of built-in types. Fixes the
3630 * typemanager.cs (IsBuiltinOrEnum): New method.
3632 2003-09-30 Miguel de Icaza <miguel@ximian.com>
3634 * cs-parser.jay: Upgrade: yield now needs the return clause.
3636 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
3638 * cs-parser.jay : Renamed yyName to yyNames related to jay.
3640 2003-09-29 Martin Baulig <martin@ximian.com>
3642 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
3643 inflated generic methods.
3645 * generics.cs (ConstructedType): Distinguish between open and
3646 closed constructed types; correctly resolve the arguments.
3648 2003-09-22 Martin Baulig <martin@ximian.com>
3650 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
3651 all type arguments meet their constraints.
3653 2003-09-19 Martin Baulig <martin@ximian.com>
3655 * decl.cs (MemberCache.SetupCacheForInterface): Take a
3656 `MemberCache parent' argument. Normally, an interface doesn't
3657 have a parent type except System.Object, but we use this in gmcs
3658 for generic type parameters.
3660 2003-09-18 Martin Baulig <martin@ximian.com>
3662 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
3663 on `type.IsInterface'; don't check whether the type has a parent
3664 to determine whether it's an interface.
3666 2003-09-17 Martin Baulig <martin@ximian.com>
3668 * generic.cs (ConstructedType.ToString): Always use `name' as the
3671 2003-09-15 Martin Baulig <martin@ximian.com>
3673 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
3675 * generic.cs (Constraints.Resolve): New public method; this is
3676 called to resolve the constraint types and to check whether all
3677 the constraints are correct.
3678 (Constraints.Types): New public property.
3679 (TypeParameter.Resolve): New public method; resolves all the
3682 * class.cs (TypeContainer.DefineType): Call
3683 TypeParameter.Resolve() before actually defining the type.
3685 2003-09-15 Martin Baulig <martin@ximian.com>
3687 * class.cs (TypeContainer.DefineType): Added an error flag to
3688 avoid reporting duplicate CS0146's ("class definition is
3691 * driver.cs (Driver.MainDriver): Abort if
3692 RootContext.ResolveTree() reported any errors.
3694 2003-09-07 Martin Baulig <martin@ximian.com>
3696 * report.cs (Error, Warning): Added overloaded versions which take
3697 a `params object[] args' and call String.Format().
3699 2003-09-07 Martin Baulig <martin@ximian.com>
3701 * decl.cs (DeclSpace..ctor): Don't call
3702 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
3703 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
3704 (DeclSpace.RecordDecl): New method.
3706 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
3708 2003-09-02 Ravi Pratap <ravi@ximian.com>
3710 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
3711 value attributes to be applied to ParameterBuilders.
3713 * class.cs (MethodCore.LabelParameters): Make static and more
3714 generic so that it can be used from other places - like interface
3715 methods, for instance.
3717 * interface.cs (Interface.Emit): Call LabelParameters before
3718 emitting attributes on the InterfaceMethod.
3720 2003-09-07 Martin Baulig <martin@ximian.com>
3722 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
3723 if the number of type parameters doesn't match.
3725 2003-09-04 Martin Baulig <martin@ximian.com>
3727 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
3728 for arrays of generic type params (ie. `!0[]').
3730 2003-09-04 Martin Baulig <martin@ximian.com>
3732 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
3735 2003-09-04 Martin Baulig <martin@ximian.com>
3737 * decl.cs (DeclSpace.LookupGeneric): New method.
3738 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
3741 * generic.cs (TypeParameterExpr): Take a TypeParameter as
3742 argument, not just a string.
3743 (TypeParameter.Define): New public method; this is called to
3744 actually define the generic parameter; after this, you can use the
3745 new `Type' property to get the type.
3747 2003-09-04 Martin Baulig <martin@ximian.com>
3749 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
3750 is now an ArrayList; initialize the result of the `TypeParameters'
3752 (DeclSpace.GetGenericData): Removed.
3753 (DeclSpace.LookupGeneric): Temporarily removed; we need to
3754 implement this in a different way.
3755 (DeclSpace.GetTypeParameters): Removed; there's now a
3756 `TypeParameters' property.
3757 (DeclSpace.TypeParameters): New public property.
3759 * generic.cs (Constraints): Make this class public.
3760 (TypeParameter): New public class.
3762 2003-09-04 Martin Baulig <martin@ximian.com>
3764 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
3767 * class.cs (TypeContainer.DefineType): Call
3768 TypeBuilder.DefineGenericParameter () on all generic parameters if
3769 this is a generic type.
3771 2003-08-28 Martin Baulig <martin@ximian.com>
3773 * sample-stack.il: Compile this with ilasm: "ilasm /dll
3776 * sample-hello.cs: Compile this with gmcs: "gmcs
3777 /r:sample-stack.dll sample-hello.cs".
3779 2003-08-28 Martin Baulig <martin@ximian.com>
3781 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
3782 the parameters to the generic type.
3784 2003-08-28 Martin Baulig <martin@ximian.com>
3786 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
3788 2003-08-28 Martin Baulig <martin@ximian.com>
3790 * cs-parser.jay (opt_type_argument_list): Use
3791 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
3792 (primary_expression): Replace `qualified_identifier' with `type_name'.
3793 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
3795 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
3796 parser to check whether it is syntactically a type parameter list;
3797 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
3800 2003-08-26 Martin Baulig <martin@ximian.com>
3802 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
3803 resolving aliases; fixes #47927.
3805 2003-08-26 Martin Baulig <martin@ximian.com>
3807 * statement.cs (Using.DoResolve): This is internally emitting a
3808 try/finally clause, so we need to set ec.NeedExplicitReturn if we
3809 do not always return. Fixes #47681.
3811 2003-08-26 Martin Baulig <martin@ximian.com>
3813 * decl.cs (MemberCore): Moved WarningNotHiding(),
3814 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
3816 (AdditionResult): Make this nested in DeclSpace.
3817 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
3818 argument; call NamespaceEntry.Define() unless we're nested in a
3821 * namespace.cs (Namespace.DefineName): New public function. This
3822 is called from DeclSpace's .ctor to add
3823 (Namespace.Lookup): Include DeclSpaces in the lookup.
3825 * class.cs (Operator): Derive from MemberBase, not MemberCore.
3827 * const.cs (Const): Derive from MemberBase, not MemberCore.
3829 2003-08-25 Martin Baulig <martin@ximian.com>
3831 * convert.cs (Convert.ExplicitReferenceConversion): When
3832 converting from an interface type to a class, unbox if the target
3833 type is a struct type. Fixes #47822.
3835 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3837 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
3840 2003-08-22 Martin Baulig <martin@ximian.com>
3842 * class.cs (TypeManager.DefineType): When defining a nested type,
3843 call DefineType() on our parent; fixes #47801.
3845 2003-08-22 Martin Baulig <martin@ximian.com>
3847 * class.cs (MethodData.Define): While checking if a method is an
3848 interface implementation, improve the test a bit more to fix #47654.
3850 2003-08-22 Martin Baulig <martin@ximian.com>
3852 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
3853 correctly; fixes #47722.
3855 2003-08-22 Martin Baulig <martin@ximian.com>
3857 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
3858 LocalVariableReference, ensure it's not read-only. Fixes #47536.
3860 * statement.cs (Fixed.DoResolve): Make all variables read-only.
3862 2003-08-22 Martin Baulig <martin@ximian.com>
3864 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
3865 can only be assigned in static constructors. Fixes #47161.
3867 2003-08-22 Martin Baulig <martin@ximian.com>
3869 Rewrote and improved the flow analysis code.
3871 * flowbranching.cs (FlowBranching): Make this class abstract.
3872 (FlowBranching.CreateBranching): New static function to create a
3874 (FlowBranchingBlock, FlowBranchingException): New classes.
3875 (FlowBranching.UsageVector.Type): New public readonly field.
3876 (FlowBranching.UsageVector.Breaks): Removed the setter.
3877 (FlowBranching.UsageVector.Returns): Removed the setter.
3878 (FlowBranching.UsageVector): Added Break(), Return(),
3879 NeverReachable() and Throw() methods to modify the reachability.
3880 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
3881 done by FlowBranching.Merge().
3882 (FlowBranching.UsageVector.MergeChild): New method; merges the
3883 merge result into the current vector.
3884 (FlowBranching.Merge): New abstract method to merge a branching.
3886 2003-08-12 Martin Baulig <martin@ximian.com>
3888 * expression.cs (Indirection.CacheTemporaries): Create the
3889 LocalTemporary with the pointer type, not its element type.
3891 2003-08-10 Miguel de Icaza <miguel@ximian.com>
3893 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
3894 token was a keyword or not.
3896 Add `error' options where an IDENTIFIER was expected; Provide
3897 CheckToken and CheckIdentifierToken convenience error reporting
3900 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
3902 * decl.cs: Rename `NamespaceEntry Namespace' public field into
3903 NameSpaceEntry NameSpaceEntry.
3905 (LookupInterfaceOrClass): Avoid creating a full qualified name
3906 from namespace and name: avoid doing lookups when we know the
3907 namespace is non-existant. Use new Tree.LookupByNamespace which
3908 looks up DeclSpaces based on their namespace, name pair.
3910 * driver.cs: Provide a new `parser verbose' to display the
3911 exception thrown during parsing. This is turned off by default
3912 now, so the output of a failure from mcs is more graceful.
3914 * namespace.cs: Track all the namespaces defined in a hashtable
3917 (IsNamespace): New method
3919 2003-08-09 Miguel de Icaza <miguel@ximian.com>
3921 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
3922 we know that we need to concatenate (full typename can never be
3927 * statement.cs: Use a bitfield; Do not initialize to null things
3928 which are done by the constructor by default.
3930 * cs-parser.jay: bug fix, parameter was 4, not 3.
3932 * expression.cs: Just use the property;
3934 * statement.cs: No need for GetVariableInfo method.
3936 2003-08-08 Martin Baulig <martin@ximian.com>
3938 * flowanalysis.cs (FlowReturns): This is now nested in the
3939 `FlowBranching' class.
3940 (MyBitVector): Moved this here from statement.cs.
3941 (FlowBranching.SiblingType): New enum type.
3942 (FlowBranching.CreateSibling): Added `SiblingType' argument.
3944 2003-08-07 Martin Baulig <martin@ximian.com>
3946 * flowanalysis.cs (FlowBranchingType): This is now nested in the
3947 `FlowBranching' class and called `BranchingType'.
3949 2003-08-07 Martin Baulig <martin@ximian.com>
3951 * flowanalysis.cs: Moved all the control flow analysis code into
3954 2003-08-07 Martin Baulig <martin@ximian.com>
3956 * assign.cs (Assign.DoResolve): `target' must either be an
3957 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
3960 2003-08-07 Miguel de Icaza <miguel@ximian.com>
3962 * expression.cs (BinaryMethod): This kind of expression is created by the
3963 Binary class if it determines that the operator has to be handled
3966 (BinaryDelegate): This kind of expression is created if we are
3967 dealing with a + or - operator on delegates.
3969 (Binary): remove method, argumetns, and DelegateOperator: when
3970 dealing with methods,
3972 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
3974 * statement.cs (Block): use bitfields for the three extra booleans
3975 we had in use. Remove unused topblock parameter.
3977 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
3979 * assign.cs: Drop extra unneeded tests.
3981 2003-08-06 Miguel de Icaza <miguel@ximian.com>
3983 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
3985 * statement.cs (Foreach): Use VariableStorage instead of
3988 * codegen.cs (VariableStorage): New class used by clients that
3989 require a variable stored: locals or fields for variables that
3990 need to live across yield.
3992 Maybe provide a convenience api for EmitThis+EmitLoad?
3994 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
3997 2003-08-05 Miguel de Icaza <miguel@ximian.com>
3999 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
4000 RemapParameterLValue): New methods that are used to turn a
4001 precomputed FieldInfo into an expression like this:
4005 The idea is to use this instead of making LocalVariableReference
4006 have more than one meaning.
4008 * cs-parser.jay: Add error production to BASE.
4010 * ecore.cs: Deal with TypeManager.GetField returning null, which
4011 is now a valid return value.
4013 (FieldExprNoAddress): New expression for Fields whose address can
4016 * expression.cs (LocalVariableReference): During the resolve
4017 phases, create new expressions if we are in a remapping context.
4018 Remove code that dealt with remapping here.
4020 (ParameterReference): same.
4022 (ProxyInstance): New expression, like the `This' expression, but
4023 it is born fully resolved. We know what we are doing, so remove
4024 the errors that are targeted to user-provided uses of `this'.
4026 * statement.cs (Foreach): our variable is now stored as an
4027 Expression; During resolution, follow the protocol, dont just
4028 assume it will return this.
4030 2003-08-06 Martin Baulig <martin@ximian.com>
4032 * support.cs (SeekableStreamReader.cs): New public class.
4034 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
4035 SeekableStreamReader instead of the normal StreamReader.
4037 2003-08-04 Martin Baulig <martin@ximian.com>
4039 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
4040 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
4041 deambiguate casts and delegate invocations.
4042 (parenthesized_expression): Use the new tokens to ensure this is
4043 not a cast of method invocation.
4045 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
4046 when reading a `)' and Deambiguate_CloseParens () was previously
4049 * expression.cs (ParenthesizedExpression): New class. This is
4050 just used for the CS0075 test.
4051 (Binary.DoResolve): Check for CS0075.
4053 2003-07-29 Ravi Pratap <ravi@ximian.com>
4055 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
4056 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
4057 reference comparison.
4059 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
4060 examine the ReturnType for equality - this is necessary in the
4061 cases of implicit and explicit operators whose signature also
4062 includes the return type.
4064 2003-07-26 Miguel de Icaza <miguel@ximian.com>
4066 * namespace.cs: Cache the result of the namespace computation,
4067 instead of computing it every time.
4069 2003-07-24 Miguel de Icaza <miguel@ximian.com>
4071 * decl.cs: Use a global arraylist that we reuse over invocations
4072 to avoid excesive memory consumption. Reduces memory usage on an
4073 mcs compile by one meg (45 average).
4075 * typemanager.cs (LookupTypeReflection): In .NET pointers are
4076 private, work around that.
4078 2003-07-23 Miguel de Icaza <miguel@ximian.com>
4080 * literal.cs (IntLiteral): Define Zero and One static literals.
4082 * cs-parser.jay (integer_literal): use static literals to reduce
4083 memory usage for the most used literals (0, 1 and -1). 211kb
4084 reduced in memory usage.
4086 Replace all calls to `new ArrayList' with `new
4087 ArrayList(4)' which is a good average number for most allocations,
4088 and also requires only 16 bytes of memory for its buffer by
4091 This reduced MCS memory usage in seven megabytes for the RSS after
4094 2003-07-28 Ravi Pratap <ravi@ximian.com>
4096 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
4097 handle params methods the correct way by forming only one
4098 applicable set with params and normal methods in them. Earlier we
4099 were looking at params methods only if we found no normal methods
4100 which was not the correct thing to do.
4102 (Invocation.BetterFunction): Take separate arguments indicating
4103 when candidate and the best method are params methods in their
4106 This fixes bugs #43367 and #46199.
4108 * attribute.cs: Documentation updates.
4110 (CheckAttribute): Rename to CheckAttributeTarget.
4111 (GetValidPlaces): Rename to GetValidTargets.
4113 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
4114 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
4118 2003-07-28 Miguel de Icaza <miguel@ximian.com>
4120 * codegen.cs: Compute IsGeneric correctly.
4122 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
4125 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
4126 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
4127 regressions, and I was chasing more bugs than I required.
4129 * interface.cs: Use expressions for base type names (like classes
4130 and structs have been doing for a while now), and resolve that.
4131 This patch should probably go into head as well.
4133 This makes it one less user of FindType.
4135 2003-07-24 Miguel de Icaza <miguel@ximian.com>
4137 This compiler can not self host currently. Need to fix that.
4139 * Makefile: compile to `gmcs.exe'
4141 * driver.cs: Turn on v2 by default on gmcs.
4143 * generic.cs (ConstructedType): Does no longer take a container
4144 type argument; That will be taken care of later.
4146 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
4147 Use SimpleName to resolve for now, so we can continue the work on
4148 the parser, until we get Type.GetType that understands generics.
4150 (ConstructedType.ToString): Implement
4152 (TypeArguments.Resolve): Resolve the child expressions as types.
4154 * cs-parser.jay: Rename interface_constraints to
4155 type_parameter_constraints
4157 (namespace_or_type_name): Only use constructed types for the basic
4158 construction, we will deal with identifier<...> later.
4160 (type/type_name): No longer call DecomposeQI, as
4161 namespace_or_type_name is always decoded now.
4163 2003-07-22 Ravi Pratap <ravi@ximian.com>
4165 * expression.cs (Invocation.OverloadResolve): Follow the spec more
4166 closely: we eliminate methods in base types when we have an
4167 applicable method in a top-level type.
4169 Please see section 14.5.5.1 for an exact description of what goes
4172 This fixes bug #45127 and a host of other related to corlib compilation.
4174 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
4175 array is the method corresponding to the top-level type (this is
4176 because of the changes made to icall.c) so we change this
4179 (MethodGroupExpr.Name): This too.
4181 * typemanager.cs (GetElementType): New method which does the right
4182 thing when compiling corlib.
4184 * everywhere: Make use of the above in the relevant places.
4186 2003-07-22 Martin Baulig <martin@ximian.com>
4188 * cs-parser.jay (invocation_expression): Moved
4189 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
4190 `cast_expression', but create a InvocationOrCast which later
4191 resolves to either an Invocation or a Cast.
4193 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
4194 method; call this before EmitStatement() to make sure that this
4195 expression can be used as a statement.
4197 * expression.cs (InvocationOrCast): New class; resolves to either
4198 an Invocation or a Cast.
4200 * statement.cs (StatementExpression): Call ResolveStatement() on
4201 the ExpressionStatement before emitting it.
4203 2003-07-21 Martin Baulig <martin@ximian.com>
4205 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
4206 `ref' and `out' attributes match; fixes #46220.
4207 (MemberAccess.ResolveMemberAccess): You can't reference a type
4208 through an expression; fixes #33180.
4209 (Indexers.GetIndexersForType): Don't return the indexers from
4210 interfaces the class implements; fixes #46502.
4212 2003-07-21 Martin Baulig <martin@ximian.com>
4214 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
4215 CS0661 checks; fixes bug #30442.
4217 2003-07-21 Martin Baulig <martin@ximian.com>
4219 * decl.cs (AdditionResult): Added `Error'.
4221 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
4223 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
4224 cs0031.cs actually work.
4226 2003-07-20 Miguel de Icaza <miguel@ximian.com>
4228 * cs-parser.jay (namespace_name): do not use
4229 namespace_or_type_name, use qualified_identifier, because
4230 namespace_or_type_name will soon return a composed expression
4231 instead of a string.
4233 (namespace_or_type_name): Instead of returning a string, now this
4234 production returns an expression.
4236 * codegen.cs (EmitContext): Setup IsGeneric property based on
4237 whether our DeclSpace is generic, our the method is generic.
4239 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
4240 the method is generic.
4242 * cs-parser.jay (type_arguments, opt_type_argument_list,
4243 type_parameters, type_parameter_list, opt_type_parameter_list,
4244 type_parameter,, opt_type_parameter_constraints_clauses,
4245 type_parameter_constraints_clauses,
4246 type_parameter_constraint_clause, type_parameter_constraint,
4247 interface_constraints): Add new production
4249 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
4250 DeclSpace is generic or not.
4252 (DeclSpace.SetParameterInfo): New routine, used to set the
4253 parameter info for a type.
4255 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
4256 returns a GenericTypeExpr
4258 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
4259 generic, lookup the generic argument.
4261 * attribute.cs: Do not allow TypeParameterExpressions in
4264 * class.cs: Do not allow the Main method to be defined in a
4267 * expression.cs (SizeOf): Do not allow generic types to be used as
4268 arguments to sizeof.
4270 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
4271 it: whether a type is generic or not. Only works for types we are
4272 currently building for now.
4274 2003-07-20 Martin Baulig <martin@ximian.com>
4276 * namespace.cs: Fixed that bug which caused a crash when compiling
4279 2003-07-20 Miguel de Icaza <miguel@ximian.com>
4281 * typemanager.cs (LookupTypeReflection): Never expose types which
4282 are NotPublic, NestedPrivate, NestedAssembly, or
4283 NestedFamANDAssem. We used to return these, and later do a check
4284 that would report a meaningful error, but the problem is that we
4285 would not get the real match, if there was a name override.
4287 2003-07-18 Miguel de Icaza <miguel@ximian.com>
4289 * namespace.cs (Namespace, Name): Do not compute the namespace
4290 name dynamically, compute it in the constructor. This reduced
4291 memory usage by 1697 KB.
4293 * driver.cs: Use --pause to pause at the end.
4295 2003-07-17 Peter Williams <peter@newton.cx>
4297 * Makefile: Change the name of the test target so that it doesn't
4298 conflict with the recursive test target.
4300 2003-07-17 Miguel de Icaza <miguel@ximian.com>
4302 * expression.cs (LocalVariableReference.Emit, EmitAssign,
4303 AddressOf): Do not use EmitThis, that was wrong, use the actual
4306 2003-07-15 Miguel de Icaza <miguel@ximian.com>
4308 * class.cs (MethodData.Define): While checking if a method is an
4309 interface implementation, improve the test: If we are not public
4310 (use new test here: use the computed MethodAttributes directly,
4311 instead of the parsed modifier flags) check if the `implementing'
4312 method comes from an interface or not.
4314 * pending.cs (VerifyPendingMethods): Slightly better error
4317 * makefile: add test target that does the mcs bootstrap.
4319 2003-07-16 Ravi Pratap <ravi@ximian.com>
4321 * interface.cs (Define): Do nothing here since there are no
4322 members to populate etc. Move the attribute emission out of here
4323 since this was just totally the wrong place to put it. Attribute
4324 application happens during the 'Emit' phase, not in the 'Define'
4327 (Emit): Add this method and move the attribute emission here
4329 * rootcontext.cs (EmitCode): Call the Emit method on interface
4332 2003-07-14 Ravi Pratap M <ravi@ximian.com>
4334 * expression.cs (OverloadResolve): Report error only if Location
4335 is not 'Null' which means that there was a probe going on.
4337 2003-07-14 Martin Baulig <martin@ximian.com>
4339 * expression.cs (ConditionalLogicalOperator): New public class to
4340 implement user defined conditional logical operators.
4341 This is section 14.11.2 in the spec and bug #40505.
4343 2003-07-14 Martin Baulig <martin@ximian.com>
4345 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
4347 2003-07-14 Martin Baulig <martin@ximian.com>
4349 * codegen.cs (EmitContext.InFixedInitializer): New public field.
4351 * ecore.cs (IVariable.VerifyFixed): New interface method.
4353 * expression.cs (Unary.ResolveOperator): When resolving the `&'
4354 operator, check whether the variable is actually fixed. Fixes bug
4355 #36055. Set a variable definitely assigned when taking its
4356 address as required by the spec.
4358 * statement.cs (LocalInfo.IsFixed): New field.
4359 (LocalInfo.MakePinned): Set `IsFixed' to true.
4361 2003-07-14 Ravi Pratap M <ravi@ximian.com>
4363 * attribute.cs (Attribute.Resolve): While doing a Member lookup
4364 for .ctors, ensure that we only ask for members declared in the
4365 attribute type (BindingFlags.DeclaredOnly).
4369 * expression.cs (Error_WrongNumArguments): Report error 1501
4370 correctly the way CSC does.
4372 2003-07-13 Martin Baulig <martin@ximian.com>
4374 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
4375 lookup on the fully qualified name, to make things like "X.X" work
4376 where "X.X" is a fully qualified type name, but we also have a
4377 namespace "X" in the using list. Fixes #41975.
4379 2003-07-13 Martin Baulig <martin@ximian.com>
4381 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
4382 function. If we're a CompoundAssign, we need to create an embedded
4383 CompoundAssign, not an embedded Assign.
4384 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
4387 2003-07-13 Martin Baulig <martin@ximian.com>
4389 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
4390 work to fix bug #46088.
4392 2003-07-13 Ravi Pratap <ravi@ximian.com>
4394 * class.cs (Operator.Emit): Do not emit attributes here - it is
4395 taken care of by the Method class that we delegate too. This takes
4398 2003-07-10 Martin Baulig <martin@ximian.com>
4400 * expression.cs (TypeOfVoid): New class.
4401 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
4403 2003-07-10 Martin Baulig <martin@ximian.com>
4405 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
4408 2003-07-10 Martin Baulig <martin@ximian.com>
4410 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
4411 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
4413 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
4415 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
4417 2003-07-10 Martin Baulig <martin@ximian.com>
4419 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
4420 of decimal. Fixes #42850.
4422 NOTE: I also fixed the created byte blob, but this doesn't work on
4423 the MS runtime and csc never produces any byte blobs for decimal
4426 2003-07-10 Martin Baulig <martin@ximian.com>
4428 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
4429 structs; fixes #32068.
4430 (Block.AddChildVariableNames): Fixed #44302.
4432 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4434 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
4436 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4438 * attribute.cs: And this test is onger needed.
4440 2003-07-08 Martin Baulig <martin@ximian.com>
4442 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
4443 inaccessible types. Fixes #36313.
4445 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
4447 * namespace.cs (NamespaceEntry): Create implicit entries for all
4448 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
4449 implicit entries for N1.N2 and N1.
4451 2003-07-08 Martin Baulig <martin@ximian.com>
4453 Rewrote the handling of namespaces to fix a lot of the issues
4454 wrt. `using' aliases etc.
4456 * namespace.cs (Namespace): Splitted this class into a
4457 per-assembly `Namespace' and a per-file `NamespaceEntry'.
4459 * typemanager.cs (TypeManager.IsNamespace): Removed.
4460 (TypeManager.ComputeNamespaces): Only compute namespaces from
4461 loaded assemblies here, not the namespaces from the assembly we're
4462 currently compiling.
4464 2003-07-08 Martin Baulig <martin@ximian.com>
4466 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
4468 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4470 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
4473 I thought about the memory savings here, but LookupTypeReflection
4474 is used under already very constrained scenarios. Compiling
4475 corlib or mcs only exposes one hit, so it would not really reduce
4476 any memory consumption.
4478 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4480 * typemanager.cs: fixes bug #45889 by only adding public types from
4481 other assemblies to the list of known types.
4483 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4485 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
4486 on the type we resolved.
4488 2003-07-05 Martin Baulig <martin@ximian.com>
4490 * pending.cs (PendingImplementation.ParentImplements): Don't
4491 create the proxy if the parent is abstract.
4493 * class.cs (TypeContainer.DefineIndexers): Process explicit
4494 interface implementations first. Fixes #37714.
4496 2003-07-04 Miguel de Icaza <miguel@ximian.com>
4498 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
4499 defined recursively; but since we modify the input parameters
4500 (left is set to `this' temporarily), we reset this value if the
4501 left_is_explicit is false, which gives the original semantics to
4504 * literal.cs (NullPointer): new class used to represent a null
4505 literal in a pointer context.
4507 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
4508 type is a pointer, use a NullPointer object instead of a
4509 NullLiteral. Closes 43687
4511 (ExplicitConversion): Convert pointer values using
4512 the conv opcode to the proper type.
4514 * ecore.cs (New): change ValueTypeVariable property into a method,
4515 that returns whether the valuetype is suitable for being used.
4517 * expression.cs (Binary.DoNumericPromotions): Only return if we
4518 the int constant was a valid uint, and we can return both left and
4519 right as uints. If not, we continue processing, to trigger the
4520 type conversion. This fixes 39018.
4522 * statement.cs (Block.EmitMeta): During constant resolution, set
4523 the CurrentBlock property on the emitcontext, so that we resolve
4524 constants propertly.
4526 2003-07-02 Martin Baulig <martin@ximian.com>
4528 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
4529 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
4531 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
4532 than emitting it here.
4534 * statement.cs: Fixed some more flow analysis bugs.
4536 2003-07-02 Martin Baulig <martin@ximian.com>
4538 * class.cs (MethodData.Define): When implementing interface
4539 methods, set Final unless we're Virtual.
4541 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
4542 check work for interface methods.
4544 2003-07-01 Martin Baulig <martin@ximian.com>
4546 * ecore.cs (EmitContext.This): Replaced this property with a
4547 GetThis() method which takes a Location argument. This ensures
4548 that we get the correct error location for a CS0188.
4550 2003-07-01 Miguel de Icaza <miguel@ximian.com>
4552 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
4553 ImplicitStandardConversion.
4555 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
4557 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
4559 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
4562 2003-06-30 Miguel de Icaza <miguel@ximian.com>
4564 * class.cs (Constructor.Define): Turn off initlocals for unsafe
4567 (MethodData.Define): Turn off initlocals for unsafe methods.
4569 2003-06-29 Miguel de Icaza <miguel@ximian.com>
4571 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
4572 complete; Fixes #37521.
4574 * delegate.cs: Use Modifiers.TypeAttr to compute the
4575 TypeAttributes, instead of rolling our own. This makes the flags
4576 correct for the delegates.
4578 2003-06-28 Miguel de Icaza <miguel@ximian.com>
4580 * class.cs (Constructor.Define): Set the private flag for static
4581 constructors as well.
4583 * cs-parser.jay (statement_expression): Set the return value to
4584 null, to avoid a crash when we catch an error.
4586 2003-06-24 Miguel de Icaza <miguel@ximian.com>
4588 * cs-parser.jay: Applied patch from Jackson that adds support for
4589 extern and unsafe modifiers to destructor declarations.
4591 * expression.cs: Report error 21 if the user is trying to index a
4594 * driver.cs: Add an error message, suggested by the bug report.
4596 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
4597 if we do not have a ": this ()" constructor initializer. Fixes 45149
4599 2003-06-14 Miguel de Icaza <miguel@ximian.com>
4601 * namespace.cs: Add some information to reduce FAQs.
4603 2003-06-13 Miguel de Icaza <miguel@ximian.com>
4605 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
4606 underlying enumeration types. Fixes #43915.
4608 * expression.cs: Treat ushort/short as legal values to be used in
4611 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
4613 * delegate.cs: transfer custom attributes for paramenters from
4614 the delegate declaration to Invoke and BeginInvoke.
4616 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
4618 * attribute.cs: handle custom marshalers and emit marshal info
4621 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
4623 * makefile.gnu: Added anonymous.cs to the compiler sources.
4625 2003-05-28 Miguel de Icaza <miguel@ximian.com>
4627 * iterators.cs: Change the name of the proxy class to include two
4630 * cs-parser.jay: Update grammar to include anonymous methods.
4632 * anonymous.cs: new file.
4634 2003-05-27 Miguel de Icaza <miguel@ximian.com>
4636 * class.cs (Field.Define): Add missing test for pointers and
4639 2003-05-27 Ravi Pratap <ravi@ximian.com>
4641 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
4642 we use the stobj opcode.
4644 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
4645 since it wasn't the correct fix.
4647 It still is puzzling that we are required to use stobj for IntPtr
4648 which seems to be a ValueType.
4650 2003-05-26 Miguel de Icaza <miguel@ximian.com>
4652 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
4653 during regular simple name resolution. Now, the trick is that
4654 instead of returning for processing the simplename, we do a
4655 TypeManager.LookupType (ie, a rooted lookup as opposed to a
4656 contextual lookup type). If a match is found, return that, if
4657 not, return for further composition.
4659 This fixes long-standing 30485.
4661 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4662 using the address to initialize an object, do an Stobj instead of
4663 using the regular Stelem.
4665 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
4666 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
4667 Because if we are a BaseIndexerAccess that value will be true.
4670 * statement.cs (GotoCase.Resolve): Return after reporting an
4671 error, do not attempt to continue.
4673 * expression.cs (PointerArithmetic.Emit): If our operand is a
4674 long, convert our constants to match the operand before
4675 multiplying. Convert to I type before adding. Fixes 43670.
4677 2003-05-14 Ravi Pratap <ravi@ximian.com>
4679 * enum.cs (ImplicitConversionExists) : Rename to
4680 ImplicitEnumConversionExists to remove ambiguity.
4682 * ecore.cs (NullCast): New type of cast expression class which
4683 basically is very similar to EmptyCast with the difference being
4684 it still is a constant since it is used only to cast a null to
4688 * convert.cs (ImplicitReferenceConversion): When casting a null
4689 literal, we return a NullCast.
4691 * literal.cs (NullLiteralTyped): Remove - I don't see why this
4692 should be around anymore.
4694 The renaming (reported was slightly wrong). Corrections:
4696 ConvertImplicitStandard -> ImplicitConversionStandard
4697 ConvertExplicitStandard -> ExplicitConversionStandard
4699 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
4700 before passing them in !
4702 * convert.cs (ImplicitConversionStandard): When comparing for
4703 equal expr and target types, ensure that expr is not a
4706 In general, we must not be checking (expr_type ==
4707 target_type) in the top level conversion methods
4708 (ImplicitConversion, ExplicitConversion etc). This checking is
4709 done in the methods that they delegate to.
4711 2003-05-20 Miguel de Icaza <miguel@ximian.com>
4713 * convert.cs: Move Error_CannotConvertType,
4714 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
4715 ImplicitNumericConversion, ImplicitConversionExists,
4716 ImplicitUserConversionExists, StandardConversionExists,
4717 FindMostEncompassedType, FindMostSpecificSource,
4718 FindMostSpecificTarget, ImplicitUserConversion,
4719 ExplicitUserConversion, GetConversionOperators,
4720 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
4721 TryImplicitIntConversion, Error_CannotConvertImplicit,
4722 ConvertImplicitRequired, ConvertNumericExplicit,
4723 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
4724 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
4727 Perform the following renames:
4729 StandardConversionExists -> ImplicitStandardConversionExists
4730 ConvertImplicit -> ImplicitConversion
4731 ConvertImplicitStandard -> ImplicitStandardConversion
4732 TryImplicitIntConversion -> ImplicitIntConversion
4733 ConvertImplicitRequired -> ImplicitConversionRequired
4734 ConvertNumericExplicit -> ExplicitNumericConversion
4735 ConvertReferenceExplicit -> ExplicitReferenceConversion
4736 ConvertExplicit -> ExplicitConversion
4737 ConvertExplicitStandard -> ExplicitStandardConversion
4739 2003-05-19 Martin Baulig <martin@ximian.com>
4741 * statement.cs (TypeInfo.StructInfo): Made this type protected.
4742 (TypeInfo): Added support for structs having structs as fields.
4744 * ecore.cs (FieldExpr): Implement IVariable.
4745 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
4746 VariableInfo for the field.
4748 2003-05-18 Martin Baulig <martin@ximian.com>
4750 * expression.cs (This.DoResolve): Report a CS0027 if we're
4751 emitting a field initializer.
4753 2003-05-18 Martin Baulig <martin@ximian.com>
4755 * expression.cs (This.ResolveBase): New public function.
4756 (This.DoResolve): Check for CS0188.
4758 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
4761 * ecore.cs (MethodGroupExpr.DoResolve): Set the
4762 `instance_expression' to null if we don't have any non-static
4765 2003-05-18 Martin Baulig <martin@ximian.com>
4767 Reworked the way how local variables and parameters are handled by
4768 the flow analysis code.
4770 * statement.cs (TypeInfo, VariableMap): New public classes.
4771 (VariableInfo): New public class. This is now responsible for
4772 checking whether a variable has been assigned. It is used for
4773 parameters and local variables.
4774 (Block.EmitMeta): Take the InternalParameters as argument; compute
4775 the layout of the flow vectors here.
4776 (Block.LocalMap, Block.ParameterMap): New public properties.
4777 (FlowBranching): The .ctor doesn't get the InternalParameters
4778 anymore since Block.EmitMeta() now computes the layout of the flow
4780 (MyStructInfo): This class is now known as `StructInfo' and nested
4781 in `TypeInfo'; we don't access this directly anymore.
4783 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
4784 property and removed IsAssigned(), IsFieldAssigned(),
4785 SetAssigned() and SetFieldAssigned(); we now call them on the
4786 VariableInfo so we don't need to duplicate this code everywhere.
4788 * expression.cs (ParameterReference): Added `Block block' argument
4790 (LocalVariableReference, ParameterReference, This): The new
4791 VariableInfo class is now responsible for all the definite
4794 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
4795 IsParameterAssigned, SetParameterAssigned): Removed.
4797 2003-05-18 Martin Baulig <martin@ximian.com>
4799 * typemanager.cs (InitCoreTypes): Try calling
4800 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
4801 the 3-args-version. Corlib now also needs our `void_type'.
4802 (GetMethod): Added overloaded version which takes an optional
4803 `bool report_errors' to allow lookups of optional methods.
4805 2003-05-12 Martin Baulig <martin@ximian.com>
4807 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
4808 only used for locals and not for parameters.
4810 2003-05-12 Miguel de Icaza <miguel@ximian.com>
4812 * support.cs (InternalParameters.ParameterType): Return the
4813 ExternalType of the parameter.
4815 * parameter.cs (Parameter.ExternalType): drop the two arguments,
4818 2003-05-11 Miguel de Icaza <miguel@ximian.com>
4820 * class.cs (MethodData.Define): Do not set the `newslot' on
4821 interface members, if they are also flagged as "override".
4823 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
4824 better code for ++i and i++. This only works for static fields
4825 and local variables.
4827 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
4828 want to pull the DeclSpace out of the builder_to_declspace instead
4829 of the TypeBuilder (like in TypeContainer.FindMembers).
4831 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
4832 instead of LookupTypeContainer. Fixes the crash on .NET for
4833 looking up interface members.
4835 * const.cs: Create our own emit context during the Definition
4836 stage, so that constants are evaluated in the proper context, when
4837 a recursive definition happens.
4839 2003-05-11 Martin Baulig <martin@ximian.com>
4841 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
4842 new block for a switch section.
4843 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
4844 the adding/lookup in the switch block. Fixes #39828.
4846 2003-05-09 Miguel de Icaza <miguel@ximian.com>
4848 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
4849 functionality: I needed to convert the data after I had performed
4850 the add/sub operation into the operands type size.
4852 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
4853 pass the type for the box operation, otherwise the resulting
4854 object would have been of type object.
4856 (BoxedCast): Add constructor to specify the type to box as.
4858 2003-05-07 Miguel de Icaza <miguel@ximian.com>
4860 * iterators.cs: I was reusing the `count' variable inadvertently,
4861 take steps to not allow this to happen.
4863 2003-05-06 Miguel de Icaza <miguel@ximian.com>
4865 * attribute.cs (Attribute.Resolve): Params attributes are encoded
4866 by creating an array at the point where the params starts and
4867 putting all those arguments there, then adjusting the size of the
4870 2003-05-05 Miguel de Icaza <miguel@ximian.com>
4872 * expression.cs (New.AddressOf): Implement interface
4873 IMemoryLocation. This is used when the `new' operator is used in
4874 the context of an invocation to a method on a value type.
4876 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
4879 * namespace.cs: Also check the using aliases here.
4881 * driver.cs: Move the test for using validity after the types have
4882 been entered, so we do a single pass that also includes the using
4885 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
4886 in the regular case. CreateSiblingForFinally is doing extra
4889 * attribute.cs (GetAttributeArgumentExpression): Store the result
4890 on an out value, and use the return value to indicate failure
4891 instead of using null (which is a valid return for Constant.GetValue).
4893 * statement.cs: Perform the analysis flow for the increment
4894 portion after the statement, because this will be the real flow of
4895 execution. Fixes #42385
4897 * codegen.cs (EmitContext.EmitArgument,
4898 EmitContext.EmitStoreArgument): New helper functions when the
4899 RemapToProxy flag is set.
4901 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
4904 Add support for remapping parameters.
4906 * iterators.cs: Propagate parameter values; Store parameter
4907 values in the proxy classes.
4909 2003-05-04 Miguel de Icaza <miguel@ximian.com>
4911 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
4912 need a proxy reference; I do not know what I was thinking
4914 * cs-parser.jay (constructor_initializer): catch another error,
4915 and display nice message.
4917 (field_declaration): catch void field declaration
4918 to flag a better error.
4920 * class.cs (MemberBase.CheckBase): Report an error instead of a
4921 warning if a new protected member is declared in a struct.
4922 (Field.Define): catch the error of readonly/volatile.
4924 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
4926 (FieldExpr.AddressOf): ditto. Catch error where the address of a
4927 volatile variable is taken
4929 2003-05-02 Miguel de Icaza <miguel@ximian.com>
4931 * statement.cs (Fixed.Resolve): Report an error if we are not in
4934 2003-05-01 Miguel de Icaza <miguel@ximian.com>
4936 * typemanager.cs: reuse the code that handles type clashes for
4937 delegates and enumerations.
4939 * class.cs (Report28): Always report.
4941 * expression.cs (EncodeAsAttribute): Allow nulls here.
4943 2003-04-28 Miguel de Icaza <miguel@ximian.com>
4945 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
4946 the functionality for testing whether an expression is valid for
4947 an attribute here. Also handle the case of arrays of elements
4950 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
4951 encoding a linear array into an array of objects that are suitable
4952 to be passed to an CustomAttributeBuilder.
4954 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
4956 * ecore.cs: (FieldExpr): Handle field remapping here.
4958 * iteratators.cs: Pass the instance variable (if the method is an
4959 instance method) to the constructors, so we can access the field
4960 variables on the class.
4962 TODO: Test this with structs. I think the THIS variable on
4963 structs might have to be a pointer, and not a refenrece
4965 2003-04-27 Miguel de Icaza <miguel@ximian.com>
4967 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
4968 local variables to fields in a proxy class.
4970 * iterators.cs (PopulateProxy): Rename our internal fields to
4972 Create a <THIS> field if we are an instance method, so we can
4973 reference our parent container variables.
4974 (MapVariable): Called back from the EmitContext code to enter a
4975 new variable to field mapping into the proxy class (we just create
4979 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
4980 for using the remapped locals to fields.
4982 I placed the code here, because that gives the same semantics to
4983 local variables, and only changes the Emit code.
4985 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
4986 statements inside iterators.
4987 (VariableInfo): Add a FieldBuilder for the cases when we are
4988 remapping local variables to fields in a proxy class
4990 * ecore.cs (SimpleNameResolve): Avoid testing two times for
4991 current_block != null.
4993 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
4994 not cope with strings, as it has been moved to the
4995 TableSwitchEmit. Fixed bug in switch generation.
4997 * expression.cs (New.DoResolve): Provide more context for the user
4998 when reporting an error.
5000 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
5003 * expression.cs (MemberAccess.DoResolve): When we get a type back,
5004 check the permissions for it. Note than in a type-resolution
5005 context the check was already present in DeclSpace.ResolveType,
5006 but was missing from the MemberAccess.
5008 (ArrayCreation.CheckIndices): warn if the user has
5009 more nested levels of expressions, but there are no more
5010 dimensions specified. Avoids crash on bug 41906.
5012 2003-04-26 Miguel de Icaza <miguel@ximian.com>
5014 * statement.cs (Block): replace Implicit bool, for a generic
5016 New flag: `Unchecked'. This is used during the EmitMeta phase
5017 (which is out-of-line with the regular Resolve/Emit process for a
5018 statement, as this is done ahead of time, but still gets a chance
5019 to call constant resolve).
5021 (Block.Flags): new enum for adding a new flag.
5023 (Block.EmitMeta): track the state of unchecked.
5025 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
5026 to enable constant resolution to work there as well.
5028 2003-04-22 Miguel de Icaza <miguel@ximian.com>
5030 * typemanager.cs (ienumerable_type): Also look up
5031 System.Collections.IEnumerable.
5033 2003-04-21 Miguel de Icaza <miguel@ximian.com>
5035 TODO: Test more than one conditional per method.
5037 * class.cs (Indexer.Define): Report the location where the user is
5038 referencing the unsupported feature.
5040 (MethodData): Overload the use of `conditionals' to
5041 minimize the creation of needless ArrayLists. This saves roughly
5042 212kb on my machine.
5044 (Method): Implement the new IIteratorContainer interface.
5045 (Method.SetYields): Implement the method by setting the ModFlags
5046 to contain METHOD_YIELDS.
5048 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
5049 which just got set to null.
5051 * iterators.cs: New file.
5053 (Yield, YieldBreak): New statements.
5055 * statement.cs (Return.Resolve): Flag an error if we are used in
5058 * codegen.cs (InIterator): New flag set if the code is being
5059 compiled in an iterator method.
5061 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
5062 internal modifier, and we just use it to avoid adding extra
5063 fields, as this is seldom used.
5065 * cs-parser.jay: Add yield_statement (yield and yield break).
5067 * driver.cs: New flag -v2 to turn on version 2 features.
5069 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
5070 hashtable when v2 is enabled.
5072 2003-04-20 Miguel de Icaza <miguel@ximian.com>
5074 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
5075 there is already a namespace defined with this name.
5077 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
5078 people upgraded their corlibs.
5080 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
5081 always use fully qualified types, no need to use the compiler
5084 (TypeManager.IsNamespace): Use binarysearch.
5086 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
5087 AddDelegate): I did not quite use the new IsValid API properly: I
5088 have to pass the short-name and the fullname. I was passing only
5089 the basename instead of the fullname sometimes.
5091 (TypeContainer.DefineType): call NamespaceClash.
5093 * interface.cs (Interface.DefineType): use NamespaceClash before
5096 * delegate.cs (Delegate.DefineType): use NamespaceClash before
5099 * enum.cs: (Enum.DefineType): use NamespaceClash before
5102 * typemanager.cs (: 3-line patch that gives us some tasty 11%
5103 speed increase. First, use the negative_hits cache when we get a
5104 negative. Second, add the type with its full original name
5105 instead of the new . and + encoded name (reflection uses + to
5106 separate type from a nested type). Use LookupTypeReflection
5107 directly which bypasses the type->name hashtable (that we already
5108 know does not contain the type.
5110 * decl.cs (DeclSpace.ResolveTypeExpr): track the
5111 location/container type.
5113 * driver.cs: When passing utf8, use directly the UTF8Encoding.
5115 2003-04-19 Miguel de Icaza <miguel@ximian.com>
5117 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
5119 * delegate.cs (NewDelegate.Resolve): Test whether an instance
5120 method is being referenced in the method group from a static
5121 context, and report error 120 if so.
5123 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
5126 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
5127 is created, we create the A namespace).
5129 * cs-parser.jay: A namespace also introduces a DeclarationFound.
5132 2003-04-18 Miguel de Icaza <miguel@ximian.com>
5134 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
5135 invocation to ModuleBuilder.GetType with the same values will
5136 return a new type instance, so we need to cache its return
5139 * expression.cs (Binary.ResolveOperator): Only allow the compare
5140 operators on enums if they are of the same type.
5142 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
5143 types of ValueType on their own case. Before we were giving them
5144 the same treatment as objects.
5146 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
5147 fullname. Short name is used to compare against container name.
5148 Fullname is used to check against defined namespace names.
5150 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
5151 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
5153 (Method.CheckBase): Call parent.
5154 (MemberBase.CheckBase): Check for protected members on sealed
5156 (PropertyBase.CheckBase): Call parent.
5157 (Field.Define): Call parent.
5159 * report.cs: Negative error codes are now mapped to 8000 - code,
5160 so that the display is render more nicely.
5162 * typemanager.cs: Do not use try/catch, instead report a regular
5165 (GetPointerType, GetReferenceType): These methods provide
5166 mechanisms to obtain the T* and T& from a T. We had the code
5167 previously scattered around the code base, and it also used
5168 TypeManager.LookupType that would go through plenty of caches.
5169 This one goes directly to the type source.
5171 In some places we did the Type.GetType followed by
5172 ModuleBuilder.GetType, but not in others, so this unifies the
5175 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
5176 statements now that we have namespace information.
5178 * typemanager.cs (IsNamespace): New method, returns whether the
5179 string presented is a namespace or not.
5181 (ComputeNamespaces): New public entry point, computes the list of
5182 available namespaces, using the GetNamespaces API call in Mono, or
5183 the slower version in MS.NET.
5185 Now before we start the semantic analysis phase, we have a
5186 complete list of namespaces including everything that the user has
5189 Deleted old code to cache namespaces in .nsc files.
5191 2003-04-17 Miguel de Icaza <miguel@ximian.com>
5193 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
5194 class/struct location definition Location for the implicit
5195 constructor location.
5197 (Operator.Define): Use the location of the operator for the
5198 implicit Method definition.
5200 (Constructor.Emit): use the constructor location for the implicit
5201 base initializer constructor.
5203 * ecore.cs: Remove ITypeExpression. This interface is now gone,
5204 and the Expression class now contains two new methods:
5206 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
5207 isolate type lookup from the rest of the resolution process.
5209 Since we use Expressions to hold type definitions due to the way
5210 we parse the input we have historically overloaded Resolve to
5211 perform the Type lookups if a special flag is passed. Now this is
5212 eliminated and two methods take their place.
5214 The differences in the two methods between xStep and xTerminal is
5215 that xStep is involved in our current lookup system that uses
5216 SimpleNames to compose a name, while xTerminal is used just to
5217 catch the case where the simplename lookup failed.
5219 2003-04-16 Miguel de Icaza <miguel@ximian.com>
5221 * expression.cs (ResolveMemberAccess): Remove redundant code.
5222 TypeExpr expressions are always born fully resolved.
5224 * interface.cs (PopulateMethod): Do not lookup the types twice.
5225 We were doing it once during SemanticAnalysis and once during
5228 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
5229 in local variable type definitions, were being returned as a
5230 SimpleName (we decomposed everything into a string), that is
5231 because primary_expression was being used instead of a type in the
5232 grammar (reduce/reduce conflicts).
5234 The part that was wrong is that we converted the expression into a
5235 string (an oversimplification in one hand, compounded with primary
5236 expressions doing string concatenation).
5242 Would return "A.B.C[]" as a SimpleName. This stopped things like
5243 using clauses from working on this particular context. And a type
5244 was being matched directly against "A.B.C[]".
5246 We now use the correct approach, and allow for ComposedCast to be
5247 part of the unary expression. So the "A.B.C []" become a composed
5248 cast of "A.B.C" (as a nested group of MemberAccess with a
5249 SimpleName at the end) plus the rank composition "[]".
5253 2003-04-10 Miguel de Icaza <miguel@ximian.com>
5255 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
5256 for the access level checking.
5258 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
5259 `TypeContainer container', because I kept getting confused when I
5260 was debugging this code.
5262 * expression.cs (Indexers): Instead of tracking getters/setters,
5263 we now track them in parallel. We create one arraylist less, but
5264 most importantly it is possible now for the LValue code to find a
5265 matching get for a set.
5267 (IndexerAccess.DoResolveLValue): Update the code.
5268 GetIndexersForType has been modified already to extract all the
5269 indexers from a type. The code assumed it did not.
5271 Also make the code set the correct return type for the indexer.
5272 This was fixed a long time ago for properties, but was missing for
5273 indexers. It used to be void_type.
5275 (Binary.Emit): Test first for doubles instead of
5276 floats, as they are more common.
5278 (Binary.EmitBranchable): Use the .un version of the branch opcodes
5279 when dealing with floats and the <=, >= operators. This fixes bug
5282 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
5283 to load the array value by emitting a load on the foreach variable
5284 type. This was incorrect.
5286 We now emit the code to load an element using the the array
5287 variable type, and then we emit the conversion operator.
5291 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
5293 * attribute.cs: Avoid allocation of ArrayLists in the common case.
5295 2003-04-09 Miguel de Icaza <miguel@ximian.com>
5297 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
5298 test for protection before we test for signatures.
5300 (MethodSignature.ToString): implement.
5302 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
5303 to the case where we reduced into a LongConstant.
5305 * decl.cs (CheckAccessLevel): If the type is an array, we can not
5306 depend on whether the information is acurrate, because the
5307 Microsoft runtime will always claim that the array type is public,
5308 regardless of the real state.
5310 If the type is a pointer, another problem happens: the type is
5311 reported as non-public in Microsoft.
5313 In both cases we have to call CheckAccessLevel recursively with
5314 the underlying type as the argument to be tested.
5316 2003-04-08 Miguel de Icaza <miguel@ximian.com>
5318 * assign.cs (Assign.Emit): If we are dealing with a compound
5319 assignment expression, we should use the code path that stores the
5320 intermediate result in a temporary value. This fixes #40903.
5322 *expression.cs (Indirection.ToString): Provide ToString method for
5325 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
5327 * class.cs: Null out fields holding references to Block objects so
5328 they can be garbage collected.
5330 * expression.cs (OverloadResolve): Remove unused local.
5332 2003-04-07 Martin Baulig <martin@ximian.com>
5334 * codegen.cs (EmitContext.CurrentFile): New public field.
5335 (EmitContext.Mark): Use the CurrentFile to check whether the
5336 location is in the correct file.
5337 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
5339 2003-04-07 Martin Baulig <martin@ximian.com>
5341 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
5343 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
5344 location. [FIXME: The location argument which gets passed to this
5345 method is sometimes wrong!]
5347 2003-04-07 Nick Drochak <ndrochak@gol.com>
5349 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
5351 2003-04-07 Miguel de Icaza <miguel@ximian.com>
5353 * expression.cs (Indirection.EmitAssign): We were using the
5354 temporary, but returning immediately instead of continuing the
5357 2003-04-06 Martin Baulig <martin@ximian.com>
5359 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
5360 if it's a nested child, but also deriving from the outer class.
5363 * typemanager.cs (IsNestedChildOf): Make this work if it's a
5364 nested child, but also deriving from the outer class. See
5366 (FilterWithClosure): We may access private members of the outer
5367 class if we're a nested child and deriving from the outer class.
5368 (RealMemberLookup): Only set `closure_private_ok' if the
5369 `original_bf' contained BindingFlags.NonPublic.
5371 2003-04-05 Martin Baulig <martin@ximian.com>
5373 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
5374 probe if its a type parameter, and if so, flag an error.
5376 * decl.cs: Move here the SetParameterInfo code from class.cs.
5377 Handle IsGeneric here.
5379 Handle a variety of errors in the parameter info definition.
5381 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
5382 type parameters here.
5384 * cs-parser.jay (class_declaration): report errors for parameters
5387 2003-01-21 Miguel de Icaza <miguel@ximian.com>
5389 * generic.cs: New file, contains support code for generics.
5391 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
5392 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
5394 Update parser for the above removals.
5396 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
5397 now taken care of in the parser.
5399 2003-04-02 Miguel de Icaza <miguel@ximian.com>
5401 * class.cs (Event.Define): Do not allow abstract events to have
5404 2003-04-01 Miguel de Icaza <miguel@ximian.com>
5406 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
5407 block in event declarations.
5409 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
5410 value type, get its address.
5412 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
5413 leaving a class on the stack instead of a boolean value (int
5414 0/1). Change the code so we compare against null, and then the
5415 result against zero.
5417 * class.cs (TypeContainer.GetClassBases): We were checking for the
5418 parent class being sealed too late.
5420 * expression.cs (Binary.Emit): For <= and >= when dealing with
5421 floating point values, use cgt.un and clt.un instead of cgt and
5424 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
5426 * statement.cs: Apply the same optimization as MS: skip the
5427 GetEnumerator returning an IEnumerator, and use the one returning a
5428 CharEnumerator instead. This allows us to avoid the try-finally block
5431 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
5433 * cs-parser.jay: Attributes cannot be applied to
5434 namespaces. Fixes #40473
5436 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5439 (Add*): check if the name is valid using the full name for constants,
5440 fields, properties and events.
5442 2003-03-28 Miguel de Icaza <miguel@ximian.com>
5444 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
5445 char constants to be part of the enumeration.
5447 * expression.cs (Conditional.DoResolve): Add support for operator
5448 true. Implements the missing functionality from 14.12
5450 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
5451 operator true/false as required by the spec.
5453 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
5454 implicit conversion to boolean.
5456 * statement.cs (Statement.ResolveBoolean): A boolean expression is
5457 also one where the type implements `operator true'.
5459 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
5460 get an expression that will invoke operator true based on an
5463 (GetConversionOperators): Removed the hack that called op_True
5466 (Expression.ResolveBoolean): Move this from Statement.
5468 2003-03-17 Miguel de Icaza <miguel@ximian.com>
5470 * ecore.cs (FieldExpr): do not allow initialization of initonly
5471 fields on derived classes
5473 2003-03-13 Martin Baulig <martin@ximian.com>
5475 * statement.cs (Block.Emit): Call ig.BeginScope() and
5476 ig.EndScope() when compiling with debugging info; call
5477 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
5479 2003-03-08 Miguel de Icaza <miguel@ximian.com>
5481 * expression.cs (Indexers): Do not construct immediately, allow
5482 for new members to be appended as we go. Fixes 38143
5484 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5486 * expression.cs: save/restore context when resolving an unchecked
5489 2003-03-05 Miguel de Icaza <miguel@ximian.com>
5491 * cfold.cs: Catch division by zero in modulus operator during
5494 2003-03-03 Miguel de Icaza <miguel@ximian.com>
5496 * interface.cs (Interface.DefineMembers): Avoid defining members
5499 2003-02-27 Miguel de Icaza <miguel@ximian.com>
5501 * driver.cs: handle the +/- options for -noconfig
5503 * statement.cs (Unckeched.Resolve): Also track the state of
5504 unchecked in the Resolve phase.
5506 2003-02-27 Martin Baulig <martin@ximian.com>
5508 * ecore.cs (Expression.MemberLookup): Don't create a
5509 MethodGroupExpr for something which is not a method. Fixes #38291.
5511 2003-02-25 Miguel de Icaza <miguel@ximian.com>
5513 * class.cs (MemberBase.CheckParameters): Also check that the type
5514 is unmanaged if it is a pointer.
5516 * expression.cs (SizeOf.Resolve): Add location information.
5518 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
5519 a managed type is declared.
5521 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
5522 parameter modifiers as well. Fixes bug 38606
5524 * class.cs: Very sad. Am backing out the speed up changes
5525 introduced by the ArrayList -> Array in the TypeContainer, as they
5526 were not actually that much faster, and introduced a bug (no error
5527 reports on duplicated methods).
5529 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
5530 source first, this will guarantee that we have a valid expression
5531 before calling in lower levels functions that will require a
5532 resolved object. Then use this original_source in the
5533 target.ResolveLValue instead of the original source that was
5536 Another change. Use target.Resolve instead of LValueResolve.
5537 Although we are resolving for LValues, we will let the Assign code
5538 take care of that (it will be called again from Resolve). This
5539 basically allows code like this:
5541 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
5542 class Y { void A (X x) { x [0] += o; }
5544 The problem was that the indexer was trying to resolve for
5545 set_Item (idx, object o) and never finding one. The real set_Item
5546 was set_Item (idx, X). By delaying the process we get the right
5551 2003-02-23 Martin Baulig <martin@ximian.com>
5553 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
5554 while calling DoEmit ().
5556 * codegen.cs (EmitContext.Mark): Don't mark locations in other
5557 source files; if you use the #line directive inside a method, the
5558 compiler stops emitting line numbers for the debugger until it
5559 reaches the end of the method or another #line directive which
5560 restores the original file.
5562 2003-02-23 Martin Baulig <martin@ximian.com>
5564 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
5566 2003-02-23 Martin Baulig <martin@ximian.com>
5568 * statement.cs (Block.AddChildVariableNames): We need to call this
5569 recursively, not just for our immediate children.
5571 2003-02-23 Martin Baulig <martin@ximian.com>
5573 * class.cs (Event.Define): Always make the field private, like csc does.
5575 * typemanager.cs (TypeManager.RealMemberLookup): Make events
5576 actually work, fixes bug #37521.
5578 2003-02-23 Miguel de Icaza <miguel@ximian.com>
5580 * delegate.cs: When creating the various temporary "Parameters"
5581 classes, make sure that we call the ComputeAndDefineParameterTypes
5582 on those new parameters (just like we do with the formal ones), to
5583 allow them to be resolved in the context of the DeclSpace.
5585 This fixes the bug that Dick observed in Bugzilla #38530.
5587 2003-02-22 Miguel de Icaza <miguel@ximian.com>
5589 * expression.cs (ResolveMemberAccess): When resolving a constant,
5590 do not attempt to pull a constant if the value was not able to
5591 generate a valid constant.
5593 * const.cs (LookupConstantValue): Do not report more errors than required.
5595 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5597 * expression.cs: fixes bug #38328.
5599 2003-02-18 Miguel de Icaza <miguel@ximian.com>
5601 * class.cs: Changed all the various members that can be part of a
5602 class from being an ArrayList to be an Array of the right type.
5603 During the DefineType type_list, interface_list, delegate_list and
5604 enum_list are turned into types, interfaces, delegates and enums
5607 And during the member population, indexer_list, event_list,
5608 constant_list, field_list, instance_constructor_list, method_list,
5609 operator_list and property_list are turned into their real arrays.
5611 Although we could probably perform this operation earlier, for
5612 good error reporting we need to keep the lists and remove the
5613 lists for longer than required.
5615 This optimization was triggered by Paolo profiling the compiler
5616 speed on the output of `gen-sample-program.pl' perl script.
5618 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
5619 not crash in methods like MemberLookupFailed that use this field.
5621 This problem arises when the compiler fails to resolve a type
5622 during interface type definition for example.
5624 2003-02-18 Miguel de Icaza <miguel@ximian.com>
5626 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
5627 inherit from System.Object, so we have to stop at null, not only
5628 when reaching System.Object.
5630 2003-02-17 Miguel de Icaza <miguel@ximian.com>
5632 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
5633 DeclaredOnly because the parent indexer might have had a different
5634 name, but did not loop until the top of the hierarchy was reached.
5636 The problem this one fixes is 35492: when a class implemented an
5637 indexer from an interface, we were getting the interface method
5638 (which was abstract) and we were flagging an error (can not invoke
5641 This also keeps bug 33089 functioning, and test-148 functioning.
5643 * typemanager.cs (IsSpecialMethod): The correct way of figuring
5644 out if a method is special is to see if it is declared in a
5645 property or event, or whether it is one of the predefined operator
5646 names. This should fix correctly #36804.
5648 2003-02-15 Miguel de Icaza <miguel@ximian.com>
5650 The goal here is to remove the dependency on EmptyCast.Peel ().
5651 Killing it completely.
5653 The problem is that currently in a number of places where
5654 constants are expected, we have to "probe" for an EmptyCast, and
5655 Peel, which is not the correct thing to do, as this will be
5656 repetitive and will likely lead to errors.
5658 The idea is to remove any EmptyCasts that are used in casts that
5659 can be reduced to constants, so we only have to cope with
5662 This bug hunt was triggered by Bug 37363 and the desire to remove
5663 the duplicate pattern where we were "peeling" emptycasts to check
5664 whether they were constants. Now constants will always be
5667 * ecore.cs: Use an enumconstant here instead of wrapping with
5670 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
5671 throwing me off. By handling this we can get rid of a few hacks.
5673 * statement.cs (Switch): Removed Peel() code.
5675 2003-02-14 Miguel de Icaza <miguel@ximian.com>
5677 * class.cs: Location information for error 508
5679 * expression.cs (New.DoResolve): Add a guard against double
5680 resolution of an expression.
5682 The New DoResolve might be called twice when initializing field
5683 expressions (see EmitFieldInitializers, the call to
5684 GetInitializerExpression will perform a resolve on the expression,
5685 and later the assign will trigger another resolution
5687 This leads to bugs (#37014)
5689 * delegate.cs: The signature for EndInvoke should contain any ref
5690 or out parameters as well. We were not doing this in the past.
5692 * class.cs (Field.Define): Do not overwrite the type definition
5693 inside the `volatile' group. Turns out that volatile enumerations
5694 were changing the type here to perform a validity test, which
5697 2003-02-12 Miguel de Icaza <miguel@ximian.com>
5699 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
5700 and structs, we do not want to load the instance variable
5702 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
5703 enum_type has to be handled like an object reference (implicit
5704 conversions exists from this to object), but the regular IsClass
5705 and IsValueType tests will never return true for this one.
5707 Also we use TypeManager.IsValueType instead of type.IsValueType,
5708 just for consistency with the rest of the code (this is only
5709 needed if we ever use the construct exposed by test-180.cs inside
5710 corlib, which we dont today).
5712 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
5714 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
5717 2003-02-09 Martin Baulig <martin@ximian.com>
5719 * namespace.cs (Namespace..ctor): Added SourceFile argument.
5720 (Namespace.DefineNamespaces): New static public method; this is
5721 called when we're compiling with debugging to add all namespaces
5724 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
5725 pass it to the Namespace's .ctor.
5727 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
5728 and MethodBase arguments; pass the namespace ID to the symwriter;
5729 pass the MethodBase instead of the token to the symwriter.
5730 (SymbolWriter.DefineNamespace): New method to add a namespace to
5733 2003-02-09 Martin Baulig <martin@ximian.com>
5735 * symbolwriter.cs: New file. This is a wrapper around
5736 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
5737 methods here in near future.
5739 2003-02-09 Martin Baulig <martin@ximian.com>
5741 * codegen.cs (EmitContext.Mark): Just pass the arguments to
5742 ILGenerator.MarkSequencePoint() which are actually used by the
5745 2003-02-09 Martin Baulig <martin@ximian.com>
5747 * location.cs (SourceFile): New public sealed class. This
5748 contains the name and an index which is used in the location's token.
5749 (Location): Reserve an appropriate number of bits in the token for
5750 the source file instead of walking over that list, this gives us a
5751 really huge performance improvement when compiling with debugging.
5753 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
5754 `SourceFile' argument instead of a string.
5755 (Driver.ProcessFile): Add all the files via Location.AddFile(),
5756 but don't parse/tokenize here, we need to generate the list of all
5757 source files before we do that.
5758 (Driver.ProcessFiles): New static function. Parses/tokenizes all
5761 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
5762 instead of a string.
5764 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
5767 2003-02-09 Martin Baulig <martin@ximian.com>
5769 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
5770 filename on `#line default'.
5772 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
5774 * statement.cs: don't clear the pinned var when the fixed statement
5775 returns from the method (fixes bug#37752).
5777 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
5779 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
5782 2003-02-07 Martin Baulig <martin@ximian.com>
5784 * driver.cs: Removed the `--debug-args' command line argument.
5786 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
5787 automatically by the AsssemblyBuilder.
5788 (CodeGen.InitializeSymbolWriter): We don't need to call any
5789 initialization function on the symbol writer anymore. This method
5790 doesn't take any arguments.
5792 2003-02-03 Miguel de Icaza <miguel@ximian.com>
5794 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
5795 from referenced assemblies as well.
5797 2003-02-02 Martin Baulig <martin@ximian.com>
5799 * class.cs (MethodData.Emit): Generate debugging info for external methods.
5801 2003-02-02 Martin Baulig <martin@ximian.com>
5803 * class.cs (Constructor.Emit): Open the symbol writer before
5804 emitting the constructor initializer.
5805 (ConstructorInitializer.Emit): Call ec.Mark() to allow
5806 single-stepping through constructor initializers.
5808 2003-01-30 Miguel de Icaza <miguel@ximian.com>
5810 * class.cs: Handle error 549: do not allow virtual methods in
5813 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
5815 * decl.cs: Check access levels when resolving types
5817 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
5819 * statement.cs: Add parameters and locals set in catch blocks that might
5820 return to set vector
5822 2003-01-29 Miguel de Icaza <miguel@ximian.com>
5824 * class.cs (Operator): Set the SpecialName flags for operators.
5826 * expression.cs (Invocation.DoResolve): Only block calls to
5827 accessors and operators on SpecialName methods.
5829 (Cast.TryReduce): Handle conversions from char constants.
5832 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
5834 * statement.cs: small memory and time optimization in FlowBranching.
5836 2003-01-28 Pedro Mart <yoros@wanadoo.es>
5838 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
5839 problem that the last fix but in the other sid (Set).
5841 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
5842 access when there is no indexer in the hierarchy.
5844 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
5846 * class.cs: Combine some if statements.
5848 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5850 * driver.cs: fixed bug #37187.
5852 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
5854 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
5855 any indexer, it's needed to build a list with all the indexers in the
5856 hierarchy (AllGetters), else we have problems. Fixes #35653.
5858 2003-01-23 Miguel de Icaza <miguel@ximian.com>
5860 * class.cs (MethodData.Define): It is wrong for an interface
5861 implementation to be static in both cases: explicit and implicit.
5862 We were only handling this in one case.
5864 Improve the if situation there to not have negations.
5866 * class.cs (Field.Define): Turns out that we do not need to check
5867 the unsafe bit on field definition, only on usage. Remove the test.
5869 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5871 * driver.cs: use assembly.Location instead of Codebase (the latest
5872 patch made mcs fail when using MS assemblies).
5874 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
5876 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
5877 get the path to *corlib.dll.
5879 2003-01-21 Nick Drochak <ndrochak@gol.com>
5883 * typemanager.cs: Remove compiler warnings
5885 2003-01-20 Duncan Mak <duncan@ximian.com>
5887 * AssemblyInfo.cs: Bump the version number to 0.19.
5889 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5891 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
5893 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
5895 * class.cs (Constructor::Emit): Emit debugging info for constructors.
5897 2003-01-17 Miguel de Icaza <miguel@ximian.com>
5899 * cs-parser.jay: Small fix: we were not comparing the constructor
5900 name correctly. Thanks to Zoltan for the initial pointer.
5902 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
5904 * cs-tokenizer.cs: Set file name when specified with #line
5906 2003-01-15 Miguel de Icaza <miguel@ximian.com>
5908 * cs-parser.jay: Only perform the constructor checks here if we
5909 are named like the class; This will help provider a better
5910 error. The constructor path is taken when a type definition is
5911 not found, but most likely the user forgot to add the type, so
5912 report that rather than the constructor error.
5914 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
5916 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
5919 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
5921 * cs-parser.jay: Add cleanup call.
5923 2003-01-13 Duncan Mak <duncan@ximian.com>
5925 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
5926 consistent with other methods.
5928 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
5930 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
5932 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
5934 * attribute.cs: only set GuidAttr to true when we have a
5937 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5941 * typemanager.cs: fixes to allow mcs compile corlib with the new
5942 Type.IsSubclassOf fix.
5944 2003-01-08 Miguel de Icaza <miguel@ximian.com>
5946 * expression.cs (LocalVariableReference.DoResolve): Classify a
5947 constant as a value, not as a variable. Also, set the type for
5950 * cs-parser.jay (fixed_statement): take a type instead of a
5951 pointer_type, so we can produce a better error message later.
5953 * statement.cs (Fixed.Resolve): Flag types that are not pointers
5956 (For.DoEmit): Make inifinite loops have a
5957 non-conditional branch back.
5959 (Fixed.DoEmit): First populate the pinned variables, then emit the
5960 statement, then clear the variables. Before I was emitting the
5961 code once for each fixed piece.
5964 2003-01-08 Martin Baulig <martin@ximian.com>
5966 * statement.cs (FlowBranching.MergeChild): A break in a
5967 SWITCH_SECTION does not leave a loop. Fixes #36155.
5969 2003-01-08 Martin Baulig <martin@ximian.com>
5971 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
5972 lives in the same number space than `param_map'. Fixes #36154.
5974 2003-01-07 Miguel de Icaza <miguel@ximian.com>
5976 * cs-parser.jay (constructor_declaration): Set the
5977 Constructor.ModFlags before probing for it. This makes the
5978 compiler report 514, 515 and 132 (the code was there, but got
5981 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
5982 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
5983 (GotoCase.Resolve): Set `Returns' to ALWAYS.
5985 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
5987 * enum.cs: create the enum static fields using the enum type.
5989 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
5991 * class.cs: don't try to create the ParamBuilder for the return
5992 type if it's not needed (and handle it breaking for the ms runtime
5995 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
5997 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
5999 2002-12-29 Miguel de Icaza <miguel@ximian.com>
6001 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
6002 the command. This showed up while compiling the JANET source
6003 code, which used \r as its only newline separator.
6005 2002-12-28 Miguel de Icaza <miguel@ximian.com>
6007 * class.cs (Method.Define): If we are an operator (because it
6008 reuses our code), then set the SpecialName and HideBySig. #36128
6010 2002-12-22 Miguel de Icaza <miguel@ximian.com>
6012 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
6013 exception, report error 120 `object reference required'.
6015 * driver.cs: Add --pause option, used during to measure the size
6016 of the process as it goes with --timestamp.
6018 * expression.cs (Invocation.DoResolve): Do not allow methods with
6019 SpecialName to be invoked.
6021 2002-12-21 Miguel de Icaza <miguel@ximian.com>
6023 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
6024 number before adding it.
6026 2002-12-21 Ravi Pratap <ravi@ximian.com>
6028 * ecore.cs (StandardImplicitConversion): When in an unsafe
6029 context, we allow conversion between void * to any other pointer
6030 type. This fixes bug #35973.
6032 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
6034 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
6035 is not thrown when extensionless outputs are used
6037 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6039 * rootcontext.cs: fixed compilation of corlib.
6041 2002-12-19 Miguel de Icaza <miguel@ximian.com>
6043 * attribute.cs (Attributes.Contains): Add new method.
6045 * class.cs (MethodCore.LabelParameters): if the parameter is an
6046 `out' parameter, check that no attribute `[In]' has been passed.
6048 * enum.cs: Handle the `value__' name in an enumeration.
6050 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
6052 * decl.cs: Added special case to allow overrides on "protected
6055 2002-12-18 Ravi Pratap <ravi@ximian.com>
6057 * attribute.cs (Attributes.AddAttributeSection): Rename to this
6058 since it makes much more sense.
6060 (Attributes.ctor): Don't require a Location parameter.
6062 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
6064 * attribute.cs (ApplyAttributes): Remove extra Location parameters
6065 since we already have that information per attribute.
6067 * everywhere : make appropriate changes.
6069 * class.cs (LabelParameters): Write the code which actually
6070 applies attributes to the return type. We can't do this on the MS
6071 .NET runtime so we flag a warning in the case an exception is
6074 2002-12-18 Miguel de Icaza <miguel@ximian.com>
6076 * const.cs: Handle implicit null conversions here too.
6078 2002-12-17 Ravi Pratap <ravi@ximian.com>
6080 * class.cs (MethodCore.LabelParameters): Remove the extra
6081 Type [] parameter since it is completely unnecessary. Instead
6082 pass in the method's attributes so that we can extract
6083 the "return" attribute.
6085 2002-12-17 Miguel de Icaza <miguel@ximian.com>
6087 * cs-parser.jay (parse): Use Report.Error to flag errors instead
6088 of ignoring it and letting the compile continue.
6090 * typemanager.cs (ChangeType): use an extra argument to return an
6091 error condition instead of throwing an exception.
6093 2002-12-15 Miguel de Icaza <miguel@ximian.com>
6095 * expression.cs (Unary.TryReduce): mimic the code for the regular
6096 code path. Perform an implicit cast in the cases where we can
6097 implicitly convert to one of the integral types, and then reduce
6098 based on that constant. This fixes bug #35483.
6100 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6102 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
6104 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6106 * namespace.cs: fixed bug #35489.
6108 2002-12-12 Miguel de Icaza <miguel@ximian.com>
6110 * class.cs: Remove some dead code.
6112 * cs-parser.jay: Estimate the number of methods needed
6113 (RootContext.MethodCount);
6115 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
6116 numbers instead of StringBuilders.
6118 * support.cs (PtrHashtable): Add constructor with initial size;
6119 We can now reduce reallocations of the method table.
6121 2002-12-10 Ravi Pratap <ravi@ximian.com>
6123 * attribute.cs (ApplyAttributes): Keep track of the emitted
6124 attributes on a per-target basis. This fixes bug #35413.
6126 2002-12-10 Miguel de Icaza <miguel@ximian.com>
6128 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
6129 default to the Windows 1252 encoding.
6131 (UnixParseOption): Support version, thanks to Alp for the missing
6134 * AssemblyInfo.cs: Add nice assembly information.
6136 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
6139 * cs-parser.jay: Allow a trailing comma before the close bracked
6140 in the attribute_section production.
6142 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
6143 address of the instance was being taken, I will take this out,
6144 because we take the address of the object immediately here.
6146 2002-12-09 Ravi Pratap <ravi@ximian.com>
6148 * typemanager.cs (AreMultipleAllowed): Take care of the most
6149 obvious case where attribute type is not in the current assembly -
6152 2002-12-08 Miguel de Icaza <miguel@ximian.com>
6154 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
6155 definitions, instead of doing that afterwards.
6157 Also we use a nice little hack, depending on the constructor, we
6158 know if we are a "composed" name or a simple name. Hence, we
6159 avoid the IndexOf test, and we avoid
6161 * codegen.cs: Add code to assist in a bug reporter to track down
6162 the source of a compiler crash.
6164 2002-12-07 Ravi Pratap <ravi@ximian.com>
6166 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
6167 types have been emitted for a given element and flag an error
6168 if something which does not have AllowMultiple set is used more
6171 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
6172 attribute types and their corresponding AllowMultiple properties
6174 (AreMultipleAllowed): Check the property for a given type.
6176 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
6177 property in the case we have a TypeContainer.
6179 (Attributes.AddAttribute): Detect duplicates and just skip on
6180 adding them. This trivial fix catches a pretty gross error in our
6181 attribute emission - global attributes were being emitted twice!
6183 Bugzilla bug #33187 is now fixed.
6185 2002-12-06 Miguel de Icaza <miguel@ximian.com>
6187 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
6190 * expression.cs (Binary.ResolveOperator): I can only use the
6191 Concat (string, string, string) and Concat (string, string,
6192 string, string) if the child is actually a concatenation of
6195 2002-12-04 Miguel de Icaza <miguel@ximian.com>
6197 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
6198 context where we need a 2-character lookahead.
6200 * pending.cs (PendingImplementation): Rework so we can keep track
6201 of interface types all the time, and flag those which were
6202 implemented by parents as optional.
6204 2002-12-03 Miguel de Icaza <miguel@ximian.com>
6206 * expression.cs (Binary.ResolveOperator): Use
6207 String.Concat(string,string,string) or
6208 String.Concat(string,string,string,string) when possible.
6210 * typemanager: More helper methods.
6213 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
6215 * pending.cs: remove the bogus return from GetMissingInterfaces()
6216 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
6218 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6220 * namespace.cs: avoid duplicated 'using xxx' being added to
6221 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
6222 when we get more than one 'using' statement for the same namespace.
6223 Report a CS0105 warning for it.
6225 2002-11-30 Miguel de Icaza <miguel@ximian.com>
6227 * cs-tokenizer.cs (consume_identifier): use read directly, instead
6228 of calling getChar/putback, uses internal knowledge of it.
6230 (xtoken): Reorder tokenizer so most common patterns are checked
6231 first. This reduces the compilation time in another 5% (from 8.11s
6232 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
6234 The parsing time is 22% of the compilation in mcs, and from that
6235 64% is spent on the tokenization process.
6237 I tried using a binary search for keywords, but this is slower
6238 than the hashtable. Another option would be to do a couple of
6241 * Not use a StringBuilder, instead use an array of chars,
6242 with a set value. Notice that this way we could catch
6243 the 645 error without having to do it *afterwards*.
6245 * We could write a hand-parser to avoid the hashtable
6246 compares altogether.
6248 The identifier consumption process takes 37% of the tokenization
6249 time. Another 15% is spent on is_number. 56% of the time spent
6250 on is_number is spent on Int64.Parse:
6252 * We could probably choose based on the string length to
6253 use Int32.Parse or Int64.Parse and avoid all the 64-bit
6256 Another 3% is spend on wrapping `xtoken' in the `token' function.
6258 Handle 0xa0 as whitespace (#34752)
6260 2002-11-26 Miguel de Icaza <miguel@ximian.com>
6262 * typemanager.cs (IsCLRType): New routine to tell whether a type
6263 is one of the builtin types.
6265 Maybe it needs to use TypeCodes to be faster. Maybe we could use
6266 typecode in more places instead of doing pointer comparissions.
6267 We could leverage some knowledge about the way the typecodes are
6270 New code to cache namespaces in assemblies, it is currently not
6271 invoked, to be used soon.
6273 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
6275 * expression.cs (Binary.ResolveOperator): specially handle
6276 strings, and do not perform user-defined operator overloading for
6279 2002-11-24 Miguel de Icaza <miguel@ximian.com>
6281 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
6282 internalcall as it is a pretty simple operation; Avoid whenever
6283 possible to call Char.IsLetter.
6285 (consume_identifier): Cut by half the number of
6286 hashtable calls by merging the is_keyword and GetKeyword behavior.
6288 Do not short-circuit, because if we do, we
6289 report errors (ie, #if false && true would produce an invalid
6293 2002-11-24 Martin Baulig <martin@ximian.com>
6295 * expression.cs (Cast.TryReduce): If we're in checked syntax,
6296 check constant ranges and report a CS0221. Fixes #33186.
6298 2002-11-24 Martin Baulig <martin@ximian.com>
6300 * cs-parser.jay: Make this work for uninitialized variable
6301 declarations in the `for' initializer. Fixes #32416.
6303 2002-11-24 Martin Baulig <martin@ximian.com>
6305 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
6306 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
6308 2002-11-24 Martin Baulig <martin@ximian.com>
6310 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
6311 argument; if true, we also check for user-defined conversions.
6312 This is only needed if both arguments are of a user-defined type.
6313 Fixes #30443, added test-175.cs.
6314 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
6316 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
6318 2002-11-24 Martin Baulig <martin@ximian.com>
6320 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
6321 function to get the store opcode.
6322 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
6323 only emit the Ldelema if the store opcode is Stobj. You must run
6324 both test-34 and test-167 to test this. Fixes #34529.
6326 2002-11-23 Martin Baulig <martin@ximian.com>
6328 * ecore.cs (Expression.MemberLookup): Added additional
6329 `qualifier_type' argument which is used when we're being called
6330 from MemberAccess.DoResolve() and null if we're called from a
6332 (Expression.MemberLookupFailed): New method to report errors; this
6333 does the CS1540 check and reports the correct error message.
6335 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
6336 argument for the CS1540 check and redone the way how we're dealing
6337 with private members. See the comment in the source code for details.
6338 (FilterWithClosure): Reverted this back to revision 1.197; renamed
6339 `closure_start_type' to `closure_qualifier_type' and check whether
6340 it's not null. It was not this filter being broken, it was just
6341 being called with the wrong arguments.
6343 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
6344 and pass it the correct `qualifier_type'; this also does the error
6347 2002-11-22 Miguel de Icaza <miguel@ximian.com>
6349 * expression.cs (Invocation.EmitParams): If the we are dealing
6350 with a non-built-in value type, load its address as well.
6352 (ArrayCreation): Use a a pretty constant instead
6353 of the hardcoded value 2. Use 6 instead of 2 for the number of
6354 static initializers.
6356 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
6357 because they are not really value types, just glorified integers.
6359 * driver.cs: Do not append .exe, the CSC compiler does not do it.
6361 * ecore.cs: Remove redundant code for enumerations, make them use
6362 the same code path as everything else, fixes the casting issue
6363 with enumerations in Windows.Forms.
6365 * attribute.cs: Do only cast to string if it is a string, the
6366 validation happens later.
6368 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
6369 people upgrade their corlibs.
6371 * ecore.cs: Oops, enumerations were not following the entire code path
6373 2002-11-21 Miguel de Icaza <miguel@ximian.com>
6375 * typemanager.cs (FilterWithClosure): Commented out the test for
6376 1540 in typemanager.cs, as it has problems when accessing
6377 protected methods from a parent class (see test-174.cs).
6379 * attribute.cs (Attribute.ValidateGuid): new method.
6380 (Attribute.Resolve): Use above.
6382 2002-11-19 Miguel de Icaza <miguel@ximian.com>
6384 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
6386 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
6387 handling for enumerations, as we only needed the TypeContainer
6388 functionality to begin with (this is required for the fix below to
6389 work for enums that reference constants in a container class for
6392 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
6394 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
6395 a valid TypeBuilder to perform lookups on.o
6397 * class.cs (InheritableMemberSignatureCompare): Use true in the
6398 call to GetGetMethod and GetSetMethod, because we are comparing
6399 the signature, and we need to get the methods *even* if they are
6402 (PropertyBase.CheckBase): ditto.
6404 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
6405 GotoCase.Resolve): Use Peel on EmpytCasts.
6407 * ecore.cs (EmptyCast): drop child, add Peel method.
6409 2002-11-17 Martin Baulig <martin@ximian.com>
6411 * ecore.cs (EmptyCast.Child): New public property.
6413 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
6414 label resolved to an EmptyCast. Fixes #34162.
6415 (GotoCase.Resolve): Likewise.
6416 (Block.EmitMeta): Likewise.
6418 2002-11-17 Martin Baulig <martin@ximian.com>
6420 * expression.cs (Invocation.BetterConversion): Prefer int over
6421 uint; short over ushort; long over ulong for integer literals.
6422 Use ImplicitConversionExists instead of StandardConversionExists
6423 since we also need to check for user-defined implicit conversions.
6424 Fixes #34165. Added test-173.cs.
6426 2002-11-16 Martin Baulig <martin@ximian.com>
6428 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
6429 with the `true' and `false' literals. Fixes #33151.
6431 2002-11-16 Martin Baulig <martin@ximian.com>
6433 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
6434 October 22nd; don't do the cs1540 check for static members.
6436 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
6437 now using our own filter here and doing the cs1540 check again.
6439 2002-11-16 Martin Baulig <martin@ximian.com>
6441 * support.cs (InternalParameters): Don't crash if we don't have
6442 any fixed parameters. Fixes #33532.
6444 2002-11-16 Martin Baulig <martin@ximian.com>
6446 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
6447 when looking up static methods to make this work on Windows.
6450 2002-11-16 Martin Baulig <martin@ximian.com>
6452 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
6453 a setter rather than using PropertyInfo.CanWrite.
6455 2002-11-15 Nick Drochak <ndrochak@gol.com>
6457 * class.cs: Allow acces to block member by subclasses. Fixes build
6460 2002-11-14 Martin Baulig <martin@ximian.com>
6462 * class.cs (Constructor.Emit): Added the extern/block check.
6465 2002-11-14 Martin Baulig <martin@ximian.com>
6467 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
6468 iteration while looking for indexers, this is needed because the
6469 indexer may have a different name in our base classes. Fixed the
6470 error reporting (no indexers at all, not get accessor, no
6471 overloaded match). Fixes bug #33089.
6472 (IndexerAccess.DoResolveLValue): Likewise.
6474 2002-11-14 Martin Baulig <martin@ximian.com>
6476 * class.cs (PropertyBase.CheckBase): Make this work for multiple
6477 indexers. Fixes the first part of bug #33089.
6478 (MethodSignature.InheritableMemberSignatureCompare): Added support
6481 2002-11-13 Ravi Pratap <ravi@ximian.com>
6483 * attribute.cs (Attribute.Resolve): Catch the
6484 NullReferenceException and report it since it isn't supposed to
6487 2002-11-12 Miguel de Icaza <miguel@ximian.com>
6489 * expression.cs (Binary.EmitBranchable): Also handle the cases for
6490 LogicalOr and LogicalAnd that can benefit from recursively
6491 handling EmitBranchable. The code now should be nice for Paolo.
6493 2002-11-08 Miguel de Icaza <miguel@ximian.com>
6495 * typemanager.cs (LookupType): Added a negative-hit hashtable for
6496 the Type lookups, as we perform quite a number of lookups on
6497 non-Types. This can be removed once we can deterministically tell
6498 whether we have a type or a namespace in advance.
6500 But this might require special hacks from our corlib.
6504 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
6505 and double which avoids a conversion from an integer to a double.
6507 * expression.cs: tiny optimization, avoid calling IsConstant,
6508 because it effectively performs the lookup twice.
6510 2002-11-06 Miguel de Icaza <miguel@ximian.com>
6512 But a bogus return here to keep the semantics of the old code
6513 until the Mono runtime is fixed.
6515 * pending.cs (GetMissingInterfaces): New method used to remove all
6516 the interfaces that are already implemented by our parent
6517 classes from the list of pending methods.
6519 * interface.cs: Add checks for calls after ResolveTypeExpr.
6521 2002-11-05 Miguel de Icaza <miguel@ximian.com>
6523 * class.cs (Class.Emit): Report warning 67: event not used if the
6524 warning level is beyond 3.
6526 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
6527 being a NullLiteral.
6529 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
6532 * class.cs (TypeContainer.GetClassBases): Cover a missing code
6533 path that might fail if a type can not be resolved.
6535 * expression.cs (Binary.Emit): Emit unsigned versions of the
6538 * driver.cs: use error 5.
6540 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
6542 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
6544 2002-11-01 Miguel de Icaza <miguel@ximian.com>
6546 * cs-parser.jay (switch_section): A beautiful patch from Martin
6547 Baulig that fixed 33094.
6549 2002-10-31 Miguel de Icaza <miguel@ximian.com>
6551 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
6552 Check whether the base is abstract and report an error if so.
6554 * expression.cs (IndexerAccess.DoResolveLValue,
6555 IndexerAccess.DoResolve): ditto.
6557 (Invocation.DoResolve): ditto.
6559 (Invocation.FullMethodDesc): Improve the report string.
6561 * statement.cs (Block): Eliminate IsVariableDefined as it is
6562 basically just a wrapper for GetVariableInfo.
6564 * ecore.cs (SimpleName): Use new
6566 * support.cs (ReflectionParamter.ParameterType): We unwrap the
6567 type, as we return the actual parameter ref/unref state on a
6570 2002-10-30 Miguel de Icaza <miguel@ximian.com>
6572 * support.cs: Return proper flags REF/OUT fixing the previous
6575 * expression.cs: Reverted last patch, that was wrong. Is_ref is
6576 not used to mean `ref' but `ref or out' in ParameterReference
6578 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
6579 full type signature instead of calling TypeManger.CSharpName
6582 * support.cs (InternalParameters.ParameterDesc): Do not compare
6583 directly to the modflags, because REF/OUT will actually be bitsets
6586 * delegate.cs (VerifyMethod): Check also the modifiers.
6588 * cs-tokenizer.cs: Fix bug where floating point values with an
6589 exponent where a sign was missing was ignored.
6591 * driver.cs: Allow multiple assemblies to be specified in a single
6594 2002-10-28 Miguel de Icaza <miguel@ximian.com>
6596 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
6597 because identifiers after a parenthesis would end up in this kind
6598 of production, and we needed to desamiguate it for having casts
6601 (UserDefinedType *) xxx
6603 2002-10-24 Miguel de Icaza <miguel@ximian.com>
6605 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
6606 we should set on the Bindingflags.NonPublic, but not turn on
6607 private_ok. private_ok controls whether a Private member is
6608 returned (this is chekced on the filter routine), while the
6609 BindingFlags.NonPublic just controls whether private/protected
6610 will be allowed. This fixes the problem part of the problem of
6611 private properties being allowed to be used in derived classes.
6613 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
6614 so we can call the children DoResolveLValue method (this will
6615 properly signal errors on lvalue assignments to base properties)
6617 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
6618 getter are null, and we have a property info, we know that this
6619 happened because the lookup failed, so we report an error 122 for
6620 protection level violation.
6622 We also silently return if setter and getter are null in the
6623 resolve functions, this condition only happens if we have flagged
6624 the error before. This is the other half of the problem.
6626 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
6627 not have accessibility information, that is why we were returning
6628 true in the filter function in typemanager.cs.
6630 To properly report 122 (property is inaccessible because of its
6631 protection level) correctly, we report this error in ResolveAccess
6632 by failing if both the setter and the getter are lacking (ie, the
6635 DoResolve and DoLResolve have been modified to check for both
6636 setter/getter being null and returning silently, the reason being
6637 that I did not want to put the knowledge about this error in upper
6640 int old = Report.Errors;
6641 x = new PropertyExpr (...);
6642 if (old != Report.Errors)
6647 So the property expr is returned, but it is invalid, so the error
6648 will be flagged during the resolve process.
6650 * class.cs: Remove InheritablePropertySignatureCompare from the
6651 class, as we no longer depend on the property signature to compute
6652 whether it is possible to implement a method or not.
6654 The reason is that calling PropertyInfo.GetGetMethod will return
6655 null (in .NET, in Mono it works, and we should change this), in
6656 cases where the Get Method does not exist in that particular
6661 class X { public virtual int A { get { return 1; } } }
6663 class Z : Y { public override int A { get { return 2; } } }
6665 Would fail in Z because the parent (Y) would not have the property
6666 defined. So we avoid this completely now (because the alternative
6667 fix was ugly and slow), and we now depend exclusively on the
6670 (PropertyBase.CheckBase): Use a method-base mechanism to find our
6671 reference method, instead of using the property.
6673 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
6674 routines are gone now.
6676 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
6677 names, they were incorrectly named.
6679 * cs-tokenizer.cs: Return are more gentle token on failure.
6681 * pending.cs (PendingImplementation.InterfaceMethod): This routine
6682 had an out-of-sync index variable, which caused it to remove from
6683 the list of pending methods the wrong method sometimes.
6685 2002-10-22 Miguel de Icaza <miguel@ximian.com>
6687 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
6688 CanWrite, because those refer to this particular instance of the
6689 property, and do not take into account the fact that we can
6690 override single members of a property.
6692 Constructor requires an EmitContext. The resolution process does
6693 not happen here, but we need to compute the accessors before,
6694 because the resolution does not always happen for properties.
6696 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
6697 subclass, before we did not update this flag, but we did update
6700 (GetAccessors): Drop this routine, as it did not work in the
6701 presence of partially overwritten set/get methods.
6703 Notice that this broke the cs1540 detection, but that will require
6706 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6710 * driver.cs: issue a warning instead of an error if we don't support
6711 debugging for the platform. Also ignore a couple of errors that may
6712 arise when trying to write the symbols. Undo my previous patch.
6714 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6716 * driver.cs: ignore /debug switch except for Unix platforms.
6718 2002-10-23 Nick Drochak <ndrochak@gol.com>
6720 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
6722 2002-10-21 Miguel de Icaza <miguel@ximian.com>
6724 * driver.cs: Do not make mcs-debug conditional, so we do not break
6727 * statement.cs (UsageVector.MergeChildren): I would like Martin to
6728 review this patch. But basically after all the children variables
6729 have been merged, the value of "Breaks" was not being set to
6730 new_breaks for Switch blocks. I think that it should be set after
6731 it has executed. Currently I set this to the value of new_breaks,
6732 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
6733 conservative, but I do not understand this code very well.
6735 I did not break anything in the build, so that is good ;-)
6737 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
6739 2002-10-20 Mark Crichton <crichton@gimp.org>
6741 * cfold.cs: Fixed compile blocker. Really fixed it this time.
6743 2002-10-20 Nick Drochak <ndrochak@gol.com>
6745 * cfold.cs: Fixed compile blocker.
6747 2002-10-20 Miguel de Icaza <miguel@ximian.com>
6749 * driver.cs: I was chekcing the key, not the file.
6751 2002-10-19 Ravi Pratap <ravi@ximian.com>
6753 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
6754 message that we were generating - we just need to silently return
6757 2002-10-19 Miguel de Icaza <miguel@ximian.com>
6759 * class.cs (Event.Define): Change my previous commit, as this
6760 breaks the debugger. This is a temporary hack, as it seems like
6761 the compiler is generating events incorrectly to begin with.
6763 * expression.cs (Binary.ResolveOperator): Added support for
6764 "U operator - (E x, E y)"
6766 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
6769 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
6770 init-only variables, but this path did not take into account that
6771 there might be also instance readonly variables. Correct this
6774 This fixes bug 32253
6776 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
6779 * driver.cs: Change the extension for modules to `netmodule'
6781 * cs-parser.jay: Improved slightly the location tracking for
6782 the debugger symbols.
6784 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
6785 modifiers that were specified instead of the hardcoded value
6786 (FamAndAssem). This was basically ignoring the static modifier,
6787 and others. Fixes 32429.
6789 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
6790 fixed a bug in the process (32476)
6792 * expression.cs (ArrayAccess.EmitAssign): Patch from
6793 hwang_rob@yahoo.ca that fixes bug 31834.3
6795 2002-10-18 Miguel de Icaza <miguel@ximian.com>
6797 * driver.cs: Make the module extension .netmodule.
6799 2002-10-16 Miguel de Icaza <miguel@ximian.com>
6801 * driver.cs: Report an error if the resource file is not found
6802 instead of crashing.
6804 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
6805 false, like Emit does.
6807 2002-10-16 Nick Drochak <ndrochak@gol.com>
6809 * typemanager.cs: Remove unused private member. Also reported mcs
6810 bug to report this as a warning like csc.
6812 2002-10-15 Martin Baulig <martin@gnome.org>
6814 * statement.cs (Statement.Emit): Made this a virtual method; emits
6815 the line number info and calls DoEmit().
6816 (Statement.DoEmit): New protected abstract method, formerly knows
6817 as Statement.Emit().
6819 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
6821 2002-10-11 Miguel de Icaza <miguel@ximian.com>
6823 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
6824 have fixed a remaining problem: not every AddXXXX was adding a
6825 fully qualified name.
6827 Now everyone registers a fully qualified name in the DeclSpace as
6828 being defined instead of the partial name.
6830 Downsides: we are slower than we need to be due to the excess
6831 copies and the names being registered this way.
6833 The reason for this is that we currently depend (on the corlib
6834 bootstrap for instance) that types are fully qualified, because
6835 we dump all the types in the namespace, and we should really have
6836 types inserted into the proper namespace, so we can only store the
6837 basenames in the defined_names array.
6839 2002-10-10 Martin Baulig <martin@gnome.org>
6841 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
6842 from bug #31834, see the bug report for a testcase which is
6845 2002-10-10 Martin Baulig <martin@gnome.org>
6847 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
6848 flow analysis code for this.
6850 * statement.cs (Do, While, For): Tell the flow analysis code about
6852 (FlowBranching.UsageVector): Added support for infinite loops.
6853 (Block.Resolve): Moved the dead code elimination here and use flow
6856 2002-10-09 Miguel de Icaza <miguel@ximian.com>
6858 * class.cs (Field.Define): Catch cycles on struct type
6861 * typemanager.cs (IsUnmanagedtype): Do not recursively check
6862 fields if the fields are static. We only need to check instance
6865 * expression.cs (As.DoResolve): Test for reference type.
6867 * statement.cs (Using.ResolveExpression): Use
6868 ConvertImplicitRequired, not ConvertImplicit which reports an
6870 (Using.ResolveLocalVariableDecls): ditto.
6872 * expression.cs (Binary.ResolveOperator): Report errors in a few
6873 places where we had to.
6875 * typemanager.cs (IsUnmanagedtype): Finish implementation.
6877 2002-10-08 Miguel de Icaza <miguel@ximian.com>
6879 * expression.cs: Use StoreFromPtr instead of extracting the type
6880 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
6882 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
6883 an enumeration value to a System.Enum, but System.Enum is not a
6884 value type, but an class type, so we need to box.
6886 (Expression.ConvertExplicit): One codepath could return
6887 errors but not flag them. Fix this. Fixes #31853
6889 * parameter.cs (Resolve): Do not allow void as a parameter type.
6891 2002-10-06 Martin Baulig <martin@gnome.org>
6893 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
6894 if it's a class type and not a struct. Fixes #31815.
6896 2002-10-06 Martin Baulig <martin@gnome.org>
6898 * statement.cs: Reworked the flow analysis code a bit to make it
6899 usable for dead code elimination.
6901 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6903 * cs-parser.jay: allow empty source files. Fixes bug #31781.
6905 2002-10-04 Miguel de Icaza <miguel@ximian.com>
6907 * expression.cs (ComposedCast.DoResolveType): A quick workaround
6908 to fix the test 165, will investigate deeper.
6910 2002-10-04 Martin Baulig <martin@gnome.org>
6912 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
6913 finally blocks actually work.
6914 (Try.Resolve): We don't need to create a sibling for `finally' if
6915 there is no finally block.
6917 2002-10-04 Martin Baulig <martin@gnome.org>
6919 * class.cs (Constructor.Define): The default accessibility for a
6920 non-default constructor is private, not public.
6922 2002-10-04 Miguel de Icaza <miguel@ximian.com>
6924 * class.cs (Constructor): Make AllowedModifiers public, add
6927 * cs-parser.jay: Perform the modifiers test here, as the
6928 constructor for the Constructor class usually receives a zero
6929 because of the way we create it (first we create, later we
6930 customize, and we were never checking the modifiers).
6932 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
6933 is a version of LookupTypeReflection that includes the type-name
6934 cache. This can be used as a fast path for functions that know
6935 the fully qualified name and are only calling into *.GetType() to
6936 obtain a composed type.
6938 This is also used by TypeManager.LookupType during its type
6941 (LookupType): We now also track the real type name, as sometimes
6942 we can get a quey for the real type name from things like
6943 ComposedCast. This fixes bug 31422.
6945 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
6946 complete type fullname, it does not have to go through the type
6947 resolution system to obtain the composed version of the type (for
6948 obtaining arrays or pointers).
6950 (Conditional.Emit): Use the EmitBoolExpression to
6951 generate nicer code, as requested by Paolo.
6953 (ArrayCreation.CheckIndices): Use the patch from
6954 hwang_rob@yahoo.ca to validate the array initializers.
6956 2002-10-03 Miguel de Icaza <miguel@ximian.com>
6958 * class.cs (ConstructorInitializer.Emit): simplify code by using
6959 Invocation.EmitCall, and at the same time, fix the bugs in calling
6960 parent constructors that took variable arguments.
6962 * ecore.cs (Expression.ConvertNumericExplicit,
6963 Expression.ImplicitNumericConversion): Remove the code that
6964 manually wrapped decimal (InternalTypeConstructor call is now gone
6967 * expression.cs (Cast.TryReduce): Also handle decimal types when
6968 trying to perform a constant fold on the type.
6970 * typemanager.cs (IsUnmanagedtype): Partially implemented.
6972 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
6973 that only turned off an error report, and did nothing else.
6975 2002-10-02 Miguel de Icaza <miguel@ximian.com>
6977 * driver.cs: Handle and ignore /fullpaths
6979 2002-10-01 Miguel de Icaza <miguel@ximian.com>
6981 * expression.cs (Binary.ResolveOperator): Catch the case where
6982 DoNumericPromotions returns true,
6984 (Binary.DoNumericPromotions): Simplify the code, and the tests.
6986 2002-09-27 Miguel de Icaza <miguel@ximian.com>
6988 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
6991 2002-09-26 Miguel de Icaza <miguel@ximian.com>
6993 * ecore.cs (ConvertNumericExplicit): It is not enough that the
6994 conversion exists, but it is also required that the conversion be
6995 performed. This manifested in "(Type64Enum) 2".
6997 * class.cs (TypeManager.AddMethod): The fix is not to change
6998 AddEnum, because that one was using a fully qualified name (every
6999 DeclSpace derivative does), but to change the AddMethod routine
7000 that was using an un-namespaced name. This now correctly reports
7001 the duplicated name.
7003 Revert patch until I can properly fix it. The issue
7004 is that we have a shared Type space across all namespaces
7005 currently, which is wrong.
7007 Options include making the Namespace a DeclSpace, and merge
7008 current_namespace/current_container in the parser.
7010 2002-09-25 Miguel de Icaza <miguel@ximian.com>
7012 * cs-parser.jay: Improve error reporting when we get a different
7013 kind of expression in local_variable_type and
7014 local_variable_pointer_type.
7016 Propagate this to avoid missleading errors being reported.
7018 * ecore.cs (ImplicitReferenceConversion): treat
7019 TypeManager.value_type as a target just like object_type. As
7024 Is valid, and needs to result in the int 1 being boxed before it
7025 is assigned to the value type v.
7027 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
7028 to validate the enumeration name.
7030 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
7031 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
7032 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
7034 * ecore.cs (TryImplicitIntConversion): When doing an
7035 implicit-enumeration-conversion, check if the type is 64-bits and
7036 perform a conversion before passing to EnumConstant.
7038 2002-09-23 Miguel de Icaza <miguel@ximian.com>
7040 * decl.cs (Error_AmbiguousTypeReference); New routine used to
7041 report ambiguous type references. Unlike the MS version, we
7042 report what the ambiguity is. Innovation at work ;-)
7044 (DeclSpace.FindType): Require a location argument to
7045 display when we display an ambiguous error.
7047 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
7049 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
7051 * expression.cs (EmitDynamicInitializers): Apply patch from
7052 hwang_rob@yahoo.ca that fixes the order in which we emit our
7055 2002-09-21 Martin Baulig <martin@gnome.org>
7057 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
7058 delegate takes no arguments.
7060 2002-09-20 Miguel de Icaza <miguel@ximian.com>
7062 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
7065 * expression.cs: Extract the underlying type.
7067 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
7069 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
7071 2002-09-19 Miguel de Icaza <miguel@ximian.com>
7073 * class.cs (TypeContainer.DefineType): We can not use the nice
7074 PackingSize with the size set to 1 DefineType method, because it
7075 will not allow us to define the interfaces that the struct
7078 This completes the fixing of bug 27287
7080 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
7081 means also structs. This fixes part of the problem.
7082 (Expresion.ImplicitReferenceConversionExists): ditto.
7084 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
7085 error if there were no errors reported during the type lookup
7086 process, to avoid duplicates or redundant errors. Without this
7087 you would get an ambiguous errors plus a type not found. We have
7088 beaten the user enough with the first error.
7090 (DeclSparce.FindType): Emit a warning if we have an ambiguous
7093 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
7094 during the resolution process, stop the lookup, this avoids
7095 repeated error reports (same error twice).
7097 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
7099 * typemanager.cs (LookupType): Redo the type lookup code to match
7100 the needs of System.Reflection.
7102 The issue is that System.Reflection requires references to nested
7103 types to begin with a "+" sign instead of a dot. So toplevel
7104 types look like: "NameSpace.TopLevelClass", and nested ones look
7105 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
7108 2002-09-19 Martin Baulig <martin@gnome.org>
7110 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
7111 says that a method always returns or always throws an exception,
7112 don't report the CS0161.
7114 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
7115 set `Returns = new_returns'.
7117 2002-09-19 Martin Baulig <martin@gnome.org>
7119 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
7120 to an enum constant, check for a CS0176.
7122 2002-09-18 Miguel de Icaza <miguel@ximian.com>
7124 * class.cs (TypeContainer.CheckPairedOperators): Now we check
7125 for operators that must be in pairs and report errors.
7127 * ecore.cs (SimpleName.DoResolveType): During the initial type
7128 resolution process, when we define types recursively, we must
7129 check first for types in our current scope before we perform
7130 lookups in the enclosing scopes.
7132 * expression.cs (MakeByteBlob): Handle Decimal blobs.
7134 (Invocation.VerifyArgumentsCompat): Call
7135 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
7136 I thought we were supposed to always call this, but there are a
7137 few places in the code where we dont do it.
7139 2002-09-17 Miguel de Icaza <miguel@ximian.com>
7141 * driver.cs: Add support in -linkres and -resource to specify the
7142 name of the identifier.
7144 2002-09-16 Miguel de Icaza <miguel@ximian.com>
7146 * ecore.cs (StandardConversionExists): Sync with the conversion
7147 code: allow anything-* to void* conversions.
7149 (FindMostSpecificSource): Use an Expression argument
7150 instead of a Type, because we might be handed over a Literal which
7151 gets a few more implicit conversions that plain types do not. So
7152 this information was being lost.
7154 Also, we drop the temporary type-holder expression when not
7157 2002-09-17 Martin Baulig <martin@gnome.org>
7159 * class.cs (PropertyBase.CheckBase): Don't check the base class if
7160 this is an explicit interface implementation.
7162 2002-09-17 Martin Baulig <martin@gnome.org>
7164 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
7165 different `IndexerName' attributes.
7167 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
7168 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
7169 virtual CommonResolve().
7171 2002-09-16 Miguel de Icaza <miguel@ximian.com>
7173 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
7174 and convert that to the UnderlyingType.
7176 * statement.cs (Foreach.Resolve): Indexers are just like variables
7177 or PropertyAccesses.
7179 * cs-tokenizer.cs (consume_string): Track line numbers and columns
7180 inside quoted strings, we were not doing this before.
7182 2002-09-16 Martin Baulig <martin@gnome.org>
7184 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
7185 resolve it. This is needed for the definite assignment check of the
7186 instance expression, fixes bug #29846.
7187 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
7189 2002-09-16 Nick Drochak <ndrochak@gol.com>
7191 * parameter.cs: Fix compile error. Cannot reference static member
7192 from an instance object. Is this an mcs bug?
7194 2002-09-14 Martin Baulig <martin@gnome.org>
7196 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
7197 multiple times. Fixes bug #30295, added test-166.cs.
7199 2002-09-14 Martin Baulig <martin@gnome.org>
7201 * statement.cs (Block.Emit): Don't emit unreachable code.
7202 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
7204 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
7206 2002-09-14 Martin Baulig <martin@gnome.org>
7208 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
7211 2002-09-14 Martin Baulig <martin@gnome.org>
7213 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
7214 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
7215 be false on the ms runtime.
7217 2002-09-13 Martin Baulig <martin@gnome.org>
7219 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
7220 the CS0038 error message.
7222 2002-09-12 Miguel de Icaza <miguel@ximian.com>
7224 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
7225 constant inside, return it.
7227 2002-09-12 Martin Baulig <martin@gnome.org>
7229 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
7230 implicit conversion can be done between enum types.
7232 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
7233 check whether an implicit conversion to the current enum's UnderlyingType
7234 exists and report an error if not.
7236 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
7237 without debugging support.
7239 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
7240 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
7242 2002-09-12 Martin Baulig <martin@gnome.org>
7244 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
7246 * ecore.cs (IMemberExpr.DeclaringType): New property.
7247 (SimpleName.SimpleNameResolve): Check whether we're accessing a
7248 nonstatic member of an outer type (CS0038).
7250 2002-09-11 Miguel de Icaza <miguel@ximian.com>
7252 * driver.cs: Activate the using-error detector at warning level
7253 4 (at least for MS-compatible APIs).
7255 * namespace.cs (VerifyUsing): Small buglett fix.
7257 * pending.cs (PendingImplementation): pass the container pointer.
7259 * interface.cs (GetMethods): Allow for recursive definition. Long
7260 term, I would like to move every type to support recursive
7261 definitions, not the current ordering mechanism that we have right
7264 The situation is this: Attributes are handled before interfaces,
7265 so we can apply attributes to interfaces. But some attributes
7266 implement interfaces, we will now handle the simple cases
7267 (recursive definitions will just get an error).
7269 * parameter.cs: Only invalidate types at the end if we fail to
7272 2002-09-09 Martin Baulig <martin@gnome.org>
7274 * ecore.cs (PropertyExpr.Emit): Also check for
7275 TypeManager.system_int_array_get_length so this'll also work when
7276 compiling corlib. Fixes #30003.
7278 2002-09-09 Martin Baulig <martin@gnome.org>
7280 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
7281 and throw an exception if we can't get the type's size. Fixed #30040,
7284 2002-09-09 Martin Baulig <martin@gnome.org>
7286 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
7288 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
7289 context. Fixes bug #30027.
7291 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
7292 virtual functions. Fixes bug #30043, added test-164.cs.
7294 2002-09-08 Ravi Pratap <ravi@ximian.com>
7296 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
7298 2002-09-08 Nick Drochak <ndrochak@gol.com>
7300 * driver.cs: Use an object to get the windows codepage since it's not a
7303 2002-09-08 Miguel de Icaza <miguel@ximian.com>
7305 * statement.cs (For.Emit): for infinite loops (test == null)
7306 return whether there is a break inside, not always "true".
7308 * namespace.cs (UsingEntry): New struct to hold the name of the
7309 using definition, the location where it is defined, and whether it
7310 has been used in a successful type lookup.
7312 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
7317 2002-09-06 Ravi Pratap <ravi@ximian.com>
7319 * attribute.cs : Fix incorrect code which relied on catching
7320 a NullReferenceException to detect a null being passed in
7321 where an object was expected.
7323 2002-09-06 Miguel de Icaza <miguel@ximian.com>
7325 * statement.cs (Try): flag the catch variable as assigned
7327 * expression.cs (Cast): Simplified by using ResolveType instead of
7330 * statement.cs (Catch): Fix bug by using ResolveType.
7332 2002-09-06 Ravi Pratap <ravi@ximian.com>
7334 * expression.cs (BetterConversion): Special case for when we have
7335 a NullLiteral as the argument and we have to choose between string
7336 and object types - we choose string the way csc does.
7338 * attribute.cs (Attribute.Resolve): Catch the
7339 NullReferenceException and report error #182 since the Mono
7340 runtime no more has the bug and having this exception raised means
7341 we tried to select a constructor which takes an object and is
7344 2002-09-05 Ravi Pratap <ravi@ximian.com>
7346 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
7347 message (1502, 1503) when we can't locate a method after overload
7348 resolution. This is much more informative and closes the bug
7351 * interface.cs (PopulateMethod): Return if there are no argument
7352 types. Fixes a NullReferenceException bug.
7354 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
7355 expressions too. Previously we were checking only in one place for
7356 positional arguments leaving out named arguments.
7358 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
7359 type to the enum type is not allowed. Remove code corresponding to
7362 (ConvertNumericExplicit): Allow explicit conversions from
7363 the underlying type to enum type. This precisely follows the spec
7364 and closes a bug filed by Gonzalo.
7366 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7369 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
7371 2002-09-03 Miguel de Icaza <miguel@ximian.com>
7373 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
7374 it was important that we stored the right value after the
7375 reduction in `converted'.
7377 2002-09-04 Martin Baulig <martin@gnome.org>
7379 * location.cs (Location.SymbolDocument): Use full pathnames for the
7382 2002-08-30 Miguel de Icaza <miguel@ximian.com>
7384 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
7385 of the expression resolve mechanism, because that will catch the
7386 SimpleName error failures.
7388 (Conditional): If we can not resolve the
7389 expression, return, do not crash.
7391 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7394 (location): display token name instead of its number.
7396 2002-08-28 Martin Baulig <martin@gnome.org>
7398 * expression.cs (Binary.ResolveOperator): Don't silently return
7399 but return an error if an operator cannot be applied between two
7402 2002-08-28 Martin Baulig <martin@gnome.org>
7404 * class.cs (Constructor.Define): Set the permission attributes
7405 correctly instead of making all constructors public.
7407 2002-08-28 Martin Baulig <martin@gnome.org>
7409 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
7410 for private members before reporting a CS0103; if we find anything,
7413 2002-08-28 Martin Baulig <martin@gnome.org>
7415 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
7416 to check whether `closure_start_type == closure_invocation_type',
7417 we also need to check whether `m.DeclaringType == closure_invocation_type'
7418 before bypassing the permission checks. We might be accessing
7419 protected/private members from the base class.
7420 (TypeManager.RealMemberLookup): Only set private_ok if private
7421 members were requested via BindingFlags.NonPublic.
7423 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
7425 * expression.cs (MemberAccess.ResolveMemberAccess): Set
7426 MethodGroupExpr.IsExplicitImpl if appropriate.
7427 (Invocation.DoResolve): Don't report the CS0120 for explicit
7428 interface implementations.
7430 2002-08-27 Martin Baulig <martin@gnome.org>
7432 * expression.cs (Invocation.DoResolve): If this is a static
7433 method and we don't have an InstanceExpression, we must report
7436 2002-08-25 Martin Baulig <martin@gnome.org>
7438 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
7439 `==' between a valuetype and an object.
7441 2002-08-25 Miguel de Icaza <miguel@ximian.com>
7443 * ecore.cs (TypeExpr): Provide a ToString method.
7445 2002-08-24 Martin Baulig <martin@gnome.org>
7447 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
7448 now called proggie.dbg and it's a binary file.
7450 2002-08-23 Martin Baulig <martin@gnome.org>
7452 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
7454 2002-08-23 Martin Baulig <martin@gnome.org>
7456 * struct.cs (MyStructInfo.ctor): Make this work with empty
7457 structs; it's not allowed to use foreach() on null.
7459 2002-08-23 Martin Baulig <martin@gnome.org>
7461 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
7462 writer the full pathname of the generated assembly.
7464 2002-08-23 Martin Baulig <martin@gnome.org>
7466 * statements.cs (FlowBranching.UsageVector.MergeChildren):
7467 A `finally' block never returns or breaks; improved handling of
7470 2002-08-23 Martin Baulig <martin@gnome.org>
7472 * statement.cs (Throw.Resolve): Allow `throw null'.
7474 2002-08-23 Martin Baulig <martin@gnome.org>
7476 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
7477 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
7478 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
7479 MemberLookup would return a wrong event if this is an explicit
7480 interface implementation and the class has an event with the same
7483 2002-08-23 Martin Baulig <martin@gnome.org>
7485 * statement.cs (Block.AddChildVariableNames): New public method.
7486 (Block.AddChildVariableName): Likewise.
7487 (Block.IsVariableNameUsedInChildBlock): Likewise.
7488 (Block.AddVariable): Check whether a variable name has already
7489 been used in a child block.
7491 * cs-parser.jay (declare_local_variables): Mark all variable names
7492 from the current block as being used in a child block in the
7495 2002-08-23 Martin Baulig <martin@gnome.org>
7497 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
7498 find the symbol writer.
7500 * driver.cs: csc also allows the arguments to /define being
7501 separated by commas, not only by semicolons.
7503 2002-08-23 Martin Baulig <martin@gnome.org>
7505 * interface.cs (Interface.GetMembers): Added static check for events.
7507 2002-08-15 Martin Baulig <martin@gnome.org>
7509 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
7510 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
7512 * ecore.cs (Expression.MemberLookup): Added documentation and explained
7513 why the MethodData.EmitDestructor() change was necessary.
7515 2002-08-20 Martin Baulig <martin@gnome.org>
7517 * class.cs (TypeContainer.FindMembers): Added static check for events.
7519 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
7521 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
7522 use Type.GetEvents(), not Type.FindMembers().
7524 2002-08-20 Martin Baulig <martin@gnome.org>
7526 * decl.cs (MemberCache): Added a special method cache which will
7527 be used for method-only searched. This ensures that a method
7528 search will return a MethodInfo with the correct ReflectedType for
7531 2002-08-20 Martin Baulig <martin@gnome.org>
7533 * decl.cs (DeclSpace.FindMembers): Made this public.
7535 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7537 * delegate.cs: fixed build on windows.
7538 [FIXME: Filed as bug #29150: MCS must report these errors.]
7540 2002-08-19 Ravi Pratap <ravi@ximian.com>
7542 * ecore.cs (StandardConversionExists): Return a false
7543 if we are trying to convert the void type to anything else
7544 since that is not allowed.
7546 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
7547 we flag error 70 in the event an event is trying to be accessed
7548 directly from outside the declaring type.
7550 2002-08-20 Martin Baulig <martin@gnome.org>
7552 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
7553 MemberCache from typemanager.cs to decl.cs.
7555 2002-08-19 Martin Baulig <martin@gnome.org>
7557 * class.cs (TypeContainer): Implement IMemberContainer.
7558 (TypeContainer.DefineMembers): Create the MemberCache.
7559 (TypeContainer.FindMembers): Do better BindingFlags checking; only
7560 return public members if BindingFlags.Public was given, check
7561 whether members are static.
7563 2002-08-16 Martin Baulig <martin@gnome.org>
7565 * decl.cs (DeclSpace.Define): Splitted this in Define and
7566 DefineMembers. DefineMembers is called first and initializes the
7569 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
7570 DefineMembers() on all our DeclSpaces.
7572 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
7573 but call DefineMembers() on all nested interfaces. We call their
7574 Define() in our new Define() function.
7576 * interface.cs (Interface): Implement IMemberContainer.
7577 (Interface.Define): Moved all code except the attribute stuf to
7579 (Interface.DefineMembers): Initialize the member cache.
7581 * typemanager.cs (IMemberFinder): Removed this interface, we don't
7582 need this anymore since we can use MemberCache.FindMembers directly.
7584 2002-08-19 Martin Baulig <martin@gnome.org>
7586 * typemanager.cs (MemberCache): When creating the cache for an
7587 interface type, add all inherited members.
7588 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
7589 to `out bool used_cache' and documented it.
7590 (TypeManager.MemberLookup): If we already used the cache in the first
7591 iteration, we don't need to do the interfaces check.
7593 2002-08-19 Martin Baulig <martin@gnome.org>
7595 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
7596 here from IMemberFinder and don't implement this interface anymore.
7597 (DeclSpace.MemberCache): Moved here from IMemberFinder.
7599 * typemanager.cs (IMemberFinder): This interface is now only used by
7600 classes which actually support the member cache.
7601 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
7602 since we only put DeclSpaces into this Hashtable.
7603 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
7604 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
7606 2002-08-16 Martin Baulig <martin@gnome.org>
7608 * typemanager.cs (ICachingMemberFinder): Removed.
7609 (IMemberFinder.MemberCache): New property.
7610 (TypeManager.FindMembers): Merged this with RealFindMembers().
7611 This function will never be called from TypeManager.MemberLookup()
7612 so we can't use the cache here, just the IMemberFinder.
7613 (TypeManager.MemberLookup_FindMembers): Check whether the
7614 IMemberFinder has a MemberCache and call the cache's FindMembers
7616 (MemberCache): Rewrote larger parts of this yet another time and
7617 cleaned it up a bit.
7619 2002-08-15 Miguel de Icaza <miguel@ximian.com>
7621 * driver.cs (LoadArgs): Support quoting.
7623 (Usage): Show the CSC-like command line arguments.
7625 Improved a few error messages.
7627 2002-08-15 Martin Baulig <martin@gnome.org>
7629 * typemanager.cs (IMemberContainer.Type): New property.
7630 (IMemberContainer.IsInterface): New property.
7632 The following changes are conditional to BROKEN_RUNTIME, which is
7633 defined at the top of the file.
7635 * typemanager.cs (MemberCache.MemberCache): Don't add the base
7636 class'es members, but add all members from TypeHandle.ObjectType
7637 if we're an interface.
7638 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
7639 is the current type.
7640 (MemberCache.CacheEntry.Container): Removed this field.
7641 (TypeHandle.GetMembers): Include inherited members.
7643 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7645 * typemanager.cs: fixed compilation and added a comment on a field that
7648 2002-08-15 Martin Baulig <martin@gnome.org>
7650 * class.cs (ConstructorInitializer.Resolve): In the
7651 Expression.MemberLookup call, use the queried_type as
7654 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
7655 declared' attribute, it's always true.
7656 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
7657 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
7658 temporary wrapper for FindMembers which tells MemberLookup whether
7659 members from the base classes are included in the return value.
7660 This will go away soon.
7661 (TypeManager.MemberLookup): Use this temporary hack here; once the
7662 new MemberCache is completed, we don't need to do the DeclaredOnly
7663 looping here anymore since the MemberCache will take care of this.
7664 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
7665 (MemberCache): When creating the MemberCache for a class, get
7666 members from the current class and all its base classes.
7667 (MemberCache.CacheEntry.Container): New field. This is a
7668 temporary hack until the Mono runtime is fixed to distinguish
7669 between ReflectedType and DeclaringType. It allows us to use MCS
7670 with both the MS runtime and the unfixed Mono runtime without
7671 problems and without accecting performance.
7672 (MemberCache.SearchMembers): The DeclaredOnly looping from
7673 TypeManager.MemberLookup is now done here.
7675 2002-08-14 Martin Baulig <martin@gnome.org>
7677 * statement.cs (MyStructInfo.MyStructInfo): Don't call
7678 Type.GetFields on dynamic types but get the fields from the
7679 corresponding TypeContainer.
7680 (MyStructInfo.GetStructInfo): Added check for enum types.
7682 * typemanager.cs (MemberList.IsSynchronized): Implemented.
7683 (MemberList.SyncRoot): Implemented.
7684 (TypeManager.FilterWithClosure): No need to check permissions if
7685 closure_start_type == closure_invocation_type, don't crash if
7686 closure_invocation_type is null.
7688 2002-08-13 Martin Baulig <martin@gnome.org>
7690 Rewrote TypeContainer.FindMembers to use a member cache. This
7691 gives us a speed increase of about 35% for the self-hosting MCS
7692 build and of about 15-20% for the class libs (both on GNU/Linux).
7694 * report.cs (Timer): New class to get enhanced profiling. This
7695 whole class is "TIMER" conditional since it remarkably slows down
7698 * class.cs (MemberList): New class. This is an IList wrapper
7699 which we're now using instead of passing MemberInfo[]'s around to
7700 avoid copying this array unnecessarily.
7701 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
7702 (ICachingMemberFinder, IMemberContainer): New interface.
7703 (TypeManager.FilterWithClosure): If `criteria' is null, the name
7704 has already been checked, otherwise use it for the name comparision.
7705 (TypeManager.FindMembers): Renamed to RealMemberFinder and
7706 provided wrapper which tries to use ICachingMemberFinder.FindMembers
7707 if possible. Returns a MemberList, not a MemberInfo [].
7708 (TypeHandle): New class, implements IMemberContainer. We create
7709 one instance of this class per type, it contains a MemberCache
7710 which is used to do the member lookups.
7711 (MemberCache): New class. Each instance of this class contains
7712 all members of a type and a name-based hash table.
7713 (MemberCache.FindMembers): This is our new member lookup
7714 function. First, it looks up all members of the requested name in
7715 the hash table. Then, it walks this list and sorts out all
7716 applicable members and returns them.
7718 2002-08-13 Martin Baulig <martin@gnome.org>
7720 In addition to a nice code cleanup, this gives us a performance
7721 increase of about 1.4% on GNU/Linux - not much, but it's already
7722 half a second for the self-hosting MCS compilation.
7724 * typemanager.cs (IMemberFinder): New interface. It is used by
7725 TypeManager.FindMembers to call FindMembers on a TypeContainer,
7726 Enum, Delegate or Interface.
7727 (TypeManager.finder_to_member_finder): New PtrHashtable.
7728 (TypeManager.finder_to_container): Removed.
7729 (TypeManager.finder_to_delegate): Removed.
7730 (TypeManager.finder_to_interface): Removed.
7731 (TypeManager.finder_to_enum): Removed.
7733 * interface.cs (Interface): Implement IMemberFinder.
7735 * delegate.cs (Delegate): Implement IMemberFinder.
7737 * enum.cs (Enum): Implement IMemberFinder.
7739 * class.cs (TypeContainer): Implement IMemberFinder.
7741 2002-08-12 Martin Baulig <martin@gnome.org>
7743 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
7745 2002-08-12 Martin Baulig <martin@gnome.org>
7747 * ecore.cs (ITypeExpression): New interface for expressions which
7749 (TypeExpression): Renamed to TypeLookupExpression.
7750 (Expression.DoResolve): If we're doing a types-only lookup, the
7751 expression must implement the ITypeExpression interface and we
7752 call DoResolveType() on it.
7753 (SimpleName): Implement the new ITypeExpression interface.
7754 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
7755 hack, the situation that we're only looking up types can't happen
7756 anymore when this method is called. Moved the type lookup code to
7757 DoResolveType() and call it.
7758 (SimpleName.DoResolveType): This ITypeExpression interface method
7759 is now doing the types-only lookup.
7760 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
7761 (ResolveFlags): Added MaskExprClass.
7763 * expression.cs (MemberAccess): Implement the ITypeExpression
7765 (MemberAccess.DoResolve): Added support for a types-only lookup
7766 when we're called via ITypeExpression.DoResolveType().
7767 (ComposedCast): Implement the ITypeExpression interface.
7769 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
7770 Expression.Resolve() with ResolveFlags.Type instead.
7772 2002-08-12 Martin Baulig <martin@gnome.org>
7774 * interface.cs (Interface.Define): Apply attributes.
7776 * attribute.cs (Attribute.ApplyAttributes): Added support for
7777 interface attributes.
7779 2002-08-11 Martin Baulig <martin@gnome.org>
7781 * statement.cs (Block.Emit): Only check the "this" variable if we
7782 do not always throw an exception.
7784 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
7785 whether the property has a set accessor.
7787 2002-08-11 Martin Baulig <martin@gnome.org>
7789 Added control flow analysis support for structs.
7791 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
7792 with control flow analysis turned off.
7793 (IVariable): New interface.
7794 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
7795 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
7796 (FieldExpr.DoResolve): Resolve the instance expression with flow
7797 analysis turned off and do the definite assignment check after the
7798 resolving when we know what the expression will resolve to.
7800 * expression.cs (LocalVariableReference, ParameterReference):
7801 Implement the new IVariable interface, only call the flow analysis
7802 code if ec.DoFlowAnalysis is true.
7803 (This): Added constructor which takes a Block argument. Implement
7804 the new IVariable interface.
7805 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
7806 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
7807 This does the definite assignment checks for struct members.
7809 * class.cs (Constructor.Emit): If this is a non-static `struct'
7810 constructor which doesn't have any initializer, call
7811 Block.AddThisVariable() to tell the flow analysis code that all
7812 struct elements must be initialized before control returns from
7815 * statement.cs (MyStructInfo): New public class.
7816 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
7817 argument to this indexer. If non-zero, check an individual struct
7818 member, not the whole struct.
7819 (FlowBranching.CheckOutParameters): Check struct members.
7820 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
7821 overloaded versions of these methods which take an additional
7822 `int field_idx' argument to check struct members.
7823 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
7824 overloaded versions of these methods which take an additional
7825 `string field_name' argument to check struct member.s
7826 (VariableInfo): Implement the IVariable interface.
7827 (VariableInfo.StructInfo): New public property. Returns the
7828 MyStructInfo instance of the variable if it's a struct or null.
7829 (Block.AddThisVariable): New public method. This is called from
7830 Constructor.Emit() for non-static `struct' constructor which do
7831 not have any initializer. It creates a special variable for the
7832 "this" instance variable which will be checked by the flow
7833 analysis code to ensure that all of the struct's fields are
7834 initialized before control returns from the constructor.
7835 (UsageVector): Added support for struct members. If a
7836 variable/parameter is a struct with N members, we reserve a slot
7837 in the usage vector for each member. A struct is considered fully
7838 initialized if either the struct itself (slot 0) or all its
7839 members are initialized.
7841 2002-08-08 Martin Baulig <martin@gnome.org>
7843 * driver.cs (Driver.MainDriver): Only report an error CS5001
7844 if there were no compilation errors.
7846 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
7847 `UnsafeContext' property to determine whether the parent is in
7848 unsafe context rather than checking the parent's ModFlags:
7849 classes nested in an unsafe class are unsafe as well.
7851 2002-08-08 Martin Baulig <martin@gnome.org>
7853 * statement.cs (UsageVector.MergeChildren): Distinguish between
7854 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
7855 we return. Added test17() and test18() to test-154.cs.
7857 2002-08-08 Martin Baulig <martin@gnome.org>
7859 * typemanager.cs (TypeManager.FilterWithClosure): If we have
7860 Family access, make sure the invoking type isn't a subclass of the
7861 queried type (that'd be a CS1540).
7863 * ecore.cs (Expression.MemberLookup): Added overloaded version of
7864 this method which takes an additional `Type invocation_type'.
7866 * expression.cs (BaseAccess.DoResolve): Use the base type as
7867 invocation and query type.
7868 (MemberAccess.DoResolve): If the lookup failed and we're about to
7869 report a CS0122, try a lookup with the ec.ContainerType - if this
7870 succeeds, we must report a CS1540.
7872 2002-08-08 Martin Baulig <martin@gnome.org>
7874 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
7875 (MethodGroupExpr): Implement the IMemberExpr interface.
7877 * expression (MemberAccess.ResolveMemberAccess): No need to have
7878 any special code for MethodGroupExprs anymore, they're now
7881 2002-08-08 Martin Baulig <martin@gnome.org>
7883 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
7884 Family, FamANDAssem and FamORAssem permissions.
7885 (TypeManager.IsSubclassOrNestedChildOf): New public method.
7887 2002-08-08 Martin Baulig <martin@gnome.org>
7889 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
7890 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
7893 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
7895 * driver.cs: implemented /resource option to embed managed resources.
7897 2002-08-07 Martin Baulig <martin@gnome.org>
7899 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
7900 (FieldBase.HasFieldInitializer): New public property.
7901 (FieldBase.GetInitializerExpression): New public method. Resolves and
7902 returns the field initializer and makes sure it is only resolved once.
7903 (TypeContainer.EmitFieldInitializers): Call
7904 FieldBase.GetInitializerExpression to get the initializer, this ensures
7905 that it isn't resolved multiple times.
7907 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
7908 the resolving process (SimpleName/MemberLookup) that we're currently
7909 emitting a field initializer (which must not access any instance members,
7910 this is an error CS0236).
7912 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
7913 argument, if the `IsFieldInitializer' flag is set, we must report and
7914 error CS0236 and not an error CS0120.
7916 2002-08-07 Martin Baulig <martin@gnome.org>
7918 * ecore.cs (IMemberExpr): New public interface.
7919 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
7920 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
7921 if the expression is an IMemberExpr.
7923 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
7924 to be null, implicitly default to `this' if we're non-static in
7925 this case. Simplified the code a lot by using the new IMemberExpr
7926 interface. Also fixed bug #28176 here.
7928 2002-08-06 Martin Baulig <martin@gnome.org>
7930 * cs-parser.jay (SimpleLookup): Removed. We need to create
7931 ParameterReferences during semantic analysis so that we can do a
7932 type-only search when resolving Cast, TypeOf and SizeOf.
7933 (block): Pass the `current_local_parameters' to the Block's
7936 * class.cs (ConstructorInitializer): Added `Parameters parameters'
7937 argument to the constructor.
7938 (ConstructorInitializer.Resolve): Create a temporary implicit
7939 block with the parameters.
7941 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
7942 references here if we aren't doing a type-only search.
7944 * statement.cs (Block): Added constructor which takes a
7945 `Parameters parameters' argument.
7946 (Block.Parameters): New public property.
7948 * support.cs (InternalParameters.Parameters): Renamed `parameters'
7949 to `Parameters' and made it public readonly.
7951 2002-08-06 Martin Baulig <martin@gnome.org>
7953 * ecore.cs (Expression.Warning): Made this public as well.
7955 * report.cs (Report.Debug): Print the contents of collections.
7957 2002-08-06 Martin Baulig <martin@gnome.org>
7959 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
7960 used to tell Resolve() which kinds of expressions it may return.
7961 (Expression.Resolve): Added overloaded version of this method which
7962 takes a `ResolveFlags flags' argument. This can be used to tell
7963 Resolve() which kinds of expressions it may return. Reports a
7965 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
7966 ResolveFlags.SimpleName.
7967 (Expression.Error118): Added overloaded version of this method which
7968 takes a `ResolveFlags flags' argument. It uses the flags to determine
7969 which kinds of expressions are allowed.
7971 * expression.cs (Argument.ResolveMethodGroup): New public method.
7972 Resolves an argument, but allows a MethodGroup to be returned.
7973 This is used when invoking a delegate.
7975 * TODO: Updated a bit.
7977 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7979 Fixed compilation with csc.
7981 * ecore.cs: Expression.Error made public. Is this correct? Should
7982 Warning be made public too?
7984 * expression.cs: use ea.Location instead of ea.loc.
7985 [FIXME: Filed as bug #28607: MCS must report these errors.]
7987 2002-08-06 Martin Baulig <martin@gnome.org>
7989 * ecore.cs (Expression.loc): Moved the location here instead of
7990 duplicating it in all derived classes.
7991 (Expression.Location): New public property.
7992 (Expression.Error, Expression.Warning): Made them non-static and
7993 removed the location argument.
7994 (Expression.Warning): Added overloaded version which takes an
7995 `int level' argument.
7996 (Expression.Error118): Make this non-static and removed the
7997 expression and location arguments.
7998 (TypeExpr): Added location argument to the constructor.
8000 * expression.cs (StaticCallExpr): Added location argument to
8002 (Indirection, PointerArithmetic): Likewise.
8003 (CheckedExpr, UnCheckedExpr): Likewise.
8004 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
8005 (StringPtr): Likewise.
8008 2002-08-05 Martin Baulig <martin@gnome.org>
8010 * expression.cs (BaseAccess.DoResolve): Actually report errors.
8012 * assign.cs (Assign.DoResolve): Check whether the source
8013 expression is a value or variable.
8015 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
8016 while resolving the corresponding blocks.
8018 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
8019 an error, don't silently return null.
8021 * statement.cs (Block.AddVariable): Do the error reporting here
8022 and distinguish between CS0128 and CS0136.
8023 (Block.DoResolve): Report all unused labels (warning CS0164).
8024 (LabeledStatement): Pass the location to the constructor.
8025 (LabeledStatement.HasBeenReferenced): New property.
8026 (LabeledStatement.Resolve): Set it to true here.
8028 * statement.cs (Return.Emit): Return success even after reporting
8029 a type mismatch error (CS0126 or CS0127), this is what csc does and
8030 it avoids confusing the users with any consecutive errors.
8032 2002-08-05 Martin Baulig <martin@gnome.org>
8034 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
8036 * const.cs (Const.LookupConstantValue): Catch circular definitions.
8038 * expression.cs (MemberAccess.DoResolve): Silently return if an
8039 error has already been reported.
8041 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
8042 error has already been reported.
8044 2002-08-05 Martin Baulig <martin@gnome.org>
8046 * statement.cs (UsageVector): Only initialize the `parameters'
8047 vector if we actually have any "out" parameters.
8049 2002-08-05 Martin Baulig <martin@gnome.org>
8051 * expression.cs (Binary.ResolveOperator): When combining delegates,
8052 they must have the same type.
8054 2002-08-05 Martin Baulig <martin@gnome.org>
8056 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
8057 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
8058 work with the ms runtime and we also don't need it: if we're a
8059 PropertyBuilder and not in the `indexer_arguments' hash, then we
8060 are a property and not an indexer.
8062 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
8063 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
8064 since the latter one doesn't work with the ms runtime.
8066 2002-08-03 Martin Baulig <martin@gnome.org>
8068 Fixed bugs #27998 and #22735.
8070 * class.cs (Method.IsOperator): New public field.
8071 (Method.CheckBase): Report CS0111 if there's already a method
8072 with the same parameters in the current class. Report CS0508 when
8073 attempting to change the return type of an inherited method.
8074 (MethodData.Emit): Report CS0179 if a method doesn't have a body
8075 and it's not marked abstract or extern.
8076 (PropertyBase): New abstract base class for Property and Indexer.
8077 (PropertyBase.CheckBase): Moved here from Property and made it work
8079 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
8080 the same so we can reuse it there.
8081 (Property, Indexer): Derive from PropertyBase.
8082 (MethodSignature.inheritable_property_signature_filter): New delegate
8083 to find properties and indexers.
8085 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
8086 argument and improved error reporting.
8088 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
8089 EmptyReadOnlyParameters and made it a property.
8091 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
8092 version of this method which takes a `PropertyInfo indexer'.
8093 (TypeManager.RegisterIndexer): New method.
8095 * class.cs: Added myself as author of this file :-)
8097 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8099 * class.cs: fixed compilation on windoze.
8101 2002-08-03 Martin Baulig <martin@gnome.org>
8103 * interface.cs (Interface.GetInterfaceBases): Check whether all
8104 base interfaces are at least as accessible than the current one.
8106 * class.cs (TypeContainer.GetClassBases): Check whether base types
8107 are at least as accessible than the current type.
8108 (TypeContainer.AsAccessible): Implemented and made non-static.
8109 (MemberBase.CheckParameters): Report errors if the accessibility
8112 * delegate.cs (Delegate.Delegate): The default visibility is
8113 internal for top-level types and private for nested types.
8114 (Delegate.Define): Report errors if the accessibility checks fail.
8116 * enum.cs (Enum.Enum): The default visibility is internal for
8117 top-level types and private for nested types.
8118 (Enum.DefineType): Compute the correct visibility.
8120 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
8121 function which takes a `bool is_toplevel' instead of a TypeContainer.
8123 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
8126 2002-08-02 Martin Baulig <martin@gnome.org>
8128 * expression.cs (LocalVariableReferenc): Added constructor which
8129 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
8130 (LocalVariableReference.IsReadOnly): New property.
8131 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
8132 variable is readonly, use our own readonly flag to do this; you can
8133 use the new constructor to get a writable reference to a read-only
8136 * cs-parser.jay (foreach_statement, using_statement): Get a writable
8137 reference to the local variable.
8139 2002-08-01 Miguel de Icaza <miguel@ximian.com>
8141 * rootcontext.cs (ResolveCore): Also include System.Exception
8143 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
8144 we reach an EmptyStatement.
8146 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
8149 * expression.cs (Binary.ResolveOperator): Check error result in
8152 use brtrue/brfalse directly and avoid compares to null.
8154 2002-08-02 Martin Baulig <martin@gnome.org>
8156 * class.cs (TypeContainer.Define): Define all nested interfaces here.
8157 Fixes bug #28407, added test-155.cs.
8159 2002-08-01 Martin Baulig <martin@gnome.org>
8161 * class.cs (Event.EmitDefaultMethod): Make this work with static
8162 events. Fixes #28311, added verify-3.cs.
8164 2002-08-01 Martin Baulig <martin@gnome.org>
8166 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
8167 `is_disposable' fields.
8168 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
8169 `hm.is_disposable' if we're using the collection pattern.
8170 (Foreach.EmitCollectionForeach): Use the correct type for the
8171 enumerator's local variable, only emit the try/finally block if
8172 necessary (fixes #27713).
8174 2002-08-01 Martin Baulig <martin@gnome.org>
8176 * ecore.cs (Expression.report118): Renamed to Error118 and made
8179 * statement.cs (Throw.Resolve): Check whether the expression is of
8180 the correct type (CS0118) and whether the type derives from
8181 System.Exception (CS0155).
8182 (Catch.Resolve): New method. Do the type lookup here and check
8183 whether it derives from System.Exception (CS0155).
8184 (Catch.CatchType, Catch.IsGeneral): New public properties.
8186 * typemanager.cs (TypeManager.exception_type): Added.
8188 2002-07-31 Miguel de Icaza <miguel@ximian.com>
8190 * driver.cs: Updated About function.
8192 2002-07-31 Martin Baulig <martin@gnome.org>
8194 Implemented Control Flow Analysis.
8196 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
8197 (EmitContext.CurrentBranching): Added.
8198 (EmitContext.StartFlowBranching): Added.
8199 (EmitContext.EndFlowBranching): Added.
8200 (EmitContext.KillFlowBranching): Added.
8201 (EmitContext.IsVariableAssigned): Added.
8202 (EmitContext.SetVariableAssigned): Added.
8203 (EmitContext.IsParameterAssigned): Added.
8204 (EmitContext.SetParameterAssigned): Added.
8205 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
8206 Added control flow analysis stuff here.
8208 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
8209 resolve the expression as lvalue.
8210 (LocalVariableReference.DoResolve): Check whether the variable has
8211 already been assigned.
8212 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
8213 the parameter as assigned here.
8214 (ParameterReference.DoResolve): Check whether the parameter has already
8216 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
8217 expression as lvalue.
8219 * statement.cs (FlowBranching): New class for the flow analysis code.
8220 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
8221 (LabeledStatement.IsDefined): New public property.
8222 (LabeledStatement.AddUsageVector): New public method to tell flow
8223 analyis that the label may be reached via a forward jump.
8224 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
8226 (VariableInfo.Number): New public field. This is used by flow analysis
8227 to number all locals of a block.
8228 (Block.CountVariables): New public property. This is the number of
8229 local variables in this block (including the locals from all parent
8231 (Block.EmitMeta): Number all the variables.
8233 * statement.cs: Added flow analysis support to all classes.
8235 2002-07-31 Martin Baulig <martin@gnome.org>
8237 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
8238 To get debugging messages, compile mcs with /define:MCS_DEBUG and
8239 then use this argument.
8241 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
8243 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
8244 use this to specify /define options.
8246 2002-07-29 Martin Baulig <martin@gnome.org>
8248 * statement.cs (Fixed): Moved all code that does variable lookups
8249 and resolvings from Emit to Resolve.
8251 * statement.cs (For): Moved all code that does variable lookups
8252 and resolvings from Emit to Resolve.
8254 * statement.cs (Using): Moved all code that does variable lookups
8255 and resolvings from Emit to Resolve.
8257 2002-07-29 Martin Baulig <martin@gnome.org>
8259 * attribute.cs (Attribute.Resolve): Explicitly catch a
8260 System.NullReferenceException when creating the
8261 CustromAttributeBuilder and report a different warning message.
8263 2002-07-29 Martin Baulig <martin@gnome.org>
8265 * support.cs (ParameterData.ParameterName): Added method to
8266 get the name of a parameter.
8268 * typemanager.cs (TypeManager.IsValueType): New public method.
8270 2002-07-29 Martin Baulig <martin@gnome.org>
8272 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
8273 is a flag which specifies that it's either ref or out.
8274 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
8275 the out parameter to `out Parameter.Modifier mod', also set the
8276 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
8278 * support.cs (InternalParameters.ParameterModifier): Distinguish
8279 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8280 Parameter.Modifier.ISBYREF flag if it's either ref or out.
8282 * expression.cs (Argument.GetParameterModifier): Distinguish
8283 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8284 Parameter.Modifier.ISBYREF flag if it's either ref or out.
8286 2002-07-29 Martin Baulig <martin@gnome.org>
8288 * expression.cs (ParameterReference.ParameterReference): Added
8289 `Location loc' argument to the constructor.
8291 * cs-parser.jay: Pass location to ParameterReference.
8293 2002-07-28 Miguel de Icaza <miguel@ximian.com>
8295 * statement.cs (Try): Initialize the location.
8297 * cs-parser.jay: pass location to Try.
8299 * expression.cs (Unary.Reduce): Change the prototype to return
8300 whether a constant fold could be performed or not. The result is
8301 returned in an out parameters. In the case of Indirection and
8302 AddressOf, we want to perform the full tests.
8304 2002-07-26 Miguel de Icaza <miguel@ximian.com>
8306 * statement.cs (Statement.Emit): Flag dead code.
8308 2002-07-27 Andrew Birkett <andy@nobugs.org>
8310 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
8312 2002-07-27 Martin Baulig <martin@gnome.org>
8314 * class.cs (MethodData.Define): Put back call to
8315 TypeManager.AddMethod(), accidentally commented this out.
8317 * report.cs (Debug): New public method to print debugging information,
8318 this is `[Conditional ("DEBUG")]'.
8320 2002-07-26 Martin Baulig <martin@gnome.org>
8322 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
8323 (switch_statement): Push the current_block to the switch_stack and
8324 pop it again when we're done with the switch.
8325 (switch_section): The new block is a child of the current_block.
8326 Fixes bug #24007, added test-152.cs.
8328 2002-07-27 Martin Baulig <martin@gnome.org>
8330 * expression.cs (Invocation.EmitArguments): When calling a varargs
8331 function with only its fixed arguments, we need to pass an empty
8334 2002-07-27 Martin Baulig <martin@gnome.org>
8336 Mono 0.13 has been released.
8338 2002-07-25 Miguel de Icaza <miguel@ximian.com>
8340 * driver.cs: Rename --resource to --linkres, because that is what
8341 we do currently, we dont support --resource yet.
8343 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
8345 2002-07-25 Martin Baulig <martin@gnome.org>
8347 * class.cs (MethodData): New public class. This is a `method builder'
8348 class for a method or one accessor of a Property/Indexer/Event.
8349 (MethodData.GetMethodFlags): Moved here from MemberBase.
8350 (MethodData.ApplyAttributes): Likewise.
8351 (MethodData.ApplyObsoleteAttribute): Likewise.
8352 (MethodData.ApplyConditionalAttribute): Likewise.
8353 (MethodData.ApplyDllImportAttribute): Likewise.
8354 (MethodData.CheckAbstractAndExternal): Likewise.
8355 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
8356 (MethodData.Emit): Formerly known as Method.Emit().
8357 (MemberBase): Moved everything which was specific to a single
8358 accessor/method to MethodData.
8359 (Method): Create a new MethodData and call Define() and Emit() on it.
8360 (Property, Indexer, Event): Create a new MethodData objects for each
8361 accessor and call Define() and Emit() on them.
8363 2002-07-25 Martin Baulig <martin@gnome.org>
8365 Made MethodCore derive from MemberBase to reuse the code from there.
8366 MemberBase now also checks for attributes.
8368 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
8369 (MemberBase.GetMethodFlags): Moved here from class Method and marked
8371 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
8372 `CallingConventions cc' and `Attributes opt_attrs' arguments.
8373 (MemberBase.ApplyAttributes): New virtual method; applies the
8374 attributes to a method or accessor.
8375 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
8376 (MemberBase.ApplyConditionalAttribute): Likewise.
8377 (MemberBase.ApplyDllImportAttribute): Likewise.
8378 (MemberBase.CheckAbstractAndExternal): Likewise.
8379 (MethodCore.ParameterTypes): This is now a property instead of a
8380 method, it's initialized from DoDefineParameters().
8381 (MethodCore.ParameterInfo): Removed the set accessor.
8382 (MethodCore.DoDefineParameters): New protected virtual method to
8383 initialize ParameterTypes and ParameterInfo.
8384 (Method.GetReturnType): We can now simply return the MemberType.
8385 (Method.GetMethodFlags): Override the MemberBase version and add
8386 the conditional flags.
8387 (Method.CheckBase): Moved some code from Define() here, call
8388 DoDefineParameters() here.
8389 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
8390 here to avoid some larger code duplication.
8391 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
8392 ensure that abstract and external accessors don't declare a body.
8394 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
8395 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
8396 lookup in the attribute's parent classes, so we need to abort as soon
8397 as we found the first match.
8398 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
8399 the attribute has no arguments.
8401 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
8404 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8406 * cs-parser.jay: reverted previous patch.
8408 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8410 * cs-parser.jay: fixed bug #22119.
8412 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8414 * attribute.cs: fixed compilation. The error was:
8415 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
8416 be assigned to before control leaves the current method."
8417 [FIXME: Filed as bug #28186: MCS must report this error.]
8419 2002-07-25 Martin Baulig <martin@gnome.org>
8421 * attribute.cs (Attribute.Conditional_GetConditionName): New static
8422 method to pull the condition name ouf of a Conditional attribute.
8423 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
8424 the obsolete message and error flag out of an Obsolete attribute.
8426 * class.cs (Method.GetMethodFlags): New public method to get the
8427 TypeManager.MethodFlags for this method.
8428 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
8430 (Method.Define): Get and apply the Obsolete and Conditional attributes;
8431 if we're overriding a virtual function, set the new private variable
8432 `parent_method'; call the new TypeManager.AddMethod().
8434 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
8435 the MethodBuilder and the Method in a PtrHashtable.
8436 (TypeManager.builder_to_method): Added for this purpose.
8437 (TypeManager.MethodFlags): Added IsObsoleteError.
8438 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
8439 Obsolete and Conditional arguments in MethodBuilders. If we discover
8440 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
8441 the message from the attribute.
8443 2002-07-24 Martin Baulig <martin@gnome.org>
8445 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
8446 preprocessor directives, ensure that the argument to #define/#undef is
8447 exactly one identifier and that it's actually an identifier.
8449 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
8452 2002-07-24 Martin Baulig <martin@gnome.org>
8454 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
8455 initialize it to TypeManager.object_type in the constructor.
8456 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
8457 of the `hm.get_current' method if we're using the collection pattern.
8458 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
8459 for the explicit conversion to make it work when we're using the collection
8460 pattern and the `Current' property has a different return type than `object'.
8463 2002-07-24 Martin Baulig <martin@gnome.org>
8465 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
8466 does not match, but don't report any errors. This method is called in
8467 order for all methods in a MethodGroupExpr until a matching method is
8468 found, so we don't want to bail out if the first method doesn't match.
8469 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
8470 matches, report the 123. Fixes #28070.
8472 2002-07-24 Martin Baulig <martin@gnome.org>
8474 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
8475 TypeManager.TypeToCoreType() to the top of the method so the
8476 following equality checks will work. Fixes #28107.
8478 2002-07-24 Martin Baulig <martin@gnome.org>
8480 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
8481 operand is of type uint, and the other operand is of type sbyte,
8482 short or int, the operands are converted to type long." -
8483 Actually do what this comment already told us. Fixes bug #28106,
8486 2002-07-24 Martin Baulig <martin@gnome.org>
8488 * class.cs (MethodBase): New abstract class. This is now a base
8489 class for Property, Indexer and Event to avoid some code duplication
8490 in their Define() and DefineMethods() methods.
8491 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
8492 generic methods for Define() and DefineMethods().
8493 (FieldBase): Derive from MemberBase, not MemberCore.
8494 (Property): Derive from MemberBase, not MemberCore.
8495 (Property.DefineMethod): Moved all the code from this method to the
8496 new MethodBase.DefineAccessor(), just call it with appropriate
8498 (Property.Define): Call the new Property.DoDefine(), this does some
8499 sanity checks and we don't need to duplicate the code everywhere.
8500 (Event): Derive from MemberBase, not MemberCore.
8501 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
8502 accessors, this will also make them work with interface events.
8503 (Indexer): Derive from MemberBase, not MemberCore.
8504 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
8505 (Indexer.Define): Use the new MethodBase functions.
8507 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
8508 argument to the constructor.
8509 (Interface.FindMembers): Added support for interface events.
8510 (Interface.PopluateEvent): Implemented.
8512 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
8514 2002-07-22 Miguel de Icaza <miguel@ximian.com>
8516 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
8517 but this is required to check for a method name being the same as
8518 the containing class.
8522 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8524 * interface.cs: initialize variable.
8526 2002-07-23 Martin Baulig <martin@gnome.org>
8528 Implemented the IndexerName attribute in interfaces.
8530 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
8531 name if this is an explicit interface implementation.
8532 (Indexer.InterfaceIndexerName): New public variable. If we're
8533 implementing an interface indexer, this is the IndexerName in that
8534 interface. Otherwise, it's the IndexerName.
8535 (Indexer.DefineMethod): If we're implementing interface indexer,
8536 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
8537 and Pending.ImplementIndexer methods.
8538 (Indexer.Define): Also define the PropertyBuilder if we're
8539 implementing an interface indexer and this is neither an explicit
8540 interface implementation nor do the IndexerName match the one in
8543 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
8544 If a method is defined here, then we always need to create a proxy
8545 for it. This is used when implementing interface indexers.
8546 (Pending.IsInterfaceIndexer): New public method.
8547 (Pending.ImplementIndexer): New public method.
8548 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
8549 This is used when implementing interface indexers to define a proxy
8551 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
8552 define a proxy if necessary.
8554 * interface.cs (Interface.IndexerName): New public variable.
8555 (Interface.PopulateIndexer): Set the IndexerName.
8556 (Interface.DefineIndexers): New private method. Populate all the
8557 indexers and make sure their IndexerNames match.
8559 * typemanager.cs (IndexerPropertyName): Added support for interface
8562 2002-07-22 Martin Baulig <martin@gnome.org>
8564 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
8565 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
8566 ret if HasReturnLabel.
8567 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
8570 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
8571 and set the ec.LoopBeginTryCatchLevel.
8572 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
8573 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
8574 the current ec.TryCatchLevel, the branch goes out of an exception
8575 block. In this case, we need to use Leave and not Br.
8577 2002-07-22 Martin Baulig <martin@gnome.org>
8579 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
8580 block unless the block does not always return or it is contained in
8581 another try { ... } catch { ... } block. Fixes bug #26506.
8582 Added verify-1.cs to the test suite.
8584 2002-07-22 Martin Baulig <martin@gnome.org>
8586 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
8587 then we do not always return. Fixes bug #24985.
8589 2002-07-22 Martin Baulig <martin@gnome.org>
8591 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
8592 lookup on a per-class level; ie. walk up the class hierarchy until we
8593 found at least one applicable method, then choose the best among them.
8594 Fixes bug #24463 and test-29.cs.
8596 2002-07-22 Martin Baulig <martin@gnome.org>
8598 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
8599 return types of the methods. The return type is not part of the
8600 signature and we must not check it to make the `new' modifier work.
8601 Fixes bug #27999, also added test-147.cs.
8602 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
8604 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
8605 on the method's return type.
8607 2002-07-21 Martin Baulig <martin@gnome.org>
8609 * assign.cs: Make this work if the rightmost source is a constant and
8610 we need to do an implicit type conversion. Also adding a few more tests
8611 to test-38.cs which should have caught this.
8613 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
8614 target in the makefile for this. The makefile.gnu is primarily intended
8615 for end-users who don't want to debug the compiler.
8617 2002-07-21 Martin Baulig <martin@gnome.org>
8619 * assign.cs: Improved the Assign class so it can now handle embedded
8620 assignments (X = Y = Z = something). As a side-effect this'll now also
8621 consume less local variables. test-38.cs now passes with MCS, added
8622 a few new test cases to that test.
8624 2002-07-20 Martin Baulig <martin@gnome.org>
8626 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
8627 instructions. Fixes bug #27977, also added test-146.cs.
8629 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8631 * cs-tokenizer.cs: fixed getHex ().
8633 2002-07-19 Martin Baulig <martin@gnome.org>
8635 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
8636 not Type.GetType() to lookup the array type. This is needed when
8637 we're constructing an array of a user-defined type.
8638 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
8639 single-dimensional arrays, but also for single-dimensial arrays of
8642 2002-07-19 Martin Baulig <martin@gnome.org>
8644 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
8645 this function is called, it's not allowed to share LocalBuilders
8648 2002-07-19 Martin Baulig <martin@gnome.org>
8650 * expression.cs (Argument.Resolve): Report an error 118 when trying
8651 to pass a type as argument.
8653 2002-07-18 Martin Baulig <martin@gnome.org>
8655 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
8656 Conv_R_Un for the signed `long' type.
8658 2002-07-15 Miguel de Icaza <miguel@ximian.com>
8660 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
8661 `expr' for the temporary result, as that will fail if we do
8662 multiple resolves on the same expression.
8664 2002-07-05 Miguel de Icaza <miguel@ximian.com>
8666 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
8667 ec.TypeContainer for looking up aliases.
8669 * class.cs (TypeContainer): Remove LookupAlias from here.
8671 * decl.cs (DeclSpace); Move here.
8673 2002-07-01 Miguel de Icaza <miguel@ximian.com>
8675 * class.cs (FindMembers): Only call filter if the constructor
8676 bulider is not null.
8678 Also handle delegates in `NestedTypes' now. Now we will perform
8679 type lookups using the standard resolution process. This also
8682 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
8683 This uses Expressions (the limited kind that can be parsed by the
8684 tree) instead of strings.
8686 * expression.cs (ComposedCast.ToString): Implement, used to flag
8687 errors since now we have to render expressions.
8689 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
8692 * ecore.cs (SimpleName.ToString): ditto.
8694 * cs-parser.jay: Instead of using strings to assemble types, use
8695 Expressions to assemble the type (using SimpleName, ComposedCast,
8696 MemberAccess). This should fix the type lookups in declarations,
8697 because we were using a different code path for this.
8699 * statement.cs (Block.Resolve): Continue processing statements
8700 even when there is an error.
8702 2002-07-17 Miguel de Icaza <miguel@ximian.com>
8704 * class.cs (Event.Define): Also remove the `remove' method from
8705 the list of pending items.
8707 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
8708 generate more compact code.
8710 2002-07-17 Martin Baulig <martin@gnome.org>
8712 * const.cs (Const.LookupConstantValue): Add support for constant
8713 `unchecked' and `checked' expressions.
8714 Also adding test case test-140.cs for this.
8716 2002-07-17 Martin Baulig <martin@gnome.org>
8718 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
8719 check whether mi.ReturnType implements the IEnumerator interface; the
8720 `==' and the IsAssignableFrom() will fail in this situation.
8722 2002-07-16 Ravi Pratap <ravi@ximian.com>
8724 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
8727 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8729 * expression.cs: fixed bug #27811.
8731 2002-07-14 Miguel de Icaza <miguel@ximian.com>
8733 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
8734 Molaro: when we are a ref, the value already contains a pointer
8735 value, do not take the address of it.
8737 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
8738 * removed mb-parser.jay and mb-tokenizer.cs
8740 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
8742 * expression.cs: check against the building corlib void type.
8744 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
8746 * ecore.cs: fix for valuetype static readonly fields: when
8747 initializing them, we need their address, not the address of a copy.
8749 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
8751 * typemanager.cs: register also enum_type in corlib.
8753 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
8755 * class.cs: allow calling this (but not base) initializers in structs.
8757 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
8759 * ecore.cs: make sure we compare against the building base types
8762 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
8764 * typemanager.cs: fix TypeToCoreType() to handle void and object
8765 (corlib gets no more typerefs after this change).
8767 2002-07-12 Miguel de Icaza <miguel@ximian.com>
8769 * expression.cs (ArrayCreation.EmitArrayArguments): use
8770 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
8772 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
8773 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
8774 array indexes, the runtime actually forbids them.
8776 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
8777 for array arguments here.
8779 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
8780 instead of the default for ValueTypes.
8782 (New.DoEmit): Use IsValueType instead of
8783 IsSubclassOf (value_type)
8784 (New.DoResolve): ditto.
8785 (Invocation.EmitCall): ditto.
8787 * assign.cs (Assign): ditto.
8789 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
8790 Statements *are* currently doing part of their resolution during
8793 Expressions do always resolve during resolve, but statements are
8794 only required to propagate resolution to their children.
8796 2002-07-11 Miguel de Icaza <miguel@ximian.com>
8798 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
8800 (LoadAssembly): Do not add the dll if it is already specified
8802 (MainDriver): Add the System directory to the link path at the end,
8803 after all the other -L arguments.
8805 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
8806 wrong opcode for loading bytes and bools (ldelem.i1 instead of
8807 ldelem.u1) and using the opposite for sbytes.
8809 This fixes Digger, and we can finally run it.
8811 * driver.cs (UnixParseOption): Move the option parsing here.
8812 (CSCParseOption): Implement CSC-like parsing of options.
8814 We now support both modes of operation, the old Unix way, and the
8815 new CSC-like way. This should help those who wanted to make cross
8818 The only thing broken is that /r:, /reference: and /lib: are not
8819 implemented, because I want to make those have the same semantics
8820 as the CSC compiler has, and kill once and for all the confussion
8821 around this. Will be doing this tomorrow.
8823 * statement.cs (Unsafe.Resolve): The state is checked during
8824 resolve, not emit, so we have to set the flags for IsUnsfe here.
8826 2002-07-10 Miguel de Icaza <miguel@ximian.com>
8828 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
8829 not catch the Error_ObjectRefRequired in SimpleName (as it is
8830 possible to have a class/instance variable name that later gets
8831 deambiguated), we have to check this here.
8833 2002-07-10 Ravi Pratap <ravi@ximian.com>
8835 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
8836 make static and put into Expression.
8838 (Event.Define): Register the private field of the event with the
8839 TypeManager so that GetFieldFromEvent can get at it.
8841 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
8842 keep track of the private field associated with an event which
8845 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
8848 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
8850 2002-07-10 Miguel de Icaza <miguel@ximian.com>
8852 * expression.cs (Binary.EmitBranchable): this routine emits the
8853 Binary expression in a branchable context. This basically means:
8854 we need to branch somewhere, not just get the value on the stack.
8856 This works together with Statement.EmitBoolExpression.
8858 * statement.cs (Statement.EmitBoolExpression): Use
8861 2002-07-09 Miguel de Icaza <miguel@ximian.com>
8863 * statement.cs (For): Reduce the number of jumps in loops.
8865 (For): Implement loop inversion for the For statement.
8867 (Break): We can be breaking out of a Try/Catch controlled section
8868 (foreach might have an implicit try/catch clause), so we need to
8869 use Leave instead of Br.
8871 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
8872 now). If the instace expression supports IMemoryLocation, we use
8873 the AddressOf method from the IMemoryLocation to extract the
8874 address instead of emitting the instance.
8876 This showed up with `This', as we were emitting the instance
8877 always (Emit) instead of the Address of This. Particularly
8878 interesting when This is a value type, as we dont want the Emit
8879 effect (which was to load the object).
8881 2002-07-08 Miguel de Icaza <miguel@ximian.com>
8883 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
8885 * statement.cs (Checked): Set the CheckedState during the resolve
8886 process too, as the ConvCast operations track the checked state on
8887 the resolve process, and not emit.
8889 * cs-parser.jay (namespace_member_declaration): Flag that we have
8890 found a declaration when we do. This is used to flag error 1529
8892 * driver.cs: Report ok when we display the help only.
8894 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
8896 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
8898 2002-07-04 Miguel de Icaza <miguel@ximian.com>
8900 * cs-tokenizer.cs (define): We also have to track locally the
8901 defines. AllDefines is just used for the Conditional Attribute,
8902 but we also need the local defines for the current source code.
8904 2002-07-03 Miguel de Icaza <miguel@ximian.com>
8906 * statement.cs (While, For, Do): These loops can exit through a
8907 Break statement, use this information to tell whether the
8908 statement is the last piece of code.
8910 (Break): Flag that we break.
8912 * codegen.cs (EmitContexts): New `Breaks' state variable.
8914 2002-07-03 Martin Baulig <martin@gnome.org>
8916 * class.cs (TypeContainer.MethodModifiersValid): Allow override
8917 modifiers in method declarations in structs. Otherwise, you won't
8918 be able to override things like Object.Equals().
8920 2002-07-02 Miguel de Icaza <miguel@ximian.com>
8922 * class.cs (Method, Property, Indexer): Do not allow the public
8923 modifier to be used in explicit interface implementations.
8925 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
8926 override modifiers in method declarations in structs
8928 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
8930 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
8931 integer or real overflow, report an error
8933 2002-07-02 Martin Baulig <martin@gnome.org>
8935 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
8936 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
8937 to tell the runtime about our newly created System.Object and
8938 System.ValueType types.
8940 2002-07-02 Miguel de Icaza <miguel@ximian.com>
8942 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
8943 struct instead of Ldarg/Starg.
8945 2002-07-02 Martin Baulig <martin@gnome.org>
8947 * expression.cs (Indirection.Indirection): Call
8948 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
8950 2002-07-02 Martin Baulig <martin@gnome.org>
8952 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
8953 ValueType, call TypeManager.TypeToCoreType() on it.
8954 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
8955 the OpCodes.Newarr argument.
8957 2002-07-02 Martin Baulig <martin@gnome.org>
8959 * expression.cs (Invocation.EmitCall): When compiling corlib,
8960 replace all calls to the system's System.Array type to calls to
8961 the newly created one.
8963 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
8964 System.Array methods.
8965 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
8966 from the system's System.Array type which must be replaced.
8968 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
8970 * typemanager.cs: load unverifiable_code_ctor so we can build
8971 corlib using the correct type. Avoid using GetTypeCode() with
8973 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
8974 TypeManager.object_type to allow building corlib.
8976 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
8978 * ecore.cs: handle System.Enum separately in LoadFromPtr().
8980 2002-07-01 Martin Baulig <martin@gnome.org>
8982 * class.cs: Make the last change actually work, we need to check
8983 whether `ifaces != null' to avoid a crash.
8985 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
8987 * class.cs: when we build structs without fields that implement
8988 interfaces, we need to add the interfaces separately, since there is
8989 no API to both set the size and add the interfaces at type creation
8992 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
8994 * expression.cs: the dimension arguments to the array constructors
8995 need to be converted if they are a long.
8997 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
8999 * class.cs: don't emit ldarg.0 if there is no parent constructor
9000 (fixes showstopper for corlib).
9002 2002-06-29 Martin Baulig <martin@gnome.org>
9004 MCS now compiles corlib on GNU/Linux :-)
9006 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
9007 ie. check for MethodImplOptions.InternalCall.
9009 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
9010 and TypeManager.attribute_type are null, so we must explicitly check
9011 whether parent is not null to find out whether it's an attribute type.
9012 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
9013 and SetBuilder, not only if the property is neither abstract nor external.
9014 This is necessary to set the MethodImplOptions on the accessor methods.
9015 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
9016 SetBuilder, see Property.Emit().
9018 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
9019 populate "System.Object", "System.ValueType" and "System.Attribute" since
9020 they've already been populated from BootCorlib_PopulateCoreTypes().
9022 2002-06-29 Martin Baulig <martin@gnome.org>
9024 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
9025 is the NullLiteral, we also need to make sure that target_type is not
9028 2002-06-29 Martin Baulig <martin@gnome.org>
9030 * rootcontext.cs (RootContext.ResolveCore): We must initialize
9031 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
9032 before calling BootstrapCorlib_ResolveDelegate ().
9034 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9036 * statement.cs: fixed build-breaker. All tests passed ok.
9038 2002-06-27 Martin Baulig <martin@gnome.org>
9040 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
9041 for System.Decimal when compiling corlib.
9043 2002-06-27 Martin Baulig <martin@gnome.org>
9045 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
9046 switch blocks which contain nothing but a default clause.
9048 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
9050 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
9052 2002-06-27 Martin Baulig <martin@gnome.org>
9054 * ecore.cs (PropertyExpr.PropertyExpr): Call
9055 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
9057 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
9058 is already a TypeBuilder.
9060 2002-06-27 Martin Baulig <martin@gnome.org>
9062 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
9063 `target_type == TypeManager.array_type', not IsAssignableFrom() in
9064 the "from an array-type to System.Array" case. This makes it work
9065 when compiling corlib.
9067 2002-06-27 Martin Baulig <martin@gnome.org>
9069 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
9070 non-static PropertyExpr, set its InstanceExpression. This makes
9071 the `ICollection.Count' property work in System/Array.cs.
9073 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
9075 * driver.cs: Made error handling more consistent. Errors now
9076 tracked by Report class, so many methods which used to return int
9077 now return void. Main() now prints success/failure and
9078 errors/warnings message.
9080 Renamed '--probe' compiler argument to '--expect-error'. Removed
9081 the magic number return values (123 and 124). Now, if the
9082 expected error occurs, the compiler exits with success (exit value
9083 0). If the compilation completes without seeing that particular
9084 error, the compiler exits with failure (exit value 1). The
9085 makefile in mcs/errors has been changed to handle the new behaviour.
9087 * report.cs: Made 'expected error' number a property and renamed
9088 it from 'Probe' to 'ExpectedError'.
9090 * genericparser.cs: Removed error handling support, since it is
9091 now all done by Report class.
9093 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
9094 class, so parse() no longer returns an int.
9096 * namespace.cs: Use Report.Error instead of GenericParser.error
9098 2002-06-22 Miguel de Icaza <miguel@ximian.com>
9100 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
9101 TypeContainer.AddOperator): At the front of the list put the
9102 explicit implementations, so they get resolved/defined first.
9104 2002-06-21 Miguel de Icaza <miguel@ximian.com>
9106 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
9107 interface type is implemented by this TypeContainer. Used during
9108 explicit interface implementation.
9110 (Property.Define, Indexer.Define, Method.Define): Validate that
9111 the given interface in the explicit implementation is one of the
9112 base classes for the containing type.
9114 Also if we are explicitly implementing an interface, but there is
9115 no match in the pending implementation table, report an error.
9117 (Property.Define): Only define the property if we are
9118 not explicitly implementing a property from an interface. Use the
9119 correct name also for those properties (the same CSC uses,
9120 although that is really not needed).
9122 (Property.Emit): Do not emit attributes for explicitly implemented
9123 properties, as there is no TypeBuilder.
9125 (Indexer.Emit): ditto.
9127 Hiding then means that we do not really *implement* a pending
9128 implementation, which makes code fail.
9130 2002-06-22 Martin Baulig <martin@gnome.org>
9132 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
9133 the return value of Object.GetType(). [FIXME: we need to do this whenever
9134 we get a type back from the reflection library].
9136 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
9138 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
9140 2002-06-20 Miguel de Icaza <miguel@ximian.com>
9142 * attribute.cs: Return null if we can not look up the type.
9144 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
9145 the interface types found.
9147 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
9148 interface types found.
9150 * typemanager.cs (GetInterfaces): Make this routine returns alll
9151 the interfaces and work around the lame differences between
9152 System.Type and System.Reflection.Emit.TypeBuilder in the results
9153 result for GetInterfaces.
9155 (ExpandInterfaces): Given an array of interface types, expand and
9156 eliminate repeated ocurrences of an interface. This expands in
9157 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
9160 2002-06-21 Martin Baulig <martin@gnome.org>
9162 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
9165 2002-06-21 Martin Baulig <martin@gnome.org>
9167 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
9168 and called with one of the core types, return the corresponding typebuilder for
9171 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
9174 2002-06-21 Martin Baulig <martin@gnome.org>
9176 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
9177 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
9178 (Expression.ConvertReferenceExplicit): Likewise.
9180 * expression.cs (ElementAccess.DoResolve): Likewise.
9181 (ElementAccess.DoResolveLValue): Likewise.
9183 2002-06-10 Martin Baulig <martin@gnome.org>
9185 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
9186 add the "value" parameter to the parameter list.
9188 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
9191 2002-06-19 Miguel de Icaza <miguel@ximian.com>
9193 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
9194 the argument to an int, uint, long or ulong, per the spec. Also
9195 catch negative constants in array creation.
9197 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
9199 * class.cs: do not allow the same interface to appear twice in
9200 the definition list.
9202 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
9204 * ecore.cs: don't use ldlen with System.Array.
9206 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
9208 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
9210 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
9212 * modifiers.cs: produce correct field attributes for protected
9213 internal. Easy fix so miguel can work on ther harder stuff:-)
9215 2002-06-18 Miguel de Icaza <miguel@ximian.com>
9217 * pending.cs: New file. Move the code from class.cs here.
9218 Support clearning the pending flag for all methods (when not doing
9219 explicit interface implementation).
9221 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
9223 * rootcontext.cs: added a couple more types needed to bootstrap.
9225 2002-06-17 Miguel de Icaza <miguel@ximian.com>
9227 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
9228 constructor in the type, instead of any constructor in the type
9229 hierarchy. Thanks to Paolo for finding this bug (it showed up as
9230 a bug in the Mono runtime when applying the params attribute).
9232 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9233 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
9235 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
9237 * expression.cs (Unary.ResolveOperator): Use TypeManager
9238 to resolve the type.
9240 2002-06-13 Ravi Pratap <ravi@ximian.com>
9242 * cs-parser.jay (enum_member_declaration): Pass in the attributes
9245 * enum.cs (AddEnumMember): Add support to store the attributes associated
9246 with each member too.
9248 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
9249 field builders too - this takes care of the enum member case.
9251 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
9253 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
9254 address-of operator on both value types and pointers.
9256 2002-06-10 Martin Baulig <martin@gnome.org>
9258 * interface.cs (Interface.PopulateIndexer): Add the indexer's
9259 PropertyBuilder to the `property_builders' list.
9261 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
9262 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
9263 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
9264 find any indexers which are inherited from an interface.
9266 2002-06-09 Martin Baulig <martin@gnome.org>
9268 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
9269 the same type as the constant if necessary. There's also a test-130.cs
9272 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
9274 * typemanager.cs (TypeManager.ChangeType): Previously known as
9275 Enum.ChangeEnumType().
9277 2002-06-09 Martin Baulig <martin@gnome.org>
9279 * expression.cs (Cast.TryReduce): Added support for consts.
9281 2002-06-08 Ravi Pratap <ravi@ximian.com>
9283 * class.cs (Accessor): Hold attributes information so we can pass
9286 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
9287 Modify to pass in attributes attached to the methods.
9289 (add_accessor_declaration, remove_accessor_declaration): Ditto.
9291 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
9292 to handle the Accessor kind :-)
9294 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
9296 2002-06-08 Martin Baulig <martin@gnome.org>
9298 * expression.cs (Unary.TryReduceNegative): Added support for
9301 2002-06-08 Martin Baulig <martin@gnome.org>
9303 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
9304 name can't be found in the `defined_names' - the caller will do a
9305 MemberLookup in this case and thus find methods in System.Enum
9306 such as Enum.IsDefined().
9308 2002-06-08 Martin Baulig <martin@gnome.org>
9310 * enum.cs (Enum.ChangeEnumType): This is a custom version of
9311 Convert.ChangeType() which works with TypeBuilder created types.
9312 (Enum.LookupEnumValue, Enum.Define): Use it here.
9314 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
9315 `TypeBuilder.BaseType != null' check.
9316 (TypeContainer.FindMembers): Only lookup parent members if we
9317 actually have a parent.
9318 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
9319 (ConstructorInitializer.Resolve): Likewise.
9321 * interface.cs (Interface.FindMembers): Added
9322 `TypeBuilder.BaseType != null' check.
9324 * rootcontext.cs (RootContext.ResolveCore): Added
9325 "System.Runtime.CompilerServices.IndexerNameAttribute" to
9326 classes_second_stage.
9328 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
9329 debug_type and trace_type when compiling with --nostdlib.
9331 2002-06-07 Martin Baulig <martin@gnome.org>
9333 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
9334 (AddField): Set it to true when adding a non-static field.
9335 (DefineType): Use `have_nonstatic_fields' to find out whether we
9336 have non-static fields, not `Fields != null'.
9338 2002-06-02 Miguel de Icaza <miguel@ximian.com>
9340 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
9341 dereferencing a null on the static-field code path)
9343 2002-05-30 Martin Baulig <martin@gnome.org>
9345 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
9346 to take command line arguments. Use reflection to call the new
9347 custom `Initialize' function on the symbol writer and pass it the
9348 command line arguments.
9350 * driver.cs (--debug-args): New command line argument to pass command
9351 line arguments to the symbol writer.
9353 2002-05-28 Miguel de Icaza <miguel@ximian.com>
9355 * assign.cs (DoResolve): Forgot to do the implicit conversion to
9356 the target type for indexers and properties. Thanks to Joe for
9359 2002-05-27 Miguel de Icaza <miguel@ximian.com>
9361 * typemanager.cs (MethodFlags): returns the method flags
9362 (Obsolete/ShouldIgnore) that control warning emission and whether
9363 the invocation should be made, or ignored.
9365 * expression.cs (Invocation.Emit): Remove previous hack, we should
9366 not do this on matching a base type, we should do this based on an attribute
9368 Only emit calls to System.Diagnostics.Debug and
9369 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
9370 on the command line.
9372 * rootcontext.cs: Global settings for tracing and debugging.
9374 * cs-tokenizer.cs (define): New utility function to track
9375 defines. Set the global settings for TRACE and DEBUG if found.
9377 2002-05-25 Ravi Pratap <ravi@ximian.com>
9379 * interface.cs (Populate*): Pass in the TypeContainer as well as
9380 the DeclSpace as parameters so that we can create EmitContexts and
9381 then use that to apply attributes etc.
9383 (PopulateMethod, PopulateEvent, PopulateProperty)
9384 (PopulateIndexer): Apply attributes everywhere.
9386 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
9389 (ApplyAttributes): Update accordingly.
9391 We now apply interface attributes for all members too.
9393 2002-05-26 Miguel de Icaza <miguel@ximian.com>
9395 * class.cs (Indexer.Define); Correctly check if we are explicit
9396 implementation (instead of checking the Name for a ".", we
9397 directly look up if the InterfaceType was specified).
9399 Delay the creation of the PropertyBuilder.
9401 Only create the PropertyBuilder if we are not an explicit
9402 interface implementation. This means that explicit interface
9403 implementation members do not participate in regular function
9404 lookups, and hence fixes another major ambiguity problem in
9405 overload resolution (that was the visible effect).
9407 (DefineMethod): Return whether we are doing an interface
9410 * typemanager.cs: Temporary hack until we get attributes in
9411 interfaces (Ravi is working on that) and we get IndexerName
9412 support in interfaces.
9414 * interface.cs: Register the indexers as properties.
9416 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
9417 warning, I have verified that this is a bug in the .NET runtime
9418 (JavaScript suffers of the same problem).
9420 * typemanager.cs (MemberLookup): When looking up members for
9421 interfaces, the parent of an interface is the implicit
9422 System.Object (so we succeed in searches of Object methods in an
9423 interface method invocation. Example: IEnumerable x; x.ToString
9426 2002-05-25 Miguel de Icaza <miguel@ximian.com>
9428 * class.cs (Event): Events should also register if they do
9429 implement the methods that an interface requires.
9431 * typemanager.cs (MemberLookup); use the new GetInterfaces
9434 (GetInterfaces): The code used to lookup interfaces for a type is
9435 used in more than one place, factor it here.
9437 * driver.cs: Track the errors at the bottom of the file, we kept
9440 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
9441 instance if the method we are calling is static!
9443 2002-05-24 Miguel de Icaza <miguel@ximian.com>
9445 * attribute.cs (ApplyAttributes): Make this function filter out
9446 the IndexerName attribute (as that attribute in reality is never
9447 applied) and return the string constant for the IndexerName
9450 * class.cs (TypeContainer.Emit): Validate that all the indexers
9451 have the same IndexerName attribute, and if so, set the
9452 DefaultName attribute on the class.
9454 * typemanager.cs: The return value might contain other stuff (not
9455 only methods). For instance, consider a method with an "Item"
9456 property and an Item method.
9458 * class.cs: If there is a problem with the parameter types,
9461 2002-05-24 Ravi Pratap <ravi@ximian.com>
9463 * ecore.cs (ImplicitConversionExists): Wrapper function which also
9464 looks at user defined conversion after making a call to
9465 StandardConversionExists - we need this for overload resolution.
9467 * expression.cs : Update accordingly the various method calls.
9469 This fixes 2 bugs filed against implicit user defined conversions
9471 2002-05-22 Miguel de Icaza <miguel@ximian.com>
9473 * statement.cs: Track the result of the assignment.
9475 2002-05-21 Miguel de Icaza <miguel@ximian.com>
9477 * expression.cs (MemberAccess): Improved error reporting for
9478 inaccessible members.
9480 2002-05-22 Martin Baulig <martin@gnome.org>
9482 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
9483 itself with debugging support.
9485 2002-05-22 Martin Baulig <martin@gnome.org>
9487 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
9488 Removed, this isn't needed anymore.
9490 2002-05-20 Martin Baulig <martin@gnome.org>
9492 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
9493 be underlying type for an enum.
9495 2002-05-20 Miguel de Icaza <miguel@ximian.com>
9497 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
9498 that splits out the loading of just the core types.
9500 * rootcontext.cs (ResolveCore): Split the struct resolution in
9501 two, so we can load the enumeration underlying types before any
9504 * expression.cs (Is): Bandaid until we fix properly Switch (see
9505 bug #24985 for details).
9507 * typemanager.cs (ImplementsInterface): The hashtable will contain
9508 a null if there are no interfaces implemented.
9510 2002-05-18 Miguel de Icaza <miguel@ximian.com>
9512 * cs-parser.jay (indexer_declarator): It is fine to have array
9515 2002-05-17 Miguel de Icaza <miguel@ximian.com>
9517 * typemanager.cs: (RegisterBuilder): New function used to register
9518 TypeBuilders that implement interfaces. Since
9519 TypeBuilder.GetInterfaces (as usual) does not work with lame
9521 (AddUserType): register interfaces.
9523 (ImplementsInterface): Use the builder_to_ifaces hash if we are
9524 dealing with TypeBuilder. Also, arrays are showing up as
9525 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
9526 methods can not be invoked on them!
9528 * ecore.cs (ExplicitReferenceConversionExists): Made public.
9529 (ImplicitReferenceConversionExists): Split out from
9530 StandardConversionExists.
9532 * expression.cs (As): We were only implementing one of the three
9533 cases for the as operator. We now implement them all.
9534 (Is): Implement the various other cases for Is as well.
9536 * typemanager.cs (CACHE): New define used to control if we want or
9537 not the FindMembers cache. Seems to have a negative impact on
9538 performance currently
9540 (MemberLookup): Nested types have full acess to
9541 enclosing type members
9543 Remove code that coped with instance/static returns for events, we
9544 now catch this in RealFindMembers.
9546 (RealFindMembers): only perform static lookup if the instance
9547 lookup did not return a type or an event.
9549 2002-05-17 Miguel de Icaza <miguel@ximian.com>
9551 * assign.cs (CompoundAssign): We pass more semantic information
9552 now to Compound Assignments than we did before: now we have all
9553 the information at hand, and now we resolve the target *before* we
9554 do the expression expansion, which allows the "CacheValue" method
9555 to have the effect we intended (before, a [x] += 1 would generate
9556 two differen ArrayAccess expressions from the ElementAccess,
9557 during the resolution process).
9559 (CompoundAssign.DoResolve): Resolve target and original_source here.
9561 2002-05-16 Miguel de Icaza <miguel@ximian.com>
9563 * expression.cs (ArrayAccess): dropped debugging information.
9565 * typemanager.cs: Small bug fix: I was always returning i_members,
9566 instead of one of i_members or s_members (depending on which had
9569 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
9570 method is invoked before any code generation takes place, and it
9571 is a mechanism to inform that the expression will be invoked more
9572 than once, and that the method should use temporary values to
9573 avoid having side effects
9575 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
9577 * ecore.cs (Expression.CacheTemporaries): Provide empty default
9580 * expression.cs (Indirection, ArrayAccess): Add support for
9581 CacheTemporaries in these two bad boys.
9583 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
9585 (StoreFromPtr): Handle stobj as well.
9587 * expression.cs (UnaryMutator): Share more code.
9589 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
9590 down: I was not tracking the Filter function as well, which
9591 was affecting the results of the cache.
9593 2002-05-15 Miguel de Icaza <miguel@ximian.com>
9595 * attribute.cs: Remove the hack to handle the CharSet property on
9598 2002-05-14 Miguel de Icaza <miguel@ximian.com>
9600 * attribute.cs (DoResolve): More uglyness, we now only try to
9601 resolve the attribute partially, to extract the CharSet
9602 information (only if we are a StructLayout attribute). Otherwise
9604 (GetExtraTypeInfo): Add some code to conditionally kill in the
9605 future this. I am more and more convinced that the .NET
9606 framework has special code to handle the attribute setting on
9609 * expression.cs (IsParamsMethodApplicable): Revert my previous
9610 foreach change here, it was wrong.
9612 2002-05-13 Miguel de Icaza <miguel@ximian.com>
9614 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
9615 (pp_expr): do not abort on unknown input, just return.
9616 (eval): abort if there are pending chars.
9618 * attribute.cs (Attribute.Resolve): Positional parameters are
9619 optional. Deal with that case.
9621 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
9622 the Ansi/Unicode/Auto information for the type.
9624 (TypeContainer.DefineType): instantiate the EmitContext here, as
9625 we will be using it during the type definition (to resolve
9626 attributes) and during the emit phase.
9628 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
9629 to pull type information out of the attributes
9631 (Attribute.Resolve): track the constructor builder, and allow for
9632 multiple invocations (structs and classes will use this).
9634 * ecore.cs (MemberLookupFinal): new version with all the
9635 parameters customizable.
9637 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
9638 constructors. Return if the result value is null (as the error
9639 would have been flagged already by MemberLookupFinal)
9641 Do not allow instances of abstract classes or interfaces to be
9644 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
9645 We have to compare the assembly property here when dealing with
9646 FamANDAssem and Assembly access modifiers, because we might be
9647 creating an assembly from *modules* (that means that we are not
9648 getting TypeBuilders for types defined in other modules that are
9649 part of this assembly).
9651 (Method.Emit): If the method is marked abstract and has a body,
9654 (TypeContainer.DefineMembers): If both the defined member and the
9655 parent name match are methods, then do not emit any warnings: let
9656 the Method.Define routine take care of flagging warnings. But if
9657 there is a mismatch (method overrides something else, or method is
9658 overriwritten by something, then emit warning).
9660 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
9661 set to null, this means `do not check for the return type on the
9664 (Method.Define): set the return type for the method signature to
9665 null, so that we get methods with the same name and parameters and
9666 different return types. This is used to flag warning 114 (you are
9667 hiding a method, and you probably want to use the new/override
9670 * typemanager.cs (MemberLookup): Implemented proper access
9671 control, closing a long standing set of bug reports. The problem
9672 was that the Framework only has two bits: Public and NonPublic,
9673 and NonPublic includes private and protected methods, but we need
9674 to enforce the FamANDAssem, FamOrAssem and Family.
9676 2002-05-11 Miguel de Icaza <miguel@ximian.com>
9678 * statement.cs (GotoCase): Return true: Ammounts to giving up
9679 knowledge on whether we return or not, and letting the other case
9680 be responsible for it.
9682 2002-05-10 Miguel de Icaza <miguel@ximian.com>
9684 * driver.cs: Do not load directories for each file processed, only
9685 do it if there is a pattern.
9687 * ecore.cs: Report readonly assigns here as well, as we might have
9688 been resolved only by MemberAccess.
9690 (SimpleName.SimpleNameResolve): Also be useful for LValue
9691 resolution. We need this to propagate assign to local readonly variables
9693 * typemanager.cs: Use a ptrhashtable for the criteria, because we
9694 do not want to reuse potential criteria memory.
9696 * class.cs (MyEventBuilder): Set reflected_type;
9698 * ecore.cs (Constantify): Added support for constifying bools.
9700 (RootContext.LookupType): Added a cache for values looked up in
9701 the declaration space.
9703 * typemanager.cs (FindMembers): Now is a front-end to
9704 RealFindMembers, and provides a two-level hashtable-based cache to
9707 15% performance improvement: from 22.5 to 19.2 seconds.
9709 * expression.cs (IsParamsMethodApplicable): use foreach.
9710 (Invocation.DoResolve): ditto.
9711 (New.DoResolve): ditto.
9712 (ArrayCreation.DoResolve): ditto.
9714 * ecore.cs (FindMostEncompassingType): use foreach.
9716 * delegate.cs (NewDelegate.DoResolve): Use foreach
9718 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
9719 (RemoveMethods): use foreach.
9721 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
9722 nested foreach statements instead of for, and also break out of
9723 the inner loop once a match is found.
9725 (Invocation.OverloadResolve): Use foreach, simplify the code.
9727 2002-05-08 Miguel de Icaza <miguel@ximian.com>
9729 * cfold.cs (BinaryFold): During an enumeration evaluation context,
9730 we actually unwrap the expression to allow for extra information
9733 * expression.cs: Use Shr_Un on unsigned operations.
9735 2002-05-08 Ravi Pratap <ravi@ximian.com>
9737 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
9738 applicable operators was not being considered correctly. This closes
9739 the bug Miguel reported.
9741 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
9743 * attribute.cs: check that the type derives from System.Attribute
9744 and report the correct error in that case (moved the duplicate code to
9745 its own method, too).
9747 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
9749 * attribute.cs: lookup attribute type name as the spec says: first the
9750 bare attribute name and then name + "Attribute" (nant compiles with
9751 mcs after this fix).
9753 2002-05-07 Miguel de Icaza <miguel@ximian.com>
9755 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
9756 Because of the way we parse things, we should try to see if a
9757 UIntConstant can fit in an integer.
9759 2002-05-07 Ravi Pratap <ravi@ximian.com>
9761 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
9762 when we are in an explicit context.
9764 (ConvertReferenceExplicit): When converting from Iface type S to Class
9765 T make sure the rules are implemented as an OR.
9767 * parameter.cs (ParameterType): Make it a property for now although the
9768 purpose really isn't anything immediate.
9770 * expression.cs (Is*Applicable): Do better checking on the parameter type
9771 of a ref/out parameter. The ones from the system assemblies are already
9772 marked with the correct type so we don't need to do any correction.
9774 * ecore.cs (StandardConversionExists): Conversion from Interface types to
9775 the object type is standard too so include that.
9777 2002-05-06 Miguel de Icaza <miguel@ximian.com>
9779 * ecore.cs (StandardConversionExists): Augment with missing code:
9780 deal with IntConstant, LongConstants and Enumerations.
9782 * assign.cs: Report the error, instead of failing silently
9784 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
9785 typecontainer that they are declared, because the
9786 typecontainer/namespace will have the list of using clauses that
9789 Assembly Attributes were escaping the normal registration
9792 (EmitCode): Apply attributes within an EmitContext that represents
9793 the container they were declared on.
9795 * cs-parser.jay: Track bases for structs. How did I get this wrong?
9797 2002-05-06 Ravi Pratap <ravi@ximian.com>
9799 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
9800 Revamp completely - make much cleaner as we now operate only
9803 (FindMostSpecificSource, FindMostSpecificTarget): New methods
9804 to implement the logic detailed in the spec more correctly.
9806 (UserDefinedConversion): Update accordingly.
9808 2002-05-06 Miguel de Icaza <miguel@ximian.com>
9810 * statement.cs: Return flow analysis information up.
9812 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
9815 (token): Do not consume an extra character before calling
9818 2002-05-06 Piers Haken <piersh@friskit.com>
9820 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
9822 2002-05-06 Miguel de Icaza <miguel@ximian.com>
9824 * class.cs (Constructor.Emit): Set the IsStatic flag in the
9825 EmitContext during the instance constructor initializer
9826 resolution, to stop access to instance variables.
9828 This is mandated by the spec, last paragraph of the `constructor
9829 initializers' section.
9831 2002-05-05 Miguel de Icaza <miguel@ximian.com>
9833 * cs-parser.jay, class.cs (Accessor): new class used to represent
9834 an accessor (get or set). In the past we used `null' to represent
9835 a missing accessor. But this is ambiguous because there was no
9836 way to tell in abstract indexers/properties if one of them was
9839 Now there is a way of addressing that.
9841 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
9842 instead of FindMembers.
9844 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
9845 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
9847 * attribute.cs: Treat indexers and properties as the same in terms
9848 of applying attributes
9850 * ecore.cs (FindMostEncompassedType): Use statically initialized
9851 EmptyExpressions()s like we do elsewhere to avoid creating useless
9852 objects (and we take this out of the tight loop).
9854 (GetConversionOperators): Move the code to extract the actual
9855 operators to a separate routine to clean things up.
9857 2002-05-04 Miguel de Icaza <miguel@ximian.com>
9859 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
9860 events are always registered FieldBuilders.
9862 * class.cs (FieldBase): New class shared by Fields
9864 * delegate.cs: If we are a toplevel delegate, use our full name.
9865 If we are a nested delegate, then only use our tail name.
9867 2002-05-02 Ravi Pratap <ravi@ximian.com>
9869 * expression.cs (IsApplicable): Ensure that we add the "&" to
9870 ref/out types before comparing it with the type of the argument.
9872 (IsParamsMethodApplicable): Ditto.
9874 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
9877 * delegate.cs : Handle the case when we have more than one applicable
9878 method. Flag an error only when we finish checking all.
9880 2002-05-02 Miguel de Icaza <miguel@ximian.com>
9882 * expression.cs: Add support for boolean static initializers.
9884 2002-05-01 Miguel de Icaza <miguel@ximian.com>
9886 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
9888 * parameter.cs (ComputeParameterTypes,
9889 ComputeAndDefineParameterTypes): Better error handling: now we
9890 clear the `types' cache if we fail during any of the type lookups.
9891 We also return the status code correctly to our caller
9893 * delegate.cs: If we fail to define a delegate, abort the extra
9896 * expression.cs (Binary.ResolveOperator): for
9897 operator==(object,object) and operator !=(object, object) we also
9898 have to verify that there is an implicit conversion from one to
9901 (ArrayAccess.DoResolve): Array Access can operate on
9904 2002-04-30 Miguel de Icaza <miguel@ximian.com>
9906 * assign.cs (CompoundAssign): A new class used as a "flag" that
9907 the assignment actually is happening as part of a compound
9908 assignment operator.
9910 During compound assignment, a few new rules exist to enable things
9917 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
9918 to the type of x) if y is implicitly convertible to the type of x,
9919 and the operator is a builtin operator and the return type of the
9920 operator is explicitly convertible to the type of x.
9922 * rootcontext.cs: Reset warning level to 2. 4 catches various
9923 "interesting" features in mcs, we must clean this up at some
9924 point, but currently am trying to kill other bugs ;-)
9926 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
9927 in container classes as well.
9929 * expression.cs (Binary.ResolveOperator): Handle string case
9930 before anything else (as operator overloading does emit an error
9931 before doing anything else).
9933 This code could go away when we move to a table driven model, but
9934 i could not come up with a good plan last night.
9936 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
9938 * typemanager.cs (CSharpName): reimplementation using regex.
9939 * class.cs: added null check for fields in Emit
9940 * rootcontext.cs: set warninglevel to 4
9942 2002-04-29 Miguel de Icaza <miguel@ximian.com>
9944 * typemanager.cs (CSharpName): reimplemented with Lupus
9947 2002-04-28 Miguel de Icaza <miguel@ximian.com>
9949 * statement.cs (If): correclty implement Resolve, because we were
9950 not catching sem errors in there. The same process is needed
9952 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
9955 (Statement.Warning_DeadCodeFound): Factorize code.
9956 (While): Report dead code here too.
9958 (Statement): Added Resolve virtual method to allow
9959 for resolution split from the emit code.
9961 2002-04-26 Miguel de Icaza <miguel@ximian.com>
9963 * statement.cs (EmitBoolExpression): No longer try to resolve the
9965 (MakeBoolean): New utility function that resolve, implicitly
9966 converts to boolean and tags the expression.
9969 (If, Do): Implement dead code elimination.
9970 (While): Implement loop inversion
9972 (Do, While, For, If): Resolve the expression prior to calling our
9975 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
9978 - added method Report28 (warning: program has more than one entry point)
9979 - added method IsEntryPoint, implements paragraph 10.1 of the spec
9980 - modified method Method.Define, the part at the end of the method
9982 * rootcontext.cs: added static public Location EntryPointLocation;
9984 * ../errors/cs0028.cs : Add test case for the above warning.
9987 - modified method CSharpName to allow arrays of primitive type to
9988 be printed nicely (e.g. instead of System.Int32[][] it now prints
9990 - added method CSharpSignature: returns the signature of a method
9991 in string format to be used in reporting errors, warnings, etc.
9993 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
9996 2002-04-26 Ravi Pratap <ravi@ximian.com>
9998 * delegate.cs (Define): Fix extremely silly bug where I was
9999 setting the type of the 'object' parameter of the BeginInvoke
10000 method to System.IAsyncResult instead of System.Object ;-)
10002 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10004 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
10007 (Constructor.Emit): return if we fail to initialize the
10008 constructor. Another door closed!
10010 * expression.cs (New.DoResolve): Improve error message (from -6 to
10011 1501). Use DeclaredOnly lookup to find the exact constructor.
10013 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
10014 loop. This is useful.
10016 * cs-parser.jay: Adjust the default parameters so that destructors
10017 have the proper signature.
10019 2002-04-26 Martin Baulig <martin@gnome.org>
10021 * driver.cs (LoadAssembly): If `assembly' contains any characters
10022 which are only valid in path names and not in assembly names
10023 (currently slash, backslash and point), use Assembly.LoadFrom ()
10024 instead of Assembly.Load () on the `assembly' (before iteration
10025 over the link_paths).
10027 2002-04-26 Martin Baulig <martin@gnome.org>
10029 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
10031 2002-04-25 Miguel de Icaza <miguel@ximian.com>
10033 * class.cs (Property): use the new typemanager.MemberLookup
10035 (TypeContainer.MemberLookup): Implement using the
10036 TypeManager.MemberLookup now.
10038 * typemanager.cs: Make MemberLookup a function of the TypeManager,
10039 and return MemberInfos, so that these can be used without an
10040 EmitContext (what we had before).
10042 2002-04-24 Miguel de Icaza <miguel@ximian.com>
10044 * expression.cs: Fix the case where the argument to params if the
10045 type of the params. I omitted handling this before. Fixed
10047 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10049 * driver.cs: Call BootCorlib_PopulateCoreType
10051 * class.cs (Property.CheckBase): Check for properties only, not
10054 * interface.cs: Temporary hack: try/catch around the
10055 CustomAttributeBuilder, because I am getting an exception that I
10058 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
10059 types whose definitions are required to be there (attributes are
10060 defined before standard types).
10062 Compute definitions as we boot the various types, as they are used
10063 immediately (value_type class will need object_type, but if we do
10064 not initialize object_type, we will pass a null, which will let
10065 the runtime pick the System.Object from the existing corlib, which
10066 is not what we want).
10068 2002-04-22 Patrik Torstensson <totte@labs2.com>
10070 * cs-tokenizer.cs: fixed a number of trim() issues.
10072 2002-04-22 Ravi Pratap <ravi@ximian.com>
10074 * expression.cs (Argument.Type): Ensure that we return the correct
10075 type when we have out or ref parameters [in which case we
10078 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10080 * class.cs (Property, Indexer): Allow extern modifier in there.
10082 * typemanager.cs (InitBaseTypes): Initializes object_type and
10083 value_type, since those will be used early on during the bootstrap
10084 process to compile corlib.
10086 (InitCoreTypes): Move code from here to InitBaseTypes.
10088 2002-04-21 Miguel de Icaza <miguel@ximian.com>
10090 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
10091 single-dimension arrays as using the ldlen opcode.
10093 Daniel Lewis discovered this optimization.
10095 * typemanager.cs: Add signature for System.Array::get_Length
10097 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10099 * statement.cs: report the error when the foreach does not apply to an
10100 array nor a collection.
10102 2002-04-19 Miguel de Icaza <miguel@ximian.com>
10104 * expression.cs: Add implicit conversions to the operator ~.
10106 * constant.cs (DecimalConstant.Emit): Emit decimal value.
10108 * typemanager.cs: Locate the decimal constructor.
10110 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10112 * attribute.cs: use the new property of TypeOf.
10113 * expression.cs: added 'get' property around typearg.
10115 These changes fix a build breaker reported by NickD. Is this the
10116 correct way to fix? If not, please, revert my changes and make it
10119 2002-04-17 Miguel de Icaza <miguel@ximian.com>
10121 * attribute.cs: Add support for typeof in attribute invocations.
10122 I am not sure that this is right though.
10124 2002-04-14 Duncan Mak <duncan@ximian.com>
10126 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
10127 Binary.Operator.Division case.
10129 2002-04-13 Ravi Pratap <ravi@ximian.com>
10131 * class.cs (DefineType): Ensure that we do a proper check on
10132 attribute types and also register it with the TypeManager.
10134 (TypeContainer.Targets): The default for attribute types is
10135 AttributeTargets.All.
10137 * attribute.cs (ApplyAttributes): Registering the attribute type
10138 is done elsewhere, not when we discover we have a Usage attribute.
10140 2002-04-12 Ravi Pratap <ravi@ximian.com>
10142 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
10143 and get rid of is_delegate parameter.
10145 * everywhere : update.
10147 2002-04-12 Ravi Pratap <ravi@ximian.com>
10149 * cs-parser.jay (compilation_unit): Revamp completely to use
10150 some new ideas that I got from Rhys' grammar to solve the problems
10151 with assembly level attributes.
10153 (outer_declaration): New grammar production.
10155 (attribute_sections): Add.
10157 (opt_attributes): Base on attribute_sections
10159 (namespace_declaration): Allow opt_attributes to tackle the case
10160 when we have assembly level attributes - we are clever in this
10163 * attribute.cs (ApplyAttributes): Do not worry about assembly
10164 attributes in the non-global context.
10166 * rootcontext.cs (AddGlobalAttributes): Go back to using this
10167 instead of SetGlobalAttributes.
10169 * class.cs, rootcontext.cs : Ensure we define and generate
10170 attribute types before anything else.
10172 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
10173 and flag the new error -20 for the case when the attribute type
10174 does not have valid targets specified. csc does not catch this.
10176 * ../errors/errors.txt : update for error # -20
10178 2002-04-11 Ravi Pratap <ravi@ximian.com>
10180 * support.cs (InternalParameters.ParameterModifier): Do some null
10181 checking and return sane values.
10183 * class.cs (Method.Define): If we are a PInvoke method, ensure
10184 that we are static and extern. Report error # 601
10186 * ../errors/cs0601.cs : Add test case for the above error.
10188 2002-04-07 Ravi Pratap <ravi@ximian.com>
10190 * rootcontext.cs (attribute_types): We need to keep type of
10191 all attribute types separately and emit code for them first.
10193 (RegisterAttribute) : Implement.
10195 * class.cs (DefineType): Check if the current Type is a custom
10196 attribute type and register it accordingly.
10198 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
10199 adding the first attribute twice and rename to
10201 (SetGlobalAttributes): this.
10203 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
10206 * attribute.cs (ApplyAttributes): Take an additional argument telling us
10207 if we are processing global arguments. Hmm, I am unsure of this.
10209 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10211 * expression.cs: added static array of strings to avoid calling
10212 Enum.ToString () for Operator in Binary. Significant recover of
10215 2002-04-10 Miguel de Icaza <miguel@ximian.com>
10217 * class.cs (FindMembers): Allow the Builders of the various
10218 members to be null. If they are skip them. This only happens
10219 during the PInvoke declaration.
10221 2002-04-09 Miguel de Icaza <miguel@ximian.com>
10223 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
10224 failure, so we do not keep going afterwards.
10226 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
10227 wanted to pass `false' as the `is_delegate' argument. If this is
10228 the case, why not use delegate_type == null to mean `is_delegate =
10229 false' and anything else as is_delegate = true.
10231 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
10233 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
10234 code for the section, not the beginning of the tests.
10236 2002-04-08 Miguel de Icaza <miguel@ximian.com>
10238 * cfold.cs: Handle operator + (Enum x, Underlying x)
10240 * expression.cs (Binary): same. Warn about errors where we have
10241 Enum/Enum in operator + as well.
10243 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
10246 - added support for switch(bool)
10247 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
10248 - add TableSwitchEmit() to handle table-based switch statements
10250 2002-04-05 Ravi Pratap <ravi@ximian.com>
10252 * expression.cs (Invocation.OverloadResolve): Factor out code which
10253 does parameter compatibility checking with arguments so that we can
10254 re-use the code even from Delegate.VerifyApplicability
10256 (VerifyArgumentsCompat): Move above code here.
10258 * delegate.cs (VerifyApplicability): Get rid of duplicate code
10259 and instead make a call to the above method.
10261 2002-03-31 Ravi Pratap <ravi@ximian.com>
10263 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
10264 We use it to keep track of classes which are attribute types.
10266 2002-04-02 Miguel de Icaza <miguel@ximian.com>
10268 * delegate.cs (Delegate.Define): Correctly define the types in the
10269 presence of fixed and array parameters.
10271 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
10274 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
10275 include NonPublic after the first iteration.
10277 * class.cs (Indexer.CheckBase): Only check if both parents are
10280 * cs-parser.jay (accessor_body): If empty, set to null.
10282 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
10283 same code path here to resolve constants names that we did have in
10284 MemberAccess.DoResolve. There is too much code duplicated here.
10286 2002-04-01 Miguel de Icaza <miguel@ximian.com>
10288 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
10290 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
10293 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
10294 tokens, numbers and strings.
10296 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
10299 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
10300 asyncronous parameters and the regular parameters.
10302 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
10303 specify the target directory.
10305 * expression.cs: (This.DoResolve): Simplify
10306 (As.Emit): Optimize, do not generate IsInst if the expression is
10307 always of the given type.
10309 (Is.DoResolve): Bug fix, we were reporting both always/never for
10312 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
10313 creating too many unnecessary arrays.
10315 2002-03-31 Miguel de Icaza <miguel@ximian.com>
10317 * class.cs (EmitFieldInitializer): Use Assign expression to assign
10318 fields instead of rolling our own initializer. Takes care of all
10319 implicit conversions, and drops unnecessary static checks/argument.
10321 2002-03-31 Dick Porter <dick@ximian.com>
10323 * driver.cs: use the GetDirectories() return values properly, and
10324 use "/" as path separator.
10326 2002-03-30 Miguel de Icaza <miguel@ximian.com>
10328 * expression.cs (Unary): Optimize - - expr into expr.
10329 (Binary): Optimize a + (-b) into a -b.
10331 * codegen.cs (CodeGen): Made all methods static.
10333 2002-03-29 Miguel de Icaza <miguel@ximian.com>
10337 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
10338 TypeBuilder property.
10340 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
10343 * tree.cs: Removed the various RecordXXXX, and replaced with a
10344 single RecordDecl. Removed all the accessor methods, and just
10345 left a single access point Type
10347 * enum.cs: Rename DefineEnum to DefineType.
10349 * decl.cs: New abstract method `DefineType' used to unify the
10350 Defines for Enumerations, Interfaces, TypeContainers and
10353 (FindType): Moved LookupInterfaceOrClass here. Moved the
10354 LookupBaseClasses method that used to live in class.cs and
10355 interface.cs here, and renamed to FindType.
10357 * delegate.cs: Implement DefineType. Take advantage of the
10358 refactored pattern for locating the parent builder without taking
10359 the parent_builder argument (which we know does not work if we are
10360 nested, and triggering a toplevel definition).
10362 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10364 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
10365 accessibility of a member has changed during override and report
10368 * class.cs (Method.Define, Property.Define): Only complain on
10369 overrides if the method is private, any other accessibility is
10370 fine (and since we just checked the permission is the same, we are
10373 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
10374 and elif are processed always. The other pre-processing
10375 directives are only processed if we are "taking" the path
10377 2002-03-29 Martin Baulig <martin@gnome.org>
10379 * class.cs (Method.Emit): Only emit symbolic debugging info if the
10380 current location is not Null.
10382 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
10383 a separate method so we can profile it.
10385 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
10386 `span.Seconds' are just seconds, but no minutes or hours.
10387 (MainDriver): Profile the CodeGen.SaveSymbols calls.
10389 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10391 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
10392 Remove the gratuitous set of Final:
10394 // If an interface implementation, then we can set Final.
10395 if (((flags & MethodAttributes.Abstract) == 0) &&
10396 implementing.DeclaringType.IsInterface)
10397 flags |= MethodAttributes.Final;
10399 I do not know what I was smoking when I used that.
10402 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
10403 step into fixing the name resolution issues for delegates and
10404 unifying the toplevel name resolution.
10406 2002-03-28 Martin Baulig <martin@gnome.org>
10408 * class.cs (Method.Emit): If we have a symbol writer, call its
10409 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
10410 tell it about the current method.
10412 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
10413 writer that we're going to emit the first byte of IL code for a new
10414 statement (a new source line).
10415 (EmitContext.EmitTopBlock): If we have a symbol writer, call
10416 EmitContext.Mark() before emitting any code.
10418 * location.cs (SymbolDocument): Return null when we're Null.
10420 * statement.cs (Statement): Moved the `Location loc' variable here.
10421 (Statement.EmitBoolExpression): If we have a symbol writer, call
10422 ec.Mark() before emitting any code to tell it that we're at the
10423 beginning of a new statement.
10424 (StatementExpression): Added `Location' argument to the constructor.
10425 (Block): Added public readonly variable `StartLocation' and public
10426 variable `EndLocation'. The latter is to be set using SetEndLocation().
10427 (Block): Added constructor which takes a start and end location.
10428 (Block.SetEndLocation): New method. This sets the end location.
10429 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
10430 local variables we create.
10431 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
10432 each statement and do also mark the begin and end of the block.
10434 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
10435 tell it the current lexer.Location, use Location.Null for the end of the
10437 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
10438 current block, set its end location using SetEndLocation().
10439 (statement_expression): StatementExpression constructor now takes the
10440 lexer.Location as additional argument.
10441 (for_statement, declare_local_variables): Likewise.
10442 (declare_local_variables): When creating a new implicit block, use the
10443 new Block constructor and pass it the lexer.Location.
10445 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10447 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
10448 members also on the parent interfaces recursively.
10450 2002-03-27 Miguel de Icaza <miguel@ximian.com>
10452 * report.cs: Use new formats, since Gonzalo finished the missing
10455 * expression.cs (Binary.ResolveOperator): added missing operator|
10456 operator& and operator^ for bool/bool.
10458 * cs-parser.jay: CheckDef now takes a Location argument that is
10459 used to report errors more precisly (instead of reporting the end
10460 of a definition, we try to track something which is a lot closer
10461 to the source of the problem).
10463 * cs-tokenizer.cs: Track global token use, so we can properly flag
10464 the use of #define/#undef after the first token has been seen.
10466 Also, rename the reportXXXX to Error_DescriptiveName
10468 * decl.cs (DeclSpace.IsTopLevel): Move property here from
10469 TypeContainer, so that Enum and Interface can use this too.
10471 * class.cs (TypeContainer.LookupInterfaceOrClass,
10472 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
10473 `builder' argument. Typically this was used to pass the parent
10474 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
10477 The problem is that a nested class could trigger the definition of
10478 a toplevel class, and the builder would be obviously wrong in that
10481 So we drop this argument, and we compute dynamically the
10482 TypeBuilder/ModuleBuilder (the correct information was available
10483 to us anyways from DeclSpace.Parent)
10485 * interface.cs (Interface.DefineInterface): Drop builder
10486 parameter cleanup like class.cs
10488 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
10491 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
10494 (Try.Emit): Propagate the returns value from the statement.
10496 (Return.Emit): Even if we are leavning
10498 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
10500 * modifiers.cs: Fix the computation of MethodAttributes flags.
10502 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
10504 * driver.cs: allow compilation of files that start with '/'.
10505 Add a default case when checking the argument of --target.
10507 2002-03-25 Miguel de Icaza <miguel@ximian.com>
10509 * interface.cs: Implement the same search algorithm for types in
10510 the interface code.
10512 * delegate.cs: Do not allow multiple definition.
10514 * Recovered ChangeLog that got accidentally amputated
10516 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
10518 * rootcontext.cs: Load manually enum to allow core classes to
10519 contain enumerations.
10521 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
10522 Update to new static methods in TypeManager.
10524 * typemanager.cs (GetMethod, GetConstructor): Use our
10525 implementation of FindMembers to find the members, since during
10526 corlib compilation, the types are TypeBuilders and GetMethod and
10527 GetConstructor do not work.
10529 Make all methods in TypeManager static.
10531 (InitCodeHelpers): Split the functionality from
10532 the InitCodeTypes function.
10534 * driver.cs: Call InitCodeHelpers after we have populated the
10537 * cs-parser.jay (delegate_declaration): we did not used to compute
10538 the delegate name correctly for void delegates.
10540 2002-03-24 Miguel de Icaza <miguel@ximian.com>
10542 * rootcontext.cs (RootContext): Init the interface_resolve_order
10543 and type_container_resolve_order always.
10545 (ResolveCore, BootstrapCorlib_ResolveClass,
10546 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
10547 compiler when compiling with --nostdlib
10549 * class.cs (TypeContainer.DefineType): Check that our parent is
10550 not null. This test is most important when we are bootstraping
10553 * codegen.cs: Split out the symbol writing code.
10555 2002-03-25 Martin Baulig <martin@gnome.org>
10557 * driver.cs (-g): Made -g an alias for --debug.
10559 2002-03-24 Martin Baulig <martin@gnome.org>
10561 * codegen.cs (SymbolWriter): New public variable. Returns the
10562 current symbol writer.
10563 (CodeGen): Added `bool want_debugging_support' argument to the
10564 constructor. If true, tell the ModuleBuild that we want debugging
10565 support and ask it for the ISymbolWriter.
10566 (Save): If we have a symbol writer, call it's Close() method after
10567 saving the assembly.
10569 * driver.c (--debug): New command line argument to create a
10570 debugger information file.
10572 * location.cs (SymbolDocument): New public property. Returns an
10573 ISymbolDocumentWriter object for the current source file or null
10574 if we don't have a symbol writer.
10576 2002-03-21 Miguel de Icaza <miguel@ximian.com>
10578 * driver.cs (LoadAssembly): Correctly return when all the paths
10579 have been tried and not before.
10581 * statement.cs (Switch.Emit): return the actual coverage for this
10582 statement (returns/not-returns)
10584 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
10585 switch of the statement if we are the last switch section. That
10586 kills two problems: try/catch problems (we used to emit an empty
10587 nop at the end) and switch statements where all branches would
10590 2002-03-19 Miguel de Icaza <miguel@ximian.com>
10592 * driver.cs: Add default assemblies (the equivalent to the
10593 Microsoft CSC.RSP file)
10595 * cs-tokenizer.cs: When updating `cols and setting it to zero,
10596 also update tokens_seen and set it to false.
10598 * driver.cs: Implement --recurse for Mike.
10600 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
10601 correctly splitting out the paths.
10603 2002-03-18 Miguel de Icaza <miguel@ximian.com>
10605 * interface.cs (Interface.PopulateProperty): Instead of using
10606 `parent' as the declaration space for the set parameters, use
10609 * support.cs (InternalParameters): InternalParameters constructor
10610 takes a DeclSpace instead of a TypeContainer.
10612 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
10613 types are being initialized, load the address of it before calling
10616 (New): Provide a mechanism to disable the generation of local
10617 value type temporaries when the caller will be providing us with
10618 an address to store it.
10620 (ArrayCreation.EmitDynamicInitializers): Use it.
10622 2002-03-17 Miguel de Icaza <miguel@ximian.com>
10624 * expression.cs (Invocation.EmitArguments): Only probe for array
10625 property if there is more than one argument. Sorry about that.
10627 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
10628 empty param arrays.
10630 * class.cs (Method.LabelParameters): Fix incorrect code path that
10631 prevented the `ParamArrayAttribute' from being applied to the
10634 2002-03-16 Miguel de Icaza <miguel@ximian.com>
10636 * support.cs (ReflectionParameters): Correctly compute whether the
10637 last argument is a params array. Fixes the problem with
10640 * typemanager.cs: Make the assemblies array always be non-null
10641 (empty, but non-null)
10643 * tree.cs (RecordDecl): New function that abstracts the recording
10644 of names. This reports error 101, and provides a pointer to the
10645 previous declaration. Fixes a crash in the compiler.
10647 * cs-parser.jay (constructor_declaration): Update to new grammar,
10648 and provide a constructor_body that can be empty.
10650 2002-03-15 Miguel de Icaza <miguel@ximian.com>
10652 * driver.cs: Add support for --resources.
10654 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
10655 Make all types for the various array helper methods be integer.
10657 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
10658 CheckState to ConvCast.
10660 (ConvCast): Now it takes a `checked' state argument, to avoid
10661 depending on the emit context for the conversion, and just using
10662 the resolve time setting.
10664 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
10665 instead of Invocation.EmitArguments. We do not emit the original
10666 arguments, instead we emit those which have been converted to
10667 unsigned int expressions.
10669 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
10671 * codegen.cs: ditto.
10673 * expression.cs (LocalVariableReference): Drop the use of the
10674 Store function that depended on the variable index.
10676 * statement.cs (VariableInfo): Drop the `Idx' property from this
10677 class, as this is not taking into account the indexes for
10678 temporaries tat we generate during the execution, getting the
10681 * class.cs: First emit class initializers, then call the parent
10684 * expression.cs (Binary): Fix opcode emision.
10685 (UnaryMutator.EmitCode): Support checked code generation
10687 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
10688 matches for events for both the Static and Instance scans,
10689 pointing to the same element. Fix that.
10691 2002-03-14 Miguel de Icaza <miguel@ximian.com>
10693 * rootcontext.cs (ResolveTree): Always set the
10694 interface_resolve_order, because nested interfaces will be calling
10697 * class.cs (GetInterfaceOrClass): Track the same resolution
10698 process used by TypeManager.LookupType. This fixes the nested
10699 type lookups in class declarations (separate path from
10702 (TypeContainer.DefineType): Also define nested interfaces.
10703 (TypeContainer.RegisterOrder): New public function used to
10704 register the order in which child interfaces need to be closed.
10706 Nested interfaces need to be closed after their parents have been
10709 * interface.cs (InterfaceAttr): Put all the logic for computing
10710 the interface attribute here.
10712 (DefineInterface): Register our interface order with the
10713 RootContext or with the TypeContainer depending on the case.
10715 2002-03-12 Miguel de Icaza <miguel@ximian.com>
10717 * cs-parser.jay: rework foreach statement to work with the new
10718 changes to the policy on SimpleNames.
10720 * report.cs: support Stacktrace on warnings as well.
10722 * makefile: drop --unsafe and /unsafe from the compile.
10724 2002-03-13 Ravi Pratap <ravi@ximian.com>
10726 * ecore.cs (StandardConversionExists): Modify to take an Expression
10727 as the first parameter. Ensure we do null -> reference type conversion
10730 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
10731 temporary Expression objects.
10733 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
10735 * interface.cs: workaround bug in method overloading resolution
10736 (there is already a bugzilla bug for it).
10738 2002-03-12 Miguel de Icaza <miguel@ximian.com>
10740 We could also solve this problem by having a separate path for
10741 performing type lookups, instead of DoResolve, we could have a
10742 ResolveType entry point, and only participating pieces of the
10743 production (simplename, deref, array) would implement this.
10745 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
10746 signal SimpleName to only resolve type names and not attempt to
10747 resolve anything else.
10749 * expression.cs (Cast): Set the flag.
10751 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
10753 * class.cs: Only report 108 if there is no `new' modifier.
10755 * cs-parser.jay: rework foreach statement to work with the new
10756 changes to the policy on SimpleNames.
10758 * report.cs: support Stacktrace on warnings as well.
10760 * makefile: drop --unsafe and /unsafe from the compile.
10762 2002-03-11 Miguel de Icaza <miguel@ximian.com>
10764 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
10765 lookups here, instead of doing that at parse time. This means
10766 that our grammar will not introduce `LocalVariableReferences' as
10767 expressions at this point. That solves the problem of code like
10771 static void Main ()
10775 This is only half the fix. The full fix requires parameters to
10776 also be handled in this way.
10778 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
10779 makes the use more obvious of the DeclSpace. The
10780 ec.TypeContainer.TypeBuilder is now only used to pull the
10781 TypeBuilder for it.
10783 My theory is that I can get rid of the TypeBuilder completely from
10784 the EmitContext, and have typecasts where it is used (from
10785 DeclSpace to where it matters).
10787 The only pending problem is that the code that implements Aliases
10788 is on TypeContainer, and probably should go in DeclSpace.
10790 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
10791 lookups here, instead of doing that at parse time. This means
10792 that our grammar will not introduce `LocalVariableReferences' as
10793 expressions at this point. That solves the problem of code like
10797 static void Main ()
10801 This is only half the fix. The full fix requires parameters to
10802 also be handled in this way.
10804 * class.cs (Property.DefineMethod): When implementing an interface
10805 method, set newslot, when implementing an abstract method, do not
10806 set the flag (before we tried never setting it, or always setting
10807 it, which is the difference).
10808 (Indexer.DefineMethod): same.
10809 (Method.DefineMethod): same.
10811 * ecore.cs: Only set the status used flag if we get back a Field.
10813 * attribute.cs: Temporary hack, so Paolo can keep working.
10815 2002-03-08 Ravi Pratap <ravi@ximian.com>
10817 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
10818 the unmanaged type in the case we have a MarshalAs attribute.
10820 (Resolve): Handle the case when we are parsing the special MarshalAs
10821 attribute [we need to store the unmanaged type to use later]
10823 * typemanager.cs (marshal_as_attr_type): Built in type for the
10824 MarshalAs Attribute.
10826 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
10827 on parameters and accordingly set the marshalling info.
10829 2002-03-09 Miguel de Icaza <miguel@ximian.com>
10831 * class.cs: Optimizing slightly by removing redundant code after
10832 we switched to the `NoTypes' return value.
10833 (Property.DefineMethod): use NoTypes here too.
10835 This fixes the bug I introduced in my last batch of changes.
10837 2002-03-05 Ravi Pratap <ravi@ximian.com>
10839 * tree.cs (RecordEnum): Add. We now keep track of enums too.
10841 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
10842 Enums since those are types too.
10844 * cs-parser.jay (enum_declaration): Record enums as we parse them.
10846 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
10847 thanks to a call during the lookup process.
10849 2002-03-07 Miguel de Icaza <miguel@ximian.com>
10851 * statement.cs (Foreach): Lots of work to accomodate a particular
10852 kind of foreach statement that I had not kept in mind. It is
10853 possible to have foreachs on classes that provide a GetEnumerator
10854 method that return objects that implement the "pattern" for using
10855 a foreach, there is no need to support GetEnumerator
10858 This is needed to compile nant.
10860 * decl.cs: Only report 114 if the member is not `Finalize' and if
10861 the warning level is at least 2.
10863 * class.cs: Moved the compare function from Method to
10866 (MethodSignature.InheritableMemberSignatureCompare): Add new
10867 filter function that is used to extract inheritable methods from a
10870 (Method.Define): Use the new `inheritable_method_signature_filter'
10873 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
10876 2002-03-06 Miguel de Icaza <miguel@ximian.com>
10878 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
10880 * cs-parser.jay: Add opt_semicolon to the interface declaration.
10882 * expression.cs: Pass location information to
10883 ConvertImplicitStandard.
10885 * class.cs: Added debugging code to track return values from
10888 2002-03-05 Miguel de Icaza <miguel@ximian.com>
10890 * expression.cs (Is.DoResolve): If either side of the `is' is an
10891 interface, do not flag the warning.
10893 * ecore.cs (ImplicitReferenceConversion): We need a separate test
10896 * report.cs: Allow for --fatal to be used with --probe.
10898 * typemanager.cs (NoTypes): Move the definition for the empty Type
10901 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
10903 (TypeContainer.DefineProxy): New function used to proxy to parent
10904 implementations when implementing interfaces.
10905 (TypeContainer.ParentImplements): used to lookup if our parent
10906 implements a public function that is required by an interface.
10907 (TypeContainer.VerifyPendingMethods): Hook this up.
10909 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
10910 `modules' and `assemblies' arraylists into arrays. We only grow
10911 these are the very early start up of the program, so this improves
10912 the speedof LookupType (nicely measured).
10914 * expression.cs (MakeByteBlob): Replaced unsafe code with
10915 BitConverter, as suggested by Paolo.
10917 * cfold.cs (ConstantFold.Binary): Special case: perform constant
10918 folding of string concatenation, but if either side is a string,
10919 and the other is not, then return null, and let the runtime use
10920 the concatenation on the string plus the object (using
10921 `Object.ToString').
10923 2002-03-04 Miguel de Icaza <miguel@ximian.com>
10925 Constant Folding has been implemented now.
10927 * expression.cs (Unary.Reduce): Do not throw an exception, catch
10928 the error instead on types that are not supported in one's
10931 * constant.cs (Constant and all children): New set of functions to
10932 perform implict and explicit conversions.
10934 * ecore.cs (EnumConstant): Implement the new functions to perform
10935 conversion by proxying to the child expression.
10937 * codegen.cs: (ConstantCheckState): Constant evaluation has its
10938 own separate setting that can not be turned off from the command
10939 line using --unchecked or --checked and is only controlled using
10940 the checked/unchecked statements and expressions. This setting is
10941 used by the constant folder to flag errors.
10943 * expression.cs (CheckedExpr, UncheckedExpr): Set the
10944 ConstantCheckState as well.
10946 During Resolve, they also have to flag the state, because the
10947 constant folder runs completely in the Resolve phase.
10949 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
10952 2002-03-01 Miguel de Icaza <miguel@ximian.com>
10954 * cfold.cs: New file, this file contains the constant folder.
10956 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
10957 argument to track whether we are using the resulting address to
10958 load or store a value and provide better error messages.
10960 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
10961 new AddressOf arguments.
10963 * statement.cs (Foreach.EmitCollectionForeach): Update
10965 * expression.cs (Argument.Emit): Call AddressOf with proper
10966 arguments to track usage.
10968 (New.DoEmit): Call AddressOf with new arguments.
10970 (Unary.Emit): Adjust AddressOf call.
10972 2002-03-01 Ravi Pratap <ravi@ximian.com>
10974 * cs-parser.jay (member_access): Change the case for pre-defined types
10975 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
10978 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
10981 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
10982 essentially like methods and apply attributes like MethodImplOptions to them too.
10984 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
10987 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
10988 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
10991 * Update code everywhere accordingly.
10993 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
10995 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
10997 2002-02-28 Ravi Pratap <ravi@ximian.com>
10999 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
11000 try performing lookups against those instead of jumping straight into using
11001 the 'using' clauses.
11003 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
11005 (LookupType): Perform lookups in implicit parents too.
11007 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
11008 sequence as RootContext.LookupType.
11010 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
11011 the various cases of namespace lookups into this method.
11013 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11015 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
11016 in positional arguments)
11018 * class.cs (Operator): Update the AllowedModifiers to contain
11021 * cs-parser.jay: Update operator declaration to allow for the
11022 operator body to be empty.
11024 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
11027 2002-02-27 Miguel de Icaza <miguel@ximian.com>
11029 * class.cs (Method.Emit): Label parameters.
11031 * driver.cs: Return 1 or 0 as the program exit code.
11033 2002-02-26 Miguel de Icaza <miguel@ximian.com>
11035 * expression.cs: Special case the `null' object when trying to
11036 auto-compute the type, as anything can be explicitly converted to
11039 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
11040 spotting this Paolo.
11042 (Expression.ImplicitNumericConversion): Perform comparissions of
11043 the type using the underlying type in the case of an enumeration
11044 rather than using the enumeration type for the compare.
11046 Cope with the underlying == type case, which is not possible to
11049 (Expression.ConvertNumericExplicit): Perform comparissions of
11050 the type using the underlying type in the case of an enumeration
11051 rather than using the enumeration type for the compare.
11053 * driver.cs: If the user does not supply an extension, assume .exe
11055 * cs-parser.jay (if_statement): Rewrote so that we can track the
11056 location for the if statement.
11058 * expression.cs (Binary.ConstantFold): Only concat strings when
11059 the operation is "+", not everything ;-)
11061 * statement.cs (Statement.EmitBoolExpression): Take a location
11063 (If, While, Do): Track location.
11065 * expression.cs (Binary.ResolveOperator): In the object + string
11066 case, I was missing a call to ConvertImplicit
11068 2002-02-25 Ravi Pratap <ravi@ximian.com>
11070 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
11071 Location arguments. Ensure we use RootContext.LookupType to do our work
11072 and not try to do a direct Type.GetType and ModuleBuilder.GetType
11074 * interface.cs (PopulateMethod): Handle the type of the parameter being
11077 * expression.cs (Invocation.BetterFunction): Handle the case when we
11078 have a params method with no fixed arguments and a call is made with no
11081 2002-02-25 Miguel de Icaza <miguel@ximian.com>
11083 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
11084 the verbatim-string-literal
11086 * support.cs (InternalParameters.ParameterModifier): handle null
11088 (InternalParameters.ParameterType): ditto.
11090 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
11091 duplicating the name of the variable parameter.
11092 (GetParameterByName): Fix bug where we were not looking up array
11093 paramters if they were the only present (thanks Paolo!).
11094 (GetParameterInfo): We only have an empty set of types if both
11095 fixed and array are set to null.
11096 (GetParameterInfo-idx): Handle FixedParameter == null
11098 * cs-parser.jay: Handle the case where there is no catch
11099 statements (missing null test).
11101 2002-02-22 Miguel de Icaza <miguel@ximian.com>
11103 * driver.cs (MainDriver): Be conservative on our command line
11106 Catch DirectoryNotFoundException when calling GetFiles.
11108 (SplitPathAndPattern): Used to split the input specification into
11109 a path and a pattern that we can feed to Directory.GetFiles.
11111 2002-02-21 Miguel de Icaza <miguel@ximian.com>
11113 * statement.cs (Fixed): Implement the last case of the Fixed
11114 statement (string handling).
11116 * expression.cs (StringPtr): New class used to return a char * to
11117 a string; Used by the Fixed statement.
11119 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
11121 * expression.cs (Binary.ResolveOperator): Remove redundant
11122 MemberLookup pn parent type.
11123 Optimize union call, we do not need a union if the types are the same.
11124 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
11127 Specialize the use of MemberLookup everywhere, instead of using
11128 the default settings.
11130 (StackAlloc): Implement stackalloc keyword.
11132 * cs-parser.jay: Add rule to parse stackalloc.
11134 * driver.cs: Handle /h, /help, /?
11136 * expression.cs (MakeByteBlob): Removed the hacks we had in place
11137 before we supported unsafe code.
11139 * makefile: add --unsafe to the self compilation of mcs.
11141 2002-02-20 Miguel de Icaza <miguel@ximian.com>
11143 * expression.cs (PointerArithmetic): New class that is used to
11144 perform pointer arithmetic.
11145 (Binary.Resolve): Handle pointer arithmetic
11146 Handle pointer comparission.
11147 (ArrayPtr): Utility expression class that is used to take the
11148 address of an array.
11150 (ElementAccess): Implement array access for pointers
11152 * statement.cs (Fixed): Implement fixed statement for arrays, we
11153 are missing one more case before we are done.
11155 * expression.cs (Indirection): Implement EmitAssign and set the
11156 ExprClass to Variable. This allows pointer dereferences to be
11157 treated as variables, and to have values assigned to them.
11159 * ecore.cs (Expression.StoreFromPtr): New utility function to
11160 store values dereferencing.
11162 2002-02-20 Ravi Pratap <ravi@ximian.com>
11164 * expression.cs (Binary.ResolveOperator): Ensure that we are
11165 not trying to operate on a void type - this fixes the reported
11168 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
11169 the parent implementation is sealed.
11171 * ../errors/cs0239.cs : Add.
11173 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
11175 * typemanager.cs (unverifiable_code_type): Corresponds to
11176 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
11177 which have unsafe code in them.
11179 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
11182 2002-02-19 Miguel de Icaza <miguel@ximian.com>
11184 * cs-tokenizer.cs: Add support for @"litreal strings"
11186 Make tokenizer accept pre-processor directives
11187 on any column (remove the old C-like limitation).
11189 * rootcontext.cs (EmitCode): Emit any global attributes.
11190 (AddGlobalAttributes): Used to keep track of assembly attributes.
11192 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
11194 * cs-parser.jay: Add support for global attributes.
11196 2002-02-17 Miguel de Icaza <miguel@ximian.com>
11198 * expression.cs (Indirection): New helper class. Unary will
11199 create Indirection classes to be able to implement the
11200 IMemoryLocation interface on it.
11202 2002-02-16 Miguel de Icaza <miguel@ximian.com>
11204 * cs-parser.jay (fixed_statement): reference the right statement.
11206 * statement.cs (Fixed.Emit): Finish implementing the fixed
11207 statement for the &x case.
11209 2002-02-14 Miguel de Icaza <miguel@ximian.com>
11211 * class.cs (Property.Define, Method.Define): Remove newslot when
11214 * modifiers.cs: My use of NewSlot when `Abstract' was set was
11215 wrong. NewSlot should only be used if the `new' keyword is present.
11217 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
11218 locating our system dir. Sorry about this.
11220 2002-02-13 Miguel de Icaza <miguel@ximian.com>
11222 * driver.cs (GetSystemDir): Compute correctly the location of our
11223 system assemblies. I was using the compiler directory instead of
11224 the library directory.
11226 2002-02-13 Ravi Pratap <ravi@ximian.com>
11228 * expression.cs (BetterFunction): Put back in what Miguel commented out
11229 since it is the correct fix. The problem is elsewhere ;-)
11231 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
11232 parameters of the parms method are themselves compatible or not !
11234 (StandardConversionExists): Fix very dangerous bug where we were forgetting
11235 to check that a class implements an interface before saying that an implicit
11236 conversion was allowed. Use ImplementsInterface to do the checking.
11238 2002-02-13 Miguel de Icaza <miguel@ximian.com>
11240 * class.cs (Method.Define): Track whether we are an explicit
11241 implementation or not. And only call DefineMethodOverride if we
11242 are an explicit implementation.
11244 (Property.DefineMethod): Ditto.
11246 2002-02-11 Ravi Pratap <ravi@ximian.com>
11248 * expression.cs (BetterFunction): Catch hideous bug which was
11249 preventing us from detecting ambiguous calls due to implicit casts i.e
11252 2002-01-29 Miguel de Icaza <miguel@ximian.com>
11254 * support.cs (Pair): Remove un-needed method. I figured why I was
11255 getting the error in cs-parser.jay, the variable in a foreach loop
11256 is readonly, and the compiler does not really treat this as a variable.
11258 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
11259 instead of EQUALS in grammar.
11261 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
11263 * expression.cs (Unary.DoResolve): Check whether the argument is
11266 2002-01-28 Miguel de Icaza <miguel@ximian.com>
11268 * support.cs: Api for Pair to set a value. Despite the fact that
11269 the variables are public the MS C# compiler refuses to compile
11270 code that accesses the field if the variable is part of a foreach
11273 * statement.cs (Fixed): Begin implementation of the fixed
11276 (Block.AddVariable): Return the VariableInfo on success and null
11277 on failure instead of true/false.
11279 * cs-parser.jay (foreach): Catch errors on variables already
11280 defined (we were ignoring this value before) and properly unwind
11281 the block hierarchy
11283 (fixed_statement): grammar for the fixed statement.
11285 2002-01-25 Miguel de Icaza <miguel@ximian.com>
11287 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
11288 pointer types to be incretemented.
11290 (SizeOf): Implement.
11292 * cs-parser.jay (pointer_member_access): Implement
11293 expr->IDENTIFIER production.
11295 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
11296 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
11299 (Unary): Implement indirection.
11301 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
11302 use in non-unsafe context).
11304 (SimpleName.DoResolve): Check for pointers in field access on safe
11307 (Expression.LoadFromPtr): Factor the load-indirect code in this
11308 function. This was duplicated in UnboxCast and ParameterReference
11310 2002-01-24 Miguel de Icaza <miguel@ximian.com>
11312 * expression.cs (ComposedCast): report an error if a pointer cast
11313 is used in a safe region.
11315 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
11316 pointer type casts in unsafe context.
11318 * codegen.cs (EmitContext): Set up IsUnsafe.
11320 * cs-parser.jay (non_expression_type): Add productions for pointer
11323 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
11324 code. We should not use force into static mode if the method is
11325 not virtual. Fixes bug in MIS
11327 * statement.cs (Do.Emit, While.Emit, For.Emit,
11328 Statement.EmitBoolExpression): Add support to Do and While to
11329 propagate infinite loop as `I do return' semantics.
11331 Improve the For case to also test for boolean constants.
11333 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
11334 to the list of attributes we can add.
11336 Remove `EmitContext' argument.
11338 * class.cs (Method.Define): Apply parameter attributes.
11339 (Constructor.Define): Apply parameter attributes.
11340 (MethodCore.LabelParameters): Move here the core of labeling
11343 * support.cs (ReflectionParameters.ParameterModifier,
11344 InternalParameters.ParameterModifier): Use IsByRef on the type and
11345 only return the OUT bit for these parameters instead of in/out/ref
11348 This is because I miss-understood things. The ParameterInfo.IsIn
11349 and IsOut represent whether the parameter has the [In] and [Out]
11352 2002-01-22 Miguel de Icaza <miguel@ximian.com>
11354 * ecore.cs (FieldExpr.Emit): Release temporaries.
11356 * assign.cs (LocalTemporary.Release): new function.
11358 * codegen.cs (EmitContext.GetTemporaryStorage,
11359 EmitContext.FreeTemporaryStorage): Rework the way we deal with
11360 temporary storage. Now we can "put back" localbuilders when we
11363 2002-01-21 Miguel de Icaza <miguel@ximian.com>
11365 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
11366 need to make a copy of the variable to generate verifiable code.
11368 2002-01-19 Miguel de Icaza <miguel@ximian.com>
11370 * driver.cs: Compute dynamically the system directory.
11372 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
11373 Slower, but more generally useful. Used by the abstract
11374 registering implementation.
11376 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
11377 the rules for the special rule on Type/instances. First check if
11378 we have the same name, and if so, try that special static path
11379 rather than the instance path.
11381 2002-01-18 Miguel de Icaza <miguel@ximian.com>
11383 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
11386 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
11387 Enum, ValueType, Delegate or Array for non-corlib compiles.
11389 * cs-tokenizer.cs: Catch long identifiers (645)
11391 * typemanager.cs (IndexerPropetyName): Ravi never tested this
11394 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
11395 fix, we were returning too early, so we were not registering
11396 pending methods from abstract classes.
11398 Do not register pending methods if the class is abstract.
11400 * expression.cs (Conditional.DoResolve): Report circular implicit
11401 conversions when we neecd to compute it for conditional
11404 (Is.DoResolve): If the expression is always of the provided type,
11405 flag warning 183. If the expression can not ever be of the
11406 provided type flag warning 184.
11408 * class.cs: Catch 169 as well.
11410 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
11413 2002-01-18 Nick Drochak <ndrochak@gol.com>
11415 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
11417 2002-01-17 Miguel de Icaza <miguel@ximian.com>
11419 * interface.cs: (PopulateMethod): Check for pointers being defined
11420 only if the unsafe context is active.
11421 (PopulateProperty): ditto.
11422 (PopulateIndexer): ditto.
11424 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
11425 specified. If pointers are present, make sure that they are
11426 present in an unsafe context.
11427 (Constructor, Constructor.Define): ditto.
11428 (Field, Field.Define): ditto.
11429 (Property, Property.Define): ditto.
11430 (Event, Event.Define): ditto.
11432 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
11433 hashtable if there are classes or structs defined.
11435 * expression.cs (LocalVariableReference.DoResolve): Simplify this
11436 code, as the constant resolution moved.
11438 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
11439 the metadata, so we can flag error 133.
11441 * decl.cs (MemberCore.UnsafeOK): New function to test that a
11442 pointer is being declared in an unsafe context.
11444 2002-01-16 Miguel de Icaza <miguel@ximian.com>
11446 * modifiers.cs (Modifiers.Check): Require a Location argument.
11447 Report error 227 for Unsafe use.
11449 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
11451 * statement.cs (For.Emit): If the test is null, then report that
11452 we do `return', as we wont reach anything afterwards.
11454 (Switch.SwitchGoverningType): Track the expression that matched
11457 * driver.cs: Allow negative numbers as an error code to flag.
11459 * cs-parser.jay: Handle 1551.
11461 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
11463 2002-01-15 Miguel de Icaza <miguel@ximian.com>
11465 * cs-parser.jay: Report 1518 (type declaration can only contain
11466 class, struct, interface, enum or delegate)
11468 (switch_label): Report 1523 (keywords `case' or `default' must
11471 (opt_switch_sections): Report 1522 (empty switch)
11473 * driver.cs: Report 1515 (response file specified multiple times)
11474 Report 1516 (Source file specified multiple times).
11476 * expression.cs (Argument.Resolve): Signal 1510
11478 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
11479 access not allowed in static code)
11481 2002-01-11 Ravi Pratap <ravi@ximian.com>
11483 * typemanager.cs (IsPointerType): Utility method which we are going
11486 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
11487 the object type, so we take care of that.
11489 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
11491 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
11492 added to non-params parameters :-)
11494 * typemanager.cs (CSharpName): Include 'void' type too.
11496 (void_ptr_type): Include in the set of core types.
11498 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
11501 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
11504 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
11505 completely forgotten about it.
11507 2002-01-10 Ravi Pratap <ravi@ximian.com>
11509 * cs-parser.jay (pointer_type): Add. This begins our implementation
11510 of parsing rules for unsafe code.
11512 (unsafe_statement): Implement.
11514 (embedded_statement): Modify to include the above.
11516 * statement.cs (Unsafe): Implement new class for unsafe blocks.
11518 * codegen.cs (EmitContext.InUnsafe): Add. This determines
11519 if the current context is an unsafe one.
11521 * cs-parser.jay (local_variable_pointer_type): Since local variable types
11522 are handled differently, we need separate rules for them.
11524 (local_variable_declaration): Update to use local_variable_pointer_type
11525 to allow variable declarations of unmanaged pointer types.
11527 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
11528 in unsafe contexts.
11530 * ../errors/cs0214.cs : Add.
11532 2002-01-16 Nick Drochak <ndrochak@gol.com>
11534 * makefile: remove 'response' file when cleaning.
11536 2002-01-15 Miguel de Icaza <miguel@ximian.com>
11538 * cs-parser.jay: Report 1524.
11540 2002-01-14 Miguel de Icaza <miguel@ximian.com>
11542 * typemanager.cs (RegisterMethod): drop checking if we have
11543 registered this from here
11545 2002-01-12 Miguel de Icaza <miguel@ximian.com>
11547 * class.cs (Method.EmitDestructor): Implement calling our base
11550 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
11551 value of InFinally.
11553 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
11554 this routine and will wrap the call in a try/catch block. Deal
11557 2002-01-11 Miguel de Icaza <miguel@ximian.com>
11559 * ecore.cs (Expression.MemberLookup): instead of taking a
11560 parameter `same_type' that was used to tell whether we could
11561 access private members we compute our containing type from the
11564 (FieldExpr): Added partial support for volatile fields. This does
11565 not work for volatile fields exposed from assemblies, as I can not
11566 figure out how to extract the modreq from it.
11568 Updated all the source files to use this.
11570 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
11571 because it is referenced by MemberLookup very often.
11573 2002-01-09 Ravi Pratap <ravi@ximian.com>
11575 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
11576 TypeBuilder.GetCustomAttributes to retrieve what we need.
11578 Get rid of redundant default_member_attr_type as this is the same as
11579 default_member_type which already exists.
11581 * interface.cs, attribute.cs : Update accordingly.
11583 2002-01-08 Miguel de Icaza <miguel@ximian.com>
11585 * typemanager.cs: Enable IndexerPropertyName again. It does not
11586 work for TYpeBuilders though. Ravi, can you please fix this?
11588 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
11590 * expression.cs (Argument.Emit): Handle the case of ref objects
11591 being passed to ref functions;
11593 (ParameterReference.EmitLoad): Loads the content of the pointer
11594 without dereferencing.
11596 2002-01-07 Miguel de Icaza <miguel@ximian.com>
11598 * cs-tokenizer.cs: Implemented the pre-processing expressions.
11600 2002-01-08 Ravi Pratap <ravi@ximian.com>
11602 * class.cs (Indexer.DefineMethod): Incorporate the interface
11603 type in the name of the method if we are doing explicit interface
11606 * expression.cs (ConversionExists): Remove as it is completely obsolete.
11608 (BetterConversion): Fix extremely trivial bug where we were referring to
11609 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
11612 * ../errors/bug16.cs : Add although we have fixed it.
11614 2002-01-07 Miguel de Icaza <miguel@ximian.com>
11616 * expression.cs (BaseIndexer): Begin implementation.
11618 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
11620 * cs-parser.jay (indexer_declarator): Use qualified_identifier
11621 production directly to remove a shift/reduce, and implement
11622 explicit interface implementation.
11624 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
11625 after a floating point suffix.
11627 * expression.cs (DoNumericPromotions): Improved the conversion for
11628 uint/uint. If we have a constant, we avoid doing a typecast to a
11631 * class.cs (Indexer): Implement explicit interface implementation
11634 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
11636 * class.cs: make the default instance constructor public and hidebysig.
11638 2001-01-03 Ravi Pratap <ravi@ximian.com>
11640 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
11641 so we can call it from elsewhere.
11643 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
11644 we emit it internally if the class has a defined indexer; otherwise the user
11645 emits it by decorating the class definition with the DefaultMemberAttribute.
11647 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
11648 attribute is not used on a type which defines an indexer.
11650 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
11651 character when we skip whitespace.
11653 * ../errors/cs0646.cs : Add.
11655 2002-01-03 Miguel de Icaza <miguel@ximian.com>
11657 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
11660 * makefile: Add practical target `mcs3.exe' which builds the third
11661 generation compiler.
11663 * expression.cs (New): Fix structures constructor calling.
11665 * class.cs (Property, Method, Indexer): Emit Final flag on the
11666 method if we are an interface implementation and we are not
11669 * ecore.cs (PropertyExpr): New public field `IsBase', tells
11670 whether this property is referencing a `base' method.
11672 * expression.cs (Invocation.EmitCall): take an extra argument:
11673 is_base, this is used to determine whether the `call' or
11674 `callvirt' opcode should be used.
11677 * delegate.cs: update EmitCall.
11679 * class.cs (Method.Define): Set NewSlot for the cases where we are
11680 not implementing an interface method.
11682 (Property.Define): ditto.
11684 2002-01-02 Miguel de Icaza <miguel@ximian.com>
11686 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
11687 'r'. Allows mcs to parse itself fully.
11689 2002-01-02 Ravi Pratap <ravi@ximian.com>
11691 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
11692 of the number of initializers that require the InitializeArray method.
11694 (CheckIndices): Store the Expression in all cases - not the plain value. Also
11695 update the above field where necessary.
11697 (MakeByteBlob): Update accordingly.
11699 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
11702 (EmitDynamicInitializers): Update in accordance with the new optimization.
11704 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
11705 same OpCode applies.
11707 * cs-parser.jay : Fix some glaring errors I introduced.
11709 2002-01-01 Ravi Pratap <ravi@ximian.com>
11711 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
11712 so that we can check for name clashes there too.
11714 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
11715 for interface indexers.
11717 * interfaces.cs (Define): Emit the default member attribute.
11719 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
11720 variable was being referred to while setting the value ;-)
11722 2002-01-01 Miguel de Icaza <miguel@ximian.com>
11724 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
11725 byte-by-byte information when we know the data is zero.
11727 Make the block always a multiple of 4, because
11728 DefineInitializedData has a bug.
11730 * assign.cs: Fix, we should assign from the temporary, not from
11733 * expression.cs (MakeByteBlob): Fix my incorrect code.
11735 2001-12-31 Miguel de Icaza <miguel@ximian.com>
11737 * typemanager.cs (EnumToUnderlying): This function is used to get
11738 the underlying type from an enumeration, because it does not
11741 * constant.cs: Use the I4_S form for values between -128 and 127.
11743 * statement.cs (Block.LookupLabel): Looks up a label.
11744 (Block): Drop support for labeled blocks.
11746 (LabeledStatement): New kind of statement that represents a label
11749 (Goto): Finally implement this bad boy.
11751 * cs-parser.jay: Update to reflect new mechanism to implement
11754 2001-12-30 Miguel de Icaza <miguel@ximian.com>
11756 * codegen.cs (EmitContext.This): a codegen property that keeps the
11757 a single instance of this instead of creating many different this
11760 * delegate.cs (Delegate.DoResolve): Update to use the property;
11762 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
11764 * expression.cs (BaseAccess.DoResolve): Ditto.
11766 2001-12-29 Ravi Pratap <ravi@ximian.com>
11768 * typemanager.cs (methodimpl_attr_type): Add to hold the type
11769 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
11771 (InitCoreTypes): Update accordingly.
11773 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
11774 so we can quickly store the state.
11776 (ApplyAttributes): Set the correct implementation flags
11777 for InternalCall methods.
11779 2001-12-29 Miguel de Icaza <miguel@ximian.com>
11781 * expression.cs (EmitCall): if a method is not virtual, then do
11782 not use callvirt on it.
11784 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
11785 user defined stuff) requires the use of stobj, which takes an
11786 address on the stack instead of an array and an index. So emit
11787 the Ldelema operation for it.
11789 (EmitStoreOpcode): Use stobj for valuetypes.
11791 (UnaryMutator.EmitCode): Use the right 1 value depending on
11792 whether we are dealing with int64/uint64, float or doubles.
11794 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
11795 constructors that I implemented last night.
11797 (Constructor.IsDefault): Fix to work properly for static
11800 * cs-parser.jay (CheckDef): report method signature errors.
11801 Update error number 103 to be 132.
11803 * decl.cs: New AdditionResult enumeration value: MethodExists.
11804 Although we do this check for methods later on in the semantic
11805 analysis, catching repeated default constructors is so easy that
11806 we catch these here.
11808 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
11811 (ParameterReference.EmitAssign, Emit): handle
11814 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
11815 (ArrayAccess.EmitStoreOpcode): ditto.
11817 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
11819 * expression.cs (MakeByteBlob): Complete all the missing types
11820 (uint, short, ushort, byte, sbyte)
11822 * class.cs: Only init instance field initializers on instance
11825 Rename `constructors' to instance_constructors.
11827 (TypeContainer.AddConstructor): Only add constructors to the list
11828 if it is not static.
11830 Make sure that we handle default_static_constructor independently
11831 everywhere where we handle instance_constructors
11833 2001-12-28 Miguel de Icaza <miguel@ximian.com>
11835 * class.cs: Do not lookup or create a base initializer for a
11836 static constructor.
11838 (ConstructorInitializer.Resolve): use the proper type to lookup
11841 * cs-parser.jay: Report error 1585 (modifiers between type and name).
11843 * enum.cs, interface.cs: Remove CloseType, this is taken care by
11846 * decl.cs: CloseType is now an virtual method, the default
11847 implementation just closes this type.
11849 2001-12-28 Ravi Pratap <ravi@ximian.com>
11851 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
11852 to PreserveSig by default. Also emit HideBySig on such methods.
11854 Basically, set the defaults to standard values.
11856 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
11857 argument, if candidate is better, it can't be worse than the best !
11859 (Invocation): Re-write bits to differentiate between methods being
11860 applicable in their expanded form and their normal form - for params
11863 Get rid of use_standard everywhere as only standard conversions are allowed
11864 in overload resolution.
11866 More spec conformance.
11868 2001-12-27 Miguel de Icaza <miguel@ximian.com>
11870 * driver.cs: Add --timestamp, to see where the compiler spends
11873 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
11874 `this' in static code.
11876 (SimpleName.DoResolve): Implement in terms of a helper function
11877 that allows static-references to be passed upstream to
11880 (Expression.ResolveWithSimpleName): Resolve specially simple
11881 names when called by MemberAccess to implement the special
11884 (Expression.ImplicitReferenceConversion): Handle conversions from
11885 Null to reference types before others, as Null's type is
11888 * expression.cs (Invocation.EmitCall): Handle the special case of
11889 calling methods declared on a reference type from a ValueType
11890 (Base classes System.Object and System.Enum)
11892 (MemberAccess.Resolve): Only perform lookups on Enumerations if
11893 the left hand side is a TypeExpr, not on every enumeration.
11895 (Binary.Resolve): If types are reference types, then do a cast to
11896 object on operators != and == of both arguments.
11898 * typemanager.cs (FindMembers): Extract instance and static
11899 members if requested.
11901 * interface.cs (PopulateProperty): Use void_type instead of null
11902 as the return type for the setter method.
11904 (PopulateIndexer): ditto.
11906 2001-12-27 Ravi Pratap <ravi@ximian.com>
11908 * support.cs (ReflectionParameters): Fix minor bug where we
11909 were examining the wrong parameter for the ParamArray attribute.
11911 Cope with requests for the type of the parameter at position
11912 greater than the params parameter's. We now return the element
11913 type of the params array as that makes more sense.
11915 * expression.cs (Invocation.IsParamsMethodApplicable): Update
11916 accordingly as we no longer have to extract the element type
11919 (Invocation.OverloadResolve): Update.
11921 2001-12-27 Miguel de Icaza <miguel@ximian.com>
11923 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
11924 against IEnumerator, test whether the return value is a descendant
11925 of the IEnumerator interface.
11927 * class.cs (Indexer.Define): Use an auxiliary method to implement
11928 the other bits of the method definition. Begin support for
11929 explicit interface implementation.
11931 (Property.DefineMethod): Use TypeManager.void_type instead of null
11932 for an empty return value.
11934 2001-12-26 Miguel de Icaza <miguel@ximian.com>
11936 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
11937 dealing with a FieldExpr which is composed of a FieldBuilder, in
11938 the code path we did extract the constant, but we should have
11939 obtained the underlying value to be able to cast it (otherwise we
11940 end up in an infinite loop, this is what Ravi was running into).
11942 (ArrayCreation.UpdateIndices): Arrays might be empty.
11944 (MemberAccess.ResolveMemberAccess): Add support for section
11945 14.5.4.1 that deals with the special case of E.I when E is a type
11946 and something else, that I can be a reference to a static member.
11948 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
11949 handle a particular array type to create byte blobs, it is just
11950 something we dont generate byteblobs for.
11952 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
11955 * location.cs (Push): remove the key from the hashtable that we
11956 are about to add. This happens for empty files.
11958 * driver.cs: Dispose files after we have parsed them.
11960 (tokenize): new function that only runs the tokenizer on its
11961 input, for speed testing.
11963 2001-12-26 Ravi Pratap <ravi@ximian.com>
11965 * class.cs (Event.Define): Define the private field only if there
11966 are no accessors defined.
11968 * expression.cs (ResolveMemberAccess): If there is no associated
11969 field with the event, that means we have an event defined with its
11970 own accessors and we should flag error cs0070 since transforming
11971 ourselves into a field is not valid in that case.
11973 * ecore.cs (SimpleName.DoResolve): Same as above.
11975 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
11976 and charset to sane values.
11978 2001-12-25 Ravi Pratap <ravi@ximian.com>
11980 * assign.cs (DoResolve): Perform check on events only if they
11981 are being accessed outside the declaring type.
11983 * cs-parser.jay (event_declarations): Update rules to correctly
11984 set the type of the implicit parameter etc.
11986 (add_accessor, remove_accessor): Set current local parameters.
11988 * expression.cs (Binary): For delegate addition and subtraction,
11989 cast the return value from the method into the appropriate delegate
11992 2001-12-24 Ravi Pratap <ravi@ximian.com>
11994 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
11995 of these as the workaround is unnecessary.
11997 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
11998 delegate data - none of that is needed at all.
12000 Re-write bits to extract the instance expression and the delegate method
12003 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
12006 * attribute.cs (ApplyAttributes): New method to take care of common tasks
12007 of attaching attributes instead of duplicating code everywhere.
12009 * everywhere : Update code to do attribute emission using the above method.
12011 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12013 * expression.cs (IsParamsMethodApplicable): if there are not
12014 parameters, return immediately.
12016 * ecore.cs: The 0 literal can be implicity converted to an enum
12019 (SimpleName.DoResolve): First lookup the type, then lookup the
12022 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
12023 want to get its address. If the InstanceExpression is not
12024 addressable, store the result in a temporary variable, then get
12027 * codegen.cs: Only display 219 errors on warning level or above.
12029 * expression.cs (ArrayAccess): Make it implement the
12030 IMemoryLocation interface.
12032 (Binary.DoResolve): handle the operator == (object a, object b)
12033 and operator != (object a, object b) without incurring into a
12034 BoxedCast (because 5 != o should never be performed).
12036 Handle binary enumerator operators.
12038 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
12039 value type, otherwise use Ldelem_ref.
12041 Use precomputed names;
12043 (AddressOf): Implement address of
12045 * cs-parser.jay (labeled_statement): Fix recursive block
12046 addition by reworking the production.
12048 * expression.cs (New.DoEmit): New has a special case:
12050 If we are dealing with a ValueType, we have a few
12051 situations to deal with:
12053 * The target of New is a ValueType variable, that is
12054 easy, we just pass this as the variable reference
12056 * The target of New is being passed as an argument,
12057 to a boxing operation or a function that takes a
12060 In this case, we need to create a temporary variable
12061 that is the argument of New.
12064 2001-12-23 Ravi Pratap <ravi@ximian.com>
12066 * rootcontext.cs (LookupType): Check that current_type is not null before
12067 going about looking at nested types.
12069 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
12070 not implement the IAssignMethod interface any more.
12072 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
12073 where we tranform them into FieldExprs if they are being resolved from within
12074 the declaring type.
12076 * ecore.cs (SimpleName.DoResolve): Do the same here.
12078 * assign.cs (DoResolve, Emit): Clean up code considerably.
12080 * ../errors/bug10.cs : Add.
12082 * ../errors/cs0070.cs : Add.
12084 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
12086 * assign.cs : Get rid of EventIsLocal everywhere.
12088 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12090 * ecore.cs (ConvertIntLiteral): finished the implementation.
12092 * statement.cs (SwitchLabel): Convert the value we are using as a
12093 key before looking up the table.
12095 2001-12-22 Miguel de Icaza <miguel@ximian.com>
12097 * codegen.cs (EmitTopBlock): Require a Location argument now.
12099 * cs-parser.jay (constructor_declarator): We need to setup
12100 current_local_parameters before we parse the
12101 opt_constructor_initializer, to allow the variables to be bound
12102 to the constructor arguments.
12104 * rootcontext.cs (LookupType): First lookup nested classes in our
12105 class and our parents before we go looking outside our class.
12107 * expression.cs (ConstantFold): Extract/debox the values at the
12110 * rootcontext.cs (EmitCode): Resolve the constants first before we
12111 resolve the types. This is not really needed, but it helps debugging.
12113 * statement.cs: report location.
12115 * cs-parser.jay: pass location to throw statement.
12117 * driver.cs: Small bug fix.
12119 * report.cs: Updated format to be 4-zero filled digits.
12121 2001-12-22 Ravi Pratap <ravi@ximian.com>
12123 * expression.cs (CheckIndices): Fix minor bug where the wrong
12124 variable was being referred to ;-)
12126 (DoEmit): Do not call EmitStaticInitializers when the
12127 underlying type is System.Object.
12129 2001-12-21 Ravi Pratap <ravi@ximian.com>
12131 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
12132 and do the usual workaround for SRE.
12134 * class.cs (MyEventBuilder.EventType): New member to get at the type
12135 of the event, quickly.
12137 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
12139 * assign.cs (Assign.DoResolve): Handle the case when the target
12140 is an EventExpr and perform the necessary checks.
12142 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
12145 (SimpleName.MemberStaticCheck): Include check for EventExpr.
12147 (EventExpr): Set the type in the constructor itself since we
12148 are meant to be born fully resolved.
12150 (EventExpr.Define): Revert code I wrote earlier.
12152 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
12153 instance expression is null. The instance expression is a This in that case
12154 or a null, depending on whether it is a static method or not.
12156 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
12157 refers to more than one method.
12159 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
12160 and accordingly flag errors.
12162 2001-12-21 Miguel de Icaza <miguel@ximian.com>
12164 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
12166 2001-12-22 Miguel de Icaza <miguel@ximian.com>
12168 * location.cs (ToString): Provide useful rutine.
12170 2001-12-21 Miguel de Icaza <miguel@ximian.com>
12172 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
12173 objects, return the actual integral boxed.
12175 * statement.cs (SwitchLabel): define an ILLabel for each
12178 (Switch.CheckSwitch): If the value is a Literal, extract
12179 the underlying literal.
12181 Also in the unused hashtable we had, add the SwitchLabel so we can
12182 quickly look this value up.
12184 * constant.cs: Implement a bunch of new constants. Rewrite
12185 Literal based on this. Made changes everywhere to adapt to this.
12187 * expression.cs (Expression.MakeByteBlob): Optimize routine by
12188 dereferencing array only once, and also copes with enumrations.
12190 bytes are two bytes wide, not one.
12192 (Cast): Perform constant conversions.
12194 * ecore.cs (TryImplicitIntConversion): Return literals instead of
12195 wrappers to the literals here.
12197 * expression.cs (DoNumericPromotions): long literals can converted
12198 to ulong implicity (this is taken care of elsewhere, but I was
12199 missing this spot).
12201 * ecore.cs (Expression.Literalize): Make the return type Literal,
12202 to improve type checking.
12204 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
12206 2001-12-20 Miguel de Icaza <miguel@ximian.com>
12208 * literal.cs: Revert code from ravi that checked the bounds. The
12209 bounds are sane by the definition of the type itself.
12211 * typemanager.cs: Fix implementation of ImplementsInterface. We
12212 need to actually look up in our parent hierarchy for interfaces
12215 * const.cs: Use the underlying type for enumerations
12217 * delegate.cs: Compute the basename for the delegate creation,
12218 that should fix the delegate test case, and restore the correct
12219 Type Lookup semantics in rootcontext
12221 * rootcontext.cs: Revert Ravi's last patch. The correct way of
12222 referencing a nested type with the Reflection API is using the "+"
12225 * cs-parser.jay: Do not require EOF token at the end.
12227 2001-12-20 Ravi Pratap <ravi@ximian.com>
12229 * rootcontext.cs (LookupType): Concatenate type names with
12230 a '.' instead of a '+' The test suite passes again.
12232 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
12233 field of the enumeration.
12235 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
12236 the case when the member is an EventExpr.
12238 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
12239 static has an associated instance expression.
12241 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
12243 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
12245 * class.cs (Event.Define): Register event and perform appropriate checks
12248 We define the Add and Remove methods even if the use provides none because
12249 in that case, we provide default implementations ourselves.
12251 Define a private field of the type of the event. This is done by the CSC compiler
12252 and we should be doing it too ;-)
12254 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
12255 More methods we use in code we generate.
12257 (multicast_delegate_type, delegate_type): Two separate types since the distinction
12260 (InitCoreTypes): Update accordingly for the above.
12262 * class.cs (Event.Emit): Generate code for default accessors that we provide
12264 (EmitDefaultMethod): Do the job in the above.
12266 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
12269 2001-12-20 Miguel de Icaza <miguel@ximian.com>
12271 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
12272 builders even if we were missing one.
12274 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
12275 pass the Basename as our class name instead of the Name. The
12276 basename will be correctly composed for us.
12278 * parameter.cs (Paramters): Now takes a Location argument.
12280 * decl.cs (DeclSpace.LookupType): Removed convenience function and
12281 make all the code call directly LookupType in RootContext and take
12282 this chance to pass the Location information everywhere.
12284 * Everywhere: pass Location information.
12286 2001-12-19 Miguel de Icaza <miguel@ximian.com>
12288 * class.cs (Constructor.Define): Updated way of detecting the
12289 length of the parameters.
12291 (TypeContainer.DefineType): Use basename as the type name for
12294 (TypeContainer.Define): Do not recursively define types here, as
12295 definition is taken care in order by the RootContext.
12297 * tree.cs: Keep track of namespaces in a per-file basis.
12299 * parameter.cs (Parameter.ComputeSignature): Update to use
12302 (Parameters.GetSignature): ditto.
12304 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
12305 instead of a TypeContainer.
12307 (Interface.SemanticAnalysis): Use `this' instead of our parent to
12308 resolve names. Because we need to be resolve in our context, not
12311 * driver.cs: Implement response files.
12313 * class.cs (TypeContainer.DefineType): If we are defined, do not
12314 redefine ourselves.
12316 (Event.Emit): Emit the code for add/remove handlers.
12317 (Event.Define): Save the MethodBuilders for add/remove.
12319 * typemanager.cs: Use pair here too.
12321 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
12322 DictionaryEntry requires the first argument to be non-null.
12324 (enum_declaration): Compute full name for registering the
12327 (delegate_declaration): Instead of using
12328 formal_parameter_list, use opt_formal_parameter_list as the list
12331 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
12332 (EventParsing): New property that controls whether `add' and
12333 `remove' are returned as tokens or identifiers (for events);
12335 2001-12-19 Ravi Pratap <ravi@ximian.com>
12337 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
12338 use MyEventBuilder only and let it wrap the real builder for us.
12340 (MyEventBuilder): Revamp constructor etc.
12342 Implement all operations that we perform on EventBuilder in precisely the same
12345 (FindMembers): Update to use the EventBuilder member.
12347 (Event.Emit): Update accordingly.
12349 2001-12-18 Ravi Pratap <ravi@ximian.com>
12351 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
12352 by calling the appropriate methods.
12354 (GetCustomAttributes): Make stubs as they cannot possibly do anything
12357 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
12359 2001-12-17 Ravi Pratap <ravi@ximian.com>
12361 * delegate.cs (Delegate.Populate): Check that the return type
12362 and various parameters types are indeed accessible.
12364 * class.cs (Constructor.Define): Same here.
12366 (Field.Define): Ditto.
12368 (Event.Define): Ditto.
12370 (Operator.Define): Check that the underlying Method defined itself
12371 correctly - so it's MethodBuilder should not be null.
12373 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
12374 expression happens to be null.
12376 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
12377 members but as of now we don't seem to be able to do anything really useful with it.
12379 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
12380 not the EventBuilder.
12382 2001-12-18 Miguel de Icaza <miguel@ximian.com>
12384 * cs-tokenizer.cs: Add support for defines.
12385 Add support for #if, #elif, #else, #endif
12387 (eval_var): evaluates a variable.
12388 (eval): stubbed for evaluating functions.
12390 * cs-parser.jay: Pass the defines information
12392 * driver.cs: Add --define command line option.
12394 * decl.cs: Move MemberCore here.
12396 Make it the base class for DeclSpace. This allows us to catch and
12397 report 108 and 109 for everything now.
12399 * class.cs (TypeContainer.Define): Extract all the members
12400 before populating and emit the warning 108 (new keyword required
12401 to override) instead of having each member implement this.
12403 (MemberCore.Define): New abstract method, we will be using this in
12404 the warning reporting engine in Populate.
12406 (Operator.Define): Adjust to new MemberCore protocol.
12408 * const.cs (Const): This does not derive from Expression, it is a
12409 temporary object we use to create fields, it is a MemberCore.
12411 * class.cs (Method.Define): Allow the entry point to be in a
12414 * driver.cs: Rewrite the argument handler to clean it up a bit.
12416 * rootcontext.cs: Made it just an auxiliary namespace feature by
12417 making everything static.
12419 * driver.cs: Adapt code to use RootContext type name instead of
12422 * delegate.cs: Remove RootContext argument.
12424 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
12427 * class.cs (Event.Define): The lookup can fail.
12429 * cs-tokenizer.cs: Begin implementation of pre-procesor.
12431 * expression.cs: Resolve the this instance before invoking the code.
12433 2001-12-17 Miguel de Icaza <miguel@ximian.com>
12435 * cs-parser.jay: Add a production in element_access that allows
12436 the thing to become a "type" reference. This way we can parse
12437 things like "(string [])" as a type.
12439 Note that this still does not handle the more complex rules of
12443 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
12445 * ecore.cs: (CopyNewMethods): new utility function used to
12446 assemble the list of methods from running FindMembers.
12448 (MemberLookup): Rework FindMembers so that
12450 2001-12-16 Miguel de Icaza <miguel@ximian.com>
12452 * class.cs (TypeContainer): Remove Delegates who fail to be
12455 * delegate.cs (Populate): Verify that we dont get null return
12456 values. TODO: Check for AsAccessible.
12458 * cs-parser.jay: Use basename to emit error 574 (destructor should
12459 have the same name as container class), not the full name.
12461 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
12462 possible representation.
12464 Also implements integer type suffixes U and L.
12466 2001-12-15 Miguel de Icaza <miguel@ximian.com>
12468 * expression.cs (ArrayCreation.DoResolve): We need to do the
12469 argument resolution *always*.
12471 * decl.cs: Make this hold the namespace. Hold the root context as
12473 (LookupType): Move here.
12475 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
12477 * location.cs (Row, Name): Fixed the code, it was always returning
12478 references to the first file.
12480 * interface.cs: Register properties defined through interfaces.
12482 * driver.cs: Add support for globbing on the command line
12484 * class.cs (Field): Make it derive from MemberCore as well.
12487 2001-12-15 Ravi Pratap <ravi@ximian.com>
12489 * class.cs (Event::Define): Check that the type of the event is a delegate
12490 type else flag error #66.
12492 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
12495 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
12496 values of EntryPoint, CharSet etc etc.
12498 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
12500 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
12501 be null and we should ignore this. I am not sure if this is really clean. Apparently,
12502 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
12503 which needs this to do its work.
12505 * ../errors/cs0066.cs : Add.
12507 2001-12-14 Miguel de Icaza <miguel@ximian.com>
12509 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
12512 * class.cs: (MethodSignature.MethodSignature): Removed hack that
12513 clears out the parameters field.
12514 (MemberSignatureCompare): Cleanup
12516 (MemberCore): New base class used to share code between MethodCore
12519 (RegisterRequiredImplementations) BindingFlags.Public requires
12520 either BindingFlags.Instace or Static. Use instance here.
12522 (Property): Refactored code to cope better with the full spec.
12524 * parameter.cs (GetParameterInfo): Return an empty array instead
12527 * class.cs (Property): Abstract or extern properties have no bodies.
12529 * parameter.cs (GetParameterInfo): return a zero-sized array.
12531 * class.cs (TypeContainer.MethodModifiersValid): Move all the
12532 method modifier validation to the typecontainer so we can reuse
12533 this on properties.
12535 (MethodCore.ParameterTypes): return an empty sized array of types.
12537 (Property.Define): Test property modifier validity.
12539 Add tests for sealed/override too.
12541 (Method.Emit): abstract or extern methods have no bodies.
12543 2001-12-14 Ravi Pratap <ravi@ximian.com>
12545 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
12548 (Method::Define, ::Emit): Modify accordingly.
12550 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
12552 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
12554 * makefile: Pass in /unsafe.
12556 2001-12-13 Miguel de Icaza <miguel@ximian.com>
12558 * class.cs (MakeKey): Kill routine.
12560 * class.cs (TypeContainer.Define): Correctly define explicit
12561 method implementations (they require the full interface name plus
12564 * typemanager.cs: Deply the PtrHashtable here and stop using the
12565 lame keys. Things work so much better.
12567 This of course broke everyone who depended on `RegisterMethod' to
12568 do the `test for existance' test. This has to be done elsewhere.
12570 * support.cs (PtrHashtable): A hashtable that avoid comparing with
12571 the object stupid Equals method (because, that like fails all over
12572 the place). We still do not use it.
12574 * class.cs (TypeContainer.SetRequiredInterface,
12575 TypeContainer.RequireMethods): Killed these two routines and moved
12576 all the functionality to RegisterRequiredImplementations.
12578 (TypeContainer.RegisterRequiredImplementations): This routine now
12579 registers all the implementations required in an array for the
12580 interfaces and abstract methods. We use an array of structures
12581 which can be computed ahead of time to reduce memory usage and we
12582 also assume that lookups are cheap as most classes will not
12583 implement too many interfaces.
12585 We also avoid creating too many MethodSignatures.
12587 (TypeContainer.IsInterfaceMethod): Update and optionally does not
12588 clear the "pending" bit if we find that there are problems with
12591 (TypeContainer.VerifyPendingMethods): Update to report errors of
12592 methods that look like implementations but are not.
12594 (TypeContainer.Define): Add support for explicit interface method
12597 2001-12-12 Miguel de Icaza <miguel@ximian.com>
12599 * typemanager.cs: Keep track of the parameters here instead of
12600 being a feature of the TypeContainer.
12602 * class.cs: Drop the registration of parameters here, as
12603 InterfaceMethods are also interface declarations.
12605 * delegate.cs: Register methods with the TypeManager not only with
12606 the TypeContainer. This code was buggy.
12608 * interface.cs: Full registation here.
12610 2001-12-11 Miguel de Icaza <miguel@ximian.com>
12612 * expression.cs: Remove reducer for binary expressions, it can not
12615 * const.cs: Put here the code that used to go into constant.cs
12617 * constant.cs: Put here the code for constants, this is a new base
12618 class for Literals.
12620 * literal.cs: Make Literal derive from Constant.
12622 2001-12-09 Miguel de Icaza <miguel@ximian.com>
12624 * statement.cs (Return.Emit): Report error 157 if the user
12625 attempts to return from a finally block.
12627 (Return.Emit): Instead of emitting a return, jump to the end of
12630 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
12631 LocalBuilder to store the result of the function. ReturnLabel is
12632 the target where we jump.
12635 2001-12-09 Radek Doulik <rodo@ximian.com>
12637 * cs-parser.jay: remember alias in current namespace
12639 * ecore.cs (SimpleName::DoResolve): use aliases for types or
12642 * class.cs (LookupAlias): lookup alias in my_namespace
12644 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
12646 (LookupAlias): lookup alias in this and if needed in parent
12649 2001-12-08 Miguel de Icaza <miguel@ximian.com>
12653 * rootcontext.cs: (ModuleBuilder) Made static, first step into
12654 making things static. I need this to avoid passing the
12655 TypeContainer when calling ParameterType.
12657 * support.cs (InternalParameters.ParameterType): Remove ugly hack
12658 that did string manipulation to compute the type and then call
12659 GetType. Use Parameter.ParameterType instead.
12661 * cs-tokenizer.cs: Consume the suffix for floating values.
12663 * expression.cs (ParameterReference): figure out whether this is a
12664 reference parameter or not. Kill an extra variable by computing
12665 the arg_idx during emission.
12667 * parameter.cs (Parameters.GetParameterInfo): New overloaded
12668 function that returns whether a parameter is an out/ref value or not.
12670 (Parameter.ParameterType): The type of the parameter (base,
12671 without ref/out applied).
12673 (Parameter.Resolve): Perform resolution here.
12674 (Parameter.ExternalType): The full type (with ref/out applied).
12676 * statement.cs (Using.Emit, Using.EmitExpression): Implement
12677 support for expressions on the using statement.
12679 2001-12-07 Miguel de Icaza <miguel@ximian.com>
12681 * statement.cs (Using.EmitLocalVariableDecls): Split the
12682 localvariable handling of the using statement.
12684 (Block.EmitMeta): Keep track of variable count across blocks. We
12685 were reusing slots on separate branches of blocks.
12687 (Try.Emit): Emit the general code block, we were not emitting it.
12689 Check the type of the declaration to be an IDisposable or
12690 something that can be implicity converted to it.
12692 Emit conversions if required.
12694 * ecore.cs (EmptyExpression): New utility class.
12695 (Expression.ImplicitConversionExists): New utility function.
12697 2001-12-06 Miguel de Icaza <miguel@ximian.com>
12699 * statement.cs (Using): Implement.
12701 * expression.cs (LocalVariableReference): Support read only variables.
12703 * statement.cs: Remove the explicit emit for the Leave opcode.
12704 (VariableInfo): Add a readonly field.
12706 2001-12-05 Miguel de Icaza <miguel@ximian.com>
12708 * ecore.cs (ConvCast): new class used to encapsulate the various
12709 explicit integer conversions that works in both checked and
12710 unchecked contexts.
12712 (Expression.ConvertNumericExplicit): Use new ConvCast class to
12713 properly generate the overflow opcodes.
12715 2001-12-04 Miguel de Icaza <miguel@ximian.com>
12717 * statement.cs: The correct type for the EmptyExpression is the
12718 element_type, not the variable type. Ravi pointed this out.
12720 2001-12-04 Ravi Pratap <ravi@ximian.com>
12722 * class.cs (Method::Define): Handle PInvoke methods specially
12723 by using DefinePInvokeMethod instead of the usual one.
12725 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
12726 above to do the task of extracting information and defining the method.
12728 2001-12-04 Ravi Pratap <ravi@ximian.com>
12730 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
12731 of the condition for string type.
12733 (Emit): Move that here.
12735 (ArrayCreation::CheckIndices): Keep string literals in their expression
12738 (EmitDynamicInitializers): Handle strings appropriately.
12740 2001-12-04 Miguel de Icaza <miguel@ximian.com>
12742 * codegen.cs (EmitContext): Replace multiple variables with a
12743 single pointer to the current Switch statement.
12745 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
12748 2001-12-03 Miguel de Icaza <miguel@ximian.com>
12752 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
12755 (Foreach.Emit): Foreach on arrays was not setting
12756 up the loop variables (for break/continue).
12758 (GotoCase): Semi-implented.
12760 2001-12-03 Ravi Pratap <ravi@ximian.com>
12762 * attribute.cs (CheckAttribute): Handle system attributes by using
12763 Attribute.GetAttributes to examine information we need.
12765 (GetValidPlaces): Same here.
12767 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
12769 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
12771 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
12773 (Method::Define): Set appropriate flags if we have a DllImport attribute.
12775 (Method::Emit): Handle the case when we are a PInvoke method.
12777 2001-12-03 Miguel de Icaza <miguel@ximian.com>
12779 * expression.cs: Use ResolveWithSimpleName on compound names.
12781 2001-12-02 Ravi Pratap <ravi@ximian.com>
12783 * constant.cs (EmitConstant): Make sure we resolve the associated expression
12784 before trying to reduce it.
12786 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
12788 * constant.cs (LookupConstantValue): Implement.
12790 (EmitConstant): Use the above in emitting the constant.
12792 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
12793 that are user-defined by doing a LookupConstantValue on them.
12795 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
12798 2001-11-29 Miguel de Icaza <miguel@ximian.com>
12800 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
12802 (BaseAccess.DoResolve): Implement.
12804 (MemberAccess.DoResolve): Split this routine into a
12805 ResolveMemberAccess routine that can be used independently
12807 2001-11-28 Miguel de Icaza <miguel@ximian.com>
12809 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
12810 As that share bits of the implementation. Is returns a boolean,
12811 while As returns the Type that is being probed.
12813 2001-12-01 Ravi Pratap <ravi@ximian.com>
12815 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
12816 instead of a Literal - much easier.
12818 (EnumInTransit): Remove - utterly useless :-)
12820 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
12822 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
12824 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
12825 chain when we have no associated expression.
12827 2001-11-30 Ravi Pratap <ravi@ximian.com>
12829 * constant.cs (Define): Use Location while reporting the errror.
12831 Also emit a warning when 'new' is used and there is no inherited
12834 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
12837 (LookupEnumValue): Implement to lookup an enum member's value and define it
12840 (Populate): Re-write accordingly to use the above routine.
12842 2001-11-27 Miguel de Icaza <miguel@ximian.com>
12844 * expression.cs (This): Fix prototype for DoResolveLValue to
12845 override the base class DoResolveLValue.
12847 * cs-parser.cs: Report errors cs574 and cs575 (destructor
12850 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
12851 (we need to load the address of the field here). This fixes
12854 (FieldExpr.DoResolveLValue): Call the DoResolve
12855 function to initialize the Instance expression.
12857 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
12858 correctly the GetEnumerator operation on a value type.
12860 * cs-parser.jay: Add more simple parsing error catches.
12862 * statement.cs (Switch): Add support for string switches.
12863 Handle null specially.
12865 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
12867 2001-11-28 Ravi Pratap <ravi@ximian.com>
12869 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
12871 (declare_local_constant): New helper function.
12873 * statement.cs (AddConstant): Keep a separate record of constants
12875 (IsConstant): Implement to determine if a variable is a constant.
12877 (GetConstantExpression): Implement.
12879 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
12881 * statement.cs (IsVariableDefined): Re-write.
12883 2001-11-27 Ravi Pratap <ravi@ximian.com>
12885 * class.cs (TypeContainer::FindMembers): Look for constants
12886 in the case when we are looking for MemberTypes.Field
12888 * expression.cs (MemberAccess::DoResolve): Check that in the
12889 case we are a FieldExpr and a Literal, we are not being accessed
12890 by an instance reference.
12892 * cs-parser.jay (local_constant_declaration): Implement.
12894 (declaration_statement): Implement for constant declarations.
12896 2001-11-26 Miguel de Icaza <miguel@ximian.com>
12898 * statement.cs (Switch): Catch double defaults.
12900 (Switch): More work on the switch() statement
12901 implementation. It works for integral values now, need to finish
12905 2001-11-24 Miguel de Icaza <miguel@ximian.com>
12907 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
12908 integer literals into other integer literals. To be used by
12911 2001-11-24 Ravi Pratap <ravi@ximian.com>
12913 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
12916 (EmitDynamicInitializers): Cope with the above since we extract data
12917 directly from ArrayData now.
12919 (ExpectInitializers): Keep track of whether initializers are mandatory
12922 (Bounds): Make it a hashtable to prevent the same dimension being
12923 recorded for every element in that dimension.
12925 (EmitDynamicInitializers): Fix bug which prevented the Set array method
12928 Also fix bug which was causing the indices to be emitted in the reverse
12931 2001-11-24 Miguel de Icaza <miguel@ximian.com>
12933 * expression.cs (ArrayCreation): Implement the bits that Ravi left
12934 unfinished. They do not work, because the underlying code is
12937 2001-11-22 Miguel de Icaza <miguel@ximian.com>
12939 * cs-parser.jay: Remove bogus fixme.
12941 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
12942 on Switch statement.
12944 2001-11-23 Ravi Pratap <ravi@ximian.com>
12946 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
12949 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
12950 parameter. Apparently, any expression is allowed.
12952 (ValidateInitializers): Update accordingly.
12954 (CheckIndices): Fix some tricky bugs thanks to recursion.
12956 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
12957 I was being completely brain-dead.
12959 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
12960 and re-write acordingly.
12962 (DelegateInvocation): Re-write accordingly.
12964 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
12966 (MakeByteBlob): Handle types more correctly.
12968 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
12969 initialization from expressions but it is incomplete because I am a complete
12972 2001-11-22 Miguel de Icaza <miguel@ximian.com>
12974 * statement.cs (If.Emit): Fix a bug that generated incorrect code
12975 on If. Basically, we have to return `true' (ie, we do return to
12976 our caller) only if both branches of the if return.
12978 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
12979 short-circuit operators, handle them as short circuit operators.
12981 (Cast.DoResolve): Resolve type.
12982 (Cast.Cast): Take an expression as the target type.
12984 * cs-parser.jay (cast_expression): Remove old hack that only
12985 allowed a limited set of types to be handled. Now we take a
12986 unary_expression and we resolve to a type during semantic
12989 Use the grammar productions from Rhys to handle casts (this is
12990 not complete like Rhys syntax yet, we fail to handle that corner
12991 case that C# has regarding (-x), but we will get there.
12993 2001-11-22 Ravi Pratap <ravi@ximian.com>
12995 * class.cs (EmitFieldInitializer): Take care of the case when we have a
12996 field which is an array type.
12998 * cs-parser.jay (declare_local_variables): Support array initialization too.
13000 * typemanager.cs (MakeKey): Implement.
13002 (everywhere): Use the above appropriately.
13004 * cs-parser.jay (for_statement): Update for array initialization while
13005 declaring variables.
13007 * ecore.cs : The error message was correct, it's the variable's names that
13008 were misleading ;-) Make the code more readable.
13010 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
13011 the correct type etc.
13013 (ConvertExplicit): Handle Enum types by examining the underlying type.
13015 2001-11-21 Ravi Pratap <ravi@ximian.com>
13017 * parameter.cs (GetCallingConvention): Always return
13018 CallingConventions.Standard for now.
13020 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13022 * expression.cs (Binary.ResolveOperator): Update the values of `l'
13023 and `r' after calling DoNumericPromotions.
13025 * ecore.cs: Fix error message (the types were in the wrong order).
13027 * statement.cs (Foreach.ProbeCollectionType): Need to pass
13028 BindingFlags.Instance as well
13030 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
13031 implicit int literal conversion in an empty cast so that we
13032 propagate the right type upstream.
13034 (UnboxCast): new class used to unbox value types.
13035 (Expression.ConvertExplicit): Add explicit type conversions done
13038 (Expression.ImplicitNumericConversion): Oops, forgot to test for
13039 the target type before applying the implicit LongLiterals to ULong
13042 2001-11-21 Miguel de Icaza <miguel@ximian.com>
13044 * cs-parser.jay (for_statement): Reworked the way For works: now
13045 we declare manually any variables that are introduced in
13046 for_initializer to solve the problem of having out-of-band code
13047 emition (that is what got for broken).
13049 (declaration_statement): Perform the actual variable declaration
13050 that used to be done in local_variable_declaration here.
13052 (local_variable_declaration): Do not declare anything, just pass
13053 the information on a DictionaryEntry
13055 2001-11-20 Ravi Pratap <ravi@ximian.com>
13057 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
13058 re-write of the logic to now make it recursive.
13060 (UpdateIndices): Re-write accordingly.
13062 Store element data in a separate ArrayData list in the above methods.
13064 (MakeByteBlob): Implement to dump the array data into a byte array.
13066 2001-11-19 Ravi Pratap <ravi@ximian.com>
13068 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
13071 * constant.cs (Define): Implement.
13073 (EmitConstant): Re-write fully.
13075 Pass in location info.
13077 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
13080 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
13081 DictionaryEntry since we need location info too.
13083 (constant_declaration): Update accordingly.
13085 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
13086 code into another method : UpdateIndices.
13088 2001-11-18 Ravi Pratap <ravi@ximian.com>
13090 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
13091 some type checking etc.
13093 2001-11-17 Ravi Pratap <ravi@ximian.com>
13095 * expression.cs (ArrayCreation::ValidateInitializers): Implement
13096 bits to provide dimension info if the user skips doing that.
13098 Update second constructor to store the rank correctly.
13100 2001-11-16 Ravi Pratap <ravi@ximian.com>
13102 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
13103 and try to implement.
13105 * ../errors/cs0150.cs : Add.
13107 * ../errors/cs0178.cs : Add.
13109 2001-11-16 Miguel de Icaza <miguel@ximian.com>
13111 * statement.cs: Implement foreach on multi-dimensional arrays.
13113 * parameter.cs (Parameters.GetParameterByName): Also lookup the
13114 name of the params argument.
13116 * expression.cs: Use EmitStoreOpcode to get the right opcode while
13117 initializing the array.
13119 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
13120 we can use this elsewhere.
13122 * statement.cs: Finish implementation of foreach for single
13125 * cs-parser.jay: Use an out-of-band stack to pass information
13126 around, I wonder why I need this.
13128 foreach_block: Make the new foreach_block the current_block.
13130 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
13131 function used to return a static Parameters structure. Used for
13132 empty parameters, as those are created very frequently.
13134 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
13136 2001-11-15 Ravi Pratap <ravi@ximian.com>
13138 * interface.cs : Default modifier is private, not public. The
13139 make verify test passes again.
13141 2001-11-15 Ravi Pratap <ravi@ximian.com>
13143 * support.cs (ReflectionParameters): Fix logic to determine
13144 whether the last parameter is a params one. Test 9 passes again.
13146 * delegate.cs (Populate): Register the builders we define with
13147 RegisterParameterForBuilder. Test 19 passes again.
13149 * cs-parser.jay (property_declaration): Reference $6 instead
13150 of $$ to get at the location.
13152 (indexer_declaration): Similar stuff.
13154 (attribute): Ditto.
13156 * class.cs (Property): Register parameters for the Get and Set methods
13157 if they exist. Test 23 passes again.
13159 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
13160 call to EmitArguments as we are sure there aren't any params arguments.
13161 Test 32 passes again.
13163 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
13164 IndexOutOfRangeException.
13166 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
13167 Test 33 now passes again.
13169 2001-11-15 Miguel de Icaza <miguel@ximian.com>
13171 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
13172 broke a bunch of things. Will have to come up with a better way
13173 of tracking locations.
13175 * statement.cs: Implemented foreach for single dimension arrays.
13177 2001-11-09 Miguel de Icaza <miguel@ximian.com>
13179 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
13180 an error. This removes the lookup from the critical path.
13182 * cs-parser.jay: Removed use of temporary_loc, which is completely
13185 2001-11-14 Miguel de Icaza <miguel@ximian.com>
13187 * support.cs (ReflectionParameters.ParameterModifier): Report
13188 whether the argument is a PARAMS argument or not.
13190 * class.cs: Set the attribute `ParamArrayAttribute' on the
13191 parameter argument.
13193 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
13194 and cons_param_array_attribute (ConstructorInfo for
13195 ParamArrayAttribute).,
13197 * codegen.cs: Emit the return using the `Return' statement, that
13198 way we can report the error correctly for missing return values.
13200 * class.cs (Method.Emit): Clean up.
13202 * expression.cs (Argument.Resolve): Take another argument: the
13203 location where this argument is used. Notice that this is not
13204 part of the "Argument" class as to reduce the size of the
13205 structure (we know the approximate location anyways).
13207 Test if the argument is a variable-reference, if not, then
13208 complain with a 206.
13210 (Argument.Emit): Emit addresses of variables.
13212 (Argument.FullDesc): Simplify.
13214 (Invocation.DoResolve): Update for Argument.Resolve.
13216 (ElementAccess.DoResolve): ditto.
13218 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
13219 method should be virtual, as this method is always virtual.
13221 (NewDelegate.DoResolve): Update for Argument.Resolve.
13223 * class.cs (ConstructorInitializer.DoResolve): ditto.
13225 * attribute.cs (Attribute.Resolve): ditto.
13227 2001-11-13 Miguel de Icaza <miguel@ximian.com>
13229 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
13231 * expression.cs (ParameterReference): Drop IStackStorage and implement
13232 IAssignMethod instead.
13234 (LocalVariableReference): ditto.
13236 * ecore.cs (FieldExpr): Drop IStackStorage and implement
13237 IAssignMethod instead.
13239 2001-11-13 Miguel de Icaza <miguel@ximian.com>
13241 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
13242 enumerations that are used in heavily used structures derive from
13243 byte in a laughable and pathetic attempt to reduce memory usage.
13244 This is the kind of pre-optimzations that you should not do at
13245 home without adult supervision.
13247 * expression.cs (UnaryMutator): New class, used to handle ++ and
13248 -- separatedly from the other unary operators. Cleans up the
13249 code, and kills the ExpressionStatement dependency in Unary.
13251 (Unary): Removed `method' and `Arguments' from this class, making
13252 it smaller, and moving it all to SimpleCall, so I can reuse this
13253 code in other locations and avoid creating a lot of transient data
13254 strucutres when not required.
13256 * cs-parser.jay: Adjust for new changes.
13258 2001-11-11 Miguel de Icaza <miguel@ximian.com>
13260 * enum.cs (Enum.Populate): If there is a failure during
13263 * cs-parser.jay (opt_enum_base): we used to catch type errors
13264 here, but this is really incorrect. The type error should be
13265 catched during semantic analysis.
13267 2001-12-11 Ravi Pratap <ravi@ximian.com>
13269 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
13270 current_local_parameters as expected since I, in my stupidity, had forgotten
13273 * attribute.cs (GetValidPlaces): Fix stupid bug.
13275 * class.cs (Method::Emit): Perform check on applicability of attributes.
13277 (Constructor::Emit): Ditto.
13279 (Field::Emit): Ditto.
13281 (Field.Location): Store location information.
13283 (Property, Event, Indexer, Operator): Ditto.
13285 * cs-parser.jay (field_declaration): Pass in location for each field.
13287 * ../errors/cs0592.cs : Add.
13289 2001-11-12 Ravi Pratap <ravi@ximian.com>
13291 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
13293 (InitCoreTypes): Update accordingly.
13295 (RegisterAttrType, LookupAttr): Implement.
13297 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
13298 info about the same.
13300 (Resolve): Update to populate the above as necessary.
13302 (Error592): Helper.
13304 (GetValidPlaces): Helper to the above.
13306 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
13308 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
13310 2001-11-12 Ravi Pratap <ravi@ximian.com>
13312 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
13314 * ../errors/cs0617.cs : Add.
13316 2001-11-11 Ravi Pratap <ravi@ximian.com>
13318 * enum.cs (Emit): Rename to Populate to be more consistent with what
13319 we expect it to do and when exactly it is called.
13321 * class.cs, rootcontext.cs : Update accordingly.
13323 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
13324 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
13326 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
13328 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
13329 of a fieldinfo using the above, when dealing with a FieldBuilder.
13331 2001-11-10 Ravi Pratap <ravi@ximian.com>
13333 * ../errors/cs0031.cs : Add.
13335 * ../errors/cs1008.cs : Add.
13337 * ../errrors/cs0543.cs : Add.
13339 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
13342 (FindMembers): Implement.
13344 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
13345 enums and delegates too.
13347 (enum_types): Rename to builder_to_enum.
13349 (delegate_types): Rename to builder_to_delegate.
13351 * delegate.cs (FindMembers): Implement.
13353 2001-11-09 Ravi Pratap <ravi@ximian.com>
13355 * typemanager.cs (IsEnumType): Implement.
13357 * enum.cs (Emit): Re-write parts to account for the underlying type
13358 better and perform checking etc.
13360 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
13361 of the underlying type.
13363 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
13366 * enum.cs (error31): Helper to report error #31.
13368 * cs-parser.jay (enum_declaration): Store location of each member too.
13370 * enum.cs (member_to_location): New hashtable.
13372 (AddEnumMember): Update location hashtable.
13374 (Emit): Use the location of each member while reporting errors.
13376 2001-11-09 Miguel de Icaza <miguel@ximian.com>
13378 * cs-parser.jay: A for_initializer if is a
13379 local_variable_declaration really ammount to have an implicit
13380 block with the variable declaration and no initializer for for.
13382 * statement.cs (For.Emit): Cope with null initializers.
13384 This fixes the infinite loop on for initializers.
13386 2001-11-08 Miguel de Icaza <miguel@ximian.com>
13388 * enum.cs: More cleanup.
13390 * ecore.cs: Remove dead code.
13392 * class.cs (Property.Emit): More simplification.
13393 (Event.Emit): ditto.
13395 Reworked to have less levels of indentation.
13397 2001-11-08 Ravi Pratap <ravi@ximian.com>
13399 * class.cs (Property): Emit attributes.
13409 * enum.cs (Emit): Ditto.
13411 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
13414 * class.cs (Field, Event, etc.): Move attribute generation into the
13415 Emit method everywhere.
13417 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
13418 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
13419 as we had no way of defining nested enums !
13421 * rootcontext.cs : Adjust code accordingly.
13423 * typemanager.cs (AddEnumType): To keep track of enum types separately.
13425 2001-11-07 Ravi Pratap <ravi@ximian.com>
13427 * expression.cs (EvalConstantExpression): Move into ecore.cs
13429 * enum.cs (Enum): Rename some members and make them public and readonly
13430 according to our convention.
13432 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
13435 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
13437 (Enum::Emit): Write a simple version for now which doesn't try to compute
13438 expressions. I shall modify this to be more robust in just a while.
13440 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
13442 (TypeContainer::CloseType): Create the Enum types too.
13444 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
13446 * expression.cs (EvalConstantExpression): Get rid of completely.
13448 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
13449 user-defined values and other cases.
13451 (IsValidEnumLiteral): Helper function.
13453 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
13454 out there in the case we had a literal FieldExpr.
13456 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
13458 (Literalize): Revamp a bit to take two arguments.
13460 (EnumLiteral): New class which derives from Literal to wrap enum literals.
13462 2001-11-06 Ravi Pratap <ravi@ximian.com>
13464 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
13466 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
13468 (Resolve): Use the above to ensure we have proper initializers.
13470 2001-11-05 Ravi Pratap <ravi@ximian.com>
13472 * expression.cs (Expression::EvalConstantExpression): New method to
13473 evaluate constant expressions.
13475 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
13477 2001-11-07 Miguel de Icaza <miguel@ximian.com>
13479 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
13482 (Binary.ResolveOperator): Handle operator != (object a, object b)
13483 and operator == (object a, object b);
13485 (Binary.DoNumericPromotions): Indicate whether the numeric
13486 promotion was possible.
13488 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
13491 Made the ArrayAccess implement interface IAssignMethod instead of
13492 IStackStore as the order in which arguments are passed reflects
13495 * assign.cs: Instead of using expr.ExprClass to select the way of
13496 assinging, probe for the IStackStore/IAssignMethod interfaces.
13498 * typemanager.cs: Load InitializeArray definition.
13500 * rootcontext.cs (RootContext.MakeStaticData): Used to define
13501 static data that can be used to initialize arrays.
13503 2001-11-05 Miguel de Icaza <miguel@ximian.com>
13505 * expression.cs: Handle operator== and operator!= for booleans.
13507 (Conditioal.Reduce): Implement reducer for the ?: operator.
13509 (Conditional.Resolve): Implement dead code elimination.
13511 (Binary.Resolve): Catch string literals and return a new
13512 concatenated string.
13514 (Unary.Reduce): Implement reduction of unary expressions.
13516 * ecore.cs: Split out the expression core handling here.
13518 (Expression.Reduce): New method used to perform constant folding
13519 and CSE. This is needed to support constant-expressions.
13521 * statement.cs (Statement.EmitBoolExpression): Pass true and false
13522 targets, and optimize for !x.
13524 2001-11-04 Ravi Pratap <ravi@ximian.com>
13526 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
13527 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
13528 set custom atttributes.
13530 * literal.cs (Literal::GetValue): New abstract method to return the actual
13531 value of the literal, cast as an object.
13533 (*Literal): Implement GetValue method.
13535 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
13536 expressions to the arraylist but objects of type Argument.
13538 * class.cs (TypeContainer::Emit): Emit our attributes too.
13540 (Method::Emit, Constructor::Emit): Ditto.
13542 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
13543 to be ignoring earlier.
13545 2001-11-03 Ravi Pratap <ravi@ximian.com>
13547 * attribute.cs (AttributeSection::Define): Implement to do the business
13548 of constructing a CustomAttributeBuilder.
13550 (Attribute): New trivial class. Increases readability of code.
13552 * cs-parser.jay : Update accordingly.
13554 (positional_argument_list, named_argument_list, named_argument): New rules
13556 (attribute_arguments): Use the above so that we are more correct.
13558 2001-11-02 Ravi Pratap <ravi@ximian.com>
13560 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
13561 to perform all checks for a method with a params parameter.
13563 (Invocation::OverloadResolve): Update to use the above method and therefore
13564 cope correctly with params method invocations.
13566 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
13569 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
13570 constructors in our parent too because we can't afford to miss out on
13573 * attribute.cs (AttributeSection): New name for the class Attribute
13575 Other trivial changes to improve readability.
13577 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
13578 use the new class names.
13580 2001-11-01 Ravi Pratap <ravi@ximian.com>
13582 * class.cs (Method::Define): Complete definition for params types too
13584 (Indexer::Define): Ditto.
13586 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
13587 Cope everywhere with a request for info about the array parameter.
13589 2001-11-01 Ravi Pratap <ravi@ximian.com>
13591 * tree.cs (RecordNamespace): Fix up to check for the correct key.
13593 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
13594 local_variable_type to extract the string corresponding to the type.
13596 (local_variable_type): Fixup the action to use the new helper method.
13598 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
13601 * expression.cs : Clean out code which uses the above.
13603 2001-10-31 Ravi Pratap <ravi@ximian.com>
13605 * typemanager.cs (RegisterMethod): Check if we already have an existing key
13606 and bale out if necessary by returning a false.
13608 (RegisterProperty): Ditto.
13610 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
13611 and print out appropriate error messages.
13613 * interface.cs (everywhere): Ditto.
13615 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
13616 location to constructor.
13618 * class.cs (Property, Event, Indexer): Update accordingly.
13620 * ../errors/cs111.cs : Added.
13622 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
13623 of a method, as laid down by the spec.
13625 (Invocation::OverloadResolve): Use the above method.
13627 2001-10-31 Ravi Pratap <ravi@ximian.com>
13629 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
13630 now take a TypeContainer and a Parameters object.
13632 (ParameterData): Modify return type of ParameterModifier method to be
13633 Parameter.Modifier and not a string.
13635 (ReflectionParameters, InternalParameters): Update accordingly.
13637 * expression.cs (Argument::GetParameterModifier): Same here.
13639 * support.cs (InternalParameters::ParameterType): Find a better way of determining
13640 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
13641 symbol in it at all so maybe this is only for now.
13643 2001-10-30 Ravi Pratap <ravi@ximian.com>
13645 * support.cs (InternalParameters): Constructor now takes an extra argument
13646 which is the actual Parameters class.
13648 (ParameterDesc): Update to provide info on ref/out modifiers.
13650 * class.cs (everywhere): Update call to InternalParameters to pass in
13651 the second argument too.
13653 * support.cs (ParameterData): Add ParameterModifier, which is a method
13654 to return the modifier info [ref/out etc]
13656 (InternalParameters, ReflectionParameters): Implement the above.
13658 * expression.cs (Argument::ParameterModifier): Similar function to return
13659 info about the argument's modifiers.
13661 (Invocation::OverloadResolve): Update to take into account matching modifiers
13664 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
13665 a new SetFormalParameters object which we pass to InternalParameters.
13667 2001-10-30 Ravi Pratap <ravi@ximian.com>
13669 * expression.cs (NewArray): Merge into the ArrayCreation class.
13671 2001-10-29 Ravi Pratap <ravi@ximian.com>
13673 * expression.cs (NewArray): Merge classes NewBuiltinArray and
13674 NewUserdefinedArray into one as there wasn't much of a use in having
13677 * expression.cs (Argument): Change field's name to ArgType from Type.
13679 (Type): New readonly property which returns the proper type, taking into
13680 account ref/out modifiers.
13682 (everywhere): Adjust code accordingly for the above.
13684 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
13685 whether we are emitting for a ref or out parameter.
13687 * expression.cs (Argument::Emit): Use the above field to set the state.
13689 (LocalVariableReference::Emit): Update to honour the flag and emit the
13692 * parameter.cs (Attributes): Set the correct flags for ref parameters.
13694 * expression.cs (Argument::FullDesc): New function to provide a full desc.
13696 * support.cs (ParameterData): Add method ParameterDesc to the interface.
13698 (ReflectionParameters, InternalParameters): Implement the above method.
13700 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
13703 (Invocation::FullMethodDesc): Ditto.
13705 2001-10-29 Miguel de Icaza <miguel@ximian.com>
13707 * cs-parser.jay: Add extra production for the second form of array
13710 * expression.cs (ArrayCreation): Update to reflect the above
13713 * Small changes to prepare for Array initialization.
13715 2001-10-28 Miguel de Icaza <miguel@ximian.com>
13717 * typemanager.cs (ImplementsInterface): interface might be null;
13718 Deal with this problem;
13720 Also, we do store negative hits on the cache (null values), so use
13721 this instead of calling t.GetInterfaces on the type everytime.
13723 2001-10-28 Ravi Pratap <ravi@ximian.com>
13725 * typemanager.cs (IsBuiltinType): New method to help determine the same.
13727 * expression.cs (New::DoResolve): Get rid of array creation code and instead
13728 split functionality out into different classes.
13730 (New::FormArrayType): Move into NewBuiltinArray.
13732 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
13735 (NewBuiltinArray): New class to handle creation of built-in arrays.
13737 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
13738 account creation of one-dimensional arrays.
13740 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
13742 (NewUserdefinedArray::DoResolve): Implement.
13744 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
13746 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
13747 we maintain inside the TypeManager. This is necessary to perform lookups on the
13750 (LookupType): Update to perform GetType on the module builders too.
13752 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
13754 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
13756 2001-10-23 Ravi Pratap <ravi@ximian.com>
13758 * expression.cs (New::DoResolve): Implement guts of array creation.
13760 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
13762 2001-10-27 Miguel de Icaza <miguel@ximian.com>
13764 * expression.cs: Fix bug I introduced lsat night that broke
13767 (Expression.Resolve): Report a 246 error (can not resolve name)
13768 if we find a SimpleName in the stream.
13770 (Expression.ResolveLValue): Ditto.
13772 (Expression.ResolveWithSimpleName): This function is a variant of
13773 ResolveName, this one allows SimpleNames to be returned without a
13774 warning. The only consumer of SimpleNames is MemberAccess
13776 2001-10-26 Miguel de Icaza <miguel@ximian.com>
13778 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
13779 might arrive here. I have my doubts that this is correct.
13781 * statement.cs (Lock): Implement lock statement.
13783 * cs-parser.jay: Small fixes to support `lock' and `using'
13785 * cs-tokenizer.cs: Remove extra space
13787 * driver.cs: New flag --checked, allows to turn on integer math
13790 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
13791 Threading.Monitor.Exit
13793 2001-10-23 Miguel de Icaza <miguel@ximian.com>
13795 * expression.cs (IndexerAccess::DoResolveLValue): Set the
13796 Expression Class to be IndexerAccess.
13798 Notice that Indexer::DoResolve sets the eclass to Value.
13800 2001-10-22 Miguel de Icaza <miguel@ximian.com>
13802 * class.cs (TypeContainer::Emit): Emit code for indexers.
13804 * assign.cs (IAssignMethod): New interface implemented by Indexers
13805 and Properties for handling assignment.
13807 (Assign::Emit): Simplify and reuse code.
13809 * expression.cs (IndexerAccess, PropertyExpr): Implement
13810 IAssignMethod, clean up old code.
13812 2001-10-22 Ravi Pratap <ravi@ximian.com>
13814 * typemanager.cs (ImplementsInterface): New method to determine if a type
13815 implements a given interface. Provides a nice cache too.
13817 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
13820 (ConvertReferenceExplicit): Ditto.
13822 * delegate.cs (Delegate::Populate): Update to define the parameters on the
13823 various methods, with correct names etc.
13825 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
13826 Operator.UnaryNegation.
13828 * cs-parser.jay (operator_declarator): Be a little clever in the case where
13829 we have a unary plus or minus operator.
13831 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
13834 * everywhere : update accordingly.
13836 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
13839 * class.cs (Method::Define): For the case where we are implementing a method
13840 inherited from an interface, we need to set the MethodAttributes.Final flag too.
13841 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
13843 2001-10-21 Ravi Pratap <ravi@ximian.com>
13845 * interface.cs (FindMembers): Implement to work around S.R.E
13848 * typemanager.cs (IsInterfaceType): Implement.
13850 (FindMembers): Update to handle interface types too.
13852 * expression.cs (ImplicitReferenceConversion): Re-write bits which
13853 use IsAssignableFrom as that is not correct - it doesn't work.
13855 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
13856 and accordingly override EmitStatement.
13858 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
13859 using the correct logic :-)
13861 2001-10-19 Ravi Pratap <ravi@ximian.com>
13863 * ../errors/cs-11.cs : Add to demonstrate error -11
13865 2001-10-17 Miguel de Icaza <miguel@ximian.com>
13867 * assign.cs (Assign::Resolve): Resolve right hand side first, and
13868 then pass this as a hint to ResolveLValue.
13870 * expression.cs (FieldExpr): Add Location information
13872 (FieldExpr::LValueResolve): Report assignment to readonly
13875 (Expression::ExprClassFromMemberInfo): Pass location information.
13877 (Expression::ResolveLValue): Add new method that resolves an
13880 (Expression::DoResolveLValue): Default invocation calls
13883 (Indexers): New class used to keep track of indexers in a given
13886 (IStackStore): Renamed from LValue, as it did not really describe
13887 what this did. Also ResolveLValue is gone from this interface and
13888 now is part of Expression.
13890 (ElementAccess): Depending on the element access type
13892 * typemanager.cs: Add `indexer_name_type' as a Core type
13893 (System.Runtime.CompilerServices.IndexerNameAttribute)
13895 * statement.cs (Goto): Take a location.
13897 2001-10-18 Ravi Pratap <ravi@ximian.com>
13899 * delegate.cs (Delegate::VerifyDelegate): New method to verify
13900 if two delegates are compatible.
13902 (NewDelegate::DoResolve): Update to take care of the case when
13903 we instantiate a delegate from another delegate.
13905 * typemanager.cs (FindMembers): Don't even try to look up members
13906 of Delegate types for now.
13908 2001-10-18 Ravi Pratap <ravi@ximian.com>
13910 * delegate.cs (NewDelegate): New class to take care of delegate
13913 * expression.cs (New): Split the delegate related code out into
13914 the NewDelegate class.
13916 * delegate.cs (DelegateInvocation): New class to handle delegate
13919 * expression.cs (Invocation): Split out delegate related code into
13920 the DelegateInvocation class.
13922 2001-10-17 Ravi Pratap <ravi@ximian.com>
13924 * expression.cs (New::DoResolve): Implement delegate creation fully
13925 and according to the spec.
13927 (New::DoEmit): Update to handle delegates differently.
13929 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
13930 because of which we were printing out arguments in reverse order !
13932 * delegate.cs (VerifyMethod): Implement to check if the given method
13933 matches the delegate.
13935 (FullDelegateDesc): Implement.
13937 (VerifyApplicability): Implement.
13939 * expression.cs (Invocation::DoResolve): Update to accordingly handle
13940 delegate invocations too.
13942 (Invocation::Emit): Ditto.
13944 * ../errors/cs1593.cs : Added.
13946 * ../errors/cs1594.cs : Added.
13948 * delegate.cs (InstanceExpression, TargetMethod): New properties.
13950 2001-10-16 Ravi Pratap <ravi@ximian.com>
13952 * typemanager.cs (intptr_type): Core type for System.IntPtr
13954 (InitCoreTypes): Update for the same.
13956 (iasyncresult_type, asynccallback_type): Ditto.
13958 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
13961 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
13964 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
13965 the builders for the 4 members of a delegate type :-)
13967 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
13970 * expression.cs (New::DoResolve): Implement guts for delegate creation.
13972 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
13974 2001-10-15 Miguel de Icaza <miguel@ximian.com>
13976 * statement.cs (Break::Emit): Implement.
13977 (Continue::Emit): Implement.
13979 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
13980 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
13981 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
13982 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
13985 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
13986 properties that track the label for the current loop (begin of the
13987 loop and end of the loop).
13989 2001-10-15 Ravi Pratap <ravi@ximian.com>
13991 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
13992 use of emitting anything at all.
13994 * class.cs, rootcontext.cs : Get rid of calls to the same.
13996 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
13998 (Populate): Define the constructor correctly and set the implementation
14001 * typemanager.cs (delegate_types): New hashtable to hold delegates that
14004 (AddDelegateType): Implement.
14006 (IsDelegateType): Implement helper method.
14008 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
14010 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
14011 and accordingly handle it.
14013 * delegate.cs (Populate): Take TypeContainer argument.
14014 Implement bits to define the Invoke method. However, I still haven't figured out
14015 how to take care of the native int bit :-(
14017 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
14018 Qualify the name of the delegate, not its return type !
14020 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
14023 (StandardConversionExists): Checking for array types turns out to be recursive.
14025 (ConvertReferenceExplicit): Implement array conversion.
14027 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
14029 2001-10-12 Ravi Pratap <ravi@ximian.com>
14031 * cs-parser.jay (delegate_declaration): Store the fully qualified
14032 name as it is a type declaration.
14034 * delegate.cs (ReturnType, Name): Rename members to these. Make them
14037 (DefineDelegate): Renamed from Define. Does the same thing essentially,
14038 as TypeContainer::DefineType.
14040 (Populate): Method in which all the definition of the various methods (Invoke)
14043 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
14046 (CloseDelegate): Finally creates the delegate.
14048 * class.cs (TypeContainer::DefineType): Update to define delegates.
14049 (Populate, Emit and CloseType): Do the same thing here too.
14051 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
14052 delegates in all these operations.
14054 2001-10-14 Miguel de Icaza <miguel@ximian.com>
14056 * expression.cs: LocalTemporary: a new expression used to
14057 reference a temporary that has been created.
14059 * assign.cs: Handle PropertyAccess back here, so that we can
14060 provide the proper semantic access to properties.
14062 * expression.cs (Expression::ConvertReferenceExplicit): Implement
14063 a few more explicit conversions.
14065 * modifiers.cs: `NEW' modifier maps to HideBySig.
14067 * expression.cs (PropertyExpr): Make this into an
14068 ExpressionStatement, and support the EmitStatement code path.
14070 Perform get/set error checking, clean up the interface.
14072 * assign.cs: recognize PropertyExprs as targets, and if so, turn
14073 them into toplevel access objects.
14075 2001-10-12 Miguel de Icaza <miguel@ximian.com>
14077 * expression.cs: PropertyExpr::PropertyExpr: use work around the
14080 * typemanager.cs: Keep track here of our PropertyBuilders again to
14081 work around lameness in SRE.
14083 2001-10-11 Miguel de Icaza <miguel@ximian.com>
14085 * expression.cs (LValue::LValueResolve): New method in the
14086 interface, used to perform a second resolution pass for LValues.
14088 (This::DoResolve): Catch the use of this in static methods.
14090 (This::LValueResolve): Implement.
14092 (This::Store): Remove warning, assigning to `this' in structures
14095 (Invocation::Emit): Deal with invocation of
14096 methods on value types. We need to pass the address to structure
14097 methods rather than the object itself. (The equivalent code to
14098 emit "this" for structures leaves the entire structure on the
14099 stack instead of a pointer to it).
14101 (ParameterReference::DoResolve): Compute the real index for the
14102 argument based on whether the method takes or not a `this' pointer
14103 (ie, the method is static).
14105 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
14106 value types returned from functions when we need to invoke a
14107 method on the sturcture.
14110 2001-10-11 Ravi Pratap <ravi@ximian.com>
14112 * class.cs (TypeContainer::DefineType): Method to actually do the business of
14113 defining the type in the Modulebuilder or Typebuilder. This is to take
14114 care of nested types which need to be defined on the TypeBuilder using
14115 DefineNestedMethod.
14117 (TypeContainer::GetClassBases): Implement. Essentially the code from the
14118 methods in RootContext, only ported to be part of TypeContainer.
14120 (TypeContainer::GetInterfaceOrClass): Ditto.
14122 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
14124 * interface.cs (Interface::DefineInterface): New method. Does exactly
14125 what RootContext.CreateInterface did earlier, only it takes care of nested types
14128 (Interface::GetInterfaces): Move from RootContext here and port.
14130 (Interface::GetInterfaceByName): Same here.
14132 * rootcontext.cs (ResolveTree): Re-write.
14134 (PopulateTypes): Re-write.
14136 * class.cs (TypeContainer::Populate): Populate nested types too.
14137 (TypeContainer::Emit): Emit nested members too.
14139 * typemanager.cs (AddUserType): Do not make use of the FullName property,
14140 instead just use the name argument passed in as it is already fully
14143 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
14144 to TypeContainer mapping to see if a type is user-defined.
14146 * class.cs (TypeContainer::CloseType): Implement.
14148 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
14149 the default constructor.
14151 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
14154 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
14156 * interface.cs (CloseType): Create the type here.
14158 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
14161 Remove all the methods which are now in TypeContainer.
14163 2001-10-10 Ravi Pratap <ravi@ximian.com>
14165 * delegate.cs (Define): Re-write bits to define the delegate
14168 2001-10-10 Miguel de Icaza <miguel@ximian.com>
14170 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
14172 * expression.cs (ImplicitReferenceConversion): handle null as well
14173 as a source to convert to any reference type.
14175 * statement.cs (Return): Perform any implicit conversions to
14176 expected return type.
14178 Validate use of return statement.
14180 * codegen.cs (EmitContext): Pass the expected return type here.
14182 * class.cs (Method, Constructor, Property): Pass expected return
14183 type to EmitContext.
14185 2001-10-09 Miguel de Icaza <miguel@ximian.com>
14187 * expression.cs: Make DoResolve take an EmitContext instead of a
14190 Replaced `l' and `location' for `loc', for consistency.
14192 (Error, Warning): Remove unneeded Tc argument.
14194 * assign.cs, literal.cs, constant.cs: Update to new calling
14197 * codegen.cs: EmitContext now contains a flag indicating whether
14198 code is being generated in a static method or not.
14200 * cs-parser.jay: DecomposeQI, new function that replaces the old
14201 QualifiedIdentifier. Now we always decompose the assembled
14202 strings from qualified_identifier productions into a group of
14205 2001-10-08 Miguel de Icaza <miguel@ximian.com>
14207 * rootcontext.cs: Deal with field-less struct types correctly now
14208 by passing the size option to Define Type.
14210 * class.cs: Removed hack that created one static field.
14212 2001-10-07 Miguel de Icaza <miguel@ximian.com>
14214 * statement.cs: Moved most of the code generation here.
14216 2001-10-09 Ravi Pratap <ravi@ximian.com>
14218 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
14221 (ElementAccess): Remove useless bits for now - keep checks as the spec
14224 2001-10-08 Ravi Pratap <ravi@ximian.com>
14226 * expression.cs (ElementAccess::DoResolve): Remove my crap code
14227 and start performing checks according to the spec.
14229 2001-10-07 Ravi Pratap <ravi@ximian.com>
14231 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
14232 rank_specifiers instead.
14234 (rank_specifiers): Change the order in which the rank specifiers are stored
14236 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
14238 * expression.cs (ElementAccess): Implement the LValue interface too.
14240 2001-10-06 Ravi Pratap <ravi@ximian.com>
14242 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
14243 except that user defined conversions are not included.
14245 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
14246 perform the conversion of the return type, if necessary.
14248 (New::DoResolve): Check whether we are creating an array or an object
14249 and accordingly do the needful.
14251 (New::Emit): Same here.
14253 (New::DoResolve): Implement guts of array creation.
14255 (New::FormLookupType): Helper function.
14257 2001-10-07 Miguel de Icaza <miguel@ximian.com>
14259 * codegen.cs: Removed most of the code generation here, and move the
14260 corresponding code generation bits to the statement classes.
14262 Added support for try/catch/finalize and throw.
14264 * cs-parser.jay: Added support for try/catch/finalize.
14266 * class.cs: Catch static methods having the flags override,
14267 virtual or abstract.
14269 * expression.cs (UserCast): This user cast was not really doing
14270 what it was supposed to do. Which is to be born in fully resolved
14271 state. Parts of the resolution were being performed at Emit time!
14275 2001-10-05 Miguel de Icaza <miguel@ximian.com>
14277 * expression.cs: Implicity convert the result from UserCast.
14279 2001-10-05 Ravi Pratap <ravi@ximian.com>
14281 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
14282 prevented it from working correctly.
14284 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
14285 merely ConvertImplicit.
14287 2001-10-05 Miguel de Icaza <miguel@ximian.com>
14289 * typemanager.cs: Make the LookupTypeContainer function static,
14290 and not per-instance.
14292 * class.cs: Make static FindMembers (the one that takes a Type
14295 * codegen.cs: Add EmitForeach here.
14297 * cs-parser.jay: Make foreach a toplevel object instead of the
14298 inline expansion, as we need to perform semantic analysis on it.
14300 2001-10-05 Ravi Pratap <ravi@ximian.com>
14302 * expression.cs (Expression::ImplicitUserConversion): Rename to
14303 UserDefinedConversion.
14305 (Expression::UserDefinedConversion): Take an extra argument specifying
14306 whether we look for explicit user conversions too.
14308 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
14310 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
14312 (ExplicitUserConversion): Make it a call to UserDefinedConversion
14313 with the appropriate arguments.
14315 * cs-parser.jay (cast_expression): Record location too.
14317 * expression.cs (Cast): Record location info.
14319 (Expression::ConvertExplicit): Take location argument.
14321 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
14322 to determine if we are doing explicit conversions.
14324 (UserCast::Emit): Update accordingly.
14326 (Expression::ConvertExplicit): Report an error if everything fails.
14328 * ../errors/cs0030.cs : Add.
14330 2001-10-04 Miguel de Icaza <miguel@ximian.com>
14332 * modifiers.cs: If the ABSTRACT keyword is present, also set the
14333 virtual and newslot bits.
14335 * class.cs (TypeContainer::RegisterRequiredImplementations):
14336 Record methods we need.
14338 (TypeContainer::MakeKey): Helper function to make keys for
14339 MethodBases, since the Methodbase key is useless.
14341 (TypeContainer::Populate): Call RegisterRequiredImplementations
14342 before defining the methods.
14344 Create a mapping for method_builders_to_methods ahead of time
14345 instead of inside a tight loop.
14347 (::RequireMethods): Accept an object as the data to set into the
14348 hashtable so we can report interface vs abstract method mismatch.
14350 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14352 * report.cs: Make all of it static.
14354 * rootcontext.cs: Drop object_type and value_type computations, as
14355 we have those in the TypeManager anyways.
14357 Drop report instance variable too, now it is a global.
14359 * driver.cs: Use try/catch on command line handling.
14361 Add --probe option to debug the error reporting system with a test
14364 * report.cs: Add support for exiting program when a probe
14365 condition is reached.
14367 2001-10-03 Ravi Pratap <ravi@ximian.com>
14369 * expression.cs (Binary::DoNumericPromotions): Fix the case when
14370 we do a forcible conversion regardless of type, to check if
14371 ForceConversion returns a null.
14373 (Binary::error19): Use location to report error.
14375 (Unary::error23): Use location here too.
14377 * ../errors/cs0019.cs : Check in.
14379 * ../errors/cs0023.cs : Check in.
14381 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
14382 case of a non-null MethodInfo object with a length of 0 !
14384 (Binary::ResolveOperator): Flag error if overload resolution fails to find
14385 an applicable member - according to the spec :-)
14386 Also fix logic to find members in base types.
14388 (Unary::ResolveOperator): Same here.
14390 (Unary::report23): Change name to error23 and make first argument a TypeContainer
14391 as I was getting thoroughly confused between this and error19 :-)
14393 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
14394 (::FindMostEncompassedType): Implement.
14395 (::FindMostEncompassingType): Implement.
14396 (::StandardConversionExists): Implement.
14398 (UserImplicitCast): Re-vamp. We now need info about most specific
14399 source and target types so that we can do the necessary conversions.
14401 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
14402 mathematical union with no duplicates.
14404 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14406 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
14407 in order from base classes to child classes, so that we can in
14408 child classes look up in our parent for method names and
14409 attributes (required for handling abstract, virtual, new, override
14410 constructs: we need to instrospect our base class, and if we dont
14411 populate the classes in order, the introspection might be
14412 incorrect. For example, a method could query its parent before
14413 the parent has any methods and would determine that the parent has
14414 no abstract methods (while it could have had them)).
14416 (RootContext::CreateType): Record the order in which we define the
14419 2001-10-02 Miguel de Icaza <miguel@ximian.com>
14421 * class.cs (TypeContainer::Populate): Also method definitions can
14422 fail now, keep track of this.
14424 (TypeContainer::FindMembers): Implement support for
14425 DeclaredOnly/noDeclaredOnly flag.
14427 (Constructor::Emit) Return the ConstructorBuilder.
14429 (Method::Emit) Return the MethodBuilder.
14430 Check for abstract or virtual methods to be public.
14432 * rootcontext.cs (RootContext::CreateType): Register all the
14433 abstract methods required for the class to be complete and the
14434 interface methods that must be implemented.
14436 * cs-parser.jay: Report error 501 (method requires body if it is
14437 not marked abstract or extern).
14439 * expression.cs (TypeOf::Emit): Implement.
14441 * typemanager.cs: runtime_handle_type, new global type.
14443 * class.cs (Property::Emit): Generate code for properties.
14445 2001-10-02 Ravi Pratap <ravi@ximian.com>
14447 * expression.cs (Unary::ResolveOperator): Find operators on base type
14448 too - we now conform exactly to the spec.
14450 (Binary::ResolveOperator): Same here.
14452 * class.cs (Operator::Define): Fix minor quirk in the tests.
14454 * ../errors/cs0215.cs : Added.
14456 * ../errors/cs0556.cs : Added.
14458 * ../errors/cs0555.cs : Added.
14460 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14462 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
14463 single integer which is really efficient
14465 2001-10-01 Ravi Pratap <ravi@ximian.com>
14467 * expression.cs (Expression::ImplicitUserConversion): Use location
14468 even in the case when we are examining True operators.
14470 * class.cs (Operator::Define): Perform extensive checks to conform
14471 with the rules for operator overloading in the spec.
14473 * expression.cs (Expression::ImplicitReferenceConversion): Implement
14474 some of the other conversions mentioned in the spec.
14476 * typemanager.cs (array_type): New static member for the System.Array built-in
14479 (cloneable_interface): For System.ICloneable interface.
14481 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
14482 we start resolving the tree and populating types.
14484 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
14486 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14488 * expression.cs (Expression::ExprClassFromMemberInfo,
14489 Expression::Literalize): Create literal expressions from
14490 FieldInfos which are literals.
14492 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
14493 type casts, because they were wrong. The test suite in tests
14496 (ImplicitNumericConversion): ushort to ulong requires a widening
14499 Int32 constant to long requires widening cast as well.
14501 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
14502 for integers because the type on the stack is not i4.
14504 2001-09-30 Miguel de Icaza <miguel@ximian.com>
14506 * expression.cs (report118): require location argument.
14508 * parameter.cs: Do not dereference potential null value.
14510 * class.cs: Catch methods that lack the `new' keyword when
14511 overriding a name. Report warnings when `new' is used without
14512 anything being there to override.
14514 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
14516 * class.cs: Only add constructor to hashtable if it is non-null
14517 (as now constructors can fail on define).
14519 (TypeManager, Class, Struct): Take location arguments.
14521 Catch field instance initialization in structs as errors.
14523 accepting_filter: a new filter for FindMembers that is static so
14524 that we dont create an instance per invocation.
14526 (Constructor::Define): Catch errors where a struct constructor is
14529 * cs-parser.jay: Pass location information for various new
14532 * delegate.cs (Delegate): take a location argument.
14534 * driver.cs: Do not call EmitCode if there were problesm in the
14535 Definition of the types, as many Builders wont be there.
14537 * decl.cs (Decl::Decl): Require a location argument.
14539 * cs-tokenizer.cs: Handle properly hex constants that can not fit
14540 into integers, and find the most appropiate integer for it.
14542 * literal.cs: Implement ULongLiteral.
14544 * rootcontext.cs: Provide better information about the location of
14545 failure when CreateType fails.
14547 2001-09-29 Miguel de Icaza <miguel@ximian.com>
14549 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
14552 * expression.cs (Binary::CheckShiftArguments): Add missing type
14554 (Binary::ResolveOperator): Add type to the logical and and logical
14555 or, Bitwise And/Or and Exclusive Or code paths, it was missing
14558 (Binary::DoNumericPromotions): In the case where either argument
14559 is ulong (and most signed types combined with ulong cause an
14560 error) perform implicit integer constant conversions as well.
14562 2001-09-28 Miguel de Icaza <miguel@ximian.com>
14564 * expression.cs (UserImplicitCast): Method should always be
14566 (Invocation::BetterConversion): Simplified test for IntLiteral.
14568 (Expression::ImplicitNumericConversion): Split this routine out.
14569 Put the code that performs implicit constant integer conversions
14572 (Expression::Resolve): Become a wrapper around DoResolve so we can
14573 check eclass and type being set after resolve.
14575 (Invocation::Badness): Remove this dead function
14577 (Binary::ResolveOperator): Do not compute the expensive argumnets
14578 unless we have a union for it.
14580 (Probe::Emit): Is needs to do an isinst and then
14581 compare against null.
14583 (::CanConvert): Added Location argument. If the Location argument
14584 is null (Location.Null), then we do not report errors. This is
14585 used by the `probe' mechanism of the Explicit conversion. We do
14586 not want to generate an error for something that the user
14587 explicitly requested to be casted. But the pipeline for an
14588 explicit cast first tests for potential implicit casts.
14590 So for now, if the Location is null, it means `Probe only' to
14591 avoid adding another argument. Might have to revise this
14594 (ClassCast): New class used to type cast objects into arbitrary
14595 classes (used in Explicit Reference Conversions).
14597 Implement `as' as well.
14599 Reverted all the patches from Ravi below: they were broken:
14601 * The use of `level' as a mechanism to stop recursive
14602 invocations is wrong. That was there just to catch the
14603 bug with a strack trace but not as a way of addressing
14606 To fix the problem we have to *understand* what is going
14607 on and the interactions and come up with a plan, not
14608 just get things going.
14610 * The use of the type conversion cache that I proposed
14611 last night had an open topic: How does this work across
14612 protection domains. A user defined conversion might not
14613 be public in the location where we are applying the
14614 conversion, a different conversion might be selected
14615 (ie, private A->B (better) but public B->A (worse),
14616 inside A, A->B applies, but outside it, B->A will
14619 * On top of that (ie, even if the above is solved),
14620 conversions in a cache need to be abstract. Ie, `To
14621 convert from an Int to a Short use an OpcodeCast', not
14622 `To convert from an Int to a Short use the OpcodeCast on
14623 the variable 5' (which is what this patch was doing).
14625 2001-09-28 Ravi Pratap <ravi@ximian.com>
14627 * expression.cs (Invocation::ConversionExists): Re-write to use
14628 the conversion cache
14630 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
14631 cache all conversions done, not just user-defined ones.
14633 (Invocation::BetterConversion): The real culprit. Use ConversionExists
14634 to determine if a conversion exists instead of acutually trying to
14635 perform the conversion. It's faster too.
14637 (Expression::ConvertExplicit): Modify to use ConversionExists to check
14638 and only then attempt the implicit conversion.
14640 2001-09-28 Ravi Pratap <ravi@ximian.com>
14642 * expression.cs (ConvertImplicit): Use a cache for conversions
14643 already found. Check level of recursion and bail out if necessary.
14645 2001-09-28 Miguel de Icaza <miguel@ximian.com>
14647 * typemanager.cs (string_concat_string_string, string_concat_object_object):
14648 Export standard methods that we expect for string operations.
14650 * statement.cs (Block::UsageWarning): Track usage of variables and
14651 report the errors for not used variables.
14653 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
14656 2001-09-27 Miguel de Icaza <miguel@ximian.com>
14658 * codegen.cs: remove unnneded code
14660 * expression.cs: Removed BuiltinTypeAccess class
14662 Fix the order in which implicit conversions are
14665 The previous fixed dropped support for boxed conversions (adding a
14666 test to the test suite now)
14668 (UserImplicitCast::CanConvert): Remove test for source being null,
14669 that code is broken. We should not feed a null to begin with, if
14670 we do, then we should track the bug where the problem originates
14671 and not try to cover it up here.
14673 Return a resolved expression of type UserImplicitCast on success
14674 rather than true/false. Ravi: this is what I was talking about,
14675 the pattern is to use a static method as a "constructor" for
14678 Also, do not create arguments until the very last minute,
14679 otherwise we always create the arguments even for lookups that
14680 will never be performed.
14682 (UserImplicitCast::Resolve): Eliminate, objects of type
14683 UserImplicitCast are born in a fully resolved state.
14685 * typemanager.cs (InitCoreTypes): Init also value_type
14686 (System.ValueType).
14688 * expression.cs (Cast::Resolve): First resolve the child expression.
14690 (LValue): Add new method AddressOf to be used by
14693 Change the argument of Store to take an EmitContext instead of an
14694 ILGenerator, because things like FieldExpr need to be able to call
14695 their children expression to generate the instance code.
14697 (Expression::Error, Expression::Warning): Sugar functions for
14700 (Expression::MemberLookup): Accept a TypeContainer instead of a
14701 Report as the first argument.
14703 (Expression::ResolvePrimary): Killed. I still want to improve
14704 this as currently the code is just not right.
14706 (Expression::ResolveMemberAccess): Simplify, but it is still
14709 (Unary::Resolve): Catch errors in AddressOf operators.
14711 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
14712 index to a byte for the short-version, or the compiler will choose
14713 the wrong Emit call, which generates the wrong data.
14715 (ParameterReference::Emit, ::Store): same.
14717 (FieldExpr::AddressOf): Implement.
14719 * typemanager.cs: TypeManager: made public variable instead of
14722 * driver.cs: document --fatal.
14724 * report.cs (ErrorMessage, WarningMessage): new names for the old
14725 Error and Warning classes.
14727 * cs-parser.jay (member_access): Turn built-in access to types
14728 into a normal simplename
14730 2001-09-27 Ravi Pratap <ravi@ximian.com>
14732 * expression.cs (Invocation::BetterConversion): Fix to cope
14733 with q being null, since this was introducing a bug.
14735 * expression.cs (ConvertImplicit): Do built-in conversions first.
14737 2001-09-27 Ravi Pratap <ravi@ximian.com>
14739 * expression.cs (UserImplicitCast::Resolve): Fix bug.
14741 2001-09-27 Ravi Pratap <ravi@ximian.com>
14743 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
14744 I had introduced long ago (what's new ?).
14746 * expression.cs (UserImplicitCast::CanConvert): Static method to do
14747 the work of all the checking.
14748 (ConvertImplicit): Call CanConvert and only then create object if necessary.
14749 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
14751 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
14752 that is the right way.
14754 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
14755 overloading resolution. Use everywhere instead of cutting and pasting code.
14757 (Binary::ResolveOperator): Use MakeUnionSet.
14759 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
14760 we have to convert to bool types. Not complete yet.
14762 2001-09-27 Miguel de Icaza <miguel@ximian.com>
14764 * typemanager.cs (TypeManager::CSharpName): support ushort.
14766 * expression.cs (Expression::TryImplicitIntConversion): Attempts
14767 to provide an expression that performsn an implicit constant int
14768 conversion (section 6.1.6).
14769 (Expression::ConvertImplicitRequired): Reworked to include
14770 implicit constant expression conversions.
14772 (Expression::ConvertNumericExplicit): Finished.
14774 (Invocation::Emit): If InstanceExpression is null, then it means
14775 that we perform a call on this.
14777 2001-09-26 Miguel de Icaza <miguel@ximian.com>
14779 * expression.cs (Unary::Emit): Remove some dead code.
14780 (Probe): Implement Resolve and Emit for `is'.
14781 (Expression::ConvertImplicitRequired): Attempt to do constant
14782 expression conversions here. Maybe should be moved to
14783 ConvertImplicit, but I am not sure.
14784 (Expression::ImplicitLongConstantConversionPossible,
14785 Expression::ImplicitIntConstantConversionPossible): New functions
14786 that tell whether is it possible to apply an implicit constant
14787 expression conversion.
14789 (ConvertNumericExplicit): Started work on explicit numeric
14792 * cs-parser.jay: Update operator constants.
14794 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
14795 (Parameters::GetSignature): Hook up VerifyArgs here.
14796 (Parameters::VerifyArgs): Verifies that no two arguments have the
14799 * class.cs (Operator): Update the operator names to reflect the
14800 ones that the spec expects (as we are just stringizing the
14803 * expression.cs (Unary::ResolveOperator): Fix bug: Use
14804 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
14805 previous usage did only work for our methods.
14806 (Expression::ConvertImplicit): Handle decimal implicit numeric
14807 conversions as well.
14808 (Expression::InternalTypeConstructor): Used to invoke constructors
14809 on internal types for default promotions.
14811 (Unary::Emit): Implement special handling for the pre/post
14812 increment/decrement for overloaded operators, as they need to have
14813 the same semantics as the other operators.
14815 (Binary::ResolveOperator): ditto.
14816 (Invocation::ConversionExists): ditto.
14817 (UserImplicitCast::Resolve): ditto.
14819 2001-09-26 Ravi Pratap <ravi@ximian.com>
14821 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
14822 operator, return after emitting body. Regression tests pass again !
14824 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
14825 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
14826 (Invocation::OverloadResolve): Ditto.
14827 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
14829 * everywhere : update calls to the above methods accordingly.
14831 2001-09-26 Miguel de Icaza <miguel@ximian.com>
14833 * assign.cs (Assign): Make it inherit from ExpressionStatement.
14835 * expression.cs (ExpressionStatement): New base class used for
14836 expressions that can appear in statements, so that we can provide
14837 an alternate path to generate expression that do not leave a value
14840 (Expression::Emit, and all the derivatives): We no longer return
14841 whether a value is left on the stack or not. Every expression
14842 after being emitted leaves a single value on the stack.
14844 * codegen.cs (EmitContext::EmitStatementExpression): Use the
14845 facilties of ExpressionStatement if possible.
14847 * cs-parser.jay: Update statement_expression.
14849 2001-09-25 Miguel de Icaza <miguel@ximian.com>
14851 * driver.cs: Change the wording of message
14853 2001-09-25 Ravi Pratap <ravi@ximian.com>
14855 * expression.cs (Binary::ResolveOperator): Had forgottten to set
14856 the type of the expression to the return type of the method if
14857 we have an overloaded operator match ! The regression tests pass again !
14858 (Unary::ResolveOperator): Ditto.
14860 * expression.cs (Invocation::ConversionExists): Correct the member lookup
14861 to find "op_Implicit", not "implicit" ;-)
14862 (UserImplicitCast): New class to take care of user-defined implicit conversions.
14863 (ConvertImplicit, ForceConversion): Take TypeContainer argument
14865 * everywhere : Correct calls to the above accordingly.
14867 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
14868 (ConvertImplicit): Do user-defined conversion if it exists.
14870 2001-09-24 Miguel de Icaza <miguel@ximian.com>
14872 * assign.cs: track location.
14873 (Resolve): Use implicit conversions on assignment.
14875 * literal.cs: Oops. Not good, Emit of short access values should
14876 pass (Bytes) or the wrong argument will be selected.
14878 * expression.cs (Unary::Emit): Emit code for -expr.
14880 (Unary::ResolveOperator): Handle `Substract' for non-constants
14881 (substract from zero from the non-constants).
14882 Deal with Doubles as well.
14884 (Expression::ConvertImplicitRequired): New routine that reports an
14885 error if no implicit conversion exists.
14887 (Invocation::OverloadResolve): Store the converted implicit
14888 expressions if we make them
14890 2001-09-24 Ravi Pratap <ravi@ximian.com>
14892 * class.cs (ConstructorInitializer): Take a Location argument.
14893 (ConstructorBaseInitializer): Same here.
14894 (ConstructorThisInitializer): Same here.
14896 * cs-parser.jay : Update all calls accordingly.
14898 * expression.cs (Unary, Binary, New): Take location argument.
14899 Update accordingly everywhere.
14901 * cs-parser.jay : Update all calls to the above to take a location
14904 * class.cs : Ditto.
14906 2001-09-24 Ravi Pratap <ravi@ximian.com>
14908 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
14909 (Invocation::BetterConversion): Same here
14910 (Invocation::ConversionExists): Ditto.
14912 (Invocation::ConversionExists): Implement.
14914 2001-09-22 Ravi Pratap <ravi@ximian.com>
14916 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
14917 Also take an additional TypeContainer argument.
14919 * All over : Pass in TypeContainer as argument to OverloadResolve.
14921 * typemanager.cs (CSharpName): Update to check for the string type and return
14924 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
14927 2001-09-21 Ravi Pratap <ravi@ximian.com>
14929 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
14930 (Invocation::BetterFunction): Implement.
14931 (Invocation::BetterConversion): Implement.
14932 (Invocation::ConversionExists): Skeleton, no implementation yet.
14934 Okay, things work fine !
14936 2001-09-21 Miguel de Icaza <miguel@ximian.com>
14938 * typemanager.cs: declare and load enum_type, delegate_type and
14941 * expression.cs (Expression::Emit): Now emit returns a value that
14942 tells whether a value is left on the stack or not. This strategy
14943 might be reveted tomorrow with a mechanism that would address
14944 multiple assignments.
14945 (Expression::report118): Utility routine to report mismatches on
14948 (Unary::Report23): Report impossible type/operator combination
14951 (Unary::IsIncrementableNumber): Whether the type can be
14952 incremented or decremented with add.
14953 (Unary::ResolveOperator): Also allow enumerations to be bitwise
14955 (Unary::ResolveOperator): Implement ++, !, ~,
14957 (Invocation::Emit): Deal with new Emit convetion.
14959 * All Expression derivatives: Updated their Emit method to return
14960 whether they leave values on the stack or not.
14962 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
14963 stack for expressions that are statements.
14965 2001-09-20 Miguel de Icaza <miguel@ximian.com>
14967 * expression.cs (LValue): New interface. Must be implemented by
14969 (LocalVariableReference, ParameterReference, FieldExpr): Implement
14972 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
14973 interface for generating code, simplifies the code.
14975 2001-09-20 Ravi Pratap <ravi@ximian.com>
14977 * expression.cs (everywhere): Comment out return statements in ::Resolve
14978 methods to avoid the warnings.
14980 2001-09-20 Miguel de Icaza <miguel@ximian.com>
14982 * driver.cs (parse): Report error 2001 if we can not open the
14985 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
14988 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
14991 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
14992 otherwise nested blocks end up with the same index.
14994 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
14996 * expression.cs: Instead of having FIXMEs in the Resolve
14997 functions, throw exceptions so it is obvious that we are facing a
15000 * cs-parser.jay (invocation_expression): Pass Location information.
15002 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
15003 Use a basename for those routines because .NET does not like paths
15006 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
15009 2001-09-19 Miguel de Icaza <miguel@ximian.com>
15011 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
15012 are loading the correct data types (throws an exception if not).
15013 (TypeManager::InitCoreTypes): Use CoreLookupType
15015 * expression.cs (Unary::ResolveOperator): return the child
15016 expression for expressions which are just +expr.
15017 (Unary::ResolveOperator): Return negative literals for -LITERAL
15018 expressions (otherwise they are Unary {Literal}).
15019 (Invocation::Badness): Take into account `Implicit constant
15020 expression conversions'.
15022 * literal.cs (LongLiteral): Implement long literal class.
15023 (IntLiteral): export the `Value' of the intliteral.
15025 2001-09-19 Ravi Pratap <ravi@ximian.com>
15027 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
15029 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
15030 instead of 'Operator'
15032 * expression.cs (Binary::ResolveOperator): Update accordingly.
15033 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
15036 * cs-parser.jay (unary_expression): Update to use the new names.
15038 * gen-treedump.cs (GetUnary): Same here.
15040 * expression.cs (Unary::Resolve): Implement.
15041 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
15042 operators are found instead of making noise ;-)
15043 (Unary::ResolveOperator): New method to do precisely the same thing which
15044 Binary::ResolveOperator does for Binary expressions.
15045 (Unary.method, .Arguments): Add.
15046 (Unary::OperName): Implement.
15047 (Unary::ForceConversion): Copy and Paste !
15049 * class.cs (Operator::Define): Fix a small bug for the case when we have
15052 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
15053 for the inbuilt operators. Only overloading works for now ;-)
15055 2001-09-18 Miguel de Icaza <miguel@ximian.com>
15057 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
15058 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
15060 * expression.cs (This::Emit): Implement.
15061 (This::Resolve): Implement.
15062 (TypeOf:Resolve): Implement.
15063 (Expression::ResolveSimpleName): Add an implicit this to instance
15065 (MemberAccess::Resolve): Deal with Parameters and Fields.
15066 Bind instance variable to Field expressions.
15067 (FieldExpr::Instance): New field used to track the expression that
15068 represents the object instance.
15069 (FieldExpr::Resolve): Track potential errors from MemberLookup not
15071 (FieldExpr::Emit): Implement.
15073 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
15074 the last instruction contains a return opcode to avoid generating
15075 the last `ret' instruction (this generates correct code, and it is
15076 nice to pass the peverify output).
15078 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
15079 initializer for static and instance variables.
15080 (Constructor::Emit): Allow initializer to be null in the case of
15081 static constructors. Only emit initializer for instance
15084 (TypeContainer::FindMembers): Return a null array if there are no
15087 Also fix the code for the MemberTypes.Method branch, as it was not
15088 scanning that for operators (or tried to access null variables before).
15090 * assign.cs (Assign::Emit): Handle instance and static fields.
15094 * driver.cs: Stop compilation if there are parse errors.
15096 * cs-parser.jay (constructor_declaration): Provide default base
15097 initializer for non-static constructors.
15098 (constructor_declarator): Do not provide a default base
15099 initializers if none was specified.
15100 Catch the fact that constructors should not have parameters.
15102 * class.cs: Do not emit parent class initializers for static
15103 constructors, that should be flagged as an error.
15105 2001-09-18 Ravi Pratap <ravi@ximian.com>
15107 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
15108 Move back code into TypeContainer::Populate.
15110 2001-09-18 Ravi Pratap <ravi@ximian.com>
15112 * class.cs (TypeContainer::AddConstructor): Fix the check to
15113 compare against Name, not Basename.
15114 (Operator::OpType): Change Plus and Minus to Add and Subtract.
15116 * cs-parser.jay : Update accordingly.
15118 * class.cs (TypeContainer::FindMembers): For the case where we are searching
15119 for methods, don't forget to look into the operators too.
15120 (RegisterMethodBuilder): Helper method to take care of this for
15121 methods, constructors and operators.
15122 (Operator::Define): Completely revamp.
15123 (Operator.OperatorMethod, MethodName): New fields.
15124 (TypeContainer::Populate): Move the registering of builders into
15125 RegisterMethodBuilder.
15126 (Operator::Emit): Re-write.
15128 * expression.cs (Binary::Emit): Comment out code path to emit method
15129 invocation stuff for the case when we have a user defined operator. I am
15130 just not able to get it right !
15132 2001-09-17 Miguel de Icaza <miguel@ximian.com>
15134 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
15137 (Expression::MemberLookup): Provide a version that allows to
15138 specify the MemberTypes and BindingFlags.
15140 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
15141 so it was not fetching variable information from outer blocks.
15143 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
15144 Beforefieldinit as it was buggy.
15146 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
15147 that Ravi put here.
15149 * class.cs (Constructor::Emit): Only emit if block is not null.
15150 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
15151 deal with this by semantically definining it as if the user had
15154 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
15155 constructors as we now "emit" them at a higher level.
15157 (TypeContainer::DefineDefaultConstructor): Used to define the
15158 default constructors if none was provided.
15160 (ConstructorInitializer): Add methods Resolve and Emit.
15162 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
15164 2001-09-17 Ravi Pratap <ravi@ximian.com>
15166 * class.cs (TypeContainer::EmitDefaultConstructor): Register
15167 the default constructor builder with our hashtable for methodbuilders
15170 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
15171 and argument_count is 0 in which case we have a match.
15172 (Binary::ResolveOperator): More null checking and miscellaneous coding
15175 2001-09-17 Ravi Pratap <ravi@ximian.com>
15177 * rootcontext.cs (IsNameSpace): Compare against null.
15179 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
15181 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
15182 and Unary::Operator.
15184 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
15187 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
15188 we have overloaded operators.
15189 (Binary::ResolveOperator): Implement the part which does the operator overload
15192 * class.cs (Operator::Emit): Implement.
15193 (TypeContainer::Emit): Emit the operators we have too.
15195 * expression.cs (Binary::Emit): Update to emit the appropriate code for
15196 the case when we have a user-defined operator.
15198 2001-09-17 Miguel de Icaza <miguel@ximian.com>
15200 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
15202 2001-09-16 Ravi Pratap <ravi@ximian.com>
15204 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
15205 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
15206 (Constructor::Emit): Implement.
15207 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
15208 if we have no work to do.
15209 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
15212 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
15213 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
15215 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
15218 2001-09-15 Ravi Pratap <ravi@ximian.com>
15220 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
15222 (Tree::RecordNamespace): Method to do what the name says ;-)
15223 (Tree::Namespaces): Property to get at the namespaces hashtable.
15225 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
15228 * rootcontext.cs (IsNamespace): Fixed it :-)
15230 2001-09-14 Miguel de Icaza <miguel@ximian.com>
15232 * class.cs (TypeContainer::FindMembers): Add support for
15234 (MethodCore): New class that encapsulates both the shared aspects
15235 of a Constructor and a Method.
15236 (Method, Constructor): Factored pieces into MethodCore.
15238 * driver.cs: Added --fatal which makes errors throw exceptions.
15239 Load System assembly as well as part of the standard library.
15241 * report.cs: Allow throwing exceptions on errors for debugging.
15243 * modifiers.cs: Do not use `parent', instead use the real type
15244 container to evaluate permission settings.
15246 * class.cs: Put Ravi's patch back in. He is right, and we will
15247 have to cope with the
15249 2001-09-14 Ravi Pratap <ravi@ximian.com>
15251 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
15252 FamORAssem, not FamANDAssem.
15254 2001-09-14 Miguel de Icaza <miguel@ximian.com>
15256 * driver.cs: Added --parse option that only parses its input files
15259 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
15260 incorrect. IsTopLevel is not used to tell whether an object is
15261 root_types or not (that can be achieved by testing this ==
15262 root_types). But to see if this is a top-level *class* (not
15263 necessarly our "toplevel" container).
15265 2001-09-14 Ravi Pratap <ravi@ximian.com>
15267 * enum.cs (Enum::Define): Modify to call the Lookup method on the
15268 parent instead of a direct call to GetType.
15270 2001-09-14 Ravi Pratap <ravi@ximian.com>
15272 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
15273 Modifiers.TypeAttr. This should just be a call to that method.
15275 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
15276 object so that we can determine if we are top-level or not.
15278 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
15281 * enum.cs (Enum::Define): Ditto.
15283 * modifiers.cs (FieldAttr): Re-write.
15285 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
15286 (TypeContainer::HaveStaticConstructor): New property to provide access
15287 to precisely that info.
15289 * modifiers.cs (MethodAttr): Re-write.
15290 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
15292 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
15293 of top-level types as claimed.
15295 2001-09-13 Miguel de Icaza <miguel@ximian.com>
15297 * expression.cs (MemberLookup): Fruitless attempt to lookup
15298 constructors. Maybe I need to emit default constructors? That
15299 might be it (currently .NET emits this for me automatically).
15300 (Invocation::OverloadResolve): Cope with Arguments == null.
15301 (Invocation::EmitArguments): new function, shared by the new
15302 constructor and us.
15303 (Invocation::Emit): Handle static and instance methods. Emit
15304 proper call instruction for virtual or non-virtual invocations.
15305 (New::Emit): Implement.
15306 (New::Resolve): Implement.
15307 (MemberAccess:Resolve): Implement.
15308 (MethodGroupExpr::InstanceExpression): used conforming to the spec
15309 to track instances.
15310 (FieldExpr::Resolve): Set type.
15312 * support.cs: Handle empty arguments.
15314 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
15315 SimpleLookup): Auxiliary routines to help parse a qualifier
15318 Update qualifier_identifier rule.
15320 * codegen.cs: Removed debugging messages.
15322 * class.cs: Make this a global thing, this acts just as a "key" to
15323 objects that we might have around.
15325 (Populate): Only initialize method_builders_to_methods once.
15327 * expression.cs (PropertyExpr): Initialize type from the
15330 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
15331 Resolve pattern. Attempt to implicitly convert value to boolean.
15334 * expression.cs: Set the type for the int32/int32 argument case.
15335 (Binary::ResolveOperator): Set the return type to boolean for
15336 comparission operators
15338 * typemanager.cs: Remove debugging print code.
15340 (Invocation::Resolve): resolve type.
15342 * class.cs: Allocate a MemberInfo of the correct size, as the code
15343 elsewhere depends on the test to reflect the correct contents.
15345 (Method::) Keep track of parameters, due to System.Reflection holes
15347 (TypeContainer::Populate): Keep track of MethodBuilders to Method
15350 (TypeContainer::FindMembers): Use ArrayList and then copy an array
15351 of the exact size and return that.
15353 (Class::LookupMethodByBuilder): New function that maps
15354 MethodBuilders to its methods. Required to locate the information
15355 on methods because System.Reflection bit us again.
15357 * support.cs: New file, contains an interface ParameterData and
15358 two implementations: ReflectionParameters and InternalParameters
15359 used to access Parameter information. We will need to grow this
15362 * expression.cs (Invocation::GetParameterData): implement a cache
15363 and a wrapper around the ParameterData creation for methods.
15364 (Invocation::OverloadResolve): Use new code.
15366 2001-09-13 Ravi Pratap <ravi@ximian.com>
15368 * class.cs (TypeContainer::EmitField): Remove and move into
15369 (Field::Define): here and modify accordingly.
15370 (Field.FieldBuilder): New member.
15371 (TypeContainer::Populate): Update accordingly.
15372 (TypeContainer::FindMembers): Implement.
15374 2001-09-13 Miguel de Icaza <miguel@ximian.com>
15376 * statement.cs: (VariableInfo::VariableType): New field to be
15377 initialized with the full type once it is resolved.
15379 2001-09-12 Miguel de Icaza <miguel@ximian.com>
15381 * parameter.cs (GetParameterInfo): Use a type cache to compute
15382 things only once, and to reuse this information
15384 * expression.cs (LocalVariableReference::Emit): Implement.
15385 (OpcodeCast::Emit): fix.
15387 (ParameterReference::Resolve): Implement.
15388 (ParameterReference::Emit): Implement.
15390 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
15391 that are expressions need to stay as Expressions.
15393 * typemanager.cs (CSharpName): Returns the C# name of a type if
15396 * expression.cs (Expression::ConvertImplicit): New function that
15397 implements implicit type conversions.
15399 (Expression::ImplicitReferenceConversion): Implements implicit
15400 reference conversions.
15402 (EmptyCast): New type for transparent casts.
15404 (OpcodeCast): New type for casts of types that are performed with
15405 a sequence of bytecodes.
15407 (BoxedCast): New type used for casting value types into reference
15408 types. Emits a box opcode.
15410 (Binary::DoNumericPromotions): Implements numeric promotions of
15411 and computation of the Binary::Type.
15413 (Binary::EmitBranchable): Optimization.
15415 (Binary::Emit): Implement code emission for expressions.
15417 * typemanager.cs (TypeManager): Added two new core types: sbyte
15420 2001-09-12 Ravi Pratap <ravi@ximian.com>
15422 * class.cs (TypeContainer::FindMembers): Method which does exactly
15423 what Type.FindMembers does, only we don't have to use reflection. No
15424 implementation yet.
15426 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
15427 typecontainer objects as we need to get at them.
15428 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
15430 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
15431 typecontainer object.
15433 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
15434 of just a Report object.
15436 2001-09-11 Ravi Pratap <ravi@ximian.com>
15438 * class.cs (Event::Define): Go back to using the prefixes "add_" and
15440 (TypeContainer::Populate): Now define the delegates of the type too.
15441 (TypeContainer.Delegates): Property to access the list of delegates defined
15444 * delegates.cs (Delegate::Define): Implement partially.
15446 * modifiers.cs (TypeAttr): Handle more flags.
15448 2001-09-11 Ravi Pratap <ravi@ximian.com>
15450 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
15452 (Operator::Define): Re-write logic to get types by using the LookupType method
15453 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
15454 (Indexer::Define): Ditto.
15455 (Event::Define): Ditto.
15456 (Property::Define): Ditto.
15458 2001-09-10 Ravi Pratap <ravi@ximian.com>
15460 * class.cs (TypeContainer::Populate): Now define operators too.
15461 (TypeContainer.Operators): New property to access the list of operators
15463 (Operator.OperatorMethodBuilder): New member to hold the method builder
15464 for the operator we are defining.
15465 (Operator::Define): Implement.
15467 2001-09-10 Ravi Pratap <ravi@ximian.com>
15469 * class.cs (Event::Define): Make the prefixes of the accessor methods
15470 addOn_ and removeOn_
15472 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
15473 of the location being passed in too. Ideally, this should go later since all
15474 error reporting should be done through the Report object.
15476 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
15477 (Populate): Iterate thru the indexers we have and define them too.
15478 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
15479 for the get and set accessors.
15480 (Indexer::Define): Implement.
15482 2001-09-09 Miguel de Icaza <miguel@ximian.com>
15484 * expression.cs (Binary::Resolve): Beginning of it. I scratched
15485 my previous implementation, did not work.
15487 * typemanager.cs: Add a couple of missing types (the longs).
15489 * literal.cs: Use TypeManager.bool_type instead of getting it.
15491 * expression.cs (EventExpr): New kind of expressions.
15492 (Expressio::ExprClassFromMemberInfo): finish
15494 2001-09-08 Miguel de Icaza <miguel@ximian.com>
15496 * assign.cs: Emit stores to static fields differently.
15498 2001-09-08 Ravi Pratap <ravi@ximian.com>
15500 * Merge in changes and adjust code to tackle conflicts. Backed out my
15501 code in Assign::Resolve ;-)
15503 2001-09-08 Ravi Pratap <ravi@ximian.com>
15505 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
15506 instead Report.Error and also pass in the location.
15507 (CSharpParser::Lexer): New readonly property to return the reference
15508 to the Tokenizer object.
15509 (declare_local_variables): Use Report.Error with location instead of plain
15513 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
15514 (Operator.CheckBinaryOperator): Ditto.
15516 * cs-parser.jay (operator_declarator): Update accordingly.
15518 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
15519 (CheckBinaryOperator): Same here.
15521 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
15522 on the name without any prefixes of namespace names etc. This is because we
15523 already might have something already fully qualified like
15524 'System.Console.WriteLine'
15526 * assign.cs (Resolve): Begin implementation. Stuck ;-)
15528 2001-09-07 Ravi Pratap <ravi@ximian.com>
15530 * cs-tokenizer.cs (location): Return a string which also contains
15533 * expression.cs (ElementAccess): New class for expressions of the
15534 type 'element access.'
15535 (BaseAccess): New class for expressions of the type 'base access.'
15536 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
15539 * cs-parser.jay (element_access): Implement action.
15540 (base_access): Implement actions.
15541 (checked_expression, unchecked_expression): Implement.
15543 * cs-parser.jay (local_variable_type): Correct and implement.
15544 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
15546 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
15548 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
15549 name and the specifiers.
15551 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
15553 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
15554 making them all public ;-)
15556 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
15559 2001-09-07 Miguel de Icaza <miguel@ximian.com>
15561 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
15563 (FieldExpr, PropertyExprs): New resolved expressions.
15564 (SimpleName::MemberStaticCheck): Perform static checks for access
15565 to non-static fields on static methods. Maybe this should be
15566 generalized for MemberAccesses.
15567 (SimpleName::ResolveSimpleName): More work on simple name
15570 * cs-parser.jay (primary_expression/qualified_identifier): track
15571 the parameter index.
15573 * codegen.cs (CodeGen::Save): Catch save exception, report error.
15574 (EmitContext::EmitBoolExpression): Chain to expression generation
15575 instead of temporary hack.
15576 (::EmitStatementExpression): Put generic expression code generation.
15578 * assign.cs (Assign::Emit): Implement variable assignments to
15579 local variables, parameters and fields.
15581 2001-09-06 Miguel de Icaza <miguel@ximian.com>
15583 * statement.cs (Block::GetVariableInfo): New method, returns the
15584 VariableInfo for a variable name in a block.
15585 (Block::GetVariableType): Implement in terms of GetVariableInfo
15587 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
15588 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
15590 2001-09-06 Ravi Pratap <ravi@ximian.com>
15592 * cs-parser.jay (operator_declaration): Continue on my quest : update
15593 to take attributes argument.
15594 (event_declaration): Ditto.
15595 (enum_declaration): Ditto.
15596 (indexer_declaration): Ditto.
15598 * class.cs (Operator::Operator): Update constructor accordingly.
15599 (Event::Event): Ditto.
15601 * delegate.cs (Delegate::Delegate): Same here.
15603 * enum.cs (Enum::Enum): Same here.
15605 2001-09-05 Ravi Pratap <ravi@ximian.com>
15607 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
15609 * ../tests/cs0658.cs : New file to demonstrate error 0658.
15611 * attribute.cs (Attributes): New class to encapsulate all attributes which were
15612 being passed around as an arraylist.
15613 (Attributes::AddAttribute): Method to add attribute sections.
15615 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
15616 (struct_declaration): Update accordingly.
15617 (constant_declaration): Update.
15618 (field_declaration): Update.
15619 (method_header): Update.
15620 (fixed_parameter): Update.
15621 (parameter_array): Ditto.
15622 (property_declaration): Ditto.
15623 (destructor_declaration): Ditto.
15625 * class.cs (Struct::Struct): Update constructors accordingly.
15626 (Class::Class): Ditto.
15627 (Field::Field): Ditto.
15628 (Method::Method): Ditto.
15629 (Property::Property): Ditto.
15630 (TypeContainer::OptAttribute): update property's return type.
15632 * interface.cs (Interface.opt_attributes): New member.
15633 (Interface::Interface): Update to take the extra Attributes argument.
15635 * parameter.cs (Parameter::Parameter): Ditto.
15637 * constant.cs (Constant::Constant): Ditto.
15639 * interface.cs (InterfaceMemberBase): New OptAttributes field.
15640 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
15641 the attributes as a parameter.
15642 (InterfaceProperty): Update constructor call.
15643 (InterfaceEvent): Ditto.
15644 (InterfaceMethod): Ditto.
15645 (InterfaceIndexer): Ditto.
15647 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
15648 pass the attributes too.
15649 (interface_event_declaration): Ditto.
15650 (interface_property_declaration): Ditto.
15651 (interface_method_declaration): Ditto.
15652 (interface_declaration): Ditto.
15654 2001-09-05 Miguel de Icaza <miguel@ximian.com>
15656 * class.cs (Method::Define): Track the "static Main" definition to
15657 create an entry point.
15659 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
15660 EntryPoint if we find it.
15662 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
15663 (EmitContext::ig): Make this variable public.
15665 * driver.cs: Make the default output file be the first file name
15666 with the .exe extension.
15668 Detect empty compilations
15670 Handle various kinds of output targets. Handle --target and
15671 rename -t to --dumper.
15673 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
15674 methods inherited from Expression return now an Expression. This
15675 will is used during the tree rewriting as we resolve them during
15678 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
15679 the spec. Missing entirely is the information about
15680 accessability of elements of it.
15682 (Expression::ExprClassFromMemberInfo): New constructor for
15683 Expressions that creates a fully initialized Expression based on
15684 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
15687 (Invocation::Resolve): Begin implementing resolution of invocations.
15689 * literal.cs (StringLiteral): Implement Emit.
15691 2001-09-05 Ravi Pratap <ravi@ximian.com>
15693 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
15696 2001-09-04 Ravi Pratap <ravi@ximian.com>
15698 * cs-parser.jay (attribute_arguments): Implement actions.
15699 (attribute): Fix bug in production. Implement action.
15700 (attribute_list): Implement.
15701 (attribute_target): Implement.
15702 (attribute_target_specifier, opt_target_specifier): Implement
15703 (CheckAttributeTarget): New method to check if the attribute target
15705 (attribute_section): Implement.
15706 (opt_attributes): Implement.
15708 * attribute.cs : New file to handle attributes.
15709 (Attribute): Class to hold attribute info.
15711 * cs-parser.jay (opt_attribute_target_specifier): Remove production
15712 (attribute_section): Modify production to use 2 different rules to
15713 achieve the same thing. 1 s/r conflict down !
15714 Clean out commented, useless, non-reducing dimension_separator rules.
15716 * class.cs (TypeContainer.attributes): New member to hold list
15717 of attributes for a type.
15718 (Struct::Struct): Modify to take one more argument, the attribute list.
15719 (Class::Class): Ditto.
15720 (Field::Field): Ditto.
15721 (Method::Method): Ditto.
15722 (Property::Property): Ditto.
15724 * cs-parser.jay (struct_declaration): Update constructor call to
15725 pass in the attributes too.
15726 (class_declaration): Ditto.
15727 (constant_declaration): Ditto.
15728 (field_declaration): Ditto.
15729 (method_header): Ditto.
15730 (fixed_parameter): Ditto.
15731 (parameter_array): Ditto.
15732 (property_declaration): Ditto.
15734 * constant.cs (Constant::Constant): Update constructor similarly.
15735 Use System.Collections.
15737 * parameter.cs (Parameter::Parameter): Update as above.
15739 2001-09-02 Ravi Pratap <ravi@ximian.com>
15741 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
15742 (TypeContainer.delegates): New member to hold list of delegates.
15744 * cs-parser.jay (delegate_declaration): Implement the action correctly
15745 this time as I seem to be on crack ;-)
15747 2001-09-02 Miguel de Icaza <miguel@ximian.com>
15749 * rootcontext.cs (RootContext::IsNamespace): new function, used to
15750 tell whether an identifier represents a namespace.
15752 * expression.cs (NamespaceExpr): A namespace expression, used only
15753 temporarly during expression resolution.
15754 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
15755 utility functions to resolve names on expressions.
15757 2001-09-01 Miguel de Icaza <miguel@ximian.com>
15759 * codegen.cs: Add hook for StatementExpressions.
15761 * class.cs: Fix inverted test for static flag in methods.
15763 2001-09-02 Ravi Pratap <ravi@ximian.com>
15765 * class.cs (Operator::CheckUnaryOperator): Correct error number used
15766 to make it coincide with MS' number.
15767 (Operator::CheckBinaryOperator): Ditto.
15769 * ../errors/errors.txt : Remove error numbers added earlier.
15771 * ../errors/cs1019.cs : Test case for error # 1019
15773 * ../errros/cs1020.cs : Test case for error # 1020
15775 * cs-parser.jay : Clean out commented cruft.
15776 (dimension_separators, dimension_separator): Comment out. Ostensibly not
15777 used anywhere - non-reducing rule.
15778 (namespace_declarations): Non-reducing rule - comment out.
15780 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
15781 with TypeContainer::AddEnum.
15783 * delegate.cs : New file for delegate handling classes.
15784 (Delegate): Class for declaring delegates.
15786 * makefile : Update.
15788 * cs-parser.jay (delegate_declaration): Implement.
15790 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
15792 * class.cs (Event::Define): Implement.
15793 (Event.EventBuilder): New member.
15795 * class.cs (TypeContainer::Populate): Update to define all enums and events
15797 (Events): New property for the events arraylist we hold. Shouldn't we move to using
15798 readonly fields for all these cases ?
15800 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
15802 * class.cs (Property): Revamp to use the convention of making fields readonly.
15803 Accordingly modify code elsewhere.
15805 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
15806 the Define method of the Property class.
15808 * class.cs : Clean up applied patch and update references to variables etc. Fix
15810 (TypeContainer::Populate): Update to define all the properties we have. Also
15811 define all enumerations.
15813 * enum.cs (Define): Implement.
15815 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
15817 * cs-parser.jay (overloadable_operator): The semantic value is an
15818 enum of the Operator class.
15819 (operator_declarator): Implement actions.
15820 (operator_declaration): Implement.
15822 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
15823 validity of definitions.
15824 (Operator::CheckBinaryOperator): Static method to check for binary operators
15825 (TypeContainer::AddOperator): New method to add an operator to a type.
15827 * cs-parser.jay (indexer_declaration): Added line to actually call the
15828 AddIndexer method so it gets added ;-)
15830 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
15831 already taken care of by the MS compiler ?
15833 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
15835 * class.cs (Operator): New class for operator declarations.
15836 (Operator::OpType): Enum for the various operators.
15838 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
15840 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
15841 ostensibly handle this in semantic analysis.
15843 * cs-parser.jay (general_catch_clause): Comment out
15844 (specific_catch_clauses, specific_catch_clause): Ditto.
15845 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
15846 (catch_args, opt_catch_args): New productions.
15847 (catch_clause): Rewrite to use the new productions above
15848 (catch_clauses): Modify accordingly.
15849 (opt_catch_clauses): New production to use in try_statement
15850 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
15851 and re-write the code in the actions to extract the specific and
15852 general catch clauses by being a little smart ;-)
15854 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
15855 Hooray, try and catch statements parse fine !
15857 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
15859 * statement.cs (Block::GetVariableType): Fix logic to extract the type
15860 string from the hashtable of variables.
15862 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
15863 I end up making that mistake ;-)
15864 (catch_clauses): Fixed gross error which made Key and Value of the
15865 DictionaryEntry the same : $1 !!
15867 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
15869 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
15871 * cs-parser.jay (event_declaration): Correct to remove the semicolon
15872 when the add and remove accessors are specified.
15874 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
15876 * cs-parser.jay (IndexerDeclaration): New helper class to hold
15877 information about indexer_declarator.
15878 (indexer_declarator): Implement actions.
15879 (parsing_indexer): New local boolean used to keep track of whether
15880 we are parsing indexers or properties. This is necessary because
15881 implicit_parameters come into picture even for the get accessor in the
15882 case of an indexer.
15883 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
15885 * class.cs (Indexer): New class for indexer declarations.
15886 (TypeContainer::AddIndexer): New method to add an indexer to a type.
15887 (TypeContainer::indexers): New member to hold list of indexers for the
15890 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
15892 * cs-parser.jay (add_accessor_declaration): Implement action.
15893 (remove_accessor_declaration): Implement action.
15894 (event_accessors_declaration): Implement
15895 (variable_declarators): swap statements for first rule - trivial.
15897 * class.cs (Event): New class to hold information about event
15899 (TypeContainer::AddEvent): New method to add an event to a type
15900 (TypeContainer::events): New member to hold list of events.
15902 * cs-parser.jay (event_declaration): Implement actions.
15904 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
15906 * cs-parser.jay (dim_separators): Implement. Make it a string
15907 concatenating all the commas together, just as they appear.
15908 (opt_dim_separators): Modify accordingly
15909 (rank_specifiers): Update accordingly. Basically do the same
15910 thing - instead, collect the brackets here.
15911 (opt_rank_sepcifiers): Modify accordingly.
15912 (array_type): Modify to actually return the complete type string
15913 instead of ignoring the rank_specifiers.
15914 (expression_list): Implement to collect the expressions
15915 (variable_initializer): Implement. We make it a list of expressions
15916 essentially so that we can handle the array_initializer case neatly too.
15917 (variable_initializer_list): Implement.
15918 (array_initializer): Make it a list of variable_initializers
15919 (opt_array_initializer): Modify accordingly.
15921 * expression.cs (New::NType): Add enumeration to help us
15922 keep track of whether we have an object/delegate creation
15923 or an array creation.
15924 (New:NewType, New::Rank, New::Indices, New::Initializers): New
15925 members to hold data about array creation.
15926 (New:New): Modify to update NewType
15927 (New:New): New Overloaded contructor for the array creation
15930 * cs-parser.jay (array_creation_expression): Implement to call
15931 the overloaded New constructor.
15933 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
15935 * class.cs (TypeContainer::Constructors): Return member
15936 constructors instead of returning null.
15938 2001-08-26 Miguel de Icaza <miguel@ximian.com>
15940 * typemanager.cs (InitCoreTypes): Initialize the various core
15941 types after we have populated the type manager with the user
15942 defined types (this distinction will be important later while
15943 compiling corlib.dll)
15945 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
15946 on Expression Classification. Now all expressions have a method
15947 `Resolve' and a method `Emit'.
15949 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
15950 generation from working. Also add some temporary debugging
15953 2001-08-24 Miguel de Icaza <miguel@ximian.com>
15955 * codegen.cs: Lots of code generation pieces. This is only the
15956 beginning, will continue tomorrow with more touches of polish. We
15957 handle the fundamentals of if, while, do, for, return. Others are
15958 trickier and I need to start working on invocations soon.
15960 * gen-treedump.cs: Bug fix, use s.Increment here instead of
15963 * codegen.cs (EmitContext): New struct, used during code
15964 emission to keep a context. Most of the code generation will be
15967 * cs-parser.jay: Add embedded blocks to the list of statements of
15968 this block. So code generation proceeds in a top down fashion.
15970 2001-08-23 Miguel de Icaza <miguel@ximian.com>
15972 * statement.cs: Add support for multiple child blocks.
15974 2001-08-22 Miguel de Icaza <miguel@ximian.com>
15976 * codegen.cs (EmitCode): New function, will emit the code for a
15977 Block of code given a TypeContainer and its ILGenerator.
15979 * statement.cs (Block): Standard public readonly optimization.
15980 (Block::Block constructors): Link children.
15981 (Block::Child): Child Linker.
15982 (Block::EmitVariables): Emits IL variable declarations.
15984 * class.cs: Drop support for MethodGroups here, delay until
15986 (Method::): Applied the same simplification that I did before, and
15987 move from Properties to public readonly fields.
15988 (Method::ParameterTypes): Returns the parameter types for the
15989 function, and implements a cache that will be useful later when I
15990 do error checking and the semantic analysis on the methods is
15992 (Constructor::GetCallingConvention): Renamed from CallingConvetion
15993 and made a method, optional argument tells whether this is a class
15994 or a structure to apply the `has-this' bit.
15995 (Method::GetCallingConvention): Implement, returns the calling
15997 (Method::Define): Defines the type, a second pass is performed
15998 later to populate the methods.
16000 (Constructor::ParameterTypes): implement a cache similar to the
16001 one on Method::ParameterTypes, useful later when we do semantic
16004 (TypeContainer::EmitMethod): New method. Emits methods.
16006 * expression.cs: Removed MethodGroup class from here.
16008 * parameter.cs (Parameters::GetCallingConvention): new method.
16010 2001-08-21 Miguel de Icaza <miguel@ximian.com>
16012 * class.cs (TypeContainer::Populate): Drop RootContext from the
16015 (Constructor::CallingConvention): Returns the calling convention.
16016 (Constructor::ParameterTypes): Returns the constructor parameter
16019 (TypeContainer::AddConstructor): Keep track of default constructor
16020 and the default static constructor.
16022 (Constructor::) Another class that starts using `public readonly'
16023 instead of properties.
16025 (Constructor::IsDefault): Whether this is a default constructor.
16027 (Field::) use readonly public fields instead of properties also.
16029 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
16030 track of static constructors; If none is used, turn on
16031 BeforeFieldInit in the TypeAttributes.
16033 * cs-parser.jay (opt_argument_list): now the return can be null
16034 for the cases where there are no arguments.
16036 (constructor_declarator): If there is no implicit `base' or
16037 `this', then invoke the default parent constructor.
16039 * modifiers.cs (MethodAttr): New static function maps a set of
16040 modifiers flags into a MethodAttributes enum
16041 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
16042 MethodAttr, TypeAttr to represent the various mappings where the
16043 modifiers are used.
16044 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
16046 2001-08-19 Miguel de Icaza <miguel@ximian.com>
16048 * parameter.cs (GetParameterInfo): Fix bug where there would be no
16051 * interface.cs (PopulateIndexer): Implemented the code generator
16052 for interface indexers.
16054 2001-08-17 Miguel de Icaza <miguel@ximian.com>
16056 * interface.cs (InterfaceMemberBase): Now we track the new status
16059 (PopulateProperty): Implement property population. Woohoo! Got
16060 Methods and Properties going today.
16062 Removed all the properties for interfaces, and replaced them with
16063 `public readonly' fields.
16065 2001-08-16 Miguel de Icaza <miguel@ximian.com>
16067 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
16068 initialize their hashtables/arraylists only when they are needed
16069 instead of doing this always.
16071 * parameter.cs: Handle refs and out parameters.
16073 * cs-parser.jay: Use an ArrayList to construct the arguments
16074 instead of the ParameterCollection, and then cast that to a
16077 * parameter.cs: Drop the use of ParameterCollection and use
16078 instead arrays of Parameters.
16080 (GetParameterInfo): Use the Type, not the Name when resolving
16083 2001-08-13 Miguel de Icaza <miguel@ximian.com>
16085 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
16086 and instead use public readonly fields.
16088 * class.cs: Put back walking code for type containers.
16090 2001-08-11 Miguel de Icaza <miguel@ximian.com>
16092 * class.cs (MakeConstant): Code to define constants.
16094 * rootcontext.cs (LookupType): New function. Used to locate types
16097 2001-08-08 Miguel de Icaza <miguel@ximian.com>
16099 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
16100 this System.Reflection code is. Kudos to Microsoft
16102 * typemanager.cs: Implement a type cache and avoid loading all
16103 types at boot time. Wrap in LookupType the internals. This made
16104 the compiler so much faster. Wow. I rule!
16106 * driver.cs: Make sure we always load mscorlib first (for
16107 debugging purposes, nothing really important).
16109 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
16110 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
16112 * rootcontext.cs: Lookup types on their namespace; Lookup types
16113 on namespaces that have been imported using the `using' keyword.
16115 * class.cs (TypeContainer::TypeAttr): Virtualize.
16116 (Class::TypeAttr): Return attributes suitable for this bad boy.
16117 (Struct::TypeAttr): ditto.
16118 Handle nested classes.
16119 (TypeContainer::) Remove all the type visiting code, it is now
16120 replaced with the rootcontext.cs code
16122 * rootcontext.cs (GetClassBases): Added support for structs.
16124 2001-08-06 Miguel de Icaza <miguel@ximian.com>
16126 * interface.cs, statement.cs, class.cs, parameter.cs,
16127 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
16128 Drop use of TypeRefs, and use strings instead.
16130 2001-08-04 Miguel de Icaza <miguel@ximian.com>
16134 * class.cs (Struct::Struct): set the SEALED flags after
16135 checking the modifiers.
16136 (TypeContainer::TypeAttr): new property, returns the
16137 TypeAttributes for a class.
16139 * cs-parser.jay (type_list): Oops, list production was creating a
16140 new list of base types.
16142 * rootcontext.cs (StdLib): New property.
16143 (GetInterfaceTypeByName): returns an interface by type name, and
16144 encapsulates error handling here.
16145 (GetInterfaces): simplified.
16146 (ResolveTree): Encapsulated all the tree resolution here.
16147 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
16150 * driver.cs: Add support for --nostdlib, to avoid loading the
16151 default assemblies.
16152 (Main): Do not put tree resolution here.
16154 * rootcontext.cs: Beginning of the class resolution.
16156 2001-08-03 Miguel de Icaza <miguel@ximian.com>
16158 * rootcontext.cs: Provide better error reporting.
16160 * cs-parser.jay (interface_base): set our $$ to be interfaces.
16162 * rootcontext.cs (CreateInterface): Handle the case where there
16163 are no parent interfaces.
16165 (CloseTypes): Routine to flush types at the end.
16166 (CreateInterface): Track types.
16167 (GetInterfaces): Returns an array of Types from the list of
16168 defined interfaces.
16170 * typemanager.c (AddUserType): Mechanism to track user types (puts
16171 the type on the global type hash, and allows us to close it at the
16174 2001-08-02 Miguel de Icaza <miguel@ximian.com>
16176 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
16177 RecordInterface instead.
16179 * cs-parser.jay: Updated to reflect changes above.
16181 * decl.cs (Definition): Keep track of the TypeBuilder type that
16182 represents this type here. Not sure we will use it in the long
16183 run, but wont hurt for now.
16185 * driver.cs: Smaller changes to accomodate the new code.
16187 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
16190 * rootcontext.cs (CreateInterface): New method, used to create
16191 the System.TypeBuilder type for interfaces.
16192 (ResolveInterfaces): new entry point to resolve the interface
16194 (CodeGen): Property, used to keep track of the code generator.
16196 2001-07-26 Miguel de Icaza <miguel@ximian.com>
16198 * cs-parser.jay: Add a second production for delegate_declaration
16201 (enum_body): Put an opt_comma here instead of putting it on
16202 enum_body or enum_member_declarations so we can handle trailing
16203 commas on enumeration members. Gets rid of a shift/reduce.
16205 (type_list): Need a COMMA in the middle.
16207 (indexer_declaration): Tell tokenizer to recognize get/set
16209 * Remove old targets.
16211 * Re-add the parser target.
16213 2001-07-13 Simon Cozens <simon@simon-cozens.org>
16215 * cs-parser.jay: Add precendence rules for a number of operators
16216 ot reduce the number of shift/reduce conflicts in the grammar.
16218 2001-07-17 Miguel de Icaza <miguel@ximian.com>
16220 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
16223 Get rid of old crufty code.
16225 * rootcontext.cs: Use this to keep track of the parsed
16226 representation and the defined types available to the program.
16228 * gen-treedump.cs: adjust for new convention.
16230 * type.cs: Split out the type manager, and the assembly builder
16233 * typemanager.cs: the type manager will live here now.
16235 * cil-codegen.cs: And the code generator here.
16237 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
16239 * makefile: Fixed up for easy making.
16241 2001-07-13 Simon Cozens <simon@simon-cozens.org>
16243 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
16246 (unary_expression): Expand pre_increment_expression and
16247 post_decrement_expression to reduce a shift/reduce.
16249 2001-07-11 Simon Cozens
16251 * cs-tokenizer.cs: Hex numbers should begin with a 0.
16253 Improve allow_keyword_as_indent name.
16255 2001-06-19 Miguel de Icaza <miguel@ximian.com>
16257 * Adjustments for Beta2.
16259 2001-06-13 Miguel de Icaza <miguel@ximian.com>
16261 * decl.cs: Added `Define' abstract method.
16262 (InTransit): new property, used to catch recursive definitions.
16264 * interface.cs: Implement `Define'.
16266 * modifiers.cs: Map Modifiers.constants to
16267 System.Reflection.TypeAttribute flags.
16269 * class.cs: Keep track of types and user-defined types.
16270 (BuilderInit): New method for creating an assembly
16271 (ResolveType): New function to launch the resolution process, only
16272 used by interfaces for now.
16274 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
16275 that are inserted into the name space.
16277 2001-06-08 Miguel de Icaza <miguel@ximian.com>
16279 * ARGH. I have screwed up my tree so many times due to the use of
16280 rsync rather than using CVS. Going to fix this at once.
16282 * driver.cs: Objetify driver. Load assemblies, use assemblies to
16285 2001-06-07 Miguel de Icaza <miguel@ximian.com>
16287 * Experiment successful: Use System.Type rather that our own
16290 2001-05-25 Miguel de Icaza <miguel@ximian.com>
16292 * cs-parser.jay: Removed nsAliases from here.
16294 Use new namespaces, handle `using XXX;'
16296 * namespace.cs: Reimplemented namespace handling, use a recursive
16297 definition of the class. Now we can keep track of using clauses
16298 and catch invalid using clauses.
16300 2001-05-24 Miguel de Icaza <miguel@ximian.com>
16302 * gen-treedump.cs: Adapted for all the renaming.
16304 * expression.cs (Expression): this class now has a Type property
16305 which returns an expression Type.
16307 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
16308 `Type', as this has a different meaning now in the base
16310 2001-05-22 Miguel de Icaza <miguel@ximian.com>
16312 * interface.cs, class.cs: Removed from all the sources the
16313 references to signature computation, as we can not do method
16314 signature computation during the parsing time, as we are not
16315 trying to solve at that point distinguishing:
16319 void a (NS.Blah x) {}
16322 Which depending on the context might be valid or not, as we do not
16323 know if Blah is the same thing as NS.Blah at that point.
16325 * Redid everything so the code uses TypeRefs now instead of
16326 Types. TypeRefs are just temporary type placeholders, that need
16327 to be resolved. They initially have a pointer to a string and the
16328 current scope in which they are used. This is used later by the
16329 compiler to resolve the reference to an actual Type.
16331 * DeclSpace is no longer a CIR.Type, and neither are
16332 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
16333 are all DeclSpaces, but no Types.
16335 * type.cs (TypeRefManager): This implements the TypeRef manager,
16336 which keeps track of all the types that need to be resolved after
16337 the parsing has finished.
16339 2001-05-13 Miguel de Icaza <miguel@ximian.com>
16341 * ARGH. We are going to have to store `foreach' as a class rather
16342 than resolving it, as we need to verify error 1579 after name
16343 resolution. *OR* we could keep a flag that says `This request to
16344 IEnumerator comes from a foreach statement' which we can then use
16345 to generate the error.
16347 2001-05-10 Miguel de Icaza <miguel@ximian.com>
16349 * class.cs (TypeContainer.AddMethod): we now add methods to the
16350 MethodGroup instead of the method hashtable.
16352 * expression.cs: Add MethodGroup abstraction, which gets us one
16353 step closer to the specification in the way we handle method
16356 * cs-parser.jay (primary_expression): qualified_identifier now
16357 tried to match up an identifier to a local variable reference or
16358 to a parameter reference.
16360 current_local_parameters is now a parser global variable that
16361 points to the current parameters for the block, used during name
16364 (property_declaration): Now creates an implicit `value' argument to
16367 2001-05-09 Miguel de Icaza <miguel@ximian.com>
16369 * parameter.cs: Do not use `param' arguments as part of the
16370 signature, per the spec.
16372 2001-05-08 Miguel de Icaza <miguel@ximian.com>
16374 * decl.cs: Base class for classes, structs and interfaces. This
16375 is the "Declaration Space"
16377 * cs-parser.jay: Use CheckDef for checking declaration errors
16378 instead of having one on each function.
16380 * class.cs: Factor out some code for handling error handling in
16381 accordance to the "Declarations" section in the "Basic Concepts"
16382 chapter in the ECMA C# spec.
16384 * interface.cs: Make all interface member classes derive from
16385 InterfaceMemberBase.
16387 2001-05-07 Miguel de Icaza <miguel@ximian.com>
16389 * Many things: all interfaces are parsed and generated in
16390 gen-treedump. Support for member variables, constructors,
16391 destructors, properties, constants is there.
16393 Beginning of the IL backend, but very little done, just there for
16396 2001-04-29 Miguel de Icaza <miguel@ximian.com>
16398 * cs-parser.jay: Fix labeled statement.
16400 * cs-tokenizer.cs (escape): Escape " and ' always.
16401 ref_line, ref_name: keep track of the line/filename as instructed
16402 by #line by the compiler.
16405 2001-04-27 Miguel de Icaza <miguel@ximian.com>
16407 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
16408 to match the values in System.CodeDOM.
16410 Divid renamed to Divide.
16412 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
16414 (Statements.set): remove.
16416 * System.CodeDOM/CodeCatchClause.cs: always have a valid
16419 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
16420 falseStatements always have valid values.
16422 * cs-parser.jay: Use System.CodeDOM now.