1 2004-06-03 Marek Safar <marek.safar@seznam.cz>
4 (GetConditionalAttributeValue): New method. Returns
5 condition of ConditionalAttribute.
6 (SearchMulti): New method. Returns all attributes of type 't'.
7 Use it when attribute is AllowMultiple = true.
8 (IsConditionalMethodExcluded): New method.
11 (Method.IsExcluded): Implemented. Returns true if method has conditional
12 attribute and the conditions is not defined (method is excluded).
13 (IMethodData): Extended interface for ConditionalAttribute support.
14 (PropertyMethod.IsExcluded): Implemented.
17 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
20 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
23 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
25 * expression.cs (ArrayCreationExpression): Make this just an
26 `expression'. It can't be a statement, so the code here was
29 2004-06-02 Marek Safar <marek.safar@seznam.cz>
32 * typemanager.cs (GetFullNameSignature): New method for
35 2004-06-02 Marek Safar <marek.safar@seznam.cz>
38 * class.cs (MemberBase.GetSignatureForError): New virtual method.
39 Use this method when MethodBuilder is null.
40 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
41 Added test for error CS0626 (MONO reports error for this situation).
42 (IMethodData.GetSignatureForError): Extended interface.
44 2004-06-01 Marek Safar <marek.safar@seznam.cz>
47 (AttributeTester.GetObsoleteAttribute): Returns instance of
48 ObsoleteAttribute when type is obsolete.
51 (TypeContainer.VerifyObsoleteAttribute): Override.
52 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
53 (MethodCode.VerifyObsoleteAttribute): Override.
54 (MemberBase.VerifyObsoleteAttribute): Override.
57 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
58 and report proper error.
61 Delegate.VerifyObsoleteAttribute): Override.
64 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
65 and report proper error.
66 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
69 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
73 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
74 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
75 Added test for ObsoleteAttribute.
78 (Catch): Derived from Statement.
80 2004-06-01 Marek Safar <marek.safar@seznam.cz>
82 Fixed bug #59071 & cs0160.cs
84 * statement.cs (Try.Resolve): Check here whether order of catch
85 clauses matches their dependencies.
87 2004-05-31 Miguel de Icaza <miguel@ximian.com>
89 * Reverted patch to namespace.cs (Use lookuptypedirect). This
90 caused a regression: #59343. Referencing nested classes from an
91 assembly stopped working.
93 2004-05-31 Martin Baulig <martin@ximian.com>
95 MCS is now frozen for beta 2.
97 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
99 * convert.cs: add a trivial cache for overload operator resolution.
101 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
103 * decl.cs: If possible, use lookuptypedirect here. We can only do
104 this if there is no `.' after the namespace. Avoids using
105 LookupType, which does lots of slow processing.
106 (FindNestedType) New method, does what it says :-).
107 * namespace.cs: use LookupTypeDirect.
108 * rootcontext.cs: use membercache, if possible.
109 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
111 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
114 According to the spec,
116 In a member access of the form E.I, if E is a single identifier,
117 and if the meaning of E as a simple-name (§7.5.2) is a constant,
118 field, property, localvariable, or parameter with the same type as
119 the meaning of E as a type-name (§3.8), then both possible
120 meanings of E are permitted.
122 We did not check that E as a simple-name had the same type as E as
125 This trivial check gives us 5-7% on bootstrap time.
127 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
129 * expression.cs (Invocation.OverloadResolve): Avoid the
130 use of hashtables and boxing here by allocating on demand.
132 2004-05-30 Martin Baulig <martin@ximian.com>
134 * rootcontext.cs (RootContext.LookupType): Don't cache things if
135 we're doing a silent lookup. Don't try to lookup nested types in
136 TypeManager.object_type (thanks to Ben Maurer).
138 2004-05-30 Martin Baulig <martin@ximian.com>
140 Committing a patch from Ben Maurer.
142 * rootcontext.cs (RootContext.LookupType): Cache negative results.
144 2004-05-29 Martin Baulig <martin@ximian.com>
146 * class.cs (IMethodData.ShouldIgnore): New method.
148 * typemanager.cs (TypeManager.MethodFlags): Don't take a
149 `Location' argument, we don't need it anywhere. Use
150 `IMethodData.ShouldIgnore ()' instead of
151 `MethodData.GetMethodFlags ()'.
152 (TypeManager.AddMethod): Removed.
153 (TypeManager.AddMethod2): Renamed to AddMethod.
155 2004-05-29 Martin Baulig <martin@ximian.com>
157 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
159 * convert.cs (Convert.ImplicitReferenceConversion): If we're
160 converting from a class type S to an interface type and we already
161 have an object on the stack, don't box it again. Fixes #52578.
163 2004-05-29 Martin Baulig <martin@ximian.com>
165 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
166 Added support for `params' parameters. Fixes #59267.
168 2004-05-29 Martin Baulig <martin@ximian.com>
170 * literal.cs (NullPointer): Provide a private .ctor which sets
171 `type' to TypeManager.object_type. Fixes #59048.
173 2004-05-29 Martin Baulig <martin@ximian.com>
175 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
176 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
178 * ecore.cs (EventExpr.instance_expr): Make the field private.
180 2004-05-26 Marek Safar <marek.safar@seznam.cz>
182 Fixed bug #50080 & cs0214-2.cs
183 * expression.cs (Cast.DoResolve): Check unsafe context here.
185 * statement.cs (Resolve.DoResolve): Likewise.
187 2004-05-26 Martin Baulig <martin@ximian.com>
189 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
191 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
192 (RootContext.LookupType): Pass down the `silent' flag.
194 2004-05-25 Martin Baulig <martin@ximian.com>
197 (MethodGroupExpr.IdenticalTypeName): New public property.
198 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
199 expression actually refers to a type.
201 2004-05-25 Martin Baulig <martin@ximian.com>
203 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
204 for #56176 and made it actually work.
206 2004-05-25 Martin Baulig <martin@ximian.com>
208 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
209 (FieldExpr, PropertyExpr): Override and implement
210 CacheTemporaries. Fixes #52279.
212 2004-05-25 Miguel de Icaza <miguel@ximian.com>
214 * location.cs: In the new compiler listing a file twice is a
215 warning, not an error.
217 2004-05-24 Martin Baulig <martin@ximian.com>
219 * enum.cs (Enum.DefineType): For the `BaseType' to be a
220 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
222 2004-05-24 Martin Baulig <martin@ximian.com>
224 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
225 walking the `using' list. Fixes #53921.
227 2004-05-24 Martin Baulig <martin@ximian.com>
229 * const.cs (Const.LookupConstantValue): Added support for
230 EmptyCast's; fixes #55251.
232 2004-05-24 Martin Baulig <martin@ximian.com>
234 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
235 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
236 which does the CS0135 check. The reason is that we first need to
237 check whether the variable actually exists.
239 2004-05-24 Martin Baulig <martin@ximian.com>
241 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
242 than RootContext.LookupType() to find the explicit interface
245 2004-05-24 Raja R Harinath <rharinath@novell.com>
247 * Makefile: Simplify. Use executable.make.
248 * mcs.exe.sources: New file. List of sources of mcs.exe.
250 2004-05-24 Anders Carlsson <andersca@gnome.org>
254 Use the invariant culture when doing String.Compare for CLS case
257 2004-05-23 Martin Baulig <martin@ximian.com>
259 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
260 don't have any dots. Fixes #52622, added cs0246-8.cs.
262 * namespace.cs (NamespaceEntry.Lookup): Likewise.
264 2004-05-23 Marek Safar <marek.safar@seznam.cz>
266 * class.cs (MemberBase.Define): Reuse MemberType member for
267 resolved type. Other methods can use it too.
269 2004-05-23 Martin Baulig <martin@ximian.com>
271 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
272 the variable also exists in the current block (otherwise, we need
273 to report a CS0103). Fixes #58670.
275 2004-05-23 Martin Baulig <martin@ximian.com>
277 * flowanalysis.cs (Reachability.Reachable): Compute this
278 on-the-fly rather than storing it as a field.
280 2004-05-23 Martin Baulig <martin@ximian.com>
282 * flowanalysis.cs (Reachability.And): Manually compute the
283 resulting `barrier' from the reachability.
285 2004-05-23 Marek Safar <marek.safar@seznam.cz>
288 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
289 instance of ObsoleteAttribute when symbol is obsolete.
292 (IMethodData): Extended interface for ObsoleteAttribute support.
294 2004-05-22 Marek Safar <marek.safar@seznam.cz>
296 * attribute.cs: Fix bug #55970
298 2004-05-22 Marek Safar <marek.safar@seznam.cz>
302 (GetObsoleteAttribute): New method. Creates the instance of
304 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
305 ObsoleteAttribute when member is obsolete.
306 (AttributeTester.Report_ObsoleteMessage): Common method for
307 Obsolete error/warning reporting.
310 (TypeContainer.base_classs_type): New member for storing parent type.
313 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
316 2004-05-21 Marek Safar <marek.safar@seznam.cz>
318 * attribute.cs, const.cs: Fix bug #58590
320 2004-05-21 Martin Baulig <martin@ximian.com>
322 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
323 out parameters if the end of the method is unreachable. Fixes
326 2004-05-21 Marek Safar <marek.safar@seznam.cz>
328 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
329 Hari was right, why extra method.
331 2004-05-21 Marek Safar <marek.safar@seznam.cz>
333 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
335 2004-05-20 Martin Baulig <martin@ximian.com>
337 Merged this back from gmcs to keep the differences to a minumum.
339 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
340 instead of a Declspace.
341 (Attribute.ResolveType): Likewise.
342 (Attributes.Search): Likewise.
343 (Attributes.Contains): Likewise.
344 (Attributes.GetClsCompliantAttribute): Likewise.
346 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
348 (MethodData.ApplyAttributes): Take an EmitContext instead of a
351 2004-04-20 Martin Baulig <martin@ximian.com>
353 Merged latest changes into gmcs. Please keep this comment in
354 here, it makes it easier for me to see what changed in MCS since
355 the last time I merged.
357 2004-05-19 Marek Safar <marek.safar@seznam.cz>
359 Fix bug #58688 (MCS does not report error when the same attribute
362 * attribute.cs (Attribute.Emit): Distinction between null and default.
364 2004-05-19 Raja R Harinath <rharinath@novell.com>
366 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
367 of a top-level attribute without an attribute target.
368 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
370 (Attribute.Conditional_GetConditionName),
371 (Attribute.Obsolete_GetObsoleteMessage): Update.
372 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
373 part of ScanForIndexerName.
374 (Attribute.CanIgnoreInvalidAttribute): New function.
375 (Attribute.ScanForIndexerName): Move to ...
376 (Attributes.ScanForIndexerName): ... here.
377 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
378 (Attributes.Search): New internal variant that can choose not to
379 complain if types aren't resolved. The original signature now
381 (Attributes.GetClsCompliantAttribute): Use internal variant, with
382 complaints suppressed.
383 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
384 only if it not useful.
385 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
386 top-level for attributes that are shared between the assembly
387 and a top-level class.
388 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
389 * class.cs: Update to reflect changes.
390 (DefineIndexers): Fuse loops.
391 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
392 a couple more variants of attribute names.
394 2004-05-18 Marek Safar <marek.safar@seznam.cz>
396 Fix bug #52585 (Implemented explicit attribute declaration)
399 (Attributable.ValidAttributeTargets): New abstract method. It gets
400 list of valid attribute targets for explicit target declaration.
401 (Attribute.Target): It holds target itself.
402 (AttributeSection): Removed.
403 (Attribute.CheckTargets): New method. It checks whether attribute
404 target is valid for the current element.
407 (EventProperty): New class. For events that are declared like
408 property (with add and remove accessors).
409 (EventField): New class. For events that are declared like field.
412 * cs-parser.jay: Implemented explicit attribute target declaration.
414 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
415 Override ValidAttributeTargets.
418 (ReturnParameter): Class for applying custom attributes on
420 (ParameterAtribute): New class. Class for applying custom
421 attributes on the parameter type.
423 2004-05-17 Miguel de Icaza <miguel@ximian.com>
425 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
428 (Method): Allow UNSAFE here.
430 * modifiers.cs: Support unsafe reporting.
432 2004-05-17 Marek Safar <marek.safar@seznam.cz>
434 * decl.cs: Fix bug #58478.
436 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
438 * statement.cs: When checking for unreachable code on an EmptyStatement,
439 set the location. Fixes bug #58488.
441 2004-05-13 Miguel de Icaza <miguel@ximian.com>
443 * driver.cs: Add -pkg handling.
445 From Gonzalo: UseShelLExecute=false
447 2004-05-12 Marek Safar <marek.safar@seznam.cz>
450 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
452 (Attribute.IsClsCompliaceRequired): Moved to base for better
454 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
455 when attribute is AttributeUsageAttribute.
456 (Attribute.GetValidTargets): Simplified.
457 (Attribute.GetAttributeUsage): New method returns AttributeUsage
458 attribute for this type.
459 (Attribute.ApplyAttributes): Method renamed to Emit and make
461 (GlobalAttributeSection): New class for special handling of global
462 attributes (assembly, module).
463 (AttributeSection.Emit): New method.
465 * class.cs: Implemented Attributable abstract methods.
466 (MethodCore.LabelParameters): Moved to Parameter class.
467 (Accessor): Is back simple class.
468 (PropertyMethod): Implemented Attributable abstract class.
469 (DelegateMethod): Implemented Attributable abstract class.
470 (Event): New constructor for disctintion between normal Event
471 and Event with accessors.
473 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
475 * codegen.cs, const.cs, decl.cs, delegate.cs:
476 (CommonAssemblyModulClass): Implemented Attributable abstract class
479 * enum.cs: Implement IAttributeSupport interface.
480 (EnumMember): New class for emum members. Implemented Attributable
484 (ParameterBase): Is abstract.
485 (ReturnParameter): New class for easier [return:] attribute handling.
487 * typemanager.cs: Removed builder_to_attr.
489 2004-05-11 Raja R Harinath <rharinath@novell.com>
492 * attribute.cs (Attribute.GetPositionalValue): New function.
493 * class.cs (TypeContainer.VerifyMembers): New function.
494 (TypeContainer.Emit): Use it.
495 (ClassOrStruct): New base class for Class and Struct.
496 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
497 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
499 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
500 then each non-static field should have a FieldOffset attribute.
501 Otherwise, none of the fields should have a FieldOffset attribute.
502 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
503 and FieldOffset attributes.
504 * typemanager.cs (TypeManager.struct_layout_attribute_type)
505 (TypeManager.field_offset_attribute_type): New core types.
506 (TypeManager.InitCoreTypes): Initialize them.
508 2004-05-11 Michal Moskal <malekith@pld-linux.org>
510 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
514 2004-05-09 Miguel de Icaza <miguel@ximian.com>
516 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
517 be implicitly converted to ulong.
519 * expression.cs: The logic for allowing operator &, | and ^ worked
520 was wrong, it worked before because we did not report an error in
521 an else branch. Fixes 57895.
523 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
524 allow volatile fields to be reference types.
526 2004-05-07 Miguel de Icaza <miguel@ximian.com>
528 * driver.cs: Add support for /debug-
530 2004-05-07 Raja R Harinath <rharinath@novell.com>
532 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
533 Add a 'complain' parameter to silence errors.
534 (Attribute.Resolve): Update to changes. Put in sanity check to catch
535 silently overlooked type-resolutions.
536 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
538 (Attributes.Search): New function.
539 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
540 (Attributes.GetAttributeFullName): Remove hack.
541 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
542 Update to reflect changes.
543 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
544 Use Attributes.Search instead of nested loops.
546 2004-05-07 Marek Safar <marek.safar@seznam.cz>
549 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
550 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
551 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
553 * report.cs: (Report.Warning): Renamed to Warning_T because of
556 2004-05-05 Raja R Harinath <rharinath@novell.com>
558 * expression.cs (MemberAccess.ResolveMemberAccess):
559 Exit with non-zero status after Report.Error.
560 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
562 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
564 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
566 * support.cs: Don't hang when the file is empty.
568 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
570 * support.cs: In SeekableStreamReader, compute the preamble size of the
571 underlying stream. Position changes should take into account that initial
574 2004-05-03 Todd Berman <tberman@sevenl.net>
576 * driver.cs: remove unused GetSysVersion function.
578 2004-05-03 Todd Berman <tberman@sevenl.net>
580 * driver.cs: Remove the hack from saturday, as well as the hack
581 from jackson (LoadAssemblyFromGac), also adds the CWD to the
582 link_paths to get that bit proper.
584 2004-05-01 Todd Berman <tberman@sevenl.net>
586 * driver.cs: Try a LoadFrom before a Load, this checks the current
587 path. This is currently a bug in mono that is be fixed, however, this
588 provides a workaround for now. This will be removed when the bug
591 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
593 * CryptoConvert.cs: Updated to latest version. Fix issue with
594 incomplete key pairs (#57941).
596 2004-05-01 Todd Berman <tberman@sevenl.net>
598 * driver.cs: Remove '.' from path_chars, now System.* loads properly
601 2004-04-30 Jackson Harper <jackson@ximian.com>
603 * codegen.cs: Open keys readonly.
605 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
607 * typemanager.cs: don't report cyclic struct layout when a struct
608 contains 2 or more fields of the same type. Failed for Pango.AttrShape
609 which has 2 Pango.Rectangle fields.
611 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
613 * expression.cs: Handle IntPtr comparisons with IL code
614 rather than a method call.
616 2004-04-29 Martin Baulig <martin@ximian.com>
618 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
619 the list of PropertyInfo's in class hierarchy and find the
620 accessor. Fixes #56013.
622 2004-04-29 Martin Baulig <martin@ximian.com>
624 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
626 2004-04-29 Martin Baulig <martin@ximian.com>
628 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
630 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
632 2004-04-29 Martin Baulig <martin@ximian.com>
634 * class.cs (ConstructorInitializer.Resolve): Check whether the
635 parent .ctor is accessible. Fixes #52146.
637 2004-04-29 Martin Baulig <martin@ximian.com>
639 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
641 * statement.cs (Using.EmitLocalVariableDecls): Use
642 TypeManager.idisposable_type, not typeof (IDisposable).
643 (Foreach.EmitCollectionForeach): Added support for valuetypes.
645 2004-04-29 Martin Baulig <martin@ximian.com>
647 * class.cs (Event.Define): Don't emit the field and don't set
648 RTSpecialName and SpecialName for events on interfaces. Fixes
651 2004-04-29 Raja R Harinath <rharinath@novell.com>
653 Refactor Attribute.ApplyAttributes.
654 * attribute.cs (Attributable): New base class for objects that can
655 have Attributes applied on them.
656 (Attribute): Make AttributeUsage fields public.
657 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
658 (Attribute.IsInternalCall): New property.
659 (Attribute.UsageAttr): Convert to a public read-only property.
660 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
661 (Attribute.ResolveType, Attribute.Resolve)
662 (Attribute.ScanForIndexerName): Update to reflect changes.
663 (Attribute.CheckAttributeTarget): Re-format.
664 (Attribute.ApplyAttributes): Refactor, to various
665 Attributable.ApplyAttributeBuilder methods.
666 * decl.cs (MemberCore): Make Attributable.
667 * class.cs (Accessor): Make Attributable.
668 (MethodData.ApplyAttributes): Use proper attribute types, not
670 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
671 (TypeContainer.ApplyAttributeBuilder)
672 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
673 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
674 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
675 (Operator.ApplyAttributeBuilder): New factored-out methods.
676 * const.cs (Const.ApplyAttributeBuilder): Likewise.
677 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
678 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
679 * parameter.cs (ParameterBase): New Attributable base class
680 that can also represent Return types.
681 (Parameter): Update to the changes.
683 2004-04-29 Jackson Harper <jackson@ximian.com>
685 * driver.cs: Prefer the corlib system version when looking for
686 assemblies in the GAC. This is still a hack, but its a better hack
689 2004-04-29 Marek Safar <marek.safar@seznam.cz>
691 * decl.cs, enum.cs: Improved error 3005 reporting.
693 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
694 (related_symbols): New private member for list of symbols
695 related to reported error/warning.
697 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
699 2004-04-29 Martin Baulig <martin@ximian.com>
701 * ecore.cs (Expression.Constantify): If we're an enum and
702 TypeManager.TypeToCoreType() doesn't give us another type, use
703 t.UnderlyingSystemType. Fixes #56178.
705 2004-04-29 Martin Baulig <martin@ximian.com>
707 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
708 interfaces and for each interface, only add members directly
709 declared in that interface. Fixes #53255.
711 2004-04-28 Martin Baulig <martin@ximian.com>
713 * expression.cs (ConditionalLogicalOperator): Use a temporary
714 variable for `left' to avoid that we evaluate it more than once;
717 2004-04-28 Martin Baulig <martin@ximian.com>
719 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
722 2004-04-28 Martin Baulig <martin@ximian.com>
724 * statement.cs (LocalInfo.Resolve): Check whether the type is not
727 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
728 whether the type is not void (CS1547).
730 2004-04-28 Martin Baulig <martin@ximian.com>
732 * expression.cs (Unary.DoResolveLValue): Override this and report
733 CS0131 for anything but Operator.Indirection.
735 2004-04-28 Martin Baulig <martin@ximian.com>
737 Committing a patch from Ben Maurer; see bug #50820.
739 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
742 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
745 2004-04-28 Martin Baulig <martin@ximian.com>
747 Committing a patch from Ben Maurer; see bug #50820.
749 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
752 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
755 2004-04-28 Martin Baulig <martin@ximian.com>
757 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
758 (Block.AddLabel): Call DoLookupLabel() to only search in the
761 2004-04-28 Martin Baulig <martin@ximian.com>
763 * cfold.cs (ConstantFold.BinaryFold): Added special support for
764 comparing StringConstants and NullLiterals in Equality and Inequality.
766 2004-04-28 Jackson Harper <jackson@ximian.com>
768 * driver.cs: Attempt to load referenced assemblies from the
769 GAC. This is the quick and dirty version of this method that
770 doesnt take into account versions and just takes the first
771 canidate found. Will be good enough for now as we will not have more
772 then one version installed into the GAC until I update this method.
774 2004-04-28 Martin Baulig <martin@ximian.com>
776 * typemanager.cs (TypeManager.CheckStructCycles): New public
777 static method to check for cycles in the struct layout.
779 * rootcontext.cs (RootContext.PopulateTypes): Call
780 TypeManager.CheckStructCycles() for each TypeContainer.
781 [Note: We only need to visit each type once.]
783 2004-04-28 Martin Baulig <martin@ximian.com>
785 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
787 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
788 success and added `out object value'. Use a `bool resolved' field
789 to check whether we've already been called rather than
790 `ConstantValue != null' since this breaks for NullLiterals.
792 2004-04-28 Raja R Harinath <rharinath@novell.com>
794 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
795 setting of this flag, since the 'set' method may be non-public.
797 2004-04-28 Raja R Harinath <rharinath@novell.com>
799 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
800 check on current_vector.Block.
802 2004-04-27 Martin Baulig <martin@ximian.com>
804 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
805 a field initializer. Fixes #56459.
807 2004-04-27 Martin Baulig <martin@ximian.com>
809 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
810 we're not attempting to use an indexer. Fixes #52154.
812 2004-04-27 Martin Baulig <martin@ximian.com>
814 * statement.cs (Return): Don't create a return label if we don't
815 need it; reverts my change from January 20th. Thanks to Ben
818 2004-04-27 Martin Baulig <martin@ximian.com>
820 According to the spec, `goto' can only leave a nested scope, but
823 * statement.cs (Block.LookupLabel): Only lookup in the current
824 block, don't recurse into parent or child blocks.
825 (Block.AddLabel): Check in parent and child blocks, report
826 CS0140/CS0158 if we find a duplicate.
827 (Block): Removed this indexer for label lookups.
828 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
829 this already does the error reporting for us.
832 (FlowBranching.UsageVector.Block): New public variable; may be null.
833 (FlowBranching.CreateSibling): Added `Block' argument.
834 (FlowBranching.LookupLabel): New public virtual method. Lookup a
835 label for the target of a `goto' and check whether we're not
838 2004-04-27 Martin Baulig <martin@ximian.com>
840 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
841 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
844 2004-04-27 Martin Baulig <martin@ximian.com>
846 * statement.cs (Block.AddLabel): Also check for implicit blocks
847 and added a CS0158 check.
849 2004-04-27 Martin Baulig <martin@ximian.com>
851 * flowanalysis.cs (FlowBranchingLoop): New class.
852 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
853 UsageVector's instead of an ArrayList.
854 (FlowBranching.Label): Likewise.
855 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
856 (FlowBranching.AddBreakVector): New method.
858 2004-04-27 Miguel de Icaza <miguel@ximian.com>
860 * attribute.cs: Small regression fix: only convert the type if we
861 the type is different, fixes System.Drawing build.
863 2004-04-27 Martin Baulig <martin@ximian.com>
865 * attribute.cs (Attribute.Resolve): If we have a constant value
866 for a named field or property, implicity convert it to the correct
869 2004-04-27 Raja R Harinath <rharinath@novell.com>
871 * statement.cs (Block.Block): Implicit blocks share
872 'child_variable_names' fields with parent blocks.
873 (Block.AddChildVariableNames): Remove.
874 (Block.AddVariable): Mark variable as "used by a child block" in
875 every surrounding block.
876 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
877 been used in a child block, complain about violation of "Invariant
878 meaning in blocks" rule.
879 * cs-parser.jay (declare_local_variables): Don't use
880 AddChildVariableNames.
881 (foreach_statement): Don't create an implicit block: 'foreach'
884 2004-04-23 Miguel de Icaza <miguel@ximian.com>
886 * convert.cs (ImplicitNumericConversion): 0 is also positive when
887 converting from 0L to ulong. Fixes 57522.
889 2004-04-22 Marek Safar <marek.safar@seznam.cz>
891 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
892 derived class hides via 'new' keyword field from base class (test-242.cs).
893 TODO: Handle this in the more general way.
895 * class.cs (CheckBase): Ditto.
897 2004-04-22 Marek Safar <marek.safar@seznam.cz>
899 * decl.cs (caching_flags): New member for storing cached values
901 (MemberCore.Flags): New enum where bit flags for caching_flags
903 (MemberCore.cls_compliance): Moved to caching_flags.
904 (DeclSpace.Created): Moved to caching_flags.
906 * class.cs: Use caching_flags instead of DeclSpace.Created
908 2004-04-21 Miguel de Icaza <miguel@ximian.com>
910 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
911 if we are only a derived class, not a nested class.
913 * typemanager.cs: Same as above, but do this at the MemberLookup
914 level (used by field and methods, properties are handled in
915 PropertyExpr). Allow for the qualified access if we are a nested
918 2004-04-21 Marek Safar <marek.safar@seznam.cz>
920 * class.cs: Refactoring.
921 (IMethodData): New inteface; Holds links to parent members
922 to avoid member duplication (reduced memory allocation).
923 (Method): Implemented IMethodData interface.
924 (PropertyBase): New inner classes for get/set methods.
925 (PropertyBase.PropertyMethod): Implemented IMethodData interface
926 (Event): New inner classes for add/remove methods.
927 (Event.DelegateMethod): Implemented IMethodData interface.
929 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
930 EmitContext (related to class.cs refactoring).
932 2004-04-21 Raja R Harinath <rharinath@novell.com>
934 * delegate.cs (Delegate.VerifyApplicability): If the number of
935 arguments are the same as the number of parameters, first try to
936 verify applicability ignoring any 'params' modifier on the last
940 2004-04-16 Raja R Harinath <rharinath@novell.com>
942 * class.cs (TypeContainer.AddIndexer): Use
943 'ExplicitInterfaceName' to determine if interface name was
944 explicitly specified. 'InterfaceType' is not initialized at this time.
945 (TypeContainer.DefineIndexers): Remove use of temporary list. The
946 Indexers array is already in the required order. Initialize
947 'IndexerName' only if there are normal indexers.
948 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
949 (TypeContainer.Emit): Emit DefaultMember attribute only if
950 IndexerName is initialized.
953 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
955 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
958 2004-04-15 Raja R Harinath <rharinath@novell.com>
960 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
964 * attribute.cs (Attribute.Resolve): Check for duplicate named
968 2004-04-15 Miguel de Icaza <miguel@ximian.com>
970 * iterators.cs (MarkYield): track whether we are in an exception,
971 and generate code accordingly. Use a temporary value to store the
972 result for our state.
974 I had ignored a bit the interaction of try/catch with iterators
975 since their behavior was not entirely obvious, but now it is
976 possible to verify that our behavior is the same as MS .NET 2.0
980 2004-04-14 Miguel de Icaza <miguel@ximian.com>
982 * iterators.cs: Avoid creating temporaries if there is no work to
985 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
986 Enumerations, use TypeManager.EnumToUnderlying and call
989 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
992 (This.Emit): Use EmitContext.EmitThis to emit our
995 (This.EmitAssign): Ditto.
997 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
998 codepaths, we will move all the functionality into
1001 (FieldExpr.EmitAssign): Ditto.
1003 This fixes several hidden bugs that I uncovered while doing a code
1004 review of this today.
1006 * codegen.cs (EmitThis): reworked so the semantics are more clear
1007 and also support value types "this" instances.
1009 * iterators.cs: Changed so that for iterators in value types, we
1010 do not pass the value type as a parameter.
1012 Initialization of the enumerator helpers is now done in the caller
1013 instead of passing the parameters to the constructors and having
1014 the constructor set the fields.
1016 The fields have now `assembly' visibility instead of private.
1018 2004-04-11 Miguel de Icaza <miguel@ximian.com>
1020 * expression.cs (Argument.Resolve): Check if fields passed as ref
1021 or out are contained in a MarshalByRefObject.
1023 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
1024 another compiler type.
1026 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
1028 * class.cs (Indexer.Define): use the new name checking method.
1029 Also, return false on an error.
1030 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
1031 (is_identifier_[start/part]_character): make static.
1033 2004-04-10 Miguel de Icaza <miguel@ximian.com>
1035 * expression.cs (Binary.ResolveOperator): Do no append strings
1036 twice: since we can be invoked more than once (array evaluation)
1037 on the same concatenation, take care of this here. Based on a fix
1038 from Ben (bug #56454)
1040 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
1042 * codegen.cs: Fix another case where CS1548 must be reported (when
1043 delay-sign isn't specified and no private is available #56564). Fix
1044 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
1045 error when MCS is used on the MS runtime and we need to delay-sign
1046 (which seems unsupported by AssemblyBuilder - see #56621).
1048 2004-04-08 Marek Safar <marek.safar@seznam.cz>
1050 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
1051 (TypeManager.ComputeNamespaces): Faster implementation for
1054 * compiler.csproj: Updated AssemblyName to mcs.
1056 2004-04-07 Miguel de Icaza <miguel@ximian.com>
1058 * rootcontext.cs: Add new types to the boot resolution.
1060 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
1061 MulticastDelegate is not allowed.
1063 * typemanager.cs: Add new types to lookup: System.TypedReference
1066 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
1067 check for TypedReference or ArgIterator, they are not allowed.
1069 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
1070 makes us properly catch 1510 in some conditions (see bug 56016 for
1073 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
1075 * CryptoConvert.cs: update from corlib version
1078 2004-04-05 Miguel de Icaza <miguel@ximian.com>
1080 * class.cs (Indexer.Define): Check indexername declaration
1082 2004-04-05 Marek Safar <marek.safar@seznam.cz>
1084 * attribute.cs (IsClsCompliant): Fixed problem with handling
1085 all three states (compliant, not-compliant, undetected).
1087 2004-03-30 Marek Safar <marek.safar@seznam.cz>
1089 * attribute.cs (Attribute): Location is now public.
1090 (Resolve): Store resolved arguments (pos_values) in attribute class.
1091 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
1092 (GetClsCompliantAttributeValue): New method that gets
1093 CLSCompliantAttribute value.
1094 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
1095 if exists else null.
1096 (AttributeTester): New class for CLS-Compliant verification routines.
1098 * class.cs (Emit): Add CLS-Compliant verification.
1099 (Method.GetSignatureForError): Implemented.
1100 (Constructor.GetSignatureForError): Implemented
1101 (Constructor.HasCompliantArgs): Returns if constructor has
1102 CLS-Compliant arguments.
1103 (Constructor.Emit): Override.
1104 (Construcor.IsIdentifierClsCompliant): New method; For constructors
1105 is needed to test only parameters.
1106 (FieldBase.GetSignatureForError): Implemented.
1107 (TypeContainer): New member for storing base interfaces.
1108 (TypeContainer.FindMembers): Search in base interfaces too.
1110 * codegen.cs (GetClsComplianceAttribute): New method that gets
1111 assembly or module CLSCompliantAttribute value.
1112 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
1114 (ModuleClass.Emit): Add error 3012 test.
1116 * const.cs (Emit): Override and call base for CLS-Compliant tests.
1118 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
1119 state for all decl types.
1120 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
1121 if CLS-Compliant tests are required.
1122 (IsClsCompliaceRequired): New method. Analyze whether code
1123 must be CLS-Compliant.
1124 (IsExposedFromAssembly): New method. Returns true when MemberCore
1125 is exposed from assembly.
1126 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
1127 value or gets cached value.
1128 (HasClsCompliantAttribute): New method. Returns true if MemberCore
1129 is explicitly marked with CLSCompliantAttribute.
1130 (IsIdentifierClsCompliant): New abstract method. This method is
1131 used to testing error 3005.
1132 (IsIdentifierAndParamClsCompliant): New method. Common helper method
1133 for identifier and parameters CLS-Compliant testing.
1134 (VerifyClsCompliance): New method. The main virtual method for
1135 CLS-Compliant verifications.
1136 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
1137 null. I don't know why is null (too many public members !).
1138 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
1139 and get value of first CLSCompliantAttribute that found.
1141 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
1142 (VerifyClsCompliance): Override and add extra tests.
1144 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
1145 clscheck- disable CLS-Compliant verification event if assembly is has
1146 CLSCompliantAttribute(true).
1148 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
1149 ApllyAttribute is now called in emit section as in the other cases.
1150 Possible future Emit integration.
1151 (IsIdentifierClsCompliant): New override.
1152 (VerifyClsCompliance): New override.
1153 (GetEnumeratorName): Returns full enum name.
1155 * parameter.cs (GetSignatureForError): Implemented.
1157 * report.cs (WarningData): New struct for Warning message information.
1158 (LocationOfPreviousError): New method.
1159 (Warning): New method. Reports warning based on the warning table.
1160 (Error_T): New method. Reports error based on the error table.
1162 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
1163 verifications are done here.
1165 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
1167 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
1168 CLSCompliantAttribute.
1169 (all_imported_types): New member holds all imported types from other
1171 (LoadAllImportedTypes): New method fills static table with exported types
1172 from all referenced assemblies.
1173 (Modules): New property returns all assembly modules.
1175 2004-03-30 Miguel de Icaza <miguel@ximian.com>
1177 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
1178 throwing a parser error.
1180 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
1181 which removes the hardcoded get_/set_ prefixes for properties, as
1182 IL allows for the properties to be named something else.
1186 * expression.cs: Do not override operand before we know if it is
1189 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1191 * typemanager.cs: support for pinned variables.
1193 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1195 * decl.cs, typemanager.cs: Avoid using an arraylist
1196 as a buffer if there is only one result set.
1198 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1200 * expression.cs: Make sure you cant call a static method
1201 with an instance expression, bug #56174.
1203 2004-03-29 Miguel de Icaza <miguel@ximian.com>
1205 * class.cs (IsDuplicateImplementation): Improve error reporting to
1206 flag 663 (method only differs in parameter modifier).
1208 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
1209 in preprocessor directives.
1211 * location.cs (LookupFile): Allow for the empty path.
1213 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
1214 better approach for some of that patch, but its failing with the
1215 CharSet enumeration. For now try/catch will do.
1217 * typemanager.cs: Do not crash if a struct does not have fields.
1220 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1222 * expression.cs: cs0213, cant fix a fixed expression.
1225 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1227 * cs-parser.jay: detect invalid embeded statements gracefully.
1230 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1232 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
1235 the invocation type may not be a subclass of the tye of the item/
1236 The type of the item must be a subclass of the invocation item.
1241 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
1243 * attribute.cs: Added methods to get a string and a bool from an
1244 attribute. Required to information from AssemblyKeyFileAttribute,
1245 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
1246 * codegen.cs: Modified AssemblyName creation to include support for
1247 strongnames. Catch additional exceptions to report them as CS1548.
1248 * compiler.csproj: Updated include CryptoConvert.cs.
1249 * compiler.csproj.user: Removed file - user specific configuration.
1250 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
1251 Mono.Security assembly. The original class is maintained and tested in
1252 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
1253 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
1254 like CSC 8.0 (C# v2) supports.
1255 * Makefile: Added CryptoConvert.cs to mcs sources.
1256 * rootcontext.cs: Added new options for strongnames.
1258 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
1260 * driver.cs: For --expect-error, report error code `2'
1261 if the program compiled with no errors, error code `1' if
1262 it compiled with an error other than the one expected.
1264 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
1266 * compiler.csproj: Updated for Visual Studio .NET 2003.
1267 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
1268 * compiler.sln: Updated for Visual Studio .NET 2003.
1270 2004-03-24 Ravi Pratap M <ravi@ximian.com>
1272 * expression.cs: Fix bug #47234. We basically need to apply the
1273 rule that we prefer the conversion of null to a reference type
1274 when faced with a conversion to 'object' (csc behaviour).
1276 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1278 * statement.cs: Shorter form for foreach, eliminates
1279 a local variable. r=Martin.
1281 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1283 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
1284 checks if we can use brtrue/brfalse to test for 0.
1285 * expression.cs: use the above in the test for using brtrue/brfalse.
1288 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1290 * expression.cs: Rewrite string concat stuff. Benefits:
1292 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
1293 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
1294 rather than a concat chain.
1296 * typemanager.cs: Add lookups for more concat overloads.
1298 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1300 * expression.cs: Emit shorter il code for array init.
1317 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
1319 * statement.cs: Before, two switch blocks would be merged if the
1320 total size of the blocks (end_item - begin_item + 1) was less than
1321 two times the combined sizes of the blocks.
1323 Now, it will only merge if after the merge at least half of the
1328 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
1330 * class.cs : csc build fix for GetMethods(). See bug #52503.
1332 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
1334 * expression.cs: Make sure fp comparisons work with NaN.
1335 This fixes bug #54303. Mig approved this patch a long
1336 time ago, but we were not able to test b/c the runtime
1339 2004-03-19 Miguel de Icaza <miguel@ximian.com>
1341 * ecore.cs (TypExpr.GetHashCode): implement this overload.
1343 2004-03-19 Martin Baulig <martin@ximian.com>
1345 * class.cs (MemberCore.IsDuplicateImplementation): Report the
1346 error here and not in our caller.
1348 2004-03-19 Martin Baulig <martin@ximian.com>
1350 * interface.cs: Completely killed this file.
1351 (Interface): We're now a TypeContainer and live in class.cs.
1353 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
1354 argument; we're now also called for interfaces.
1355 (TypeContainer.DefineMembers): Allow this method being called
1357 (TypeContainer.GetMethods): New public method; formerly known as
1358 Interface.GetMethod(). This is used by PendingImplementation.
1359 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
1360 it's now private and non-static.
1361 (Interface): Moved this here; it's now implemented similar to
1363 (Method, Property, Event, Indexer): Added `bool is_interface'
1364 argument to their .ctor's.
1365 (MemberBase.IsInterface): New public field.
1367 * cs-parser.jay: Create normal Method, Property, Event, Indexer
1368 instances instead of InterfaceMethod, InterfaceProperty, etc.
1369 (opt_interface_base): Removed; we now use `opt_class_base' instead.
1370 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
1372 2004-03-19 Martin Baulig <martin@ximian.com>
1374 * class.cs (MethodCore.IsDuplicateImplementation): New private
1375 method which does the CS0111 checking.
1376 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
1377 Use IsDuplicateImplementation().
1379 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
1381 * decl.cs (FindMemberToOverride): New method to find the correct
1382 method or property to override in the base class.
1384 - Make Method/Property use the above method to find the
1385 version in the base class.
1386 - Remove the InheritableMemberSignatureCompare as it is now
1389 This patch makes large code bases much faster to compile, as it is
1390 O(n) rather than O(n^2) to do this validation.
1392 Also, it fixes bug 52458 which is that nested classes are not
1393 taken into account when finding the base class member.
1395 Reviewed/Approved by Martin.
1397 2004-03-17 Marek Safar <marek.safar@seznam.cz>
1399 * interface.cs: In all interface classes removed redundant
1400 member initialization.
1402 2004-03-16 Martin Baulig <martin@ximian.com>
1404 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1406 2004-03-15 Miguel de Icaza <miguel@ximian.com>
1408 * decl.cs (DefineTypeAndParents): New helper method to define a
1409 type's containers before the type itself is defined; This is a
1410 bug exposed by the recent changes to Windows.Forms when an
1411 implemented interface was defined inside a class that had not been
1414 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
1416 (Check): Loop correctly to report errors modifiers
1417 (UNSAFE was not in the loop, since it was the same as TOP).
1419 * interface.cs: Every interface member now takes a ModFlags,
1420 instead of a "is_new" bool, which we set on the base MemberCore.
1422 Every place where we called "UnsafeOk" in the interface, now we
1423 call the proper member (InterfaceMethod.UnsafeOK) instead to get
1424 the unsafe settings from the member declaration instead of the
1425 container interface.
1427 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
1429 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1430 `set_indexer_name' to the pending bits (one per type).
1432 We fixed a bug today that was picking the wrong method to
1433 override, since for properties the existing InterfaceMethod code
1434 basically ignored the method name. Now we make sure that the
1435 method name is one of the valid indexer names.
1437 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
1439 * support.cs (SeekableStreamReader): Keep track of stream byte
1440 positions and don't mix them with character offsets to the buffer.
1442 Patch from Gustavo Giráldez
1444 2004-03-15 Marek Safar <marek.safar@seznam.cz>
1446 * interface.cs (InterfaceSetGetBase): Removed double member
1447 initialization, base class does it as well.
1449 2004-03-13 Martin Baulig <martin@ximian.com>
1451 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
1452 when compiling corlib.
1454 2004-03-13 Miguel de Icaza <miguel@ximian.com>
1456 * convert.cs (ExplicitConversion): We were reporting an error on
1457 certain conversions (object_type source to a value type, when the
1458 expression was `null') before we had a chance to pass it through
1459 the user defined conversions.
1461 * driver.cs: Replace / and \ in resource specifications to dots.
1464 * class.cs: Add check for duplicate operators. Fixes 52477
1466 2004-03-11 Miguel de Icaza <miguel@ximian.com>
1468 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
1469 that are in the middle of the statements, not only at the end.
1472 * class.cs (TypeContainer.AddField): No longer set the
1473 `HaveStaticConstructor' flag, now we call it
1474 `UserDefineStaticConstructor' to diferentiate the slightly
1475 semantic difference.
1477 The situation is that we were not adding BeforeFieldInit (from
1478 Modifiers.TypeAttr) to classes that could have it.
1479 BeforeFieldInit should be set to classes that have no static
1484 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
1486 And most importantly Zoltan's comment:
1488 http://bugzilla.ximian.com/show_bug.cgi?id=44229
1490 "I think beforefieldinit means 'it's ok to initialize the type sometime
1491 before its static fields are used', i.e. initialization does not need
1492 to be triggered by the first access to the type. Setting this flag
1493 helps the JIT to compile better code, since it can run the static
1494 constructor at JIT time, and does not need to generate code to call it
1495 (possibly lots of times) at runtime. Unfortunately, mcs does not set
1496 this flag for lots of classes like String.
1498 csc sets this flag if the type does not have an explicit static
1499 constructor. The reasoning seems to be that if there are only static
1500 initalizers for a type, and no static constructor, then the programmer
1501 does not care when this initialization happens, so beforefieldinit
1504 This bug prevents the AOT compiler from being usable, since it
1505 generates so many calls to mono_runtime_class_init that the AOT code
1506 is much slower than the JITted code. The JITted code is faster,
1507 because it does not generate these calls if the vtable is type is
1508 already initialized, which is true in the majority of cases. But the
1509 AOT compiler can't do this."
1511 2004-03-10 Miguel de Icaza <miguel@ximian.com>
1513 * class.cs (MethodData.Emit): Refactor the code so symbolic
1514 information is generated for destructors; For some reasons we
1515 were taking a code path that did not generate symbolic information
1518 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
1520 * class.cs: Create a Constructor.CheckBase method that
1521 takes care of all validation type code. The method
1522 contains some code that was moved from Define.
1524 It also includes new code that checks for duplicate ctors.
1525 This fixes bug #55148.
1527 2004-03-09 Joshua Tauberer <tauberer@for.net>
1529 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
1530 a { ... }-style array creation invokes EmitStaticInitializers
1531 which is not good for reference-type arrays. String, decimal
1532 and now null constants (NullCast) are not counted toward
1533 static initializers.
1535 2004-03-05 Martin Baulig <martin@ximian.com>
1537 * location.cs (SourceFile.HasLineDirective): New public field;
1538 specifies whether the file contains or is referenced by a "#line"
1540 (Location.DefineSymbolDocuments): Ignore source files which
1541 either contain or are referenced by a "#line" directive.
1543 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
1545 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
1546 direct access to our parent, so check the method inline there.
1548 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
1550 * expression.cs (Invocation.EmitCall): Miguel's last commit
1551 caused a regression. If you had:
1556 In Foo the implict this would be null.
1558 2004-02-27 Miguel de Icaza <miguel@ximian.com>
1560 * expression.cs (Invocation.EmitCall): If the method is not
1561 virtual, do not emit a CallVirt to it, use Call.
1563 * typemanager.cs (GetFullNameSignature): Improve the method to
1564 cope with ".ctor" and replace it with the type name.
1566 * class.cs (ConstructorInitializer.Resolve): Now the method takes
1567 as an argument the ConstructorBuilder where it is being defined,
1568 to catch the recursive constructor invocations.
1570 2004-02-26 Miguel de Icaza <miguel@ximian.com>
1572 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
1573 routines to check if a type is an enumerable/enumerator allow
1574 classes that implement the IEnumerable or IEnumerator interfaces.
1576 * class.cs (Property, Operator): Implement IIteratorContainer, and
1577 implement SetYields.
1579 (Property.Define): Do the block swapping for get_methods in the
1580 context of iterators. We need to check if Properties also
1581 include indexers or not.
1583 (Operator): Assign the Block before invoking the
1584 OperatorMethod.Define, so we can trigger the Iterator code
1587 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
1588 Property and Operator classes are not created when we parse the
1589 declarator but until we have the block completed, so we use a
1590 singleton SimpleIteratorContainer.Simple to flag whether the
1591 SetYields has been invoked.
1593 We propagate this setting then to the Property or the Operator to
1594 allow the `yield' to function.
1596 2004-02-25 Marek Safar <marek.safar@seznam.cz>
1598 * codegen.cs: Implemented attribute support for modules.
1599 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
1600 Assembly/Module functionality.
1602 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
1603 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
1604 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
1606 2004-02-16 Marek Safar <marek.safar@seznam.cz>
1608 * interface.cs (FindMembers): The operation is performed on all base
1609 interfaces and not only on the first. It is required for future CLS Compliance patch.
1611 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
1613 * statement.cs, codegen.cs:
1614 This patch deals with patterns such as:
1616 public class List : IEnumerable {
1618 public MyEnumerator GetEnumerator () {
1619 return new MyEnumerator(this);
1622 IEnumerator IEnumerable.GetEnumerator () {
1626 public struct MyEnumerator : IEnumerator {
1631 Before, there were a few things we did wrong:
1632 1) we would emit callvirt on a struct, which is illegal
1633 2) we emited ldarg when we needed to emit ldarga
1634 3) we would mistakenly call the interface methods on an enumerator
1635 type that derived from IEnumerator and was in another assembly. For example:
1637 public class MyEnumerator : IEnumerator
1639 Would have the interface methods called, even if there were public impls of the
1640 method. In a struct, this lead to invalid IL code.
1642 2004-02-11 Marek Safar <marek.safar@seznam.cz>
1644 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
1647 * delegate.cs (Define): Fixed crash when delegate type is undefined.
1649 2004-02-11 Miguel de Icaza <miguel@ximian.com>
1651 * cs-parser.jay: Fix small regression: we were not testing V2
1652 compiler features correctly.
1654 * interface.cs: If the emit context is null, then create one
1656 2004-02-09 Marek Safar <marek.safar@seznam.cz>
1658 * decl.cs (GetSignatureForError): New virtual method to get full name
1661 * attribute.cs (IAttributeSupport): New interface for attribute setting.
1662 Now it is possible to rewrite ApplyAttributes method to be less if/else.
1664 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
1665 Duplicated members and code in these classes has been removed.
1666 Better encapsulation in these classes.
1668 2004-02-07 Miguel de Icaza <miguel@ximian.com>
1670 * assign.cs (Assign.DoResolve): When dealing with compound
1671 assignments, there is a new rule in ECMA C# 2.4 (might have been
1672 there before, but it is documented here) that states that in:
1676 If b is of type int, and the `op' is a shift-operator, then the
1677 above is evaluated as:
1681 * expression.cs (Binary.ResolveOperator): Instead of testing for
1682 int/uint/long/ulong, try to implicitly convert to any of those
1683 types and use that in pointer arithmetic.
1685 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
1686 method to print information for from the type, not from the
1687 null-method we were given.
1689 2004-02-01 Duncan Mak <duncan@ximian.com>
1691 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
1692 parsing for cmd, fixes bug #53694.
1694 2004-02-04 Marek Safar <marek.safar@seznam.cz>
1696 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
1697 in the member name duplication tests. Property and operator name duplication
1698 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
1700 2004-02-03 Marek Safar <marek.safar@seznam.cz>
1702 * interface.cs (PopulateMethod): Fixed crash when interface method
1703 returns not existing type (error test cs0246-3.cs).
1705 2004-02-02 Ravi Pratap M <ravi@ximian.com>
1707 * cs-parser.jay (interface_accessors): Re-write actions to also
1708 store attributes attached to get and set methods. Fix spelling
1711 (inteface_property_declaration): Modify accordingly.
1713 (InterfaceAccessorInfo): New helper class to store information to pass
1714 around between rules that use interface_accessors.
1716 * interface.cs (Emit): Apply attributes on the get and set
1717 accessors of properties and indexers too.
1719 * attribute.cs (ApplyAttributes): Modify accordingly to use the
1720 right MethodBuilder when applying attributes to the get and set accessors.
1722 2004-01-31 Miguel de Icaza <miguel@ximian.com>
1724 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
1726 2004-01-26 Miguel de Icaza <miguel@ximian.com>
1728 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
1730 2004-01-25 Miguel de Icaza <miguel@ximian.com>
1732 * cs-parser.jay: Remove YIELD token, instead use the new grammar
1733 changes that treat `yield' specially when present before `break'
1736 * cs-tokenizer.cs: yield is no longer a keyword.
1738 2004-01-23 Marek Safar <marek.safar@seznam.cz>
1740 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
1741 setting for default constructors.
1742 For default constructors are almost every time set wrong Modifier. The
1743 generated IL code has been alright. But inside mcs this values was
1744 wrong and this was reason why several of my CLS Compliance tests
1747 2004-01-22 Martin Baulig <martin@ximian.com>
1749 * cs-parser.jay (namespace_or_type_name): Return an Expression,
1750 not a QualifiedIdentifier. This is what `type_name_expression'
1751 was previously doing.
1752 (type_name_expression): Removed; the code is now in
1753 `namespace_or_type_name'.
1754 (qualified_identifier): Removed, use `namespace_or_type_name'
1756 (QualifiedIdentifier): Removed this class.
1758 2004-01-22 Martin Baulig <martin@ximian.com>
1760 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
1761 not a string as alias name.
1763 2004-01-21 Miguel de Icaza <miguel@ximian.com>
1765 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
1766 #52730 bug, and instead compute correctly the need to use a
1767 temporary variable when requesting an address based on the
1768 static/instace modified of the field and the constructor.
1770 2004-01-21 Martin Baulig <martin@ximian.com>
1772 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
1773 class and namespace before looking up aliases. Fixes #52517.
1775 2004-01-21 Martin Baulig <martin@ximian.com>
1777 * flowanalysis.cs (UsageVector.Merge): Allow variables being
1778 assinged in a 'try'; fixes exception4.cs.
1780 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1781 * class.cs : Implemented parameter-less constructor for TypeContainer
1783 * decl.cs: Attributes are now stored here. New property OptAttributes
1785 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
1787 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
1789 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1791 * typemanager.cs (CSharpSignature): Now reports also inner class name.
1792 (CSharpSignature): New method for indexer and property signature.
1794 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1796 * pending.cs (IsVirtualFilter): Faster implementation.
1798 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1800 * typemanager.cs: Avoid inclusion of same assembly more than once.
1802 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1804 * cs-parser.jay: Fixed problem where the last assembly attribute
1805 has been applied also to following declaration (class, struct, etc.)
1807 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1809 * class.cs: Added error CS0538, CS0539 reporting.
1810 Fixed crash on Microsoft runtime when field type is void.
1812 * cs-parser.jay: Added error CS0537 reporting.
1814 * pending.cs: Added error CS0535 reporting.
1815 Improved error report for errors CS0536, CS0534.
1817 2004-01-20 Miguel de Icaza <miguel@ximian.com>
1819 Merge a few bits from the Anonymous Method MCS tree.
1821 * statement.cs (ToplevelBlock): New class for toplevel methods,
1822 will hold anonymous methods, lifted variables.
1824 * cs-parser.jay: Create toplevel blocks for delegates and for
1825 regular blocks of code.
1827 2004-01-20 Martin Baulig <martin@ximian.com>
1829 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
1830 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
1831 and `NeedExplicitReturn'; added `IsLastStatement'.
1832 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
1833 have a `ReturnLabel' or we're not unreachable.
1835 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
1836 child's reachability; don't just override ours with it. Fixes
1837 #58058 (lluis's example).
1838 (FlowBranching): Added public InTryOrCatch(), InCatch(),
1839 InFinally(), InLoop(), InSwitch() and
1840 BreakCrossesTryCatchBoundary() methods.
1842 * statement.cs (Return): Do all error checking in Resolve().
1843 Unless we are the last statement in a top-level block, always
1844 create a return label and jump to it.
1845 (Break, Continue): Do all error checking in Resolve(); also make
1846 sure we aren't leaving a `finally'.
1847 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
1848 statement in a top-level block.
1849 (Block.Flags): Added `IsDestructor'.
1850 (Block.IsDestructor): New public property.
1852 2004-01-20 Martin Baulig <martin@ximian.com>
1854 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
1856 2004-01-20 Martin Baulig <martin@ximian.com>
1858 * statement.cs (Statement.ResolveUnreachable): New public method.
1859 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
1860 (Block.Resolve): Resolve unreachable statements.
1862 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
1864 * expression.cs: We need to fix the case where we do
1865 not have a temp variable here.
1867 * assign.cs: Only expression compound assignments need
1868 temporary variables.
1870 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
1872 * flowanalysis.cs: Reduce memory allocation in a few ways:
1873 - A block with no variables should not allocate a bit
1875 - A method with no out parameters does not need any tracking
1876 for assignment of the parameters, so we need not allocate
1879 public readonly Type[] VariableTypes;
1880 public readonly string[] VariableNames;
1881 Are redundant. The data is already stored in the variable
1882 map, so we need not allocate another array for it.
1883 - We need to add alot of checks for if (params | locals) == null
1884 due to the first two changes.
1886 2004-01-18 Miguel de Icaza <miguel@ximian.com>
1888 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
1889 implement IMemoryLocation, we store a copy on a local variable and
1890 take the address of it. Patch from Benjamin Jemlich
1892 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
1893 to use a special "type_name_expression" rule which reduces the
1894 number of "QualifiedIdentifier" classes created, and instead
1895 directly creates MemberAccess expressions.
1897 2004-01-17 Miguel de Icaza <miguel@ximian.com>
1899 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
1900 that fixes #52853. Null literal assignment to ValueType
1902 * class.cs (MethodData.Emit): Instead of checking the name of the
1903 method to determine if its a destructor, create a new derived
1904 class from Method called Destructor, and test for that.
1906 * cs-parser.jay: Create a Destructor object instead of a Method.
1908 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
1912 2004-01-16 Miguel de Icaza <miguel@ximian.com>
1914 * expression.cs (Binary.ResolveOperator): Perform an implicit
1915 conversion from MethodGroups to their delegate types on the
1918 * delegate.cs: Introduce a new class DelegateCreation that is the
1919 base class for `NewDelegate' and `ImplicitDelegateCreation',
1920 factor some code in here.
1922 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
1923 conversion from MethodGroups to compatible delegate types.
1925 * ecore.cs (Expression.Resolve): Do not flag error 654
1926 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
1927 we allow conversions from MethodGroups to delegate types now.
1929 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
1930 assignments in v2 either.
1932 2004-01-10 Miguel de Icaza <miguel@ximian.com>
1934 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
1935 static read-only fields in ctors.
1937 Applied patch from Benjamin Jemlich
1939 * expression.cs (UnaryMutator): Avoid leaking local variables.
1941 2004-01-09 Miguel de Icaza <miguel@ximian.com>
1943 * cs-tokenizer.cs (IsCastToken): Allow the various native types
1944 here to return true, as they can be used like this:
1948 Fixed 49836 and all the other dups
1950 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
1952 * driver.cs: Implement /win32res and /win32icon.
1954 2004-01-08 Miguel de Icaza <miguel@ximian.com>
1956 * cs-parser.jay: Add a rule to improve error handling for the
1957 common mistake of placing modifiers after the type.
1959 2004-01-07 Miguel de Icaza <miguel@ximian.com>
1961 * cs-parser.jay (interface_event_declaration): Catch
1962 initialization of events on interfaces, and report cs0068
1964 * cs-parser.jay (interface_event_declaration): Catch
1965 initialization of events.
1967 * ecore.cs: Better report missing constructors.
1969 * expression.cs (Binary.ResolveOperator): My previous bug fix had
1970 the error reporting done in the wrong place. Fix.
1972 * expression.cs (Binary.ResolveOperator): Catch the
1973 operator + (E x, E y) error earlier, and later allow for implicit
1974 conversions in operator +/- (E e, U x) from U to the underlying
1977 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
1978 52596, if the container class is abstract, the default constructor
1979 is protected otherwise its public (before, we were always public).
1981 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
1984 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
1985 Jemlich that fixes bug #52597, MCS was generating invalid code for
1986 idisposable structs. Thanks to Ben for following up with this
1989 2004-01-06 Miguel de Icaza <miguel@ximian.com>
1991 * driver.cs: Allow assemblies without code to be generated, fixes
1994 2004-01-07 Nick Drochak <ndrochak@gol.com>
1996 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
1998 2004-01-05 Miguel de Icaza <miguel@ximian.com>
2000 * cs-parser.jay: Add rules to improve error reporting if fields or
2001 methods are declared at the namespace level (error 116)
2003 * Add rules to catch event add/remove
2005 2004-01-04 David Sheldon <dave-mono@earth.li>
2007 * expression.cs: Added matching ")" to error message for
2010 2004-01-03 Todd Berman <tberman@gentoo.org>
2012 * ecore.cs, attribute.cs:
2013 Applying fix from #52429.
2015 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2017 * ecore.cs, expression.cs, statement.cs:
2018 Total rewrite of how we handle branching. We
2019 now handle complex boolean expressions with fewer
2020 jumps. As well if (x == 0) no longer emits a ceq.
2022 if (x is Foo) is much faster now, because we generate
2025 Overall, we get a pretty big improvement on our benchmark
2026 tests. The code we generate is smaller and more readable.
2028 I did a full two-stage bootstrap. The patch was reviewed
2029 by Martin and Miguel.
2031 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2033 * cs-parser.jay: Make primary_expression not take a QI.
2034 we dont need this because the member_access rule covers
2035 us here. So we replace the rule with just IDENTIFIER.
2037 This has two good effects. First, we remove a s/r conflict.
2038 Second, we allocate many fewer QualifiedIdentifier objects.
2040 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2042 * attribute.cs: Handle MarshalAs attributes as pseudo, and
2043 set the correct information via SRE. This prevents
2044 hanging on the MS runtime. Fixes #29374.
2046 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2048 * convert.cs: correctly handle conversions to value types
2049 from Enum and ValueType as unboxing conversions.
2051 Fixes bug #52569. Patch by Benjamin Jemlich.
2053 2004-01-02 Ravi Pratap <ravi@ximian.com>
2055 * expression.cs (BetterConversion): Prefer int -> uint
2056 over int -> ulong (csc's behaviour). This fixed bug #52046.
2058 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
2060 * decl.cs (MemberCache.FindMembers): now returns a
2063 * typemanager.cs: In general, go with with ^^.
2064 (CopyNewMethods): take an IList.
2065 (RealMemberLookup): Only allocate an arraylist
2066 if we copy from two sets of methods.
2068 This change basically does two things:
2069 1) Fewer array lists allocated due to CopyNewMethods.
2070 2) the explicit cast in MemberList costed ALOT.
2072 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
2074 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
2075 a hashtable to avoid needless string allocations when an identifier is
2076 used more than once (the common case).
2078 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2080 * pending.cs: MS's TypeBuilder.GetInterfaces ()
2081 is broken, it will not return anything. So, we
2082 have to use the information we have in mcs to
2085 * typemanager.cs: Add a cache for GetInterfaces,
2086 since this will now be used more often (due to ^^)
2088 (GetExplicitInterfaces) New method that gets the
2089 declared, not effective, interfaces on a type
2090 builder (eg, if you have interface IFoo, interface
2091 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
2094 This patch makes MCS able to bootstrap itself on
2097 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2099 * expression.cs: Remove the Nop's that Miguel put
2102 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2104 * report.cs, codegen.cs: Give the real stack trace to
2105 the error when an exception is thrown.
2107 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2109 * decl.cs: only allocate hashtables for ifaces if
2112 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2114 * expression.cs: fix the error from cs0121-2.cs
2115 (a parent interface has two child interfaces that
2116 have a function with the same name and 0 params
2117 and the function is called through the parent).
2119 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
2121 * class.cs, rootcontext.cs, typmanager.cs: do not
2124 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
2126 * codegen.cs: remove stack for the ec flow branching.
2127 It is already a linked list, so no need.
2129 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
2131 * Makefile: Allow custom profiler here.
2133 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2135 * typemanager.cs (LookupType):
2136 - Use a static char [], because split takes
2137 a param array for args, so it was allocating
2139 - Do not store true in a hashtable, it boxes.
2141 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2143 * flowanalysis.cs: bytify common enums.
2145 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2147 * modifiers.cs: Add a new set of flags for the
2148 flags allowed on explicit interface impls.
2149 * cs-parser.jay: catch the use of modifiers in
2150 interfaces correctly.
2151 * class.cs: catch private void IFoo.Blah ().
2153 All related to bug #50572.
2155 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2157 * decl.cs: Rewrite the consistant accessability checking.
2158 Accessability is not linear, it must be implemented in
2159 a tableish way. Fixes #49704.
2161 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2163 * expression.cs: Handle negation in a checked context.
2164 We must use subtraction from zero. Fixes #38674.
2166 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2168 * class.cs: Ignore static void main in DLLs.
2169 * rootcontext.cs: Handle the target type here,
2170 since we are have to access it from class.cs
2171 * driver.cs: account for the above.
2173 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2175 * report.cs: Give line numbers and files if available.
2177 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
2179 * driver.cs: Implement /addmodule.
2181 * typemanager.cs: Change 'modules' field so it now contains Modules not
2184 2003-12-20 Martin Baulig <martin@ximian.com>
2186 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
2187 (FieldBase.IsAssigned): Removed this field.
2188 (FieldBase.SetAssigned): New public method.
2189 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
2191 2003-12-20 Martin Baulig <martin@ximian.com>
2193 * expression.cs (LocalVariableReference.DoResolve): Don't set
2194 `vi.Used' if we're called from DoResolveLValue().
2196 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
2197 returns the usage vector it just merged into the current one -
2198 pass this one to UsageWarning().
2199 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
2200 of the `EmitContext', don't call this recursively on our children.
2202 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
2204 * driver.cs: Implement /target:module.
2206 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
2208 * support.cs (CharArrayHashtable): New helper class.
2210 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
2211 char arrays, not strings, so we can avoid creating a string in
2212 consume_identifier if the identifier is a keyword.
2214 2003-12-16 Martin Baulig <martin@ximian.com>
2216 * statement.cs (LocalInfo.Assigned): Removed this property.
2217 (LocalInfo.Flags): Removed `Assigned'.
2218 (LocalInfo.IsAssigned): New public method; takes the EmitContext
2219 and uses flow analysis.
2220 (Block.UsageWarning): Made this method private.
2221 (Block.Resolve): Call UsageWarning() if appropriate.
2223 * expression.cs (LocalVariableReference.DoResolve): Always set
2224 LocalInfo.Used here.
2226 2003-12-13 Martin Baulig <martin@ximian.com>
2228 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
2229 any value here; we're now using flow analysis to figure out
2230 whether a statement/block returns a value.
2232 2003-12-13 Martin Baulig <martin@ximian.com>
2234 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
2236 (FlowBranching.MergeFinally): Don't call
2237 `branching.CheckOutParameters()' here, this is called in
2239 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
2240 when adding the `finally' vector.
2242 2003-12-13 Martin Baulig <martin@ximian.com>
2245 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
2246 actually work and also fix #48962.
2248 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
2250 * decl.cs: Do not check System.Object for nested types,
2251 since we know it does not have any. Big bang for buck:
2256 corlib: 17.99 seconds
2260 corlib: 17.39 seconds
2262 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
2264 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
2265 time we are returning 0 members, so we save alot here.
2267 2003-12-11 Martin Baulig <martin@ximian.com>
2269 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
2270 `MergeChild()', also just take the `FlowBranching' as argument;
2271 call Merge() on it and return the result.
2272 (FlowBranching.Merge): We don't need to do anything if we just
2275 2003-12-11 Martin Baulig <martin@ximian.com>
2277 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
2278 them in an `ArrayList' to reduce memory usage. Thanks to Ben
2279 Maurer for this idea.
2281 2003-12-11 Martin Baulig <martin@ximian.com>
2283 * flowanalysis.cs (MergeResult): This class is now gone; we now
2284 use the `UsageVector' for this. The reason for this is that if a
2285 branching just has one sibling, we don't need to "merge" them at
2286 all - that's the next step to do.
2287 (FlowBranching.Merge): We now return a `UsageVector' instead of a
2290 2003-12-11 Martin Baulig <martin@ximian.com>
2292 Reworked flow analyis and made it more precise and bug-free. The
2293 most important change is that we're now using a special `Reachability'
2294 class instead of having "magic" meanings of `FlowReturns'. I'll
2295 do some more cleanups and optimizations and also add some more
2296 documentation this week.
2298 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
2299 largely reworked this class.
2300 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
2301 the new `Reachability' class instead of having "magic" values here.
2302 (FlowBranching): We're now using an instance of `Reachability'
2303 instead of having separate `Returns', `Breaks' etc. fields.
2305 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
2306 based on flow analysis; ignore the return value of block.Emit ().
2308 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
2310 * driver.cs typemanager.cs: Find the mono extensions to corlib even
2311 if they are private.
2313 2003-12-09 Martin Baulig <martin@ximian.com>
2315 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
2316 call them directly on the UsageVector.
2318 2003-12-09 Martin Baulig <martin@ximian.com>
2320 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
2321 Changed return type from `FlowReturns' to `Reachability'.
2323 2003-12-09 Martin Baulig <martin@ximian.com>
2325 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
2326 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
2327 `Reachable' fields with a single `Reachability' one.
2329 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2331 * class.cs (FindMembers): Remove foreach's.
2344 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2349 This patch does a few things:
2350 1. EmptyStatement is now a singleton, so it is never reallocated.
2351 2. All blah is EmptyStatement constructs have been changed to
2352 blah == EmptyStatement.Value, which is much faster and valid
2353 now that EmptyStatement is a singleton.
2354 3. When resolving a block, rather than allocating a new array for
2355 the non-empty statements, empty statements are replaced with
2356 EmptyStatement.Value
2357 4. Some recursive functions have been made non-recursive.
2358 Mainly the performance impact is from (3), however (1) and (2) are needed for
2359 this to work. (4) does not make a big difference in normal situations, however
2360 it makes the profile look saner.
2365 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2366 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2367 Total memory allocated: 56397 KB
2370 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
2371 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
2372 Total memory allocated: 55666 KB
2374 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2376 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
2377 than the hashtable in a hashtable version
2379 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
2380 we always end up concating a string. This results in a huge perf
2381 loss, because many strings have to be tracked by the GC. In this
2382 patch, we first use a hashtable that works with two keys, so that
2383 the strings do not need to be concat'ed.
2394 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2396 * Makefile: Add a new target `do-time' that does a quick and simple
2397 profile, leaving easy to parse output.
2399 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
2401 * codegen.cs (Init): Create the dynamic assembly with
2402 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
2404 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
2406 * support.cs: Make the PtrHashtable use only one
2407 instance of its comparer.
2409 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
2411 * typemanager.cs: Fix lookup of GetNamespaces.
2413 2003-11-29 Miguel de Icaza <miguel@ximian.com>
2415 * expression.cs: Removed redundant line.
2417 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
2418 ArrayLists, use for loops with bounds.
2420 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
2423 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
2424 arraylists, use for loop with bounds.
2426 The above three changes give us a 0.071 second performance
2427 improvement out of 3.294 seconds down to 3.223. On my machine
2428 the above changes reduced the memory usage by 1,387 KB during
2431 * cs-parser.jay (QualifiedIdentifier): New class used to represent
2432 QualifiedIdentifiers. Before we created a new string through
2433 concatenation, and mostly later on, the result would be
2434 manipulated by DecomposeQI through string manipulation.
2436 This reduced the compiler memory usage for bootstrapping from
2437 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
2438 compile times in 0.05 seconds.
2440 2003-11-28 Dick Porter <dick@ximian.com>
2442 * support.cs: Do string compares with the Invariant culture.
2450 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
2451 the comparison is done with the Invariant culture.
2453 2003-11-27 Miguel de Icaza <miguel@ximian.com>
2455 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
2456 GetEnumerator method.
2458 (ProbeCollectionType): Iterate starting at the most specific type
2459 upwards looking for a GetEnumerator
2461 * expression.cs: Shift count can be up to 31 for int/uint and 63
2464 2003-11-26 Miguel de Icaza <miguel@ximian.com>
2466 * statement.cs (Block.LookupLabel): Also look for the label on the
2467 children blocks. Use a hash table to keep track of visited
2470 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
2471 we actually did transform the other operand, otherwise fall back
2472 to the common codepath that casts to long.
2474 * cs-tokenizer.cs: Use the same code pattern as the int case.
2475 Maybe I should do the parsing myself, and avoid depending on the
2476 Parse routines to get this done.
2478 2003-11-25 Miguel de Icaza <miguel@ximian.com>
2480 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2481 which fixes bug 51347. This time test it.
2483 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
2484 attributes for example can not tell the difference between these.
2485 The difference was only a syntax feature of the language.
2487 * attribute.cs: Apply attributes to delegates.
2489 * delegate.cs: Call the apply attributes method.
2491 2003-11-24 Miguel de Icaza <miguel@ximian.com>
2493 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
2494 comparing 0 vs Byte.MinValue, not the value
2496 (ImplicitConversionRequired): When reporting a conversion error,
2497 use error 31 to print out the constant error instead of the
2500 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2501 which fixes bug 51347.
2503 2003-11-22 Miguel de Icaza <miguel@ximian.com>
2505 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
2506 which fixes the -warnaserror command line option.
2508 2003-11-21 Miguel de Icaza <miguel@ximian.com>
2510 * cfold.cs (DoNumericPromotions): During constant folding of
2511 additions on UIntConstant, special case intconstants with
2512 IntConstants like we do on the expression binary operator.
2514 2003-11-12 Miguel de Icaza <miguel@ximian.com>
2516 * convert.cs (ImplicitReferenceConversion): We were missing a case
2517 (System.Enum are not value types or class types, so we need to
2518 classify them separatedly).
2520 * driver.cs: We do not support error 2007.
2522 2003-11-12 Jackson Harper <jackson@ximian.com>
2524 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
2525 system directory. Also use the full file name so users can
2526 libraries names mscorlib-o-tron.dll in a non system dir.
2528 2003-11-10 Martin Baulig <martin@ximian.com>
2530 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
2531 (TypeManager.InitCoreTypes): Initialize them here, but instead of
2532 calling `ResolveType()' on them, directly assign their `Type'.
2534 2003-11-08 Martin Baulig <martin@ximian.com>
2536 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
2537 return value and the `out parent' parameter.
2538 (TypeContainer.DefineType): Moved the CS0644 check into
2539 GetClassBases(). Don't pass the interface types to the
2540 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
2541 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
2543 * ecore.cs (TypeExpr.IsAttribute): New property.
2544 (TypeExpr.GetInterfaces): New method.
2546 * interface.cs (Interface.GetInterfaceTypeByName): Return a
2547 TypeExpr instead of a Type.
2548 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
2549 (Interface.DefineType): Don't pass the interface types to the
2550 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
2551 them later and then call `TypeBulider.AddInterfaceImplementation()'.
2553 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
2554 instead of a `Type[]'.
2555 (TypeManager.RegisterBuilder): Likewise.
2556 (TypeManager.AddUserInterface): Likewise.
2557 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
2558 `Type[]' and also return a `TypeExpr[]'.
2559 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
2561 2003-11-08 Martin Baulig <martin@ximian.com>
2563 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
2566 2003-11-08 Martin Baulig <martin@ximian.com>
2568 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
2569 TypeManager.ResolveExpressionTypes().
2571 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
2572 instead of an Expression.
2573 (TypeExpr): This is now an abstract base class for `TypeExpression'.
2574 (TypeExpression): New public class; formerly known as `TypeExpr'.
2576 * expression.cs (ComposedCast): Derive from TypeExpr.
2578 * typemanager.cs (TypeManager.system_*_expr): These are now
2579 TypExpr's instead of Expression's.
2580 (TypeManager.ResolveExpressionTypes): New public static function;
2581 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
2584 2003-11-06 Miguel de Icaza <miguel@ximian.com>
2586 * expression.cs (New.DoResolve): Do not dereference value that
2587 might be a null return.
2589 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
2590 sure that the constant value has the right type. Fixes an
2591 unreported bug, similar to 50425.
2593 * const.cs (Const.LookupConstantValue): Call
2594 ImplicitStandardConversionExists before doing a conversion to
2595 avoid havng the TypeManager.ChangeType do conversions.
2597 Reduced the number of casts used
2599 (Const.ChangeType): New routine to enable reuse of the constant
2600 type changing code from statement.
2602 * typemanager.cs (ChangeType): Move common initialization to
2603 static global variables.
2607 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
2608 every value type to go through, even if it was void. Fix that.
2610 * cs-tokenizer.cs: Use is_identifier_start_character on the start
2611 character of the define, and the is_identifier_part_character for
2612 the rest of the string.
2614 2003-11-05 Miguel de Icaza <miguel@ximian.com>
2616 * expression.cs (UnaryMutator.EmitCode): When I updated
2617 LocalVariableReference.DoResolve, I overdid it, and dropped an
2618 optimization done on local variable references.
2620 2003-11-04 Miguel de Icaza <miguel@ximian.com>
2622 * ecore.cs: Convert the return from Ldlen into an int.
2624 2003-10-20 Miguel de Icaza <miguel@ximian.com>
2626 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
2627 the accessibility, this is a special case for toplevel non-public
2628 classes (internal for instance).
2630 2003-10-20 Nick Drochak <ndrochak@gol.com>
2632 * ecore.cs: Fix typo and build. Needed another right paren.
2634 2003-10-19 Miguel de Icaza <miguel@ximian.com>
2636 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
2637 `internal' case regular and protected, but not allowing protected
2638 to be evaluated later. Bug 49840
2640 2003-10-15 Miguel de Icaza <miguel@ximian.com>
2642 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
2643 to kb.Nlast, and not the kb.nFirst to isolate the switch
2646 Extract the underlying type, so enumerations of long/ulong are
2647 treated like long/ulong.
2649 2003-10-14 Miguel de Icaza <miguel@ximian.com>
2651 * expression.cs (New): Overload the meaning of RequestedType to
2652 track the possible creation of the NewDelegate type, since
2653 DoResolve is invoked more than once for new constructors on field
2656 See bugs: #48800 and #37014
2658 * cs-parser.jay (declare_local_constants): Take an arraylist
2659 instead of a single constant.
2661 (local_constant_declaration): It should take a
2662 constant_declarators, not a constant_declarator. Fixes 49487
2664 * convert.cs: Fix error report.
2666 2003-10-13 Jackson Harper <jackson@ximian.com>
2668 * typemanager.cs (TypeToCoreType): Add float and double this fixes
2671 2003-10-09 Martin Baulig <martin@ximian.com>
2673 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
2675 (MethodCore.DoDefineParameters): Removed the TypeContainer
2676 argument; use the DeclSpace which was passed to the .ctor instead.
2677 (MethodCore.CheckParameter): Take a DeclSpace instead of a
2678 TypeContainer; we only need a DeclSpace here.
2680 2003-10-09 Martin Baulig <martin@ximian.com>
2682 * class.cs (MethodData): Added additional `DeclSpace ds' argument
2684 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
2685 EmitContext's .ctor.
2687 2003-10-09 Martin Baulig <martin@ximian.com>
2689 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
2690 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
2691 AsAccessible(), moved them as well.
2693 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
2695 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
2697 * cs-parser.jay : Renamed yyName to yyNames related to jay.
2699 2003-10-07 Miguel de Icaza <miguel@ximian.com>
2701 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
2702 generation for >=, as spotted by Paolo, bug 48679.
2703 Patch from David Waite.
2705 * cs-tokenizer.cs: Add handling for #pragma.
2707 * cs-parser.jay: Allow for both yield and yield return in the
2708 syntax. The anti-cobolization of C# fight will go on!
2710 * class.cs (TypeBuilder.DefineType): Catch error condition here
2711 (Parent.DefineType erroring out and returning null).
2713 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2714 coping with enumerations variables, we were mistakenly processing
2715 them as a regular value type instead of built-in types. Fixes the
2718 * typemanager.cs (IsBuiltinOrEnum): New method.
2720 2003-09-30 Miguel de Icaza <miguel@ximian.com>
2722 * cs-parser.jay: Upgrade: yield now needs the return clause.
2724 2003-09-19 Martin Baulig <martin@ximian.com>
2726 * decl.cs (MemberCache.SetupCacheForInterface): Take a
2727 `MemberCache parent' argument. Normally, an interface doesn't
2728 have a parent type except System.Object, but we use this in gmcs
2729 for generic type parameters.
2731 2003-09-18 Martin Baulig <martin@ximian.com>
2733 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
2734 on `type.IsInterface'; don't check whether the type has a parent
2735 to determine whether it's an interface.
2737 2003-09-15 Martin Baulig <martin@ximian.com>
2739 * class.cs (TypeContainer.DefineType): Added an error flag to
2740 avoid reporting duplicate CS0146's ("class definition is
2743 * driver.cs (Driver.MainDriver): Abort if
2744 RootContext.ResolveTree() reported any errors.
2746 2003-09-07 Martin Baulig <martin@ximian.com>
2748 * report.cs (Error, Warning): Added overloaded versions which take
2749 a `params object[] args' and call String.Format().
2751 2003-09-07 Martin Baulig <martin@ximian.com>
2753 * decl.cs (DeclSpace..ctor): Don't call
2754 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2755 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
2756 (DeclSpace.RecordDecl): New method.
2758 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2760 2003-09-02 Ravi Pratap <ravi@ximian.com>
2762 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2763 value attributes to be applied to ParameterBuilders.
2765 * class.cs (MethodCore.LabelParameters): Make static and more
2766 generic so that it can be used from other places - like interface
2767 methods, for instance.
2769 * interface.cs (Interface.Emit): Call LabelParameters before
2770 emitting attributes on the InterfaceMethod.
2772 2003-08-26 Martin Baulig <martin@ximian.com>
2774 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2775 resolving aliases; fixes #47927.
2777 2003-08-26 Martin Baulig <martin@ximian.com>
2779 * statement.cs (Using.DoResolve): This is internally emitting a
2780 try/finally clause, so we need to set ec.NeedExplicitReturn if we
2781 do not always return. Fixes #47681.
2783 2003-08-26 Martin Baulig <martin@ximian.com>
2785 * decl.cs (MemberCore): Moved WarningNotHiding(),
2786 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2788 (AdditionResult): Make this nested in DeclSpace.
2789 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2790 argument; call NamespaceEntry.Define() unless we're nested in a
2793 * namespace.cs (Namespace.DefineName): New public function. This
2794 is called from DeclSpace's .ctor to add
2795 (Namespace.Lookup): Include DeclSpaces in the lookup.
2797 * class.cs (Operator): Derive from MemberBase, not MemberCore.
2799 * const.cs (Const): Derive from MemberBase, not MemberCore.
2801 2003-08-25 Martin Baulig <martin@ximian.com>
2803 * convert.cs (Convert.ExplicitReferenceConversion): When
2804 converting from an interface type to a class, unbox if the target
2805 type is a struct type. Fixes #47822.
2807 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2809 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2812 2003-08-22 Martin Baulig <martin@ximian.com>
2814 * class.cs (TypeManager.DefineType): When defining a nested type,
2815 call DefineType() on our parent; fixes #47801.
2817 2003-08-22 Martin Baulig <martin@ximian.com>
2819 * class.cs (MethodData.Define): While checking if a method is an
2820 interface implementation, improve the test a bit more to fix #47654.
2822 2003-08-22 Martin Baulig <martin@ximian.com>
2824 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2825 correctly; fixes #47722.
2827 2003-08-22 Martin Baulig <martin@ximian.com>
2829 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2830 LocalVariableReference, ensure it's not read-only. Fixes #47536.
2832 * statement.cs (Fixed.DoResolve): Make all variables read-only.
2834 2003-08-22 Martin Baulig <martin@ximian.com>
2836 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2837 can only be assigned in static constructors. Fixes #47161.
2839 2003-08-22 Martin Baulig <martin@ximian.com>
2841 Rewrote and improved the flow analysis code.
2843 * flowbranching.cs (FlowBranching): Make this class abstract.
2844 (FlowBranching.CreateBranching): New static function to create a
2846 (FlowBranchingBlock, FlowBranchingException): New classes.
2847 (FlowBranching.UsageVector.Type): New public readonly field.
2848 (FlowBranching.UsageVector.Breaks): Removed the setter.
2849 (FlowBranching.UsageVector.Returns): Removed the setter.
2850 (FlowBranching.UsageVector): Added Break(), Return(),
2851 NeverReachable() and Throw() methods to modify the reachability.
2852 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2853 done by FlowBranching.Merge().
2854 (FlowBranching.UsageVector.MergeChild): New method; merges the
2855 merge result into the current vector.
2856 (FlowBranching.Merge): New abstract method to merge a branching.
2858 2003-08-12 Martin Baulig <martin@ximian.com>
2860 * expression.cs (Indirection.CacheTemporaries): Create the
2861 LocalTemporary with the pointer type, not its element type.
2863 2003-08-10 Miguel de Icaza <miguel@ximian.com>
2865 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2866 token was a keyword or not.
2868 Add `error' options where an IDENTIFIER was expected; Provide
2869 CheckToken and CheckIdentifierToken convenience error reporting
2872 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2874 * decl.cs: Rename `NamespaceEntry Namespace' public field into
2875 NameSpaceEntry NameSpaceEntry.
2877 (LookupInterfaceOrClass): Avoid creating a full qualified name
2878 from namespace and name: avoid doing lookups when we know the
2879 namespace is non-existant. Use new Tree.LookupByNamespace which
2880 looks up DeclSpaces based on their namespace, name pair.
2882 * driver.cs: Provide a new `parser verbose' to display the
2883 exception thrown during parsing. This is turned off by default
2884 now, so the output of a failure from mcs is more graceful.
2886 * namespace.cs: Track all the namespaces defined in a hashtable
2889 (IsNamespace): New method
2891 2003-08-09 Miguel de Icaza <miguel@ximian.com>
2893 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
2894 we know that we need to concatenate (full typename can never be
2899 * statement.cs: Use a bitfield; Do not initialize to null things
2900 which are done by the constructor by default.
2902 * cs-parser.jay: bug fix, parameter was 4, not 3.
2904 * expression.cs: Just use the property;
2906 * statement.cs: No need for GetVariableInfo method.
2908 2003-08-08 Martin Baulig <martin@ximian.com>
2910 * flowanalysis.cs (FlowReturns): This is now nested in the
2911 `FlowBranching' class.
2912 (MyBitVector): Moved this here from statement.cs.
2913 (FlowBranching.SiblingType): New enum type.
2914 (FlowBranching.CreateSibling): Added `SiblingType' argument.
2916 2003-08-07 Martin Baulig <martin@ximian.com>
2918 * flowanalysis.cs (FlowBranchingType): This is now nested in the
2919 `FlowBranching' class and called `BranchingType'.
2921 2003-08-07 Martin Baulig <martin@ximian.com>
2923 * flowanalysis.cs: Moved all the control flow analysis code into
2926 2003-08-07 Martin Baulig <martin@ximian.com>
2928 * assign.cs (Assign.DoResolve): `target' must either be an
2929 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
2932 2003-08-07 Miguel de Icaza <miguel@ximian.com>
2934 * expression.cs (BinaryMethod): This kind of expression is created by the
2935 Binary class if it determines that the operator has to be handled
2938 (BinaryDelegate): This kind of expression is created if we are
2939 dealing with a + or - operator on delegates.
2941 (Binary): remove method, argumetns, and DelegateOperator: when
2942 dealing with methods,
2944 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
2946 * statement.cs (Block): use bitfields for the three extra booleans
2947 we had in use. Remove unused topblock parameter.
2949 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
2951 * assign.cs: Drop extra unneeded tests.
2953 2003-08-06 Miguel de Icaza <miguel@ximian.com>
2955 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
2957 * statement.cs (Foreach): Use VariableStorage instead of
2960 * codegen.cs (VariableStorage): New class used by clients that
2961 require a variable stored: locals or fields for variables that
2962 need to live across yield.
2964 Maybe provide a convenience api for EmitThis+EmitLoad?
2966 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
2969 2003-08-05 Miguel de Icaza <miguel@ximian.com>
2971 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
2972 RemapParameterLValue): New methods that are used to turn a
2973 precomputed FieldInfo into an expression like this:
2977 The idea is to use this instead of making LocalVariableReference
2978 have more than one meaning.
2980 * cs-parser.jay: Add error production to BASE.
2982 * ecore.cs: Deal with TypeManager.GetField returning null, which
2983 is now a valid return value.
2985 (FieldExprNoAddress): New expression for Fields whose address can
2988 * expression.cs (LocalVariableReference): During the resolve
2989 phases, create new expressions if we are in a remapping context.
2990 Remove code that dealt with remapping here.
2992 (ParameterReference): same.
2994 (ProxyInstance): New expression, like the `This' expression, but
2995 it is born fully resolved. We know what we are doing, so remove
2996 the errors that are targeted to user-provided uses of `this'.
2998 * statement.cs (Foreach): our variable is now stored as an
2999 Expression; During resolution, follow the protocol, dont just
3000 assume it will return this.
3002 2003-08-06 Martin Baulig <martin@ximian.com>
3004 * support.cs (SeekableStreamReader.cs): New public class.
3006 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
3007 SeekableStreamReader instead of the normal StreamReader.
3009 2003-08-04 Martin Baulig <martin@ximian.com>
3011 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
3012 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
3013 deambiguate casts and delegate invocations.
3014 (parenthesized_expression): Use the new tokens to ensure this is
3015 not a cast of method invocation.
3017 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
3018 when reading a `)' and Deambiguate_CloseParens () was previously
3021 * expression.cs (ParenthesizedExpression): New class. This is
3022 just used for the CS0075 test.
3023 (Binary.DoResolve): Check for CS0075.
3025 2003-07-29 Ravi Pratap <ravi@ximian.com>
3027 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
3028 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
3029 reference comparison.
3031 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
3032 examine the ReturnType for equality - this is necessary in the
3033 cases of implicit and explicit operators whose signature also
3034 includes the return type.
3036 2003-07-26 Miguel de Icaza <miguel@ximian.com>
3038 * namespace.cs: Cache the result of the namespace computation,
3039 instead of computing it every time.
3041 2003-07-24 Miguel de Icaza <miguel@ximian.com>
3043 * decl.cs: Use a global arraylist that we reuse over invocations
3044 to avoid excesive memory consumption. Reduces memory usage on an
3045 mcs compile by one meg (45 average).
3047 * typemanager.cs (LookupTypeReflection): In .NET pointers are
3048 private, work around that.
3050 2003-07-23 Miguel de Icaza <miguel@ximian.com>
3052 * literal.cs (IntLiteral): Define Zero and One static literals.
3054 * cs-parser.jay (integer_literal): use static literals to reduce
3055 memory usage for the most used literals (0, 1 and -1). 211kb
3056 reduced in memory usage.
3058 Replace all calls to `new ArrayList' with `new
3059 ArrayList(4)' which is a good average number for most allocations,
3060 and also requires only 16 bytes of memory for its buffer by
3063 This reduced MCS memory usage in seven megabytes for the RSS after
3066 2003-07-28 Ravi Pratap <ravi@ximian.com>
3068 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
3069 handle params methods the correct way by forming only one
3070 applicable set with params and normal methods in them. Earlier we
3071 were looking at params methods only if we found no normal methods
3072 which was not the correct thing to do.
3074 (Invocation.BetterFunction): Take separate arguments indicating
3075 when candidate and the best method are params methods in their
3078 This fixes bugs #43367 and #46199.
3080 * attribute.cs: Documentation updates.
3082 (CheckAttribute): Rename to CheckAttributeTarget.
3083 (GetValidPlaces): Rename to GetValidTargets.
3085 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
3086 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
3090 2003-07-28 Martin Baulig <martin@ximian.com>
3092 * class.cs (TypeContainer.DefineMembers): Use the base type's full
3093 name when looking up the base class of a nested class. Fixes #46977.
3095 2003-07-26 Martin Baulig <martin@ximian.com>
3097 * expression.cs (Indexers.Indexer): New nested struct; contains
3098 getter, setter and the indexer's type.
3099 (Indexers.Properties): This is now an ArrayList of
3101 (IndexerAccess.DoResolveLValue): Correctly set the type if the
3102 indexer doesn't have any getters.
3104 * assign.cs (Assign.DoResolve): Also do the implicit conversions
3105 for embedded property and indexer assignments.
3107 2003-07-26 Martin Baulig <martin@ximian.com>
3109 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
3110 preprocessor directive is not the first non-whitespace character
3113 2003-07-26 Martin Baulig <martin@ximian.com>
3115 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
3116 namespace parsing, follow the spec more closely.
3118 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
3119 NamespaceEntry.Lookup().
3121 2003-07-25 Martin Baulig <martin@ximian.com>
3123 * MethodCore.cs (OverridesSomething): New public field; it's set
3124 from TypeContainer.DefineMembers if this method overrides
3125 something (which doesn't need to be a method). Fix #39462.
3127 2003-07-25 Ravi Pratap <ravi@ximian.com>
3129 * typemanager.cs (GetMembers): Ensure that the list of members is
3130 reversed. This keeps things in sync.
3132 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
3133 find an AttributeUsage attribute.
3135 * expression.cs (Invocation.OverloadResolve): Perform the check
3136 which disallows Invoke to be directly called on a Delegate.
3138 (Error_InvokeOnDelegate): Report error cs1533.
3140 2003-07-25 Martin Baulig <martin@ximian.com>
3142 * expression.cs (Indexers.GetIndexersForType): Only look in the
3143 interface hierarchy if the requested type is already an
3144 interface. Fixes #46788 while keeping #46502 fixed.
3146 2003-07-25 Martin Baulig <martin@ximian.com>
3148 * class.cs (TypeContainer.DefineMembers): Check whether all
3149 readonly fields have been assigned and report warning CS0649 if
3152 * statement.cs (LocalInfo.IsFixed): Always return true if this is
3155 2003-07-24 Ravi Pratap <ravi@ximian.com>
3157 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
3158 returned from GetMethods to make things consistent with the
3159 assumptions MCS makes about ordering of methods.
3161 This should comprehensively fix bug #45127 and it does :-)
3163 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
3164 ordering is actually reverse.
3166 * Clean up some debug messages I left lying around.
3168 * interface.cs (Populate*): Get rid of code which emits attributes
3169 since the stage in which we emit attributes is the 'Emit' stage,
3170 not the define stage.
3172 (Emit): Move attribute emission for interface members here.
3174 2003-07-22 Ravi Pratap <ravi@ximian.com>
3176 * expression.cs (Invocation.OverloadResolve): Follow the spec more
3177 closely: we eliminate methods in base types when we have an
3178 applicable method in a top-level type.
3180 Please see section 14.5.5.1 for an exact description of what goes
3183 This fixes bug #45127 and a host of other related to corlib compilation.
3185 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
3186 array is the method corresponding to the top-level type (this is
3187 because of the changes made to icall.c) so we change this
3190 (MethodGroupExpr.Name): This too.
3192 * typemanager.cs (GetElementType): New method which does the right
3193 thing when compiling corlib.
3195 * everywhere: Make use of the above in the relevant places.
3197 2003-07-22 Martin Baulig <martin@ximian.com>
3199 * cs-parser.jay (invocation_expression): Moved
3200 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
3201 `cast_expression', but create a InvocationOrCast which later
3202 resolves to either an Invocation or a Cast.
3204 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
3205 method; call this before EmitStatement() to make sure that this
3206 expression can be used as a statement.
3208 * expression.cs (InvocationOrCast): New class; resolves to either
3209 an Invocation or a Cast.
3211 * statement.cs (StatementExpression): Call ResolveStatement() on
3212 the ExpressionStatement before emitting it.
3214 2003-07-21 Martin Baulig <martin@ximian.com>
3216 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
3217 `ref' and `out' attributes match; fixes #46220.
3218 (MemberAccess.ResolveMemberAccess): You can't reference a type
3219 through an expression; fixes #33180.
3220 (Indexers.GetIndexersForType): Don't return the indexers from
3221 interfaces the class implements; fixes #46502.
3223 2003-07-21 Martin Baulig <martin@ximian.com>
3225 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
3226 CS0661 checks; fixes bug #30442.
3228 2003-07-21 Martin Baulig <martin@ximian.com>
3230 * decl.cs (AdditionResult): Added `Error'.
3232 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
3234 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
3235 makes cs0031.cs actually work.
3237 2003-07-20 Martin Baulig <martin@ximian.com>
3239 * namespace.cs: Fixed that bug which caused a crash when compiling
3242 2003-07-20 Miguel de Icaza <miguel@ximian.com>
3244 * typemanager.cs (LookupTypeReflection): Never expose types which
3245 are NotPublic, NestedPrivate, NestedAssembly, or
3246 NestedFamANDAssem. We used to return these, and later do a check
3247 that would report a meaningful error, but the problem is that we
3248 would not get the real match, if there was a name override.
3250 2003-07-18 Miguel de Icaza <miguel@ximian.com>
3252 * namespace.cs (Namespace, Name): Do not compute the namespace
3253 name dynamically, compute it in the constructor. This reduced
3254 memory usage by 1697 KB.
3256 * driver.cs: Use --pause to pause at the end.
3258 2003-07-17 Peter Williams <peter@newton.cx>
3260 * Makefile: Change the name of the test target so that it doesn't
3261 conflict with the recursive test target.
3263 2003-07-17 Miguel de Icaza <miguel@ximian.com>
3265 * expression.cs (LocalVariableReference.Emit, EmitAssign,
3266 AddressOf): Do not use EmitThis, that was wrong, use the actual
3269 2003-07-15 Miguel de Icaza <miguel@ximian.com>
3271 * class.cs (MethodData.Define): While checking if a method is an
3272 interface implementation, improve the test: If we are not public
3273 (use new test here: use the computed MethodAttributes directly,
3274 instead of the parsed modifier flags) check if the `implementing'
3275 method comes from an interface or not.
3277 * pending.cs (VerifyPendingMethods): Slightly better error
3280 * makefile: add test target that does the mcs bootstrap.
3282 2003-07-16 Ravi Pratap <ravi@ximian.com>
3284 * interface.cs (Define): Do nothing here since there are no
3285 members to populate etc. Move the attribute emission out of here
3286 since this was just totally the wrong place to put it. Attribute
3287 application happens during the 'Emit' phase, not in the 'Define'
3290 (Emit): Add this method and move the attribute emission here
3292 * rootcontext.cs (EmitCode): Call the Emit method on interface
3295 2003-07-14 Ravi Pratap M <ravi@ximian.com>
3297 * expression.cs (OverloadResolve): Report error only if Location
3298 is not 'Null' which means that there was a probe going on.
3300 2003-07-14 Martin Baulig <martin@ximian.com>
3302 * expression.cs (ConditionalLogicalOperator): New public class to
3303 implement user defined conditional logical operators.
3304 This is section 14.11.2 in the spec and bug #40505.
3306 2003-07-14 Martin Baulig <martin@ximian.com>
3308 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
3310 2003-07-14 Martin Baulig <martin@ximian.com>
3312 * codegen.cs (EmitContext.InFixedInitializer): New public field.
3314 * ecore.cs (IVariable.VerifyFixed): New interface method.
3316 * expression.cs (Unary.ResolveOperator): When resolving the `&'
3317 operator, check whether the variable is actually fixed. Fixes bug
3318 #36055. Set a variable definitely assigned when taking its
3319 address as required by the spec.
3321 * statement.cs (LocalInfo.IsFixed): New field.
3322 (LocalInfo.MakePinned): Set `IsFixed' to true.
3324 2003-07-14 Ravi Pratap M <ravi@ximian.com>
3326 * attribute.cs (Attribute.Resolve): While doing a Member lookup
3327 for .ctors, ensure that we only ask for members declared in the
3328 attribute type (BindingFlags.DeclaredOnly).
3332 * expression.cs (Error_WrongNumArguments): Report error 1501
3333 correctly the way CSC does.
3335 2003-07-13 Martin Baulig <martin@ximian.com>
3337 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
3338 lookup on the fully qualified name, to make things like "X.X" work
3339 where "X.X" is a fully qualified type name, but we also have a
3340 namespace "X" in the using list. Fixes #41975.
3342 2003-07-13 Martin Baulig <martin@ximian.com>
3344 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
3345 function. If we're a CompoundAssign, we need to create an embedded
3346 CompoundAssign, not an embedded Assign.
3347 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
3350 2003-07-13 Martin Baulig <martin@ximian.com>
3352 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
3353 work to fix bug #46088.
3355 2003-07-13 Ravi Pratap <ravi@ximian.com>
3357 * class.cs (Operator.Emit): Do not emit attributes here - it is
3358 taken care of by the Method class that we delegate too. This takes
3361 2003-07-10 Martin Baulig <martin@ximian.com>
3363 * expression.cs (TypeOfVoid): New class.
3364 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
3366 2003-07-10 Martin Baulig <martin@ximian.com>
3368 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
3371 2003-07-10 Martin Baulig <martin@ximian.com>
3373 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
3374 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
3376 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
3378 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
3380 2003-07-10 Martin Baulig <martin@ximian.com>
3382 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
3383 of decimal. Fixes #42850.
3385 NOTE: I also fixed the created byte blob, but this doesn't work on
3386 the MS runtime and csc never produces any byte blobs for decimal
3389 2003-07-10 Martin Baulig <martin@ximian.com>
3391 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
3392 structs; fixes #32068.
3393 (Block.AddChildVariableNames): Fixed #44302.
3395 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3397 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
3399 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3401 * attribute.cs: And this test is onger needed.
3403 2003-07-08 Martin Baulig <martin@ximian.com>
3405 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
3406 inaccessible types. Fixes #36313.
3408 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
3410 * namespace.cs (NamespaceEntry): Create implicit entries for all
3411 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
3412 implicit entries for N1.N2 and N1.
3414 2003-07-08 Martin Baulig <martin@ximian.com>
3416 Rewrote the handling of namespaces to fix a lot of the issues
3417 wrt. `using' aliases etc.
3419 * namespace.cs (Namespace): Splitted this class into a
3420 per-assembly `Namespace' and a per-file `NamespaceEntry'.
3422 * typemanager.cs (TypeManager.IsNamespace): Removed.
3423 (TypeManager.ComputeNamespaces): Only compute namespaces from
3424 loaded assemblies here, not the namespaces from the assembly we're
3425 currently compiling.
3427 2003-07-08 Martin Baulig <martin@ximian.com>
3429 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
3431 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3433 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
3436 I thought about the memory savings here, but LookupTypeReflection
3437 is used under already very constrained scenarios. Compiling
3438 corlib or mcs only exposes one hit, so it would not really reduce
3439 any memory consumption.
3441 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3443 * typemanager.cs: fixes bug #45889 by only adding public types from
3444 other assemblies to the list of known types.
3446 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3448 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
3449 on the type we resolved.
3451 2003-07-05 Martin Baulig <martin@ximian.com>
3453 * pending.cs (PendingImplementation.ParentImplements): Don't
3454 create the proxy if the parent is abstract.
3456 * class.cs (TypeContainer.DefineIndexers): Process explicit
3457 interface implementations first. Fixes #37714.
3459 2003-07-04 Miguel de Icaza <miguel@ximian.com>
3461 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
3462 defined recursively; but since we modify the input parameters
3463 (left is set to `this' temporarily), we reset this value if the
3464 left_is_explicit is false, which gives the original semantics to
3467 * literal.cs (NullPointer): new class used to represent a null
3468 literal in a pointer context.
3470 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
3471 type is a pointer, use a NullPointer object instead of a
3472 NullLiteral. Closes 43687
3474 (ExplicitConversion): Convert pointer values using
3475 the conv opcode to the proper type.
3477 * ecore.cs (New): change ValueTypeVariable property into a method,
3478 that returns whether the valuetype is suitable for being used.
3480 * expression.cs (Binary.DoNumericPromotions): Only return if we
3481 the int constant was a valid uint, and we can return both left and
3482 right as uints. If not, we continue processing, to trigger the
3483 type conversion. This fixes 39018.
3485 * statement.cs (Block.EmitMeta): During constant resolution, set
3486 the CurrentBlock property on the emitcontext, so that we resolve
3487 constants propertly.
3489 2003-07-02 Martin Baulig <martin@ximian.com>
3491 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
3492 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
3494 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
3495 than emitting it here.
3497 * statement.cs: Fixed some more flow analysis bugs.
3499 2003-07-02 Martin Baulig <martin@ximian.com>
3501 * class.cs (MethodData.Define): When implementing interface
3502 methods, set Final unless we're Virtual.
3504 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
3505 check work for interface methods.
3507 2003-07-01 Martin Baulig <martin@ximian.com>
3509 * ecore.cs (EmitContext.This): Replaced this property with a
3510 GetThis() method which takes a Location argument. This ensures
3511 that we get the correct error location for a CS0188.
3513 2003-07-01 Miguel de Icaza <miguel@ximian.com>
3515 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
3516 ImplicitStandardConversion.
3518 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
3520 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
3522 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
3525 2003-06-30 Miguel de Icaza <miguel@ximian.com>
3527 * class.cs (Constructor.Define): Turn off initlocals for unsafe
3530 (MethodData.Define): Turn off initlocals for unsafe methods.
3532 2003-06-29 Miguel de Icaza <miguel@ximian.com>
3534 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
3535 complete; Fixes #37521.
3537 * delegate.cs: Use Modifiers.TypeAttr to compute the
3538 TypeAttributes, instead of rolling our own. This makes the flags
3539 correct for the delegates.
3541 2003-06-28 Miguel de Icaza <miguel@ximian.com>
3543 * class.cs (Constructor.Define): Set the private flag for static
3544 constructors as well.
3546 * cs-parser.jay (statement_expression): Set the return value to
3547 null, to avoid a crash when we catch an error.
3549 2003-06-24 Miguel de Icaza <miguel@ximian.com>
3551 * cs-parser.jay: Applied patch from Jackson that adds support for
3552 extern and unsafe modifiers to destructor declarations.
3554 * expression.cs: Report error 21 if the user is trying to index a
3557 * driver.cs: Add an error message, suggested by the bug report.
3559 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
3560 if we do not have a ": this ()" constructor initializer. Fixes 45149
3562 2003-06-14 Miguel de Icaza <miguel@ximian.com>
3564 * namespace.cs: Add some information to reduce FAQs.
3566 2003-06-13 Miguel de Icaza <miguel@ximian.com>
3568 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
3569 underlying enumeration types. Fixes #43915.
3571 * expression.cs: Treat ushort/short as legal values to be used in
3574 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
3576 * delegate.cs: transfer custom attributes for paramenters from
3577 the delegate declaration to Invoke and BeginInvoke.
3579 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
3581 * attribute.cs: handle custom marshalers and emit marshal info
3584 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
3586 * makefile.gnu: Added anonymous.cs to the compiler sources.
3588 2003-05-28 Miguel de Icaza <miguel@ximian.com>
3590 * iterators.cs: Change the name of the proxy class to include two
3593 * cs-parser.jay: Update grammar to include anonymous methods.
3595 * anonymous.cs: new file.
3597 2003-05-27 Miguel de Icaza <miguel@ximian.com>
3599 * class.cs (Field.Define): Add missing test for pointers and
3602 2003-05-27 Ravi Pratap <ravi@ximian.com>
3604 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
3605 we use the stobj opcode.
3607 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
3608 since it wasn't the correct fix.
3610 It still is puzzling that we are required to use stobj for IntPtr
3611 which seems to be a ValueType.
3613 2003-05-26 Miguel de Icaza <miguel@ximian.com>
3615 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
3616 during regular simple name resolution. Now, the trick is that
3617 instead of returning for processing the simplename, we do a
3618 TypeManager.LookupType (ie, a rooted lookup as opposed to a
3619 contextual lookup type). If a match is found, return that, if
3620 not, return for further composition.
3622 This fixes long-standing 30485.
3624 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3625 using the address to initialize an object, do an Stobj instead of
3626 using the regular Stelem.
3628 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
3629 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
3630 Because if we are a BaseIndexerAccess that value will be true.
3633 * statement.cs (GotoCase.Resolve): Return after reporting an
3634 error, do not attempt to continue.
3636 * expression.cs (PointerArithmetic.Emit): If our operand is a
3637 long, convert our constants to match the operand before
3638 multiplying. Convert to I type before adding. Fixes 43670.
3640 2003-05-14 Ravi Pratap <ravi@ximian.com>
3642 * enum.cs (ImplicitConversionExists) : Rename to
3643 ImplicitEnumConversionExists to remove ambiguity.
3645 * ecore.cs (NullCast): New type of cast expression class which
3646 basically is very similar to EmptyCast with the difference being
3647 it still is a constant since it is used only to cast a null to
3651 * convert.cs (ImplicitReferenceConversion): When casting a null
3652 literal, we return a NullCast.
3654 * literal.cs (NullLiteralTyped): Remove - I don't see why this
3655 should be around anymore.
3657 The renaming (reported was slightly wrong). Corrections:
3659 ConvertImplicitStandard -> ImplicitConversionStandard
3660 ConvertExplicitStandard -> ExplicitConversionStandard
3662 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3663 before passing them in !
3665 * convert.cs (ImplicitConversionStandard): When comparing for
3666 equal expr and target types, ensure that expr is not a
3669 In general, we must not be checking (expr_type ==
3670 target_type) in the top level conversion methods
3671 (ImplicitConversion, ExplicitConversion etc). This checking is
3672 done in the methods that they delegate to.
3674 2003-05-20 Miguel de Icaza <miguel@ximian.com>
3676 * convert.cs: Move Error_CannotConvertType,
3677 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3678 ImplicitNumericConversion, ImplicitConversionExists,
3679 ImplicitUserConversionExists, StandardConversionExists,
3680 FindMostEncompassedType, FindMostSpecificSource,
3681 FindMostSpecificTarget, ImplicitUserConversion,
3682 ExplicitUserConversion, GetConversionOperators,
3683 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3684 TryImplicitIntConversion, Error_CannotConvertImplicit,
3685 ConvertImplicitRequired, ConvertNumericExplicit,
3686 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3687 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3690 Perform the following renames:
3692 StandardConversionExists -> ImplicitStandardConversionExists
3693 ConvertImplicit -> ImplicitConversion
3694 ConvertImplicitStandard -> ImplicitStandardConversion
3695 TryImplicitIntConversion -> ImplicitIntConversion
3696 ConvertImplicitRequired -> ImplicitConversionRequired
3697 ConvertNumericExplicit -> ExplicitNumericConversion
3698 ConvertReferenceExplicit -> ExplicitReferenceConversion
3699 ConvertExplicit -> ExplicitConversion
3700 ConvertExplicitStandard -> ExplicitStandardConversion
3702 2003-05-19 Martin Baulig <martin@ximian.com>
3704 * statement.cs (TypeInfo.StructInfo): Made this type protected.
3705 (TypeInfo): Added support for structs having structs as fields.
3707 * ecore.cs (FieldExpr): Implement IVariable.
3708 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3709 VariableInfo for the field.
3711 2003-05-18 Martin Baulig <martin@ximian.com>
3713 * expression.cs (This.DoResolve): Report a CS0027 if we're
3714 emitting a field initializer.
3716 2003-05-18 Martin Baulig <martin@ximian.com>
3718 * expression.cs (This.ResolveBase): New public function.
3719 (This.DoResolve): Check for CS0188.
3721 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3724 * ecore.cs (MethodGroupExpr.DoResolve): Set the
3725 `instance_expression' to null if we don't have any non-static
3728 2003-05-18 Martin Baulig <martin@ximian.com>
3730 Reworked the way how local variables and parameters are handled by
3731 the flow analysis code.
3733 * statement.cs (TypeInfo, VariableMap): New public classes.
3734 (VariableInfo): New public class. This is now responsible for
3735 checking whether a variable has been assigned. It is used for
3736 parameters and local variables.
3737 (Block.EmitMeta): Take the InternalParameters as argument; compute
3738 the layout of the flow vectors here.
3739 (Block.LocalMap, Block.ParameterMap): New public properties.
3740 (FlowBranching): The .ctor doesn't get the InternalParameters
3741 anymore since Block.EmitMeta() now computes the layout of the flow
3743 (MyStructInfo): This class is now known as `StructInfo' and nested
3744 in `TypeInfo'; we don't access this directly anymore.
3746 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3747 property and removed IsAssigned(), IsFieldAssigned(),
3748 SetAssigned() and SetFieldAssigned(); we now call them on the
3749 VariableInfo so we don't need to duplicate this code everywhere.
3751 * expression.cs (ParameterReference): Added `Block block' argument
3753 (LocalVariableReference, ParameterReference, This): The new
3754 VariableInfo class is now responsible for all the definite
3757 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3758 IsParameterAssigned, SetParameterAssigned): Removed.
3760 2003-05-18 Martin Baulig <martin@ximian.com>
3762 * typemanager.cs (InitCoreTypes): Try calling
3763 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3764 the 3-args-version. Corlib now also needs our `void_type'.
3765 (GetMethod): Added overloaded version which takes an optional
3766 `bool report_errors' to allow lookups of optional methods.
3768 2003-05-12 Martin Baulig <martin@ximian.com>
3770 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3771 only used for locals and not for parameters.
3773 2003-05-12 Miguel de Icaza <miguel@ximian.com>
3775 * support.cs (InternalParameters.ParameterType): Return the
3776 ExternalType of the parameter.
3778 * parameter.cs (Parameter.ExternalType): drop the two arguments,
3781 2003-05-11 Miguel de Icaza <miguel@ximian.com>
3783 * class.cs (MethodData.Define): Do not set the `newslot' on
3784 interface members, if they are also flagged as "override".
3786 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3787 better code for ++i and i++. This only works for static fields
3788 and local variables.
3790 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3791 want to pull the DeclSpace out of the builder_to_declspace instead
3792 of the TypeBuilder (like in TypeContainer.FindMembers).
3794 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3795 instead of LookupTypeContainer. Fixes the crash on .NET for
3796 looking up interface members.
3798 * const.cs: Create our own emit context during the Definition
3799 stage, so that constants are evaluated in the proper context, when
3800 a recursive definition happens.
3802 2003-05-11 Martin Baulig <martin@ximian.com>
3804 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
3805 new block for a switch section.
3806 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3807 the adding/lookup in the switch block. Fixes #39828.
3809 2003-05-09 Miguel de Icaza <miguel@ximian.com>
3811 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3812 functionality: I needed to convert the data after I had performed
3813 the add/sub operation into the operands type size.
3815 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3816 pass the type for the box operation, otherwise the resulting
3817 object would have been of type object.
3819 (BoxedCast): Add constructor to specify the type to box as.
3821 2003-05-07 Miguel de Icaza <miguel@ximian.com>
3823 * iterators.cs: I was reusing the `count' variable inadvertently,
3824 take steps to not allow this to happen.
3826 2003-05-06 Miguel de Icaza <miguel@ximian.com>
3828 * attribute.cs (Attribute.Resolve): Params attributes are encoded
3829 by creating an array at the point where the params starts and
3830 putting all those arguments there, then adjusting the size of the
3833 2003-05-05 Miguel de Icaza <miguel@ximian.com>
3835 * expression.cs (New.AddressOf): Implement interface
3836 IMemoryLocation. This is used when the `new' operator is used in
3837 the context of an invocation to a method on a value type.
3839 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3842 * namespace.cs: Also check the using aliases here.
3844 * driver.cs: Move the test for using validity after the types have
3845 been entered, so we do a single pass that also includes the using
3848 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3849 in the regular case. CreateSiblingForFinally is doing extra
3852 * attribute.cs (GetAttributeArgumentExpression): Store the result
3853 on an out value, and use the return value to indicate failure
3854 instead of using null (which is a valid return for Constant.GetValue).
3856 * statement.cs: Perform the analysis flow for the increment
3857 portion after the statement, because this will be the real flow of
3858 execution. Fixes #42385
3860 * codegen.cs (EmitContext.EmitArgument,
3861 EmitContext.EmitStoreArgument): New helper functions when the
3862 RemapToProxy flag is set.
3864 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3867 Add support for remapping parameters.
3869 * iterators.cs: Propagate parameter values; Store parameter
3870 values in the proxy classes.
3872 2003-05-04 Miguel de Icaza <miguel@ximian.com>
3874 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
3875 need a proxy reference; I do not know what I was thinking
3877 * cs-parser.jay (constructor_initializer): catch another error,
3878 and display nice message.
3880 (field_declaration): catch void field declaration
3881 to flag a better error.
3883 * class.cs (MemberBase.CheckBase): Report an error instead of a
3884 warning if a new protected member is declared in a struct.
3885 (Field.Define): catch the error of readonly/volatile.
3887 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3889 (FieldExpr.AddressOf): ditto. Catch error where the address of a
3890 volatile variable is taken
3892 2003-05-02 Miguel de Icaza <miguel@ximian.com>
3894 * statement.cs (Fixed.Resolve): Report an error if we are not in
3897 2003-05-01 Miguel de Icaza <miguel@ximian.com>
3899 * typemanager.cs: reuse the code that handles type clashes for
3900 delegates and enumerations.
3902 * class.cs (Report28): Always report.
3904 * expression.cs (EncodeAsAttribute): Allow nulls here.
3906 2003-04-28 Miguel de Icaza <miguel@ximian.com>
3908 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3909 the functionality for testing whether an expression is valid for
3910 an attribute here. Also handle the case of arrays of elements
3913 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3914 encoding a linear array into an array of objects that are suitable
3915 to be passed to an CustomAttributeBuilder.
3917 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3919 * ecore.cs: (FieldExpr): Handle field remapping here.
3921 * iteratators.cs: Pass the instance variable (if the method is an
3922 instance method) to the constructors, so we can access the field
3923 variables on the class.
3925 TODO: Test this with structs. I think the THIS variable on
3926 structs might have to be a pointer, and not a refenrece
3928 2003-04-27 Miguel de Icaza <miguel@ximian.com>
3930 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
3931 local variables to fields in a proxy class.
3933 * iterators.cs (PopulateProxy): Rename our internal fields to
3935 Create a <THIS> field if we are an instance method, so we can
3936 reference our parent container variables.
3937 (MapVariable): Called back from the EmitContext code to enter a
3938 new variable to field mapping into the proxy class (we just create
3942 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
3943 for using the remapped locals to fields.
3945 I placed the code here, because that gives the same semantics to
3946 local variables, and only changes the Emit code.
3948 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
3949 statements inside iterators.
3950 (VariableInfo): Add a FieldBuilder for the cases when we are
3951 remapping local variables to fields in a proxy class
3953 * ecore.cs (SimpleNameResolve): Avoid testing two times for
3954 current_block != null.
3956 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
3957 not cope with strings, as it has been moved to the
3958 TableSwitchEmit. Fixed bug in switch generation.
3960 * expression.cs (New.DoResolve): Provide more context for the user
3961 when reporting an error.
3963 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
3966 * expression.cs (MemberAccess.DoResolve): When we get a type back,
3967 check the permissions for it. Note than in a type-resolution
3968 context the check was already present in DeclSpace.ResolveType,
3969 but was missing from the MemberAccess.
3971 (ArrayCreation.CheckIndices): warn if the user has
3972 more nested levels of expressions, but there are no more
3973 dimensions specified. Avoids crash on bug 41906.
3975 2003-04-26 Miguel de Icaza <miguel@ximian.com>
3977 * statement.cs (Block): replace Implicit bool, for a generic
3979 New flag: `Unchecked'. This is used during the EmitMeta phase
3980 (which is out-of-line with the regular Resolve/Emit process for a
3981 statement, as this is done ahead of time, but still gets a chance
3982 to call constant resolve).
3984 (Block.Flags): new enum for adding a new flag.
3986 (Block.EmitMeta): track the state of unchecked.
3988 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
3989 to enable constant resolution to work there as well.
3991 2003-04-22 Miguel de Icaza <miguel@ximian.com>
3993 * typemanager.cs (ienumerable_type): Also look up
3994 System.Collections.IEnumerable.
3996 2003-04-21 Miguel de Icaza <miguel@ximian.com>
3998 TODO: Test more than one conditional per method.
4000 * class.cs (Indexer.Define): Report the location where the user is
4001 referencing the unsupported feature.
4003 (MethodData): Overload the use of `conditionals' to
4004 minimize the creation of needless ArrayLists. This saves roughly
4005 212kb on my machine.
4007 (Method): Implement the new IIteratorContainer interface.
4008 (Method.SetYields): Implement the method by setting the ModFlags
4009 to contain METHOD_YIELDS.
4011 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
4012 which just got set to null.
4014 * iterators.cs: New file.
4016 (Yield, YieldBreak): New statements.
4018 * statement.cs (Return.Resolve): Flag an error if we are used in
4021 * codegen.cs (InIterator): New flag set if the code is being
4022 compiled in an iterator method.
4024 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
4025 internal modifier, and we just use it to avoid adding extra
4026 fields, as this is seldom used.
4028 * cs-parser.jay: Add yield_statement (yield and yield break).
4030 * driver.cs: New flag -v2 to turn on version 2 features.
4032 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
4033 hashtable when v2 is enabled.
4035 2003-04-20 Miguel de Icaza <miguel@ximian.com>
4037 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
4038 there is already a namespace defined with this name.
4040 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
4041 people upgraded their corlibs.
4043 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
4044 always use fully qualified types, no need to use the compiler
4047 (TypeManager.IsNamespace): Use binarysearch.
4049 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
4050 AddDelegate): I did not quite use the new IsValid API properly: I
4051 have to pass the short-name and the fullname. I was passing only
4052 the basename instead of the fullname sometimes.
4054 (TypeContainer.DefineType): call NamespaceClash.
4056 * interface.cs (Interface.DefineType): use NamespaceClash before
4059 * delegate.cs (Delegate.DefineType): use NamespaceClash before
4062 * enum.cs: (Enum.DefineType): use NamespaceClash before
4065 * typemanager.cs (: 3-line patch that gives us some tasty 11%
4066 speed increase. First, use the negative_hits cache when we get a
4067 negative. Second, add the type with its full original name
4068 instead of the new . and + encoded name (reflection uses + to
4069 separate type from a nested type). Use LookupTypeReflection
4070 directly which bypasses the type->name hashtable (that we already
4071 know does not contain the type.
4073 * decl.cs (DeclSpace.ResolveTypeExpr): track the
4074 location/container type.
4076 * driver.cs: When passing utf8, use directly the UTF8Encoding.
4078 2003-04-19 Miguel de Icaza <miguel@ximian.com>
4080 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
4082 * delegate.cs (NewDelegate.Resolve): Test whether an instance
4083 method is being referenced in the method group from a static
4084 context, and report error 120 if so.
4086 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
4089 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
4090 is created, we create the A namespace).
4092 * cs-parser.jay: A namespace also introduces a DeclarationFound.
4095 2003-04-18 Miguel de Icaza <miguel@ximian.com>
4097 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
4098 invocation to ModuleBuilder.GetType with the same values will
4099 return a new type instance, so we need to cache its return
4102 * expression.cs (Binary.ResolveOperator): Only allow the compare
4103 operators on enums if they are of the same type.
4105 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
4106 types of ValueType on their own case. Before we were giving them
4107 the same treatment as objects.
4109 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
4110 fullname. Short name is used to compare against container name.
4111 Fullname is used to check against defined namespace names.
4113 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
4114 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
4116 (Method.CheckBase): Call parent.
4117 (MemberBase.CheckBase): Check for protected members on sealed
4119 (PropertyBase.CheckBase): Call parent.
4120 (Field.Define): Call parent.
4122 * report.cs: Negative error codes are now mapped to 8000 - code,
4123 so that the display is render more nicely.
4125 * typemanager.cs: Do not use try/catch, instead report a regular
4128 (GetPointerType, GetReferenceType): These methods provide
4129 mechanisms to obtain the T* and T& from a T. We had the code
4130 previously scattered around the code base, and it also used
4131 TypeManager.LookupType that would go through plenty of caches.
4132 This one goes directly to the type source.
4134 In some places we did the Type.GetType followed by
4135 ModuleBuilder.GetType, but not in others, so this unifies the
4138 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
4139 statements now that we have namespace information.
4141 * typemanager.cs (IsNamespace): New method, returns whether the
4142 string presented is a namespace or not.
4144 (ComputeNamespaces): New public entry point, computes the list of
4145 available namespaces, using the GetNamespaces API call in Mono, or
4146 the slower version in MS.NET.
4148 Now before we start the semantic analysis phase, we have a
4149 complete list of namespaces including everything that the user has
4152 Deleted old code to cache namespaces in .nsc files.
4154 2003-04-17 Miguel de Icaza <miguel@ximian.com>
4156 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
4157 class/struct location definition Location for the implicit
4158 constructor location.
4160 (Operator.Define): Use the location of the operator for the
4161 implicit Method definition.
4163 (Constructor.Emit): use the constructor location for the implicit
4164 base initializer constructor.
4166 * ecore.cs: Remove ITypeExpression. This interface is now gone,
4167 and the Expression class now contains two new methods:
4169 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
4170 isolate type lookup from the rest of the resolution process.
4172 Since we use Expressions to hold type definitions due to the way
4173 we parse the input we have historically overloaded Resolve to
4174 perform the Type lookups if a special flag is passed. Now this is
4175 eliminated and two methods take their place.
4177 The differences in the two methods between xStep and xTerminal is
4178 that xStep is involved in our current lookup system that uses
4179 SimpleNames to compose a name, while xTerminal is used just to
4180 catch the case where the simplename lookup failed.
4182 2003-04-16 Miguel de Icaza <miguel@ximian.com>
4184 * expression.cs (ResolveMemberAccess): Remove redundant code.
4185 TypeExpr expressions are always born fully resolved.
4187 * interface.cs (PopulateMethod): Do not lookup the types twice.
4188 We were doing it once during SemanticAnalysis and once during
4191 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
4192 in local variable type definitions, were being returned as a
4193 SimpleName (we decomposed everything into a string), that is
4194 because primary_expression was being used instead of a type in the
4195 grammar (reduce/reduce conflicts).
4197 The part that was wrong is that we converted the expression into a
4198 string (an oversimplification in one hand, compounded with primary
4199 expressions doing string concatenation).
4205 Would return "A.B.C[]" as a SimpleName. This stopped things like
4206 using clauses from working on this particular context. And a type
4207 was being matched directly against "A.B.C[]".
4209 We now use the correct approach, and allow for ComposedCast to be
4210 part of the unary expression. So the "A.B.C []" become a composed
4211 cast of "A.B.C" (as a nested group of MemberAccess with a
4212 SimpleName at the end) plus the rank composition "[]".
4216 2003-04-10 Miguel de Icaza <miguel@ximian.com>
4218 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
4219 for the access level checking.
4221 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
4222 `TypeContainer container', because I kept getting confused when I
4223 was debugging this code.
4225 * expression.cs (Indexers): Instead of tracking getters/setters,
4226 we now track them in parallel. We create one arraylist less, but
4227 most importantly it is possible now for the LValue code to find a
4228 matching get for a set.
4230 (IndexerAccess.DoResolveLValue): Update the code.
4231 GetIndexersForType has been modified already to extract all the
4232 indexers from a type. The code assumed it did not.
4234 Also make the code set the correct return type for the indexer.
4235 This was fixed a long time ago for properties, but was missing for
4236 indexers. It used to be void_type.
4238 (Binary.Emit): Test first for doubles instead of
4239 floats, as they are more common.
4241 (Binary.EmitBranchable): Use the .un version of the branch opcodes
4242 when dealing with floats and the <=, >= operators. This fixes bug
4245 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
4246 to load the array value by emitting a load on the foreach variable
4247 type. This was incorrect.
4249 We now emit the code to load an element using the the array
4250 variable type, and then we emit the conversion operator.
4254 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
4256 * attribute.cs: Avoid allocation of ArrayLists in the common case.
4258 2003-04-09 Miguel de Icaza <miguel@ximian.com>
4260 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
4261 test for protection before we test for signatures.
4263 (MethodSignature.ToString): implement.
4265 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
4266 to the case where we reduced into a LongConstant.
4268 * decl.cs (CheckAccessLevel): If the type is an array, we can not
4269 depend on whether the information is acurrate, because the
4270 Microsoft runtime will always claim that the array type is public,
4271 regardless of the real state.
4273 If the type is a pointer, another problem happens: the type is
4274 reported as non-public in Microsoft.
4276 In both cases we have to call CheckAccessLevel recursively with
4277 the underlying type as the argument to be tested.
4279 2003-04-08 Miguel de Icaza <miguel@ximian.com>
4281 * assign.cs (Assign.Emit): If we are dealing with a compound
4282 assignment expression, we should use the code path that stores the
4283 intermediate result in a temporary value. This fixes #40903.
4285 *expression.cs (Indirection.ToString): Provide ToString method for
4288 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
4290 * class.cs: Null out fields holding references to Block objects so
4291 they can be garbage collected.
4293 * expression.cs (OverloadResolve): Remove unused local.
4295 2003-04-07 Martin Baulig <martin@ximian.com>
4297 * codegen.cs (EmitContext.CurrentFile): New public field.
4298 (EmitContext.Mark): Use the CurrentFile to check whether the
4299 location is in the correct file.
4300 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
4302 2003-04-07 Martin Baulig <martin@ximian.com>
4304 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
4306 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
4307 location. [FIXME: The location argument which gets passed to this
4308 method is sometimes wrong!]
4310 2003-04-07 Nick Drochak <ndrochak@gol.com>
4312 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
4314 2003-04-07 Miguel de Icaza <miguel@ximian.com>
4316 * expression.cs (Indirection.EmitAssign): We were using the
4317 temporary, but returning immediately instead of continuing the
4320 2003-04-06 Martin Baulig <martin@ximian.com>
4322 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
4323 if it's a nested child, but also deriving from the outer class.
4326 * typemanager.cs (IsNestedChildOf): Make this work if it's a
4327 nested child, but also deriving from the outer class. See
4329 (FilterWithClosure): We may access private members of the outer
4330 class if we're a nested child and deriving from the outer class.
4331 (RealMemberLookup): Only set `closure_private_ok' if the
4332 `original_bf' contained BindingFlags.NonPublic.
4334 2003-04-05 Martin Baulig <martin@ximian.com>
4336 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
4338 2003-04-02 Miguel de Icaza <miguel@ximian.com>
4340 * class.cs (Event.Define): Do not allow abstract events to have
4343 2003-04-01 Miguel de Icaza <miguel@ximian.com>
4345 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
4346 block in event declarations.
4348 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
4349 value type, get its address.
4351 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
4352 leaving a class on the stack instead of a boolean value (int
4353 0/1). Change the code so we compare against null, and then the
4354 result against zero.
4356 * class.cs (TypeContainer.GetClassBases): We were checking for the
4357 parent class being sealed too late.
4359 * expression.cs (Binary.Emit): For <= and >= when dealing with
4360 floating point values, use cgt.un and clt.un instead of cgt and
4363 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
4365 * statement.cs: Apply the same optimization as MS: skip the
4366 GetEnumerator returning an IEnumerator, and use the one returning a
4367 CharEnumerator instead. This allows us to avoid the try-finally block
4370 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
4372 * cs-parser.jay: Attributes cannot be applied to
4373 namespaces. Fixes #40473
4375 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4378 (Add*): check if the name is valid using the full name for constants,
4379 fields, properties and events.
4381 2003-03-28 Miguel de Icaza <miguel@ximian.com>
4383 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
4384 char constants to be part of the enumeration.
4386 * expression.cs (Conditional.DoResolve): Add support for operator
4387 true. Implements the missing functionality from 14.12
4389 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
4390 operator true/false as required by the spec.
4392 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
4393 implicit conversion to boolean.
4395 * statement.cs (Statement.ResolveBoolean): A boolean expression is
4396 also one where the type implements `operator true'.
4398 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
4399 get an expression that will invoke operator true based on an
4402 (GetConversionOperators): Removed the hack that called op_True
4405 (Expression.ResolveBoolean): Move this from Statement.
4407 2003-03-17 Miguel de Icaza <miguel@ximian.com>
4409 * ecore.cs (FieldExpr): do not allow initialization of initonly
4410 fields on derived classes
4412 2003-03-13 Martin Baulig <martin@ximian.com>
4414 * statement.cs (Block.Emit): Call ig.BeginScope() and
4415 ig.EndScope() when compiling with debugging info; call
4416 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
4418 2003-03-08 Miguel de Icaza <miguel@ximian.com>
4420 * expression.cs (Indexers): Do not construct immediately, allow
4421 for new members to be appended as we go. Fixes 38143
4423 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4425 * expression.cs: save/restore context when resolving an unchecked
4428 2003-03-05 Miguel de Icaza <miguel@ximian.com>
4430 * cfold.cs: Catch division by zero in modulus operator during
4433 2003-03-03 Miguel de Icaza <miguel@ximian.com>
4435 * interface.cs (Interface.DefineMembers): Avoid defining members
4438 2003-02-27 Miguel de Icaza <miguel@ximian.com>
4440 * driver.cs: handle the +/- options for -noconfig
4442 * statement.cs (Unckeched.Resolve): Also track the state of
4443 unchecked in the Resolve phase.
4445 2003-02-27 Martin Baulig <martin@ximian.com>
4447 * ecore.cs (Expression.MemberLookup): Don't create a
4448 MethodGroupExpr for something which is not a method. Fixes #38291.
4450 2003-02-25 Miguel de Icaza <miguel@ximian.com>
4452 * class.cs (MemberBase.CheckParameters): Also check that the type
4453 is unmanaged if it is a pointer.
4455 * expression.cs (SizeOf.Resolve): Add location information.
4457 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
4458 a managed type is declared.
4460 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
4461 parameter modifiers as well. Fixes bug 38606
4463 * class.cs: Very sad. Am backing out the speed up changes
4464 introduced by the ArrayList -> Array in the TypeContainer, as they
4465 were not actually that much faster, and introduced a bug (no error
4466 reports on duplicated methods).
4468 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
4469 source first, this will guarantee that we have a valid expression
4470 before calling in lower levels functions that will require a
4471 resolved object. Then use this original_source in the
4472 target.ResolveLValue instead of the original source that was
4475 Another change. Use target.Resolve instead of LValueResolve.
4476 Although we are resolving for LValues, we will let the Assign code
4477 take care of that (it will be called again from Resolve). This
4478 basically allows code like this:
4480 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
4481 class Y { void A (X x) { x [0] += o; }
4483 The problem was that the indexer was trying to resolve for
4484 set_Item (idx, object o) and never finding one. The real set_Item
4485 was set_Item (idx, X). By delaying the process we get the right
4490 2003-02-23 Martin Baulig <martin@ximian.com>
4492 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
4493 while calling DoEmit ().
4495 * codegen.cs (EmitContext.Mark): Don't mark locations in other
4496 source files; if you use the #line directive inside a method, the
4497 compiler stops emitting line numbers for the debugger until it
4498 reaches the end of the method or another #line directive which
4499 restores the original file.
4501 2003-02-23 Martin Baulig <martin@ximian.com>
4503 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
4505 2003-02-23 Martin Baulig <martin@ximian.com>
4507 * statement.cs (Block.AddChildVariableNames): We need to call this
4508 recursively, not just for our immediate children.
4510 2003-02-23 Martin Baulig <martin@ximian.com>
4512 * class.cs (Event.Define): Always make the field private, like csc does.
4514 * typemanager.cs (TypeManager.RealMemberLookup): Make events
4515 actually work, fixes bug #37521.
4517 2003-02-23 Miguel de Icaza <miguel@ximian.com>
4519 * delegate.cs: When creating the various temporary "Parameters"
4520 classes, make sure that we call the ComputeAndDefineParameterTypes
4521 on those new parameters (just like we do with the formal ones), to
4522 allow them to be resolved in the context of the DeclSpace.
4524 This fixes the bug that Dick observed in Bugzilla #38530.
4526 2003-02-22 Miguel de Icaza <miguel@ximian.com>
4528 * expression.cs (ResolveMemberAccess): When resolving a constant,
4529 do not attempt to pull a constant if the value was not able to
4530 generate a valid constant.
4532 * const.cs (LookupConstantValue): Do not report more errors than required.
4534 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4536 * expression.cs: fixes bug #38328.
4538 2003-02-18 Miguel de Icaza <miguel@ximian.com>
4540 * class.cs: Changed all the various members that can be part of a
4541 class from being an ArrayList to be an Array of the right type.
4542 During the DefineType type_list, interface_list, delegate_list and
4543 enum_list are turned into types, interfaces, delegates and enums
4546 And during the member population, indexer_list, event_list,
4547 constant_list, field_list, instance_constructor_list, method_list,
4548 operator_list and property_list are turned into their real arrays.
4550 Although we could probably perform this operation earlier, for
4551 good error reporting we need to keep the lists and remove the
4552 lists for longer than required.
4554 This optimization was triggered by Paolo profiling the compiler
4555 speed on the output of `gen-sample-program.pl' perl script.
4557 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
4558 not crash in methods like MemberLookupFailed that use this field.
4560 This problem arises when the compiler fails to resolve a type
4561 during interface type definition for example.
4563 2003-02-18 Miguel de Icaza <miguel@ximian.com>
4565 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
4566 inherit from System.Object, so we have to stop at null, not only
4567 when reaching System.Object.
4569 2003-02-17 Miguel de Icaza <miguel@ximian.com>
4571 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
4572 DeclaredOnly because the parent indexer might have had a different
4573 name, but did not loop until the top of the hierarchy was reached.
4575 The problem this one fixes is 35492: when a class implemented an
4576 indexer from an interface, we were getting the interface method
4577 (which was abstract) and we were flagging an error (can not invoke
4580 This also keeps bug 33089 functioning, and test-148 functioning.
4582 * typemanager.cs (IsSpecialMethod): The correct way of figuring
4583 out if a method is special is to see if it is declared in a
4584 property or event, or whether it is one of the predefined operator
4585 names. This should fix correctly #36804.
4587 2003-02-15 Miguel de Icaza <miguel@ximian.com>
4589 The goal here is to remove the dependency on EmptyCast.Peel ().
4590 Killing it completely.
4592 The problem is that currently in a number of places where
4593 constants are expected, we have to "probe" for an EmptyCast, and
4594 Peel, which is not the correct thing to do, as this will be
4595 repetitive and will likely lead to errors.
4597 The idea is to remove any EmptyCasts that are used in casts that
4598 can be reduced to constants, so we only have to cope with
4601 This bug hunt was triggered by Bug 37363 and the desire to remove
4602 the duplicate pattern where we were "peeling" emptycasts to check
4603 whether they were constants. Now constants will always be
4606 * ecore.cs: Use an enumconstant here instead of wrapping with
4609 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
4610 throwing me off. By handling this we can get rid of a few hacks.
4612 * statement.cs (Switch): Removed Peel() code.
4614 2003-02-14 Miguel de Icaza <miguel@ximian.com>
4616 * class.cs: Location information for error 508
4618 * expression.cs (New.DoResolve): Add a guard against double
4619 resolution of an expression.
4621 The New DoResolve might be called twice when initializing field
4622 expressions (see EmitFieldInitializers, the call to
4623 GetInitializerExpression will perform a resolve on the expression,
4624 and later the assign will trigger another resolution
4626 This leads to bugs (#37014)
4628 * delegate.cs: The signature for EndInvoke should contain any ref
4629 or out parameters as well. We were not doing this in the past.
4631 * class.cs (Field.Define): Do not overwrite the type definition
4632 inside the `volatile' group. Turns out that volatile enumerations
4633 were changing the type here to perform a validity test, which
4636 2003-02-12 Miguel de Icaza <miguel@ximian.com>
4638 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4639 and structs, we do not want to load the instance variable
4641 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4642 enum_type has to be handled like an object reference (implicit
4643 conversions exists from this to object), but the regular IsClass
4644 and IsValueType tests will never return true for this one.
4646 Also we use TypeManager.IsValueType instead of type.IsValueType,
4647 just for consistency with the rest of the code (this is only
4648 needed if we ever use the construct exposed by test-180.cs inside
4649 corlib, which we dont today).
4651 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
4653 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4656 2003-02-09 Martin Baulig <martin@ximian.com>
4658 * namespace.cs (Namespace..ctor): Added SourceFile argument.
4659 (Namespace.DefineNamespaces): New static public method; this is
4660 called when we're compiling with debugging to add all namespaces
4663 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4664 pass it to the Namespace's .ctor.
4666 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4667 and MethodBase arguments; pass the namespace ID to the symwriter;
4668 pass the MethodBase instead of the token to the symwriter.
4669 (SymbolWriter.DefineNamespace): New method to add a namespace to
4672 2003-02-09 Martin Baulig <martin@ximian.com>
4674 * symbolwriter.cs: New file. This is a wrapper around
4675 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
4676 methods here in near future.
4678 2003-02-09 Martin Baulig <martin@ximian.com>
4680 * codegen.cs (EmitContext.Mark): Just pass the arguments to
4681 ILGenerator.MarkSequencePoint() which are actually used by the
4684 2003-02-09 Martin Baulig <martin@ximian.com>
4686 * location.cs (SourceFile): New public sealed class. This
4687 contains the name and an index which is used in the location's token.
4688 (Location): Reserve an appropriate number of bits in the token for
4689 the source file instead of walking over that list, this gives us a
4690 really huge performance improvement when compiling with debugging.
4692 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4693 `SourceFile' argument instead of a string.
4694 (Driver.ProcessFile): Add all the files via Location.AddFile(),
4695 but don't parse/tokenize here, we need to generate the list of all
4696 source files before we do that.
4697 (Driver.ProcessFiles): New static function. Parses/tokenizes all
4700 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4701 instead of a string.
4703 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4706 2003-02-09 Martin Baulig <martin@ximian.com>
4708 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4709 filename on `#line default'.
4711 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4713 * statement.cs: don't clear the pinned var when the fixed statement
4714 returns from the method (fixes bug#37752).
4716 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4718 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
4721 2003-02-07 Martin Baulig <martin@ximian.com>
4723 * driver.cs: Removed the `--debug-args' command line argument.
4725 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4726 automatically by the AsssemblyBuilder.
4727 (CodeGen.InitializeSymbolWriter): We don't need to call any
4728 initialization function on the symbol writer anymore. This method
4729 doesn't take any arguments.
4731 2003-02-03 Miguel de Icaza <miguel@ximian.com>
4733 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4734 from referenced assemblies as well.
4736 2003-02-02 Martin Baulig <martin@ximian.com>
4738 * class.cs (MethodData.Emit): Generate debugging info for external methods.
4740 2003-02-02 Martin Baulig <martin@ximian.com>
4742 * class.cs (Constructor.Emit): Open the symbol writer before
4743 emitting the constructor initializer.
4744 (ConstructorInitializer.Emit): Call ec.Mark() to allow
4745 single-stepping through constructor initializers.
4747 2003-01-30 Miguel de Icaza <miguel@ximian.com>
4749 * class.cs: Handle error 549: do not allow virtual methods in
4752 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4754 * decl.cs: Check access levels when resolving types
4756 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4758 * statement.cs: Add parameters and locals set in catch blocks that might
4759 return to set vector
4761 2003-01-29 Miguel de Icaza <miguel@ximian.com>
4763 * class.cs (Operator): Set the SpecialName flags for operators.
4765 * expression.cs (Invocation.DoResolve): Only block calls to
4766 accessors and operators on SpecialName methods.
4768 (Cast.TryReduce): Handle conversions from char constants.
4771 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4773 * statement.cs: small memory and time optimization in FlowBranching.
4775 2003-01-28 Pedro Mart <yoros@wanadoo.es>
4777 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4778 problem that the last fix but in the other sid (Set).
4780 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4781 access when there is no indexer in the hierarchy.
4783 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4785 * class.cs: Combine some if statements.
4787 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4789 * driver.cs: fixed bug #37187.
4791 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
4793 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4794 any indexer, it's needed to build a list with all the indexers in the
4795 hierarchy (AllGetters), else we have problems. Fixes #35653.
4797 2003-01-23 Miguel de Icaza <miguel@ximian.com>
4799 * class.cs (MethodData.Define): It is wrong for an interface
4800 implementation to be static in both cases: explicit and implicit.
4801 We were only handling this in one case.
4803 Improve the if situation there to not have negations.
4805 * class.cs (Field.Define): Turns out that we do not need to check
4806 the unsafe bit on field definition, only on usage. Remove the test.
4808 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4810 * driver.cs: use assembly.Location instead of Codebase (the latest
4811 patch made mcs fail when using MS assemblies).
4813 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
4815 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4816 get the path to *corlib.dll.
4818 2003-01-21 Nick Drochak <ndrochak@gol.com>
4822 * typemanager.cs: Remove compiler warnings
4824 2003-01-20 Duncan Mak <duncan@ximian.com>
4826 * AssemblyInfo.cs: Bump the version number to 0.19.
4828 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4830 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4832 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
4834 * class.cs (Constructor::Emit): Emit debugging info for constructors.
4836 2003-01-17 Miguel de Icaza <miguel@ximian.com>
4838 * cs-parser.jay: Small fix: we were not comparing the constructor
4839 name correctly. Thanks to Zoltan for the initial pointer.
4841 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4843 * cs-tokenizer.cs: Set file name when specified with #line
4845 2003-01-15 Miguel de Icaza <miguel@ximian.com>
4847 * cs-parser.jay: Only perform the constructor checks here if we
4848 are named like the class; This will help provider a better
4849 error. The constructor path is taken when a type definition is
4850 not found, but most likely the user forgot to add the type, so
4851 report that rather than the constructor error.
4853 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4855 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4858 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4860 * cs-parser.jay: Add cleanup call.
4862 2003-01-13 Duncan Mak <duncan@ximian.com>
4864 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4865 consistent with other methods.
4867 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4869 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4871 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4873 * attribute.cs: only set GuidAttr to true when we have a
4876 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4880 * typemanager.cs: fixes to allow mcs compile corlib with the new
4881 Type.IsSubclassOf fix.
4883 2003-01-08 Miguel de Icaza <miguel@ximian.com>
4885 * expression.cs (LocalVariableReference.DoResolve): Classify a
4886 constant as a value, not as a variable. Also, set the type for
4889 * cs-parser.jay (fixed_statement): take a type instead of a
4890 pointer_type, so we can produce a better error message later.
4892 * statement.cs (Fixed.Resolve): Flag types that are not pointers
4895 (For.DoEmit): Make inifinite loops have a
4896 non-conditional branch back.
4898 (Fixed.DoEmit): First populate the pinned variables, then emit the
4899 statement, then clear the variables. Before I was emitting the
4900 code once for each fixed piece.
4903 2003-01-08 Martin Baulig <martin@ximian.com>
4905 * statement.cs (FlowBranching.MergeChild): A break in a
4906 SWITCH_SECTION does not leave a loop. Fixes #36155.
4908 2003-01-08 Martin Baulig <martin@ximian.com>
4910 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4911 lives in the same number space than `param_map'. Fixes #36154.
4913 2003-01-07 Miguel de Icaza <miguel@ximian.com>
4915 * cs-parser.jay (constructor_declaration): Set the
4916 Constructor.ModFlags before probing for it. This makes the
4917 compiler report 514, 515 and 132 (the code was there, but got
4920 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4921 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4922 (GotoCase.Resolve): Set `Returns' to ALWAYS.
4924 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4926 * enum.cs: create the enum static fields using the enum type.
4928 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
4930 * class.cs: don't try to create the ParamBuilder for the return
4931 type if it's not needed (and handle it breaking for the ms runtime
4934 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
4936 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
4938 2002-12-29 Miguel de Icaza <miguel@ximian.com>
4940 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
4941 the command. This showed up while compiling the JANET source
4942 code, which used \r as its only newline separator.
4944 2002-12-28 Miguel de Icaza <miguel@ximian.com>
4946 * class.cs (Method.Define): If we are an operator (because it
4947 reuses our code), then set the SpecialName and HideBySig. #36128
4949 2002-12-22 Miguel de Icaza <miguel@ximian.com>
4951 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
4952 exception, report error 120 `object reference required'.
4954 * driver.cs: Add --pause option, used during to measure the size
4955 of the process as it goes with --timestamp.
4957 * expression.cs (Invocation.DoResolve): Do not allow methods with
4958 SpecialName to be invoked.
4960 2002-12-21 Miguel de Icaza <miguel@ximian.com>
4962 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
4963 number before adding it.
4965 2002-12-21 Ravi Pratap <ravi@ximian.com>
4967 * ecore.cs (StandardImplicitConversion): When in an unsafe
4968 context, we allow conversion between void * to any other pointer
4969 type. This fixes bug #35973.
4971 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
4973 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
4974 is not thrown when extensionless outputs are used
4976 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4978 * rootcontext.cs: fixed compilation of corlib.
4980 2002-12-19 Miguel de Icaza <miguel@ximian.com>
4982 * attribute.cs (Attributes.Contains): Add new method.
4984 * class.cs (MethodCore.LabelParameters): if the parameter is an
4985 `out' parameter, check that no attribute `[In]' has been passed.
4987 * enum.cs: Handle the `value__' name in an enumeration.
4989 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
4991 * decl.cs: Added special case to allow overrides on "protected
4994 2002-12-18 Ravi Pratap <ravi@ximian.com>
4996 * attribute.cs (Attributes.AddAttributeSection): Rename to this
4997 since it makes much more sense.
4999 (Attributes.ctor): Don't require a Location parameter.
5001 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
5003 * attribute.cs (ApplyAttributes): Remove extra Location parameters
5004 since we already have that information per attribute.
5006 * everywhere : make appropriate changes.
5008 * class.cs (LabelParameters): Write the code which actually
5009 applies attributes to the return type. We can't do this on the MS
5010 .NET runtime so we flag a warning in the case an exception is
5013 2002-12-18 Miguel de Icaza <miguel@ximian.com>
5015 * const.cs: Handle implicit null conversions here too.
5017 2002-12-17 Ravi Pratap <ravi@ximian.com>
5019 * class.cs (MethodCore.LabelParameters): Remove the extra
5020 Type [] parameter since it is completely unnecessary. Instead
5021 pass in the method's attributes so that we can extract
5022 the "return" attribute.
5024 2002-12-17 Miguel de Icaza <miguel@ximian.com>
5026 * cs-parser.jay (parse): Use Report.Error to flag errors instead
5027 of ignoring it and letting the compile continue.
5029 * typemanager.cs (ChangeType): use an extra argument to return an
5030 error condition instead of throwing an exception.
5032 2002-12-15 Miguel de Icaza <miguel@ximian.com>
5034 * expression.cs (Unary.TryReduce): mimic the code for the regular
5035 code path. Perform an implicit cast in the cases where we can
5036 implicitly convert to one of the integral types, and then reduce
5037 based on that constant. This fixes bug #35483.
5039 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5041 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
5043 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5045 * namespace.cs: fixed bug #35489.
5047 2002-12-12 Miguel de Icaza <miguel@ximian.com>
5049 * class.cs: Remove some dead code.
5051 * cs-parser.jay: Estimate the number of methods needed
5052 (RootContext.MethodCount);
5054 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
5055 numbers instead of StringBuilders.
5057 * support.cs (PtrHashtable): Add constructor with initial size;
5058 We can now reduce reallocations of the method table.
5060 2002-12-10 Ravi Pratap <ravi@ximian.com>
5062 * attribute.cs (ApplyAttributes): Keep track of the emitted
5063 attributes on a per-target basis. This fixes bug #35413.
5065 2002-12-10 Miguel de Icaza <miguel@ximian.com>
5067 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
5068 default to the Windows 1252 encoding.
5070 (UnixParseOption): Support version, thanks to Alp for the missing
5073 * AssemblyInfo.cs: Add nice assembly information.
5075 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
5078 * cs-parser.jay: Allow a trailing comma before the close bracked
5079 in the attribute_section production.
5081 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
5082 address of the instance was being taken, I will take this out,
5083 because we take the address of the object immediately here.
5085 2002-12-09 Ravi Pratap <ravi@ximian.com>
5087 * typemanager.cs (AreMultipleAllowed): Take care of the most
5088 obvious case where attribute type is not in the current assembly -
5091 2002-12-08 Miguel de Icaza <miguel@ximian.com>
5093 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
5094 definitions, instead of doing that afterwards.
5096 Also we use a nice little hack, depending on the constructor, we
5097 know if we are a "composed" name or a simple name. Hence, we
5098 avoid the IndexOf test, and we avoid
5100 * codegen.cs: Add code to assist in a bug reporter to track down
5101 the source of a compiler crash.
5103 2002-12-07 Ravi Pratap <ravi@ximian.com>
5105 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
5106 types have been emitted for a given element and flag an error
5107 if something which does not have AllowMultiple set is used more
5110 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
5111 attribute types and their corresponding AllowMultiple properties
5113 (AreMultipleAllowed): Check the property for a given type.
5115 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
5116 property in the case we have a TypeContainer.
5118 (Attributes.AddAttribute): Detect duplicates and just skip on
5119 adding them. This trivial fix catches a pretty gross error in our
5120 attribute emission - global attributes were being emitted twice!
5122 Bugzilla bug #33187 is now fixed.
5124 2002-12-06 Miguel de Icaza <miguel@ximian.com>
5126 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
5129 * expression.cs (Binary.ResolveOperator): I can only use the
5130 Concat (string, string, string) and Concat (string, string,
5131 string, string) if the child is actually a concatenation of
5134 2002-12-04 Miguel de Icaza <miguel@ximian.com>
5136 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
5137 context where we need a 2-character lookahead.
5139 * pending.cs (PendingImplementation): Rework so we can keep track
5140 of interface types all the time, and flag those which were
5141 implemented by parents as optional.
5143 2002-12-03 Miguel de Icaza <miguel@ximian.com>
5145 * expression.cs (Binary.ResolveOperator): Use
5146 String.Concat(string,string,string) or
5147 String.Concat(string,string,string,string) when possible.
5149 * typemanager: More helper methods.
5152 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
5154 * pending.cs: remove the bogus return from GetMissingInterfaces()
5155 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
5157 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5159 * namespace.cs: avoid duplicated 'using xxx' being added to
5160 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
5161 when we get more than one 'using' statement for the same namespace.
5162 Report a CS0105 warning for it.
5164 2002-11-30 Miguel de Icaza <miguel@ximian.com>
5166 * cs-tokenizer.cs (consume_identifier): use read directly, instead
5167 of calling getChar/putback, uses internal knowledge of it.
5169 (xtoken): Reorder tokenizer so most common patterns are checked
5170 first. This reduces the compilation time in another 5% (from 8.11s
5171 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
5173 The parsing time is 22% of the compilation in mcs, and from that
5174 64% is spent on the tokenization process.
5176 I tried using a binary search for keywords, but this is slower
5177 than the hashtable. Another option would be to do a couple of
5180 * Not use a StringBuilder, instead use an array of chars,
5181 with a set value. Notice that this way we could catch
5182 the 645 error without having to do it *afterwards*.
5184 * We could write a hand-parser to avoid the hashtable
5185 compares altogether.
5187 The identifier consumption process takes 37% of the tokenization
5188 time. Another 15% is spent on is_number. 56% of the time spent
5189 on is_number is spent on Int64.Parse:
5191 * We could probably choose based on the string length to
5192 use Int32.Parse or Int64.Parse and avoid all the 64-bit
5195 Another 3% is spend on wrapping `xtoken' in the `token' function.
5197 Handle 0xa0 as whitespace (#34752)
5199 2002-11-26 Miguel de Icaza <miguel@ximian.com>
5201 * typemanager.cs (IsCLRType): New routine to tell whether a type
5202 is one of the builtin types.
5204 Maybe it needs to use TypeCodes to be faster. Maybe we could use
5205 typecode in more places instead of doing pointer comparissions.
5206 We could leverage some knowledge about the way the typecodes are
5209 New code to cache namespaces in assemblies, it is currently not
5210 invoked, to be used soon.
5212 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
5214 * expression.cs (Binary.ResolveOperator): specially handle
5215 strings, and do not perform user-defined operator overloading for
5218 2002-11-24 Miguel de Icaza <miguel@ximian.com>
5220 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
5221 internalcall as it is a pretty simple operation; Avoid whenever
5222 possible to call Char.IsLetter.
5224 (consume_identifier): Cut by half the number of
5225 hashtable calls by merging the is_keyword and GetKeyword behavior.
5227 Do not short-circuit, because if we do, we
5228 report errors (ie, #if false && true would produce an invalid
5232 2002-11-24 Martin Baulig <martin@ximian.com>
5234 * expression.cs (Cast.TryReduce): If we're in checked syntax,
5235 check constant ranges and report a CS0221. Fixes #33186.
5237 2002-11-24 Martin Baulig <martin@ximian.com>
5239 * cs-parser.jay: Make this work for uninitialized variable
5240 declarations in the `for' initializer. Fixes #32416.
5242 2002-11-24 Martin Baulig <martin@ximian.com>
5244 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
5245 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
5247 2002-11-24 Martin Baulig <martin@ximian.com>
5249 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
5250 argument; if true, we also check for user-defined conversions.
5251 This is only needed if both arguments are of a user-defined type.
5252 Fixes #30443, added test-175.cs.
5253 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
5255 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
5257 2002-11-24 Martin Baulig <martin@ximian.com>
5259 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
5260 function to get the store opcode.
5261 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
5262 only emit the Ldelema if the store opcode is Stobj. You must run
5263 both test-34 and test-167 to test this. Fixes #34529.
5265 2002-11-23 Martin Baulig <martin@ximian.com>
5267 * ecore.cs (Expression.MemberLookup): Added additional
5268 `qualifier_type' argument which is used when we're being called
5269 from MemberAccess.DoResolve() and null if we're called from a
5271 (Expression.MemberLookupFailed): New method to report errors; this
5272 does the CS1540 check and reports the correct error message.
5274 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
5275 argument for the CS1540 check and redone the way how we're dealing
5276 with private members. See the comment in the source code for details.
5277 (FilterWithClosure): Reverted this back to revision 1.197; renamed
5278 `closure_start_type' to `closure_qualifier_type' and check whether
5279 it's not null. It was not this filter being broken, it was just
5280 being called with the wrong arguments.
5282 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
5283 and pass it the correct `qualifier_type'; this also does the error
5286 2002-11-22 Miguel de Icaza <miguel@ximian.com>
5288 * expression.cs (Invocation.EmitParams): If the we are dealing
5289 with a non-built-in value type, load its address as well.
5291 (ArrayCreation): Use a a pretty constant instead
5292 of the hardcoded value 2. Use 6 instead of 2 for the number of
5293 static initializers.
5295 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
5296 because they are not really value types, just glorified integers.
5298 * driver.cs: Do not append .exe, the CSC compiler does not do it.
5300 * ecore.cs: Remove redundant code for enumerations, make them use
5301 the same code path as everything else, fixes the casting issue
5302 with enumerations in Windows.Forms.
5304 * attribute.cs: Do only cast to string if it is a string, the
5305 validation happens later.
5307 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
5308 people upgrade their corlibs.
5310 * ecore.cs: Oops, enumerations were not following the entire code path
5312 2002-11-21 Miguel de Icaza <miguel@ximian.com>
5314 * typemanager.cs (FilterWithClosure): Commented out the test for
5315 1540 in typemanager.cs, as it has problems when accessing
5316 protected methods from a parent class (see test-174.cs).
5318 * attribute.cs (Attribute.ValidateGuid): new method.
5319 (Attribute.Resolve): Use above.
5321 2002-11-19 Miguel de Icaza <miguel@ximian.com>
5323 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
5325 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
5326 handling for enumerations, as we only needed the TypeContainer
5327 functionality to begin with (this is required for the fix below to
5328 work for enums that reference constants in a container class for
5331 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
5333 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
5334 a valid TypeBuilder to perform lookups on.o
5336 * class.cs (InheritableMemberSignatureCompare): Use true in the
5337 call to GetGetMethod and GetSetMethod, because we are comparing
5338 the signature, and we need to get the methods *even* if they are
5341 (PropertyBase.CheckBase): ditto.
5343 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
5344 GotoCase.Resolve): Use Peel on EmpytCasts.
5346 * ecore.cs (EmptyCast): drop child, add Peel method.
5348 2002-11-17 Martin Baulig <martin@ximian.com>
5350 * ecore.cs (EmptyCast.Child): New public property.
5352 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
5353 label resolved to an EmptyCast. Fixes #34162.
5354 (GotoCase.Resolve): Likewise.
5355 (Block.EmitMeta): Likewise.
5357 2002-11-17 Martin Baulig <martin@ximian.com>
5359 * expression.cs (Invocation.BetterConversion): Prefer int over
5360 uint; short over ushort; long over ulong for integer literals.
5361 Use ImplicitConversionExists instead of StandardConversionExists
5362 since we also need to check for user-defined implicit conversions.
5363 Fixes #34165. Added test-173.cs.
5365 2002-11-16 Martin Baulig <martin@ximian.com>
5367 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
5368 with the `true' and `false' literals. Fixes #33151.
5370 2002-11-16 Martin Baulig <martin@ximian.com>
5372 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
5373 October 22nd; don't do the cs1540 check for static members.
5375 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
5376 now using our own filter here and doing the cs1540 check again.
5378 2002-11-16 Martin Baulig <martin@ximian.com>
5380 * support.cs (InternalParameters): Don't crash if we don't have
5381 any fixed parameters. Fixes #33532.
5383 2002-11-16 Martin Baulig <martin@ximian.com>
5385 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
5386 when looking up static methods to make this work on Windows.
5389 2002-11-16 Martin Baulig <martin@ximian.com>
5391 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
5392 a setter rather than using PropertyInfo.CanWrite.
5394 2002-11-15 Nick Drochak <ndrochak@gol.com>
5396 * class.cs: Allow acces to block member by subclasses. Fixes build
5399 2002-11-14 Martin Baulig <martin@ximian.com>
5401 * class.cs (Constructor.Emit): Added the extern/block check.
5404 2002-11-14 Martin Baulig <martin@ximian.com>
5406 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
5407 iteration while looking for indexers, this is needed because the
5408 indexer may have a different name in our base classes. Fixed the
5409 error reporting (no indexers at all, not get accessor, no
5410 overloaded match). Fixes bug #33089.
5411 (IndexerAccess.DoResolveLValue): Likewise.
5413 2002-11-14 Martin Baulig <martin@ximian.com>
5415 * class.cs (PropertyBase.CheckBase): Make this work for multiple
5416 indexers. Fixes the first part of bug #33089.
5417 (MethodSignature.InheritableMemberSignatureCompare): Added support
5420 2002-11-13 Ravi Pratap <ravi@ximian.com>
5422 * attribute.cs (Attribute.Resolve): Catch the
5423 NullReferenceException and report it since it isn't supposed to
5426 2002-11-12 Miguel de Icaza <miguel@ximian.com>
5428 * expression.cs (Binary.EmitBranchable): Also handle the cases for
5429 LogicalOr and LogicalAnd that can benefit from recursively
5430 handling EmitBranchable. The code now should be nice for Paolo.
5432 2002-11-08 Miguel de Icaza <miguel@ximian.com>
5434 * typemanager.cs (LookupType): Added a negative-hit hashtable for
5435 the Type lookups, as we perform quite a number of lookups on
5436 non-Types. This can be removed once we can deterministically tell
5437 whether we have a type or a namespace in advance.
5439 But this might require special hacks from our corlib.
5443 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
5444 and double which avoids a conversion from an integer to a double.
5446 * expression.cs: tiny optimization, avoid calling IsConstant,
5447 because it effectively performs the lookup twice.
5449 2002-11-06 Miguel de Icaza <miguel@ximian.com>
5451 But a bogus return here to keep the semantics of the old code
5452 until the Mono runtime is fixed.
5454 * pending.cs (GetMissingInterfaces): New method used to remove all
5455 the interfaces that are already implemented by our parent
5456 classes from the list of pending methods.
5458 * interface.cs: Add checks for calls after ResolveTypeExpr.
5460 2002-11-05 Miguel de Icaza <miguel@ximian.com>
5462 * class.cs (Class.Emit): Report warning 67: event not used if the
5463 warning level is beyond 3.
5465 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
5466 being a NullLiteral.
5468 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
5471 * class.cs (TypeContainer.GetClassBases): Cover a missing code
5472 path that might fail if a type can not be resolved.
5474 * expression.cs (Binary.Emit): Emit unsigned versions of the
5477 * driver.cs: use error 5.
5479 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
5481 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
5483 2002-11-01 Miguel de Icaza <miguel@ximian.com>
5485 * cs-parser.jay (switch_section): A beautiful patch from Martin
5486 Baulig that fixed 33094.
5488 2002-10-31 Miguel de Icaza <miguel@ximian.com>
5490 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
5491 Check whether the base is abstract and report an error if so.
5493 * expression.cs (IndexerAccess.DoResolveLValue,
5494 IndexerAccess.DoResolve): ditto.
5496 (Invocation.DoResolve): ditto.
5498 (Invocation.FullMethodDesc): Improve the report string.
5500 * statement.cs (Block): Eliminate IsVariableDefined as it is
5501 basically just a wrapper for GetVariableInfo.
5503 * ecore.cs (SimpleName): Use new
5505 * support.cs (ReflectionParamter.ParameterType): We unwrap the
5506 type, as we return the actual parameter ref/unref state on a
5509 2002-10-30 Miguel de Icaza <miguel@ximian.com>
5511 * support.cs: Return proper flags REF/OUT fixing the previous
5514 * expression.cs: Reverted last patch, that was wrong. Is_ref is
5515 not used to mean `ref' but `ref or out' in ParameterReference
5517 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
5518 full type signature instead of calling TypeManger.CSharpName
5521 * support.cs (InternalParameters.ParameterDesc): Do not compare
5522 directly to the modflags, because REF/OUT will actually be bitsets
5525 * delegate.cs (VerifyMethod): Check also the modifiers.
5527 * cs-tokenizer.cs: Fix bug where floating point values with an
5528 exponent where a sign was missing was ignored.
5530 * driver.cs: Allow multiple assemblies to be specified in a single
5533 2002-10-28 Miguel de Icaza <miguel@ximian.com>
5535 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
5536 because identifiers after a parenthesis would end up in this kind
5537 of production, and we needed to desamiguate it for having casts
5540 (UserDefinedType *) xxx
5542 2002-10-24 Miguel de Icaza <miguel@ximian.com>
5544 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
5545 we should set on the Bindingflags.NonPublic, but not turn on
5546 private_ok. private_ok controls whether a Private member is
5547 returned (this is chekced on the filter routine), while the
5548 BindingFlags.NonPublic just controls whether private/protected
5549 will be allowed. This fixes the problem part of the problem of
5550 private properties being allowed to be used in derived classes.
5552 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
5553 so we can call the children DoResolveLValue method (this will
5554 properly signal errors on lvalue assignments to base properties)
5556 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
5557 getter are null, and we have a property info, we know that this
5558 happened because the lookup failed, so we report an error 122 for
5559 protection level violation.
5561 We also silently return if setter and getter are null in the
5562 resolve functions, this condition only happens if we have flagged
5563 the error before. This is the other half of the problem.
5565 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
5566 not have accessibility information, that is why we were returning
5567 true in the filter function in typemanager.cs.
5569 To properly report 122 (property is inaccessible because of its
5570 protection level) correctly, we report this error in ResolveAccess
5571 by failing if both the setter and the getter are lacking (ie, the
5574 DoResolve and DoLResolve have been modified to check for both
5575 setter/getter being null and returning silently, the reason being
5576 that I did not want to put the knowledge about this error in upper
5579 int old = Report.Errors;
5580 x = new PropertyExpr (...);
5581 if (old != Report.Errors)
5586 So the property expr is returned, but it is invalid, so the error
5587 will be flagged during the resolve process.
5589 * class.cs: Remove InheritablePropertySignatureCompare from the
5590 class, as we no longer depend on the property signature to compute
5591 whether it is possible to implement a method or not.
5593 The reason is that calling PropertyInfo.GetGetMethod will return
5594 null (in .NET, in Mono it works, and we should change this), in
5595 cases where the Get Method does not exist in that particular
5600 class X { public virtual int A { get { return 1; } } }
5602 class Z : Y { public override int A { get { return 2; } } }
5604 Would fail in Z because the parent (Y) would not have the property
5605 defined. So we avoid this completely now (because the alternative
5606 fix was ugly and slow), and we now depend exclusively on the
5609 (PropertyBase.CheckBase): Use a method-base mechanism to find our
5610 reference method, instead of using the property.
5612 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
5613 routines are gone now.
5615 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
5616 names, they were incorrectly named.
5618 * cs-tokenizer.cs: Return are more gentle token on failure.
5620 * pending.cs (PendingImplementation.InterfaceMethod): This routine
5621 had an out-of-sync index variable, which caused it to remove from
5622 the list of pending methods the wrong method sometimes.
5624 2002-10-22 Miguel de Icaza <miguel@ximian.com>
5626 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5627 CanWrite, because those refer to this particular instance of the
5628 property, and do not take into account the fact that we can
5629 override single members of a property.
5631 Constructor requires an EmitContext. The resolution process does
5632 not happen here, but we need to compute the accessors before,
5633 because the resolution does not always happen for properties.
5635 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5636 subclass, before we did not update this flag, but we did update
5639 (GetAccessors): Drop this routine, as it did not work in the
5640 presence of partially overwritten set/get methods.
5642 Notice that this broke the cs1540 detection, but that will require
5645 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5649 * driver.cs: issue a warning instead of an error if we don't support
5650 debugging for the platform. Also ignore a couple of errors that may
5651 arise when trying to write the symbols. Undo my previous patch.
5653 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5655 * driver.cs: ignore /debug switch except for Unix platforms.
5657 2002-10-23 Nick Drochak <ndrochak@gol.com>
5659 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5661 2002-10-21 Miguel de Icaza <miguel@ximian.com>
5663 * driver.cs: Do not make mcs-debug conditional, so we do not break
5666 * statement.cs (UsageVector.MergeChildren): I would like Martin to
5667 review this patch. But basically after all the children variables
5668 have been merged, the value of "Breaks" was not being set to
5669 new_breaks for Switch blocks. I think that it should be set after
5670 it has executed. Currently I set this to the value of new_breaks,
5671 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5672 conservative, but I do not understand this code very well.
5674 I did not break anything in the build, so that is good ;-)
5676 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5678 2002-10-20 Mark Crichton <crichton@gimp.org>
5680 * cfold.cs: Fixed compile blocker. Really fixed it this time.
5682 2002-10-20 Nick Drochak <ndrochak@gol.com>
5684 * cfold.cs: Fixed compile blocker.
5686 2002-10-20 Miguel de Icaza <miguel@ximian.com>
5688 * driver.cs: I was chekcing the key, not the file.
5690 2002-10-19 Ravi Pratap <ravi@ximian.com>
5692 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5693 message that we were generating - we just need to silently return
5696 2002-10-19 Miguel de Icaza <miguel@ximian.com>
5698 * class.cs (Event.Define): Change my previous commit, as this
5699 breaks the debugger. This is a temporary hack, as it seems like
5700 the compiler is generating events incorrectly to begin with.
5702 * expression.cs (Binary.ResolveOperator): Added support for
5703 "U operator - (E x, E y)"
5705 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5708 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5709 init-only variables, but this path did not take into account that
5710 there might be also instance readonly variables. Correct this
5713 This fixes bug 32253
5715 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5718 * driver.cs: Change the extension for modules to `netmodule'
5720 * cs-parser.jay: Improved slightly the location tracking for
5721 the debugger symbols.
5723 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5724 modifiers that were specified instead of the hardcoded value
5725 (FamAndAssem). This was basically ignoring the static modifier,
5726 and others. Fixes 32429.
5728 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5729 fixed a bug in the process (32476)
5731 * expression.cs (ArrayAccess.EmitAssign): Patch from
5732 hwang_rob@yahoo.ca that fixes bug 31834.3
5734 2002-10-18 Miguel de Icaza <miguel@ximian.com>
5736 * driver.cs: Make the module extension .netmodule.
5738 2002-10-16 Miguel de Icaza <miguel@ximian.com>
5740 * driver.cs: Report an error if the resource file is not found
5741 instead of crashing.
5743 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5744 false, like Emit does.
5746 2002-10-16 Nick Drochak <ndrochak@gol.com>
5748 * typemanager.cs: Remove unused private member. Also reported mcs
5749 bug to report this as a warning like csc.
5751 2002-10-15 Martin Baulig <martin@gnome.org>
5753 * statement.cs (Statement.Emit): Made this a virtual method; emits
5754 the line number info and calls DoEmit().
5755 (Statement.DoEmit): New protected abstract method, formerly knows
5756 as Statement.Emit().
5758 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5760 2002-10-11 Miguel de Icaza <miguel@ximian.com>
5762 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5763 have fixed a remaining problem: not every AddXXXX was adding a
5764 fully qualified name.
5766 Now everyone registers a fully qualified name in the DeclSpace as
5767 being defined instead of the partial name.
5769 Downsides: we are slower than we need to be due to the excess
5770 copies and the names being registered this way.
5772 The reason for this is that we currently depend (on the corlib
5773 bootstrap for instance) that types are fully qualified, because
5774 we dump all the types in the namespace, and we should really have
5775 types inserted into the proper namespace, so we can only store the
5776 basenames in the defined_names array.
5778 2002-10-10 Martin Baulig <martin@gnome.org>
5780 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5781 from bug #31834, see the bug report for a testcase which is
5784 2002-10-10 Martin Baulig <martin@gnome.org>
5786 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5787 flow analysis code for this.
5789 * statement.cs (Do, While, For): Tell the flow analysis code about
5791 (FlowBranching.UsageVector): Added support for infinite loops.
5792 (Block.Resolve): Moved the dead code elimination here and use flow
5795 2002-10-09 Miguel de Icaza <miguel@ximian.com>
5797 * class.cs (Field.Define): Catch cycles on struct type
5800 * typemanager.cs (IsUnmanagedtype): Do not recursively check
5801 fields if the fields are static. We only need to check instance
5804 * expression.cs (As.DoResolve): Test for reference type.
5806 * statement.cs (Using.ResolveExpression): Use
5807 ConvertImplicitRequired, not ConvertImplicit which reports an
5809 (Using.ResolveLocalVariableDecls): ditto.
5811 * expression.cs (Binary.ResolveOperator): Report errors in a few
5812 places where we had to.
5814 * typemanager.cs (IsUnmanagedtype): Finish implementation.
5816 2002-10-08 Miguel de Icaza <miguel@ximian.com>
5818 * expression.cs: Use StoreFromPtr instead of extracting the type
5819 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
5821 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5822 an enumeration value to a System.Enum, but System.Enum is not a
5823 value type, but an class type, so we need to box.
5825 (Expression.ConvertExplicit): One codepath could return
5826 errors but not flag them. Fix this. Fixes #31853
5828 * parameter.cs (Resolve): Do not allow void as a parameter type.
5830 2002-10-06 Martin Baulig <martin@gnome.org>
5832 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5833 if it's a class type and not a struct. Fixes #31815.
5835 2002-10-06 Martin Baulig <martin@gnome.org>
5837 * statement.cs: Reworked the flow analysis code a bit to make it
5838 usable for dead code elimination.
5840 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5842 * cs-parser.jay: allow empty source files. Fixes bug #31781.
5844 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5846 * expression.cs (ComposedCast.DoResolveType): A quick workaround
5847 to fix the test 165, will investigate deeper.
5849 2002-10-04 Martin Baulig <martin@gnome.org>
5851 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5852 finally blocks actually work.
5853 (Try.Resolve): We don't need to create a sibling for `finally' if
5854 there is no finally block.
5856 2002-10-04 Martin Baulig <martin@gnome.org>
5858 * class.cs (Constructor.Define): The default accessibility for a
5859 non-default constructor is private, not public.
5861 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5863 * class.cs (Constructor): Make AllowedModifiers public, add
5866 * cs-parser.jay: Perform the modifiers test here, as the
5867 constructor for the Constructor class usually receives a zero
5868 because of the way we create it (first we create, later we
5869 customize, and we were never checking the modifiers).
5871 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5872 is a version of LookupTypeReflection that includes the type-name
5873 cache. This can be used as a fast path for functions that know
5874 the fully qualified name and are only calling into *.GetType() to
5875 obtain a composed type.
5877 This is also used by TypeManager.LookupType during its type
5880 (LookupType): We now also track the real type name, as sometimes
5881 we can get a quey for the real type name from things like
5882 ComposedCast. This fixes bug 31422.
5884 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5885 complete type fullname, it does not have to go through the type
5886 resolution system to obtain the composed version of the type (for
5887 obtaining arrays or pointers).
5889 (Conditional.Emit): Use the EmitBoolExpression to
5890 generate nicer code, as requested by Paolo.
5892 (ArrayCreation.CheckIndices): Use the patch from
5893 hwang_rob@yahoo.ca to validate the array initializers.
5895 2002-10-03 Miguel de Icaza <miguel@ximian.com>
5897 * class.cs (ConstructorInitializer.Emit): simplify code by using
5898 Invocation.EmitCall, and at the same time, fix the bugs in calling
5899 parent constructors that took variable arguments.
5901 * ecore.cs (Expression.ConvertNumericExplicit,
5902 Expression.ImplicitNumericConversion): Remove the code that
5903 manually wrapped decimal (InternalTypeConstructor call is now gone
5906 * expression.cs (Cast.TryReduce): Also handle decimal types when
5907 trying to perform a constant fold on the type.
5909 * typemanager.cs (IsUnmanagedtype): Partially implemented.
5911 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5912 that only turned off an error report, and did nothing else.
5914 2002-10-02 Miguel de Icaza <miguel@ximian.com>
5916 * driver.cs: Handle and ignore /fullpaths
5918 2002-10-01 Miguel de Icaza <miguel@ximian.com>
5920 * expression.cs (Binary.ResolveOperator): Catch the case where
5921 DoNumericPromotions returns true,
5923 (Binary.DoNumericPromotions): Simplify the code, and the tests.
5925 2002-09-27 Miguel de Icaza <miguel@ximian.com>
5927 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
5930 2002-09-26 Miguel de Icaza <miguel@ximian.com>
5932 * ecore.cs (ConvertNumericExplicit): It is not enough that the
5933 conversion exists, but it is also required that the conversion be
5934 performed. This manifested in "(Type64Enum) 2".
5936 * class.cs (TypeManager.AddMethod): The fix is not to change
5937 AddEnum, because that one was using a fully qualified name (every
5938 DeclSpace derivative does), but to change the AddMethod routine
5939 that was using an un-namespaced name. This now correctly reports
5940 the duplicated name.
5942 Revert patch until I can properly fix it. The issue
5943 is that we have a shared Type space across all namespaces
5944 currently, which is wrong.
5946 Options include making the Namespace a DeclSpace, and merge
5947 current_namespace/current_container in the parser.
5949 2002-09-25 Miguel de Icaza <miguel@ximian.com>
5951 * cs-parser.jay: Improve error reporting when we get a different
5952 kind of expression in local_variable_type and
5953 local_variable_pointer_type.
5955 Propagate this to avoid missleading errors being reported.
5957 * ecore.cs (ImplicitReferenceConversion): treat
5958 TypeManager.value_type as a target just like object_type. As
5963 Is valid, and needs to result in the int 1 being boxed before it
5964 is assigned to the value type v.
5966 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
5967 to validate the enumeration name.
5969 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
5970 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
5971 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
5973 * ecore.cs (TryImplicitIntConversion): When doing an
5974 implicit-enumeration-conversion, check if the type is 64-bits and
5975 perform a conversion before passing to EnumConstant.
5977 2002-09-23 Miguel de Icaza <miguel@ximian.com>
5979 * decl.cs (Error_AmbiguousTypeReference); New routine used to
5980 report ambiguous type references. Unlike the MS version, we
5981 report what the ambiguity is. Innovation at work ;-)
5983 (DeclSpace.FindType): Require a location argument to
5984 display when we display an ambiguous error.
5986 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
5988 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
5990 * expression.cs (EmitDynamicInitializers): Apply patch from
5991 hwang_rob@yahoo.ca that fixes the order in which we emit our
5994 2002-09-21 Martin Baulig <martin@gnome.org>
5996 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
5997 delegate takes no arguments.
5999 2002-09-20 Miguel de Icaza <miguel@ximian.com>
6001 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
6004 * expression.cs: Extract the underlying type.
6006 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
6008 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
6010 2002-09-19 Miguel de Icaza <miguel@ximian.com>
6012 * class.cs (TypeContainer.DefineType): We can not use the nice
6013 PackingSize with the size set to 1 DefineType method, because it
6014 will not allow us to define the interfaces that the struct
6017 This completes the fixing of bug 27287
6019 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
6020 means also structs. This fixes part of the problem.
6021 (Expresion.ImplicitReferenceConversionExists): ditto.
6023 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
6024 error if there were no errors reported during the type lookup
6025 process, to avoid duplicates or redundant errors. Without this
6026 you would get an ambiguous errors plus a type not found. We have
6027 beaten the user enough with the first error.
6029 (DeclSparce.FindType): Emit a warning if we have an ambiguous
6032 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
6033 during the resolution process, stop the lookup, this avoids
6034 repeated error reports (same error twice).
6036 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
6038 * typemanager.cs (LookupType): Redo the type lookup code to match
6039 the needs of System.Reflection.
6041 The issue is that System.Reflection requires references to nested
6042 types to begin with a "+" sign instead of a dot. So toplevel
6043 types look like: "NameSpace.TopLevelClass", and nested ones look
6044 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
6047 2002-09-19 Martin Baulig <martin@gnome.org>
6049 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
6050 says that a method always returns or always throws an exception,
6051 don't report the CS0161.
6053 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
6054 set `Returns = new_returns'.
6056 2002-09-19 Martin Baulig <martin@gnome.org>
6058 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
6059 to an enum constant, check for a CS0176.
6061 2002-09-18 Miguel de Icaza <miguel@ximian.com>
6063 * class.cs (TypeContainer.CheckPairedOperators): Now we check
6064 for operators that must be in pairs and report errors.
6066 * ecore.cs (SimpleName.DoResolveType): During the initial type
6067 resolution process, when we define types recursively, we must
6068 check first for types in our current scope before we perform
6069 lookups in the enclosing scopes.
6071 * expression.cs (MakeByteBlob): Handle Decimal blobs.
6073 (Invocation.VerifyArgumentsCompat): Call
6074 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
6075 I thought we were supposed to always call this, but there are a
6076 few places in the code where we dont do it.
6078 2002-09-17 Miguel de Icaza <miguel@ximian.com>
6080 * driver.cs: Add support in -linkres and -resource to specify the
6081 name of the identifier.
6083 2002-09-16 Miguel de Icaza <miguel@ximian.com>
6085 * ecore.cs (StandardConversionExists): Sync with the conversion
6086 code: allow anything-* to void* conversions.
6088 (FindMostSpecificSource): Use an Expression argument
6089 instead of a Type, because we might be handed over a Literal which
6090 gets a few more implicit conversions that plain types do not. So
6091 this information was being lost.
6093 Also, we drop the temporary type-holder expression when not
6096 2002-09-17 Martin Baulig <martin@gnome.org>
6098 * class.cs (PropertyBase.CheckBase): Don't check the base class if
6099 this is an explicit interface implementation.
6101 2002-09-17 Martin Baulig <martin@gnome.org>
6103 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
6104 different `IndexerName' attributes.
6106 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
6107 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
6108 virtual CommonResolve().
6110 2002-09-16 Miguel de Icaza <miguel@ximian.com>
6112 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
6113 and convert that to the UnderlyingType.
6115 * statement.cs (Foreach.Resolve): Indexers are just like variables
6116 or PropertyAccesses.
6118 * cs-tokenizer.cs (consume_string): Track line numbers and columns
6119 inside quoted strings, we were not doing this before.
6121 2002-09-16 Martin Baulig <martin@gnome.org>
6123 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
6124 resolve it. This is needed for the definite assignment check of the
6125 instance expression, fixes bug #29846.
6126 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
6128 2002-09-16 Nick Drochak <ndrochak@gol.com>
6130 * parameter.cs: Fix compile error. Cannot reference static member
6131 from an instance object. Is this an mcs bug?
6133 2002-09-14 Martin Baulig <martin@gnome.org>
6135 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
6136 multiple times. Fixes bug #30295, added test-166.cs.
6138 2002-09-14 Martin Baulig <martin@gnome.org>
6140 * statement.cs (Block.Emit): Don't emit unreachable code.
6141 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
6143 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
6145 2002-09-14 Martin Baulig <martin@gnome.org>
6147 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
6150 2002-09-14 Martin Baulig <martin@gnome.org>
6152 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
6153 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
6154 be false on the ms runtime.
6156 2002-09-13 Martin Baulig <martin@gnome.org>
6158 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
6159 the CS0038 error message.
6161 2002-09-12 Miguel de Icaza <miguel@ximian.com>
6163 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
6164 constant inside, return it.
6166 2002-09-12 Martin Baulig <martin@gnome.org>
6168 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
6169 implicit conversion can be done between enum types.
6171 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
6172 check whether an implicit conversion to the current enum's UnderlyingType
6173 exists and report an error if not.
6175 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
6176 without debugging support.
6178 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
6179 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
6181 2002-09-12 Martin Baulig <martin@gnome.org>
6183 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
6185 * ecore.cs (IMemberExpr.DeclaringType): New property.
6186 (SimpleName.SimpleNameResolve): Check whether we're accessing a
6187 nonstatic member of an outer type (CS0038).
6189 2002-09-11 Miguel de Icaza <miguel@ximian.com>
6191 * driver.cs: Activate the using-error detector at warning level
6192 4 (at least for MS-compatible APIs).
6194 * namespace.cs (VerifyUsing): Small buglett fix.
6196 * pending.cs (PendingImplementation): pass the container pointer.
6198 * interface.cs (GetMethods): Allow for recursive definition. Long
6199 term, I would like to move every type to support recursive
6200 definitions, not the current ordering mechanism that we have right
6203 The situation is this: Attributes are handled before interfaces,
6204 so we can apply attributes to interfaces. But some attributes
6205 implement interfaces, we will now handle the simple cases
6206 (recursive definitions will just get an error).
6208 * parameter.cs: Only invalidate types at the end if we fail to
6211 2002-09-09 Martin Baulig <martin@gnome.org>
6213 * ecore.cs (PropertyExpr.Emit): Also check for
6214 TypeManager.system_int_array_get_length so this'll also work when
6215 compiling corlib. Fixes #30003.
6217 2002-09-09 Martin Baulig <martin@gnome.org>
6219 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
6220 and throw an exception if we can't get the type's size. Fixed #30040,
6223 2002-09-09 Martin Baulig <martin@gnome.org>
6225 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
6227 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
6228 context. Fixes bug #30027.
6230 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
6231 virtual functions. Fixes bug #30043, added test-164.cs.
6233 2002-09-08 Ravi Pratap <ravi@ximian.com>
6235 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
6237 2002-09-08 Nick Drochak <ndrochak@gol.com>
6239 * driver.cs: Use an object to get the windows codepage since it's not a
6242 2002-09-08 Miguel de Icaza <miguel@ximian.com>
6244 * statement.cs (For.Emit): for infinite loops (test == null)
6245 return whether there is a break inside, not always "true".
6247 * namespace.cs (UsingEntry): New struct to hold the name of the
6248 using definition, the location where it is defined, and whether it
6249 has been used in a successful type lookup.
6251 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
6256 2002-09-06 Ravi Pratap <ravi@ximian.com>
6258 * attribute.cs : Fix incorrect code which relied on catching
6259 a NullReferenceException to detect a null being passed in
6260 where an object was expected.
6262 2002-09-06 Miguel de Icaza <miguel@ximian.com>
6264 * statement.cs (Try): flag the catch variable as assigned
6266 * expression.cs (Cast): Simplified by using ResolveType instead of
6269 * statement.cs (Catch): Fix bug by using ResolveType.
6271 2002-09-06 Ravi Pratap <ravi@ximian.com>
6273 * expression.cs (BetterConversion): Special case for when we have
6274 a NullLiteral as the argument and we have to choose between string
6275 and object types - we choose string the way csc does.
6277 * attribute.cs (Attribute.Resolve): Catch the
6278 NullReferenceException and report error #182 since the Mono
6279 runtime no more has the bug and having this exception raised means
6280 we tried to select a constructor which takes an object and is
6283 2002-09-05 Ravi Pratap <ravi@ximian.com>
6285 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
6286 message (1502, 1503) when we can't locate a method after overload
6287 resolution. This is much more informative and closes the bug
6290 * interface.cs (PopulateMethod): Return if there are no argument
6291 types. Fixes a NullReferenceException bug.
6293 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
6294 expressions too. Previously we were checking only in one place for
6295 positional arguments leaving out named arguments.
6297 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
6298 type to the enum type is not allowed. Remove code corresponding to
6301 (ConvertNumericExplicit): Allow explicit conversions from
6302 the underlying type to enum type. This precisely follows the spec
6303 and closes a bug filed by Gonzalo.
6305 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6308 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
6310 2002-09-03 Miguel de Icaza <miguel@ximian.com>
6312 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
6313 it was important that we stored the right value after the
6314 reduction in `converted'.
6316 2002-09-04 Martin Baulig <martin@gnome.org>
6318 * location.cs (Location.SymbolDocument): Use full pathnames for the
6321 2002-08-30 Miguel de Icaza <miguel@ximian.com>
6323 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
6324 of the expression resolve mechanism, because that will catch the
6325 SimpleName error failures.
6327 (Conditional): If we can not resolve the
6328 expression, return, do not crash.
6330 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6333 (location): display token name instead of its number.
6335 2002-08-28 Martin Baulig <martin@gnome.org>
6337 * expression.cs (Binary.ResolveOperator): Don't silently return
6338 but return an error if an operator cannot be applied between two
6341 2002-08-28 Martin Baulig <martin@gnome.org>
6343 * class.cs (Constructor.Define): Set the permission attributes
6344 correctly instead of making all constructors public.
6346 2002-08-28 Martin Baulig <martin@gnome.org>
6348 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
6349 for private members before reporting a CS0103; if we find anything,
6352 2002-08-28 Martin Baulig <martin@gnome.org>
6354 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
6355 to check whether `closure_start_type == closure_invocation_type',
6356 we also need to check whether `m.DeclaringType == closure_invocation_type'
6357 before bypassing the permission checks. We might be accessing
6358 protected/private members from the base class.
6359 (TypeManager.RealMemberLookup): Only set private_ok if private
6360 members were requested via BindingFlags.NonPublic.
6362 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
6364 * expression.cs (MemberAccess.ResolveMemberAccess): Set
6365 MethodGroupExpr.IsExplicitImpl if appropriate.
6366 (Invocation.DoResolve): Don't report the CS0120 for explicit
6367 interface implementations.
6369 2002-08-27 Martin Baulig <martin@gnome.org>
6371 * expression.cs (Invocation.DoResolve): If this is a static
6372 method and we don't have an InstanceExpression, we must report
6375 2002-08-25 Martin Baulig <martin@gnome.org>
6377 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
6378 `==' between a valuetype and an object.
6380 2002-08-25 Miguel de Icaza <miguel@ximian.com>
6382 * ecore.cs (TypeExpr): Provide a ToString method.
6384 2002-08-24 Martin Baulig <martin@gnome.org>
6386 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
6387 now called proggie.dbg and it's a binary file.
6389 2002-08-23 Martin Baulig <martin@gnome.org>
6391 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
6393 2002-08-23 Martin Baulig <martin@gnome.org>
6395 * struct.cs (MyStructInfo.ctor): Make this work with empty
6396 structs; it's not allowed to use foreach() on null.
6398 2002-08-23 Martin Baulig <martin@gnome.org>
6400 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
6401 writer the full pathname of the generated assembly.
6403 2002-08-23 Martin Baulig <martin@gnome.org>
6405 * statements.cs (FlowBranching.UsageVector.MergeChildren):
6406 A `finally' block never returns or breaks; improved handling of
6409 2002-08-23 Martin Baulig <martin@gnome.org>
6411 * statement.cs (Throw.Resolve): Allow `throw null'.
6413 2002-08-23 Martin Baulig <martin@gnome.org>
6415 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
6416 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
6417 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
6418 MemberLookup would return a wrong event if this is an explicit
6419 interface implementation and the class has an event with the same
6422 2002-08-23 Martin Baulig <martin@gnome.org>
6424 * statement.cs (Block.AddChildVariableNames): New public method.
6425 (Block.AddChildVariableName): Likewise.
6426 (Block.IsVariableNameUsedInChildBlock): Likewise.
6427 (Block.AddVariable): Check whether a variable name has already
6428 been used in a child block.
6430 * cs-parser.jay (declare_local_variables): Mark all variable names
6431 from the current block as being used in a child block in the
6434 2002-08-23 Martin Baulig <martin@gnome.org>
6436 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
6437 find the symbol writer.
6439 * driver.cs: csc also allows the arguments to /define being
6440 separated by commas, not only by semicolons.
6442 2002-08-23 Martin Baulig <martin@gnome.org>
6444 * interface.cs (Interface.GetMembers): Added static check for events.
6446 2002-08-15 Martin Baulig <martin@gnome.org>
6448 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
6449 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
6451 * ecore.cs (Expression.MemberLookup): Added documentation and explained
6452 why the MethodData.EmitDestructor() change was necessary.
6454 2002-08-20 Martin Baulig <martin@gnome.org>
6456 * class.cs (TypeContainer.FindMembers): Added static check for events.
6458 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
6460 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
6461 use Type.GetEvents(), not Type.FindMembers().
6463 2002-08-20 Martin Baulig <martin@gnome.org>
6465 * decl.cs (MemberCache): Added a special method cache which will
6466 be used for method-only searched. This ensures that a method
6467 search will return a MethodInfo with the correct ReflectedType for
6470 2002-08-20 Martin Baulig <martin@gnome.org>
6472 * decl.cs (DeclSpace.FindMembers): Made this public.
6474 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6476 * delegate.cs: fixed build on windows.
6477 [FIXME: Filed as bug #29150: MCS must report these errors.]
6479 2002-08-19 Ravi Pratap <ravi@ximian.com>
6481 * ecore.cs (StandardConversionExists): Return a false
6482 if we are trying to convert the void type to anything else
6483 since that is not allowed.
6485 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
6486 we flag error 70 in the event an event is trying to be accessed
6487 directly from outside the declaring type.
6489 2002-08-20 Martin Baulig <martin@gnome.org>
6491 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
6492 MemberCache from typemanager.cs to decl.cs.
6494 2002-08-19 Martin Baulig <martin@gnome.org>
6496 * class.cs (TypeContainer): Implement IMemberContainer.
6497 (TypeContainer.DefineMembers): Create the MemberCache.
6498 (TypeContainer.FindMembers): Do better BindingFlags checking; only
6499 return public members if BindingFlags.Public was given, check
6500 whether members are static.
6502 2002-08-16 Martin Baulig <martin@gnome.org>
6504 * decl.cs (DeclSpace.Define): Splitted this in Define and
6505 DefineMembers. DefineMembers is called first and initializes the
6508 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
6509 DefineMembers() on all our DeclSpaces.
6511 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
6512 but call DefineMembers() on all nested interfaces. We call their
6513 Define() in our new Define() function.
6515 * interface.cs (Interface): Implement IMemberContainer.
6516 (Interface.Define): Moved all code except the attribute stuf to
6518 (Interface.DefineMembers): Initialize the member cache.
6520 * typemanager.cs (IMemberFinder): Removed this interface, we don't
6521 need this anymore since we can use MemberCache.FindMembers directly.
6523 2002-08-19 Martin Baulig <martin@gnome.org>
6525 * typemanager.cs (MemberCache): When creating the cache for an
6526 interface type, add all inherited members.
6527 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
6528 to `out bool used_cache' and documented it.
6529 (TypeManager.MemberLookup): If we already used the cache in the first
6530 iteration, we don't need to do the interfaces check.
6532 2002-08-19 Martin Baulig <martin@gnome.org>
6534 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
6535 here from IMemberFinder and don't implement this interface anymore.
6536 (DeclSpace.MemberCache): Moved here from IMemberFinder.
6538 * typemanager.cs (IMemberFinder): This interface is now only used by
6539 classes which actually support the member cache.
6540 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
6541 since we only put DeclSpaces into this Hashtable.
6542 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
6543 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
6545 2002-08-16 Martin Baulig <martin@gnome.org>
6547 * typemanager.cs (ICachingMemberFinder): Removed.
6548 (IMemberFinder.MemberCache): New property.
6549 (TypeManager.FindMembers): Merged this with RealFindMembers().
6550 This function will never be called from TypeManager.MemberLookup()
6551 so we can't use the cache here, just the IMemberFinder.
6552 (TypeManager.MemberLookup_FindMembers): Check whether the
6553 IMemberFinder has a MemberCache and call the cache's FindMembers
6555 (MemberCache): Rewrote larger parts of this yet another time and
6556 cleaned it up a bit.
6558 2002-08-15 Miguel de Icaza <miguel@ximian.com>
6560 * driver.cs (LoadArgs): Support quoting.
6562 (Usage): Show the CSC-like command line arguments.
6564 Improved a few error messages.
6566 2002-08-15 Martin Baulig <martin@gnome.org>
6568 * typemanager.cs (IMemberContainer.Type): New property.
6569 (IMemberContainer.IsInterface): New property.
6571 The following changes are conditional to BROKEN_RUNTIME, which is
6572 defined at the top of the file.
6574 * typemanager.cs (MemberCache.MemberCache): Don't add the base
6575 class'es members, but add all members from TypeHandle.ObjectType
6576 if we're an interface.
6577 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
6578 is the current type.
6579 (MemberCache.CacheEntry.Container): Removed this field.
6580 (TypeHandle.GetMembers): Include inherited members.
6582 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6584 * typemanager.cs: fixed compilation and added a comment on a field that
6587 2002-08-15 Martin Baulig <martin@gnome.org>
6589 * class.cs (ConstructorInitializer.Resolve): In the
6590 Expression.MemberLookup call, use the queried_type as
6593 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
6594 declared' attribute, it's always true.
6595 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
6596 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
6597 temporary wrapper for FindMembers which tells MemberLookup whether
6598 members from the base classes are included in the return value.
6599 This will go away soon.
6600 (TypeManager.MemberLookup): Use this temporary hack here; once the
6601 new MemberCache is completed, we don't need to do the DeclaredOnly
6602 looping here anymore since the MemberCache will take care of this.
6603 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
6604 (MemberCache): When creating the MemberCache for a class, get
6605 members from the current class and all its base classes.
6606 (MemberCache.CacheEntry.Container): New field. This is a
6607 temporary hack until the Mono runtime is fixed to distinguish
6608 between ReflectedType and DeclaringType. It allows us to use MCS
6609 with both the MS runtime and the unfixed Mono runtime without
6610 problems and without accecting performance.
6611 (MemberCache.SearchMembers): The DeclaredOnly looping from
6612 TypeManager.MemberLookup is now done here.
6614 2002-08-14 Martin Baulig <martin@gnome.org>
6616 * statement.cs (MyStructInfo.MyStructInfo): Don't call
6617 Type.GetFields on dynamic types but get the fields from the
6618 corresponding TypeContainer.
6619 (MyStructInfo.GetStructInfo): Added check for enum types.
6621 * typemanager.cs (MemberList.IsSynchronized): Implemented.
6622 (MemberList.SyncRoot): Implemented.
6623 (TypeManager.FilterWithClosure): No need to check permissions if
6624 closure_start_type == closure_invocation_type, don't crash if
6625 closure_invocation_type is null.
6627 2002-08-13 Martin Baulig <martin@gnome.org>
6629 Rewrote TypeContainer.FindMembers to use a member cache. This
6630 gives us a speed increase of about 35% for the self-hosting MCS
6631 build and of about 15-20% for the class libs (both on GNU/Linux).
6633 * report.cs (Timer): New class to get enhanced profiling. This
6634 whole class is "TIMER" conditional since it remarkably slows down
6637 * class.cs (MemberList): New class. This is an IList wrapper
6638 which we're now using instead of passing MemberInfo[]'s around to
6639 avoid copying this array unnecessarily.
6640 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6641 (ICachingMemberFinder, IMemberContainer): New interface.
6642 (TypeManager.FilterWithClosure): If `criteria' is null, the name
6643 has already been checked, otherwise use it for the name comparision.
6644 (TypeManager.FindMembers): Renamed to RealMemberFinder and
6645 provided wrapper which tries to use ICachingMemberFinder.FindMembers
6646 if possible. Returns a MemberList, not a MemberInfo [].
6647 (TypeHandle): New class, implements IMemberContainer. We create
6648 one instance of this class per type, it contains a MemberCache
6649 which is used to do the member lookups.
6650 (MemberCache): New class. Each instance of this class contains
6651 all members of a type and a name-based hash table.
6652 (MemberCache.FindMembers): This is our new member lookup
6653 function. First, it looks up all members of the requested name in
6654 the hash table. Then, it walks this list and sorts out all
6655 applicable members and returns them.
6657 2002-08-13 Martin Baulig <martin@gnome.org>
6659 In addition to a nice code cleanup, this gives us a performance
6660 increase of about 1.4% on GNU/Linux - not much, but it's already
6661 half a second for the self-hosting MCS compilation.
6663 * typemanager.cs (IMemberFinder): New interface. It is used by
6664 TypeManager.FindMembers to call FindMembers on a TypeContainer,
6665 Enum, Delegate or Interface.
6666 (TypeManager.finder_to_member_finder): New PtrHashtable.
6667 (TypeManager.finder_to_container): Removed.
6668 (TypeManager.finder_to_delegate): Removed.
6669 (TypeManager.finder_to_interface): Removed.
6670 (TypeManager.finder_to_enum): Removed.
6672 * interface.cs (Interface): Implement IMemberFinder.
6674 * delegate.cs (Delegate): Implement IMemberFinder.
6676 * enum.cs (Enum): Implement IMemberFinder.
6678 * class.cs (TypeContainer): Implement IMemberFinder.
6680 2002-08-12 Martin Baulig <martin@gnome.org>
6682 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6684 2002-08-12 Martin Baulig <martin@gnome.org>
6686 * ecore.cs (ITypeExpression): New interface for expressions which
6688 (TypeExpression): Renamed to TypeLookupExpression.
6689 (Expression.DoResolve): If we're doing a types-only lookup, the
6690 expression must implement the ITypeExpression interface and we
6691 call DoResolveType() on it.
6692 (SimpleName): Implement the new ITypeExpression interface.
6693 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6694 hack, the situation that we're only looking up types can't happen
6695 anymore when this method is called. Moved the type lookup code to
6696 DoResolveType() and call it.
6697 (SimpleName.DoResolveType): This ITypeExpression interface method
6698 is now doing the types-only lookup.
6699 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6700 (ResolveFlags): Added MaskExprClass.
6702 * expression.cs (MemberAccess): Implement the ITypeExpression
6704 (MemberAccess.DoResolve): Added support for a types-only lookup
6705 when we're called via ITypeExpression.DoResolveType().
6706 (ComposedCast): Implement the ITypeExpression interface.
6708 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
6709 Expression.Resolve() with ResolveFlags.Type instead.
6711 2002-08-12 Martin Baulig <martin@gnome.org>
6713 * interface.cs (Interface.Define): Apply attributes.
6715 * attribute.cs (Attribute.ApplyAttributes): Added support for
6716 interface attributes.
6718 2002-08-11 Martin Baulig <martin@gnome.org>
6720 * statement.cs (Block.Emit): Only check the "this" variable if we
6721 do not always throw an exception.
6723 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6724 whether the property has a set accessor.
6726 2002-08-11 Martin Baulig <martin@gnome.org>
6728 Added control flow analysis support for structs.
6730 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6731 with control flow analysis turned off.
6732 (IVariable): New interface.
6733 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6734 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6735 (FieldExpr.DoResolve): Resolve the instance expression with flow
6736 analysis turned off and do the definite assignment check after the
6737 resolving when we know what the expression will resolve to.
6739 * expression.cs (LocalVariableReference, ParameterReference):
6740 Implement the new IVariable interface, only call the flow analysis
6741 code if ec.DoFlowAnalysis is true.
6742 (This): Added constructor which takes a Block argument. Implement
6743 the new IVariable interface.
6744 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6745 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6746 This does the definite assignment checks for struct members.
6748 * class.cs (Constructor.Emit): If this is a non-static `struct'
6749 constructor which doesn't have any initializer, call
6750 Block.AddThisVariable() to tell the flow analysis code that all
6751 struct elements must be initialized before control returns from
6754 * statement.cs (MyStructInfo): New public class.
6755 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6756 argument to this indexer. If non-zero, check an individual struct
6757 member, not the whole struct.
6758 (FlowBranching.CheckOutParameters): Check struct members.
6759 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6760 overloaded versions of these methods which take an additional
6761 `int field_idx' argument to check struct members.
6762 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6763 overloaded versions of these methods which take an additional
6764 `string field_name' argument to check struct member.s
6765 (VariableInfo): Implement the IVariable interface.
6766 (VariableInfo.StructInfo): New public property. Returns the
6767 MyStructInfo instance of the variable if it's a struct or null.
6768 (Block.AddThisVariable): New public method. This is called from
6769 Constructor.Emit() for non-static `struct' constructor which do
6770 not have any initializer. It creates a special variable for the
6771 "this" instance variable which will be checked by the flow
6772 analysis code to ensure that all of the struct's fields are
6773 initialized before control returns from the constructor.
6774 (UsageVector): Added support for struct members. If a
6775 variable/parameter is a struct with N members, we reserve a slot
6776 in the usage vector for each member. A struct is considered fully
6777 initialized if either the struct itself (slot 0) or all its
6778 members are initialized.
6780 2002-08-08 Martin Baulig <martin@gnome.org>
6782 * driver.cs (Driver.MainDriver): Only report an error CS5001
6783 if there were no compilation errors.
6785 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6786 `UnsafeContext' property to determine whether the parent is in
6787 unsafe context rather than checking the parent's ModFlags:
6788 classes nested in an unsafe class are unsafe as well.
6790 2002-08-08 Martin Baulig <martin@gnome.org>
6792 * statement.cs (UsageVector.MergeChildren): Distinguish between
6793 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6794 we return. Added test17() and test18() to test-154.cs.
6796 2002-08-08 Martin Baulig <martin@gnome.org>
6798 * typemanager.cs (TypeManager.FilterWithClosure): If we have
6799 Family access, make sure the invoking type isn't a subclass of the
6800 queried type (that'd be a CS1540).
6802 * ecore.cs (Expression.MemberLookup): Added overloaded version of
6803 this method which takes an additional `Type invocation_type'.
6805 * expression.cs (BaseAccess.DoResolve): Use the base type as
6806 invocation and query type.
6807 (MemberAccess.DoResolve): If the lookup failed and we're about to
6808 report a CS0122, try a lookup with the ec.ContainerType - if this
6809 succeeds, we must report a CS1540.
6811 2002-08-08 Martin Baulig <martin@gnome.org>
6813 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6814 (MethodGroupExpr): Implement the IMemberExpr interface.
6816 * expression (MemberAccess.ResolveMemberAccess): No need to have
6817 any special code for MethodGroupExprs anymore, they're now
6820 2002-08-08 Martin Baulig <martin@gnome.org>
6822 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6823 Family, FamANDAssem and FamORAssem permissions.
6824 (TypeManager.IsSubclassOrNestedChildOf): New public method.
6826 2002-08-08 Martin Baulig <martin@gnome.org>
6828 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6829 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6832 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6834 * driver.cs: implemented /resource option to embed managed resources.
6836 2002-08-07 Martin Baulig <martin@gnome.org>
6838 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6839 (FieldBase.HasFieldInitializer): New public property.
6840 (FieldBase.GetInitializerExpression): New public method. Resolves and
6841 returns the field initializer and makes sure it is only resolved once.
6842 (TypeContainer.EmitFieldInitializers): Call
6843 FieldBase.GetInitializerExpression to get the initializer, this ensures
6844 that it isn't resolved multiple times.
6846 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
6847 the resolving process (SimpleName/MemberLookup) that we're currently
6848 emitting a field initializer (which must not access any instance members,
6849 this is an error CS0236).
6851 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6852 argument, if the `IsFieldInitializer' flag is set, we must report and
6853 error CS0236 and not an error CS0120.
6855 2002-08-07 Martin Baulig <martin@gnome.org>
6857 * ecore.cs (IMemberExpr): New public interface.
6858 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6859 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6860 if the expression is an IMemberExpr.
6862 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6863 to be null, implicitly default to `this' if we're non-static in
6864 this case. Simplified the code a lot by using the new IMemberExpr
6865 interface. Also fixed bug #28176 here.
6867 2002-08-06 Martin Baulig <martin@gnome.org>
6869 * cs-parser.jay (SimpleLookup): Removed. We need to create
6870 ParameterReferences during semantic analysis so that we can do a
6871 type-only search when resolving Cast, TypeOf and SizeOf.
6872 (block): Pass the `current_local_parameters' to the Block's
6875 * class.cs (ConstructorInitializer): Added `Parameters parameters'
6876 argument to the constructor.
6877 (ConstructorInitializer.Resolve): Create a temporary implicit
6878 block with the parameters.
6880 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6881 references here if we aren't doing a type-only search.
6883 * statement.cs (Block): Added constructor which takes a
6884 `Parameters parameters' argument.
6885 (Block.Parameters): New public property.
6887 * support.cs (InternalParameters.Parameters): Renamed `parameters'
6888 to `Parameters' and made it public readonly.
6890 2002-08-06 Martin Baulig <martin@gnome.org>
6892 * ecore.cs (Expression.Warning): Made this public as well.
6894 * report.cs (Report.Debug): Print the contents of collections.
6896 2002-08-06 Martin Baulig <martin@gnome.org>
6898 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
6899 used to tell Resolve() which kinds of expressions it may return.
6900 (Expression.Resolve): Added overloaded version of this method which
6901 takes a `ResolveFlags flags' argument. This can be used to tell
6902 Resolve() which kinds of expressions it may return. Reports a
6904 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6905 ResolveFlags.SimpleName.
6906 (Expression.Error118): Added overloaded version of this method which
6907 takes a `ResolveFlags flags' argument. It uses the flags to determine
6908 which kinds of expressions are allowed.
6910 * expression.cs (Argument.ResolveMethodGroup): New public method.
6911 Resolves an argument, but allows a MethodGroup to be returned.
6912 This is used when invoking a delegate.
6914 * TODO: Updated a bit.
6916 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6918 Fixed compilation with csc.
6920 * ecore.cs: Expression.Error made public. Is this correct? Should
6921 Warning be made public too?
6923 * expression.cs: use ea.Location instead of ea.loc.
6924 [FIXME: Filed as bug #28607: MCS must report these errors.]
6926 2002-08-06 Martin Baulig <martin@gnome.org>
6928 * ecore.cs (Expression.loc): Moved the location here instead of
6929 duplicating it in all derived classes.
6930 (Expression.Location): New public property.
6931 (Expression.Error, Expression.Warning): Made them non-static and
6932 removed the location argument.
6933 (Expression.Warning): Added overloaded version which takes an
6934 `int level' argument.
6935 (Expression.Error118): Make this non-static and removed the
6936 expression and location arguments.
6937 (TypeExpr): Added location argument to the constructor.
6939 * expression.cs (StaticCallExpr): Added location argument to
6941 (Indirection, PointerArithmetic): Likewise.
6942 (CheckedExpr, UnCheckedExpr): Likewise.
6943 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
6944 (StringPtr): Likewise.
6947 2002-08-05 Martin Baulig <martin@gnome.org>
6949 * expression.cs (BaseAccess.DoResolve): Actually report errors.
6951 * assign.cs (Assign.DoResolve): Check whether the source
6952 expression is a value or variable.
6954 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
6955 while resolving the corresponding blocks.
6957 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
6958 an error, don't silently return null.
6960 * statement.cs (Block.AddVariable): Do the error reporting here
6961 and distinguish between CS0128 and CS0136.
6962 (Block.DoResolve): Report all unused labels (warning CS0164).
6963 (LabeledStatement): Pass the location to the constructor.
6964 (LabeledStatement.HasBeenReferenced): New property.
6965 (LabeledStatement.Resolve): Set it to true here.
6967 * statement.cs (Return.Emit): Return success even after reporting
6968 a type mismatch error (CS0126 or CS0127), this is what csc does and
6969 it avoids confusing the users with any consecutive errors.
6971 2002-08-05 Martin Baulig <martin@gnome.org>
6973 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
6975 * const.cs (Const.LookupConstantValue): Catch circular definitions.
6977 * expression.cs (MemberAccess.DoResolve): Silently return if an
6978 error has already been reported.
6980 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
6981 error has already been reported.
6983 2002-08-05 Martin Baulig <martin@gnome.org>
6985 * statement.cs (UsageVector): Only initialize the `parameters'
6986 vector if we actually have any "out" parameters.
6988 2002-08-05 Martin Baulig <martin@gnome.org>
6990 * expression.cs (Binary.ResolveOperator): When combining delegates,
6991 they must have the same type.
6993 2002-08-05 Martin Baulig <martin@gnome.org>
6995 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
6996 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
6997 work with the ms runtime and we also don't need it: if we're a
6998 PropertyBuilder and not in the `indexer_arguments' hash, then we
6999 are a property and not an indexer.
7001 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
7002 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
7003 since the latter one doesn't work with the ms runtime.
7005 2002-08-03 Martin Baulig <martin@gnome.org>
7007 Fixed bugs #27998 and #22735.
7009 * class.cs (Method.IsOperator): New public field.
7010 (Method.CheckBase): Report CS0111 if there's already a method
7011 with the same parameters in the current class. Report CS0508 when
7012 attempting to change the return type of an inherited method.
7013 (MethodData.Emit): Report CS0179 if a method doesn't have a body
7014 and it's not marked abstract or extern.
7015 (PropertyBase): New abstract base class for Property and Indexer.
7016 (PropertyBase.CheckBase): Moved here from Property and made it work
7018 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
7019 the same so we can reuse it there.
7020 (Property, Indexer): Derive from PropertyBase.
7021 (MethodSignature.inheritable_property_signature_filter): New delegate
7022 to find properties and indexers.
7024 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
7025 argument and improved error reporting.
7027 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
7028 EmptyReadOnlyParameters and made it a property.
7030 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
7031 version of this method which takes a `PropertyInfo indexer'.
7032 (TypeManager.RegisterIndexer): New method.
7034 * class.cs: Added myself as author of this file :-)
7036 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7038 * class.cs: fixed compilation on windoze.
7040 2002-08-03 Martin Baulig <martin@gnome.org>
7042 * interface.cs (Interface.GetInterfaceBases): Check whether all
7043 base interfaces are at least as accessible than the current one.
7045 * class.cs (TypeContainer.GetClassBases): Check whether base types
7046 are at least as accessible than the current type.
7047 (TypeContainer.AsAccessible): Implemented and made non-static.
7048 (MemberBase.CheckParameters): Report errors if the accessibility
7051 * delegate.cs (Delegate.Delegate): The default visibility is
7052 internal for top-level types and private for nested types.
7053 (Delegate.Define): Report errors if the accessibility checks fail.
7055 * enum.cs (Enum.Enum): The default visibility is internal for
7056 top-level types and private for nested types.
7057 (Enum.DefineType): Compute the correct visibility.
7059 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
7060 function which takes a `bool is_toplevel' instead of a TypeContainer.
7062 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
7065 2002-08-02 Martin Baulig <martin@gnome.org>
7067 * expression.cs (LocalVariableReferenc): Added constructor which
7068 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
7069 (LocalVariableReference.IsReadOnly): New property.
7070 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
7071 variable is readonly, use our own readonly flag to do this; you can
7072 use the new constructor to get a writable reference to a read-only
7075 * cs-parser.jay (foreach_statement, using_statement): Get a writable
7076 reference to the local variable.
7078 2002-08-01 Miguel de Icaza <miguel@ximian.com>
7080 * rootcontext.cs (ResolveCore): Also include System.Exception
7082 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
7083 we reach an EmptyStatement.
7085 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
7088 * expression.cs (Binary.ResolveOperator): Check error result in
7091 use brtrue/brfalse directly and avoid compares to null.
7093 2002-08-02 Martin Baulig <martin@gnome.org>
7095 * class.cs (TypeContainer.Define): Define all nested interfaces here.
7096 Fixes bug #28407, added test-155.cs.
7098 2002-08-01 Martin Baulig <martin@gnome.org>
7100 * class.cs (Event.EmitDefaultMethod): Make this work with static
7101 events. Fixes #28311, added verify-3.cs.
7103 2002-08-01 Martin Baulig <martin@gnome.org>
7105 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
7106 `is_disposable' fields.
7107 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
7108 `hm.is_disposable' if we're using the collection pattern.
7109 (Foreach.EmitCollectionForeach): Use the correct type for the
7110 enumerator's local variable, only emit the try/finally block if
7111 necessary (fixes #27713).
7113 2002-08-01 Martin Baulig <martin@gnome.org>
7115 * ecore.cs (Expression.report118): Renamed to Error118 and made
7118 * statement.cs (Throw.Resolve): Check whether the expression is of
7119 the correct type (CS0118) and whether the type derives from
7120 System.Exception (CS0155).
7121 (Catch.Resolve): New method. Do the type lookup here and check
7122 whether it derives from System.Exception (CS0155).
7123 (Catch.CatchType, Catch.IsGeneral): New public properties.
7125 * typemanager.cs (TypeManager.exception_type): Added.
7127 2002-07-31 Miguel de Icaza <miguel@ximian.com>
7129 * driver.cs: Updated About function.
7131 2002-07-31 Martin Baulig <martin@gnome.org>
7133 Implemented Control Flow Analysis.
7135 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
7136 (EmitContext.CurrentBranching): Added.
7137 (EmitContext.StartFlowBranching): Added.
7138 (EmitContext.EndFlowBranching): Added.
7139 (EmitContext.KillFlowBranching): Added.
7140 (EmitContext.IsVariableAssigned): Added.
7141 (EmitContext.SetVariableAssigned): Added.
7142 (EmitContext.IsParameterAssigned): Added.
7143 (EmitContext.SetParameterAssigned): Added.
7144 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
7145 Added control flow analysis stuff here.
7147 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
7148 resolve the expression as lvalue.
7149 (LocalVariableReference.DoResolve): Check whether the variable has
7150 already been assigned.
7151 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
7152 the parameter as assigned here.
7153 (ParameterReference.DoResolve): Check whether the parameter has already
7155 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
7156 expression as lvalue.
7158 * statement.cs (FlowBranching): New class for the flow analysis code.
7159 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
7160 (LabeledStatement.IsDefined): New public property.
7161 (LabeledStatement.AddUsageVector): New public method to tell flow
7162 analyis that the label may be reached via a forward jump.
7163 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
7165 (VariableInfo.Number): New public field. This is used by flow analysis
7166 to number all locals of a block.
7167 (Block.CountVariables): New public property. This is the number of
7168 local variables in this block (including the locals from all parent
7170 (Block.EmitMeta): Number all the variables.
7172 * statement.cs: Added flow analysis support to all classes.
7174 2002-07-31 Martin Baulig <martin@gnome.org>
7176 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
7177 To get debugging messages, compile mcs with /define:MCS_DEBUG and
7178 then use this argument.
7180 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
7182 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
7183 use this to specify /define options.
7185 2002-07-29 Martin Baulig <martin@gnome.org>
7187 * statement.cs (Fixed): Moved all code that does variable lookups
7188 and resolvings from Emit to Resolve.
7190 * statement.cs (For): Moved all code that does variable lookups
7191 and resolvings from Emit to Resolve.
7193 * statement.cs (Using): Moved all code that does variable lookups
7194 and resolvings from Emit to Resolve.
7196 2002-07-29 Martin Baulig <martin@gnome.org>
7198 * attribute.cs (Attribute.Resolve): Explicitly catch a
7199 System.NullReferenceException when creating the
7200 CustromAttributeBuilder and report a different warning message.
7202 2002-07-29 Martin Baulig <martin@gnome.org>
7204 * support.cs (ParameterData.ParameterName): Added method to
7205 get the name of a parameter.
7207 * typemanager.cs (TypeManager.IsValueType): New public method.
7209 2002-07-29 Martin Baulig <martin@gnome.org>
7211 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
7212 is a flag which specifies that it's either ref or out.
7213 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
7214 the out parameter to `out Parameter.Modifier mod', also set the
7215 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
7217 * support.cs (InternalParameters.ParameterModifier): Distinguish
7218 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7219 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7221 * expression.cs (Argument.GetParameterModifier): Distinguish
7222 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7223 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7225 2002-07-29 Martin Baulig <martin@gnome.org>
7227 * expression.cs (ParameterReference.ParameterReference): Added
7228 `Location loc' argument to the constructor.
7230 * cs-parser.jay: Pass location to ParameterReference.
7232 2002-07-28 Miguel de Icaza <miguel@ximian.com>
7234 * statement.cs (Try): Initialize the location.
7236 * cs-parser.jay: pass location to Try.
7238 * expression.cs (Unary.Reduce): Change the prototype to return
7239 whether a constant fold could be performed or not. The result is
7240 returned in an out parameters. In the case of Indirection and
7241 AddressOf, we want to perform the full tests.
7243 2002-07-26 Miguel de Icaza <miguel@ximian.com>
7245 * statement.cs (Statement.Emit): Flag dead code.
7247 2002-07-27 Andrew Birkett <andy@nobugs.org>
7249 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
7251 2002-07-27 Martin Baulig <martin@gnome.org>
7253 * class.cs (MethodData.Define): Put back call to
7254 TypeManager.AddMethod(), accidentally commented this out.
7256 * report.cs (Debug): New public method to print debugging information,
7257 this is `[Conditional ("DEBUG")]'.
7259 2002-07-26 Martin Baulig <martin@gnome.org>
7261 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
7262 (switch_statement): Push the current_block to the switch_stack and
7263 pop it again when we're done with the switch.
7264 (switch_section): The new block is a child of the current_block.
7265 Fixes bug #24007, added test-152.cs.
7267 2002-07-27 Martin Baulig <martin@gnome.org>
7269 * expression.cs (Invocation.EmitArguments): When calling a varargs
7270 function with only its fixed arguments, we need to pass an empty
7273 2002-07-27 Martin Baulig <martin@gnome.org>
7275 Mono 0.13 has been released.
7277 2002-07-25 Miguel de Icaza <miguel@ximian.com>
7279 * driver.cs: Rename --resource to --linkres, because that is what
7280 we do currently, we dont support --resource yet.
7282 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
7284 2002-07-25 Martin Baulig <martin@gnome.org>
7286 * class.cs (MethodData): New public class. This is a `method builder'
7287 class for a method or one accessor of a Property/Indexer/Event.
7288 (MethodData.GetMethodFlags): Moved here from MemberBase.
7289 (MethodData.ApplyAttributes): Likewise.
7290 (MethodData.ApplyObsoleteAttribute): Likewise.
7291 (MethodData.ApplyConditionalAttribute): Likewise.
7292 (MethodData.ApplyDllImportAttribute): Likewise.
7293 (MethodData.CheckAbstractAndExternal): Likewise.
7294 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
7295 (MethodData.Emit): Formerly known as Method.Emit().
7296 (MemberBase): Moved everything which was specific to a single
7297 accessor/method to MethodData.
7298 (Method): Create a new MethodData and call Define() and Emit() on it.
7299 (Property, Indexer, Event): Create a new MethodData objects for each
7300 accessor and call Define() and Emit() on them.
7302 2002-07-25 Martin Baulig <martin@gnome.org>
7304 Made MethodCore derive from MemberBase to reuse the code from there.
7305 MemberBase now also checks for attributes.
7307 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
7308 (MemberBase.GetMethodFlags): Moved here from class Method and marked
7310 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
7311 `CallingConventions cc' and `Attributes opt_attrs' arguments.
7312 (MemberBase.ApplyAttributes): New virtual method; applies the
7313 attributes to a method or accessor.
7314 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
7315 (MemberBase.ApplyConditionalAttribute): Likewise.
7316 (MemberBase.ApplyDllImportAttribute): Likewise.
7317 (MemberBase.CheckAbstractAndExternal): Likewise.
7318 (MethodCore.ParameterTypes): This is now a property instead of a
7319 method, it's initialized from DoDefineParameters().
7320 (MethodCore.ParameterInfo): Removed the set accessor.
7321 (MethodCore.DoDefineParameters): New protected virtual method to
7322 initialize ParameterTypes and ParameterInfo.
7323 (Method.GetReturnType): We can now simply return the MemberType.
7324 (Method.GetMethodFlags): Override the MemberBase version and add
7325 the conditional flags.
7326 (Method.CheckBase): Moved some code from Define() here, call
7327 DoDefineParameters() here.
7328 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
7329 here to avoid some larger code duplication.
7330 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
7331 ensure that abstract and external accessors don't declare a body.
7333 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
7334 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
7335 lookup in the attribute's parent classes, so we need to abort as soon
7336 as we found the first match.
7337 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
7338 the attribute has no arguments.
7340 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
7343 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7345 * cs-parser.jay: reverted previous patch.
7347 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7349 * cs-parser.jay: fixed bug #22119.
7351 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7353 * attribute.cs: fixed compilation. The error was:
7354 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
7355 be assigned to before control leaves the current method."
7356 [FIXME: Filed as bug #28186: MCS must report this error.]
7358 2002-07-25 Martin Baulig <martin@gnome.org>
7360 * attribute.cs (Attribute.Conditional_GetConditionName): New static
7361 method to pull the condition name ouf of a Conditional attribute.
7362 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
7363 the obsolete message and error flag out of an Obsolete attribute.
7365 * class.cs (Method.GetMethodFlags): New public method to get the
7366 TypeManager.MethodFlags for this method.
7367 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
7369 (Method.Define): Get and apply the Obsolete and Conditional attributes;
7370 if we're overriding a virtual function, set the new private variable
7371 `parent_method'; call the new TypeManager.AddMethod().
7373 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
7374 the MethodBuilder and the Method in a PtrHashtable.
7375 (TypeManager.builder_to_method): Added for this purpose.
7376 (TypeManager.MethodFlags): Added IsObsoleteError.
7377 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
7378 Obsolete and Conditional arguments in MethodBuilders. If we discover
7379 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
7380 the message from the attribute.
7382 2002-07-24 Martin Baulig <martin@gnome.org>
7384 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
7385 preprocessor directives, ensure that the argument to #define/#undef is
7386 exactly one identifier and that it's actually an identifier.
7388 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
7391 2002-07-24 Martin Baulig <martin@gnome.org>
7393 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
7394 initialize it to TypeManager.object_type in the constructor.
7395 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
7396 of the `hm.get_current' method if we're using the collection pattern.
7397 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
7398 for the explicit conversion to make it work when we're using the collection
7399 pattern and the `Current' property has a different return type than `object'.
7402 2002-07-24 Martin Baulig <martin@gnome.org>
7404 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
7405 does not match, but don't report any errors. This method is called in
7406 order for all methods in a MethodGroupExpr until a matching method is
7407 found, so we don't want to bail out if the first method doesn't match.
7408 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
7409 matches, report the 123. Fixes #28070.
7411 2002-07-24 Martin Baulig <martin@gnome.org>
7413 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
7414 TypeManager.TypeToCoreType() to the top of the method so the
7415 following equality checks will work. Fixes #28107.
7417 2002-07-24 Martin Baulig <martin@gnome.org>
7419 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
7420 operand is of type uint, and the other operand is of type sbyte,
7421 short or int, the operands are converted to type long." -
7422 Actually do what this comment already told us. Fixes bug #28106,
7425 2002-07-24 Martin Baulig <martin@gnome.org>
7427 * class.cs (MethodBase): New abstract class. This is now a base
7428 class for Property, Indexer and Event to avoid some code duplication
7429 in their Define() and DefineMethods() methods.
7430 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
7431 generic methods for Define() and DefineMethods().
7432 (FieldBase): Derive from MemberBase, not MemberCore.
7433 (Property): Derive from MemberBase, not MemberCore.
7434 (Property.DefineMethod): Moved all the code from this method to the
7435 new MethodBase.DefineAccessor(), just call it with appropriate
7437 (Property.Define): Call the new Property.DoDefine(), this does some
7438 sanity checks and we don't need to duplicate the code everywhere.
7439 (Event): Derive from MemberBase, not MemberCore.
7440 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
7441 accessors, this will also make them work with interface events.
7442 (Indexer): Derive from MemberBase, not MemberCore.
7443 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
7444 (Indexer.Define): Use the new MethodBase functions.
7446 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
7447 argument to the constructor.
7448 (Interface.FindMembers): Added support for interface events.
7449 (Interface.PopluateEvent): Implemented.
7451 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
7453 2002-07-22 Miguel de Icaza <miguel@ximian.com>
7455 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
7456 but this is required to check for a method name being the same as
7457 the containing class.
7461 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7463 * interface.cs: initialize variable.
7465 2002-07-23 Martin Baulig <martin@gnome.org>
7467 Implemented the IndexerName attribute in interfaces.
7469 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
7470 name if this is an explicit interface implementation.
7471 (Indexer.InterfaceIndexerName): New public variable. If we're
7472 implementing an interface indexer, this is the IndexerName in that
7473 interface. Otherwise, it's the IndexerName.
7474 (Indexer.DefineMethod): If we're implementing interface indexer,
7475 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
7476 and Pending.ImplementIndexer methods.
7477 (Indexer.Define): Also define the PropertyBuilder if we're
7478 implementing an interface indexer and this is neither an explicit
7479 interface implementation nor do the IndexerName match the one in
7482 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
7483 If a method is defined here, then we always need to create a proxy
7484 for it. This is used when implementing interface indexers.
7485 (Pending.IsInterfaceIndexer): New public method.
7486 (Pending.ImplementIndexer): New public method.
7487 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
7488 This is used when implementing interface indexers to define a proxy
7490 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
7491 define a proxy if necessary.
7493 * interface.cs (Interface.IndexerName): New public variable.
7494 (Interface.PopulateIndexer): Set the IndexerName.
7495 (Interface.DefineIndexers): New private method. Populate all the
7496 indexers and make sure their IndexerNames match.
7498 * typemanager.cs (IndexerPropertyName): Added support for interface
7501 2002-07-22 Martin Baulig <martin@gnome.org>
7503 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
7504 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
7505 ret if HasReturnLabel.
7506 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
7509 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
7510 and set the ec.LoopBeginTryCatchLevel.
7511 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
7512 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
7513 the current ec.TryCatchLevel, the branch goes out of an exception
7514 block. In this case, we need to use Leave and not Br.
7516 2002-07-22 Martin Baulig <martin@gnome.org>
7518 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
7519 block unless the block does not always return or it is contained in
7520 another try { ... } catch { ... } block. Fixes bug #26506.
7521 Added verify-1.cs to the test suite.
7523 2002-07-22 Martin Baulig <martin@gnome.org>
7525 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
7526 then we do not always return. Fixes bug #24985.
7528 2002-07-22 Martin Baulig <martin@gnome.org>
7530 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
7531 lookup on a per-class level; ie. walk up the class hierarchy until we
7532 found at least one applicable method, then choose the best among them.
7533 Fixes bug #24463 and test-29.cs.
7535 2002-07-22 Martin Baulig <martin@gnome.org>
7537 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
7538 return types of the methods. The return type is not part of the
7539 signature and we must not check it to make the `new' modifier work.
7540 Fixes bug #27999, also added test-147.cs.
7541 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
7543 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
7544 on the method's return type.
7546 2002-07-21 Martin Baulig <martin@gnome.org>
7548 * assign.cs: Make this work if the rightmost source is a constant and
7549 we need to do an implicit type conversion. Also adding a few more tests
7550 to test-38.cs which should have caught this.
7552 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
7553 target in the makefile for this. The makefile.gnu is primarily intended
7554 for end-users who don't want to debug the compiler.
7556 2002-07-21 Martin Baulig <martin@gnome.org>
7558 * assign.cs: Improved the Assign class so it can now handle embedded
7559 assignments (X = Y = Z = something). As a side-effect this'll now also
7560 consume less local variables. test-38.cs now passes with MCS, added
7561 a few new test cases to that test.
7563 2002-07-20 Martin Baulig <martin@gnome.org>
7565 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
7566 instructions. Fixes bug #27977, also added test-146.cs.
7568 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7570 * cs-tokenizer.cs: fixed getHex ().
7572 2002-07-19 Martin Baulig <martin@gnome.org>
7574 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
7575 not Type.GetType() to lookup the array type. This is needed when
7576 we're constructing an array of a user-defined type.
7577 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
7578 single-dimensional arrays, but also for single-dimensial arrays of
7581 2002-07-19 Martin Baulig <martin@gnome.org>
7583 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
7584 this function is called, it's not allowed to share LocalBuilders
7587 2002-07-19 Martin Baulig <martin@gnome.org>
7589 * expression.cs (Argument.Resolve): Report an error 118 when trying
7590 to pass a type as argument.
7592 2002-07-18 Martin Baulig <martin@gnome.org>
7594 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
7595 Conv_R_Un for the signed `long' type.
7597 2002-07-15 Miguel de Icaza <miguel@ximian.com>
7599 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
7600 `expr' for the temporary result, as that will fail if we do
7601 multiple resolves on the same expression.
7603 2002-07-05 Miguel de Icaza <miguel@ximian.com>
7605 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
7606 ec.TypeContainer for looking up aliases.
7608 * class.cs (TypeContainer): Remove LookupAlias from here.
7610 * decl.cs (DeclSpace); Move here.
7612 2002-07-01 Miguel de Icaza <miguel@ximian.com>
7614 * class.cs (FindMembers): Only call filter if the constructor
7615 bulider is not null.
7617 Also handle delegates in `NestedTypes' now. Now we will perform
7618 type lookups using the standard resolution process. This also
7621 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7622 This uses Expressions (the limited kind that can be parsed by the
7623 tree) instead of strings.
7625 * expression.cs (ComposedCast.ToString): Implement, used to flag
7626 errors since now we have to render expressions.
7628 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
7631 * ecore.cs (SimpleName.ToString): ditto.
7633 * cs-parser.jay: Instead of using strings to assemble types, use
7634 Expressions to assemble the type (using SimpleName, ComposedCast,
7635 MemberAccess). This should fix the type lookups in declarations,
7636 because we were using a different code path for this.
7638 * statement.cs (Block.Resolve): Continue processing statements
7639 even when there is an error.
7641 2002-07-17 Miguel de Icaza <miguel@ximian.com>
7643 * class.cs (Event.Define): Also remove the `remove' method from
7644 the list of pending items.
7646 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7647 generate more compact code.
7649 2002-07-17 Martin Baulig <martin@gnome.org>
7651 * const.cs (Const.LookupConstantValue): Add support for constant
7652 `unchecked' and `checked' expressions.
7653 Also adding test case test-140.cs for this.
7655 2002-07-17 Martin Baulig <martin@gnome.org>
7657 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7658 check whether mi.ReturnType implements the IEnumerator interface; the
7659 `==' and the IsAssignableFrom() will fail in this situation.
7661 2002-07-16 Ravi Pratap <ravi@ximian.com>
7663 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
7666 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7668 * expression.cs: fixed bug #27811.
7670 2002-07-14 Miguel de Icaza <miguel@ximian.com>
7672 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7673 Molaro: when we are a ref, the value already contains a pointer
7674 value, do not take the address of it.
7676 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7677 * removed mb-parser.jay and mb-tokenizer.cs
7679 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7681 * expression.cs: check against the building corlib void type.
7683 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7685 * ecore.cs: fix for valuetype static readonly fields: when
7686 initializing them, we need their address, not the address of a copy.
7688 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7690 * typemanager.cs: register also enum_type in corlib.
7692 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7694 * class.cs: allow calling this (but not base) initializers in structs.
7696 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7698 * ecore.cs: make sure we compare against the building base types
7701 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7703 * typemanager.cs: fix TypeToCoreType() to handle void and object
7704 (corlib gets no more typerefs after this change).
7706 2002-07-12 Miguel de Icaza <miguel@ximian.com>
7708 * expression.cs (ArrayCreation.EmitArrayArguments): use
7709 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7711 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7712 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
7713 array indexes, the runtime actually forbids them.
7715 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7716 for array arguments here.
7718 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7719 instead of the default for ValueTypes.
7721 (New.DoEmit): Use IsValueType instead of
7722 IsSubclassOf (value_type)
7723 (New.DoResolve): ditto.
7724 (Invocation.EmitCall): ditto.
7726 * assign.cs (Assign): ditto.
7728 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7729 Statements *are* currently doing part of their resolution during
7732 Expressions do always resolve during resolve, but statements are
7733 only required to propagate resolution to their children.
7735 2002-07-11 Miguel de Icaza <miguel@ximian.com>
7737 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7739 (LoadAssembly): Do not add the dll if it is already specified
7741 (MainDriver): Add the System directory to the link path at the end,
7742 after all the other -L arguments.
7744 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7745 wrong opcode for loading bytes and bools (ldelem.i1 instead of
7746 ldelem.u1) and using the opposite for sbytes.
7748 This fixes Digger, and we can finally run it.
7750 * driver.cs (UnixParseOption): Move the option parsing here.
7751 (CSCParseOption): Implement CSC-like parsing of options.
7753 We now support both modes of operation, the old Unix way, and the
7754 new CSC-like way. This should help those who wanted to make cross
7757 The only thing broken is that /r:, /reference: and /lib: are not
7758 implemented, because I want to make those have the same semantics
7759 as the CSC compiler has, and kill once and for all the confussion
7760 around this. Will be doing this tomorrow.
7762 * statement.cs (Unsafe.Resolve): The state is checked during
7763 resolve, not emit, so we have to set the flags for IsUnsfe here.
7765 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7767 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7768 not catch the Error_ObjectRefRequired in SimpleName (as it is
7769 possible to have a class/instance variable name that later gets
7770 deambiguated), we have to check this here.
7772 2002-07-10 Ravi Pratap <ravi@ximian.com>
7774 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7775 make static and put into Expression.
7777 (Event.Define): Register the private field of the event with the
7778 TypeManager so that GetFieldFromEvent can get at it.
7780 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7781 keep track of the private field associated with an event which
7784 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7787 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7789 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7791 * expression.cs (Binary.EmitBranchable): this routine emits the
7792 Binary expression in a branchable context. This basically means:
7793 we need to branch somewhere, not just get the value on the stack.
7795 This works together with Statement.EmitBoolExpression.
7797 * statement.cs (Statement.EmitBoolExpression): Use
7800 2002-07-09 Miguel de Icaza <miguel@ximian.com>
7802 * statement.cs (For): Reduce the number of jumps in loops.
7804 (For): Implement loop inversion for the For statement.
7806 (Break): We can be breaking out of a Try/Catch controlled section
7807 (foreach might have an implicit try/catch clause), so we need to
7808 use Leave instead of Br.
7810 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7811 now). If the instace expression supports IMemoryLocation, we use
7812 the AddressOf method from the IMemoryLocation to extract the
7813 address instead of emitting the instance.
7815 This showed up with `This', as we were emitting the instance
7816 always (Emit) instead of the Address of This. Particularly
7817 interesting when This is a value type, as we dont want the Emit
7818 effect (which was to load the object).
7820 2002-07-08 Miguel de Icaza <miguel@ximian.com>
7822 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7824 * statement.cs (Checked): Set the CheckedState during the resolve
7825 process too, as the ConvCast operations track the checked state on
7826 the resolve process, and not emit.
7828 * cs-parser.jay (namespace_member_declaration): Flag that we have
7829 found a declaration when we do. This is used to flag error 1529
7831 * driver.cs: Report ok when we display the help only.
7833 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
7835 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7837 2002-07-04 Miguel de Icaza <miguel@ximian.com>
7839 * cs-tokenizer.cs (define): We also have to track locally the
7840 defines. AllDefines is just used for the Conditional Attribute,
7841 but we also need the local defines for the current source code.
7843 2002-07-03 Miguel de Icaza <miguel@ximian.com>
7845 * statement.cs (While, For, Do): These loops can exit through a
7846 Break statement, use this information to tell whether the
7847 statement is the last piece of code.
7849 (Break): Flag that we break.
7851 * codegen.cs (EmitContexts): New `Breaks' state variable.
7853 2002-07-03 Martin Baulig <martin@gnome.org>
7855 * class.cs (TypeContainer.MethodModifiersValid): Allow override
7856 modifiers in method declarations in structs. Otherwise, you won't
7857 be able to override things like Object.Equals().
7859 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7861 * class.cs (Method, Property, Indexer): Do not allow the public
7862 modifier to be used in explicit interface implementations.
7864 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7865 override modifiers in method declarations in structs
7867 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
7869 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7870 integer or real overflow, report an error
7872 2002-07-02 Martin Baulig <martin@gnome.org>
7874 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7875 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7876 to tell the runtime about our newly created System.Object and
7877 System.ValueType types.
7879 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7881 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7882 struct instead of Ldarg/Starg.
7884 2002-07-02 Martin Baulig <martin@gnome.org>
7886 * expression.cs (Indirection.Indirection): Call
7887 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7889 2002-07-02 Martin Baulig <martin@gnome.org>
7891 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7892 ValueType, call TypeManager.TypeToCoreType() on it.
7893 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7894 the OpCodes.Newarr argument.
7896 2002-07-02 Martin Baulig <martin@gnome.org>
7898 * expression.cs (Invocation.EmitCall): When compiling corlib,
7899 replace all calls to the system's System.Array type to calls to
7900 the newly created one.
7902 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7903 System.Array methods.
7904 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7905 from the system's System.Array type which must be replaced.
7907 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7909 * typemanager.cs: load unverifiable_code_ctor so we can build
7910 corlib using the correct type. Avoid using GetTypeCode() with
7912 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7913 TypeManager.object_type to allow building corlib.
7915 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7917 * ecore.cs: handle System.Enum separately in LoadFromPtr().
7919 2002-07-01 Martin Baulig <martin@gnome.org>
7921 * class.cs: Make the last change actually work, we need to check
7922 whether `ifaces != null' to avoid a crash.
7924 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7926 * class.cs: when we build structs without fields that implement
7927 interfaces, we need to add the interfaces separately, since there is
7928 no API to both set the size and add the interfaces at type creation
7931 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7933 * expression.cs: the dimension arguments to the array constructors
7934 need to be converted if they are a long.
7936 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
7938 * class.cs: don't emit ldarg.0 if there is no parent constructor
7939 (fixes showstopper for corlib).
7941 2002-06-29 Martin Baulig <martin@gnome.org>
7943 MCS now compiles corlib on GNU/Linux :-)
7945 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
7946 ie. check for MethodImplOptions.InternalCall.
7948 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
7949 and TypeManager.attribute_type are null, so we must explicitly check
7950 whether parent is not null to find out whether it's an attribute type.
7951 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
7952 and SetBuilder, not only if the property is neither abstract nor external.
7953 This is necessary to set the MethodImplOptions on the accessor methods.
7954 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
7955 SetBuilder, see Property.Emit().
7957 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
7958 populate "System.Object", "System.ValueType" and "System.Attribute" since
7959 they've already been populated from BootCorlib_PopulateCoreTypes().
7961 2002-06-29 Martin Baulig <martin@gnome.org>
7963 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
7964 is the NullLiteral, we also need to make sure that target_type is not
7967 2002-06-29 Martin Baulig <martin@gnome.org>
7969 * rootcontext.cs (RootContext.ResolveCore): We must initialize
7970 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
7971 before calling BootstrapCorlib_ResolveDelegate ().
7973 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7975 * statement.cs: fixed build-breaker. All tests passed ok.
7977 2002-06-27 Martin Baulig <martin@gnome.org>
7979 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
7980 for System.Decimal when compiling corlib.
7982 2002-06-27 Martin Baulig <martin@gnome.org>
7984 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
7985 switch blocks which contain nothing but a default clause.
7987 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
7989 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
7991 2002-06-27 Martin Baulig <martin@gnome.org>
7993 * ecore.cs (PropertyExpr.PropertyExpr): Call
7994 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
7996 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
7997 is already a TypeBuilder.
7999 2002-06-27 Martin Baulig <martin@gnome.org>
8001 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
8002 `target_type == TypeManager.array_type', not IsAssignableFrom() in
8003 the "from an array-type to System.Array" case. This makes it work
8004 when compiling corlib.
8006 2002-06-27 Martin Baulig <martin@gnome.org>
8008 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
8009 non-static PropertyExpr, set its InstanceExpression. This makes
8010 the `ICollection.Count' property work in System/Array.cs.
8012 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
8014 * driver.cs: Made error handling more consistent. Errors now
8015 tracked by Report class, so many methods which used to return int
8016 now return void. Main() now prints success/failure and
8017 errors/warnings message.
8019 Renamed '--probe' compiler argument to '--expect-error'. Removed
8020 the magic number return values (123 and 124). Now, if the
8021 expected error occurs, the compiler exits with success (exit value
8022 0). If the compilation completes without seeing that particular
8023 error, the compiler exits with failure (exit value 1). The
8024 makefile in mcs/errors has been changed to handle the new behaviour.
8026 * report.cs: Made 'expected error' number a property and renamed
8027 it from 'Probe' to 'ExpectedError'.
8029 * genericparser.cs: Removed error handling support, since it is
8030 now all done by Report class.
8032 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
8033 class, so parse() no longer returns an int.
8035 * namespace.cs: Use Report.Error instead of GenericParser.error
8037 2002-06-22 Miguel de Icaza <miguel@ximian.com>
8039 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
8040 TypeContainer.AddOperator): At the front of the list put the
8041 explicit implementations, so they get resolved/defined first.
8043 2002-06-21 Miguel de Icaza <miguel@ximian.com>
8045 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
8046 interface type is implemented by this TypeContainer. Used during
8047 explicit interface implementation.
8049 (Property.Define, Indexer.Define, Method.Define): Validate that
8050 the given interface in the explicit implementation is one of the
8051 base classes for the containing type.
8053 Also if we are explicitly implementing an interface, but there is
8054 no match in the pending implementation table, report an error.
8056 (Property.Define): Only define the property if we are
8057 not explicitly implementing a property from an interface. Use the
8058 correct name also for those properties (the same CSC uses,
8059 although that is really not needed).
8061 (Property.Emit): Do not emit attributes for explicitly implemented
8062 properties, as there is no TypeBuilder.
8064 (Indexer.Emit): ditto.
8066 Hiding then means that we do not really *implement* a pending
8067 implementation, which makes code fail.
8069 2002-06-22 Martin Baulig <martin@gnome.org>
8071 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
8072 the return value of Object.GetType(). [FIXME: we need to do this whenever
8073 we get a type back from the reflection library].
8075 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
8077 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
8079 2002-06-20 Miguel de Icaza <miguel@ximian.com>
8081 * attribute.cs: Return null if we can not look up the type.
8083 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
8084 the interface types found.
8086 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
8087 interface types found.
8089 * typemanager.cs (GetInterfaces): Make this routine returns alll
8090 the interfaces and work around the lame differences between
8091 System.Type and System.Reflection.Emit.TypeBuilder in the results
8092 result for GetInterfaces.
8094 (ExpandInterfaces): Given an array of interface types, expand and
8095 eliminate repeated ocurrences of an interface. This expands in
8096 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
8099 2002-06-21 Martin Baulig <martin@gnome.org>
8101 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
8104 2002-06-21 Martin Baulig <martin@gnome.org>
8106 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
8107 and called with one of the core types, return the corresponding typebuilder for
8110 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
8113 2002-06-21 Martin Baulig <martin@gnome.org>
8115 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
8116 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
8117 (Expression.ConvertReferenceExplicit): Likewise.
8119 * expression.cs (ElementAccess.DoResolve): Likewise.
8120 (ElementAccess.DoResolveLValue): Likewise.
8122 2002-06-10 Martin Baulig <martin@gnome.org>
8124 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
8125 add the "value" parameter to the parameter list.
8127 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
8130 2002-06-19 Miguel de Icaza <miguel@ximian.com>
8132 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
8133 the argument to an int, uint, long or ulong, per the spec. Also
8134 catch negative constants in array creation.
8136 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
8138 * class.cs: do not allow the same interface to appear twice in
8139 the definition list.
8141 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
8143 * ecore.cs: don't use ldlen with System.Array.
8145 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
8147 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
8149 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
8151 * modifiers.cs: produce correct field attributes for protected
8152 internal. Easy fix so miguel can work on ther harder stuff:-)
8154 2002-06-18 Miguel de Icaza <miguel@ximian.com>
8156 * pending.cs: New file. Move the code from class.cs here.
8157 Support clearning the pending flag for all methods (when not doing
8158 explicit interface implementation).
8160 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
8162 * rootcontext.cs: added a couple more types needed to bootstrap.
8164 2002-06-17 Miguel de Icaza <miguel@ximian.com>
8166 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
8167 constructor in the type, instead of any constructor in the type
8168 hierarchy. Thanks to Paolo for finding this bug (it showed up as
8169 a bug in the Mono runtime when applying the params attribute).
8171 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
8172 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
8174 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
8176 * expression.cs (Unary.ResolveOperator): Use TypeManager
8177 to resolve the type.
8179 2002-06-13 Ravi Pratap <ravi@ximian.com>
8181 * cs-parser.jay (enum_member_declaration): Pass in the attributes
8184 * enum.cs (AddEnumMember): Add support to store the attributes associated
8185 with each member too.
8187 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
8188 field builders too - this takes care of the enum member case.
8190 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
8192 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
8193 address-of operator on both value types and pointers.
8195 2002-06-10 Martin Baulig <martin@gnome.org>
8197 * interface.cs (Interface.PopulateIndexer): Add the indexer's
8198 PropertyBuilder to the `property_builders' list.
8200 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
8201 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
8202 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
8203 find any indexers which are inherited from an interface.
8205 2002-06-09 Martin Baulig <martin@gnome.org>
8207 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
8208 the same type as the constant if necessary. There's also a test-130.cs
8211 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
8213 * typemanager.cs (TypeManager.ChangeType): Previously known as
8214 Enum.ChangeEnumType().
8216 2002-06-09 Martin Baulig <martin@gnome.org>
8218 * expression.cs (Cast.TryReduce): Added support for consts.
8220 2002-06-08 Ravi Pratap <ravi@ximian.com>
8222 * class.cs (Accessor): Hold attributes information so we can pass
8225 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
8226 Modify to pass in attributes attached to the methods.
8228 (add_accessor_declaration, remove_accessor_declaration): Ditto.
8230 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
8231 to handle the Accessor kind :-)
8233 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
8235 2002-06-08 Martin Baulig <martin@gnome.org>
8237 * expression.cs (Unary.TryReduceNegative): Added support for
8240 2002-06-08 Martin Baulig <martin@gnome.org>
8242 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
8243 name can't be found in the `defined_names' - the caller will do a
8244 MemberLookup in this case and thus find methods in System.Enum
8245 such as Enum.IsDefined().
8247 2002-06-08 Martin Baulig <martin@gnome.org>
8249 * enum.cs (Enum.ChangeEnumType): This is a custom version of
8250 Convert.ChangeType() which works with TypeBuilder created types.
8251 (Enum.LookupEnumValue, Enum.Define): Use it here.
8253 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
8254 `TypeBuilder.BaseType != null' check.
8255 (TypeContainer.FindMembers): Only lookup parent members if we
8256 actually have a parent.
8257 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
8258 (ConstructorInitializer.Resolve): Likewise.
8260 * interface.cs (Interface.FindMembers): Added
8261 `TypeBuilder.BaseType != null' check.
8263 * rootcontext.cs (RootContext.ResolveCore): Added
8264 "System.Runtime.CompilerServices.IndexerNameAttribute" to
8265 classes_second_stage.
8267 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
8268 debug_type and trace_type when compiling with --nostdlib.
8270 2002-06-07 Martin Baulig <martin@gnome.org>
8272 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
8273 (AddField): Set it to true when adding a non-static field.
8274 (DefineType): Use `have_nonstatic_fields' to find out whether we
8275 have non-static fields, not `Fields != null'.
8277 2002-06-02 Miguel de Icaza <miguel@ximian.com>
8279 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
8280 dereferencing a null on the static-field code path)
8282 2002-05-30 Martin Baulig <martin@gnome.org>
8284 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
8285 to take command line arguments. Use reflection to call the new
8286 custom `Initialize' function on the symbol writer and pass it the
8287 command line arguments.
8289 * driver.cs (--debug-args): New command line argument to pass command
8290 line arguments to the symbol writer.
8292 2002-05-28 Miguel de Icaza <miguel@ximian.com>
8294 * assign.cs (DoResolve): Forgot to do the implicit conversion to
8295 the target type for indexers and properties. Thanks to Joe for
8298 2002-05-27 Miguel de Icaza <miguel@ximian.com>
8300 * typemanager.cs (MethodFlags): returns the method flags
8301 (Obsolete/ShouldIgnore) that control warning emission and whether
8302 the invocation should be made, or ignored.
8304 * expression.cs (Invocation.Emit): Remove previous hack, we should
8305 not do this on matching a base type, we should do this based on an attribute
8307 Only emit calls to System.Diagnostics.Debug and
8308 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
8309 on the command line.
8311 * rootcontext.cs: Global settings for tracing and debugging.
8313 * cs-tokenizer.cs (define): New utility function to track
8314 defines. Set the global settings for TRACE and DEBUG if found.
8316 2002-05-25 Ravi Pratap <ravi@ximian.com>
8318 * interface.cs (Populate*): Pass in the TypeContainer as well as
8319 the DeclSpace as parameters so that we can create EmitContexts and
8320 then use that to apply attributes etc.
8322 (PopulateMethod, PopulateEvent, PopulateProperty)
8323 (PopulateIndexer): Apply attributes everywhere.
8325 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
8328 (ApplyAttributes): Update accordingly.
8330 We now apply interface attributes for all members too.
8332 2002-05-26 Miguel de Icaza <miguel@ximian.com>
8334 * class.cs (Indexer.Define); Correctly check if we are explicit
8335 implementation (instead of checking the Name for a ".", we
8336 directly look up if the InterfaceType was specified).
8338 Delay the creation of the PropertyBuilder.
8340 Only create the PropertyBuilder if we are not an explicit
8341 interface implementation. This means that explicit interface
8342 implementation members do not participate in regular function
8343 lookups, and hence fixes another major ambiguity problem in
8344 overload resolution (that was the visible effect).
8346 (DefineMethod): Return whether we are doing an interface
8349 * typemanager.cs: Temporary hack until we get attributes in
8350 interfaces (Ravi is working on that) and we get IndexerName
8351 support in interfaces.
8353 * interface.cs: Register the indexers as properties.
8355 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
8356 warning, I have verified that this is a bug in the .NET runtime
8357 (JavaScript suffers of the same problem).
8359 * typemanager.cs (MemberLookup): When looking up members for
8360 interfaces, the parent of an interface is the implicit
8361 System.Object (so we succeed in searches of Object methods in an
8362 interface method invocation. Example: IEnumerable x; x.ToString
8365 2002-05-25 Miguel de Icaza <miguel@ximian.com>
8367 * class.cs (Event): Events should also register if they do
8368 implement the methods that an interface requires.
8370 * typemanager.cs (MemberLookup); use the new GetInterfaces
8373 (GetInterfaces): The code used to lookup interfaces for a type is
8374 used in more than one place, factor it here.
8376 * driver.cs: Track the errors at the bottom of the file, we kept
8379 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
8380 instance if the method we are calling is static!
8382 2002-05-24 Miguel de Icaza <miguel@ximian.com>
8384 * attribute.cs (ApplyAttributes): Make this function filter out
8385 the IndexerName attribute (as that attribute in reality is never
8386 applied) and return the string constant for the IndexerName
8389 * class.cs (TypeContainer.Emit): Validate that all the indexers
8390 have the same IndexerName attribute, and if so, set the
8391 DefaultName attribute on the class.
8393 * typemanager.cs: The return value might contain other stuff (not
8394 only methods). For instance, consider a method with an "Item"
8395 property and an Item method.
8397 * class.cs: If there is a problem with the parameter types,
8400 2002-05-24 Ravi Pratap <ravi@ximian.com>
8402 * ecore.cs (ImplicitConversionExists): Wrapper function which also
8403 looks at user defined conversion after making a call to
8404 StandardConversionExists - we need this for overload resolution.
8406 * expression.cs : Update accordingly the various method calls.
8408 This fixes 2 bugs filed against implicit user defined conversions
8410 2002-05-22 Miguel de Icaza <miguel@ximian.com>
8412 * statement.cs: Track the result of the assignment.
8414 2002-05-21 Miguel de Icaza <miguel@ximian.com>
8416 * expression.cs (MemberAccess): Improved error reporting for
8417 inaccessible members.
8419 2002-05-22 Martin Baulig <martin@gnome.org>
8421 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
8422 itself with debugging support.
8424 2002-05-22 Martin Baulig <martin@gnome.org>
8426 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
8427 Removed, this isn't needed anymore.
8429 2002-05-20 Martin Baulig <martin@gnome.org>
8431 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
8432 be underlying type for an enum.
8434 2002-05-20 Miguel de Icaza <miguel@ximian.com>
8436 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
8437 that splits out the loading of just the core types.
8439 * rootcontext.cs (ResolveCore): Split the struct resolution in
8440 two, so we can load the enumeration underlying types before any
8443 * expression.cs (Is): Bandaid until we fix properly Switch (see
8444 bug #24985 for details).
8446 * typemanager.cs (ImplementsInterface): The hashtable will contain
8447 a null if there are no interfaces implemented.
8449 2002-05-18 Miguel de Icaza <miguel@ximian.com>
8451 * cs-parser.jay (indexer_declarator): It is fine to have array
8454 2002-05-17 Miguel de Icaza <miguel@ximian.com>
8456 * typemanager.cs: (RegisterBuilder): New function used to register
8457 TypeBuilders that implement interfaces. Since
8458 TypeBuilder.GetInterfaces (as usual) does not work with lame
8460 (AddUserType): register interfaces.
8462 (ImplementsInterface): Use the builder_to_ifaces hash if we are
8463 dealing with TypeBuilder. Also, arrays are showing up as
8464 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
8465 methods can not be invoked on them!
8467 * ecore.cs (ExplicitReferenceConversionExists): Made public.
8468 (ImplicitReferenceConversionExists): Split out from
8469 StandardConversionExists.
8471 * expression.cs (As): We were only implementing one of the three
8472 cases for the as operator. We now implement them all.
8473 (Is): Implement the various other cases for Is as well.
8475 * typemanager.cs (CACHE): New define used to control if we want or
8476 not the FindMembers cache. Seems to have a negative impact on
8477 performance currently
8479 (MemberLookup): Nested types have full acess to
8480 enclosing type members
8482 Remove code that coped with instance/static returns for events, we
8483 now catch this in RealFindMembers.
8485 (RealFindMembers): only perform static lookup if the instance
8486 lookup did not return a type or an event.
8488 2002-05-17 Miguel de Icaza <miguel@ximian.com>
8490 * assign.cs (CompoundAssign): We pass more semantic information
8491 now to Compound Assignments than we did before: now we have all
8492 the information at hand, and now we resolve the target *before* we
8493 do the expression expansion, which allows the "CacheValue" method
8494 to have the effect we intended (before, a [x] += 1 would generate
8495 two differen ArrayAccess expressions from the ElementAccess,
8496 during the resolution process).
8498 (CompoundAssign.DoResolve): Resolve target and original_source here.
8500 2002-05-16 Miguel de Icaza <miguel@ximian.com>
8502 * expression.cs (ArrayAccess): dropped debugging information.
8504 * typemanager.cs: Small bug fix: I was always returning i_members,
8505 instead of one of i_members or s_members (depending on which had
8508 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
8509 method is invoked before any code generation takes place, and it
8510 is a mechanism to inform that the expression will be invoked more
8511 than once, and that the method should use temporary values to
8512 avoid having side effects
8514 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
8516 * ecore.cs (Expression.CacheTemporaries): Provide empty default
8519 * expression.cs (Indirection, ArrayAccess): Add support for
8520 CacheTemporaries in these two bad boys.
8522 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
8524 (StoreFromPtr): Handle stobj as well.
8526 * expression.cs (UnaryMutator): Share more code.
8528 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
8529 down: I was not tracking the Filter function as well, which
8530 was affecting the results of the cache.
8532 2002-05-15 Miguel de Icaza <miguel@ximian.com>
8534 * attribute.cs: Remove the hack to handle the CharSet property on
8537 2002-05-14 Miguel de Icaza <miguel@ximian.com>
8539 * attribute.cs (DoResolve): More uglyness, we now only try to
8540 resolve the attribute partially, to extract the CharSet
8541 information (only if we are a StructLayout attribute). Otherwise
8543 (GetExtraTypeInfo): Add some code to conditionally kill in the
8544 future this. I am more and more convinced that the .NET
8545 framework has special code to handle the attribute setting on
8548 * expression.cs (IsParamsMethodApplicable): Revert my previous
8549 foreach change here, it was wrong.
8551 2002-05-13 Miguel de Icaza <miguel@ximian.com>
8553 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
8554 (pp_expr): do not abort on unknown input, just return.
8555 (eval): abort if there are pending chars.
8557 * attribute.cs (Attribute.Resolve): Positional parameters are
8558 optional. Deal with that case.
8560 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
8561 the Ansi/Unicode/Auto information for the type.
8563 (TypeContainer.DefineType): instantiate the EmitContext here, as
8564 we will be using it during the type definition (to resolve
8565 attributes) and during the emit phase.
8567 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
8568 to pull type information out of the attributes
8570 (Attribute.Resolve): track the constructor builder, and allow for
8571 multiple invocations (structs and classes will use this).
8573 * ecore.cs (MemberLookupFinal): new version with all the
8574 parameters customizable.
8576 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
8577 constructors. Return if the result value is null (as the error
8578 would have been flagged already by MemberLookupFinal)
8580 Do not allow instances of abstract classes or interfaces to be
8583 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
8584 We have to compare the assembly property here when dealing with
8585 FamANDAssem and Assembly access modifiers, because we might be
8586 creating an assembly from *modules* (that means that we are not
8587 getting TypeBuilders for types defined in other modules that are
8588 part of this assembly).
8590 (Method.Emit): If the method is marked abstract and has a body,
8593 (TypeContainer.DefineMembers): If both the defined member and the
8594 parent name match are methods, then do not emit any warnings: let
8595 the Method.Define routine take care of flagging warnings. But if
8596 there is a mismatch (method overrides something else, or method is
8597 overriwritten by something, then emit warning).
8599 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
8600 set to null, this means `do not check for the return type on the
8603 (Method.Define): set the return type for the method signature to
8604 null, so that we get methods with the same name and parameters and
8605 different return types. This is used to flag warning 114 (you are
8606 hiding a method, and you probably want to use the new/override
8609 * typemanager.cs (MemberLookup): Implemented proper access
8610 control, closing a long standing set of bug reports. The problem
8611 was that the Framework only has two bits: Public and NonPublic,
8612 and NonPublic includes private and protected methods, but we need
8613 to enforce the FamANDAssem, FamOrAssem and Family.
8615 2002-05-11 Miguel de Icaza <miguel@ximian.com>
8617 * statement.cs (GotoCase): Return true: Ammounts to giving up
8618 knowledge on whether we return or not, and letting the other case
8619 be responsible for it.
8621 2002-05-10 Miguel de Icaza <miguel@ximian.com>
8623 * driver.cs: Do not load directories for each file processed, only
8624 do it if there is a pattern.
8626 * ecore.cs: Report readonly assigns here as well, as we might have
8627 been resolved only by MemberAccess.
8629 (SimpleName.SimpleNameResolve): Also be useful for LValue
8630 resolution. We need this to propagate assign to local readonly variables
8632 * typemanager.cs: Use a ptrhashtable for the criteria, because we
8633 do not want to reuse potential criteria memory.
8635 * class.cs (MyEventBuilder): Set reflected_type;
8637 * ecore.cs (Constantify): Added support for constifying bools.
8639 (RootContext.LookupType): Added a cache for values looked up in
8640 the declaration space.
8642 * typemanager.cs (FindMembers): Now is a front-end to
8643 RealFindMembers, and provides a two-level hashtable-based cache to
8646 15% performance improvement: from 22.5 to 19.2 seconds.
8648 * expression.cs (IsParamsMethodApplicable): use foreach.
8649 (Invocation.DoResolve): ditto.
8650 (New.DoResolve): ditto.
8651 (ArrayCreation.DoResolve): ditto.
8653 * ecore.cs (FindMostEncompassingType): use foreach.
8655 * delegate.cs (NewDelegate.DoResolve): Use foreach
8657 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8658 (RemoveMethods): use foreach.
8660 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8661 nested foreach statements instead of for, and also break out of
8662 the inner loop once a match is found.
8664 (Invocation.OverloadResolve): Use foreach, simplify the code.
8666 2002-05-08 Miguel de Icaza <miguel@ximian.com>
8668 * cfold.cs (BinaryFold): During an enumeration evaluation context,
8669 we actually unwrap the expression to allow for extra information
8672 * expression.cs: Use Shr_Un on unsigned operations.
8674 2002-05-08 Ravi Pratap <ravi@ximian.com>
8676 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
8677 applicable operators was not being considered correctly. This closes
8678 the bug Miguel reported.
8680 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8682 * attribute.cs: check that the type derives from System.Attribute
8683 and report the correct error in that case (moved the duplicate code to
8684 its own method, too).
8686 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8688 * attribute.cs: lookup attribute type name as the spec says: first the
8689 bare attribute name and then name + "Attribute" (nant compiles with
8690 mcs after this fix).
8692 2002-05-07 Miguel de Icaza <miguel@ximian.com>
8694 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
8695 Because of the way we parse things, we should try to see if a
8696 UIntConstant can fit in an integer.
8698 2002-05-07 Ravi Pratap <ravi@ximian.com>
8700 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8701 when we are in an explicit context.
8703 (ConvertReferenceExplicit): When converting from Iface type S to Class
8704 T make sure the rules are implemented as an OR.
8706 * parameter.cs (ParameterType): Make it a property for now although the
8707 purpose really isn't anything immediate.
8709 * expression.cs (Is*Applicable): Do better checking on the parameter type
8710 of a ref/out parameter. The ones from the system assemblies are already
8711 marked with the correct type so we don't need to do any correction.
8713 * ecore.cs (StandardConversionExists): Conversion from Interface types to
8714 the object type is standard too so include that.
8716 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8718 * ecore.cs (StandardConversionExists): Augment with missing code:
8719 deal with IntConstant, LongConstants and Enumerations.
8721 * assign.cs: Report the error, instead of failing silently
8723 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8724 typecontainer that they are declared, because the
8725 typecontainer/namespace will have the list of using clauses that
8728 Assembly Attributes were escaping the normal registration
8731 (EmitCode): Apply attributes within an EmitContext that represents
8732 the container they were declared on.
8734 * cs-parser.jay: Track bases for structs. How did I get this wrong?
8736 2002-05-06 Ravi Pratap <ravi@ximian.com>
8738 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8739 Revamp completely - make much cleaner as we now operate only
8742 (FindMostSpecificSource, FindMostSpecificTarget): New methods
8743 to implement the logic detailed in the spec more correctly.
8745 (UserDefinedConversion): Update accordingly.
8747 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8749 * statement.cs: Return flow analysis information up.
8751 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8754 (token): Do not consume an extra character before calling
8757 2002-05-06 Piers Haken <piersh@friskit.com>
8759 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8761 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8763 * class.cs (Constructor.Emit): Set the IsStatic flag in the
8764 EmitContext during the instance constructor initializer
8765 resolution, to stop access to instance variables.
8767 This is mandated by the spec, last paragraph of the `constructor
8768 initializers' section.
8770 2002-05-05 Miguel de Icaza <miguel@ximian.com>
8772 * cs-parser.jay, class.cs (Accessor): new class used to represent
8773 an accessor (get or set). In the past we used `null' to represent
8774 a missing accessor. But this is ambiguous because there was no
8775 way to tell in abstract indexers/properties if one of them was
8778 Now there is a way of addressing that.
8780 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8781 instead of FindMembers.
8783 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8784 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8786 * attribute.cs: Treat indexers and properties as the same in terms
8787 of applying attributes
8789 * ecore.cs (FindMostEncompassedType): Use statically initialized
8790 EmptyExpressions()s like we do elsewhere to avoid creating useless
8791 objects (and we take this out of the tight loop).
8793 (GetConversionOperators): Move the code to extract the actual
8794 operators to a separate routine to clean things up.
8796 2002-05-04 Miguel de Icaza <miguel@ximian.com>
8798 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8799 events are always registered FieldBuilders.
8801 * class.cs (FieldBase): New class shared by Fields
8803 * delegate.cs: If we are a toplevel delegate, use our full name.
8804 If we are a nested delegate, then only use our tail name.
8806 2002-05-02 Ravi Pratap <ravi@ximian.com>
8808 * expression.cs (IsApplicable): Ensure that we add the "&" to
8809 ref/out types before comparing it with the type of the argument.
8811 (IsParamsMethodApplicable): Ditto.
8813 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
8816 * delegate.cs : Handle the case when we have more than one applicable
8817 method. Flag an error only when we finish checking all.
8819 2002-05-02 Miguel de Icaza <miguel@ximian.com>
8821 * expression.cs: Add support for boolean static initializers.
8823 2002-05-01 Miguel de Icaza <miguel@ximian.com>
8825 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8827 * parameter.cs (ComputeParameterTypes,
8828 ComputeAndDefineParameterTypes): Better error handling: now we
8829 clear the `types' cache if we fail during any of the type lookups.
8830 We also return the status code correctly to our caller
8832 * delegate.cs: If we fail to define a delegate, abort the extra
8835 * expression.cs (Binary.ResolveOperator): for
8836 operator==(object,object) and operator !=(object, object) we also
8837 have to verify that there is an implicit conversion from one to
8840 (ArrayAccess.DoResolve): Array Access can operate on
8843 2002-04-30 Miguel de Icaza <miguel@ximian.com>
8845 * assign.cs (CompoundAssign): A new class used as a "flag" that
8846 the assignment actually is happening as part of a compound
8847 assignment operator.
8849 During compound assignment, a few new rules exist to enable things
8856 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8857 to the type of x) if y is implicitly convertible to the type of x,
8858 and the operator is a builtin operator and the return type of the
8859 operator is explicitly convertible to the type of x.
8861 * rootcontext.cs: Reset warning level to 2. 4 catches various
8862 "interesting" features in mcs, we must clean this up at some
8863 point, but currently am trying to kill other bugs ;-)
8865 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8866 in container classes as well.
8868 * expression.cs (Binary.ResolveOperator): Handle string case
8869 before anything else (as operator overloading does emit an error
8870 before doing anything else).
8872 This code could go away when we move to a table driven model, but
8873 i could not come up with a good plan last night.
8875 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
8877 * typemanager.cs (CSharpName): reimplementation using regex.
8878 * class.cs: added null check for fields in Emit
8879 * rootcontext.cs: set warninglevel to 4
8881 2002-04-29 Miguel de Icaza <miguel@ximian.com>
8883 * typemanager.cs (CSharpName): reimplemented with Lupus
8886 2002-04-28 Miguel de Icaza <miguel@ximian.com>
8888 * statement.cs (If): correclty implement Resolve, because we were
8889 not catching sem errors in there. The same process is needed
8891 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8894 (Statement.Warning_DeadCodeFound): Factorize code.
8895 (While): Report dead code here too.
8897 (Statement): Added Resolve virtual method to allow
8898 for resolution split from the emit code.
8900 2002-04-26 Miguel de Icaza <miguel@ximian.com>
8902 * statement.cs (EmitBoolExpression): No longer try to resolve the
8904 (MakeBoolean): New utility function that resolve, implicitly
8905 converts to boolean and tags the expression.
8908 (If, Do): Implement dead code elimination.
8909 (While): Implement loop inversion
8911 (Do, While, For, If): Resolve the expression prior to calling our
8914 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
8917 - added method Report28 (warning: program has more than one entry point)
8918 - added method IsEntryPoint, implements paragraph 10.1 of the spec
8919 - modified method Method.Define, the part at the end of the method
8921 * rootcontext.cs: added static public Location EntryPointLocation;
8923 * ../errors/cs0028.cs : Add test case for the above warning.
8926 - modified method CSharpName to allow arrays of primitive type to
8927 be printed nicely (e.g. instead of System.Int32[][] it now prints
8929 - added method CSharpSignature: returns the signature of a method
8930 in string format to be used in reporting errors, warnings, etc.
8932 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
8935 2002-04-26 Ravi Pratap <ravi@ximian.com>
8937 * delegate.cs (Define): Fix extremely silly bug where I was
8938 setting the type of the 'object' parameter of the BeginInvoke
8939 method to System.IAsyncResult instead of System.Object ;-)
8941 2002-04-26 Miguel de Icaza <miguel@ximian.com>
8943 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
8946 (Constructor.Emit): return if we fail to initialize the
8947 constructor. Another door closed!
8949 * expression.cs (New.DoResolve): Improve error message (from -6 to
8950 1501). Use DeclaredOnly lookup to find the exact constructor.
8952 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
8953 loop. This is useful.
8955 * cs-parser.jay: Adjust the default parameters so that destructors
8956 have the proper signature.
8958 2002-04-26 Martin Baulig <martin@gnome.org>
8960 * driver.cs (LoadAssembly): If `assembly' contains any characters
8961 which are only valid in path names and not in assembly names
8962 (currently slash, backslash and point), use Assembly.LoadFrom ()
8963 instead of Assembly.Load () on the `assembly' (before iteration
8964 over the link_paths).
8966 2002-04-26 Martin Baulig <martin@gnome.org>
8968 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
8970 2002-04-25 Miguel de Icaza <miguel@ximian.com>
8972 * class.cs (Property): use the new typemanager.MemberLookup
8974 (TypeContainer.MemberLookup): Implement using the
8975 TypeManager.MemberLookup now.
8977 * typemanager.cs: Make MemberLookup a function of the TypeManager,
8978 and return MemberInfos, so that these can be used without an
8979 EmitContext (what we had before).
8981 2002-04-24 Miguel de Icaza <miguel@ximian.com>
8983 * expression.cs: Fix the case where the argument to params if the
8984 type of the params. I omitted handling this before. Fixed
8986 2002-04-22 Miguel de Icaza <miguel@ximian.com>
8988 * driver.cs: Call BootCorlib_PopulateCoreType
8990 * class.cs (Property.CheckBase): Check for properties only, not
8993 * interface.cs: Temporary hack: try/catch around the
8994 CustomAttributeBuilder, because I am getting an exception that I
8997 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
8998 types whose definitions are required to be there (attributes are
8999 defined before standard types).
9001 Compute definitions as we boot the various types, as they are used
9002 immediately (value_type class will need object_type, but if we do
9003 not initialize object_type, we will pass a null, which will let
9004 the runtime pick the System.Object from the existing corlib, which
9005 is not what we want).
9007 2002-04-22 Patrik Torstensson <totte@labs2.com>
9009 * cs-tokenizer.cs: fixed a number of trim() issues.
9011 2002-04-22 Ravi Pratap <ravi@ximian.com>
9013 * expression.cs (Argument.Type): Ensure that we return the correct
9014 type when we have out or ref parameters [in which case we
9017 2002-04-22 Miguel de Icaza <miguel@ximian.com>
9019 * class.cs (Property, Indexer): Allow extern modifier in there.
9021 * typemanager.cs (InitBaseTypes): Initializes object_type and
9022 value_type, since those will be used early on during the bootstrap
9023 process to compile corlib.
9025 (InitCoreTypes): Move code from here to InitBaseTypes.
9027 2002-04-21 Miguel de Icaza <miguel@ximian.com>
9029 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
9030 single-dimension arrays as using the ldlen opcode.
9032 Daniel Lewis discovered this optimization.
9034 * typemanager.cs: Add signature for System.Array::get_Length
9036 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9038 * statement.cs: report the error when the foreach does not apply to an
9039 array nor a collection.
9041 2002-04-19 Miguel de Icaza <miguel@ximian.com>
9043 * expression.cs: Add implicit conversions to the operator ~.
9045 * constant.cs (DecimalConstant.Emit): Emit decimal value.
9047 * typemanager.cs: Locate the decimal constructor.
9049 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9051 * attribute.cs: use the new property of TypeOf.
9052 * expression.cs: added 'get' property around typearg.
9054 These changes fix a build breaker reported by NickD. Is this the
9055 correct way to fix? If not, please, revert my changes and make it
9058 2002-04-17 Miguel de Icaza <miguel@ximian.com>
9060 * attribute.cs: Add support for typeof in attribute invocations.
9061 I am not sure that this is right though.
9063 2002-04-14 Duncan Mak <duncan@ximian.com>
9065 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
9066 Binary.Operator.Division case.
9068 2002-04-13 Ravi Pratap <ravi@ximian.com>
9070 * class.cs (DefineType): Ensure that we do a proper check on
9071 attribute types and also register it with the TypeManager.
9073 (TypeContainer.Targets): The default for attribute types is
9074 AttributeTargets.All.
9076 * attribute.cs (ApplyAttributes): Registering the attribute type
9077 is done elsewhere, not when we discover we have a Usage attribute.
9079 2002-04-12 Ravi Pratap <ravi@ximian.com>
9081 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
9082 and get rid of is_delegate parameter.
9084 * everywhere : update.
9086 2002-04-12 Ravi Pratap <ravi@ximian.com>
9088 * cs-parser.jay (compilation_unit): Revamp completely to use
9089 some new ideas that I got from Rhys' grammar to solve the problems
9090 with assembly level attributes.
9092 (outer_declaration): New grammar production.
9094 (attribute_sections): Add.
9096 (opt_attributes): Base on attribute_sections
9098 (namespace_declaration): Allow opt_attributes to tackle the case
9099 when we have assembly level attributes - we are clever in this
9102 * attribute.cs (ApplyAttributes): Do not worry about assembly
9103 attributes in the non-global context.
9105 * rootcontext.cs (AddGlobalAttributes): Go back to using this
9106 instead of SetGlobalAttributes.
9108 * class.cs, rootcontext.cs : Ensure we define and generate
9109 attribute types before anything else.
9111 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
9112 and flag the new error -20 for the case when the attribute type
9113 does not have valid targets specified. csc does not catch this.
9115 * ../errors/errors.txt : update for error # -20
9117 2002-04-11 Ravi Pratap <ravi@ximian.com>
9119 * support.cs (InternalParameters.ParameterModifier): Do some null
9120 checking and return sane values.
9122 * class.cs (Method.Define): If we are a PInvoke method, ensure
9123 that we are static and extern. Report error # 601
9125 * ../errors/cs0601.cs : Add test case for the above error.
9127 2002-04-07 Ravi Pratap <ravi@ximian.com>
9129 * rootcontext.cs (attribute_types): We need to keep type of
9130 all attribute types separately and emit code for them first.
9132 (RegisterAttribute) : Implement.
9134 * class.cs (DefineType): Check if the current Type is a custom
9135 attribute type and register it accordingly.
9137 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
9138 adding the first attribute twice and rename to
9140 (SetGlobalAttributes): this.
9142 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
9145 * attribute.cs (ApplyAttributes): Take an additional argument telling us
9146 if we are processing global arguments. Hmm, I am unsure of this.
9148 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9150 * expression.cs: added static array of strings to avoid calling
9151 Enum.ToString () for Operator in Binary. Significant recover of
9154 2002-04-10 Miguel de Icaza <miguel@ximian.com>
9156 * class.cs (FindMembers): Allow the Builders of the various
9157 members to be null. If they are skip them. This only happens
9158 during the PInvoke declaration.
9160 2002-04-09 Miguel de Icaza <miguel@ximian.com>
9162 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
9163 failure, so we do not keep going afterwards.
9165 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
9166 wanted to pass `false' as the `is_delegate' argument. If this is
9167 the case, why not use delegate_type == null to mean `is_delegate =
9168 false' and anything else as is_delegate = true.
9170 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
9172 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
9173 code for the section, not the beginning of the tests.
9175 2002-04-08 Miguel de Icaza <miguel@ximian.com>
9177 * cfold.cs: Handle operator + (Enum x, Underlying x)
9179 * expression.cs (Binary): same. Warn about errors where we have
9180 Enum/Enum in operator + as well.
9182 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
9185 - added support for switch(bool)
9186 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
9187 - add TableSwitchEmit() to handle table-based switch statements
9189 2002-04-05 Ravi Pratap <ravi@ximian.com>
9191 * expression.cs (Invocation.OverloadResolve): Factor out code which
9192 does parameter compatibility checking with arguments so that we can
9193 re-use the code even from Delegate.VerifyApplicability
9195 (VerifyArgumentsCompat): Move above code here.
9197 * delegate.cs (VerifyApplicability): Get rid of duplicate code
9198 and instead make a call to the above method.
9200 2002-03-31 Ravi Pratap <ravi@ximian.com>
9202 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
9203 We use it to keep track of classes which are attribute types.
9205 2002-04-02 Miguel de Icaza <miguel@ximian.com>
9207 * delegate.cs (Delegate.Define): Correctly define the types in the
9208 presence of fixed and array parameters.
9210 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
9213 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
9214 include NonPublic after the first iteration.
9216 * class.cs (Indexer.CheckBase): Only check if both parents are
9219 * cs-parser.jay (accessor_body): If empty, set to null.
9221 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
9222 same code path here to resolve constants names that we did have in
9223 MemberAccess.DoResolve. There is too much code duplicated here.
9225 2002-04-01 Miguel de Icaza <miguel@ximian.com>
9227 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
9229 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
9232 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
9233 tokens, numbers and strings.
9235 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
9238 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
9239 asyncronous parameters and the regular parameters.
9241 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
9242 specify the target directory.
9244 * expression.cs: (This.DoResolve): Simplify
9245 (As.Emit): Optimize, do not generate IsInst if the expression is
9246 always of the given type.
9248 (Is.DoResolve): Bug fix, we were reporting both always/never for
9251 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
9252 creating too many unnecessary arrays.
9254 2002-03-31 Miguel de Icaza <miguel@ximian.com>
9256 * class.cs (EmitFieldInitializer): Use Assign expression to assign
9257 fields instead of rolling our own initializer. Takes care of all
9258 implicit conversions, and drops unnecessary static checks/argument.
9260 2002-03-31 Dick Porter <dick@ximian.com>
9262 * driver.cs: use the GetDirectories() return values properly, and
9263 use "/" as path separator.
9265 2002-03-30 Miguel de Icaza <miguel@ximian.com>
9267 * expression.cs (Unary): Optimize - - expr into expr.
9268 (Binary): Optimize a + (-b) into a -b.
9270 * codegen.cs (CodeGen): Made all methods static.
9272 2002-03-29 Miguel de Icaza <miguel@ximian.com>
9276 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
9277 TypeBuilder property.
9279 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
9282 * tree.cs: Removed the various RecordXXXX, and replaced with a
9283 single RecordDecl. Removed all the accessor methods, and just
9284 left a single access point Type
9286 * enum.cs: Rename DefineEnum to DefineType.
9288 * decl.cs: New abstract method `DefineType' used to unify the
9289 Defines for Enumerations, Interfaces, TypeContainers and
9292 (FindType): Moved LookupInterfaceOrClass here. Moved the
9293 LookupBaseClasses method that used to live in class.cs and
9294 interface.cs here, and renamed to FindType.
9296 * delegate.cs: Implement DefineType. Take advantage of the
9297 refactored pattern for locating the parent builder without taking
9298 the parent_builder argument (which we know does not work if we are
9299 nested, and triggering a toplevel definition).
9301 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9303 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
9304 accessibility of a member has changed during override and report
9307 * class.cs (Method.Define, Property.Define): Only complain on
9308 overrides if the method is private, any other accessibility is
9309 fine (and since we just checked the permission is the same, we are
9312 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
9313 and elif are processed always. The other pre-processing
9314 directives are only processed if we are "taking" the path
9316 2002-03-29 Martin Baulig <martin@gnome.org>
9318 * class.cs (Method.Emit): Only emit symbolic debugging info if the
9319 current location is not Null.
9321 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
9322 a separate method so we can profile it.
9324 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
9325 `span.Seconds' are just seconds, but no minutes or hours.
9326 (MainDriver): Profile the CodeGen.SaveSymbols calls.
9328 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9330 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
9331 Remove the gratuitous set of Final:
9333 // If an interface implementation, then we can set Final.
9334 if (((flags & MethodAttributes.Abstract) == 0) &&
9335 implementing.DeclaringType.IsInterface)
9336 flags |= MethodAttributes.Final;
9338 I do not know what I was smoking when I used that.
9341 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
9342 step into fixing the name resolution issues for delegates and
9343 unifying the toplevel name resolution.
9345 2002-03-28 Martin Baulig <martin@gnome.org>
9347 * class.cs (Method.Emit): If we have a symbol writer, call its
9348 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
9349 tell it about the current method.
9351 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
9352 writer that we're going to emit the first byte of IL code for a new
9353 statement (a new source line).
9354 (EmitContext.EmitTopBlock): If we have a symbol writer, call
9355 EmitContext.Mark() before emitting any code.
9357 * location.cs (SymbolDocument): Return null when we're Null.
9359 * statement.cs (Statement): Moved the `Location loc' variable here.
9360 (Statement.EmitBoolExpression): If we have a symbol writer, call
9361 ec.Mark() before emitting any code to tell it that we're at the
9362 beginning of a new statement.
9363 (StatementExpression): Added `Location' argument to the constructor.
9364 (Block): Added public readonly variable `StartLocation' and public
9365 variable `EndLocation'. The latter is to be set using SetEndLocation().
9366 (Block): Added constructor which takes a start and end location.
9367 (Block.SetEndLocation): New method. This sets the end location.
9368 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
9369 local variables we create.
9370 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
9371 each statement and do also mark the begin and end of the block.
9373 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
9374 tell it the current lexer.Location, use Location.Null for the end of the
9376 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
9377 current block, set its end location using SetEndLocation().
9378 (statement_expression): StatementExpression constructor now takes the
9379 lexer.Location as additional argument.
9380 (for_statement, declare_local_variables): Likewise.
9381 (declare_local_variables): When creating a new implicit block, use the
9382 new Block constructor and pass it the lexer.Location.
9384 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9386 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
9387 members also on the parent interfaces recursively.
9389 2002-03-27 Miguel de Icaza <miguel@ximian.com>
9391 * report.cs: Use new formats, since Gonzalo finished the missing
9394 * expression.cs (Binary.ResolveOperator): added missing operator|
9395 operator& and operator^ for bool/bool.
9397 * cs-parser.jay: CheckDef now takes a Location argument that is
9398 used to report errors more precisly (instead of reporting the end
9399 of a definition, we try to track something which is a lot closer
9400 to the source of the problem).
9402 * cs-tokenizer.cs: Track global token use, so we can properly flag
9403 the use of #define/#undef after the first token has been seen.
9405 Also, rename the reportXXXX to Error_DescriptiveName
9407 * decl.cs (DeclSpace.IsTopLevel): Move property here from
9408 TypeContainer, so that Enum and Interface can use this too.
9410 * class.cs (TypeContainer.LookupInterfaceOrClass,
9411 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
9412 `builder' argument. Typically this was used to pass the parent
9413 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
9416 The problem is that a nested class could trigger the definition of
9417 a toplevel class, and the builder would be obviously wrong in that
9420 So we drop this argument, and we compute dynamically the
9421 TypeBuilder/ModuleBuilder (the correct information was available
9422 to us anyways from DeclSpace.Parent)
9424 * interface.cs (Interface.DefineInterface): Drop builder
9425 parameter cleanup like class.cs
9427 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
9430 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
9433 (Try.Emit): Propagate the returns value from the statement.
9435 (Return.Emit): Even if we are leavning
9437 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
9439 * modifiers.cs: Fix the computation of MethodAttributes flags.
9441 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
9443 * driver.cs: allow compilation of files that start with '/'.
9444 Add a default case when checking the argument of --target.
9446 2002-03-25 Miguel de Icaza <miguel@ximian.com>
9448 * interface.cs: Implement the same search algorithm for types in
9451 * delegate.cs: Do not allow multiple definition.
9453 * Recovered ChangeLog that got accidentally amputated
9455 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
9457 * rootcontext.cs: Load manually enum to allow core classes to
9458 contain enumerations.
9460 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
9461 Update to new static methods in TypeManager.
9463 * typemanager.cs (GetMethod, GetConstructor): Use our
9464 implementation of FindMembers to find the members, since during
9465 corlib compilation, the types are TypeBuilders and GetMethod and
9466 GetConstructor do not work.
9468 Make all methods in TypeManager static.
9470 (InitCodeHelpers): Split the functionality from
9471 the InitCodeTypes function.
9473 * driver.cs: Call InitCodeHelpers after we have populated the
9476 * cs-parser.jay (delegate_declaration): we did not used to compute
9477 the delegate name correctly for void delegates.
9479 2002-03-24 Miguel de Icaza <miguel@ximian.com>
9481 * rootcontext.cs (RootContext): Init the interface_resolve_order
9482 and type_container_resolve_order always.
9484 (ResolveCore, BootstrapCorlib_ResolveClass,
9485 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
9486 compiler when compiling with --nostdlib
9488 * class.cs (TypeContainer.DefineType): Check that our parent is
9489 not null. This test is most important when we are bootstraping
9492 * codegen.cs: Split out the symbol writing code.
9494 2002-03-25 Martin Baulig <martin@gnome.org>
9496 * driver.cs (-g): Made -g an alias for --debug.
9498 2002-03-24 Martin Baulig <martin@gnome.org>
9500 * codegen.cs (SymbolWriter): New public variable. Returns the
9501 current symbol writer.
9502 (CodeGen): Added `bool want_debugging_support' argument to the
9503 constructor. If true, tell the ModuleBuild that we want debugging
9504 support and ask it for the ISymbolWriter.
9505 (Save): If we have a symbol writer, call it's Close() method after
9506 saving the assembly.
9508 * driver.c (--debug): New command line argument to create a
9509 debugger information file.
9511 * location.cs (SymbolDocument): New public property. Returns an
9512 ISymbolDocumentWriter object for the current source file or null
9513 if we don't have a symbol writer.
9515 2002-03-21 Miguel de Icaza <miguel@ximian.com>
9517 * driver.cs (LoadAssembly): Correctly return when all the paths
9518 have been tried and not before.
9520 * statement.cs (Switch.Emit): return the actual coverage for this
9521 statement (returns/not-returns)
9523 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
9524 switch of the statement if we are the last switch section. That
9525 kills two problems: try/catch problems (we used to emit an empty
9526 nop at the end) and switch statements where all branches would
9529 2002-03-19 Miguel de Icaza <miguel@ximian.com>
9531 * driver.cs: Add default assemblies (the equivalent to the
9532 Microsoft CSC.RSP file)
9534 * cs-tokenizer.cs: When updating `cols and setting it to zero,
9535 also update tokens_seen and set it to false.
9537 * driver.cs: Implement --recurse for Mike.
9539 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
9540 correctly splitting out the paths.
9542 2002-03-18 Miguel de Icaza <miguel@ximian.com>
9544 * interface.cs (Interface.PopulateProperty): Instead of using
9545 `parent' as the declaration space for the set parameters, use
9548 * support.cs (InternalParameters): InternalParameters constructor
9549 takes a DeclSpace instead of a TypeContainer.
9551 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
9552 types are being initialized, load the address of it before calling
9555 (New): Provide a mechanism to disable the generation of local
9556 value type temporaries when the caller will be providing us with
9557 an address to store it.
9559 (ArrayCreation.EmitDynamicInitializers): Use it.
9561 2002-03-17 Miguel de Icaza <miguel@ximian.com>
9563 * expression.cs (Invocation.EmitArguments): Only probe for array
9564 property if there is more than one argument. Sorry about that.
9566 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
9569 * class.cs (Method.LabelParameters): Fix incorrect code path that
9570 prevented the `ParamArrayAttribute' from being applied to the
9573 2002-03-16 Miguel de Icaza <miguel@ximian.com>
9575 * support.cs (ReflectionParameters): Correctly compute whether the
9576 last argument is a params array. Fixes the problem with
9579 * typemanager.cs: Make the assemblies array always be non-null
9580 (empty, but non-null)
9582 * tree.cs (RecordDecl): New function that abstracts the recording
9583 of names. This reports error 101, and provides a pointer to the
9584 previous declaration. Fixes a crash in the compiler.
9586 * cs-parser.jay (constructor_declaration): Update to new grammar,
9587 and provide a constructor_body that can be empty.
9589 2002-03-15 Miguel de Icaza <miguel@ximian.com>
9591 * driver.cs: Add support for --resources.
9593 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
9594 Make all types for the various array helper methods be integer.
9596 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9597 CheckState to ConvCast.
9599 (ConvCast): Now it takes a `checked' state argument, to avoid
9600 depending on the emit context for the conversion, and just using
9601 the resolve time setting.
9603 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
9604 instead of Invocation.EmitArguments. We do not emit the original
9605 arguments, instead we emit those which have been converted to
9606 unsigned int expressions.
9608 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
9610 * codegen.cs: ditto.
9612 * expression.cs (LocalVariableReference): Drop the use of the
9613 Store function that depended on the variable index.
9615 * statement.cs (VariableInfo): Drop the `Idx' property from this
9616 class, as this is not taking into account the indexes for
9617 temporaries tat we generate during the execution, getting the
9620 * class.cs: First emit class initializers, then call the parent
9623 * expression.cs (Binary): Fix opcode emision.
9624 (UnaryMutator.EmitCode): Support checked code generation
9626 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9627 matches for events for both the Static and Instance scans,
9628 pointing to the same element. Fix that.
9630 2002-03-14 Miguel de Icaza <miguel@ximian.com>
9632 * rootcontext.cs (ResolveTree): Always set the
9633 interface_resolve_order, because nested interfaces will be calling
9636 * class.cs (GetInterfaceOrClass): Track the same resolution
9637 process used by TypeManager.LookupType. This fixes the nested
9638 type lookups in class declarations (separate path from
9641 (TypeContainer.DefineType): Also define nested interfaces.
9642 (TypeContainer.RegisterOrder): New public function used to
9643 register the order in which child interfaces need to be closed.
9645 Nested interfaces need to be closed after their parents have been
9648 * interface.cs (InterfaceAttr): Put all the logic for computing
9649 the interface attribute here.
9651 (DefineInterface): Register our interface order with the
9652 RootContext or with the TypeContainer depending on the case.
9654 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9656 * cs-parser.jay: rework foreach statement to work with the new
9657 changes to the policy on SimpleNames.
9659 * report.cs: support Stacktrace on warnings as well.
9661 * makefile: drop --unsafe and /unsafe from the compile.
9663 2002-03-13 Ravi Pratap <ravi@ximian.com>
9665 * ecore.cs (StandardConversionExists): Modify to take an Expression
9666 as the first parameter. Ensure we do null -> reference type conversion
9669 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9670 temporary Expression objects.
9672 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9674 * interface.cs: workaround bug in method overloading resolution
9675 (there is already a bugzilla bug for it).
9677 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9679 We could also solve this problem by having a separate path for
9680 performing type lookups, instead of DoResolve, we could have a
9681 ResolveType entry point, and only participating pieces of the
9682 production (simplename, deref, array) would implement this.
9684 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9685 signal SimpleName to only resolve type names and not attempt to
9686 resolve anything else.
9688 * expression.cs (Cast): Set the flag.
9690 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9692 * class.cs: Only report 108 if there is no `new' modifier.
9694 * cs-parser.jay: rework foreach statement to work with the new
9695 changes to the policy on SimpleNames.
9697 * report.cs: support Stacktrace on warnings as well.
9699 * makefile: drop --unsafe and /unsafe from the compile.
9701 2002-03-11 Miguel de Icaza <miguel@ximian.com>
9703 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9704 lookups here, instead of doing that at parse time. This means
9705 that our grammar will not introduce `LocalVariableReferences' as
9706 expressions at this point. That solves the problem of code like
9714 This is only half the fix. The full fix requires parameters to
9715 also be handled in this way.
9717 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9718 makes the use more obvious of the DeclSpace. The
9719 ec.TypeContainer.TypeBuilder is now only used to pull the
9722 My theory is that I can get rid of the TypeBuilder completely from
9723 the EmitContext, and have typecasts where it is used (from
9724 DeclSpace to where it matters).
9726 The only pending problem is that the code that implements Aliases
9727 is on TypeContainer, and probably should go in DeclSpace.
9729 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9730 lookups here, instead of doing that at parse time. This means
9731 that our grammar will not introduce `LocalVariableReferences' as
9732 expressions at this point. That solves the problem of code like
9740 This is only half the fix. The full fix requires parameters to
9741 also be handled in this way.
9743 * class.cs (Property.DefineMethod): When implementing an interface
9744 method, set newslot, when implementing an abstract method, do not
9745 set the flag (before we tried never setting it, or always setting
9746 it, which is the difference).
9747 (Indexer.DefineMethod): same.
9748 (Method.DefineMethod): same.
9750 * ecore.cs: Only set the status used flag if we get back a Field.
9752 * attribute.cs: Temporary hack, so Paolo can keep working.
9754 2002-03-08 Ravi Pratap <ravi@ximian.com>
9756 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9757 the unmanaged type in the case we have a MarshalAs attribute.
9759 (Resolve): Handle the case when we are parsing the special MarshalAs
9760 attribute [we need to store the unmanaged type to use later]
9762 * typemanager.cs (marshal_as_attr_type): Built in type for the
9763 MarshalAs Attribute.
9765 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
9766 on parameters and accordingly set the marshalling info.
9768 2002-03-09 Miguel de Icaza <miguel@ximian.com>
9770 * class.cs: Optimizing slightly by removing redundant code after
9771 we switched to the `NoTypes' return value.
9772 (Property.DefineMethod): use NoTypes here too.
9774 This fixes the bug I introduced in my last batch of changes.
9776 2002-03-05 Ravi Pratap <ravi@ximian.com>
9778 * tree.cs (RecordEnum): Add. We now keep track of enums too.
9780 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9781 Enums since those are types too.
9783 * cs-parser.jay (enum_declaration): Record enums as we parse them.
9785 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
9786 thanks to a call during the lookup process.
9788 2002-03-07 Miguel de Icaza <miguel@ximian.com>
9790 * statement.cs (Foreach): Lots of work to accomodate a particular
9791 kind of foreach statement that I had not kept in mind. It is
9792 possible to have foreachs on classes that provide a GetEnumerator
9793 method that return objects that implement the "pattern" for using
9794 a foreach, there is no need to support GetEnumerator
9797 This is needed to compile nant.
9799 * decl.cs: Only report 114 if the member is not `Finalize' and if
9800 the warning level is at least 2.
9802 * class.cs: Moved the compare function from Method to
9805 (MethodSignature.InheritableMemberSignatureCompare): Add new
9806 filter function that is used to extract inheritable methods from a
9809 (Method.Define): Use the new `inheritable_method_signature_filter'
9812 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9815 2002-03-06 Miguel de Icaza <miguel@ximian.com>
9817 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9819 * cs-parser.jay: Add opt_semicolon to the interface declaration.
9821 * expression.cs: Pass location information to
9822 ConvertImplicitStandard.
9824 * class.cs: Added debugging code to track return values from
9827 2002-03-05 Miguel de Icaza <miguel@ximian.com>
9829 * expression.cs (Is.DoResolve): If either side of the `is' is an
9830 interface, do not flag the warning.
9832 * ecore.cs (ImplicitReferenceConversion): We need a separate test
9835 * report.cs: Allow for --fatal to be used with --probe.
9837 * typemanager.cs (NoTypes): Move the definition for the empty Type
9840 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9842 (TypeContainer.DefineProxy): New function used to proxy to parent
9843 implementations when implementing interfaces.
9844 (TypeContainer.ParentImplements): used to lookup if our parent
9845 implements a public function that is required by an interface.
9846 (TypeContainer.VerifyPendingMethods): Hook this up.
9848 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9849 `modules' and `assemblies' arraylists into arrays. We only grow
9850 these are the very early start up of the program, so this improves
9851 the speedof LookupType (nicely measured).
9853 * expression.cs (MakeByteBlob): Replaced unsafe code with
9854 BitConverter, as suggested by Paolo.
9856 * cfold.cs (ConstantFold.Binary): Special case: perform constant
9857 folding of string concatenation, but if either side is a string,
9858 and the other is not, then return null, and let the runtime use
9859 the concatenation on the string plus the object (using
9862 2002-03-04 Miguel de Icaza <miguel@ximian.com>
9864 Constant Folding has been implemented now.
9866 * expression.cs (Unary.Reduce): Do not throw an exception, catch
9867 the error instead on types that are not supported in one's
9870 * constant.cs (Constant and all children): New set of functions to
9871 perform implict and explicit conversions.
9873 * ecore.cs (EnumConstant): Implement the new functions to perform
9874 conversion by proxying to the child expression.
9876 * codegen.cs: (ConstantCheckState): Constant evaluation has its
9877 own separate setting that can not be turned off from the command
9878 line using --unchecked or --checked and is only controlled using
9879 the checked/unchecked statements and expressions. This setting is
9880 used by the constant folder to flag errors.
9882 * expression.cs (CheckedExpr, UncheckedExpr): Set the
9883 ConstantCheckState as well.
9885 During Resolve, they also have to flag the state, because the
9886 constant folder runs completely in the Resolve phase.
9888 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9891 2002-03-01 Miguel de Icaza <miguel@ximian.com>
9893 * cfold.cs: New file, this file contains the constant folder.
9895 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9896 argument to track whether we are using the resulting address to
9897 load or store a value and provide better error messages.
9899 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9900 new AddressOf arguments.
9902 * statement.cs (Foreach.EmitCollectionForeach): Update
9904 * expression.cs (Argument.Emit): Call AddressOf with proper
9905 arguments to track usage.
9907 (New.DoEmit): Call AddressOf with new arguments.
9909 (Unary.Emit): Adjust AddressOf call.
9911 2002-03-01 Ravi Pratap <ravi@ximian.com>
9913 * cs-parser.jay (member_access): Change the case for pre-defined types
9914 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
9917 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9920 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9921 essentially like methods and apply attributes like MethodImplOptions to them too.
9923 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9926 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9927 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
9930 * Update code everywhere accordingly.
9932 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
9934 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
9936 2002-02-28 Ravi Pratap <ravi@ximian.com>
9938 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
9939 try performing lookups against those instead of jumping straight into using
9940 the 'using' clauses.
9942 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
9944 (LookupType): Perform lookups in implicit parents too.
9946 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
9947 sequence as RootContext.LookupType.
9949 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
9950 the various cases of namespace lookups into this method.
9952 2002-03-01 Miguel de Icaza <miguel@ximian.com>
9954 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
9955 in positional arguments)
9957 * class.cs (Operator): Update the AllowedModifiers to contain
9960 * cs-parser.jay: Update operator declaration to allow for the
9961 operator body to be empty.
9963 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
9966 2002-02-27 Miguel de Icaza <miguel@ximian.com>
9968 * class.cs (Method.Emit): Label parameters.
9970 * driver.cs: Return 1 or 0 as the program exit code.
9972 2002-02-26 Miguel de Icaza <miguel@ximian.com>
9974 * expression.cs: Special case the `null' object when trying to
9975 auto-compute the type, as anything can be explicitly converted to
9978 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
9979 spotting this Paolo.
9981 (Expression.ImplicitNumericConversion): Perform comparissions of
9982 the type using the underlying type in the case of an enumeration
9983 rather than using the enumeration type for the compare.
9985 Cope with the underlying == type case, which is not possible to
9988 (Expression.ConvertNumericExplicit): Perform comparissions of
9989 the type using the underlying type in the case of an enumeration
9990 rather than using the enumeration type for the compare.
9992 * driver.cs: If the user does not supply an extension, assume .exe
9994 * cs-parser.jay (if_statement): Rewrote so that we can track the
9995 location for the if statement.
9997 * expression.cs (Binary.ConstantFold): Only concat strings when
9998 the operation is "+", not everything ;-)
10000 * statement.cs (Statement.EmitBoolExpression): Take a location
10002 (If, While, Do): Track location.
10004 * expression.cs (Binary.ResolveOperator): In the object + string
10005 case, I was missing a call to ConvertImplicit
10007 2002-02-25 Ravi Pratap <ravi@ximian.com>
10009 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
10010 Location arguments. Ensure we use RootContext.LookupType to do our work
10011 and not try to do a direct Type.GetType and ModuleBuilder.GetType
10013 * interface.cs (PopulateMethod): Handle the type of the parameter being
10016 * expression.cs (Invocation.BetterFunction): Handle the case when we
10017 have a params method with no fixed arguments and a call is made with no
10020 2002-02-25 Miguel de Icaza <miguel@ximian.com>
10022 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
10023 the verbatim-string-literal
10025 * support.cs (InternalParameters.ParameterModifier): handle null
10027 (InternalParameters.ParameterType): ditto.
10029 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
10030 duplicating the name of the variable parameter.
10031 (GetParameterByName): Fix bug where we were not looking up array
10032 paramters if they were the only present (thanks Paolo!).
10033 (GetParameterInfo): We only have an empty set of types if both
10034 fixed and array are set to null.
10035 (GetParameterInfo-idx): Handle FixedParameter == null
10037 * cs-parser.jay: Handle the case where there is no catch
10038 statements (missing null test).
10040 2002-02-22 Miguel de Icaza <miguel@ximian.com>
10042 * driver.cs (MainDriver): Be conservative on our command line
10045 Catch DirectoryNotFoundException when calling GetFiles.
10047 (SplitPathAndPattern): Used to split the input specification into
10048 a path and a pattern that we can feed to Directory.GetFiles.
10050 2002-02-21 Miguel de Icaza <miguel@ximian.com>
10052 * statement.cs (Fixed): Implement the last case of the Fixed
10053 statement (string handling).
10055 * expression.cs (StringPtr): New class used to return a char * to
10056 a string; Used by the Fixed statement.
10058 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
10060 * expression.cs (Binary.ResolveOperator): Remove redundant
10061 MemberLookup pn parent type.
10062 Optimize union call, we do not need a union if the types are the same.
10063 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
10066 Specialize the use of MemberLookup everywhere, instead of using
10067 the default settings.
10069 (StackAlloc): Implement stackalloc keyword.
10071 * cs-parser.jay: Add rule to parse stackalloc.
10073 * driver.cs: Handle /h, /help, /?
10075 * expression.cs (MakeByteBlob): Removed the hacks we had in place
10076 before we supported unsafe code.
10078 * makefile: add --unsafe to the self compilation of mcs.
10080 2002-02-20 Miguel de Icaza <miguel@ximian.com>
10082 * expression.cs (PointerArithmetic): New class that is used to
10083 perform pointer arithmetic.
10084 (Binary.Resolve): Handle pointer arithmetic
10085 Handle pointer comparission.
10086 (ArrayPtr): Utility expression class that is used to take the
10087 address of an array.
10089 (ElementAccess): Implement array access for pointers
10091 * statement.cs (Fixed): Implement fixed statement for arrays, we
10092 are missing one more case before we are done.
10094 * expression.cs (Indirection): Implement EmitAssign and set the
10095 ExprClass to Variable. This allows pointer dereferences to be
10096 treated as variables, and to have values assigned to them.
10098 * ecore.cs (Expression.StoreFromPtr): New utility function to
10099 store values dereferencing.
10101 2002-02-20 Ravi Pratap <ravi@ximian.com>
10103 * expression.cs (Binary.ResolveOperator): Ensure that we are
10104 not trying to operate on a void type - this fixes the reported
10107 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
10108 the parent implementation is sealed.
10110 * ../errors/cs0239.cs : Add.
10112 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
10114 * typemanager.cs (unverifiable_code_type): Corresponds to
10115 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
10116 which have unsafe code in them.
10118 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
10121 2002-02-19 Miguel de Icaza <miguel@ximian.com>
10123 * cs-tokenizer.cs: Add support for @"litreal strings"
10125 Make tokenizer accept pre-processor directives
10126 on any column (remove the old C-like limitation).
10128 * rootcontext.cs (EmitCode): Emit any global attributes.
10129 (AddGlobalAttributes): Used to keep track of assembly attributes.
10131 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
10133 * cs-parser.jay: Add support for global attributes.
10135 2002-02-17 Miguel de Icaza <miguel@ximian.com>
10137 * expression.cs (Indirection): New helper class. Unary will
10138 create Indirection classes to be able to implement the
10139 IMemoryLocation interface on it.
10141 2002-02-16 Miguel de Icaza <miguel@ximian.com>
10143 * cs-parser.jay (fixed_statement): reference the right statement.
10145 * statement.cs (Fixed.Emit): Finish implementing the fixed
10146 statement for the &x case.
10148 2002-02-14 Miguel de Icaza <miguel@ximian.com>
10150 * class.cs (Property.Define, Method.Define): Remove newslot when
10153 * modifiers.cs: My use of NewSlot when `Abstract' was set was
10154 wrong. NewSlot should only be used if the `new' keyword is present.
10156 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
10157 locating our system dir. Sorry about this.
10159 2002-02-13 Miguel de Icaza <miguel@ximian.com>
10161 * driver.cs (GetSystemDir): Compute correctly the location of our
10162 system assemblies. I was using the compiler directory instead of
10163 the library directory.
10165 2002-02-13 Ravi Pratap <ravi@ximian.com>
10167 * expression.cs (BetterFunction): Put back in what Miguel commented out
10168 since it is the correct fix. The problem is elsewhere ;-)
10170 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
10171 parameters of the parms method are themselves compatible or not !
10173 (StandardConversionExists): Fix very dangerous bug where we were forgetting
10174 to check that a class implements an interface before saying that an implicit
10175 conversion was allowed. Use ImplementsInterface to do the checking.
10177 2002-02-13 Miguel de Icaza <miguel@ximian.com>
10179 * class.cs (Method.Define): Track whether we are an explicit
10180 implementation or not. And only call DefineMethodOverride if we
10181 are an explicit implementation.
10183 (Property.DefineMethod): Ditto.
10185 2002-02-11 Ravi Pratap <ravi@ximian.com>
10187 * expression.cs (BetterFunction): Catch hideous bug which was
10188 preventing us from detecting ambiguous calls due to implicit casts i.e
10191 2002-01-29 Miguel de Icaza <miguel@ximian.com>
10193 * support.cs (Pair): Remove un-needed method. I figured why I was
10194 getting the error in cs-parser.jay, the variable in a foreach loop
10195 is readonly, and the compiler does not really treat this as a variable.
10197 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
10198 instead of EQUALS in grammar.
10200 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
10202 * expression.cs (Unary.DoResolve): Check whether the argument is
10205 2002-01-28 Miguel de Icaza <miguel@ximian.com>
10207 * support.cs: Api for Pair to set a value. Despite the fact that
10208 the variables are public the MS C# compiler refuses to compile
10209 code that accesses the field if the variable is part of a foreach
10212 * statement.cs (Fixed): Begin implementation of the fixed
10215 (Block.AddVariable): Return the VariableInfo on success and null
10216 on failure instead of true/false.
10218 * cs-parser.jay (foreach): Catch errors on variables already
10219 defined (we were ignoring this value before) and properly unwind
10220 the block hierarchy
10222 (fixed_statement): grammar for the fixed statement.
10224 2002-01-25 Miguel de Icaza <miguel@ximian.com>
10226 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
10227 pointer types to be incretemented.
10229 (SizeOf): Implement.
10231 * cs-parser.jay (pointer_member_access): Implement
10232 expr->IDENTIFIER production.
10234 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
10235 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
10238 (Unary): Implement indirection.
10240 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
10241 use in non-unsafe context).
10243 (SimpleName.DoResolve): Check for pointers in field access on safe
10246 (Expression.LoadFromPtr): Factor the load-indirect code in this
10247 function. This was duplicated in UnboxCast and ParameterReference
10249 2002-01-24 Miguel de Icaza <miguel@ximian.com>
10251 * expression.cs (ComposedCast): report an error if a pointer cast
10252 is used in a safe region.
10254 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
10255 pointer type casts in unsafe context.
10257 * codegen.cs (EmitContext): Set up IsUnsafe.
10259 * cs-parser.jay (non_expression_type): Add productions for pointer
10262 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
10263 code. We should not use force into static mode if the method is
10264 not virtual. Fixes bug in MIS
10266 * statement.cs (Do.Emit, While.Emit, For.Emit,
10267 Statement.EmitBoolExpression): Add support to Do and While to
10268 propagate infinite loop as `I do return' semantics.
10270 Improve the For case to also test for boolean constants.
10272 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
10273 to the list of attributes we can add.
10275 Remove `EmitContext' argument.
10277 * class.cs (Method.Define): Apply parameter attributes.
10278 (Constructor.Define): Apply parameter attributes.
10279 (MethodCore.LabelParameters): Move here the core of labeling
10282 * support.cs (ReflectionParameters.ParameterModifier,
10283 InternalParameters.ParameterModifier): Use IsByRef on the type and
10284 only return the OUT bit for these parameters instead of in/out/ref
10287 This is because I miss-understood things. The ParameterInfo.IsIn
10288 and IsOut represent whether the parameter has the [In] and [Out]
10291 2002-01-22 Miguel de Icaza <miguel@ximian.com>
10293 * ecore.cs (FieldExpr.Emit): Release temporaries.
10295 * assign.cs (LocalTemporary.Release): new function.
10297 * codegen.cs (EmitContext.GetTemporaryStorage,
10298 EmitContext.FreeTemporaryStorage): Rework the way we deal with
10299 temporary storage. Now we can "put back" localbuilders when we
10302 2002-01-21 Miguel de Icaza <miguel@ximian.com>
10304 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
10305 need to make a copy of the variable to generate verifiable code.
10307 2002-01-19 Miguel de Icaza <miguel@ximian.com>
10309 * driver.cs: Compute dynamically the system directory.
10311 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
10312 Slower, but more generally useful. Used by the abstract
10313 registering implementation.
10315 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
10316 the rules for the special rule on Type/instances. First check if
10317 we have the same name, and if so, try that special static path
10318 rather than the instance path.
10320 2002-01-18 Miguel de Icaza <miguel@ximian.com>
10322 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
10325 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
10326 Enum, ValueType, Delegate or Array for non-corlib compiles.
10328 * cs-tokenizer.cs: Catch long identifiers (645)
10330 * typemanager.cs (IndexerPropetyName): Ravi never tested this
10333 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
10334 fix, we were returning too early, so we were not registering
10335 pending methods from abstract classes.
10337 Do not register pending methods if the class is abstract.
10339 * expression.cs (Conditional.DoResolve): Report circular implicit
10340 conversions when we neecd to compute it for conditional
10343 (Is.DoResolve): If the expression is always of the provided type,
10344 flag warning 183. If the expression can not ever be of the
10345 provided type flag warning 184.
10347 * class.cs: Catch 169 as well.
10349 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
10352 2002-01-18 Nick Drochak <ndrochak@gol.com>
10354 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
10356 2002-01-17 Miguel de Icaza <miguel@ximian.com>
10358 * interface.cs: (PopulateMethod): Check for pointers being defined
10359 only if the unsafe context is active.
10360 (PopulateProperty): ditto.
10361 (PopulateIndexer): ditto.
10363 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
10364 specified. If pointers are present, make sure that they are
10365 present in an unsafe context.
10366 (Constructor, Constructor.Define): ditto.
10367 (Field, Field.Define): ditto.
10368 (Property, Property.Define): ditto.
10369 (Event, Event.Define): ditto.
10371 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
10372 hashtable if there are classes or structs defined.
10374 * expression.cs (LocalVariableReference.DoResolve): Simplify this
10375 code, as the constant resolution moved.
10377 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
10378 the metadata, so we can flag error 133.
10380 * decl.cs (MemberCore.UnsafeOK): New function to test that a
10381 pointer is being declared in an unsafe context.
10383 2002-01-16 Miguel de Icaza <miguel@ximian.com>
10385 * modifiers.cs (Modifiers.Check): Require a Location argument.
10386 Report error 227 for Unsafe use.
10388 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
10390 * statement.cs (For.Emit): If the test is null, then report that
10391 we do `return', as we wont reach anything afterwards.
10393 (Switch.SwitchGoverningType): Track the expression that matched
10396 * driver.cs: Allow negative numbers as an error code to flag.
10398 * cs-parser.jay: Handle 1551.
10400 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
10402 2002-01-15 Miguel de Icaza <miguel@ximian.com>
10404 * cs-parser.jay: Report 1518 (type declaration can only contain
10405 class, struct, interface, enum or delegate)
10407 (switch_label): Report 1523 (keywords `case' or `default' must
10410 (opt_switch_sections): Report 1522 (empty switch)
10412 * driver.cs: Report 1515 (response file specified multiple times)
10413 Report 1516 (Source file specified multiple times).
10415 * expression.cs (Argument.Resolve): Signal 1510
10417 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
10418 access not allowed in static code)
10420 2002-01-11 Ravi Pratap <ravi@ximian.com>
10422 * typemanager.cs (IsPointerType): Utility method which we are going
10425 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
10426 the object type, so we take care of that.
10428 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
10430 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
10431 added to non-params parameters :-)
10433 * typemanager.cs (CSharpName): Include 'void' type too.
10435 (void_ptr_type): Include in the set of core types.
10437 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
10440 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
10443 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
10444 completely forgotten about it.
10446 2002-01-10 Ravi Pratap <ravi@ximian.com>
10448 * cs-parser.jay (pointer_type): Add. This begins our implementation
10449 of parsing rules for unsafe code.
10451 (unsafe_statement): Implement.
10453 (embedded_statement): Modify to include the above.
10455 * statement.cs (Unsafe): Implement new class for unsafe blocks.
10457 * codegen.cs (EmitContext.InUnsafe): Add. This determines
10458 if the current context is an unsafe one.
10460 * cs-parser.jay (local_variable_pointer_type): Since local variable types
10461 are handled differently, we need separate rules for them.
10463 (local_variable_declaration): Update to use local_variable_pointer_type
10464 to allow variable declarations of unmanaged pointer types.
10466 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
10467 in unsafe contexts.
10469 * ../errors/cs0214.cs : Add.
10471 2002-01-16 Nick Drochak <ndrochak@gol.com>
10473 * makefile: remove 'response' file when cleaning.
10475 2002-01-15 Miguel de Icaza <miguel@ximian.com>
10477 * cs-parser.jay: Report 1524.
10479 2002-01-14 Miguel de Icaza <miguel@ximian.com>
10481 * typemanager.cs (RegisterMethod): drop checking if we have
10482 registered this from here
10484 2002-01-12 Miguel de Icaza <miguel@ximian.com>
10486 * class.cs (Method.EmitDestructor): Implement calling our base
10489 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
10490 value of InFinally.
10492 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
10493 this routine and will wrap the call in a try/catch block. Deal
10496 2002-01-11 Miguel de Icaza <miguel@ximian.com>
10498 * ecore.cs (Expression.MemberLookup): instead of taking a
10499 parameter `same_type' that was used to tell whether we could
10500 access private members we compute our containing type from the
10503 (FieldExpr): Added partial support for volatile fields. This does
10504 not work for volatile fields exposed from assemblies, as I can not
10505 figure out how to extract the modreq from it.
10507 Updated all the source files to use this.
10509 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
10510 because it is referenced by MemberLookup very often.
10512 2002-01-09 Ravi Pratap <ravi@ximian.com>
10514 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
10515 TypeBuilder.GetCustomAttributes to retrieve what we need.
10517 Get rid of redundant default_member_attr_type as this is the same as
10518 default_member_type which already exists.
10520 * interface.cs, attribute.cs : Update accordingly.
10522 2002-01-08 Miguel de Icaza <miguel@ximian.com>
10524 * typemanager.cs: Enable IndexerPropertyName again. It does not
10525 work for TYpeBuilders though. Ravi, can you please fix this?
10527 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
10529 * expression.cs (Argument.Emit): Handle the case of ref objects
10530 being passed to ref functions;
10532 (ParameterReference.EmitLoad): Loads the content of the pointer
10533 without dereferencing.
10535 2002-01-07 Miguel de Icaza <miguel@ximian.com>
10537 * cs-tokenizer.cs: Implemented the pre-processing expressions.
10539 2002-01-08 Ravi Pratap <ravi@ximian.com>
10541 * class.cs (Indexer.DefineMethod): Incorporate the interface
10542 type in the name of the method if we are doing explicit interface
10545 * expression.cs (ConversionExists): Remove as it is completely obsolete.
10547 (BetterConversion): Fix extremely trivial bug where we were referring to
10548 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
10551 * ../errors/bug16.cs : Add although we have fixed it.
10553 2002-01-07 Miguel de Icaza <miguel@ximian.com>
10555 * expression.cs (BaseIndexer): Begin implementation.
10557 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
10559 * cs-parser.jay (indexer_declarator): Use qualified_identifier
10560 production directly to remove a shift/reduce, and implement
10561 explicit interface implementation.
10563 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
10564 after a floating point suffix.
10566 * expression.cs (DoNumericPromotions): Improved the conversion for
10567 uint/uint. If we have a constant, we avoid doing a typecast to a
10570 * class.cs (Indexer): Implement explicit interface implementation
10573 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
10575 * class.cs: make the default instance constructor public and hidebysig.
10577 2001-01-03 Ravi Pratap <ravi@ximian.com>
10579 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
10580 so we can call it from elsewhere.
10582 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
10583 we emit it internally if the class has a defined indexer; otherwise the user
10584 emits it by decorating the class definition with the DefaultMemberAttribute.
10586 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
10587 attribute is not used on a type which defines an indexer.
10589 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
10590 character when we skip whitespace.
10592 * ../errors/cs0646.cs : Add.
10594 2002-01-03 Miguel de Icaza <miguel@ximian.com>
10596 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
10599 * makefile: Add practical target `mcs3.exe' which builds the third
10600 generation compiler.
10602 * expression.cs (New): Fix structures constructor calling.
10604 * class.cs (Property, Method, Indexer): Emit Final flag on the
10605 method if we are an interface implementation and we are not
10608 * ecore.cs (PropertyExpr): New public field `IsBase', tells
10609 whether this property is referencing a `base' method.
10611 * expression.cs (Invocation.EmitCall): take an extra argument:
10612 is_base, this is used to determine whether the `call' or
10613 `callvirt' opcode should be used.
10616 * delegate.cs: update EmitCall.
10618 * class.cs (Method.Define): Set NewSlot for the cases where we are
10619 not implementing an interface method.
10621 (Property.Define): ditto.
10623 2002-01-02 Miguel de Icaza <miguel@ximian.com>
10625 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10626 'r'. Allows mcs to parse itself fully.
10628 2002-01-02 Ravi Pratap <ravi@ximian.com>
10630 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10631 of the number of initializers that require the InitializeArray method.
10633 (CheckIndices): Store the Expression in all cases - not the plain value. Also
10634 update the above field where necessary.
10636 (MakeByteBlob): Update accordingly.
10638 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
10641 (EmitDynamicInitializers): Update in accordance with the new optimization.
10643 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10644 same OpCode applies.
10646 * cs-parser.jay : Fix some glaring errors I introduced.
10648 2002-01-01 Ravi Pratap <ravi@ximian.com>
10650 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10651 so that we can check for name clashes there too.
10653 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10654 for interface indexers.
10656 * interfaces.cs (Define): Emit the default member attribute.
10658 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10659 variable was being referred to while setting the value ;-)
10661 2002-01-01 Miguel de Icaza <miguel@ximian.com>
10663 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10664 byte-by-byte information when we know the data is zero.
10666 Make the block always a multiple of 4, because
10667 DefineInitializedData has a bug.
10669 * assign.cs: Fix, we should assign from the temporary, not from
10672 * expression.cs (MakeByteBlob): Fix my incorrect code.
10674 2001-12-31 Miguel de Icaza <miguel@ximian.com>
10676 * typemanager.cs (EnumToUnderlying): This function is used to get
10677 the underlying type from an enumeration, because it does not
10680 * constant.cs: Use the I4_S form for values between -128 and 127.
10682 * statement.cs (Block.LookupLabel): Looks up a label.
10683 (Block): Drop support for labeled blocks.
10685 (LabeledStatement): New kind of statement that represents a label
10688 (Goto): Finally implement this bad boy.
10690 * cs-parser.jay: Update to reflect new mechanism to implement
10693 2001-12-30 Miguel de Icaza <miguel@ximian.com>
10695 * codegen.cs (EmitContext.This): a codegen property that keeps the
10696 a single instance of this instead of creating many different this
10699 * delegate.cs (Delegate.DoResolve): Update to use the property;
10701 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10703 * expression.cs (BaseAccess.DoResolve): Ditto.
10705 2001-12-29 Ravi Pratap <ravi@ximian.com>
10707 * typemanager.cs (methodimpl_attr_type): Add to hold the type
10708 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10710 (InitCoreTypes): Update accordingly.
10712 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10713 so we can quickly store the state.
10715 (ApplyAttributes): Set the correct implementation flags
10716 for InternalCall methods.
10718 2001-12-29 Miguel de Icaza <miguel@ximian.com>
10720 * expression.cs (EmitCall): if a method is not virtual, then do
10721 not use callvirt on it.
10723 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10724 user defined stuff) requires the use of stobj, which takes an
10725 address on the stack instead of an array and an index. So emit
10726 the Ldelema operation for it.
10728 (EmitStoreOpcode): Use stobj for valuetypes.
10730 (UnaryMutator.EmitCode): Use the right 1 value depending on
10731 whether we are dealing with int64/uint64, float or doubles.
10733 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10734 constructors that I implemented last night.
10736 (Constructor.IsDefault): Fix to work properly for static
10739 * cs-parser.jay (CheckDef): report method signature errors.
10740 Update error number 103 to be 132.
10742 * decl.cs: New AdditionResult enumeration value: MethodExists.
10743 Although we do this check for methods later on in the semantic
10744 analysis, catching repeated default constructors is so easy that
10745 we catch these here.
10747 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10750 (ParameterReference.EmitAssign, Emit): handle
10753 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10754 (ArrayAccess.EmitStoreOpcode): ditto.
10756 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10758 * expression.cs (MakeByteBlob): Complete all the missing types
10759 (uint, short, ushort, byte, sbyte)
10761 * class.cs: Only init instance field initializers on instance
10764 Rename `constructors' to instance_constructors.
10766 (TypeContainer.AddConstructor): Only add constructors to the list
10767 if it is not static.
10769 Make sure that we handle default_static_constructor independently
10770 everywhere where we handle instance_constructors
10772 2001-12-28 Miguel de Icaza <miguel@ximian.com>
10774 * class.cs: Do not lookup or create a base initializer for a
10775 static constructor.
10777 (ConstructorInitializer.Resolve): use the proper type to lookup
10780 * cs-parser.jay: Report error 1585 (modifiers between type and name).
10782 * enum.cs, interface.cs: Remove CloseType, this is taken care by
10785 * decl.cs: CloseType is now an virtual method, the default
10786 implementation just closes this type.
10788 2001-12-28 Ravi Pratap <ravi@ximian.com>
10790 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10791 to PreserveSig by default. Also emit HideBySig on such methods.
10793 Basically, set the defaults to standard values.
10795 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10796 argument, if candidate is better, it can't be worse than the best !
10798 (Invocation): Re-write bits to differentiate between methods being
10799 applicable in their expanded form and their normal form - for params
10802 Get rid of use_standard everywhere as only standard conversions are allowed
10803 in overload resolution.
10805 More spec conformance.
10807 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10809 * driver.cs: Add --timestamp, to see where the compiler spends
10812 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10813 `this' in static code.
10815 (SimpleName.DoResolve): Implement in terms of a helper function
10816 that allows static-references to be passed upstream to
10819 (Expression.ResolveWithSimpleName): Resolve specially simple
10820 names when called by MemberAccess to implement the special
10823 (Expression.ImplicitReferenceConversion): Handle conversions from
10824 Null to reference types before others, as Null's type is
10827 * expression.cs (Invocation.EmitCall): Handle the special case of
10828 calling methods declared on a reference type from a ValueType
10829 (Base classes System.Object and System.Enum)
10831 (MemberAccess.Resolve): Only perform lookups on Enumerations if
10832 the left hand side is a TypeExpr, not on every enumeration.
10834 (Binary.Resolve): If types are reference types, then do a cast to
10835 object on operators != and == of both arguments.
10837 * typemanager.cs (FindMembers): Extract instance and static
10838 members if requested.
10840 * interface.cs (PopulateProperty): Use void_type instead of null
10841 as the return type for the setter method.
10843 (PopulateIndexer): ditto.
10845 2001-12-27 Ravi Pratap <ravi@ximian.com>
10847 * support.cs (ReflectionParameters): Fix minor bug where we
10848 were examining the wrong parameter for the ParamArray attribute.
10850 Cope with requests for the type of the parameter at position
10851 greater than the params parameter's. We now return the element
10852 type of the params array as that makes more sense.
10854 * expression.cs (Invocation.IsParamsMethodApplicable): Update
10855 accordingly as we no longer have to extract the element type
10858 (Invocation.OverloadResolve): Update.
10860 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10862 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10863 against IEnumerator, test whether the return value is a descendant
10864 of the IEnumerator interface.
10866 * class.cs (Indexer.Define): Use an auxiliary method to implement
10867 the other bits of the method definition. Begin support for
10868 explicit interface implementation.
10870 (Property.DefineMethod): Use TypeManager.void_type instead of null
10871 for an empty return value.
10873 2001-12-26 Miguel de Icaza <miguel@ximian.com>
10875 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10876 dealing with a FieldExpr which is composed of a FieldBuilder, in
10877 the code path we did extract the constant, but we should have
10878 obtained the underlying value to be able to cast it (otherwise we
10879 end up in an infinite loop, this is what Ravi was running into).
10881 (ArrayCreation.UpdateIndices): Arrays might be empty.
10883 (MemberAccess.ResolveMemberAccess): Add support for section
10884 14.5.4.1 that deals with the special case of E.I when E is a type
10885 and something else, that I can be a reference to a static member.
10887 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10888 handle a particular array type to create byte blobs, it is just
10889 something we dont generate byteblobs for.
10891 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10894 * location.cs (Push): remove the key from the hashtable that we
10895 are about to add. This happens for empty files.
10897 * driver.cs: Dispose files after we have parsed them.
10899 (tokenize): new function that only runs the tokenizer on its
10900 input, for speed testing.
10902 2001-12-26 Ravi Pratap <ravi@ximian.com>
10904 * class.cs (Event.Define): Define the private field only if there
10905 are no accessors defined.
10907 * expression.cs (ResolveMemberAccess): If there is no associated
10908 field with the event, that means we have an event defined with its
10909 own accessors and we should flag error cs0070 since transforming
10910 ourselves into a field is not valid in that case.
10912 * ecore.cs (SimpleName.DoResolve): Same as above.
10914 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10915 and charset to sane values.
10917 2001-12-25 Ravi Pratap <ravi@ximian.com>
10919 * assign.cs (DoResolve): Perform check on events only if they
10920 are being accessed outside the declaring type.
10922 * cs-parser.jay (event_declarations): Update rules to correctly
10923 set the type of the implicit parameter etc.
10925 (add_accessor, remove_accessor): Set current local parameters.
10927 * expression.cs (Binary): For delegate addition and subtraction,
10928 cast the return value from the method into the appropriate delegate
10931 2001-12-24 Ravi Pratap <ravi@ximian.com>
10933 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
10934 of these as the workaround is unnecessary.
10936 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
10937 delegate data - none of that is needed at all.
10939 Re-write bits to extract the instance expression and the delegate method
10942 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
10945 * attribute.cs (ApplyAttributes): New method to take care of common tasks
10946 of attaching attributes instead of duplicating code everywhere.
10948 * everywhere : Update code to do attribute emission using the above method.
10950 2001-12-23 Miguel de Icaza <miguel@ximian.com>
10952 * expression.cs (IsParamsMethodApplicable): if there are not
10953 parameters, return immediately.
10955 * ecore.cs: The 0 literal can be implicity converted to an enum
10958 (SimpleName.DoResolve): First lookup the type, then lookup the
10961 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
10962 want to get its address. If the InstanceExpression is not
10963 addressable, store the result in a temporary variable, then get
10966 * codegen.cs: Only display 219 errors on warning level or above.
10968 * expression.cs (ArrayAccess): Make it implement the
10969 IMemoryLocation interface.
10971 (Binary.DoResolve): handle the operator == (object a, object b)
10972 and operator != (object a, object b) without incurring into a
10973 BoxedCast (because 5 != o should never be performed).
10975 Handle binary enumerator operators.
10977 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
10978 value type, otherwise use Ldelem_ref.
10980 Use precomputed names;
10982 (AddressOf): Implement address of
10984 * cs-parser.jay (labeled_statement): Fix recursive block
10985 addition by reworking the production.
10987 * expression.cs (New.DoEmit): New has a special case:
10989 If we are dealing with a ValueType, we have a few
10990 situations to deal with:
10992 * The target of New is a ValueType variable, that is
10993 easy, we just pass this as the variable reference
10995 * The target of New is being passed as an argument,
10996 to a boxing operation or a function that takes a
10999 In this case, we need to create a temporary variable
11000 that is the argument of New.
11003 2001-12-23 Ravi Pratap <ravi@ximian.com>
11005 * rootcontext.cs (LookupType): Check that current_type is not null before
11006 going about looking at nested types.
11008 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
11009 not implement the IAssignMethod interface any more.
11011 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
11012 where we tranform them into FieldExprs if they are being resolved from within
11013 the declaring type.
11015 * ecore.cs (SimpleName.DoResolve): Do the same here.
11017 * assign.cs (DoResolve, Emit): Clean up code considerably.
11019 * ../errors/bug10.cs : Add.
11021 * ../errors/cs0070.cs : Add.
11023 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
11025 * assign.cs : Get rid of EventIsLocal everywhere.
11027 2001-12-23 Miguel de Icaza <miguel@ximian.com>
11029 * ecore.cs (ConvertIntLiteral): finished the implementation.
11031 * statement.cs (SwitchLabel): Convert the value we are using as a
11032 key before looking up the table.
11034 2001-12-22 Miguel de Icaza <miguel@ximian.com>
11036 * codegen.cs (EmitTopBlock): Require a Location argument now.
11038 * cs-parser.jay (constructor_declarator): We need to setup
11039 current_local_parameters before we parse the
11040 opt_constructor_initializer, to allow the variables to be bound
11041 to the constructor arguments.
11043 * rootcontext.cs (LookupType): First lookup nested classes in our
11044 class and our parents before we go looking outside our class.
11046 * expression.cs (ConstantFold): Extract/debox the values at the
11049 * rootcontext.cs (EmitCode): Resolve the constants first before we
11050 resolve the types. This is not really needed, but it helps debugging.
11052 * statement.cs: report location.
11054 * cs-parser.jay: pass location to throw statement.
11056 * driver.cs: Small bug fix.
11058 * report.cs: Updated format to be 4-zero filled digits.
11060 2001-12-22 Ravi Pratap <ravi@ximian.com>
11062 * expression.cs (CheckIndices): Fix minor bug where the wrong
11063 variable was being referred to ;-)
11065 (DoEmit): Do not call EmitStaticInitializers when the
11066 underlying type is System.Object.
11068 2001-12-21 Ravi Pratap <ravi@ximian.com>
11070 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
11071 and do the usual workaround for SRE.
11073 * class.cs (MyEventBuilder.EventType): New member to get at the type
11074 of the event, quickly.
11076 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
11078 * assign.cs (Assign.DoResolve): Handle the case when the target
11079 is an EventExpr and perform the necessary checks.
11081 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
11084 (SimpleName.MemberStaticCheck): Include check for EventExpr.
11086 (EventExpr): Set the type in the constructor itself since we
11087 are meant to be born fully resolved.
11089 (EventExpr.Define): Revert code I wrote earlier.
11091 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
11092 instance expression is null. The instance expression is a This in that case
11093 or a null, depending on whether it is a static method or not.
11095 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
11096 refers to more than one method.
11098 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
11099 and accordingly flag errors.
11101 2001-12-21 Miguel de Icaza <miguel@ximian.com>
11103 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
11105 2001-12-22 Miguel de Icaza <miguel@ximian.com>
11107 * location.cs (ToString): Provide useful rutine.
11109 2001-12-21 Miguel de Icaza <miguel@ximian.com>
11111 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
11112 objects, return the actual integral boxed.
11114 * statement.cs (SwitchLabel): define an ILLabel for each
11117 (Switch.CheckSwitch): If the value is a Literal, extract
11118 the underlying literal.
11120 Also in the unused hashtable we had, add the SwitchLabel so we can
11121 quickly look this value up.
11123 * constant.cs: Implement a bunch of new constants. Rewrite
11124 Literal based on this. Made changes everywhere to adapt to this.
11126 * expression.cs (Expression.MakeByteBlob): Optimize routine by
11127 dereferencing array only once, and also copes with enumrations.
11129 bytes are two bytes wide, not one.
11131 (Cast): Perform constant conversions.
11133 * ecore.cs (TryImplicitIntConversion): Return literals instead of
11134 wrappers to the literals here.
11136 * expression.cs (DoNumericPromotions): long literals can converted
11137 to ulong implicity (this is taken care of elsewhere, but I was
11138 missing this spot).
11140 * ecore.cs (Expression.Literalize): Make the return type Literal,
11141 to improve type checking.
11143 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
11145 2001-12-20 Miguel de Icaza <miguel@ximian.com>
11147 * literal.cs: Revert code from ravi that checked the bounds. The
11148 bounds are sane by the definition of the type itself.
11150 * typemanager.cs: Fix implementation of ImplementsInterface. We
11151 need to actually look up in our parent hierarchy for interfaces
11154 * const.cs: Use the underlying type for enumerations
11156 * delegate.cs: Compute the basename for the delegate creation,
11157 that should fix the delegate test case, and restore the correct
11158 Type Lookup semantics in rootcontext
11160 * rootcontext.cs: Revert Ravi's last patch. The correct way of
11161 referencing a nested type with the Reflection API is using the "+"
11164 * cs-parser.jay: Do not require EOF token at the end.
11166 2001-12-20 Ravi Pratap <ravi@ximian.com>
11168 * rootcontext.cs (LookupType): Concatenate type names with
11169 a '.' instead of a '+' The test suite passes again.
11171 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
11172 field of the enumeration.
11174 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
11175 the case when the member is an EventExpr.
11177 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
11178 static has an associated instance expression.
11180 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
11182 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
11184 * class.cs (Event.Define): Register event and perform appropriate checks
11187 We define the Add and Remove methods even if the use provides none because
11188 in that case, we provide default implementations ourselves.
11190 Define a private field of the type of the event. This is done by the CSC compiler
11191 and we should be doing it too ;-)
11193 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
11194 More methods we use in code we generate.
11196 (multicast_delegate_type, delegate_type): Two separate types since the distinction
11199 (InitCoreTypes): Update accordingly for the above.
11201 * class.cs (Event.Emit): Generate code for default accessors that we provide
11203 (EmitDefaultMethod): Do the job in the above.
11205 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
11208 2001-12-20 Miguel de Icaza <miguel@ximian.com>
11210 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
11211 builders even if we were missing one.
11213 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
11214 pass the Basename as our class name instead of the Name. The
11215 basename will be correctly composed for us.
11217 * parameter.cs (Paramters): Now takes a Location argument.
11219 * decl.cs (DeclSpace.LookupType): Removed convenience function and
11220 make all the code call directly LookupType in RootContext and take
11221 this chance to pass the Location information everywhere.
11223 * Everywhere: pass Location information.
11225 2001-12-19 Miguel de Icaza <miguel@ximian.com>
11227 * class.cs (Constructor.Define): Updated way of detecting the
11228 length of the parameters.
11230 (TypeContainer.DefineType): Use basename as the type name for
11233 (TypeContainer.Define): Do not recursively define types here, as
11234 definition is taken care in order by the RootContext.
11236 * tree.cs: Keep track of namespaces in a per-file basis.
11238 * parameter.cs (Parameter.ComputeSignature): Update to use
11241 (Parameters.GetSignature): ditto.
11243 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
11244 instead of a TypeContainer.
11246 (Interface.SemanticAnalysis): Use `this' instead of our parent to
11247 resolve names. Because we need to be resolve in our context, not
11250 * driver.cs: Implement response files.
11252 * class.cs (TypeContainer.DefineType): If we are defined, do not
11253 redefine ourselves.
11255 (Event.Emit): Emit the code for add/remove handlers.
11256 (Event.Define): Save the MethodBuilders for add/remove.
11258 * typemanager.cs: Use pair here too.
11260 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
11261 DictionaryEntry requires the first argument to be non-null.
11263 (enum_declaration): Compute full name for registering the
11266 (delegate_declaration): Instead of using
11267 formal_parameter_list, use opt_formal_parameter_list as the list
11270 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
11271 (EventParsing): New property that controls whether `add' and
11272 `remove' are returned as tokens or identifiers (for events);
11274 2001-12-19 Ravi Pratap <ravi@ximian.com>
11276 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
11277 use MyEventBuilder only and let it wrap the real builder for us.
11279 (MyEventBuilder): Revamp constructor etc.
11281 Implement all operations that we perform on EventBuilder in precisely the same
11284 (FindMembers): Update to use the EventBuilder member.
11286 (Event.Emit): Update accordingly.
11288 2001-12-18 Ravi Pratap <ravi@ximian.com>
11290 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
11291 by calling the appropriate methods.
11293 (GetCustomAttributes): Make stubs as they cannot possibly do anything
11296 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
11298 2001-12-17 Ravi Pratap <ravi@ximian.com>
11300 * delegate.cs (Delegate.Populate): Check that the return type
11301 and various parameters types are indeed accessible.
11303 * class.cs (Constructor.Define): Same here.
11305 (Field.Define): Ditto.
11307 (Event.Define): Ditto.
11309 (Operator.Define): Check that the underlying Method defined itself
11310 correctly - so it's MethodBuilder should not be null.
11312 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
11313 expression happens to be null.
11315 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
11316 members but as of now we don't seem to be able to do anything really useful with it.
11318 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
11319 not the EventBuilder.
11321 2001-12-18 Miguel de Icaza <miguel@ximian.com>
11323 * cs-tokenizer.cs: Add support for defines.
11324 Add support for #if, #elif, #else, #endif
11326 (eval_var): evaluates a variable.
11327 (eval): stubbed for evaluating functions.
11329 * cs-parser.jay: Pass the defines information
11331 * driver.cs: Add --define command line option.
11333 * decl.cs: Move MemberCore here.
11335 Make it the base class for DeclSpace. This allows us to catch and
11336 report 108 and 109 for everything now.
11338 * class.cs (TypeContainer.Define): Extract all the members
11339 before populating and emit the warning 108 (new keyword required
11340 to override) instead of having each member implement this.
11342 (MemberCore.Define): New abstract method, we will be using this in
11343 the warning reporting engine in Populate.
11345 (Operator.Define): Adjust to new MemberCore protocol.
11347 * const.cs (Const): This does not derive from Expression, it is a
11348 temporary object we use to create fields, it is a MemberCore.
11350 * class.cs (Method.Define): Allow the entry point to be in a
11353 * driver.cs: Rewrite the argument handler to clean it up a bit.
11355 * rootcontext.cs: Made it just an auxiliary namespace feature by
11356 making everything static.
11358 * driver.cs: Adapt code to use RootContext type name instead of
11361 * delegate.cs: Remove RootContext argument.
11363 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
11366 * class.cs (Event.Define): The lookup can fail.
11368 * cs-tokenizer.cs: Begin implementation of pre-procesor.
11370 * expression.cs: Resolve the this instance before invoking the code.
11372 2001-12-17 Miguel de Icaza <miguel@ximian.com>
11374 * cs-parser.jay: Add a production in element_access that allows
11375 the thing to become a "type" reference. This way we can parse
11376 things like "(string [])" as a type.
11378 Note that this still does not handle the more complex rules of
11382 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
11384 * ecore.cs: (CopyNewMethods): new utility function used to
11385 assemble the list of methods from running FindMembers.
11387 (MemberLookup): Rework FindMembers so that
11389 2001-12-16 Miguel de Icaza <miguel@ximian.com>
11391 * class.cs (TypeContainer): Remove Delegates who fail to be
11394 * delegate.cs (Populate): Verify that we dont get null return
11395 values. TODO: Check for AsAccessible.
11397 * cs-parser.jay: Use basename to emit error 574 (destructor should
11398 have the same name as container class), not the full name.
11400 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
11401 possible representation.
11403 Also implements integer type suffixes U and L.
11405 2001-12-15 Miguel de Icaza <miguel@ximian.com>
11407 * expression.cs (ArrayCreation.DoResolve): We need to do the
11408 argument resolution *always*.
11410 * decl.cs: Make this hold the namespace. Hold the root context as
11412 (LookupType): Move here.
11414 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
11416 * location.cs (Row, Name): Fixed the code, it was always returning
11417 references to the first file.
11419 * interface.cs: Register properties defined through interfaces.
11421 * driver.cs: Add support for globbing on the command line
11423 * class.cs (Field): Make it derive from MemberCore as well.
11426 2001-12-15 Ravi Pratap <ravi@ximian.com>
11428 * class.cs (Event::Define): Check that the type of the event is a delegate
11429 type else flag error #66.
11431 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
11434 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
11435 values of EntryPoint, CharSet etc etc.
11437 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
11439 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
11440 be null and we should ignore this. I am not sure if this is really clean. Apparently,
11441 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
11442 which needs this to do its work.
11444 * ../errors/cs0066.cs : Add.
11446 2001-12-14 Miguel de Icaza <miguel@ximian.com>
11448 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
11451 * class.cs: (MethodSignature.MethodSignature): Removed hack that
11452 clears out the parameters field.
11453 (MemberSignatureCompare): Cleanup
11455 (MemberCore): New base class used to share code between MethodCore
11458 (RegisterRequiredImplementations) BindingFlags.Public requires
11459 either BindingFlags.Instace or Static. Use instance here.
11461 (Property): Refactored code to cope better with the full spec.
11463 * parameter.cs (GetParameterInfo): Return an empty array instead
11466 * class.cs (Property): Abstract or extern properties have no bodies.
11468 * parameter.cs (GetParameterInfo): return a zero-sized array.
11470 * class.cs (TypeContainer.MethodModifiersValid): Move all the
11471 method modifier validation to the typecontainer so we can reuse
11472 this on properties.
11474 (MethodCore.ParameterTypes): return an empty sized array of types.
11476 (Property.Define): Test property modifier validity.
11478 Add tests for sealed/override too.
11480 (Method.Emit): abstract or extern methods have no bodies.
11482 2001-12-14 Ravi Pratap <ravi@ximian.com>
11484 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
11487 (Method::Define, ::Emit): Modify accordingly.
11489 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
11491 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
11493 * makefile: Pass in /unsafe.
11495 2001-12-13 Miguel de Icaza <miguel@ximian.com>
11497 * class.cs (MakeKey): Kill routine.
11499 * class.cs (TypeContainer.Define): Correctly define explicit
11500 method implementations (they require the full interface name plus
11503 * typemanager.cs: Deply the PtrHashtable here and stop using the
11504 lame keys. Things work so much better.
11506 This of course broke everyone who depended on `RegisterMethod' to
11507 do the `test for existance' test. This has to be done elsewhere.
11509 * support.cs (PtrHashtable): A hashtable that avoid comparing with
11510 the object stupid Equals method (because, that like fails all over
11511 the place). We still do not use it.
11513 * class.cs (TypeContainer.SetRequiredInterface,
11514 TypeContainer.RequireMethods): Killed these two routines and moved
11515 all the functionality to RegisterRequiredImplementations.
11517 (TypeContainer.RegisterRequiredImplementations): This routine now
11518 registers all the implementations required in an array for the
11519 interfaces and abstract methods. We use an array of structures
11520 which can be computed ahead of time to reduce memory usage and we
11521 also assume that lookups are cheap as most classes will not
11522 implement too many interfaces.
11524 We also avoid creating too many MethodSignatures.
11526 (TypeContainer.IsInterfaceMethod): Update and optionally does not
11527 clear the "pending" bit if we find that there are problems with
11530 (TypeContainer.VerifyPendingMethods): Update to report errors of
11531 methods that look like implementations but are not.
11533 (TypeContainer.Define): Add support for explicit interface method
11536 2001-12-12 Miguel de Icaza <miguel@ximian.com>
11538 * typemanager.cs: Keep track of the parameters here instead of
11539 being a feature of the TypeContainer.
11541 * class.cs: Drop the registration of parameters here, as
11542 InterfaceMethods are also interface declarations.
11544 * delegate.cs: Register methods with the TypeManager not only with
11545 the TypeContainer. This code was buggy.
11547 * interface.cs: Full registation here.
11549 2001-12-11 Miguel de Icaza <miguel@ximian.com>
11551 * expression.cs: Remove reducer for binary expressions, it can not
11554 * const.cs: Put here the code that used to go into constant.cs
11556 * constant.cs: Put here the code for constants, this is a new base
11557 class for Literals.
11559 * literal.cs: Make Literal derive from Constant.
11561 2001-12-09 Miguel de Icaza <miguel@ximian.com>
11563 * statement.cs (Return.Emit): Report error 157 if the user
11564 attempts to return from a finally block.
11566 (Return.Emit): Instead of emitting a return, jump to the end of
11569 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
11570 LocalBuilder to store the result of the function. ReturnLabel is
11571 the target where we jump.
11574 2001-12-09 Radek Doulik <rodo@ximian.com>
11576 * cs-parser.jay: remember alias in current namespace
11578 * ecore.cs (SimpleName::DoResolve): use aliases for types or
11581 * class.cs (LookupAlias): lookup alias in my_namespace
11583 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
11585 (LookupAlias): lookup alias in this and if needed in parent
11588 2001-12-08 Miguel de Icaza <miguel@ximian.com>
11592 * rootcontext.cs: (ModuleBuilder) Made static, first step into
11593 making things static. I need this to avoid passing the
11594 TypeContainer when calling ParameterType.
11596 * support.cs (InternalParameters.ParameterType): Remove ugly hack
11597 that did string manipulation to compute the type and then call
11598 GetType. Use Parameter.ParameterType instead.
11600 * cs-tokenizer.cs: Consume the suffix for floating values.
11602 * expression.cs (ParameterReference): figure out whether this is a
11603 reference parameter or not. Kill an extra variable by computing
11604 the arg_idx during emission.
11606 * parameter.cs (Parameters.GetParameterInfo): New overloaded
11607 function that returns whether a parameter is an out/ref value or not.
11609 (Parameter.ParameterType): The type of the parameter (base,
11610 without ref/out applied).
11612 (Parameter.Resolve): Perform resolution here.
11613 (Parameter.ExternalType): The full type (with ref/out applied).
11615 * statement.cs (Using.Emit, Using.EmitExpression): Implement
11616 support for expressions on the using statement.
11618 2001-12-07 Miguel de Icaza <miguel@ximian.com>
11620 * statement.cs (Using.EmitLocalVariableDecls): Split the
11621 localvariable handling of the using statement.
11623 (Block.EmitMeta): Keep track of variable count across blocks. We
11624 were reusing slots on separate branches of blocks.
11626 (Try.Emit): Emit the general code block, we were not emitting it.
11628 Check the type of the declaration to be an IDisposable or
11629 something that can be implicity converted to it.
11631 Emit conversions if required.
11633 * ecore.cs (EmptyExpression): New utility class.
11634 (Expression.ImplicitConversionExists): New utility function.
11636 2001-12-06 Miguel de Icaza <miguel@ximian.com>
11638 * statement.cs (Using): Implement.
11640 * expression.cs (LocalVariableReference): Support read only variables.
11642 * statement.cs: Remove the explicit emit for the Leave opcode.
11643 (VariableInfo): Add a readonly field.
11645 2001-12-05 Miguel de Icaza <miguel@ximian.com>
11647 * ecore.cs (ConvCast): new class used to encapsulate the various
11648 explicit integer conversions that works in both checked and
11649 unchecked contexts.
11651 (Expression.ConvertNumericExplicit): Use new ConvCast class to
11652 properly generate the overflow opcodes.
11654 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11656 * statement.cs: The correct type for the EmptyExpression is the
11657 element_type, not the variable type. Ravi pointed this out.
11659 2001-12-04 Ravi Pratap <ravi@ximian.com>
11661 * class.cs (Method::Define): Handle PInvoke methods specially
11662 by using DefinePInvokeMethod instead of the usual one.
11664 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11665 above to do the task of extracting information and defining the method.
11667 2001-12-04 Ravi Pratap <ravi@ximian.com>
11669 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11670 of the condition for string type.
11672 (Emit): Move that here.
11674 (ArrayCreation::CheckIndices): Keep string literals in their expression
11677 (EmitDynamicInitializers): Handle strings appropriately.
11679 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11681 * codegen.cs (EmitContext): Replace multiple variables with a
11682 single pointer to the current Switch statement.
11684 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11687 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11691 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11694 (Foreach.Emit): Foreach on arrays was not setting
11695 up the loop variables (for break/continue).
11697 (GotoCase): Semi-implented.
11699 2001-12-03 Ravi Pratap <ravi@ximian.com>
11701 * attribute.cs (CheckAttribute): Handle system attributes by using
11702 Attribute.GetAttributes to examine information we need.
11704 (GetValidPlaces): Same here.
11706 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11708 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11710 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11712 (Method::Define): Set appropriate flags if we have a DllImport attribute.
11714 (Method::Emit): Handle the case when we are a PInvoke method.
11716 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11718 * expression.cs: Use ResolveWithSimpleName on compound names.
11720 2001-12-02 Ravi Pratap <ravi@ximian.com>
11722 * constant.cs (EmitConstant): Make sure we resolve the associated expression
11723 before trying to reduce it.
11725 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11727 * constant.cs (LookupConstantValue): Implement.
11729 (EmitConstant): Use the above in emitting the constant.
11731 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11732 that are user-defined by doing a LookupConstantValue on them.
11734 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11737 2001-11-29 Miguel de Icaza <miguel@ximian.com>
11739 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11741 (BaseAccess.DoResolve): Implement.
11743 (MemberAccess.DoResolve): Split this routine into a
11744 ResolveMemberAccess routine that can be used independently
11746 2001-11-28 Miguel de Icaza <miguel@ximian.com>
11748 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11749 As that share bits of the implementation. Is returns a boolean,
11750 while As returns the Type that is being probed.
11752 2001-12-01 Ravi Pratap <ravi@ximian.com>
11754 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11755 instead of a Literal - much easier.
11757 (EnumInTransit): Remove - utterly useless :-)
11759 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11761 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11763 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11764 chain when we have no associated expression.
11766 2001-11-30 Ravi Pratap <ravi@ximian.com>
11768 * constant.cs (Define): Use Location while reporting the errror.
11770 Also emit a warning when 'new' is used and there is no inherited
11773 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
11776 (LookupEnumValue): Implement to lookup an enum member's value and define it
11779 (Populate): Re-write accordingly to use the above routine.
11781 2001-11-27 Miguel de Icaza <miguel@ximian.com>
11783 * expression.cs (This): Fix prototype for DoResolveLValue to
11784 override the base class DoResolveLValue.
11786 * cs-parser.cs: Report errors cs574 and cs575 (destructor
11789 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11790 (we need to load the address of the field here). This fixes
11793 (FieldExpr.DoResolveLValue): Call the DoResolve
11794 function to initialize the Instance expression.
11796 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11797 correctly the GetEnumerator operation on a value type.
11799 * cs-parser.jay: Add more simple parsing error catches.
11801 * statement.cs (Switch): Add support for string switches.
11802 Handle null specially.
11804 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
11806 2001-11-28 Ravi Pratap <ravi@ximian.com>
11808 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11810 (declare_local_constant): New helper function.
11812 * statement.cs (AddConstant): Keep a separate record of constants
11814 (IsConstant): Implement to determine if a variable is a constant.
11816 (GetConstantExpression): Implement.
11818 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11820 * statement.cs (IsVariableDefined): Re-write.
11822 2001-11-27 Ravi Pratap <ravi@ximian.com>
11824 * class.cs (TypeContainer::FindMembers): Look for constants
11825 in the case when we are looking for MemberTypes.Field
11827 * expression.cs (MemberAccess::DoResolve): Check that in the
11828 case we are a FieldExpr and a Literal, we are not being accessed
11829 by an instance reference.
11831 * cs-parser.jay (local_constant_declaration): Implement.
11833 (declaration_statement): Implement for constant declarations.
11835 2001-11-26 Miguel de Icaza <miguel@ximian.com>
11837 * statement.cs (Switch): Catch double defaults.
11839 (Switch): More work on the switch() statement
11840 implementation. It works for integral values now, need to finish
11844 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11846 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11847 integer literals into other integer literals. To be used by
11850 2001-11-24 Ravi Pratap <ravi@ximian.com>
11852 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11855 (EmitDynamicInitializers): Cope with the above since we extract data
11856 directly from ArrayData now.
11858 (ExpectInitializers): Keep track of whether initializers are mandatory
11861 (Bounds): Make it a hashtable to prevent the same dimension being
11862 recorded for every element in that dimension.
11864 (EmitDynamicInitializers): Fix bug which prevented the Set array method
11867 Also fix bug which was causing the indices to be emitted in the reverse
11870 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11872 * expression.cs (ArrayCreation): Implement the bits that Ravi left
11873 unfinished. They do not work, because the underlying code is
11876 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11878 * cs-parser.jay: Remove bogus fixme.
11880 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11881 on Switch statement.
11883 2001-11-23 Ravi Pratap <ravi@ximian.com>
11885 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11888 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11889 parameter. Apparently, any expression is allowed.
11891 (ValidateInitializers): Update accordingly.
11893 (CheckIndices): Fix some tricky bugs thanks to recursion.
11895 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
11896 I was being completely brain-dead.
11898 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11899 and re-write acordingly.
11901 (DelegateInvocation): Re-write accordingly.
11903 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11905 (MakeByteBlob): Handle types more correctly.
11907 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11908 initialization from expressions but it is incomplete because I am a complete
11911 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11913 * statement.cs (If.Emit): Fix a bug that generated incorrect code
11914 on If. Basically, we have to return `true' (ie, we do return to
11915 our caller) only if both branches of the if return.
11917 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11918 short-circuit operators, handle them as short circuit operators.
11920 (Cast.DoResolve): Resolve type.
11921 (Cast.Cast): Take an expression as the target type.
11923 * cs-parser.jay (cast_expression): Remove old hack that only
11924 allowed a limited set of types to be handled. Now we take a
11925 unary_expression and we resolve to a type during semantic
11928 Use the grammar productions from Rhys to handle casts (this is
11929 not complete like Rhys syntax yet, we fail to handle that corner
11930 case that C# has regarding (-x), but we will get there.
11932 2001-11-22 Ravi Pratap <ravi@ximian.com>
11934 * class.cs (EmitFieldInitializer): Take care of the case when we have a
11935 field which is an array type.
11937 * cs-parser.jay (declare_local_variables): Support array initialization too.
11939 * typemanager.cs (MakeKey): Implement.
11941 (everywhere): Use the above appropriately.
11943 * cs-parser.jay (for_statement): Update for array initialization while
11944 declaring variables.
11946 * ecore.cs : The error message was correct, it's the variable's names that
11947 were misleading ;-) Make the code more readable.
11949 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
11950 the correct type etc.
11952 (ConvertExplicit): Handle Enum types by examining the underlying type.
11954 2001-11-21 Ravi Pratap <ravi@ximian.com>
11956 * parameter.cs (GetCallingConvention): Always return
11957 CallingConventions.Standard for now.
11959 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11961 * expression.cs (Binary.ResolveOperator): Update the values of `l'
11962 and `r' after calling DoNumericPromotions.
11964 * ecore.cs: Fix error message (the types were in the wrong order).
11966 * statement.cs (Foreach.ProbeCollectionType): Need to pass
11967 BindingFlags.Instance as well
11969 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
11970 implicit int literal conversion in an empty cast so that we
11971 propagate the right type upstream.
11973 (UnboxCast): new class used to unbox value types.
11974 (Expression.ConvertExplicit): Add explicit type conversions done
11977 (Expression.ImplicitNumericConversion): Oops, forgot to test for
11978 the target type before applying the implicit LongLiterals to ULong
11981 2001-11-21 Miguel de Icaza <miguel@ximian.com>
11983 * cs-parser.jay (for_statement): Reworked the way For works: now
11984 we declare manually any variables that are introduced in
11985 for_initializer to solve the problem of having out-of-band code
11986 emition (that is what got for broken).
11988 (declaration_statement): Perform the actual variable declaration
11989 that used to be done in local_variable_declaration here.
11991 (local_variable_declaration): Do not declare anything, just pass
11992 the information on a DictionaryEntry
11994 2001-11-20 Ravi Pratap <ravi@ximian.com>
11996 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
11997 re-write of the logic to now make it recursive.
11999 (UpdateIndices): Re-write accordingly.
12001 Store element data in a separate ArrayData list in the above methods.
12003 (MakeByteBlob): Implement to dump the array data into a byte array.
12005 2001-11-19 Ravi Pratap <ravi@ximian.com>
12007 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
12010 * constant.cs (Define): Implement.
12012 (EmitConstant): Re-write fully.
12014 Pass in location info.
12016 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
12019 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
12020 DictionaryEntry since we need location info too.
12022 (constant_declaration): Update accordingly.
12024 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
12025 code into another method : UpdateIndices.
12027 2001-11-18 Ravi Pratap <ravi@ximian.com>
12029 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
12030 some type checking etc.
12032 2001-11-17 Ravi Pratap <ravi@ximian.com>
12034 * expression.cs (ArrayCreation::ValidateInitializers): Implement
12035 bits to provide dimension info if the user skips doing that.
12037 Update second constructor to store the rank correctly.
12039 2001-11-16 Ravi Pratap <ravi@ximian.com>
12041 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
12042 and try to implement.
12044 * ../errors/cs0150.cs : Add.
12046 * ../errors/cs0178.cs : Add.
12048 2001-11-16 Miguel de Icaza <miguel@ximian.com>
12050 * statement.cs: Implement foreach on multi-dimensional arrays.
12052 * parameter.cs (Parameters.GetParameterByName): Also lookup the
12053 name of the params argument.
12055 * expression.cs: Use EmitStoreOpcode to get the right opcode while
12056 initializing the array.
12058 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
12059 we can use this elsewhere.
12061 * statement.cs: Finish implementation of foreach for single
12064 * cs-parser.jay: Use an out-of-band stack to pass information
12065 around, I wonder why I need this.
12067 foreach_block: Make the new foreach_block the current_block.
12069 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
12070 function used to return a static Parameters structure. Used for
12071 empty parameters, as those are created very frequently.
12073 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
12075 2001-11-15 Ravi Pratap <ravi@ximian.com>
12077 * interface.cs : Default modifier is private, not public. The
12078 make verify test passes again.
12080 2001-11-15 Ravi Pratap <ravi@ximian.com>
12082 * support.cs (ReflectionParameters): Fix logic to determine
12083 whether the last parameter is a params one. Test 9 passes again.
12085 * delegate.cs (Populate): Register the builders we define with
12086 RegisterParameterForBuilder. Test 19 passes again.
12088 * cs-parser.jay (property_declaration): Reference $6 instead
12089 of $$ to get at the location.
12091 (indexer_declaration): Similar stuff.
12093 (attribute): Ditto.
12095 * class.cs (Property): Register parameters for the Get and Set methods
12096 if they exist. Test 23 passes again.
12098 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
12099 call to EmitArguments as we are sure there aren't any params arguments.
12100 Test 32 passes again.
12102 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
12103 IndexOutOfRangeException.
12105 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
12106 Test 33 now passes again.
12108 2001-11-15 Miguel de Icaza <miguel@ximian.com>
12110 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
12111 broke a bunch of things. Will have to come up with a better way
12112 of tracking locations.
12114 * statement.cs: Implemented foreach for single dimension arrays.
12116 2001-11-09 Miguel de Icaza <miguel@ximian.com>
12118 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
12119 an error. This removes the lookup from the critical path.
12121 * cs-parser.jay: Removed use of temporary_loc, which is completely
12124 2001-11-14 Miguel de Icaza <miguel@ximian.com>
12126 * support.cs (ReflectionParameters.ParameterModifier): Report
12127 whether the argument is a PARAMS argument or not.
12129 * class.cs: Set the attribute `ParamArrayAttribute' on the
12130 parameter argument.
12132 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
12133 and cons_param_array_attribute (ConstructorInfo for
12134 ParamArrayAttribute).,
12136 * codegen.cs: Emit the return using the `Return' statement, that
12137 way we can report the error correctly for missing return values.
12139 * class.cs (Method.Emit): Clean up.
12141 * expression.cs (Argument.Resolve): Take another argument: the
12142 location where this argument is used. Notice that this is not
12143 part of the "Argument" class as to reduce the size of the
12144 structure (we know the approximate location anyways).
12146 Test if the argument is a variable-reference, if not, then
12147 complain with a 206.
12149 (Argument.Emit): Emit addresses of variables.
12151 (Argument.FullDesc): Simplify.
12153 (Invocation.DoResolve): Update for Argument.Resolve.
12155 (ElementAccess.DoResolve): ditto.
12157 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
12158 method should be virtual, as this method is always virtual.
12160 (NewDelegate.DoResolve): Update for Argument.Resolve.
12162 * class.cs (ConstructorInitializer.DoResolve): ditto.
12164 * attribute.cs (Attribute.Resolve): ditto.
12166 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12168 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
12170 * expression.cs (ParameterReference): Drop IStackStorage and implement
12171 IAssignMethod instead.
12173 (LocalVariableReference): ditto.
12175 * ecore.cs (FieldExpr): Drop IStackStorage and implement
12176 IAssignMethod instead.
12178 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12180 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
12181 enumerations that are used in heavily used structures derive from
12182 byte in a laughable and pathetic attempt to reduce memory usage.
12183 This is the kind of pre-optimzations that you should not do at
12184 home without adult supervision.
12186 * expression.cs (UnaryMutator): New class, used to handle ++ and
12187 -- separatedly from the other unary operators. Cleans up the
12188 code, and kills the ExpressionStatement dependency in Unary.
12190 (Unary): Removed `method' and `Arguments' from this class, making
12191 it smaller, and moving it all to SimpleCall, so I can reuse this
12192 code in other locations and avoid creating a lot of transient data
12193 strucutres when not required.
12195 * cs-parser.jay: Adjust for new changes.
12197 2001-11-11 Miguel de Icaza <miguel@ximian.com>
12199 * enum.cs (Enum.Populate): If there is a failure during
12202 * cs-parser.jay (opt_enum_base): we used to catch type errors
12203 here, but this is really incorrect. The type error should be
12204 catched during semantic analysis.
12206 2001-12-11 Ravi Pratap <ravi@ximian.com>
12208 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
12209 current_local_parameters as expected since I, in my stupidity, had forgotten
12212 * attribute.cs (GetValidPlaces): Fix stupid bug.
12214 * class.cs (Method::Emit): Perform check on applicability of attributes.
12216 (Constructor::Emit): Ditto.
12218 (Field::Emit): Ditto.
12220 (Field.Location): Store location information.
12222 (Property, Event, Indexer, Operator): Ditto.
12224 * cs-parser.jay (field_declaration): Pass in location for each field.
12226 * ../errors/cs0592.cs : Add.
12228 2001-11-12 Ravi Pratap <ravi@ximian.com>
12230 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
12232 (InitCoreTypes): Update accordingly.
12234 (RegisterAttrType, LookupAttr): Implement.
12236 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
12237 info about the same.
12239 (Resolve): Update to populate the above as necessary.
12241 (Error592): Helper.
12243 (GetValidPlaces): Helper to the above.
12245 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
12247 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
12249 2001-11-12 Ravi Pratap <ravi@ximian.com>
12251 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
12253 * ../errors/cs0617.cs : Add.
12255 2001-11-11 Ravi Pratap <ravi@ximian.com>
12257 * enum.cs (Emit): Rename to Populate to be more consistent with what
12258 we expect it to do and when exactly it is called.
12260 * class.cs, rootcontext.cs : Update accordingly.
12262 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
12263 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
12265 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
12267 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
12268 of a fieldinfo using the above, when dealing with a FieldBuilder.
12270 2001-11-10 Ravi Pratap <ravi@ximian.com>
12272 * ../errors/cs0031.cs : Add.
12274 * ../errors/cs1008.cs : Add.
12276 * ../errrors/cs0543.cs : Add.
12278 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
12281 (FindMembers): Implement.
12283 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
12284 enums and delegates too.
12286 (enum_types): Rename to builder_to_enum.
12288 (delegate_types): Rename to builder_to_delegate.
12290 * delegate.cs (FindMembers): Implement.
12292 2001-11-09 Ravi Pratap <ravi@ximian.com>
12294 * typemanager.cs (IsEnumType): Implement.
12296 * enum.cs (Emit): Re-write parts to account for the underlying type
12297 better and perform checking etc.
12299 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
12300 of the underlying type.
12302 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
12305 * enum.cs (error31): Helper to report error #31.
12307 * cs-parser.jay (enum_declaration): Store location of each member too.
12309 * enum.cs (member_to_location): New hashtable.
12311 (AddEnumMember): Update location hashtable.
12313 (Emit): Use the location of each member while reporting errors.
12315 2001-11-09 Miguel de Icaza <miguel@ximian.com>
12317 * cs-parser.jay: A for_initializer if is a
12318 local_variable_declaration really ammount to have an implicit
12319 block with the variable declaration and no initializer for for.
12321 * statement.cs (For.Emit): Cope with null initializers.
12323 This fixes the infinite loop on for initializers.
12325 2001-11-08 Miguel de Icaza <miguel@ximian.com>
12327 * enum.cs: More cleanup.
12329 * ecore.cs: Remove dead code.
12331 * class.cs (Property.Emit): More simplification.
12332 (Event.Emit): ditto.
12334 Reworked to have less levels of indentation.
12336 2001-11-08 Ravi Pratap <ravi@ximian.com>
12338 * class.cs (Property): Emit attributes.
12348 * enum.cs (Emit): Ditto.
12350 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
12353 * class.cs (Field, Event, etc.): Move attribute generation into the
12354 Emit method everywhere.
12356 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
12357 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
12358 as we had no way of defining nested enums !
12360 * rootcontext.cs : Adjust code accordingly.
12362 * typemanager.cs (AddEnumType): To keep track of enum types separately.
12364 2001-11-07 Ravi Pratap <ravi@ximian.com>
12366 * expression.cs (EvalConstantExpression): Move into ecore.cs
12368 * enum.cs (Enum): Rename some members and make them public and readonly
12369 according to our convention.
12371 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
12374 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
12376 (Enum::Emit): Write a simple version for now which doesn't try to compute
12377 expressions. I shall modify this to be more robust in just a while.
12379 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
12381 (TypeContainer::CloseType): Create the Enum types too.
12383 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
12385 * expression.cs (EvalConstantExpression): Get rid of completely.
12387 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
12388 user-defined values and other cases.
12390 (IsValidEnumLiteral): Helper function.
12392 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
12393 out there in the case we had a literal FieldExpr.
12395 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
12397 (Literalize): Revamp a bit to take two arguments.
12399 (EnumLiteral): New class which derives from Literal to wrap enum literals.
12401 2001-11-06 Ravi Pratap <ravi@ximian.com>
12403 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
12405 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
12407 (Resolve): Use the above to ensure we have proper initializers.
12409 2001-11-05 Ravi Pratap <ravi@ximian.com>
12411 * expression.cs (Expression::EvalConstantExpression): New method to
12412 evaluate constant expressions.
12414 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
12416 2001-11-07 Miguel de Icaza <miguel@ximian.com>
12418 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
12421 (Binary.ResolveOperator): Handle operator != (object a, object b)
12422 and operator == (object a, object b);
12424 (Binary.DoNumericPromotions): Indicate whether the numeric
12425 promotion was possible.
12427 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
12430 Made the ArrayAccess implement interface IAssignMethod instead of
12431 IStackStore as the order in which arguments are passed reflects
12434 * assign.cs: Instead of using expr.ExprClass to select the way of
12435 assinging, probe for the IStackStore/IAssignMethod interfaces.
12437 * typemanager.cs: Load InitializeArray definition.
12439 * rootcontext.cs (RootContext.MakeStaticData): Used to define
12440 static data that can be used to initialize arrays.
12442 2001-11-05 Miguel de Icaza <miguel@ximian.com>
12444 * expression.cs: Handle operator== and operator!= for booleans.
12446 (Conditioal.Reduce): Implement reducer for the ?: operator.
12448 (Conditional.Resolve): Implement dead code elimination.
12450 (Binary.Resolve): Catch string literals and return a new
12451 concatenated string.
12453 (Unary.Reduce): Implement reduction of unary expressions.
12455 * ecore.cs: Split out the expression core handling here.
12457 (Expression.Reduce): New method used to perform constant folding
12458 and CSE. This is needed to support constant-expressions.
12460 * statement.cs (Statement.EmitBoolExpression): Pass true and false
12461 targets, and optimize for !x.
12463 2001-11-04 Ravi Pratap <ravi@ximian.com>
12465 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
12466 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
12467 set custom atttributes.
12469 * literal.cs (Literal::GetValue): New abstract method to return the actual
12470 value of the literal, cast as an object.
12472 (*Literal): Implement GetValue method.
12474 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
12475 expressions to the arraylist but objects of type Argument.
12477 * class.cs (TypeContainer::Emit): Emit our attributes too.
12479 (Method::Emit, Constructor::Emit): Ditto.
12481 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
12482 to be ignoring earlier.
12484 2001-11-03 Ravi Pratap <ravi@ximian.com>
12486 * attribute.cs (AttributeSection::Define): Implement to do the business
12487 of constructing a CustomAttributeBuilder.
12489 (Attribute): New trivial class. Increases readability of code.
12491 * cs-parser.jay : Update accordingly.
12493 (positional_argument_list, named_argument_list, named_argument): New rules
12495 (attribute_arguments): Use the above so that we are more correct.
12497 2001-11-02 Ravi Pratap <ravi@ximian.com>
12499 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
12500 to perform all checks for a method with a params parameter.
12502 (Invocation::OverloadResolve): Update to use the above method and therefore
12503 cope correctly with params method invocations.
12505 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
12508 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
12509 constructors in our parent too because we can't afford to miss out on
12512 * attribute.cs (AttributeSection): New name for the class Attribute
12514 Other trivial changes to improve readability.
12516 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
12517 use the new class names.
12519 2001-11-01 Ravi Pratap <ravi@ximian.com>
12521 * class.cs (Method::Define): Complete definition for params types too
12523 (Indexer::Define): Ditto.
12525 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
12526 Cope everywhere with a request for info about the array parameter.
12528 2001-11-01 Ravi Pratap <ravi@ximian.com>
12530 * tree.cs (RecordNamespace): Fix up to check for the correct key.
12532 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
12533 local_variable_type to extract the string corresponding to the type.
12535 (local_variable_type): Fixup the action to use the new helper method.
12537 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
12540 * expression.cs : Clean out code which uses the above.
12542 2001-10-31 Ravi Pratap <ravi@ximian.com>
12544 * typemanager.cs (RegisterMethod): Check if we already have an existing key
12545 and bale out if necessary by returning a false.
12547 (RegisterProperty): Ditto.
12549 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
12550 and print out appropriate error messages.
12552 * interface.cs (everywhere): Ditto.
12554 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
12555 location to constructor.
12557 * class.cs (Property, Event, Indexer): Update accordingly.
12559 * ../errors/cs111.cs : Added.
12561 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
12562 of a method, as laid down by the spec.
12564 (Invocation::OverloadResolve): Use the above method.
12566 2001-10-31 Ravi Pratap <ravi@ximian.com>
12568 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
12569 now take a TypeContainer and a Parameters object.
12571 (ParameterData): Modify return type of ParameterModifier method to be
12572 Parameter.Modifier and not a string.
12574 (ReflectionParameters, InternalParameters): Update accordingly.
12576 * expression.cs (Argument::GetParameterModifier): Same here.
12578 * support.cs (InternalParameters::ParameterType): Find a better way of determining
12579 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
12580 symbol in it at all so maybe this is only for now.
12582 2001-10-30 Ravi Pratap <ravi@ximian.com>
12584 * support.cs (InternalParameters): Constructor now takes an extra argument
12585 which is the actual Parameters class.
12587 (ParameterDesc): Update to provide info on ref/out modifiers.
12589 * class.cs (everywhere): Update call to InternalParameters to pass in
12590 the second argument too.
12592 * support.cs (ParameterData): Add ParameterModifier, which is a method
12593 to return the modifier info [ref/out etc]
12595 (InternalParameters, ReflectionParameters): Implement the above.
12597 * expression.cs (Argument::ParameterModifier): Similar function to return
12598 info about the argument's modifiers.
12600 (Invocation::OverloadResolve): Update to take into account matching modifiers
12603 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
12604 a new SetFormalParameters object which we pass to InternalParameters.
12606 2001-10-30 Ravi Pratap <ravi@ximian.com>
12608 * expression.cs (NewArray): Merge into the ArrayCreation class.
12610 2001-10-29 Ravi Pratap <ravi@ximian.com>
12612 * expression.cs (NewArray): Merge classes NewBuiltinArray and
12613 NewUserdefinedArray into one as there wasn't much of a use in having
12616 * expression.cs (Argument): Change field's name to ArgType from Type.
12618 (Type): New readonly property which returns the proper type, taking into
12619 account ref/out modifiers.
12621 (everywhere): Adjust code accordingly for the above.
12623 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12624 whether we are emitting for a ref or out parameter.
12626 * expression.cs (Argument::Emit): Use the above field to set the state.
12628 (LocalVariableReference::Emit): Update to honour the flag and emit the
12631 * parameter.cs (Attributes): Set the correct flags for ref parameters.
12633 * expression.cs (Argument::FullDesc): New function to provide a full desc.
12635 * support.cs (ParameterData): Add method ParameterDesc to the interface.
12637 (ReflectionParameters, InternalParameters): Implement the above method.
12639 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12642 (Invocation::FullMethodDesc): Ditto.
12644 2001-10-29 Miguel de Icaza <miguel@ximian.com>
12646 * cs-parser.jay: Add extra production for the second form of array
12649 * expression.cs (ArrayCreation): Update to reflect the above
12652 * Small changes to prepare for Array initialization.
12654 2001-10-28 Miguel de Icaza <miguel@ximian.com>
12656 * typemanager.cs (ImplementsInterface): interface might be null;
12657 Deal with this problem;
12659 Also, we do store negative hits on the cache (null values), so use
12660 this instead of calling t.GetInterfaces on the type everytime.
12662 2001-10-28 Ravi Pratap <ravi@ximian.com>
12664 * typemanager.cs (IsBuiltinType): New method to help determine the same.
12666 * expression.cs (New::DoResolve): Get rid of array creation code and instead
12667 split functionality out into different classes.
12669 (New::FormArrayType): Move into NewBuiltinArray.
12671 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12674 (NewBuiltinArray): New class to handle creation of built-in arrays.
12676 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12677 account creation of one-dimensional arrays.
12679 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12681 (NewUserdefinedArray::DoResolve): Implement.
12683 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12685 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12686 we maintain inside the TypeManager. This is necessary to perform lookups on the
12689 (LookupType): Update to perform GetType on the module builders too.
12691 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12693 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12695 2001-10-23 Ravi Pratap <ravi@ximian.com>
12697 * expression.cs (New::DoResolve): Implement guts of array creation.
12699 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12701 2001-10-27 Miguel de Icaza <miguel@ximian.com>
12703 * expression.cs: Fix bug I introduced lsat night that broke
12706 (Expression.Resolve): Report a 246 error (can not resolve name)
12707 if we find a SimpleName in the stream.
12709 (Expression.ResolveLValue): Ditto.
12711 (Expression.ResolveWithSimpleName): This function is a variant of
12712 ResolveName, this one allows SimpleNames to be returned without a
12713 warning. The only consumer of SimpleNames is MemberAccess
12715 2001-10-26 Miguel de Icaza <miguel@ximian.com>
12717 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12718 might arrive here. I have my doubts that this is correct.
12720 * statement.cs (Lock): Implement lock statement.
12722 * cs-parser.jay: Small fixes to support `lock' and `using'
12724 * cs-tokenizer.cs: Remove extra space
12726 * driver.cs: New flag --checked, allows to turn on integer math
12729 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12730 Threading.Monitor.Exit
12732 2001-10-23 Miguel de Icaza <miguel@ximian.com>
12734 * expression.cs (IndexerAccess::DoResolveLValue): Set the
12735 Expression Class to be IndexerAccess.
12737 Notice that Indexer::DoResolve sets the eclass to Value.
12739 2001-10-22 Miguel de Icaza <miguel@ximian.com>
12741 * class.cs (TypeContainer::Emit): Emit code for indexers.
12743 * assign.cs (IAssignMethod): New interface implemented by Indexers
12744 and Properties for handling assignment.
12746 (Assign::Emit): Simplify and reuse code.
12748 * expression.cs (IndexerAccess, PropertyExpr): Implement
12749 IAssignMethod, clean up old code.
12751 2001-10-22 Ravi Pratap <ravi@ximian.com>
12753 * typemanager.cs (ImplementsInterface): New method to determine if a type
12754 implements a given interface. Provides a nice cache too.
12756 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12759 (ConvertReferenceExplicit): Ditto.
12761 * delegate.cs (Delegate::Populate): Update to define the parameters on the
12762 various methods, with correct names etc.
12764 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
12765 Operator.UnaryNegation.
12767 * cs-parser.jay (operator_declarator): Be a little clever in the case where
12768 we have a unary plus or minus operator.
12770 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
12773 * everywhere : update accordingly.
12775 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12778 * class.cs (Method::Define): For the case where we are implementing a method
12779 inherited from an interface, we need to set the MethodAttributes.Final flag too.
12780 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12782 2001-10-21 Ravi Pratap <ravi@ximian.com>
12784 * interface.cs (FindMembers): Implement to work around S.R.E
12787 * typemanager.cs (IsInterfaceType): Implement.
12789 (FindMembers): Update to handle interface types too.
12791 * expression.cs (ImplicitReferenceConversion): Re-write bits which
12792 use IsAssignableFrom as that is not correct - it doesn't work.
12794 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12795 and accordingly override EmitStatement.
12797 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12798 using the correct logic :-)
12800 2001-10-19 Ravi Pratap <ravi@ximian.com>
12802 * ../errors/cs-11.cs : Add to demonstrate error -11
12804 2001-10-17 Miguel de Icaza <miguel@ximian.com>
12806 * assign.cs (Assign::Resolve): Resolve right hand side first, and
12807 then pass this as a hint to ResolveLValue.
12809 * expression.cs (FieldExpr): Add Location information
12811 (FieldExpr::LValueResolve): Report assignment to readonly
12814 (Expression::ExprClassFromMemberInfo): Pass location information.
12816 (Expression::ResolveLValue): Add new method that resolves an
12819 (Expression::DoResolveLValue): Default invocation calls
12822 (Indexers): New class used to keep track of indexers in a given
12825 (IStackStore): Renamed from LValue, as it did not really describe
12826 what this did. Also ResolveLValue is gone from this interface and
12827 now is part of Expression.
12829 (ElementAccess): Depending on the element access type
12831 * typemanager.cs: Add `indexer_name_type' as a Core type
12832 (System.Runtime.CompilerServices.IndexerNameAttribute)
12834 * statement.cs (Goto): Take a location.
12836 2001-10-18 Ravi Pratap <ravi@ximian.com>
12838 * delegate.cs (Delegate::VerifyDelegate): New method to verify
12839 if two delegates are compatible.
12841 (NewDelegate::DoResolve): Update to take care of the case when
12842 we instantiate a delegate from another delegate.
12844 * typemanager.cs (FindMembers): Don't even try to look up members
12845 of Delegate types for now.
12847 2001-10-18 Ravi Pratap <ravi@ximian.com>
12849 * delegate.cs (NewDelegate): New class to take care of delegate
12852 * expression.cs (New): Split the delegate related code out into
12853 the NewDelegate class.
12855 * delegate.cs (DelegateInvocation): New class to handle delegate
12858 * expression.cs (Invocation): Split out delegate related code into
12859 the DelegateInvocation class.
12861 2001-10-17 Ravi Pratap <ravi@ximian.com>
12863 * expression.cs (New::DoResolve): Implement delegate creation fully
12864 and according to the spec.
12866 (New::DoEmit): Update to handle delegates differently.
12868 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12869 because of which we were printing out arguments in reverse order !
12871 * delegate.cs (VerifyMethod): Implement to check if the given method
12872 matches the delegate.
12874 (FullDelegateDesc): Implement.
12876 (VerifyApplicability): Implement.
12878 * expression.cs (Invocation::DoResolve): Update to accordingly handle
12879 delegate invocations too.
12881 (Invocation::Emit): Ditto.
12883 * ../errors/cs1593.cs : Added.
12885 * ../errors/cs1594.cs : Added.
12887 * delegate.cs (InstanceExpression, TargetMethod): New properties.
12889 2001-10-16 Ravi Pratap <ravi@ximian.com>
12891 * typemanager.cs (intptr_type): Core type for System.IntPtr
12893 (InitCoreTypes): Update for the same.
12895 (iasyncresult_type, asynccallback_type): Ditto.
12897 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12900 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12903 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12904 the builders for the 4 members of a delegate type :-)
12906 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12909 * expression.cs (New::DoResolve): Implement guts for delegate creation.
12911 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12913 2001-10-15 Miguel de Icaza <miguel@ximian.com>
12915 * statement.cs (Break::Emit): Implement.
12916 (Continue::Emit): Implement.
12918 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
12919 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
12920 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
12921 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
12924 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12925 properties that track the label for the current loop (begin of the
12926 loop and end of the loop).
12928 2001-10-15 Ravi Pratap <ravi@ximian.com>
12930 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
12931 use of emitting anything at all.
12933 * class.cs, rootcontext.cs : Get rid of calls to the same.
12935 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
12937 (Populate): Define the constructor correctly and set the implementation
12940 * typemanager.cs (delegate_types): New hashtable to hold delegates that
12943 (AddDelegateType): Implement.
12945 (IsDelegateType): Implement helper method.
12947 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
12949 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
12950 and accordingly handle it.
12952 * delegate.cs (Populate): Take TypeContainer argument.
12953 Implement bits to define the Invoke method. However, I still haven't figured out
12954 how to take care of the native int bit :-(
12956 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
12957 Qualify the name of the delegate, not its return type !
12959 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
12962 (StandardConversionExists): Checking for array types turns out to be recursive.
12964 (ConvertReferenceExplicit): Implement array conversion.
12966 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
12968 2001-10-12 Ravi Pratap <ravi@ximian.com>
12970 * cs-parser.jay (delegate_declaration): Store the fully qualified
12971 name as it is a type declaration.
12973 * delegate.cs (ReturnType, Name): Rename members to these. Make them
12976 (DefineDelegate): Renamed from Define. Does the same thing essentially,
12977 as TypeContainer::DefineType.
12979 (Populate): Method in which all the definition of the various methods (Invoke)
12982 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
12985 (CloseDelegate): Finally creates the delegate.
12987 * class.cs (TypeContainer::DefineType): Update to define delegates.
12988 (Populate, Emit and CloseType): Do the same thing here too.
12990 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
12991 delegates in all these operations.
12993 2001-10-14 Miguel de Icaza <miguel@ximian.com>
12995 * expression.cs: LocalTemporary: a new expression used to
12996 reference a temporary that has been created.
12998 * assign.cs: Handle PropertyAccess back here, so that we can
12999 provide the proper semantic access to properties.
13001 * expression.cs (Expression::ConvertReferenceExplicit): Implement
13002 a few more explicit conversions.
13004 * modifiers.cs: `NEW' modifier maps to HideBySig.
13006 * expression.cs (PropertyExpr): Make this into an
13007 ExpressionStatement, and support the EmitStatement code path.
13009 Perform get/set error checking, clean up the interface.
13011 * assign.cs: recognize PropertyExprs as targets, and if so, turn
13012 them into toplevel access objects.
13014 2001-10-12 Miguel de Icaza <miguel@ximian.com>
13016 * expression.cs: PropertyExpr::PropertyExpr: use work around the
13019 * typemanager.cs: Keep track here of our PropertyBuilders again to
13020 work around lameness in SRE.
13022 2001-10-11 Miguel de Icaza <miguel@ximian.com>
13024 * expression.cs (LValue::LValueResolve): New method in the
13025 interface, used to perform a second resolution pass for LValues.
13027 (This::DoResolve): Catch the use of this in static methods.
13029 (This::LValueResolve): Implement.
13031 (This::Store): Remove warning, assigning to `this' in structures
13034 (Invocation::Emit): Deal with invocation of
13035 methods on value types. We need to pass the address to structure
13036 methods rather than the object itself. (The equivalent code to
13037 emit "this" for structures leaves the entire structure on the
13038 stack instead of a pointer to it).
13040 (ParameterReference::DoResolve): Compute the real index for the
13041 argument based on whether the method takes or not a `this' pointer
13042 (ie, the method is static).
13044 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
13045 value types returned from functions when we need to invoke a
13046 method on the sturcture.
13049 2001-10-11 Ravi Pratap <ravi@ximian.com>
13051 * class.cs (TypeContainer::DefineType): Method to actually do the business of
13052 defining the type in the Modulebuilder or Typebuilder. This is to take
13053 care of nested types which need to be defined on the TypeBuilder using
13054 DefineNestedMethod.
13056 (TypeContainer::GetClassBases): Implement. Essentially the code from the
13057 methods in RootContext, only ported to be part of TypeContainer.
13059 (TypeContainer::GetInterfaceOrClass): Ditto.
13061 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
13063 * interface.cs (Interface::DefineInterface): New method. Does exactly
13064 what RootContext.CreateInterface did earlier, only it takes care of nested types
13067 (Interface::GetInterfaces): Move from RootContext here and port.
13069 (Interface::GetInterfaceByName): Same here.
13071 * rootcontext.cs (ResolveTree): Re-write.
13073 (PopulateTypes): Re-write.
13075 * class.cs (TypeContainer::Populate): Populate nested types too.
13076 (TypeContainer::Emit): Emit nested members too.
13078 * typemanager.cs (AddUserType): Do not make use of the FullName property,
13079 instead just use the name argument passed in as it is already fully
13082 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
13083 to TypeContainer mapping to see if a type is user-defined.
13085 * class.cs (TypeContainer::CloseType): Implement.
13087 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
13088 the default constructor.
13090 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
13093 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
13095 * interface.cs (CloseType): Create the type here.
13097 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
13100 Remove all the methods which are now in TypeContainer.
13102 2001-10-10 Ravi Pratap <ravi@ximian.com>
13104 * delegate.cs (Define): Re-write bits to define the delegate
13107 2001-10-10 Miguel de Icaza <miguel@ximian.com>
13109 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
13111 * expression.cs (ImplicitReferenceConversion): handle null as well
13112 as a source to convert to any reference type.
13114 * statement.cs (Return): Perform any implicit conversions to
13115 expected return type.
13117 Validate use of return statement.
13119 * codegen.cs (EmitContext): Pass the expected return type here.
13121 * class.cs (Method, Constructor, Property): Pass expected return
13122 type to EmitContext.
13124 2001-10-09 Miguel de Icaza <miguel@ximian.com>
13126 * expression.cs: Make DoResolve take an EmitContext instead of a
13129 Replaced `l' and `location' for `loc', for consistency.
13131 (Error, Warning): Remove unneeded Tc argument.
13133 * assign.cs, literal.cs, constant.cs: Update to new calling
13136 * codegen.cs: EmitContext now contains a flag indicating whether
13137 code is being generated in a static method or not.
13139 * cs-parser.jay: DecomposeQI, new function that replaces the old
13140 QualifiedIdentifier. Now we always decompose the assembled
13141 strings from qualified_identifier productions into a group of
13144 2001-10-08 Miguel de Icaza <miguel@ximian.com>
13146 * rootcontext.cs: Deal with field-less struct types correctly now
13147 by passing the size option to Define Type.
13149 * class.cs: Removed hack that created one static field.
13151 2001-10-07 Miguel de Icaza <miguel@ximian.com>
13153 * statement.cs: Moved most of the code generation here.
13155 2001-10-09 Ravi Pratap <ravi@ximian.com>
13157 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
13160 (ElementAccess): Remove useless bits for now - keep checks as the spec
13163 2001-10-08 Ravi Pratap <ravi@ximian.com>
13165 * expression.cs (ElementAccess::DoResolve): Remove my crap code
13166 and start performing checks according to the spec.
13168 2001-10-07 Ravi Pratap <ravi@ximian.com>
13170 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
13171 rank_specifiers instead.
13173 (rank_specifiers): Change the order in which the rank specifiers are stored
13175 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
13177 * expression.cs (ElementAccess): Implement the LValue interface too.
13179 2001-10-06 Ravi Pratap <ravi@ximian.com>
13181 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
13182 except that user defined conversions are not included.
13184 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
13185 perform the conversion of the return type, if necessary.
13187 (New::DoResolve): Check whether we are creating an array or an object
13188 and accordingly do the needful.
13190 (New::Emit): Same here.
13192 (New::DoResolve): Implement guts of array creation.
13194 (New::FormLookupType): Helper function.
13196 2001-10-07 Miguel de Icaza <miguel@ximian.com>
13198 * codegen.cs: Removed most of the code generation here, and move the
13199 corresponding code generation bits to the statement classes.
13201 Added support for try/catch/finalize and throw.
13203 * cs-parser.jay: Added support for try/catch/finalize.
13205 * class.cs: Catch static methods having the flags override,
13206 virtual or abstract.
13208 * expression.cs (UserCast): This user cast was not really doing
13209 what it was supposed to do. Which is to be born in fully resolved
13210 state. Parts of the resolution were being performed at Emit time!
13214 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13216 * expression.cs: Implicity convert the result from UserCast.
13218 2001-10-05 Ravi Pratap <ravi@ximian.com>
13220 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
13221 prevented it from working correctly.
13223 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
13224 merely ConvertImplicit.
13226 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13228 * typemanager.cs: Make the LookupTypeContainer function static,
13229 and not per-instance.
13231 * class.cs: Make static FindMembers (the one that takes a Type
13234 * codegen.cs: Add EmitForeach here.
13236 * cs-parser.jay: Make foreach a toplevel object instead of the
13237 inline expansion, as we need to perform semantic analysis on it.
13239 2001-10-05 Ravi Pratap <ravi@ximian.com>
13241 * expression.cs (Expression::ImplicitUserConversion): Rename to
13242 UserDefinedConversion.
13244 (Expression::UserDefinedConversion): Take an extra argument specifying
13245 whether we look for explicit user conversions too.
13247 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
13249 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
13251 (ExplicitUserConversion): Make it a call to UserDefinedConversion
13252 with the appropriate arguments.
13254 * cs-parser.jay (cast_expression): Record location too.
13256 * expression.cs (Cast): Record location info.
13258 (Expression::ConvertExplicit): Take location argument.
13260 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
13261 to determine if we are doing explicit conversions.
13263 (UserCast::Emit): Update accordingly.
13265 (Expression::ConvertExplicit): Report an error if everything fails.
13267 * ../errors/cs0030.cs : Add.
13269 2001-10-04 Miguel de Icaza <miguel@ximian.com>
13271 * modifiers.cs: If the ABSTRACT keyword is present, also set the
13272 virtual and newslot bits.
13274 * class.cs (TypeContainer::RegisterRequiredImplementations):
13275 Record methods we need.
13277 (TypeContainer::MakeKey): Helper function to make keys for
13278 MethodBases, since the Methodbase key is useless.
13280 (TypeContainer::Populate): Call RegisterRequiredImplementations
13281 before defining the methods.
13283 Create a mapping for method_builders_to_methods ahead of time
13284 instead of inside a tight loop.
13286 (::RequireMethods): Accept an object as the data to set into the
13287 hashtable so we can report interface vs abstract method mismatch.
13289 2001-10-03 Miguel de Icaza <miguel@ximian.com>
13291 * report.cs: Make all of it static.
13293 * rootcontext.cs: Drop object_type and value_type computations, as
13294 we have those in the TypeManager anyways.
13296 Drop report instance variable too, now it is a global.
13298 * driver.cs: Use try/catch on command line handling.
13300 Add --probe option to debug the error reporting system with a test
13303 * report.cs: Add support for exiting program when a probe
13304 condition is reached.
13306 2001-10-03 Ravi Pratap <ravi@ximian.com>
13308 * expression.cs (Binary::DoNumericPromotions): Fix the case when
13309 we do a forcible conversion regardless of type, to check if
13310 ForceConversion returns a null.
13312 (Binary::error19): Use location to report error.
13314 (Unary::error23): Use location here too.
13316 * ../errors/cs0019.cs : Check in.
13318 * ../errors/cs0023.cs : Check in.
13320 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
13321 case of a non-null MethodInfo object with a length of 0 !
13323 (Binary::ResolveOperator): Flag error if overload resolution fails to find
13324 an applicable member - according to the spec :-)
13325 Also fix logic to find members in base types.
13327 (Unary::ResolveOperator): Same here.
13329 (Unary::report23): Change name to error23 and make first argument a TypeContainer
13330 as I was getting thoroughly confused between this and error19 :-)
13332 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
13333 (::FindMostEncompassedType): Implement.
13334 (::FindMostEncompassingType): Implement.
13335 (::StandardConversionExists): Implement.
13337 (UserImplicitCast): Re-vamp. We now need info about most specific
13338 source and target types so that we can do the necessary conversions.
13340 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
13341 mathematical union with no duplicates.
13343 2001-10-03 Miguel de Icaza <miguel@ximian.com>
13345 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
13346 in order from base classes to child classes, so that we can in
13347 child classes look up in our parent for method names and
13348 attributes (required for handling abstract, virtual, new, override
13349 constructs: we need to instrospect our base class, and if we dont
13350 populate the classes in order, the introspection might be
13351 incorrect. For example, a method could query its parent before
13352 the parent has any methods and would determine that the parent has
13353 no abstract methods (while it could have had them)).
13355 (RootContext::CreateType): Record the order in which we define the
13358 2001-10-02 Miguel de Icaza <miguel@ximian.com>
13360 * class.cs (TypeContainer::Populate): Also method definitions can
13361 fail now, keep track of this.
13363 (TypeContainer::FindMembers): Implement support for
13364 DeclaredOnly/noDeclaredOnly flag.
13366 (Constructor::Emit) Return the ConstructorBuilder.
13368 (Method::Emit) Return the MethodBuilder.
13369 Check for abstract or virtual methods to be public.
13371 * rootcontext.cs (RootContext::CreateType): Register all the
13372 abstract methods required for the class to be complete and the
13373 interface methods that must be implemented.
13375 * cs-parser.jay: Report error 501 (method requires body if it is
13376 not marked abstract or extern).
13378 * expression.cs (TypeOf::Emit): Implement.
13380 * typemanager.cs: runtime_handle_type, new global type.
13382 * class.cs (Property::Emit): Generate code for properties.
13384 2001-10-02 Ravi Pratap <ravi@ximian.com>
13386 * expression.cs (Unary::ResolveOperator): Find operators on base type
13387 too - we now conform exactly to the spec.
13389 (Binary::ResolveOperator): Same here.
13391 * class.cs (Operator::Define): Fix minor quirk in the tests.
13393 * ../errors/cs0215.cs : Added.
13395 * ../errors/cs0556.cs : Added.
13397 * ../errors/cs0555.cs : Added.
13399 2001-10-01 Miguel de Icaza <miguel@ximian.com>
13401 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
13402 single integer which is really efficient
13404 2001-10-01 Ravi Pratap <ravi@ximian.com>
13406 * expression.cs (Expression::ImplicitUserConversion): Use location
13407 even in the case when we are examining True operators.
13409 * class.cs (Operator::Define): Perform extensive checks to conform
13410 with the rules for operator overloading in the spec.
13412 * expression.cs (Expression::ImplicitReferenceConversion): Implement
13413 some of the other conversions mentioned in the spec.
13415 * typemanager.cs (array_type): New static member for the System.Array built-in
13418 (cloneable_interface): For System.ICloneable interface.
13420 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
13421 we start resolving the tree and populating types.
13423 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
13425 2001-10-01 Miguel de Icaza <miguel@ximian.com>
13427 * expression.cs (Expression::ExprClassFromMemberInfo,
13428 Expression::Literalize): Create literal expressions from
13429 FieldInfos which are literals.
13431 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
13432 type casts, because they were wrong. The test suite in tests
13435 (ImplicitNumericConversion): ushort to ulong requires a widening
13438 Int32 constant to long requires widening cast as well.
13440 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
13441 for integers because the type on the stack is not i4.
13443 2001-09-30 Miguel de Icaza <miguel@ximian.com>
13445 * expression.cs (report118): require location argument.
13447 * parameter.cs: Do not dereference potential null value.
13449 * class.cs: Catch methods that lack the `new' keyword when
13450 overriding a name. Report warnings when `new' is used without
13451 anything being there to override.
13453 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
13455 * class.cs: Only add constructor to hashtable if it is non-null
13456 (as now constructors can fail on define).
13458 (TypeManager, Class, Struct): Take location arguments.
13460 Catch field instance initialization in structs as errors.
13462 accepting_filter: a new filter for FindMembers that is static so
13463 that we dont create an instance per invocation.
13465 (Constructor::Define): Catch errors where a struct constructor is
13468 * cs-parser.jay: Pass location information for various new
13471 * delegate.cs (Delegate): take a location argument.
13473 * driver.cs: Do not call EmitCode if there were problesm in the
13474 Definition of the types, as many Builders wont be there.
13476 * decl.cs (Decl::Decl): Require a location argument.
13478 * cs-tokenizer.cs: Handle properly hex constants that can not fit
13479 into integers, and find the most appropiate integer for it.
13481 * literal.cs: Implement ULongLiteral.
13483 * rootcontext.cs: Provide better information about the location of
13484 failure when CreateType fails.
13486 2001-09-29 Miguel de Icaza <miguel@ximian.com>
13488 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
13491 * expression.cs (Binary::CheckShiftArguments): Add missing type
13493 (Binary::ResolveOperator): Add type to the logical and and logical
13494 or, Bitwise And/Or and Exclusive Or code paths, it was missing
13497 (Binary::DoNumericPromotions): In the case where either argument
13498 is ulong (and most signed types combined with ulong cause an
13499 error) perform implicit integer constant conversions as well.
13501 2001-09-28 Miguel de Icaza <miguel@ximian.com>
13503 * expression.cs (UserImplicitCast): Method should always be
13505 (Invocation::BetterConversion): Simplified test for IntLiteral.
13507 (Expression::ImplicitNumericConversion): Split this routine out.
13508 Put the code that performs implicit constant integer conversions
13511 (Expression::Resolve): Become a wrapper around DoResolve so we can
13512 check eclass and type being set after resolve.
13514 (Invocation::Badness): Remove this dead function
13516 (Binary::ResolveOperator): Do not compute the expensive argumnets
13517 unless we have a union for it.
13519 (Probe::Emit): Is needs to do an isinst and then
13520 compare against null.
13522 (::CanConvert): Added Location argument. If the Location argument
13523 is null (Location.Null), then we do not report errors. This is
13524 used by the `probe' mechanism of the Explicit conversion. We do
13525 not want to generate an error for something that the user
13526 explicitly requested to be casted. But the pipeline for an
13527 explicit cast first tests for potential implicit casts.
13529 So for now, if the Location is null, it means `Probe only' to
13530 avoid adding another argument. Might have to revise this
13533 (ClassCast): New class used to type cast objects into arbitrary
13534 classes (used in Explicit Reference Conversions).
13536 Implement `as' as well.
13538 Reverted all the patches from Ravi below: they were broken:
13540 * The use of `level' as a mechanism to stop recursive
13541 invocations is wrong. That was there just to catch the
13542 bug with a strack trace but not as a way of addressing
13545 To fix the problem we have to *understand* what is going
13546 on and the interactions and come up with a plan, not
13547 just get things going.
13549 * The use of the type conversion cache that I proposed
13550 last night had an open topic: How does this work across
13551 protection domains. A user defined conversion might not
13552 be public in the location where we are applying the
13553 conversion, a different conversion might be selected
13554 (ie, private A->B (better) but public B->A (worse),
13555 inside A, A->B applies, but outside it, B->A will
13558 * On top of that (ie, even if the above is solved),
13559 conversions in a cache need to be abstract. Ie, `To
13560 convert from an Int to a Short use an OpcodeCast', not
13561 `To convert from an Int to a Short use the OpcodeCast on
13562 the variable 5' (which is what this patch was doing).
13564 2001-09-28 Ravi Pratap <ravi@ximian.com>
13566 * expression.cs (Invocation::ConversionExists): Re-write to use
13567 the conversion cache
13569 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
13570 cache all conversions done, not just user-defined ones.
13572 (Invocation::BetterConversion): The real culprit. Use ConversionExists
13573 to determine if a conversion exists instead of acutually trying to
13574 perform the conversion. It's faster too.
13576 (Expression::ConvertExplicit): Modify to use ConversionExists to check
13577 and only then attempt the implicit conversion.
13579 2001-09-28 Ravi Pratap <ravi@ximian.com>
13581 * expression.cs (ConvertImplicit): Use a cache for conversions
13582 already found. Check level of recursion and bail out if necessary.
13584 2001-09-28 Miguel de Icaza <miguel@ximian.com>
13586 * typemanager.cs (string_concat_string_string, string_concat_object_object):
13587 Export standard methods that we expect for string operations.
13589 * statement.cs (Block::UsageWarning): Track usage of variables and
13590 report the errors for not used variables.
13592 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
13595 2001-09-27 Miguel de Icaza <miguel@ximian.com>
13597 * codegen.cs: remove unnneded code
13599 * expression.cs: Removed BuiltinTypeAccess class
13601 Fix the order in which implicit conversions are
13604 The previous fixed dropped support for boxed conversions (adding a
13605 test to the test suite now)
13607 (UserImplicitCast::CanConvert): Remove test for source being null,
13608 that code is broken. We should not feed a null to begin with, if
13609 we do, then we should track the bug where the problem originates
13610 and not try to cover it up here.
13612 Return a resolved expression of type UserImplicitCast on success
13613 rather than true/false. Ravi: this is what I was talking about,
13614 the pattern is to use a static method as a "constructor" for
13617 Also, do not create arguments until the very last minute,
13618 otherwise we always create the arguments even for lookups that
13619 will never be performed.
13621 (UserImplicitCast::Resolve): Eliminate, objects of type
13622 UserImplicitCast are born in a fully resolved state.
13624 * typemanager.cs (InitCoreTypes): Init also value_type
13625 (System.ValueType).
13627 * expression.cs (Cast::Resolve): First resolve the child expression.
13629 (LValue): Add new method AddressOf to be used by
13632 Change the argument of Store to take an EmitContext instead of an
13633 ILGenerator, because things like FieldExpr need to be able to call
13634 their children expression to generate the instance code.
13636 (Expression::Error, Expression::Warning): Sugar functions for
13639 (Expression::MemberLookup): Accept a TypeContainer instead of a
13640 Report as the first argument.
13642 (Expression::ResolvePrimary): Killed. I still want to improve
13643 this as currently the code is just not right.
13645 (Expression::ResolveMemberAccess): Simplify, but it is still
13648 (Unary::Resolve): Catch errors in AddressOf operators.
13650 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13651 index to a byte for the short-version, or the compiler will choose
13652 the wrong Emit call, which generates the wrong data.
13654 (ParameterReference::Emit, ::Store): same.
13656 (FieldExpr::AddressOf): Implement.
13658 * typemanager.cs: TypeManager: made public variable instead of
13661 * driver.cs: document --fatal.
13663 * report.cs (ErrorMessage, WarningMessage): new names for the old
13664 Error and Warning classes.
13666 * cs-parser.jay (member_access): Turn built-in access to types
13667 into a normal simplename
13669 2001-09-27 Ravi Pratap <ravi@ximian.com>
13671 * expression.cs (Invocation::BetterConversion): Fix to cope
13672 with q being null, since this was introducing a bug.
13674 * expression.cs (ConvertImplicit): Do built-in conversions first.
13676 2001-09-27 Ravi Pratap <ravi@ximian.com>
13678 * expression.cs (UserImplicitCast::Resolve): Fix bug.
13680 2001-09-27 Ravi Pratap <ravi@ximian.com>
13682 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13683 I had introduced long ago (what's new ?).
13685 * expression.cs (UserImplicitCast::CanConvert): Static method to do
13686 the work of all the checking.
13687 (ConvertImplicit): Call CanConvert and only then create object if necessary.
13688 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13690 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13691 that is the right way.
13693 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
13694 overloading resolution. Use everywhere instead of cutting and pasting code.
13696 (Binary::ResolveOperator): Use MakeUnionSet.
13698 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
13699 we have to convert to bool types. Not complete yet.
13701 2001-09-27 Miguel de Icaza <miguel@ximian.com>
13703 * typemanager.cs (TypeManager::CSharpName): support ushort.
13705 * expression.cs (Expression::TryImplicitIntConversion): Attempts
13706 to provide an expression that performsn an implicit constant int
13707 conversion (section 6.1.6).
13708 (Expression::ConvertImplicitRequired): Reworked to include
13709 implicit constant expression conversions.
13711 (Expression::ConvertNumericExplicit): Finished.
13713 (Invocation::Emit): If InstanceExpression is null, then it means
13714 that we perform a call on this.
13716 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13718 * expression.cs (Unary::Emit): Remove some dead code.
13719 (Probe): Implement Resolve and Emit for `is'.
13720 (Expression::ConvertImplicitRequired): Attempt to do constant
13721 expression conversions here. Maybe should be moved to
13722 ConvertImplicit, but I am not sure.
13723 (Expression::ImplicitLongConstantConversionPossible,
13724 Expression::ImplicitIntConstantConversionPossible): New functions
13725 that tell whether is it possible to apply an implicit constant
13726 expression conversion.
13728 (ConvertNumericExplicit): Started work on explicit numeric
13731 * cs-parser.jay: Update operator constants.
13733 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13734 (Parameters::GetSignature): Hook up VerifyArgs here.
13735 (Parameters::VerifyArgs): Verifies that no two arguments have the
13738 * class.cs (Operator): Update the operator names to reflect the
13739 ones that the spec expects (as we are just stringizing the
13742 * expression.cs (Unary::ResolveOperator): Fix bug: Use
13743 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13744 previous usage did only work for our methods.
13745 (Expression::ConvertImplicit): Handle decimal implicit numeric
13746 conversions as well.
13747 (Expression::InternalTypeConstructor): Used to invoke constructors
13748 on internal types for default promotions.
13750 (Unary::Emit): Implement special handling for the pre/post
13751 increment/decrement for overloaded operators, as they need to have
13752 the same semantics as the other operators.
13754 (Binary::ResolveOperator): ditto.
13755 (Invocation::ConversionExists): ditto.
13756 (UserImplicitCast::Resolve): ditto.
13758 2001-09-26 Ravi Pratap <ravi@ximian.com>
13760 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13761 operator, return after emitting body. Regression tests pass again !
13763 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13764 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13765 (Invocation::OverloadResolve): Ditto.
13766 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13768 * everywhere : update calls to the above methods accordingly.
13770 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13772 * assign.cs (Assign): Make it inherit from ExpressionStatement.
13774 * expression.cs (ExpressionStatement): New base class used for
13775 expressions that can appear in statements, so that we can provide
13776 an alternate path to generate expression that do not leave a value
13779 (Expression::Emit, and all the derivatives): We no longer return
13780 whether a value is left on the stack or not. Every expression
13781 after being emitted leaves a single value on the stack.
13783 * codegen.cs (EmitContext::EmitStatementExpression): Use the
13784 facilties of ExpressionStatement if possible.
13786 * cs-parser.jay: Update statement_expression.
13788 2001-09-25 Miguel de Icaza <miguel@ximian.com>
13790 * driver.cs: Change the wording of message
13792 2001-09-25 Ravi Pratap <ravi@ximian.com>
13794 * expression.cs (Binary::ResolveOperator): Had forgottten to set
13795 the type of the expression to the return type of the method if
13796 we have an overloaded operator match ! The regression tests pass again !
13797 (Unary::ResolveOperator): Ditto.
13799 * expression.cs (Invocation::ConversionExists): Correct the member lookup
13800 to find "op_Implicit", not "implicit" ;-)
13801 (UserImplicitCast): New class to take care of user-defined implicit conversions.
13802 (ConvertImplicit, ForceConversion): Take TypeContainer argument
13804 * everywhere : Correct calls to the above accordingly.
13806 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13807 (ConvertImplicit): Do user-defined conversion if it exists.
13809 2001-09-24 Miguel de Icaza <miguel@ximian.com>
13811 * assign.cs: track location.
13812 (Resolve): Use implicit conversions on assignment.
13814 * literal.cs: Oops. Not good, Emit of short access values should
13815 pass (Bytes) or the wrong argument will be selected.
13817 * expression.cs (Unary::Emit): Emit code for -expr.
13819 (Unary::ResolveOperator): Handle `Substract' for non-constants
13820 (substract from zero from the non-constants).
13821 Deal with Doubles as well.
13823 (Expression::ConvertImplicitRequired): New routine that reports an
13824 error if no implicit conversion exists.
13826 (Invocation::OverloadResolve): Store the converted implicit
13827 expressions if we make them
13829 2001-09-24 Ravi Pratap <ravi@ximian.com>
13831 * class.cs (ConstructorInitializer): Take a Location argument.
13832 (ConstructorBaseInitializer): Same here.
13833 (ConstructorThisInitializer): Same here.
13835 * cs-parser.jay : Update all calls accordingly.
13837 * expression.cs (Unary, Binary, New): Take location argument.
13838 Update accordingly everywhere.
13840 * cs-parser.jay : Update all calls to the above to take a location
13843 * class.cs : Ditto.
13845 2001-09-24 Ravi Pratap <ravi@ximian.com>
13847 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13848 (Invocation::BetterConversion): Same here
13849 (Invocation::ConversionExists): Ditto.
13851 (Invocation::ConversionExists): Implement.
13853 2001-09-22 Ravi Pratap <ravi@ximian.com>
13855 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13856 Also take an additional TypeContainer argument.
13858 * All over : Pass in TypeContainer as argument to OverloadResolve.
13860 * typemanager.cs (CSharpName): Update to check for the string type and return
13863 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13866 2001-09-21 Ravi Pratap <ravi@ximian.com>
13868 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13869 (Invocation::BetterFunction): Implement.
13870 (Invocation::BetterConversion): Implement.
13871 (Invocation::ConversionExists): Skeleton, no implementation yet.
13873 Okay, things work fine !
13875 2001-09-21 Miguel de Icaza <miguel@ximian.com>
13877 * typemanager.cs: declare and load enum_type, delegate_type and
13880 * expression.cs (Expression::Emit): Now emit returns a value that
13881 tells whether a value is left on the stack or not. This strategy
13882 might be reveted tomorrow with a mechanism that would address
13883 multiple assignments.
13884 (Expression::report118): Utility routine to report mismatches on
13887 (Unary::Report23): Report impossible type/operator combination
13890 (Unary::IsIncrementableNumber): Whether the type can be
13891 incremented or decremented with add.
13892 (Unary::ResolveOperator): Also allow enumerations to be bitwise
13894 (Unary::ResolveOperator): Implement ++, !, ~,
13896 (Invocation::Emit): Deal with new Emit convetion.
13898 * All Expression derivatives: Updated their Emit method to return
13899 whether they leave values on the stack or not.
13901 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13902 stack for expressions that are statements.
13904 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13906 * expression.cs (LValue): New interface. Must be implemented by
13908 (LocalVariableReference, ParameterReference, FieldExpr): Implement
13911 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13912 interface for generating code, simplifies the code.
13914 2001-09-20 Ravi Pratap <ravi@ximian.com>
13916 * expression.cs (everywhere): Comment out return statements in ::Resolve
13917 methods to avoid the warnings.
13919 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13921 * driver.cs (parse): Report error 2001 if we can not open the
13924 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13927 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
13930 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
13931 otherwise nested blocks end up with the same index.
13933 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
13935 * expression.cs: Instead of having FIXMEs in the Resolve
13936 functions, throw exceptions so it is obvious that we are facing a
13939 * cs-parser.jay (invocation_expression): Pass Location information.
13941 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
13942 Use a basename for those routines because .NET does not like paths
13945 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
13948 2001-09-19 Miguel de Icaza <miguel@ximian.com>
13950 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
13951 are loading the correct data types (throws an exception if not).
13952 (TypeManager::InitCoreTypes): Use CoreLookupType
13954 * expression.cs (Unary::ResolveOperator): return the child
13955 expression for expressions which are just +expr.
13956 (Unary::ResolveOperator): Return negative literals for -LITERAL
13957 expressions (otherwise they are Unary {Literal}).
13958 (Invocation::Badness): Take into account `Implicit constant
13959 expression conversions'.
13961 * literal.cs (LongLiteral): Implement long literal class.
13962 (IntLiteral): export the `Value' of the intliteral.
13964 2001-09-19 Ravi Pratap <ravi@ximian.com>
13966 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
13968 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
13969 instead of 'Operator'
13971 * expression.cs (Binary::ResolveOperator): Update accordingly.
13972 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
13975 * cs-parser.jay (unary_expression): Update to use the new names.
13977 * gen-treedump.cs (GetUnary): Same here.
13979 * expression.cs (Unary::Resolve): Implement.
13980 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
13981 operators are found instead of making noise ;-)
13982 (Unary::ResolveOperator): New method to do precisely the same thing which
13983 Binary::ResolveOperator does for Binary expressions.
13984 (Unary.method, .Arguments): Add.
13985 (Unary::OperName): Implement.
13986 (Unary::ForceConversion): Copy and Paste !
13988 * class.cs (Operator::Define): Fix a small bug for the case when we have
13991 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
13992 for the inbuilt operators. Only overloading works for now ;-)
13994 2001-09-18 Miguel de Icaza <miguel@ximian.com>
13996 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
13997 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
13999 * expression.cs (This::Emit): Implement.
14000 (This::Resolve): Implement.
14001 (TypeOf:Resolve): Implement.
14002 (Expression::ResolveSimpleName): Add an implicit this to instance
14004 (MemberAccess::Resolve): Deal with Parameters and Fields.
14005 Bind instance variable to Field expressions.
14006 (FieldExpr::Instance): New field used to track the expression that
14007 represents the object instance.
14008 (FieldExpr::Resolve): Track potential errors from MemberLookup not
14010 (FieldExpr::Emit): Implement.
14012 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
14013 the last instruction contains a return opcode to avoid generating
14014 the last `ret' instruction (this generates correct code, and it is
14015 nice to pass the peverify output).
14017 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
14018 initializer for static and instance variables.
14019 (Constructor::Emit): Allow initializer to be null in the case of
14020 static constructors. Only emit initializer for instance
14023 (TypeContainer::FindMembers): Return a null array if there are no
14026 Also fix the code for the MemberTypes.Method branch, as it was not
14027 scanning that for operators (or tried to access null variables before).
14029 * assign.cs (Assign::Emit): Handle instance and static fields.
14033 * driver.cs: Stop compilation if there are parse errors.
14035 * cs-parser.jay (constructor_declaration): Provide default base
14036 initializer for non-static constructors.
14037 (constructor_declarator): Do not provide a default base
14038 initializers if none was specified.
14039 Catch the fact that constructors should not have parameters.
14041 * class.cs: Do not emit parent class initializers for static
14042 constructors, that should be flagged as an error.
14044 2001-09-18 Ravi Pratap <ravi@ximian.com>
14046 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
14047 Move back code into TypeContainer::Populate.
14049 2001-09-18 Ravi Pratap <ravi@ximian.com>
14051 * class.cs (TypeContainer::AddConstructor): Fix the check to
14052 compare against Name, not Basename.
14053 (Operator::OpType): Change Plus and Minus to Add and Subtract.
14055 * cs-parser.jay : Update accordingly.
14057 * class.cs (TypeContainer::FindMembers): For the case where we are searching
14058 for methods, don't forget to look into the operators too.
14059 (RegisterMethodBuilder): Helper method to take care of this for
14060 methods, constructors and operators.
14061 (Operator::Define): Completely revamp.
14062 (Operator.OperatorMethod, MethodName): New fields.
14063 (TypeContainer::Populate): Move the registering of builders into
14064 RegisterMethodBuilder.
14065 (Operator::Emit): Re-write.
14067 * expression.cs (Binary::Emit): Comment out code path to emit method
14068 invocation stuff for the case when we have a user defined operator. I am
14069 just not able to get it right !
14071 2001-09-17 Miguel de Icaza <miguel@ximian.com>
14073 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
14076 (Expression::MemberLookup): Provide a version that allows to
14077 specify the MemberTypes and BindingFlags.
14079 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
14080 so it was not fetching variable information from outer blocks.
14082 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
14083 Beforefieldinit as it was buggy.
14085 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
14086 that Ravi put here.
14088 * class.cs (Constructor::Emit): Only emit if block is not null.
14089 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
14090 deal with this by semantically definining it as if the user had
14093 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
14094 constructors as we now "emit" them at a higher level.
14096 (TypeContainer::DefineDefaultConstructor): Used to define the
14097 default constructors if none was provided.
14099 (ConstructorInitializer): Add methods Resolve and Emit.
14101 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
14103 2001-09-17 Ravi Pratap <ravi@ximian.com>
14105 * class.cs (TypeContainer::EmitDefaultConstructor): Register
14106 the default constructor builder with our hashtable for methodbuilders
14109 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
14110 and argument_count is 0 in which case we have a match.
14111 (Binary::ResolveOperator): More null checking and miscellaneous coding
14114 2001-09-17 Ravi Pratap <ravi@ximian.com>
14116 * rootcontext.cs (IsNameSpace): Compare against null.
14118 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
14120 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
14121 and Unary::Operator.
14123 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
14126 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
14127 we have overloaded operators.
14128 (Binary::ResolveOperator): Implement the part which does the operator overload
14131 * class.cs (Operator::Emit): Implement.
14132 (TypeContainer::Emit): Emit the operators we have too.
14134 * expression.cs (Binary::Emit): Update to emit the appropriate code for
14135 the case when we have a user-defined operator.
14137 2001-09-17 Miguel de Icaza <miguel@ximian.com>
14139 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
14141 2001-09-16 Ravi Pratap <ravi@ximian.com>
14143 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
14144 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
14145 (Constructor::Emit): Implement.
14146 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
14147 if we have no work to do.
14148 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
14151 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
14152 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
14154 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
14157 2001-09-15 Ravi Pratap <ravi@ximian.com>
14159 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
14161 (Tree::RecordNamespace): Method to do what the name says ;-)
14162 (Tree::Namespaces): Property to get at the namespaces hashtable.
14164 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
14167 * rootcontext.cs (IsNamespace): Fixed it :-)
14169 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14171 * class.cs (TypeContainer::FindMembers): Add support for
14173 (MethodCore): New class that encapsulates both the shared aspects
14174 of a Constructor and a Method.
14175 (Method, Constructor): Factored pieces into MethodCore.
14177 * driver.cs: Added --fatal which makes errors throw exceptions.
14178 Load System assembly as well as part of the standard library.
14180 * report.cs: Allow throwing exceptions on errors for debugging.
14182 * modifiers.cs: Do not use `parent', instead use the real type
14183 container to evaluate permission settings.
14185 * class.cs: Put Ravi's patch back in. He is right, and we will
14186 have to cope with the
14188 2001-09-14 Ravi Pratap <ravi@ximian.com>
14190 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
14191 FamORAssem, not FamANDAssem.
14193 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14195 * driver.cs: Added --parse option that only parses its input files
14198 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
14199 incorrect. IsTopLevel is not used to tell whether an object is
14200 root_types or not (that can be achieved by testing this ==
14201 root_types). But to see if this is a top-level *class* (not
14202 necessarly our "toplevel" container).
14204 2001-09-14 Ravi Pratap <ravi@ximian.com>
14206 * enum.cs (Enum::Define): Modify to call the Lookup method on the
14207 parent instead of a direct call to GetType.
14209 2001-09-14 Ravi Pratap <ravi@ximian.com>
14211 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
14212 Modifiers.TypeAttr. This should just be a call to that method.
14214 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
14215 object so that we can determine if we are top-level or not.
14217 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
14220 * enum.cs (Enum::Define): Ditto.
14222 * modifiers.cs (FieldAttr): Re-write.
14224 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
14225 (TypeContainer::HaveStaticConstructor): New property to provide access
14226 to precisely that info.
14228 * modifiers.cs (MethodAttr): Re-write.
14229 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
14231 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
14232 of top-level types as claimed.
14234 2001-09-13 Miguel de Icaza <miguel@ximian.com>
14236 * expression.cs (MemberLookup): Fruitless attempt to lookup
14237 constructors. Maybe I need to emit default constructors? That
14238 might be it (currently .NET emits this for me automatically).
14239 (Invocation::OverloadResolve): Cope with Arguments == null.
14240 (Invocation::EmitArguments): new function, shared by the new
14241 constructor and us.
14242 (Invocation::Emit): Handle static and instance methods. Emit
14243 proper call instruction for virtual or non-virtual invocations.
14244 (New::Emit): Implement.
14245 (New::Resolve): Implement.
14246 (MemberAccess:Resolve): Implement.
14247 (MethodGroupExpr::InstanceExpression): used conforming to the spec
14248 to track instances.
14249 (FieldExpr::Resolve): Set type.
14251 * support.cs: Handle empty arguments.
14253 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
14254 SimpleLookup): Auxiliary routines to help parse a qualifier
14257 Update qualifier_identifier rule.
14259 * codegen.cs: Removed debugging messages.
14261 * class.cs: Make this a global thing, this acts just as a "key" to
14262 objects that we might have around.
14264 (Populate): Only initialize method_builders_to_methods once.
14266 * expression.cs (PropertyExpr): Initialize type from the
14269 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
14270 Resolve pattern. Attempt to implicitly convert value to boolean.
14273 * expression.cs: Set the type for the int32/int32 argument case.
14274 (Binary::ResolveOperator): Set the return type to boolean for
14275 comparission operators
14277 * typemanager.cs: Remove debugging print code.
14279 (Invocation::Resolve): resolve type.
14281 * class.cs: Allocate a MemberInfo of the correct size, as the code
14282 elsewhere depends on the test to reflect the correct contents.
14284 (Method::) Keep track of parameters, due to System.Reflection holes
14286 (TypeContainer::Populate): Keep track of MethodBuilders to Method
14289 (TypeContainer::FindMembers): Use ArrayList and then copy an array
14290 of the exact size and return that.
14292 (Class::LookupMethodByBuilder): New function that maps
14293 MethodBuilders to its methods. Required to locate the information
14294 on methods because System.Reflection bit us again.
14296 * support.cs: New file, contains an interface ParameterData and
14297 two implementations: ReflectionParameters and InternalParameters
14298 used to access Parameter information. We will need to grow this
14301 * expression.cs (Invocation::GetParameterData): implement a cache
14302 and a wrapper around the ParameterData creation for methods.
14303 (Invocation::OverloadResolve): Use new code.
14305 2001-09-13 Ravi Pratap <ravi@ximian.com>
14307 * class.cs (TypeContainer::EmitField): Remove and move into
14308 (Field::Define): here and modify accordingly.
14309 (Field.FieldBuilder): New member.
14310 (TypeContainer::Populate): Update accordingly.
14311 (TypeContainer::FindMembers): Implement.
14313 2001-09-13 Miguel de Icaza <miguel@ximian.com>
14315 * statement.cs: (VariableInfo::VariableType): New field to be
14316 initialized with the full type once it is resolved.
14318 2001-09-12 Miguel de Icaza <miguel@ximian.com>
14320 * parameter.cs (GetParameterInfo): Use a type cache to compute
14321 things only once, and to reuse this information
14323 * expression.cs (LocalVariableReference::Emit): Implement.
14324 (OpcodeCast::Emit): fix.
14326 (ParameterReference::Resolve): Implement.
14327 (ParameterReference::Emit): Implement.
14329 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
14330 that are expressions need to stay as Expressions.
14332 * typemanager.cs (CSharpName): Returns the C# name of a type if
14335 * expression.cs (Expression::ConvertImplicit): New function that
14336 implements implicit type conversions.
14338 (Expression::ImplicitReferenceConversion): Implements implicit
14339 reference conversions.
14341 (EmptyCast): New type for transparent casts.
14343 (OpcodeCast): New type for casts of types that are performed with
14344 a sequence of bytecodes.
14346 (BoxedCast): New type used for casting value types into reference
14347 types. Emits a box opcode.
14349 (Binary::DoNumericPromotions): Implements numeric promotions of
14350 and computation of the Binary::Type.
14352 (Binary::EmitBranchable): Optimization.
14354 (Binary::Emit): Implement code emission for expressions.
14356 * typemanager.cs (TypeManager): Added two new core types: sbyte
14359 2001-09-12 Ravi Pratap <ravi@ximian.com>
14361 * class.cs (TypeContainer::FindMembers): Method which does exactly
14362 what Type.FindMembers does, only we don't have to use reflection. No
14363 implementation yet.
14365 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
14366 typecontainer objects as we need to get at them.
14367 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
14369 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
14370 typecontainer object.
14372 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
14373 of just a Report object.
14375 2001-09-11 Ravi Pratap <ravi@ximian.com>
14377 * class.cs (Event::Define): Go back to using the prefixes "add_" and
14379 (TypeContainer::Populate): Now define the delegates of the type too.
14380 (TypeContainer.Delegates): Property to access the list of delegates defined
14383 * delegates.cs (Delegate::Define): Implement partially.
14385 * modifiers.cs (TypeAttr): Handle more flags.
14387 2001-09-11 Ravi Pratap <ravi@ximian.com>
14389 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
14391 (Operator::Define): Re-write logic to get types by using the LookupType method
14392 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
14393 (Indexer::Define): Ditto.
14394 (Event::Define): Ditto.
14395 (Property::Define): Ditto.
14397 2001-09-10 Ravi Pratap <ravi@ximian.com>
14399 * class.cs (TypeContainer::Populate): Now define operators too.
14400 (TypeContainer.Operators): New property to access the list of operators
14402 (Operator.OperatorMethodBuilder): New member to hold the method builder
14403 for the operator we are defining.
14404 (Operator::Define): Implement.
14406 2001-09-10 Ravi Pratap <ravi@ximian.com>
14408 * class.cs (Event::Define): Make the prefixes of the accessor methods
14409 addOn_ and removeOn_
14411 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
14412 of the location being passed in too. Ideally, this should go later since all
14413 error reporting should be done through the Report object.
14415 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
14416 (Populate): Iterate thru the indexers we have and define them too.
14417 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
14418 for the get and set accessors.
14419 (Indexer::Define): Implement.
14421 2001-09-09 Miguel de Icaza <miguel@ximian.com>
14423 * expression.cs (Binary::Resolve): Beginning of it. I scratched
14424 my previous implementation, did not work.
14426 * typemanager.cs: Add a couple of missing types (the longs).
14428 * literal.cs: Use TypeManager.bool_type instead of getting it.
14430 * expression.cs (EventExpr): New kind of expressions.
14431 (Expressio::ExprClassFromMemberInfo): finish
14433 2001-09-08 Miguel de Icaza <miguel@ximian.com>
14435 * assign.cs: Emit stores to static fields differently.
14437 2001-09-08 Ravi Pratap <ravi@ximian.com>
14439 * Merge in changes and adjust code to tackle conflicts. Backed out my
14440 code in Assign::Resolve ;-)
14442 2001-09-08 Ravi Pratap <ravi@ximian.com>
14444 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
14445 instead Report.Error and also pass in the location.
14446 (CSharpParser::Lexer): New readonly property to return the reference
14447 to the Tokenizer object.
14448 (declare_local_variables): Use Report.Error with location instead of plain
14452 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
14453 (Operator.CheckBinaryOperator): Ditto.
14455 * cs-parser.jay (operator_declarator): Update accordingly.
14457 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
14458 (CheckBinaryOperator): Same here.
14460 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
14461 on the name without any prefixes of namespace names etc. This is because we
14462 already might have something already fully qualified like
14463 'System.Console.WriteLine'
14465 * assign.cs (Resolve): Begin implementation. Stuck ;-)
14467 2001-09-07 Ravi Pratap <ravi@ximian.com>
14469 * cs-tokenizer.cs (location): Return a string which also contains
14472 * expression.cs (ElementAccess): New class for expressions of the
14473 type 'element access.'
14474 (BaseAccess): New class for expressions of the type 'base access.'
14475 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
14478 * cs-parser.jay (element_access): Implement action.
14479 (base_access): Implement actions.
14480 (checked_expression, unchecked_expression): Implement.
14482 * cs-parser.jay (local_variable_type): Correct and implement.
14483 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
14485 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
14487 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
14488 name and the specifiers.
14490 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
14492 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
14493 making them all public ;-)
14495 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
14498 2001-09-07 Miguel de Icaza <miguel@ximian.com>
14500 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
14502 (FieldExpr, PropertyExprs): New resolved expressions.
14503 (SimpleName::MemberStaticCheck): Perform static checks for access
14504 to non-static fields on static methods. Maybe this should be
14505 generalized for MemberAccesses.
14506 (SimpleName::ResolveSimpleName): More work on simple name
14509 * cs-parser.jay (primary_expression/qualified_identifier): track
14510 the parameter index.
14512 * codegen.cs (CodeGen::Save): Catch save exception, report error.
14513 (EmitContext::EmitBoolExpression): Chain to expression generation
14514 instead of temporary hack.
14515 (::EmitStatementExpression): Put generic expression code generation.
14517 * assign.cs (Assign::Emit): Implement variable assignments to
14518 local variables, parameters and fields.
14520 2001-09-06 Miguel de Icaza <miguel@ximian.com>
14522 * statement.cs (Block::GetVariableInfo): New method, returns the
14523 VariableInfo for a variable name in a block.
14524 (Block::GetVariableType): Implement in terms of GetVariableInfo
14526 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
14527 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
14529 2001-09-06 Ravi Pratap <ravi@ximian.com>
14531 * cs-parser.jay (operator_declaration): Continue on my quest : update
14532 to take attributes argument.
14533 (event_declaration): Ditto.
14534 (enum_declaration): Ditto.
14535 (indexer_declaration): Ditto.
14537 * class.cs (Operator::Operator): Update constructor accordingly.
14538 (Event::Event): Ditto.
14540 * delegate.cs (Delegate::Delegate): Same here.
14542 * enum.cs (Enum::Enum): Same here.
14544 2001-09-05 Ravi Pratap <ravi@ximian.com>
14546 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
14548 * ../tests/cs0658.cs : New file to demonstrate error 0658.
14550 * attribute.cs (Attributes): New class to encapsulate all attributes which were
14551 being passed around as an arraylist.
14552 (Attributes::AddAttribute): Method to add attribute sections.
14554 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
14555 (struct_declaration): Update accordingly.
14556 (constant_declaration): Update.
14557 (field_declaration): Update.
14558 (method_header): Update.
14559 (fixed_parameter): Update.
14560 (parameter_array): Ditto.
14561 (property_declaration): Ditto.
14562 (destructor_declaration): Ditto.
14564 * class.cs (Struct::Struct): Update constructors accordingly.
14565 (Class::Class): Ditto.
14566 (Field::Field): Ditto.
14567 (Method::Method): Ditto.
14568 (Property::Property): Ditto.
14569 (TypeContainer::OptAttribute): update property's return type.
14571 * interface.cs (Interface.opt_attributes): New member.
14572 (Interface::Interface): Update to take the extra Attributes argument.
14574 * parameter.cs (Parameter::Parameter): Ditto.
14576 * constant.cs (Constant::Constant): Ditto.
14578 * interface.cs (InterfaceMemberBase): New OptAttributes field.
14579 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
14580 the attributes as a parameter.
14581 (InterfaceProperty): Update constructor call.
14582 (InterfaceEvent): Ditto.
14583 (InterfaceMethod): Ditto.
14584 (InterfaceIndexer): Ditto.
14586 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
14587 pass the attributes too.
14588 (interface_event_declaration): Ditto.
14589 (interface_property_declaration): Ditto.
14590 (interface_method_declaration): Ditto.
14591 (interface_declaration): Ditto.
14593 2001-09-05 Miguel de Icaza <miguel@ximian.com>
14595 * class.cs (Method::Define): Track the "static Main" definition to
14596 create an entry point.
14598 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
14599 EntryPoint if we find it.
14601 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
14602 (EmitContext::ig): Make this variable public.
14604 * driver.cs: Make the default output file be the first file name
14605 with the .exe extension.
14607 Detect empty compilations
14609 Handle various kinds of output targets. Handle --target and
14610 rename -t to --dumper.
14612 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
14613 methods inherited from Expression return now an Expression. This
14614 will is used during the tree rewriting as we resolve them during
14617 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14618 the spec. Missing entirely is the information about
14619 accessability of elements of it.
14621 (Expression::ExprClassFromMemberInfo): New constructor for
14622 Expressions that creates a fully initialized Expression based on
14623 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14626 (Invocation::Resolve): Begin implementing resolution of invocations.
14628 * literal.cs (StringLiteral): Implement Emit.
14630 2001-09-05 Ravi Pratap <ravi@ximian.com>
14632 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14635 2001-09-04 Ravi Pratap <ravi@ximian.com>
14637 * cs-parser.jay (attribute_arguments): Implement actions.
14638 (attribute): Fix bug in production. Implement action.
14639 (attribute_list): Implement.
14640 (attribute_target): Implement.
14641 (attribute_target_specifier, opt_target_specifier): Implement
14642 (CheckAttributeTarget): New method to check if the attribute target
14644 (attribute_section): Implement.
14645 (opt_attributes): Implement.
14647 * attribute.cs : New file to handle attributes.
14648 (Attribute): Class to hold attribute info.
14650 * cs-parser.jay (opt_attribute_target_specifier): Remove production
14651 (attribute_section): Modify production to use 2 different rules to
14652 achieve the same thing. 1 s/r conflict down !
14653 Clean out commented, useless, non-reducing dimension_separator rules.
14655 * class.cs (TypeContainer.attributes): New member to hold list
14656 of attributes for a type.
14657 (Struct::Struct): Modify to take one more argument, the attribute list.
14658 (Class::Class): Ditto.
14659 (Field::Field): Ditto.
14660 (Method::Method): Ditto.
14661 (Property::Property): Ditto.
14663 * cs-parser.jay (struct_declaration): Update constructor call to
14664 pass in the attributes too.
14665 (class_declaration): Ditto.
14666 (constant_declaration): Ditto.
14667 (field_declaration): Ditto.
14668 (method_header): Ditto.
14669 (fixed_parameter): Ditto.
14670 (parameter_array): Ditto.
14671 (property_declaration): Ditto.
14673 * constant.cs (Constant::Constant): Update constructor similarly.
14674 Use System.Collections.
14676 * parameter.cs (Parameter::Parameter): Update as above.
14678 2001-09-02 Ravi Pratap <ravi@ximian.com>
14680 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14681 (TypeContainer.delegates): New member to hold list of delegates.
14683 * cs-parser.jay (delegate_declaration): Implement the action correctly
14684 this time as I seem to be on crack ;-)
14686 2001-09-02 Miguel de Icaza <miguel@ximian.com>
14688 * rootcontext.cs (RootContext::IsNamespace): new function, used to
14689 tell whether an identifier represents a namespace.
14691 * expression.cs (NamespaceExpr): A namespace expression, used only
14692 temporarly during expression resolution.
14693 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14694 utility functions to resolve names on expressions.
14696 2001-09-01 Miguel de Icaza <miguel@ximian.com>
14698 * codegen.cs: Add hook for StatementExpressions.
14700 * class.cs: Fix inverted test for static flag in methods.
14702 2001-09-02 Ravi Pratap <ravi@ximian.com>
14704 * class.cs (Operator::CheckUnaryOperator): Correct error number used
14705 to make it coincide with MS' number.
14706 (Operator::CheckBinaryOperator): Ditto.
14708 * ../errors/errors.txt : Remove error numbers added earlier.
14710 * ../errors/cs1019.cs : Test case for error # 1019
14712 * ../errros/cs1020.cs : Test case for error # 1020
14714 * cs-parser.jay : Clean out commented cruft.
14715 (dimension_separators, dimension_separator): Comment out. Ostensibly not
14716 used anywhere - non-reducing rule.
14717 (namespace_declarations): Non-reducing rule - comment out.
14719 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14720 with TypeContainer::AddEnum.
14722 * delegate.cs : New file for delegate handling classes.
14723 (Delegate): Class for declaring delegates.
14725 * makefile : Update.
14727 * cs-parser.jay (delegate_declaration): Implement.
14729 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
14731 * class.cs (Event::Define): Implement.
14732 (Event.EventBuilder): New member.
14734 * class.cs (TypeContainer::Populate): Update to define all enums and events
14736 (Events): New property for the events arraylist we hold. Shouldn't we move to using
14737 readonly fields for all these cases ?
14739 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14741 * class.cs (Property): Revamp to use the convention of making fields readonly.
14742 Accordingly modify code elsewhere.
14744 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14745 the Define method of the Property class.
14747 * class.cs : Clean up applied patch and update references to variables etc. Fix
14749 (TypeContainer::Populate): Update to define all the properties we have. Also
14750 define all enumerations.
14752 * enum.cs (Define): Implement.
14754 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14756 * cs-parser.jay (overloadable_operator): The semantic value is an
14757 enum of the Operator class.
14758 (operator_declarator): Implement actions.
14759 (operator_declaration): Implement.
14761 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14762 validity of definitions.
14763 (Operator::CheckBinaryOperator): Static method to check for binary operators
14764 (TypeContainer::AddOperator): New method to add an operator to a type.
14766 * cs-parser.jay (indexer_declaration): Added line to actually call the
14767 AddIndexer method so it gets added ;-)
14769 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
14770 already taken care of by the MS compiler ?
14772 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14774 * class.cs (Operator): New class for operator declarations.
14775 (Operator::OpType): Enum for the various operators.
14777 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14779 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14780 ostensibly handle this in semantic analysis.
14782 * cs-parser.jay (general_catch_clause): Comment out
14783 (specific_catch_clauses, specific_catch_clause): Ditto.
14784 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14785 (catch_args, opt_catch_args): New productions.
14786 (catch_clause): Rewrite to use the new productions above
14787 (catch_clauses): Modify accordingly.
14788 (opt_catch_clauses): New production to use in try_statement
14789 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14790 and re-write the code in the actions to extract the specific and
14791 general catch clauses by being a little smart ;-)
14793 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14794 Hooray, try and catch statements parse fine !
14796 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14798 * statement.cs (Block::GetVariableType): Fix logic to extract the type
14799 string from the hashtable of variables.
14801 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14802 I end up making that mistake ;-)
14803 (catch_clauses): Fixed gross error which made Key and Value of the
14804 DictionaryEntry the same : $1 !!
14806 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14808 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14810 * cs-parser.jay (event_declaration): Correct to remove the semicolon
14811 when the add and remove accessors are specified.
14813 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14815 * cs-parser.jay (IndexerDeclaration): New helper class to hold
14816 information about indexer_declarator.
14817 (indexer_declarator): Implement actions.
14818 (parsing_indexer): New local boolean used to keep track of whether
14819 we are parsing indexers or properties. This is necessary because
14820 implicit_parameters come into picture even for the get accessor in the
14821 case of an indexer.
14822 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14824 * class.cs (Indexer): New class for indexer declarations.
14825 (TypeContainer::AddIndexer): New method to add an indexer to a type.
14826 (TypeContainer::indexers): New member to hold list of indexers for the
14829 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14831 * cs-parser.jay (add_accessor_declaration): Implement action.
14832 (remove_accessor_declaration): Implement action.
14833 (event_accessors_declaration): Implement
14834 (variable_declarators): swap statements for first rule - trivial.
14836 * class.cs (Event): New class to hold information about event
14838 (TypeContainer::AddEvent): New method to add an event to a type
14839 (TypeContainer::events): New member to hold list of events.
14841 * cs-parser.jay (event_declaration): Implement actions.
14843 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14845 * cs-parser.jay (dim_separators): Implement. Make it a string
14846 concatenating all the commas together, just as they appear.
14847 (opt_dim_separators): Modify accordingly
14848 (rank_specifiers): Update accordingly. Basically do the same
14849 thing - instead, collect the brackets here.
14850 (opt_rank_sepcifiers): Modify accordingly.
14851 (array_type): Modify to actually return the complete type string
14852 instead of ignoring the rank_specifiers.
14853 (expression_list): Implement to collect the expressions
14854 (variable_initializer): Implement. We make it a list of expressions
14855 essentially so that we can handle the array_initializer case neatly too.
14856 (variable_initializer_list): Implement.
14857 (array_initializer): Make it a list of variable_initializers
14858 (opt_array_initializer): Modify accordingly.
14860 * expression.cs (New::NType): Add enumeration to help us
14861 keep track of whether we have an object/delegate creation
14862 or an array creation.
14863 (New:NewType, New::Rank, New::Indices, New::Initializers): New
14864 members to hold data about array creation.
14865 (New:New): Modify to update NewType
14866 (New:New): New Overloaded contructor for the array creation
14869 * cs-parser.jay (array_creation_expression): Implement to call
14870 the overloaded New constructor.
14872 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
14874 * class.cs (TypeContainer::Constructors): Return member
14875 constructors instead of returning null.
14877 2001-08-26 Miguel de Icaza <miguel@ximian.com>
14879 * typemanager.cs (InitCoreTypes): Initialize the various core
14880 types after we have populated the type manager with the user
14881 defined types (this distinction will be important later while
14882 compiling corlib.dll)
14884 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14885 on Expression Classification. Now all expressions have a method
14886 `Resolve' and a method `Emit'.
14888 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14889 generation from working. Also add some temporary debugging
14892 2001-08-24 Miguel de Icaza <miguel@ximian.com>
14894 * codegen.cs: Lots of code generation pieces. This is only the
14895 beginning, will continue tomorrow with more touches of polish. We
14896 handle the fundamentals of if, while, do, for, return. Others are
14897 trickier and I need to start working on invocations soon.
14899 * gen-treedump.cs: Bug fix, use s.Increment here instead of
14902 * codegen.cs (EmitContext): New struct, used during code
14903 emission to keep a context. Most of the code generation will be
14906 * cs-parser.jay: Add embedded blocks to the list of statements of
14907 this block. So code generation proceeds in a top down fashion.
14909 2001-08-23 Miguel de Icaza <miguel@ximian.com>
14911 * statement.cs: Add support for multiple child blocks.
14913 2001-08-22 Miguel de Icaza <miguel@ximian.com>
14915 * codegen.cs (EmitCode): New function, will emit the code for a
14916 Block of code given a TypeContainer and its ILGenerator.
14918 * statement.cs (Block): Standard public readonly optimization.
14919 (Block::Block constructors): Link children.
14920 (Block::Child): Child Linker.
14921 (Block::EmitVariables): Emits IL variable declarations.
14923 * class.cs: Drop support for MethodGroups here, delay until
14925 (Method::): Applied the same simplification that I did before, and
14926 move from Properties to public readonly fields.
14927 (Method::ParameterTypes): Returns the parameter types for the
14928 function, and implements a cache that will be useful later when I
14929 do error checking and the semantic analysis on the methods is
14931 (Constructor::GetCallingConvention): Renamed from CallingConvetion
14932 and made a method, optional argument tells whether this is a class
14933 or a structure to apply the `has-this' bit.
14934 (Method::GetCallingConvention): Implement, returns the calling
14936 (Method::Define): Defines the type, a second pass is performed
14937 later to populate the methods.
14939 (Constructor::ParameterTypes): implement a cache similar to the
14940 one on Method::ParameterTypes, useful later when we do semantic
14943 (TypeContainer::EmitMethod): New method. Emits methods.
14945 * expression.cs: Removed MethodGroup class from here.
14947 * parameter.cs (Parameters::GetCallingConvention): new method.
14949 2001-08-21 Miguel de Icaza <miguel@ximian.com>
14951 * class.cs (TypeContainer::Populate): Drop RootContext from the
14954 (Constructor::CallingConvention): Returns the calling convention.
14955 (Constructor::ParameterTypes): Returns the constructor parameter
14958 (TypeContainer::AddConstructor): Keep track of default constructor
14959 and the default static constructor.
14961 (Constructor::) Another class that starts using `public readonly'
14962 instead of properties.
14964 (Constructor::IsDefault): Whether this is a default constructor.
14966 (Field::) use readonly public fields instead of properties also.
14968 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
14969 track of static constructors; If none is used, turn on
14970 BeforeFieldInit in the TypeAttributes.
14972 * cs-parser.jay (opt_argument_list): now the return can be null
14973 for the cases where there are no arguments.
14975 (constructor_declarator): If there is no implicit `base' or
14976 `this', then invoke the default parent constructor.
14978 * modifiers.cs (MethodAttr): New static function maps a set of
14979 modifiers flags into a MethodAttributes enum
14980 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
14981 MethodAttr, TypeAttr to represent the various mappings where the
14982 modifiers are used.
14983 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
14985 2001-08-19 Miguel de Icaza <miguel@ximian.com>
14987 * parameter.cs (GetParameterInfo): Fix bug where there would be no
14990 * interface.cs (PopulateIndexer): Implemented the code generator
14991 for interface indexers.
14993 2001-08-17 Miguel de Icaza <miguel@ximian.com>
14995 * interface.cs (InterfaceMemberBase): Now we track the new status
14998 (PopulateProperty): Implement property population. Woohoo! Got
14999 Methods and Properties going today.
15001 Removed all the properties for interfaces, and replaced them with
15002 `public readonly' fields.
15004 2001-08-16 Miguel de Icaza <miguel@ximian.com>
15006 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
15007 initialize their hashtables/arraylists only when they are needed
15008 instead of doing this always.
15010 * parameter.cs: Handle refs and out parameters.
15012 * cs-parser.jay: Use an ArrayList to construct the arguments
15013 instead of the ParameterCollection, and then cast that to a
15016 * parameter.cs: Drop the use of ParameterCollection and use
15017 instead arrays of Parameters.
15019 (GetParameterInfo): Use the Type, not the Name when resolving
15022 2001-08-13 Miguel de Icaza <miguel@ximian.com>
15024 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
15025 and instead use public readonly fields.
15027 * class.cs: Put back walking code for type containers.
15029 2001-08-11 Miguel de Icaza <miguel@ximian.com>
15031 * class.cs (MakeConstant): Code to define constants.
15033 * rootcontext.cs (LookupType): New function. Used to locate types
15036 2001-08-08 Miguel de Icaza <miguel@ximian.com>
15038 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
15039 this System.Reflection code is. Kudos to Microsoft
15041 * typemanager.cs: Implement a type cache and avoid loading all
15042 types at boot time. Wrap in LookupType the internals. This made
15043 the compiler so much faster. Wow. I rule!
15045 * driver.cs: Make sure we always load mscorlib first (for
15046 debugging purposes, nothing really important).
15048 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
15049 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
15051 * rootcontext.cs: Lookup types on their namespace; Lookup types
15052 on namespaces that have been imported using the `using' keyword.
15054 * class.cs (TypeContainer::TypeAttr): Virtualize.
15055 (Class::TypeAttr): Return attributes suitable for this bad boy.
15056 (Struct::TypeAttr): ditto.
15057 Handle nested classes.
15058 (TypeContainer::) Remove all the type visiting code, it is now
15059 replaced with the rootcontext.cs code
15061 * rootcontext.cs (GetClassBases): Added support for structs.
15063 2001-08-06 Miguel de Icaza <miguel@ximian.com>
15065 * interface.cs, statement.cs, class.cs, parameter.cs,
15066 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
15067 Drop use of TypeRefs, and use strings instead.
15069 2001-08-04 Miguel de Icaza <miguel@ximian.com>
15073 * class.cs (Struct::Struct): set the SEALED flags after
15074 checking the modifiers.
15075 (TypeContainer::TypeAttr): new property, returns the
15076 TypeAttributes for a class.
15078 * cs-parser.jay (type_list): Oops, list production was creating a
15079 new list of base types.
15081 * rootcontext.cs (StdLib): New property.
15082 (GetInterfaceTypeByName): returns an interface by type name, and
15083 encapsulates error handling here.
15084 (GetInterfaces): simplified.
15085 (ResolveTree): Encapsulated all the tree resolution here.
15086 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
15089 * driver.cs: Add support for --nostdlib, to avoid loading the
15090 default assemblies.
15091 (Main): Do not put tree resolution here.
15093 * rootcontext.cs: Beginning of the class resolution.
15095 2001-08-03 Miguel de Icaza <miguel@ximian.com>
15097 * rootcontext.cs: Provide better error reporting.
15099 * cs-parser.jay (interface_base): set our $$ to be interfaces.
15101 * rootcontext.cs (CreateInterface): Handle the case where there
15102 are no parent interfaces.
15104 (CloseTypes): Routine to flush types at the end.
15105 (CreateInterface): Track types.
15106 (GetInterfaces): Returns an array of Types from the list of
15107 defined interfaces.
15109 * typemanager.c (AddUserType): Mechanism to track user types (puts
15110 the type on the global type hash, and allows us to close it at the
15113 2001-08-02 Miguel de Icaza <miguel@ximian.com>
15115 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
15116 RecordInterface instead.
15118 * cs-parser.jay: Updated to reflect changes above.
15120 * decl.cs (Definition): Keep track of the TypeBuilder type that
15121 represents this type here. Not sure we will use it in the long
15122 run, but wont hurt for now.
15124 * driver.cs: Smaller changes to accomodate the new code.
15126 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
15129 * rootcontext.cs (CreateInterface): New method, used to create
15130 the System.TypeBuilder type for interfaces.
15131 (ResolveInterfaces): new entry point to resolve the interface
15133 (CodeGen): Property, used to keep track of the code generator.
15135 2001-07-26 Miguel de Icaza <miguel@ximian.com>
15137 * cs-parser.jay: Add a second production for delegate_declaration
15140 (enum_body): Put an opt_comma here instead of putting it on
15141 enum_body or enum_member_declarations so we can handle trailing
15142 commas on enumeration members. Gets rid of a shift/reduce.
15144 (type_list): Need a COMMA in the middle.
15146 (indexer_declaration): Tell tokenizer to recognize get/set
15148 * Remove old targets.
15150 * Re-add the parser target.
15152 2001-07-13 Simon Cozens <simon@simon-cozens.org>
15154 * cs-parser.jay: Add precendence rules for a number of operators
15155 ot reduce the number of shift/reduce conflicts in the grammar.
15157 2001-07-17 Miguel de Icaza <miguel@ximian.com>
15159 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
15162 Get rid of old crufty code.
15164 * rootcontext.cs: Use this to keep track of the parsed
15165 representation and the defined types available to the program.
15167 * gen-treedump.cs: adjust for new convention.
15169 * type.cs: Split out the type manager, and the assembly builder
15172 * typemanager.cs: the type manager will live here now.
15174 * cil-codegen.cs: And the code generator here.
15176 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
15178 * makefile: Fixed up for easy making.
15180 2001-07-13 Simon Cozens <simon@simon-cozens.org>
15182 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
15185 (unary_expression): Expand pre_increment_expression and
15186 post_decrement_expression to reduce a shift/reduce.
15188 2001-07-11 Simon Cozens
15190 * cs-tokenizer.cs: Hex numbers should begin with a 0.
15192 Improve allow_keyword_as_indent name.
15194 2001-06-19 Miguel de Icaza <miguel@ximian.com>
15196 * Adjustments for Beta2.
15198 2001-06-13 Miguel de Icaza <miguel@ximian.com>
15200 * decl.cs: Added `Define' abstract method.
15201 (InTransit): new property, used to catch recursive definitions.
15203 * interface.cs: Implement `Define'.
15205 * modifiers.cs: Map Modifiers.constants to
15206 System.Reflection.TypeAttribute flags.
15208 * class.cs: Keep track of types and user-defined types.
15209 (BuilderInit): New method for creating an assembly
15210 (ResolveType): New function to launch the resolution process, only
15211 used by interfaces for now.
15213 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
15214 that are inserted into the name space.
15216 2001-06-08 Miguel de Icaza <miguel@ximian.com>
15218 * ARGH. I have screwed up my tree so many times due to the use of
15219 rsync rather than using CVS. Going to fix this at once.
15221 * driver.cs: Objetify driver. Load assemblies, use assemblies to
15224 2001-06-07 Miguel de Icaza <miguel@ximian.com>
15226 * Experiment successful: Use System.Type rather that our own
15229 2001-05-25 Miguel de Icaza <miguel@ximian.com>
15231 * cs-parser.jay: Removed nsAliases from here.
15233 Use new namespaces, handle `using XXX;'
15235 * namespace.cs: Reimplemented namespace handling, use a recursive
15236 definition of the class. Now we can keep track of using clauses
15237 and catch invalid using clauses.
15239 2001-05-24 Miguel de Icaza <miguel@ximian.com>
15241 * gen-treedump.cs: Adapted for all the renaming.
15243 * expression.cs (Expression): this class now has a Type property
15244 which returns an expression Type.
15246 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
15247 `Type', as this has a different meaning now in the base
15249 2001-05-22 Miguel de Icaza <miguel@ximian.com>
15251 * interface.cs, class.cs: Removed from all the sources the
15252 references to signature computation, as we can not do method
15253 signature computation during the parsing time, as we are not
15254 trying to solve at that point distinguishing:
15258 void a (NS.Blah x) {}
15261 Which depending on the context might be valid or not, as we do not
15262 know if Blah is the same thing as NS.Blah at that point.
15264 * Redid everything so the code uses TypeRefs now instead of
15265 Types. TypeRefs are just temporary type placeholders, that need
15266 to be resolved. They initially have a pointer to a string and the
15267 current scope in which they are used. This is used later by the
15268 compiler to resolve the reference to an actual Type.
15270 * DeclSpace is no longer a CIR.Type, and neither are
15271 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
15272 are all DeclSpaces, but no Types.
15274 * type.cs (TypeRefManager): This implements the TypeRef manager,
15275 which keeps track of all the types that need to be resolved after
15276 the parsing has finished.
15278 2001-05-13 Miguel de Icaza <miguel@ximian.com>
15280 * ARGH. We are going to have to store `foreach' as a class rather
15281 than resolving it, as we need to verify error 1579 after name
15282 resolution. *OR* we could keep a flag that says `This request to
15283 IEnumerator comes from a foreach statement' which we can then use
15284 to generate the error.
15286 2001-05-10 Miguel de Icaza <miguel@ximian.com>
15288 * class.cs (TypeContainer.AddMethod): we now add methods to the
15289 MethodGroup instead of the method hashtable.
15291 * expression.cs: Add MethodGroup abstraction, which gets us one
15292 step closer to the specification in the way we handle method
15295 * cs-parser.jay (primary_expression): qualified_identifier now
15296 tried to match up an identifier to a local variable reference or
15297 to a parameter reference.
15299 current_local_parameters is now a parser global variable that
15300 points to the current parameters for the block, used during name
15303 (property_declaration): Now creates an implicit `value' argument to
15306 2001-05-09 Miguel de Icaza <miguel@ximian.com>
15308 * parameter.cs: Do not use `param' arguments as part of the
15309 signature, per the spec.
15311 2001-05-08 Miguel de Icaza <miguel@ximian.com>
15313 * decl.cs: Base class for classes, structs and interfaces. This
15314 is the "Declaration Space"
15316 * cs-parser.jay: Use CheckDef for checking declaration errors
15317 instead of having one on each function.
15319 * class.cs: Factor out some code for handling error handling in
15320 accordance to the "Declarations" section in the "Basic Concepts"
15321 chapter in the ECMA C# spec.
15323 * interface.cs: Make all interface member classes derive from
15324 InterfaceMemberBase.
15326 2001-05-07 Miguel de Icaza <miguel@ximian.com>
15328 * Many things: all interfaces are parsed and generated in
15329 gen-treedump. Support for member variables, constructors,
15330 destructors, properties, constants is there.
15332 Beginning of the IL backend, but very little done, just there for
15335 2001-04-29 Miguel de Icaza <miguel@ximian.com>
15337 * cs-parser.jay: Fix labeled statement.
15339 * cs-tokenizer.cs (escape): Escape " and ' always.
15340 ref_line, ref_name: keep track of the line/filename as instructed
15341 by #line by the compiler.
15344 2001-04-27 Miguel de Icaza <miguel@ximian.com>
15346 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
15347 to match the values in System.CodeDOM.
15349 Divid renamed to Divide.
15351 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
15353 (Statements.set): remove.
15355 * System.CodeDOM/CodeCatchClause.cs: always have a valid
15358 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
15359 falseStatements always have valid values.
15361 * cs-parser.jay: Use System.CodeDOM now.