1 2004-06-08 Marek Safar <marek.safar@seznam.cz>
4 (Method.ApplyAttributeBuilder): Moved and added conditional
5 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
8 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
10 2004-06-08 Marek Safar <marek.safar@seznam.cz>
13 * class.cs: (EventField.attribute_targets): Changed default target.
15 2004-06-08 Martin Baulig <martin@ximian.com>
17 * expression.cs (Invocation.EmitCall): Enable varargs methods.
19 2004-06-08 Martin Baulig <martin@ximian.com>
21 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
23 2004-06-07 Martin Baulig <martin@ximian.com>
25 Added support for varargs methods.
27 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
30 * cs-parser.jay: Added support for `__arglist'.
32 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
34 * expression.cs (Argument.AType): Added `ArgList'.
35 (Invocation): Added support for varargs methods.
36 (ArglistAccess): New public class.
37 (Arglist): New public class.
39 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
41 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
42 a method's top-level block if the method has varargs.
44 * support.cs (ReflectionParameters, InternalParameters): Added
45 support for varargs methods.
47 2004-06-07 Miguel de Icaza <miguel@ximian.com>
49 * class.cs: Provide location in indexer error report.
51 * driver.cs: Use standard names.
53 * namespace.cs: Catch the use of using after a namespace has been
54 declared also on using aliases.
56 2004-06-04 Martin Baulig <martin@ximian.com>
58 Merged latest changes into gmcs. Please keep this comment in
59 here, it makes it easier for me to see what changed in MCS since
60 the last time I merged.
62 2004-06-03 Raja R Harinath <rharinath@novell.com>
65 * typemanager.cs (closure_private_ok, closure_invocation_type)
66 (closure_qualifier_type, closure_invocation_assembly)
67 (FilterWithClosure): Move to ...
68 (Closure): New internal nested class.
69 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
70 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
71 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
72 (MemberLookup, MemberLookupFailed): Use it.
73 * expression.cs (New.DoResolve): Treat the lookup for the
74 constructor as being qualified by the 'new'ed type.
75 (Indexers.GetIndexersForTypeOrInterface): Update.
77 2004-06-03 Marek Safar <marek.safar@seznam.cz>
80 (GetConditionalAttributeValue): New method. Returns
81 condition of ConditionalAttribute.
82 (SearchMulti): New method. Returns all attributes of type 't'.
83 Use it when attribute is AllowMultiple = true.
84 (IsConditionalMethodExcluded): New method.
87 (Method.IsExcluded): Implemented. Returns true if method has conditional
88 attribute and the conditions is not defined (method is excluded).
89 (IMethodData): Extended interface for ConditionalAttribute support.
90 (PropertyMethod.IsExcluded): Implemented.
93 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
96 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
99 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
101 * expression.cs (ArrayCreationExpression): Make this just an
102 `expression'. It can't be a statement, so the code here was
105 2004-06-02 Marek Safar <marek.safar@seznam.cz>
108 * typemanager.cs (GetFullNameSignature): New method for
111 2004-06-02 Marek Safar <marek.safar@seznam.cz>
114 * class.cs (MemberBase.GetSignatureForError): New virtual method.
115 Use this method when MethodBuilder is null.
116 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
117 Added test for error CS0626 (MONO reports error for this situation).
118 (IMethodData.GetSignatureForError): Extended interface.
120 2004-06-01 Marek Safar <marek.safar@seznam.cz>
123 (AttributeTester.GetObsoleteAttribute): Returns instance of
124 ObsoleteAttribute when type is obsolete.
127 (TypeContainer.VerifyObsoleteAttribute): Override.
128 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
129 (MethodCode.VerifyObsoleteAttribute): Override.
130 (MemberBase.VerifyObsoleteAttribute): Override.
133 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
134 and report proper error.
137 Delegate.VerifyObsoleteAttribute): Override.
140 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
141 and report proper error.
142 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
145 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
149 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
150 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
151 Added test for ObsoleteAttribute.
154 (Catch): Derived from Statement.
156 2004-06-01 Marek Safar <marek.safar@seznam.cz>
158 Fixed bug #59071 & cs0160.cs
160 * statement.cs (Try.Resolve): Check here whether order of catch
161 clauses matches their dependencies.
163 2004-05-31 Miguel de Icaza <miguel@ximian.com>
165 * Reverted patch to namespace.cs (Use lookuptypedirect). This
166 caused a regression: #59343. Referencing nested classes from an
167 assembly stopped working.
169 2004-05-31 Martin Baulig <martin@ximian.com>
171 MCS is now frozen for beta 2.
173 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
175 * convert.cs: add a trivial cache for overload operator resolution.
177 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
179 * decl.cs: If possible, use lookuptypedirect here. We can only do
180 this if there is no `.' after the namespace. Avoids using
181 LookupType, which does lots of slow processing.
182 (FindNestedType) New method, does what it says :-).
183 * namespace.cs: use LookupTypeDirect.
184 * rootcontext.cs: use membercache, if possible.
185 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
187 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
190 According to the spec,
192 In a member access of the form E.I, if E is a single identifier,
193 and if the meaning of E as a simple-name (§7.5.2) is a constant,
194 field, property, localvariable, or parameter with the same type as
195 the meaning of E as a type-name (§3.8), then both possible
196 meanings of E are permitted.
198 We did not check that E as a simple-name had the same type as E as
201 This trivial check gives us 5-7% on bootstrap time.
203 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
205 * expression.cs (Invocation.OverloadResolve): Avoid the
206 use of hashtables and boxing here by allocating on demand.
208 2004-05-30 Martin Baulig <martin@ximian.com>
210 * rootcontext.cs (RootContext.LookupType): Don't cache things if
211 we're doing a silent lookup. Don't try to lookup nested types in
212 TypeManager.object_type (thanks to Ben Maurer).
214 2004-05-30 Martin Baulig <martin@ximian.com>
216 Committing a patch from Ben Maurer.
218 * rootcontext.cs (RootContext.LookupType): Cache negative results.
220 2004-05-29 Martin Baulig <martin@ximian.com>
222 * class.cs (IMethodData.ShouldIgnore): New method.
224 * typemanager.cs (TypeManager.MethodFlags): Don't take a
225 `Location' argument, we don't need it anywhere. Use
226 `IMethodData.ShouldIgnore ()' instead of
227 `MethodData.GetMethodFlags ()'.
228 (TypeManager.AddMethod): Removed.
229 (TypeManager.AddMethod2): Renamed to AddMethod.
231 2004-05-29 Martin Baulig <martin@ximian.com>
233 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
235 * convert.cs (Convert.ImplicitReferenceConversion): If we're
236 converting from a class type S to an interface type and we already
237 have an object on the stack, don't box it again. Fixes #52578.
239 2004-05-29 Martin Baulig <martin@ximian.com>
241 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
242 Added support for `params' parameters. Fixes #59267.
244 2004-05-29 Martin Baulig <martin@ximian.com>
246 * literal.cs (NullPointer): Provide a private .ctor which sets
247 `type' to TypeManager.object_type. Fixes #59048.
249 2004-05-29 Martin Baulig <martin@ximian.com>
251 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
252 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
254 * ecore.cs (EventExpr.instance_expr): Make the field private.
256 2004-05-26 Marek Safar <marek.safar@seznam.cz>
258 Fixed bug #50080 & cs0214-2.cs
259 * expression.cs (Cast.DoResolve): Check unsafe context here.
261 * statement.cs (Resolve.DoResolve): Likewise.
263 2004-05-26 Martin Baulig <martin@ximian.com>
265 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
267 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
268 (RootContext.LookupType): Pass down the `silent' flag.
270 2004-05-25 Martin Baulig <martin@ximian.com>
273 (MethodGroupExpr.IdenticalTypeName): New public property.
274 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
275 expression actually refers to a type.
277 2004-05-25 Martin Baulig <martin@ximian.com>
279 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
280 for #56176 and made it actually work.
282 2004-05-25 Martin Baulig <martin@ximian.com>
284 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
285 (FieldExpr, PropertyExpr): Override and implement
286 CacheTemporaries. Fixes #52279.
288 2004-05-25 Miguel de Icaza <miguel@ximian.com>
290 * location.cs: In the new compiler listing a file twice is a
291 warning, not an error.
293 2004-05-24 Martin Baulig <martin@ximian.com>
295 * enum.cs (Enum.DefineType): For the `BaseType' to be a
296 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
298 2004-05-24 Martin Baulig <martin@ximian.com>
300 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
301 walking the `using' list. Fixes #53921.
303 2004-05-24 Martin Baulig <martin@ximian.com>
305 * const.cs (Const.LookupConstantValue): Added support for
306 EmptyCast's; fixes #55251.
308 2004-05-24 Martin Baulig <martin@ximian.com>
310 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
311 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
312 which does the CS0135 check. The reason is that we first need to
313 check whether the variable actually exists.
315 2004-05-24 Martin Baulig <martin@ximian.com>
317 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
318 than RootContext.LookupType() to find the explicit interface
321 2004-05-24 Raja R Harinath <rharinath@novell.com>
323 * Makefile: Simplify. Use executable.make.
324 * mcs.exe.sources: New file. List of sources of mcs.exe.
326 2004-05-24 Anders Carlsson <andersca@gnome.org>
330 Use the invariant culture when doing String.Compare for CLS case
333 2004-05-23 Martin Baulig <martin@ximian.com>
335 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
336 don't have any dots. Fixes #52622, added cs0246-8.cs.
338 * namespace.cs (NamespaceEntry.Lookup): Likewise.
340 2004-05-23 Marek Safar <marek.safar@seznam.cz>
342 * class.cs (MemberBase.Define): Reuse MemberType member for
343 resolved type. Other methods can use it too.
345 2004-05-23 Martin Baulig <martin@ximian.com>
347 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
348 the variable also exists in the current block (otherwise, we need
349 to report a CS0103). Fixes #58670.
351 2004-05-23 Martin Baulig <martin@ximian.com>
353 * flowanalysis.cs (Reachability.Reachable): Compute this
354 on-the-fly rather than storing it as a field.
356 2004-05-23 Martin Baulig <martin@ximian.com>
358 * flowanalysis.cs (Reachability.And): Manually compute the
359 resulting `barrier' from the reachability.
361 2004-05-23 Marek Safar <marek.safar@seznam.cz>
364 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
365 instance of ObsoleteAttribute when symbol is obsolete.
368 (IMethodData): Extended interface for ObsoleteAttribute support.
370 2004-05-22 Marek Safar <marek.safar@seznam.cz>
372 * attribute.cs: Fix bug #55970
374 2004-05-22 Marek Safar <marek.safar@seznam.cz>
378 (GetObsoleteAttribute): New method. Creates the instance of
380 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
381 ObsoleteAttribute when member is obsolete.
382 (AttributeTester.Report_ObsoleteMessage): Common method for
383 Obsolete error/warning reporting.
386 (TypeContainer.base_classs_type): New member for storing parent type.
389 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
392 2004-05-21 Marek Safar <marek.safar@seznam.cz>
394 * attribute.cs, const.cs: Fix bug #58590
396 2004-05-21 Martin Baulig <martin@ximian.com>
398 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
399 out parameters if the end of the method is unreachable. Fixes
402 2004-05-21 Marek Safar <marek.safar@seznam.cz>
404 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
405 Hari was right, why extra method.
407 2004-05-21 Marek Safar <marek.safar@seznam.cz>
409 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
411 2004-05-20 Martin Baulig <martin@ximian.com>
413 Merged this back from gmcs to keep the differences to a minumum.
415 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
416 instead of a Declspace.
417 (Attribute.ResolveType): Likewise.
418 (Attributes.Search): Likewise.
419 (Attributes.Contains): Likewise.
420 (Attributes.GetClsCompliantAttribute): Likewise.
422 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
424 (MethodData.ApplyAttributes): Take an EmitContext instead of a
427 2004-05-19 Marek Safar <marek.safar@seznam.cz>
429 Fix bug #58688 (MCS does not report error when the same attribute
432 * attribute.cs (Attribute.Emit): Distinction between null and default.
434 2004-05-19 Raja R Harinath <rharinath@novell.com>
436 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
437 of a top-level attribute without an attribute target.
438 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
440 (Attribute.Conditional_GetConditionName),
441 (Attribute.Obsolete_GetObsoleteMessage): Update.
442 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
443 part of ScanForIndexerName.
444 (Attribute.CanIgnoreInvalidAttribute): New function.
445 (Attribute.ScanForIndexerName): Move to ...
446 (Attributes.ScanForIndexerName): ... here.
447 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
448 (Attributes.Search): New internal variant that can choose not to
449 complain if types aren't resolved. The original signature now
451 (Attributes.GetClsCompliantAttribute): Use internal variant, with
452 complaints suppressed.
453 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
454 only if it not useful.
455 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
456 top-level for attributes that are shared between the assembly
457 and a top-level class.
458 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
459 * class.cs: Update to reflect changes.
460 (DefineIndexers): Fuse loops.
461 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
462 a couple more variants of attribute names.
464 2004-05-18 Marek Safar <marek.safar@seznam.cz>
466 Fix bug #52585 (Implemented explicit attribute declaration)
469 (Attributable.ValidAttributeTargets): New abstract method. It gets
470 list of valid attribute targets for explicit target declaration.
471 (Attribute.Target): It holds target itself.
472 (AttributeSection): Removed.
473 (Attribute.CheckTargets): New method. It checks whether attribute
474 target is valid for the current element.
477 (EventProperty): New class. For events that are declared like
478 property (with add and remove accessors).
479 (EventField): New class. For events that are declared like field.
482 * cs-parser.jay: Implemented explicit attribute target declaration.
484 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
485 Override ValidAttributeTargets.
488 (ReturnParameter): Class for applying custom attributes on
490 (ParameterAtribute): New class. Class for applying custom
491 attributes on the parameter type.
493 2004-05-17 Miguel de Icaza <miguel@ximian.com>
495 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
498 (Method): Allow UNSAFE here.
500 * modifiers.cs: Support unsafe reporting.
502 2004-05-17 Marek Safar <marek.safar@seznam.cz>
504 * decl.cs: Fix bug #58478.
506 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
508 * statement.cs: When checking for unreachable code on an EmptyStatement,
509 set the location. Fixes bug #58488.
511 2004-05-13 Miguel de Icaza <miguel@ximian.com>
513 * driver.cs: Add -pkg handling.
515 From Gonzalo: UseShelLExecute=false
517 2004-05-12 Marek Safar <marek.safar@seznam.cz>
520 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
522 (Attribute.IsClsCompliaceRequired): Moved to base for better
524 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
525 when attribute is AttributeUsageAttribute.
526 (Attribute.GetValidTargets): Simplified.
527 (Attribute.GetAttributeUsage): New method returns AttributeUsage
528 attribute for this type.
529 (Attribute.ApplyAttributes): Method renamed to Emit and make
531 (GlobalAttributeSection): New class for special handling of global
532 attributes (assembly, module).
533 (AttributeSection.Emit): New method.
535 * class.cs: Implemented Attributable abstract methods.
536 (MethodCore.LabelParameters): Moved to Parameter class.
537 (Accessor): Is back simple class.
538 (PropertyMethod): Implemented Attributable abstract class.
539 (DelegateMethod): Implemented Attributable abstract class.
540 (Event): New constructor for disctintion between normal Event
541 and Event with accessors.
543 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
545 * codegen.cs, const.cs, decl.cs, delegate.cs:
546 (CommonAssemblyModulClass): Implemented Attributable abstract class
549 * enum.cs: Implement IAttributeSupport interface.
550 (EnumMember): New class for emum members. Implemented Attributable
554 (ParameterBase): Is abstract.
555 (ReturnParameter): New class for easier [return:] attribute handling.
557 * typemanager.cs: Removed builder_to_attr.
559 2004-05-11 Raja R Harinath <rharinath@novell.com>
562 * attribute.cs (Attribute.GetPositionalValue): New function.
563 * class.cs (TypeContainer.VerifyMembers): New function.
564 (TypeContainer.Emit): Use it.
565 (ClassOrStruct): New base class for Class and Struct.
566 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
567 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
569 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
570 then each non-static field should have a FieldOffset attribute.
571 Otherwise, none of the fields should have a FieldOffset attribute.
572 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
573 and FieldOffset attributes.
574 * typemanager.cs (TypeManager.struct_layout_attribute_type)
575 (TypeManager.field_offset_attribute_type): New core types.
576 (TypeManager.InitCoreTypes): Initialize them.
578 2004-05-11 Michal Moskal <malekith@pld-linux.org>
580 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
584 2004-05-09 Miguel de Icaza <miguel@ximian.com>
586 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
587 be implicitly converted to ulong.
589 * expression.cs: The logic for allowing operator &, | and ^ worked
590 was wrong, it worked before because we did not report an error in
591 an else branch. Fixes 57895.
593 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
594 allow volatile fields to be reference types.
596 2004-05-07 Miguel de Icaza <miguel@ximian.com>
598 * driver.cs: Add support for /debug-
600 2004-05-07 Raja R Harinath <rharinath@novell.com>
602 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
603 Add a 'complain' parameter to silence errors.
604 (Attribute.Resolve): Update to changes. Put in sanity check to catch
605 silently overlooked type-resolutions.
606 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
608 (Attributes.Search): New function.
609 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
610 (Attributes.GetAttributeFullName): Remove hack.
611 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
612 Update to reflect changes.
613 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
614 Use Attributes.Search instead of nested loops.
616 2004-05-07 Marek Safar <marek.safar@seznam.cz>
619 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
620 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
621 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
623 * report.cs: (Report.Warning): Renamed to Warning_T because of
626 2004-05-05 Raja R Harinath <rharinath@novell.com>
628 * expression.cs (MemberAccess.ResolveMemberAccess):
629 Exit with non-zero status after Report.Error.
630 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
632 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
634 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
636 * support.cs: Don't hang when the file is empty.
638 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
640 * support.cs: In SeekableStreamReader, compute the preamble size of the
641 underlying stream. Position changes should take into account that initial
644 2004-05-03 Todd Berman <tberman@sevenl.net>
646 * driver.cs: remove unused GetSysVersion function.
648 2004-05-03 Todd Berman <tberman@sevenl.net>
650 * driver.cs: Remove the hack from saturday, as well as the hack
651 from jackson (LoadAssemblyFromGac), also adds the CWD to the
652 link_paths to get that bit proper.
654 2004-05-01 Todd Berman <tberman@sevenl.net>
656 * driver.cs: Try a LoadFrom before a Load, this checks the current
657 path. This is currently a bug in mono that is be fixed, however, this
658 provides a workaround for now. This will be removed when the bug
661 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
663 * CryptoConvert.cs: Updated to latest version. Fix issue with
664 incomplete key pairs (#57941).
666 2004-05-01 Todd Berman <tberman@sevenl.net>
668 * driver.cs: Remove '.' from path_chars, now System.* loads properly
671 2004-04-30 Jackson Harper <jackson@ximian.com>
673 * codegen.cs: Open keys readonly.
675 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
677 * typemanager.cs: don't report cyclic struct layout when a struct
678 contains 2 or more fields of the same type. Failed for Pango.AttrShape
679 which has 2 Pango.Rectangle fields.
681 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
683 * expression.cs: Handle IntPtr comparisons with IL code
684 rather than a method call.
686 2004-04-29 Martin Baulig <martin@ximian.com>
688 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
689 the list of PropertyInfo's in class hierarchy and find the
690 accessor. Fixes #56013.
692 2004-04-29 Martin Baulig <martin@ximian.com>
694 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
696 2004-04-29 Martin Baulig <martin@ximian.com>
698 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
700 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
702 2004-04-29 Martin Baulig <martin@ximian.com>
704 * class.cs (ConstructorInitializer.Resolve): Check whether the
705 parent .ctor is accessible. Fixes #52146.
707 2004-04-29 Martin Baulig <martin@ximian.com>
709 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
711 * statement.cs (Using.EmitLocalVariableDecls): Use
712 TypeManager.idisposable_type, not typeof (IDisposable).
713 (Foreach.EmitCollectionForeach): Added support for valuetypes.
715 2004-04-29 Martin Baulig <martin@ximian.com>
717 * class.cs (Event.Define): Don't emit the field and don't set
718 RTSpecialName and SpecialName for events on interfaces. Fixes
721 2004-04-29 Raja R Harinath <rharinath@novell.com>
723 Refactor Attribute.ApplyAttributes.
724 * attribute.cs (Attributable): New base class for objects that can
725 have Attributes applied on them.
726 (Attribute): Make AttributeUsage fields public.
727 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
728 (Attribute.IsInternalCall): New property.
729 (Attribute.UsageAttr): Convert to a public read-only property.
730 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
731 (Attribute.ResolveType, Attribute.Resolve)
732 (Attribute.ScanForIndexerName): Update to reflect changes.
733 (Attribute.CheckAttributeTarget): Re-format.
734 (Attribute.ApplyAttributes): Refactor, to various
735 Attributable.ApplyAttributeBuilder methods.
736 * decl.cs (MemberCore): Make Attributable.
737 * class.cs (Accessor): Make Attributable.
738 (MethodData.ApplyAttributes): Use proper attribute types, not
740 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
741 (TypeContainer.ApplyAttributeBuilder)
742 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
743 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
744 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
745 (Operator.ApplyAttributeBuilder): New factored-out methods.
746 * const.cs (Const.ApplyAttributeBuilder): Likewise.
747 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
748 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
749 * parameter.cs (ParameterBase): New Attributable base class
750 that can also represent Return types.
751 (Parameter): Update to the changes.
753 2004-04-29 Jackson Harper <jackson@ximian.com>
755 * driver.cs: Prefer the corlib system version when looking for
756 assemblies in the GAC. This is still a hack, but its a better hack
759 2004-04-29 Marek Safar <marek.safar@seznam.cz>
761 * decl.cs, enum.cs: Improved error 3005 reporting.
763 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
764 (related_symbols): New private member for list of symbols
765 related to reported error/warning.
767 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
769 2004-04-29 Martin Baulig <martin@ximian.com>
771 * ecore.cs (Expression.Constantify): If we're an enum and
772 TypeManager.TypeToCoreType() doesn't give us another type, use
773 t.UnderlyingSystemType. Fixes #56178.
775 2004-04-29 Martin Baulig <martin@ximian.com>
777 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
778 interfaces and for each interface, only add members directly
779 declared in that interface. Fixes #53255.
781 2004-04-28 Martin Baulig <martin@ximian.com>
783 * expression.cs (ConditionalLogicalOperator): Use a temporary
784 variable for `left' to avoid that we evaluate it more than once;
787 2004-04-28 Martin Baulig <martin@ximian.com>
789 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
792 2004-04-28 Martin Baulig <martin@ximian.com>
794 * statement.cs (LocalInfo.Resolve): Check whether the type is not
797 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
798 whether the type is not void (CS1547).
800 2004-04-28 Martin Baulig <martin@ximian.com>
802 * expression.cs (Unary.DoResolveLValue): Override this and report
803 CS0131 for anything but Operator.Indirection.
805 2004-04-28 Martin Baulig <martin@ximian.com>
807 Committing a patch from Ben Maurer; see bug #50820.
809 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
812 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
815 2004-04-28 Martin Baulig <martin@ximian.com>
817 Committing a patch from Ben Maurer; see bug #50820.
819 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
822 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
825 2004-04-28 Martin Baulig <martin@ximian.com>
827 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
828 (Block.AddLabel): Call DoLookupLabel() to only search in the
831 2004-04-28 Martin Baulig <martin@ximian.com>
833 * cfold.cs (ConstantFold.BinaryFold): Added special support for
834 comparing StringConstants and NullLiterals in Equality and Inequality.
836 2004-04-28 Jackson Harper <jackson@ximian.com>
838 * driver.cs: Attempt to load referenced assemblies from the
839 GAC. This is the quick and dirty version of this method that
840 doesnt take into account versions and just takes the first
841 canidate found. Will be good enough for now as we will not have more
842 then one version installed into the GAC until I update this method.
844 2004-04-28 Martin Baulig <martin@ximian.com>
846 * typemanager.cs (TypeManager.CheckStructCycles): New public
847 static method to check for cycles in the struct layout.
849 * rootcontext.cs (RootContext.PopulateTypes): Call
850 TypeManager.CheckStructCycles() for each TypeContainer.
851 [Note: We only need to visit each type once.]
853 2004-04-28 Martin Baulig <martin@ximian.com>
855 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
857 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
858 success and added `out object value'. Use a `bool resolved' field
859 to check whether we've already been called rather than
860 `ConstantValue != null' since this breaks for NullLiterals.
862 2004-04-28 Raja R Harinath <rharinath@novell.com>
864 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
865 setting of this flag, since the 'set' method may be non-public.
867 2004-04-28 Raja R Harinath <rharinath@novell.com>
869 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
870 check on current_vector.Block.
872 2004-04-27 Martin Baulig <martin@ximian.com>
874 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
875 a field initializer. Fixes #56459.
877 2004-04-27 Martin Baulig <martin@ximian.com>
879 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
880 we're not attempting to use an indexer. Fixes #52154.
882 2004-04-27 Martin Baulig <martin@ximian.com>
884 * statement.cs (Return): Don't create a return label if we don't
885 need it; reverts my change from January 20th. Thanks to Ben
888 2004-04-27 Martin Baulig <martin@ximian.com>
890 According to the spec, `goto' can only leave a nested scope, but
893 * statement.cs (Block.LookupLabel): Only lookup in the current
894 block, don't recurse into parent or child blocks.
895 (Block.AddLabel): Check in parent and child blocks, report
896 CS0140/CS0158 if we find a duplicate.
897 (Block): Removed this indexer for label lookups.
898 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
899 this already does the error reporting for us.
902 (FlowBranching.UsageVector.Block): New public variable; may be null.
903 (FlowBranching.CreateSibling): Added `Block' argument.
904 (FlowBranching.LookupLabel): New public virtual method. Lookup a
905 label for the target of a `goto' and check whether we're not
908 2004-04-27 Martin Baulig <martin@ximian.com>
910 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
911 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
914 2004-04-27 Martin Baulig <martin@ximian.com>
916 * statement.cs (Block.AddLabel): Also check for implicit blocks
917 and added a CS0158 check.
919 2004-04-27 Martin Baulig <martin@ximian.com>
921 * flowanalysis.cs (FlowBranchingLoop): New class.
922 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
923 UsageVector's instead of an ArrayList.
924 (FlowBranching.Label): Likewise.
925 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
926 (FlowBranching.AddBreakVector): New method.
928 2004-04-27 Miguel de Icaza <miguel@ximian.com>
930 * attribute.cs: Small regression fix: only convert the type if we
931 the type is different, fixes System.Drawing build.
933 2004-04-27 Martin Baulig <martin@ximian.com>
935 * attribute.cs (Attribute.Resolve): If we have a constant value
936 for a named field or property, implicity convert it to the correct
939 2004-04-27 Raja R Harinath <rharinath@novell.com>
941 * statement.cs (Block.Block): Implicit blocks share
942 'child_variable_names' fields with parent blocks.
943 (Block.AddChildVariableNames): Remove.
944 (Block.AddVariable): Mark variable as "used by a child block" in
945 every surrounding block.
946 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
947 been used in a child block, complain about violation of "Invariant
948 meaning in blocks" rule.
949 * cs-parser.jay (declare_local_variables): Don't use
950 AddChildVariableNames.
951 (foreach_statement): Don't create an implicit block: 'foreach'
954 2004-04-23 Miguel de Icaza <miguel@ximian.com>
956 * convert.cs (ImplicitNumericConversion): 0 is also positive when
957 converting from 0L to ulong. Fixes 57522.
959 2004-04-22 Marek Safar <marek.safar@seznam.cz>
961 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
962 derived class hides via 'new' keyword field from base class (test-242.cs).
963 TODO: Handle this in the more general way.
965 * class.cs (CheckBase): Ditto.
967 2004-04-22 Marek Safar <marek.safar@seznam.cz>
969 * decl.cs (caching_flags): New member for storing cached values
971 (MemberCore.Flags): New enum where bit flags for caching_flags
973 (MemberCore.cls_compliance): Moved to caching_flags.
974 (DeclSpace.Created): Moved to caching_flags.
976 * class.cs: Use caching_flags instead of DeclSpace.Created
978 2004-04-21 Miguel de Icaza <miguel@ximian.com>
980 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
981 if we are only a derived class, not a nested class.
983 * typemanager.cs: Same as above, but do this at the MemberLookup
984 level (used by field and methods, properties are handled in
985 PropertyExpr). Allow for the qualified access if we are a nested
988 2004-04-21 Marek Safar <marek.safar@seznam.cz>
990 * class.cs: Refactoring.
991 (IMethodData): New inteface; Holds links to parent members
992 to avoid member duplication (reduced memory allocation).
993 (Method): Implemented IMethodData interface.
994 (PropertyBase): New inner classes for get/set methods.
995 (PropertyBase.PropertyMethod): Implemented IMethodData interface
996 (Event): New inner classes for add/remove methods.
997 (Event.DelegateMethod): Implemented IMethodData interface.
999 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
1000 EmitContext (related to class.cs refactoring).
1002 2004-04-21 Raja R Harinath <rharinath@novell.com>
1004 * delegate.cs (Delegate.VerifyApplicability): If the number of
1005 arguments are the same as the number of parameters, first try to
1006 verify applicability ignoring any 'params' modifier on the last
1010 2004-04-16 Raja R Harinath <rharinath@novell.com>
1012 * class.cs (TypeContainer.AddIndexer): Use
1013 'ExplicitInterfaceName' to determine if interface name was
1014 explicitly specified. 'InterfaceType' is not initialized at this time.
1015 (TypeContainer.DefineIndexers): Remove use of temporary list. The
1016 Indexers array is already in the required order. Initialize
1017 'IndexerName' only if there are normal indexers.
1018 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
1019 (TypeContainer.Emit): Emit DefaultMember attribute only if
1020 IndexerName is initialized.
1023 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
1025 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
1028 2004-04-15 Raja R Harinath <rharinath@novell.com>
1030 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
1034 * attribute.cs (Attribute.Resolve): Check for duplicate named
1038 2004-04-15 Miguel de Icaza <miguel@ximian.com>
1040 * iterators.cs (MarkYield): track whether we are in an exception,
1041 and generate code accordingly. Use a temporary value to store the
1042 result for our state.
1044 I had ignored a bit the interaction of try/catch with iterators
1045 since their behavior was not entirely obvious, but now it is
1046 possible to verify that our behavior is the same as MS .NET 2.0
1050 2004-04-14 Miguel de Icaza <miguel@ximian.com>
1052 * iterators.cs: Avoid creating temporaries if there is no work to
1055 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
1056 Enumerations, use TypeManager.EnumToUnderlying and call
1059 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
1062 (This.Emit): Use EmitContext.EmitThis to emit our
1065 (This.EmitAssign): Ditto.
1067 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
1068 codepaths, we will move all the functionality into
1071 (FieldExpr.EmitAssign): Ditto.
1073 This fixes several hidden bugs that I uncovered while doing a code
1074 review of this today.
1076 * codegen.cs (EmitThis): reworked so the semantics are more clear
1077 and also support value types "this" instances.
1079 * iterators.cs: Changed so that for iterators in value types, we
1080 do not pass the value type as a parameter.
1082 Initialization of the enumerator helpers is now done in the caller
1083 instead of passing the parameters to the constructors and having
1084 the constructor set the fields.
1086 The fields have now `assembly' visibility instead of private.
1088 2004-04-11 Miguel de Icaza <miguel@ximian.com>
1090 * expression.cs (Argument.Resolve): Check if fields passed as ref
1091 or out are contained in a MarshalByRefObject.
1093 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
1094 another compiler type.
1096 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
1098 * class.cs (Indexer.Define): use the new name checking method.
1099 Also, return false on an error.
1100 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
1101 (is_identifier_[start/part]_character): make static.
1103 2004-04-10 Miguel de Icaza <miguel@ximian.com>
1105 * expression.cs (Binary.ResolveOperator): Do no append strings
1106 twice: since we can be invoked more than once (array evaluation)
1107 on the same concatenation, take care of this here. Based on a fix
1108 from Ben (bug #56454)
1110 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
1112 * codegen.cs: Fix another case where CS1548 must be reported (when
1113 delay-sign isn't specified and no private is available #56564). Fix
1114 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
1115 error when MCS is used on the MS runtime and we need to delay-sign
1116 (which seems unsupported by AssemblyBuilder - see #56621).
1118 2004-04-08 Marek Safar <marek.safar@seznam.cz>
1120 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
1121 (TypeManager.ComputeNamespaces): Faster implementation for
1124 * compiler.csproj: Updated AssemblyName to mcs.
1126 2004-04-07 Miguel de Icaza <miguel@ximian.com>
1128 * rootcontext.cs: Add new types to the boot resolution.
1130 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
1131 MulticastDelegate is not allowed.
1133 * typemanager.cs: Add new types to lookup: System.TypedReference
1136 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
1137 check for TypedReference or ArgIterator, they are not allowed.
1139 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
1140 makes us properly catch 1510 in some conditions (see bug 56016 for
1143 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
1145 * CryptoConvert.cs: update from corlib version
1148 2004-04-05 Miguel de Icaza <miguel@ximian.com>
1150 * class.cs (Indexer.Define): Check indexername declaration
1152 2004-04-05 Marek Safar <marek.safar@seznam.cz>
1154 * attribute.cs (IsClsCompliant): Fixed problem with handling
1155 all three states (compliant, not-compliant, undetected).
1157 2004-03-30 Marek Safar <marek.safar@seznam.cz>
1159 * attribute.cs (Attribute): Location is now public.
1160 (Resolve): Store resolved arguments (pos_values) in attribute class.
1161 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
1162 (GetClsCompliantAttributeValue): New method that gets
1163 CLSCompliantAttribute value.
1164 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
1165 if exists else null.
1166 (AttributeTester): New class for CLS-Compliant verification routines.
1168 * class.cs (Emit): Add CLS-Compliant verification.
1169 (Method.GetSignatureForError): Implemented.
1170 (Constructor.GetSignatureForError): Implemented
1171 (Constructor.HasCompliantArgs): Returns if constructor has
1172 CLS-Compliant arguments.
1173 (Constructor.Emit): Override.
1174 (Construcor.IsIdentifierClsCompliant): New method; For constructors
1175 is needed to test only parameters.
1176 (FieldBase.GetSignatureForError): Implemented.
1177 (TypeContainer): New member for storing base interfaces.
1178 (TypeContainer.FindMembers): Search in base interfaces too.
1180 * codegen.cs (GetClsComplianceAttribute): New method that gets
1181 assembly or module CLSCompliantAttribute value.
1182 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
1184 (ModuleClass.Emit): Add error 3012 test.
1186 * const.cs (Emit): Override and call base for CLS-Compliant tests.
1188 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
1189 state for all decl types.
1190 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
1191 if CLS-Compliant tests are required.
1192 (IsClsCompliaceRequired): New method. Analyze whether code
1193 must be CLS-Compliant.
1194 (IsExposedFromAssembly): New method. Returns true when MemberCore
1195 is exposed from assembly.
1196 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
1197 value or gets cached value.
1198 (HasClsCompliantAttribute): New method. Returns true if MemberCore
1199 is explicitly marked with CLSCompliantAttribute.
1200 (IsIdentifierClsCompliant): New abstract method. This method is
1201 used to testing error 3005.
1202 (IsIdentifierAndParamClsCompliant): New method. Common helper method
1203 for identifier and parameters CLS-Compliant testing.
1204 (VerifyClsCompliance): New method. The main virtual method for
1205 CLS-Compliant verifications.
1206 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
1207 null. I don't know why is null (too many public members !).
1208 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
1209 and get value of first CLSCompliantAttribute that found.
1211 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
1212 (VerifyClsCompliance): Override and add extra tests.
1214 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
1215 clscheck- disable CLS-Compliant verification event if assembly is has
1216 CLSCompliantAttribute(true).
1218 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
1219 ApllyAttribute is now called in emit section as in the other cases.
1220 Possible future Emit integration.
1221 (IsIdentifierClsCompliant): New override.
1222 (VerifyClsCompliance): New override.
1223 (GetEnumeratorName): Returns full enum name.
1225 * parameter.cs (GetSignatureForError): Implemented.
1227 * report.cs (WarningData): New struct for Warning message information.
1228 (LocationOfPreviousError): New method.
1229 (Warning): New method. Reports warning based on the warning table.
1230 (Error_T): New method. Reports error based on the error table.
1232 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
1233 verifications are done here.
1235 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
1237 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
1238 CLSCompliantAttribute.
1239 (all_imported_types): New member holds all imported types from other
1241 (LoadAllImportedTypes): New method fills static table with exported types
1242 from all referenced assemblies.
1243 (Modules): New property returns all assembly modules.
1245 2004-03-30 Miguel de Icaza <miguel@ximian.com>
1247 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
1248 throwing a parser error.
1250 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
1251 which removes the hardcoded get_/set_ prefixes for properties, as
1252 IL allows for the properties to be named something else.
1256 * expression.cs: Do not override operand before we know if it is
1259 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1261 * typemanager.cs: support for pinned variables.
1263 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1265 * decl.cs, typemanager.cs: Avoid using an arraylist
1266 as a buffer if there is only one result set.
1268 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1270 * expression.cs: Make sure you cant call a static method
1271 with an instance expression, bug #56174.
1273 2004-03-29 Miguel de Icaza <miguel@ximian.com>
1275 * class.cs (IsDuplicateImplementation): Improve error reporting to
1276 flag 663 (method only differs in parameter modifier).
1278 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
1279 in preprocessor directives.
1281 * location.cs (LookupFile): Allow for the empty path.
1283 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
1284 better approach for some of that patch, but its failing with the
1285 CharSet enumeration. For now try/catch will do.
1287 * typemanager.cs: Do not crash if a struct does not have fields.
1290 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1292 * expression.cs: cs0213, cant fix a fixed expression.
1295 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1297 * cs-parser.jay: detect invalid embeded statements gracefully.
1300 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1302 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
1305 the invocation type may not be a subclass of the tye of the item/
1306 The type of the item must be a subclass of the invocation item.
1311 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
1313 * attribute.cs: Added methods to get a string and a bool from an
1314 attribute. Required to information from AssemblyKeyFileAttribute,
1315 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
1316 * codegen.cs: Modified AssemblyName creation to include support for
1317 strongnames. Catch additional exceptions to report them as CS1548.
1318 * compiler.csproj: Updated include CryptoConvert.cs.
1319 * compiler.csproj.user: Removed file - user specific configuration.
1320 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
1321 Mono.Security assembly. The original class is maintained and tested in
1322 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
1323 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
1324 like CSC 8.0 (C# v2) supports.
1325 * Makefile: Added CryptoConvert.cs to mcs sources.
1326 * rootcontext.cs: Added new options for strongnames.
1328 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
1330 * driver.cs: For --expect-error, report error code `2'
1331 if the program compiled with no errors, error code `1' if
1332 it compiled with an error other than the one expected.
1334 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
1336 * compiler.csproj: Updated for Visual Studio .NET 2003.
1337 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
1338 * compiler.sln: Updated for Visual Studio .NET 2003.
1340 2004-03-24 Ravi Pratap M <ravi@ximian.com>
1342 * expression.cs: Fix bug #47234. We basically need to apply the
1343 rule that we prefer the conversion of null to a reference type
1344 when faced with a conversion to 'object' (csc behaviour).
1346 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1348 * statement.cs: Shorter form for foreach, eliminates
1349 a local variable. r=Martin.
1351 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1353 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
1354 checks if we can use brtrue/brfalse to test for 0.
1355 * expression.cs: use the above in the test for using brtrue/brfalse.
1358 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1360 * expression.cs: Rewrite string concat stuff. Benefits:
1362 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
1363 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
1364 rather than a concat chain.
1366 * typemanager.cs: Add lookups for more concat overloads.
1368 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1370 * expression.cs: Emit shorter il code for array init.
1387 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
1389 * statement.cs: Before, two switch blocks would be merged if the
1390 total size of the blocks (end_item - begin_item + 1) was less than
1391 two times the combined sizes of the blocks.
1393 Now, it will only merge if after the merge at least half of the
1398 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
1400 * class.cs : csc build fix for GetMethods(). See bug #52503.
1402 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
1404 * expression.cs: Make sure fp comparisons work with NaN.
1405 This fixes bug #54303. Mig approved this patch a long
1406 time ago, but we were not able to test b/c the runtime
1409 2004-03-19 Miguel de Icaza <miguel@ximian.com>
1411 * ecore.cs (TypExpr.GetHashCode): implement this overload.
1413 2004-03-19 Martin Baulig <martin@ximian.com>
1415 * class.cs (MemberCore.IsDuplicateImplementation): Report the
1416 error here and not in our caller.
1418 2004-03-19 Martin Baulig <martin@ximian.com>
1420 * interface.cs: Completely killed this file.
1421 (Interface): We're now a TypeContainer and live in class.cs.
1423 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
1424 argument; we're now also called for interfaces.
1425 (TypeContainer.DefineMembers): Allow this method being called
1427 (TypeContainer.GetMethods): New public method; formerly known as
1428 Interface.GetMethod(). This is used by PendingImplementation.
1429 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
1430 it's now private and non-static.
1431 (Interface): Moved this here; it's now implemented similar to
1433 (Method, Property, Event, Indexer): Added `bool is_interface'
1434 argument to their .ctor's.
1435 (MemberBase.IsInterface): New public field.
1437 * cs-parser.jay: Create normal Method, Property, Event, Indexer
1438 instances instead of InterfaceMethod, InterfaceProperty, etc.
1439 (opt_interface_base): Removed; we now use `opt_class_base' instead.
1440 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
1442 2004-03-19 Martin Baulig <martin@ximian.com>
1444 * class.cs (MethodCore.IsDuplicateImplementation): New private
1445 method which does the CS0111 checking.
1446 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
1447 Use IsDuplicateImplementation().
1449 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
1451 * decl.cs (FindMemberToOverride): New method to find the correct
1452 method or property to override in the base class.
1454 - Make Method/Property use the above method to find the
1455 version in the base class.
1456 - Remove the InheritableMemberSignatureCompare as it is now
1459 This patch makes large code bases much faster to compile, as it is
1460 O(n) rather than O(n^2) to do this validation.
1462 Also, it fixes bug 52458 which is that nested classes are not
1463 taken into account when finding the base class member.
1465 Reviewed/Approved by Martin.
1467 2004-03-17 Marek Safar <marek.safar@seznam.cz>
1469 * interface.cs: In all interface classes removed redundant
1470 member initialization.
1472 2004-03-16 Martin Baulig <martin@ximian.com>
1474 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1476 2004-03-15 Miguel de Icaza <miguel@ximian.com>
1478 * decl.cs (DefineTypeAndParents): New helper method to define a
1479 type's containers before the type itself is defined; This is a
1480 bug exposed by the recent changes to Windows.Forms when an
1481 implemented interface was defined inside a class that had not been
1484 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
1486 (Check): Loop correctly to report errors modifiers
1487 (UNSAFE was not in the loop, since it was the same as TOP).
1489 * interface.cs: Every interface member now takes a ModFlags,
1490 instead of a "is_new" bool, which we set on the base MemberCore.
1492 Every place where we called "UnsafeOk" in the interface, now we
1493 call the proper member (InterfaceMethod.UnsafeOK) instead to get
1494 the unsafe settings from the member declaration instead of the
1495 container interface.
1497 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
1499 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1500 `set_indexer_name' to the pending bits (one per type).
1502 We fixed a bug today that was picking the wrong method to
1503 override, since for properties the existing InterfaceMethod code
1504 basically ignored the method name. Now we make sure that the
1505 method name is one of the valid indexer names.
1507 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
1509 * support.cs (SeekableStreamReader): Keep track of stream byte
1510 positions and don't mix them with character offsets to the buffer.
1512 Patch from Gustavo Giráldez
1514 2004-03-15 Marek Safar <marek.safar@seznam.cz>
1516 * interface.cs (InterfaceSetGetBase): Removed double member
1517 initialization, base class does it as well.
1519 2004-03-13 Martin Baulig <martin@ximian.com>
1521 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
1522 when compiling corlib.
1524 2004-03-13 Miguel de Icaza <miguel@ximian.com>
1526 * convert.cs (ExplicitConversion): We were reporting an error on
1527 certain conversions (object_type source to a value type, when the
1528 expression was `null') before we had a chance to pass it through
1529 the user defined conversions.
1531 * driver.cs: Replace / and \ in resource specifications to dots.
1534 * class.cs: Add check for duplicate operators. Fixes 52477
1536 2004-03-11 Miguel de Icaza <miguel@ximian.com>
1538 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
1539 that are in the middle of the statements, not only at the end.
1542 * class.cs (TypeContainer.AddField): No longer set the
1543 `HaveStaticConstructor' flag, now we call it
1544 `UserDefineStaticConstructor' to diferentiate the slightly
1545 semantic difference.
1547 The situation is that we were not adding BeforeFieldInit (from
1548 Modifiers.TypeAttr) to classes that could have it.
1549 BeforeFieldInit should be set to classes that have no static
1554 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
1556 And most importantly Zoltan's comment:
1558 http://bugzilla.ximian.com/show_bug.cgi?id=44229
1560 "I think beforefieldinit means 'it's ok to initialize the type sometime
1561 before its static fields are used', i.e. initialization does not need
1562 to be triggered by the first access to the type. Setting this flag
1563 helps the JIT to compile better code, since it can run the static
1564 constructor at JIT time, and does not need to generate code to call it
1565 (possibly lots of times) at runtime. Unfortunately, mcs does not set
1566 this flag for lots of classes like String.
1568 csc sets this flag if the type does not have an explicit static
1569 constructor. The reasoning seems to be that if there are only static
1570 initalizers for a type, and no static constructor, then the programmer
1571 does not care when this initialization happens, so beforefieldinit
1574 This bug prevents the AOT compiler from being usable, since it
1575 generates so many calls to mono_runtime_class_init that the AOT code
1576 is much slower than the JITted code. The JITted code is faster,
1577 because it does not generate these calls if the vtable is type is
1578 already initialized, which is true in the majority of cases. But the
1579 AOT compiler can't do this."
1581 2004-03-10 Miguel de Icaza <miguel@ximian.com>
1583 * class.cs (MethodData.Emit): Refactor the code so symbolic
1584 information is generated for destructors; For some reasons we
1585 were taking a code path that did not generate symbolic information
1588 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
1590 * class.cs: Create a Constructor.CheckBase method that
1591 takes care of all validation type code. The method
1592 contains some code that was moved from Define.
1594 It also includes new code that checks for duplicate ctors.
1595 This fixes bug #55148.
1597 2004-03-09 Joshua Tauberer <tauberer@for.net>
1599 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
1600 a { ... }-style array creation invokes EmitStaticInitializers
1601 which is not good for reference-type arrays. String, decimal
1602 and now null constants (NullCast) are not counted toward
1603 static initializers.
1605 2004-03-05 Martin Baulig <martin@ximian.com>
1607 * location.cs (SourceFile.HasLineDirective): New public field;
1608 specifies whether the file contains or is referenced by a "#line"
1610 (Location.DefineSymbolDocuments): Ignore source files which
1611 either contain or are referenced by a "#line" directive.
1613 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
1615 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
1616 direct access to our parent, so check the method inline there.
1618 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
1620 * expression.cs (Invocation.EmitCall): Miguel's last commit
1621 caused a regression. If you had:
1626 In Foo the implict this would be null.
1628 2004-02-27 Miguel de Icaza <miguel@ximian.com>
1630 * expression.cs (Invocation.EmitCall): If the method is not
1631 virtual, do not emit a CallVirt to it, use Call.
1633 * typemanager.cs (GetFullNameSignature): Improve the method to
1634 cope with ".ctor" and replace it with the type name.
1636 * class.cs (ConstructorInitializer.Resolve): Now the method takes
1637 as an argument the ConstructorBuilder where it is being defined,
1638 to catch the recursive constructor invocations.
1640 2004-02-26 Miguel de Icaza <miguel@ximian.com>
1642 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
1643 routines to check if a type is an enumerable/enumerator allow
1644 classes that implement the IEnumerable or IEnumerator interfaces.
1646 * class.cs (Property, Operator): Implement IIteratorContainer, and
1647 implement SetYields.
1649 (Property.Define): Do the block swapping for get_methods in the
1650 context of iterators. We need to check if Properties also
1651 include indexers or not.
1653 (Operator): Assign the Block before invoking the
1654 OperatorMethod.Define, so we can trigger the Iterator code
1657 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
1658 Property and Operator classes are not created when we parse the
1659 declarator but until we have the block completed, so we use a
1660 singleton SimpleIteratorContainer.Simple to flag whether the
1661 SetYields has been invoked.
1663 We propagate this setting then to the Property or the Operator to
1664 allow the `yield' to function.
1666 2004-02-25 Marek Safar <marek.safar@seznam.cz>
1668 * codegen.cs: Implemented attribute support for modules.
1669 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
1670 Assembly/Module functionality.
1672 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
1673 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
1674 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
1676 2004-02-16 Marek Safar <marek.safar@seznam.cz>
1678 * interface.cs (FindMembers): The operation is performed on all base
1679 interfaces and not only on the first. It is required for future CLS Compliance patch.
1681 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
1683 * statement.cs, codegen.cs:
1684 This patch deals with patterns such as:
1686 public class List : IEnumerable {
1688 public MyEnumerator GetEnumerator () {
1689 return new MyEnumerator(this);
1692 IEnumerator IEnumerable.GetEnumerator () {
1696 public struct MyEnumerator : IEnumerator {
1701 Before, there were a few things we did wrong:
1702 1) we would emit callvirt on a struct, which is illegal
1703 2) we emited ldarg when we needed to emit ldarga
1704 3) we would mistakenly call the interface methods on an enumerator
1705 type that derived from IEnumerator and was in another assembly. For example:
1707 public class MyEnumerator : IEnumerator
1709 Would have the interface methods called, even if there were public impls of the
1710 method. In a struct, this lead to invalid IL code.
1712 2004-02-11 Marek Safar <marek.safar@seznam.cz>
1714 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
1717 * delegate.cs (Define): Fixed crash when delegate type is undefined.
1719 2004-02-11 Miguel de Icaza <miguel@ximian.com>
1721 * cs-parser.jay: Fix small regression: we were not testing V2
1722 compiler features correctly.
1724 * interface.cs: If the emit context is null, then create one
1726 2004-02-09 Marek Safar <marek.safar@seznam.cz>
1728 * decl.cs (GetSignatureForError): New virtual method to get full name
1731 * attribute.cs (IAttributeSupport): New interface for attribute setting.
1732 Now it is possible to rewrite ApplyAttributes method to be less if/else.
1734 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
1735 Duplicated members and code in these classes has been removed.
1736 Better encapsulation in these classes.
1738 2004-02-07 Miguel de Icaza <miguel@ximian.com>
1740 * assign.cs (Assign.DoResolve): When dealing with compound
1741 assignments, there is a new rule in ECMA C# 2.4 (might have been
1742 there before, but it is documented here) that states that in:
1746 If b is of type int, and the `op' is a shift-operator, then the
1747 above is evaluated as:
1751 * expression.cs (Binary.ResolveOperator): Instead of testing for
1752 int/uint/long/ulong, try to implicitly convert to any of those
1753 types and use that in pointer arithmetic.
1755 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
1756 method to print information for from the type, not from the
1757 null-method we were given.
1759 2004-02-01 Duncan Mak <duncan@ximian.com>
1761 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
1762 parsing for cmd, fixes bug #53694.
1764 2004-02-04 Marek Safar <marek.safar@seznam.cz>
1766 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
1767 in the member name duplication tests. Property and operator name duplication
1768 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
1770 2004-02-03 Marek Safar <marek.safar@seznam.cz>
1772 * interface.cs (PopulateMethod): Fixed crash when interface method
1773 returns not existing type (error test cs0246-3.cs).
1775 2004-02-02 Ravi Pratap M <ravi@ximian.com>
1777 * cs-parser.jay (interface_accessors): Re-write actions to also
1778 store attributes attached to get and set methods. Fix spelling
1781 (inteface_property_declaration): Modify accordingly.
1783 (InterfaceAccessorInfo): New helper class to store information to pass
1784 around between rules that use interface_accessors.
1786 * interface.cs (Emit): Apply attributes on the get and set
1787 accessors of properties and indexers too.
1789 * attribute.cs (ApplyAttributes): Modify accordingly to use the
1790 right MethodBuilder when applying attributes to the get and set accessors.
1792 2004-01-31 Miguel de Icaza <miguel@ximian.com>
1794 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
1796 2004-01-26 Miguel de Icaza <miguel@ximian.com>
1798 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
1800 2004-01-25 Miguel de Icaza <miguel@ximian.com>
1802 * cs-parser.jay: Remove YIELD token, instead use the new grammar
1803 changes that treat `yield' specially when present before `break'
1806 * cs-tokenizer.cs: yield is no longer a keyword.
1808 2004-01-23 Marek Safar <marek.safar@seznam.cz>
1810 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
1811 setting for default constructors.
1812 For default constructors are almost every time set wrong Modifier. The
1813 generated IL code has been alright. But inside mcs this values was
1814 wrong and this was reason why several of my CLS Compliance tests
1817 2004-01-22 Martin Baulig <martin@ximian.com>
1819 * cs-parser.jay (namespace_or_type_name): Return an Expression,
1820 not a QualifiedIdentifier. This is what `type_name_expression'
1821 was previously doing.
1822 (type_name_expression): Removed; the code is now in
1823 `namespace_or_type_name'.
1824 (qualified_identifier): Removed, use `namespace_or_type_name'
1826 (QualifiedIdentifier): Removed this class.
1828 2004-01-22 Martin Baulig <martin@ximian.com>
1830 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
1831 not a string as alias name.
1833 2004-01-21 Miguel de Icaza <miguel@ximian.com>
1835 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
1836 #52730 bug, and instead compute correctly the need to use a
1837 temporary variable when requesting an address based on the
1838 static/instace modified of the field and the constructor.
1840 2004-01-21 Martin Baulig <martin@ximian.com>
1842 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
1843 class and namespace before looking up aliases. Fixes #52517.
1845 2004-01-21 Martin Baulig <martin@ximian.com>
1847 * flowanalysis.cs (UsageVector.Merge): Allow variables being
1848 assinged in a 'try'; fixes exception4.cs.
1850 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1851 * class.cs : Implemented parameter-less constructor for TypeContainer
1853 * decl.cs: Attributes are now stored here. New property OptAttributes
1855 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
1857 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
1859 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1861 * typemanager.cs (CSharpSignature): Now reports also inner class name.
1862 (CSharpSignature): New method for indexer and property signature.
1864 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1866 * pending.cs (IsVirtualFilter): Faster implementation.
1868 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1870 * typemanager.cs: Avoid inclusion of same assembly more than once.
1872 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1874 * cs-parser.jay: Fixed problem where the last assembly attribute
1875 has been applied also to following declaration (class, struct, etc.)
1877 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1879 * class.cs: Added error CS0538, CS0539 reporting.
1880 Fixed crash on Microsoft runtime when field type is void.
1882 * cs-parser.jay: Added error CS0537 reporting.
1884 * pending.cs: Added error CS0535 reporting.
1885 Improved error report for errors CS0536, CS0534.
1887 2004-01-20 Miguel de Icaza <miguel@ximian.com>
1889 Merge a few bits from the Anonymous Method MCS tree.
1891 * statement.cs (ToplevelBlock): New class for toplevel methods,
1892 will hold anonymous methods, lifted variables.
1894 * cs-parser.jay: Create toplevel blocks for delegates and for
1895 regular blocks of code.
1897 2004-01-20 Martin Baulig <martin@ximian.com>
1899 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
1900 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
1901 and `NeedExplicitReturn'; added `IsLastStatement'.
1902 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
1903 have a `ReturnLabel' or we're not unreachable.
1905 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
1906 child's reachability; don't just override ours with it. Fixes
1907 #58058 (lluis's example).
1908 (FlowBranching): Added public InTryOrCatch(), InCatch(),
1909 InFinally(), InLoop(), InSwitch() and
1910 BreakCrossesTryCatchBoundary() methods.
1912 * statement.cs (Return): Do all error checking in Resolve().
1913 Unless we are the last statement in a top-level block, always
1914 create a return label and jump to it.
1915 (Break, Continue): Do all error checking in Resolve(); also make
1916 sure we aren't leaving a `finally'.
1917 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
1918 statement in a top-level block.
1919 (Block.Flags): Added `IsDestructor'.
1920 (Block.IsDestructor): New public property.
1922 2004-01-20 Martin Baulig <martin@ximian.com>
1924 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
1926 2004-01-20 Martin Baulig <martin@ximian.com>
1928 * statement.cs (Statement.ResolveUnreachable): New public method.
1929 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
1930 (Block.Resolve): Resolve unreachable statements.
1932 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
1934 * expression.cs: We need to fix the case where we do
1935 not have a temp variable here.
1937 * assign.cs: Only expression compound assignments need
1938 temporary variables.
1940 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
1942 * flowanalysis.cs: Reduce memory allocation in a few ways:
1943 - A block with no variables should not allocate a bit
1945 - A method with no out parameters does not need any tracking
1946 for assignment of the parameters, so we need not allocate
1949 public readonly Type[] VariableTypes;
1950 public readonly string[] VariableNames;
1951 Are redundant. The data is already stored in the variable
1952 map, so we need not allocate another array for it.
1953 - We need to add alot of checks for if (params | locals) == null
1954 due to the first two changes.
1956 2004-01-18 Miguel de Icaza <miguel@ximian.com>
1958 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
1959 implement IMemoryLocation, we store a copy on a local variable and
1960 take the address of it. Patch from Benjamin Jemlich
1962 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
1963 to use a special "type_name_expression" rule which reduces the
1964 number of "QualifiedIdentifier" classes created, and instead
1965 directly creates MemberAccess expressions.
1967 2004-01-17 Miguel de Icaza <miguel@ximian.com>
1969 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
1970 that fixes #52853. Null literal assignment to ValueType
1972 * class.cs (MethodData.Emit): Instead of checking the name of the
1973 method to determine if its a destructor, create a new derived
1974 class from Method called Destructor, and test for that.
1976 * cs-parser.jay: Create a Destructor object instead of a Method.
1978 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
1982 2004-01-16 Miguel de Icaza <miguel@ximian.com>
1984 * expression.cs (Binary.ResolveOperator): Perform an implicit
1985 conversion from MethodGroups to their delegate types on the
1988 * delegate.cs: Introduce a new class DelegateCreation that is the
1989 base class for `NewDelegate' and `ImplicitDelegateCreation',
1990 factor some code in here.
1992 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
1993 conversion from MethodGroups to compatible delegate types.
1995 * ecore.cs (Expression.Resolve): Do not flag error 654
1996 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
1997 we allow conversions from MethodGroups to delegate types now.
1999 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
2000 assignments in v2 either.
2002 2004-01-10 Miguel de Icaza <miguel@ximian.com>
2004 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
2005 static read-only fields in ctors.
2007 Applied patch from Benjamin Jemlich
2009 * expression.cs (UnaryMutator): Avoid leaking local variables.
2011 2004-01-09 Miguel de Icaza <miguel@ximian.com>
2013 * cs-tokenizer.cs (IsCastToken): Allow the various native types
2014 here to return true, as they can be used like this:
2018 Fixed 49836 and all the other dups
2020 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
2022 * driver.cs: Implement /win32res and /win32icon.
2024 2004-01-08 Miguel de Icaza <miguel@ximian.com>
2026 * cs-parser.jay: Add a rule to improve error handling for the
2027 common mistake of placing modifiers after the type.
2029 2004-01-07 Miguel de Icaza <miguel@ximian.com>
2031 * cs-parser.jay (interface_event_declaration): Catch
2032 initialization of events on interfaces, and report cs0068
2034 * cs-parser.jay (interface_event_declaration): Catch
2035 initialization of events.
2037 * ecore.cs: Better report missing constructors.
2039 * expression.cs (Binary.ResolveOperator): My previous bug fix had
2040 the error reporting done in the wrong place. Fix.
2042 * expression.cs (Binary.ResolveOperator): Catch the
2043 operator + (E x, E y) error earlier, and later allow for implicit
2044 conversions in operator +/- (E e, U x) from U to the underlying
2047 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
2048 52596, if the container class is abstract, the default constructor
2049 is protected otherwise its public (before, we were always public).
2051 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
2054 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
2055 Jemlich that fixes bug #52597, MCS was generating invalid code for
2056 idisposable structs. Thanks to Ben for following up with this
2059 2004-01-06 Miguel de Icaza <miguel@ximian.com>
2061 * driver.cs: Allow assemblies without code to be generated, fixes
2064 2004-01-07 Nick Drochak <ndrochak@gol.com>
2066 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
2068 2004-01-05 Miguel de Icaza <miguel@ximian.com>
2070 * cs-parser.jay: Add rules to improve error reporting if fields or
2071 methods are declared at the namespace level (error 116)
2073 * Add rules to catch event add/remove
2075 2004-01-04 David Sheldon <dave-mono@earth.li>
2077 * expression.cs: Added matching ")" to error message for
2080 2004-01-03 Todd Berman <tberman@gentoo.org>
2082 * ecore.cs, attribute.cs:
2083 Applying fix from #52429.
2085 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2087 * ecore.cs, expression.cs, statement.cs:
2088 Total rewrite of how we handle branching. We
2089 now handle complex boolean expressions with fewer
2090 jumps. As well if (x == 0) no longer emits a ceq.
2092 if (x is Foo) is much faster now, because we generate
2095 Overall, we get a pretty big improvement on our benchmark
2096 tests. The code we generate is smaller and more readable.
2098 I did a full two-stage bootstrap. The patch was reviewed
2099 by Martin and Miguel.
2101 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2103 * cs-parser.jay: Make primary_expression not take a QI.
2104 we dont need this because the member_access rule covers
2105 us here. So we replace the rule with just IDENTIFIER.
2107 This has two good effects. First, we remove a s/r conflict.
2108 Second, we allocate many fewer QualifiedIdentifier objects.
2110 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2112 * attribute.cs: Handle MarshalAs attributes as pseudo, and
2113 set the correct information via SRE. This prevents
2114 hanging on the MS runtime. Fixes #29374.
2116 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2118 * convert.cs: correctly handle conversions to value types
2119 from Enum and ValueType as unboxing conversions.
2121 Fixes bug #52569. Patch by Benjamin Jemlich.
2123 2004-01-02 Ravi Pratap <ravi@ximian.com>
2125 * expression.cs (BetterConversion): Prefer int -> uint
2126 over int -> ulong (csc's behaviour). This fixed bug #52046.
2128 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
2130 * decl.cs (MemberCache.FindMembers): now returns a
2133 * typemanager.cs: In general, go with with ^^.
2134 (CopyNewMethods): take an IList.
2135 (RealMemberLookup): Only allocate an arraylist
2136 if we copy from two sets of methods.
2138 This change basically does two things:
2139 1) Fewer array lists allocated due to CopyNewMethods.
2140 2) the explicit cast in MemberList costed ALOT.
2142 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
2144 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
2145 a hashtable to avoid needless string allocations when an identifier is
2146 used more than once (the common case).
2148 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2150 * pending.cs: MS's TypeBuilder.GetInterfaces ()
2151 is broken, it will not return anything. So, we
2152 have to use the information we have in mcs to
2155 * typemanager.cs: Add a cache for GetInterfaces,
2156 since this will now be used more often (due to ^^)
2158 (GetExplicitInterfaces) New method that gets the
2159 declared, not effective, interfaces on a type
2160 builder (eg, if you have interface IFoo, interface
2161 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
2164 This patch makes MCS able to bootstrap itself on
2167 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2169 * expression.cs: Remove the Nop's that Miguel put
2172 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2174 * report.cs, codegen.cs: Give the real stack trace to
2175 the error when an exception is thrown.
2177 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2179 * decl.cs: only allocate hashtables for ifaces if
2182 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2184 * expression.cs: fix the error from cs0121-2.cs
2185 (a parent interface has two child interfaces that
2186 have a function with the same name and 0 params
2187 and the function is called through the parent).
2189 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
2191 * class.cs, rootcontext.cs, typmanager.cs: do not
2194 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
2196 * codegen.cs: remove stack for the ec flow branching.
2197 It is already a linked list, so no need.
2199 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
2201 * Makefile: Allow custom profiler here.
2203 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2205 * typemanager.cs (LookupType):
2206 - Use a static char [], because split takes
2207 a param array for args, so it was allocating
2209 - Do not store true in a hashtable, it boxes.
2211 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2213 * flowanalysis.cs: bytify common enums.
2215 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2217 * modifiers.cs: Add a new set of flags for the
2218 flags allowed on explicit interface impls.
2219 * cs-parser.jay: catch the use of modifiers in
2220 interfaces correctly.
2221 * class.cs: catch private void IFoo.Blah ().
2223 All related to bug #50572.
2225 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2227 * decl.cs: Rewrite the consistant accessability checking.
2228 Accessability is not linear, it must be implemented in
2229 a tableish way. Fixes #49704.
2231 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2233 * expression.cs: Handle negation in a checked context.
2234 We must use subtraction from zero. Fixes #38674.
2236 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2238 * class.cs: Ignore static void main in DLLs.
2239 * rootcontext.cs: Handle the target type here,
2240 since we are have to access it from class.cs
2241 * driver.cs: account for the above.
2243 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2245 * report.cs: Give line numbers and files if available.
2247 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
2249 * driver.cs: Implement /addmodule.
2251 * typemanager.cs: Change 'modules' field so it now contains Modules not
2254 2003-12-20 Martin Baulig <martin@ximian.com>
2256 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
2257 (FieldBase.IsAssigned): Removed this field.
2258 (FieldBase.SetAssigned): New public method.
2259 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
2261 2003-12-20 Martin Baulig <martin@ximian.com>
2263 * expression.cs (LocalVariableReference.DoResolve): Don't set
2264 `vi.Used' if we're called from DoResolveLValue().
2266 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
2267 returns the usage vector it just merged into the current one -
2268 pass this one to UsageWarning().
2269 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
2270 of the `EmitContext', don't call this recursively on our children.
2272 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
2274 * driver.cs: Implement /target:module.
2276 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
2278 * support.cs (CharArrayHashtable): New helper class.
2280 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
2281 char arrays, not strings, so we can avoid creating a string in
2282 consume_identifier if the identifier is a keyword.
2284 2003-12-16 Martin Baulig <martin@ximian.com>
2286 * statement.cs (LocalInfo.Assigned): Removed this property.
2287 (LocalInfo.Flags): Removed `Assigned'.
2288 (LocalInfo.IsAssigned): New public method; takes the EmitContext
2289 and uses flow analysis.
2290 (Block.UsageWarning): Made this method private.
2291 (Block.Resolve): Call UsageWarning() if appropriate.
2293 * expression.cs (LocalVariableReference.DoResolve): Always set
2294 LocalInfo.Used here.
2296 2003-12-13 Martin Baulig <martin@ximian.com>
2298 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
2299 any value here; we're now using flow analysis to figure out
2300 whether a statement/block returns a value.
2302 2003-12-13 Martin Baulig <martin@ximian.com>
2304 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
2306 (FlowBranching.MergeFinally): Don't call
2307 `branching.CheckOutParameters()' here, this is called in
2309 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
2310 when adding the `finally' vector.
2312 2003-12-13 Martin Baulig <martin@ximian.com>
2315 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
2316 actually work and also fix #48962.
2318 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
2320 * decl.cs: Do not check System.Object for nested types,
2321 since we know it does not have any. Big bang for buck:
2326 corlib: 17.99 seconds
2330 corlib: 17.39 seconds
2332 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
2334 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
2335 time we are returning 0 members, so we save alot here.
2337 2003-12-11 Martin Baulig <martin@ximian.com>
2339 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
2340 `MergeChild()', also just take the `FlowBranching' as argument;
2341 call Merge() on it and return the result.
2342 (FlowBranching.Merge): We don't need to do anything if we just
2345 2003-12-11 Martin Baulig <martin@ximian.com>
2347 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
2348 them in an `ArrayList' to reduce memory usage. Thanks to Ben
2349 Maurer for this idea.
2351 2003-12-11 Martin Baulig <martin@ximian.com>
2353 * flowanalysis.cs (MergeResult): This class is now gone; we now
2354 use the `UsageVector' for this. The reason for this is that if a
2355 branching just has one sibling, we don't need to "merge" them at
2356 all - that's the next step to do.
2357 (FlowBranching.Merge): We now return a `UsageVector' instead of a
2360 2003-12-11 Martin Baulig <martin@ximian.com>
2362 Reworked flow analyis and made it more precise and bug-free. The
2363 most important change is that we're now using a special `Reachability'
2364 class instead of having "magic" meanings of `FlowReturns'. I'll
2365 do some more cleanups and optimizations and also add some more
2366 documentation this week.
2368 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
2369 largely reworked this class.
2370 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
2371 the new `Reachability' class instead of having "magic" values here.
2372 (FlowBranching): We're now using an instance of `Reachability'
2373 instead of having separate `Returns', `Breaks' etc. fields.
2375 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
2376 based on flow analysis; ignore the return value of block.Emit ().
2378 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
2380 * driver.cs typemanager.cs: Find the mono extensions to corlib even
2381 if they are private.
2383 2003-12-09 Martin Baulig <martin@ximian.com>
2385 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
2386 call them directly on the UsageVector.
2388 2003-12-09 Martin Baulig <martin@ximian.com>
2390 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
2391 Changed return type from `FlowReturns' to `Reachability'.
2393 2003-12-09 Martin Baulig <martin@ximian.com>
2395 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
2396 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
2397 `Reachable' fields with a single `Reachability' one.
2399 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2401 * class.cs (FindMembers): Remove foreach's.
2414 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2419 This patch does a few things:
2420 1. EmptyStatement is now a singleton, so it is never reallocated.
2421 2. All blah is EmptyStatement constructs have been changed to
2422 blah == EmptyStatement.Value, which is much faster and valid
2423 now that EmptyStatement is a singleton.
2424 3. When resolving a block, rather than allocating a new array for
2425 the non-empty statements, empty statements are replaced with
2426 EmptyStatement.Value
2427 4. Some recursive functions have been made non-recursive.
2428 Mainly the performance impact is from (3), however (1) and (2) are needed for
2429 this to work. (4) does not make a big difference in normal situations, however
2430 it makes the profile look saner.
2435 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2436 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2437 Total memory allocated: 56397 KB
2440 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
2441 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
2442 Total memory allocated: 55666 KB
2444 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2446 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
2447 than the hashtable in a hashtable version
2449 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
2450 we always end up concating a string. This results in a huge perf
2451 loss, because many strings have to be tracked by the GC. In this
2452 patch, we first use a hashtable that works with two keys, so that
2453 the strings do not need to be concat'ed.
2464 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2466 * Makefile: Add a new target `do-time' that does a quick and simple
2467 profile, leaving easy to parse output.
2469 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
2471 * codegen.cs (Init): Create the dynamic assembly with
2472 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
2474 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
2476 * support.cs: Make the PtrHashtable use only one
2477 instance of its comparer.
2479 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
2481 * typemanager.cs: Fix lookup of GetNamespaces.
2483 2003-11-29 Miguel de Icaza <miguel@ximian.com>
2485 * expression.cs: Removed redundant line.
2487 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
2488 ArrayLists, use for loops with bounds.
2490 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
2493 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
2494 arraylists, use for loop with bounds.
2496 The above three changes give us a 0.071 second performance
2497 improvement out of 3.294 seconds down to 3.223. On my machine
2498 the above changes reduced the memory usage by 1,387 KB during
2501 * cs-parser.jay (QualifiedIdentifier): New class used to represent
2502 QualifiedIdentifiers. Before we created a new string through
2503 concatenation, and mostly later on, the result would be
2504 manipulated by DecomposeQI through string manipulation.
2506 This reduced the compiler memory usage for bootstrapping from
2507 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
2508 compile times in 0.05 seconds.
2510 2003-11-28 Dick Porter <dick@ximian.com>
2512 * support.cs: Do string compares with the Invariant culture.
2520 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
2521 the comparison is done with the Invariant culture.
2523 2003-11-27 Miguel de Icaza <miguel@ximian.com>
2525 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
2526 GetEnumerator method.
2528 (ProbeCollectionType): Iterate starting at the most specific type
2529 upwards looking for a GetEnumerator
2531 * expression.cs: Shift count can be up to 31 for int/uint and 63
2534 2003-11-26 Miguel de Icaza <miguel@ximian.com>
2536 * statement.cs (Block.LookupLabel): Also look for the label on the
2537 children blocks. Use a hash table to keep track of visited
2540 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
2541 we actually did transform the other operand, otherwise fall back
2542 to the common codepath that casts to long.
2544 * cs-tokenizer.cs: Use the same code pattern as the int case.
2545 Maybe I should do the parsing myself, and avoid depending on the
2546 Parse routines to get this done.
2548 2003-11-25 Miguel de Icaza <miguel@ximian.com>
2550 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2551 which fixes bug 51347. This time test it.
2553 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
2554 attributes for example can not tell the difference between these.
2555 The difference was only a syntax feature of the language.
2557 * attribute.cs: Apply attributes to delegates.
2559 * delegate.cs: Call the apply attributes method.
2561 2003-11-24 Miguel de Icaza <miguel@ximian.com>
2563 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
2564 comparing 0 vs Byte.MinValue, not the value
2566 (ImplicitConversionRequired): When reporting a conversion error,
2567 use error 31 to print out the constant error instead of the
2570 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2571 which fixes bug 51347.
2573 2003-11-22 Miguel de Icaza <miguel@ximian.com>
2575 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
2576 which fixes the -warnaserror command line option.
2578 2003-11-21 Miguel de Icaza <miguel@ximian.com>
2580 * cfold.cs (DoNumericPromotions): During constant folding of
2581 additions on UIntConstant, special case intconstants with
2582 IntConstants like we do on the expression binary operator.
2584 2003-11-12 Miguel de Icaza <miguel@ximian.com>
2586 * convert.cs (ImplicitReferenceConversion): We were missing a case
2587 (System.Enum are not value types or class types, so we need to
2588 classify them separatedly).
2590 * driver.cs: We do not support error 2007.
2592 2003-11-12 Jackson Harper <jackson@ximian.com>
2594 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
2595 system directory. Also use the full file name so users can
2596 libraries names mscorlib-o-tron.dll in a non system dir.
2598 2003-11-10 Martin Baulig <martin@ximian.com>
2600 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
2601 (TypeManager.InitCoreTypes): Initialize them here, but instead of
2602 calling `ResolveType()' on them, directly assign their `Type'.
2604 2003-11-08 Martin Baulig <martin@ximian.com>
2606 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
2607 return value and the `out parent' parameter.
2608 (TypeContainer.DefineType): Moved the CS0644 check into
2609 GetClassBases(). Don't pass the interface types to the
2610 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
2611 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
2613 * ecore.cs (TypeExpr.IsAttribute): New property.
2614 (TypeExpr.GetInterfaces): New method.
2616 * interface.cs (Interface.GetInterfaceTypeByName): Return a
2617 TypeExpr instead of a Type.
2618 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
2619 (Interface.DefineType): Don't pass the interface types to the
2620 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
2621 them later and then call `TypeBulider.AddInterfaceImplementation()'.
2623 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
2624 instead of a `Type[]'.
2625 (TypeManager.RegisterBuilder): Likewise.
2626 (TypeManager.AddUserInterface): Likewise.
2627 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
2628 `Type[]' and also return a `TypeExpr[]'.
2629 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
2631 2003-11-08 Martin Baulig <martin@ximian.com>
2633 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
2636 2003-11-08 Martin Baulig <martin@ximian.com>
2638 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
2639 TypeManager.ResolveExpressionTypes().
2641 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
2642 instead of an Expression.
2643 (TypeExpr): This is now an abstract base class for `TypeExpression'.
2644 (TypeExpression): New public class; formerly known as `TypeExpr'.
2646 * expression.cs (ComposedCast): Derive from TypeExpr.
2648 * typemanager.cs (TypeManager.system_*_expr): These are now
2649 TypExpr's instead of Expression's.
2650 (TypeManager.ResolveExpressionTypes): New public static function;
2651 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
2654 2003-11-06 Miguel de Icaza <miguel@ximian.com>
2656 * expression.cs (New.DoResolve): Do not dereference value that
2657 might be a null return.
2659 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
2660 sure that the constant value has the right type. Fixes an
2661 unreported bug, similar to 50425.
2663 * const.cs (Const.LookupConstantValue): Call
2664 ImplicitStandardConversionExists before doing a conversion to
2665 avoid havng the TypeManager.ChangeType do conversions.
2667 Reduced the number of casts used
2669 (Const.ChangeType): New routine to enable reuse of the constant
2670 type changing code from statement.
2672 * typemanager.cs (ChangeType): Move common initialization to
2673 static global variables.
2677 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
2678 every value type to go through, even if it was void. Fix that.
2680 * cs-tokenizer.cs: Use is_identifier_start_character on the start
2681 character of the define, and the is_identifier_part_character for
2682 the rest of the string.
2684 2003-11-05 Miguel de Icaza <miguel@ximian.com>
2686 * expression.cs (UnaryMutator.EmitCode): When I updated
2687 LocalVariableReference.DoResolve, I overdid it, and dropped an
2688 optimization done on local variable references.
2690 2003-11-04 Miguel de Icaza <miguel@ximian.com>
2692 * ecore.cs: Convert the return from Ldlen into an int.
2694 2003-10-20 Miguel de Icaza <miguel@ximian.com>
2696 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
2697 the accessibility, this is a special case for toplevel non-public
2698 classes (internal for instance).
2700 2003-10-20 Nick Drochak <ndrochak@gol.com>
2702 * ecore.cs: Fix typo and build. Needed another right paren.
2704 2003-10-19 Miguel de Icaza <miguel@ximian.com>
2706 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
2707 `internal' case regular and protected, but not allowing protected
2708 to be evaluated later. Bug 49840
2710 2003-10-15 Miguel de Icaza <miguel@ximian.com>
2712 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
2713 to kb.Nlast, and not the kb.nFirst to isolate the switch
2716 Extract the underlying type, so enumerations of long/ulong are
2717 treated like long/ulong.
2719 2003-10-14 Miguel de Icaza <miguel@ximian.com>
2721 * expression.cs (New): Overload the meaning of RequestedType to
2722 track the possible creation of the NewDelegate type, since
2723 DoResolve is invoked more than once for new constructors on field
2726 See bugs: #48800 and #37014
2728 * cs-parser.jay (declare_local_constants): Take an arraylist
2729 instead of a single constant.
2731 (local_constant_declaration): It should take a
2732 constant_declarators, not a constant_declarator. Fixes 49487
2734 * convert.cs: Fix error report.
2736 2003-10-13 Jackson Harper <jackson@ximian.com>
2738 * typemanager.cs (TypeToCoreType): Add float and double this fixes
2741 2003-10-09 Martin Baulig <martin@ximian.com>
2743 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
2745 (MethodCore.DoDefineParameters): Removed the TypeContainer
2746 argument; use the DeclSpace which was passed to the .ctor instead.
2747 (MethodCore.CheckParameter): Take a DeclSpace instead of a
2748 TypeContainer; we only need a DeclSpace here.
2750 2003-10-09 Martin Baulig <martin@ximian.com>
2752 * class.cs (MethodData): Added additional `DeclSpace ds' argument
2754 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
2755 EmitContext's .ctor.
2757 2003-10-09 Martin Baulig <martin@ximian.com>
2759 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
2760 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
2761 AsAccessible(), moved them as well.
2763 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
2765 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
2767 * cs-parser.jay : Renamed yyName to yyNames related to jay.
2769 2003-10-07 Miguel de Icaza <miguel@ximian.com>
2771 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
2772 generation for >=, as spotted by Paolo, bug 48679.
2773 Patch from David Waite.
2775 * cs-tokenizer.cs: Add handling for #pragma.
2777 * cs-parser.jay: Allow for both yield and yield return in the
2778 syntax. The anti-cobolization of C# fight will go on!
2780 * class.cs (TypeBuilder.DefineType): Catch error condition here
2781 (Parent.DefineType erroring out and returning null).
2783 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2784 coping with enumerations variables, we were mistakenly processing
2785 them as a regular value type instead of built-in types. Fixes the
2788 * typemanager.cs (IsBuiltinOrEnum): New method.
2790 2003-09-30 Miguel de Icaza <miguel@ximian.com>
2792 * cs-parser.jay: Upgrade: yield now needs the return clause.
2794 2003-09-19 Martin Baulig <martin@ximian.com>
2796 * decl.cs (MemberCache.SetupCacheForInterface): Take a
2797 `MemberCache parent' argument. Normally, an interface doesn't
2798 have a parent type except System.Object, but we use this in gmcs
2799 for generic type parameters.
2801 2003-09-18 Martin Baulig <martin@ximian.com>
2803 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
2804 on `type.IsInterface'; don't check whether the type has a parent
2805 to determine whether it's an interface.
2807 2003-09-15 Martin Baulig <martin@ximian.com>
2809 * class.cs (TypeContainer.DefineType): Added an error flag to
2810 avoid reporting duplicate CS0146's ("class definition is
2813 * driver.cs (Driver.MainDriver): Abort if
2814 RootContext.ResolveTree() reported any errors.
2816 2003-09-07 Martin Baulig <martin@ximian.com>
2818 * report.cs (Error, Warning): Added overloaded versions which take
2819 a `params object[] args' and call String.Format().
2821 2003-09-07 Martin Baulig <martin@ximian.com>
2823 * decl.cs (DeclSpace..ctor): Don't call
2824 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2825 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
2826 (DeclSpace.RecordDecl): New method.
2828 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2830 2003-09-02 Ravi Pratap <ravi@ximian.com>
2832 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2833 value attributes to be applied to ParameterBuilders.
2835 * class.cs (MethodCore.LabelParameters): Make static and more
2836 generic so that it can be used from other places - like interface
2837 methods, for instance.
2839 * interface.cs (Interface.Emit): Call LabelParameters before
2840 emitting attributes on the InterfaceMethod.
2842 2003-08-26 Martin Baulig <martin@ximian.com>
2844 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2845 resolving aliases; fixes #47927.
2847 2003-08-26 Martin Baulig <martin@ximian.com>
2849 * statement.cs (Using.DoResolve): This is internally emitting a
2850 try/finally clause, so we need to set ec.NeedExplicitReturn if we
2851 do not always return. Fixes #47681.
2853 2003-08-26 Martin Baulig <martin@ximian.com>
2855 * decl.cs (MemberCore): Moved WarningNotHiding(),
2856 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2858 (AdditionResult): Make this nested in DeclSpace.
2859 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2860 argument; call NamespaceEntry.Define() unless we're nested in a
2863 * namespace.cs (Namespace.DefineName): New public function. This
2864 is called from DeclSpace's .ctor to add
2865 (Namespace.Lookup): Include DeclSpaces in the lookup.
2867 * class.cs (Operator): Derive from MemberBase, not MemberCore.
2869 * const.cs (Const): Derive from MemberBase, not MemberCore.
2871 2003-08-25 Martin Baulig <martin@ximian.com>
2873 * convert.cs (Convert.ExplicitReferenceConversion): When
2874 converting from an interface type to a class, unbox if the target
2875 type is a struct type. Fixes #47822.
2877 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2879 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2882 2003-08-22 Martin Baulig <martin@ximian.com>
2884 * class.cs (TypeManager.DefineType): When defining a nested type,
2885 call DefineType() on our parent; fixes #47801.
2887 2003-08-22 Martin Baulig <martin@ximian.com>
2889 * class.cs (MethodData.Define): While checking if a method is an
2890 interface implementation, improve the test a bit more to fix #47654.
2892 2003-08-22 Martin Baulig <martin@ximian.com>
2894 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2895 correctly; fixes #47722.
2897 2003-08-22 Martin Baulig <martin@ximian.com>
2899 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2900 LocalVariableReference, ensure it's not read-only. Fixes #47536.
2902 * statement.cs (Fixed.DoResolve): Make all variables read-only.
2904 2003-08-22 Martin Baulig <martin@ximian.com>
2906 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2907 can only be assigned in static constructors. Fixes #47161.
2909 2003-08-22 Martin Baulig <martin@ximian.com>
2911 Rewrote and improved the flow analysis code.
2913 * flowbranching.cs (FlowBranching): Make this class abstract.
2914 (FlowBranching.CreateBranching): New static function to create a
2916 (FlowBranchingBlock, FlowBranchingException): New classes.
2917 (FlowBranching.UsageVector.Type): New public readonly field.
2918 (FlowBranching.UsageVector.Breaks): Removed the setter.
2919 (FlowBranching.UsageVector.Returns): Removed the setter.
2920 (FlowBranching.UsageVector): Added Break(), Return(),
2921 NeverReachable() and Throw() methods to modify the reachability.
2922 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2923 done by FlowBranching.Merge().
2924 (FlowBranching.UsageVector.MergeChild): New method; merges the
2925 merge result into the current vector.
2926 (FlowBranching.Merge): New abstract method to merge a branching.
2928 2003-08-12 Martin Baulig <martin@ximian.com>
2930 * expression.cs (Indirection.CacheTemporaries): Create the
2931 LocalTemporary with the pointer type, not its element type.
2933 2003-08-10 Miguel de Icaza <miguel@ximian.com>
2935 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2936 token was a keyword or not.
2938 Add `error' options where an IDENTIFIER was expected; Provide
2939 CheckToken and CheckIdentifierToken convenience error reporting
2942 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2944 * decl.cs: Rename `NamespaceEntry Namespace' public field into
2945 NameSpaceEntry NameSpaceEntry.
2947 (LookupInterfaceOrClass): Avoid creating a full qualified name
2948 from namespace and name: avoid doing lookups when we know the
2949 namespace is non-existant. Use new Tree.LookupByNamespace which
2950 looks up DeclSpaces based on their namespace, name pair.
2952 * driver.cs: Provide a new `parser verbose' to display the
2953 exception thrown during parsing. This is turned off by default
2954 now, so the output of a failure from mcs is more graceful.
2956 * namespace.cs: Track all the namespaces defined in a hashtable
2959 (IsNamespace): New method
2961 2003-08-09 Miguel de Icaza <miguel@ximian.com>
2963 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
2964 we know that we need to concatenate (full typename can never be
2969 * statement.cs: Use a bitfield; Do not initialize to null things
2970 which are done by the constructor by default.
2972 * cs-parser.jay: bug fix, parameter was 4, not 3.
2974 * expression.cs: Just use the property;
2976 * statement.cs: No need for GetVariableInfo method.
2978 2003-08-08 Martin Baulig <martin@ximian.com>
2980 * flowanalysis.cs (FlowReturns): This is now nested in the
2981 `FlowBranching' class.
2982 (MyBitVector): Moved this here from statement.cs.
2983 (FlowBranching.SiblingType): New enum type.
2984 (FlowBranching.CreateSibling): Added `SiblingType' argument.
2986 2003-08-07 Martin Baulig <martin@ximian.com>
2988 * flowanalysis.cs (FlowBranchingType): This is now nested in the
2989 `FlowBranching' class and called `BranchingType'.
2991 2003-08-07 Martin Baulig <martin@ximian.com>
2993 * flowanalysis.cs: Moved all the control flow analysis code into
2996 2003-08-07 Martin Baulig <martin@ximian.com>
2998 * assign.cs (Assign.DoResolve): `target' must either be an
2999 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
3002 2003-08-07 Miguel de Icaza <miguel@ximian.com>
3004 * expression.cs (BinaryMethod): This kind of expression is created by the
3005 Binary class if it determines that the operator has to be handled
3008 (BinaryDelegate): This kind of expression is created if we are
3009 dealing with a + or - operator on delegates.
3011 (Binary): remove method, argumetns, and DelegateOperator: when
3012 dealing with methods,
3014 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
3016 * statement.cs (Block): use bitfields for the three extra booleans
3017 we had in use. Remove unused topblock parameter.
3019 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
3021 * assign.cs: Drop extra unneeded tests.
3023 2003-08-06 Miguel de Icaza <miguel@ximian.com>
3025 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
3027 * statement.cs (Foreach): Use VariableStorage instead of
3030 * codegen.cs (VariableStorage): New class used by clients that
3031 require a variable stored: locals or fields for variables that
3032 need to live across yield.
3034 Maybe provide a convenience api for EmitThis+EmitLoad?
3036 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
3039 2003-08-05 Miguel de Icaza <miguel@ximian.com>
3041 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
3042 RemapParameterLValue): New methods that are used to turn a
3043 precomputed FieldInfo into an expression like this:
3047 The idea is to use this instead of making LocalVariableReference
3048 have more than one meaning.
3050 * cs-parser.jay: Add error production to BASE.
3052 * ecore.cs: Deal with TypeManager.GetField returning null, which
3053 is now a valid return value.
3055 (FieldExprNoAddress): New expression for Fields whose address can
3058 * expression.cs (LocalVariableReference): During the resolve
3059 phases, create new expressions if we are in a remapping context.
3060 Remove code that dealt with remapping here.
3062 (ParameterReference): same.
3064 (ProxyInstance): New expression, like the `This' expression, but
3065 it is born fully resolved. We know what we are doing, so remove
3066 the errors that are targeted to user-provided uses of `this'.
3068 * statement.cs (Foreach): our variable is now stored as an
3069 Expression; During resolution, follow the protocol, dont just
3070 assume it will return this.
3072 2003-08-06 Martin Baulig <martin@ximian.com>
3074 * support.cs (SeekableStreamReader.cs): New public class.
3076 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
3077 SeekableStreamReader instead of the normal StreamReader.
3079 2003-08-04 Martin Baulig <martin@ximian.com>
3081 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
3082 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
3083 deambiguate casts and delegate invocations.
3084 (parenthesized_expression): Use the new tokens to ensure this is
3085 not a cast of method invocation.
3087 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
3088 when reading a `)' and Deambiguate_CloseParens () was previously
3091 * expression.cs (ParenthesizedExpression): New class. This is
3092 just used for the CS0075 test.
3093 (Binary.DoResolve): Check for CS0075.
3095 2003-07-29 Ravi Pratap <ravi@ximian.com>
3097 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
3098 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
3099 reference comparison.
3101 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
3102 examine the ReturnType for equality - this is necessary in the
3103 cases of implicit and explicit operators whose signature also
3104 includes the return type.
3106 2003-07-26 Miguel de Icaza <miguel@ximian.com>
3108 * namespace.cs: Cache the result of the namespace computation,
3109 instead of computing it every time.
3111 2003-07-24 Miguel de Icaza <miguel@ximian.com>
3113 * decl.cs: Use a global arraylist that we reuse over invocations
3114 to avoid excesive memory consumption. Reduces memory usage on an
3115 mcs compile by one meg (45 average).
3117 * typemanager.cs (LookupTypeReflection): In .NET pointers are
3118 private, work around that.
3120 2003-07-23 Miguel de Icaza <miguel@ximian.com>
3122 * literal.cs (IntLiteral): Define Zero and One static literals.
3124 * cs-parser.jay (integer_literal): use static literals to reduce
3125 memory usage for the most used literals (0, 1 and -1). 211kb
3126 reduced in memory usage.
3128 Replace all calls to `new ArrayList' with `new
3129 ArrayList(4)' which is a good average number for most allocations,
3130 and also requires only 16 bytes of memory for its buffer by
3133 This reduced MCS memory usage in seven megabytes for the RSS after
3136 2003-07-28 Ravi Pratap <ravi@ximian.com>
3138 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
3139 handle params methods the correct way by forming only one
3140 applicable set with params and normal methods in them. Earlier we
3141 were looking at params methods only if we found no normal methods
3142 which was not the correct thing to do.
3144 (Invocation.BetterFunction): Take separate arguments indicating
3145 when candidate and the best method are params methods in their
3148 This fixes bugs #43367 and #46199.
3150 * attribute.cs: Documentation updates.
3152 (CheckAttribute): Rename to CheckAttributeTarget.
3153 (GetValidPlaces): Rename to GetValidTargets.
3155 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
3156 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
3160 2003-07-28 Martin Baulig <martin@ximian.com>
3162 * class.cs (TypeContainer.DefineMembers): Use the base type's full
3163 name when looking up the base class of a nested class. Fixes #46977.
3165 2003-07-26 Martin Baulig <martin@ximian.com>
3167 * expression.cs (Indexers.Indexer): New nested struct; contains
3168 getter, setter and the indexer's type.
3169 (Indexers.Properties): This is now an ArrayList of
3171 (IndexerAccess.DoResolveLValue): Correctly set the type if the
3172 indexer doesn't have any getters.
3174 * assign.cs (Assign.DoResolve): Also do the implicit conversions
3175 for embedded property and indexer assignments.
3177 2003-07-26 Martin Baulig <martin@ximian.com>
3179 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
3180 preprocessor directive is not the first non-whitespace character
3183 2003-07-26 Martin Baulig <martin@ximian.com>
3185 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
3186 namespace parsing, follow the spec more closely.
3188 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
3189 NamespaceEntry.Lookup().
3191 2003-07-25 Martin Baulig <martin@ximian.com>
3193 * MethodCore.cs (OverridesSomething): New public field; it's set
3194 from TypeContainer.DefineMembers if this method overrides
3195 something (which doesn't need to be a method). Fix #39462.
3197 2003-07-25 Ravi Pratap <ravi@ximian.com>
3199 * typemanager.cs (GetMembers): Ensure that the list of members is
3200 reversed. This keeps things in sync.
3202 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
3203 find an AttributeUsage attribute.
3205 * expression.cs (Invocation.OverloadResolve): Perform the check
3206 which disallows Invoke to be directly called on a Delegate.
3208 (Error_InvokeOnDelegate): Report error cs1533.
3210 2003-07-25 Martin Baulig <martin@ximian.com>
3212 * expression.cs (Indexers.GetIndexersForType): Only look in the
3213 interface hierarchy if the requested type is already an
3214 interface. Fixes #46788 while keeping #46502 fixed.
3216 2003-07-25 Martin Baulig <martin@ximian.com>
3218 * class.cs (TypeContainer.DefineMembers): Check whether all
3219 readonly fields have been assigned and report warning CS0649 if
3222 * statement.cs (LocalInfo.IsFixed): Always return true if this is
3225 2003-07-24 Ravi Pratap <ravi@ximian.com>
3227 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
3228 returned from GetMethods to make things consistent with the
3229 assumptions MCS makes about ordering of methods.
3231 This should comprehensively fix bug #45127 and it does :-)
3233 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
3234 ordering is actually reverse.
3236 * Clean up some debug messages I left lying around.
3238 * interface.cs (Populate*): Get rid of code which emits attributes
3239 since the stage in which we emit attributes is the 'Emit' stage,
3240 not the define stage.
3242 (Emit): Move attribute emission for interface members here.
3244 2003-07-22 Ravi Pratap <ravi@ximian.com>
3246 * expression.cs (Invocation.OverloadResolve): Follow the spec more
3247 closely: we eliminate methods in base types when we have an
3248 applicable method in a top-level type.
3250 Please see section 14.5.5.1 for an exact description of what goes
3253 This fixes bug #45127 and a host of other related to corlib compilation.
3255 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
3256 array is the method corresponding to the top-level type (this is
3257 because of the changes made to icall.c) so we change this
3260 (MethodGroupExpr.Name): This too.
3262 * typemanager.cs (GetElementType): New method which does the right
3263 thing when compiling corlib.
3265 * everywhere: Make use of the above in the relevant places.
3267 2003-07-22 Martin Baulig <martin@ximian.com>
3269 * cs-parser.jay (invocation_expression): Moved
3270 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
3271 `cast_expression', but create a InvocationOrCast which later
3272 resolves to either an Invocation or a Cast.
3274 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
3275 method; call this before EmitStatement() to make sure that this
3276 expression can be used as a statement.
3278 * expression.cs (InvocationOrCast): New class; resolves to either
3279 an Invocation or a Cast.
3281 * statement.cs (StatementExpression): Call ResolveStatement() on
3282 the ExpressionStatement before emitting it.
3284 2003-07-21 Martin Baulig <martin@ximian.com>
3286 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
3287 `ref' and `out' attributes match; fixes #46220.
3288 (MemberAccess.ResolveMemberAccess): You can't reference a type
3289 through an expression; fixes #33180.
3290 (Indexers.GetIndexersForType): Don't return the indexers from
3291 interfaces the class implements; fixes #46502.
3293 2003-07-21 Martin Baulig <martin@ximian.com>
3295 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
3296 CS0661 checks; fixes bug #30442.
3298 2003-07-21 Martin Baulig <martin@ximian.com>
3300 * decl.cs (AdditionResult): Added `Error'.
3302 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
3304 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
3305 makes cs0031.cs actually work.
3307 2003-07-20 Martin Baulig <martin@ximian.com>
3309 * namespace.cs: Fixed that bug which caused a crash when compiling
3312 2003-07-20 Miguel de Icaza <miguel@ximian.com>
3314 * typemanager.cs (LookupTypeReflection): Never expose types which
3315 are NotPublic, NestedPrivate, NestedAssembly, or
3316 NestedFamANDAssem. We used to return these, and later do a check
3317 that would report a meaningful error, but the problem is that we
3318 would not get the real match, if there was a name override.
3320 2003-07-18 Miguel de Icaza <miguel@ximian.com>
3322 * namespace.cs (Namespace, Name): Do not compute the namespace
3323 name dynamically, compute it in the constructor. This reduced
3324 memory usage by 1697 KB.
3326 * driver.cs: Use --pause to pause at the end.
3328 2003-07-17 Peter Williams <peter@newton.cx>
3330 * Makefile: Change the name of the test target so that it doesn't
3331 conflict with the recursive test target.
3333 2003-07-17 Miguel de Icaza <miguel@ximian.com>
3335 * expression.cs (LocalVariableReference.Emit, EmitAssign,
3336 AddressOf): Do not use EmitThis, that was wrong, use the actual
3339 2003-07-15 Miguel de Icaza <miguel@ximian.com>
3341 * class.cs (MethodData.Define): While checking if a method is an
3342 interface implementation, improve the test: If we are not public
3343 (use new test here: use the computed MethodAttributes directly,
3344 instead of the parsed modifier flags) check if the `implementing'
3345 method comes from an interface or not.
3347 * pending.cs (VerifyPendingMethods): Slightly better error
3350 * makefile: add test target that does the mcs bootstrap.
3352 2003-07-16 Ravi Pratap <ravi@ximian.com>
3354 * interface.cs (Define): Do nothing here since there are no
3355 members to populate etc. Move the attribute emission out of here
3356 since this was just totally the wrong place to put it. Attribute
3357 application happens during the 'Emit' phase, not in the 'Define'
3360 (Emit): Add this method and move the attribute emission here
3362 * rootcontext.cs (EmitCode): Call the Emit method on interface
3365 2003-07-14 Ravi Pratap M <ravi@ximian.com>
3367 * expression.cs (OverloadResolve): Report error only if Location
3368 is not 'Null' which means that there was a probe going on.
3370 2003-07-14 Martin Baulig <martin@ximian.com>
3372 * expression.cs (ConditionalLogicalOperator): New public class to
3373 implement user defined conditional logical operators.
3374 This is section 14.11.2 in the spec and bug #40505.
3376 2003-07-14 Martin Baulig <martin@ximian.com>
3378 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
3380 2003-07-14 Martin Baulig <martin@ximian.com>
3382 * codegen.cs (EmitContext.InFixedInitializer): New public field.
3384 * ecore.cs (IVariable.VerifyFixed): New interface method.
3386 * expression.cs (Unary.ResolveOperator): When resolving the `&'
3387 operator, check whether the variable is actually fixed. Fixes bug
3388 #36055. Set a variable definitely assigned when taking its
3389 address as required by the spec.
3391 * statement.cs (LocalInfo.IsFixed): New field.
3392 (LocalInfo.MakePinned): Set `IsFixed' to true.
3394 2003-07-14 Ravi Pratap M <ravi@ximian.com>
3396 * attribute.cs (Attribute.Resolve): While doing a Member lookup
3397 for .ctors, ensure that we only ask for members declared in the
3398 attribute type (BindingFlags.DeclaredOnly).
3402 * expression.cs (Error_WrongNumArguments): Report error 1501
3403 correctly the way CSC does.
3405 2003-07-13 Martin Baulig <martin@ximian.com>
3407 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
3408 lookup on the fully qualified name, to make things like "X.X" work
3409 where "X.X" is a fully qualified type name, but we also have a
3410 namespace "X" in the using list. Fixes #41975.
3412 2003-07-13 Martin Baulig <martin@ximian.com>
3414 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
3415 function. If we're a CompoundAssign, we need to create an embedded
3416 CompoundAssign, not an embedded Assign.
3417 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
3420 2003-07-13 Martin Baulig <martin@ximian.com>
3422 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
3423 work to fix bug #46088.
3425 2003-07-13 Ravi Pratap <ravi@ximian.com>
3427 * class.cs (Operator.Emit): Do not emit attributes here - it is
3428 taken care of by the Method class that we delegate too. This takes
3431 2003-07-10 Martin Baulig <martin@ximian.com>
3433 * expression.cs (TypeOfVoid): New class.
3434 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
3436 2003-07-10 Martin Baulig <martin@ximian.com>
3438 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
3441 2003-07-10 Martin Baulig <martin@ximian.com>
3443 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
3444 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
3446 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
3448 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
3450 2003-07-10 Martin Baulig <martin@ximian.com>
3452 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
3453 of decimal. Fixes #42850.
3455 NOTE: I also fixed the created byte blob, but this doesn't work on
3456 the MS runtime and csc never produces any byte blobs for decimal
3459 2003-07-10 Martin Baulig <martin@ximian.com>
3461 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
3462 structs; fixes #32068.
3463 (Block.AddChildVariableNames): Fixed #44302.
3465 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3467 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
3469 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3471 * attribute.cs: And this test is onger needed.
3473 2003-07-08 Martin Baulig <martin@ximian.com>
3475 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
3476 inaccessible types. Fixes #36313.
3478 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
3480 * namespace.cs (NamespaceEntry): Create implicit entries for all
3481 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
3482 implicit entries for N1.N2 and N1.
3484 2003-07-08 Martin Baulig <martin@ximian.com>
3486 Rewrote the handling of namespaces to fix a lot of the issues
3487 wrt. `using' aliases etc.
3489 * namespace.cs (Namespace): Splitted this class into a
3490 per-assembly `Namespace' and a per-file `NamespaceEntry'.
3492 * typemanager.cs (TypeManager.IsNamespace): Removed.
3493 (TypeManager.ComputeNamespaces): Only compute namespaces from
3494 loaded assemblies here, not the namespaces from the assembly we're
3495 currently compiling.
3497 2003-07-08 Martin Baulig <martin@ximian.com>
3499 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
3501 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3503 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
3506 I thought about the memory savings here, but LookupTypeReflection
3507 is used under already very constrained scenarios. Compiling
3508 corlib or mcs only exposes one hit, so it would not really reduce
3509 any memory consumption.
3511 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3513 * typemanager.cs: fixes bug #45889 by only adding public types from
3514 other assemblies to the list of known types.
3516 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3518 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
3519 on the type we resolved.
3521 2003-07-05 Martin Baulig <martin@ximian.com>
3523 * pending.cs (PendingImplementation.ParentImplements): Don't
3524 create the proxy if the parent is abstract.
3526 * class.cs (TypeContainer.DefineIndexers): Process explicit
3527 interface implementations first. Fixes #37714.
3529 2003-07-04 Miguel de Icaza <miguel@ximian.com>
3531 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
3532 defined recursively; but since we modify the input parameters
3533 (left is set to `this' temporarily), we reset this value if the
3534 left_is_explicit is false, which gives the original semantics to
3537 * literal.cs (NullPointer): new class used to represent a null
3538 literal in a pointer context.
3540 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
3541 type is a pointer, use a NullPointer object instead of a
3542 NullLiteral. Closes 43687
3544 (ExplicitConversion): Convert pointer values using
3545 the conv opcode to the proper type.
3547 * ecore.cs (New): change ValueTypeVariable property into a method,
3548 that returns whether the valuetype is suitable for being used.
3550 * expression.cs (Binary.DoNumericPromotions): Only return if we
3551 the int constant was a valid uint, and we can return both left and
3552 right as uints. If not, we continue processing, to trigger the
3553 type conversion. This fixes 39018.
3555 * statement.cs (Block.EmitMeta): During constant resolution, set
3556 the CurrentBlock property on the emitcontext, so that we resolve
3557 constants propertly.
3559 2003-07-02 Martin Baulig <martin@ximian.com>
3561 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
3562 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
3564 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
3565 than emitting it here.
3567 * statement.cs: Fixed some more flow analysis bugs.
3569 2003-07-02 Martin Baulig <martin@ximian.com>
3571 * class.cs (MethodData.Define): When implementing interface
3572 methods, set Final unless we're Virtual.
3574 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
3575 check work for interface methods.
3577 2003-07-01 Martin Baulig <martin@ximian.com>
3579 * ecore.cs (EmitContext.This): Replaced this property with a
3580 GetThis() method which takes a Location argument. This ensures
3581 that we get the correct error location for a CS0188.
3583 2003-07-01 Miguel de Icaza <miguel@ximian.com>
3585 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
3586 ImplicitStandardConversion.
3588 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
3590 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
3592 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
3595 2003-06-30 Miguel de Icaza <miguel@ximian.com>
3597 * class.cs (Constructor.Define): Turn off initlocals for unsafe
3600 (MethodData.Define): Turn off initlocals for unsafe methods.
3602 2003-06-29 Miguel de Icaza <miguel@ximian.com>
3604 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
3605 complete; Fixes #37521.
3607 * delegate.cs: Use Modifiers.TypeAttr to compute the
3608 TypeAttributes, instead of rolling our own. This makes the flags
3609 correct for the delegates.
3611 2003-06-28 Miguel de Icaza <miguel@ximian.com>
3613 * class.cs (Constructor.Define): Set the private flag for static
3614 constructors as well.
3616 * cs-parser.jay (statement_expression): Set the return value to
3617 null, to avoid a crash when we catch an error.
3619 2003-06-24 Miguel de Icaza <miguel@ximian.com>
3621 * cs-parser.jay: Applied patch from Jackson that adds support for
3622 extern and unsafe modifiers to destructor declarations.
3624 * expression.cs: Report error 21 if the user is trying to index a
3627 * driver.cs: Add an error message, suggested by the bug report.
3629 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
3630 if we do not have a ": this ()" constructor initializer. Fixes 45149
3632 2003-06-14 Miguel de Icaza <miguel@ximian.com>
3634 * namespace.cs: Add some information to reduce FAQs.
3636 2003-06-13 Miguel de Icaza <miguel@ximian.com>
3638 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
3639 underlying enumeration types. Fixes #43915.
3641 * expression.cs: Treat ushort/short as legal values to be used in
3644 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
3646 * delegate.cs: transfer custom attributes for paramenters from
3647 the delegate declaration to Invoke and BeginInvoke.
3649 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
3651 * attribute.cs: handle custom marshalers and emit marshal info
3654 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
3656 * makefile.gnu: Added anonymous.cs to the compiler sources.
3658 2003-05-28 Miguel de Icaza <miguel@ximian.com>
3660 * iterators.cs: Change the name of the proxy class to include two
3663 * cs-parser.jay: Update grammar to include anonymous methods.
3665 * anonymous.cs: new file.
3667 2003-05-27 Miguel de Icaza <miguel@ximian.com>
3669 * class.cs (Field.Define): Add missing test for pointers and
3672 2003-05-27 Ravi Pratap <ravi@ximian.com>
3674 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
3675 we use the stobj opcode.
3677 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
3678 since it wasn't the correct fix.
3680 It still is puzzling that we are required to use stobj for IntPtr
3681 which seems to be a ValueType.
3683 2003-05-26 Miguel de Icaza <miguel@ximian.com>
3685 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
3686 during regular simple name resolution. Now, the trick is that
3687 instead of returning for processing the simplename, we do a
3688 TypeManager.LookupType (ie, a rooted lookup as opposed to a
3689 contextual lookup type). If a match is found, return that, if
3690 not, return for further composition.
3692 This fixes long-standing 30485.
3694 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3695 using the address to initialize an object, do an Stobj instead of
3696 using the regular Stelem.
3698 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
3699 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
3700 Because if we are a BaseIndexerAccess that value will be true.
3703 * statement.cs (GotoCase.Resolve): Return after reporting an
3704 error, do not attempt to continue.
3706 * expression.cs (PointerArithmetic.Emit): If our operand is a
3707 long, convert our constants to match the operand before
3708 multiplying. Convert to I type before adding. Fixes 43670.
3710 2003-05-14 Ravi Pratap <ravi@ximian.com>
3712 * enum.cs (ImplicitConversionExists) : Rename to
3713 ImplicitEnumConversionExists to remove ambiguity.
3715 * ecore.cs (NullCast): New type of cast expression class which
3716 basically is very similar to EmptyCast with the difference being
3717 it still is a constant since it is used only to cast a null to
3721 * convert.cs (ImplicitReferenceConversion): When casting a null
3722 literal, we return a NullCast.
3724 * literal.cs (NullLiteralTyped): Remove - I don't see why this
3725 should be around anymore.
3727 The renaming (reported was slightly wrong). Corrections:
3729 ConvertImplicitStandard -> ImplicitConversionStandard
3730 ConvertExplicitStandard -> ExplicitConversionStandard
3732 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3733 before passing them in !
3735 * convert.cs (ImplicitConversionStandard): When comparing for
3736 equal expr and target types, ensure that expr is not a
3739 In general, we must not be checking (expr_type ==
3740 target_type) in the top level conversion methods
3741 (ImplicitConversion, ExplicitConversion etc). This checking is
3742 done in the methods that they delegate to.
3744 2003-05-20 Miguel de Icaza <miguel@ximian.com>
3746 * convert.cs: Move Error_CannotConvertType,
3747 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3748 ImplicitNumericConversion, ImplicitConversionExists,
3749 ImplicitUserConversionExists, StandardConversionExists,
3750 FindMostEncompassedType, FindMostSpecificSource,
3751 FindMostSpecificTarget, ImplicitUserConversion,
3752 ExplicitUserConversion, GetConversionOperators,
3753 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3754 TryImplicitIntConversion, Error_CannotConvertImplicit,
3755 ConvertImplicitRequired, ConvertNumericExplicit,
3756 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3757 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3760 Perform the following renames:
3762 StandardConversionExists -> ImplicitStandardConversionExists
3763 ConvertImplicit -> ImplicitConversion
3764 ConvertImplicitStandard -> ImplicitStandardConversion
3765 TryImplicitIntConversion -> ImplicitIntConversion
3766 ConvertImplicitRequired -> ImplicitConversionRequired
3767 ConvertNumericExplicit -> ExplicitNumericConversion
3768 ConvertReferenceExplicit -> ExplicitReferenceConversion
3769 ConvertExplicit -> ExplicitConversion
3770 ConvertExplicitStandard -> ExplicitStandardConversion
3772 2003-05-19 Martin Baulig <martin@ximian.com>
3774 * statement.cs (TypeInfo.StructInfo): Made this type protected.
3775 (TypeInfo): Added support for structs having structs as fields.
3777 * ecore.cs (FieldExpr): Implement IVariable.
3778 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3779 VariableInfo for the field.
3781 2003-05-18 Martin Baulig <martin@ximian.com>
3783 * expression.cs (This.DoResolve): Report a CS0027 if we're
3784 emitting a field initializer.
3786 2003-05-18 Martin Baulig <martin@ximian.com>
3788 * expression.cs (This.ResolveBase): New public function.
3789 (This.DoResolve): Check for CS0188.
3791 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3794 * ecore.cs (MethodGroupExpr.DoResolve): Set the
3795 `instance_expression' to null if we don't have any non-static
3798 2003-05-18 Martin Baulig <martin@ximian.com>
3800 Reworked the way how local variables and parameters are handled by
3801 the flow analysis code.
3803 * statement.cs (TypeInfo, VariableMap): New public classes.
3804 (VariableInfo): New public class. This is now responsible for
3805 checking whether a variable has been assigned. It is used for
3806 parameters and local variables.
3807 (Block.EmitMeta): Take the InternalParameters as argument; compute
3808 the layout of the flow vectors here.
3809 (Block.LocalMap, Block.ParameterMap): New public properties.
3810 (FlowBranching): The .ctor doesn't get the InternalParameters
3811 anymore since Block.EmitMeta() now computes the layout of the flow
3813 (MyStructInfo): This class is now known as `StructInfo' and nested
3814 in `TypeInfo'; we don't access this directly anymore.
3816 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3817 property and removed IsAssigned(), IsFieldAssigned(),
3818 SetAssigned() and SetFieldAssigned(); we now call them on the
3819 VariableInfo so we don't need to duplicate this code everywhere.
3821 * expression.cs (ParameterReference): Added `Block block' argument
3823 (LocalVariableReference, ParameterReference, This): The new
3824 VariableInfo class is now responsible for all the definite
3827 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3828 IsParameterAssigned, SetParameterAssigned): Removed.
3830 2003-05-18 Martin Baulig <martin@ximian.com>
3832 * typemanager.cs (InitCoreTypes): Try calling
3833 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3834 the 3-args-version. Corlib now also needs our `void_type'.
3835 (GetMethod): Added overloaded version which takes an optional
3836 `bool report_errors' to allow lookups of optional methods.
3838 2003-05-12 Martin Baulig <martin@ximian.com>
3840 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3841 only used for locals and not for parameters.
3843 2003-05-12 Miguel de Icaza <miguel@ximian.com>
3845 * support.cs (InternalParameters.ParameterType): Return the
3846 ExternalType of the parameter.
3848 * parameter.cs (Parameter.ExternalType): drop the two arguments,
3851 2003-05-11 Miguel de Icaza <miguel@ximian.com>
3853 * class.cs (MethodData.Define): Do not set the `newslot' on
3854 interface members, if they are also flagged as "override".
3856 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3857 better code for ++i and i++. This only works for static fields
3858 and local variables.
3860 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3861 want to pull the DeclSpace out of the builder_to_declspace instead
3862 of the TypeBuilder (like in TypeContainer.FindMembers).
3864 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3865 instead of LookupTypeContainer. Fixes the crash on .NET for
3866 looking up interface members.
3868 * const.cs: Create our own emit context during the Definition
3869 stage, so that constants are evaluated in the proper context, when
3870 a recursive definition happens.
3872 2003-05-11 Martin Baulig <martin@ximian.com>
3874 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
3875 new block for a switch section.
3876 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3877 the adding/lookup in the switch block. Fixes #39828.
3879 2003-05-09 Miguel de Icaza <miguel@ximian.com>
3881 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3882 functionality: I needed to convert the data after I had performed
3883 the add/sub operation into the operands type size.
3885 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3886 pass the type for the box operation, otherwise the resulting
3887 object would have been of type object.
3889 (BoxedCast): Add constructor to specify the type to box as.
3891 2003-05-07 Miguel de Icaza <miguel@ximian.com>
3893 * iterators.cs: I was reusing the `count' variable inadvertently,
3894 take steps to not allow this to happen.
3896 2003-05-06 Miguel de Icaza <miguel@ximian.com>
3898 * attribute.cs (Attribute.Resolve): Params attributes are encoded
3899 by creating an array at the point where the params starts and
3900 putting all those arguments there, then adjusting the size of the
3903 2003-05-05 Miguel de Icaza <miguel@ximian.com>
3905 * expression.cs (New.AddressOf): Implement interface
3906 IMemoryLocation. This is used when the `new' operator is used in
3907 the context of an invocation to a method on a value type.
3909 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3912 * namespace.cs: Also check the using aliases here.
3914 * driver.cs: Move the test for using validity after the types have
3915 been entered, so we do a single pass that also includes the using
3918 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3919 in the regular case. CreateSiblingForFinally is doing extra
3922 * attribute.cs (GetAttributeArgumentExpression): Store the result
3923 on an out value, and use the return value to indicate failure
3924 instead of using null (which is a valid return for Constant.GetValue).
3926 * statement.cs: Perform the analysis flow for the increment
3927 portion after the statement, because this will be the real flow of
3928 execution. Fixes #42385
3930 * codegen.cs (EmitContext.EmitArgument,
3931 EmitContext.EmitStoreArgument): New helper functions when the
3932 RemapToProxy flag is set.
3934 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3937 Add support for remapping parameters.
3939 * iterators.cs: Propagate parameter values; Store parameter
3940 values in the proxy classes.
3942 2003-05-04 Miguel de Icaza <miguel@ximian.com>
3944 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
3945 need a proxy reference; I do not know what I was thinking
3947 * cs-parser.jay (constructor_initializer): catch another error,
3948 and display nice message.
3950 (field_declaration): catch void field declaration
3951 to flag a better error.
3953 * class.cs (MemberBase.CheckBase): Report an error instead of a
3954 warning if a new protected member is declared in a struct.
3955 (Field.Define): catch the error of readonly/volatile.
3957 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3959 (FieldExpr.AddressOf): ditto. Catch error where the address of a
3960 volatile variable is taken
3962 2003-05-02 Miguel de Icaza <miguel@ximian.com>
3964 * statement.cs (Fixed.Resolve): Report an error if we are not in
3967 2003-05-01 Miguel de Icaza <miguel@ximian.com>
3969 * typemanager.cs: reuse the code that handles type clashes for
3970 delegates and enumerations.
3972 * class.cs (Report28): Always report.
3974 * expression.cs (EncodeAsAttribute): Allow nulls here.
3976 2003-04-28 Miguel de Icaza <miguel@ximian.com>
3978 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3979 the functionality for testing whether an expression is valid for
3980 an attribute here. Also handle the case of arrays of elements
3983 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3984 encoding a linear array into an array of objects that are suitable
3985 to be passed to an CustomAttributeBuilder.
3987 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3989 * ecore.cs: (FieldExpr): Handle field remapping here.
3991 * iteratators.cs: Pass the instance variable (if the method is an
3992 instance method) to the constructors, so we can access the field
3993 variables on the class.
3995 TODO: Test this with structs. I think the THIS variable on
3996 structs might have to be a pointer, and not a refenrece
3998 2003-04-27 Miguel de Icaza <miguel@ximian.com>
4000 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
4001 local variables to fields in a proxy class.
4003 * iterators.cs (PopulateProxy): Rename our internal fields to
4005 Create a <THIS> field if we are an instance method, so we can
4006 reference our parent container variables.
4007 (MapVariable): Called back from the EmitContext code to enter a
4008 new variable to field mapping into the proxy class (we just create
4012 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
4013 for using the remapped locals to fields.
4015 I placed the code here, because that gives the same semantics to
4016 local variables, and only changes the Emit code.
4018 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
4019 statements inside iterators.
4020 (VariableInfo): Add a FieldBuilder for the cases when we are
4021 remapping local variables to fields in a proxy class
4023 * ecore.cs (SimpleNameResolve): Avoid testing two times for
4024 current_block != null.
4026 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
4027 not cope with strings, as it has been moved to the
4028 TableSwitchEmit. Fixed bug in switch generation.
4030 * expression.cs (New.DoResolve): Provide more context for the user
4031 when reporting an error.
4033 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
4036 * expression.cs (MemberAccess.DoResolve): When we get a type back,
4037 check the permissions for it. Note than in a type-resolution
4038 context the check was already present in DeclSpace.ResolveType,
4039 but was missing from the MemberAccess.
4041 (ArrayCreation.CheckIndices): warn if the user has
4042 more nested levels of expressions, but there are no more
4043 dimensions specified. Avoids crash on bug 41906.
4045 2003-04-26 Miguel de Icaza <miguel@ximian.com>
4047 * statement.cs (Block): replace Implicit bool, for a generic
4049 New flag: `Unchecked'. This is used during the EmitMeta phase
4050 (which is out-of-line with the regular Resolve/Emit process for a
4051 statement, as this is done ahead of time, but still gets a chance
4052 to call constant resolve).
4054 (Block.Flags): new enum for adding a new flag.
4056 (Block.EmitMeta): track the state of unchecked.
4058 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
4059 to enable constant resolution to work there as well.
4061 2003-04-22 Miguel de Icaza <miguel@ximian.com>
4063 * typemanager.cs (ienumerable_type): Also look up
4064 System.Collections.IEnumerable.
4066 2003-04-21 Miguel de Icaza <miguel@ximian.com>
4068 TODO: Test more than one conditional per method.
4070 * class.cs (Indexer.Define): Report the location where the user is
4071 referencing the unsupported feature.
4073 (MethodData): Overload the use of `conditionals' to
4074 minimize the creation of needless ArrayLists. This saves roughly
4075 212kb on my machine.
4077 (Method): Implement the new IIteratorContainer interface.
4078 (Method.SetYields): Implement the method by setting the ModFlags
4079 to contain METHOD_YIELDS.
4081 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
4082 which just got set to null.
4084 * iterators.cs: New file.
4086 (Yield, YieldBreak): New statements.
4088 * statement.cs (Return.Resolve): Flag an error if we are used in
4091 * codegen.cs (InIterator): New flag set if the code is being
4092 compiled in an iterator method.
4094 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
4095 internal modifier, and we just use it to avoid adding extra
4096 fields, as this is seldom used.
4098 * cs-parser.jay: Add yield_statement (yield and yield break).
4100 * driver.cs: New flag -v2 to turn on version 2 features.
4102 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
4103 hashtable when v2 is enabled.
4105 2003-04-20 Miguel de Icaza <miguel@ximian.com>
4107 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
4108 there is already a namespace defined with this name.
4110 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
4111 people upgraded their corlibs.
4113 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
4114 always use fully qualified types, no need to use the compiler
4117 (TypeManager.IsNamespace): Use binarysearch.
4119 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
4120 AddDelegate): I did not quite use the new IsValid API properly: I
4121 have to pass the short-name and the fullname. I was passing only
4122 the basename instead of the fullname sometimes.
4124 (TypeContainer.DefineType): call NamespaceClash.
4126 * interface.cs (Interface.DefineType): use NamespaceClash before
4129 * delegate.cs (Delegate.DefineType): use NamespaceClash before
4132 * enum.cs: (Enum.DefineType): use NamespaceClash before
4135 * typemanager.cs (: 3-line patch that gives us some tasty 11%
4136 speed increase. First, use the negative_hits cache when we get a
4137 negative. Second, add the type with its full original name
4138 instead of the new . and + encoded name (reflection uses + to
4139 separate type from a nested type). Use LookupTypeReflection
4140 directly which bypasses the type->name hashtable (that we already
4141 know does not contain the type.
4143 * decl.cs (DeclSpace.ResolveTypeExpr): track the
4144 location/container type.
4146 * driver.cs: When passing utf8, use directly the UTF8Encoding.
4148 2003-04-19 Miguel de Icaza <miguel@ximian.com>
4150 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
4152 * delegate.cs (NewDelegate.Resolve): Test whether an instance
4153 method is being referenced in the method group from a static
4154 context, and report error 120 if so.
4156 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
4159 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
4160 is created, we create the A namespace).
4162 * cs-parser.jay: A namespace also introduces a DeclarationFound.
4165 2003-04-18 Miguel de Icaza <miguel@ximian.com>
4167 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
4168 invocation to ModuleBuilder.GetType with the same values will
4169 return a new type instance, so we need to cache its return
4172 * expression.cs (Binary.ResolveOperator): Only allow the compare
4173 operators on enums if they are of the same type.
4175 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
4176 types of ValueType on their own case. Before we were giving them
4177 the same treatment as objects.
4179 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
4180 fullname. Short name is used to compare against container name.
4181 Fullname is used to check against defined namespace names.
4183 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
4184 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
4186 (Method.CheckBase): Call parent.
4187 (MemberBase.CheckBase): Check for protected members on sealed
4189 (PropertyBase.CheckBase): Call parent.
4190 (Field.Define): Call parent.
4192 * report.cs: Negative error codes are now mapped to 8000 - code,
4193 so that the display is render more nicely.
4195 * typemanager.cs: Do not use try/catch, instead report a regular
4198 (GetPointerType, GetReferenceType): These methods provide
4199 mechanisms to obtain the T* and T& from a T. We had the code
4200 previously scattered around the code base, and it also used
4201 TypeManager.LookupType that would go through plenty of caches.
4202 This one goes directly to the type source.
4204 In some places we did the Type.GetType followed by
4205 ModuleBuilder.GetType, but not in others, so this unifies the
4208 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
4209 statements now that we have namespace information.
4211 * typemanager.cs (IsNamespace): New method, returns whether the
4212 string presented is a namespace or not.
4214 (ComputeNamespaces): New public entry point, computes the list of
4215 available namespaces, using the GetNamespaces API call in Mono, or
4216 the slower version in MS.NET.
4218 Now before we start the semantic analysis phase, we have a
4219 complete list of namespaces including everything that the user has
4222 Deleted old code to cache namespaces in .nsc files.
4224 2003-04-17 Miguel de Icaza <miguel@ximian.com>
4226 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
4227 class/struct location definition Location for the implicit
4228 constructor location.
4230 (Operator.Define): Use the location of the operator for the
4231 implicit Method definition.
4233 (Constructor.Emit): use the constructor location for the implicit
4234 base initializer constructor.
4236 * ecore.cs: Remove ITypeExpression. This interface is now gone,
4237 and the Expression class now contains two new methods:
4239 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
4240 isolate type lookup from the rest of the resolution process.
4242 Since we use Expressions to hold type definitions due to the way
4243 we parse the input we have historically overloaded Resolve to
4244 perform the Type lookups if a special flag is passed. Now this is
4245 eliminated and two methods take their place.
4247 The differences in the two methods between xStep and xTerminal is
4248 that xStep is involved in our current lookup system that uses
4249 SimpleNames to compose a name, while xTerminal is used just to
4250 catch the case where the simplename lookup failed.
4252 2003-04-16 Miguel de Icaza <miguel@ximian.com>
4254 * expression.cs (ResolveMemberAccess): Remove redundant code.
4255 TypeExpr expressions are always born fully resolved.
4257 * interface.cs (PopulateMethod): Do not lookup the types twice.
4258 We were doing it once during SemanticAnalysis and once during
4261 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
4262 in local variable type definitions, were being returned as a
4263 SimpleName (we decomposed everything into a string), that is
4264 because primary_expression was being used instead of a type in the
4265 grammar (reduce/reduce conflicts).
4267 The part that was wrong is that we converted the expression into a
4268 string (an oversimplification in one hand, compounded with primary
4269 expressions doing string concatenation).
4275 Would return "A.B.C[]" as a SimpleName. This stopped things like
4276 using clauses from working on this particular context. And a type
4277 was being matched directly against "A.B.C[]".
4279 We now use the correct approach, and allow for ComposedCast to be
4280 part of the unary expression. So the "A.B.C []" become a composed
4281 cast of "A.B.C" (as a nested group of MemberAccess with a
4282 SimpleName at the end) plus the rank composition "[]".
4286 2003-04-10 Miguel de Icaza <miguel@ximian.com>
4288 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
4289 for the access level checking.
4291 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
4292 `TypeContainer container', because I kept getting confused when I
4293 was debugging this code.
4295 * expression.cs (Indexers): Instead of tracking getters/setters,
4296 we now track them in parallel. We create one arraylist less, but
4297 most importantly it is possible now for the LValue code to find a
4298 matching get for a set.
4300 (IndexerAccess.DoResolveLValue): Update the code.
4301 GetIndexersForType has been modified already to extract all the
4302 indexers from a type. The code assumed it did not.
4304 Also make the code set the correct return type for the indexer.
4305 This was fixed a long time ago for properties, but was missing for
4306 indexers. It used to be void_type.
4308 (Binary.Emit): Test first for doubles instead of
4309 floats, as they are more common.
4311 (Binary.EmitBranchable): Use the .un version of the branch opcodes
4312 when dealing with floats and the <=, >= operators. This fixes bug
4315 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
4316 to load the array value by emitting a load on the foreach variable
4317 type. This was incorrect.
4319 We now emit the code to load an element using the the array
4320 variable type, and then we emit the conversion operator.
4324 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
4326 * attribute.cs: Avoid allocation of ArrayLists in the common case.
4328 2003-04-09 Miguel de Icaza <miguel@ximian.com>
4330 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
4331 test for protection before we test for signatures.
4333 (MethodSignature.ToString): implement.
4335 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
4336 to the case where we reduced into a LongConstant.
4338 * decl.cs (CheckAccessLevel): If the type is an array, we can not
4339 depend on whether the information is acurrate, because the
4340 Microsoft runtime will always claim that the array type is public,
4341 regardless of the real state.
4343 If the type is a pointer, another problem happens: the type is
4344 reported as non-public in Microsoft.
4346 In both cases we have to call CheckAccessLevel recursively with
4347 the underlying type as the argument to be tested.
4349 2003-04-08 Miguel de Icaza <miguel@ximian.com>
4351 * assign.cs (Assign.Emit): If we are dealing with a compound
4352 assignment expression, we should use the code path that stores the
4353 intermediate result in a temporary value. This fixes #40903.
4355 *expression.cs (Indirection.ToString): Provide ToString method for
4358 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
4360 * class.cs: Null out fields holding references to Block objects so
4361 they can be garbage collected.
4363 * expression.cs (OverloadResolve): Remove unused local.
4365 2003-04-07 Martin Baulig <martin@ximian.com>
4367 * codegen.cs (EmitContext.CurrentFile): New public field.
4368 (EmitContext.Mark): Use the CurrentFile to check whether the
4369 location is in the correct file.
4370 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
4372 2003-04-07 Martin Baulig <martin@ximian.com>
4374 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
4376 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
4377 location. [FIXME: The location argument which gets passed to this
4378 method is sometimes wrong!]
4380 2003-04-07 Nick Drochak <ndrochak@gol.com>
4382 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
4384 2003-04-07 Miguel de Icaza <miguel@ximian.com>
4386 * expression.cs (Indirection.EmitAssign): We were using the
4387 temporary, but returning immediately instead of continuing the
4390 2003-04-06 Martin Baulig <martin@ximian.com>
4392 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
4393 if it's a nested child, but also deriving from the outer class.
4396 * typemanager.cs (IsNestedChildOf): Make this work if it's a
4397 nested child, but also deriving from the outer class. See
4399 (FilterWithClosure): We may access private members of the outer
4400 class if we're a nested child and deriving from the outer class.
4401 (RealMemberLookup): Only set `closure_private_ok' if the
4402 `original_bf' contained BindingFlags.NonPublic.
4404 2003-04-05 Martin Baulig <martin@ximian.com>
4406 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
4408 2003-04-02 Miguel de Icaza <miguel@ximian.com>
4410 * class.cs (Event.Define): Do not allow abstract events to have
4413 2003-04-01 Miguel de Icaza <miguel@ximian.com>
4415 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
4416 block in event declarations.
4418 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
4419 value type, get its address.
4421 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
4422 leaving a class on the stack instead of a boolean value (int
4423 0/1). Change the code so we compare against null, and then the
4424 result against zero.
4426 * class.cs (TypeContainer.GetClassBases): We were checking for the
4427 parent class being sealed too late.
4429 * expression.cs (Binary.Emit): For <= and >= when dealing with
4430 floating point values, use cgt.un and clt.un instead of cgt and
4433 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
4435 * statement.cs: Apply the same optimization as MS: skip the
4436 GetEnumerator returning an IEnumerator, and use the one returning a
4437 CharEnumerator instead. This allows us to avoid the try-finally block
4440 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
4442 * cs-parser.jay: Attributes cannot be applied to
4443 namespaces. Fixes #40473
4445 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4448 (Add*): check if the name is valid using the full name for constants,
4449 fields, properties and events.
4451 2003-03-28 Miguel de Icaza <miguel@ximian.com>
4453 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
4454 char constants to be part of the enumeration.
4456 * expression.cs (Conditional.DoResolve): Add support for operator
4457 true. Implements the missing functionality from 14.12
4459 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
4460 operator true/false as required by the spec.
4462 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
4463 implicit conversion to boolean.
4465 * statement.cs (Statement.ResolveBoolean): A boolean expression is
4466 also one where the type implements `operator true'.
4468 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
4469 get an expression that will invoke operator true based on an
4472 (GetConversionOperators): Removed the hack that called op_True
4475 (Expression.ResolveBoolean): Move this from Statement.
4477 2003-03-17 Miguel de Icaza <miguel@ximian.com>
4479 * ecore.cs (FieldExpr): do not allow initialization of initonly
4480 fields on derived classes
4482 2003-03-13 Martin Baulig <martin@ximian.com>
4484 * statement.cs (Block.Emit): Call ig.BeginScope() and
4485 ig.EndScope() when compiling with debugging info; call
4486 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
4488 2003-03-08 Miguel de Icaza <miguel@ximian.com>
4490 * expression.cs (Indexers): Do not construct immediately, allow
4491 for new members to be appended as we go. Fixes 38143
4493 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4495 * expression.cs: save/restore context when resolving an unchecked
4498 2003-03-05 Miguel de Icaza <miguel@ximian.com>
4500 * cfold.cs: Catch division by zero in modulus operator during
4503 2003-03-03 Miguel de Icaza <miguel@ximian.com>
4505 * interface.cs (Interface.DefineMembers): Avoid defining members
4508 2003-02-27 Miguel de Icaza <miguel@ximian.com>
4510 * driver.cs: handle the +/- options for -noconfig
4512 * statement.cs (Unckeched.Resolve): Also track the state of
4513 unchecked in the Resolve phase.
4515 2003-02-27 Martin Baulig <martin@ximian.com>
4517 * ecore.cs (Expression.MemberLookup): Don't create a
4518 MethodGroupExpr for something which is not a method. Fixes #38291.
4520 2003-02-25 Miguel de Icaza <miguel@ximian.com>
4522 * class.cs (MemberBase.CheckParameters): Also check that the type
4523 is unmanaged if it is a pointer.
4525 * expression.cs (SizeOf.Resolve): Add location information.
4527 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
4528 a managed type is declared.
4530 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
4531 parameter modifiers as well. Fixes bug 38606
4533 * class.cs: Very sad. Am backing out the speed up changes
4534 introduced by the ArrayList -> Array in the TypeContainer, as they
4535 were not actually that much faster, and introduced a bug (no error
4536 reports on duplicated methods).
4538 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
4539 source first, this will guarantee that we have a valid expression
4540 before calling in lower levels functions that will require a
4541 resolved object. Then use this original_source in the
4542 target.ResolveLValue instead of the original source that was
4545 Another change. Use target.Resolve instead of LValueResolve.
4546 Although we are resolving for LValues, we will let the Assign code
4547 take care of that (it will be called again from Resolve). This
4548 basically allows code like this:
4550 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
4551 class Y { void A (X x) { x [0] += o; }
4553 The problem was that the indexer was trying to resolve for
4554 set_Item (idx, object o) and never finding one. The real set_Item
4555 was set_Item (idx, X). By delaying the process we get the right
4560 2003-02-23 Martin Baulig <martin@ximian.com>
4562 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
4563 while calling DoEmit ().
4565 * codegen.cs (EmitContext.Mark): Don't mark locations in other
4566 source files; if you use the #line directive inside a method, the
4567 compiler stops emitting line numbers for the debugger until it
4568 reaches the end of the method or another #line directive which
4569 restores the original file.
4571 2003-02-23 Martin Baulig <martin@ximian.com>
4573 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
4575 2003-02-23 Martin Baulig <martin@ximian.com>
4577 * statement.cs (Block.AddChildVariableNames): We need to call this
4578 recursively, not just for our immediate children.
4580 2003-02-23 Martin Baulig <martin@ximian.com>
4582 * class.cs (Event.Define): Always make the field private, like csc does.
4584 * typemanager.cs (TypeManager.RealMemberLookup): Make events
4585 actually work, fixes bug #37521.
4587 2003-02-23 Miguel de Icaza <miguel@ximian.com>
4589 * delegate.cs: When creating the various temporary "Parameters"
4590 classes, make sure that we call the ComputeAndDefineParameterTypes
4591 on those new parameters (just like we do with the formal ones), to
4592 allow them to be resolved in the context of the DeclSpace.
4594 This fixes the bug that Dick observed in Bugzilla #38530.
4596 2003-02-22 Miguel de Icaza <miguel@ximian.com>
4598 * expression.cs (ResolveMemberAccess): When resolving a constant,
4599 do not attempt to pull a constant if the value was not able to
4600 generate a valid constant.
4602 * const.cs (LookupConstantValue): Do not report more errors than required.
4604 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4606 * expression.cs: fixes bug #38328.
4608 2003-02-18 Miguel de Icaza <miguel@ximian.com>
4610 * class.cs: Changed all the various members that can be part of a
4611 class from being an ArrayList to be an Array of the right type.
4612 During the DefineType type_list, interface_list, delegate_list and
4613 enum_list are turned into types, interfaces, delegates and enums
4616 And during the member population, indexer_list, event_list,
4617 constant_list, field_list, instance_constructor_list, method_list,
4618 operator_list and property_list are turned into their real arrays.
4620 Although we could probably perform this operation earlier, for
4621 good error reporting we need to keep the lists and remove the
4622 lists for longer than required.
4624 This optimization was triggered by Paolo profiling the compiler
4625 speed on the output of `gen-sample-program.pl' perl script.
4627 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
4628 not crash in methods like MemberLookupFailed that use this field.
4630 This problem arises when the compiler fails to resolve a type
4631 during interface type definition for example.
4633 2003-02-18 Miguel de Icaza <miguel@ximian.com>
4635 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
4636 inherit from System.Object, so we have to stop at null, not only
4637 when reaching System.Object.
4639 2003-02-17 Miguel de Icaza <miguel@ximian.com>
4641 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
4642 DeclaredOnly because the parent indexer might have had a different
4643 name, but did not loop until the top of the hierarchy was reached.
4645 The problem this one fixes is 35492: when a class implemented an
4646 indexer from an interface, we were getting the interface method
4647 (which was abstract) and we were flagging an error (can not invoke
4650 This also keeps bug 33089 functioning, and test-148 functioning.
4652 * typemanager.cs (IsSpecialMethod): The correct way of figuring
4653 out if a method is special is to see if it is declared in a
4654 property or event, or whether it is one of the predefined operator
4655 names. This should fix correctly #36804.
4657 2003-02-15 Miguel de Icaza <miguel@ximian.com>
4659 The goal here is to remove the dependency on EmptyCast.Peel ().
4660 Killing it completely.
4662 The problem is that currently in a number of places where
4663 constants are expected, we have to "probe" for an EmptyCast, and
4664 Peel, which is not the correct thing to do, as this will be
4665 repetitive and will likely lead to errors.
4667 The idea is to remove any EmptyCasts that are used in casts that
4668 can be reduced to constants, so we only have to cope with
4671 This bug hunt was triggered by Bug 37363 and the desire to remove
4672 the duplicate pattern where we were "peeling" emptycasts to check
4673 whether they were constants. Now constants will always be
4676 * ecore.cs: Use an enumconstant here instead of wrapping with
4679 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
4680 throwing me off. By handling this we can get rid of a few hacks.
4682 * statement.cs (Switch): Removed Peel() code.
4684 2003-02-14 Miguel de Icaza <miguel@ximian.com>
4686 * class.cs: Location information for error 508
4688 * expression.cs (New.DoResolve): Add a guard against double
4689 resolution of an expression.
4691 The New DoResolve might be called twice when initializing field
4692 expressions (see EmitFieldInitializers, the call to
4693 GetInitializerExpression will perform a resolve on the expression,
4694 and later the assign will trigger another resolution
4696 This leads to bugs (#37014)
4698 * delegate.cs: The signature for EndInvoke should contain any ref
4699 or out parameters as well. We were not doing this in the past.
4701 * class.cs (Field.Define): Do not overwrite the type definition
4702 inside the `volatile' group. Turns out that volatile enumerations
4703 were changing the type here to perform a validity test, which
4706 2003-02-12 Miguel de Icaza <miguel@ximian.com>
4708 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4709 and structs, we do not want to load the instance variable
4711 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4712 enum_type has to be handled like an object reference (implicit
4713 conversions exists from this to object), but the regular IsClass
4714 and IsValueType tests will never return true for this one.
4716 Also we use TypeManager.IsValueType instead of type.IsValueType,
4717 just for consistency with the rest of the code (this is only
4718 needed if we ever use the construct exposed by test-180.cs inside
4719 corlib, which we dont today).
4721 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
4723 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4726 2003-02-09 Martin Baulig <martin@ximian.com>
4728 * namespace.cs (Namespace..ctor): Added SourceFile argument.
4729 (Namespace.DefineNamespaces): New static public method; this is
4730 called when we're compiling with debugging to add all namespaces
4733 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4734 pass it to the Namespace's .ctor.
4736 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4737 and MethodBase arguments; pass the namespace ID to the symwriter;
4738 pass the MethodBase instead of the token to the symwriter.
4739 (SymbolWriter.DefineNamespace): New method to add a namespace to
4742 2003-02-09 Martin Baulig <martin@ximian.com>
4744 * symbolwriter.cs: New file. This is a wrapper around
4745 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
4746 methods here in near future.
4748 2003-02-09 Martin Baulig <martin@ximian.com>
4750 * codegen.cs (EmitContext.Mark): Just pass the arguments to
4751 ILGenerator.MarkSequencePoint() which are actually used by the
4754 2003-02-09 Martin Baulig <martin@ximian.com>
4756 * location.cs (SourceFile): New public sealed class. This
4757 contains the name and an index which is used in the location's token.
4758 (Location): Reserve an appropriate number of bits in the token for
4759 the source file instead of walking over that list, this gives us a
4760 really huge performance improvement when compiling with debugging.
4762 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4763 `SourceFile' argument instead of a string.
4764 (Driver.ProcessFile): Add all the files via Location.AddFile(),
4765 but don't parse/tokenize here, we need to generate the list of all
4766 source files before we do that.
4767 (Driver.ProcessFiles): New static function. Parses/tokenizes all
4770 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4771 instead of a string.
4773 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4776 2003-02-09 Martin Baulig <martin@ximian.com>
4778 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4779 filename on `#line default'.
4781 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4783 * statement.cs: don't clear the pinned var when the fixed statement
4784 returns from the method (fixes bug#37752).
4786 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4788 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
4791 2003-02-07 Martin Baulig <martin@ximian.com>
4793 * driver.cs: Removed the `--debug-args' command line argument.
4795 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4796 automatically by the AsssemblyBuilder.
4797 (CodeGen.InitializeSymbolWriter): We don't need to call any
4798 initialization function on the symbol writer anymore. This method
4799 doesn't take any arguments.
4801 2003-02-03 Miguel de Icaza <miguel@ximian.com>
4803 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4804 from referenced assemblies as well.
4806 2003-02-02 Martin Baulig <martin@ximian.com>
4808 * class.cs (MethodData.Emit): Generate debugging info for external methods.
4810 2003-02-02 Martin Baulig <martin@ximian.com>
4812 * class.cs (Constructor.Emit): Open the symbol writer before
4813 emitting the constructor initializer.
4814 (ConstructorInitializer.Emit): Call ec.Mark() to allow
4815 single-stepping through constructor initializers.
4817 2003-01-30 Miguel de Icaza <miguel@ximian.com>
4819 * class.cs: Handle error 549: do not allow virtual methods in
4822 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4824 * decl.cs: Check access levels when resolving types
4826 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4828 * statement.cs: Add parameters and locals set in catch blocks that might
4829 return to set vector
4831 2003-01-29 Miguel de Icaza <miguel@ximian.com>
4833 * class.cs (Operator): Set the SpecialName flags for operators.
4835 * expression.cs (Invocation.DoResolve): Only block calls to
4836 accessors and operators on SpecialName methods.
4838 (Cast.TryReduce): Handle conversions from char constants.
4841 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4843 * statement.cs: small memory and time optimization in FlowBranching.
4845 2003-01-28 Pedro Mart <yoros@wanadoo.es>
4847 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4848 problem that the last fix but in the other sid (Set).
4850 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4851 access when there is no indexer in the hierarchy.
4853 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4855 * class.cs: Combine some if statements.
4857 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4859 * driver.cs: fixed bug #37187.
4861 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
4863 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4864 any indexer, it's needed to build a list with all the indexers in the
4865 hierarchy (AllGetters), else we have problems. Fixes #35653.
4867 2003-01-23 Miguel de Icaza <miguel@ximian.com>
4869 * class.cs (MethodData.Define): It is wrong for an interface
4870 implementation to be static in both cases: explicit and implicit.
4871 We were only handling this in one case.
4873 Improve the if situation there to not have negations.
4875 * class.cs (Field.Define): Turns out that we do not need to check
4876 the unsafe bit on field definition, only on usage. Remove the test.
4878 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4880 * driver.cs: use assembly.Location instead of Codebase (the latest
4881 patch made mcs fail when using MS assemblies).
4883 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
4885 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4886 get the path to *corlib.dll.
4888 2003-01-21 Nick Drochak <ndrochak@gol.com>
4892 * typemanager.cs: Remove compiler warnings
4894 2003-01-20 Duncan Mak <duncan@ximian.com>
4896 * AssemblyInfo.cs: Bump the version number to 0.19.
4898 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4900 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4902 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
4904 * class.cs (Constructor::Emit): Emit debugging info for constructors.
4906 2003-01-17 Miguel de Icaza <miguel@ximian.com>
4908 * cs-parser.jay: Small fix: we were not comparing the constructor
4909 name correctly. Thanks to Zoltan for the initial pointer.
4911 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4913 * cs-tokenizer.cs: Set file name when specified with #line
4915 2003-01-15 Miguel de Icaza <miguel@ximian.com>
4917 * cs-parser.jay: Only perform the constructor checks here if we
4918 are named like the class; This will help provider a better
4919 error. The constructor path is taken when a type definition is
4920 not found, but most likely the user forgot to add the type, so
4921 report that rather than the constructor error.
4923 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4925 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4928 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4930 * cs-parser.jay: Add cleanup call.
4932 2003-01-13 Duncan Mak <duncan@ximian.com>
4934 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4935 consistent with other methods.
4937 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4939 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4941 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4943 * attribute.cs: only set GuidAttr to true when we have a
4946 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4950 * typemanager.cs: fixes to allow mcs compile corlib with the new
4951 Type.IsSubclassOf fix.
4953 2003-01-08 Miguel de Icaza <miguel@ximian.com>
4955 * expression.cs (LocalVariableReference.DoResolve): Classify a
4956 constant as a value, not as a variable. Also, set the type for
4959 * cs-parser.jay (fixed_statement): take a type instead of a
4960 pointer_type, so we can produce a better error message later.
4962 * statement.cs (Fixed.Resolve): Flag types that are not pointers
4965 (For.DoEmit): Make inifinite loops have a
4966 non-conditional branch back.
4968 (Fixed.DoEmit): First populate the pinned variables, then emit the
4969 statement, then clear the variables. Before I was emitting the
4970 code once for each fixed piece.
4973 2003-01-08 Martin Baulig <martin@ximian.com>
4975 * statement.cs (FlowBranching.MergeChild): A break in a
4976 SWITCH_SECTION does not leave a loop. Fixes #36155.
4978 2003-01-08 Martin Baulig <martin@ximian.com>
4980 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4981 lives in the same number space than `param_map'. Fixes #36154.
4983 2003-01-07 Miguel de Icaza <miguel@ximian.com>
4985 * cs-parser.jay (constructor_declaration): Set the
4986 Constructor.ModFlags before probing for it. This makes the
4987 compiler report 514, 515 and 132 (the code was there, but got
4990 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4991 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4992 (GotoCase.Resolve): Set `Returns' to ALWAYS.
4994 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4996 * enum.cs: create the enum static fields using the enum type.
4998 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
5000 * class.cs: don't try to create the ParamBuilder for the return
5001 type if it's not needed (and handle it breaking for the ms runtime
5004 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
5006 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
5008 2002-12-29 Miguel de Icaza <miguel@ximian.com>
5010 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
5011 the command. This showed up while compiling the JANET source
5012 code, which used \r as its only newline separator.
5014 2002-12-28 Miguel de Icaza <miguel@ximian.com>
5016 * class.cs (Method.Define): If we are an operator (because it
5017 reuses our code), then set the SpecialName and HideBySig. #36128
5019 2002-12-22 Miguel de Icaza <miguel@ximian.com>
5021 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
5022 exception, report error 120 `object reference required'.
5024 * driver.cs: Add --pause option, used during to measure the size
5025 of the process as it goes with --timestamp.
5027 * expression.cs (Invocation.DoResolve): Do not allow methods with
5028 SpecialName to be invoked.
5030 2002-12-21 Miguel de Icaza <miguel@ximian.com>
5032 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
5033 number before adding it.
5035 2002-12-21 Ravi Pratap <ravi@ximian.com>
5037 * ecore.cs (StandardImplicitConversion): When in an unsafe
5038 context, we allow conversion between void * to any other pointer
5039 type. This fixes bug #35973.
5041 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
5043 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
5044 is not thrown when extensionless outputs are used
5046 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5048 * rootcontext.cs: fixed compilation of corlib.
5050 2002-12-19 Miguel de Icaza <miguel@ximian.com>
5052 * attribute.cs (Attributes.Contains): Add new method.
5054 * class.cs (MethodCore.LabelParameters): if the parameter is an
5055 `out' parameter, check that no attribute `[In]' has been passed.
5057 * enum.cs: Handle the `value__' name in an enumeration.
5059 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
5061 * decl.cs: Added special case to allow overrides on "protected
5064 2002-12-18 Ravi Pratap <ravi@ximian.com>
5066 * attribute.cs (Attributes.AddAttributeSection): Rename to this
5067 since it makes much more sense.
5069 (Attributes.ctor): Don't require a Location parameter.
5071 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
5073 * attribute.cs (ApplyAttributes): Remove extra Location parameters
5074 since we already have that information per attribute.
5076 * everywhere : make appropriate changes.
5078 * class.cs (LabelParameters): Write the code which actually
5079 applies attributes to the return type. We can't do this on the MS
5080 .NET runtime so we flag a warning in the case an exception is
5083 2002-12-18 Miguel de Icaza <miguel@ximian.com>
5085 * const.cs: Handle implicit null conversions here too.
5087 2002-12-17 Ravi Pratap <ravi@ximian.com>
5089 * class.cs (MethodCore.LabelParameters): Remove the extra
5090 Type [] parameter since it is completely unnecessary. Instead
5091 pass in the method's attributes so that we can extract
5092 the "return" attribute.
5094 2002-12-17 Miguel de Icaza <miguel@ximian.com>
5096 * cs-parser.jay (parse): Use Report.Error to flag errors instead
5097 of ignoring it and letting the compile continue.
5099 * typemanager.cs (ChangeType): use an extra argument to return an
5100 error condition instead of throwing an exception.
5102 2002-12-15 Miguel de Icaza <miguel@ximian.com>
5104 * expression.cs (Unary.TryReduce): mimic the code for the regular
5105 code path. Perform an implicit cast in the cases where we can
5106 implicitly convert to one of the integral types, and then reduce
5107 based on that constant. This fixes bug #35483.
5109 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5111 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
5113 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5115 * namespace.cs: fixed bug #35489.
5117 2002-12-12 Miguel de Icaza <miguel@ximian.com>
5119 * class.cs: Remove some dead code.
5121 * cs-parser.jay: Estimate the number of methods needed
5122 (RootContext.MethodCount);
5124 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
5125 numbers instead of StringBuilders.
5127 * support.cs (PtrHashtable): Add constructor with initial size;
5128 We can now reduce reallocations of the method table.
5130 2002-12-10 Ravi Pratap <ravi@ximian.com>
5132 * attribute.cs (ApplyAttributes): Keep track of the emitted
5133 attributes on a per-target basis. This fixes bug #35413.
5135 2002-12-10 Miguel de Icaza <miguel@ximian.com>
5137 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
5138 default to the Windows 1252 encoding.
5140 (UnixParseOption): Support version, thanks to Alp for the missing
5143 * AssemblyInfo.cs: Add nice assembly information.
5145 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
5148 * cs-parser.jay: Allow a trailing comma before the close bracked
5149 in the attribute_section production.
5151 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
5152 address of the instance was being taken, I will take this out,
5153 because we take the address of the object immediately here.
5155 2002-12-09 Ravi Pratap <ravi@ximian.com>
5157 * typemanager.cs (AreMultipleAllowed): Take care of the most
5158 obvious case where attribute type is not in the current assembly -
5161 2002-12-08 Miguel de Icaza <miguel@ximian.com>
5163 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
5164 definitions, instead of doing that afterwards.
5166 Also we use a nice little hack, depending on the constructor, we
5167 know if we are a "composed" name or a simple name. Hence, we
5168 avoid the IndexOf test, and we avoid
5170 * codegen.cs: Add code to assist in a bug reporter to track down
5171 the source of a compiler crash.
5173 2002-12-07 Ravi Pratap <ravi@ximian.com>
5175 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
5176 types have been emitted for a given element and flag an error
5177 if something which does not have AllowMultiple set is used more
5180 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
5181 attribute types and their corresponding AllowMultiple properties
5183 (AreMultipleAllowed): Check the property for a given type.
5185 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
5186 property in the case we have a TypeContainer.
5188 (Attributes.AddAttribute): Detect duplicates and just skip on
5189 adding them. This trivial fix catches a pretty gross error in our
5190 attribute emission - global attributes were being emitted twice!
5192 Bugzilla bug #33187 is now fixed.
5194 2002-12-06 Miguel de Icaza <miguel@ximian.com>
5196 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
5199 * expression.cs (Binary.ResolveOperator): I can only use the
5200 Concat (string, string, string) and Concat (string, string,
5201 string, string) if the child is actually a concatenation of
5204 2002-12-04 Miguel de Icaza <miguel@ximian.com>
5206 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
5207 context where we need a 2-character lookahead.
5209 * pending.cs (PendingImplementation): Rework so we can keep track
5210 of interface types all the time, and flag those which were
5211 implemented by parents as optional.
5213 2002-12-03 Miguel de Icaza <miguel@ximian.com>
5215 * expression.cs (Binary.ResolveOperator): Use
5216 String.Concat(string,string,string) or
5217 String.Concat(string,string,string,string) when possible.
5219 * typemanager: More helper methods.
5222 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
5224 * pending.cs: remove the bogus return from GetMissingInterfaces()
5225 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
5227 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5229 * namespace.cs: avoid duplicated 'using xxx' being added to
5230 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
5231 when we get more than one 'using' statement for the same namespace.
5232 Report a CS0105 warning for it.
5234 2002-11-30 Miguel de Icaza <miguel@ximian.com>
5236 * cs-tokenizer.cs (consume_identifier): use read directly, instead
5237 of calling getChar/putback, uses internal knowledge of it.
5239 (xtoken): Reorder tokenizer so most common patterns are checked
5240 first. This reduces the compilation time in another 5% (from 8.11s
5241 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
5243 The parsing time is 22% of the compilation in mcs, and from that
5244 64% is spent on the tokenization process.
5246 I tried using a binary search for keywords, but this is slower
5247 than the hashtable. Another option would be to do a couple of
5250 * Not use a StringBuilder, instead use an array of chars,
5251 with a set value. Notice that this way we could catch
5252 the 645 error without having to do it *afterwards*.
5254 * We could write a hand-parser to avoid the hashtable
5255 compares altogether.
5257 The identifier consumption process takes 37% of the tokenization
5258 time. Another 15% is spent on is_number. 56% of the time spent
5259 on is_number is spent on Int64.Parse:
5261 * We could probably choose based on the string length to
5262 use Int32.Parse or Int64.Parse and avoid all the 64-bit
5265 Another 3% is spend on wrapping `xtoken' in the `token' function.
5267 Handle 0xa0 as whitespace (#34752)
5269 2002-11-26 Miguel de Icaza <miguel@ximian.com>
5271 * typemanager.cs (IsCLRType): New routine to tell whether a type
5272 is one of the builtin types.
5274 Maybe it needs to use TypeCodes to be faster. Maybe we could use
5275 typecode in more places instead of doing pointer comparissions.
5276 We could leverage some knowledge about the way the typecodes are
5279 New code to cache namespaces in assemblies, it is currently not
5280 invoked, to be used soon.
5282 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
5284 * expression.cs (Binary.ResolveOperator): specially handle
5285 strings, and do not perform user-defined operator overloading for
5288 2002-11-24 Miguel de Icaza <miguel@ximian.com>
5290 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
5291 internalcall as it is a pretty simple operation; Avoid whenever
5292 possible to call Char.IsLetter.
5294 (consume_identifier): Cut by half the number of
5295 hashtable calls by merging the is_keyword and GetKeyword behavior.
5297 Do not short-circuit, because if we do, we
5298 report errors (ie, #if false && true would produce an invalid
5302 2002-11-24 Martin Baulig <martin@ximian.com>
5304 * expression.cs (Cast.TryReduce): If we're in checked syntax,
5305 check constant ranges and report a CS0221. Fixes #33186.
5307 2002-11-24 Martin Baulig <martin@ximian.com>
5309 * cs-parser.jay: Make this work for uninitialized variable
5310 declarations in the `for' initializer. Fixes #32416.
5312 2002-11-24 Martin Baulig <martin@ximian.com>
5314 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
5315 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
5317 2002-11-24 Martin Baulig <martin@ximian.com>
5319 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
5320 argument; if true, we also check for user-defined conversions.
5321 This is only needed if both arguments are of a user-defined type.
5322 Fixes #30443, added test-175.cs.
5323 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
5325 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
5327 2002-11-24 Martin Baulig <martin@ximian.com>
5329 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
5330 function to get the store opcode.
5331 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
5332 only emit the Ldelema if the store opcode is Stobj. You must run
5333 both test-34 and test-167 to test this. Fixes #34529.
5335 2002-11-23 Martin Baulig <martin@ximian.com>
5337 * ecore.cs (Expression.MemberLookup): Added additional
5338 `qualifier_type' argument which is used when we're being called
5339 from MemberAccess.DoResolve() and null if we're called from a
5341 (Expression.MemberLookupFailed): New method to report errors; this
5342 does the CS1540 check and reports the correct error message.
5344 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
5345 argument for the CS1540 check and redone the way how we're dealing
5346 with private members. See the comment in the source code for details.
5347 (FilterWithClosure): Reverted this back to revision 1.197; renamed
5348 `closure_start_type' to `closure_qualifier_type' and check whether
5349 it's not null. It was not this filter being broken, it was just
5350 being called with the wrong arguments.
5352 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
5353 and pass it the correct `qualifier_type'; this also does the error
5356 2002-11-22 Miguel de Icaza <miguel@ximian.com>
5358 * expression.cs (Invocation.EmitParams): If the we are dealing
5359 with a non-built-in value type, load its address as well.
5361 (ArrayCreation): Use a a pretty constant instead
5362 of the hardcoded value 2. Use 6 instead of 2 for the number of
5363 static initializers.
5365 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
5366 because they are not really value types, just glorified integers.
5368 * driver.cs: Do not append .exe, the CSC compiler does not do it.
5370 * ecore.cs: Remove redundant code for enumerations, make them use
5371 the same code path as everything else, fixes the casting issue
5372 with enumerations in Windows.Forms.
5374 * attribute.cs: Do only cast to string if it is a string, the
5375 validation happens later.
5377 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
5378 people upgrade their corlibs.
5380 * ecore.cs: Oops, enumerations were not following the entire code path
5382 2002-11-21 Miguel de Icaza <miguel@ximian.com>
5384 * typemanager.cs (FilterWithClosure): Commented out the test for
5385 1540 in typemanager.cs, as it has problems when accessing
5386 protected methods from a parent class (see test-174.cs).
5388 * attribute.cs (Attribute.ValidateGuid): new method.
5389 (Attribute.Resolve): Use above.
5391 2002-11-19 Miguel de Icaza <miguel@ximian.com>
5393 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
5395 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
5396 handling for enumerations, as we only needed the TypeContainer
5397 functionality to begin with (this is required for the fix below to
5398 work for enums that reference constants in a container class for
5401 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
5403 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
5404 a valid TypeBuilder to perform lookups on.o
5406 * class.cs (InheritableMemberSignatureCompare): Use true in the
5407 call to GetGetMethod and GetSetMethod, because we are comparing
5408 the signature, and we need to get the methods *even* if they are
5411 (PropertyBase.CheckBase): ditto.
5413 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
5414 GotoCase.Resolve): Use Peel on EmpytCasts.
5416 * ecore.cs (EmptyCast): drop child, add Peel method.
5418 2002-11-17 Martin Baulig <martin@ximian.com>
5420 * ecore.cs (EmptyCast.Child): New public property.
5422 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
5423 label resolved to an EmptyCast. Fixes #34162.
5424 (GotoCase.Resolve): Likewise.
5425 (Block.EmitMeta): Likewise.
5427 2002-11-17 Martin Baulig <martin@ximian.com>
5429 * expression.cs (Invocation.BetterConversion): Prefer int over
5430 uint; short over ushort; long over ulong for integer literals.
5431 Use ImplicitConversionExists instead of StandardConversionExists
5432 since we also need to check for user-defined implicit conversions.
5433 Fixes #34165. Added test-173.cs.
5435 2002-11-16 Martin Baulig <martin@ximian.com>
5437 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
5438 with the `true' and `false' literals. Fixes #33151.
5440 2002-11-16 Martin Baulig <martin@ximian.com>
5442 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
5443 October 22nd; don't do the cs1540 check for static members.
5445 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
5446 now using our own filter here and doing the cs1540 check again.
5448 2002-11-16 Martin Baulig <martin@ximian.com>
5450 * support.cs (InternalParameters): Don't crash if we don't have
5451 any fixed parameters. Fixes #33532.
5453 2002-11-16 Martin Baulig <martin@ximian.com>
5455 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
5456 when looking up static methods to make this work on Windows.
5459 2002-11-16 Martin Baulig <martin@ximian.com>
5461 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
5462 a setter rather than using PropertyInfo.CanWrite.
5464 2002-11-15 Nick Drochak <ndrochak@gol.com>
5466 * class.cs: Allow acces to block member by subclasses. Fixes build
5469 2002-11-14 Martin Baulig <martin@ximian.com>
5471 * class.cs (Constructor.Emit): Added the extern/block check.
5474 2002-11-14 Martin Baulig <martin@ximian.com>
5476 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
5477 iteration while looking for indexers, this is needed because the
5478 indexer may have a different name in our base classes. Fixed the
5479 error reporting (no indexers at all, not get accessor, no
5480 overloaded match). Fixes bug #33089.
5481 (IndexerAccess.DoResolveLValue): Likewise.
5483 2002-11-14 Martin Baulig <martin@ximian.com>
5485 * class.cs (PropertyBase.CheckBase): Make this work for multiple
5486 indexers. Fixes the first part of bug #33089.
5487 (MethodSignature.InheritableMemberSignatureCompare): Added support
5490 2002-11-13 Ravi Pratap <ravi@ximian.com>
5492 * attribute.cs (Attribute.Resolve): Catch the
5493 NullReferenceException and report it since it isn't supposed to
5496 2002-11-12 Miguel de Icaza <miguel@ximian.com>
5498 * expression.cs (Binary.EmitBranchable): Also handle the cases for
5499 LogicalOr and LogicalAnd that can benefit from recursively
5500 handling EmitBranchable. The code now should be nice for Paolo.
5502 2002-11-08 Miguel de Icaza <miguel@ximian.com>
5504 * typemanager.cs (LookupType): Added a negative-hit hashtable for
5505 the Type lookups, as we perform quite a number of lookups on
5506 non-Types. This can be removed once we can deterministically tell
5507 whether we have a type or a namespace in advance.
5509 But this might require special hacks from our corlib.
5513 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
5514 and double which avoids a conversion from an integer to a double.
5516 * expression.cs: tiny optimization, avoid calling IsConstant,
5517 because it effectively performs the lookup twice.
5519 2002-11-06 Miguel de Icaza <miguel@ximian.com>
5521 But a bogus return here to keep the semantics of the old code
5522 until the Mono runtime is fixed.
5524 * pending.cs (GetMissingInterfaces): New method used to remove all
5525 the interfaces that are already implemented by our parent
5526 classes from the list of pending methods.
5528 * interface.cs: Add checks for calls after ResolveTypeExpr.
5530 2002-11-05 Miguel de Icaza <miguel@ximian.com>
5532 * class.cs (Class.Emit): Report warning 67: event not used if the
5533 warning level is beyond 3.
5535 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
5536 being a NullLiteral.
5538 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
5541 * class.cs (TypeContainer.GetClassBases): Cover a missing code
5542 path that might fail if a type can not be resolved.
5544 * expression.cs (Binary.Emit): Emit unsigned versions of the
5547 * driver.cs: use error 5.
5549 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
5551 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
5553 2002-11-01 Miguel de Icaza <miguel@ximian.com>
5555 * cs-parser.jay (switch_section): A beautiful patch from Martin
5556 Baulig that fixed 33094.
5558 2002-10-31 Miguel de Icaza <miguel@ximian.com>
5560 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
5561 Check whether the base is abstract and report an error if so.
5563 * expression.cs (IndexerAccess.DoResolveLValue,
5564 IndexerAccess.DoResolve): ditto.
5566 (Invocation.DoResolve): ditto.
5568 (Invocation.FullMethodDesc): Improve the report string.
5570 * statement.cs (Block): Eliminate IsVariableDefined as it is
5571 basically just a wrapper for GetVariableInfo.
5573 * ecore.cs (SimpleName): Use new
5575 * support.cs (ReflectionParamter.ParameterType): We unwrap the
5576 type, as we return the actual parameter ref/unref state on a
5579 2002-10-30 Miguel de Icaza <miguel@ximian.com>
5581 * support.cs: Return proper flags REF/OUT fixing the previous
5584 * expression.cs: Reverted last patch, that was wrong. Is_ref is
5585 not used to mean `ref' but `ref or out' in ParameterReference
5587 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
5588 full type signature instead of calling TypeManger.CSharpName
5591 * support.cs (InternalParameters.ParameterDesc): Do not compare
5592 directly to the modflags, because REF/OUT will actually be bitsets
5595 * delegate.cs (VerifyMethod): Check also the modifiers.
5597 * cs-tokenizer.cs: Fix bug where floating point values with an
5598 exponent where a sign was missing was ignored.
5600 * driver.cs: Allow multiple assemblies to be specified in a single
5603 2002-10-28 Miguel de Icaza <miguel@ximian.com>
5605 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
5606 because identifiers after a parenthesis would end up in this kind
5607 of production, and we needed to desamiguate it for having casts
5610 (UserDefinedType *) xxx
5612 2002-10-24 Miguel de Icaza <miguel@ximian.com>
5614 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
5615 we should set on the Bindingflags.NonPublic, but not turn on
5616 private_ok. private_ok controls whether a Private member is
5617 returned (this is chekced on the filter routine), while the
5618 BindingFlags.NonPublic just controls whether private/protected
5619 will be allowed. This fixes the problem part of the problem of
5620 private properties being allowed to be used in derived classes.
5622 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
5623 so we can call the children DoResolveLValue method (this will
5624 properly signal errors on lvalue assignments to base properties)
5626 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
5627 getter are null, and we have a property info, we know that this
5628 happened because the lookup failed, so we report an error 122 for
5629 protection level violation.
5631 We also silently return if setter and getter are null in the
5632 resolve functions, this condition only happens if we have flagged
5633 the error before. This is the other half of the problem.
5635 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
5636 not have accessibility information, that is why we were returning
5637 true in the filter function in typemanager.cs.
5639 To properly report 122 (property is inaccessible because of its
5640 protection level) correctly, we report this error in ResolveAccess
5641 by failing if both the setter and the getter are lacking (ie, the
5644 DoResolve and DoLResolve have been modified to check for both
5645 setter/getter being null and returning silently, the reason being
5646 that I did not want to put the knowledge about this error in upper
5649 int old = Report.Errors;
5650 x = new PropertyExpr (...);
5651 if (old != Report.Errors)
5656 So the property expr is returned, but it is invalid, so the error
5657 will be flagged during the resolve process.
5659 * class.cs: Remove InheritablePropertySignatureCompare from the
5660 class, as we no longer depend on the property signature to compute
5661 whether it is possible to implement a method or not.
5663 The reason is that calling PropertyInfo.GetGetMethod will return
5664 null (in .NET, in Mono it works, and we should change this), in
5665 cases where the Get Method does not exist in that particular
5670 class X { public virtual int A { get { return 1; } } }
5672 class Z : Y { public override int A { get { return 2; } } }
5674 Would fail in Z because the parent (Y) would not have the property
5675 defined. So we avoid this completely now (because the alternative
5676 fix was ugly and slow), and we now depend exclusively on the
5679 (PropertyBase.CheckBase): Use a method-base mechanism to find our
5680 reference method, instead of using the property.
5682 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
5683 routines are gone now.
5685 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
5686 names, they were incorrectly named.
5688 * cs-tokenizer.cs: Return are more gentle token on failure.
5690 * pending.cs (PendingImplementation.InterfaceMethod): This routine
5691 had an out-of-sync index variable, which caused it to remove from
5692 the list of pending methods the wrong method sometimes.
5694 2002-10-22 Miguel de Icaza <miguel@ximian.com>
5696 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5697 CanWrite, because those refer to this particular instance of the
5698 property, and do not take into account the fact that we can
5699 override single members of a property.
5701 Constructor requires an EmitContext. The resolution process does
5702 not happen here, but we need to compute the accessors before,
5703 because the resolution does not always happen for properties.
5705 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5706 subclass, before we did not update this flag, but we did update
5709 (GetAccessors): Drop this routine, as it did not work in the
5710 presence of partially overwritten set/get methods.
5712 Notice that this broke the cs1540 detection, but that will require
5715 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5719 * driver.cs: issue a warning instead of an error if we don't support
5720 debugging for the platform. Also ignore a couple of errors that may
5721 arise when trying to write the symbols. Undo my previous patch.
5723 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5725 * driver.cs: ignore /debug switch except for Unix platforms.
5727 2002-10-23 Nick Drochak <ndrochak@gol.com>
5729 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5731 2002-10-21 Miguel de Icaza <miguel@ximian.com>
5733 * driver.cs: Do not make mcs-debug conditional, so we do not break
5736 * statement.cs (UsageVector.MergeChildren): I would like Martin to
5737 review this patch. But basically after all the children variables
5738 have been merged, the value of "Breaks" was not being set to
5739 new_breaks for Switch blocks. I think that it should be set after
5740 it has executed. Currently I set this to the value of new_breaks,
5741 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5742 conservative, but I do not understand this code very well.
5744 I did not break anything in the build, so that is good ;-)
5746 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5748 2002-10-20 Mark Crichton <crichton@gimp.org>
5750 * cfold.cs: Fixed compile blocker. Really fixed it this time.
5752 2002-10-20 Nick Drochak <ndrochak@gol.com>
5754 * cfold.cs: Fixed compile blocker.
5756 2002-10-20 Miguel de Icaza <miguel@ximian.com>
5758 * driver.cs: I was chekcing the key, not the file.
5760 2002-10-19 Ravi Pratap <ravi@ximian.com>
5762 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5763 message that we were generating - we just need to silently return
5766 2002-10-19 Miguel de Icaza <miguel@ximian.com>
5768 * class.cs (Event.Define): Change my previous commit, as this
5769 breaks the debugger. This is a temporary hack, as it seems like
5770 the compiler is generating events incorrectly to begin with.
5772 * expression.cs (Binary.ResolveOperator): Added support for
5773 "U operator - (E x, E y)"
5775 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5778 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5779 init-only variables, but this path did not take into account that
5780 there might be also instance readonly variables. Correct this
5783 This fixes bug 32253
5785 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5788 * driver.cs: Change the extension for modules to `netmodule'
5790 * cs-parser.jay: Improved slightly the location tracking for
5791 the debugger symbols.
5793 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5794 modifiers that were specified instead of the hardcoded value
5795 (FamAndAssem). This was basically ignoring the static modifier,
5796 and others. Fixes 32429.
5798 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5799 fixed a bug in the process (32476)
5801 * expression.cs (ArrayAccess.EmitAssign): Patch from
5802 hwang_rob@yahoo.ca that fixes bug 31834.3
5804 2002-10-18 Miguel de Icaza <miguel@ximian.com>
5806 * driver.cs: Make the module extension .netmodule.
5808 2002-10-16 Miguel de Icaza <miguel@ximian.com>
5810 * driver.cs: Report an error if the resource file is not found
5811 instead of crashing.
5813 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5814 false, like Emit does.
5816 2002-10-16 Nick Drochak <ndrochak@gol.com>
5818 * typemanager.cs: Remove unused private member. Also reported mcs
5819 bug to report this as a warning like csc.
5821 2002-10-15 Martin Baulig <martin@gnome.org>
5823 * statement.cs (Statement.Emit): Made this a virtual method; emits
5824 the line number info and calls DoEmit().
5825 (Statement.DoEmit): New protected abstract method, formerly knows
5826 as Statement.Emit().
5828 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5830 2002-10-11 Miguel de Icaza <miguel@ximian.com>
5832 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5833 have fixed a remaining problem: not every AddXXXX was adding a
5834 fully qualified name.
5836 Now everyone registers a fully qualified name in the DeclSpace as
5837 being defined instead of the partial name.
5839 Downsides: we are slower than we need to be due to the excess
5840 copies and the names being registered this way.
5842 The reason for this is that we currently depend (on the corlib
5843 bootstrap for instance) that types are fully qualified, because
5844 we dump all the types in the namespace, and we should really have
5845 types inserted into the proper namespace, so we can only store the
5846 basenames in the defined_names array.
5848 2002-10-10 Martin Baulig <martin@gnome.org>
5850 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5851 from bug #31834, see the bug report for a testcase which is
5854 2002-10-10 Martin Baulig <martin@gnome.org>
5856 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5857 flow analysis code for this.
5859 * statement.cs (Do, While, For): Tell the flow analysis code about
5861 (FlowBranching.UsageVector): Added support for infinite loops.
5862 (Block.Resolve): Moved the dead code elimination here and use flow
5865 2002-10-09 Miguel de Icaza <miguel@ximian.com>
5867 * class.cs (Field.Define): Catch cycles on struct type
5870 * typemanager.cs (IsUnmanagedtype): Do not recursively check
5871 fields if the fields are static. We only need to check instance
5874 * expression.cs (As.DoResolve): Test for reference type.
5876 * statement.cs (Using.ResolveExpression): Use
5877 ConvertImplicitRequired, not ConvertImplicit which reports an
5879 (Using.ResolveLocalVariableDecls): ditto.
5881 * expression.cs (Binary.ResolveOperator): Report errors in a few
5882 places where we had to.
5884 * typemanager.cs (IsUnmanagedtype): Finish implementation.
5886 2002-10-08 Miguel de Icaza <miguel@ximian.com>
5888 * expression.cs: Use StoreFromPtr instead of extracting the type
5889 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
5891 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5892 an enumeration value to a System.Enum, but System.Enum is not a
5893 value type, but an class type, so we need to box.
5895 (Expression.ConvertExplicit): One codepath could return
5896 errors but not flag them. Fix this. Fixes #31853
5898 * parameter.cs (Resolve): Do not allow void as a parameter type.
5900 2002-10-06 Martin Baulig <martin@gnome.org>
5902 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5903 if it's a class type and not a struct. Fixes #31815.
5905 2002-10-06 Martin Baulig <martin@gnome.org>
5907 * statement.cs: Reworked the flow analysis code a bit to make it
5908 usable for dead code elimination.
5910 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5912 * cs-parser.jay: allow empty source files. Fixes bug #31781.
5914 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5916 * expression.cs (ComposedCast.DoResolveType): A quick workaround
5917 to fix the test 165, will investigate deeper.
5919 2002-10-04 Martin Baulig <martin@gnome.org>
5921 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5922 finally blocks actually work.
5923 (Try.Resolve): We don't need to create a sibling for `finally' if
5924 there is no finally block.
5926 2002-10-04 Martin Baulig <martin@gnome.org>
5928 * class.cs (Constructor.Define): The default accessibility for a
5929 non-default constructor is private, not public.
5931 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5933 * class.cs (Constructor): Make AllowedModifiers public, add
5936 * cs-parser.jay: Perform the modifiers test here, as the
5937 constructor for the Constructor class usually receives a zero
5938 because of the way we create it (first we create, later we
5939 customize, and we were never checking the modifiers).
5941 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5942 is a version of LookupTypeReflection that includes the type-name
5943 cache. This can be used as a fast path for functions that know
5944 the fully qualified name and are only calling into *.GetType() to
5945 obtain a composed type.
5947 This is also used by TypeManager.LookupType during its type
5950 (LookupType): We now also track the real type name, as sometimes
5951 we can get a quey for the real type name from things like
5952 ComposedCast. This fixes bug 31422.
5954 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5955 complete type fullname, it does not have to go through the type
5956 resolution system to obtain the composed version of the type (for
5957 obtaining arrays or pointers).
5959 (Conditional.Emit): Use the EmitBoolExpression to
5960 generate nicer code, as requested by Paolo.
5962 (ArrayCreation.CheckIndices): Use the patch from
5963 hwang_rob@yahoo.ca to validate the array initializers.
5965 2002-10-03 Miguel de Icaza <miguel@ximian.com>
5967 * class.cs (ConstructorInitializer.Emit): simplify code by using
5968 Invocation.EmitCall, and at the same time, fix the bugs in calling
5969 parent constructors that took variable arguments.
5971 * ecore.cs (Expression.ConvertNumericExplicit,
5972 Expression.ImplicitNumericConversion): Remove the code that
5973 manually wrapped decimal (InternalTypeConstructor call is now gone
5976 * expression.cs (Cast.TryReduce): Also handle decimal types when
5977 trying to perform a constant fold on the type.
5979 * typemanager.cs (IsUnmanagedtype): Partially implemented.
5981 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5982 that only turned off an error report, and did nothing else.
5984 2002-10-02 Miguel de Icaza <miguel@ximian.com>
5986 * driver.cs: Handle and ignore /fullpaths
5988 2002-10-01 Miguel de Icaza <miguel@ximian.com>
5990 * expression.cs (Binary.ResolveOperator): Catch the case where
5991 DoNumericPromotions returns true,
5993 (Binary.DoNumericPromotions): Simplify the code, and the tests.
5995 2002-09-27 Miguel de Icaza <miguel@ximian.com>
5997 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
6000 2002-09-26 Miguel de Icaza <miguel@ximian.com>
6002 * ecore.cs (ConvertNumericExplicit): It is not enough that the
6003 conversion exists, but it is also required that the conversion be
6004 performed. This manifested in "(Type64Enum) 2".
6006 * class.cs (TypeManager.AddMethod): The fix is not to change
6007 AddEnum, because that one was using a fully qualified name (every
6008 DeclSpace derivative does), but to change the AddMethod routine
6009 that was using an un-namespaced name. This now correctly reports
6010 the duplicated name.
6012 Revert patch until I can properly fix it. The issue
6013 is that we have a shared Type space across all namespaces
6014 currently, which is wrong.
6016 Options include making the Namespace a DeclSpace, and merge
6017 current_namespace/current_container in the parser.
6019 2002-09-25 Miguel de Icaza <miguel@ximian.com>
6021 * cs-parser.jay: Improve error reporting when we get a different
6022 kind of expression in local_variable_type and
6023 local_variable_pointer_type.
6025 Propagate this to avoid missleading errors being reported.
6027 * ecore.cs (ImplicitReferenceConversion): treat
6028 TypeManager.value_type as a target just like object_type. As
6033 Is valid, and needs to result in the int 1 being boxed before it
6034 is assigned to the value type v.
6036 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
6037 to validate the enumeration name.
6039 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
6040 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
6041 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
6043 * ecore.cs (TryImplicitIntConversion): When doing an
6044 implicit-enumeration-conversion, check if the type is 64-bits and
6045 perform a conversion before passing to EnumConstant.
6047 2002-09-23 Miguel de Icaza <miguel@ximian.com>
6049 * decl.cs (Error_AmbiguousTypeReference); New routine used to
6050 report ambiguous type references. Unlike the MS version, we
6051 report what the ambiguity is. Innovation at work ;-)
6053 (DeclSpace.FindType): Require a location argument to
6054 display when we display an ambiguous error.
6056 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
6058 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
6060 * expression.cs (EmitDynamicInitializers): Apply patch from
6061 hwang_rob@yahoo.ca that fixes the order in which we emit our
6064 2002-09-21 Martin Baulig <martin@gnome.org>
6066 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
6067 delegate takes no arguments.
6069 2002-09-20 Miguel de Icaza <miguel@ximian.com>
6071 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
6074 * expression.cs: Extract the underlying type.
6076 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
6078 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
6080 2002-09-19 Miguel de Icaza <miguel@ximian.com>
6082 * class.cs (TypeContainer.DefineType): We can not use the nice
6083 PackingSize with the size set to 1 DefineType method, because it
6084 will not allow us to define the interfaces that the struct
6087 This completes the fixing of bug 27287
6089 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
6090 means also structs. This fixes part of the problem.
6091 (Expresion.ImplicitReferenceConversionExists): ditto.
6093 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
6094 error if there were no errors reported during the type lookup
6095 process, to avoid duplicates or redundant errors. Without this
6096 you would get an ambiguous errors plus a type not found. We have
6097 beaten the user enough with the first error.
6099 (DeclSparce.FindType): Emit a warning if we have an ambiguous
6102 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
6103 during the resolution process, stop the lookup, this avoids
6104 repeated error reports (same error twice).
6106 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
6108 * typemanager.cs (LookupType): Redo the type lookup code to match
6109 the needs of System.Reflection.
6111 The issue is that System.Reflection requires references to nested
6112 types to begin with a "+" sign instead of a dot. So toplevel
6113 types look like: "NameSpace.TopLevelClass", and nested ones look
6114 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
6117 2002-09-19 Martin Baulig <martin@gnome.org>
6119 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
6120 says that a method always returns or always throws an exception,
6121 don't report the CS0161.
6123 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
6124 set `Returns = new_returns'.
6126 2002-09-19 Martin Baulig <martin@gnome.org>
6128 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
6129 to an enum constant, check for a CS0176.
6131 2002-09-18 Miguel de Icaza <miguel@ximian.com>
6133 * class.cs (TypeContainer.CheckPairedOperators): Now we check
6134 for operators that must be in pairs and report errors.
6136 * ecore.cs (SimpleName.DoResolveType): During the initial type
6137 resolution process, when we define types recursively, we must
6138 check first for types in our current scope before we perform
6139 lookups in the enclosing scopes.
6141 * expression.cs (MakeByteBlob): Handle Decimal blobs.
6143 (Invocation.VerifyArgumentsCompat): Call
6144 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
6145 I thought we were supposed to always call this, but there are a
6146 few places in the code where we dont do it.
6148 2002-09-17 Miguel de Icaza <miguel@ximian.com>
6150 * driver.cs: Add support in -linkres and -resource to specify the
6151 name of the identifier.
6153 2002-09-16 Miguel de Icaza <miguel@ximian.com>
6155 * ecore.cs (StandardConversionExists): Sync with the conversion
6156 code: allow anything-* to void* conversions.
6158 (FindMostSpecificSource): Use an Expression argument
6159 instead of a Type, because we might be handed over a Literal which
6160 gets a few more implicit conversions that plain types do not. So
6161 this information was being lost.
6163 Also, we drop the temporary type-holder expression when not
6166 2002-09-17 Martin Baulig <martin@gnome.org>
6168 * class.cs (PropertyBase.CheckBase): Don't check the base class if
6169 this is an explicit interface implementation.
6171 2002-09-17 Martin Baulig <martin@gnome.org>
6173 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
6174 different `IndexerName' attributes.
6176 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
6177 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
6178 virtual CommonResolve().
6180 2002-09-16 Miguel de Icaza <miguel@ximian.com>
6182 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
6183 and convert that to the UnderlyingType.
6185 * statement.cs (Foreach.Resolve): Indexers are just like variables
6186 or PropertyAccesses.
6188 * cs-tokenizer.cs (consume_string): Track line numbers and columns
6189 inside quoted strings, we were not doing this before.
6191 2002-09-16 Martin Baulig <martin@gnome.org>
6193 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
6194 resolve it. This is needed for the definite assignment check of the
6195 instance expression, fixes bug #29846.
6196 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
6198 2002-09-16 Nick Drochak <ndrochak@gol.com>
6200 * parameter.cs: Fix compile error. Cannot reference static member
6201 from an instance object. Is this an mcs bug?
6203 2002-09-14 Martin Baulig <martin@gnome.org>
6205 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
6206 multiple times. Fixes bug #30295, added test-166.cs.
6208 2002-09-14 Martin Baulig <martin@gnome.org>
6210 * statement.cs (Block.Emit): Don't emit unreachable code.
6211 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
6213 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
6215 2002-09-14 Martin Baulig <martin@gnome.org>
6217 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
6220 2002-09-14 Martin Baulig <martin@gnome.org>
6222 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
6223 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
6224 be false on the ms runtime.
6226 2002-09-13 Martin Baulig <martin@gnome.org>
6228 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
6229 the CS0038 error message.
6231 2002-09-12 Miguel de Icaza <miguel@ximian.com>
6233 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
6234 constant inside, return it.
6236 2002-09-12 Martin Baulig <martin@gnome.org>
6238 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
6239 implicit conversion can be done between enum types.
6241 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
6242 check whether an implicit conversion to the current enum's UnderlyingType
6243 exists and report an error if not.
6245 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
6246 without debugging support.
6248 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
6249 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
6251 2002-09-12 Martin Baulig <martin@gnome.org>
6253 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
6255 * ecore.cs (IMemberExpr.DeclaringType): New property.
6256 (SimpleName.SimpleNameResolve): Check whether we're accessing a
6257 nonstatic member of an outer type (CS0038).
6259 2002-09-11 Miguel de Icaza <miguel@ximian.com>
6261 * driver.cs: Activate the using-error detector at warning level
6262 4 (at least for MS-compatible APIs).
6264 * namespace.cs (VerifyUsing): Small buglett fix.
6266 * pending.cs (PendingImplementation): pass the container pointer.
6268 * interface.cs (GetMethods): Allow for recursive definition. Long
6269 term, I would like to move every type to support recursive
6270 definitions, not the current ordering mechanism that we have right
6273 The situation is this: Attributes are handled before interfaces,
6274 so we can apply attributes to interfaces. But some attributes
6275 implement interfaces, we will now handle the simple cases
6276 (recursive definitions will just get an error).
6278 * parameter.cs: Only invalidate types at the end if we fail to
6281 2002-09-09 Martin Baulig <martin@gnome.org>
6283 * ecore.cs (PropertyExpr.Emit): Also check for
6284 TypeManager.system_int_array_get_length so this'll also work when
6285 compiling corlib. Fixes #30003.
6287 2002-09-09 Martin Baulig <martin@gnome.org>
6289 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
6290 and throw an exception if we can't get the type's size. Fixed #30040,
6293 2002-09-09 Martin Baulig <martin@gnome.org>
6295 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
6297 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
6298 context. Fixes bug #30027.
6300 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
6301 virtual functions. Fixes bug #30043, added test-164.cs.
6303 2002-09-08 Ravi Pratap <ravi@ximian.com>
6305 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
6307 2002-09-08 Nick Drochak <ndrochak@gol.com>
6309 * driver.cs: Use an object to get the windows codepage since it's not a
6312 2002-09-08 Miguel de Icaza <miguel@ximian.com>
6314 * statement.cs (For.Emit): for infinite loops (test == null)
6315 return whether there is a break inside, not always "true".
6317 * namespace.cs (UsingEntry): New struct to hold the name of the
6318 using definition, the location where it is defined, and whether it
6319 has been used in a successful type lookup.
6321 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
6326 2002-09-06 Ravi Pratap <ravi@ximian.com>
6328 * attribute.cs : Fix incorrect code which relied on catching
6329 a NullReferenceException to detect a null being passed in
6330 where an object was expected.
6332 2002-09-06 Miguel de Icaza <miguel@ximian.com>
6334 * statement.cs (Try): flag the catch variable as assigned
6336 * expression.cs (Cast): Simplified by using ResolveType instead of
6339 * statement.cs (Catch): Fix bug by using ResolveType.
6341 2002-09-06 Ravi Pratap <ravi@ximian.com>
6343 * expression.cs (BetterConversion): Special case for when we have
6344 a NullLiteral as the argument and we have to choose between string
6345 and object types - we choose string the way csc does.
6347 * attribute.cs (Attribute.Resolve): Catch the
6348 NullReferenceException and report error #182 since the Mono
6349 runtime no more has the bug and having this exception raised means
6350 we tried to select a constructor which takes an object and is
6353 2002-09-05 Ravi Pratap <ravi@ximian.com>
6355 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
6356 message (1502, 1503) when we can't locate a method after overload
6357 resolution. This is much more informative and closes the bug
6360 * interface.cs (PopulateMethod): Return if there are no argument
6361 types. Fixes a NullReferenceException bug.
6363 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
6364 expressions too. Previously we were checking only in one place for
6365 positional arguments leaving out named arguments.
6367 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
6368 type to the enum type is not allowed. Remove code corresponding to
6371 (ConvertNumericExplicit): Allow explicit conversions from
6372 the underlying type to enum type. This precisely follows the spec
6373 and closes a bug filed by Gonzalo.
6375 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6378 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
6380 2002-09-03 Miguel de Icaza <miguel@ximian.com>
6382 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
6383 it was important that we stored the right value after the
6384 reduction in `converted'.
6386 2002-09-04 Martin Baulig <martin@gnome.org>
6388 * location.cs (Location.SymbolDocument): Use full pathnames for the
6391 2002-08-30 Miguel de Icaza <miguel@ximian.com>
6393 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
6394 of the expression resolve mechanism, because that will catch the
6395 SimpleName error failures.
6397 (Conditional): If we can not resolve the
6398 expression, return, do not crash.
6400 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6403 (location): display token name instead of its number.
6405 2002-08-28 Martin Baulig <martin@gnome.org>
6407 * expression.cs (Binary.ResolveOperator): Don't silently return
6408 but return an error if an operator cannot be applied between two
6411 2002-08-28 Martin Baulig <martin@gnome.org>
6413 * class.cs (Constructor.Define): Set the permission attributes
6414 correctly instead of making all constructors public.
6416 2002-08-28 Martin Baulig <martin@gnome.org>
6418 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
6419 for private members before reporting a CS0103; if we find anything,
6422 2002-08-28 Martin Baulig <martin@gnome.org>
6424 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
6425 to check whether `closure_start_type == closure_invocation_type',
6426 we also need to check whether `m.DeclaringType == closure_invocation_type'
6427 before bypassing the permission checks. We might be accessing
6428 protected/private members from the base class.
6429 (TypeManager.RealMemberLookup): Only set private_ok if private
6430 members were requested via BindingFlags.NonPublic.
6432 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
6434 * expression.cs (MemberAccess.ResolveMemberAccess): Set
6435 MethodGroupExpr.IsExplicitImpl if appropriate.
6436 (Invocation.DoResolve): Don't report the CS0120 for explicit
6437 interface implementations.
6439 2002-08-27 Martin Baulig <martin@gnome.org>
6441 * expression.cs (Invocation.DoResolve): If this is a static
6442 method and we don't have an InstanceExpression, we must report
6445 2002-08-25 Martin Baulig <martin@gnome.org>
6447 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
6448 `==' between a valuetype and an object.
6450 2002-08-25 Miguel de Icaza <miguel@ximian.com>
6452 * ecore.cs (TypeExpr): Provide a ToString method.
6454 2002-08-24 Martin Baulig <martin@gnome.org>
6456 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
6457 now called proggie.dbg and it's a binary file.
6459 2002-08-23 Martin Baulig <martin@gnome.org>
6461 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
6463 2002-08-23 Martin Baulig <martin@gnome.org>
6465 * struct.cs (MyStructInfo.ctor): Make this work with empty
6466 structs; it's not allowed to use foreach() on null.
6468 2002-08-23 Martin Baulig <martin@gnome.org>
6470 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
6471 writer the full pathname of the generated assembly.
6473 2002-08-23 Martin Baulig <martin@gnome.org>
6475 * statements.cs (FlowBranching.UsageVector.MergeChildren):
6476 A `finally' block never returns or breaks; improved handling of
6479 2002-08-23 Martin Baulig <martin@gnome.org>
6481 * statement.cs (Throw.Resolve): Allow `throw null'.
6483 2002-08-23 Martin Baulig <martin@gnome.org>
6485 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
6486 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
6487 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
6488 MemberLookup would return a wrong event if this is an explicit
6489 interface implementation and the class has an event with the same
6492 2002-08-23 Martin Baulig <martin@gnome.org>
6494 * statement.cs (Block.AddChildVariableNames): New public method.
6495 (Block.AddChildVariableName): Likewise.
6496 (Block.IsVariableNameUsedInChildBlock): Likewise.
6497 (Block.AddVariable): Check whether a variable name has already
6498 been used in a child block.
6500 * cs-parser.jay (declare_local_variables): Mark all variable names
6501 from the current block as being used in a child block in the
6504 2002-08-23 Martin Baulig <martin@gnome.org>
6506 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
6507 find the symbol writer.
6509 * driver.cs: csc also allows the arguments to /define being
6510 separated by commas, not only by semicolons.
6512 2002-08-23 Martin Baulig <martin@gnome.org>
6514 * interface.cs (Interface.GetMembers): Added static check for events.
6516 2002-08-15 Martin Baulig <martin@gnome.org>
6518 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
6519 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
6521 * ecore.cs (Expression.MemberLookup): Added documentation and explained
6522 why the MethodData.EmitDestructor() change was necessary.
6524 2002-08-20 Martin Baulig <martin@gnome.org>
6526 * class.cs (TypeContainer.FindMembers): Added static check for events.
6528 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
6530 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
6531 use Type.GetEvents(), not Type.FindMembers().
6533 2002-08-20 Martin Baulig <martin@gnome.org>
6535 * decl.cs (MemberCache): Added a special method cache which will
6536 be used for method-only searched. This ensures that a method
6537 search will return a MethodInfo with the correct ReflectedType for
6540 2002-08-20 Martin Baulig <martin@gnome.org>
6542 * decl.cs (DeclSpace.FindMembers): Made this public.
6544 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6546 * delegate.cs: fixed build on windows.
6547 [FIXME: Filed as bug #29150: MCS must report these errors.]
6549 2002-08-19 Ravi Pratap <ravi@ximian.com>
6551 * ecore.cs (StandardConversionExists): Return a false
6552 if we are trying to convert the void type to anything else
6553 since that is not allowed.
6555 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
6556 we flag error 70 in the event an event is trying to be accessed
6557 directly from outside the declaring type.
6559 2002-08-20 Martin Baulig <martin@gnome.org>
6561 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
6562 MemberCache from typemanager.cs to decl.cs.
6564 2002-08-19 Martin Baulig <martin@gnome.org>
6566 * class.cs (TypeContainer): Implement IMemberContainer.
6567 (TypeContainer.DefineMembers): Create the MemberCache.
6568 (TypeContainer.FindMembers): Do better BindingFlags checking; only
6569 return public members if BindingFlags.Public was given, check
6570 whether members are static.
6572 2002-08-16 Martin Baulig <martin@gnome.org>
6574 * decl.cs (DeclSpace.Define): Splitted this in Define and
6575 DefineMembers. DefineMembers is called first and initializes the
6578 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
6579 DefineMembers() on all our DeclSpaces.
6581 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
6582 but call DefineMembers() on all nested interfaces. We call their
6583 Define() in our new Define() function.
6585 * interface.cs (Interface): Implement IMemberContainer.
6586 (Interface.Define): Moved all code except the attribute stuf to
6588 (Interface.DefineMembers): Initialize the member cache.
6590 * typemanager.cs (IMemberFinder): Removed this interface, we don't
6591 need this anymore since we can use MemberCache.FindMembers directly.
6593 2002-08-19 Martin Baulig <martin@gnome.org>
6595 * typemanager.cs (MemberCache): When creating the cache for an
6596 interface type, add all inherited members.
6597 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
6598 to `out bool used_cache' and documented it.
6599 (TypeManager.MemberLookup): If we already used the cache in the first
6600 iteration, we don't need to do the interfaces check.
6602 2002-08-19 Martin Baulig <martin@gnome.org>
6604 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
6605 here from IMemberFinder and don't implement this interface anymore.
6606 (DeclSpace.MemberCache): Moved here from IMemberFinder.
6608 * typemanager.cs (IMemberFinder): This interface is now only used by
6609 classes which actually support the member cache.
6610 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
6611 since we only put DeclSpaces into this Hashtable.
6612 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
6613 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
6615 2002-08-16 Martin Baulig <martin@gnome.org>
6617 * typemanager.cs (ICachingMemberFinder): Removed.
6618 (IMemberFinder.MemberCache): New property.
6619 (TypeManager.FindMembers): Merged this with RealFindMembers().
6620 This function will never be called from TypeManager.MemberLookup()
6621 so we can't use the cache here, just the IMemberFinder.
6622 (TypeManager.MemberLookup_FindMembers): Check whether the
6623 IMemberFinder has a MemberCache and call the cache's FindMembers
6625 (MemberCache): Rewrote larger parts of this yet another time and
6626 cleaned it up a bit.
6628 2002-08-15 Miguel de Icaza <miguel@ximian.com>
6630 * driver.cs (LoadArgs): Support quoting.
6632 (Usage): Show the CSC-like command line arguments.
6634 Improved a few error messages.
6636 2002-08-15 Martin Baulig <martin@gnome.org>
6638 * typemanager.cs (IMemberContainer.Type): New property.
6639 (IMemberContainer.IsInterface): New property.
6641 The following changes are conditional to BROKEN_RUNTIME, which is
6642 defined at the top of the file.
6644 * typemanager.cs (MemberCache.MemberCache): Don't add the base
6645 class'es members, but add all members from TypeHandle.ObjectType
6646 if we're an interface.
6647 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
6648 is the current type.
6649 (MemberCache.CacheEntry.Container): Removed this field.
6650 (TypeHandle.GetMembers): Include inherited members.
6652 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6654 * typemanager.cs: fixed compilation and added a comment on a field that
6657 2002-08-15 Martin Baulig <martin@gnome.org>
6659 * class.cs (ConstructorInitializer.Resolve): In the
6660 Expression.MemberLookup call, use the queried_type as
6663 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
6664 declared' attribute, it's always true.
6665 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
6666 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
6667 temporary wrapper for FindMembers which tells MemberLookup whether
6668 members from the base classes are included in the return value.
6669 This will go away soon.
6670 (TypeManager.MemberLookup): Use this temporary hack here; once the
6671 new MemberCache is completed, we don't need to do the DeclaredOnly
6672 looping here anymore since the MemberCache will take care of this.
6673 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
6674 (MemberCache): When creating the MemberCache for a class, get
6675 members from the current class and all its base classes.
6676 (MemberCache.CacheEntry.Container): New field. This is a
6677 temporary hack until the Mono runtime is fixed to distinguish
6678 between ReflectedType and DeclaringType. It allows us to use MCS
6679 with both the MS runtime and the unfixed Mono runtime without
6680 problems and without accecting performance.
6681 (MemberCache.SearchMembers): The DeclaredOnly looping from
6682 TypeManager.MemberLookup is now done here.
6684 2002-08-14 Martin Baulig <martin@gnome.org>
6686 * statement.cs (MyStructInfo.MyStructInfo): Don't call
6687 Type.GetFields on dynamic types but get the fields from the
6688 corresponding TypeContainer.
6689 (MyStructInfo.GetStructInfo): Added check for enum types.
6691 * typemanager.cs (MemberList.IsSynchronized): Implemented.
6692 (MemberList.SyncRoot): Implemented.
6693 (TypeManager.FilterWithClosure): No need to check permissions if
6694 closure_start_type == closure_invocation_type, don't crash if
6695 closure_invocation_type is null.
6697 2002-08-13 Martin Baulig <martin@gnome.org>
6699 Rewrote TypeContainer.FindMembers to use a member cache. This
6700 gives us a speed increase of about 35% for the self-hosting MCS
6701 build and of about 15-20% for the class libs (both on GNU/Linux).
6703 * report.cs (Timer): New class to get enhanced profiling. This
6704 whole class is "TIMER" conditional since it remarkably slows down
6707 * class.cs (MemberList): New class. This is an IList wrapper
6708 which we're now using instead of passing MemberInfo[]'s around to
6709 avoid copying this array unnecessarily.
6710 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6711 (ICachingMemberFinder, IMemberContainer): New interface.
6712 (TypeManager.FilterWithClosure): If `criteria' is null, the name
6713 has already been checked, otherwise use it for the name comparision.
6714 (TypeManager.FindMembers): Renamed to RealMemberFinder and
6715 provided wrapper which tries to use ICachingMemberFinder.FindMembers
6716 if possible. Returns a MemberList, not a MemberInfo [].
6717 (TypeHandle): New class, implements IMemberContainer. We create
6718 one instance of this class per type, it contains a MemberCache
6719 which is used to do the member lookups.
6720 (MemberCache): New class. Each instance of this class contains
6721 all members of a type and a name-based hash table.
6722 (MemberCache.FindMembers): This is our new member lookup
6723 function. First, it looks up all members of the requested name in
6724 the hash table. Then, it walks this list and sorts out all
6725 applicable members and returns them.
6727 2002-08-13 Martin Baulig <martin@gnome.org>
6729 In addition to a nice code cleanup, this gives us a performance
6730 increase of about 1.4% on GNU/Linux - not much, but it's already
6731 half a second for the self-hosting MCS compilation.
6733 * typemanager.cs (IMemberFinder): New interface. It is used by
6734 TypeManager.FindMembers to call FindMembers on a TypeContainer,
6735 Enum, Delegate or Interface.
6736 (TypeManager.finder_to_member_finder): New PtrHashtable.
6737 (TypeManager.finder_to_container): Removed.
6738 (TypeManager.finder_to_delegate): Removed.
6739 (TypeManager.finder_to_interface): Removed.
6740 (TypeManager.finder_to_enum): Removed.
6742 * interface.cs (Interface): Implement IMemberFinder.
6744 * delegate.cs (Delegate): Implement IMemberFinder.
6746 * enum.cs (Enum): Implement IMemberFinder.
6748 * class.cs (TypeContainer): Implement IMemberFinder.
6750 2002-08-12 Martin Baulig <martin@gnome.org>
6752 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6754 2002-08-12 Martin Baulig <martin@gnome.org>
6756 * ecore.cs (ITypeExpression): New interface for expressions which
6758 (TypeExpression): Renamed to TypeLookupExpression.
6759 (Expression.DoResolve): If we're doing a types-only lookup, the
6760 expression must implement the ITypeExpression interface and we
6761 call DoResolveType() on it.
6762 (SimpleName): Implement the new ITypeExpression interface.
6763 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6764 hack, the situation that we're only looking up types can't happen
6765 anymore when this method is called. Moved the type lookup code to
6766 DoResolveType() and call it.
6767 (SimpleName.DoResolveType): This ITypeExpression interface method
6768 is now doing the types-only lookup.
6769 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6770 (ResolveFlags): Added MaskExprClass.
6772 * expression.cs (MemberAccess): Implement the ITypeExpression
6774 (MemberAccess.DoResolve): Added support for a types-only lookup
6775 when we're called via ITypeExpression.DoResolveType().
6776 (ComposedCast): Implement the ITypeExpression interface.
6778 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
6779 Expression.Resolve() with ResolveFlags.Type instead.
6781 2002-08-12 Martin Baulig <martin@gnome.org>
6783 * interface.cs (Interface.Define): Apply attributes.
6785 * attribute.cs (Attribute.ApplyAttributes): Added support for
6786 interface attributes.
6788 2002-08-11 Martin Baulig <martin@gnome.org>
6790 * statement.cs (Block.Emit): Only check the "this" variable if we
6791 do not always throw an exception.
6793 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6794 whether the property has a set accessor.
6796 2002-08-11 Martin Baulig <martin@gnome.org>
6798 Added control flow analysis support for structs.
6800 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6801 with control flow analysis turned off.
6802 (IVariable): New interface.
6803 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6804 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6805 (FieldExpr.DoResolve): Resolve the instance expression with flow
6806 analysis turned off and do the definite assignment check after the
6807 resolving when we know what the expression will resolve to.
6809 * expression.cs (LocalVariableReference, ParameterReference):
6810 Implement the new IVariable interface, only call the flow analysis
6811 code if ec.DoFlowAnalysis is true.
6812 (This): Added constructor which takes a Block argument. Implement
6813 the new IVariable interface.
6814 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6815 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6816 This does the definite assignment checks for struct members.
6818 * class.cs (Constructor.Emit): If this is a non-static `struct'
6819 constructor which doesn't have any initializer, call
6820 Block.AddThisVariable() to tell the flow analysis code that all
6821 struct elements must be initialized before control returns from
6824 * statement.cs (MyStructInfo): New public class.
6825 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6826 argument to this indexer. If non-zero, check an individual struct
6827 member, not the whole struct.
6828 (FlowBranching.CheckOutParameters): Check struct members.
6829 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6830 overloaded versions of these methods which take an additional
6831 `int field_idx' argument to check struct members.
6832 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6833 overloaded versions of these methods which take an additional
6834 `string field_name' argument to check struct member.s
6835 (VariableInfo): Implement the IVariable interface.
6836 (VariableInfo.StructInfo): New public property. Returns the
6837 MyStructInfo instance of the variable if it's a struct or null.
6838 (Block.AddThisVariable): New public method. This is called from
6839 Constructor.Emit() for non-static `struct' constructor which do
6840 not have any initializer. It creates a special variable for the
6841 "this" instance variable which will be checked by the flow
6842 analysis code to ensure that all of the struct's fields are
6843 initialized before control returns from the constructor.
6844 (UsageVector): Added support for struct members. If a
6845 variable/parameter is a struct with N members, we reserve a slot
6846 in the usage vector for each member. A struct is considered fully
6847 initialized if either the struct itself (slot 0) or all its
6848 members are initialized.
6850 2002-08-08 Martin Baulig <martin@gnome.org>
6852 * driver.cs (Driver.MainDriver): Only report an error CS5001
6853 if there were no compilation errors.
6855 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6856 `UnsafeContext' property to determine whether the parent is in
6857 unsafe context rather than checking the parent's ModFlags:
6858 classes nested in an unsafe class are unsafe as well.
6860 2002-08-08 Martin Baulig <martin@gnome.org>
6862 * statement.cs (UsageVector.MergeChildren): Distinguish between
6863 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6864 we return. Added test17() and test18() to test-154.cs.
6866 2002-08-08 Martin Baulig <martin@gnome.org>
6868 * typemanager.cs (TypeManager.FilterWithClosure): If we have
6869 Family access, make sure the invoking type isn't a subclass of the
6870 queried type (that'd be a CS1540).
6872 * ecore.cs (Expression.MemberLookup): Added overloaded version of
6873 this method which takes an additional `Type invocation_type'.
6875 * expression.cs (BaseAccess.DoResolve): Use the base type as
6876 invocation and query type.
6877 (MemberAccess.DoResolve): If the lookup failed and we're about to
6878 report a CS0122, try a lookup with the ec.ContainerType - if this
6879 succeeds, we must report a CS1540.
6881 2002-08-08 Martin Baulig <martin@gnome.org>
6883 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6884 (MethodGroupExpr): Implement the IMemberExpr interface.
6886 * expression (MemberAccess.ResolveMemberAccess): No need to have
6887 any special code for MethodGroupExprs anymore, they're now
6890 2002-08-08 Martin Baulig <martin@gnome.org>
6892 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6893 Family, FamANDAssem and FamORAssem permissions.
6894 (TypeManager.IsSubclassOrNestedChildOf): New public method.
6896 2002-08-08 Martin Baulig <martin@gnome.org>
6898 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6899 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6902 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6904 * driver.cs: implemented /resource option to embed managed resources.
6906 2002-08-07 Martin Baulig <martin@gnome.org>
6908 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6909 (FieldBase.HasFieldInitializer): New public property.
6910 (FieldBase.GetInitializerExpression): New public method. Resolves and
6911 returns the field initializer and makes sure it is only resolved once.
6912 (TypeContainer.EmitFieldInitializers): Call
6913 FieldBase.GetInitializerExpression to get the initializer, this ensures
6914 that it isn't resolved multiple times.
6916 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
6917 the resolving process (SimpleName/MemberLookup) that we're currently
6918 emitting a field initializer (which must not access any instance members,
6919 this is an error CS0236).
6921 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6922 argument, if the `IsFieldInitializer' flag is set, we must report and
6923 error CS0236 and not an error CS0120.
6925 2002-08-07 Martin Baulig <martin@gnome.org>
6927 * ecore.cs (IMemberExpr): New public interface.
6928 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6929 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6930 if the expression is an IMemberExpr.
6932 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6933 to be null, implicitly default to `this' if we're non-static in
6934 this case. Simplified the code a lot by using the new IMemberExpr
6935 interface. Also fixed bug #28176 here.
6937 2002-08-06 Martin Baulig <martin@gnome.org>
6939 * cs-parser.jay (SimpleLookup): Removed. We need to create
6940 ParameterReferences during semantic analysis so that we can do a
6941 type-only search when resolving Cast, TypeOf and SizeOf.
6942 (block): Pass the `current_local_parameters' to the Block's
6945 * class.cs (ConstructorInitializer): Added `Parameters parameters'
6946 argument to the constructor.
6947 (ConstructorInitializer.Resolve): Create a temporary implicit
6948 block with the parameters.
6950 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6951 references here if we aren't doing a type-only search.
6953 * statement.cs (Block): Added constructor which takes a
6954 `Parameters parameters' argument.
6955 (Block.Parameters): New public property.
6957 * support.cs (InternalParameters.Parameters): Renamed `parameters'
6958 to `Parameters' and made it public readonly.
6960 2002-08-06 Martin Baulig <martin@gnome.org>
6962 * ecore.cs (Expression.Warning): Made this public as well.
6964 * report.cs (Report.Debug): Print the contents of collections.
6966 2002-08-06 Martin Baulig <martin@gnome.org>
6968 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
6969 used to tell Resolve() which kinds of expressions it may return.
6970 (Expression.Resolve): Added overloaded version of this method which
6971 takes a `ResolveFlags flags' argument. This can be used to tell
6972 Resolve() which kinds of expressions it may return. Reports a
6974 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6975 ResolveFlags.SimpleName.
6976 (Expression.Error118): Added overloaded version of this method which
6977 takes a `ResolveFlags flags' argument. It uses the flags to determine
6978 which kinds of expressions are allowed.
6980 * expression.cs (Argument.ResolveMethodGroup): New public method.
6981 Resolves an argument, but allows a MethodGroup to be returned.
6982 This is used when invoking a delegate.
6984 * TODO: Updated a bit.
6986 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6988 Fixed compilation with csc.
6990 * ecore.cs: Expression.Error made public. Is this correct? Should
6991 Warning be made public too?
6993 * expression.cs: use ea.Location instead of ea.loc.
6994 [FIXME: Filed as bug #28607: MCS must report these errors.]
6996 2002-08-06 Martin Baulig <martin@gnome.org>
6998 * ecore.cs (Expression.loc): Moved the location here instead of
6999 duplicating it in all derived classes.
7000 (Expression.Location): New public property.
7001 (Expression.Error, Expression.Warning): Made them non-static and
7002 removed the location argument.
7003 (Expression.Warning): Added overloaded version which takes an
7004 `int level' argument.
7005 (Expression.Error118): Make this non-static and removed the
7006 expression and location arguments.
7007 (TypeExpr): Added location argument to the constructor.
7009 * expression.cs (StaticCallExpr): Added location argument to
7011 (Indirection, PointerArithmetic): Likewise.
7012 (CheckedExpr, UnCheckedExpr): Likewise.
7013 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
7014 (StringPtr): Likewise.
7017 2002-08-05 Martin Baulig <martin@gnome.org>
7019 * expression.cs (BaseAccess.DoResolve): Actually report errors.
7021 * assign.cs (Assign.DoResolve): Check whether the source
7022 expression is a value or variable.
7024 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
7025 while resolving the corresponding blocks.
7027 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
7028 an error, don't silently return null.
7030 * statement.cs (Block.AddVariable): Do the error reporting here
7031 and distinguish between CS0128 and CS0136.
7032 (Block.DoResolve): Report all unused labels (warning CS0164).
7033 (LabeledStatement): Pass the location to the constructor.
7034 (LabeledStatement.HasBeenReferenced): New property.
7035 (LabeledStatement.Resolve): Set it to true here.
7037 * statement.cs (Return.Emit): Return success even after reporting
7038 a type mismatch error (CS0126 or CS0127), this is what csc does and
7039 it avoids confusing the users with any consecutive errors.
7041 2002-08-05 Martin Baulig <martin@gnome.org>
7043 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
7045 * const.cs (Const.LookupConstantValue): Catch circular definitions.
7047 * expression.cs (MemberAccess.DoResolve): Silently return if an
7048 error has already been reported.
7050 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
7051 error has already been reported.
7053 2002-08-05 Martin Baulig <martin@gnome.org>
7055 * statement.cs (UsageVector): Only initialize the `parameters'
7056 vector if we actually have any "out" parameters.
7058 2002-08-05 Martin Baulig <martin@gnome.org>
7060 * expression.cs (Binary.ResolveOperator): When combining delegates,
7061 they must have the same type.
7063 2002-08-05 Martin Baulig <martin@gnome.org>
7065 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
7066 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
7067 work with the ms runtime and we also don't need it: if we're a
7068 PropertyBuilder and not in the `indexer_arguments' hash, then we
7069 are a property and not an indexer.
7071 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
7072 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
7073 since the latter one doesn't work with the ms runtime.
7075 2002-08-03 Martin Baulig <martin@gnome.org>
7077 Fixed bugs #27998 and #22735.
7079 * class.cs (Method.IsOperator): New public field.
7080 (Method.CheckBase): Report CS0111 if there's already a method
7081 with the same parameters in the current class. Report CS0508 when
7082 attempting to change the return type of an inherited method.
7083 (MethodData.Emit): Report CS0179 if a method doesn't have a body
7084 and it's not marked abstract or extern.
7085 (PropertyBase): New abstract base class for Property and Indexer.
7086 (PropertyBase.CheckBase): Moved here from Property and made it work
7088 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
7089 the same so we can reuse it there.
7090 (Property, Indexer): Derive from PropertyBase.
7091 (MethodSignature.inheritable_property_signature_filter): New delegate
7092 to find properties and indexers.
7094 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
7095 argument and improved error reporting.
7097 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
7098 EmptyReadOnlyParameters and made it a property.
7100 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
7101 version of this method which takes a `PropertyInfo indexer'.
7102 (TypeManager.RegisterIndexer): New method.
7104 * class.cs: Added myself as author of this file :-)
7106 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7108 * class.cs: fixed compilation on windoze.
7110 2002-08-03 Martin Baulig <martin@gnome.org>
7112 * interface.cs (Interface.GetInterfaceBases): Check whether all
7113 base interfaces are at least as accessible than the current one.
7115 * class.cs (TypeContainer.GetClassBases): Check whether base types
7116 are at least as accessible than the current type.
7117 (TypeContainer.AsAccessible): Implemented and made non-static.
7118 (MemberBase.CheckParameters): Report errors if the accessibility
7121 * delegate.cs (Delegate.Delegate): The default visibility is
7122 internal for top-level types and private for nested types.
7123 (Delegate.Define): Report errors if the accessibility checks fail.
7125 * enum.cs (Enum.Enum): The default visibility is internal for
7126 top-level types and private for nested types.
7127 (Enum.DefineType): Compute the correct visibility.
7129 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
7130 function which takes a `bool is_toplevel' instead of a TypeContainer.
7132 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
7135 2002-08-02 Martin Baulig <martin@gnome.org>
7137 * expression.cs (LocalVariableReferenc): Added constructor which
7138 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
7139 (LocalVariableReference.IsReadOnly): New property.
7140 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
7141 variable is readonly, use our own readonly flag to do this; you can
7142 use the new constructor to get a writable reference to a read-only
7145 * cs-parser.jay (foreach_statement, using_statement): Get a writable
7146 reference to the local variable.
7148 2002-08-01 Miguel de Icaza <miguel@ximian.com>
7150 * rootcontext.cs (ResolveCore): Also include System.Exception
7152 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
7153 we reach an EmptyStatement.
7155 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
7158 * expression.cs (Binary.ResolveOperator): Check error result in
7161 use brtrue/brfalse directly and avoid compares to null.
7163 2002-08-02 Martin Baulig <martin@gnome.org>
7165 * class.cs (TypeContainer.Define): Define all nested interfaces here.
7166 Fixes bug #28407, added test-155.cs.
7168 2002-08-01 Martin Baulig <martin@gnome.org>
7170 * class.cs (Event.EmitDefaultMethod): Make this work with static
7171 events. Fixes #28311, added verify-3.cs.
7173 2002-08-01 Martin Baulig <martin@gnome.org>
7175 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
7176 `is_disposable' fields.
7177 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
7178 `hm.is_disposable' if we're using the collection pattern.
7179 (Foreach.EmitCollectionForeach): Use the correct type for the
7180 enumerator's local variable, only emit the try/finally block if
7181 necessary (fixes #27713).
7183 2002-08-01 Martin Baulig <martin@gnome.org>
7185 * ecore.cs (Expression.report118): Renamed to Error118 and made
7188 * statement.cs (Throw.Resolve): Check whether the expression is of
7189 the correct type (CS0118) and whether the type derives from
7190 System.Exception (CS0155).
7191 (Catch.Resolve): New method. Do the type lookup here and check
7192 whether it derives from System.Exception (CS0155).
7193 (Catch.CatchType, Catch.IsGeneral): New public properties.
7195 * typemanager.cs (TypeManager.exception_type): Added.
7197 2002-07-31 Miguel de Icaza <miguel@ximian.com>
7199 * driver.cs: Updated About function.
7201 2002-07-31 Martin Baulig <martin@gnome.org>
7203 Implemented Control Flow Analysis.
7205 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
7206 (EmitContext.CurrentBranching): Added.
7207 (EmitContext.StartFlowBranching): Added.
7208 (EmitContext.EndFlowBranching): Added.
7209 (EmitContext.KillFlowBranching): Added.
7210 (EmitContext.IsVariableAssigned): Added.
7211 (EmitContext.SetVariableAssigned): Added.
7212 (EmitContext.IsParameterAssigned): Added.
7213 (EmitContext.SetParameterAssigned): Added.
7214 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
7215 Added control flow analysis stuff here.
7217 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
7218 resolve the expression as lvalue.
7219 (LocalVariableReference.DoResolve): Check whether the variable has
7220 already been assigned.
7221 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
7222 the parameter as assigned here.
7223 (ParameterReference.DoResolve): Check whether the parameter has already
7225 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
7226 expression as lvalue.
7228 * statement.cs (FlowBranching): New class for the flow analysis code.
7229 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
7230 (LabeledStatement.IsDefined): New public property.
7231 (LabeledStatement.AddUsageVector): New public method to tell flow
7232 analyis that the label may be reached via a forward jump.
7233 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
7235 (VariableInfo.Number): New public field. This is used by flow analysis
7236 to number all locals of a block.
7237 (Block.CountVariables): New public property. This is the number of
7238 local variables in this block (including the locals from all parent
7240 (Block.EmitMeta): Number all the variables.
7242 * statement.cs: Added flow analysis support to all classes.
7244 2002-07-31 Martin Baulig <martin@gnome.org>
7246 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
7247 To get debugging messages, compile mcs with /define:MCS_DEBUG and
7248 then use this argument.
7250 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
7252 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
7253 use this to specify /define options.
7255 2002-07-29 Martin Baulig <martin@gnome.org>
7257 * statement.cs (Fixed): Moved all code that does variable lookups
7258 and resolvings from Emit to Resolve.
7260 * statement.cs (For): Moved all code that does variable lookups
7261 and resolvings from Emit to Resolve.
7263 * statement.cs (Using): Moved all code that does variable lookups
7264 and resolvings from Emit to Resolve.
7266 2002-07-29 Martin Baulig <martin@gnome.org>
7268 * attribute.cs (Attribute.Resolve): Explicitly catch a
7269 System.NullReferenceException when creating the
7270 CustromAttributeBuilder and report a different warning message.
7272 2002-07-29 Martin Baulig <martin@gnome.org>
7274 * support.cs (ParameterData.ParameterName): Added method to
7275 get the name of a parameter.
7277 * typemanager.cs (TypeManager.IsValueType): New public method.
7279 2002-07-29 Martin Baulig <martin@gnome.org>
7281 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
7282 is a flag which specifies that it's either ref or out.
7283 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
7284 the out parameter to `out Parameter.Modifier mod', also set the
7285 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
7287 * support.cs (InternalParameters.ParameterModifier): Distinguish
7288 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7289 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7291 * expression.cs (Argument.GetParameterModifier): Distinguish
7292 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7293 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7295 2002-07-29 Martin Baulig <martin@gnome.org>
7297 * expression.cs (ParameterReference.ParameterReference): Added
7298 `Location loc' argument to the constructor.
7300 * cs-parser.jay: Pass location to ParameterReference.
7302 2002-07-28 Miguel de Icaza <miguel@ximian.com>
7304 * statement.cs (Try): Initialize the location.
7306 * cs-parser.jay: pass location to Try.
7308 * expression.cs (Unary.Reduce): Change the prototype to return
7309 whether a constant fold could be performed or not. The result is
7310 returned in an out parameters. In the case of Indirection and
7311 AddressOf, we want to perform the full tests.
7313 2002-07-26 Miguel de Icaza <miguel@ximian.com>
7315 * statement.cs (Statement.Emit): Flag dead code.
7317 2002-07-27 Andrew Birkett <andy@nobugs.org>
7319 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
7321 2002-07-27 Martin Baulig <martin@gnome.org>
7323 * class.cs (MethodData.Define): Put back call to
7324 TypeManager.AddMethod(), accidentally commented this out.
7326 * report.cs (Debug): New public method to print debugging information,
7327 this is `[Conditional ("DEBUG")]'.
7329 2002-07-26 Martin Baulig <martin@gnome.org>
7331 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
7332 (switch_statement): Push the current_block to the switch_stack and
7333 pop it again when we're done with the switch.
7334 (switch_section): The new block is a child of the current_block.
7335 Fixes bug #24007, added test-152.cs.
7337 2002-07-27 Martin Baulig <martin@gnome.org>
7339 * expression.cs (Invocation.EmitArguments): When calling a varargs
7340 function with only its fixed arguments, we need to pass an empty
7343 2002-07-27 Martin Baulig <martin@gnome.org>
7345 Mono 0.13 has been released.
7347 2002-07-25 Miguel de Icaza <miguel@ximian.com>
7349 * driver.cs: Rename --resource to --linkres, because that is what
7350 we do currently, we dont support --resource yet.
7352 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
7354 2002-07-25 Martin Baulig <martin@gnome.org>
7356 * class.cs (MethodData): New public class. This is a `method builder'
7357 class for a method or one accessor of a Property/Indexer/Event.
7358 (MethodData.GetMethodFlags): Moved here from MemberBase.
7359 (MethodData.ApplyAttributes): Likewise.
7360 (MethodData.ApplyObsoleteAttribute): Likewise.
7361 (MethodData.ApplyConditionalAttribute): Likewise.
7362 (MethodData.ApplyDllImportAttribute): Likewise.
7363 (MethodData.CheckAbstractAndExternal): Likewise.
7364 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
7365 (MethodData.Emit): Formerly known as Method.Emit().
7366 (MemberBase): Moved everything which was specific to a single
7367 accessor/method to MethodData.
7368 (Method): Create a new MethodData and call Define() and Emit() on it.
7369 (Property, Indexer, Event): Create a new MethodData objects for each
7370 accessor and call Define() and Emit() on them.
7372 2002-07-25 Martin Baulig <martin@gnome.org>
7374 Made MethodCore derive from MemberBase to reuse the code from there.
7375 MemberBase now also checks for attributes.
7377 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
7378 (MemberBase.GetMethodFlags): Moved here from class Method and marked
7380 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
7381 `CallingConventions cc' and `Attributes opt_attrs' arguments.
7382 (MemberBase.ApplyAttributes): New virtual method; applies the
7383 attributes to a method or accessor.
7384 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
7385 (MemberBase.ApplyConditionalAttribute): Likewise.
7386 (MemberBase.ApplyDllImportAttribute): Likewise.
7387 (MemberBase.CheckAbstractAndExternal): Likewise.
7388 (MethodCore.ParameterTypes): This is now a property instead of a
7389 method, it's initialized from DoDefineParameters().
7390 (MethodCore.ParameterInfo): Removed the set accessor.
7391 (MethodCore.DoDefineParameters): New protected virtual method to
7392 initialize ParameterTypes and ParameterInfo.
7393 (Method.GetReturnType): We can now simply return the MemberType.
7394 (Method.GetMethodFlags): Override the MemberBase version and add
7395 the conditional flags.
7396 (Method.CheckBase): Moved some code from Define() here, call
7397 DoDefineParameters() here.
7398 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
7399 here to avoid some larger code duplication.
7400 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
7401 ensure that abstract and external accessors don't declare a body.
7403 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
7404 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
7405 lookup in the attribute's parent classes, so we need to abort as soon
7406 as we found the first match.
7407 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
7408 the attribute has no arguments.
7410 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
7413 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7415 * cs-parser.jay: reverted previous patch.
7417 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7419 * cs-parser.jay: fixed bug #22119.
7421 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7423 * attribute.cs: fixed compilation. The error was:
7424 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
7425 be assigned to before control leaves the current method."
7426 [FIXME: Filed as bug #28186: MCS must report this error.]
7428 2002-07-25 Martin Baulig <martin@gnome.org>
7430 * attribute.cs (Attribute.Conditional_GetConditionName): New static
7431 method to pull the condition name ouf of a Conditional attribute.
7432 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
7433 the obsolete message and error flag out of an Obsolete attribute.
7435 * class.cs (Method.GetMethodFlags): New public method to get the
7436 TypeManager.MethodFlags for this method.
7437 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
7439 (Method.Define): Get and apply the Obsolete and Conditional attributes;
7440 if we're overriding a virtual function, set the new private variable
7441 `parent_method'; call the new TypeManager.AddMethod().
7443 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
7444 the MethodBuilder and the Method in a PtrHashtable.
7445 (TypeManager.builder_to_method): Added for this purpose.
7446 (TypeManager.MethodFlags): Added IsObsoleteError.
7447 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
7448 Obsolete and Conditional arguments in MethodBuilders. If we discover
7449 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
7450 the message from the attribute.
7452 2002-07-24 Martin Baulig <martin@gnome.org>
7454 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
7455 preprocessor directives, ensure that the argument to #define/#undef is
7456 exactly one identifier and that it's actually an identifier.
7458 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
7461 2002-07-24 Martin Baulig <martin@gnome.org>
7463 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
7464 initialize it to TypeManager.object_type in the constructor.
7465 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
7466 of the `hm.get_current' method if we're using the collection pattern.
7467 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
7468 for the explicit conversion to make it work when we're using the collection
7469 pattern and the `Current' property has a different return type than `object'.
7472 2002-07-24 Martin Baulig <martin@gnome.org>
7474 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
7475 does not match, but don't report any errors. This method is called in
7476 order for all methods in a MethodGroupExpr until a matching method is
7477 found, so we don't want to bail out if the first method doesn't match.
7478 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
7479 matches, report the 123. Fixes #28070.
7481 2002-07-24 Martin Baulig <martin@gnome.org>
7483 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
7484 TypeManager.TypeToCoreType() to the top of the method so the
7485 following equality checks will work. Fixes #28107.
7487 2002-07-24 Martin Baulig <martin@gnome.org>
7489 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
7490 operand is of type uint, and the other operand is of type sbyte,
7491 short or int, the operands are converted to type long." -
7492 Actually do what this comment already told us. Fixes bug #28106,
7495 2002-07-24 Martin Baulig <martin@gnome.org>
7497 * class.cs (MethodBase): New abstract class. This is now a base
7498 class for Property, Indexer and Event to avoid some code duplication
7499 in their Define() and DefineMethods() methods.
7500 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
7501 generic methods for Define() and DefineMethods().
7502 (FieldBase): Derive from MemberBase, not MemberCore.
7503 (Property): Derive from MemberBase, not MemberCore.
7504 (Property.DefineMethod): Moved all the code from this method to the
7505 new MethodBase.DefineAccessor(), just call it with appropriate
7507 (Property.Define): Call the new Property.DoDefine(), this does some
7508 sanity checks and we don't need to duplicate the code everywhere.
7509 (Event): Derive from MemberBase, not MemberCore.
7510 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
7511 accessors, this will also make them work with interface events.
7512 (Indexer): Derive from MemberBase, not MemberCore.
7513 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
7514 (Indexer.Define): Use the new MethodBase functions.
7516 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
7517 argument to the constructor.
7518 (Interface.FindMembers): Added support for interface events.
7519 (Interface.PopluateEvent): Implemented.
7521 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
7523 2002-07-22 Miguel de Icaza <miguel@ximian.com>
7525 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
7526 but this is required to check for a method name being the same as
7527 the containing class.
7531 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7533 * interface.cs: initialize variable.
7535 2002-07-23 Martin Baulig <martin@gnome.org>
7537 Implemented the IndexerName attribute in interfaces.
7539 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
7540 name if this is an explicit interface implementation.
7541 (Indexer.InterfaceIndexerName): New public variable. If we're
7542 implementing an interface indexer, this is the IndexerName in that
7543 interface. Otherwise, it's the IndexerName.
7544 (Indexer.DefineMethod): If we're implementing interface indexer,
7545 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
7546 and Pending.ImplementIndexer methods.
7547 (Indexer.Define): Also define the PropertyBuilder if we're
7548 implementing an interface indexer and this is neither an explicit
7549 interface implementation nor do the IndexerName match the one in
7552 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
7553 If a method is defined here, then we always need to create a proxy
7554 for it. This is used when implementing interface indexers.
7555 (Pending.IsInterfaceIndexer): New public method.
7556 (Pending.ImplementIndexer): New public method.
7557 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
7558 This is used when implementing interface indexers to define a proxy
7560 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
7561 define a proxy if necessary.
7563 * interface.cs (Interface.IndexerName): New public variable.
7564 (Interface.PopulateIndexer): Set the IndexerName.
7565 (Interface.DefineIndexers): New private method. Populate all the
7566 indexers and make sure their IndexerNames match.
7568 * typemanager.cs (IndexerPropertyName): Added support for interface
7571 2002-07-22 Martin Baulig <martin@gnome.org>
7573 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
7574 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
7575 ret if HasReturnLabel.
7576 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
7579 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
7580 and set the ec.LoopBeginTryCatchLevel.
7581 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
7582 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
7583 the current ec.TryCatchLevel, the branch goes out of an exception
7584 block. In this case, we need to use Leave and not Br.
7586 2002-07-22 Martin Baulig <martin@gnome.org>
7588 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
7589 block unless the block does not always return or it is contained in
7590 another try { ... } catch { ... } block. Fixes bug #26506.
7591 Added verify-1.cs to the test suite.
7593 2002-07-22 Martin Baulig <martin@gnome.org>
7595 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
7596 then we do not always return. Fixes bug #24985.
7598 2002-07-22 Martin Baulig <martin@gnome.org>
7600 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
7601 lookup on a per-class level; ie. walk up the class hierarchy until we
7602 found at least one applicable method, then choose the best among them.
7603 Fixes bug #24463 and test-29.cs.
7605 2002-07-22 Martin Baulig <martin@gnome.org>
7607 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
7608 return types of the methods. The return type is not part of the
7609 signature and we must not check it to make the `new' modifier work.
7610 Fixes bug #27999, also added test-147.cs.
7611 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
7613 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
7614 on the method's return type.
7616 2002-07-21 Martin Baulig <martin@gnome.org>
7618 * assign.cs: Make this work if the rightmost source is a constant and
7619 we need to do an implicit type conversion. Also adding a few more tests
7620 to test-38.cs which should have caught this.
7622 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
7623 target in the makefile for this. The makefile.gnu is primarily intended
7624 for end-users who don't want to debug the compiler.
7626 2002-07-21 Martin Baulig <martin@gnome.org>
7628 * assign.cs: Improved the Assign class so it can now handle embedded
7629 assignments (X = Y = Z = something). As a side-effect this'll now also
7630 consume less local variables. test-38.cs now passes with MCS, added
7631 a few new test cases to that test.
7633 2002-07-20 Martin Baulig <martin@gnome.org>
7635 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
7636 instructions. Fixes bug #27977, also added test-146.cs.
7638 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7640 * cs-tokenizer.cs: fixed getHex ().
7642 2002-07-19 Martin Baulig <martin@gnome.org>
7644 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
7645 not Type.GetType() to lookup the array type. This is needed when
7646 we're constructing an array of a user-defined type.
7647 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
7648 single-dimensional arrays, but also for single-dimensial arrays of
7651 2002-07-19 Martin Baulig <martin@gnome.org>
7653 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
7654 this function is called, it's not allowed to share LocalBuilders
7657 2002-07-19 Martin Baulig <martin@gnome.org>
7659 * expression.cs (Argument.Resolve): Report an error 118 when trying
7660 to pass a type as argument.
7662 2002-07-18 Martin Baulig <martin@gnome.org>
7664 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
7665 Conv_R_Un for the signed `long' type.
7667 2002-07-15 Miguel de Icaza <miguel@ximian.com>
7669 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
7670 `expr' for the temporary result, as that will fail if we do
7671 multiple resolves on the same expression.
7673 2002-07-05 Miguel de Icaza <miguel@ximian.com>
7675 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
7676 ec.TypeContainer for looking up aliases.
7678 * class.cs (TypeContainer): Remove LookupAlias from here.
7680 * decl.cs (DeclSpace); Move here.
7682 2002-07-01 Miguel de Icaza <miguel@ximian.com>
7684 * class.cs (FindMembers): Only call filter if the constructor
7685 bulider is not null.
7687 Also handle delegates in `NestedTypes' now. Now we will perform
7688 type lookups using the standard resolution process. This also
7691 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7692 This uses Expressions (the limited kind that can be parsed by the
7693 tree) instead of strings.
7695 * expression.cs (ComposedCast.ToString): Implement, used to flag
7696 errors since now we have to render expressions.
7698 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
7701 * ecore.cs (SimpleName.ToString): ditto.
7703 * cs-parser.jay: Instead of using strings to assemble types, use
7704 Expressions to assemble the type (using SimpleName, ComposedCast,
7705 MemberAccess). This should fix the type lookups in declarations,
7706 because we were using a different code path for this.
7708 * statement.cs (Block.Resolve): Continue processing statements
7709 even when there is an error.
7711 2002-07-17 Miguel de Icaza <miguel@ximian.com>
7713 * class.cs (Event.Define): Also remove the `remove' method from
7714 the list of pending items.
7716 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7717 generate more compact code.
7719 2002-07-17 Martin Baulig <martin@gnome.org>
7721 * const.cs (Const.LookupConstantValue): Add support for constant
7722 `unchecked' and `checked' expressions.
7723 Also adding test case test-140.cs for this.
7725 2002-07-17 Martin Baulig <martin@gnome.org>
7727 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7728 check whether mi.ReturnType implements the IEnumerator interface; the
7729 `==' and the IsAssignableFrom() will fail in this situation.
7731 2002-07-16 Ravi Pratap <ravi@ximian.com>
7733 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
7736 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7738 * expression.cs: fixed bug #27811.
7740 2002-07-14 Miguel de Icaza <miguel@ximian.com>
7742 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7743 Molaro: when we are a ref, the value already contains a pointer
7744 value, do not take the address of it.
7746 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7747 * removed mb-parser.jay and mb-tokenizer.cs
7749 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7751 * expression.cs: check against the building corlib void type.
7753 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7755 * ecore.cs: fix for valuetype static readonly fields: when
7756 initializing them, we need their address, not the address of a copy.
7758 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7760 * typemanager.cs: register also enum_type in corlib.
7762 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7764 * class.cs: allow calling this (but not base) initializers in structs.
7766 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7768 * ecore.cs: make sure we compare against the building base types
7771 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7773 * typemanager.cs: fix TypeToCoreType() to handle void and object
7774 (corlib gets no more typerefs after this change).
7776 2002-07-12 Miguel de Icaza <miguel@ximian.com>
7778 * expression.cs (ArrayCreation.EmitArrayArguments): use
7779 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7781 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7782 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
7783 array indexes, the runtime actually forbids them.
7785 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7786 for array arguments here.
7788 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7789 instead of the default for ValueTypes.
7791 (New.DoEmit): Use IsValueType instead of
7792 IsSubclassOf (value_type)
7793 (New.DoResolve): ditto.
7794 (Invocation.EmitCall): ditto.
7796 * assign.cs (Assign): ditto.
7798 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7799 Statements *are* currently doing part of their resolution during
7802 Expressions do always resolve during resolve, but statements are
7803 only required to propagate resolution to their children.
7805 2002-07-11 Miguel de Icaza <miguel@ximian.com>
7807 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7809 (LoadAssembly): Do not add the dll if it is already specified
7811 (MainDriver): Add the System directory to the link path at the end,
7812 after all the other -L arguments.
7814 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7815 wrong opcode for loading bytes and bools (ldelem.i1 instead of
7816 ldelem.u1) and using the opposite for sbytes.
7818 This fixes Digger, and we can finally run it.
7820 * driver.cs (UnixParseOption): Move the option parsing here.
7821 (CSCParseOption): Implement CSC-like parsing of options.
7823 We now support both modes of operation, the old Unix way, and the
7824 new CSC-like way. This should help those who wanted to make cross
7827 The only thing broken is that /r:, /reference: and /lib: are not
7828 implemented, because I want to make those have the same semantics
7829 as the CSC compiler has, and kill once and for all the confussion
7830 around this. Will be doing this tomorrow.
7832 * statement.cs (Unsafe.Resolve): The state is checked during
7833 resolve, not emit, so we have to set the flags for IsUnsfe here.
7835 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7837 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7838 not catch the Error_ObjectRefRequired in SimpleName (as it is
7839 possible to have a class/instance variable name that later gets
7840 deambiguated), we have to check this here.
7842 2002-07-10 Ravi Pratap <ravi@ximian.com>
7844 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7845 make static and put into Expression.
7847 (Event.Define): Register the private field of the event with the
7848 TypeManager so that GetFieldFromEvent can get at it.
7850 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7851 keep track of the private field associated with an event which
7854 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7857 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7859 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7861 * expression.cs (Binary.EmitBranchable): this routine emits the
7862 Binary expression in a branchable context. This basically means:
7863 we need to branch somewhere, not just get the value on the stack.
7865 This works together with Statement.EmitBoolExpression.
7867 * statement.cs (Statement.EmitBoolExpression): Use
7870 2002-07-09 Miguel de Icaza <miguel@ximian.com>
7872 * statement.cs (For): Reduce the number of jumps in loops.
7874 (For): Implement loop inversion for the For statement.
7876 (Break): We can be breaking out of a Try/Catch controlled section
7877 (foreach might have an implicit try/catch clause), so we need to
7878 use Leave instead of Br.
7880 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7881 now). If the instace expression supports IMemoryLocation, we use
7882 the AddressOf method from the IMemoryLocation to extract the
7883 address instead of emitting the instance.
7885 This showed up with `This', as we were emitting the instance
7886 always (Emit) instead of the Address of This. Particularly
7887 interesting when This is a value type, as we dont want the Emit
7888 effect (which was to load the object).
7890 2002-07-08 Miguel de Icaza <miguel@ximian.com>
7892 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7894 * statement.cs (Checked): Set the CheckedState during the resolve
7895 process too, as the ConvCast operations track the checked state on
7896 the resolve process, and not emit.
7898 * cs-parser.jay (namespace_member_declaration): Flag that we have
7899 found a declaration when we do. This is used to flag error 1529
7901 * driver.cs: Report ok when we display the help only.
7903 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
7905 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7907 2002-07-04 Miguel de Icaza <miguel@ximian.com>
7909 * cs-tokenizer.cs (define): We also have to track locally the
7910 defines. AllDefines is just used for the Conditional Attribute,
7911 but we also need the local defines for the current source code.
7913 2002-07-03 Miguel de Icaza <miguel@ximian.com>
7915 * statement.cs (While, For, Do): These loops can exit through a
7916 Break statement, use this information to tell whether the
7917 statement is the last piece of code.
7919 (Break): Flag that we break.
7921 * codegen.cs (EmitContexts): New `Breaks' state variable.
7923 2002-07-03 Martin Baulig <martin@gnome.org>
7925 * class.cs (TypeContainer.MethodModifiersValid): Allow override
7926 modifiers in method declarations in structs. Otherwise, you won't
7927 be able to override things like Object.Equals().
7929 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7931 * class.cs (Method, Property, Indexer): Do not allow the public
7932 modifier to be used in explicit interface implementations.
7934 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7935 override modifiers in method declarations in structs
7937 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
7939 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7940 integer or real overflow, report an error
7942 2002-07-02 Martin Baulig <martin@gnome.org>
7944 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7945 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7946 to tell the runtime about our newly created System.Object and
7947 System.ValueType types.
7949 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7951 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7952 struct instead of Ldarg/Starg.
7954 2002-07-02 Martin Baulig <martin@gnome.org>
7956 * expression.cs (Indirection.Indirection): Call
7957 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7959 2002-07-02 Martin Baulig <martin@gnome.org>
7961 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7962 ValueType, call TypeManager.TypeToCoreType() on it.
7963 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7964 the OpCodes.Newarr argument.
7966 2002-07-02 Martin Baulig <martin@gnome.org>
7968 * expression.cs (Invocation.EmitCall): When compiling corlib,
7969 replace all calls to the system's System.Array type to calls to
7970 the newly created one.
7972 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7973 System.Array methods.
7974 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7975 from the system's System.Array type which must be replaced.
7977 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7979 * typemanager.cs: load unverifiable_code_ctor so we can build
7980 corlib using the correct type. Avoid using GetTypeCode() with
7982 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7983 TypeManager.object_type to allow building corlib.
7985 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7987 * ecore.cs: handle System.Enum separately in LoadFromPtr().
7989 2002-07-01 Martin Baulig <martin@gnome.org>
7991 * class.cs: Make the last change actually work, we need to check
7992 whether `ifaces != null' to avoid a crash.
7994 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7996 * class.cs: when we build structs without fields that implement
7997 interfaces, we need to add the interfaces separately, since there is
7998 no API to both set the size and add the interfaces at type creation
8001 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
8003 * expression.cs: the dimension arguments to the array constructors
8004 need to be converted if they are a long.
8006 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
8008 * class.cs: don't emit ldarg.0 if there is no parent constructor
8009 (fixes showstopper for corlib).
8011 2002-06-29 Martin Baulig <martin@gnome.org>
8013 MCS now compiles corlib on GNU/Linux :-)
8015 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
8016 ie. check for MethodImplOptions.InternalCall.
8018 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
8019 and TypeManager.attribute_type are null, so we must explicitly check
8020 whether parent is not null to find out whether it's an attribute type.
8021 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
8022 and SetBuilder, not only if the property is neither abstract nor external.
8023 This is necessary to set the MethodImplOptions on the accessor methods.
8024 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
8025 SetBuilder, see Property.Emit().
8027 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
8028 populate "System.Object", "System.ValueType" and "System.Attribute" since
8029 they've already been populated from BootCorlib_PopulateCoreTypes().
8031 2002-06-29 Martin Baulig <martin@gnome.org>
8033 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
8034 is the NullLiteral, we also need to make sure that target_type is not
8037 2002-06-29 Martin Baulig <martin@gnome.org>
8039 * rootcontext.cs (RootContext.ResolveCore): We must initialize
8040 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
8041 before calling BootstrapCorlib_ResolveDelegate ().
8043 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8045 * statement.cs: fixed build-breaker. All tests passed ok.
8047 2002-06-27 Martin Baulig <martin@gnome.org>
8049 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
8050 for System.Decimal when compiling corlib.
8052 2002-06-27 Martin Baulig <martin@gnome.org>
8054 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
8055 switch blocks which contain nothing but a default clause.
8057 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
8059 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
8061 2002-06-27 Martin Baulig <martin@gnome.org>
8063 * ecore.cs (PropertyExpr.PropertyExpr): Call
8064 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
8066 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
8067 is already a TypeBuilder.
8069 2002-06-27 Martin Baulig <martin@gnome.org>
8071 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
8072 `target_type == TypeManager.array_type', not IsAssignableFrom() in
8073 the "from an array-type to System.Array" case. This makes it work
8074 when compiling corlib.
8076 2002-06-27 Martin Baulig <martin@gnome.org>
8078 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
8079 non-static PropertyExpr, set its InstanceExpression. This makes
8080 the `ICollection.Count' property work in System/Array.cs.
8082 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
8084 * driver.cs: Made error handling more consistent. Errors now
8085 tracked by Report class, so many methods which used to return int
8086 now return void. Main() now prints success/failure and
8087 errors/warnings message.
8089 Renamed '--probe' compiler argument to '--expect-error'. Removed
8090 the magic number return values (123 and 124). Now, if the
8091 expected error occurs, the compiler exits with success (exit value
8092 0). If the compilation completes without seeing that particular
8093 error, the compiler exits with failure (exit value 1). The
8094 makefile in mcs/errors has been changed to handle the new behaviour.
8096 * report.cs: Made 'expected error' number a property and renamed
8097 it from 'Probe' to 'ExpectedError'.
8099 * genericparser.cs: Removed error handling support, since it is
8100 now all done by Report class.
8102 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
8103 class, so parse() no longer returns an int.
8105 * namespace.cs: Use Report.Error instead of GenericParser.error
8107 2002-06-22 Miguel de Icaza <miguel@ximian.com>
8109 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
8110 TypeContainer.AddOperator): At the front of the list put the
8111 explicit implementations, so they get resolved/defined first.
8113 2002-06-21 Miguel de Icaza <miguel@ximian.com>
8115 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
8116 interface type is implemented by this TypeContainer. Used during
8117 explicit interface implementation.
8119 (Property.Define, Indexer.Define, Method.Define): Validate that
8120 the given interface in the explicit implementation is one of the
8121 base classes for the containing type.
8123 Also if we are explicitly implementing an interface, but there is
8124 no match in the pending implementation table, report an error.
8126 (Property.Define): Only define the property if we are
8127 not explicitly implementing a property from an interface. Use the
8128 correct name also for those properties (the same CSC uses,
8129 although that is really not needed).
8131 (Property.Emit): Do not emit attributes for explicitly implemented
8132 properties, as there is no TypeBuilder.
8134 (Indexer.Emit): ditto.
8136 Hiding then means that we do not really *implement* a pending
8137 implementation, which makes code fail.
8139 2002-06-22 Martin Baulig <martin@gnome.org>
8141 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
8142 the return value of Object.GetType(). [FIXME: we need to do this whenever
8143 we get a type back from the reflection library].
8145 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
8147 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
8149 2002-06-20 Miguel de Icaza <miguel@ximian.com>
8151 * attribute.cs: Return null if we can not look up the type.
8153 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
8154 the interface types found.
8156 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
8157 interface types found.
8159 * typemanager.cs (GetInterfaces): Make this routine returns alll
8160 the interfaces and work around the lame differences between
8161 System.Type and System.Reflection.Emit.TypeBuilder in the results
8162 result for GetInterfaces.
8164 (ExpandInterfaces): Given an array of interface types, expand and
8165 eliminate repeated ocurrences of an interface. This expands in
8166 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
8169 2002-06-21 Martin Baulig <martin@gnome.org>
8171 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
8174 2002-06-21 Martin Baulig <martin@gnome.org>
8176 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
8177 and called with one of the core types, return the corresponding typebuilder for
8180 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
8183 2002-06-21 Martin Baulig <martin@gnome.org>
8185 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
8186 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
8187 (Expression.ConvertReferenceExplicit): Likewise.
8189 * expression.cs (ElementAccess.DoResolve): Likewise.
8190 (ElementAccess.DoResolveLValue): Likewise.
8192 2002-06-10 Martin Baulig <martin@gnome.org>
8194 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
8195 add the "value" parameter to the parameter list.
8197 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
8200 2002-06-19 Miguel de Icaza <miguel@ximian.com>
8202 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
8203 the argument to an int, uint, long or ulong, per the spec. Also
8204 catch negative constants in array creation.
8206 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
8208 * class.cs: do not allow the same interface to appear twice in
8209 the definition list.
8211 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
8213 * ecore.cs: don't use ldlen with System.Array.
8215 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
8217 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
8219 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
8221 * modifiers.cs: produce correct field attributes for protected
8222 internal. Easy fix so miguel can work on ther harder stuff:-)
8224 2002-06-18 Miguel de Icaza <miguel@ximian.com>
8226 * pending.cs: New file. Move the code from class.cs here.
8227 Support clearning the pending flag for all methods (when not doing
8228 explicit interface implementation).
8230 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
8232 * rootcontext.cs: added a couple more types needed to bootstrap.
8234 2002-06-17 Miguel de Icaza <miguel@ximian.com>
8236 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
8237 constructor in the type, instead of any constructor in the type
8238 hierarchy. Thanks to Paolo for finding this bug (it showed up as
8239 a bug in the Mono runtime when applying the params attribute).
8241 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
8242 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
8244 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
8246 * expression.cs (Unary.ResolveOperator): Use TypeManager
8247 to resolve the type.
8249 2002-06-13 Ravi Pratap <ravi@ximian.com>
8251 * cs-parser.jay (enum_member_declaration): Pass in the attributes
8254 * enum.cs (AddEnumMember): Add support to store the attributes associated
8255 with each member too.
8257 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
8258 field builders too - this takes care of the enum member case.
8260 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
8262 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
8263 address-of operator on both value types and pointers.
8265 2002-06-10 Martin Baulig <martin@gnome.org>
8267 * interface.cs (Interface.PopulateIndexer): Add the indexer's
8268 PropertyBuilder to the `property_builders' list.
8270 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
8271 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
8272 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
8273 find any indexers which are inherited from an interface.
8275 2002-06-09 Martin Baulig <martin@gnome.org>
8277 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
8278 the same type as the constant if necessary. There's also a test-130.cs
8281 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
8283 * typemanager.cs (TypeManager.ChangeType): Previously known as
8284 Enum.ChangeEnumType().
8286 2002-06-09 Martin Baulig <martin@gnome.org>
8288 * expression.cs (Cast.TryReduce): Added support for consts.
8290 2002-06-08 Ravi Pratap <ravi@ximian.com>
8292 * class.cs (Accessor): Hold attributes information so we can pass
8295 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
8296 Modify to pass in attributes attached to the methods.
8298 (add_accessor_declaration, remove_accessor_declaration): Ditto.
8300 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
8301 to handle the Accessor kind :-)
8303 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
8305 2002-06-08 Martin Baulig <martin@gnome.org>
8307 * expression.cs (Unary.TryReduceNegative): Added support for
8310 2002-06-08 Martin Baulig <martin@gnome.org>
8312 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
8313 name can't be found in the `defined_names' - the caller will do a
8314 MemberLookup in this case and thus find methods in System.Enum
8315 such as Enum.IsDefined().
8317 2002-06-08 Martin Baulig <martin@gnome.org>
8319 * enum.cs (Enum.ChangeEnumType): This is a custom version of
8320 Convert.ChangeType() which works with TypeBuilder created types.
8321 (Enum.LookupEnumValue, Enum.Define): Use it here.
8323 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
8324 `TypeBuilder.BaseType != null' check.
8325 (TypeContainer.FindMembers): Only lookup parent members if we
8326 actually have a parent.
8327 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
8328 (ConstructorInitializer.Resolve): Likewise.
8330 * interface.cs (Interface.FindMembers): Added
8331 `TypeBuilder.BaseType != null' check.
8333 * rootcontext.cs (RootContext.ResolveCore): Added
8334 "System.Runtime.CompilerServices.IndexerNameAttribute" to
8335 classes_second_stage.
8337 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
8338 debug_type and trace_type when compiling with --nostdlib.
8340 2002-06-07 Martin Baulig <martin@gnome.org>
8342 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
8343 (AddField): Set it to true when adding a non-static field.
8344 (DefineType): Use `have_nonstatic_fields' to find out whether we
8345 have non-static fields, not `Fields != null'.
8347 2002-06-02 Miguel de Icaza <miguel@ximian.com>
8349 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
8350 dereferencing a null on the static-field code path)
8352 2002-05-30 Martin Baulig <martin@gnome.org>
8354 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
8355 to take command line arguments. Use reflection to call the new
8356 custom `Initialize' function on the symbol writer and pass it the
8357 command line arguments.
8359 * driver.cs (--debug-args): New command line argument to pass command
8360 line arguments to the symbol writer.
8362 2002-05-28 Miguel de Icaza <miguel@ximian.com>
8364 * assign.cs (DoResolve): Forgot to do the implicit conversion to
8365 the target type for indexers and properties. Thanks to Joe for
8368 2002-05-27 Miguel de Icaza <miguel@ximian.com>
8370 * typemanager.cs (MethodFlags): returns the method flags
8371 (Obsolete/ShouldIgnore) that control warning emission and whether
8372 the invocation should be made, or ignored.
8374 * expression.cs (Invocation.Emit): Remove previous hack, we should
8375 not do this on matching a base type, we should do this based on an attribute
8377 Only emit calls to System.Diagnostics.Debug and
8378 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
8379 on the command line.
8381 * rootcontext.cs: Global settings for tracing and debugging.
8383 * cs-tokenizer.cs (define): New utility function to track
8384 defines. Set the global settings for TRACE and DEBUG if found.
8386 2002-05-25 Ravi Pratap <ravi@ximian.com>
8388 * interface.cs (Populate*): Pass in the TypeContainer as well as
8389 the DeclSpace as parameters so that we can create EmitContexts and
8390 then use that to apply attributes etc.
8392 (PopulateMethod, PopulateEvent, PopulateProperty)
8393 (PopulateIndexer): Apply attributes everywhere.
8395 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
8398 (ApplyAttributes): Update accordingly.
8400 We now apply interface attributes for all members too.
8402 2002-05-26 Miguel de Icaza <miguel@ximian.com>
8404 * class.cs (Indexer.Define); Correctly check if we are explicit
8405 implementation (instead of checking the Name for a ".", we
8406 directly look up if the InterfaceType was specified).
8408 Delay the creation of the PropertyBuilder.
8410 Only create the PropertyBuilder if we are not an explicit
8411 interface implementation. This means that explicit interface
8412 implementation members do not participate in regular function
8413 lookups, and hence fixes another major ambiguity problem in
8414 overload resolution (that was the visible effect).
8416 (DefineMethod): Return whether we are doing an interface
8419 * typemanager.cs: Temporary hack until we get attributes in
8420 interfaces (Ravi is working on that) and we get IndexerName
8421 support in interfaces.
8423 * interface.cs: Register the indexers as properties.
8425 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
8426 warning, I have verified that this is a bug in the .NET runtime
8427 (JavaScript suffers of the same problem).
8429 * typemanager.cs (MemberLookup): When looking up members for
8430 interfaces, the parent of an interface is the implicit
8431 System.Object (so we succeed in searches of Object methods in an
8432 interface method invocation. Example: IEnumerable x; x.ToString
8435 2002-05-25 Miguel de Icaza <miguel@ximian.com>
8437 * class.cs (Event): Events should also register if they do
8438 implement the methods that an interface requires.
8440 * typemanager.cs (MemberLookup); use the new GetInterfaces
8443 (GetInterfaces): The code used to lookup interfaces for a type is
8444 used in more than one place, factor it here.
8446 * driver.cs: Track the errors at the bottom of the file, we kept
8449 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
8450 instance if the method we are calling is static!
8452 2002-05-24 Miguel de Icaza <miguel@ximian.com>
8454 * attribute.cs (ApplyAttributes): Make this function filter out
8455 the IndexerName attribute (as that attribute in reality is never
8456 applied) and return the string constant for the IndexerName
8459 * class.cs (TypeContainer.Emit): Validate that all the indexers
8460 have the same IndexerName attribute, and if so, set the
8461 DefaultName attribute on the class.
8463 * typemanager.cs: The return value might contain other stuff (not
8464 only methods). For instance, consider a method with an "Item"
8465 property and an Item method.
8467 * class.cs: If there is a problem with the parameter types,
8470 2002-05-24 Ravi Pratap <ravi@ximian.com>
8472 * ecore.cs (ImplicitConversionExists): Wrapper function which also
8473 looks at user defined conversion after making a call to
8474 StandardConversionExists - we need this for overload resolution.
8476 * expression.cs : Update accordingly the various method calls.
8478 This fixes 2 bugs filed against implicit user defined conversions
8480 2002-05-22 Miguel de Icaza <miguel@ximian.com>
8482 * statement.cs: Track the result of the assignment.
8484 2002-05-21 Miguel de Icaza <miguel@ximian.com>
8486 * expression.cs (MemberAccess): Improved error reporting for
8487 inaccessible members.
8489 2002-05-22 Martin Baulig <martin@gnome.org>
8491 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
8492 itself with debugging support.
8494 2002-05-22 Martin Baulig <martin@gnome.org>
8496 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
8497 Removed, this isn't needed anymore.
8499 2002-05-20 Martin Baulig <martin@gnome.org>
8501 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
8502 be underlying type for an enum.
8504 2002-05-20 Miguel de Icaza <miguel@ximian.com>
8506 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
8507 that splits out the loading of just the core types.
8509 * rootcontext.cs (ResolveCore): Split the struct resolution in
8510 two, so we can load the enumeration underlying types before any
8513 * expression.cs (Is): Bandaid until we fix properly Switch (see
8514 bug #24985 for details).
8516 * typemanager.cs (ImplementsInterface): The hashtable will contain
8517 a null if there are no interfaces implemented.
8519 2002-05-18 Miguel de Icaza <miguel@ximian.com>
8521 * cs-parser.jay (indexer_declarator): It is fine to have array
8524 2002-05-17 Miguel de Icaza <miguel@ximian.com>
8526 * typemanager.cs: (RegisterBuilder): New function used to register
8527 TypeBuilders that implement interfaces. Since
8528 TypeBuilder.GetInterfaces (as usual) does not work with lame
8530 (AddUserType): register interfaces.
8532 (ImplementsInterface): Use the builder_to_ifaces hash if we are
8533 dealing with TypeBuilder. Also, arrays are showing up as
8534 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
8535 methods can not be invoked on them!
8537 * ecore.cs (ExplicitReferenceConversionExists): Made public.
8538 (ImplicitReferenceConversionExists): Split out from
8539 StandardConversionExists.
8541 * expression.cs (As): We were only implementing one of the three
8542 cases for the as operator. We now implement them all.
8543 (Is): Implement the various other cases for Is as well.
8545 * typemanager.cs (CACHE): New define used to control if we want or
8546 not the FindMembers cache. Seems to have a negative impact on
8547 performance currently
8549 (MemberLookup): Nested types have full acess to
8550 enclosing type members
8552 Remove code that coped with instance/static returns for events, we
8553 now catch this in RealFindMembers.
8555 (RealFindMembers): only perform static lookup if the instance
8556 lookup did not return a type or an event.
8558 2002-05-17 Miguel de Icaza <miguel@ximian.com>
8560 * assign.cs (CompoundAssign): We pass more semantic information
8561 now to Compound Assignments than we did before: now we have all
8562 the information at hand, and now we resolve the target *before* we
8563 do the expression expansion, which allows the "CacheValue" method
8564 to have the effect we intended (before, a [x] += 1 would generate
8565 two differen ArrayAccess expressions from the ElementAccess,
8566 during the resolution process).
8568 (CompoundAssign.DoResolve): Resolve target and original_source here.
8570 2002-05-16 Miguel de Icaza <miguel@ximian.com>
8572 * expression.cs (ArrayAccess): dropped debugging information.
8574 * typemanager.cs: Small bug fix: I was always returning i_members,
8575 instead of one of i_members or s_members (depending on which had
8578 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
8579 method is invoked before any code generation takes place, and it
8580 is a mechanism to inform that the expression will be invoked more
8581 than once, and that the method should use temporary values to
8582 avoid having side effects
8584 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
8586 * ecore.cs (Expression.CacheTemporaries): Provide empty default
8589 * expression.cs (Indirection, ArrayAccess): Add support for
8590 CacheTemporaries in these two bad boys.
8592 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
8594 (StoreFromPtr): Handle stobj as well.
8596 * expression.cs (UnaryMutator): Share more code.
8598 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
8599 down: I was not tracking the Filter function as well, which
8600 was affecting the results of the cache.
8602 2002-05-15 Miguel de Icaza <miguel@ximian.com>
8604 * attribute.cs: Remove the hack to handle the CharSet property on
8607 2002-05-14 Miguel de Icaza <miguel@ximian.com>
8609 * attribute.cs (DoResolve): More uglyness, we now only try to
8610 resolve the attribute partially, to extract the CharSet
8611 information (only if we are a StructLayout attribute). Otherwise
8613 (GetExtraTypeInfo): Add some code to conditionally kill in the
8614 future this. I am more and more convinced that the .NET
8615 framework has special code to handle the attribute setting on
8618 * expression.cs (IsParamsMethodApplicable): Revert my previous
8619 foreach change here, it was wrong.
8621 2002-05-13 Miguel de Icaza <miguel@ximian.com>
8623 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
8624 (pp_expr): do not abort on unknown input, just return.
8625 (eval): abort if there are pending chars.
8627 * attribute.cs (Attribute.Resolve): Positional parameters are
8628 optional. Deal with that case.
8630 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
8631 the Ansi/Unicode/Auto information for the type.
8633 (TypeContainer.DefineType): instantiate the EmitContext here, as
8634 we will be using it during the type definition (to resolve
8635 attributes) and during the emit phase.
8637 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
8638 to pull type information out of the attributes
8640 (Attribute.Resolve): track the constructor builder, and allow for
8641 multiple invocations (structs and classes will use this).
8643 * ecore.cs (MemberLookupFinal): new version with all the
8644 parameters customizable.
8646 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
8647 constructors. Return if the result value is null (as the error
8648 would have been flagged already by MemberLookupFinal)
8650 Do not allow instances of abstract classes or interfaces to be
8653 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
8654 We have to compare the assembly property here when dealing with
8655 FamANDAssem and Assembly access modifiers, because we might be
8656 creating an assembly from *modules* (that means that we are not
8657 getting TypeBuilders for types defined in other modules that are
8658 part of this assembly).
8660 (Method.Emit): If the method is marked abstract and has a body,
8663 (TypeContainer.DefineMembers): If both the defined member and the
8664 parent name match are methods, then do not emit any warnings: let
8665 the Method.Define routine take care of flagging warnings. But if
8666 there is a mismatch (method overrides something else, or method is
8667 overriwritten by something, then emit warning).
8669 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
8670 set to null, this means `do not check for the return type on the
8673 (Method.Define): set the return type for the method signature to
8674 null, so that we get methods with the same name and parameters and
8675 different return types. This is used to flag warning 114 (you are
8676 hiding a method, and you probably want to use the new/override
8679 * typemanager.cs (MemberLookup): Implemented proper access
8680 control, closing a long standing set of bug reports. The problem
8681 was that the Framework only has two bits: Public and NonPublic,
8682 and NonPublic includes private and protected methods, but we need
8683 to enforce the FamANDAssem, FamOrAssem and Family.
8685 2002-05-11 Miguel de Icaza <miguel@ximian.com>
8687 * statement.cs (GotoCase): Return true: Ammounts to giving up
8688 knowledge on whether we return or not, and letting the other case
8689 be responsible for it.
8691 2002-05-10 Miguel de Icaza <miguel@ximian.com>
8693 * driver.cs: Do not load directories for each file processed, only
8694 do it if there is a pattern.
8696 * ecore.cs: Report readonly assigns here as well, as we might have
8697 been resolved only by MemberAccess.
8699 (SimpleName.SimpleNameResolve): Also be useful for LValue
8700 resolution. We need this to propagate assign to local readonly variables
8702 * typemanager.cs: Use a ptrhashtable for the criteria, because we
8703 do not want to reuse potential criteria memory.
8705 * class.cs (MyEventBuilder): Set reflected_type;
8707 * ecore.cs (Constantify): Added support for constifying bools.
8709 (RootContext.LookupType): Added a cache for values looked up in
8710 the declaration space.
8712 * typemanager.cs (FindMembers): Now is a front-end to
8713 RealFindMembers, and provides a two-level hashtable-based cache to
8716 15% performance improvement: from 22.5 to 19.2 seconds.
8718 * expression.cs (IsParamsMethodApplicable): use foreach.
8719 (Invocation.DoResolve): ditto.
8720 (New.DoResolve): ditto.
8721 (ArrayCreation.DoResolve): ditto.
8723 * ecore.cs (FindMostEncompassingType): use foreach.
8725 * delegate.cs (NewDelegate.DoResolve): Use foreach
8727 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8728 (RemoveMethods): use foreach.
8730 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8731 nested foreach statements instead of for, and also break out of
8732 the inner loop once a match is found.
8734 (Invocation.OverloadResolve): Use foreach, simplify the code.
8736 2002-05-08 Miguel de Icaza <miguel@ximian.com>
8738 * cfold.cs (BinaryFold): During an enumeration evaluation context,
8739 we actually unwrap the expression to allow for extra information
8742 * expression.cs: Use Shr_Un on unsigned operations.
8744 2002-05-08 Ravi Pratap <ravi@ximian.com>
8746 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
8747 applicable operators was not being considered correctly. This closes
8748 the bug Miguel reported.
8750 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8752 * attribute.cs: check that the type derives from System.Attribute
8753 and report the correct error in that case (moved the duplicate code to
8754 its own method, too).
8756 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8758 * attribute.cs: lookup attribute type name as the spec says: first the
8759 bare attribute name and then name + "Attribute" (nant compiles with
8760 mcs after this fix).
8762 2002-05-07 Miguel de Icaza <miguel@ximian.com>
8764 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
8765 Because of the way we parse things, we should try to see if a
8766 UIntConstant can fit in an integer.
8768 2002-05-07 Ravi Pratap <ravi@ximian.com>
8770 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8771 when we are in an explicit context.
8773 (ConvertReferenceExplicit): When converting from Iface type S to Class
8774 T make sure the rules are implemented as an OR.
8776 * parameter.cs (ParameterType): Make it a property for now although the
8777 purpose really isn't anything immediate.
8779 * expression.cs (Is*Applicable): Do better checking on the parameter type
8780 of a ref/out parameter. The ones from the system assemblies are already
8781 marked with the correct type so we don't need to do any correction.
8783 * ecore.cs (StandardConversionExists): Conversion from Interface types to
8784 the object type is standard too so include that.
8786 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8788 * ecore.cs (StandardConversionExists): Augment with missing code:
8789 deal with IntConstant, LongConstants and Enumerations.
8791 * assign.cs: Report the error, instead of failing silently
8793 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8794 typecontainer that they are declared, because the
8795 typecontainer/namespace will have the list of using clauses that
8798 Assembly Attributes were escaping the normal registration
8801 (EmitCode): Apply attributes within an EmitContext that represents
8802 the container they were declared on.
8804 * cs-parser.jay: Track bases for structs. How did I get this wrong?
8806 2002-05-06 Ravi Pratap <ravi@ximian.com>
8808 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8809 Revamp completely - make much cleaner as we now operate only
8812 (FindMostSpecificSource, FindMostSpecificTarget): New methods
8813 to implement the logic detailed in the spec more correctly.
8815 (UserDefinedConversion): Update accordingly.
8817 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8819 * statement.cs: Return flow analysis information up.
8821 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8824 (token): Do not consume an extra character before calling
8827 2002-05-06 Piers Haken <piersh@friskit.com>
8829 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8831 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8833 * class.cs (Constructor.Emit): Set the IsStatic flag in the
8834 EmitContext during the instance constructor initializer
8835 resolution, to stop access to instance variables.
8837 This is mandated by the spec, last paragraph of the `constructor
8838 initializers' section.
8840 2002-05-05 Miguel de Icaza <miguel@ximian.com>
8842 * cs-parser.jay, class.cs (Accessor): new class used to represent
8843 an accessor (get or set). In the past we used `null' to represent
8844 a missing accessor. But this is ambiguous because there was no
8845 way to tell in abstract indexers/properties if one of them was
8848 Now there is a way of addressing that.
8850 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8851 instead of FindMembers.
8853 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8854 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8856 * attribute.cs: Treat indexers and properties as the same in terms
8857 of applying attributes
8859 * ecore.cs (FindMostEncompassedType): Use statically initialized
8860 EmptyExpressions()s like we do elsewhere to avoid creating useless
8861 objects (and we take this out of the tight loop).
8863 (GetConversionOperators): Move the code to extract the actual
8864 operators to a separate routine to clean things up.
8866 2002-05-04 Miguel de Icaza <miguel@ximian.com>
8868 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8869 events are always registered FieldBuilders.
8871 * class.cs (FieldBase): New class shared by Fields
8873 * delegate.cs: If we are a toplevel delegate, use our full name.
8874 If we are a nested delegate, then only use our tail name.
8876 2002-05-02 Ravi Pratap <ravi@ximian.com>
8878 * expression.cs (IsApplicable): Ensure that we add the "&" to
8879 ref/out types before comparing it with the type of the argument.
8881 (IsParamsMethodApplicable): Ditto.
8883 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
8886 * delegate.cs : Handle the case when we have more than one applicable
8887 method. Flag an error only when we finish checking all.
8889 2002-05-02 Miguel de Icaza <miguel@ximian.com>
8891 * expression.cs: Add support for boolean static initializers.
8893 2002-05-01 Miguel de Icaza <miguel@ximian.com>
8895 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8897 * parameter.cs (ComputeParameterTypes,
8898 ComputeAndDefineParameterTypes): Better error handling: now we
8899 clear the `types' cache if we fail during any of the type lookups.
8900 We also return the status code correctly to our caller
8902 * delegate.cs: If we fail to define a delegate, abort the extra
8905 * expression.cs (Binary.ResolveOperator): for
8906 operator==(object,object) and operator !=(object, object) we also
8907 have to verify that there is an implicit conversion from one to
8910 (ArrayAccess.DoResolve): Array Access can operate on
8913 2002-04-30 Miguel de Icaza <miguel@ximian.com>
8915 * assign.cs (CompoundAssign): A new class used as a "flag" that
8916 the assignment actually is happening as part of a compound
8917 assignment operator.
8919 During compound assignment, a few new rules exist to enable things
8926 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8927 to the type of x) if y is implicitly convertible to the type of x,
8928 and the operator is a builtin operator and the return type of the
8929 operator is explicitly convertible to the type of x.
8931 * rootcontext.cs: Reset warning level to 2. 4 catches various
8932 "interesting" features in mcs, we must clean this up at some
8933 point, but currently am trying to kill other bugs ;-)
8935 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8936 in container classes as well.
8938 * expression.cs (Binary.ResolveOperator): Handle string case
8939 before anything else (as operator overloading does emit an error
8940 before doing anything else).
8942 This code could go away when we move to a table driven model, but
8943 i could not come up with a good plan last night.
8945 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
8947 * typemanager.cs (CSharpName): reimplementation using regex.
8948 * class.cs: added null check for fields in Emit
8949 * rootcontext.cs: set warninglevel to 4
8951 2002-04-29 Miguel de Icaza <miguel@ximian.com>
8953 * typemanager.cs (CSharpName): reimplemented with Lupus
8956 2002-04-28 Miguel de Icaza <miguel@ximian.com>
8958 * statement.cs (If): correclty implement Resolve, because we were
8959 not catching sem errors in there. The same process is needed
8961 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8964 (Statement.Warning_DeadCodeFound): Factorize code.
8965 (While): Report dead code here too.
8967 (Statement): Added Resolve virtual method to allow
8968 for resolution split from the emit code.
8970 2002-04-26 Miguel de Icaza <miguel@ximian.com>
8972 * statement.cs (EmitBoolExpression): No longer try to resolve the
8974 (MakeBoolean): New utility function that resolve, implicitly
8975 converts to boolean and tags the expression.
8978 (If, Do): Implement dead code elimination.
8979 (While): Implement loop inversion
8981 (Do, While, For, If): Resolve the expression prior to calling our
8984 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
8987 - added method Report28 (warning: program has more than one entry point)
8988 - added method IsEntryPoint, implements paragraph 10.1 of the spec
8989 - modified method Method.Define, the part at the end of the method
8991 * rootcontext.cs: added static public Location EntryPointLocation;
8993 * ../errors/cs0028.cs : Add test case for the above warning.
8996 - modified method CSharpName to allow arrays of primitive type to
8997 be printed nicely (e.g. instead of System.Int32[][] it now prints
8999 - added method CSharpSignature: returns the signature of a method
9000 in string format to be used in reporting errors, warnings, etc.
9002 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
9005 2002-04-26 Ravi Pratap <ravi@ximian.com>
9007 * delegate.cs (Define): Fix extremely silly bug where I was
9008 setting the type of the 'object' parameter of the BeginInvoke
9009 method to System.IAsyncResult instead of System.Object ;-)
9011 2002-04-26 Miguel de Icaza <miguel@ximian.com>
9013 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
9016 (Constructor.Emit): return if we fail to initialize the
9017 constructor. Another door closed!
9019 * expression.cs (New.DoResolve): Improve error message (from -6 to
9020 1501). Use DeclaredOnly lookup to find the exact constructor.
9022 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
9023 loop. This is useful.
9025 * cs-parser.jay: Adjust the default parameters so that destructors
9026 have the proper signature.
9028 2002-04-26 Martin Baulig <martin@gnome.org>
9030 * driver.cs (LoadAssembly): If `assembly' contains any characters
9031 which are only valid in path names and not in assembly names
9032 (currently slash, backslash and point), use Assembly.LoadFrom ()
9033 instead of Assembly.Load () on the `assembly' (before iteration
9034 over the link_paths).
9036 2002-04-26 Martin Baulig <martin@gnome.org>
9038 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
9040 2002-04-25 Miguel de Icaza <miguel@ximian.com>
9042 * class.cs (Property): use the new typemanager.MemberLookup
9044 (TypeContainer.MemberLookup): Implement using the
9045 TypeManager.MemberLookup now.
9047 * typemanager.cs: Make MemberLookup a function of the TypeManager,
9048 and return MemberInfos, so that these can be used without an
9049 EmitContext (what we had before).
9051 2002-04-24 Miguel de Icaza <miguel@ximian.com>
9053 * expression.cs: Fix the case where the argument to params if the
9054 type of the params. I omitted handling this before. Fixed
9056 2002-04-22 Miguel de Icaza <miguel@ximian.com>
9058 * driver.cs: Call BootCorlib_PopulateCoreType
9060 * class.cs (Property.CheckBase): Check for properties only, not
9063 * interface.cs: Temporary hack: try/catch around the
9064 CustomAttributeBuilder, because I am getting an exception that I
9067 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
9068 types whose definitions are required to be there (attributes are
9069 defined before standard types).
9071 Compute definitions as we boot the various types, as they are used
9072 immediately (value_type class will need object_type, but if we do
9073 not initialize object_type, we will pass a null, which will let
9074 the runtime pick the System.Object from the existing corlib, which
9075 is not what we want).
9077 2002-04-22 Patrik Torstensson <totte@labs2.com>
9079 * cs-tokenizer.cs: fixed a number of trim() issues.
9081 2002-04-22 Ravi Pratap <ravi@ximian.com>
9083 * expression.cs (Argument.Type): Ensure that we return the correct
9084 type when we have out or ref parameters [in which case we
9087 2002-04-22 Miguel de Icaza <miguel@ximian.com>
9089 * class.cs (Property, Indexer): Allow extern modifier in there.
9091 * typemanager.cs (InitBaseTypes): Initializes object_type and
9092 value_type, since those will be used early on during the bootstrap
9093 process to compile corlib.
9095 (InitCoreTypes): Move code from here to InitBaseTypes.
9097 2002-04-21 Miguel de Icaza <miguel@ximian.com>
9099 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
9100 single-dimension arrays as using the ldlen opcode.
9102 Daniel Lewis discovered this optimization.
9104 * typemanager.cs: Add signature for System.Array::get_Length
9106 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9108 * statement.cs: report the error when the foreach does not apply to an
9109 array nor a collection.
9111 2002-04-19 Miguel de Icaza <miguel@ximian.com>
9113 * expression.cs: Add implicit conversions to the operator ~.
9115 * constant.cs (DecimalConstant.Emit): Emit decimal value.
9117 * typemanager.cs: Locate the decimal constructor.
9119 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9121 * attribute.cs: use the new property of TypeOf.
9122 * expression.cs: added 'get' property around typearg.
9124 These changes fix a build breaker reported by NickD. Is this the
9125 correct way to fix? If not, please, revert my changes and make it
9128 2002-04-17 Miguel de Icaza <miguel@ximian.com>
9130 * attribute.cs: Add support for typeof in attribute invocations.
9131 I am not sure that this is right though.
9133 2002-04-14 Duncan Mak <duncan@ximian.com>
9135 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
9136 Binary.Operator.Division case.
9138 2002-04-13 Ravi Pratap <ravi@ximian.com>
9140 * class.cs (DefineType): Ensure that we do a proper check on
9141 attribute types and also register it with the TypeManager.
9143 (TypeContainer.Targets): The default for attribute types is
9144 AttributeTargets.All.
9146 * attribute.cs (ApplyAttributes): Registering the attribute type
9147 is done elsewhere, not when we discover we have a Usage attribute.
9149 2002-04-12 Ravi Pratap <ravi@ximian.com>
9151 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
9152 and get rid of is_delegate parameter.
9154 * everywhere : update.
9156 2002-04-12 Ravi Pratap <ravi@ximian.com>
9158 * cs-parser.jay (compilation_unit): Revamp completely to use
9159 some new ideas that I got from Rhys' grammar to solve the problems
9160 with assembly level attributes.
9162 (outer_declaration): New grammar production.
9164 (attribute_sections): Add.
9166 (opt_attributes): Base on attribute_sections
9168 (namespace_declaration): Allow opt_attributes to tackle the case
9169 when we have assembly level attributes - we are clever in this
9172 * attribute.cs (ApplyAttributes): Do not worry about assembly
9173 attributes in the non-global context.
9175 * rootcontext.cs (AddGlobalAttributes): Go back to using this
9176 instead of SetGlobalAttributes.
9178 * class.cs, rootcontext.cs : Ensure we define and generate
9179 attribute types before anything else.
9181 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
9182 and flag the new error -20 for the case when the attribute type
9183 does not have valid targets specified. csc does not catch this.
9185 * ../errors/errors.txt : update for error # -20
9187 2002-04-11 Ravi Pratap <ravi@ximian.com>
9189 * support.cs (InternalParameters.ParameterModifier): Do some null
9190 checking and return sane values.
9192 * class.cs (Method.Define): If we are a PInvoke method, ensure
9193 that we are static and extern. Report error # 601
9195 * ../errors/cs0601.cs : Add test case for the above error.
9197 2002-04-07 Ravi Pratap <ravi@ximian.com>
9199 * rootcontext.cs (attribute_types): We need to keep type of
9200 all attribute types separately and emit code for them first.
9202 (RegisterAttribute) : Implement.
9204 * class.cs (DefineType): Check if the current Type is a custom
9205 attribute type and register it accordingly.
9207 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
9208 adding the first attribute twice and rename to
9210 (SetGlobalAttributes): this.
9212 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
9215 * attribute.cs (ApplyAttributes): Take an additional argument telling us
9216 if we are processing global arguments. Hmm, I am unsure of this.
9218 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9220 * expression.cs: added static array of strings to avoid calling
9221 Enum.ToString () for Operator in Binary. Significant recover of
9224 2002-04-10 Miguel de Icaza <miguel@ximian.com>
9226 * class.cs (FindMembers): Allow the Builders of the various
9227 members to be null. If they are skip them. This only happens
9228 during the PInvoke declaration.
9230 2002-04-09 Miguel de Icaza <miguel@ximian.com>
9232 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
9233 failure, so we do not keep going afterwards.
9235 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
9236 wanted to pass `false' as the `is_delegate' argument. If this is
9237 the case, why not use delegate_type == null to mean `is_delegate =
9238 false' and anything else as is_delegate = true.
9240 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
9242 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
9243 code for the section, not the beginning of the tests.
9245 2002-04-08 Miguel de Icaza <miguel@ximian.com>
9247 * cfold.cs: Handle operator + (Enum x, Underlying x)
9249 * expression.cs (Binary): same. Warn about errors where we have
9250 Enum/Enum in operator + as well.
9252 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
9255 - added support for switch(bool)
9256 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
9257 - add TableSwitchEmit() to handle table-based switch statements
9259 2002-04-05 Ravi Pratap <ravi@ximian.com>
9261 * expression.cs (Invocation.OverloadResolve): Factor out code which
9262 does parameter compatibility checking with arguments so that we can
9263 re-use the code even from Delegate.VerifyApplicability
9265 (VerifyArgumentsCompat): Move above code here.
9267 * delegate.cs (VerifyApplicability): Get rid of duplicate code
9268 and instead make a call to the above method.
9270 2002-03-31 Ravi Pratap <ravi@ximian.com>
9272 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
9273 We use it to keep track of classes which are attribute types.
9275 2002-04-02 Miguel de Icaza <miguel@ximian.com>
9277 * delegate.cs (Delegate.Define): Correctly define the types in the
9278 presence of fixed and array parameters.
9280 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
9283 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
9284 include NonPublic after the first iteration.
9286 * class.cs (Indexer.CheckBase): Only check if both parents are
9289 * cs-parser.jay (accessor_body): If empty, set to null.
9291 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
9292 same code path here to resolve constants names that we did have in
9293 MemberAccess.DoResolve. There is too much code duplicated here.
9295 2002-04-01 Miguel de Icaza <miguel@ximian.com>
9297 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
9299 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
9302 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
9303 tokens, numbers and strings.
9305 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
9308 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
9309 asyncronous parameters and the regular parameters.
9311 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
9312 specify the target directory.
9314 * expression.cs: (This.DoResolve): Simplify
9315 (As.Emit): Optimize, do not generate IsInst if the expression is
9316 always of the given type.
9318 (Is.DoResolve): Bug fix, we were reporting both always/never for
9321 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
9322 creating too many unnecessary arrays.
9324 2002-03-31 Miguel de Icaza <miguel@ximian.com>
9326 * class.cs (EmitFieldInitializer): Use Assign expression to assign
9327 fields instead of rolling our own initializer. Takes care of all
9328 implicit conversions, and drops unnecessary static checks/argument.
9330 2002-03-31 Dick Porter <dick@ximian.com>
9332 * driver.cs: use the GetDirectories() return values properly, and
9333 use "/" as path separator.
9335 2002-03-30 Miguel de Icaza <miguel@ximian.com>
9337 * expression.cs (Unary): Optimize - - expr into expr.
9338 (Binary): Optimize a + (-b) into a -b.
9340 * codegen.cs (CodeGen): Made all methods static.
9342 2002-03-29 Miguel de Icaza <miguel@ximian.com>
9346 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
9347 TypeBuilder property.
9349 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
9352 * tree.cs: Removed the various RecordXXXX, and replaced with a
9353 single RecordDecl. Removed all the accessor methods, and just
9354 left a single access point Type
9356 * enum.cs: Rename DefineEnum to DefineType.
9358 * decl.cs: New abstract method `DefineType' used to unify the
9359 Defines for Enumerations, Interfaces, TypeContainers and
9362 (FindType): Moved LookupInterfaceOrClass here. Moved the
9363 LookupBaseClasses method that used to live in class.cs and
9364 interface.cs here, and renamed to FindType.
9366 * delegate.cs: Implement DefineType. Take advantage of the
9367 refactored pattern for locating the parent builder without taking
9368 the parent_builder argument (which we know does not work if we are
9369 nested, and triggering a toplevel definition).
9371 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9373 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
9374 accessibility of a member has changed during override and report
9377 * class.cs (Method.Define, Property.Define): Only complain on
9378 overrides if the method is private, any other accessibility is
9379 fine (and since we just checked the permission is the same, we are
9382 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
9383 and elif are processed always. The other pre-processing
9384 directives are only processed if we are "taking" the path
9386 2002-03-29 Martin Baulig <martin@gnome.org>
9388 * class.cs (Method.Emit): Only emit symbolic debugging info if the
9389 current location is not Null.
9391 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
9392 a separate method so we can profile it.
9394 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
9395 `span.Seconds' are just seconds, but no minutes or hours.
9396 (MainDriver): Profile the CodeGen.SaveSymbols calls.
9398 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9400 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
9401 Remove the gratuitous set of Final:
9403 // If an interface implementation, then we can set Final.
9404 if (((flags & MethodAttributes.Abstract) == 0) &&
9405 implementing.DeclaringType.IsInterface)
9406 flags |= MethodAttributes.Final;
9408 I do not know what I was smoking when I used that.
9411 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
9412 step into fixing the name resolution issues for delegates and
9413 unifying the toplevel name resolution.
9415 2002-03-28 Martin Baulig <martin@gnome.org>
9417 * class.cs (Method.Emit): If we have a symbol writer, call its
9418 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
9419 tell it about the current method.
9421 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
9422 writer that we're going to emit the first byte of IL code for a new
9423 statement (a new source line).
9424 (EmitContext.EmitTopBlock): If we have a symbol writer, call
9425 EmitContext.Mark() before emitting any code.
9427 * location.cs (SymbolDocument): Return null when we're Null.
9429 * statement.cs (Statement): Moved the `Location loc' variable here.
9430 (Statement.EmitBoolExpression): If we have a symbol writer, call
9431 ec.Mark() before emitting any code to tell it that we're at the
9432 beginning of a new statement.
9433 (StatementExpression): Added `Location' argument to the constructor.
9434 (Block): Added public readonly variable `StartLocation' and public
9435 variable `EndLocation'. The latter is to be set using SetEndLocation().
9436 (Block): Added constructor which takes a start and end location.
9437 (Block.SetEndLocation): New method. This sets the end location.
9438 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
9439 local variables we create.
9440 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
9441 each statement and do also mark the begin and end of the block.
9443 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
9444 tell it the current lexer.Location, use Location.Null for the end of the
9446 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
9447 current block, set its end location using SetEndLocation().
9448 (statement_expression): StatementExpression constructor now takes the
9449 lexer.Location as additional argument.
9450 (for_statement, declare_local_variables): Likewise.
9451 (declare_local_variables): When creating a new implicit block, use the
9452 new Block constructor and pass it the lexer.Location.
9454 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9456 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
9457 members also on the parent interfaces recursively.
9459 2002-03-27 Miguel de Icaza <miguel@ximian.com>
9461 * report.cs: Use new formats, since Gonzalo finished the missing
9464 * expression.cs (Binary.ResolveOperator): added missing operator|
9465 operator& and operator^ for bool/bool.
9467 * cs-parser.jay: CheckDef now takes a Location argument that is
9468 used to report errors more precisly (instead of reporting the end
9469 of a definition, we try to track something which is a lot closer
9470 to the source of the problem).
9472 * cs-tokenizer.cs: Track global token use, so we can properly flag
9473 the use of #define/#undef after the first token has been seen.
9475 Also, rename the reportXXXX to Error_DescriptiveName
9477 * decl.cs (DeclSpace.IsTopLevel): Move property here from
9478 TypeContainer, so that Enum and Interface can use this too.
9480 * class.cs (TypeContainer.LookupInterfaceOrClass,
9481 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
9482 `builder' argument. Typically this was used to pass the parent
9483 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
9486 The problem is that a nested class could trigger the definition of
9487 a toplevel class, and the builder would be obviously wrong in that
9490 So we drop this argument, and we compute dynamically the
9491 TypeBuilder/ModuleBuilder (the correct information was available
9492 to us anyways from DeclSpace.Parent)
9494 * interface.cs (Interface.DefineInterface): Drop builder
9495 parameter cleanup like class.cs
9497 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
9500 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
9503 (Try.Emit): Propagate the returns value from the statement.
9505 (Return.Emit): Even if we are leavning
9507 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
9509 * modifiers.cs: Fix the computation of MethodAttributes flags.
9511 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
9513 * driver.cs: allow compilation of files that start with '/'.
9514 Add a default case when checking the argument of --target.
9516 2002-03-25 Miguel de Icaza <miguel@ximian.com>
9518 * interface.cs: Implement the same search algorithm for types in
9521 * delegate.cs: Do not allow multiple definition.
9523 * Recovered ChangeLog that got accidentally amputated
9525 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
9527 * rootcontext.cs: Load manually enum to allow core classes to
9528 contain enumerations.
9530 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
9531 Update to new static methods in TypeManager.
9533 * typemanager.cs (GetMethod, GetConstructor): Use our
9534 implementation of FindMembers to find the members, since during
9535 corlib compilation, the types are TypeBuilders and GetMethod and
9536 GetConstructor do not work.
9538 Make all methods in TypeManager static.
9540 (InitCodeHelpers): Split the functionality from
9541 the InitCodeTypes function.
9543 * driver.cs: Call InitCodeHelpers after we have populated the
9546 * cs-parser.jay (delegate_declaration): we did not used to compute
9547 the delegate name correctly for void delegates.
9549 2002-03-24 Miguel de Icaza <miguel@ximian.com>
9551 * rootcontext.cs (RootContext): Init the interface_resolve_order
9552 and type_container_resolve_order always.
9554 (ResolveCore, BootstrapCorlib_ResolveClass,
9555 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
9556 compiler when compiling with --nostdlib
9558 * class.cs (TypeContainer.DefineType): Check that our parent is
9559 not null. This test is most important when we are bootstraping
9562 * codegen.cs: Split out the symbol writing code.
9564 2002-03-25 Martin Baulig <martin@gnome.org>
9566 * driver.cs (-g): Made -g an alias for --debug.
9568 2002-03-24 Martin Baulig <martin@gnome.org>
9570 * codegen.cs (SymbolWriter): New public variable. Returns the
9571 current symbol writer.
9572 (CodeGen): Added `bool want_debugging_support' argument to the
9573 constructor. If true, tell the ModuleBuild that we want debugging
9574 support and ask it for the ISymbolWriter.
9575 (Save): If we have a symbol writer, call it's Close() method after
9576 saving the assembly.
9578 * driver.c (--debug): New command line argument to create a
9579 debugger information file.
9581 * location.cs (SymbolDocument): New public property. Returns an
9582 ISymbolDocumentWriter object for the current source file or null
9583 if we don't have a symbol writer.
9585 2002-03-21 Miguel de Icaza <miguel@ximian.com>
9587 * driver.cs (LoadAssembly): Correctly return when all the paths
9588 have been tried and not before.
9590 * statement.cs (Switch.Emit): return the actual coverage for this
9591 statement (returns/not-returns)
9593 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
9594 switch of the statement if we are the last switch section. That
9595 kills two problems: try/catch problems (we used to emit an empty
9596 nop at the end) and switch statements where all branches would
9599 2002-03-19 Miguel de Icaza <miguel@ximian.com>
9601 * driver.cs: Add default assemblies (the equivalent to the
9602 Microsoft CSC.RSP file)
9604 * cs-tokenizer.cs: When updating `cols and setting it to zero,
9605 also update tokens_seen and set it to false.
9607 * driver.cs: Implement --recurse for Mike.
9609 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
9610 correctly splitting out the paths.
9612 2002-03-18 Miguel de Icaza <miguel@ximian.com>
9614 * interface.cs (Interface.PopulateProperty): Instead of using
9615 `parent' as the declaration space for the set parameters, use
9618 * support.cs (InternalParameters): InternalParameters constructor
9619 takes a DeclSpace instead of a TypeContainer.
9621 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
9622 types are being initialized, load the address of it before calling
9625 (New): Provide a mechanism to disable the generation of local
9626 value type temporaries when the caller will be providing us with
9627 an address to store it.
9629 (ArrayCreation.EmitDynamicInitializers): Use it.
9631 2002-03-17 Miguel de Icaza <miguel@ximian.com>
9633 * expression.cs (Invocation.EmitArguments): Only probe for array
9634 property if there is more than one argument. Sorry about that.
9636 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
9639 * class.cs (Method.LabelParameters): Fix incorrect code path that
9640 prevented the `ParamArrayAttribute' from being applied to the
9643 2002-03-16 Miguel de Icaza <miguel@ximian.com>
9645 * support.cs (ReflectionParameters): Correctly compute whether the
9646 last argument is a params array. Fixes the problem with
9649 * typemanager.cs: Make the assemblies array always be non-null
9650 (empty, but non-null)
9652 * tree.cs (RecordDecl): New function that abstracts the recording
9653 of names. This reports error 101, and provides a pointer to the
9654 previous declaration. Fixes a crash in the compiler.
9656 * cs-parser.jay (constructor_declaration): Update to new grammar,
9657 and provide a constructor_body that can be empty.
9659 2002-03-15 Miguel de Icaza <miguel@ximian.com>
9661 * driver.cs: Add support for --resources.
9663 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
9664 Make all types for the various array helper methods be integer.
9666 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9667 CheckState to ConvCast.
9669 (ConvCast): Now it takes a `checked' state argument, to avoid
9670 depending on the emit context for the conversion, and just using
9671 the resolve time setting.
9673 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
9674 instead of Invocation.EmitArguments. We do not emit the original
9675 arguments, instead we emit those which have been converted to
9676 unsigned int expressions.
9678 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
9680 * codegen.cs: ditto.
9682 * expression.cs (LocalVariableReference): Drop the use of the
9683 Store function that depended on the variable index.
9685 * statement.cs (VariableInfo): Drop the `Idx' property from this
9686 class, as this is not taking into account the indexes for
9687 temporaries tat we generate during the execution, getting the
9690 * class.cs: First emit class initializers, then call the parent
9693 * expression.cs (Binary): Fix opcode emision.
9694 (UnaryMutator.EmitCode): Support checked code generation
9696 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9697 matches for events for both the Static and Instance scans,
9698 pointing to the same element. Fix that.
9700 2002-03-14 Miguel de Icaza <miguel@ximian.com>
9702 * rootcontext.cs (ResolveTree): Always set the
9703 interface_resolve_order, because nested interfaces will be calling
9706 * class.cs (GetInterfaceOrClass): Track the same resolution
9707 process used by TypeManager.LookupType. This fixes the nested
9708 type lookups in class declarations (separate path from
9711 (TypeContainer.DefineType): Also define nested interfaces.
9712 (TypeContainer.RegisterOrder): New public function used to
9713 register the order in which child interfaces need to be closed.
9715 Nested interfaces need to be closed after their parents have been
9718 * interface.cs (InterfaceAttr): Put all the logic for computing
9719 the interface attribute here.
9721 (DefineInterface): Register our interface order with the
9722 RootContext or with the TypeContainer depending on the case.
9724 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9726 * cs-parser.jay: rework foreach statement to work with the new
9727 changes to the policy on SimpleNames.
9729 * report.cs: support Stacktrace on warnings as well.
9731 * makefile: drop --unsafe and /unsafe from the compile.
9733 2002-03-13 Ravi Pratap <ravi@ximian.com>
9735 * ecore.cs (StandardConversionExists): Modify to take an Expression
9736 as the first parameter. Ensure we do null -> reference type conversion
9739 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9740 temporary Expression objects.
9742 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9744 * interface.cs: workaround bug in method overloading resolution
9745 (there is already a bugzilla bug for it).
9747 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9749 We could also solve this problem by having a separate path for
9750 performing type lookups, instead of DoResolve, we could have a
9751 ResolveType entry point, and only participating pieces of the
9752 production (simplename, deref, array) would implement this.
9754 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9755 signal SimpleName to only resolve type names and not attempt to
9756 resolve anything else.
9758 * expression.cs (Cast): Set the flag.
9760 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9762 * class.cs: Only report 108 if there is no `new' modifier.
9764 * cs-parser.jay: rework foreach statement to work with the new
9765 changes to the policy on SimpleNames.
9767 * report.cs: support Stacktrace on warnings as well.
9769 * makefile: drop --unsafe and /unsafe from the compile.
9771 2002-03-11 Miguel de Icaza <miguel@ximian.com>
9773 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9774 lookups here, instead of doing that at parse time. This means
9775 that our grammar will not introduce `LocalVariableReferences' as
9776 expressions at this point. That solves the problem of code like
9784 This is only half the fix. The full fix requires parameters to
9785 also be handled in this way.
9787 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9788 makes the use more obvious of the DeclSpace. The
9789 ec.TypeContainer.TypeBuilder is now only used to pull the
9792 My theory is that I can get rid of the TypeBuilder completely from
9793 the EmitContext, and have typecasts where it is used (from
9794 DeclSpace to where it matters).
9796 The only pending problem is that the code that implements Aliases
9797 is on TypeContainer, and probably should go in DeclSpace.
9799 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9800 lookups here, instead of doing that at parse time. This means
9801 that our grammar will not introduce `LocalVariableReferences' as
9802 expressions at this point. That solves the problem of code like
9810 This is only half the fix. The full fix requires parameters to
9811 also be handled in this way.
9813 * class.cs (Property.DefineMethod): When implementing an interface
9814 method, set newslot, when implementing an abstract method, do not
9815 set the flag (before we tried never setting it, or always setting
9816 it, which is the difference).
9817 (Indexer.DefineMethod): same.
9818 (Method.DefineMethod): same.
9820 * ecore.cs: Only set the status used flag if we get back a Field.
9822 * attribute.cs: Temporary hack, so Paolo can keep working.
9824 2002-03-08 Ravi Pratap <ravi@ximian.com>
9826 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9827 the unmanaged type in the case we have a MarshalAs attribute.
9829 (Resolve): Handle the case when we are parsing the special MarshalAs
9830 attribute [we need to store the unmanaged type to use later]
9832 * typemanager.cs (marshal_as_attr_type): Built in type for the
9833 MarshalAs Attribute.
9835 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
9836 on parameters and accordingly set the marshalling info.
9838 2002-03-09 Miguel de Icaza <miguel@ximian.com>
9840 * class.cs: Optimizing slightly by removing redundant code after
9841 we switched to the `NoTypes' return value.
9842 (Property.DefineMethod): use NoTypes here too.
9844 This fixes the bug I introduced in my last batch of changes.
9846 2002-03-05 Ravi Pratap <ravi@ximian.com>
9848 * tree.cs (RecordEnum): Add. We now keep track of enums too.
9850 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9851 Enums since those are types too.
9853 * cs-parser.jay (enum_declaration): Record enums as we parse them.
9855 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
9856 thanks to a call during the lookup process.
9858 2002-03-07 Miguel de Icaza <miguel@ximian.com>
9860 * statement.cs (Foreach): Lots of work to accomodate a particular
9861 kind of foreach statement that I had not kept in mind. It is
9862 possible to have foreachs on classes that provide a GetEnumerator
9863 method that return objects that implement the "pattern" for using
9864 a foreach, there is no need to support GetEnumerator
9867 This is needed to compile nant.
9869 * decl.cs: Only report 114 if the member is not `Finalize' and if
9870 the warning level is at least 2.
9872 * class.cs: Moved the compare function from Method to
9875 (MethodSignature.InheritableMemberSignatureCompare): Add new
9876 filter function that is used to extract inheritable methods from a
9879 (Method.Define): Use the new `inheritable_method_signature_filter'
9882 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9885 2002-03-06 Miguel de Icaza <miguel@ximian.com>
9887 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9889 * cs-parser.jay: Add opt_semicolon to the interface declaration.
9891 * expression.cs: Pass location information to
9892 ConvertImplicitStandard.
9894 * class.cs: Added debugging code to track return values from
9897 2002-03-05 Miguel de Icaza <miguel@ximian.com>
9899 * expression.cs (Is.DoResolve): If either side of the `is' is an
9900 interface, do not flag the warning.
9902 * ecore.cs (ImplicitReferenceConversion): We need a separate test
9905 * report.cs: Allow for --fatal to be used with --probe.
9907 * typemanager.cs (NoTypes): Move the definition for the empty Type
9910 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9912 (TypeContainer.DefineProxy): New function used to proxy to parent
9913 implementations when implementing interfaces.
9914 (TypeContainer.ParentImplements): used to lookup if our parent
9915 implements a public function that is required by an interface.
9916 (TypeContainer.VerifyPendingMethods): Hook this up.
9918 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9919 `modules' and `assemblies' arraylists into arrays. We only grow
9920 these are the very early start up of the program, so this improves
9921 the speedof LookupType (nicely measured).
9923 * expression.cs (MakeByteBlob): Replaced unsafe code with
9924 BitConverter, as suggested by Paolo.
9926 * cfold.cs (ConstantFold.Binary): Special case: perform constant
9927 folding of string concatenation, but if either side is a string,
9928 and the other is not, then return null, and let the runtime use
9929 the concatenation on the string plus the object (using
9932 2002-03-04 Miguel de Icaza <miguel@ximian.com>
9934 Constant Folding has been implemented now.
9936 * expression.cs (Unary.Reduce): Do not throw an exception, catch
9937 the error instead on types that are not supported in one's
9940 * constant.cs (Constant and all children): New set of functions to
9941 perform implict and explicit conversions.
9943 * ecore.cs (EnumConstant): Implement the new functions to perform
9944 conversion by proxying to the child expression.
9946 * codegen.cs: (ConstantCheckState): Constant evaluation has its
9947 own separate setting that can not be turned off from the command
9948 line using --unchecked or --checked and is only controlled using
9949 the checked/unchecked statements and expressions. This setting is
9950 used by the constant folder to flag errors.
9952 * expression.cs (CheckedExpr, UncheckedExpr): Set the
9953 ConstantCheckState as well.
9955 During Resolve, they also have to flag the state, because the
9956 constant folder runs completely in the Resolve phase.
9958 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9961 2002-03-01 Miguel de Icaza <miguel@ximian.com>
9963 * cfold.cs: New file, this file contains the constant folder.
9965 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9966 argument to track whether we are using the resulting address to
9967 load or store a value and provide better error messages.
9969 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9970 new AddressOf arguments.
9972 * statement.cs (Foreach.EmitCollectionForeach): Update
9974 * expression.cs (Argument.Emit): Call AddressOf with proper
9975 arguments to track usage.
9977 (New.DoEmit): Call AddressOf with new arguments.
9979 (Unary.Emit): Adjust AddressOf call.
9981 2002-03-01 Ravi Pratap <ravi@ximian.com>
9983 * cs-parser.jay (member_access): Change the case for pre-defined types
9984 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
9987 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9990 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9991 essentially like methods and apply attributes like MethodImplOptions to them too.
9993 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9996 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9997 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
10000 * Update code everywhere accordingly.
10002 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
10004 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
10006 2002-02-28 Ravi Pratap <ravi@ximian.com>
10008 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
10009 try performing lookups against those instead of jumping straight into using
10010 the 'using' clauses.
10012 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
10014 (LookupType): Perform lookups in implicit parents too.
10016 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
10017 sequence as RootContext.LookupType.
10019 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
10020 the various cases of namespace lookups into this method.
10022 2002-03-01 Miguel de Icaza <miguel@ximian.com>
10024 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
10025 in positional arguments)
10027 * class.cs (Operator): Update the AllowedModifiers to contain
10030 * cs-parser.jay: Update operator declaration to allow for the
10031 operator body to be empty.
10033 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
10036 2002-02-27 Miguel de Icaza <miguel@ximian.com>
10038 * class.cs (Method.Emit): Label parameters.
10040 * driver.cs: Return 1 or 0 as the program exit code.
10042 2002-02-26 Miguel de Icaza <miguel@ximian.com>
10044 * expression.cs: Special case the `null' object when trying to
10045 auto-compute the type, as anything can be explicitly converted to
10048 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
10049 spotting this Paolo.
10051 (Expression.ImplicitNumericConversion): Perform comparissions of
10052 the type using the underlying type in the case of an enumeration
10053 rather than using the enumeration type for the compare.
10055 Cope with the underlying == type case, which is not possible to
10058 (Expression.ConvertNumericExplicit): Perform comparissions of
10059 the type using the underlying type in the case of an enumeration
10060 rather than using the enumeration type for the compare.
10062 * driver.cs: If the user does not supply an extension, assume .exe
10064 * cs-parser.jay (if_statement): Rewrote so that we can track the
10065 location for the if statement.
10067 * expression.cs (Binary.ConstantFold): Only concat strings when
10068 the operation is "+", not everything ;-)
10070 * statement.cs (Statement.EmitBoolExpression): Take a location
10072 (If, While, Do): Track location.
10074 * expression.cs (Binary.ResolveOperator): In the object + string
10075 case, I was missing a call to ConvertImplicit
10077 2002-02-25 Ravi Pratap <ravi@ximian.com>
10079 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
10080 Location arguments. Ensure we use RootContext.LookupType to do our work
10081 and not try to do a direct Type.GetType and ModuleBuilder.GetType
10083 * interface.cs (PopulateMethod): Handle the type of the parameter being
10086 * expression.cs (Invocation.BetterFunction): Handle the case when we
10087 have a params method with no fixed arguments and a call is made with no
10090 2002-02-25 Miguel de Icaza <miguel@ximian.com>
10092 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
10093 the verbatim-string-literal
10095 * support.cs (InternalParameters.ParameterModifier): handle null
10097 (InternalParameters.ParameterType): ditto.
10099 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
10100 duplicating the name of the variable parameter.
10101 (GetParameterByName): Fix bug where we were not looking up array
10102 paramters if they were the only present (thanks Paolo!).
10103 (GetParameterInfo): We only have an empty set of types if both
10104 fixed and array are set to null.
10105 (GetParameterInfo-idx): Handle FixedParameter == null
10107 * cs-parser.jay: Handle the case where there is no catch
10108 statements (missing null test).
10110 2002-02-22 Miguel de Icaza <miguel@ximian.com>
10112 * driver.cs (MainDriver): Be conservative on our command line
10115 Catch DirectoryNotFoundException when calling GetFiles.
10117 (SplitPathAndPattern): Used to split the input specification into
10118 a path and a pattern that we can feed to Directory.GetFiles.
10120 2002-02-21 Miguel de Icaza <miguel@ximian.com>
10122 * statement.cs (Fixed): Implement the last case of the Fixed
10123 statement (string handling).
10125 * expression.cs (StringPtr): New class used to return a char * to
10126 a string; Used by the Fixed statement.
10128 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
10130 * expression.cs (Binary.ResolveOperator): Remove redundant
10131 MemberLookup pn parent type.
10132 Optimize union call, we do not need a union if the types are the same.
10133 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
10136 Specialize the use of MemberLookup everywhere, instead of using
10137 the default settings.
10139 (StackAlloc): Implement stackalloc keyword.
10141 * cs-parser.jay: Add rule to parse stackalloc.
10143 * driver.cs: Handle /h, /help, /?
10145 * expression.cs (MakeByteBlob): Removed the hacks we had in place
10146 before we supported unsafe code.
10148 * makefile: add --unsafe to the self compilation of mcs.
10150 2002-02-20 Miguel de Icaza <miguel@ximian.com>
10152 * expression.cs (PointerArithmetic): New class that is used to
10153 perform pointer arithmetic.
10154 (Binary.Resolve): Handle pointer arithmetic
10155 Handle pointer comparission.
10156 (ArrayPtr): Utility expression class that is used to take the
10157 address of an array.
10159 (ElementAccess): Implement array access for pointers
10161 * statement.cs (Fixed): Implement fixed statement for arrays, we
10162 are missing one more case before we are done.
10164 * expression.cs (Indirection): Implement EmitAssign and set the
10165 ExprClass to Variable. This allows pointer dereferences to be
10166 treated as variables, and to have values assigned to them.
10168 * ecore.cs (Expression.StoreFromPtr): New utility function to
10169 store values dereferencing.
10171 2002-02-20 Ravi Pratap <ravi@ximian.com>
10173 * expression.cs (Binary.ResolveOperator): Ensure that we are
10174 not trying to operate on a void type - this fixes the reported
10177 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
10178 the parent implementation is sealed.
10180 * ../errors/cs0239.cs : Add.
10182 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
10184 * typemanager.cs (unverifiable_code_type): Corresponds to
10185 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
10186 which have unsafe code in them.
10188 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
10191 2002-02-19 Miguel de Icaza <miguel@ximian.com>
10193 * cs-tokenizer.cs: Add support for @"litreal strings"
10195 Make tokenizer accept pre-processor directives
10196 on any column (remove the old C-like limitation).
10198 * rootcontext.cs (EmitCode): Emit any global attributes.
10199 (AddGlobalAttributes): Used to keep track of assembly attributes.
10201 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
10203 * cs-parser.jay: Add support for global attributes.
10205 2002-02-17 Miguel de Icaza <miguel@ximian.com>
10207 * expression.cs (Indirection): New helper class. Unary will
10208 create Indirection classes to be able to implement the
10209 IMemoryLocation interface on it.
10211 2002-02-16 Miguel de Icaza <miguel@ximian.com>
10213 * cs-parser.jay (fixed_statement): reference the right statement.
10215 * statement.cs (Fixed.Emit): Finish implementing the fixed
10216 statement for the &x case.
10218 2002-02-14 Miguel de Icaza <miguel@ximian.com>
10220 * class.cs (Property.Define, Method.Define): Remove newslot when
10223 * modifiers.cs: My use of NewSlot when `Abstract' was set was
10224 wrong. NewSlot should only be used if the `new' keyword is present.
10226 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
10227 locating our system dir. Sorry about this.
10229 2002-02-13 Miguel de Icaza <miguel@ximian.com>
10231 * driver.cs (GetSystemDir): Compute correctly the location of our
10232 system assemblies. I was using the compiler directory instead of
10233 the library directory.
10235 2002-02-13 Ravi Pratap <ravi@ximian.com>
10237 * expression.cs (BetterFunction): Put back in what Miguel commented out
10238 since it is the correct fix. The problem is elsewhere ;-)
10240 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
10241 parameters of the parms method are themselves compatible or not !
10243 (StandardConversionExists): Fix very dangerous bug where we were forgetting
10244 to check that a class implements an interface before saying that an implicit
10245 conversion was allowed. Use ImplementsInterface to do the checking.
10247 2002-02-13 Miguel de Icaza <miguel@ximian.com>
10249 * class.cs (Method.Define): Track whether we are an explicit
10250 implementation or not. And only call DefineMethodOverride if we
10251 are an explicit implementation.
10253 (Property.DefineMethod): Ditto.
10255 2002-02-11 Ravi Pratap <ravi@ximian.com>
10257 * expression.cs (BetterFunction): Catch hideous bug which was
10258 preventing us from detecting ambiguous calls due to implicit casts i.e
10261 2002-01-29 Miguel de Icaza <miguel@ximian.com>
10263 * support.cs (Pair): Remove un-needed method. I figured why I was
10264 getting the error in cs-parser.jay, the variable in a foreach loop
10265 is readonly, and the compiler does not really treat this as a variable.
10267 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
10268 instead of EQUALS in grammar.
10270 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
10272 * expression.cs (Unary.DoResolve): Check whether the argument is
10275 2002-01-28 Miguel de Icaza <miguel@ximian.com>
10277 * support.cs: Api for Pair to set a value. Despite the fact that
10278 the variables are public the MS C# compiler refuses to compile
10279 code that accesses the field if the variable is part of a foreach
10282 * statement.cs (Fixed): Begin implementation of the fixed
10285 (Block.AddVariable): Return the VariableInfo on success and null
10286 on failure instead of true/false.
10288 * cs-parser.jay (foreach): Catch errors on variables already
10289 defined (we were ignoring this value before) and properly unwind
10290 the block hierarchy
10292 (fixed_statement): grammar for the fixed statement.
10294 2002-01-25 Miguel de Icaza <miguel@ximian.com>
10296 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
10297 pointer types to be incretemented.
10299 (SizeOf): Implement.
10301 * cs-parser.jay (pointer_member_access): Implement
10302 expr->IDENTIFIER production.
10304 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
10305 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
10308 (Unary): Implement indirection.
10310 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
10311 use in non-unsafe context).
10313 (SimpleName.DoResolve): Check for pointers in field access on safe
10316 (Expression.LoadFromPtr): Factor the load-indirect code in this
10317 function. This was duplicated in UnboxCast and ParameterReference
10319 2002-01-24 Miguel de Icaza <miguel@ximian.com>
10321 * expression.cs (ComposedCast): report an error if a pointer cast
10322 is used in a safe region.
10324 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
10325 pointer type casts in unsafe context.
10327 * codegen.cs (EmitContext): Set up IsUnsafe.
10329 * cs-parser.jay (non_expression_type): Add productions for pointer
10332 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
10333 code. We should not use force into static mode if the method is
10334 not virtual. Fixes bug in MIS
10336 * statement.cs (Do.Emit, While.Emit, For.Emit,
10337 Statement.EmitBoolExpression): Add support to Do and While to
10338 propagate infinite loop as `I do return' semantics.
10340 Improve the For case to also test for boolean constants.
10342 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
10343 to the list of attributes we can add.
10345 Remove `EmitContext' argument.
10347 * class.cs (Method.Define): Apply parameter attributes.
10348 (Constructor.Define): Apply parameter attributes.
10349 (MethodCore.LabelParameters): Move here the core of labeling
10352 * support.cs (ReflectionParameters.ParameterModifier,
10353 InternalParameters.ParameterModifier): Use IsByRef on the type and
10354 only return the OUT bit for these parameters instead of in/out/ref
10357 This is because I miss-understood things. The ParameterInfo.IsIn
10358 and IsOut represent whether the parameter has the [In] and [Out]
10361 2002-01-22 Miguel de Icaza <miguel@ximian.com>
10363 * ecore.cs (FieldExpr.Emit): Release temporaries.
10365 * assign.cs (LocalTemporary.Release): new function.
10367 * codegen.cs (EmitContext.GetTemporaryStorage,
10368 EmitContext.FreeTemporaryStorage): Rework the way we deal with
10369 temporary storage. Now we can "put back" localbuilders when we
10372 2002-01-21 Miguel de Icaza <miguel@ximian.com>
10374 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
10375 need to make a copy of the variable to generate verifiable code.
10377 2002-01-19 Miguel de Icaza <miguel@ximian.com>
10379 * driver.cs: Compute dynamically the system directory.
10381 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
10382 Slower, but more generally useful. Used by the abstract
10383 registering implementation.
10385 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
10386 the rules for the special rule on Type/instances. First check if
10387 we have the same name, and if so, try that special static path
10388 rather than the instance path.
10390 2002-01-18 Miguel de Icaza <miguel@ximian.com>
10392 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
10395 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
10396 Enum, ValueType, Delegate or Array for non-corlib compiles.
10398 * cs-tokenizer.cs: Catch long identifiers (645)
10400 * typemanager.cs (IndexerPropetyName): Ravi never tested this
10403 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
10404 fix, we were returning too early, so we were not registering
10405 pending methods from abstract classes.
10407 Do not register pending methods if the class is abstract.
10409 * expression.cs (Conditional.DoResolve): Report circular implicit
10410 conversions when we neecd to compute it for conditional
10413 (Is.DoResolve): If the expression is always of the provided type,
10414 flag warning 183. If the expression can not ever be of the
10415 provided type flag warning 184.
10417 * class.cs: Catch 169 as well.
10419 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
10422 2002-01-18 Nick Drochak <ndrochak@gol.com>
10424 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
10426 2002-01-17 Miguel de Icaza <miguel@ximian.com>
10428 * interface.cs: (PopulateMethod): Check for pointers being defined
10429 only if the unsafe context is active.
10430 (PopulateProperty): ditto.
10431 (PopulateIndexer): ditto.
10433 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
10434 specified. If pointers are present, make sure that they are
10435 present in an unsafe context.
10436 (Constructor, Constructor.Define): ditto.
10437 (Field, Field.Define): ditto.
10438 (Property, Property.Define): ditto.
10439 (Event, Event.Define): ditto.
10441 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
10442 hashtable if there are classes or structs defined.
10444 * expression.cs (LocalVariableReference.DoResolve): Simplify this
10445 code, as the constant resolution moved.
10447 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
10448 the metadata, so we can flag error 133.
10450 * decl.cs (MemberCore.UnsafeOK): New function to test that a
10451 pointer is being declared in an unsafe context.
10453 2002-01-16 Miguel de Icaza <miguel@ximian.com>
10455 * modifiers.cs (Modifiers.Check): Require a Location argument.
10456 Report error 227 for Unsafe use.
10458 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
10460 * statement.cs (For.Emit): If the test is null, then report that
10461 we do `return', as we wont reach anything afterwards.
10463 (Switch.SwitchGoverningType): Track the expression that matched
10466 * driver.cs: Allow negative numbers as an error code to flag.
10468 * cs-parser.jay: Handle 1551.
10470 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
10472 2002-01-15 Miguel de Icaza <miguel@ximian.com>
10474 * cs-parser.jay: Report 1518 (type declaration can only contain
10475 class, struct, interface, enum or delegate)
10477 (switch_label): Report 1523 (keywords `case' or `default' must
10480 (opt_switch_sections): Report 1522 (empty switch)
10482 * driver.cs: Report 1515 (response file specified multiple times)
10483 Report 1516 (Source file specified multiple times).
10485 * expression.cs (Argument.Resolve): Signal 1510
10487 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
10488 access not allowed in static code)
10490 2002-01-11 Ravi Pratap <ravi@ximian.com>
10492 * typemanager.cs (IsPointerType): Utility method which we are going
10495 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
10496 the object type, so we take care of that.
10498 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
10500 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
10501 added to non-params parameters :-)
10503 * typemanager.cs (CSharpName): Include 'void' type too.
10505 (void_ptr_type): Include in the set of core types.
10507 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
10510 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
10513 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
10514 completely forgotten about it.
10516 2002-01-10 Ravi Pratap <ravi@ximian.com>
10518 * cs-parser.jay (pointer_type): Add. This begins our implementation
10519 of parsing rules for unsafe code.
10521 (unsafe_statement): Implement.
10523 (embedded_statement): Modify to include the above.
10525 * statement.cs (Unsafe): Implement new class for unsafe blocks.
10527 * codegen.cs (EmitContext.InUnsafe): Add. This determines
10528 if the current context is an unsafe one.
10530 * cs-parser.jay (local_variable_pointer_type): Since local variable types
10531 are handled differently, we need separate rules for them.
10533 (local_variable_declaration): Update to use local_variable_pointer_type
10534 to allow variable declarations of unmanaged pointer types.
10536 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
10537 in unsafe contexts.
10539 * ../errors/cs0214.cs : Add.
10541 2002-01-16 Nick Drochak <ndrochak@gol.com>
10543 * makefile: remove 'response' file when cleaning.
10545 2002-01-15 Miguel de Icaza <miguel@ximian.com>
10547 * cs-parser.jay: Report 1524.
10549 2002-01-14 Miguel de Icaza <miguel@ximian.com>
10551 * typemanager.cs (RegisterMethod): drop checking if we have
10552 registered this from here
10554 2002-01-12 Miguel de Icaza <miguel@ximian.com>
10556 * class.cs (Method.EmitDestructor): Implement calling our base
10559 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
10560 value of InFinally.
10562 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
10563 this routine and will wrap the call in a try/catch block. Deal
10566 2002-01-11 Miguel de Icaza <miguel@ximian.com>
10568 * ecore.cs (Expression.MemberLookup): instead of taking a
10569 parameter `same_type' that was used to tell whether we could
10570 access private members we compute our containing type from the
10573 (FieldExpr): Added partial support for volatile fields. This does
10574 not work for volatile fields exposed from assemblies, as I can not
10575 figure out how to extract the modreq from it.
10577 Updated all the source files to use this.
10579 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
10580 because it is referenced by MemberLookup very often.
10582 2002-01-09 Ravi Pratap <ravi@ximian.com>
10584 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
10585 TypeBuilder.GetCustomAttributes to retrieve what we need.
10587 Get rid of redundant default_member_attr_type as this is the same as
10588 default_member_type which already exists.
10590 * interface.cs, attribute.cs : Update accordingly.
10592 2002-01-08 Miguel de Icaza <miguel@ximian.com>
10594 * typemanager.cs: Enable IndexerPropertyName again. It does not
10595 work for TYpeBuilders though. Ravi, can you please fix this?
10597 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
10599 * expression.cs (Argument.Emit): Handle the case of ref objects
10600 being passed to ref functions;
10602 (ParameterReference.EmitLoad): Loads the content of the pointer
10603 without dereferencing.
10605 2002-01-07 Miguel de Icaza <miguel@ximian.com>
10607 * cs-tokenizer.cs: Implemented the pre-processing expressions.
10609 2002-01-08 Ravi Pratap <ravi@ximian.com>
10611 * class.cs (Indexer.DefineMethod): Incorporate the interface
10612 type in the name of the method if we are doing explicit interface
10615 * expression.cs (ConversionExists): Remove as it is completely obsolete.
10617 (BetterConversion): Fix extremely trivial bug where we were referring to
10618 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
10621 * ../errors/bug16.cs : Add although we have fixed it.
10623 2002-01-07 Miguel de Icaza <miguel@ximian.com>
10625 * expression.cs (BaseIndexer): Begin implementation.
10627 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
10629 * cs-parser.jay (indexer_declarator): Use qualified_identifier
10630 production directly to remove a shift/reduce, and implement
10631 explicit interface implementation.
10633 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
10634 after a floating point suffix.
10636 * expression.cs (DoNumericPromotions): Improved the conversion for
10637 uint/uint. If we have a constant, we avoid doing a typecast to a
10640 * class.cs (Indexer): Implement explicit interface implementation
10643 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
10645 * class.cs: make the default instance constructor public and hidebysig.
10647 2001-01-03 Ravi Pratap <ravi@ximian.com>
10649 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
10650 so we can call it from elsewhere.
10652 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
10653 we emit it internally if the class has a defined indexer; otherwise the user
10654 emits it by decorating the class definition with the DefaultMemberAttribute.
10656 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
10657 attribute is not used on a type which defines an indexer.
10659 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
10660 character when we skip whitespace.
10662 * ../errors/cs0646.cs : Add.
10664 2002-01-03 Miguel de Icaza <miguel@ximian.com>
10666 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
10669 * makefile: Add practical target `mcs3.exe' which builds the third
10670 generation compiler.
10672 * expression.cs (New): Fix structures constructor calling.
10674 * class.cs (Property, Method, Indexer): Emit Final flag on the
10675 method if we are an interface implementation and we are not
10678 * ecore.cs (PropertyExpr): New public field `IsBase', tells
10679 whether this property is referencing a `base' method.
10681 * expression.cs (Invocation.EmitCall): take an extra argument:
10682 is_base, this is used to determine whether the `call' or
10683 `callvirt' opcode should be used.
10686 * delegate.cs: update EmitCall.
10688 * class.cs (Method.Define): Set NewSlot for the cases where we are
10689 not implementing an interface method.
10691 (Property.Define): ditto.
10693 2002-01-02 Miguel de Icaza <miguel@ximian.com>
10695 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10696 'r'. Allows mcs to parse itself fully.
10698 2002-01-02 Ravi Pratap <ravi@ximian.com>
10700 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10701 of the number of initializers that require the InitializeArray method.
10703 (CheckIndices): Store the Expression in all cases - not the plain value. Also
10704 update the above field where necessary.
10706 (MakeByteBlob): Update accordingly.
10708 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
10711 (EmitDynamicInitializers): Update in accordance with the new optimization.
10713 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10714 same OpCode applies.
10716 * cs-parser.jay : Fix some glaring errors I introduced.
10718 2002-01-01 Ravi Pratap <ravi@ximian.com>
10720 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10721 so that we can check for name clashes there too.
10723 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10724 for interface indexers.
10726 * interfaces.cs (Define): Emit the default member attribute.
10728 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10729 variable was being referred to while setting the value ;-)
10731 2002-01-01 Miguel de Icaza <miguel@ximian.com>
10733 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10734 byte-by-byte information when we know the data is zero.
10736 Make the block always a multiple of 4, because
10737 DefineInitializedData has a bug.
10739 * assign.cs: Fix, we should assign from the temporary, not from
10742 * expression.cs (MakeByteBlob): Fix my incorrect code.
10744 2001-12-31 Miguel de Icaza <miguel@ximian.com>
10746 * typemanager.cs (EnumToUnderlying): This function is used to get
10747 the underlying type from an enumeration, because it does not
10750 * constant.cs: Use the I4_S form for values between -128 and 127.
10752 * statement.cs (Block.LookupLabel): Looks up a label.
10753 (Block): Drop support for labeled blocks.
10755 (LabeledStatement): New kind of statement that represents a label
10758 (Goto): Finally implement this bad boy.
10760 * cs-parser.jay: Update to reflect new mechanism to implement
10763 2001-12-30 Miguel de Icaza <miguel@ximian.com>
10765 * codegen.cs (EmitContext.This): a codegen property that keeps the
10766 a single instance of this instead of creating many different this
10769 * delegate.cs (Delegate.DoResolve): Update to use the property;
10771 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10773 * expression.cs (BaseAccess.DoResolve): Ditto.
10775 2001-12-29 Ravi Pratap <ravi@ximian.com>
10777 * typemanager.cs (methodimpl_attr_type): Add to hold the type
10778 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10780 (InitCoreTypes): Update accordingly.
10782 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10783 so we can quickly store the state.
10785 (ApplyAttributes): Set the correct implementation flags
10786 for InternalCall methods.
10788 2001-12-29 Miguel de Icaza <miguel@ximian.com>
10790 * expression.cs (EmitCall): if a method is not virtual, then do
10791 not use callvirt on it.
10793 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10794 user defined stuff) requires the use of stobj, which takes an
10795 address on the stack instead of an array and an index. So emit
10796 the Ldelema operation for it.
10798 (EmitStoreOpcode): Use stobj for valuetypes.
10800 (UnaryMutator.EmitCode): Use the right 1 value depending on
10801 whether we are dealing with int64/uint64, float or doubles.
10803 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10804 constructors that I implemented last night.
10806 (Constructor.IsDefault): Fix to work properly for static
10809 * cs-parser.jay (CheckDef): report method signature errors.
10810 Update error number 103 to be 132.
10812 * decl.cs: New AdditionResult enumeration value: MethodExists.
10813 Although we do this check for methods later on in the semantic
10814 analysis, catching repeated default constructors is so easy that
10815 we catch these here.
10817 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10820 (ParameterReference.EmitAssign, Emit): handle
10823 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10824 (ArrayAccess.EmitStoreOpcode): ditto.
10826 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10828 * expression.cs (MakeByteBlob): Complete all the missing types
10829 (uint, short, ushort, byte, sbyte)
10831 * class.cs: Only init instance field initializers on instance
10834 Rename `constructors' to instance_constructors.
10836 (TypeContainer.AddConstructor): Only add constructors to the list
10837 if it is not static.
10839 Make sure that we handle default_static_constructor independently
10840 everywhere where we handle instance_constructors
10842 2001-12-28 Miguel de Icaza <miguel@ximian.com>
10844 * class.cs: Do not lookup or create a base initializer for a
10845 static constructor.
10847 (ConstructorInitializer.Resolve): use the proper type to lookup
10850 * cs-parser.jay: Report error 1585 (modifiers between type and name).
10852 * enum.cs, interface.cs: Remove CloseType, this is taken care by
10855 * decl.cs: CloseType is now an virtual method, the default
10856 implementation just closes this type.
10858 2001-12-28 Ravi Pratap <ravi@ximian.com>
10860 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10861 to PreserveSig by default. Also emit HideBySig on such methods.
10863 Basically, set the defaults to standard values.
10865 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10866 argument, if candidate is better, it can't be worse than the best !
10868 (Invocation): Re-write bits to differentiate between methods being
10869 applicable in their expanded form and their normal form - for params
10872 Get rid of use_standard everywhere as only standard conversions are allowed
10873 in overload resolution.
10875 More spec conformance.
10877 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10879 * driver.cs: Add --timestamp, to see where the compiler spends
10882 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10883 `this' in static code.
10885 (SimpleName.DoResolve): Implement in terms of a helper function
10886 that allows static-references to be passed upstream to
10889 (Expression.ResolveWithSimpleName): Resolve specially simple
10890 names when called by MemberAccess to implement the special
10893 (Expression.ImplicitReferenceConversion): Handle conversions from
10894 Null to reference types before others, as Null's type is
10897 * expression.cs (Invocation.EmitCall): Handle the special case of
10898 calling methods declared on a reference type from a ValueType
10899 (Base classes System.Object and System.Enum)
10901 (MemberAccess.Resolve): Only perform lookups on Enumerations if
10902 the left hand side is a TypeExpr, not on every enumeration.
10904 (Binary.Resolve): If types are reference types, then do a cast to
10905 object on operators != and == of both arguments.
10907 * typemanager.cs (FindMembers): Extract instance and static
10908 members if requested.
10910 * interface.cs (PopulateProperty): Use void_type instead of null
10911 as the return type for the setter method.
10913 (PopulateIndexer): ditto.
10915 2001-12-27 Ravi Pratap <ravi@ximian.com>
10917 * support.cs (ReflectionParameters): Fix minor bug where we
10918 were examining the wrong parameter for the ParamArray attribute.
10920 Cope with requests for the type of the parameter at position
10921 greater than the params parameter's. We now return the element
10922 type of the params array as that makes more sense.
10924 * expression.cs (Invocation.IsParamsMethodApplicable): Update
10925 accordingly as we no longer have to extract the element type
10928 (Invocation.OverloadResolve): Update.
10930 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10932 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10933 against IEnumerator, test whether the return value is a descendant
10934 of the IEnumerator interface.
10936 * class.cs (Indexer.Define): Use an auxiliary method to implement
10937 the other bits of the method definition. Begin support for
10938 explicit interface implementation.
10940 (Property.DefineMethod): Use TypeManager.void_type instead of null
10941 for an empty return value.
10943 2001-12-26 Miguel de Icaza <miguel@ximian.com>
10945 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10946 dealing with a FieldExpr which is composed of a FieldBuilder, in
10947 the code path we did extract the constant, but we should have
10948 obtained the underlying value to be able to cast it (otherwise we
10949 end up in an infinite loop, this is what Ravi was running into).
10951 (ArrayCreation.UpdateIndices): Arrays might be empty.
10953 (MemberAccess.ResolveMemberAccess): Add support for section
10954 14.5.4.1 that deals with the special case of E.I when E is a type
10955 and something else, that I can be a reference to a static member.
10957 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10958 handle a particular array type to create byte blobs, it is just
10959 something we dont generate byteblobs for.
10961 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10964 * location.cs (Push): remove the key from the hashtable that we
10965 are about to add. This happens for empty files.
10967 * driver.cs: Dispose files after we have parsed them.
10969 (tokenize): new function that only runs the tokenizer on its
10970 input, for speed testing.
10972 2001-12-26 Ravi Pratap <ravi@ximian.com>
10974 * class.cs (Event.Define): Define the private field only if there
10975 are no accessors defined.
10977 * expression.cs (ResolveMemberAccess): If there is no associated
10978 field with the event, that means we have an event defined with its
10979 own accessors and we should flag error cs0070 since transforming
10980 ourselves into a field is not valid in that case.
10982 * ecore.cs (SimpleName.DoResolve): Same as above.
10984 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10985 and charset to sane values.
10987 2001-12-25 Ravi Pratap <ravi@ximian.com>
10989 * assign.cs (DoResolve): Perform check on events only if they
10990 are being accessed outside the declaring type.
10992 * cs-parser.jay (event_declarations): Update rules to correctly
10993 set the type of the implicit parameter etc.
10995 (add_accessor, remove_accessor): Set current local parameters.
10997 * expression.cs (Binary): For delegate addition and subtraction,
10998 cast the return value from the method into the appropriate delegate
11001 2001-12-24 Ravi Pratap <ravi@ximian.com>
11003 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
11004 of these as the workaround is unnecessary.
11006 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
11007 delegate data - none of that is needed at all.
11009 Re-write bits to extract the instance expression and the delegate method
11012 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
11015 * attribute.cs (ApplyAttributes): New method to take care of common tasks
11016 of attaching attributes instead of duplicating code everywhere.
11018 * everywhere : Update code to do attribute emission using the above method.
11020 2001-12-23 Miguel de Icaza <miguel@ximian.com>
11022 * expression.cs (IsParamsMethodApplicable): if there are not
11023 parameters, return immediately.
11025 * ecore.cs: The 0 literal can be implicity converted to an enum
11028 (SimpleName.DoResolve): First lookup the type, then lookup the
11031 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
11032 want to get its address. If the InstanceExpression is not
11033 addressable, store the result in a temporary variable, then get
11036 * codegen.cs: Only display 219 errors on warning level or above.
11038 * expression.cs (ArrayAccess): Make it implement the
11039 IMemoryLocation interface.
11041 (Binary.DoResolve): handle the operator == (object a, object b)
11042 and operator != (object a, object b) without incurring into a
11043 BoxedCast (because 5 != o should never be performed).
11045 Handle binary enumerator operators.
11047 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
11048 value type, otherwise use Ldelem_ref.
11050 Use precomputed names;
11052 (AddressOf): Implement address of
11054 * cs-parser.jay (labeled_statement): Fix recursive block
11055 addition by reworking the production.
11057 * expression.cs (New.DoEmit): New has a special case:
11059 If we are dealing with a ValueType, we have a few
11060 situations to deal with:
11062 * The target of New is a ValueType variable, that is
11063 easy, we just pass this as the variable reference
11065 * The target of New is being passed as an argument,
11066 to a boxing operation or a function that takes a
11069 In this case, we need to create a temporary variable
11070 that is the argument of New.
11073 2001-12-23 Ravi Pratap <ravi@ximian.com>
11075 * rootcontext.cs (LookupType): Check that current_type is not null before
11076 going about looking at nested types.
11078 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
11079 not implement the IAssignMethod interface any more.
11081 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
11082 where we tranform them into FieldExprs if they are being resolved from within
11083 the declaring type.
11085 * ecore.cs (SimpleName.DoResolve): Do the same here.
11087 * assign.cs (DoResolve, Emit): Clean up code considerably.
11089 * ../errors/bug10.cs : Add.
11091 * ../errors/cs0070.cs : Add.
11093 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
11095 * assign.cs : Get rid of EventIsLocal everywhere.
11097 2001-12-23 Miguel de Icaza <miguel@ximian.com>
11099 * ecore.cs (ConvertIntLiteral): finished the implementation.
11101 * statement.cs (SwitchLabel): Convert the value we are using as a
11102 key before looking up the table.
11104 2001-12-22 Miguel de Icaza <miguel@ximian.com>
11106 * codegen.cs (EmitTopBlock): Require a Location argument now.
11108 * cs-parser.jay (constructor_declarator): We need to setup
11109 current_local_parameters before we parse the
11110 opt_constructor_initializer, to allow the variables to be bound
11111 to the constructor arguments.
11113 * rootcontext.cs (LookupType): First lookup nested classes in our
11114 class and our parents before we go looking outside our class.
11116 * expression.cs (ConstantFold): Extract/debox the values at the
11119 * rootcontext.cs (EmitCode): Resolve the constants first before we
11120 resolve the types. This is not really needed, but it helps debugging.
11122 * statement.cs: report location.
11124 * cs-parser.jay: pass location to throw statement.
11126 * driver.cs: Small bug fix.
11128 * report.cs: Updated format to be 4-zero filled digits.
11130 2001-12-22 Ravi Pratap <ravi@ximian.com>
11132 * expression.cs (CheckIndices): Fix minor bug where the wrong
11133 variable was being referred to ;-)
11135 (DoEmit): Do not call EmitStaticInitializers when the
11136 underlying type is System.Object.
11138 2001-12-21 Ravi Pratap <ravi@ximian.com>
11140 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
11141 and do the usual workaround for SRE.
11143 * class.cs (MyEventBuilder.EventType): New member to get at the type
11144 of the event, quickly.
11146 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
11148 * assign.cs (Assign.DoResolve): Handle the case when the target
11149 is an EventExpr and perform the necessary checks.
11151 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
11154 (SimpleName.MemberStaticCheck): Include check for EventExpr.
11156 (EventExpr): Set the type in the constructor itself since we
11157 are meant to be born fully resolved.
11159 (EventExpr.Define): Revert code I wrote earlier.
11161 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
11162 instance expression is null. The instance expression is a This in that case
11163 or a null, depending on whether it is a static method or not.
11165 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
11166 refers to more than one method.
11168 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
11169 and accordingly flag errors.
11171 2001-12-21 Miguel de Icaza <miguel@ximian.com>
11173 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
11175 2001-12-22 Miguel de Icaza <miguel@ximian.com>
11177 * location.cs (ToString): Provide useful rutine.
11179 2001-12-21 Miguel de Icaza <miguel@ximian.com>
11181 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
11182 objects, return the actual integral boxed.
11184 * statement.cs (SwitchLabel): define an ILLabel for each
11187 (Switch.CheckSwitch): If the value is a Literal, extract
11188 the underlying literal.
11190 Also in the unused hashtable we had, add the SwitchLabel so we can
11191 quickly look this value up.
11193 * constant.cs: Implement a bunch of new constants. Rewrite
11194 Literal based on this. Made changes everywhere to adapt to this.
11196 * expression.cs (Expression.MakeByteBlob): Optimize routine by
11197 dereferencing array only once, and also copes with enumrations.
11199 bytes are two bytes wide, not one.
11201 (Cast): Perform constant conversions.
11203 * ecore.cs (TryImplicitIntConversion): Return literals instead of
11204 wrappers to the literals here.
11206 * expression.cs (DoNumericPromotions): long literals can converted
11207 to ulong implicity (this is taken care of elsewhere, but I was
11208 missing this spot).
11210 * ecore.cs (Expression.Literalize): Make the return type Literal,
11211 to improve type checking.
11213 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
11215 2001-12-20 Miguel de Icaza <miguel@ximian.com>
11217 * literal.cs: Revert code from ravi that checked the bounds. The
11218 bounds are sane by the definition of the type itself.
11220 * typemanager.cs: Fix implementation of ImplementsInterface. We
11221 need to actually look up in our parent hierarchy for interfaces
11224 * const.cs: Use the underlying type for enumerations
11226 * delegate.cs: Compute the basename for the delegate creation,
11227 that should fix the delegate test case, and restore the correct
11228 Type Lookup semantics in rootcontext
11230 * rootcontext.cs: Revert Ravi's last patch. The correct way of
11231 referencing a nested type with the Reflection API is using the "+"
11234 * cs-parser.jay: Do not require EOF token at the end.
11236 2001-12-20 Ravi Pratap <ravi@ximian.com>
11238 * rootcontext.cs (LookupType): Concatenate type names with
11239 a '.' instead of a '+' The test suite passes again.
11241 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
11242 field of the enumeration.
11244 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
11245 the case when the member is an EventExpr.
11247 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
11248 static has an associated instance expression.
11250 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
11252 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
11254 * class.cs (Event.Define): Register event and perform appropriate checks
11257 We define the Add and Remove methods even if the use provides none because
11258 in that case, we provide default implementations ourselves.
11260 Define a private field of the type of the event. This is done by the CSC compiler
11261 and we should be doing it too ;-)
11263 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
11264 More methods we use in code we generate.
11266 (multicast_delegate_type, delegate_type): Two separate types since the distinction
11269 (InitCoreTypes): Update accordingly for the above.
11271 * class.cs (Event.Emit): Generate code for default accessors that we provide
11273 (EmitDefaultMethod): Do the job in the above.
11275 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
11278 2001-12-20 Miguel de Icaza <miguel@ximian.com>
11280 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
11281 builders even if we were missing one.
11283 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
11284 pass the Basename as our class name instead of the Name. The
11285 basename will be correctly composed for us.
11287 * parameter.cs (Paramters): Now takes a Location argument.
11289 * decl.cs (DeclSpace.LookupType): Removed convenience function and
11290 make all the code call directly LookupType in RootContext and take
11291 this chance to pass the Location information everywhere.
11293 * Everywhere: pass Location information.
11295 2001-12-19 Miguel de Icaza <miguel@ximian.com>
11297 * class.cs (Constructor.Define): Updated way of detecting the
11298 length of the parameters.
11300 (TypeContainer.DefineType): Use basename as the type name for
11303 (TypeContainer.Define): Do not recursively define types here, as
11304 definition is taken care in order by the RootContext.
11306 * tree.cs: Keep track of namespaces in a per-file basis.
11308 * parameter.cs (Parameter.ComputeSignature): Update to use
11311 (Parameters.GetSignature): ditto.
11313 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
11314 instead of a TypeContainer.
11316 (Interface.SemanticAnalysis): Use `this' instead of our parent to
11317 resolve names. Because we need to be resolve in our context, not
11320 * driver.cs: Implement response files.
11322 * class.cs (TypeContainer.DefineType): If we are defined, do not
11323 redefine ourselves.
11325 (Event.Emit): Emit the code for add/remove handlers.
11326 (Event.Define): Save the MethodBuilders for add/remove.
11328 * typemanager.cs: Use pair here too.
11330 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
11331 DictionaryEntry requires the first argument to be non-null.
11333 (enum_declaration): Compute full name for registering the
11336 (delegate_declaration): Instead of using
11337 formal_parameter_list, use opt_formal_parameter_list as the list
11340 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
11341 (EventParsing): New property that controls whether `add' and
11342 `remove' are returned as tokens or identifiers (for events);
11344 2001-12-19 Ravi Pratap <ravi@ximian.com>
11346 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
11347 use MyEventBuilder only and let it wrap the real builder for us.
11349 (MyEventBuilder): Revamp constructor etc.
11351 Implement all operations that we perform on EventBuilder in precisely the same
11354 (FindMembers): Update to use the EventBuilder member.
11356 (Event.Emit): Update accordingly.
11358 2001-12-18 Ravi Pratap <ravi@ximian.com>
11360 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
11361 by calling the appropriate methods.
11363 (GetCustomAttributes): Make stubs as they cannot possibly do anything
11366 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
11368 2001-12-17 Ravi Pratap <ravi@ximian.com>
11370 * delegate.cs (Delegate.Populate): Check that the return type
11371 and various parameters types are indeed accessible.
11373 * class.cs (Constructor.Define): Same here.
11375 (Field.Define): Ditto.
11377 (Event.Define): Ditto.
11379 (Operator.Define): Check that the underlying Method defined itself
11380 correctly - so it's MethodBuilder should not be null.
11382 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
11383 expression happens to be null.
11385 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
11386 members but as of now we don't seem to be able to do anything really useful with it.
11388 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
11389 not the EventBuilder.
11391 2001-12-18 Miguel de Icaza <miguel@ximian.com>
11393 * cs-tokenizer.cs: Add support for defines.
11394 Add support for #if, #elif, #else, #endif
11396 (eval_var): evaluates a variable.
11397 (eval): stubbed for evaluating functions.
11399 * cs-parser.jay: Pass the defines information
11401 * driver.cs: Add --define command line option.
11403 * decl.cs: Move MemberCore here.
11405 Make it the base class for DeclSpace. This allows us to catch and
11406 report 108 and 109 for everything now.
11408 * class.cs (TypeContainer.Define): Extract all the members
11409 before populating and emit the warning 108 (new keyword required
11410 to override) instead of having each member implement this.
11412 (MemberCore.Define): New abstract method, we will be using this in
11413 the warning reporting engine in Populate.
11415 (Operator.Define): Adjust to new MemberCore protocol.
11417 * const.cs (Const): This does not derive from Expression, it is a
11418 temporary object we use to create fields, it is a MemberCore.
11420 * class.cs (Method.Define): Allow the entry point to be in a
11423 * driver.cs: Rewrite the argument handler to clean it up a bit.
11425 * rootcontext.cs: Made it just an auxiliary namespace feature by
11426 making everything static.
11428 * driver.cs: Adapt code to use RootContext type name instead of
11431 * delegate.cs: Remove RootContext argument.
11433 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
11436 * class.cs (Event.Define): The lookup can fail.
11438 * cs-tokenizer.cs: Begin implementation of pre-procesor.
11440 * expression.cs: Resolve the this instance before invoking the code.
11442 2001-12-17 Miguel de Icaza <miguel@ximian.com>
11444 * cs-parser.jay: Add a production in element_access that allows
11445 the thing to become a "type" reference. This way we can parse
11446 things like "(string [])" as a type.
11448 Note that this still does not handle the more complex rules of
11452 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
11454 * ecore.cs: (CopyNewMethods): new utility function used to
11455 assemble the list of methods from running FindMembers.
11457 (MemberLookup): Rework FindMembers so that
11459 2001-12-16 Miguel de Icaza <miguel@ximian.com>
11461 * class.cs (TypeContainer): Remove Delegates who fail to be
11464 * delegate.cs (Populate): Verify that we dont get null return
11465 values. TODO: Check for AsAccessible.
11467 * cs-parser.jay: Use basename to emit error 574 (destructor should
11468 have the same name as container class), not the full name.
11470 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
11471 possible representation.
11473 Also implements integer type suffixes U and L.
11475 2001-12-15 Miguel de Icaza <miguel@ximian.com>
11477 * expression.cs (ArrayCreation.DoResolve): We need to do the
11478 argument resolution *always*.
11480 * decl.cs: Make this hold the namespace. Hold the root context as
11482 (LookupType): Move here.
11484 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
11486 * location.cs (Row, Name): Fixed the code, it was always returning
11487 references to the first file.
11489 * interface.cs: Register properties defined through interfaces.
11491 * driver.cs: Add support for globbing on the command line
11493 * class.cs (Field): Make it derive from MemberCore as well.
11496 2001-12-15 Ravi Pratap <ravi@ximian.com>
11498 * class.cs (Event::Define): Check that the type of the event is a delegate
11499 type else flag error #66.
11501 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
11504 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
11505 values of EntryPoint, CharSet etc etc.
11507 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
11509 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
11510 be null and we should ignore this. I am not sure if this is really clean. Apparently,
11511 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
11512 which needs this to do its work.
11514 * ../errors/cs0066.cs : Add.
11516 2001-12-14 Miguel de Icaza <miguel@ximian.com>
11518 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
11521 * class.cs: (MethodSignature.MethodSignature): Removed hack that
11522 clears out the parameters field.
11523 (MemberSignatureCompare): Cleanup
11525 (MemberCore): New base class used to share code between MethodCore
11528 (RegisterRequiredImplementations) BindingFlags.Public requires
11529 either BindingFlags.Instace or Static. Use instance here.
11531 (Property): Refactored code to cope better with the full spec.
11533 * parameter.cs (GetParameterInfo): Return an empty array instead
11536 * class.cs (Property): Abstract or extern properties have no bodies.
11538 * parameter.cs (GetParameterInfo): return a zero-sized array.
11540 * class.cs (TypeContainer.MethodModifiersValid): Move all the
11541 method modifier validation to the typecontainer so we can reuse
11542 this on properties.
11544 (MethodCore.ParameterTypes): return an empty sized array of types.
11546 (Property.Define): Test property modifier validity.
11548 Add tests for sealed/override too.
11550 (Method.Emit): abstract or extern methods have no bodies.
11552 2001-12-14 Ravi Pratap <ravi@ximian.com>
11554 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
11557 (Method::Define, ::Emit): Modify accordingly.
11559 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
11561 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
11563 * makefile: Pass in /unsafe.
11565 2001-12-13 Miguel de Icaza <miguel@ximian.com>
11567 * class.cs (MakeKey): Kill routine.
11569 * class.cs (TypeContainer.Define): Correctly define explicit
11570 method implementations (they require the full interface name plus
11573 * typemanager.cs: Deply the PtrHashtable here and stop using the
11574 lame keys. Things work so much better.
11576 This of course broke everyone who depended on `RegisterMethod' to
11577 do the `test for existance' test. This has to be done elsewhere.
11579 * support.cs (PtrHashtable): A hashtable that avoid comparing with
11580 the object stupid Equals method (because, that like fails all over
11581 the place). We still do not use it.
11583 * class.cs (TypeContainer.SetRequiredInterface,
11584 TypeContainer.RequireMethods): Killed these two routines and moved
11585 all the functionality to RegisterRequiredImplementations.
11587 (TypeContainer.RegisterRequiredImplementations): This routine now
11588 registers all the implementations required in an array for the
11589 interfaces and abstract methods. We use an array of structures
11590 which can be computed ahead of time to reduce memory usage and we
11591 also assume that lookups are cheap as most classes will not
11592 implement too many interfaces.
11594 We also avoid creating too many MethodSignatures.
11596 (TypeContainer.IsInterfaceMethod): Update and optionally does not
11597 clear the "pending" bit if we find that there are problems with
11600 (TypeContainer.VerifyPendingMethods): Update to report errors of
11601 methods that look like implementations but are not.
11603 (TypeContainer.Define): Add support for explicit interface method
11606 2001-12-12 Miguel de Icaza <miguel@ximian.com>
11608 * typemanager.cs: Keep track of the parameters here instead of
11609 being a feature of the TypeContainer.
11611 * class.cs: Drop the registration of parameters here, as
11612 InterfaceMethods are also interface declarations.
11614 * delegate.cs: Register methods with the TypeManager not only with
11615 the TypeContainer. This code was buggy.
11617 * interface.cs: Full registation here.
11619 2001-12-11 Miguel de Icaza <miguel@ximian.com>
11621 * expression.cs: Remove reducer for binary expressions, it can not
11624 * const.cs: Put here the code that used to go into constant.cs
11626 * constant.cs: Put here the code for constants, this is a new base
11627 class for Literals.
11629 * literal.cs: Make Literal derive from Constant.
11631 2001-12-09 Miguel de Icaza <miguel@ximian.com>
11633 * statement.cs (Return.Emit): Report error 157 if the user
11634 attempts to return from a finally block.
11636 (Return.Emit): Instead of emitting a return, jump to the end of
11639 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
11640 LocalBuilder to store the result of the function. ReturnLabel is
11641 the target where we jump.
11644 2001-12-09 Radek Doulik <rodo@ximian.com>
11646 * cs-parser.jay: remember alias in current namespace
11648 * ecore.cs (SimpleName::DoResolve): use aliases for types or
11651 * class.cs (LookupAlias): lookup alias in my_namespace
11653 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
11655 (LookupAlias): lookup alias in this and if needed in parent
11658 2001-12-08 Miguel de Icaza <miguel@ximian.com>
11662 * rootcontext.cs: (ModuleBuilder) Made static, first step into
11663 making things static. I need this to avoid passing the
11664 TypeContainer when calling ParameterType.
11666 * support.cs (InternalParameters.ParameterType): Remove ugly hack
11667 that did string manipulation to compute the type and then call
11668 GetType. Use Parameter.ParameterType instead.
11670 * cs-tokenizer.cs: Consume the suffix for floating values.
11672 * expression.cs (ParameterReference): figure out whether this is a
11673 reference parameter or not. Kill an extra variable by computing
11674 the arg_idx during emission.
11676 * parameter.cs (Parameters.GetParameterInfo): New overloaded
11677 function that returns whether a parameter is an out/ref value or not.
11679 (Parameter.ParameterType): The type of the parameter (base,
11680 without ref/out applied).
11682 (Parameter.Resolve): Perform resolution here.
11683 (Parameter.ExternalType): The full type (with ref/out applied).
11685 * statement.cs (Using.Emit, Using.EmitExpression): Implement
11686 support for expressions on the using statement.
11688 2001-12-07 Miguel de Icaza <miguel@ximian.com>
11690 * statement.cs (Using.EmitLocalVariableDecls): Split the
11691 localvariable handling of the using statement.
11693 (Block.EmitMeta): Keep track of variable count across blocks. We
11694 were reusing slots on separate branches of blocks.
11696 (Try.Emit): Emit the general code block, we were not emitting it.
11698 Check the type of the declaration to be an IDisposable or
11699 something that can be implicity converted to it.
11701 Emit conversions if required.
11703 * ecore.cs (EmptyExpression): New utility class.
11704 (Expression.ImplicitConversionExists): New utility function.
11706 2001-12-06 Miguel de Icaza <miguel@ximian.com>
11708 * statement.cs (Using): Implement.
11710 * expression.cs (LocalVariableReference): Support read only variables.
11712 * statement.cs: Remove the explicit emit for the Leave opcode.
11713 (VariableInfo): Add a readonly field.
11715 2001-12-05 Miguel de Icaza <miguel@ximian.com>
11717 * ecore.cs (ConvCast): new class used to encapsulate the various
11718 explicit integer conversions that works in both checked and
11719 unchecked contexts.
11721 (Expression.ConvertNumericExplicit): Use new ConvCast class to
11722 properly generate the overflow opcodes.
11724 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11726 * statement.cs: The correct type for the EmptyExpression is the
11727 element_type, not the variable type. Ravi pointed this out.
11729 2001-12-04 Ravi Pratap <ravi@ximian.com>
11731 * class.cs (Method::Define): Handle PInvoke methods specially
11732 by using DefinePInvokeMethod instead of the usual one.
11734 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11735 above to do the task of extracting information and defining the method.
11737 2001-12-04 Ravi Pratap <ravi@ximian.com>
11739 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11740 of the condition for string type.
11742 (Emit): Move that here.
11744 (ArrayCreation::CheckIndices): Keep string literals in their expression
11747 (EmitDynamicInitializers): Handle strings appropriately.
11749 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11751 * codegen.cs (EmitContext): Replace multiple variables with a
11752 single pointer to the current Switch statement.
11754 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11757 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11761 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11764 (Foreach.Emit): Foreach on arrays was not setting
11765 up the loop variables (for break/continue).
11767 (GotoCase): Semi-implented.
11769 2001-12-03 Ravi Pratap <ravi@ximian.com>
11771 * attribute.cs (CheckAttribute): Handle system attributes by using
11772 Attribute.GetAttributes to examine information we need.
11774 (GetValidPlaces): Same here.
11776 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11778 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11780 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11782 (Method::Define): Set appropriate flags if we have a DllImport attribute.
11784 (Method::Emit): Handle the case when we are a PInvoke method.
11786 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11788 * expression.cs: Use ResolveWithSimpleName on compound names.
11790 2001-12-02 Ravi Pratap <ravi@ximian.com>
11792 * constant.cs (EmitConstant): Make sure we resolve the associated expression
11793 before trying to reduce it.
11795 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11797 * constant.cs (LookupConstantValue): Implement.
11799 (EmitConstant): Use the above in emitting the constant.
11801 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11802 that are user-defined by doing a LookupConstantValue on them.
11804 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11807 2001-11-29 Miguel de Icaza <miguel@ximian.com>
11809 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11811 (BaseAccess.DoResolve): Implement.
11813 (MemberAccess.DoResolve): Split this routine into a
11814 ResolveMemberAccess routine that can be used independently
11816 2001-11-28 Miguel de Icaza <miguel@ximian.com>
11818 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11819 As that share bits of the implementation. Is returns a boolean,
11820 while As returns the Type that is being probed.
11822 2001-12-01 Ravi Pratap <ravi@ximian.com>
11824 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11825 instead of a Literal - much easier.
11827 (EnumInTransit): Remove - utterly useless :-)
11829 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11831 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11833 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11834 chain when we have no associated expression.
11836 2001-11-30 Ravi Pratap <ravi@ximian.com>
11838 * constant.cs (Define): Use Location while reporting the errror.
11840 Also emit a warning when 'new' is used and there is no inherited
11843 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
11846 (LookupEnumValue): Implement to lookup an enum member's value and define it
11849 (Populate): Re-write accordingly to use the above routine.
11851 2001-11-27 Miguel de Icaza <miguel@ximian.com>
11853 * expression.cs (This): Fix prototype for DoResolveLValue to
11854 override the base class DoResolveLValue.
11856 * cs-parser.cs: Report errors cs574 and cs575 (destructor
11859 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11860 (we need to load the address of the field here). This fixes
11863 (FieldExpr.DoResolveLValue): Call the DoResolve
11864 function to initialize the Instance expression.
11866 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11867 correctly the GetEnumerator operation on a value type.
11869 * cs-parser.jay: Add more simple parsing error catches.
11871 * statement.cs (Switch): Add support for string switches.
11872 Handle null specially.
11874 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
11876 2001-11-28 Ravi Pratap <ravi@ximian.com>
11878 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11880 (declare_local_constant): New helper function.
11882 * statement.cs (AddConstant): Keep a separate record of constants
11884 (IsConstant): Implement to determine if a variable is a constant.
11886 (GetConstantExpression): Implement.
11888 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11890 * statement.cs (IsVariableDefined): Re-write.
11892 2001-11-27 Ravi Pratap <ravi@ximian.com>
11894 * class.cs (TypeContainer::FindMembers): Look for constants
11895 in the case when we are looking for MemberTypes.Field
11897 * expression.cs (MemberAccess::DoResolve): Check that in the
11898 case we are a FieldExpr and a Literal, we are not being accessed
11899 by an instance reference.
11901 * cs-parser.jay (local_constant_declaration): Implement.
11903 (declaration_statement): Implement for constant declarations.
11905 2001-11-26 Miguel de Icaza <miguel@ximian.com>
11907 * statement.cs (Switch): Catch double defaults.
11909 (Switch): More work on the switch() statement
11910 implementation. It works for integral values now, need to finish
11914 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11916 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11917 integer literals into other integer literals. To be used by
11920 2001-11-24 Ravi Pratap <ravi@ximian.com>
11922 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11925 (EmitDynamicInitializers): Cope with the above since we extract data
11926 directly from ArrayData now.
11928 (ExpectInitializers): Keep track of whether initializers are mandatory
11931 (Bounds): Make it a hashtable to prevent the same dimension being
11932 recorded for every element in that dimension.
11934 (EmitDynamicInitializers): Fix bug which prevented the Set array method
11937 Also fix bug which was causing the indices to be emitted in the reverse
11940 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11942 * expression.cs (ArrayCreation): Implement the bits that Ravi left
11943 unfinished. They do not work, because the underlying code is
11946 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11948 * cs-parser.jay: Remove bogus fixme.
11950 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11951 on Switch statement.
11953 2001-11-23 Ravi Pratap <ravi@ximian.com>
11955 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11958 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11959 parameter. Apparently, any expression is allowed.
11961 (ValidateInitializers): Update accordingly.
11963 (CheckIndices): Fix some tricky bugs thanks to recursion.
11965 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
11966 I was being completely brain-dead.
11968 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11969 and re-write acordingly.
11971 (DelegateInvocation): Re-write accordingly.
11973 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11975 (MakeByteBlob): Handle types more correctly.
11977 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11978 initialization from expressions but it is incomplete because I am a complete
11981 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11983 * statement.cs (If.Emit): Fix a bug that generated incorrect code
11984 on If. Basically, we have to return `true' (ie, we do return to
11985 our caller) only if both branches of the if return.
11987 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11988 short-circuit operators, handle them as short circuit operators.
11990 (Cast.DoResolve): Resolve type.
11991 (Cast.Cast): Take an expression as the target type.
11993 * cs-parser.jay (cast_expression): Remove old hack that only
11994 allowed a limited set of types to be handled. Now we take a
11995 unary_expression and we resolve to a type during semantic
11998 Use the grammar productions from Rhys to handle casts (this is
11999 not complete like Rhys syntax yet, we fail to handle that corner
12000 case that C# has regarding (-x), but we will get there.
12002 2001-11-22 Ravi Pratap <ravi@ximian.com>
12004 * class.cs (EmitFieldInitializer): Take care of the case when we have a
12005 field which is an array type.
12007 * cs-parser.jay (declare_local_variables): Support array initialization too.
12009 * typemanager.cs (MakeKey): Implement.
12011 (everywhere): Use the above appropriately.
12013 * cs-parser.jay (for_statement): Update for array initialization while
12014 declaring variables.
12016 * ecore.cs : The error message was correct, it's the variable's names that
12017 were misleading ;-) Make the code more readable.
12019 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
12020 the correct type etc.
12022 (ConvertExplicit): Handle Enum types by examining the underlying type.
12024 2001-11-21 Ravi Pratap <ravi@ximian.com>
12026 * parameter.cs (GetCallingConvention): Always return
12027 CallingConventions.Standard for now.
12029 2001-11-22 Miguel de Icaza <miguel@ximian.com>
12031 * expression.cs (Binary.ResolveOperator): Update the values of `l'
12032 and `r' after calling DoNumericPromotions.
12034 * ecore.cs: Fix error message (the types were in the wrong order).
12036 * statement.cs (Foreach.ProbeCollectionType): Need to pass
12037 BindingFlags.Instance as well
12039 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
12040 implicit int literal conversion in an empty cast so that we
12041 propagate the right type upstream.
12043 (UnboxCast): new class used to unbox value types.
12044 (Expression.ConvertExplicit): Add explicit type conversions done
12047 (Expression.ImplicitNumericConversion): Oops, forgot to test for
12048 the target type before applying the implicit LongLiterals to ULong
12051 2001-11-21 Miguel de Icaza <miguel@ximian.com>
12053 * cs-parser.jay (for_statement): Reworked the way For works: now
12054 we declare manually any variables that are introduced in
12055 for_initializer to solve the problem of having out-of-band code
12056 emition (that is what got for broken).
12058 (declaration_statement): Perform the actual variable declaration
12059 that used to be done in local_variable_declaration here.
12061 (local_variable_declaration): Do not declare anything, just pass
12062 the information on a DictionaryEntry
12064 2001-11-20 Ravi Pratap <ravi@ximian.com>
12066 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
12067 re-write of the logic to now make it recursive.
12069 (UpdateIndices): Re-write accordingly.
12071 Store element data in a separate ArrayData list in the above methods.
12073 (MakeByteBlob): Implement to dump the array data into a byte array.
12075 2001-11-19 Ravi Pratap <ravi@ximian.com>
12077 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
12080 * constant.cs (Define): Implement.
12082 (EmitConstant): Re-write fully.
12084 Pass in location info.
12086 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
12089 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
12090 DictionaryEntry since we need location info too.
12092 (constant_declaration): Update accordingly.
12094 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
12095 code into another method : UpdateIndices.
12097 2001-11-18 Ravi Pratap <ravi@ximian.com>
12099 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
12100 some type checking etc.
12102 2001-11-17 Ravi Pratap <ravi@ximian.com>
12104 * expression.cs (ArrayCreation::ValidateInitializers): Implement
12105 bits to provide dimension info if the user skips doing that.
12107 Update second constructor to store the rank correctly.
12109 2001-11-16 Ravi Pratap <ravi@ximian.com>
12111 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
12112 and try to implement.
12114 * ../errors/cs0150.cs : Add.
12116 * ../errors/cs0178.cs : Add.
12118 2001-11-16 Miguel de Icaza <miguel@ximian.com>
12120 * statement.cs: Implement foreach on multi-dimensional arrays.
12122 * parameter.cs (Parameters.GetParameterByName): Also lookup the
12123 name of the params argument.
12125 * expression.cs: Use EmitStoreOpcode to get the right opcode while
12126 initializing the array.
12128 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
12129 we can use this elsewhere.
12131 * statement.cs: Finish implementation of foreach for single
12134 * cs-parser.jay: Use an out-of-band stack to pass information
12135 around, I wonder why I need this.
12137 foreach_block: Make the new foreach_block the current_block.
12139 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
12140 function used to return a static Parameters structure. Used for
12141 empty parameters, as those are created very frequently.
12143 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
12145 2001-11-15 Ravi Pratap <ravi@ximian.com>
12147 * interface.cs : Default modifier is private, not public. The
12148 make verify test passes again.
12150 2001-11-15 Ravi Pratap <ravi@ximian.com>
12152 * support.cs (ReflectionParameters): Fix logic to determine
12153 whether the last parameter is a params one. Test 9 passes again.
12155 * delegate.cs (Populate): Register the builders we define with
12156 RegisterParameterForBuilder. Test 19 passes again.
12158 * cs-parser.jay (property_declaration): Reference $6 instead
12159 of $$ to get at the location.
12161 (indexer_declaration): Similar stuff.
12163 (attribute): Ditto.
12165 * class.cs (Property): Register parameters for the Get and Set methods
12166 if they exist. Test 23 passes again.
12168 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
12169 call to EmitArguments as we are sure there aren't any params arguments.
12170 Test 32 passes again.
12172 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
12173 IndexOutOfRangeException.
12175 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
12176 Test 33 now passes again.
12178 2001-11-15 Miguel de Icaza <miguel@ximian.com>
12180 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
12181 broke a bunch of things. Will have to come up with a better way
12182 of tracking locations.
12184 * statement.cs: Implemented foreach for single dimension arrays.
12186 2001-11-09 Miguel de Icaza <miguel@ximian.com>
12188 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
12189 an error. This removes the lookup from the critical path.
12191 * cs-parser.jay: Removed use of temporary_loc, which is completely
12194 2001-11-14 Miguel de Icaza <miguel@ximian.com>
12196 * support.cs (ReflectionParameters.ParameterModifier): Report
12197 whether the argument is a PARAMS argument or not.
12199 * class.cs: Set the attribute `ParamArrayAttribute' on the
12200 parameter argument.
12202 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
12203 and cons_param_array_attribute (ConstructorInfo for
12204 ParamArrayAttribute).,
12206 * codegen.cs: Emit the return using the `Return' statement, that
12207 way we can report the error correctly for missing return values.
12209 * class.cs (Method.Emit): Clean up.
12211 * expression.cs (Argument.Resolve): Take another argument: the
12212 location where this argument is used. Notice that this is not
12213 part of the "Argument" class as to reduce the size of the
12214 structure (we know the approximate location anyways).
12216 Test if the argument is a variable-reference, if not, then
12217 complain with a 206.
12219 (Argument.Emit): Emit addresses of variables.
12221 (Argument.FullDesc): Simplify.
12223 (Invocation.DoResolve): Update for Argument.Resolve.
12225 (ElementAccess.DoResolve): ditto.
12227 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
12228 method should be virtual, as this method is always virtual.
12230 (NewDelegate.DoResolve): Update for Argument.Resolve.
12232 * class.cs (ConstructorInitializer.DoResolve): ditto.
12234 * attribute.cs (Attribute.Resolve): ditto.
12236 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12238 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
12240 * expression.cs (ParameterReference): Drop IStackStorage and implement
12241 IAssignMethod instead.
12243 (LocalVariableReference): ditto.
12245 * ecore.cs (FieldExpr): Drop IStackStorage and implement
12246 IAssignMethod instead.
12248 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12250 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
12251 enumerations that are used in heavily used structures derive from
12252 byte in a laughable and pathetic attempt to reduce memory usage.
12253 This is the kind of pre-optimzations that you should not do at
12254 home without adult supervision.
12256 * expression.cs (UnaryMutator): New class, used to handle ++ and
12257 -- separatedly from the other unary operators. Cleans up the
12258 code, and kills the ExpressionStatement dependency in Unary.
12260 (Unary): Removed `method' and `Arguments' from this class, making
12261 it smaller, and moving it all to SimpleCall, so I can reuse this
12262 code in other locations and avoid creating a lot of transient data
12263 strucutres when not required.
12265 * cs-parser.jay: Adjust for new changes.
12267 2001-11-11 Miguel de Icaza <miguel@ximian.com>
12269 * enum.cs (Enum.Populate): If there is a failure during
12272 * cs-parser.jay (opt_enum_base): we used to catch type errors
12273 here, but this is really incorrect. The type error should be
12274 catched during semantic analysis.
12276 2001-12-11 Ravi Pratap <ravi@ximian.com>
12278 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
12279 current_local_parameters as expected since I, in my stupidity, had forgotten
12282 * attribute.cs (GetValidPlaces): Fix stupid bug.
12284 * class.cs (Method::Emit): Perform check on applicability of attributes.
12286 (Constructor::Emit): Ditto.
12288 (Field::Emit): Ditto.
12290 (Field.Location): Store location information.
12292 (Property, Event, Indexer, Operator): Ditto.
12294 * cs-parser.jay (field_declaration): Pass in location for each field.
12296 * ../errors/cs0592.cs : Add.
12298 2001-11-12 Ravi Pratap <ravi@ximian.com>
12300 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
12302 (InitCoreTypes): Update accordingly.
12304 (RegisterAttrType, LookupAttr): Implement.
12306 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
12307 info about the same.
12309 (Resolve): Update to populate the above as necessary.
12311 (Error592): Helper.
12313 (GetValidPlaces): Helper to the above.
12315 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
12317 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
12319 2001-11-12 Ravi Pratap <ravi@ximian.com>
12321 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
12323 * ../errors/cs0617.cs : Add.
12325 2001-11-11 Ravi Pratap <ravi@ximian.com>
12327 * enum.cs (Emit): Rename to Populate to be more consistent with what
12328 we expect it to do and when exactly it is called.
12330 * class.cs, rootcontext.cs : Update accordingly.
12332 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
12333 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
12335 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
12337 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
12338 of a fieldinfo using the above, when dealing with a FieldBuilder.
12340 2001-11-10 Ravi Pratap <ravi@ximian.com>
12342 * ../errors/cs0031.cs : Add.
12344 * ../errors/cs1008.cs : Add.
12346 * ../errrors/cs0543.cs : Add.
12348 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
12351 (FindMembers): Implement.
12353 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
12354 enums and delegates too.
12356 (enum_types): Rename to builder_to_enum.
12358 (delegate_types): Rename to builder_to_delegate.
12360 * delegate.cs (FindMembers): Implement.
12362 2001-11-09 Ravi Pratap <ravi@ximian.com>
12364 * typemanager.cs (IsEnumType): Implement.
12366 * enum.cs (Emit): Re-write parts to account for the underlying type
12367 better and perform checking etc.
12369 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
12370 of the underlying type.
12372 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
12375 * enum.cs (error31): Helper to report error #31.
12377 * cs-parser.jay (enum_declaration): Store location of each member too.
12379 * enum.cs (member_to_location): New hashtable.
12381 (AddEnumMember): Update location hashtable.
12383 (Emit): Use the location of each member while reporting errors.
12385 2001-11-09 Miguel de Icaza <miguel@ximian.com>
12387 * cs-parser.jay: A for_initializer if is a
12388 local_variable_declaration really ammount to have an implicit
12389 block with the variable declaration and no initializer for for.
12391 * statement.cs (For.Emit): Cope with null initializers.
12393 This fixes the infinite loop on for initializers.
12395 2001-11-08 Miguel de Icaza <miguel@ximian.com>
12397 * enum.cs: More cleanup.
12399 * ecore.cs: Remove dead code.
12401 * class.cs (Property.Emit): More simplification.
12402 (Event.Emit): ditto.
12404 Reworked to have less levels of indentation.
12406 2001-11-08 Ravi Pratap <ravi@ximian.com>
12408 * class.cs (Property): Emit attributes.
12418 * enum.cs (Emit): Ditto.
12420 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
12423 * class.cs (Field, Event, etc.): Move attribute generation into the
12424 Emit method everywhere.
12426 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
12427 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
12428 as we had no way of defining nested enums !
12430 * rootcontext.cs : Adjust code accordingly.
12432 * typemanager.cs (AddEnumType): To keep track of enum types separately.
12434 2001-11-07 Ravi Pratap <ravi@ximian.com>
12436 * expression.cs (EvalConstantExpression): Move into ecore.cs
12438 * enum.cs (Enum): Rename some members and make them public and readonly
12439 according to our convention.
12441 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
12444 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
12446 (Enum::Emit): Write a simple version for now which doesn't try to compute
12447 expressions. I shall modify this to be more robust in just a while.
12449 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
12451 (TypeContainer::CloseType): Create the Enum types too.
12453 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
12455 * expression.cs (EvalConstantExpression): Get rid of completely.
12457 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
12458 user-defined values and other cases.
12460 (IsValidEnumLiteral): Helper function.
12462 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
12463 out there in the case we had a literal FieldExpr.
12465 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
12467 (Literalize): Revamp a bit to take two arguments.
12469 (EnumLiteral): New class which derives from Literal to wrap enum literals.
12471 2001-11-06 Ravi Pratap <ravi@ximian.com>
12473 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
12475 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
12477 (Resolve): Use the above to ensure we have proper initializers.
12479 2001-11-05 Ravi Pratap <ravi@ximian.com>
12481 * expression.cs (Expression::EvalConstantExpression): New method to
12482 evaluate constant expressions.
12484 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
12486 2001-11-07 Miguel de Icaza <miguel@ximian.com>
12488 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
12491 (Binary.ResolveOperator): Handle operator != (object a, object b)
12492 and operator == (object a, object b);
12494 (Binary.DoNumericPromotions): Indicate whether the numeric
12495 promotion was possible.
12497 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
12500 Made the ArrayAccess implement interface IAssignMethod instead of
12501 IStackStore as the order in which arguments are passed reflects
12504 * assign.cs: Instead of using expr.ExprClass to select the way of
12505 assinging, probe for the IStackStore/IAssignMethod interfaces.
12507 * typemanager.cs: Load InitializeArray definition.
12509 * rootcontext.cs (RootContext.MakeStaticData): Used to define
12510 static data that can be used to initialize arrays.
12512 2001-11-05 Miguel de Icaza <miguel@ximian.com>
12514 * expression.cs: Handle operator== and operator!= for booleans.
12516 (Conditioal.Reduce): Implement reducer for the ?: operator.
12518 (Conditional.Resolve): Implement dead code elimination.
12520 (Binary.Resolve): Catch string literals and return a new
12521 concatenated string.
12523 (Unary.Reduce): Implement reduction of unary expressions.
12525 * ecore.cs: Split out the expression core handling here.
12527 (Expression.Reduce): New method used to perform constant folding
12528 and CSE. This is needed to support constant-expressions.
12530 * statement.cs (Statement.EmitBoolExpression): Pass true and false
12531 targets, and optimize for !x.
12533 2001-11-04 Ravi Pratap <ravi@ximian.com>
12535 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
12536 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
12537 set custom atttributes.
12539 * literal.cs (Literal::GetValue): New abstract method to return the actual
12540 value of the literal, cast as an object.
12542 (*Literal): Implement GetValue method.
12544 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
12545 expressions to the arraylist but objects of type Argument.
12547 * class.cs (TypeContainer::Emit): Emit our attributes too.
12549 (Method::Emit, Constructor::Emit): Ditto.
12551 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
12552 to be ignoring earlier.
12554 2001-11-03 Ravi Pratap <ravi@ximian.com>
12556 * attribute.cs (AttributeSection::Define): Implement to do the business
12557 of constructing a CustomAttributeBuilder.
12559 (Attribute): New trivial class. Increases readability of code.
12561 * cs-parser.jay : Update accordingly.
12563 (positional_argument_list, named_argument_list, named_argument): New rules
12565 (attribute_arguments): Use the above so that we are more correct.
12567 2001-11-02 Ravi Pratap <ravi@ximian.com>
12569 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
12570 to perform all checks for a method with a params parameter.
12572 (Invocation::OverloadResolve): Update to use the above method and therefore
12573 cope correctly with params method invocations.
12575 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
12578 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
12579 constructors in our parent too because we can't afford to miss out on
12582 * attribute.cs (AttributeSection): New name for the class Attribute
12584 Other trivial changes to improve readability.
12586 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
12587 use the new class names.
12589 2001-11-01 Ravi Pratap <ravi@ximian.com>
12591 * class.cs (Method::Define): Complete definition for params types too
12593 (Indexer::Define): Ditto.
12595 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
12596 Cope everywhere with a request for info about the array parameter.
12598 2001-11-01 Ravi Pratap <ravi@ximian.com>
12600 * tree.cs (RecordNamespace): Fix up to check for the correct key.
12602 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
12603 local_variable_type to extract the string corresponding to the type.
12605 (local_variable_type): Fixup the action to use the new helper method.
12607 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
12610 * expression.cs : Clean out code which uses the above.
12612 2001-10-31 Ravi Pratap <ravi@ximian.com>
12614 * typemanager.cs (RegisterMethod): Check if we already have an existing key
12615 and bale out if necessary by returning a false.
12617 (RegisterProperty): Ditto.
12619 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
12620 and print out appropriate error messages.
12622 * interface.cs (everywhere): Ditto.
12624 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
12625 location to constructor.
12627 * class.cs (Property, Event, Indexer): Update accordingly.
12629 * ../errors/cs111.cs : Added.
12631 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
12632 of a method, as laid down by the spec.
12634 (Invocation::OverloadResolve): Use the above method.
12636 2001-10-31 Ravi Pratap <ravi@ximian.com>
12638 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
12639 now take a TypeContainer and a Parameters object.
12641 (ParameterData): Modify return type of ParameterModifier method to be
12642 Parameter.Modifier and not a string.
12644 (ReflectionParameters, InternalParameters): Update accordingly.
12646 * expression.cs (Argument::GetParameterModifier): Same here.
12648 * support.cs (InternalParameters::ParameterType): Find a better way of determining
12649 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
12650 symbol in it at all so maybe this is only for now.
12652 2001-10-30 Ravi Pratap <ravi@ximian.com>
12654 * support.cs (InternalParameters): Constructor now takes an extra argument
12655 which is the actual Parameters class.
12657 (ParameterDesc): Update to provide info on ref/out modifiers.
12659 * class.cs (everywhere): Update call to InternalParameters to pass in
12660 the second argument too.
12662 * support.cs (ParameterData): Add ParameterModifier, which is a method
12663 to return the modifier info [ref/out etc]
12665 (InternalParameters, ReflectionParameters): Implement the above.
12667 * expression.cs (Argument::ParameterModifier): Similar function to return
12668 info about the argument's modifiers.
12670 (Invocation::OverloadResolve): Update to take into account matching modifiers
12673 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
12674 a new SetFormalParameters object which we pass to InternalParameters.
12676 2001-10-30 Ravi Pratap <ravi@ximian.com>
12678 * expression.cs (NewArray): Merge into the ArrayCreation class.
12680 2001-10-29 Ravi Pratap <ravi@ximian.com>
12682 * expression.cs (NewArray): Merge classes NewBuiltinArray and
12683 NewUserdefinedArray into one as there wasn't much of a use in having
12686 * expression.cs (Argument): Change field's name to ArgType from Type.
12688 (Type): New readonly property which returns the proper type, taking into
12689 account ref/out modifiers.
12691 (everywhere): Adjust code accordingly for the above.
12693 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12694 whether we are emitting for a ref or out parameter.
12696 * expression.cs (Argument::Emit): Use the above field to set the state.
12698 (LocalVariableReference::Emit): Update to honour the flag and emit the
12701 * parameter.cs (Attributes): Set the correct flags for ref parameters.
12703 * expression.cs (Argument::FullDesc): New function to provide a full desc.
12705 * support.cs (ParameterData): Add method ParameterDesc to the interface.
12707 (ReflectionParameters, InternalParameters): Implement the above method.
12709 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12712 (Invocation::FullMethodDesc): Ditto.
12714 2001-10-29 Miguel de Icaza <miguel@ximian.com>
12716 * cs-parser.jay: Add extra production for the second form of array
12719 * expression.cs (ArrayCreation): Update to reflect the above
12722 * Small changes to prepare for Array initialization.
12724 2001-10-28 Miguel de Icaza <miguel@ximian.com>
12726 * typemanager.cs (ImplementsInterface): interface might be null;
12727 Deal with this problem;
12729 Also, we do store negative hits on the cache (null values), so use
12730 this instead of calling t.GetInterfaces on the type everytime.
12732 2001-10-28 Ravi Pratap <ravi@ximian.com>
12734 * typemanager.cs (IsBuiltinType): New method to help determine the same.
12736 * expression.cs (New::DoResolve): Get rid of array creation code and instead
12737 split functionality out into different classes.
12739 (New::FormArrayType): Move into NewBuiltinArray.
12741 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12744 (NewBuiltinArray): New class to handle creation of built-in arrays.
12746 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12747 account creation of one-dimensional arrays.
12749 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12751 (NewUserdefinedArray::DoResolve): Implement.
12753 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12755 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12756 we maintain inside the TypeManager. This is necessary to perform lookups on the
12759 (LookupType): Update to perform GetType on the module builders too.
12761 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12763 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12765 2001-10-23 Ravi Pratap <ravi@ximian.com>
12767 * expression.cs (New::DoResolve): Implement guts of array creation.
12769 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12771 2001-10-27 Miguel de Icaza <miguel@ximian.com>
12773 * expression.cs: Fix bug I introduced lsat night that broke
12776 (Expression.Resolve): Report a 246 error (can not resolve name)
12777 if we find a SimpleName in the stream.
12779 (Expression.ResolveLValue): Ditto.
12781 (Expression.ResolveWithSimpleName): This function is a variant of
12782 ResolveName, this one allows SimpleNames to be returned without a
12783 warning. The only consumer of SimpleNames is MemberAccess
12785 2001-10-26 Miguel de Icaza <miguel@ximian.com>
12787 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12788 might arrive here. I have my doubts that this is correct.
12790 * statement.cs (Lock): Implement lock statement.
12792 * cs-parser.jay: Small fixes to support `lock' and `using'
12794 * cs-tokenizer.cs: Remove extra space
12796 * driver.cs: New flag --checked, allows to turn on integer math
12799 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12800 Threading.Monitor.Exit
12802 2001-10-23 Miguel de Icaza <miguel@ximian.com>
12804 * expression.cs (IndexerAccess::DoResolveLValue): Set the
12805 Expression Class to be IndexerAccess.
12807 Notice that Indexer::DoResolve sets the eclass to Value.
12809 2001-10-22 Miguel de Icaza <miguel@ximian.com>
12811 * class.cs (TypeContainer::Emit): Emit code for indexers.
12813 * assign.cs (IAssignMethod): New interface implemented by Indexers
12814 and Properties for handling assignment.
12816 (Assign::Emit): Simplify and reuse code.
12818 * expression.cs (IndexerAccess, PropertyExpr): Implement
12819 IAssignMethod, clean up old code.
12821 2001-10-22 Ravi Pratap <ravi@ximian.com>
12823 * typemanager.cs (ImplementsInterface): New method to determine if a type
12824 implements a given interface. Provides a nice cache too.
12826 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12829 (ConvertReferenceExplicit): Ditto.
12831 * delegate.cs (Delegate::Populate): Update to define the parameters on the
12832 various methods, with correct names etc.
12834 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
12835 Operator.UnaryNegation.
12837 * cs-parser.jay (operator_declarator): Be a little clever in the case where
12838 we have a unary plus or minus operator.
12840 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
12843 * everywhere : update accordingly.
12845 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12848 * class.cs (Method::Define): For the case where we are implementing a method
12849 inherited from an interface, we need to set the MethodAttributes.Final flag too.
12850 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12852 2001-10-21 Ravi Pratap <ravi@ximian.com>
12854 * interface.cs (FindMembers): Implement to work around S.R.E
12857 * typemanager.cs (IsInterfaceType): Implement.
12859 (FindMembers): Update to handle interface types too.
12861 * expression.cs (ImplicitReferenceConversion): Re-write bits which
12862 use IsAssignableFrom as that is not correct - it doesn't work.
12864 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12865 and accordingly override EmitStatement.
12867 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12868 using the correct logic :-)
12870 2001-10-19 Ravi Pratap <ravi@ximian.com>
12872 * ../errors/cs-11.cs : Add to demonstrate error -11
12874 2001-10-17 Miguel de Icaza <miguel@ximian.com>
12876 * assign.cs (Assign::Resolve): Resolve right hand side first, and
12877 then pass this as a hint to ResolveLValue.
12879 * expression.cs (FieldExpr): Add Location information
12881 (FieldExpr::LValueResolve): Report assignment to readonly
12884 (Expression::ExprClassFromMemberInfo): Pass location information.
12886 (Expression::ResolveLValue): Add new method that resolves an
12889 (Expression::DoResolveLValue): Default invocation calls
12892 (Indexers): New class used to keep track of indexers in a given
12895 (IStackStore): Renamed from LValue, as it did not really describe
12896 what this did. Also ResolveLValue is gone from this interface and
12897 now is part of Expression.
12899 (ElementAccess): Depending on the element access type
12901 * typemanager.cs: Add `indexer_name_type' as a Core type
12902 (System.Runtime.CompilerServices.IndexerNameAttribute)
12904 * statement.cs (Goto): Take a location.
12906 2001-10-18 Ravi Pratap <ravi@ximian.com>
12908 * delegate.cs (Delegate::VerifyDelegate): New method to verify
12909 if two delegates are compatible.
12911 (NewDelegate::DoResolve): Update to take care of the case when
12912 we instantiate a delegate from another delegate.
12914 * typemanager.cs (FindMembers): Don't even try to look up members
12915 of Delegate types for now.
12917 2001-10-18 Ravi Pratap <ravi@ximian.com>
12919 * delegate.cs (NewDelegate): New class to take care of delegate
12922 * expression.cs (New): Split the delegate related code out into
12923 the NewDelegate class.
12925 * delegate.cs (DelegateInvocation): New class to handle delegate
12928 * expression.cs (Invocation): Split out delegate related code into
12929 the DelegateInvocation class.
12931 2001-10-17 Ravi Pratap <ravi@ximian.com>
12933 * expression.cs (New::DoResolve): Implement delegate creation fully
12934 and according to the spec.
12936 (New::DoEmit): Update to handle delegates differently.
12938 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12939 because of which we were printing out arguments in reverse order !
12941 * delegate.cs (VerifyMethod): Implement to check if the given method
12942 matches the delegate.
12944 (FullDelegateDesc): Implement.
12946 (VerifyApplicability): Implement.
12948 * expression.cs (Invocation::DoResolve): Update to accordingly handle
12949 delegate invocations too.
12951 (Invocation::Emit): Ditto.
12953 * ../errors/cs1593.cs : Added.
12955 * ../errors/cs1594.cs : Added.
12957 * delegate.cs (InstanceExpression, TargetMethod): New properties.
12959 2001-10-16 Ravi Pratap <ravi@ximian.com>
12961 * typemanager.cs (intptr_type): Core type for System.IntPtr
12963 (InitCoreTypes): Update for the same.
12965 (iasyncresult_type, asynccallback_type): Ditto.
12967 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12970 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12973 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12974 the builders for the 4 members of a delegate type :-)
12976 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12979 * expression.cs (New::DoResolve): Implement guts for delegate creation.
12981 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12983 2001-10-15 Miguel de Icaza <miguel@ximian.com>
12985 * statement.cs (Break::Emit): Implement.
12986 (Continue::Emit): Implement.
12988 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
12989 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
12990 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
12991 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
12994 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12995 properties that track the label for the current loop (begin of the
12996 loop and end of the loop).
12998 2001-10-15 Ravi Pratap <ravi@ximian.com>
13000 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
13001 use of emitting anything at all.
13003 * class.cs, rootcontext.cs : Get rid of calls to the same.
13005 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
13007 (Populate): Define the constructor correctly and set the implementation
13010 * typemanager.cs (delegate_types): New hashtable to hold delegates that
13013 (AddDelegateType): Implement.
13015 (IsDelegateType): Implement helper method.
13017 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
13019 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
13020 and accordingly handle it.
13022 * delegate.cs (Populate): Take TypeContainer argument.
13023 Implement bits to define the Invoke method. However, I still haven't figured out
13024 how to take care of the native int bit :-(
13026 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
13027 Qualify the name of the delegate, not its return type !
13029 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
13032 (StandardConversionExists): Checking for array types turns out to be recursive.
13034 (ConvertReferenceExplicit): Implement array conversion.
13036 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
13038 2001-10-12 Ravi Pratap <ravi@ximian.com>
13040 * cs-parser.jay (delegate_declaration): Store the fully qualified
13041 name as it is a type declaration.
13043 * delegate.cs (ReturnType, Name): Rename members to these. Make them
13046 (DefineDelegate): Renamed from Define. Does the same thing essentially,
13047 as TypeContainer::DefineType.
13049 (Populate): Method in which all the definition of the various methods (Invoke)
13052 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
13055 (CloseDelegate): Finally creates the delegate.
13057 * class.cs (TypeContainer::DefineType): Update to define delegates.
13058 (Populate, Emit and CloseType): Do the same thing here too.
13060 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
13061 delegates in all these operations.
13063 2001-10-14 Miguel de Icaza <miguel@ximian.com>
13065 * expression.cs: LocalTemporary: a new expression used to
13066 reference a temporary that has been created.
13068 * assign.cs: Handle PropertyAccess back here, so that we can
13069 provide the proper semantic access to properties.
13071 * expression.cs (Expression::ConvertReferenceExplicit): Implement
13072 a few more explicit conversions.
13074 * modifiers.cs: `NEW' modifier maps to HideBySig.
13076 * expression.cs (PropertyExpr): Make this into an
13077 ExpressionStatement, and support the EmitStatement code path.
13079 Perform get/set error checking, clean up the interface.
13081 * assign.cs: recognize PropertyExprs as targets, and if so, turn
13082 them into toplevel access objects.
13084 2001-10-12 Miguel de Icaza <miguel@ximian.com>
13086 * expression.cs: PropertyExpr::PropertyExpr: use work around the
13089 * typemanager.cs: Keep track here of our PropertyBuilders again to
13090 work around lameness in SRE.
13092 2001-10-11 Miguel de Icaza <miguel@ximian.com>
13094 * expression.cs (LValue::LValueResolve): New method in the
13095 interface, used to perform a second resolution pass for LValues.
13097 (This::DoResolve): Catch the use of this in static methods.
13099 (This::LValueResolve): Implement.
13101 (This::Store): Remove warning, assigning to `this' in structures
13104 (Invocation::Emit): Deal with invocation of
13105 methods on value types. We need to pass the address to structure
13106 methods rather than the object itself. (The equivalent code to
13107 emit "this" for structures leaves the entire structure on the
13108 stack instead of a pointer to it).
13110 (ParameterReference::DoResolve): Compute the real index for the
13111 argument based on whether the method takes or not a `this' pointer
13112 (ie, the method is static).
13114 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
13115 value types returned from functions when we need to invoke a
13116 method on the sturcture.
13119 2001-10-11 Ravi Pratap <ravi@ximian.com>
13121 * class.cs (TypeContainer::DefineType): Method to actually do the business of
13122 defining the type in the Modulebuilder or Typebuilder. This is to take
13123 care of nested types which need to be defined on the TypeBuilder using
13124 DefineNestedMethod.
13126 (TypeContainer::GetClassBases): Implement. Essentially the code from the
13127 methods in RootContext, only ported to be part of TypeContainer.
13129 (TypeContainer::GetInterfaceOrClass): Ditto.
13131 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
13133 * interface.cs (Interface::DefineInterface): New method. Does exactly
13134 what RootContext.CreateInterface did earlier, only it takes care of nested types
13137 (Interface::GetInterfaces): Move from RootContext here and port.
13139 (Interface::GetInterfaceByName): Same here.
13141 * rootcontext.cs (ResolveTree): Re-write.
13143 (PopulateTypes): Re-write.
13145 * class.cs (TypeContainer::Populate): Populate nested types too.
13146 (TypeContainer::Emit): Emit nested members too.
13148 * typemanager.cs (AddUserType): Do not make use of the FullName property,
13149 instead just use the name argument passed in as it is already fully
13152 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
13153 to TypeContainer mapping to see if a type is user-defined.
13155 * class.cs (TypeContainer::CloseType): Implement.
13157 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
13158 the default constructor.
13160 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
13163 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
13165 * interface.cs (CloseType): Create the type here.
13167 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
13170 Remove all the methods which are now in TypeContainer.
13172 2001-10-10 Ravi Pratap <ravi@ximian.com>
13174 * delegate.cs (Define): Re-write bits to define the delegate
13177 2001-10-10 Miguel de Icaza <miguel@ximian.com>
13179 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
13181 * expression.cs (ImplicitReferenceConversion): handle null as well
13182 as a source to convert to any reference type.
13184 * statement.cs (Return): Perform any implicit conversions to
13185 expected return type.
13187 Validate use of return statement.
13189 * codegen.cs (EmitContext): Pass the expected return type here.
13191 * class.cs (Method, Constructor, Property): Pass expected return
13192 type to EmitContext.
13194 2001-10-09 Miguel de Icaza <miguel@ximian.com>
13196 * expression.cs: Make DoResolve take an EmitContext instead of a
13199 Replaced `l' and `location' for `loc', for consistency.
13201 (Error, Warning): Remove unneeded Tc argument.
13203 * assign.cs, literal.cs, constant.cs: Update to new calling
13206 * codegen.cs: EmitContext now contains a flag indicating whether
13207 code is being generated in a static method or not.
13209 * cs-parser.jay: DecomposeQI, new function that replaces the old
13210 QualifiedIdentifier. Now we always decompose the assembled
13211 strings from qualified_identifier productions into a group of
13214 2001-10-08 Miguel de Icaza <miguel@ximian.com>
13216 * rootcontext.cs: Deal with field-less struct types correctly now
13217 by passing the size option to Define Type.
13219 * class.cs: Removed hack that created one static field.
13221 2001-10-07 Miguel de Icaza <miguel@ximian.com>
13223 * statement.cs: Moved most of the code generation here.
13225 2001-10-09 Ravi Pratap <ravi@ximian.com>
13227 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
13230 (ElementAccess): Remove useless bits for now - keep checks as the spec
13233 2001-10-08 Ravi Pratap <ravi@ximian.com>
13235 * expression.cs (ElementAccess::DoResolve): Remove my crap code
13236 and start performing checks according to the spec.
13238 2001-10-07 Ravi Pratap <ravi@ximian.com>
13240 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
13241 rank_specifiers instead.
13243 (rank_specifiers): Change the order in which the rank specifiers are stored
13245 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
13247 * expression.cs (ElementAccess): Implement the LValue interface too.
13249 2001-10-06 Ravi Pratap <ravi@ximian.com>
13251 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
13252 except that user defined conversions are not included.
13254 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
13255 perform the conversion of the return type, if necessary.
13257 (New::DoResolve): Check whether we are creating an array or an object
13258 and accordingly do the needful.
13260 (New::Emit): Same here.
13262 (New::DoResolve): Implement guts of array creation.
13264 (New::FormLookupType): Helper function.
13266 2001-10-07 Miguel de Icaza <miguel@ximian.com>
13268 * codegen.cs: Removed most of the code generation here, and move the
13269 corresponding code generation bits to the statement classes.
13271 Added support for try/catch/finalize and throw.
13273 * cs-parser.jay: Added support for try/catch/finalize.
13275 * class.cs: Catch static methods having the flags override,
13276 virtual or abstract.
13278 * expression.cs (UserCast): This user cast was not really doing
13279 what it was supposed to do. Which is to be born in fully resolved
13280 state. Parts of the resolution were being performed at Emit time!
13284 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13286 * expression.cs: Implicity convert the result from UserCast.
13288 2001-10-05 Ravi Pratap <ravi@ximian.com>
13290 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
13291 prevented it from working correctly.
13293 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
13294 merely ConvertImplicit.
13296 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13298 * typemanager.cs: Make the LookupTypeContainer function static,
13299 and not per-instance.
13301 * class.cs: Make static FindMembers (the one that takes a Type
13304 * codegen.cs: Add EmitForeach here.
13306 * cs-parser.jay: Make foreach a toplevel object instead of the
13307 inline expansion, as we need to perform semantic analysis on it.
13309 2001-10-05 Ravi Pratap <ravi@ximian.com>
13311 * expression.cs (Expression::ImplicitUserConversion): Rename to
13312 UserDefinedConversion.
13314 (Expression::UserDefinedConversion): Take an extra argument specifying
13315 whether we look for explicit user conversions too.
13317 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
13319 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
13321 (ExplicitUserConversion): Make it a call to UserDefinedConversion
13322 with the appropriate arguments.
13324 * cs-parser.jay (cast_expression): Record location too.
13326 * expression.cs (Cast): Record location info.
13328 (Expression::ConvertExplicit): Take location argument.
13330 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
13331 to determine if we are doing explicit conversions.
13333 (UserCast::Emit): Update accordingly.
13335 (Expression::ConvertExplicit): Report an error if everything fails.
13337 * ../errors/cs0030.cs : Add.
13339 2001-10-04 Miguel de Icaza <miguel@ximian.com>
13341 * modifiers.cs: If the ABSTRACT keyword is present, also set the
13342 virtual and newslot bits.
13344 * class.cs (TypeContainer::RegisterRequiredImplementations):
13345 Record methods we need.
13347 (TypeContainer::MakeKey): Helper function to make keys for
13348 MethodBases, since the Methodbase key is useless.
13350 (TypeContainer::Populate): Call RegisterRequiredImplementations
13351 before defining the methods.
13353 Create a mapping for method_builders_to_methods ahead of time
13354 instead of inside a tight loop.
13356 (::RequireMethods): Accept an object as the data to set into the
13357 hashtable so we can report interface vs abstract method mismatch.
13359 2001-10-03 Miguel de Icaza <miguel@ximian.com>
13361 * report.cs: Make all of it static.
13363 * rootcontext.cs: Drop object_type and value_type computations, as
13364 we have those in the TypeManager anyways.
13366 Drop report instance variable too, now it is a global.
13368 * driver.cs: Use try/catch on command line handling.
13370 Add --probe option to debug the error reporting system with a test
13373 * report.cs: Add support for exiting program when a probe
13374 condition is reached.
13376 2001-10-03 Ravi Pratap <ravi@ximian.com>
13378 * expression.cs (Binary::DoNumericPromotions): Fix the case when
13379 we do a forcible conversion regardless of type, to check if
13380 ForceConversion returns a null.
13382 (Binary::error19): Use location to report error.
13384 (Unary::error23): Use location here too.
13386 * ../errors/cs0019.cs : Check in.
13388 * ../errors/cs0023.cs : Check in.
13390 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
13391 case of a non-null MethodInfo object with a length of 0 !
13393 (Binary::ResolveOperator): Flag error if overload resolution fails to find
13394 an applicable member - according to the spec :-)
13395 Also fix logic to find members in base types.
13397 (Unary::ResolveOperator): Same here.
13399 (Unary::report23): Change name to error23 and make first argument a TypeContainer
13400 as I was getting thoroughly confused between this and error19 :-)
13402 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
13403 (::FindMostEncompassedType): Implement.
13404 (::FindMostEncompassingType): Implement.
13405 (::StandardConversionExists): Implement.
13407 (UserImplicitCast): Re-vamp. We now need info about most specific
13408 source and target types so that we can do the necessary conversions.
13410 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
13411 mathematical union with no duplicates.
13413 2001-10-03 Miguel de Icaza <miguel@ximian.com>
13415 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
13416 in order from base classes to child classes, so that we can in
13417 child classes look up in our parent for method names and
13418 attributes (required for handling abstract, virtual, new, override
13419 constructs: we need to instrospect our base class, and if we dont
13420 populate the classes in order, the introspection might be
13421 incorrect. For example, a method could query its parent before
13422 the parent has any methods and would determine that the parent has
13423 no abstract methods (while it could have had them)).
13425 (RootContext::CreateType): Record the order in which we define the
13428 2001-10-02 Miguel de Icaza <miguel@ximian.com>
13430 * class.cs (TypeContainer::Populate): Also method definitions can
13431 fail now, keep track of this.
13433 (TypeContainer::FindMembers): Implement support for
13434 DeclaredOnly/noDeclaredOnly flag.
13436 (Constructor::Emit) Return the ConstructorBuilder.
13438 (Method::Emit) Return the MethodBuilder.
13439 Check for abstract or virtual methods to be public.
13441 * rootcontext.cs (RootContext::CreateType): Register all the
13442 abstract methods required for the class to be complete and the
13443 interface methods that must be implemented.
13445 * cs-parser.jay: Report error 501 (method requires body if it is
13446 not marked abstract or extern).
13448 * expression.cs (TypeOf::Emit): Implement.
13450 * typemanager.cs: runtime_handle_type, new global type.
13452 * class.cs (Property::Emit): Generate code for properties.
13454 2001-10-02 Ravi Pratap <ravi@ximian.com>
13456 * expression.cs (Unary::ResolveOperator): Find operators on base type
13457 too - we now conform exactly to the spec.
13459 (Binary::ResolveOperator): Same here.
13461 * class.cs (Operator::Define): Fix minor quirk in the tests.
13463 * ../errors/cs0215.cs : Added.
13465 * ../errors/cs0556.cs : Added.
13467 * ../errors/cs0555.cs : Added.
13469 2001-10-01 Miguel de Icaza <miguel@ximian.com>
13471 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
13472 single integer which is really efficient
13474 2001-10-01 Ravi Pratap <ravi@ximian.com>
13476 * expression.cs (Expression::ImplicitUserConversion): Use location
13477 even in the case when we are examining True operators.
13479 * class.cs (Operator::Define): Perform extensive checks to conform
13480 with the rules for operator overloading in the spec.
13482 * expression.cs (Expression::ImplicitReferenceConversion): Implement
13483 some of the other conversions mentioned in the spec.
13485 * typemanager.cs (array_type): New static member for the System.Array built-in
13488 (cloneable_interface): For System.ICloneable interface.
13490 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
13491 we start resolving the tree and populating types.
13493 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
13495 2001-10-01 Miguel de Icaza <miguel@ximian.com>
13497 * expression.cs (Expression::ExprClassFromMemberInfo,
13498 Expression::Literalize): Create literal expressions from
13499 FieldInfos which are literals.
13501 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
13502 type casts, because they were wrong. The test suite in tests
13505 (ImplicitNumericConversion): ushort to ulong requires a widening
13508 Int32 constant to long requires widening cast as well.
13510 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
13511 for integers because the type on the stack is not i4.
13513 2001-09-30 Miguel de Icaza <miguel@ximian.com>
13515 * expression.cs (report118): require location argument.
13517 * parameter.cs: Do not dereference potential null value.
13519 * class.cs: Catch methods that lack the `new' keyword when
13520 overriding a name. Report warnings when `new' is used without
13521 anything being there to override.
13523 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
13525 * class.cs: Only add constructor to hashtable if it is non-null
13526 (as now constructors can fail on define).
13528 (TypeManager, Class, Struct): Take location arguments.
13530 Catch field instance initialization in structs as errors.
13532 accepting_filter: a new filter for FindMembers that is static so
13533 that we dont create an instance per invocation.
13535 (Constructor::Define): Catch errors where a struct constructor is
13538 * cs-parser.jay: Pass location information for various new
13541 * delegate.cs (Delegate): take a location argument.
13543 * driver.cs: Do not call EmitCode if there were problesm in the
13544 Definition of the types, as many Builders wont be there.
13546 * decl.cs (Decl::Decl): Require a location argument.
13548 * cs-tokenizer.cs: Handle properly hex constants that can not fit
13549 into integers, and find the most appropiate integer for it.
13551 * literal.cs: Implement ULongLiteral.
13553 * rootcontext.cs: Provide better information about the location of
13554 failure when CreateType fails.
13556 2001-09-29 Miguel de Icaza <miguel@ximian.com>
13558 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
13561 * expression.cs (Binary::CheckShiftArguments): Add missing type
13563 (Binary::ResolveOperator): Add type to the logical and and logical
13564 or, Bitwise And/Or and Exclusive Or code paths, it was missing
13567 (Binary::DoNumericPromotions): In the case where either argument
13568 is ulong (and most signed types combined with ulong cause an
13569 error) perform implicit integer constant conversions as well.
13571 2001-09-28 Miguel de Icaza <miguel@ximian.com>
13573 * expression.cs (UserImplicitCast): Method should always be
13575 (Invocation::BetterConversion): Simplified test for IntLiteral.
13577 (Expression::ImplicitNumericConversion): Split this routine out.
13578 Put the code that performs implicit constant integer conversions
13581 (Expression::Resolve): Become a wrapper around DoResolve so we can
13582 check eclass and type being set after resolve.
13584 (Invocation::Badness): Remove this dead function
13586 (Binary::ResolveOperator): Do not compute the expensive argumnets
13587 unless we have a union for it.
13589 (Probe::Emit): Is needs to do an isinst and then
13590 compare against null.
13592 (::CanConvert): Added Location argument. If the Location argument
13593 is null (Location.Null), then we do not report errors. This is
13594 used by the `probe' mechanism of the Explicit conversion. We do
13595 not want to generate an error for something that the user
13596 explicitly requested to be casted. But the pipeline for an
13597 explicit cast first tests for potential implicit casts.
13599 So for now, if the Location is null, it means `Probe only' to
13600 avoid adding another argument. Might have to revise this
13603 (ClassCast): New class used to type cast objects into arbitrary
13604 classes (used in Explicit Reference Conversions).
13606 Implement `as' as well.
13608 Reverted all the patches from Ravi below: they were broken:
13610 * The use of `level' as a mechanism to stop recursive
13611 invocations is wrong. That was there just to catch the
13612 bug with a strack trace but not as a way of addressing
13615 To fix the problem we have to *understand* what is going
13616 on and the interactions and come up with a plan, not
13617 just get things going.
13619 * The use of the type conversion cache that I proposed
13620 last night had an open topic: How does this work across
13621 protection domains. A user defined conversion might not
13622 be public in the location where we are applying the
13623 conversion, a different conversion might be selected
13624 (ie, private A->B (better) but public B->A (worse),
13625 inside A, A->B applies, but outside it, B->A will
13628 * On top of that (ie, even if the above is solved),
13629 conversions in a cache need to be abstract. Ie, `To
13630 convert from an Int to a Short use an OpcodeCast', not
13631 `To convert from an Int to a Short use the OpcodeCast on
13632 the variable 5' (which is what this patch was doing).
13634 2001-09-28 Ravi Pratap <ravi@ximian.com>
13636 * expression.cs (Invocation::ConversionExists): Re-write to use
13637 the conversion cache
13639 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
13640 cache all conversions done, not just user-defined ones.
13642 (Invocation::BetterConversion): The real culprit. Use ConversionExists
13643 to determine if a conversion exists instead of acutually trying to
13644 perform the conversion. It's faster too.
13646 (Expression::ConvertExplicit): Modify to use ConversionExists to check
13647 and only then attempt the implicit conversion.
13649 2001-09-28 Ravi Pratap <ravi@ximian.com>
13651 * expression.cs (ConvertImplicit): Use a cache for conversions
13652 already found. Check level of recursion and bail out if necessary.
13654 2001-09-28 Miguel de Icaza <miguel@ximian.com>
13656 * typemanager.cs (string_concat_string_string, string_concat_object_object):
13657 Export standard methods that we expect for string operations.
13659 * statement.cs (Block::UsageWarning): Track usage of variables and
13660 report the errors for not used variables.
13662 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
13665 2001-09-27 Miguel de Icaza <miguel@ximian.com>
13667 * codegen.cs: remove unnneded code
13669 * expression.cs: Removed BuiltinTypeAccess class
13671 Fix the order in which implicit conversions are
13674 The previous fixed dropped support for boxed conversions (adding a
13675 test to the test suite now)
13677 (UserImplicitCast::CanConvert): Remove test for source being null,
13678 that code is broken. We should not feed a null to begin with, if
13679 we do, then we should track the bug where the problem originates
13680 and not try to cover it up here.
13682 Return a resolved expression of type UserImplicitCast on success
13683 rather than true/false. Ravi: this is what I was talking about,
13684 the pattern is to use a static method as a "constructor" for
13687 Also, do not create arguments until the very last minute,
13688 otherwise we always create the arguments even for lookups that
13689 will never be performed.
13691 (UserImplicitCast::Resolve): Eliminate, objects of type
13692 UserImplicitCast are born in a fully resolved state.
13694 * typemanager.cs (InitCoreTypes): Init also value_type
13695 (System.ValueType).
13697 * expression.cs (Cast::Resolve): First resolve the child expression.
13699 (LValue): Add new method AddressOf to be used by
13702 Change the argument of Store to take an EmitContext instead of an
13703 ILGenerator, because things like FieldExpr need to be able to call
13704 their children expression to generate the instance code.
13706 (Expression::Error, Expression::Warning): Sugar functions for
13709 (Expression::MemberLookup): Accept a TypeContainer instead of a
13710 Report as the first argument.
13712 (Expression::ResolvePrimary): Killed. I still want to improve
13713 this as currently the code is just not right.
13715 (Expression::ResolveMemberAccess): Simplify, but it is still
13718 (Unary::Resolve): Catch errors in AddressOf operators.
13720 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13721 index to a byte for the short-version, or the compiler will choose
13722 the wrong Emit call, which generates the wrong data.
13724 (ParameterReference::Emit, ::Store): same.
13726 (FieldExpr::AddressOf): Implement.
13728 * typemanager.cs: TypeManager: made public variable instead of
13731 * driver.cs: document --fatal.
13733 * report.cs (ErrorMessage, WarningMessage): new names for the old
13734 Error and Warning classes.
13736 * cs-parser.jay (member_access): Turn built-in access to types
13737 into a normal simplename
13739 2001-09-27 Ravi Pratap <ravi@ximian.com>
13741 * expression.cs (Invocation::BetterConversion): Fix to cope
13742 with q being null, since this was introducing a bug.
13744 * expression.cs (ConvertImplicit): Do built-in conversions first.
13746 2001-09-27 Ravi Pratap <ravi@ximian.com>
13748 * expression.cs (UserImplicitCast::Resolve): Fix bug.
13750 2001-09-27 Ravi Pratap <ravi@ximian.com>
13752 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13753 I had introduced long ago (what's new ?).
13755 * expression.cs (UserImplicitCast::CanConvert): Static method to do
13756 the work of all the checking.
13757 (ConvertImplicit): Call CanConvert and only then create object if necessary.
13758 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13760 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13761 that is the right way.
13763 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
13764 overloading resolution. Use everywhere instead of cutting and pasting code.
13766 (Binary::ResolveOperator): Use MakeUnionSet.
13768 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
13769 we have to convert to bool types. Not complete yet.
13771 2001-09-27 Miguel de Icaza <miguel@ximian.com>
13773 * typemanager.cs (TypeManager::CSharpName): support ushort.
13775 * expression.cs (Expression::TryImplicitIntConversion): Attempts
13776 to provide an expression that performsn an implicit constant int
13777 conversion (section 6.1.6).
13778 (Expression::ConvertImplicitRequired): Reworked to include
13779 implicit constant expression conversions.
13781 (Expression::ConvertNumericExplicit): Finished.
13783 (Invocation::Emit): If InstanceExpression is null, then it means
13784 that we perform a call on this.
13786 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13788 * expression.cs (Unary::Emit): Remove some dead code.
13789 (Probe): Implement Resolve and Emit for `is'.
13790 (Expression::ConvertImplicitRequired): Attempt to do constant
13791 expression conversions here. Maybe should be moved to
13792 ConvertImplicit, but I am not sure.
13793 (Expression::ImplicitLongConstantConversionPossible,
13794 Expression::ImplicitIntConstantConversionPossible): New functions
13795 that tell whether is it possible to apply an implicit constant
13796 expression conversion.
13798 (ConvertNumericExplicit): Started work on explicit numeric
13801 * cs-parser.jay: Update operator constants.
13803 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13804 (Parameters::GetSignature): Hook up VerifyArgs here.
13805 (Parameters::VerifyArgs): Verifies that no two arguments have the
13808 * class.cs (Operator): Update the operator names to reflect the
13809 ones that the spec expects (as we are just stringizing the
13812 * expression.cs (Unary::ResolveOperator): Fix bug: Use
13813 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13814 previous usage did only work for our methods.
13815 (Expression::ConvertImplicit): Handle decimal implicit numeric
13816 conversions as well.
13817 (Expression::InternalTypeConstructor): Used to invoke constructors
13818 on internal types for default promotions.
13820 (Unary::Emit): Implement special handling for the pre/post
13821 increment/decrement for overloaded operators, as they need to have
13822 the same semantics as the other operators.
13824 (Binary::ResolveOperator): ditto.
13825 (Invocation::ConversionExists): ditto.
13826 (UserImplicitCast::Resolve): ditto.
13828 2001-09-26 Ravi Pratap <ravi@ximian.com>
13830 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13831 operator, return after emitting body. Regression tests pass again !
13833 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13834 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13835 (Invocation::OverloadResolve): Ditto.
13836 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13838 * everywhere : update calls to the above methods accordingly.
13840 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13842 * assign.cs (Assign): Make it inherit from ExpressionStatement.
13844 * expression.cs (ExpressionStatement): New base class used for
13845 expressions that can appear in statements, so that we can provide
13846 an alternate path to generate expression that do not leave a value
13849 (Expression::Emit, and all the derivatives): We no longer return
13850 whether a value is left on the stack or not. Every expression
13851 after being emitted leaves a single value on the stack.
13853 * codegen.cs (EmitContext::EmitStatementExpression): Use the
13854 facilties of ExpressionStatement if possible.
13856 * cs-parser.jay: Update statement_expression.
13858 2001-09-25 Miguel de Icaza <miguel@ximian.com>
13860 * driver.cs: Change the wording of message
13862 2001-09-25 Ravi Pratap <ravi@ximian.com>
13864 * expression.cs (Binary::ResolveOperator): Had forgottten to set
13865 the type of the expression to the return type of the method if
13866 we have an overloaded operator match ! The regression tests pass again !
13867 (Unary::ResolveOperator): Ditto.
13869 * expression.cs (Invocation::ConversionExists): Correct the member lookup
13870 to find "op_Implicit", not "implicit" ;-)
13871 (UserImplicitCast): New class to take care of user-defined implicit conversions.
13872 (ConvertImplicit, ForceConversion): Take TypeContainer argument
13874 * everywhere : Correct calls to the above accordingly.
13876 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13877 (ConvertImplicit): Do user-defined conversion if it exists.
13879 2001-09-24 Miguel de Icaza <miguel@ximian.com>
13881 * assign.cs: track location.
13882 (Resolve): Use implicit conversions on assignment.
13884 * literal.cs: Oops. Not good, Emit of short access values should
13885 pass (Bytes) or the wrong argument will be selected.
13887 * expression.cs (Unary::Emit): Emit code for -expr.
13889 (Unary::ResolveOperator): Handle `Substract' for non-constants
13890 (substract from zero from the non-constants).
13891 Deal with Doubles as well.
13893 (Expression::ConvertImplicitRequired): New routine that reports an
13894 error if no implicit conversion exists.
13896 (Invocation::OverloadResolve): Store the converted implicit
13897 expressions if we make them
13899 2001-09-24 Ravi Pratap <ravi@ximian.com>
13901 * class.cs (ConstructorInitializer): Take a Location argument.
13902 (ConstructorBaseInitializer): Same here.
13903 (ConstructorThisInitializer): Same here.
13905 * cs-parser.jay : Update all calls accordingly.
13907 * expression.cs (Unary, Binary, New): Take location argument.
13908 Update accordingly everywhere.
13910 * cs-parser.jay : Update all calls to the above to take a location
13913 * class.cs : Ditto.
13915 2001-09-24 Ravi Pratap <ravi@ximian.com>
13917 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13918 (Invocation::BetterConversion): Same here
13919 (Invocation::ConversionExists): Ditto.
13921 (Invocation::ConversionExists): Implement.
13923 2001-09-22 Ravi Pratap <ravi@ximian.com>
13925 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13926 Also take an additional TypeContainer argument.
13928 * All over : Pass in TypeContainer as argument to OverloadResolve.
13930 * typemanager.cs (CSharpName): Update to check for the string type and return
13933 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13936 2001-09-21 Ravi Pratap <ravi@ximian.com>
13938 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13939 (Invocation::BetterFunction): Implement.
13940 (Invocation::BetterConversion): Implement.
13941 (Invocation::ConversionExists): Skeleton, no implementation yet.
13943 Okay, things work fine !
13945 2001-09-21 Miguel de Icaza <miguel@ximian.com>
13947 * typemanager.cs: declare and load enum_type, delegate_type and
13950 * expression.cs (Expression::Emit): Now emit returns a value that
13951 tells whether a value is left on the stack or not. This strategy
13952 might be reveted tomorrow with a mechanism that would address
13953 multiple assignments.
13954 (Expression::report118): Utility routine to report mismatches on
13957 (Unary::Report23): Report impossible type/operator combination
13960 (Unary::IsIncrementableNumber): Whether the type can be
13961 incremented or decremented with add.
13962 (Unary::ResolveOperator): Also allow enumerations to be bitwise
13964 (Unary::ResolveOperator): Implement ++, !, ~,
13966 (Invocation::Emit): Deal with new Emit convetion.
13968 * All Expression derivatives: Updated their Emit method to return
13969 whether they leave values on the stack or not.
13971 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13972 stack for expressions that are statements.
13974 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13976 * expression.cs (LValue): New interface. Must be implemented by
13978 (LocalVariableReference, ParameterReference, FieldExpr): Implement
13981 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13982 interface for generating code, simplifies the code.
13984 2001-09-20 Ravi Pratap <ravi@ximian.com>
13986 * expression.cs (everywhere): Comment out return statements in ::Resolve
13987 methods to avoid the warnings.
13989 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13991 * driver.cs (parse): Report error 2001 if we can not open the
13994 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13997 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
14000 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
14001 otherwise nested blocks end up with the same index.
14003 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
14005 * expression.cs: Instead of having FIXMEs in the Resolve
14006 functions, throw exceptions so it is obvious that we are facing a
14009 * cs-parser.jay (invocation_expression): Pass Location information.
14011 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
14012 Use a basename for those routines because .NET does not like paths
14015 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
14018 2001-09-19 Miguel de Icaza <miguel@ximian.com>
14020 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
14021 are loading the correct data types (throws an exception if not).
14022 (TypeManager::InitCoreTypes): Use CoreLookupType
14024 * expression.cs (Unary::ResolveOperator): return the child
14025 expression for expressions which are just +expr.
14026 (Unary::ResolveOperator): Return negative literals for -LITERAL
14027 expressions (otherwise they are Unary {Literal}).
14028 (Invocation::Badness): Take into account `Implicit constant
14029 expression conversions'.
14031 * literal.cs (LongLiteral): Implement long literal class.
14032 (IntLiteral): export the `Value' of the intliteral.
14034 2001-09-19 Ravi Pratap <ravi@ximian.com>
14036 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
14038 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
14039 instead of 'Operator'
14041 * expression.cs (Binary::ResolveOperator): Update accordingly.
14042 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
14045 * cs-parser.jay (unary_expression): Update to use the new names.
14047 * gen-treedump.cs (GetUnary): Same here.
14049 * expression.cs (Unary::Resolve): Implement.
14050 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
14051 operators are found instead of making noise ;-)
14052 (Unary::ResolveOperator): New method to do precisely the same thing which
14053 Binary::ResolveOperator does for Binary expressions.
14054 (Unary.method, .Arguments): Add.
14055 (Unary::OperName): Implement.
14056 (Unary::ForceConversion): Copy and Paste !
14058 * class.cs (Operator::Define): Fix a small bug for the case when we have
14061 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
14062 for the inbuilt operators. Only overloading works for now ;-)
14064 2001-09-18 Miguel de Icaza <miguel@ximian.com>
14066 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
14067 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
14069 * expression.cs (This::Emit): Implement.
14070 (This::Resolve): Implement.
14071 (TypeOf:Resolve): Implement.
14072 (Expression::ResolveSimpleName): Add an implicit this to instance
14074 (MemberAccess::Resolve): Deal with Parameters and Fields.
14075 Bind instance variable to Field expressions.
14076 (FieldExpr::Instance): New field used to track the expression that
14077 represents the object instance.
14078 (FieldExpr::Resolve): Track potential errors from MemberLookup not
14080 (FieldExpr::Emit): Implement.
14082 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
14083 the last instruction contains a return opcode to avoid generating
14084 the last `ret' instruction (this generates correct code, and it is
14085 nice to pass the peverify output).
14087 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
14088 initializer for static and instance variables.
14089 (Constructor::Emit): Allow initializer to be null in the case of
14090 static constructors. Only emit initializer for instance
14093 (TypeContainer::FindMembers): Return a null array if there are no
14096 Also fix the code for the MemberTypes.Method branch, as it was not
14097 scanning that for operators (or tried to access null variables before).
14099 * assign.cs (Assign::Emit): Handle instance and static fields.
14103 * driver.cs: Stop compilation if there are parse errors.
14105 * cs-parser.jay (constructor_declaration): Provide default base
14106 initializer for non-static constructors.
14107 (constructor_declarator): Do not provide a default base
14108 initializers if none was specified.
14109 Catch the fact that constructors should not have parameters.
14111 * class.cs: Do not emit parent class initializers for static
14112 constructors, that should be flagged as an error.
14114 2001-09-18 Ravi Pratap <ravi@ximian.com>
14116 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
14117 Move back code into TypeContainer::Populate.
14119 2001-09-18 Ravi Pratap <ravi@ximian.com>
14121 * class.cs (TypeContainer::AddConstructor): Fix the check to
14122 compare against Name, not Basename.
14123 (Operator::OpType): Change Plus and Minus to Add and Subtract.
14125 * cs-parser.jay : Update accordingly.
14127 * class.cs (TypeContainer::FindMembers): For the case where we are searching
14128 for methods, don't forget to look into the operators too.
14129 (RegisterMethodBuilder): Helper method to take care of this for
14130 methods, constructors and operators.
14131 (Operator::Define): Completely revamp.
14132 (Operator.OperatorMethod, MethodName): New fields.
14133 (TypeContainer::Populate): Move the registering of builders into
14134 RegisterMethodBuilder.
14135 (Operator::Emit): Re-write.
14137 * expression.cs (Binary::Emit): Comment out code path to emit method
14138 invocation stuff for the case when we have a user defined operator. I am
14139 just not able to get it right !
14141 2001-09-17 Miguel de Icaza <miguel@ximian.com>
14143 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
14146 (Expression::MemberLookup): Provide a version that allows to
14147 specify the MemberTypes and BindingFlags.
14149 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
14150 so it was not fetching variable information from outer blocks.
14152 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
14153 Beforefieldinit as it was buggy.
14155 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
14156 that Ravi put here.
14158 * class.cs (Constructor::Emit): Only emit if block is not null.
14159 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
14160 deal with this by semantically definining it as if the user had
14163 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
14164 constructors as we now "emit" them at a higher level.
14166 (TypeContainer::DefineDefaultConstructor): Used to define the
14167 default constructors if none was provided.
14169 (ConstructorInitializer): Add methods Resolve and Emit.
14171 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
14173 2001-09-17 Ravi Pratap <ravi@ximian.com>
14175 * class.cs (TypeContainer::EmitDefaultConstructor): Register
14176 the default constructor builder with our hashtable for methodbuilders
14179 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
14180 and argument_count is 0 in which case we have a match.
14181 (Binary::ResolveOperator): More null checking and miscellaneous coding
14184 2001-09-17 Ravi Pratap <ravi@ximian.com>
14186 * rootcontext.cs (IsNameSpace): Compare against null.
14188 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
14190 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
14191 and Unary::Operator.
14193 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
14196 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
14197 we have overloaded operators.
14198 (Binary::ResolveOperator): Implement the part which does the operator overload
14201 * class.cs (Operator::Emit): Implement.
14202 (TypeContainer::Emit): Emit the operators we have too.
14204 * expression.cs (Binary::Emit): Update to emit the appropriate code for
14205 the case when we have a user-defined operator.
14207 2001-09-17 Miguel de Icaza <miguel@ximian.com>
14209 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
14211 2001-09-16 Ravi Pratap <ravi@ximian.com>
14213 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
14214 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
14215 (Constructor::Emit): Implement.
14216 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
14217 if we have no work to do.
14218 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
14221 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
14222 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
14224 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
14227 2001-09-15 Ravi Pratap <ravi@ximian.com>
14229 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
14231 (Tree::RecordNamespace): Method to do what the name says ;-)
14232 (Tree::Namespaces): Property to get at the namespaces hashtable.
14234 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
14237 * rootcontext.cs (IsNamespace): Fixed it :-)
14239 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14241 * class.cs (TypeContainer::FindMembers): Add support for
14243 (MethodCore): New class that encapsulates both the shared aspects
14244 of a Constructor and a Method.
14245 (Method, Constructor): Factored pieces into MethodCore.
14247 * driver.cs: Added --fatal which makes errors throw exceptions.
14248 Load System assembly as well as part of the standard library.
14250 * report.cs: Allow throwing exceptions on errors for debugging.
14252 * modifiers.cs: Do not use `parent', instead use the real type
14253 container to evaluate permission settings.
14255 * class.cs: Put Ravi's patch back in. He is right, and we will
14256 have to cope with the
14258 2001-09-14 Ravi Pratap <ravi@ximian.com>
14260 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
14261 FamORAssem, not FamANDAssem.
14263 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14265 * driver.cs: Added --parse option that only parses its input files
14268 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
14269 incorrect. IsTopLevel is not used to tell whether an object is
14270 root_types or not (that can be achieved by testing this ==
14271 root_types). But to see if this is a top-level *class* (not
14272 necessarly our "toplevel" container).
14274 2001-09-14 Ravi Pratap <ravi@ximian.com>
14276 * enum.cs (Enum::Define): Modify to call the Lookup method on the
14277 parent instead of a direct call to GetType.
14279 2001-09-14 Ravi Pratap <ravi@ximian.com>
14281 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
14282 Modifiers.TypeAttr. This should just be a call to that method.
14284 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
14285 object so that we can determine if we are top-level or not.
14287 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
14290 * enum.cs (Enum::Define): Ditto.
14292 * modifiers.cs (FieldAttr): Re-write.
14294 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
14295 (TypeContainer::HaveStaticConstructor): New property to provide access
14296 to precisely that info.
14298 * modifiers.cs (MethodAttr): Re-write.
14299 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
14301 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
14302 of top-level types as claimed.
14304 2001-09-13 Miguel de Icaza <miguel@ximian.com>
14306 * expression.cs (MemberLookup): Fruitless attempt to lookup
14307 constructors. Maybe I need to emit default constructors? That
14308 might be it (currently .NET emits this for me automatically).
14309 (Invocation::OverloadResolve): Cope with Arguments == null.
14310 (Invocation::EmitArguments): new function, shared by the new
14311 constructor and us.
14312 (Invocation::Emit): Handle static and instance methods. Emit
14313 proper call instruction for virtual or non-virtual invocations.
14314 (New::Emit): Implement.
14315 (New::Resolve): Implement.
14316 (MemberAccess:Resolve): Implement.
14317 (MethodGroupExpr::InstanceExpression): used conforming to the spec
14318 to track instances.
14319 (FieldExpr::Resolve): Set type.
14321 * support.cs: Handle empty arguments.
14323 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
14324 SimpleLookup): Auxiliary routines to help parse a qualifier
14327 Update qualifier_identifier rule.
14329 * codegen.cs: Removed debugging messages.
14331 * class.cs: Make this a global thing, this acts just as a "key" to
14332 objects that we might have around.
14334 (Populate): Only initialize method_builders_to_methods once.
14336 * expression.cs (PropertyExpr): Initialize type from the
14339 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
14340 Resolve pattern. Attempt to implicitly convert value to boolean.
14343 * expression.cs: Set the type for the int32/int32 argument case.
14344 (Binary::ResolveOperator): Set the return type to boolean for
14345 comparission operators
14347 * typemanager.cs: Remove debugging print code.
14349 (Invocation::Resolve): resolve type.
14351 * class.cs: Allocate a MemberInfo of the correct size, as the code
14352 elsewhere depends on the test to reflect the correct contents.
14354 (Method::) Keep track of parameters, due to System.Reflection holes
14356 (TypeContainer::Populate): Keep track of MethodBuilders to Method
14359 (TypeContainer::FindMembers): Use ArrayList and then copy an array
14360 of the exact size and return that.
14362 (Class::LookupMethodByBuilder): New function that maps
14363 MethodBuilders to its methods. Required to locate the information
14364 on methods because System.Reflection bit us again.
14366 * support.cs: New file, contains an interface ParameterData and
14367 two implementations: ReflectionParameters and InternalParameters
14368 used to access Parameter information. We will need to grow this
14371 * expression.cs (Invocation::GetParameterData): implement a cache
14372 and a wrapper around the ParameterData creation for methods.
14373 (Invocation::OverloadResolve): Use new code.
14375 2001-09-13 Ravi Pratap <ravi@ximian.com>
14377 * class.cs (TypeContainer::EmitField): Remove and move into
14378 (Field::Define): here and modify accordingly.
14379 (Field.FieldBuilder): New member.
14380 (TypeContainer::Populate): Update accordingly.
14381 (TypeContainer::FindMembers): Implement.
14383 2001-09-13 Miguel de Icaza <miguel@ximian.com>
14385 * statement.cs: (VariableInfo::VariableType): New field to be
14386 initialized with the full type once it is resolved.
14388 2001-09-12 Miguel de Icaza <miguel@ximian.com>
14390 * parameter.cs (GetParameterInfo): Use a type cache to compute
14391 things only once, and to reuse this information
14393 * expression.cs (LocalVariableReference::Emit): Implement.
14394 (OpcodeCast::Emit): fix.
14396 (ParameterReference::Resolve): Implement.
14397 (ParameterReference::Emit): Implement.
14399 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
14400 that are expressions need to stay as Expressions.
14402 * typemanager.cs (CSharpName): Returns the C# name of a type if
14405 * expression.cs (Expression::ConvertImplicit): New function that
14406 implements implicit type conversions.
14408 (Expression::ImplicitReferenceConversion): Implements implicit
14409 reference conversions.
14411 (EmptyCast): New type for transparent casts.
14413 (OpcodeCast): New type for casts of types that are performed with
14414 a sequence of bytecodes.
14416 (BoxedCast): New type used for casting value types into reference
14417 types. Emits a box opcode.
14419 (Binary::DoNumericPromotions): Implements numeric promotions of
14420 and computation of the Binary::Type.
14422 (Binary::EmitBranchable): Optimization.
14424 (Binary::Emit): Implement code emission for expressions.
14426 * typemanager.cs (TypeManager): Added two new core types: sbyte
14429 2001-09-12 Ravi Pratap <ravi@ximian.com>
14431 * class.cs (TypeContainer::FindMembers): Method which does exactly
14432 what Type.FindMembers does, only we don't have to use reflection. No
14433 implementation yet.
14435 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
14436 typecontainer objects as we need to get at them.
14437 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
14439 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
14440 typecontainer object.
14442 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
14443 of just a Report object.
14445 2001-09-11 Ravi Pratap <ravi@ximian.com>
14447 * class.cs (Event::Define): Go back to using the prefixes "add_" and
14449 (TypeContainer::Populate): Now define the delegates of the type too.
14450 (TypeContainer.Delegates): Property to access the list of delegates defined
14453 * delegates.cs (Delegate::Define): Implement partially.
14455 * modifiers.cs (TypeAttr): Handle more flags.
14457 2001-09-11 Ravi Pratap <ravi@ximian.com>
14459 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
14461 (Operator::Define): Re-write logic to get types by using the LookupType method
14462 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
14463 (Indexer::Define): Ditto.
14464 (Event::Define): Ditto.
14465 (Property::Define): Ditto.
14467 2001-09-10 Ravi Pratap <ravi@ximian.com>
14469 * class.cs (TypeContainer::Populate): Now define operators too.
14470 (TypeContainer.Operators): New property to access the list of operators
14472 (Operator.OperatorMethodBuilder): New member to hold the method builder
14473 for the operator we are defining.
14474 (Operator::Define): Implement.
14476 2001-09-10 Ravi Pratap <ravi@ximian.com>
14478 * class.cs (Event::Define): Make the prefixes of the accessor methods
14479 addOn_ and removeOn_
14481 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
14482 of the location being passed in too. Ideally, this should go later since all
14483 error reporting should be done through the Report object.
14485 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
14486 (Populate): Iterate thru the indexers we have and define them too.
14487 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
14488 for the get and set accessors.
14489 (Indexer::Define): Implement.
14491 2001-09-09 Miguel de Icaza <miguel@ximian.com>
14493 * expression.cs (Binary::Resolve): Beginning of it. I scratched
14494 my previous implementation, did not work.
14496 * typemanager.cs: Add a couple of missing types (the longs).
14498 * literal.cs: Use TypeManager.bool_type instead of getting it.
14500 * expression.cs (EventExpr): New kind of expressions.
14501 (Expressio::ExprClassFromMemberInfo): finish
14503 2001-09-08 Miguel de Icaza <miguel@ximian.com>
14505 * assign.cs: Emit stores to static fields differently.
14507 2001-09-08 Ravi Pratap <ravi@ximian.com>
14509 * Merge in changes and adjust code to tackle conflicts. Backed out my
14510 code in Assign::Resolve ;-)
14512 2001-09-08 Ravi Pratap <ravi@ximian.com>
14514 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
14515 instead Report.Error and also pass in the location.
14516 (CSharpParser::Lexer): New readonly property to return the reference
14517 to the Tokenizer object.
14518 (declare_local_variables): Use Report.Error with location instead of plain
14522 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
14523 (Operator.CheckBinaryOperator): Ditto.
14525 * cs-parser.jay (operator_declarator): Update accordingly.
14527 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
14528 (CheckBinaryOperator): Same here.
14530 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
14531 on the name without any prefixes of namespace names etc. This is because we
14532 already might have something already fully qualified like
14533 'System.Console.WriteLine'
14535 * assign.cs (Resolve): Begin implementation. Stuck ;-)
14537 2001-09-07 Ravi Pratap <ravi@ximian.com>
14539 * cs-tokenizer.cs (location): Return a string which also contains
14542 * expression.cs (ElementAccess): New class for expressions of the
14543 type 'element access.'
14544 (BaseAccess): New class for expressions of the type 'base access.'
14545 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
14548 * cs-parser.jay (element_access): Implement action.
14549 (base_access): Implement actions.
14550 (checked_expression, unchecked_expression): Implement.
14552 * cs-parser.jay (local_variable_type): Correct and implement.
14553 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
14555 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
14557 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
14558 name and the specifiers.
14560 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
14562 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
14563 making them all public ;-)
14565 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
14568 2001-09-07 Miguel de Icaza <miguel@ximian.com>
14570 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
14572 (FieldExpr, PropertyExprs): New resolved expressions.
14573 (SimpleName::MemberStaticCheck): Perform static checks for access
14574 to non-static fields on static methods. Maybe this should be
14575 generalized for MemberAccesses.
14576 (SimpleName::ResolveSimpleName): More work on simple name
14579 * cs-parser.jay (primary_expression/qualified_identifier): track
14580 the parameter index.
14582 * codegen.cs (CodeGen::Save): Catch save exception, report error.
14583 (EmitContext::EmitBoolExpression): Chain to expression generation
14584 instead of temporary hack.
14585 (::EmitStatementExpression): Put generic expression code generation.
14587 * assign.cs (Assign::Emit): Implement variable assignments to
14588 local variables, parameters and fields.
14590 2001-09-06 Miguel de Icaza <miguel@ximian.com>
14592 * statement.cs (Block::GetVariableInfo): New method, returns the
14593 VariableInfo for a variable name in a block.
14594 (Block::GetVariableType): Implement in terms of GetVariableInfo
14596 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
14597 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
14599 2001-09-06 Ravi Pratap <ravi@ximian.com>
14601 * cs-parser.jay (operator_declaration): Continue on my quest : update
14602 to take attributes argument.
14603 (event_declaration): Ditto.
14604 (enum_declaration): Ditto.
14605 (indexer_declaration): Ditto.
14607 * class.cs (Operator::Operator): Update constructor accordingly.
14608 (Event::Event): Ditto.
14610 * delegate.cs (Delegate::Delegate): Same here.
14612 * enum.cs (Enum::Enum): Same here.
14614 2001-09-05 Ravi Pratap <ravi@ximian.com>
14616 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
14618 * ../tests/cs0658.cs : New file to demonstrate error 0658.
14620 * attribute.cs (Attributes): New class to encapsulate all attributes which were
14621 being passed around as an arraylist.
14622 (Attributes::AddAttribute): Method to add attribute sections.
14624 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
14625 (struct_declaration): Update accordingly.
14626 (constant_declaration): Update.
14627 (field_declaration): Update.
14628 (method_header): Update.
14629 (fixed_parameter): Update.
14630 (parameter_array): Ditto.
14631 (property_declaration): Ditto.
14632 (destructor_declaration): Ditto.
14634 * class.cs (Struct::Struct): Update constructors accordingly.
14635 (Class::Class): Ditto.
14636 (Field::Field): Ditto.
14637 (Method::Method): Ditto.
14638 (Property::Property): Ditto.
14639 (TypeContainer::OptAttribute): update property's return type.
14641 * interface.cs (Interface.opt_attributes): New member.
14642 (Interface::Interface): Update to take the extra Attributes argument.
14644 * parameter.cs (Parameter::Parameter): Ditto.
14646 * constant.cs (Constant::Constant): Ditto.
14648 * interface.cs (InterfaceMemberBase): New OptAttributes field.
14649 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
14650 the attributes as a parameter.
14651 (InterfaceProperty): Update constructor call.
14652 (InterfaceEvent): Ditto.
14653 (InterfaceMethod): Ditto.
14654 (InterfaceIndexer): Ditto.
14656 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
14657 pass the attributes too.
14658 (interface_event_declaration): Ditto.
14659 (interface_property_declaration): Ditto.
14660 (interface_method_declaration): Ditto.
14661 (interface_declaration): Ditto.
14663 2001-09-05 Miguel de Icaza <miguel@ximian.com>
14665 * class.cs (Method::Define): Track the "static Main" definition to
14666 create an entry point.
14668 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
14669 EntryPoint if we find it.
14671 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
14672 (EmitContext::ig): Make this variable public.
14674 * driver.cs: Make the default output file be the first file name
14675 with the .exe extension.
14677 Detect empty compilations
14679 Handle various kinds of output targets. Handle --target and
14680 rename -t to --dumper.
14682 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
14683 methods inherited from Expression return now an Expression. This
14684 will is used during the tree rewriting as we resolve them during
14687 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14688 the spec. Missing entirely is the information about
14689 accessability of elements of it.
14691 (Expression::ExprClassFromMemberInfo): New constructor for
14692 Expressions that creates a fully initialized Expression based on
14693 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14696 (Invocation::Resolve): Begin implementing resolution of invocations.
14698 * literal.cs (StringLiteral): Implement Emit.
14700 2001-09-05 Ravi Pratap <ravi@ximian.com>
14702 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14705 2001-09-04 Ravi Pratap <ravi@ximian.com>
14707 * cs-parser.jay (attribute_arguments): Implement actions.
14708 (attribute): Fix bug in production. Implement action.
14709 (attribute_list): Implement.
14710 (attribute_target): Implement.
14711 (attribute_target_specifier, opt_target_specifier): Implement
14712 (CheckAttributeTarget): New method to check if the attribute target
14714 (attribute_section): Implement.
14715 (opt_attributes): Implement.
14717 * attribute.cs : New file to handle attributes.
14718 (Attribute): Class to hold attribute info.
14720 * cs-parser.jay (opt_attribute_target_specifier): Remove production
14721 (attribute_section): Modify production to use 2 different rules to
14722 achieve the same thing. 1 s/r conflict down !
14723 Clean out commented, useless, non-reducing dimension_separator rules.
14725 * class.cs (TypeContainer.attributes): New member to hold list
14726 of attributes for a type.
14727 (Struct::Struct): Modify to take one more argument, the attribute list.
14728 (Class::Class): Ditto.
14729 (Field::Field): Ditto.
14730 (Method::Method): Ditto.
14731 (Property::Property): Ditto.
14733 * cs-parser.jay (struct_declaration): Update constructor call to
14734 pass in the attributes too.
14735 (class_declaration): Ditto.
14736 (constant_declaration): Ditto.
14737 (field_declaration): Ditto.
14738 (method_header): Ditto.
14739 (fixed_parameter): Ditto.
14740 (parameter_array): Ditto.
14741 (property_declaration): Ditto.
14743 * constant.cs (Constant::Constant): Update constructor similarly.
14744 Use System.Collections.
14746 * parameter.cs (Parameter::Parameter): Update as above.
14748 2001-09-02 Ravi Pratap <ravi@ximian.com>
14750 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14751 (TypeContainer.delegates): New member to hold list of delegates.
14753 * cs-parser.jay (delegate_declaration): Implement the action correctly
14754 this time as I seem to be on crack ;-)
14756 2001-09-02 Miguel de Icaza <miguel@ximian.com>
14758 * rootcontext.cs (RootContext::IsNamespace): new function, used to
14759 tell whether an identifier represents a namespace.
14761 * expression.cs (NamespaceExpr): A namespace expression, used only
14762 temporarly during expression resolution.
14763 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14764 utility functions to resolve names on expressions.
14766 2001-09-01 Miguel de Icaza <miguel@ximian.com>
14768 * codegen.cs: Add hook for StatementExpressions.
14770 * class.cs: Fix inverted test for static flag in methods.
14772 2001-09-02 Ravi Pratap <ravi@ximian.com>
14774 * class.cs (Operator::CheckUnaryOperator): Correct error number used
14775 to make it coincide with MS' number.
14776 (Operator::CheckBinaryOperator): Ditto.
14778 * ../errors/errors.txt : Remove error numbers added earlier.
14780 * ../errors/cs1019.cs : Test case for error # 1019
14782 * ../errros/cs1020.cs : Test case for error # 1020
14784 * cs-parser.jay : Clean out commented cruft.
14785 (dimension_separators, dimension_separator): Comment out. Ostensibly not
14786 used anywhere - non-reducing rule.
14787 (namespace_declarations): Non-reducing rule - comment out.
14789 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14790 with TypeContainer::AddEnum.
14792 * delegate.cs : New file for delegate handling classes.
14793 (Delegate): Class for declaring delegates.
14795 * makefile : Update.
14797 * cs-parser.jay (delegate_declaration): Implement.
14799 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
14801 * class.cs (Event::Define): Implement.
14802 (Event.EventBuilder): New member.
14804 * class.cs (TypeContainer::Populate): Update to define all enums and events
14806 (Events): New property for the events arraylist we hold. Shouldn't we move to using
14807 readonly fields for all these cases ?
14809 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14811 * class.cs (Property): Revamp to use the convention of making fields readonly.
14812 Accordingly modify code elsewhere.
14814 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14815 the Define method of the Property class.
14817 * class.cs : Clean up applied patch and update references to variables etc. Fix
14819 (TypeContainer::Populate): Update to define all the properties we have. Also
14820 define all enumerations.
14822 * enum.cs (Define): Implement.
14824 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14826 * cs-parser.jay (overloadable_operator): The semantic value is an
14827 enum of the Operator class.
14828 (operator_declarator): Implement actions.
14829 (operator_declaration): Implement.
14831 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14832 validity of definitions.
14833 (Operator::CheckBinaryOperator): Static method to check for binary operators
14834 (TypeContainer::AddOperator): New method to add an operator to a type.
14836 * cs-parser.jay (indexer_declaration): Added line to actually call the
14837 AddIndexer method so it gets added ;-)
14839 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
14840 already taken care of by the MS compiler ?
14842 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14844 * class.cs (Operator): New class for operator declarations.
14845 (Operator::OpType): Enum for the various operators.
14847 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14849 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14850 ostensibly handle this in semantic analysis.
14852 * cs-parser.jay (general_catch_clause): Comment out
14853 (specific_catch_clauses, specific_catch_clause): Ditto.
14854 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14855 (catch_args, opt_catch_args): New productions.
14856 (catch_clause): Rewrite to use the new productions above
14857 (catch_clauses): Modify accordingly.
14858 (opt_catch_clauses): New production to use in try_statement
14859 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14860 and re-write the code in the actions to extract the specific and
14861 general catch clauses by being a little smart ;-)
14863 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14864 Hooray, try and catch statements parse fine !
14866 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14868 * statement.cs (Block::GetVariableType): Fix logic to extract the type
14869 string from the hashtable of variables.
14871 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14872 I end up making that mistake ;-)
14873 (catch_clauses): Fixed gross error which made Key and Value of the
14874 DictionaryEntry the same : $1 !!
14876 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14878 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14880 * cs-parser.jay (event_declaration): Correct to remove the semicolon
14881 when the add and remove accessors are specified.
14883 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14885 * cs-parser.jay (IndexerDeclaration): New helper class to hold
14886 information about indexer_declarator.
14887 (indexer_declarator): Implement actions.
14888 (parsing_indexer): New local boolean used to keep track of whether
14889 we are parsing indexers or properties. This is necessary because
14890 implicit_parameters come into picture even for the get accessor in the
14891 case of an indexer.
14892 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14894 * class.cs (Indexer): New class for indexer declarations.
14895 (TypeContainer::AddIndexer): New method to add an indexer to a type.
14896 (TypeContainer::indexers): New member to hold list of indexers for the
14899 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14901 * cs-parser.jay (add_accessor_declaration): Implement action.
14902 (remove_accessor_declaration): Implement action.
14903 (event_accessors_declaration): Implement
14904 (variable_declarators): swap statements for first rule - trivial.
14906 * class.cs (Event): New class to hold information about event
14908 (TypeContainer::AddEvent): New method to add an event to a type
14909 (TypeContainer::events): New member to hold list of events.
14911 * cs-parser.jay (event_declaration): Implement actions.
14913 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14915 * cs-parser.jay (dim_separators): Implement. Make it a string
14916 concatenating all the commas together, just as they appear.
14917 (opt_dim_separators): Modify accordingly
14918 (rank_specifiers): Update accordingly. Basically do the same
14919 thing - instead, collect the brackets here.
14920 (opt_rank_sepcifiers): Modify accordingly.
14921 (array_type): Modify to actually return the complete type string
14922 instead of ignoring the rank_specifiers.
14923 (expression_list): Implement to collect the expressions
14924 (variable_initializer): Implement. We make it a list of expressions
14925 essentially so that we can handle the array_initializer case neatly too.
14926 (variable_initializer_list): Implement.
14927 (array_initializer): Make it a list of variable_initializers
14928 (opt_array_initializer): Modify accordingly.
14930 * expression.cs (New::NType): Add enumeration to help us
14931 keep track of whether we have an object/delegate creation
14932 or an array creation.
14933 (New:NewType, New::Rank, New::Indices, New::Initializers): New
14934 members to hold data about array creation.
14935 (New:New): Modify to update NewType
14936 (New:New): New Overloaded contructor for the array creation
14939 * cs-parser.jay (array_creation_expression): Implement to call
14940 the overloaded New constructor.
14942 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
14944 * class.cs (TypeContainer::Constructors): Return member
14945 constructors instead of returning null.
14947 2001-08-26 Miguel de Icaza <miguel@ximian.com>
14949 * typemanager.cs (InitCoreTypes): Initialize the various core
14950 types after we have populated the type manager with the user
14951 defined types (this distinction will be important later while
14952 compiling corlib.dll)
14954 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14955 on Expression Classification. Now all expressions have a method
14956 `Resolve' and a method `Emit'.
14958 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14959 generation from working. Also add some temporary debugging
14962 2001-08-24 Miguel de Icaza <miguel@ximian.com>
14964 * codegen.cs: Lots of code generation pieces. This is only the
14965 beginning, will continue tomorrow with more touches of polish. We
14966 handle the fundamentals of if, while, do, for, return. Others are
14967 trickier and I need to start working on invocations soon.
14969 * gen-treedump.cs: Bug fix, use s.Increment here instead of
14972 * codegen.cs (EmitContext): New struct, used during code
14973 emission to keep a context. Most of the code generation will be
14976 * cs-parser.jay: Add embedded blocks to the list of statements of
14977 this block. So code generation proceeds in a top down fashion.
14979 2001-08-23 Miguel de Icaza <miguel@ximian.com>
14981 * statement.cs: Add support for multiple child blocks.
14983 2001-08-22 Miguel de Icaza <miguel@ximian.com>
14985 * codegen.cs (EmitCode): New function, will emit the code for a
14986 Block of code given a TypeContainer and its ILGenerator.
14988 * statement.cs (Block): Standard public readonly optimization.
14989 (Block::Block constructors): Link children.
14990 (Block::Child): Child Linker.
14991 (Block::EmitVariables): Emits IL variable declarations.
14993 * class.cs: Drop support for MethodGroups here, delay until
14995 (Method::): Applied the same simplification that I did before, and
14996 move from Properties to public readonly fields.
14997 (Method::ParameterTypes): Returns the parameter types for the
14998 function, and implements a cache that will be useful later when I
14999 do error checking and the semantic analysis on the methods is
15001 (Constructor::GetCallingConvention): Renamed from CallingConvetion
15002 and made a method, optional argument tells whether this is a class
15003 or a structure to apply the `has-this' bit.
15004 (Method::GetCallingConvention): Implement, returns the calling
15006 (Method::Define): Defines the type, a second pass is performed
15007 later to populate the methods.
15009 (Constructor::ParameterTypes): implement a cache similar to the
15010 one on Method::ParameterTypes, useful later when we do semantic
15013 (TypeContainer::EmitMethod): New method. Emits methods.
15015 * expression.cs: Removed MethodGroup class from here.
15017 * parameter.cs (Parameters::GetCallingConvention): new method.
15019 2001-08-21 Miguel de Icaza <miguel@ximian.com>
15021 * class.cs (TypeContainer::Populate): Drop RootContext from the
15024 (Constructor::CallingConvention): Returns the calling convention.
15025 (Constructor::ParameterTypes): Returns the constructor parameter
15028 (TypeContainer::AddConstructor): Keep track of default constructor
15029 and the default static constructor.
15031 (Constructor::) Another class that starts using `public readonly'
15032 instead of properties.
15034 (Constructor::IsDefault): Whether this is a default constructor.
15036 (Field::) use readonly public fields instead of properties also.
15038 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
15039 track of static constructors; If none is used, turn on
15040 BeforeFieldInit in the TypeAttributes.
15042 * cs-parser.jay (opt_argument_list): now the return can be null
15043 for the cases where there are no arguments.
15045 (constructor_declarator): If there is no implicit `base' or
15046 `this', then invoke the default parent constructor.
15048 * modifiers.cs (MethodAttr): New static function maps a set of
15049 modifiers flags into a MethodAttributes enum
15050 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
15051 MethodAttr, TypeAttr to represent the various mappings where the
15052 modifiers are used.
15053 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
15055 2001-08-19 Miguel de Icaza <miguel@ximian.com>
15057 * parameter.cs (GetParameterInfo): Fix bug where there would be no
15060 * interface.cs (PopulateIndexer): Implemented the code generator
15061 for interface indexers.
15063 2001-08-17 Miguel de Icaza <miguel@ximian.com>
15065 * interface.cs (InterfaceMemberBase): Now we track the new status
15068 (PopulateProperty): Implement property population. Woohoo! Got
15069 Methods and Properties going today.
15071 Removed all the properties for interfaces, and replaced them with
15072 `public readonly' fields.
15074 2001-08-16 Miguel de Icaza <miguel@ximian.com>
15076 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
15077 initialize their hashtables/arraylists only when they are needed
15078 instead of doing this always.
15080 * parameter.cs: Handle refs and out parameters.
15082 * cs-parser.jay: Use an ArrayList to construct the arguments
15083 instead of the ParameterCollection, and then cast that to a
15086 * parameter.cs: Drop the use of ParameterCollection and use
15087 instead arrays of Parameters.
15089 (GetParameterInfo): Use the Type, not the Name when resolving
15092 2001-08-13 Miguel de Icaza <miguel@ximian.com>
15094 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
15095 and instead use public readonly fields.
15097 * class.cs: Put back walking code for type containers.
15099 2001-08-11 Miguel de Icaza <miguel@ximian.com>
15101 * class.cs (MakeConstant): Code to define constants.
15103 * rootcontext.cs (LookupType): New function. Used to locate types
15106 2001-08-08 Miguel de Icaza <miguel@ximian.com>
15108 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
15109 this System.Reflection code is. Kudos to Microsoft
15111 * typemanager.cs: Implement a type cache and avoid loading all
15112 types at boot time. Wrap in LookupType the internals. This made
15113 the compiler so much faster. Wow. I rule!
15115 * driver.cs: Make sure we always load mscorlib first (for
15116 debugging purposes, nothing really important).
15118 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
15119 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
15121 * rootcontext.cs: Lookup types on their namespace; Lookup types
15122 on namespaces that have been imported using the `using' keyword.
15124 * class.cs (TypeContainer::TypeAttr): Virtualize.
15125 (Class::TypeAttr): Return attributes suitable for this bad boy.
15126 (Struct::TypeAttr): ditto.
15127 Handle nested classes.
15128 (TypeContainer::) Remove all the type visiting code, it is now
15129 replaced with the rootcontext.cs code
15131 * rootcontext.cs (GetClassBases): Added support for structs.
15133 2001-08-06 Miguel de Icaza <miguel@ximian.com>
15135 * interface.cs, statement.cs, class.cs, parameter.cs,
15136 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
15137 Drop use of TypeRefs, and use strings instead.
15139 2001-08-04 Miguel de Icaza <miguel@ximian.com>
15143 * class.cs (Struct::Struct): set the SEALED flags after
15144 checking the modifiers.
15145 (TypeContainer::TypeAttr): new property, returns the
15146 TypeAttributes for a class.
15148 * cs-parser.jay (type_list): Oops, list production was creating a
15149 new list of base types.
15151 * rootcontext.cs (StdLib): New property.
15152 (GetInterfaceTypeByName): returns an interface by type name, and
15153 encapsulates error handling here.
15154 (GetInterfaces): simplified.
15155 (ResolveTree): Encapsulated all the tree resolution here.
15156 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
15159 * driver.cs: Add support for --nostdlib, to avoid loading the
15160 default assemblies.
15161 (Main): Do not put tree resolution here.
15163 * rootcontext.cs: Beginning of the class resolution.
15165 2001-08-03 Miguel de Icaza <miguel@ximian.com>
15167 * rootcontext.cs: Provide better error reporting.
15169 * cs-parser.jay (interface_base): set our $$ to be interfaces.
15171 * rootcontext.cs (CreateInterface): Handle the case where there
15172 are no parent interfaces.
15174 (CloseTypes): Routine to flush types at the end.
15175 (CreateInterface): Track types.
15176 (GetInterfaces): Returns an array of Types from the list of
15177 defined interfaces.
15179 * typemanager.c (AddUserType): Mechanism to track user types (puts
15180 the type on the global type hash, and allows us to close it at the
15183 2001-08-02 Miguel de Icaza <miguel@ximian.com>
15185 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
15186 RecordInterface instead.
15188 * cs-parser.jay: Updated to reflect changes above.
15190 * decl.cs (Definition): Keep track of the TypeBuilder type that
15191 represents this type here. Not sure we will use it in the long
15192 run, but wont hurt for now.
15194 * driver.cs: Smaller changes to accomodate the new code.
15196 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
15199 * rootcontext.cs (CreateInterface): New method, used to create
15200 the System.TypeBuilder type for interfaces.
15201 (ResolveInterfaces): new entry point to resolve the interface
15203 (CodeGen): Property, used to keep track of the code generator.
15205 2001-07-26 Miguel de Icaza <miguel@ximian.com>
15207 * cs-parser.jay: Add a second production for delegate_declaration
15210 (enum_body): Put an opt_comma here instead of putting it on
15211 enum_body or enum_member_declarations so we can handle trailing
15212 commas on enumeration members. Gets rid of a shift/reduce.
15214 (type_list): Need a COMMA in the middle.
15216 (indexer_declaration): Tell tokenizer to recognize get/set
15218 * Remove old targets.
15220 * Re-add the parser target.
15222 2001-07-13 Simon Cozens <simon@simon-cozens.org>
15224 * cs-parser.jay: Add precendence rules for a number of operators
15225 ot reduce the number of shift/reduce conflicts in the grammar.
15227 2001-07-17 Miguel de Icaza <miguel@ximian.com>
15229 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
15232 Get rid of old crufty code.
15234 * rootcontext.cs: Use this to keep track of the parsed
15235 representation and the defined types available to the program.
15237 * gen-treedump.cs: adjust for new convention.
15239 * type.cs: Split out the type manager, and the assembly builder
15242 * typemanager.cs: the type manager will live here now.
15244 * cil-codegen.cs: And the code generator here.
15246 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
15248 * makefile: Fixed up for easy making.
15250 2001-07-13 Simon Cozens <simon@simon-cozens.org>
15252 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
15255 (unary_expression): Expand pre_increment_expression and
15256 post_decrement_expression to reduce a shift/reduce.
15258 2001-07-11 Simon Cozens
15260 * cs-tokenizer.cs: Hex numbers should begin with a 0.
15262 Improve allow_keyword_as_indent name.
15264 2001-06-19 Miguel de Icaza <miguel@ximian.com>
15266 * Adjustments for Beta2.
15268 2001-06-13 Miguel de Icaza <miguel@ximian.com>
15270 * decl.cs: Added `Define' abstract method.
15271 (InTransit): new property, used to catch recursive definitions.
15273 * interface.cs: Implement `Define'.
15275 * modifiers.cs: Map Modifiers.constants to
15276 System.Reflection.TypeAttribute flags.
15278 * class.cs: Keep track of types and user-defined types.
15279 (BuilderInit): New method for creating an assembly
15280 (ResolveType): New function to launch the resolution process, only
15281 used by interfaces for now.
15283 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
15284 that are inserted into the name space.
15286 2001-06-08 Miguel de Icaza <miguel@ximian.com>
15288 * ARGH. I have screwed up my tree so many times due to the use of
15289 rsync rather than using CVS. Going to fix this at once.
15291 * driver.cs: Objetify driver. Load assemblies, use assemblies to
15294 2001-06-07 Miguel de Icaza <miguel@ximian.com>
15296 * Experiment successful: Use System.Type rather that our own
15299 2001-05-25 Miguel de Icaza <miguel@ximian.com>
15301 * cs-parser.jay: Removed nsAliases from here.
15303 Use new namespaces, handle `using XXX;'
15305 * namespace.cs: Reimplemented namespace handling, use a recursive
15306 definition of the class. Now we can keep track of using clauses
15307 and catch invalid using clauses.
15309 2001-05-24 Miguel de Icaza <miguel@ximian.com>
15311 * gen-treedump.cs: Adapted for all the renaming.
15313 * expression.cs (Expression): this class now has a Type property
15314 which returns an expression Type.
15316 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
15317 `Type', as this has a different meaning now in the base
15319 2001-05-22 Miguel de Icaza <miguel@ximian.com>
15321 * interface.cs, class.cs: Removed from all the sources the
15322 references to signature computation, as we can not do method
15323 signature computation during the parsing time, as we are not
15324 trying to solve at that point distinguishing:
15328 void a (NS.Blah x) {}
15331 Which depending on the context might be valid or not, as we do not
15332 know if Blah is the same thing as NS.Blah at that point.
15334 * Redid everything so the code uses TypeRefs now instead of
15335 Types. TypeRefs are just temporary type placeholders, that need
15336 to be resolved. They initially have a pointer to a string and the
15337 current scope in which they are used. This is used later by the
15338 compiler to resolve the reference to an actual Type.
15340 * DeclSpace is no longer a CIR.Type, and neither are
15341 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
15342 are all DeclSpaces, but no Types.
15344 * type.cs (TypeRefManager): This implements the TypeRef manager,
15345 which keeps track of all the types that need to be resolved after
15346 the parsing has finished.
15348 2001-05-13 Miguel de Icaza <miguel@ximian.com>
15350 * ARGH. We are going to have to store `foreach' as a class rather
15351 than resolving it, as we need to verify error 1579 after name
15352 resolution. *OR* we could keep a flag that says `This request to
15353 IEnumerator comes from a foreach statement' which we can then use
15354 to generate the error.
15356 2001-05-10 Miguel de Icaza <miguel@ximian.com>
15358 * class.cs (TypeContainer.AddMethod): we now add methods to the
15359 MethodGroup instead of the method hashtable.
15361 * expression.cs: Add MethodGroup abstraction, which gets us one
15362 step closer to the specification in the way we handle method
15365 * cs-parser.jay (primary_expression): qualified_identifier now
15366 tried to match up an identifier to a local variable reference or
15367 to a parameter reference.
15369 current_local_parameters is now a parser global variable that
15370 points to the current parameters for the block, used during name
15373 (property_declaration): Now creates an implicit `value' argument to
15376 2001-05-09 Miguel de Icaza <miguel@ximian.com>
15378 * parameter.cs: Do not use `param' arguments as part of the
15379 signature, per the spec.
15381 2001-05-08 Miguel de Icaza <miguel@ximian.com>
15383 * decl.cs: Base class for classes, structs and interfaces. This
15384 is the "Declaration Space"
15386 * cs-parser.jay: Use CheckDef for checking declaration errors
15387 instead of having one on each function.
15389 * class.cs: Factor out some code for handling error handling in
15390 accordance to the "Declarations" section in the "Basic Concepts"
15391 chapter in the ECMA C# spec.
15393 * interface.cs: Make all interface member classes derive from
15394 InterfaceMemberBase.
15396 2001-05-07 Miguel de Icaza <miguel@ximian.com>
15398 * Many things: all interfaces are parsed and generated in
15399 gen-treedump. Support for member variables, constructors,
15400 destructors, properties, constants is there.
15402 Beginning of the IL backend, but very little done, just there for
15405 2001-04-29 Miguel de Icaza <miguel@ximian.com>
15407 * cs-parser.jay: Fix labeled statement.
15409 * cs-tokenizer.cs (escape): Escape " and ' always.
15410 ref_line, ref_name: keep track of the line/filename as instructed
15411 by #line by the compiler.
15414 2001-04-27 Miguel de Icaza <miguel@ximian.com>
15416 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
15417 to match the values in System.CodeDOM.
15419 Divid renamed to Divide.
15421 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
15423 (Statements.set): remove.
15425 * System.CodeDOM/CodeCatchClause.cs: always have a valid
15428 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
15429 falseStatements always have valid values.
15431 * cs-parser.jay: Use System.CodeDOM now.