1 2004-05-29 Martin Baulig <martin@ximian.com>
3 * literal.cs (NullPointer): Provide a private .ctor which sets
4 `type' to TypeManager.object_type. Fixes #59048.
6 2004-05-29 Martin Baulig <martin@ximian.com>
8 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
9 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
11 * ecore.cs (EventExpr.instance_expr): Make the field private.
13 2004-05-26 Marek Safar <marek.safar@seznam.cz>
15 Fixed bug #50080 & cs0214-2.cs
16 * expression.cs (Cast.DoResolve): Check unsafe context here.
18 * statement.cs (Resolve.DoResolve): Likewise.
20 2004-05-26 Martin Baulig <martin@ximian.com>
22 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
24 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
25 (RootContext.LookupType): Pass down the `silent' flag.
27 2004-05-25 Martin Baulig <martin@ximian.com>
30 (MethodGroupExpr.IdenticalTypeName): New public property.
31 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
32 expression actually refers to a type.
34 2004-05-25 Martin Baulig <martin@ximian.com>
36 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
37 for #56176 and made it actually work.
39 2004-05-25 Martin Baulig <martin@ximian.com>
41 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
42 (FieldExpr, PropertyExpr): Override and implement
43 CacheTemporaries. Fixes #52279.
45 2004-05-25 Miguel de Icaza <miguel@ximian.com>
47 * location.cs: In the new compiler listing a file twice is a
48 warning, not an error.
50 2004-05-24 Martin Baulig <martin@ximian.com>
52 * enum.cs (Enum.DefineType): For the `BaseType' to be a
53 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
55 2004-05-24 Martin Baulig <martin@ximian.com>
57 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
58 walking the `using' list. Fixes #53921.
60 2004-05-24 Martin Baulig <martin@ximian.com>
62 * const.cs (Const.LookupConstantValue): Added support for
63 EmptyCast's; fixes #55251.
65 2004-05-24 Martin Baulig <martin@ximian.com>
67 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
68 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
69 which does the CS0135 check. The reason is that we first need to
70 check whether the variable actually exists.
72 2004-05-24 Martin Baulig <martin@ximian.com>
74 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
75 than RootContext.LookupType() to find the explicit interface
78 2004-05-24 Raja R Harinath <rharinath@novell.com>
80 * Makefile: Simplify. Use executable.make.
81 * mcs.exe.sources: New file. List of sources of mcs.exe.
83 2004-05-24 Anders Carlsson <andersca@gnome.org>
87 Use the invariant culture when doing String.Compare for CLS case
90 2004-05-23 Martin Baulig <martin@ximian.com>
92 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
93 don't have any dots. Fixes #52622, added cs0246-8.cs.
95 * namespace.cs (NamespaceEntry.Lookup): Likewise.
97 2004-05-23 Marek Safar <marek.safar@seznam.cz>
99 * class.cs (MemberBase.Define): Reuse MemberType member for
100 resolved type. Other methods can use it too.
102 2004-05-23 Martin Baulig <martin@ximian.com>
104 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
105 the variable also exists in the current block (otherwise, we need
106 to report a CS0103). Fixes #58670.
108 2004-05-23 Martin Baulig <martin@ximian.com>
110 * flowanalysis.cs (Reachability.Reachable): Compute this
111 on-the-fly rather than storing it as a field.
113 2004-05-23 Martin Baulig <martin@ximian.com>
115 * flowanalysis.cs (Reachability.And): Manually compute the
116 resulting `barrier' from the reachability.
118 2004-05-23 Marek Safar <marek.safar@seznam.cz>
121 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
122 instance of ObsoleteAttribute when symbol is obsolete.
125 (IMethodData): Extended interface for ObsoleteAttribute support.
127 2004-05-22 Marek Safar <marek.safar@seznam.cz>
129 * attribute.cs: Fix bug #55970
131 2004-05-22 Marek Safar <marek.safar@seznam.cz>
135 (GetObsoleteAttribute): New method. Creates the instance of
137 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
138 ObsoleteAttribute when member is obsolete.
139 (AttributeTester.Report_ObsoleteMessage): Common method for
140 Obsolete error/warning reporting.
143 (TypeContainer.base_classs_type): New member for storing parent type.
146 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
149 2004-05-21 Marek Safar <marek.safar@seznam.cz>
151 * attribute.cs, const.cs: Fix bug #58590
153 2004-05-21 Martin Baulig <martin@ximian.com>
155 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
156 out parameters if the end of the method is unreachable. Fixes
159 2004-05-21 Marek Safar <marek.safar@seznam.cz>
161 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
162 Hari was right, why extra method.
164 2004-05-21 Marek Safar <marek.safar@seznam.cz>
166 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
168 2004-05-20 Martin Baulig <martin@ximian.com>
170 Merged this back from gmcs to keep the differences to a minumum.
172 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
173 instead of a Declspace.
174 (Attribute.ResolveType): Likewise.
175 (Attributes.Search): Likewise.
176 (Attributes.Contains): Likewise.
177 (Attributes.GetClsCompliantAttribute): Likewise.
179 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
181 (MethodData.ApplyAttributes): Take an EmitContext instead of a
184 2004-04-20 Martin Baulig <martin@ximian.com>
186 Merged latest changes into gmcs. Please keep this comment in
187 here, it makes it easier for me to see what changed in MCS since
188 the last time I merged.
190 2004-05-19 Marek Safar <marek.safar@seznam.cz>
192 Fix bug #58688 (MCS does not report error when the same attribute
195 * attribute.cs (Attribute.Emit): Distinction between null and default.
197 2004-05-19 Raja R Harinath <rharinath@novell.com>
199 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
200 of a top-level attribute without an attribute target.
201 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
203 (Attribute.Conditional_GetConditionName),
204 (Attribute.Obsolete_GetObsoleteMessage): Update.
205 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
206 part of ScanForIndexerName.
207 (Attribute.CanIgnoreInvalidAttribute): New function.
208 (Attribute.ScanForIndexerName): Move to ...
209 (Attributes.ScanForIndexerName): ... here.
210 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
211 (Attributes.Search): New internal variant that can choose not to
212 complain if types aren't resolved. The original signature now
214 (Attributes.GetClsCompliantAttribute): Use internal variant, with
215 complaints suppressed.
216 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
217 only if it not useful.
218 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
219 top-level for attributes that are shared between the assembly
220 and a top-level class.
221 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
222 * class.cs: Update to reflect changes.
223 (DefineIndexers): Fuse loops.
224 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
225 a couple more variants of attribute names.
227 2004-05-18 Marek Safar <marek.safar@seznam.cz>
229 Fix bug #52585 (Implemented explicit attribute declaration)
232 (Attributable.ValidAttributeTargets): New abstract method. It gets
233 list of valid attribute targets for explicit target declaration.
234 (Attribute.Target): It holds target itself.
235 (AttributeSection): Removed.
236 (Attribute.CheckTargets): New method. It checks whether attribute
237 target is valid for the current element.
240 (EventProperty): New class. For events that are declared like
241 property (with add and remove accessors).
242 (EventField): New class. For events that are declared like field.
245 * cs-parser.jay: Implemented explicit attribute target declaration.
247 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
248 Override ValidAttributeTargets.
251 (ReturnParameter): Class for applying custom attributes on
253 (ParameterAtribute): New class. Class for applying custom
254 attributes on the parameter type.
256 2004-05-17 Miguel de Icaza <miguel@ximian.com>
258 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
261 (Method): Allow UNSAFE here.
263 * modifiers.cs: Support unsafe reporting.
265 2004-05-17 Marek Safar <marek.safar@seznam.cz>
267 * decl.cs: Fix bug #58478.
269 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
271 * statement.cs: When checking for unreachable code on an EmptyStatement,
272 set the location. Fixes bug #58488.
274 2004-05-13 Miguel de Icaza <miguel@ximian.com>
276 * driver.cs: Add -pkg handling.
278 From Gonzalo: UseShelLExecute=false
280 2004-05-12 Marek Safar <marek.safar@seznam.cz>
283 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
285 (Attribute.IsClsCompliaceRequired): Moved to base for better
287 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
288 when attribute is AttributeUsageAttribute.
289 (Attribute.GetValidTargets): Simplified.
290 (Attribute.GetAttributeUsage): New method returns AttributeUsage
291 attribute for this type.
292 (Attribute.ApplyAttributes): Method renamed to Emit and make
294 (GlobalAttributeSection): New class for special handling of global
295 attributes (assembly, module).
296 (AttributeSection.Emit): New method.
298 * class.cs: Implemented Attributable abstract methods.
299 (MethodCore.LabelParameters): Moved to Parameter class.
300 (Accessor): Is back simple class.
301 (PropertyMethod): Implemented Attributable abstract class.
302 (DelegateMethod): Implemented Attributable abstract class.
303 (Event): New constructor for disctintion between normal Event
304 and Event with accessors.
306 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
308 * codegen.cs, const.cs, decl.cs, delegate.cs:
309 (CommonAssemblyModulClass): Implemented Attributable abstract class
312 * enum.cs: Implement IAttributeSupport interface.
313 (EnumMember): New class for emum members. Implemented Attributable
317 (ParameterBase): Is abstract.
318 (ReturnParameter): New class for easier [return:] attribute handling.
320 * typemanager.cs: Removed builder_to_attr.
322 2004-05-11 Raja R Harinath <rharinath@novell.com>
325 * attribute.cs (Attribute.GetPositionalValue): New function.
326 * class.cs (TypeContainer.VerifyMembers): New function.
327 (TypeContainer.Emit): Use it.
328 (ClassOrStruct): New base class for Class and Struct.
329 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
330 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
332 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
333 then each non-static field should have a FieldOffset attribute.
334 Otherwise, none of the fields should have a FieldOffset attribute.
335 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
336 and FieldOffset attributes.
337 * typemanager.cs (TypeManager.struct_layout_attribute_type)
338 (TypeManager.field_offset_attribute_type): New core types.
339 (TypeManager.InitCoreTypes): Initialize them.
341 2004-05-11 Michal Moskal <malekith@pld-linux.org>
343 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
347 2004-05-09 Miguel de Icaza <miguel@ximian.com>
349 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
350 be implicitly converted to ulong.
352 * expression.cs: The logic for allowing operator &, | and ^ worked
353 was wrong, it worked before because we did not report an error in
354 an else branch. Fixes 57895.
356 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
357 allow volatile fields to be reference types.
359 2004-05-07 Miguel de Icaza <miguel@ximian.com>
361 * driver.cs: Add support for /debug-
363 2004-05-07 Raja R Harinath <rharinath@novell.com>
365 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
366 Add a 'complain' parameter to silence errors.
367 (Attribute.Resolve): Update to changes. Put in sanity check to catch
368 silently overlooked type-resolutions.
369 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
371 (Attributes.Search): New function.
372 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
373 (Attributes.GetAttributeFullName): Remove hack.
374 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
375 Update to reflect changes.
376 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
377 Use Attributes.Search instead of nested loops.
379 2004-05-07 Marek Safar <marek.safar@seznam.cz>
382 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
383 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
384 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
386 * report.cs: (Report.Warning): Renamed to Warning_T because of
389 2004-05-05 Raja R Harinath <rharinath@novell.com>
391 * expression.cs (MemberAccess.ResolveMemberAccess):
392 Exit with non-zero status after Report.Error.
393 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
395 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
397 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
399 * support.cs: Don't hang when the file is empty.
401 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
403 * support.cs: In SeekableStreamReader, compute the preamble size of the
404 underlying stream. Position changes should take into account that initial
407 2004-05-03 Todd Berman <tberman@sevenl.net>
409 * driver.cs: remove unused GetSysVersion function.
411 2004-05-03 Todd Berman <tberman@sevenl.net>
413 * driver.cs: Remove the hack from saturday, as well as the hack
414 from jackson (LoadAssemblyFromGac), also adds the CWD to the
415 link_paths to get that bit proper.
417 2004-05-01 Todd Berman <tberman@sevenl.net>
419 * driver.cs: Try a LoadFrom before a Load, this checks the current
420 path. This is currently a bug in mono that is be fixed, however, this
421 provides a workaround for now. This will be removed when the bug
424 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
426 * CryptoConvert.cs: Updated to latest version. Fix issue with
427 incomplete key pairs (#57941).
429 2004-05-01 Todd Berman <tberman@sevenl.net>
431 * driver.cs: Remove '.' from path_chars, now System.* loads properly
434 2004-04-30 Jackson Harper <jackson@ximian.com>
436 * codegen.cs: Open keys readonly.
438 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
440 * typemanager.cs: don't report cyclic struct layout when a struct
441 contains 2 or more fields of the same type. Failed for Pango.AttrShape
442 which has 2 Pango.Rectangle fields.
444 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
446 * expression.cs: Handle IntPtr comparisons with IL code
447 rather than a method call.
449 2004-04-29 Martin Baulig <martin@ximian.com>
451 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
452 the list of PropertyInfo's in class hierarchy and find the
453 accessor. Fixes #56013.
455 2004-04-29 Martin Baulig <martin@ximian.com>
457 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
459 2004-04-29 Martin Baulig <martin@ximian.com>
461 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
463 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
465 2004-04-29 Martin Baulig <martin@ximian.com>
467 * class.cs (ConstructorInitializer.Resolve): Check whether the
468 parent .ctor is accessible. Fixes #52146.
470 2004-04-29 Martin Baulig <martin@ximian.com>
472 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
474 * statement.cs (Using.EmitLocalVariableDecls): Use
475 TypeManager.idisposable_type, not typeof (IDisposable).
476 (Foreach.EmitCollectionForeach): Added support for valuetypes.
478 2004-04-29 Martin Baulig <martin@ximian.com>
480 * class.cs (Event.Define): Don't emit the field and don't set
481 RTSpecialName and SpecialName for events on interfaces. Fixes
484 2004-04-29 Raja R Harinath <rharinath@novell.com>
486 Refactor Attribute.ApplyAttributes.
487 * attribute.cs (Attributable): New base class for objects that can
488 have Attributes applied on them.
489 (Attribute): Make AttributeUsage fields public.
490 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
491 (Attribute.IsInternalCall): New property.
492 (Attribute.UsageAttr): Convert to a public read-only property.
493 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
494 (Attribute.ResolveType, Attribute.Resolve)
495 (Attribute.ScanForIndexerName): Update to reflect changes.
496 (Attribute.CheckAttributeTarget): Re-format.
497 (Attribute.ApplyAttributes): Refactor, to various
498 Attributable.ApplyAttributeBuilder methods.
499 * decl.cs (MemberCore): Make Attributable.
500 * class.cs (Accessor): Make Attributable.
501 (MethodData.ApplyAttributes): Use proper attribute types, not
503 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
504 (TypeContainer.ApplyAttributeBuilder)
505 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
506 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
507 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
508 (Operator.ApplyAttributeBuilder): New factored-out methods.
509 * const.cs (Const.ApplyAttributeBuilder): Likewise.
510 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
511 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
512 * parameter.cs (ParameterBase): New Attributable base class
513 that can also represent Return types.
514 (Parameter): Update to the changes.
516 2004-04-29 Jackson Harper <jackson@ximian.com>
518 * driver.cs: Prefer the corlib system version when looking for
519 assemblies in the GAC. This is still a hack, but its a better hack
522 2004-04-29 Marek Safar <marek.safar@seznam.cz>
524 * decl.cs, enum.cs: Improved error 3005 reporting.
526 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
527 (related_symbols): New private member for list of symbols
528 related to reported error/warning.
530 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
532 2004-04-29 Martin Baulig <martin@ximian.com>
534 * ecore.cs (Expression.Constantify): If we're an enum and
535 TypeManager.TypeToCoreType() doesn't give us another type, use
536 t.UnderlyingSystemType. Fixes #56178.
538 2004-04-29 Martin Baulig <martin@ximian.com>
540 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
541 interfaces and for each interface, only add members directly
542 declared in that interface. Fixes #53255.
544 2004-04-28 Martin Baulig <martin@ximian.com>
546 * expression.cs (ConditionalLogicalOperator): Use a temporary
547 variable for `left' to avoid that we evaluate it more than once;
550 2004-04-28 Martin Baulig <martin@ximian.com>
552 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
555 2004-04-28 Martin Baulig <martin@ximian.com>
557 * statement.cs (LocalInfo.Resolve): Check whether the type is not
560 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
561 whether the type is not void (CS1547).
563 2004-04-28 Martin Baulig <martin@ximian.com>
565 * expression.cs (Unary.DoResolveLValue): Override this and report
566 CS0131 for anything but Operator.Indirection.
568 2004-04-28 Martin Baulig <martin@ximian.com>
570 Committing a patch from Ben Maurer; see bug #50820.
572 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
575 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
578 2004-04-28 Martin Baulig <martin@ximian.com>
580 Committing a patch from Ben Maurer; see bug #50820.
582 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
585 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
588 2004-04-28 Martin Baulig <martin@ximian.com>
590 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
591 (Block.AddLabel): Call DoLookupLabel() to only search in the
594 2004-04-28 Martin Baulig <martin@ximian.com>
596 * cfold.cs (ConstantFold.BinaryFold): Added special support for
597 comparing StringConstants and NullLiterals in Equality and Inequality.
599 2004-04-28 Jackson Harper <jackson@ximian.com>
601 * driver.cs: Attempt to load referenced assemblies from the
602 GAC. This is the quick and dirty version of this method that
603 doesnt take into account versions and just takes the first
604 canidate found. Will be good enough for now as we will not have more
605 then one version installed into the GAC until I update this method.
607 2004-04-28 Martin Baulig <martin@ximian.com>
609 * typemanager.cs (TypeManager.CheckStructCycles): New public
610 static method to check for cycles in the struct layout.
612 * rootcontext.cs (RootContext.PopulateTypes): Call
613 TypeManager.CheckStructCycles() for each TypeContainer.
614 [Note: We only need to visit each type once.]
616 2004-04-28 Martin Baulig <martin@ximian.com>
618 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
620 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
621 success and added `out object value'. Use a `bool resolved' field
622 to check whether we've already been called rather than
623 `ConstantValue != null' since this breaks for NullLiterals.
625 2004-04-28 Raja R Harinath <rharinath@novell.com>
627 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
628 setting of this flag, since the 'set' method may be non-public.
630 2004-04-28 Raja R Harinath <rharinath@novell.com>
632 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
633 check on current_vector.Block.
635 2004-04-27 Martin Baulig <martin@ximian.com>
637 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
638 a field initializer. Fixes #56459.
640 2004-04-27 Martin Baulig <martin@ximian.com>
642 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
643 we're not attempting to use an indexer. Fixes #52154.
645 2004-04-27 Martin Baulig <martin@ximian.com>
647 * statement.cs (Return): Don't create a return label if we don't
648 need it; reverts my change from January 20th. Thanks to Ben
651 2004-04-27 Martin Baulig <martin@ximian.com>
653 According to the spec, `goto' can only leave a nested scope, but
656 * statement.cs (Block.LookupLabel): Only lookup in the current
657 block, don't recurse into parent or child blocks.
658 (Block.AddLabel): Check in parent and child blocks, report
659 CS0140/CS0158 if we find a duplicate.
660 (Block): Removed this indexer for label lookups.
661 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
662 this already does the error reporting for us.
665 (FlowBranching.UsageVector.Block): New public variable; may be null.
666 (FlowBranching.CreateSibling): Added `Block' argument.
667 (FlowBranching.LookupLabel): New public virtual method. Lookup a
668 label for the target of a `goto' and check whether we're not
671 2004-04-27 Martin Baulig <martin@ximian.com>
673 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
674 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
677 2004-04-27 Martin Baulig <martin@ximian.com>
679 * statement.cs (Block.AddLabel): Also check for implicit blocks
680 and added a CS0158 check.
682 2004-04-27 Martin Baulig <martin@ximian.com>
684 * flowanalysis.cs (FlowBranchingLoop): New class.
685 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
686 UsageVector's instead of an ArrayList.
687 (FlowBranching.Label): Likewise.
688 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
689 (FlowBranching.AddBreakVector): New method.
691 2004-04-27 Miguel de Icaza <miguel@ximian.com>
693 * attribute.cs: Small regression fix: only convert the type if we
694 the type is different, fixes System.Drawing build.
696 2004-04-27 Martin Baulig <martin@ximian.com>
698 * attribute.cs (Attribute.Resolve): If we have a constant value
699 for a named field or property, implicity convert it to the correct
702 2004-04-27 Raja R Harinath <rharinath@novell.com>
704 * statement.cs (Block.Block): Implicit blocks share
705 'child_variable_names' fields with parent blocks.
706 (Block.AddChildVariableNames): Remove.
707 (Block.AddVariable): Mark variable as "used by a child block" in
708 every surrounding block.
709 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
710 been used in a child block, complain about violation of "Invariant
711 meaning in blocks" rule.
712 * cs-parser.jay (declare_local_variables): Don't use
713 AddChildVariableNames.
714 (foreach_statement): Don't create an implicit block: 'foreach'
717 2004-04-23 Miguel de Icaza <miguel@ximian.com>
719 * convert.cs (ImplicitNumericConversion): 0 is also positive when
720 converting from 0L to ulong. Fixes 57522.
722 2004-04-22 Marek Safar <marek.safar@seznam.cz>
724 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
725 derived class hides via 'new' keyword field from base class (test-242.cs).
726 TODO: Handle this in the more general way.
728 * class.cs (CheckBase): Ditto.
730 2004-04-22 Marek Safar <marek.safar@seznam.cz>
732 * decl.cs (caching_flags): New member for storing cached values
734 (MemberCore.Flags): New enum where bit flags for caching_flags
736 (MemberCore.cls_compliance): Moved to caching_flags.
737 (DeclSpace.Created): Moved to caching_flags.
739 * class.cs: Use caching_flags instead of DeclSpace.Created
741 2004-04-21 Miguel de Icaza <miguel@ximian.com>
743 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
744 if we are only a derived class, not a nested class.
746 * typemanager.cs: Same as above, but do this at the MemberLookup
747 level (used by field and methods, properties are handled in
748 PropertyExpr). Allow for the qualified access if we are a nested
751 2004-04-21 Marek Safar <marek.safar@seznam.cz>
753 * class.cs: Refactoring.
754 (IMethodData): New inteface; Holds links to parent members
755 to avoid member duplication (reduced memory allocation).
756 (Method): Implemented IMethodData interface.
757 (PropertyBase): New inner classes for get/set methods.
758 (PropertyBase.PropertyMethod): Implemented IMethodData interface
759 (Event): New inner classes for add/remove methods.
760 (Event.DelegateMethod): Implemented IMethodData interface.
762 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
763 EmitContext (related to class.cs refactoring).
765 2004-04-21 Raja R Harinath <rharinath@novell.com>
767 * delegate.cs (Delegate.VerifyApplicability): If the number of
768 arguments are the same as the number of parameters, first try to
769 verify applicability ignoring any 'params' modifier on the last
773 2004-04-16 Raja R Harinath <rharinath@novell.com>
775 * class.cs (TypeContainer.AddIndexer): Use
776 'ExplicitInterfaceName' to determine if interface name was
777 explicitly specified. 'InterfaceType' is not initialized at this time.
778 (TypeContainer.DefineIndexers): Remove use of temporary list. The
779 Indexers array is already in the required order. Initialize
780 'IndexerName' only if there are normal indexers.
781 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
782 (TypeContainer.Emit): Emit DefaultMember attribute only if
783 IndexerName is initialized.
786 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
788 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
791 2004-04-15 Raja R Harinath <rharinath@novell.com>
793 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
797 * attribute.cs (Attribute.Resolve): Check for duplicate named
801 2004-04-15 Miguel de Icaza <miguel@ximian.com>
803 * iterators.cs (MarkYield): track whether we are in an exception,
804 and generate code accordingly. Use a temporary value to store the
805 result for our state.
807 I had ignored a bit the interaction of try/catch with iterators
808 since their behavior was not entirely obvious, but now it is
809 possible to verify that our behavior is the same as MS .NET 2.0
813 2004-04-14 Miguel de Icaza <miguel@ximian.com>
815 * iterators.cs: Avoid creating temporaries if there is no work to
818 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
819 Enumerations, use TypeManager.EnumToUnderlying and call
822 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
825 (This.Emit): Use EmitContext.EmitThis to emit our
828 (This.EmitAssign): Ditto.
830 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
831 codepaths, we will move all the functionality into
834 (FieldExpr.EmitAssign): Ditto.
836 This fixes several hidden bugs that I uncovered while doing a code
837 review of this today.
839 * codegen.cs (EmitThis): reworked so the semantics are more clear
840 and also support value types "this" instances.
842 * iterators.cs: Changed so that for iterators in value types, we
843 do not pass the value type as a parameter.
845 Initialization of the enumerator helpers is now done in the caller
846 instead of passing the parameters to the constructors and having
847 the constructor set the fields.
849 The fields have now `assembly' visibility instead of private.
851 2004-04-11 Miguel de Icaza <miguel@ximian.com>
853 * expression.cs (Argument.Resolve): Check if fields passed as ref
854 or out are contained in a MarshalByRefObject.
856 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
857 another compiler type.
859 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
861 * class.cs (Indexer.Define): use the new name checking method.
862 Also, return false on an error.
863 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
864 (is_identifier_[start/part]_character): make static.
866 2004-04-10 Miguel de Icaza <miguel@ximian.com>
868 * expression.cs (Binary.ResolveOperator): Do no append strings
869 twice: since we can be invoked more than once (array evaluation)
870 on the same concatenation, take care of this here. Based on a fix
871 from Ben (bug #56454)
873 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
875 * codegen.cs: Fix another case where CS1548 must be reported (when
876 delay-sign isn't specified and no private is available #56564). Fix
877 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
878 error when MCS is used on the MS runtime and we need to delay-sign
879 (which seems unsupported by AssemblyBuilder - see #56621).
881 2004-04-08 Marek Safar <marek.safar@seznam.cz>
883 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
884 (TypeManager.ComputeNamespaces): Faster implementation for
887 * compiler.csproj: Updated AssemblyName to mcs.
889 2004-04-07 Miguel de Icaza <miguel@ximian.com>
891 * rootcontext.cs: Add new types to the boot resolution.
893 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
894 MulticastDelegate is not allowed.
896 * typemanager.cs: Add new types to lookup: System.TypedReference
899 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
900 check for TypedReference or ArgIterator, they are not allowed.
902 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
903 makes us properly catch 1510 in some conditions (see bug 56016 for
906 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
908 * CryptoConvert.cs: update from corlib version
911 2004-04-05 Miguel de Icaza <miguel@ximian.com>
913 * class.cs (Indexer.Define): Check indexername declaration
915 2004-04-05 Marek Safar <marek.safar@seznam.cz>
917 * attribute.cs (IsClsCompliant): Fixed problem with handling
918 all three states (compliant, not-compliant, undetected).
920 2004-03-30 Marek Safar <marek.safar@seznam.cz>
922 * attribute.cs (Attribute): Location is now public.
923 (Resolve): Store resolved arguments (pos_values) in attribute class.
924 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
925 (GetClsCompliantAttributeValue): New method that gets
926 CLSCompliantAttribute value.
927 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
929 (AttributeTester): New class for CLS-Compliant verification routines.
931 * class.cs (Emit): Add CLS-Compliant verification.
932 (Method.GetSignatureForError): Implemented.
933 (Constructor.GetSignatureForError): Implemented
934 (Constructor.HasCompliantArgs): Returns if constructor has
935 CLS-Compliant arguments.
936 (Constructor.Emit): Override.
937 (Construcor.IsIdentifierClsCompliant): New method; For constructors
938 is needed to test only parameters.
939 (FieldBase.GetSignatureForError): Implemented.
940 (TypeContainer): New member for storing base interfaces.
941 (TypeContainer.FindMembers): Search in base interfaces too.
943 * codegen.cs (GetClsComplianceAttribute): New method that gets
944 assembly or module CLSCompliantAttribute value.
945 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
947 (ModuleClass.Emit): Add error 3012 test.
949 * const.cs (Emit): Override and call base for CLS-Compliant tests.
951 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
952 state for all decl types.
953 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
954 if CLS-Compliant tests are required.
955 (IsClsCompliaceRequired): New method. Analyze whether code
956 must be CLS-Compliant.
957 (IsExposedFromAssembly): New method. Returns true when MemberCore
958 is exposed from assembly.
959 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
960 value or gets cached value.
961 (HasClsCompliantAttribute): New method. Returns true if MemberCore
962 is explicitly marked with CLSCompliantAttribute.
963 (IsIdentifierClsCompliant): New abstract method. This method is
964 used to testing error 3005.
965 (IsIdentifierAndParamClsCompliant): New method. Common helper method
966 for identifier and parameters CLS-Compliant testing.
967 (VerifyClsCompliance): New method. The main virtual method for
968 CLS-Compliant verifications.
969 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
970 null. I don't know why is null (too many public members !).
971 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
972 and get value of first CLSCompliantAttribute that found.
974 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
975 (VerifyClsCompliance): Override and add extra tests.
977 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
978 clscheck- disable CLS-Compliant verification event if assembly is has
979 CLSCompliantAttribute(true).
981 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
982 ApllyAttribute is now called in emit section as in the other cases.
983 Possible future Emit integration.
984 (IsIdentifierClsCompliant): New override.
985 (VerifyClsCompliance): New override.
986 (GetEnumeratorName): Returns full enum name.
988 * parameter.cs (GetSignatureForError): Implemented.
990 * report.cs (WarningData): New struct for Warning message information.
991 (LocationOfPreviousError): New method.
992 (Warning): New method. Reports warning based on the warning table.
993 (Error_T): New method. Reports error based on the error table.
995 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
996 verifications are done here.
998 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
1000 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
1001 CLSCompliantAttribute.
1002 (all_imported_types): New member holds all imported types from other
1004 (LoadAllImportedTypes): New method fills static table with exported types
1005 from all referenced assemblies.
1006 (Modules): New property returns all assembly modules.
1008 2004-03-30 Miguel de Icaza <miguel@ximian.com>
1010 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
1011 throwing a parser error.
1013 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
1014 which removes the hardcoded get_/set_ prefixes for properties, as
1015 IL allows for the properties to be named something else.
1019 * expression.cs: Do not override operand before we know if it is
1022 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1024 * typemanager.cs: support for pinned variables.
1026 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1028 * decl.cs, typemanager.cs: Avoid using an arraylist
1029 as a buffer if there is only one result set.
1031 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1033 * expression.cs: Make sure you cant call a static method
1034 with an instance expression, bug #56174.
1036 2004-03-29 Miguel de Icaza <miguel@ximian.com>
1038 * class.cs (IsDuplicateImplementation): Improve error reporting to
1039 flag 663 (method only differs in parameter modifier).
1041 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
1042 in preprocessor directives.
1044 * location.cs (LookupFile): Allow for the empty path.
1046 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
1047 better approach for some of that patch, but its failing with the
1048 CharSet enumeration. For now try/catch will do.
1050 * typemanager.cs: Do not crash if a struct does not have fields.
1053 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1055 * expression.cs: cs0213, cant fix a fixed expression.
1058 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1060 * cs-parser.jay: detect invalid embeded statements gracefully.
1063 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1065 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
1068 the invocation type may not be a subclass of the tye of the item/
1069 The type of the item must be a subclass of the invocation item.
1074 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
1076 * attribute.cs: Added methods to get a string and a bool from an
1077 attribute. Required to information from AssemblyKeyFileAttribute,
1078 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
1079 * codegen.cs: Modified AssemblyName creation to include support for
1080 strongnames. Catch additional exceptions to report them as CS1548.
1081 * compiler.csproj: Updated include CryptoConvert.cs.
1082 * compiler.csproj.user: Removed file - user specific configuration.
1083 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
1084 Mono.Security assembly. The original class is maintained and tested in
1085 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
1086 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
1087 like CSC 8.0 (C# v2) supports.
1088 * Makefile: Added CryptoConvert.cs to mcs sources.
1089 * rootcontext.cs: Added new options for strongnames.
1091 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
1093 * driver.cs: For --expect-error, report error code `2'
1094 if the program compiled with no errors, error code `1' if
1095 it compiled with an error other than the one expected.
1097 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
1099 * compiler.csproj: Updated for Visual Studio .NET 2003.
1100 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
1101 * compiler.sln: Updated for Visual Studio .NET 2003.
1103 2004-03-24 Ravi Pratap M <ravi@ximian.com>
1105 * expression.cs: Fix bug #47234. We basically need to apply the
1106 rule that we prefer the conversion of null to a reference type
1107 when faced with a conversion to 'object' (csc behaviour).
1109 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1111 * statement.cs: Shorter form for foreach, eliminates
1112 a local variable. r=Martin.
1114 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1116 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
1117 checks if we can use brtrue/brfalse to test for 0.
1118 * expression.cs: use the above in the test for using brtrue/brfalse.
1121 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1123 * expression.cs: Rewrite string concat stuff. Benefits:
1125 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
1126 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
1127 rather than a concat chain.
1129 * typemanager.cs: Add lookups for more concat overloads.
1131 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1133 * expression.cs: Emit shorter il code for array init.
1150 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
1152 * statement.cs: Before, two switch blocks would be merged if the
1153 total size of the blocks (end_item - begin_item + 1) was less than
1154 two times the combined sizes of the blocks.
1156 Now, it will only merge if after the merge at least half of the
1161 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
1163 * class.cs : csc build fix for GetMethods(). See bug #52503.
1165 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
1167 * expression.cs: Make sure fp comparisons work with NaN.
1168 This fixes bug #54303. Mig approved this patch a long
1169 time ago, but we were not able to test b/c the runtime
1172 2004-03-19 Miguel de Icaza <miguel@ximian.com>
1174 * ecore.cs (TypExpr.GetHashCode): implement this overload.
1176 2004-03-19 Martin Baulig <martin@ximian.com>
1178 * class.cs (MemberCore.IsDuplicateImplementation): Report the
1179 error here and not in our caller.
1181 2004-03-19 Martin Baulig <martin@ximian.com>
1183 * interface.cs: Completely killed this file.
1184 (Interface): We're now a TypeContainer and live in class.cs.
1186 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
1187 argument; we're now also called for interfaces.
1188 (TypeContainer.DefineMembers): Allow this method being called
1190 (TypeContainer.GetMethods): New public method; formerly known as
1191 Interface.GetMethod(). This is used by PendingImplementation.
1192 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
1193 it's now private and non-static.
1194 (Interface): Moved this here; it's now implemented similar to
1196 (Method, Property, Event, Indexer): Added `bool is_interface'
1197 argument to their .ctor's.
1198 (MemberBase.IsInterface): New public field.
1200 * cs-parser.jay: Create normal Method, Property, Event, Indexer
1201 instances instead of InterfaceMethod, InterfaceProperty, etc.
1202 (opt_interface_base): Removed; we now use `opt_class_base' instead.
1203 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
1205 2004-03-19 Martin Baulig <martin@ximian.com>
1207 * class.cs (MethodCore.IsDuplicateImplementation): New private
1208 method which does the CS0111 checking.
1209 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
1210 Use IsDuplicateImplementation().
1212 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
1214 * decl.cs (FindMemberToOverride): New method to find the correct
1215 method or property to override in the base class.
1217 - Make Method/Property use the above method to find the
1218 version in the base class.
1219 - Remove the InheritableMemberSignatureCompare as it is now
1222 This patch makes large code bases much faster to compile, as it is
1223 O(n) rather than O(n^2) to do this validation.
1225 Also, it fixes bug 52458 which is that nested classes are not
1226 taken into account when finding the base class member.
1228 Reviewed/Approved by Martin.
1230 2004-03-17 Marek Safar <marek.safar@seznam.cz>
1232 * interface.cs: In all interface classes removed redundant
1233 member initialization.
1235 2004-03-16 Martin Baulig <martin@ximian.com>
1237 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1239 2004-03-15 Miguel de Icaza <miguel@ximian.com>
1241 * decl.cs (DefineTypeAndParents): New helper method to define a
1242 type's containers before the type itself is defined; This is a
1243 bug exposed by the recent changes to Windows.Forms when an
1244 implemented interface was defined inside a class that had not been
1247 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
1249 (Check): Loop correctly to report errors modifiers
1250 (UNSAFE was not in the loop, since it was the same as TOP).
1252 * interface.cs: Every interface member now takes a ModFlags,
1253 instead of a "is_new" bool, which we set on the base MemberCore.
1255 Every place where we called "UnsafeOk" in the interface, now we
1256 call the proper member (InterfaceMethod.UnsafeOK) instead to get
1257 the unsafe settings from the member declaration instead of the
1258 container interface.
1260 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
1262 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1263 `set_indexer_name' to the pending bits (one per type).
1265 We fixed a bug today that was picking the wrong method to
1266 override, since for properties the existing InterfaceMethod code
1267 basically ignored the method name. Now we make sure that the
1268 method name is one of the valid indexer names.
1270 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
1272 * support.cs (SeekableStreamReader): Keep track of stream byte
1273 positions and don't mix them with character offsets to the buffer.
1275 Patch from Gustavo Giráldez
1277 2004-03-15 Marek Safar <marek.safar@seznam.cz>
1279 * interface.cs (InterfaceSetGetBase): Removed double member
1280 initialization, base class does it as well.
1282 2004-03-13 Martin Baulig <martin@ximian.com>
1284 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
1285 when compiling corlib.
1287 2004-03-13 Miguel de Icaza <miguel@ximian.com>
1289 * convert.cs (ExplicitConversion): We were reporting an error on
1290 certain conversions (object_type source to a value type, when the
1291 expression was `null') before we had a chance to pass it through
1292 the user defined conversions.
1294 * driver.cs: Replace / and \ in resource specifications to dots.
1297 * class.cs: Add check for duplicate operators. Fixes 52477
1299 2004-03-11 Miguel de Icaza <miguel@ximian.com>
1301 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
1302 that are in the middle of the statements, not only at the end.
1305 * class.cs (TypeContainer.AddField): No longer set the
1306 `HaveStaticConstructor' flag, now we call it
1307 `UserDefineStaticConstructor' to diferentiate the slightly
1308 semantic difference.
1310 The situation is that we were not adding BeforeFieldInit (from
1311 Modifiers.TypeAttr) to classes that could have it.
1312 BeforeFieldInit should be set to classes that have no static
1317 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
1319 And most importantly Zoltan's comment:
1321 http://bugzilla.ximian.com/show_bug.cgi?id=44229
1323 "I think beforefieldinit means 'it's ok to initialize the type sometime
1324 before its static fields are used', i.e. initialization does not need
1325 to be triggered by the first access to the type. Setting this flag
1326 helps the JIT to compile better code, since it can run the static
1327 constructor at JIT time, and does not need to generate code to call it
1328 (possibly lots of times) at runtime. Unfortunately, mcs does not set
1329 this flag for lots of classes like String.
1331 csc sets this flag if the type does not have an explicit static
1332 constructor. The reasoning seems to be that if there are only static
1333 initalizers for a type, and no static constructor, then the programmer
1334 does not care when this initialization happens, so beforefieldinit
1337 This bug prevents the AOT compiler from being usable, since it
1338 generates so many calls to mono_runtime_class_init that the AOT code
1339 is much slower than the JITted code. The JITted code is faster,
1340 because it does not generate these calls if the vtable is type is
1341 already initialized, which is true in the majority of cases. But the
1342 AOT compiler can't do this."
1344 2004-03-10 Miguel de Icaza <miguel@ximian.com>
1346 * class.cs (MethodData.Emit): Refactor the code so symbolic
1347 information is generated for destructors; For some reasons we
1348 were taking a code path that did not generate symbolic information
1351 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
1353 * class.cs: Create a Constructor.CheckBase method that
1354 takes care of all validation type code. The method
1355 contains some code that was moved from Define.
1357 It also includes new code that checks for duplicate ctors.
1358 This fixes bug #55148.
1360 2004-03-09 Joshua Tauberer <tauberer@for.net>
1362 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
1363 a { ... }-style array creation invokes EmitStaticInitializers
1364 which is not good for reference-type arrays. String, decimal
1365 and now null constants (NullCast) are not counted toward
1366 static initializers.
1368 2004-03-05 Martin Baulig <martin@ximian.com>
1370 * location.cs (SourceFile.HasLineDirective): New public field;
1371 specifies whether the file contains or is referenced by a "#line"
1373 (Location.DefineSymbolDocuments): Ignore source files which
1374 either contain or are referenced by a "#line" directive.
1376 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
1378 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
1379 direct access to our parent, so check the method inline there.
1381 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
1383 * expression.cs (Invocation.EmitCall): Miguel's last commit
1384 caused a regression. If you had:
1389 In Foo the implict this would be null.
1391 2004-02-27 Miguel de Icaza <miguel@ximian.com>
1393 * expression.cs (Invocation.EmitCall): If the method is not
1394 virtual, do not emit a CallVirt to it, use Call.
1396 * typemanager.cs (GetFullNameSignature): Improve the method to
1397 cope with ".ctor" and replace it with the type name.
1399 * class.cs (ConstructorInitializer.Resolve): Now the method takes
1400 as an argument the ConstructorBuilder where it is being defined,
1401 to catch the recursive constructor invocations.
1403 2004-02-26 Miguel de Icaza <miguel@ximian.com>
1405 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
1406 routines to check if a type is an enumerable/enumerator allow
1407 classes that implement the IEnumerable or IEnumerator interfaces.
1409 * class.cs (Property, Operator): Implement IIteratorContainer, and
1410 implement SetYields.
1412 (Property.Define): Do the block swapping for get_methods in the
1413 context of iterators. We need to check if Properties also
1414 include indexers or not.
1416 (Operator): Assign the Block before invoking the
1417 OperatorMethod.Define, so we can trigger the Iterator code
1420 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
1421 Property and Operator classes are not created when we parse the
1422 declarator but until we have the block completed, so we use a
1423 singleton SimpleIteratorContainer.Simple to flag whether the
1424 SetYields has been invoked.
1426 We propagate this setting then to the Property or the Operator to
1427 allow the `yield' to function.
1429 2004-02-25 Marek Safar <marek.safar@seznam.cz>
1431 * codegen.cs: Implemented attribute support for modules.
1432 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
1433 Assembly/Module functionality.
1435 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
1436 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
1437 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
1439 2004-02-16 Marek Safar <marek.safar@seznam.cz>
1441 * interface.cs (FindMembers): The operation is performed on all base
1442 interfaces and not only on the first. It is required for future CLS Compliance patch.
1444 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
1446 * statement.cs, codegen.cs:
1447 This patch deals with patterns such as:
1449 public class List : IEnumerable {
1451 public MyEnumerator GetEnumerator () {
1452 return new MyEnumerator(this);
1455 IEnumerator IEnumerable.GetEnumerator () {
1459 public struct MyEnumerator : IEnumerator {
1464 Before, there were a few things we did wrong:
1465 1) we would emit callvirt on a struct, which is illegal
1466 2) we emited ldarg when we needed to emit ldarga
1467 3) we would mistakenly call the interface methods on an enumerator
1468 type that derived from IEnumerator and was in another assembly. For example:
1470 public class MyEnumerator : IEnumerator
1472 Would have the interface methods called, even if there were public impls of the
1473 method. In a struct, this lead to invalid IL code.
1475 2004-02-11 Marek Safar <marek.safar@seznam.cz>
1477 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
1480 * delegate.cs (Define): Fixed crash when delegate type is undefined.
1482 2004-02-11 Miguel de Icaza <miguel@ximian.com>
1484 * cs-parser.jay: Fix small regression: we were not testing V2
1485 compiler features correctly.
1487 * interface.cs: If the emit context is null, then create one
1489 2004-02-09 Marek Safar <marek.safar@seznam.cz>
1491 * decl.cs (GetSignatureForError): New virtual method to get full name
1494 * attribute.cs (IAttributeSupport): New interface for attribute setting.
1495 Now it is possible to rewrite ApplyAttributes method to be less if/else.
1497 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
1498 Duplicated members and code in these classes has been removed.
1499 Better encapsulation in these classes.
1501 2004-02-07 Miguel de Icaza <miguel@ximian.com>
1503 * assign.cs (Assign.DoResolve): When dealing with compound
1504 assignments, there is a new rule in ECMA C# 2.4 (might have been
1505 there before, but it is documented here) that states that in:
1509 If b is of type int, and the `op' is a shift-operator, then the
1510 above is evaluated as:
1514 * expression.cs (Binary.ResolveOperator): Instead of testing for
1515 int/uint/long/ulong, try to implicitly convert to any of those
1516 types and use that in pointer arithmetic.
1518 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
1519 method to print information for from the type, not from the
1520 null-method we were given.
1522 2004-02-01 Duncan Mak <duncan@ximian.com>
1524 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
1525 parsing for cmd, fixes bug #53694.
1527 2004-02-04 Marek Safar <marek.safar@seznam.cz>
1529 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
1530 in the member name duplication tests. Property and operator name duplication
1531 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
1533 2004-02-03 Marek Safar <marek.safar@seznam.cz>
1535 * interface.cs (PopulateMethod): Fixed crash when interface method
1536 returns not existing type (error test cs0246-3.cs).
1538 2004-02-02 Ravi Pratap M <ravi@ximian.com>
1540 * cs-parser.jay (interface_accessors): Re-write actions to also
1541 store attributes attached to get and set methods. Fix spelling
1544 (inteface_property_declaration): Modify accordingly.
1546 (InterfaceAccessorInfo): New helper class to store information to pass
1547 around between rules that use interface_accessors.
1549 * interface.cs (Emit): Apply attributes on the get and set
1550 accessors of properties and indexers too.
1552 * attribute.cs (ApplyAttributes): Modify accordingly to use the
1553 right MethodBuilder when applying attributes to the get and set accessors.
1555 2004-01-31 Miguel de Icaza <miguel@ximian.com>
1557 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
1559 2004-01-26 Miguel de Icaza <miguel@ximian.com>
1561 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
1563 2004-01-25 Miguel de Icaza <miguel@ximian.com>
1565 * cs-parser.jay: Remove YIELD token, instead use the new grammar
1566 changes that treat `yield' specially when present before `break'
1569 * cs-tokenizer.cs: yield is no longer a keyword.
1571 2004-01-23 Marek Safar <marek.safar@seznam.cz>
1573 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
1574 setting for default constructors.
1575 For default constructors are almost every time set wrong Modifier. The
1576 generated IL code has been alright. But inside mcs this values was
1577 wrong and this was reason why several of my CLS Compliance tests
1580 2004-01-22 Martin Baulig <martin@ximian.com>
1582 * cs-parser.jay (namespace_or_type_name): Return an Expression,
1583 not a QualifiedIdentifier. This is what `type_name_expression'
1584 was previously doing.
1585 (type_name_expression): Removed; the code is now in
1586 `namespace_or_type_name'.
1587 (qualified_identifier): Removed, use `namespace_or_type_name'
1589 (QualifiedIdentifier): Removed this class.
1591 2004-01-22 Martin Baulig <martin@ximian.com>
1593 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
1594 not a string as alias name.
1596 2004-01-21 Miguel de Icaza <miguel@ximian.com>
1598 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
1599 #52730 bug, and instead compute correctly the need to use a
1600 temporary variable when requesting an address based on the
1601 static/instace modified of the field and the constructor.
1603 2004-01-21 Martin Baulig <martin@ximian.com>
1605 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
1606 class and namespace before looking up aliases. Fixes #52517.
1608 2004-01-21 Martin Baulig <martin@ximian.com>
1610 * flowanalysis.cs (UsageVector.Merge): Allow variables being
1611 assinged in a 'try'; fixes exception4.cs.
1613 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1614 * class.cs : Implemented parameter-less constructor for TypeContainer
1616 * decl.cs: Attributes are now stored here. New property OptAttributes
1618 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
1620 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
1622 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1624 * typemanager.cs (CSharpSignature): Now reports also inner class name.
1625 (CSharpSignature): New method for indexer and property signature.
1627 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1629 * pending.cs (IsVirtualFilter): Faster implementation.
1631 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1633 * typemanager.cs: Avoid inclusion of same assembly more than once.
1635 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1637 * cs-parser.jay: Fixed problem where the last assembly attribute
1638 has been applied also to following declaration (class, struct, etc.)
1640 2004-01-21 Marek Safar <marek.safar@seznam.cz>
1642 * class.cs: Added error CS0538, CS0539 reporting.
1643 Fixed crash on Microsoft runtime when field type is void.
1645 * cs-parser.jay: Added error CS0537 reporting.
1647 * pending.cs: Added error CS0535 reporting.
1648 Improved error report for errors CS0536, CS0534.
1650 2004-01-20 Miguel de Icaza <miguel@ximian.com>
1652 Merge a few bits from the Anonymous Method MCS tree.
1654 * statement.cs (ToplevelBlock): New class for toplevel methods,
1655 will hold anonymous methods, lifted variables.
1657 * cs-parser.jay: Create toplevel blocks for delegates and for
1658 regular blocks of code.
1660 2004-01-20 Martin Baulig <martin@ximian.com>
1662 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
1663 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
1664 and `NeedExplicitReturn'; added `IsLastStatement'.
1665 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
1666 have a `ReturnLabel' or we're not unreachable.
1668 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
1669 child's reachability; don't just override ours with it. Fixes
1670 #58058 (lluis's example).
1671 (FlowBranching): Added public InTryOrCatch(), InCatch(),
1672 InFinally(), InLoop(), InSwitch() and
1673 BreakCrossesTryCatchBoundary() methods.
1675 * statement.cs (Return): Do all error checking in Resolve().
1676 Unless we are the last statement in a top-level block, always
1677 create a return label and jump to it.
1678 (Break, Continue): Do all error checking in Resolve(); also make
1679 sure we aren't leaving a `finally'.
1680 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
1681 statement in a top-level block.
1682 (Block.Flags): Added `IsDestructor'.
1683 (Block.IsDestructor): New public property.
1685 2004-01-20 Martin Baulig <martin@ximian.com>
1687 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
1689 2004-01-20 Martin Baulig <martin@ximian.com>
1691 * statement.cs (Statement.ResolveUnreachable): New public method.
1692 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
1693 (Block.Resolve): Resolve unreachable statements.
1695 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
1697 * expression.cs: We need to fix the case where we do
1698 not have a temp variable here.
1700 * assign.cs: Only expression compound assignments need
1701 temporary variables.
1703 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
1705 * flowanalysis.cs: Reduce memory allocation in a few ways:
1706 - A block with no variables should not allocate a bit
1708 - A method with no out parameters does not need any tracking
1709 for assignment of the parameters, so we need not allocate
1712 public readonly Type[] VariableTypes;
1713 public readonly string[] VariableNames;
1714 Are redundant. The data is already stored in the variable
1715 map, so we need not allocate another array for it.
1716 - We need to add alot of checks for if (params | locals) == null
1717 due to the first two changes.
1719 2004-01-18 Miguel de Icaza <miguel@ximian.com>
1721 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
1722 implement IMemoryLocation, we store a copy on a local variable and
1723 take the address of it. Patch from Benjamin Jemlich
1725 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
1726 to use a special "type_name_expression" rule which reduces the
1727 number of "QualifiedIdentifier" classes created, and instead
1728 directly creates MemberAccess expressions.
1730 2004-01-17 Miguel de Icaza <miguel@ximian.com>
1732 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
1733 that fixes #52853. Null literal assignment to ValueType
1735 * class.cs (MethodData.Emit): Instead of checking the name of the
1736 method to determine if its a destructor, create a new derived
1737 class from Method called Destructor, and test for that.
1739 * cs-parser.jay: Create a Destructor object instead of a Method.
1741 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
1745 2004-01-16 Miguel de Icaza <miguel@ximian.com>
1747 * expression.cs (Binary.ResolveOperator): Perform an implicit
1748 conversion from MethodGroups to their delegate types on the
1751 * delegate.cs: Introduce a new class DelegateCreation that is the
1752 base class for `NewDelegate' and `ImplicitDelegateCreation',
1753 factor some code in here.
1755 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
1756 conversion from MethodGroups to compatible delegate types.
1758 * ecore.cs (Expression.Resolve): Do not flag error 654
1759 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
1760 we allow conversions from MethodGroups to delegate types now.
1762 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
1763 assignments in v2 either.
1765 2004-01-10 Miguel de Icaza <miguel@ximian.com>
1767 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
1768 static read-only fields in ctors.
1770 Applied patch from Benjamin Jemlich
1772 * expression.cs (UnaryMutator): Avoid leaking local variables.
1774 2004-01-09 Miguel de Icaza <miguel@ximian.com>
1776 * cs-tokenizer.cs (IsCastToken): Allow the various native types
1777 here to return true, as they can be used like this:
1781 Fixed 49836 and all the other dups
1783 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
1785 * driver.cs: Implement /win32res and /win32icon.
1787 2004-01-08 Miguel de Icaza <miguel@ximian.com>
1789 * cs-parser.jay: Add a rule to improve error handling for the
1790 common mistake of placing modifiers after the type.
1792 2004-01-07 Miguel de Icaza <miguel@ximian.com>
1794 * cs-parser.jay (interface_event_declaration): Catch
1795 initialization of events on interfaces, and report cs0068
1797 * cs-parser.jay (interface_event_declaration): Catch
1798 initialization of events.
1800 * ecore.cs: Better report missing constructors.
1802 * expression.cs (Binary.ResolveOperator): My previous bug fix had
1803 the error reporting done in the wrong place. Fix.
1805 * expression.cs (Binary.ResolveOperator): Catch the
1806 operator + (E x, E y) error earlier, and later allow for implicit
1807 conversions in operator +/- (E e, U x) from U to the underlying
1810 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
1811 52596, if the container class is abstract, the default constructor
1812 is protected otherwise its public (before, we were always public).
1814 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
1817 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
1818 Jemlich that fixes bug #52597, MCS was generating invalid code for
1819 idisposable structs. Thanks to Ben for following up with this
1822 2004-01-06 Miguel de Icaza <miguel@ximian.com>
1824 * driver.cs: Allow assemblies without code to be generated, fixes
1827 2004-01-07 Nick Drochak <ndrochak@gol.com>
1829 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
1831 2004-01-05 Miguel de Icaza <miguel@ximian.com>
1833 * cs-parser.jay: Add rules to improve error reporting if fields or
1834 methods are declared at the namespace level (error 116)
1836 * Add rules to catch event add/remove
1838 2004-01-04 David Sheldon <dave-mono@earth.li>
1840 * expression.cs: Added matching ")" to error message for
1843 2004-01-03 Todd Berman <tberman@gentoo.org>
1845 * ecore.cs, attribute.cs:
1846 Applying fix from #52429.
1848 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1850 * ecore.cs, expression.cs, statement.cs:
1851 Total rewrite of how we handle branching. We
1852 now handle complex boolean expressions with fewer
1853 jumps. As well if (x == 0) no longer emits a ceq.
1855 if (x is Foo) is much faster now, because we generate
1858 Overall, we get a pretty big improvement on our benchmark
1859 tests. The code we generate is smaller and more readable.
1861 I did a full two-stage bootstrap. The patch was reviewed
1862 by Martin and Miguel.
1864 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1866 * cs-parser.jay: Make primary_expression not take a QI.
1867 we dont need this because the member_access rule covers
1868 us here. So we replace the rule with just IDENTIFIER.
1870 This has two good effects. First, we remove a s/r conflict.
1871 Second, we allocate many fewer QualifiedIdentifier objects.
1873 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1875 * attribute.cs: Handle MarshalAs attributes as pseudo, and
1876 set the correct information via SRE. This prevents
1877 hanging on the MS runtime. Fixes #29374.
1879 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
1881 * convert.cs: correctly handle conversions to value types
1882 from Enum and ValueType as unboxing conversions.
1884 Fixes bug #52569. Patch by Benjamin Jemlich.
1886 2004-01-02 Ravi Pratap <ravi@ximian.com>
1888 * expression.cs (BetterConversion): Prefer int -> uint
1889 over int -> ulong (csc's behaviour). This fixed bug #52046.
1891 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
1893 * decl.cs (MemberCache.FindMembers): now returns a
1896 * typemanager.cs: In general, go with with ^^.
1897 (CopyNewMethods): take an IList.
1898 (RealMemberLookup): Only allocate an arraylist
1899 if we copy from two sets of methods.
1901 This change basically does two things:
1902 1) Fewer array lists allocated due to CopyNewMethods.
1903 2) the explicit cast in MemberList costed ALOT.
1905 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
1907 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
1908 a hashtable to avoid needless string allocations when an identifier is
1909 used more than once (the common case).
1911 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
1913 * pending.cs: MS's TypeBuilder.GetInterfaces ()
1914 is broken, it will not return anything. So, we
1915 have to use the information we have in mcs to
1918 * typemanager.cs: Add a cache for GetInterfaces,
1919 since this will now be used more often (due to ^^)
1921 (GetExplicitInterfaces) New method that gets the
1922 declared, not effective, interfaces on a type
1923 builder (eg, if you have interface IFoo, interface
1924 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
1927 This patch makes MCS able to bootstrap itself on
1930 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
1932 * expression.cs: Remove the Nop's that Miguel put
1935 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
1937 * report.cs, codegen.cs: Give the real stack trace to
1938 the error when an exception is thrown.
1940 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
1942 * decl.cs: only allocate hashtables for ifaces if
1945 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
1947 * expression.cs: fix the error from cs0121-2.cs
1948 (a parent interface has two child interfaces that
1949 have a function with the same name and 0 params
1950 and the function is called through the parent).
1952 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
1954 * class.cs, rootcontext.cs, typmanager.cs: do not
1957 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
1959 * codegen.cs: remove stack for the ec flow branching.
1960 It is already a linked list, so no need.
1962 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
1964 * Makefile: Allow custom profiler here.
1966 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
1968 * typemanager.cs (LookupType):
1969 - Use a static char [], because split takes
1970 a param array for args, so it was allocating
1972 - Do not store true in a hashtable, it boxes.
1974 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
1976 * flowanalysis.cs: bytify common enums.
1978 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
1980 * modifiers.cs: Add a new set of flags for the
1981 flags allowed on explicit interface impls.
1982 * cs-parser.jay: catch the use of modifiers in
1983 interfaces correctly.
1984 * class.cs: catch private void IFoo.Blah ().
1986 All related to bug #50572.
1988 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
1990 * decl.cs: Rewrite the consistant accessability checking.
1991 Accessability is not linear, it must be implemented in
1992 a tableish way. Fixes #49704.
1994 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
1996 * expression.cs: Handle negation in a checked context.
1997 We must use subtraction from zero. Fixes #38674.
1999 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2001 * class.cs: Ignore static void main in DLLs.
2002 * rootcontext.cs: Handle the target type here,
2003 since we are have to access it from class.cs
2004 * driver.cs: account for the above.
2006 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2008 * report.cs: Give line numbers and files if available.
2010 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
2012 * driver.cs: Implement /addmodule.
2014 * typemanager.cs: Change 'modules' field so it now contains Modules not
2017 2003-12-20 Martin Baulig <martin@ximian.com>
2019 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
2020 (FieldBase.IsAssigned): Removed this field.
2021 (FieldBase.SetAssigned): New public method.
2022 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
2024 2003-12-20 Martin Baulig <martin@ximian.com>
2026 * expression.cs (LocalVariableReference.DoResolve): Don't set
2027 `vi.Used' if we're called from DoResolveLValue().
2029 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
2030 returns the usage vector it just merged into the current one -
2031 pass this one to UsageWarning().
2032 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
2033 of the `EmitContext', don't call this recursively on our children.
2035 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
2037 * driver.cs: Implement /target:module.
2039 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
2041 * support.cs (CharArrayHashtable): New helper class.
2043 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
2044 char arrays, not strings, so we can avoid creating a string in
2045 consume_identifier if the identifier is a keyword.
2047 2003-12-16 Martin Baulig <martin@ximian.com>
2049 * statement.cs (LocalInfo.Assigned): Removed this property.
2050 (LocalInfo.Flags): Removed `Assigned'.
2051 (LocalInfo.IsAssigned): New public method; takes the EmitContext
2052 and uses flow analysis.
2053 (Block.UsageWarning): Made this method private.
2054 (Block.Resolve): Call UsageWarning() if appropriate.
2056 * expression.cs (LocalVariableReference.DoResolve): Always set
2057 LocalInfo.Used here.
2059 2003-12-13 Martin Baulig <martin@ximian.com>
2061 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
2062 any value here; we're now using flow analysis to figure out
2063 whether a statement/block returns a value.
2065 2003-12-13 Martin Baulig <martin@ximian.com>
2067 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
2069 (FlowBranching.MergeFinally): Don't call
2070 `branching.CheckOutParameters()' here, this is called in
2072 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
2073 when adding the `finally' vector.
2075 2003-12-13 Martin Baulig <martin@ximian.com>
2078 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
2079 actually work and also fix #48962.
2081 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
2083 * decl.cs: Do not check System.Object for nested types,
2084 since we know it does not have any. Big bang for buck:
2089 corlib: 17.99 seconds
2093 corlib: 17.39 seconds
2095 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
2097 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
2098 time we are returning 0 members, so we save alot here.
2100 2003-12-11 Martin Baulig <martin@ximian.com>
2102 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
2103 `MergeChild()', also just take the `FlowBranching' as argument;
2104 call Merge() on it and return the result.
2105 (FlowBranching.Merge): We don't need to do anything if we just
2108 2003-12-11 Martin Baulig <martin@ximian.com>
2110 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
2111 them in an `ArrayList' to reduce memory usage. Thanks to Ben
2112 Maurer for this idea.
2114 2003-12-11 Martin Baulig <martin@ximian.com>
2116 * flowanalysis.cs (MergeResult): This class is now gone; we now
2117 use the `UsageVector' for this. The reason for this is that if a
2118 branching just has one sibling, we don't need to "merge" them at
2119 all - that's the next step to do.
2120 (FlowBranching.Merge): We now return a `UsageVector' instead of a
2123 2003-12-11 Martin Baulig <martin@ximian.com>
2125 Reworked flow analyis and made it more precise and bug-free. The
2126 most important change is that we're now using a special `Reachability'
2127 class instead of having "magic" meanings of `FlowReturns'. I'll
2128 do some more cleanups and optimizations and also add some more
2129 documentation this week.
2131 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
2132 largely reworked this class.
2133 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
2134 the new `Reachability' class instead of having "magic" values here.
2135 (FlowBranching): We're now using an instance of `Reachability'
2136 instead of having separate `Returns', `Breaks' etc. fields.
2138 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
2139 based on flow analysis; ignore the return value of block.Emit ().
2141 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
2143 * driver.cs typemanager.cs: Find the mono extensions to corlib even
2144 if they are private.
2146 2003-12-09 Martin Baulig <martin@ximian.com>
2148 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
2149 call them directly on the UsageVector.
2151 2003-12-09 Martin Baulig <martin@ximian.com>
2153 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
2154 Changed return type from `FlowReturns' to `Reachability'.
2156 2003-12-09 Martin Baulig <martin@ximian.com>
2158 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
2159 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
2160 `Reachable' fields with a single `Reachability' one.
2162 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2164 * class.cs (FindMembers): Remove foreach's.
2177 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2182 This patch does a few things:
2183 1. EmptyStatement is now a singleton, so it is never reallocated.
2184 2. All blah is EmptyStatement constructs have been changed to
2185 blah == EmptyStatement.Value, which is much faster and valid
2186 now that EmptyStatement is a singleton.
2187 3. When resolving a block, rather than allocating a new array for
2188 the non-empty statements, empty statements are replaced with
2189 EmptyStatement.Value
2190 4. Some recursive functions have been made non-recursive.
2191 Mainly the performance impact is from (3), however (1) and (2) are needed for
2192 this to work. (4) does not make a big difference in normal situations, however
2193 it makes the profile look saner.
2198 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2199 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2200 Total memory allocated: 56397 KB
2203 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
2204 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
2205 Total memory allocated: 55666 KB
2207 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2209 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
2210 than the hashtable in a hashtable version
2212 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
2213 we always end up concating a string. This results in a huge perf
2214 loss, because many strings have to be tracked by the GC. In this
2215 patch, we first use a hashtable that works with two keys, so that
2216 the strings do not need to be concat'ed.
2227 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2229 * Makefile: Add a new target `do-time' that does a quick and simple
2230 profile, leaving easy to parse output.
2232 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
2234 * codegen.cs (Init): Create the dynamic assembly with
2235 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
2237 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
2239 * support.cs: Make the PtrHashtable use only one
2240 instance of its comparer.
2242 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
2244 * typemanager.cs: Fix lookup of GetNamespaces.
2246 2003-11-29 Miguel de Icaza <miguel@ximian.com>
2248 * expression.cs: Removed redundant line.
2250 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
2251 ArrayLists, use for loops with bounds.
2253 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
2256 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
2257 arraylists, use for loop with bounds.
2259 The above three changes give us a 0.071 second performance
2260 improvement out of 3.294 seconds down to 3.223. On my machine
2261 the above changes reduced the memory usage by 1,387 KB during
2264 * cs-parser.jay (QualifiedIdentifier): New class used to represent
2265 QualifiedIdentifiers. Before we created a new string through
2266 concatenation, and mostly later on, the result would be
2267 manipulated by DecomposeQI through string manipulation.
2269 This reduced the compiler memory usage for bootstrapping from
2270 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
2271 compile times in 0.05 seconds.
2273 2003-11-28 Dick Porter <dick@ximian.com>
2275 * support.cs: Do string compares with the Invariant culture.
2283 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
2284 the comparison is done with the Invariant culture.
2286 2003-11-27 Miguel de Icaza <miguel@ximian.com>
2288 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
2289 GetEnumerator method.
2291 (ProbeCollectionType): Iterate starting at the most specific type
2292 upwards looking for a GetEnumerator
2294 * expression.cs: Shift count can be up to 31 for int/uint and 63
2297 2003-11-26 Miguel de Icaza <miguel@ximian.com>
2299 * statement.cs (Block.LookupLabel): Also look for the label on the
2300 children blocks. Use a hash table to keep track of visited
2303 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
2304 we actually did transform the other operand, otherwise fall back
2305 to the common codepath that casts to long.
2307 * cs-tokenizer.cs: Use the same code pattern as the int case.
2308 Maybe I should do the parsing myself, and avoid depending on the
2309 Parse routines to get this done.
2311 2003-11-25 Miguel de Icaza <miguel@ximian.com>
2313 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2314 which fixes bug 51347. This time test it.
2316 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
2317 attributes for example can not tell the difference between these.
2318 The difference was only a syntax feature of the language.
2320 * attribute.cs: Apply attributes to delegates.
2322 * delegate.cs: Call the apply attributes method.
2324 2003-11-24 Miguel de Icaza <miguel@ximian.com>
2326 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
2327 comparing 0 vs Byte.MinValue, not the value
2329 (ImplicitConversionRequired): When reporting a conversion error,
2330 use error 31 to print out the constant error instead of the
2333 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2334 which fixes bug 51347.
2336 2003-11-22 Miguel de Icaza <miguel@ximian.com>
2338 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
2339 which fixes the -warnaserror command line option.
2341 2003-11-21 Miguel de Icaza <miguel@ximian.com>
2343 * cfold.cs (DoNumericPromotions): During constant folding of
2344 additions on UIntConstant, special case intconstants with
2345 IntConstants like we do on the expression binary operator.
2347 2003-11-12 Miguel de Icaza <miguel@ximian.com>
2349 * convert.cs (ImplicitReferenceConversion): We were missing a case
2350 (System.Enum are not value types or class types, so we need to
2351 classify them separatedly).
2353 * driver.cs: We do not support error 2007.
2355 2003-11-12 Jackson Harper <jackson@ximian.com>
2357 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
2358 system directory. Also use the full file name so users can
2359 libraries names mscorlib-o-tron.dll in a non system dir.
2361 2003-11-10 Martin Baulig <martin@ximian.com>
2363 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
2364 (TypeManager.InitCoreTypes): Initialize them here, but instead of
2365 calling `ResolveType()' on them, directly assign their `Type'.
2367 2003-11-08 Martin Baulig <martin@ximian.com>
2369 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
2370 return value and the `out parent' parameter.
2371 (TypeContainer.DefineType): Moved the CS0644 check into
2372 GetClassBases(). Don't pass the interface types to the
2373 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
2374 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
2376 * ecore.cs (TypeExpr.IsAttribute): New property.
2377 (TypeExpr.GetInterfaces): New method.
2379 * interface.cs (Interface.GetInterfaceTypeByName): Return a
2380 TypeExpr instead of a Type.
2381 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
2382 (Interface.DefineType): Don't pass the interface types to the
2383 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
2384 them later and then call `TypeBulider.AddInterfaceImplementation()'.
2386 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
2387 instead of a `Type[]'.
2388 (TypeManager.RegisterBuilder): Likewise.
2389 (TypeManager.AddUserInterface): Likewise.
2390 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
2391 `Type[]' and also return a `TypeExpr[]'.
2392 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
2394 2003-11-08 Martin Baulig <martin@ximian.com>
2396 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
2399 2003-11-08 Martin Baulig <martin@ximian.com>
2401 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
2402 TypeManager.ResolveExpressionTypes().
2404 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
2405 instead of an Expression.
2406 (TypeExpr): This is now an abstract base class for `TypeExpression'.
2407 (TypeExpression): New public class; formerly known as `TypeExpr'.
2409 * expression.cs (ComposedCast): Derive from TypeExpr.
2411 * typemanager.cs (TypeManager.system_*_expr): These are now
2412 TypExpr's instead of Expression's.
2413 (TypeManager.ResolveExpressionTypes): New public static function;
2414 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
2417 2003-11-06 Miguel de Icaza <miguel@ximian.com>
2419 * expression.cs (New.DoResolve): Do not dereference value that
2420 might be a null return.
2422 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
2423 sure that the constant value has the right type. Fixes an
2424 unreported bug, similar to 50425.
2426 * const.cs (Const.LookupConstantValue): Call
2427 ImplicitStandardConversionExists before doing a conversion to
2428 avoid havng the TypeManager.ChangeType do conversions.
2430 Reduced the number of casts used
2432 (Const.ChangeType): New routine to enable reuse of the constant
2433 type changing code from statement.
2435 * typemanager.cs (ChangeType): Move common initialization to
2436 static global variables.
2440 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
2441 every value type to go through, even if it was void. Fix that.
2443 * cs-tokenizer.cs: Use is_identifier_start_character on the start
2444 character of the define, and the is_identifier_part_character for
2445 the rest of the string.
2447 2003-11-05 Miguel de Icaza <miguel@ximian.com>
2449 * expression.cs (UnaryMutator.EmitCode): When I updated
2450 LocalVariableReference.DoResolve, I overdid it, and dropped an
2451 optimization done on local variable references.
2453 2003-11-04 Miguel de Icaza <miguel@ximian.com>
2455 * ecore.cs: Convert the return from Ldlen into an int.
2457 2003-10-20 Miguel de Icaza <miguel@ximian.com>
2459 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
2460 the accessibility, this is a special case for toplevel non-public
2461 classes (internal for instance).
2463 2003-10-20 Nick Drochak <ndrochak@gol.com>
2465 * ecore.cs: Fix typo and build. Needed another right paren.
2467 2003-10-19 Miguel de Icaza <miguel@ximian.com>
2469 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
2470 `internal' case regular and protected, but not allowing protected
2471 to be evaluated later. Bug 49840
2473 2003-10-15 Miguel de Icaza <miguel@ximian.com>
2475 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
2476 to kb.Nlast, and not the kb.nFirst to isolate the switch
2479 Extract the underlying type, so enumerations of long/ulong are
2480 treated like long/ulong.
2482 2003-10-14 Miguel de Icaza <miguel@ximian.com>
2484 * expression.cs (New): Overload the meaning of RequestedType to
2485 track the possible creation of the NewDelegate type, since
2486 DoResolve is invoked more than once for new constructors on field
2489 See bugs: #48800 and #37014
2491 * cs-parser.jay (declare_local_constants): Take an arraylist
2492 instead of a single constant.
2494 (local_constant_declaration): It should take a
2495 constant_declarators, not a constant_declarator. Fixes 49487
2497 * convert.cs: Fix error report.
2499 2003-10-13 Jackson Harper <jackson@ximian.com>
2501 * typemanager.cs (TypeToCoreType): Add float and double this fixes
2504 2003-10-09 Martin Baulig <martin@ximian.com>
2506 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
2508 (MethodCore.DoDefineParameters): Removed the TypeContainer
2509 argument; use the DeclSpace which was passed to the .ctor instead.
2510 (MethodCore.CheckParameter): Take a DeclSpace instead of a
2511 TypeContainer; we only need a DeclSpace here.
2513 2003-10-09 Martin Baulig <martin@ximian.com>
2515 * class.cs (MethodData): Added additional `DeclSpace ds' argument
2517 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
2518 EmitContext's .ctor.
2520 2003-10-09 Martin Baulig <martin@ximian.com>
2522 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
2523 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
2524 AsAccessible(), moved them as well.
2526 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
2528 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
2530 * cs-parser.jay : Renamed yyName to yyNames related to jay.
2532 2003-10-07 Miguel de Icaza <miguel@ximian.com>
2534 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
2535 generation for >=, as spotted by Paolo, bug 48679.
2536 Patch from David Waite.
2538 * cs-tokenizer.cs: Add handling for #pragma.
2540 * cs-parser.jay: Allow for both yield and yield return in the
2541 syntax. The anti-cobolization of C# fight will go on!
2543 * class.cs (TypeBuilder.DefineType): Catch error condition here
2544 (Parent.DefineType erroring out and returning null).
2546 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2547 coping with enumerations variables, we were mistakenly processing
2548 them as a regular value type instead of built-in types. Fixes the
2551 * typemanager.cs (IsBuiltinOrEnum): New method.
2553 2003-09-30 Miguel de Icaza <miguel@ximian.com>
2555 * cs-parser.jay: Upgrade: yield now needs the return clause.
2557 2003-09-19 Martin Baulig <martin@ximian.com>
2559 * decl.cs (MemberCache.SetupCacheForInterface): Take a
2560 `MemberCache parent' argument. Normally, an interface doesn't
2561 have a parent type except System.Object, but we use this in gmcs
2562 for generic type parameters.
2564 2003-09-18 Martin Baulig <martin@ximian.com>
2566 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
2567 on `type.IsInterface'; don't check whether the type has a parent
2568 to determine whether it's an interface.
2570 2003-09-15 Martin Baulig <martin@ximian.com>
2572 * class.cs (TypeContainer.DefineType): Added an error flag to
2573 avoid reporting duplicate CS0146's ("class definition is
2576 * driver.cs (Driver.MainDriver): Abort if
2577 RootContext.ResolveTree() reported any errors.
2579 2003-09-07 Martin Baulig <martin@ximian.com>
2581 * report.cs (Error, Warning): Added overloaded versions which take
2582 a `params object[] args' and call String.Format().
2584 2003-09-07 Martin Baulig <martin@ximian.com>
2586 * decl.cs (DeclSpace..ctor): Don't call
2587 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2588 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
2589 (DeclSpace.RecordDecl): New method.
2591 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2593 2003-09-02 Ravi Pratap <ravi@ximian.com>
2595 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2596 value attributes to be applied to ParameterBuilders.
2598 * class.cs (MethodCore.LabelParameters): Make static and more
2599 generic so that it can be used from other places - like interface
2600 methods, for instance.
2602 * interface.cs (Interface.Emit): Call LabelParameters before
2603 emitting attributes on the InterfaceMethod.
2605 2003-08-26 Martin Baulig <martin@ximian.com>
2607 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2608 resolving aliases; fixes #47927.
2610 2003-08-26 Martin Baulig <martin@ximian.com>
2612 * statement.cs (Using.DoResolve): This is internally emitting a
2613 try/finally clause, so we need to set ec.NeedExplicitReturn if we
2614 do not always return. Fixes #47681.
2616 2003-08-26 Martin Baulig <martin@ximian.com>
2618 * decl.cs (MemberCore): Moved WarningNotHiding(),
2619 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2621 (AdditionResult): Make this nested in DeclSpace.
2622 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2623 argument; call NamespaceEntry.Define() unless we're nested in a
2626 * namespace.cs (Namespace.DefineName): New public function. This
2627 is called from DeclSpace's .ctor to add
2628 (Namespace.Lookup): Include DeclSpaces in the lookup.
2630 * class.cs (Operator): Derive from MemberBase, not MemberCore.
2632 * const.cs (Const): Derive from MemberBase, not MemberCore.
2634 2003-08-25 Martin Baulig <martin@ximian.com>
2636 * convert.cs (Convert.ExplicitReferenceConversion): When
2637 converting from an interface type to a class, unbox if the target
2638 type is a struct type. Fixes #47822.
2640 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2642 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2645 2003-08-22 Martin Baulig <martin@ximian.com>
2647 * class.cs (TypeManager.DefineType): When defining a nested type,
2648 call DefineType() on our parent; fixes #47801.
2650 2003-08-22 Martin Baulig <martin@ximian.com>
2652 * class.cs (MethodData.Define): While checking if a method is an
2653 interface implementation, improve the test a bit more to fix #47654.
2655 2003-08-22 Martin Baulig <martin@ximian.com>
2657 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2658 correctly; fixes #47722.
2660 2003-08-22 Martin Baulig <martin@ximian.com>
2662 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2663 LocalVariableReference, ensure it's not read-only. Fixes #47536.
2665 * statement.cs (Fixed.DoResolve): Make all variables read-only.
2667 2003-08-22 Martin Baulig <martin@ximian.com>
2669 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2670 can only be assigned in static constructors. Fixes #47161.
2672 2003-08-22 Martin Baulig <martin@ximian.com>
2674 Rewrote and improved the flow analysis code.
2676 * flowbranching.cs (FlowBranching): Make this class abstract.
2677 (FlowBranching.CreateBranching): New static function to create a
2679 (FlowBranchingBlock, FlowBranchingException): New classes.
2680 (FlowBranching.UsageVector.Type): New public readonly field.
2681 (FlowBranching.UsageVector.Breaks): Removed the setter.
2682 (FlowBranching.UsageVector.Returns): Removed the setter.
2683 (FlowBranching.UsageVector): Added Break(), Return(),
2684 NeverReachable() and Throw() methods to modify the reachability.
2685 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2686 done by FlowBranching.Merge().
2687 (FlowBranching.UsageVector.MergeChild): New method; merges the
2688 merge result into the current vector.
2689 (FlowBranching.Merge): New abstract method to merge a branching.
2691 2003-08-12 Martin Baulig <martin@ximian.com>
2693 * expression.cs (Indirection.CacheTemporaries): Create the
2694 LocalTemporary with the pointer type, not its element type.
2696 2003-08-10 Miguel de Icaza <miguel@ximian.com>
2698 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2699 token was a keyword or not.
2701 Add `error' options where an IDENTIFIER was expected; Provide
2702 CheckToken and CheckIdentifierToken convenience error reporting
2705 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2707 * decl.cs: Rename `NamespaceEntry Namespace' public field into
2708 NameSpaceEntry NameSpaceEntry.
2710 (LookupInterfaceOrClass): Avoid creating a full qualified name
2711 from namespace and name: avoid doing lookups when we know the
2712 namespace is non-existant. Use new Tree.LookupByNamespace which
2713 looks up DeclSpaces based on their namespace, name pair.
2715 * driver.cs: Provide a new `parser verbose' to display the
2716 exception thrown during parsing. This is turned off by default
2717 now, so the output of a failure from mcs is more graceful.
2719 * namespace.cs: Track all the namespaces defined in a hashtable
2722 (IsNamespace): New method
2724 2003-08-09 Miguel de Icaza <miguel@ximian.com>
2726 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
2727 we know that we need to concatenate (full typename can never be
2732 * statement.cs: Use a bitfield; Do not initialize to null things
2733 which are done by the constructor by default.
2735 * cs-parser.jay: bug fix, parameter was 4, not 3.
2737 * expression.cs: Just use the property;
2739 * statement.cs: No need for GetVariableInfo method.
2741 2003-08-08 Martin Baulig <martin@ximian.com>
2743 * flowanalysis.cs (FlowReturns): This is now nested in the
2744 `FlowBranching' class.
2745 (MyBitVector): Moved this here from statement.cs.
2746 (FlowBranching.SiblingType): New enum type.
2747 (FlowBranching.CreateSibling): Added `SiblingType' argument.
2749 2003-08-07 Martin Baulig <martin@ximian.com>
2751 * flowanalysis.cs (FlowBranchingType): This is now nested in the
2752 `FlowBranching' class and called `BranchingType'.
2754 2003-08-07 Martin Baulig <martin@ximian.com>
2756 * flowanalysis.cs: Moved all the control flow analysis code into
2759 2003-08-07 Martin Baulig <martin@ximian.com>
2761 * assign.cs (Assign.DoResolve): `target' must either be an
2762 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
2765 2003-08-07 Miguel de Icaza <miguel@ximian.com>
2767 * expression.cs (BinaryMethod): This kind of expression is created by the
2768 Binary class if it determines that the operator has to be handled
2771 (BinaryDelegate): This kind of expression is created if we are
2772 dealing with a + or - operator on delegates.
2774 (Binary): remove method, argumetns, and DelegateOperator: when
2775 dealing with methods,
2777 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
2779 * statement.cs (Block): use bitfields for the three extra booleans
2780 we had in use. Remove unused topblock parameter.
2782 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
2784 * assign.cs: Drop extra unneeded tests.
2786 2003-08-06 Miguel de Icaza <miguel@ximian.com>
2788 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
2790 * statement.cs (Foreach): Use VariableStorage instead of
2793 * codegen.cs (VariableStorage): New class used by clients that
2794 require a variable stored: locals or fields for variables that
2795 need to live across yield.
2797 Maybe provide a convenience api for EmitThis+EmitLoad?
2799 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
2802 2003-08-05 Miguel de Icaza <miguel@ximian.com>
2804 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
2805 RemapParameterLValue): New methods that are used to turn a
2806 precomputed FieldInfo into an expression like this:
2810 The idea is to use this instead of making LocalVariableReference
2811 have more than one meaning.
2813 * cs-parser.jay: Add error production to BASE.
2815 * ecore.cs: Deal with TypeManager.GetField returning null, which
2816 is now a valid return value.
2818 (FieldExprNoAddress): New expression for Fields whose address can
2821 * expression.cs (LocalVariableReference): During the resolve
2822 phases, create new expressions if we are in a remapping context.
2823 Remove code that dealt with remapping here.
2825 (ParameterReference): same.
2827 (ProxyInstance): New expression, like the `This' expression, but
2828 it is born fully resolved. We know what we are doing, so remove
2829 the errors that are targeted to user-provided uses of `this'.
2831 * statement.cs (Foreach): our variable is now stored as an
2832 Expression; During resolution, follow the protocol, dont just
2833 assume it will return this.
2835 2003-08-06 Martin Baulig <martin@ximian.com>
2837 * support.cs (SeekableStreamReader.cs): New public class.
2839 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
2840 SeekableStreamReader instead of the normal StreamReader.
2842 2003-08-04 Martin Baulig <martin@ximian.com>
2844 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
2845 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
2846 deambiguate casts and delegate invocations.
2847 (parenthesized_expression): Use the new tokens to ensure this is
2848 not a cast of method invocation.
2850 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
2851 when reading a `)' and Deambiguate_CloseParens () was previously
2854 * expression.cs (ParenthesizedExpression): New class. This is
2855 just used for the CS0075 test.
2856 (Binary.DoResolve): Check for CS0075.
2858 2003-07-29 Ravi Pratap <ravi@ximian.com>
2860 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
2861 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
2862 reference comparison.
2864 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
2865 examine the ReturnType for equality - this is necessary in the
2866 cases of implicit and explicit operators whose signature also
2867 includes the return type.
2869 2003-07-26 Miguel de Icaza <miguel@ximian.com>
2871 * namespace.cs: Cache the result of the namespace computation,
2872 instead of computing it every time.
2874 2003-07-24 Miguel de Icaza <miguel@ximian.com>
2876 * decl.cs: Use a global arraylist that we reuse over invocations
2877 to avoid excesive memory consumption. Reduces memory usage on an
2878 mcs compile by one meg (45 average).
2880 * typemanager.cs (LookupTypeReflection): In .NET pointers are
2881 private, work around that.
2883 2003-07-23 Miguel de Icaza <miguel@ximian.com>
2885 * literal.cs (IntLiteral): Define Zero and One static literals.
2887 * cs-parser.jay (integer_literal): use static literals to reduce
2888 memory usage for the most used literals (0, 1 and -1). 211kb
2889 reduced in memory usage.
2891 Replace all calls to `new ArrayList' with `new
2892 ArrayList(4)' which is a good average number for most allocations,
2893 and also requires only 16 bytes of memory for its buffer by
2896 This reduced MCS memory usage in seven megabytes for the RSS after
2899 2003-07-28 Ravi Pratap <ravi@ximian.com>
2901 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
2902 handle params methods the correct way by forming only one
2903 applicable set with params and normal methods in them. Earlier we
2904 were looking at params methods only if we found no normal methods
2905 which was not the correct thing to do.
2907 (Invocation.BetterFunction): Take separate arguments indicating
2908 when candidate and the best method are params methods in their
2911 This fixes bugs #43367 and #46199.
2913 * attribute.cs: Documentation updates.
2915 (CheckAttribute): Rename to CheckAttributeTarget.
2916 (GetValidPlaces): Rename to GetValidTargets.
2918 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
2919 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
2923 2003-07-28 Martin Baulig <martin@ximian.com>
2925 * class.cs (TypeContainer.DefineMembers): Use the base type's full
2926 name when looking up the base class of a nested class. Fixes #46977.
2928 2003-07-26 Martin Baulig <martin@ximian.com>
2930 * expression.cs (Indexers.Indexer): New nested struct; contains
2931 getter, setter and the indexer's type.
2932 (Indexers.Properties): This is now an ArrayList of
2934 (IndexerAccess.DoResolveLValue): Correctly set the type if the
2935 indexer doesn't have any getters.
2937 * assign.cs (Assign.DoResolve): Also do the implicit conversions
2938 for embedded property and indexer assignments.
2940 2003-07-26 Martin Baulig <martin@ximian.com>
2942 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
2943 preprocessor directive is not the first non-whitespace character
2946 2003-07-26 Martin Baulig <martin@ximian.com>
2948 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
2949 namespace parsing, follow the spec more closely.
2951 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
2952 NamespaceEntry.Lookup().
2954 2003-07-25 Martin Baulig <martin@ximian.com>
2956 * MethodCore.cs (OverridesSomething): New public field; it's set
2957 from TypeContainer.DefineMembers if this method overrides
2958 something (which doesn't need to be a method). Fix #39462.
2960 2003-07-25 Ravi Pratap <ravi@ximian.com>
2962 * typemanager.cs (GetMembers): Ensure that the list of members is
2963 reversed. This keeps things in sync.
2965 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
2966 find an AttributeUsage attribute.
2968 * expression.cs (Invocation.OverloadResolve): Perform the check
2969 which disallows Invoke to be directly called on a Delegate.
2971 (Error_InvokeOnDelegate): Report error cs1533.
2973 2003-07-25 Martin Baulig <martin@ximian.com>
2975 * expression.cs (Indexers.GetIndexersForType): Only look in the
2976 interface hierarchy if the requested type is already an
2977 interface. Fixes #46788 while keeping #46502 fixed.
2979 2003-07-25 Martin Baulig <martin@ximian.com>
2981 * class.cs (TypeContainer.DefineMembers): Check whether all
2982 readonly fields have been assigned and report warning CS0649 if
2985 * statement.cs (LocalInfo.IsFixed): Always return true if this is
2988 2003-07-24 Ravi Pratap <ravi@ximian.com>
2990 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
2991 returned from GetMethods to make things consistent with the
2992 assumptions MCS makes about ordering of methods.
2994 This should comprehensively fix bug #45127 and it does :-)
2996 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
2997 ordering is actually reverse.
2999 * Clean up some debug messages I left lying around.
3001 * interface.cs (Populate*): Get rid of code which emits attributes
3002 since the stage in which we emit attributes is the 'Emit' stage,
3003 not the define stage.
3005 (Emit): Move attribute emission for interface members here.
3007 2003-07-22 Ravi Pratap <ravi@ximian.com>
3009 * expression.cs (Invocation.OverloadResolve): Follow the spec more
3010 closely: we eliminate methods in base types when we have an
3011 applicable method in a top-level type.
3013 Please see section 14.5.5.1 for an exact description of what goes
3016 This fixes bug #45127 and a host of other related to corlib compilation.
3018 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
3019 array is the method corresponding to the top-level type (this is
3020 because of the changes made to icall.c) so we change this
3023 (MethodGroupExpr.Name): This too.
3025 * typemanager.cs (GetElementType): New method which does the right
3026 thing when compiling corlib.
3028 * everywhere: Make use of the above in the relevant places.
3030 2003-07-22 Martin Baulig <martin@ximian.com>
3032 * cs-parser.jay (invocation_expression): Moved
3033 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
3034 `cast_expression', but create a InvocationOrCast which later
3035 resolves to either an Invocation or a Cast.
3037 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
3038 method; call this before EmitStatement() to make sure that this
3039 expression can be used as a statement.
3041 * expression.cs (InvocationOrCast): New class; resolves to either
3042 an Invocation or a Cast.
3044 * statement.cs (StatementExpression): Call ResolveStatement() on
3045 the ExpressionStatement before emitting it.
3047 2003-07-21 Martin Baulig <martin@ximian.com>
3049 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
3050 `ref' and `out' attributes match; fixes #46220.
3051 (MemberAccess.ResolveMemberAccess): You can't reference a type
3052 through an expression; fixes #33180.
3053 (Indexers.GetIndexersForType): Don't return the indexers from
3054 interfaces the class implements; fixes #46502.
3056 2003-07-21 Martin Baulig <martin@ximian.com>
3058 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
3059 CS0661 checks; fixes bug #30442.
3061 2003-07-21 Martin Baulig <martin@ximian.com>
3063 * decl.cs (AdditionResult): Added `Error'.
3065 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
3067 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
3068 makes cs0031.cs actually work.
3070 2003-07-20 Martin Baulig <martin@ximian.com>
3072 * namespace.cs: Fixed that bug which caused a crash when compiling
3075 2003-07-20 Miguel de Icaza <miguel@ximian.com>
3077 * typemanager.cs (LookupTypeReflection): Never expose types which
3078 are NotPublic, NestedPrivate, NestedAssembly, or
3079 NestedFamANDAssem. We used to return these, and later do a check
3080 that would report a meaningful error, but the problem is that we
3081 would not get the real match, if there was a name override.
3083 2003-07-18 Miguel de Icaza <miguel@ximian.com>
3085 * namespace.cs (Namespace, Name): Do not compute the namespace
3086 name dynamically, compute it in the constructor. This reduced
3087 memory usage by 1697 KB.
3089 * driver.cs: Use --pause to pause at the end.
3091 2003-07-17 Peter Williams <peter@newton.cx>
3093 * Makefile: Change the name of the test target so that it doesn't
3094 conflict with the recursive test target.
3096 2003-07-17 Miguel de Icaza <miguel@ximian.com>
3098 * expression.cs (LocalVariableReference.Emit, EmitAssign,
3099 AddressOf): Do not use EmitThis, that was wrong, use the actual
3102 2003-07-15 Miguel de Icaza <miguel@ximian.com>
3104 * class.cs (MethodData.Define): While checking if a method is an
3105 interface implementation, improve the test: If we are not public
3106 (use new test here: use the computed MethodAttributes directly,
3107 instead of the parsed modifier flags) check if the `implementing'
3108 method comes from an interface or not.
3110 * pending.cs (VerifyPendingMethods): Slightly better error
3113 * makefile: add test target that does the mcs bootstrap.
3115 2003-07-16 Ravi Pratap <ravi@ximian.com>
3117 * interface.cs (Define): Do nothing here since there are no
3118 members to populate etc. Move the attribute emission out of here
3119 since this was just totally the wrong place to put it. Attribute
3120 application happens during the 'Emit' phase, not in the 'Define'
3123 (Emit): Add this method and move the attribute emission here
3125 * rootcontext.cs (EmitCode): Call the Emit method on interface
3128 2003-07-14 Ravi Pratap M <ravi@ximian.com>
3130 * expression.cs (OverloadResolve): Report error only if Location
3131 is not 'Null' which means that there was a probe going on.
3133 2003-07-14 Martin Baulig <martin@ximian.com>
3135 * expression.cs (ConditionalLogicalOperator): New public class to
3136 implement user defined conditional logical operators.
3137 This is section 14.11.2 in the spec and bug #40505.
3139 2003-07-14 Martin Baulig <martin@ximian.com>
3141 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
3143 2003-07-14 Martin Baulig <martin@ximian.com>
3145 * codegen.cs (EmitContext.InFixedInitializer): New public field.
3147 * ecore.cs (IVariable.VerifyFixed): New interface method.
3149 * expression.cs (Unary.ResolveOperator): When resolving the `&'
3150 operator, check whether the variable is actually fixed. Fixes bug
3151 #36055. Set a variable definitely assigned when taking its
3152 address as required by the spec.
3154 * statement.cs (LocalInfo.IsFixed): New field.
3155 (LocalInfo.MakePinned): Set `IsFixed' to true.
3157 2003-07-14 Ravi Pratap M <ravi@ximian.com>
3159 * attribute.cs (Attribute.Resolve): While doing a Member lookup
3160 for .ctors, ensure that we only ask for members declared in the
3161 attribute type (BindingFlags.DeclaredOnly).
3165 * expression.cs (Error_WrongNumArguments): Report error 1501
3166 correctly the way CSC does.
3168 2003-07-13 Martin Baulig <martin@ximian.com>
3170 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
3171 lookup on the fully qualified name, to make things like "X.X" work
3172 where "X.X" is a fully qualified type name, but we also have a
3173 namespace "X" in the using list. Fixes #41975.
3175 2003-07-13 Martin Baulig <martin@ximian.com>
3177 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
3178 function. If we're a CompoundAssign, we need to create an embedded
3179 CompoundAssign, not an embedded Assign.
3180 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
3183 2003-07-13 Martin Baulig <martin@ximian.com>
3185 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
3186 work to fix bug #46088.
3188 2003-07-13 Ravi Pratap <ravi@ximian.com>
3190 * class.cs (Operator.Emit): Do not emit attributes here - it is
3191 taken care of by the Method class that we delegate too. This takes
3194 2003-07-10 Martin Baulig <martin@ximian.com>
3196 * expression.cs (TypeOfVoid): New class.
3197 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
3199 2003-07-10 Martin Baulig <martin@ximian.com>
3201 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
3204 2003-07-10 Martin Baulig <martin@ximian.com>
3206 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
3207 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
3209 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
3211 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
3213 2003-07-10 Martin Baulig <martin@ximian.com>
3215 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
3216 of decimal. Fixes #42850.
3218 NOTE: I also fixed the created byte blob, but this doesn't work on
3219 the MS runtime and csc never produces any byte blobs for decimal
3222 2003-07-10 Martin Baulig <martin@ximian.com>
3224 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
3225 structs; fixes #32068.
3226 (Block.AddChildVariableNames): Fixed #44302.
3228 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3230 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
3232 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3234 * attribute.cs: And this test is onger needed.
3236 2003-07-08 Martin Baulig <martin@ximian.com>
3238 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
3239 inaccessible types. Fixes #36313.
3241 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
3243 * namespace.cs (NamespaceEntry): Create implicit entries for all
3244 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
3245 implicit entries for N1.N2 and N1.
3247 2003-07-08 Martin Baulig <martin@ximian.com>
3249 Rewrote the handling of namespaces to fix a lot of the issues
3250 wrt. `using' aliases etc.
3252 * namespace.cs (Namespace): Splitted this class into a
3253 per-assembly `Namespace' and a per-file `NamespaceEntry'.
3255 * typemanager.cs (TypeManager.IsNamespace): Removed.
3256 (TypeManager.ComputeNamespaces): Only compute namespaces from
3257 loaded assemblies here, not the namespaces from the assembly we're
3258 currently compiling.
3260 2003-07-08 Martin Baulig <martin@ximian.com>
3262 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
3264 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3266 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
3269 I thought about the memory savings here, but LookupTypeReflection
3270 is used under already very constrained scenarios. Compiling
3271 corlib or mcs only exposes one hit, so it would not really reduce
3272 any memory consumption.
3274 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3276 * typemanager.cs: fixes bug #45889 by only adding public types from
3277 other assemblies to the list of known types.
3279 2003-07-07 Miguel de Icaza <miguel@ximian.com>
3281 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
3282 on the type we resolved.
3284 2003-07-05 Martin Baulig <martin@ximian.com>
3286 * pending.cs (PendingImplementation.ParentImplements): Don't
3287 create the proxy if the parent is abstract.
3289 * class.cs (TypeContainer.DefineIndexers): Process explicit
3290 interface implementations first. Fixes #37714.
3292 2003-07-04 Miguel de Icaza <miguel@ximian.com>
3294 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
3295 defined recursively; but since we modify the input parameters
3296 (left is set to `this' temporarily), we reset this value if the
3297 left_is_explicit is false, which gives the original semantics to
3300 * literal.cs (NullPointer): new class used to represent a null
3301 literal in a pointer context.
3303 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
3304 type is a pointer, use a NullPointer object instead of a
3305 NullLiteral. Closes 43687
3307 (ExplicitConversion): Convert pointer values using
3308 the conv opcode to the proper type.
3310 * ecore.cs (New): change ValueTypeVariable property into a method,
3311 that returns whether the valuetype is suitable for being used.
3313 * expression.cs (Binary.DoNumericPromotions): Only return if we
3314 the int constant was a valid uint, and we can return both left and
3315 right as uints. If not, we continue processing, to trigger the
3316 type conversion. This fixes 39018.
3318 * statement.cs (Block.EmitMeta): During constant resolution, set
3319 the CurrentBlock property on the emitcontext, so that we resolve
3320 constants propertly.
3322 2003-07-02 Martin Baulig <martin@ximian.com>
3324 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
3325 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
3327 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
3328 than emitting it here.
3330 * statement.cs: Fixed some more flow analysis bugs.
3332 2003-07-02 Martin Baulig <martin@ximian.com>
3334 * class.cs (MethodData.Define): When implementing interface
3335 methods, set Final unless we're Virtual.
3337 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
3338 check work for interface methods.
3340 2003-07-01 Martin Baulig <martin@ximian.com>
3342 * ecore.cs (EmitContext.This): Replaced this property with a
3343 GetThis() method which takes a Location argument. This ensures
3344 that we get the correct error location for a CS0188.
3346 2003-07-01 Miguel de Icaza <miguel@ximian.com>
3348 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
3349 ImplicitStandardConversion.
3351 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
3353 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
3355 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
3358 2003-06-30 Miguel de Icaza <miguel@ximian.com>
3360 * class.cs (Constructor.Define): Turn off initlocals for unsafe
3363 (MethodData.Define): Turn off initlocals for unsafe methods.
3365 2003-06-29 Miguel de Icaza <miguel@ximian.com>
3367 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
3368 complete; Fixes #37521.
3370 * delegate.cs: Use Modifiers.TypeAttr to compute the
3371 TypeAttributes, instead of rolling our own. This makes the flags
3372 correct for the delegates.
3374 2003-06-28 Miguel de Icaza <miguel@ximian.com>
3376 * class.cs (Constructor.Define): Set the private flag for static
3377 constructors as well.
3379 * cs-parser.jay (statement_expression): Set the return value to
3380 null, to avoid a crash when we catch an error.
3382 2003-06-24 Miguel de Icaza <miguel@ximian.com>
3384 * cs-parser.jay: Applied patch from Jackson that adds support for
3385 extern and unsafe modifiers to destructor declarations.
3387 * expression.cs: Report error 21 if the user is trying to index a
3390 * driver.cs: Add an error message, suggested by the bug report.
3392 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
3393 if we do not have a ": this ()" constructor initializer. Fixes 45149
3395 2003-06-14 Miguel de Icaza <miguel@ximian.com>
3397 * namespace.cs: Add some information to reduce FAQs.
3399 2003-06-13 Miguel de Icaza <miguel@ximian.com>
3401 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
3402 underlying enumeration types. Fixes #43915.
3404 * expression.cs: Treat ushort/short as legal values to be used in
3407 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
3409 * delegate.cs: transfer custom attributes for paramenters from
3410 the delegate declaration to Invoke and BeginInvoke.
3412 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
3414 * attribute.cs: handle custom marshalers and emit marshal info
3417 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
3419 * makefile.gnu: Added anonymous.cs to the compiler sources.
3421 2003-05-28 Miguel de Icaza <miguel@ximian.com>
3423 * iterators.cs: Change the name of the proxy class to include two
3426 * cs-parser.jay: Update grammar to include anonymous methods.
3428 * anonymous.cs: new file.
3430 2003-05-27 Miguel de Icaza <miguel@ximian.com>
3432 * class.cs (Field.Define): Add missing test for pointers and
3435 2003-05-27 Ravi Pratap <ravi@ximian.com>
3437 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
3438 we use the stobj opcode.
3440 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
3441 since it wasn't the correct fix.
3443 It still is puzzling that we are required to use stobj for IntPtr
3444 which seems to be a ValueType.
3446 2003-05-26 Miguel de Icaza <miguel@ximian.com>
3448 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
3449 during regular simple name resolution. Now, the trick is that
3450 instead of returning for processing the simplename, we do a
3451 TypeManager.LookupType (ie, a rooted lookup as opposed to a
3452 contextual lookup type). If a match is found, return that, if
3453 not, return for further composition.
3455 This fixes long-standing 30485.
3457 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3458 using the address to initialize an object, do an Stobj instead of
3459 using the regular Stelem.
3461 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
3462 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
3463 Because if we are a BaseIndexerAccess that value will be true.
3466 * statement.cs (GotoCase.Resolve): Return after reporting an
3467 error, do not attempt to continue.
3469 * expression.cs (PointerArithmetic.Emit): If our operand is a
3470 long, convert our constants to match the operand before
3471 multiplying. Convert to I type before adding. Fixes 43670.
3473 2003-05-14 Ravi Pratap <ravi@ximian.com>
3475 * enum.cs (ImplicitConversionExists) : Rename to
3476 ImplicitEnumConversionExists to remove ambiguity.
3478 * ecore.cs (NullCast): New type of cast expression class which
3479 basically is very similar to EmptyCast with the difference being
3480 it still is a constant since it is used only to cast a null to
3484 * convert.cs (ImplicitReferenceConversion): When casting a null
3485 literal, we return a NullCast.
3487 * literal.cs (NullLiteralTyped): Remove - I don't see why this
3488 should be around anymore.
3490 The renaming (reported was slightly wrong). Corrections:
3492 ConvertImplicitStandard -> ImplicitConversionStandard
3493 ConvertExplicitStandard -> ExplicitConversionStandard
3495 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3496 before passing them in !
3498 * convert.cs (ImplicitConversionStandard): When comparing for
3499 equal expr and target types, ensure that expr is not a
3502 In general, we must not be checking (expr_type ==
3503 target_type) in the top level conversion methods
3504 (ImplicitConversion, ExplicitConversion etc). This checking is
3505 done in the methods that they delegate to.
3507 2003-05-20 Miguel de Icaza <miguel@ximian.com>
3509 * convert.cs: Move Error_CannotConvertType,
3510 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3511 ImplicitNumericConversion, ImplicitConversionExists,
3512 ImplicitUserConversionExists, StandardConversionExists,
3513 FindMostEncompassedType, FindMostSpecificSource,
3514 FindMostSpecificTarget, ImplicitUserConversion,
3515 ExplicitUserConversion, GetConversionOperators,
3516 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3517 TryImplicitIntConversion, Error_CannotConvertImplicit,
3518 ConvertImplicitRequired, ConvertNumericExplicit,
3519 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3520 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3523 Perform the following renames:
3525 StandardConversionExists -> ImplicitStandardConversionExists
3526 ConvertImplicit -> ImplicitConversion
3527 ConvertImplicitStandard -> ImplicitStandardConversion
3528 TryImplicitIntConversion -> ImplicitIntConversion
3529 ConvertImplicitRequired -> ImplicitConversionRequired
3530 ConvertNumericExplicit -> ExplicitNumericConversion
3531 ConvertReferenceExplicit -> ExplicitReferenceConversion
3532 ConvertExplicit -> ExplicitConversion
3533 ConvertExplicitStandard -> ExplicitStandardConversion
3535 2003-05-19 Martin Baulig <martin@ximian.com>
3537 * statement.cs (TypeInfo.StructInfo): Made this type protected.
3538 (TypeInfo): Added support for structs having structs as fields.
3540 * ecore.cs (FieldExpr): Implement IVariable.
3541 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3542 VariableInfo for the field.
3544 2003-05-18 Martin Baulig <martin@ximian.com>
3546 * expression.cs (This.DoResolve): Report a CS0027 if we're
3547 emitting a field initializer.
3549 2003-05-18 Martin Baulig <martin@ximian.com>
3551 * expression.cs (This.ResolveBase): New public function.
3552 (This.DoResolve): Check for CS0188.
3554 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3557 * ecore.cs (MethodGroupExpr.DoResolve): Set the
3558 `instance_expression' to null if we don't have any non-static
3561 2003-05-18 Martin Baulig <martin@ximian.com>
3563 Reworked the way how local variables and parameters are handled by
3564 the flow analysis code.
3566 * statement.cs (TypeInfo, VariableMap): New public classes.
3567 (VariableInfo): New public class. This is now responsible for
3568 checking whether a variable has been assigned. It is used for
3569 parameters and local variables.
3570 (Block.EmitMeta): Take the InternalParameters as argument; compute
3571 the layout of the flow vectors here.
3572 (Block.LocalMap, Block.ParameterMap): New public properties.
3573 (FlowBranching): The .ctor doesn't get the InternalParameters
3574 anymore since Block.EmitMeta() now computes the layout of the flow
3576 (MyStructInfo): This class is now known as `StructInfo' and nested
3577 in `TypeInfo'; we don't access this directly anymore.
3579 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3580 property and removed IsAssigned(), IsFieldAssigned(),
3581 SetAssigned() and SetFieldAssigned(); we now call them on the
3582 VariableInfo so we don't need to duplicate this code everywhere.
3584 * expression.cs (ParameterReference): Added `Block block' argument
3586 (LocalVariableReference, ParameterReference, This): The new
3587 VariableInfo class is now responsible for all the definite
3590 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3591 IsParameterAssigned, SetParameterAssigned): Removed.
3593 2003-05-18 Martin Baulig <martin@ximian.com>
3595 * typemanager.cs (InitCoreTypes): Try calling
3596 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3597 the 3-args-version. Corlib now also needs our `void_type'.
3598 (GetMethod): Added overloaded version which takes an optional
3599 `bool report_errors' to allow lookups of optional methods.
3601 2003-05-12 Martin Baulig <martin@ximian.com>
3603 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3604 only used for locals and not for parameters.
3606 2003-05-12 Miguel de Icaza <miguel@ximian.com>
3608 * support.cs (InternalParameters.ParameterType): Return the
3609 ExternalType of the parameter.
3611 * parameter.cs (Parameter.ExternalType): drop the two arguments,
3614 2003-05-11 Miguel de Icaza <miguel@ximian.com>
3616 * class.cs (MethodData.Define): Do not set the `newslot' on
3617 interface members, if they are also flagged as "override".
3619 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3620 better code for ++i and i++. This only works for static fields
3621 and local variables.
3623 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3624 want to pull the DeclSpace out of the builder_to_declspace instead
3625 of the TypeBuilder (like in TypeContainer.FindMembers).
3627 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3628 instead of LookupTypeContainer. Fixes the crash on .NET for
3629 looking up interface members.
3631 * const.cs: Create our own emit context during the Definition
3632 stage, so that constants are evaluated in the proper context, when
3633 a recursive definition happens.
3635 2003-05-11 Martin Baulig <martin@ximian.com>
3637 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
3638 new block for a switch section.
3639 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3640 the adding/lookup in the switch block. Fixes #39828.
3642 2003-05-09 Miguel de Icaza <miguel@ximian.com>
3644 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3645 functionality: I needed to convert the data after I had performed
3646 the add/sub operation into the operands type size.
3648 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3649 pass the type for the box operation, otherwise the resulting
3650 object would have been of type object.
3652 (BoxedCast): Add constructor to specify the type to box as.
3654 2003-05-07 Miguel de Icaza <miguel@ximian.com>
3656 * iterators.cs: I was reusing the `count' variable inadvertently,
3657 take steps to not allow this to happen.
3659 2003-05-06 Miguel de Icaza <miguel@ximian.com>
3661 * attribute.cs (Attribute.Resolve): Params attributes are encoded
3662 by creating an array at the point where the params starts and
3663 putting all those arguments there, then adjusting the size of the
3666 2003-05-05 Miguel de Icaza <miguel@ximian.com>
3668 * expression.cs (New.AddressOf): Implement interface
3669 IMemoryLocation. This is used when the `new' operator is used in
3670 the context of an invocation to a method on a value type.
3672 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3675 * namespace.cs: Also check the using aliases here.
3677 * driver.cs: Move the test for using validity after the types have
3678 been entered, so we do a single pass that also includes the using
3681 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3682 in the regular case. CreateSiblingForFinally is doing extra
3685 * attribute.cs (GetAttributeArgumentExpression): Store the result
3686 on an out value, and use the return value to indicate failure
3687 instead of using null (which is a valid return for Constant.GetValue).
3689 * statement.cs: Perform the analysis flow for the increment
3690 portion after the statement, because this will be the real flow of
3691 execution. Fixes #42385
3693 * codegen.cs (EmitContext.EmitArgument,
3694 EmitContext.EmitStoreArgument): New helper functions when the
3695 RemapToProxy flag is set.
3697 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3700 Add support for remapping parameters.
3702 * iterators.cs: Propagate parameter values; Store parameter
3703 values in the proxy classes.
3705 2003-05-04 Miguel de Icaza <miguel@ximian.com>
3707 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
3708 need a proxy reference; I do not know what I was thinking
3710 * cs-parser.jay (constructor_initializer): catch another error,
3711 and display nice message.
3713 (field_declaration): catch void field declaration
3714 to flag a better error.
3716 * class.cs (MemberBase.CheckBase): Report an error instead of a
3717 warning if a new protected member is declared in a struct.
3718 (Field.Define): catch the error of readonly/volatile.
3720 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3722 (FieldExpr.AddressOf): ditto. Catch error where the address of a
3723 volatile variable is taken
3725 2003-05-02 Miguel de Icaza <miguel@ximian.com>
3727 * statement.cs (Fixed.Resolve): Report an error if we are not in
3730 2003-05-01 Miguel de Icaza <miguel@ximian.com>
3732 * typemanager.cs: reuse the code that handles type clashes for
3733 delegates and enumerations.
3735 * class.cs (Report28): Always report.
3737 * expression.cs (EncodeAsAttribute): Allow nulls here.
3739 2003-04-28 Miguel de Icaza <miguel@ximian.com>
3741 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3742 the functionality for testing whether an expression is valid for
3743 an attribute here. Also handle the case of arrays of elements
3746 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3747 encoding a linear array into an array of objects that are suitable
3748 to be passed to an CustomAttributeBuilder.
3750 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3752 * ecore.cs: (FieldExpr): Handle field remapping here.
3754 * iteratators.cs: Pass the instance variable (if the method is an
3755 instance method) to the constructors, so we can access the field
3756 variables on the class.
3758 TODO: Test this with structs. I think the THIS variable on
3759 structs might have to be a pointer, and not a refenrece
3761 2003-04-27 Miguel de Icaza <miguel@ximian.com>
3763 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
3764 local variables to fields in a proxy class.
3766 * iterators.cs (PopulateProxy): Rename our internal fields to
3768 Create a <THIS> field if we are an instance method, so we can
3769 reference our parent container variables.
3770 (MapVariable): Called back from the EmitContext code to enter a
3771 new variable to field mapping into the proxy class (we just create
3775 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
3776 for using the remapped locals to fields.
3778 I placed the code here, because that gives the same semantics to
3779 local variables, and only changes the Emit code.
3781 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
3782 statements inside iterators.
3783 (VariableInfo): Add a FieldBuilder for the cases when we are
3784 remapping local variables to fields in a proxy class
3786 * ecore.cs (SimpleNameResolve): Avoid testing two times for
3787 current_block != null.
3789 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
3790 not cope with strings, as it has been moved to the
3791 TableSwitchEmit. Fixed bug in switch generation.
3793 * expression.cs (New.DoResolve): Provide more context for the user
3794 when reporting an error.
3796 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
3799 * expression.cs (MemberAccess.DoResolve): When we get a type back,
3800 check the permissions for it. Note than in a type-resolution
3801 context the check was already present in DeclSpace.ResolveType,
3802 but was missing from the MemberAccess.
3804 (ArrayCreation.CheckIndices): warn if the user has
3805 more nested levels of expressions, but there are no more
3806 dimensions specified. Avoids crash on bug 41906.
3808 2003-04-26 Miguel de Icaza <miguel@ximian.com>
3810 * statement.cs (Block): replace Implicit bool, for a generic
3812 New flag: `Unchecked'. This is used during the EmitMeta phase
3813 (which is out-of-line with the regular Resolve/Emit process for a
3814 statement, as this is done ahead of time, but still gets a chance
3815 to call constant resolve).
3817 (Block.Flags): new enum for adding a new flag.
3819 (Block.EmitMeta): track the state of unchecked.
3821 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
3822 to enable constant resolution to work there as well.
3824 2003-04-22 Miguel de Icaza <miguel@ximian.com>
3826 * typemanager.cs (ienumerable_type): Also look up
3827 System.Collections.IEnumerable.
3829 2003-04-21 Miguel de Icaza <miguel@ximian.com>
3831 TODO: Test more than one conditional per method.
3833 * class.cs (Indexer.Define): Report the location where the user is
3834 referencing the unsupported feature.
3836 (MethodData): Overload the use of `conditionals' to
3837 minimize the creation of needless ArrayLists. This saves roughly
3838 212kb on my machine.
3840 (Method): Implement the new IIteratorContainer interface.
3841 (Method.SetYields): Implement the method by setting the ModFlags
3842 to contain METHOD_YIELDS.
3844 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
3845 which just got set to null.
3847 * iterators.cs: New file.
3849 (Yield, YieldBreak): New statements.
3851 * statement.cs (Return.Resolve): Flag an error if we are used in
3854 * codegen.cs (InIterator): New flag set if the code is being
3855 compiled in an iterator method.
3857 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
3858 internal modifier, and we just use it to avoid adding extra
3859 fields, as this is seldom used.
3861 * cs-parser.jay: Add yield_statement (yield and yield break).
3863 * driver.cs: New flag -v2 to turn on version 2 features.
3865 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
3866 hashtable when v2 is enabled.
3868 2003-04-20 Miguel de Icaza <miguel@ximian.com>
3870 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
3871 there is already a namespace defined with this name.
3873 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
3874 people upgraded their corlibs.
3876 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
3877 always use fully qualified types, no need to use the compiler
3880 (TypeManager.IsNamespace): Use binarysearch.
3882 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
3883 AddDelegate): I did not quite use the new IsValid API properly: I
3884 have to pass the short-name and the fullname. I was passing only
3885 the basename instead of the fullname sometimes.
3887 (TypeContainer.DefineType): call NamespaceClash.
3889 * interface.cs (Interface.DefineType): use NamespaceClash before
3892 * delegate.cs (Delegate.DefineType): use NamespaceClash before
3895 * enum.cs: (Enum.DefineType): use NamespaceClash before
3898 * typemanager.cs (: 3-line patch that gives us some tasty 11%
3899 speed increase. First, use the negative_hits cache when we get a
3900 negative. Second, add the type with its full original name
3901 instead of the new . and + encoded name (reflection uses + to
3902 separate type from a nested type). Use LookupTypeReflection
3903 directly which bypasses the type->name hashtable (that we already
3904 know does not contain the type.
3906 * decl.cs (DeclSpace.ResolveTypeExpr): track the
3907 location/container type.
3909 * driver.cs: When passing utf8, use directly the UTF8Encoding.
3911 2003-04-19 Miguel de Icaza <miguel@ximian.com>
3913 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
3915 * delegate.cs (NewDelegate.Resolve): Test whether an instance
3916 method is being referenced in the method group from a static
3917 context, and report error 120 if so.
3919 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
3922 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
3923 is created, we create the A namespace).
3925 * cs-parser.jay: A namespace also introduces a DeclarationFound.
3928 2003-04-18 Miguel de Icaza <miguel@ximian.com>
3930 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
3931 invocation to ModuleBuilder.GetType with the same values will
3932 return a new type instance, so we need to cache its return
3935 * expression.cs (Binary.ResolveOperator): Only allow the compare
3936 operators on enums if they are of the same type.
3938 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
3939 types of ValueType on their own case. Before we were giving them
3940 the same treatment as objects.
3942 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
3943 fullname. Short name is used to compare against container name.
3944 Fullname is used to check against defined namespace names.
3946 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
3947 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
3949 (Method.CheckBase): Call parent.
3950 (MemberBase.CheckBase): Check for protected members on sealed
3952 (PropertyBase.CheckBase): Call parent.
3953 (Field.Define): Call parent.
3955 * report.cs: Negative error codes are now mapped to 8000 - code,
3956 so that the display is render more nicely.
3958 * typemanager.cs: Do not use try/catch, instead report a regular
3961 (GetPointerType, GetReferenceType): These methods provide
3962 mechanisms to obtain the T* and T& from a T. We had the code
3963 previously scattered around the code base, and it also used
3964 TypeManager.LookupType that would go through plenty of caches.
3965 This one goes directly to the type source.
3967 In some places we did the Type.GetType followed by
3968 ModuleBuilder.GetType, but not in others, so this unifies the
3971 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
3972 statements now that we have namespace information.
3974 * typemanager.cs (IsNamespace): New method, returns whether the
3975 string presented is a namespace or not.
3977 (ComputeNamespaces): New public entry point, computes the list of
3978 available namespaces, using the GetNamespaces API call in Mono, or
3979 the slower version in MS.NET.
3981 Now before we start the semantic analysis phase, we have a
3982 complete list of namespaces including everything that the user has
3985 Deleted old code to cache namespaces in .nsc files.
3987 2003-04-17 Miguel de Icaza <miguel@ximian.com>
3989 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
3990 class/struct location definition Location for the implicit
3991 constructor location.
3993 (Operator.Define): Use the location of the operator for the
3994 implicit Method definition.
3996 (Constructor.Emit): use the constructor location for the implicit
3997 base initializer constructor.
3999 * ecore.cs: Remove ITypeExpression. This interface is now gone,
4000 and the Expression class now contains two new methods:
4002 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
4003 isolate type lookup from the rest of the resolution process.
4005 Since we use Expressions to hold type definitions due to the way
4006 we parse the input we have historically overloaded Resolve to
4007 perform the Type lookups if a special flag is passed. Now this is
4008 eliminated and two methods take their place.
4010 The differences in the two methods between xStep and xTerminal is
4011 that xStep is involved in our current lookup system that uses
4012 SimpleNames to compose a name, while xTerminal is used just to
4013 catch the case where the simplename lookup failed.
4015 2003-04-16 Miguel de Icaza <miguel@ximian.com>
4017 * expression.cs (ResolveMemberAccess): Remove redundant code.
4018 TypeExpr expressions are always born fully resolved.
4020 * interface.cs (PopulateMethod): Do not lookup the types twice.
4021 We were doing it once during SemanticAnalysis and once during
4024 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
4025 in local variable type definitions, were being returned as a
4026 SimpleName (we decomposed everything into a string), that is
4027 because primary_expression was being used instead of a type in the
4028 grammar (reduce/reduce conflicts).
4030 The part that was wrong is that we converted the expression into a
4031 string (an oversimplification in one hand, compounded with primary
4032 expressions doing string concatenation).
4038 Would return "A.B.C[]" as a SimpleName. This stopped things like
4039 using clauses from working on this particular context. And a type
4040 was being matched directly against "A.B.C[]".
4042 We now use the correct approach, and allow for ComposedCast to be
4043 part of the unary expression. So the "A.B.C []" become a composed
4044 cast of "A.B.C" (as a nested group of MemberAccess with a
4045 SimpleName at the end) plus the rank composition "[]".
4049 2003-04-10 Miguel de Icaza <miguel@ximian.com>
4051 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
4052 for the access level checking.
4054 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
4055 `TypeContainer container', because I kept getting confused when I
4056 was debugging this code.
4058 * expression.cs (Indexers): Instead of tracking getters/setters,
4059 we now track them in parallel. We create one arraylist less, but
4060 most importantly it is possible now for the LValue code to find a
4061 matching get for a set.
4063 (IndexerAccess.DoResolveLValue): Update the code.
4064 GetIndexersForType has been modified already to extract all the
4065 indexers from a type. The code assumed it did not.
4067 Also make the code set the correct return type for the indexer.
4068 This was fixed a long time ago for properties, but was missing for
4069 indexers. It used to be void_type.
4071 (Binary.Emit): Test first for doubles instead of
4072 floats, as they are more common.
4074 (Binary.EmitBranchable): Use the .un version of the branch opcodes
4075 when dealing with floats and the <=, >= operators. This fixes bug
4078 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
4079 to load the array value by emitting a load on the foreach variable
4080 type. This was incorrect.
4082 We now emit the code to load an element using the the array
4083 variable type, and then we emit the conversion operator.
4087 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
4089 * attribute.cs: Avoid allocation of ArrayLists in the common case.
4091 2003-04-09 Miguel de Icaza <miguel@ximian.com>
4093 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
4094 test for protection before we test for signatures.
4096 (MethodSignature.ToString): implement.
4098 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
4099 to the case where we reduced into a LongConstant.
4101 * decl.cs (CheckAccessLevel): If the type is an array, we can not
4102 depend on whether the information is acurrate, because the
4103 Microsoft runtime will always claim that the array type is public,
4104 regardless of the real state.
4106 If the type is a pointer, another problem happens: the type is
4107 reported as non-public in Microsoft.
4109 In both cases we have to call CheckAccessLevel recursively with
4110 the underlying type as the argument to be tested.
4112 2003-04-08 Miguel de Icaza <miguel@ximian.com>
4114 * assign.cs (Assign.Emit): If we are dealing with a compound
4115 assignment expression, we should use the code path that stores the
4116 intermediate result in a temporary value. This fixes #40903.
4118 *expression.cs (Indirection.ToString): Provide ToString method for
4121 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
4123 * class.cs: Null out fields holding references to Block objects so
4124 they can be garbage collected.
4126 * expression.cs (OverloadResolve): Remove unused local.
4128 2003-04-07 Martin Baulig <martin@ximian.com>
4130 * codegen.cs (EmitContext.CurrentFile): New public field.
4131 (EmitContext.Mark): Use the CurrentFile to check whether the
4132 location is in the correct file.
4133 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
4135 2003-04-07 Martin Baulig <martin@ximian.com>
4137 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
4139 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
4140 location. [FIXME: The location argument which gets passed to this
4141 method is sometimes wrong!]
4143 2003-04-07 Nick Drochak <ndrochak@gol.com>
4145 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
4147 2003-04-07 Miguel de Icaza <miguel@ximian.com>
4149 * expression.cs (Indirection.EmitAssign): We were using the
4150 temporary, but returning immediately instead of continuing the
4153 2003-04-06 Martin Baulig <martin@ximian.com>
4155 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
4156 if it's a nested child, but also deriving from the outer class.
4159 * typemanager.cs (IsNestedChildOf): Make this work if it's a
4160 nested child, but also deriving from the outer class. See
4162 (FilterWithClosure): We may access private members of the outer
4163 class if we're a nested child and deriving from the outer class.
4164 (RealMemberLookup): Only set `closure_private_ok' if the
4165 `original_bf' contained BindingFlags.NonPublic.
4167 2003-04-05 Martin Baulig <martin@ximian.com>
4169 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
4171 2003-04-02 Miguel de Icaza <miguel@ximian.com>
4173 * class.cs (Event.Define): Do not allow abstract events to have
4176 2003-04-01 Miguel de Icaza <miguel@ximian.com>
4178 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
4179 block in event declarations.
4181 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
4182 value type, get its address.
4184 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
4185 leaving a class on the stack instead of a boolean value (int
4186 0/1). Change the code so we compare against null, and then the
4187 result against zero.
4189 * class.cs (TypeContainer.GetClassBases): We were checking for the
4190 parent class being sealed too late.
4192 * expression.cs (Binary.Emit): For <= and >= when dealing with
4193 floating point values, use cgt.un and clt.un instead of cgt and
4196 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
4198 * statement.cs: Apply the same optimization as MS: skip the
4199 GetEnumerator returning an IEnumerator, and use the one returning a
4200 CharEnumerator instead. This allows us to avoid the try-finally block
4203 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
4205 * cs-parser.jay: Attributes cannot be applied to
4206 namespaces. Fixes #40473
4208 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4211 (Add*): check if the name is valid using the full name for constants,
4212 fields, properties and events.
4214 2003-03-28 Miguel de Icaza <miguel@ximian.com>
4216 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
4217 char constants to be part of the enumeration.
4219 * expression.cs (Conditional.DoResolve): Add support for operator
4220 true. Implements the missing functionality from 14.12
4222 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
4223 operator true/false as required by the spec.
4225 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
4226 implicit conversion to boolean.
4228 * statement.cs (Statement.ResolveBoolean): A boolean expression is
4229 also one where the type implements `operator true'.
4231 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
4232 get an expression that will invoke operator true based on an
4235 (GetConversionOperators): Removed the hack that called op_True
4238 (Expression.ResolveBoolean): Move this from Statement.
4240 2003-03-17 Miguel de Icaza <miguel@ximian.com>
4242 * ecore.cs (FieldExpr): do not allow initialization of initonly
4243 fields on derived classes
4245 2003-03-13 Martin Baulig <martin@ximian.com>
4247 * statement.cs (Block.Emit): Call ig.BeginScope() and
4248 ig.EndScope() when compiling with debugging info; call
4249 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
4251 2003-03-08 Miguel de Icaza <miguel@ximian.com>
4253 * expression.cs (Indexers): Do not construct immediately, allow
4254 for new members to be appended as we go. Fixes 38143
4256 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4258 * expression.cs: save/restore context when resolving an unchecked
4261 2003-03-05 Miguel de Icaza <miguel@ximian.com>
4263 * cfold.cs: Catch division by zero in modulus operator during
4266 2003-03-03 Miguel de Icaza <miguel@ximian.com>
4268 * interface.cs (Interface.DefineMembers): Avoid defining members
4271 2003-02-27 Miguel de Icaza <miguel@ximian.com>
4273 * driver.cs: handle the +/- options for -noconfig
4275 * statement.cs (Unckeched.Resolve): Also track the state of
4276 unchecked in the Resolve phase.
4278 2003-02-27 Martin Baulig <martin@ximian.com>
4280 * ecore.cs (Expression.MemberLookup): Don't create a
4281 MethodGroupExpr for something which is not a method. Fixes #38291.
4283 2003-02-25 Miguel de Icaza <miguel@ximian.com>
4285 * class.cs (MemberBase.CheckParameters): Also check that the type
4286 is unmanaged if it is a pointer.
4288 * expression.cs (SizeOf.Resolve): Add location information.
4290 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
4291 a managed type is declared.
4293 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
4294 parameter modifiers as well. Fixes bug 38606
4296 * class.cs: Very sad. Am backing out the speed up changes
4297 introduced by the ArrayList -> Array in the TypeContainer, as they
4298 were not actually that much faster, and introduced a bug (no error
4299 reports on duplicated methods).
4301 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
4302 source first, this will guarantee that we have a valid expression
4303 before calling in lower levels functions that will require a
4304 resolved object. Then use this original_source in the
4305 target.ResolveLValue instead of the original source that was
4308 Another change. Use target.Resolve instead of LValueResolve.
4309 Although we are resolving for LValues, we will let the Assign code
4310 take care of that (it will be called again from Resolve). This
4311 basically allows code like this:
4313 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
4314 class Y { void A (X x) { x [0] += o; }
4316 The problem was that the indexer was trying to resolve for
4317 set_Item (idx, object o) and never finding one. The real set_Item
4318 was set_Item (idx, X). By delaying the process we get the right
4323 2003-02-23 Martin Baulig <martin@ximian.com>
4325 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
4326 while calling DoEmit ().
4328 * codegen.cs (EmitContext.Mark): Don't mark locations in other
4329 source files; if you use the #line directive inside a method, the
4330 compiler stops emitting line numbers for the debugger until it
4331 reaches the end of the method or another #line directive which
4332 restores the original file.
4334 2003-02-23 Martin Baulig <martin@ximian.com>
4336 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
4338 2003-02-23 Martin Baulig <martin@ximian.com>
4340 * statement.cs (Block.AddChildVariableNames): We need to call this
4341 recursively, not just for our immediate children.
4343 2003-02-23 Martin Baulig <martin@ximian.com>
4345 * class.cs (Event.Define): Always make the field private, like csc does.
4347 * typemanager.cs (TypeManager.RealMemberLookup): Make events
4348 actually work, fixes bug #37521.
4350 2003-02-23 Miguel de Icaza <miguel@ximian.com>
4352 * delegate.cs: When creating the various temporary "Parameters"
4353 classes, make sure that we call the ComputeAndDefineParameterTypes
4354 on those new parameters (just like we do with the formal ones), to
4355 allow them to be resolved in the context of the DeclSpace.
4357 This fixes the bug that Dick observed in Bugzilla #38530.
4359 2003-02-22 Miguel de Icaza <miguel@ximian.com>
4361 * expression.cs (ResolveMemberAccess): When resolving a constant,
4362 do not attempt to pull a constant if the value was not able to
4363 generate a valid constant.
4365 * const.cs (LookupConstantValue): Do not report more errors than required.
4367 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4369 * expression.cs: fixes bug #38328.
4371 2003-02-18 Miguel de Icaza <miguel@ximian.com>
4373 * class.cs: Changed all the various members that can be part of a
4374 class from being an ArrayList to be an Array of the right type.
4375 During the DefineType type_list, interface_list, delegate_list and
4376 enum_list are turned into types, interfaces, delegates and enums
4379 And during the member population, indexer_list, event_list,
4380 constant_list, field_list, instance_constructor_list, method_list,
4381 operator_list and property_list are turned into their real arrays.
4383 Although we could probably perform this operation earlier, for
4384 good error reporting we need to keep the lists and remove the
4385 lists for longer than required.
4387 This optimization was triggered by Paolo profiling the compiler
4388 speed on the output of `gen-sample-program.pl' perl script.
4390 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
4391 not crash in methods like MemberLookupFailed that use this field.
4393 This problem arises when the compiler fails to resolve a type
4394 during interface type definition for example.
4396 2003-02-18 Miguel de Icaza <miguel@ximian.com>
4398 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
4399 inherit from System.Object, so we have to stop at null, not only
4400 when reaching System.Object.
4402 2003-02-17 Miguel de Icaza <miguel@ximian.com>
4404 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
4405 DeclaredOnly because the parent indexer might have had a different
4406 name, but did not loop until the top of the hierarchy was reached.
4408 The problem this one fixes is 35492: when a class implemented an
4409 indexer from an interface, we were getting the interface method
4410 (which was abstract) and we were flagging an error (can not invoke
4413 This also keeps bug 33089 functioning, and test-148 functioning.
4415 * typemanager.cs (IsSpecialMethod): The correct way of figuring
4416 out if a method is special is to see if it is declared in a
4417 property or event, or whether it is one of the predefined operator
4418 names. This should fix correctly #36804.
4420 2003-02-15 Miguel de Icaza <miguel@ximian.com>
4422 The goal here is to remove the dependency on EmptyCast.Peel ().
4423 Killing it completely.
4425 The problem is that currently in a number of places where
4426 constants are expected, we have to "probe" for an EmptyCast, and
4427 Peel, which is not the correct thing to do, as this will be
4428 repetitive and will likely lead to errors.
4430 The idea is to remove any EmptyCasts that are used in casts that
4431 can be reduced to constants, so we only have to cope with
4434 This bug hunt was triggered by Bug 37363 and the desire to remove
4435 the duplicate pattern where we were "peeling" emptycasts to check
4436 whether they were constants. Now constants will always be
4439 * ecore.cs: Use an enumconstant here instead of wrapping with
4442 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
4443 throwing me off. By handling this we can get rid of a few hacks.
4445 * statement.cs (Switch): Removed Peel() code.
4447 2003-02-14 Miguel de Icaza <miguel@ximian.com>
4449 * class.cs: Location information for error 508
4451 * expression.cs (New.DoResolve): Add a guard against double
4452 resolution of an expression.
4454 The New DoResolve might be called twice when initializing field
4455 expressions (see EmitFieldInitializers, the call to
4456 GetInitializerExpression will perform a resolve on the expression,
4457 and later the assign will trigger another resolution
4459 This leads to bugs (#37014)
4461 * delegate.cs: The signature for EndInvoke should contain any ref
4462 or out parameters as well. We were not doing this in the past.
4464 * class.cs (Field.Define): Do not overwrite the type definition
4465 inside the `volatile' group. Turns out that volatile enumerations
4466 were changing the type here to perform a validity test, which
4469 2003-02-12 Miguel de Icaza <miguel@ximian.com>
4471 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4472 and structs, we do not want to load the instance variable
4474 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4475 enum_type has to be handled like an object reference (implicit
4476 conversions exists from this to object), but the regular IsClass
4477 and IsValueType tests will never return true for this one.
4479 Also we use TypeManager.IsValueType instead of type.IsValueType,
4480 just for consistency with the rest of the code (this is only
4481 needed if we ever use the construct exposed by test-180.cs inside
4482 corlib, which we dont today).
4484 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
4486 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4489 2003-02-09 Martin Baulig <martin@ximian.com>
4491 * namespace.cs (Namespace..ctor): Added SourceFile argument.
4492 (Namespace.DefineNamespaces): New static public method; this is
4493 called when we're compiling with debugging to add all namespaces
4496 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4497 pass it to the Namespace's .ctor.
4499 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4500 and MethodBase arguments; pass the namespace ID to the symwriter;
4501 pass the MethodBase instead of the token to the symwriter.
4502 (SymbolWriter.DefineNamespace): New method to add a namespace to
4505 2003-02-09 Martin Baulig <martin@ximian.com>
4507 * symbolwriter.cs: New file. This is a wrapper around
4508 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
4509 methods here in near future.
4511 2003-02-09 Martin Baulig <martin@ximian.com>
4513 * codegen.cs (EmitContext.Mark): Just pass the arguments to
4514 ILGenerator.MarkSequencePoint() which are actually used by the
4517 2003-02-09 Martin Baulig <martin@ximian.com>
4519 * location.cs (SourceFile): New public sealed class. This
4520 contains the name and an index which is used in the location's token.
4521 (Location): Reserve an appropriate number of bits in the token for
4522 the source file instead of walking over that list, this gives us a
4523 really huge performance improvement when compiling with debugging.
4525 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4526 `SourceFile' argument instead of a string.
4527 (Driver.ProcessFile): Add all the files via Location.AddFile(),
4528 but don't parse/tokenize here, we need to generate the list of all
4529 source files before we do that.
4530 (Driver.ProcessFiles): New static function. Parses/tokenizes all
4533 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4534 instead of a string.
4536 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4539 2003-02-09 Martin Baulig <martin@ximian.com>
4541 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4542 filename on `#line default'.
4544 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4546 * statement.cs: don't clear the pinned var when the fixed statement
4547 returns from the method (fixes bug#37752).
4549 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4551 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
4554 2003-02-07 Martin Baulig <martin@ximian.com>
4556 * driver.cs: Removed the `--debug-args' command line argument.
4558 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4559 automatically by the AsssemblyBuilder.
4560 (CodeGen.InitializeSymbolWriter): We don't need to call any
4561 initialization function on the symbol writer anymore. This method
4562 doesn't take any arguments.
4564 2003-02-03 Miguel de Icaza <miguel@ximian.com>
4566 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4567 from referenced assemblies as well.
4569 2003-02-02 Martin Baulig <martin@ximian.com>
4571 * class.cs (MethodData.Emit): Generate debugging info for external methods.
4573 2003-02-02 Martin Baulig <martin@ximian.com>
4575 * class.cs (Constructor.Emit): Open the symbol writer before
4576 emitting the constructor initializer.
4577 (ConstructorInitializer.Emit): Call ec.Mark() to allow
4578 single-stepping through constructor initializers.
4580 2003-01-30 Miguel de Icaza <miguel@ximian.com>
4582 * class.cs: Handle error 549: do not allow virtual methods in
4585 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4587 * decl.cs: Check access levels when resolving types
4589 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4591 * statement.cs: Add parameters and locals set in catch blocks that might
4592 return to set vector
4594 2003-01-29 Miguel de Icaza <miguel@ximian.com>
4596 * class.cs (Operator): Set the SpecialName flags for operators.
4598 * expression.cs (Invocation.DoResolve): Only block calls to
4599 accessors and operators on SpecialName methods.
4601 (Cast.TryReduce): Handle conversions from char constants.
4604 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4606 * statement.cs: small memory and time optimization in FlowBranching.
4608 2003-01-28 Pedro Mart <yoros@wanadoo.es>
4610 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4611 problem that the last fix but in the other sid (Set).
4613 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4614 access when there is no indexer in the hierarchy.
4616 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4618 * class.cs: Combine some if statements.
4620 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4622 * driver.cs: fixed bug #37187.
4624 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
4626 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4627 any indexer, it's needed to build a list with all the indexers in the
4628 hierarchy (AllGetters), else we have problems. Fixes #35653.
4630 2003-01-23 Miguel de Icaza <miguel@ximian.com>
4632 * class.cs (MethodData.Define): It is wrong for an interface
4633 implementation to be static in both cases: explicit and implicit.
4634 We were only handling this in one case.
4636 Improve the if situation there to not have negations.
4638 * class.cs (Field.Define): Turns out that we do not need to check
4639 the unsafe bit on field definition, only on usage. Remove the test.
4641 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4643 * driver.cs: use assembly.Location instead of Codebase (the latest
4644 patch made mcs fail when using MS assemblies).
4646 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
4648 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4649 get the path to *corlib.dll.
4651 2003-01-21 Nick Drochak <ndrochak@gol.com>
4655 * typemanager.cs: Remove compiler warnings
4657 2003-01-20 Duncan Mak <duncan@ximian.com>
4659 * AssemblyInfo.cs: Bump the version number to 0.19.
4661 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4663 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4665 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
4667 * class.cs (Constructor::Emit): Emit debugging info for constructors.
4669 2003-01-17 Miguel de Icaza <miguel@ximian.com>
4671 * cs-parser.jay: Small fix: we were not comparing the constructor
4672 name correctly. Thanks to Zoltan for the initial pointer.
4674 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4676 * cs-tokenizer.cs: Set file name when specified with #line
4678 2003-01-15 Miguel de Icaza <miguel@ximian.com>
4680 * cs-parser.jay: Only perform the constructor checks here if we
4681 are named like the class; This will help provider a better
4682 error. The constructor path is taken when a type definition is
4683 not found, but most likely the user forgot to add the type, so
4684 report that rather than the constructor error.
4686 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4688 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4691 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4693 * cs-parser.jay: Add cleanup call.
4695 2003-01-13 Duncan Mak <duncan@ximian.com>
4697 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4698 consistent with other methods.
4700 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4702 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4704 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4706 * attribute.cs: only set GuidAttr to true when we have a
4709 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4713 * typemanager.cs: fixes to allow mcs compile corlib with the new
4714 Type.IsSubclassOf fix.
4716 2003-01-08 Miguel de Icaza <miguel@ximian.com>
4718 * expression.cs (LocalVariableReference.DoResolve): Classify a
4719 constant as a value, not as a variable. Also, set the type for
4722 * cs-parser.jay (fixed_statement): take a type instead of a
4723 pointer_type, so we can produce a better error message later.
4725 * statement.cs (Fixed.Resolve): Flag types that are not pointers
4728 (For.DoEmit): Make inifinite loops have a
4729 non-conditional branch back.
4731 (Fixed.DoEmit): First populate the pinned variables, then emit the
4732 statement, then clear the variables. Before I was emitting the
4733 code once for each fixed piece.
4736 2003-01-08 Martin Baulig <martin@ximian.com>
4738 * statement.cs (FlowBranching.MergeChild): A break in a
4739 SWITCH_SECTION does not leave a loop. Fixes #36155.
4741 2003-01-08 Martin Baulig <martin@ximian.com>
4743 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4744 lives in the same number space than `param_map'. Fixes #36154.
4746 2003-01-07 Miguel de Icaza <miguel@ximian.com>
4748 * cs-parser.jay (constructor_declaration): Set the
4749 Constructor.ModFlags before probing for it. This makes the
4750 compiler report 514, 515 and 132 (the code was there, but got
4753 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4754 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4755 (GotoCase.Resolve): Set `Returns' to ALWAYS.
4757 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4759 * enum.cs: create the enum static fields using the enum type.
4761 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
4763 * class.cs: don't try to create the ParamBuilder for the return
4764 type if it's not needed (and handle it breaking for the ms runtime
4767 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
4769 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
4771 2002-12-29 Miguel de Icaza <miguel@ximian.com>
4773 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
4774 the command. This showed up while compiling the JANET source
4775 code, which used \r as its only newline separator.
4777 2002-12-28 Miguel de Icaza <miguel@ximian.com>
4779 * class.cs (Method.Define): If we are an operator (because it
4780 reuses our code), then set the SpecialName and HideBySig. #36128
4782 2002-12-22 Miguel de Icaza <miguel@ximian.com>
4784 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
4785 exception, report error 120 `object reference required'.
4787 * driver.cs: Add --pause option, used during to measure the size
4788 of the process as it goes with --timestamp.
4790 * expression.cs (Invocation.DoResolve): Do not allow methods with
4791 SpecialName to be invoked.
4793 2002-12-21 Miguel de Icaza <miguel@ximian.com>
4795 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
4796 number before adding it.
4798 2002-12-21 Ravi Pratap <ravi@ximian.com>
4800 * ecore.cs (StandardImplicitConversion): When in an unsafe
4801 context, we allow conversion between void * to any other pointer
4802 type. This fixes bug #35973.
4804 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
4806 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
4807 is not thrown when extensionless outputs are used
4809 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4811 * rootcontext.cs: fixed compilation of corlib.
4813 2002-12-19 Miguel de Icaza <miguel@ximian.com>
4815 * attribute.cs (Attributes.Contains): Add new method.
4817 * class.cs (MethodCore.LabelParameters): if the parameter is an
4818 `out' parameter, check that no attribute `[In]' has been passed.
4820 * enum.cs: Handle the `value__' name in an enumeration.
4822 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
4824 * decl.cs: Added special case to allow overrides on "protected
4827 2002-12-18 Ravi Pratap <ravi@ximian.com>
4829 * attribute.cs (Attributes.AddAttributeSection): Rename to this
4830 since it makes much more sense.
4832 (Attributes.ctor): Don't require a Location parameter.
4834 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
4836 * attribute.cs (ApplyAttributes): Remove extra Location parameters
4837 since we already have that information per attribute.
4839 * everywhere : make appropriate changes.
4841 * class.cs (LabelParameters): Write the code which actually
4842 applies attributes to the return type. We can't do this on the MS
4843 .NET runtime so we flag a warning in the case an exception is
4846 2002-12-18 Miguel de Icaza <miguel@ximian.com>
4848 * const.cs: Handle implicit null conversions here too.
4850 2002-12-17 Ravi Pratap <ravi@ximian.com>
4852 * class.cs (MethodCore.LabelParameters): Remove the extra
4853 Type [] parameter since it is completely unnecessary. Instead
4854 pass in the method's attributes so that we can extract
4855 the "return" attribute.
4857 2002-12-17 Miguel de Icaza <miguel@ximian.com>
4859 * cs-parser.jay (parse): Use Report.Error to flag errors instead
4860 of ignoring it and letting the compile continue.
4862 * typemanager.cs (ChangeType): use an extra argument to return an
4863 error condition instead of throwing an exception.
4865 2002-12-15 Miguel de Icaza <miguel@ximian.com>
4867 * expression.cs (Unary.TryReduce): mimic the code for the regular
4868 code path. Perform an implicit cast in the cases where we can
4869 implicitly convert to one of the integral types, and then reduce
4870 based on that constant. This fixes bug #35483.
4872 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4874 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
4876 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4878 * namespace.cs: fixed bug #35489.
4880 2002-12-12 Miguel de Icaza <miguel@ximian.com>
4882 * class.cs: Remove some dead code.
4884 * cs-parser.jay: Estimate the number of methods needed
4885 (RootContext.MethodCount);
4887 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
4888 numbers instead of StringBuilders.
4890 * support.cs (PtrHashtable): Add constructor with initial size;
4891 We can now reduce reallocations of the method table.
4893 2002-12-10 Ravi Pratap <ravi@ximian.com>
4895 * attribute.cs (ApplyAttributes): Keep track of the emitted
4896 attributes on a per-target basis. This fixes bug #35413.
4898 2002-12-10 Miguel de Icaza <miguel@ximian.com>
4900 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
4901 default to the Windows 1252 encoding.
4903 (UnixParseOption): Support version, thanks to Alp for the missing
4906 * AssemblyInfo.cs: Add nice assembly information.
4908 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
4911 * cs-parser.jay: Allow a trailing comma before the close bracked
4912 in the attribute_section production.
4914 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
4915 address of the instance was being taken, I will take this out,
4916 because we take the address of the object immediately here.
4918 2002-12-09 Ravi Pratap <ravi@ximian.com>
4920 * typemanager.cs (AreMultipleAllowed): Take care of the most
4921 obvious case where attribute type is not in the current assembly -
4924 2002-12-08 Miguel de Icaza <miguel@ximian.com>
4926 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
4927 definitions, instead of doing that afterwards.
4929 Also we use a nice little hack, depending on the constructor, we
4930 know if we are a "composed" name or a simple name. Hence, we
4931 avoid the IndexOf test, and we avoid
4933 * codegen.cs: Add code to assist in a bug reporter to track down
4934 the source of a compiler crash.
4936 2002-12-07 Ravi Pratap <ravi@ximian.com>
4938 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
4939 types have been emitted for a given element and flag an error
4940 if something which does not have AllowMultiple set is used more
4943 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
4944 attribute types and their corresponding AllowMultiple properties
4946 (AreMultipleAllowed): Check the property for a given type.
4948 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
4949 property in the case we have a TypeContainer.
4951 (Attributes.AddAttribute): Detect duplicates and just skip on
4952 adding them. This trivial fix catches a pretty gross error in our
4953 attribute emission - global attributes were being emitted twice!
4955 Bugzilla bug #33187 is now fixed.
4957 2002-12-06 Miguel de Icaza <miguel@ximian.com>
4959 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
4962 * expression.cs (Binary.ResolveOperator): I can only use the
4963 Concat (string, string, string) and Concat (string, string,
4964 string, string) if the child is actually a concatenation of
4967 2002-12-04 Miguel de Icaza <miguel@ximian.com>
4969 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
4970 context where we need a 2-character lookahead.
4972 * pending.cs (PendingImplementation): Rework so we can keep track
4973 of interface types all the time, and flag those which were
4974 implemented by parents as optional.
4976 2002-12-03 Miguel de Icaza <miguel@ximian.com>
4978 * expression.cs (Binary.ResolveOperator): Use
4979 String.Concat(string,string,string) or
4980 String.Concat(string,string,string,string) when possible.
4982 * typemanager: More helper methods.
4985 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
4987 * pending.cs: remove the bogus return from GetMissingInterfaces()
4988 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
4990 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4992 * namespace.cs: avoid duplicated 'using xxx' being added to
4993 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
4994 when we get more than one 'using' statement for the same namespace.
4995 Report a CS0105 warning for it.
4997 2002-11-30 Miguel de Icaza <miguel@ximian.com>
4999 * cs-tokenizer.cs (consume_identifier): use read directly, instead
5000 of calling getChar/putback, uses internal knowledge of it.
5002 (xtoken): Reorder tokenizer so most common patterns are checked
5003 first. This reduces the compilation time in another 5% (from 8.11s
5004 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
5006 The parsing time is 22% of the compilation in mcs, and from that
5007 64% is spent on the tokenization process.
5009 I tried using a binary search for keywords, but this is slower
5010 than the hashtable. Another option would be to do a couple of
5013 * Not use a StringBuilder, instead use an array of chars,
5014 with a set value. Notice that this way we could catch
5015 the 645 error without having to do it *afterwards*.
5017 * We could write a hand-parser to avoid the hashtable
5018 compares altogether.
5020 The identifier consumption process takes 37% of the tokenization
5021 time. Another 15% is spent on is_number. 56% of the time spent
5022 on is_number is spent on Int64.Parse:
5024 * We could probably choose based on the string length to
5025 use Int32.Parse or Int64.Parse and avoid all the 64-bit
5028 Another 3% is spend on wrapping `xtoken' in the `token' function.
5030 Handle 0xa0 as whitespace (#34752)
5032 2002-11-26 Miguel de Icaza <miguel@ximian.com>
5034 * typemanager.cs (IsCLRType): New routine to tell whether a type
5035 is one of the builtin types.
5037 Maybe it needs to use TypeCodes to be faster. Maybe we could use
5038 typecode in more places instead of doing pointer comparissions.
5039 We could leverage some knowledge about the way the typecodes are
5042 New code to cache namespaces in assemblies, it is currently not
5043 invoked, to be used soon.
5045 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
5047 * expression.cs (Binary.ResolveOperator): specially handle
5048 strings, and do not perform user-defined operator overloading for
5051 2002-11-24 Miguel de Icaza <miguel@ximian.com>
5053 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
5054 internalcall as it is a pretty simple operation; Avoid whenever
5055 possible to call Char.IsLetter.
5057 (consume_identifier): Cut by half the number of
5058 hashtable calls by merging the is_keyword and GetKeyword behavior.
5060 Do not short-circuit, because if we do, we
5061 report errors (ie, #if false && true would produce an invalid
5065 2002-11-24 Martin Baulig <martin@ximian.com>
5067 * expression.cs (Cast.TryReduce): If we're in checked syntax,
5068 check constant ranges and report a CS0221. Fixes #33186.
5070 2002-11-24 Martin Baulig <martin@ximian.com>
5072 * cs-parser.jay: Make this work for uninitialized variable
5073 declarations in the `for' initializer. Fixes #32416.
5075 2002-11-24 Martin Baulig <martin@ximian.com>
5077 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
5078 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
5080 2002-11-24 Martin Baulig <martin@ximian.com>
5082 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
5083 argument; if true, we also check for user-defined conversions.
5084 This is only needed if both arguments are of a user-defined type.
5085 Fixes #30443, added test-175.cs.
5086 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
5088 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
5090 2002-11-24 Martin Baulig <martin@ximian.com>
5092 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
5093 function to get the store opcode.
5094 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
5095 only emit the Ldelema if the store opcode is Stobj. You must run
5096 both test-34 and test-167 to test this. Fixes #34529.
5098 2002-11-23 Martin Baulig <martin@ximian.com>
5100 * ecore.cs (Expression.MemberLookup): Added additional
5101 `qualifier_type' argument which is used when we're being called
5102 from MemberAccess.DoResolve() and null if we're called from a
5104 (Expression.MemberLookupFailed): New method to report errors; this
5105 does the CS1540 check and reports the correct error message.
5107 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
5108 argument for the CS1540 check and redone the way how we're dealing
5109 with private members. See the comment in the source code for details.
5110 (FilterWithClosure): Reverted this back to revision 1.197; renamed
5111 `closure_start_type' to `closure_qualifier_type' and check whether
5112 it's not null. It was not this filter being broken, it was just
5113 being called with the wrong arguments.
5115 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
5116 and pass it the correct `qualifier_type'; this also does the error
5119 2002-11-22 Miguel de Icaza <miguel@ximian.com>
5121 * expression.cs (Invocation.EmitParams): If the we are dealing
5122 with a non-built-in value type, load its address as well.
5124 (ArrayCreation): Use a a pretty constant instead
5125 of the hardcoded value 2. Use 6 instead of 2 for the number of
5126 static initializers.
5128 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
5129 because they are not really value types, just glorified integers.
5131 * driver.cs: Do not append .exe, the CSC compiler does not do it.
5133 * ecore.cs: Remove redundant code for enumerations, make them use
5134 the same code path as everything else, fixes the casting issue
5135 with enumerations in Windows.Forms.
5137 * attribute.cs: Do only cast to string if it is a string, the
5138 validation happens later.
5140 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
5141 people upgrade their corlibs.
5143 * ecore.cs: Oops, enumerations were not following the entire code path
5145 2002-11-21 Miguel de Icaza <miguel@ximian.com>
5147 * typemanager.cs (FilterWithClosure): Commented out the test for
5148 1540 in typemanager.cs, as it has problems when accessing
5149 protected methods from a parent class (see test-174.cs).
5151 * attribute.cs (Attribute.ValidateGuid): new method.
5152 (Attribute.Resolve): Use above.
5154 2002-11-19 Miguel de Icaza <miguel@ximian.com>
5156 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
5158 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
5159 handling for enumerations, as we only needed the TypeContainer
5160 functionality to begin with (this is required for the fix below to
5161 work for enums that reference constants in a container class for
5164 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
5166 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
5167 a valid TypeBuilder to perform lookups on.o
5169 * class.cs (InheritableMemberSignatureCompare): Use true in the
5170 call to GetGetMethod and GetSetMethod, because we are comparing
5171 the signature, and we need to get the methods *even* if they are
5174 (PropertyBase.CheckBase): ditto.
5176 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
5177 GotoCase.Resolve): Use Peel on EmpytCasts.
5179 * ecore.cs (EmptyCast): drop child, add Peel method.
5181 2002-11-17 Martin Baulig <martin@ximian.com>
5183 * ecore.cs (EmptyCast.Child): New public property.
5185 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
5186 label resolved to an EmptyCast. Fixes #34162.
5187 (GotoCase.Resolve): Likewise.
5188 (Block.EmitMeta): Likewise.
5190 2002-11-17 Martin Baulig <martin@ximian.com>
5192 * expression.cs (Invocation.BetterConversion): Prefer int over
5193 uint; short over ushort; long over ulong for integer literals.
5194 Use ImplicitConversionExists instead of StandardConversionExists
5195 since we also need to check for user-defined implicit conversions.
5196 Fixes #34165. Added test-173.cs.
5198 2002-11-16 Martin Baulig <martin@ximian.com>
5200 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
5201 with the `true' and `false' literals. Fixes #33151.
5203 2002-11-16 Martin Baulig <martin@ximian.com>
5205 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
5206 October 22nd; don't do the cs1540 check for static members.
5208 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
5209 now using our own filter here and doing the cs1540 check again.
5211 2002-11-16 Martin Baulig <martin@ximian.com>
5213 * support.cs (InternalParameters): Don't crash if we don't have
5214 any fixed parameters. Fixes #33532.
5216 2002-11-16 Martin Baulig <martin@ximian.com>
5218 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
5219 when looking up static methods to make this work on Windows.
5222 2002-11-16 Martin Baulig <martin@ximian.com>
5224 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
5225 a setter rather than using PropertyInfo.CanWrite.
5227 2002-11-15 Nick Drochak <ndrochak@gol.com>
5229 * class.cs: Allow acces to block member by subclasses. Fixes build
5232 2002-11-14 Martin Baulig <martin@ximian.com>
5234 * class.cs (Constructor.Emit): Added the extern/block check.
5237 2002-11-14 Martin Baulig <martin@ximian.com>
5239 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
5240 iteration while looking for indexers, this is needed because the
5241 indexer may have a different name in our base classes. Fixed the
5242 error reporting (no indexers at all, not get accessor, no
5243 overloaded match). Fixes bug #33089.
5244 (IndexerAccess.DoResolveLValue): Likewise.
5246 2002-11-14 Martin Baulig <martin@ximian.com>
5248 * class.cs (PropertyBase.CheckBase): Make this work for multiple
5249 indexers. Fixes the first part of bug #33089.
5250 (MethodSignature.InheritableMemberSignatureCompare): Added support
5253 2002-11-13 Ravi Pratap <ravi@ximian.com>
5255 * attribute.cs (Attribute.Resolve): Catch the
5256 NullReferenceException and report it since it isn't supposed to
5259 2002-11-12 Miguel de Icaza <miguel@ximian.com>
5261 * expression.cs (Binary.EmitBranchable): Also handle the cases for
5262 LogicalOr and LogicalAnd that can benefit from recursively
5263 handling EmitBranchable. The code now should be nice for Paolo.
5265 2002-11-08 Miguel de Icaza <miguel@ximian.com>
5267 * typemanager.cs (LookupType): Added a negative-hit hashtable for
5268 the Type lookups, as we perform quite a number of lookups on
5269 non-Types. This can be removed once we can deterministically tell
5270 whether we have a type or a namespace in advance.
5272 But this might require special hacks from our corlib.
5276 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
5277 and double which avoids a conversion from an integer to a double.
5279 * expression.cs: tiny optimization, avoid calling IsConstant,
5280 because it effectively performs the lookup twice.
5282 2002-11-06 Miguel de Icaza <miguel@ximian.com>
5284 But a bogus return here to keep the semantics of the old code
5285 until the Mono runtime is fixed.
5287 * pending.cs (GetMissingInterfaces): New method used to remove all
5288 the interfaces that are already implemented by our parent
5289 classes from the list of pending methods.
5291 * interface.cs: Add checks for calls after ResolveTypeExpr.
5293 2002-11-05 Miguel de Icaza <miguel@ximian.com>
5295 * class.cs (Class.Emit): Report warning 67: event not used if the
5296 warning level is beyond 3.
5298 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
5299 being a NullLiteral.
5301 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
5304 * class.cs (TypeContainer.GetClassBases): Cover a missing code
5305 path that might fail if a type can not be resolved.
5307 * expression.cs (Binary.Emit): Emit unsigned versions of the
5310 * driver.cs: use error 5.
5312 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
5314 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
5316 2002-11-01 Miguel de Icaza <miguel@ximian.com>
5318 * cs-parser.jay (switch_section): A beautiful patch from Martin
5319 Baulig that fixed 33094.
5321 2002-10-31 Miguel de Icaza <miguel@ximian.com>
5323 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
5324 Check whether the base is abstract and report an error if so.
5326 * expression.cs (IndexerAccess.DoResolveLValue,
5327 IndexerAccess.DoResolve): ditto.
5329 (Invocation.DoResolve): ditto.
5331 (Invocation.FullMethodDesc): Improve the report string.
5333 * statement.cs (Block): Eliminate IsVariableDefined as it is
5334 basically just a wrapper for GetVariableInfo.
5336 * ecore.cs (SimpleName): Use new
5338 * support.cs (ReflectionParamter.ParameterType): We unwrap the
5339 type, as we return the actual parameter ref/unref state on a
5342 2002-10-30 Miguel de Icaza <miguel@ximian.com>
5344 * support.cs: Return proper flags REF/OUT fixing the previous
5347 * expression.cs: Reverted last patch, that was wrong. Is_ref is
5348 not used to mean `ref' but `ref or out' in ParameterReference
5350 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
5351 full type signature instead of calling TypeManger.CSharpName
5354 * support.cs (InternalParameters.ParameterDesc): Do not compare
5355 directly to the modflags, because REF/OUT will actually be bitsets
5358 * delegate.cs (VerifyMethod): Check also the modifiers.
5360 * cs-tokenizer.cs: Fix bug where floating point values with an
5361 exponent where a sign was missing was ignored.
5363 * driver.cs: Allow multiple assemblies to be specified in a single
5366 2002-10-28 Miguel de Icaza <miguel@ximian.com>
5368 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
5369 because identifiers after a parenthesis would end up in this kind
5370 of production, and we needed to desamiguate it for having casts
5373 (UserDefinedType *) xxx
5375 2002-10-24 Miguel de Icaza <miguel@ximian.com>
5377 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
5378 we should set on the Bindingflags.NonPublic, but not turn on
5379 private_ok. private_ok controls whether a Private member is
5380 returned (this is chekced on the filter routine), while the
5381 BindingFlags.NonPublic just controls whether private/protected
5382 will be allowed. This fixes the problem part of the problem of
5383 private properties being allowed to be used in derived classes.
5385 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
5386 so we can call the children DoResolveLValue method (this will
5387 properly signal errors on lvalue assignments to base properties)
5389 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
5390 getter are null, and we have a property info, we know that this
5391 happened because the lookup failed, so we report an error 122 for
5392 protection level violation.
5394 We also silently return if setter and getter are null in the
5395 resolve functions, this condition only happens if we have flagged
5396 the error before. This is the other half of the problem.
5398 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
5399 not have accessibility information, that is why we were returning
5400 true in the filter function in typemanager.cs.
5402 To properly report 122 (property is inaccessible because of its
5403 protection level) correctly, we report this error in ResolveAccess
5404 by failing if both the setter and the getter are lacking (ie, the
5407 DoResolve and DoLResolve have been modified to check for both
5408 setter/getter being null and returning silently, the reason being
5409 that I did not want to put the knowledge about this error in upper
5412 int old = Report.Errors;
5413 x = new PropertyExpr (...);
5414 if (old != Report.Errors)
5419 So the property expr is returned, but it is invalid, so the error
5420 will be flagged during the resolve process.
5422 * class.cs: Remove InheritablePropertySignatureCompare from the
5423 class, as we no longer depend on the property signature to compute
5424 whether it is possible to implement a method or not.
5426 The reason is that calling PropertyInfo.GetGetMethod will return
5427 null (in .NET, in Mono it works, and we should change this), in
5428 cases where the Get Method does not exist in that particular
5433 class X { public virtual int A { get { return 1; } } }
5435 class Z : Y { public override int A { get { return 2; } } }
5437 Would fail in Z because the parent (Y) would not have the property
5438 defined. So we avoid this completely now (because the alternative
5439 fix was ugly and slow), and we now depend exclusively on the
5442 (PropertyBase.CheckBase): Use a method-base mechanism to find our
5443 reference method, instead of using the property.
5445 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
5446 routines are gone now.
5448 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
5449 names, they were incorrectly named.
5451 * cs-tokenizer.cs: Return are more gentle token on failure.
5453 * pending.cs (PendingImplementation.InterfaceMethod): This routine
5454 had an out-of-sync index variable, which caused it to remove from
5455 the list of pending methods the wrong method sometimes.
5457 2002-10-22 Miguel de Icaza <miguel@ximian.com>
5459 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5460 CanWrite, because those refer to this particular instance of the
5461 property, and do not take into account the fact that we can
5462 override single members of a property.
5464 Constructor requires an EmitContext. The resolution process does
5465 not happen here, but we need to compute the accessors before,
5466 because the resolution does not always happen for properties.
5468 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5469 subclass, before we did not update this flag, but we did update
5472 (GetAccessors): Drop this routine, as it did not work in the
5473 presence of partially overwritten set/get methods.
5475 Notice that this broke the cs1540 detection, but that will require
5478 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5482 * driver.cs: issue a warning instead of an error if we don't support
5483 debugging for the platform. Also ignore a couple of errors that may
5484 arise when trying to write the symbols. Undo my previous patch.
5486 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5488 * driver.cs: ignore /debug switch except for Unix platforms.
5490 2002-10-23 Nick Drochak <ndrochak@gol.com>
5492 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5494 2002-10-21 Miguel de Icaza <miguel@ximian.com>
5496 * driver.cs: Do not make mcs-debug conditional, so we do not break
5499 * statement.cs (UsageVector.MergeChildren): I would like Martin to
5500 review this patch. But basically after all the children variables
5501 have been merged, the value of "Breaks" was not being set to
5502 new_breaks for Switch blocks. I think that it should be set after
5503 it has executed. Currently I set this to the value of new_breaks,
5504 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5505 conservative, but I do not understand this code very well.
5507 I did not break anything in the build, so that is good ;-)
5509 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5511 2002-10-20 Mark Crichton <crichton@gimp.org>
5513 * cfold.cs: Fixed compile blocker. Really fixed it this time.
5515 2002-10-20 Nick Drochak <ndrochak@gol.com>
5517 * cfold.cs: Fixed compile blocker.
5519 2002-10-20 Miguel de Icaza <miguel@ximian.com>
5521 * driver.cs: I was chekcing the key, not the file.
5523 2002-10-19 Ravi Pratap <ravi@ximian.com>
5525 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5526 message that we were generating - we just need to silently return
5529 2002-10-19 Miguel de Icaza <miguel@ximian.com>
5531 * class.cs (Event.Define): Change my previous commit, as this
5532 breaks the debugger. This is a temporary hack, as it seems like
5533 the compiler is generating events incorrectly to begin with.
5535 * expression.cs (Binary.ResolveOperator): Added support for
5536 "U operator - (E x, E y)"
5538 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5541 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5542 init-only variables, but this path did not take into account that
5543 there might be also instance readonly variables. Correct this
5546 This fixes bug 32253
5548 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5551 * driver.cs: Change the extension for modules to `netmodule'
5553 * cs-parser.jay: Improved slightly the location tracking for
5554 the debugger symbols.
5556 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5557 modifiers that were specified instead of the hardcoded value
5558 (FamAndAssem). This was basically ignoring the static modifier,
5559 and others. Fixes 32429.
5561 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5562 fixed a bug in the process (32476)
5564 * expression.cs (ArrayAccess.EmitAssign): Patch from
5565 hwang_rob@yahoo.ca that fixes bug 31834.3
5567 2002-10-18 Miguel de Icaza <miguel@ximian.com>
5569 * driver.cs: Make the module extension .netmodule.
5571 2002-10-16 Miguel de Icaza <miguel@ximian.com>
5573 * driver.cs: Report an error if the resource file is not found
5574 instead of crashing.
5576 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5577 false, like Emit does.
5579 2002-10-16 Nick Drochak <ndrochak@gol.com>
5581 * typemanager.cs: Remove unused private member. Also reported mcs
5582 bug to report this as a warning like csc.
5584 2002-10-15 Martin Baulig <martin@gnome.org>
5586 * statement.cs (Statement.Emit): Made this a virtual method; emits
5587 the line number info and calls DoEmit().
5588 (Statement.DoEmit): New protected abstract method, formerly knows
5589 as Statement.Emit().
5591 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5593 2002-10-11 Miguel de Icaza <miguel@ximian.com>
5595 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5596 have fixed a remaining problem: not every AddXXXX was adding a
5597 fully qualified name.
5599 Now everyone registers a fully qualified name in the DeclSpace as
5600 being defined instead of the partial name.
5602 Downsides: we are slower than we need to be due to the excess
5603 copies and the names being registered this way.
5605 The reason for this is that we currently depend (on the corlib
5606 bootstrap for instance) that types are fully qualified, because
5607 we dump all the types in the namespace, and we should really have
5608 types inserted into the proper namespace, so we can only store the
5609 basenames in the defined_names array.
5611 2002-10-10 Martin Baulig <martin@gnome.org>
5613 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5614 from bug #31834, see the bug report for a testcase which is
5617 2002-10-10 Martin Baulig <martin@gnome.org>
5619 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5620 flow analysis code for this.
5622 * statement.cs (Do, While, For): Tell the flow analysis code about
5624 (FlowBranching.UsageVector): Added support for infinite loops.
5625 (Block.Resolve): Moved the dead code elimination here and use flow
5628 2002-10-09 Miguel de Icaza <miguel@ximian.com>
5630 * class.cs (Field.Define): Catch cycles on struct type
5633 * typemanager.cs (IsUnmanagedtype): Do not recursively check
5634 fields if the fields are static. We only need to check instance
5637 * expression.cs (As.DoResolve): Test for reference type.
5639 * statement.cs (Using.ResolveExpression): Use
5640 ConvertImplicitRequired, not ConvertImplicit which reports an
5642 (Using.ResolveLocalVariableDecls): ditto.
5644 * expression.cs (Binary.ResolveOperator): Report errors in a few
5645 places where we had to.
5647 * typemanager.cs (IsUnmanagedtype): Finish implementation.
5649 2002-10-08 Miguel de Icaza <miguel@ximian.com>
5651 * expression.cs: Use StoreFromPtr instead of extracting the type
5652 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
5654 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5655 an enumeration value to a System.Enum, but System.Enum is not a
5656 value type, but an class type, so we need to box.
5658 (Expression.ConvertExplicit): One codepath could return
5659 errors but not flag them. Fix this. Fixes #31853
5661 * parameter.cs (Resolve): Do not allow void as a parameter type.
5663 2002-10-06 Martin Baulig <martin@gnome.org>
5665 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5666 if it's a class type and not a struct. Fixes #31815.
5668 2002-10-06 Martin Baulig <martin@gnome.org>
5670 * statement.cs: Reworked the flow analysis code a bit to make it
5671 usable for dead code elimination.
5673 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5675 * cs-parser.jay: allow empty source files. Fixes bug #31781.
5677 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5679 * expression.cs (ComposedCast.DoResolveType): A quick workaround
5680 to fix the test 165, will investigate deeper.
5682 2002-10-04 Martin Baulig <martin@gnome.org>
5684 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5685 finally blocks actually work.
5686 (Try.Resolve): We don't need to create a sibling for `finally' if
5687 there is no finally block.
5689 2002-10-04 Martin Baulig <martin@gnome.org>
5691 * class.cs (Constructor.Define): The default accessibility for a
5692 non-default constructor is private, not public.
5694 2002-10-04 Miguel de Icaza <miguel@ximian.com>
5696 * class.cs (Constructor): Make AllowedModifiers public, add
5699 * cs-parser.jay: Perform the modifiers test here, as the
5700 constructor for the Constructor class usually receives a zero
5701 because of the way we create it (first we create, later we
5702 customize, and we were never checking the modifiers).
5704 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5705 is a version of LookupTypeReflection that includes the type-name
5706 cache. This can be used as a fast path for functions that know
5707 the fully qualified name and are only calling into *.GetType() to
5708 obtain a composed type.
5710 This is also used by TypeManager.LookupType during its type
5713 (LookupType): We now also track the real type name, as sometimes
5714 we can get a quey for the real type name from things like
5715 ComposedCast. This fixes bug 31422.
5717 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5718 complete type fullname, it does not have to go through the type
5719 resolution system to obtain the composed version of the type (for
5720 obtaining arrays or pointers).
5722 (Conditional.Emit): Use the EmitBoolExpression to
5723 generate nicer code, as requested by Paolo.
5725 (ArrayCreation.CheckIndices): Use the patch from
5726 hwang_rob@yahoo.ca to validate the array initializers.
5728 2002-10-03 Miguel de Icaza <miguel@ximian.com>
5730 * class.cs (ConstructorInitializer.Emit): simplify code by using
5731 Invocation.EmitCall, and at the same time, fix the bugs in calling
5732 parent constructors that took variable arguments.
5734 * ecore.cs (Expression.ConvertNumericExplicit,
5735 Expression.ImplicitNumericConversion): Remove the code that
5736 manually wrapped decimal (InternalTypeConstructor call is now gone
5739 * expression.cs (Cast.TryReduce): Also handle decimal types when
5740 trying to perform a constant fold on the type.
5742 * typemanager.cs (IsUnmanagedtype): Partially implemented.
5744 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5745 that only turned off an error report, and did nothing else.
5747 2002-10-02 Miguel de Icaza <miguel@ximian.com>
5749 * driver.cs: Handle and ignore /fullpaths
5751 2002-10-01 Miguel de Icaza <miguel@ximian.com>
5753 * expression.cs (Binary.ResolveOperator): Catch the case where
5754 DoNumericPromotions returns true,
5756 (Binary.DoNumericPromotions): Simplify the code, and the tests.
5758 2002-09-27 Miguel de Icaza <miguel@ximian.com>
5760 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
5763 2002-09-26 Miguel de Icaza <miguel@ximian.com>
5765 * ecore.cs (ConvertNumericExplicit): It is not enough that the
5766 conversion exists, but it is also required that the conversion be
5767 performed. This manifested in "(Type64Enum) 2".
5769 * class.cs (TypeManager.AddMethod): The fix is not to change
5770 AddEnum, because that one was using a fully qualified name (every
5771 DeclSpace derivative does), but to change the AddMethod routine
5772 that was using an un-namespaced name. This now correctly reports
5773 the duplicated name.
5775 Revert patch until I can properly fix it. The issue
5776 is that we have a shared Type space across all namespaces
5777 currently, which is wrong.
5779 Options include making the Namespace a DeclSpace, and merge
5780 current_namespace/current_container in the parser.
5782 2002-09-25 Miguel de Icaza <miguel@ximian.com>
5784 * cs-parser.jay: Improve error reporting when we get a different
5785 kind of expression in local_variable_type and
5786 local_variable_pointer_type.
5788 Propagate this to avoid missleading errors being reported.
5790 * ecore.cs (ImplicitReferenceConversion): treat
5791 TypeManager.value_type as a target just like object_type. As
5796 Is valid, and needs to result in the int 1 being boxed before it
5797 is assigned to the value type v.
5799 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
5800 to validate the enumeration name.
5802 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
5803 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
5804 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
5806 * ecore.cs (TryImplicitIntConversion): When doing an
5807 implicit-enumeration-conversion, check if the type is 64-bits and
5808 perform a conversion before passing to EnumConstant.
5810 2002-09-23 Miguel de Icaza <miguel@ximian.com>
5812 * decl.cs (Error_AmbiguousTypeReference); New routine used to
5813 report ambiguous type references. Unlike the MS version, we
5814 report what the ambiguity is. Innovation at work ;-)
5816 (DeclSpace.FindType): Require a location argument to
5817 display when we display an ambiguous error.
5819 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
5821 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
5823 * expression.cs (EmitDynamicInitializers): Apply patch from
5824 hwang_rob@yahoo.ca that fixes the order in which we emit our
5827 2002-09-21 Martin Baulig <martin@gnome.org>
5829 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
5830 delegate takes no arguments.
5832 2002-09-20 Miguel de Icaza <miguel@ximian.com>
5834 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
5837 * expression.cs: Extract the underlying type.
5839 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
5841 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
5843 2002-09-19 Miguel de Icaza <miguel@ximian.com>
5845 * class.cs (TypeContainer.DefineType): We can not use the nice
5846 PackingSize with the size set to 1 DefineType method, because it
5847 will not allow us to define the interfaces that the struct
5850 This completes the fixing of bug 27287
5852 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
5853 means also structs. This fixes part of the problem.
5854 (Expresion.ImplicitReferenceConversionExists): ditto.
5856 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
5857 error if there were no errors reported during the type lookup
5858 process, to avoid duplicates or redundant errors. Without this
5859 you would get an ambiguous errors plus a type not found. We have
5860 beaten the user enough with the first error.
5862 (DeclSparce.FindType): Emit a warning if we have an ambiguous
5865 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
5866 during the resolution process, stop the lookup, this avoids
5867 repeated error reports (same error twice).
5869 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
5871 * typemanager.cs (LookupType): Redo the type lookup code to match
5872 the needs of System.Reflection.
5874 The issue is that System.Reflection requires references to nested
5875 types to begin with a "+" sign instead of a dot. So toplevel
5876 types look like: "NameSpace.TopLevelClass", and nested ones look
5877 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
5880 2002-09-19 Martin Baulig <martin@gnome.org>
5882 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
5883 says that a method always returns or always throws an exception,
5884 don't report the CS0161.
5886 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
5887 set `Returns = new_returns'.
5889 2002-09-19 Martin Baulig <martin@gnome.org>
5891 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
5892 to an enum constant, check for a CS0176.
5894 2002-09-18 Miguel de Icaza <miguel@ximian.com>
5896 * class.cs (TypeContainer.CheckPairedOperators): Now we check
5897 for operators that must be in pairs and report errors.
5899 * ecore.cs (SimpleName.DoResolveType): During the initial type
5900 resolution process, when we define types recursively, we must
5901 check first for types in our current scope before we perform
5902 lookups in the enclosing scopes.
5904 * expression.cs (MakeByteBlob): Handle Decimal blobs.
5906 (Invocation.VerifyArgumentsCompat): Call
5907 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
5908 I thought we were supposed to always call this, but there are a
5909 few places in the code where we dont do it.
5911 2002-09-17 Miguel de Icaza <miguel@ximian.com>
5913 * driver.cs: Add support in -linkres and -resource to specify the
5914 name of the identifier.
5916 2002-09-16 Miguel de Icaza <miguel@ximian.com>
5918 * ecore.cs (StandardConversionExists): Sync with the conversion
5919 code: allow anything-* to void* conversions.
5921 (FindMostSpecificSource): Use an Expression argument
5922 instead of a Type, because we might be handed over a Literal which
5923 gets a few more implicit conversions that plain types do not. So
5924 this information was being lost.
5926 Also, we drop the temporary type-holder expression when not
5929 2002-09-17 Martin Baulig <martin@gnome.org>
5931 * class.cs (PropertyBase.CheckBase): Don't check the base class if
5932 this is an explicit interface implementation.
5934 2002-09-17 Martin Baulig <martin@gnome.org>
5936 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
5937 different `IndexerName' attributes.
5939 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
5940 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
5941 virtual CommonResolve().
5943 2002-09-16 Miguel de Icaza <miguel@ximian.com>
5945 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
5946 and convert that to the UnderlyingType.
5948 * statement.cs (Foreach.Resolve): Indexers are just like variables
5949 or PropertyAccesses.
5951 * cs-tokenizer.cs (consume_string): Track line numbers and columns
5952 inside quoted strings, we were not doing this before.
5954 2002-09-16 Martin Baulig <martin@gnome.org>
5956 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
5957 resolve it. This is needed for the definite assignment check of the
5958 instance expression, fixes bug #29846.
5959 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
5961 2002-09-16 Nick Drochak <ndrochak@gol.com>
5963 * parameter.cs: Fix compile error. Cannot reference static member
5964 from an instance object. Is this an mcs bug?
5966 2002-09-14 Martin Baulig <martin@gnome.org>
5968 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
5969 multiple times. Fixes bug #30295, added test-166.cs.
5971 2002-09-14 Martin Baulig <martin@gnome.org>
5973 * statement.cs (Block.Emit): Don't emit unreachable code.
5974 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
5976 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
5978 2002-09-14 Martin Baulig <martin@gnome.org>
5980 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
5983 2002-09-14 Martin Baulig <martin@gnome.org>
5985 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
5986 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
5987 be false on the ms runtime.
5989 2002-09-13 Martin Baulig <martin@gnome.org>
5991 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
5992 the CS0038 error message.
5994 2002-09-12 Miguel de Icaza <miguel@ximian.com>
5996 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
5997 constant inside, return it.
5999 2002-09-12 Martin Baulig <martin@gnome.org>
6001 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
6002 implicit conversion can be done between enum types.
6004 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
6005 check whether an implicit conversion to the current enum's UnderlyingType
6006 exists and report an error if not.
6008 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
6009 without debugging support.
6011 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
6012 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
6014 2002-09-12 Martin Baulig <martin@gnome.org>
6016 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
6018 * ecore.cs (IMemberExpr.DeclaringType): New property.
6019 (SimpleName.SimpleNameResolve): Check whether we're accessing a
6020 nonstatic member of an outer type (CS0038).
6022 2002-09-11 Miguel de Icaza <miguel@ximian.com>
6024 * driver.cs: Activate the using-error detector at warning level
6025 4 (at least for MS-compatible APIs).
6027 * namespace.cs (VerifyUsing): Small buglett fix.
6029 * pending.cs (PendingImplementation): pass the container pointer.
6031 * interface.cs (GetMethods): Allow for recursive definition. Long
6032 term, I would like to move every type to support recursive
6033 definitions, not the current ordering mechanism that we have right
6036 The situation is this: Attributes are handled before interfaces,
6037 so we can apply attributes to interfaces. But some attributes
6038 implement interfaces, we will now handle the simple cases
6039 (recursive definitions will just get an error).
6041 * parameter.cs: Only invalidate types at the end if we fail to
6044 2002-09-09 Martin Baulig <martin@gnome.org>
6046 * ecore.cs (PropertyExpr.Emit): Also check for
6047 TypeManager.system_int_array_get_length so this'll also work when
6048 compiling corlib. Fixes #30003.
6050 2002-09-09 Martin Baulig <martin@gnome.org>
6052 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
6053 and throw an exception if we can't get the type's size. Fixed #30040,
6056 2002-09-09 Martin Baulig <martin@gnome.org>
6058 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
6060 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
6061 context. Fixes bug #30027.
6063 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
6064 virtual functions. Fixes bug #30043, added test-164.cs.
6066 2002-09-08 Ravi Pratap <ravi@ximian.com>
6068 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
6070 2002-09-08 Nick Drochak <ndrochak@gol.com>
6072 * driver.cs: Use an object to get the windows codepage since it's not a
6075 2002-09-08 Miguel de Icaza <miguel@ximian.com>
6077 * statement.cs (For.Emit): for infinite loops (test == null)
6078 return whether there is a break inside, not always "true".
6080 * namespace.cs (UsingEntry): New struct to hold the name of the
6081 using definition, the location where it is defined, and whether it
6082 has been used in a successful type lookup.
6084 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
6089 2002-09-06 Ravi Pratap <ravi@ximian.com>
6091 * attribute.cs : Fix incorrect code which relied on catching
6092 a NullReferenceException to detect a null being passed in
6093 where an object was expected.
6095 2002-09-06 Miguel de Icaza <miguel@ximian.com>
6097 * statement.cs (Try): flag the catch variable as assigned
6099 * expression.cs (Cast): Simplified by using ResolveType instead of
6102 * statement.cs (Catch): Fix bug by using ResolveType.
6104 2002-09-06 Ravi Pratap <ravi@ximian.com>
6106 * expression.cs (BetterConversion): Special case for when we have
6107 a NullLiteral as the argument and we have to choose between string
6108 and object types - we choose string the way csc does.
6110 * attribute.cs (Attribute.Resolve): Catch the
6111 NullReferenceException and report error #182 since the Mono
6112 runtime no more has the bug and having this exception raised means
6113 we tried to select a constructor which takes an object and is
6116 2002-09-05 Ravi Pratap <ravi@ximian.com>
6118 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
6119 message (1502, 1503) when we can't locate a method after overload
6120 resolution. This is much more informative and closes the bug
6123 * interface.cs (PopulateMethod): Return if there are no argument
6124 types. Fixes a NullReferenceException bug.
6126 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
6127 expressions too. Previously we were checking only in one place for
6128 positional arguments leaving out named arguments.
6130 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
6131 type to the enum type is not allowed. Remove code corresponding to
6134 (ConvertNumericExplicit): Allow explicit conversions from
6135 the underlying type to enum type. This precisely follows the spec
6136 and closes a bug filed by Gonzalo.
6138 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6141 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
6143 2002-09-03 Miguel de Icaza <miguel@ximian.com>
6145 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
6146 it was important that we stored the right value after the
6147 reduction in `converted'.
6149 2002-09-04 Martin Baulig <martin@gnome.org>
6151 * location.cs (Location.SymbolDocument): Use full pathnames for the
6154 2002-08-30 Miguel de Icaza <miguel@ximian.com>
6156 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
6157 of the expression resolve mechanism, because that will catch the
6158 SimpleName error failures.
6160 (Conditional): If we can not resolve the
6161 expression, return, do not crash.
6163 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6166 (location): display token name instead of its number.
6168 2002-08-28 Martin Baulig <martin@gnome.org>
6170 * expression.cs (Binary.ResolveOperator): Don't silently return
6171 but return an error if an operator cannot be applied between two
6174 2002-08-28 Martin Baulig <martin@gnome.org>
6176 * class.cs (Constructor.Define): Set the permission attributes
6177 correctly instead of making all constructors public.
6179 2002-08-28 Martin Baulig <martin@gnome.org>
6181 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
6182 for private members before reporting a CS0103; if we find anything,
6185 2002-08-28 Martin Baulig <martin@gnome.org>
6187 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
6188 to check whether `closure_start_type == closure_invocation_type',
6189 we also need to check whether `m.DeclaringType == closure_invocation_type'
6190 before bypassing the permission checks. We might be accessing
6191 protected/private members from the base class.
6192 (TypeManager.RealMemberLookup): Only set private_ok if private
6193 members were requested via BindingFlags.NonPublic.
6195 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
6197 * expression.cs (MemberAccess.ResolveMemberAccess): Set
6198 MethodGroupExpr.IsExplicitImpl if appropriate.
6199 (Invocation.DoResolve): Don't report the CS0120 for explicit
6200 interface implementations.
6202 2002-08-27 Martin Baulig <martin@gnome.org>
6204 * expression.cs (Invocation.DoResolve): If this is a static
6205 method and we don't have an InstanceExpression, we must report
6208 2002-08-25 Martin Baulig <martin@gnome.org>
6210 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
6211 `==' between a valuetype and an object.
6213 2002-08-25 Miguel de Icaza <miguel@ximian.com>
6215 * ecore.cs (TypeExpr): Provide a ToString method.
6217 2002-08-24 Martin Baulig <martin@gnome.org>
6219 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
6220 now called proggie.dbg and it's a binary file.
6222 2002-08-23 Martin Baulig <martin@gnome.org>
6224 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
6226 2002-08-23 Martin Baulig <martin@gnome.org>
6228 * struct.cs (MyStructInfo.ctor): Make this work with empty
6229 structs; it's not allowed to use foreach() on null.
6231 2002-08-23 Martin Baulig <martin@gnome.org>
6233 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
6234 writer the full pathname of the generated assembly.
6236 2002-08-23 Martin Baulig <martin@gnome.org>
6238 * statements.cs (FlowBranching.UsageVector.MergeChildren):
6239 A `finally' block never returns or breaks; improved handling of
6242 2002-08-23 Martin Baulig <martin@gnome.org>
6244 * statement.cs (Throw.Resolve): Allow `throw null'.
6246 2002-08-23 Martin Baulig <martin@gnome.org>
6248 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
6249 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
6250 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
6251 MemberLookup would return a wrong event if this is an explicit
6252 interface implementation and the class has an event with the same
6255 2002-08-23 Martin Baulig <martin@gnome.org>
6257 * statement.cs (Block.AddChildVariableNames): New public method.
6258 (Block.AddChildVariableName): Likewise.
6259 (Block.IsVariableNameUsedInChildBlock): Likewise.
6260 (Block.AddVariable): Check whether a variable name has already
6261 been used in a child block.
6263 * cs-parser.jay (declare_local_variables): Mark all variable names
6264 from the current block as being used in a child block in the
6267 2002-08-23 Martin Baulig <martin@gnome.org>
6269 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
6270 find the symbol writer.
6272 * driver.cs: csc also allows the arguments to /define being
6273 separated by commas, not only by semicolons.
6275 2002-08-23 Martin Baulig <martin@gnome.org>
6277 * interface.cs (Interface.GetMembers): Added static check for events.
6279 2002-08-15 Martin Baulig <martin@gnome.org>
6281 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
6282 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
6284 * ecore.cs (Expression.MemberLookup): Added documentation and explained
6285 why the MethodData.EmitDestructor() change was necessary.
6287 2002-08-20 Martin Baulig <martin@gnome.org>
6289 * class.cs (TypeContainer.FindMembers): Added static check for events.
6291 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
6293 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
6294 use Type.GetEvents(), not Type.FindMembers().
6296 2002-08-20 Martin Baulig <martin@gnome.org>
6298 * decl.cs (MemberCache): Added a special method cache which will
6299 be used for method-only searched. This ensures that a method
6300 search will return a MethodInfo with the correct ReflectedType for
6303 2002-08-20 Martin Baulig <martin@gnome.org>
6305 * decl.cs (DeclSpace.FindMembers): Made this public.
6307 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6309 * delegate.cs: fixed build on windows.
6310 [FIXME: Filed as bug #29150: MCS must report these errors.]
6312 2002-08-19 Ravi Pratap <ravi@ximian.com>
6314 * ecore.cs (StandardConversionExists): Return a false
6315 if we are trying to convert the void type to anything else
6316 since that is not allowed.
6318 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
6319 we flag error 70 in the event an event is trying to be accessed
6320 directly from outside the declaring type.
6322 2002-08-20 Martin Baulig <martin@gnome.org>
6324 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
6325 MemberCache from typemanager.cs to decl.cs.
6327 2002-08-19 Martin Baulig <martin@gnome.org>
6329 * class.cs (TypeContainer): Implement IMemberContainer.
6330 (TypeContainer.DefineMembers): Create the MemberCache.
6331 (TypeContainer.FindMembers): Do better BindingFlags checking; only
6332 return public members if BindingFlags.Public was given, check
6333 whether members are static.
6335 2002-08-16 Martin Baulig <martin@gnome.org>
6337 * decl.cs (DeclSpace.Define): Splitted this in Define and
6338 DefineMembers. DefineMembers is called first and initializes the
6341 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
6342 DefineMembers() on all our DeclSpaces.
6344 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
6345 but call DefineMembers() on all nested interfaces. We call their
6346 Define() in our new Define() function.
6348 * interface.cs (Interface): Implement IMemberContainer.
6349 (Interface.Define): Moved all code except the attribute stuf to
6351 (Interface.DefineMembers): Initialize the member cache.
6353 * typemanager.cs (IMemberFinder): Removed this interface, we don't
6354 need this anymore since we can use MemberCache.FindMembers directly.
6356 2002-08-19 Martin Baulig <martin@gnome.org>
6358 * typemanager.cs (MemberCache): When creating the cache for an
6359 interface type, add all inherited members.
6360 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
6361 to `out bool used_cache' and documented it.
6362 (TypeManager.MemberLookup): If we already used the cache in the first
6363 iteration, we don't need to do the interfaces check.
6365 2002-08-19 Martin Baulig <martin@gnome.org>
6367 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
6368 here from IMemberFinder and don't implement this interface anymore.
6369 (DeclSpace.MemberCache): Moved here from IMemberFinder.
6371 * typemanager.cs (IMemberFinder): This interface is now only used by
6372 classes which actually support the member cache.
6373 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
6374 since we only put DeclSpaces into this Hashtable.
6375 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
6376 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
6378 2002-08-16 Martin Baulig <martin@gnome.org>
6380 * typemanager.cs (ICachingMemberFinder): Removed.
6381 (IMemberFinder.MemberCache): New property.
6382 (TypeManager.FindMembers): Merged this with RealFindMembers().
6383 This function will never be called from TypeManager.MemberLookup()
6384 so we can't use the cache here, just the IMemberFinder.
6385 (TypeManager.MemberLookup_FindMembers): Check whether the
6386 IMemberFinder has a MemberCache and call the cache's FindMembers
6388 (MemberCache): Rewrote larger parts of this yet another time and
6389 cleaned it up a bit.
6391 2002-08-15 Miguel de Icaza <miguel@ximian.com>
6393 * driver.cs (LoadArgs): Support quoting.
6395 (Usage): Show the CSC-like command line arguments.
6397 Improved a few error messages.
6399 2002-08-15 Martin Baulig <martin@gnome.org>
6401 * typemanager.cs (IMemberContainer.Type): New property.
6402 (IMemberContainer.IsInterface): New property.
6404 The following changes are conditional to BROKEN_RUNTIME, which is
6405 defined at the top of the file.
6407 * typemanager.cs (MemberCache.MemberCache): Don't add the base
6408 class'es members, but add all members from TypeHandle.ObjectType
6409 if we're an interface.
6410 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
6411 is the current type.
6412 (MemberCache.CacheEntry.Container): Removed this field.
6413 (TypeHandle.GetMembers): Include inherited members.
6415 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6417 * typemanager.cs: fixed compilation and added a comment on a field that
6420 2002-08-15 Martin Baulig <martin@gnome.org>
6422 * class.cs (ConstructorInitializer.Resolve): In the
6423 Expression.MemberLookup call, use the queried_type as
6426 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
6427 declared' attribute, it's always true.
6428 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
6429 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
6430 temporary wrapper for FindMembers which tells MemberLookup whether
6431 members from the base classes are included in the return value.
6432 This will go away soon.
6433 (TypeManager.MemberLookup): Use this temporary hack here; once the
6434 new MemberCache is completed, we don't need to do the DeclaredOnly
6435 looping here anymore since the MemberCache will take care of this.
6436 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
6437 (MemberCache): When creating the MemberCache for a class, get
6438 members from the current class and all its base classes.
6439 (MemberCache.CacheEntry.Container): New field. This is a
6440 temporary hack until the Mono runtime is fixed to distinguish
6441 between ReflectedType and DeclaringType. It allows us to use MCS
6442 with both the MS runtime and the unfixed Mono runtime without
6443 problems and without accecting performance.
6444 (MemberCache.SearchMembers): The DeclaredOnly looping from
6445 TypeManager.MemberLookup is now done here.
6447 2002-08-14 Martin Baulig <martin@gnome.org>
6449 * statement.cs (MyStructInfo.MyStructInfo): Don't call
6450 Type.GetFields on dynamic types but get the fields from the
6451 corresponding TypeContainer.
6452 (MyStructInfo.GetStructInfo): Added check for enum types.
6454 * typemanager.cs (MemberList.IsSynchronized): Implemented.
6455 (MemberList.SyncRoot): Implemented.
6456 (TypeManager.FilterWithClosure): No need to check permissions if
6457 closure_start_type == closure_invocation_type, don't crash if
6458 closure_invocation_type is null.
6460 2002-08-13 Martin Baulig <martin@gnome.org>
6462 Rewrote TypeContainer.FindMembers to use a member cache. This
6463 gives us a speed increase of about 35% for the self-hosting MCS
6464 build and of about 15-20% for the class libs (both on GNU/Linux).
6466 * report.cs (Timer): New class to get enhanced profiling. This
6467 whole class is "TIMER" conditional since it remarkably slows down
6470 * class.cs (MemberList): New class. This is an IList wrapper
6471 which we're now using instead of passing MemberInfo[]'s around to
6472 avoid copying this array unnecessarily.
6473 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6474 (ICachingMemberFinder, IMemberContainer): New interface.
6475 (TypeManager.FilterWithClosure): If `criteria' is null, the name
6476 has already been checked, otherwise use it for the name comparision.
6477 (TypeManager.FindMembers): Renamed to RealMemberFinder and
6478 provided wrapper which tries to use ICachingMemberFinder.FindMembers
6479 if possible. Returns a MemberList, not a MemberInfo [].
6480 (TypeHandle): New class, implements IMemberContainer. We create
6481 one instance of this class per type, it contains a MemberCache
6482 which is used to do the member lookups.
6483 (MemberCache): New class. Each instance of this class contains
6484 all members of a type and a name-based hash table.
6485 (MemberCache.FindMembers): This is our new member lookup
6486 function. First, it looks up all members of the requested name in
6487 the hash table. Then, it walks this list and sorts out all
6488 applicable members and returns them.
6490 2002-08-13 Martin Baulig <martin@gnome.org>
6492 In addition to a nice code cleanup, this gives us a performance
6493 increase of about 1.4% on GNU/Linux - not much, but it's already
6494 half a second for the self-hosting MCS compilation.
6496 * typemanager.cs (IMemberFinder): New interface. It is used by
6497 TypeManager.FindMembers to call FindMembers on a TypeContainer,
6498 Enum, Delegate or Interface.
6499 (TypeManager.finder_to_member_finder): New PtrHashtable.
6500 (TypeManager.finder_to_container): Removed.
6501 (TypeManager.finder_to_delegate): Removed.
6502 (TypeManager.finder_to_interface): Removed.
6503 (TypeManager.finder_to_enum): Removed.
6505 * interface.cs (Interface): Implement IMemberFinder.
6507 * delegate.cs (Delegate): Implement IMemberFinder.
6509 * enum.cs (Enum): Implement IMemberFinder.
6511 * class.cs (TypeContainer): Implement IMemberFinder.
6513 2002-08-12 Martin Baulig <martin@gnome.org>
6515 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6517 2002-08-12 Martin Baulig <martin@gnome.org>
6519 * ecore.cs (ITypeExpression): New interface for expressions which
6521 (TypeExpression): Renamed to TypeLookupExpression.
6522 (Expression.DoResolve): If we're doing a types-only lookup, the
6523 expression must implement the ITypeExpression interface and we
6524 call DoResolveType() on it.
6525 (SimpleName): Implement the new ITypeExpression interface.
6526 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6527 hack, the situation that we're only looking up types can't happen
6528 anymore when this method is called. Moved the type lookup code to
6529 DoResolveType() and call it.
6530 (SimpleName.DoResolveType): This ITypeExpression interface method
6531 is now doing the types-only lookup.
6532 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6533 (ResolveFlags): Added MaskExprClass.
6535 * expression.cs (MemberAccess): Implement the ITypeExpression
6537 (MemberAccess.DoResolve): Added support for a types-only lookup
6538 when we're called via ITypeExpression.DoResolveType().
6539 (ComposedCast): Implement the ITypeExpression interface.
6541 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
6542 Expression.Resolve() with ResolveFlags.Type instead.
6544 2002-08-12 Martin Baulig <martin@gnome.org>
6546 * interface.cs (Interface.Define): Apply attributes.
6548 * attribute.cs (Attribute.ApplyAttributes): Added support for
6549 interface attributes.
6551 2002-08-11 Martin Baulig <martin@gnome.org>
6553 * statement.cs (Block.Emit): Only check the "this" variable if we
6554 do not always throw an exception.
6556 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6557 whether the property has a set accessor.
6559 2002-08-11 Martin Baulig <martin@gnome.org>
6561 Added control flow analysis support for structs.
6563 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6564 with control flow analysis turned off.
6565 (IVariable): New interface.
6566 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6567 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6568 (FieldExpr.DoResolve): Resolve the instance expression with flow
6569 analysis turned off and do the definite assignment check after the
6570 resolving when we know what the expression will resolve to.
6572 * expression.cs (LocalVariableReference, ParameterReference):
6573 Implement the new IVariable interface, only call the flow analysis
6574 code if ec.DoFlowAnalysis is true.
6575 (This): Added constructor which takes a Block argument. Implement
6576 the new IVariable interface.
6577 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6578 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6579 This does the definite assignment checks for struct members.
6581 * class.cs (Constructor.Emit): If this is a non-static `struct'
6582 constructor which doesn't have any initializer, call
6583 Block.AddThisVariable() to tell the flow analysis code that all
6584 struct elements must be initialized before control returns from
6587 * statement.cs (MyStructInfo): New public class.
6588 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6589 argument to this indexer. If non-zero, check an individual struct
6590 member, not the whole struct.
6591 (FlowBranching.CheckOutParameters): Check struct members.
6592 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6593 overloaded versions of these methods which take an additional
6594 `int field_idx' argument to check struct members.
6595 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6596 overloaded versions of these methods which take an additional
6597 `string field_name' argument to check struct member.s
6598 (VariableInfo): Implement the IVariable interface.
6599 (VariableInfo.StructInfo): New public property. Returns the
6600 MyStructInfo instance of the variable if it's a struct or null.
6601 (Block.AddThisVariable): New public method. This is called from
6602 Constructor.Emit() for non-static `struct' constructor which do
6603 not have any initializer. It creates a special variable for the
6604 "this" instance variable which will be checked by the flow
6605 analysis code to ensure that all of the struct's fields are
6606 initialized before control returns from the constructor.
6607 (UsageVector): Added support for struct members. If a
6608 variable/parameter is a struct with N members, we reserve a slot
6609 in the usage vector for each member. A struct is considered fully
6610 initialized if either the struct itself (slot 0) or all its
6611 members are initialized.
6613 2002-08-08 Martin Baulig <martin@gnome.org>
6615 * driver.cs (Driver.MainDriver): Only report an error CS5001
6616 if there were no compilation errors.
6618 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6619 `UnsafeContext' property to determine whether the parent is in
6620 unsafe context rather than checking the parent's ModFlags:
6621 classes nested in an unsafe class are unsafe as well.
6623 2002-08-08 Martin Baulig <martin@gnome.org>
6625 * statement.cs (UsageVector.MergeChildren): Distinguish between
6626 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6627 we return. Added test17() and test18() to test-154.cs.
6629 2002-08-08 Martin Baulig <martin@gnome.org>
6631 * typemanager.cs (TypeManager.FilterWithClosure): If we have
6632 Family access, make sure the invoking type isn't a subclass of the
6633 queried type (that'd be a CS1540).
6635 * ecore.cs (Expression.MemberLookup): Added overloaded version of
6636 this method which takes an additional `Type invocation_type'.
6638 * expression.cs (BaseAccess.DoResolve): Use the base type as
6639 invocation and query type.
6640 (MemberAccess.DoResolve): If the lookup failed and we're about to
6641 report a CS0122, try a lookup with the ec.ContainerType - if this
6642 succeeds, we must report a CS1540.
6644 2002-08-08 Martin Baulig <martin@gnome.org>
6646 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6647 (MethodGroupExpr): Implement the IMemberExpr interface.
6649 * expression (MemberAccess.ResolveMemberAccess): No need to have
6650 any special code for MethodGroupExprs anymore, they're now
6653 2002-08-08 Martin Baulig <martin@gnome.org>
6655 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6656 Family, FamANDAssem and FamORAssem permissions.
6657 (TypeManager.IsSubclassOrNestedChildOf): New public method.
6659 2002-08-08 Martin Baulig <martin@gnome.org>
6661 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6662 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6665 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6667 * driver.cs: implemented /resource option to embed managed resources.
6669 2002-08-07 Martin Baulig <martin@gnome.org>
6671 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6672 (FieldBase.HasFieldInitializer): New public property.
6673 (FieldBase.GetInitializerExpression): New public method. Resolves and
6674 returns the field initializer and makes sure it is only resolved once.
6675 (TypeContainer.EmitFieldInitializers): Call
6676 FieldBase.GetInitializerExpression to get the initializer, this ensures
6677 that it isn't resolved multiple times.
6679 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
6680 the resolving process (SimpleName/MemberLookup) that we're currently
6681 emitting a field initializer (which must not access any instance members,
6682 this is an error CS0236).
6684 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6685 argument, if the `IsFieldInitializer' flag is set, we must report and
6686 error CS0236 and not an error CS0120.
6688 2002-08-07 Martin Baulig <martin@gnome.org>
6690 * ecore.cs (IMemberExpr): New public interface.
6691 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6692 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6693 if the expression is an IMemberExpr.
6695 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6696 to be null, implicitly default to `this' if we're non-static in
6697 this case. Simplified the code a lot by using the new IMemberExpr
6698 interface. Also fixed bug #28176 here.
6700 2002-08-06 Martin Baulig <martin@gnome.org>
6702 * cs-parser.jay (SimpleLookup): Removed. We need to create
6703 ParameterReferences during semantic analysis so that we can do a
6704 type-only search when resolving Cast, TypeOf and SizeOf.
6705 (block): Pass the `current_local_parameters' to the Block's
6708 * class.cs (ConstructorInitializer): Added `Parameters parameters'
6709 argument to the constructor.
6710 (ConstructorInitializer.Resolve): Create a temporary implicit
6711 block with the parameters.
6713 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6714 references here if we aren't doing a type-only search.
6716 * statement.cs (Block): Added constructor which takes a
6717 `Parameters parameters' argument.
6718 (Block.Parameters): New public property.
6720 * support.cs (InternalParameters.Parameters): Renamed `parameters'
6721 to `Parameters' and made it public readonly.
6723 2002-08-06 Martin Baulig <martin@gnome.org>
6725 * ecore.cs (Expression.Warning): Made this public as well.
6727 * report.cs (Report.Debug): Print the contents of collections.
6729 2002-08-06 Martin Baulig <martin@gnome.org>
6731 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
6732 used to tell Resolve() which kinds of expressions it may return.
6733 (Expression.Resolve): Added overloaded version of this method which
6734 takes a `ResolveFlags flags' argument. This can be used to tell
6735 Resolve() which kinds of expressions it may return. Reports a
6737 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6738 ResolveFlags.SimpleName.
6739 (Expression.Error118): Added overloaded version of this method which
6740 takes a `ResolveFlags flags' argument. It uses the flags to determine
6741 which kinds of expressions are allowed.
6743 * expression.cs (Argument.ResolveMethodGroup): New public method.
6744 Resolves an argument, but allows a MethodGroup to be returned.
6745 This is used when invoking a delegate.
6747 * TODO: Updated a bit.
6749 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6751 Fixed compilation with csc.
6753 * ecore.cs: Expression.Error made public. Is this correct? Should
6754 Warning be made public too?
6756 * expression.cs: use ea.Location instead of ea.loc.
6757 [FIXME: Filed as bug #28607: MCS must report these errors.]
6759 2002-08-06 Martin Baulig <martin@gnome.org>
6761 * ecore.cs (Expression.loc): Moved the location here instead of
6762 duplicating it in all derived classes.
6763 (Expression.Location): New public property.
6764 (Expression.Error, Expression.Warning): Made them non-static and
6765 removed the location argument.
6766 (Expression.Warning): Added overloaded version which takes an
6767 `int level' argument.
6768 (Expression.Error118): Make this non-static and removed the
6769 expression and location arguments.
6770 (TypeExpr): Added location argument to the constructor.
6772 * expression.cs (StaticCallExpr): Added location argument to
6774 (Indirection, PointerArithmetic): Likewise.
6775 (CheckedExpr, UnCheckedExpr): Likewise.
6776 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
6777 (StringPtr): Likewise.
6780 2002-08-05 Martin Baulig <martin@gnome.org>
6782 * expression.cs (BaseAccess.DoResolve): Actually report errors.
6784 * assign.cs (Assign.DoResolve): Check whether the source
6785 expression is a value or variable.
6787 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
6788 while resolving the corresponding blocks.
6790 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
6791 an error, don't silently return null.
6793 * statement.cs (Block.AddVariable): Do the error reporting here
6794 and distinguish between CS0128 and CS0136.
6795 (Block.DoResolve): Report all unused labels (warning CS0164).
6796 (LabeledStatement): Pass the location to the constructor.
6797 (LabeledStatement.HasBeenReferenced): New property.
6798 (LabeledStatement.Resolve): Set it to true here.
6800 * statement.cs (Return.Emit): Return success even after reporting
6801 a type mismatch error (CS0126 or CS0127), this is what csc does and
6802 it avoids confusing the users with any consecutive errors.
6804 2002-08-05 Martin Baulig <martin@gnome.org>
6806 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
6808 * const.cs (Const.LookupConstantValue): Catch circular definitions.
6810 * expression.cs (MemberAccess.DoResolve): Silently return if an
6811 error has already been reported.
6813 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
6814 error has already been reported.
6816 2002-08-05 Martin Baulig <martin@gnome.org>
6818 * statement.cs (UsageVector): Only initialize the `parameters'
6819 vector if we actually have any "out" parameters.
6821 2002-08-05 Martin Baulig <martin@gnome.org>
6823 * expression.cs (Binary.ResolveOperator): When combining delegates,
6824 they must have the same type.
6826 2002-08-05 Martin Baulig <martin@gnome.org>
6828 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
6829 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
6830 work with the ms runtime and we also don't need it: if we're a
6831 PropertyBuilder and not in the `indexer_arguments' hash, then we
6832 are a property and not an indexer.
6834 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
6835 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
6836 since the latter one doesn't work with the ms runtime.
6838 2002-08-03 Martin Baulig <martin@gnome.org>
6840 Fixed bugs #27998 and #22735.
6842 * class.cs (Method.IsOperator): New public field.
6843 (Method.CheckBase): Report CS0111 if there's already a method
6844 with the same parameters in the current class. Report CS0508 when
6845 attempting to change the return type of an inherited method.
6846 (MethodData.Emit): Report CS0179 if a method doesn't have a body
6847 and it's not marked abstract or extern.
6848 (PropertyBase): New abstract base class for Property and Indexer.
6849 (PropertyBase.CheckBase): Moved here from Property and made it work
6851 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
6852 the same so we can reuse it there.
6853 (Property, Indexer): Derive from PropertyBase.
6854 (MethodSignature.inheritable_property_signature_filter): New delegate
6855 to find properties and indexers.
6857 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
6858 argument and improved error reporting.
6860 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
6861 EmptyReadOnlyParameters and made it a property.
6863 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
6864 version of this method which takes a `PropertyInfo indexer'.
6865 (TypeManager.RegisterIndexer): New method.
6867 * class.cs: Added myself as author of this file :-)
6869 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6871 * class.cs: fixed compilation on windoze.
6873 2002-08-03 Martin Baulig <martin@gnome.org>
6875 * interface.cs (Interface.GetInterfaceBases): Check whether all
6876 base interfaces are at least as accessible than the current one.
6878 * class.cs (TypeContainer.GetClassBases): Check whether base types
6879 are at least as accessible than the current type.
6880 (TypeContainer.AsAccessible): Implemented and made non-static.
6881 (MemberBase.CheckParameters): Report errors if the accessibility
6884 * delegate.cs (Delegate.Delegate): The default visibility is
6885 internal for top-level types and private for nested types.
6886 (Delegate.Define): Report errors if the accessibility checks fail.
6888 * enum.cs (Enum.Enum): The default visibility is internal for
6889 top-level types and private for nested types.
6890 (Enum.DefineType): Compute the correct visibility.
6892 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
6893 function which takes a `bool is_toplevel' instead of a TypeContainer.
6895 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
6898 2002-08-02 Martin Baulig <martin@gnome.org>
6900 * expression.cs (LocalVariableReferenc): Added constructor which
6901 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
6902 (LocalVariableReference.IsReadOnly): New property.
6903 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
6904 variable is readonly, use our own readonly flag to do this; you can
6905 use the new constructor to get a writable reference to a read-only
6908 * cs-parser.jay (foreach_statement, using_statement): Get a writable
6909 reference to the local variable.
6911 2002-08-01 Miguel de Icaza <miguel@ximian.com>
6913 * rootcontext.cs (ResolveCore): Also include System.Exception
6915 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
6916 we reach an EmptyStatement.
6918 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
6921 * expression.cs (Binary.ResolveOperator): Check error result in
6924 use brtrue/brfalse directly and avoid compares to null.
6926 2002-08-02 Martin Baulig <martin@gnome.org>
6928 * class.cs (TypeContainer.Define): Define all nested interfaces here.
6929 Fixes bug #28407, added test-155.cs.
6931 2002-08-01 Martin Baulig <martin@gnome.org>
6933 * class.cs (Event.EmitDefaultMethod): Make this work with static
6934 events. Fixes #28311, added verify-3.cs.
6936 2002-08-01 Martin Baulig <martin@gnome.org>
6938 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
6939 `is_disposable' fields.
6940 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
6941 `hm.is_disposable' if we're using the collection pattern.
6942 (Foreach.EmitCollectionForeach): Use the correct type for the
6943 enumerator's local variable, only emit the try/finally block if
6944 necessary (fixes #27713).
6946 2002-08-01 Martin Baulig <martin@gnome.org>
6948 * ecore.cs (Expression.report118): Renamed to Error118 and made
6951 * statement.cs (Throw.Resolve): Check whether the expression is of
6952 the correct type (CS0118) and whether the type derives from
6953 System.Exception (CS0155).
6954 (Catch.Resolve): New method. Do the type lookup here and check
6955 whether it derives from System.Exception (CS0155).
6956 (Catch.CatchType, Catch.IsGeneral): New public properties.
6958 * typemanager.cs (TypeManager.exception_type): Added.
6960 2002-07-31 Miguel de Icaza <miguel@ximian.com>
6962 * driver.cs: Updated About function.
6964 2002-07-31 Martin Baulig <martin@gnome.org>
6966 Implemented Control Flow Analysis.
6968 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
6969 (EmitContext.CurrentBranching): Added.
6970 (EmitContext.StartFlowBranching): Added.
6971 (EmitContext.EndFlowBranching): Added.
6972 (EmitContext.KillFlowBranching): Added.
6973 (EmitContext.IsVariableAssigned): Added.
6974 (EmitContext.SetVariableAssigned): Added.
6975 (EmitContext.IsParameterAssigned): Added.
6976 (EmitContext.SetParameterAssigned): Added.
6977 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
6978 Added control flow analysis stuff here.
6980 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
6981 resolve the expression as lvalue.
6982 (LocalVariableReference.DoResolve): Check whether the variable has
6983 already been assigned.
6984 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
6985 the parameter as assigned here.
6986 (ParameterReference.DoResolve): Check whether the parameter has already
6988 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
6989 expression as lvalue.
6991 * statement.cs (FlowBranching): New class for the flow analysis code.
6992 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
6993 (LabeledStatement.IsDefined): New public property.
6994 (LabeledStatement.AddUsageVector): New public method to tell flow
6995 analyis that the label may be reached via a forward jump.
6996 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
6998 (VariableInfo.Number): New public field. This is used by flow analysis
6999 to number all locals of a block.
7000 (Block.CountVariables): New public property. This is the number of
7001 local variables in this block (including the locals from all parent
7003 (Block.EmitMeta): Number all the variables.
7005 * statement.cs: Added flow analysis support to all classes.
7007 2002-07-31 Martin Baulig <martin@gnome.org>
7009 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
7010 To get debugging messages, compile mcs with /define:MCS_DEBUG and
7011 then use this argument.
7013 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
7015 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
7016 use this to specify /define options.
7018 2002-07-29 Martin Baulig <martin@gnome.org>
7020 * statement.cs (Fixed): Moved all code that does variable lookups
7021 and resolvings from Emit to Resolve.
7023 * statement.cs (For): Moved all code that does variable lookups
7024 and resolvings from Emit to Resolve.
7026 * statement.cs (Using): Moved all code that does variable lookups
7027 and resolvings from Emit to Resolve.
7029 2002-07-29 Martin Baulig <martin@gnome.org>
7031 * attribute.cs (Attribute.Resolve): Explicitly catch a
7032 System.NullReferenceException when creating the
7033 CustromAttributeBuilder and report a different warning message.
7035 2002-07-29 Martin Baulig <martin@gnome.org>
7037 * support.cs (ParameterData.ParameterName): Added method to
7038 get the name of a parameter.
7040 * typemanager.cs (TypeManager.IsValueType): New public method.
7042 2002-07-29 Martin Baulig <martin@gnome.org>
7044 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
7045 is a flag which specifies that it's either ref or out.
7046 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
7047 the out parameter to `out Parameter.Modifier mod', also set the
7048 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
7050 * support.cs (InternalParameters.ParameterModifier): Distinguish
7051 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7052 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7054 * expression.cs (Argument.GetParameterModifier): Distinguish
7055 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7056 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7058 2002-07-29 Martin Baulig <martin@gnome.org>
7060 * expression.cs (ParameterReference.ParameterReference): Added
7061 `Location loc' argument to the constructor.
7063 * cs-parser.jay: Pass location to ParameterReference.
7065 2002-07-28 Miguel de Icaza <miguel@ximian.com>
7067 * statement.cs (Try): Initialize the location.
7069 * cs-parser.jay: pass location to Try.
7071 * expression.cs (Unary.Reduce): Change the prototype to return
7072 whether a constant fold could be performed or not. The result is
7073 returned in an out parameters. In the case of Indirection and
7074 AddressOf, we want to perform the full tests.
7076 2002-07-26 Miguel de Icaza <miguel@ximian.com>
7078 * statement.cs (Statement.Emit): Flag dead code.
7080 2002-07-27 Andrew Birkett <andy@nobugs.org>
7082 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
7084 2002-07-27 Martin Baulig <martin@gnome.org>
7086 * class.cs (MethodData.Define): Put back call to
7087 TypeManager.AddMethod(), accidentally commented this out.
7089 * report.cs (Debug): New public method to print debugging information,
7090 this is `[Conditional ("DEBUG")]'.
7092 2002-07-26 Martin Baulig <martin@gnome.org>
7094 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
7095 (switch_statement): Push the current_block to the switch_stack and
7096 pop it again when we're done with the switch.
7097 (switch_section): The new block is a child of the current_block.
7098 Fixes bug #24007, added test-152.cs.
7100 2002-07-27 Martin Baulig <martin@gnome.org>
7102 * expression.cs (Invocation.EmitArguments): When calling a varargs
7103 function with only its fixed arguments, we need to pass an empty
7106 2002-07-27 Martin Baulig <martin@gnome.org>
7108 Mono 0.13 has been released.
7110 2002-07-25 Miguel de Icaza <miguel@ximian.com>
7112 * driver.cs: Rename --resource to --linkres, because that is what
7113 we do currently, we dont support --resource yet.
7115 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
7117 2002-07-25 Martin Baulig <martin@gnome.org>
7119 * class.cs (MethodData): New public class. This is a `method builder'
7120 class for a method or one accessor of a Property/Indexer/Event.
7121 (MethodData.GetMethodFlags): Moved here from MemberBase.
7122 (MethodData.ApplyAttributes): Likewise.
7123 (MethodData.ApplyObsoleteAttribute): Likewise.
7124 (MethodData.ApplyConditionalAttribute): Likewise.
7125 (MethodData.ApplyDllImportAttribute): Likewise.
7126 (MethodData.CheckAbstractAndExternal): Likewise.
7127 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
7128 (MethodData.Emit): Formerly known as Method.Emit().
7129 (MemberBase): Moved everything which was specific to a single
7130 accessor/method to MethodData.
7131 (Method): Create a new MethodData and call Define() and Emit() on it.
7132 (Property, Indexer, Event): Create a new MethodData objects for each
7133 accessor and call Define() and Emit() on them.
7135 2002-07-25 Martin Baulig <martin@gnome.org>
7137 Made MethodCore derive from MemberBase to reuse the code from there.
7138 MemberBase now also checks for attributes.
7140 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
7141 (MemberBase.GetMethodFlags): Moved here from class Method and marked
7143 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
7144 `CallingConventions cc' and `Attributes opt_attrs' arguments.
7145 (MemberBase.ApplyAttributes): New virtual method; applies the
7146 attributes to a method or accessor.
7147 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
7148 (MemberBase.ApplyConditionalAttribute): Likewise.
7149 (MemberBase.ApplyDllImportAttribute): Likewise.
7150 (MemberBase.CheckAbstractAndExternal): Likewise.
7151 (MethodCore.ParameterTypes): This is now a property instead of a
7152 method, it's initialized from DoDefineParameters().
7153 (MethodCore.ParameterInfo): Removed the set accessor.
7154 (MethodCore.DoDefineParameters): New protected virtual method to
7155 initialize ParameterTypes and ParameterInfo.
7156 (Method.GetReturnType): We can now simply return the MemberType.
7157 (Method.GetMethodFlags): Override the MemberBase version and add
7158 the conditional flags.
7159 (Method.CheckBase): Moved some code from Define() here, call
7160 DoDefineParameters() here.
7161 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
7162 here to avoid some larger code duplication.
7163 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
7164 ensure that abstract and external accessors don't declare a body.
7166 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
7167 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
7168 lookup in the attribute's parent classes, so we need to abort as soon
7169 as we found the first match.
7170 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
7171 the attribute has no arguments.
7173 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
7176 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7178 * cs-parser.jay: reverted previous patch.
7180 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7182 * cs-parser.jay: fixed bug #22119.
7184 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7186 * attribute.cs: fixed compilation. The error was:
7187 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
7188 be assigned to before control leaves the current method."
7189 [FIXME: Filed as bug #28186: MCS must report this error.]
7191 2002-07-25 Martin Baulig <martin@gnome.org>
7193 * attribute.cs (Attribute.Conditional_GetConditionName): New static
7194 method to pull the condition name ouf of a Conditional attribute.
7195 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
7196 the obsolete message and error flag out of an Obsolete attribute.
7198 * class.cs (Method.GetMethodFlags): New public method to get the
7199 TypeManager.MethodFlags for this method.
7200 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
7202 (Method.Define): Get and apply the Obsolete and Conditional attributes;
7203 if we're overriding a virtual function, set the new private variable
7204 `parent_method'; call the new TypeManager.AddMethod().
7206 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
7207 the MethodBuilder and the Method in a PtrHashtable.
7208 (TypeManager.builder_to_method): Added for this purpose.
7209 (TypeManager.MethodFlags): Added IsObsoleteError.
7210 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
7211 Obsolete and Conditional arguments in MethodBuilders. If we discover
7212 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
7213 the message from the attribute.
7215 2002-07-24 Martin Baulig <martin@gnome.org>
7217 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
7218 preprocessor directives, ensure that the argument to #define/#undef is
7219 exactly one identifier and that it's actually an identifier.
7221 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
7224 2002-07-24 Martin Baulig <martin@gnome.org>
7226 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
7227 initialize it to TypeManager.object_type in the constructor.
7228 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
7229 of the `hm.get_current' method if we're using the collection pattern.
7230 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
7231 for the explicit conversion to make it work when we're using the collection
7232 pattern and the `Current' property has a different return type than `object'.
7235 2002-07-24 Martin Baulig <martin@gnome.org>
7237 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
7238 does not match, but don't report any errors. This method is called in
7239 order for all methods in a MethodGroupExpr until a matching method is
7240 found, so we don't want to bail out if the first method doesn't match.
7241 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
7242 matches, report the 123. Fixes #28070.
7244 2002-07-24 Martin Baulig <martin@gnome.org>
7246 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
7247 TypeManager.TypeToCoreType() to the top of the method so the
7248 following equality checks will work. Fixes #28107.
7250 2002-07-24 Martin Baulig <martin@gnome.org>
7252 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
7253 operand is of type uint, and the other operand is of type sbyte,
7254 short or int, the operands are converted to type long." -
7255 Actually do what this comment already told us. Fixes bug #28106,
7258 2002-07-24 Martin Baulig <martin@gnome.org>
7260 * class.cs (MethodBase): New abstract class. This is now a base
7261 class for Property, Indexer and Event to avoid some code duplication
7262 in their Define() and DefineMethods() methods.
7263 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
7264 generic methods for Define() and DefineMethods().
7265 (FieldBase): Derive from MemberBase, not MemberCore.
7266 (Property): Derive from MemberBase, not MemberCore.
7267 (Property.DefineMethod): Moved all the code from this method to the
7268 new MethodBase.DefineAccessor(), just call it with appropriate
7270 (Property.Define): Call the new Property.DoDefine(), this does some
7271 sanity checks and we don't need to duplicate the code everywhere.
7272 (Event): Derive from MemberBase, not MemberCore.
7273 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
7274 accessors, this will also make them work with interface events.
7275 (Indexer): Derive from MemberBase, not MemberCore.
7276 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
7277 (Indexer.Define): Use the new MethodBase functions.
7279 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
7280 argument to the constructor.
7281 (Interface.FindMembers): Added support for interface events.
7282 (Interface.PopluateEvent): Implemented.
7284 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
7286 2002-07-22 Miguel de Icaza <miguel@ximian.com>
7288 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
7289 but this is required to check for a method name being the same as
7290 the containing class.
7294 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7296 * interface.cs: initialize variable.
7298 2002-07-23 Martin Baulig <martin@gnome.org>
7300 Implemented the IndexerName attribute in interfaces.
7302 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
7303 name if this is an explicit interface implementation.
7304 (Indexer.InterfaceIndexerName): New public variable. If we're
7305 implementing an interface indexer, this is the IndexerName in that
7306 interface. Otherwise, it's the IndexerName.
7307 (Indexer.DefineMethod): If we're implementing interface indexer,
7308 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
7309 and Pending.ImplementIndexer methods.
7310 (Indexer.Define): Also define the PropertyBuilder if we're
7311 implementing an interface indexer and this is neither an explicit
7312 interface implementation nor do the IndexerName match the one in
7315 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
7316 If a method is defined here, then we always need to create a proxy
7317 for it. This is used when implementing interface indexers.
7318 (Pending.IsInterfaceIndexer): New public method.
7319 (Pending.ImplementIndexer): New public method.
7320 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
7321 This is used when implementing interface indexers to define a proxy
7323 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
7324 define a proxy if necessary.
7326 * interface.cs (Interface.IndexerName): New public variable.
7327 (Interface.PopulateIndexer): Set the IndexerName.
7328 (Interface.DefineIndexers): New private method. Populate all the
7329 indexers and make sure their IndexerNames match.
7331 * typemanager.cs (IndexerPropertyName): Added support for interface
7334 2002-07-22 Martin Baulig <martin@gnome.org>
7336 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
7337 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
7338 ret if HasReturnLabel.
7339 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
7342 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
7343 and set the ec.LoopBeginTryCatchLevel.
7344 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
7345 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
7346 the current ec.TryCatchLevel, the branch goes out of an exception
7347 block. In this case, we need to use Leave and not Br.
7349 2002-07-22 Martin Baulig <martin@gnome.org>
7351 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
7352 block unless the block does not always return or it is contained in
7353 another try { ... } catch { ... } block. Fixes bug #26506.
7354 Added verify-1.cs to the test suite.
7356 2002-07-22 Martin Baulig <martin@gnome.org>
7358 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
7359 then we do not always return. Fixes bug #24985.
7361 2002-07-22 Martin Baulig <martin@gnome.org>
7363 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
7364 lookup on a per-class level; ie. walk up the class hierarchy until we
7365 found at least one applicable method, then choose the best among them.
7366 Fixes bug #24463 and test-29.cs.
7368 2002-07-22 Martin Baulig <martin@gnome.org>
7370 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
7371 return types of the methods. The return type is not part of the
7372 signature and we must not check it to make the `new' modifier work.
7373 Fixes bug #27999, also added test-147.cs.
7374 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
7376 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
7377 on the method's return type.
7379 2002-07-21 Martin Baulig <martin@gnome.org>
7381 * assign.cs: Make this work if the rightmost source is a constant and
7382 we need to do an implicit type conversion. Also adding a few more tests
7383 to test-38.cs which should have caught this.
7385 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
7386 target in the makefile for this. The makefile.gnu is primarily intended
7387 for end-users who don't want to debug the compiler.
7389 2002-07-21 Martin Baulig <martin@gnome.org>
7391 * assign.cs: Improved the Assign class so it can now handle embedded
7392 assignments (X = Y = Z = something). As a side-effect this'll now also
7393 consume less local variables. test-38.cs now passes with MCS, added
7394 a few new test cases to that test.
7396 2002-07-20 Martin Baulig <martin@gnome.org>
7398 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
7399 instructions. Fixes bug #27977, also added test-146.cs.
7401 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7403 * cs-tokenizer.cs: fixed getHex ().
7405 2002-07-19 Martin Baulig <martin@gnome.org>
7407 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
7408 not Type.GetType() to lookup the array type. This is needed when
7409 we're constructing an array of a user-defined type.
7410 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
7411 single-dimensional arrays, but also for single-dimensial arrays of
7414 2002-07-19 Martin Baulig <martin@gnome.org>
7416 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
7417 this function is called, it's not allowed to share LocalBuilders
7420 2002-07-19 Martin Baulig <martin@gnome.org>
7422 * expression.cs (Argument.Resolve): Report an error 118 when trying
7423 to pass a type as argument.
7425 2002-07-18 Martin Baulig <martin@gnome.org>
7427 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
7428 Conv_R_Un for the signed `long' type.
7430 2002-07-15 Miguel de Icaza <miguel@ximian.com>
7432 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
7433 `expr' for the temporary result, as that will fail if we do
7434 multiple resolves on the same expression.
7436 2002-07-05 Miguel de Icaza <miguel@ximian.com>
7438 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
7439 ec.TypeContainer for looking up aliases.
7441 * class.cs (TypeContainer): Remove LookupAlias from here.
7443 * decl.cs (DeclSpace); Move here.
7445 2002-07-01 Miguel de Icaza <miguel@ximian.com>
7447 * class.cs (FindMembers): Only call filter if the constructor
7448 bulider is not null.
7450 Also handle delegates in `NestedTypes' now. Now we will perform
7451 type lookups using the standard resolution process. This also
7454 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7455 This uses Expressions (the limited kind that can be parsed by the
7456 tree) instead of strings.
7458 * expression.cs (ComposedCast.ToString): Implement, used to flag
7459 errors since now we have to render expressions.
7461 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
7464 * ecore.cs (SimpleName.ToString): ditto.
7466 * cs-parser.jay: Instead of using strings to assemble types, use
7467 Expressions to assemble the type (using SimpleName, ComposedCast,
7468 MemberAccess). This should fix the type lookups in declarations,
7469 because we were using a different code path for this.
7471 * statement.cs (Block.Resolve): Continue processing statements
7472 even when there is an error.
7474 2002-07-17 Miguel de Icaza <miguel@ximian.com>
7476 * class.cs (Event.Define): Also remove the `remove' method from
7477 the list of pending items.
7479 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7480 generate more compact code.
7482 2002-07-17 Martin Baulig <martin@gnome.org>
7484 * const.cs (Const.LookupConstantValue): Add support for constant
7485 `unchecked' and `checked' expressions.
7486 Also adding test case test-140.cs for this.
7488 2002-07-17 Martin Baulig <martin@gnome.org>
7490 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7491 check whether mi.ReturnType implements the IEnumerator interface; the
7492 `==' and the IsAssignableFrom() will fail in this situation.
7494 2002-07-16 Ravi Pratap <ravi@ximian.com>
7496 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
7499 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7501 * expression.cs: fixed bug #27811.
7503 2002-07-14 Miguel de Icaza <miguel@ximian.com>
7505 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7506 Molaro: when we are a ref, the value already contains a pointer
7507 value, do not take the address of it.
7509 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7510 * removed mb-parser.jay and mb-tokenizer.cs
7512 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7514 * expression.cs: check against the building corlib void type.
7516 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7518 * ecore.cs: fix for valuetype static readonly fields: when
7519 initializing them, we need their address, not the address of a copy.
7521 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7523 * typemanager.cs: register also enum_type in corlib.
7525 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7527 * class.cs: allow calling this (but not base) initializers in structs.
7529 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7531 * ecore.cs: make sure we compare against the building base types
7534 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7536 * typemanager.cs: fix TypeToCoreType() to handle void and object
7537 (corlib gets no more typerefs after this change).
7539 2002-07-12 Miguel de Icaza <miguel@ximian.com>
7541 * expression.cs (ArrayCreation.EmitArrayArguments): use
7542 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7544 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7545 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
7546 array indexes, the runtime actually forbids them.
7548 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7549 for array arguments here.
7551 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7552 instead of the default for ValueTypes.
7554 (New.DoEmit): Use IsValueType instead of
7555 IsSubclassOf (value_type)
7556 (New.DoResolve): ditto.
7557 (Invocation.EmitCall): ditto.
7559 * assign.cs (Assign): ditto.
7561 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7562 Statements *are* currently doing part of their resolution during
7565 Expressions do always resolve during resolve, but statements are
7566 only required to propagate resolution to their children.
7568 2002-07-11 Miguel de Icaza <miguel@ximian.com>
7570 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7572 (LoadAssembly): Do not add the dll if it is already specified
7574 (MainDriver): Add the System directory to the link path at the end,
7575 after all the other -L arguments.
7577 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7578 wrong opcode for loading bytes and bools (ldelem.i1 instead of
7579 ldelem.u1) and using the opposite for sbytes.
7581 This fixes Digger, and we can finally run it.
7583 * driver.cs (UnixParseOption): Move the option parsing here.
7584 (CSCParseOption): Implement CSC-like parsing of options.
7586 We now support both modes of operation, the old Unix way, and the
7587 new CSC-like way. This should help those who wanted to make cross
7590 The only thing broken is that /r:, /reference: and /lib: are not
7591 implemented, because I want to make those have the same semantics
7592 as the CSC compiler has, and kill once and for all the confussion
7593 around this. Will be doing this tomorrow.
7595 * statement.cs (Unsafe.Resolve): The state is checked during
7596 resolve, not emit, so we have to set the flags for IsUnsfe here.
7598 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7600 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7601 not catch the Error_ObjectRefRequired in SimpleName (as it is
7602 possible to have a class/instance variable name that later gets
7603 deambiguated), we have to check this here.
7605 2002-07-10 Ravi Pratap <ravi@ximian.com>
7607 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7608 make static and put into Expression.
7610 (Event.Define): Register the private field of the event with the
7611 TypeManager so that GetFieldFromEvent can get at it.
7613 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7614 keep track of the private field associated with an event which
7617 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7620 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7622 2002-07-10 Miguel de Icaza <miguel@ximian.com>
7624 * expression.cs (Binary.EmitBranchable): this routine emits the
7625 Binary expression in a branchable context. This basically means:
7626 we need to branch somewhere, not just get the value on the stack.
7628 This works together with Statement.EmitBoolExpression.
7630 * statement.cs (Statement.EmitBoolExpression): Use
7633 2002-07-09 Miguel de Icaza <miguel@ximian.com>
7635 * statement.cs (For): Reduce the number of jumps in loops.
7637 (For): Implement loop inversion for the For statement.
7639 (Break): We can be breaking out of a Try/Catch controlled section
7640 (foreach might have an implicit try/catch clause), so we need to
7641 use Leave instead of Br.
7643 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7644 now). If the instace expression supports IMemoryLocation, we use
7645 the AddressOf method from the IMemoryLocation to extract the
7646 address instead of emitting the instance.
7648 This showed up with `This', as we were emitting the instance
7649 always (Emit) instead of the Address of This. Particularly
7650 interesting when This is a value type, as we dont want the Emit
7651 effect (which was to load the object).
7653 2002-07-08 Miguel de Icaza <miguel@ximian.com>
7655 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7657 * statement.cs (Checked): Set the CheckedState during the resolve
7658 process too, as the ConvCast operations track the checked state on
7659 the resolve process, and not emit.
7661 * cs-parser.jay (namespace_member_declaration): Flag that we have
7662 found a declaration when we do. This is used to flag error 1529
7664 * driver.cs: Report ok when we display the help only.
7666 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
7668 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7670 2002-07-04 Miguel de Icaza <miguel@ximian.com>
7672 * cs-tokenizer.cs (define): We also have to track locally the
7673 defines. AllDefines is just used for the Conditional Attribute,
7674 but we also need the local defines for the current source code.
7676 2002-07-03 Miguel de Icaza <miguel@ximian.com>
7678 * statement.cs (While, For, Do): These loops can exit through a
7679 Break statement, use this information to tell whether the
7680 statement is the last piece of code.
7682 (Break): Flag that we break.
7684 * codegen.cs (EmitContexts): New `Breaks' state variable.
7686 2002-07-03 Martin Baulig <martin@gnome.org>
7688 * class.cs (TypeContainer.MethodModifiersValid): Allow override
7689 modifiers in method declarations in structs. Otherwise, you won't
7690 be able to override things like Object.Equals().
7692 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7694 * class.cs (Method, Property, Indexer): Do not allow the public
7695 modifier to be used in explicit interface implementations.
7697 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7698 override modifiers in method declarations in structs
7700 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
7702 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7703 integer or real overflow, report an error
7705 2002-07-02 Martin Baulig <martin@gnome.org>
7707 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7708 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7709 to tell the runtime about our newly created System.Object and
7710 System.ValueType types.
7712 2002-07-02 Miguel de Icaza <miguel@ximian.com>
7714 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7715 struct instead of Ldarg/Starg.
7717 2002-07-02 Martin Baulig <martin@gnome.org>
7719 * expression.cs (Indirection.Indirection): Call
7720 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7722 2002-07-02 Martin Baulig <martin@gnome.org>
7724 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7725 ValueType, call TypeManager.TypeToCoreType() on it.
7726 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7727 the OpCodes.Newarr argument.
7729 2002-07-02 Martin Baulig <martin@gnome.org>
7731 * expression.cs (Invocation.EmitCall): When compiling corlib,
7732 replace all calls to the system's System.Array type to calls to
7733 the newly created one.
7735 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7736 System.Array methods.
7737 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7738 from the system's System.Array type which must be replaced.
7740 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7742 * typemanager.cs: load unverifiable_code_ctor so we can build
7743 corlib using the correct type. Avoid using GetTypeCode() with
7745 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7746 TypeManager.object_type to allow building corlib.
7748 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7750 * ecore.cs: handle System.Enum separately in LoadFromPtr().
7752 2002-07-01 Martin Baulig <martin@gnome.org>
7754 * class.cs: Make the last change actually work, we need to check
7755 whether `ifaces != null' to avoid a crash.
7757 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7759 * class.cs: when we build structs without fields that implement
7760 interfaces, we need to add the interfaces separately, since there is
7761 no API to both set the size and add the interfaces at type creation
7764 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7766 * expression.cs: the dimension arguments to the array constructors
7767 need to be converted if they are a long.
7769 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
7771 * class.cs: don't emit ldarg.0 if there is no parent constructor
7772 (fixes showstopper for corlib).
7774 2002-06-29 Martin Baulig <martin@gnome.org>
7776 MCS now compiles corlib on GNU/Linux :-)
7778 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
7779 ie. check for MethodImplOptions.InternalCall.
7781 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
7782 and TypeManager.attribute_type are null, so we must explicitly check
7783 whether parent is not null to find out whether it's an attribute type.
7784 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
7785 and SetBuilder, not only if the property is neither abstract nor external.
7786 This is necessary to set the MethodImplOptions on the accessor methods.
7787 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
7788 SetBuilder, see Property.Emit().
7790 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
7791 populate "System.Object", "System.ValueType" and "System.Attribute" since
7792 they've already been populated from BootCorlib_PopulateCoreTypes().
7794 2002-06-29 Martin Baulig <martin@gnome.org>
7796 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
7797 is the NullLiteral, we also need to make sure that target_type is not
7800 2002-06-29 Martin Baulig <martin@gnome.org>
7802 * rootcontext.cs (RootContext.ResolveCore): We must initialize
7803 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
7804 before calling BootstrapCorlib_ResolveDelegate ().
7806 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7808 * statement.cs: fixed build-breaker. All tests passed ok.
7810 2002-06-27 Martin Baulig <martin@gnome.org>
7812 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
7813 for System.Decimal when compiling corlib.
7815 2002-06-27 Martin Baulig <martin@gnome.org>
7817 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
7818 switch blocks which contain nothing but a default clause.
7820 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
7822 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
7824 2002-06-27 Martin Baulig <martin@gnome.org>
7826 * ecore.cs (PropertyExpr.PropertyExpr): Call
7827 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
7829 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
7830 is already a TypeBuilder.
7832 2002-06-27 Martin Baulig <martin@gnome.org>
7834 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
7835 `target_type == TypeManager.array_type', not IsAssignableFrom() in
7836 the "from an array-type to System.Array" case. This makes it work
7837 when compiling corlib.
7839 2002-06-27 Martin Baulig <martin@gnome.org>
7841 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
7842 non-static PropertyExpr, set its InstanceExpression. This makes
7843 the `ICollection.Count' property work in System/Array.cs.
7845 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
7847 * driver.cs: Made error handling more consistent. Errors now
7848 tracked by Report class, so many methods which used to return int
7849 now return void. Main() now prints success/failure and
7850 errors/warnings message.
7852 Renamed '--probe' compiler argument to '--expect-error'. Removed
7853 the magic number return values (123 and 124). Now, if the
7854 expected error occurs, the compiler exits with success (exit value
7855 0). If the compilation completes without seeing that particular
7856 error, the compiler exits with failure (exit value 1). The
7857 makefile in mcs/errors has been changed to handle the new behaviour.
7859 * report.cs: Made 'expected error' number a property and renamed
7860 it from 'Probe' to 'ExpectedError'.
7862 * genericparser.cs: Removed error handling support, since it is
7863 now all done by Report class.
7865 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
7866 class, so parse() no longer returns an int.
7868 * namespace.cs: Use Report.Error instead of GenericParser.error
7870 2002-06-22 Miguel de Icaza <miguel@ximian.com>
7872 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
7873 TypeContainer.AddOperator): At the front of the list put the
7874 explicit implementations, so they get resolved/defined first.
7876 2002-06-21 Miguel de Icaza <miguel@ximian.com>
7878 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
7879 interface type is implemented by this TypeContainer. Used during
7880 explicit interface implementation.
7882 (Property.Define, Indexer.Define, Method.Define): Validate that
7883 the given interface in the explicit implementation is one of the
7884 base classes for the containing type.
7886 Also if we are explicitly implementing an interface, but there is
7887 no match in the pending implementation table, report an error.
7889 (Property.Define): Only define the property if we are
7890 not explicitly implementing a property from an interface. Use the
7891 correct name also for those properties (the same CSC uses,
7892 although that is really not needed).
7894 (Property.Emit): Do not emit attributes for explicitly implemented
7895 properties, as there is no TypeBuilder.
7897 (Indexer.Emit): ditto.
7899 Hiding then means that we do not really *implement* a pending
7900 implementation, which makes code fail.
7902 2002-06-22 Martin Baulig <martin@gnome.org>
7904 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
7905 the return value of Object.GetType(). [FIXME: we need to do this whenever
7906 we get a type back from the reflection library].
7908 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
7910 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
7912 2002-06-20 Miguel de Icaza <miguel@ximian.com>
7914 * attribute.cs: Return null if we can not look up the type.
7916 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
7917 the interface types found.
7919 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
7920 interface types found.
7922 * typemanager.cs (GetInterfaces): Make this routine returns alll
7923 the interfaces and work around the lame differences between
7924 System.Type and System.Reflection.Emit.TypeBuilder in the results
7925 result for GetInterfaces.
7927 (ExpandInterfaces): Given an array of interface types, expand and
7928 eliminate repeated ocurrences of an interface. This expands in
7929 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
7932 2002-06-21 Martin Baulig <martin@gnome.org>
7934 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
7937 2002-06-21 Martin Baulig <martin@gnome.org>
7939 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
7940 and called with one of the core types, return the corresponding typebuilder for
7943 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
7946 2002-06-21 Martin Baulig <martin@gnome.org>
7948 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
7949 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
7950 (Expression.ConvertReferenceExplicit): Likewise.
7952 * expression.cs (ElementAccess.DoResolve): Likewise.
7953 (ElementAccess.DoResolveLValue): Likewise.
7955 2002-06-10 Martin Baulig <martin@gnome.org>
7957 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
7958 add the "value" parameter to the parameter list.
7960 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
7963 2002-06-19 Miguel de Icaza <miguel@ximian.com>
7965 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
7966 the argument to an int, uint, long or ulong, per the spec. Also
7967 catch negative constants in array creation.
7969 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
7971 * class.cs: do not allow the same interface to appear twice in
7972 the definition list.
7974 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
7976 * ecore.cs: don't use ldlen with System.Array.
7978 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
7980 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
7982 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
7984 * modifiers.cs: produce correct field attributes for protected
7985 internal. Easy fix so miguel can work on ther harder stuff:-)
7987 2002-06-18 Miguel de Icaza <miguel@ximian.com>
7989 * pending.cs: New file. Move the code from class.cs here.
7990 Support clearning the pending flag for all methods (when not doing
7991 explicit interface implementation).
7993 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
7995 * rootcontext.cs: added a couple more types needed to bootstrap.
7997 2002-06-17 Miguel de Icaza <miguel@ximian.com>
7999 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
8000 constructor in the type, instead of any constructor in the type
8001 hierarchy. Thanks to Paolo for finding this bug (it showed up as
8002 a bug in the Mono runtime when applying the params attribute).
8004 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
8005 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
8007 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
8009 * expression.cs (Unary.ResolveOperator): Use TypeManager
8010 to resolve the type.
8012 2002-06-13 Ravi Pratap <ravi@ximian.com>
8014 * cs-parser.jay (enum_member_declaration): Pass in the attributes
8017 * enum.cs (AddEnumMember): Add support to store the attributes associated
8018 with each member too.
8020 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
8021 field builders too - this takes care of the enum member case.
8023 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
8025 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
8026 address-of operator on both value types and pointers.
8028 2002-06-10 Martin Baulig <martin@gnome.org>
8030 * interface.cs (Interface.PopulateIndexer): Add the indexer's
8031 PropertyBuilder to the `property_builders' list.
8033 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
8034 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
8035 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
8036 find any indexers which are inherited from an interface.
8038 2002-06-09 Martin Baulig <martin@gnome.org>
8040 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
8041 the same type as the constant if necessary. There's also a test-130.cs
8044 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
8046 * typemanager.cs (TypeManager.ChangeType): Previously known as
8047 Enum.ChangeEnumType().
8049 2002-06-09 Martin Baulig <martin@gnome.org>
8051 * expression.cs (Cast.TryReduce): Added support for consts.
8053 2002-06-08 Ravi Pratap <ravi@ximian.com>
8055 * class.cs (Accessor): Hold attributes information so we can pass
8058 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
8059 Modify to pass in attributes attached to the methods.
8061 (add_accessor_declaration, remove_accessor_declaration): Ditto.
8063 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
8064 to handle the Accessor kind :-)
8066 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
8068 2002-06-08 Martin Baulig <martin@gnome.org>
8070 * expression.cs (Unary.TryReduceNegative): Added support for
8073 2002-06-08 Martin Baulig <martin@gnome.org>
8075 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
8076 name can't be found in the `defined_names' - the caller will do a
8077 MemberLookup in this case and thus find methods in System.Enum
8078 such as Enum.IsDefined().
8080 2002-06-08 Martin Baulig <martin@gnome.org>
8082 * enum.cs (Enum.ChangeEnumType): This is a custom version of
8083 Convert.ChangeType() which works with TypeBuilder created types.
8084 (Enum.LookupEnumValue, Enum.Define): Use it here.
8086 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
8087 `TypeBuilder.BaseType != null' check.
8088 (TypeContainer.FindMembers): Only lookup parent members if we
8089 actually have a parent.
8090 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
8091 (ConstructorInitializer.Resolve): Likewise.
8093 * interface.cs (Interface.FindMembers): Added
8094 `TypeBuilder.BaseType != null' check.
8096 * rootcontext.cs (RootContext.ResolveCore): Added
8097 "System.Runtime.CompilerServices.IndexerNameAttribute" to
8098 classes_second_stage.
8100 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
8101 debug_type and trace_type when compiling with --nostdlib.
8103 2002-06-07 Martin Baulig <martin@gnome.org>
8105 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
8106 (AddField): Set it to true when adding a non-static field.
8107 (DefineType): Use `have_nonstatic_fields' to find out whether we
8108 have non-static fields, not `Fields != null'.
8110 2002-06-02 Miguel de Icaza <miguel@ximian.com>
8112 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
8113 dereferencing a null on the static-field code path)
8115 2002-05-30 Martin Baulig <martin@gnome.org>
8117 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
8118 to take command line arguments. Use reflection to call the new
8119 custom `Initialize' function on the symbol writer and pass it the
8120 command line arguments.
8122 * driver.cs (--debug-args): New command line argument to pass command
8123 line arguments to the symbol writer.
8125 2002-05-28 Miguel de Icaza <miguel@ximian.com>
8127 * assign.cs (DoResolve): Forgot to do the implicit conversion to
8128 the target type for indexers and properties. Thanks to Joe for
8131 2002-05-27 Miguel de Icaza <miguel@ximian.com>
8133 * typemanager.cs (MethodFlags): returns the method flags
8134 (Obsolete/ShouldIgnore) that control warning emission and whether
8135 the invocation should be made, or ignored.
8137 * expression.cs (Invocation.Emit): Remove previous hack, we should
8138 not do this on matching a base type, we should do this based on an attribute
8140 Only emit calls to System.Diagnostics.Debug and
8141 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
8142 on the command line.
8144 * rootcontext.cs: Global settings for tracing and debugging.
8146 * cs-tokenizer.cs (define): New utility function to track
8147 defines. Set the global settings for TRACE and DEBUG if found.
8149 2002-05-25 Ravi Pratap <ravi@ximian.com>
8151 * interface.cs (Populate*): Pass in the TypeContainer as well as
8152 the DeclSpace as parameters so that we can create EmitContexts and
8153 then use that to apply attributes etc.
8155 (PopulateMethod, PopulateEvent, PopulateProperty)
8156 (PopulateIndexer): Apply attributes everywhere.
8158 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
8161 (ApplyAttributes): Update accordingly.
8163 We now apply interface attributes for all members too.
8165 2002-05-26 Miguel de Icaza <miguel@ximian.com>
8167 * class.cs (Indexer.Define); Correctly check if we are explicit
8168 implementation (instead of checking the Name for a ".", we
8169 directly look up if the InterfaceType was specified).
8171 Delay the creation of the PropertyBuilder.
8173 Only create the PropertyBuilder if we are not an explicit
8174 interface implementation. This means that explicit interface
8175 implementation members do not participate in regular function
8176 lookups, and hence fixes another major ambiguity problem in
8177 overload resolution (that was the visible effect).
8179 (DefineMethod): Return whether we are doing an interface
8182 * typemanager.cs: Temporary hack until we get attributes in
8183 interfaces (Ravi is working on that) and we get IndexerName
8184 support in interfaces.
8186 * interface.cs: Register the indexers as properties.
8188 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
8189 warning, I have verified that this is a bug in the .NET runtime
8190 (JavaScript suffers of the same problem).
8192 * typemanager.cs (MemberLookup): When looking up members for
8193 interfaces, the parent of an interface is the implicit
8194 System.Object (so we succeed in searches of Object methods in an
8195 interface method invocation. Example: IEnumerable x; x.ToString
8198 2002-05-25 Miguel de Icaza <miguel@ximian.com>
8200 * class.cs (Event): Events should also register if they do
8201 implement the methods that an interface requires.
8203 * typemanager.cs (MemberLookup); use the new GetInterfaces
8206 (GetInterfaces): The code used to lookup interfaces for a type is
8207 used in more than one place, factor it here.
8209 * driver.cs: Track the errors at the bottom of the file, we kept
8212 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
8213 instance if the method we are calling is static!
8215 2002-05-24 Miguel de Icaza <miguel@ximian.com>
8217 * attribute.cs (ApplyAttributes): Make this function filter out
8218 the IndexerName attribute (as that attribute in reality is never
8219 applied) and return the string constant for the IndexerName
8222 * class.cs (TypeContainer.Emit): Validate that all the indexers
8223 have the same IndexerName attribute, and if so, set the
8224 DefaultName attribute on the class.
8226 * typemanager.cs: The return value might contain other stuff (not
8227 only methods). For instance, consider a method with an "Item"
8228 property and an Item method.
8230 * class.cs: If there is a problem with the parameter types,
8233 2002-05-24 Ravi Pratap <ravi@ximian.com>
8235 * ecore.cs (ImplicitConversionExists): Wrapper function which also
8236 looks at user defined conversion after making a call to
8237 StandardConversionExists - we need this for overload resolution.
8239 * expression.cs : Update accordingly the various method calls.
8241 This fixes 2 bugs filed against implicit user defined conversions
8243 2002-05-22 Miguel de Icaza <miguel@ximian.com>
8245 * statement.cs: Track the result of the assignment.
8247 2002-05-21 Miguel de Icaza <miguel@ximian.com>
8249 * expression.cs (MemberAccess): Improved error reporting for
8250 inaccessible members.
8252 2002-05-22 Martin Baulig <martin@gnome.org>
8254 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
8255 itself with debugging support.
8257 2002-05-22 Martin Baulig <martin@gnome.org>
8259 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
8260 Removed, this isn't needed anymore.
8262 2002-05-20 Martin Baulig <martin@gnome.org>
8264 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
8265 be underlying type for an enum.
8267 2002-05-20 Miguel de Icaza <miguel@ximian.com>
8269 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
8270 that splits out the loading of just the core types.
8272 * rootcontext.cs (ResolveCore): Split the struct resolution in
8273 two, so we can load the enumeration underlying types before any
8276 * expression.cs (Is): Bandaid until we fix properly Switch (see
8277 bug #24985 for details).
8279 * typemanager.cs (ImplementsInterface): The hashtable will contain
8280 a null if there are no interfaces implemented.
8282 2002-05-18 Miguel de Icaza <miguel@ximian.com>
8284 * cs-parser.jay (indexer_declarator): It is fine to have array
8287 2002-05-17 Miguel de Icaza <miguel@ximian.com>
8289 * typemanager.cs: (RegisterBuilder): New function used to register
8290 TypeBuilders that implement interfaces. Since
8291 TypeBuilder.GetInterfaces (as usual) does not work with lame
8293 (AddUserType): register interfaces.
8295 (ImplementsInterface): Use the builder_to_ifaces hash if we are
8296 dealing with TypeBuilder. Also, arrays are showing up as
8297 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
8298 methods can not be invoked on them!
8300 * ecore.cs (ExplicitReferenceConversionExists): Made public.
8301 (ImplicitReferenceConversionExists): Split out from
8302 StandardConversionExists.
8304 * expression.cs (As): We were only implementing one of the three
8305 cases for the as operator. We now implement them all.
8306 (Is): Implement the various other cases for Is as well.
8308 * typemanager.cs (CACHE): New define used to control if we want or
8309 not the FindMembers cache. Seems to have a negative impact on
8310 performance currently
8312 (MemberLookup): Nested types have full acess to
8313 enclosing type members
8315 Remove code that coped with instance/static returns for events, we
8316 now catch this in RealFindMembers.
8318 (RealFindMembers): only perform static lookup if the instance
8319 lookup did not return a type or an event.
8321 2002-05-17 Miguel de Icaza <miguel@ximian.com>
8323 * assign.cs (CompoundAssign): We pass more semantic information
8324 now to Compound Assignments than we did before: now we have all
8325 the information at hand, and now we resolve the target *before* we
8326 do the expression expansion, which allows the "CacheValue" method
8327 to have the effect we intended (before, a [x] += 1 would generate
8328 two differen ArrayAccess expressions from the ElementAccess,
8329 during the resolution process).
8331 (CompoundAssign.DoResolve): Resolve target and original_source here.
8333 2002-05-16 Miguel de Icaza <miguel@ximian.com>
8335 * expression.cs (ArrayAccess): dropped debugging information.
8337 * typemanager.cs: Small bug fix: I was always returning i_members,
8338 instead of one of i_members or s_members (depending on which had
8341 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
8342 method is invoked before any code generation takes place, and it
8343 is a mechanism to inform that the expression will be invoked more
8344 than once, and that the method should use temporary values to
8345 avoid having side effects
8347 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
8349 * ecore.cs (Expression.CacheTemporaries): Provide empty default
8352 * expression.cs (Indirection, ArrayAccess): Add support for
8353 CacheTemporaries in these two bad boys.
8355 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
8357 (StoreFromPtr): Handle stobj as well.
8359 * expression.cs (UnaryMutator): Share more code.
8361 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
8362 down: I was not tracking the Filter function as well, which
8363 was affecting the results of the cache.
8365 2002-05-15 Miguel de Icaza <miguel@ximian.com>
8367 * attribute.cs: Remove the hack to handle the CharSet property on
8370 2002-05-14 Miguel de Icaza <miguel@ximian.com>
8372 * attribute.cs (DoResolve): More uglyness, we now only try to
8373 resolve the attribute partially, to extract the CharSet
8374 information (only if we are a StructLayout attribute). Otherwise
8376 (GetExtraTypeInfo): Add some code to conditionally kill in the
8377 future this. I am more and more convinced that the .NET
8378 framework has special code to handle the attribute setting on
8381 * expression.cs (IsParamsMethodApplicable): Revert my previous
8382 foreach change here, it was wrong.
8384 2002-05-13 Miguel de Icaza <miguel@ximian.com>
8386 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
8387 (pp_expr): do not abort on unknown input, just return.
8388 (eval): abort if there are pending chars.
8390 * attribute.cs (Attribute.Resolve): Positional parameters are
8391 optional. Deal with that case.
8393 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
8394 the Ansi/Unicode/Auto information for the type.
8396 (TypeContainer.DefineType): instantiate the EmitContext here, as
8397 we will be using it during the type definition (to resolve
8398 attributes) and during the emit phase.
8400 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
8401 to pull type information out of the attributes
8403 (Attribute.Resolve): track the constructor builder, and allow for
8404 multiple invocations (structs and classes will use this).
8406 * ecore.cs (MemberLookupFinal): new version with all the
8407 parameters customizable.
8409 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
8410 constructors. Return if the result value is null (as the error
8411 would have been flagged already by MemberLookupFinal)
8413 Do not allow instances of abstract classes or interfaces to be
8416 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
8417 We have to compare the assembly property here when dealing with
8418 FamANDAssem and Assembly access modifiers, because we might be
8419 creating an assembly from *modules* (that means that we are not
8420 getting TypeBuilders for types defined in other modules that are
8421 part of this assembly).
8423 (Method.Emit): If the method is marked abstract and has a body,
8426 (TypeContainer.DefineMembers): If both the defined member and the
8427 parent name match are methods, then do not emit any warnings: let
8428 the Method.Define routine take care of flagging warnings. But if
8429 there is a mismatch (method overrides something else, or method is
8430 overriwritten by something, then emit warning).
8432 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
8433 set to null, this means `do not check for the return type on the
8436 (Method.Define): set the return type for the method signature to
8437 null, so that we get methods with the same name and parameters and
8438 different return types. This is used to flag warning 114 (you are
8439 hiding a method, and you probably want to use the new/override
8442 * typemanager.cs (MemberLookup): Implemented proper access
8443 control, closing a long standing set of bug reports. The problem
8444 was that the Framework only has two bits: Public and NonPublic,
8445 and NonPublic includes private and protected methods, but we need
8446 to enforce the FamANDAssem, FamOrAssem and Family.
8448 2002-05-11 Miguel de Icaza <miguel@ximian.com>
8450 * statement.cs (GotoCase): Return true: Ammounts to giving up
8451 knowledge on whether we return or not, and letting the other case
8452 be responsible for it.
8454 2002-05-10 Miguel de Icaza <miguel@ximian.com>
8456 * driver.cs: Do not load directories for each file processed, only
8457 do it if there is a pattern.
8459 * ecore.cs: Report readonly assigns here as well, as we might have
8460 been resolved only by MemberAccess.
8462 (SimpleName.SimpleNameResolve): Also be useful for LValue
8463 resolution. We need this to propagate assign to local readonly variables
8465 * typemanager.cs: Use a ptrhashtable for the criteria, because we
8466 do not want to reuse potential criteria memory.
8468 * class.cs (MyEventBuilder): Set reflected_type;
8470 * ecore.cs (Constantify): Added support for constifying bools.
8472 (RootContext.LookupType): Added a cache for values looked up in
8473 the declaration space.
8475 * typemanager.cs (FindMembers): Now is a front-end to
8476 RealFindMembers, and provides a two-level hashtable-based cache to
8479 15% performance improvement: from 22.5 to 19.2 seconds.
8481 * expression.cs (IsParamsMethodApplicable): use foreach.
8482 (Invocation.DoResolve): ditto.
8483 (New.DoResolve): ditto.
8484 (ArrayCreation.DoResolve): ditto.
8486 * ecore.cs (FindMostEncompassingType): use foreach.
8488 * delegate.cs (NewDelegate.DoResolve): Use foreach
8490 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8491 (RemoveMethods): use foreach.
8493 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8494 nested foreach statements instead of for, and also break out of
8495 the inner loop once a match is found.
8497 (Invocation.OverloadResolve): Use foreach, simplify the code.
8499 2002-05-08 Miguel de Icaza <miguel@ximian.com>
8501 * cfold.cs (BinaryFold): During an enumeration evaluation context,
8502 we actually unwrap the expression to allow for extra information
8505 * expression.cs: Use Shr_Un on unsigned operations.
8507 2002-05-08 Ravi Pratap <ravi@ximian.com>
8509 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
8510 applicable operators was not being considered correctly. This closes
8511 the bug Miguel reported.
8513 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8515 * attribute.cs: check that the type derives from System.Attribute
8516 and report the correct error in that case (moved the duplicate code to
8517 its own method, too).
8519 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8521 * attribute.cs: lookup attribute type name as the spec says: first the
8522 bare attribute name and then name + "Attribute" (nant compiles with
8523 mcs after this fix).
8525 2002-05-07 Miguel de Icaza <miguel@ximian.com>
8527 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
8528 Because of the way we parse things, we should try to see if a
8529 UIntConstant can fit in an integer.
8531 2002-05-07 Ravi Pratap <ravi@ximian.com>
8533 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8534 when we are in an explicit context.
8536 (ConvertReferenceExplicit): When converting from Iface type S to Class
8537 T make sure the rules are implemented as an OR.
8539 * parameter.cs (ParameterType): Make it a property for now although the
8540 purpose really isn't anything immediate.
8542 * expression.cs (Is*Applicable): Do better checking on the parameter type
8543 of a ref/out parameter. The ones from the system assemblies are already
8544 marked with the correct type so we don't need to do any correction.
8546 * ecore.cs (StandardConversionExists): Conversion from Interface types to
8547 the object type is standard too so include that.
8549 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8551 * ecore.cs (StandardConversionExists): Augment with missing code:
8552 deal with IntConstant, LongConstants and Enumerations.
8554 * assign.cs: Report the error, instead of failing silently
8556 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8557 typecontainer that they are declared, because the
8558 typecontainer/namespace will have the list of using clauses that
8561 Assembly Attributes were escaping the normal registration
8564 (EmitCode): Apply attributes within an EmitContext that represents
8565 the container they were declared on.
8567 * cs-parser.jay: Track bases for structs. How did I get this wrong?
8569 2002-05-06 Ravi Pratap <ravi@ximian.com>
8571 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8572 Revamp completely - make much cleaner as we now operate only
8575 (FindMostSpecificSource, FindMostSpecificTarget): New methods
8576 to implement the logic detailed in the spec more correctly.
8578 (UserDefinedConversion): Update accordingly.
8580 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8582 * statement.cs: Return flow analysis information up.
8584 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8587 (token): Do not consume an extra character before calling
8590 2002-05-06 Piers Haken <piersh@friskit.com>
8592 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8594 2002-05-06 Miguel de Icaza <miguel@ximian.com>
8596 * class.cs (Constructor.Emit): Set the IsStatic flag in the
8597 EmitContext during the instance constructor initializer
8598 resolution, to stop access to instance variables.
8600 This is mandated by the spec, last paragraph of the `constructor
8601 initializers' section.
8603 2002-05-05 Miguel de Icaza <miguel@ximian.com>
8605 * cs-parser.jay, class.cs (Accessor): new class used to represent
8606 an accessor (get or set). In the past we used `null' to represent
8607 a missing accessor. But this is ambiguous because there was no
8608 way to tell in abstract indexers/properties if one of them was
8611 Now there is a way of addressing that.
8613 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8614 instead of FindMembers.
8616 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8617 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8619 * attribute.cs: Treat indexers and properties as the same in terms
8620 of applying attributes
8622 * ecore.cs (FindMostEncompassedType): Use statically initialized
8623 EmptyExpressions()s like we do elsewhere to avoid creating useless
8624 objects (and we take this out of the tight loop).
8626 (GetConversionOperators): Move the code to extract the actual
8627 operators to a separate routine to clean things up.
8629 2002-05-04 Miguel de Icaza <miguel@ximian.com>
8631 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8632 events are always registered FieldBuilders.
8634 * class.cs (FieldBase): New class shared by Fields
8636 * delegate.cs: If we are a toplevel delegate, use our full name.
8637 If we are a nested delegate, then only use our tail name.
8639 2002-05-02 Ravi Pratap <ravi@ximian.com>
8641 * expression.cs (IsApplicable): Ensure that we add the "&" to
8642 ref/out types before comparing it with the type of the argument.
8644 (IsParamsMethodApplicable): Ditto.
8646 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
8649 * delegate.cs : Handle the case when we have more than one applicable
8650 method. Flag an error only when we finish checking all.
8652 2002-05-02 Miguel de Icaza <miguel@ximian.com>
8654 * expression.cs: Add support for boolean static initializers.
8656 2002-05-01 Miguel de Icaza <miguel@ximian.com>
8658 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8660 * parameter.cs (ComputeParameterTypes,
8661 ComputeAndDefineParameterTypes): Better error handling: now we
8662 clear the `types' cache if we fail during any of the type lookups.
8663 We also return the status code correctly to our caller
8665 * delegate.cs: If we fail to define a delegate, abort the extra
8668 * expression.cs (Binary.ResolveOperator): for
8669 operator==(object,object) and operator !=(object, object) we also
8670 have to verify that there is an implicit conversion from one to
8673 (ArrayAccess.DoResolve): Array Access can operate on
8676 2002-04-30 Miguel de Icaza <miguel@ximian.com>
8678 * assign.cs (CompoundAssign): A new class used as a "flag" that
8679 the assignment actually is happening as part of a compound
8680 assignment operator.
8682 During compound assignment, a few new rules exist to enable things
8689 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8690 to the type of x) if y is implicitly convertible to the type of x,
8691 and the operator is a builtin operator and the return type of the
8692 operator is explicitly convertible to the type of x.
8694 * rootcontext.cs: Reset warning level to 2. 4 catches various
8695 "interesting" features in mcs, we must clean this up at some
8696 point, but currently am trying to kill other bugs ;-)
8698 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8699 in container classes as well.
8701 * expression.cs (Binary.ResolveOperator): Handle string case
8702 before anything else (as operator overloading does emit an error
8703 before doing anything else).
8705 This code could go away when we move to a table driven model, but
8706 i could not come up with a good plan last night.
8708 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
8710 * typemanager.cs (CSharpName): reimplementation using regex.
8711 * class.cs: added null check for fields in Emit
8712 * rootcontext.cs: set warninglevel to 4
8714 2002-04-29 Miguel de Icaza <miguel@ximian.com>
8716 * typemanager.cs (CSharpName): reimplemented with Lupus
8719 2002-04-28 Miguel de Icaza <miguel@ximian.com>
8721 * statement.cs (If): correclty implement Resolve, because we were
8722 not catching sem errors in there. The same process is needed
8724 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8727 (Statement.Warning_DeadCodeFound): Factorize code.
8728 (While): Report dead code here too.
8730 (Statement): Added Resolve virtual method to allow
8731 for resolution split from the emit code.
8733 2002-04-26 Miguel de Icaza <miguel@ximian.com>
8735 * statement.cs (EmitBoolExpression): No longer try to resolve the
8737 (MakeBoolean): New utility function that resolve, implicitly
8738 converts to boolean and tags the expression.
8741 (If, Do): Implement dead code elimination.
8742 (While): Implement loop inversion
8744 (Do, While, For, If): Resolve the expression prior to calling our
8747 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
8750 - added method Report28 (warning: program has more than one entry point)
8751 - added method IsEntryPoint, implements paragraph 10.1 of the spec
8752 - modified method Method.Define, the part at the end of the method
8754 * rootcontext.cs: added static public Location EntryPointLocation;
8756 * ../errors/cs0028.cs : Add test case for the above warning.
8759 - modified method CSharpName to allow arrays of primitive type to
8760 be printed nicely (e.g. instead of System.Int32[][] it now prints
8762 - added method CSharpSignature: returns the signature of a method
8763 in string format to be used in reporting errors, warnings, etc.
8765 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
8768 2002-04-26 Ravi Pratap <ravi@ximian.com>
8770 * delegate.cs (Define): Fix extremely silly bug where I was
8771 setting the type of the 'object' parameter of the BeginInvoke
8772 method to System.IAsyncResult instead of System.Object ;-)
8774 2002-04-26 Miguel de Icaza <miguel@ximian.com>
8776 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
8779 (Constructor.Emit): return if we fail to initialize the
8780 constructor. Another door closed!
8782 * expression.cs (New.DoResolve): Improve error message (from -6 to
8783 1501). Use DeclaredOnly lookup to find the exact constructor.
8785 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
8786 loop. This is useful.
8788 * cs-parser.jay: Adjust the default parameters so that destructors
8789 have the proper signature.
8791 2002-04-26 Martin Baulig <martin@gnome.org>
8793 * driver.cs (LoadAssembly): If `assembly' contains any characters
8794 which are only valid in path names and not in assembly names
8795 (currently slash, backslash and point), use Assembly.LoadFrom ()
8796 instead of Assembly.Load () on the `assembly' (before iteration
8797 over the link_paths).
8799 2002-04-26 Martin Baulig <martin@gnome.org>
8801 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
8803 2002-04-25 Miguel de Icaza <miguel@ximian.com>
8805 * class.cs (Property): use the new typemanager.MemberLookup
8807 (TypeContainer.MemberLookup): Implement using the
8808 TypeManager.MemberLookup now.
8810 * typemanager.cs: Make MemberLookup a function of the TypeManager,
8811 and return MemberInfos, so that these can be used without an
8812 EmitContext (what we had before).
8814 2002-04-24 Miguel de Icaza <miguel@ximian.com>
8816 * expression.cs: Fix the case where the argument to params if the
8817 type of the params. I omitted handling this before. Fixed
8819 2002-04-22 Miguel de Icaza <miguel@ximian.com>
8821 * driver.cs: Call BootCorlib_PopulateCoreType
8823 * class.cs (Property.CheckBase): Check for properties only, not
8826 * interface.cs: Temporary hack: try/catch around the
8827 CustomAttributeBuilder, because I am getting an exception that I
8830 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
8831 types whose definitions are required to be there (attributes are
8832 defined before standard types).
8834 Compute definitions as we boot the various types, as they are used
8835 immediately (value_type class will need object_type, but if we do
8836 not initialize object_type, we will pass a null, which will let
8837 the runtime pick the System.Object from the existing corlib, which
8838 is not what we want).
8840 2002-04-22 Patrik Torstensson <totte@labs2.com>
8842 * cs-tokenizer.cs: fixed a number of trim() issues.
8844 2002-04-22 Ravi Pratap <ravi@ximian.com>
8846 * expression.cs (Argument.Type): Ensure that we return the correct
8847 type when we have out or ref parameters [in which case we
8850 2002-04-22 Miguel de Icaza <miguel@ximian.com>
8852 * class.cs (Property, Indexer): Allow extern modifier in there.
8854 * typemanager.cs (InitBaseTypes): Initializes object_type and
8855 value_type, since those will be used early on during the bootstrap
8856 process to compile corlib.
8858 (InitCoreTypes): Move code from here to InitBaseTypes.
8860 2002-04-21 Miguel de Icaza <miguel@ximian.com>
8862 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
8863 single-dimension arrays as using the ldlen opcode.
8865 Daniel Lewis discovered this optimization.
8867 * typemanager.cs: Add signature for System.Array::get_Length
8869 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8871 * statement.cs: report the error when the foreach does not apply to an
8872 array nor a collection.
8874 2002-04-19 Miguel de Icaza <miguel@ximian.com>
8876 * expression.cs: Add implicit conversions to the operator ~.
8878 * constant.cs (DecimalConstant.Emit): Emit decimal value.
8880 * typemanager.cs: Locate the decimal constructor.
8882 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8884 * attribute.cs: use the new property of TypeOf.
8885 * expression.cs: added 'get' property around typearg.
8887 These changes fix a build breaker reported by NickD. Is this the
8888 correct way to fix? If not, please, revert my changes and make it
8891 2002-04-17 Miguel de Icaza <miguel@ximian.com>
8893 * attribute.cs: Add support for typeof in attribute invocations.
8894 I am not sure that this is right though.
8896 2002-04-14 Duncan Mak <duncan@ximian.com>
8898 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
8899 Binary.Operator.Division case.
8901 2002-04-13 Ravi Pratap <ravi@ximian.com>
8903 * class.cs (DefineType): Ensure that we do a proper check on
8904 attribute types and also register it with the TypeManager.
8906 (TypeContainer.Targets): The default for attribute types is
8907 AttributeTargets.All.
8909 * attribute.cs (ApplyAttributes): Registering the attribute type
8910 is done elsewhere, not when we discover we have a Usage attribute.
8912 2002-04-12 Ravi Pratap <ravi@ximian.com>
8914 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
8915 and get rid of is_delegate parameter.
8917 * everywhere : update.
8919 2002-04-12 Ravi Pratap <ravi@ximian.com>
8921 * cs-parser.jay (compilation_unit): Revamp completely to use
8922 some new ideas that I got from Rhys' grammar to solve the problems
8923 with assembly level attributes.
8925 (outer_declaration): New grammar production.
8927 (attribute_sections): Add.
8929 (opt_attributes): Base on attribute_sections
8931 (namespace_declaration): Allow opt_attributes to tackle the case
8932 when we have assembly level attributes - we are clever in this
8935 * attribute.cs (ApplyAttributes): Do not worry about assembly
8936 attributes in the non-global context.
8938 * rootcontext.cs (AddGlobalAttributes): Go back to using this
8939 instead of SetGlobalAttributes.
8941 * class.cs, rootcontext.cs : Ensure we define and generate
8942 attribute types before anything else.
8944 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
8945 and flag the new error -20 for the case when the attribute type
8946 does not have valid targets specified. csc does not catch this.
8948 * ../errors/errors.txt : update for error # -20
8950 2002-04-11 Ravi Pratap <ravi@ximian.com>
8952 * support.cs (InternalParameters.ParameterModifier): Do some null
8953 checking and return sane values.
8955 * class.cs (Method.Define): If we are a PInvoke method, ensure
8956 that we are static and extern. Report error # 601
8958 * ../errors/cs0601.cs : Add test case for the above error.
8960 2002-04-07 Ravi Pratap <ravi@ximian.com>
8962 * rootcontext.cs (attribute_types): We need to keep type of
8963 all attribute types separately and emit code for them first.
8965 (RegisterAttribute) : Implement.
8967 * class.cs (DefineType): Check if the current Type is a custom
8968 attribute type and register it accordingly.
8970 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
8971 adding the first attribute twice and rename to
8973 (SetGlobalAttributes): this.
8975 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
8978 * attribute.cs (ApplyAttributes): Take an additional argument telling us
8979 if we are processing global arguments. Hmm, I am unsure of this.
8981 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8983 * expression.cs: added static array of strings to avoid calling
8984 Enum.ToString () for Operator in Binary. Significant recover of
8987 2002-04-10 Miguel de Icaza <miguel@ximian.com>
8989 * class.cs (FindMembers): Allow the Builders of the various
8990 members to be null. If they are skip them. This only happens
8991 during the PInvoke declaration.
8993 2002-04-09 Miguel de Icaza <miguel@ximian.com>
8995 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
8996 failure, so we do not keep going afterwards.
8998 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
8999 wanted to pass `false' as the `is_delegate' argument. If this is
9000 the case, why not use delegate_type == null to mean `is_delegate =
9001 false' and anything else as is_delegate = true.
9003 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
9005 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
9006 code for the section, not the beginning of the tests.
9008 2002-04-08 Miguel de Icaza <miguel@ximian.com>
9010 * cfold.cs: Handle operator + (Enum x, Underlying x)
9012 * expression.cs (Binary): same. Warn about errors where we have
9013 Enum/Enum in operator + as well.
9015 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
9018 - added support for switch(bool)
9019 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
9020 - add TableSwitchEmit() to handle table-based switch statements
9022 2002-04-05 Ravi Pratap <ravi@ximian.com>
9024 * expression.cs (Invocation.OverloadResolve): Factor out code which
9025 does parameter compatibility checking with arguments so that we can
9026 re-use the code even from Delegate.VerifyApplicability
9028 (VerifyArgumentsCompat): Move above code here.
9030 * delegate.cs (VerifyApplicability): Get rid of duplicate code
9031 and instead make a call to the above method.
9033 2002-03-31 Ravi Pratap <ravi@ximian.com>
9035 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
9036 We use it to keep track of classes which are attribute types.
9038 2002-04-02 Miguel de Icaza <miguel@ximian.com>
9040 * delegate.cs (Delegate.Define): Correctly define the types in the
9041 presence of fixed and array parameters.
9043 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
9046 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
9047 include NonPublic after the first iteration.
9049 * class.cs (Indexer.CheckBase): Only check if both parents are
9052 * cs-parser.jay (accessor_body): If empty, set to null.
9054 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
9055 same code path here to resolve constants names that we did have in
9056 MemberAccess.DoResolve. There is too much code duplicated here.
9058 2002-04-01 Miguel de Icaza <miguel@ximian.com>
9060 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
9062 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
9065 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
9066 tokens, numbers and strings.
9068 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
9071 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
9072 asyncronous parameters and the regular parameters.
9074 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
9075 specify the target directory.
9077 * expression.cs: (This.DoResolve): Simplify
9078 (As.Emit): Optimize, do not generate IsInst if the expression is
9079 always of the given type.
9081 (Is.DoResolve): Bug fix, we were reporting both always/never for
9084 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
9085 creating too many unnecessary arrays.
9087 2002-03-31 Miguel de Icaza <miguel@ximian.com>
9089 * class.cs (EmitFieldInitializer): Use Assign expression to assign
9090 fields instead of rolling our own initializer. Takes care of all
9091 implicit conversions, and drops unnecessary static checks/argument.
9093 2002-03-31 Dick Porter <dick@ximian.com>
9095 * driver.cs: use the GetDirectories() return values properly, and
9096 use "/" as path separator.
9098 2002-03-30 Miguel de Icaza <miguel@ximian.com>
9100 * expression.cs (Unary): Optimize - - expr into expr.
9101 (Binary): Optimize a + (-b) into a -b.
9103 * codegen.cs (CodeGen): Made all methods static.
9105 2002-03-29 Miguel de Icaza <miguel@ximian.com>
9109 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
9110 TypeBuilder property.
9112 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
9115 * tree.cs: Removed the various RecordXXXX, and replaced with a
9116 single RecordDecl. Removed all the accessor methods, and just
9117 left a single access point Type
9119 * enum.cs: Rename DefineEnum to DefineType.
9121 * decl.cs: New abstract method `DefineType' used to unify the
9122 Defines for Enumerations, Interfaces, TypeContainers and
9125 (FindType): Moved LookupInterfaceOrClass here. Moved the
9126 LookupBaseClasses method that used to live in class.cs and
9127 interface.cs here, and renamed to FindType.
9129 * delegate.cs: Implement DefineType. Take advantage of the
9130 refactored pattern for locating the parent builder without taking
9131 the parent_builder argument (which we know does not work if we are
9132 nested, and triggering a toplevel definition).
9134 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9136 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
9137 accessibility of a member has changed during override and report
9140 * class.cs (Method.Define, Property.Define): Only complain on
9141 overrides if the method is private, any other accessibility is
9142 fine (and since we just checked the permission is the same, we are
9145 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
9146 and elif are processed always. The other pre-processing
9147 directives are only processed if we are "taking" the path
9149 2002-03-29 Martin Baulig <martin@gnome.org>
9151 * class.cs (Method.Emit): Only emit symbolic debugging info if the
9152 current location is not Null.
9154 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
9155 a separate method so we can profile it.
9157 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
9158 `span.Seconds' are just seconds, but no minutes or hours.
9159 (MainDriver): Profile the CodeGen.SaveSymbols calls.
9161 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9163 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
9164 Remove the gratuitous set of Final:
9166 // If an interface implementation, then we can set Final.
9167 if (((flags & MethodAttributes.Abstract) == 0) &&
9168 implementing.DeclaringType.IsInterface)
9169 flags |= MethodAttributes.Final;
9171 I do not know what I was smoking when I used that.
9174 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
9175 step into fixing the name resolution issues for delegates and
9176 unifying the toplevel name resolution.
9178 2002-03-28 Martin Baulig <martin@gnome.org>
9180 * class.cs (Method.Emit): If we have a symbol writer, call its
9181 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
9182 tell it about the current method.
9184 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
9185 writer that we're going to emit the first byte of IL code for a new
9186 statement (a new source line).
9187 (EmitContext.EmitTopBlock): If we have a symbol writer, call
9188 EmitContext.Mark() before emitting any code.
9190 * location.cs (SymbolDocument): Return null when we're Null.
9192 * statement.cs (Statement): Moved the `Location loc' variable here.
9193 (Statement.EmitBoolExpression): If we have a symbol writer, call
9194 ec.Mark() before emitting any code to tell it that we're at the
9195 beginning of a new statement.
9196 (StatementExpression): Added `Location' argument to the constructor.
9197 (Block): Added public readonly variable `StartLocation' and public
9198 variable `EndLocation'. The latter is to be set using SetEndLocation().
9199 (Block): Added constructor which takes a start and end location.
9200 (Block.SetEndLocation): New method. This sets the end location.
9201 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
9202 local variables we create.
9203 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
9204 each statement and do also mark the begin and end of the block.
9206 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
9207 tell it the current lexer.Location, use Location.Null for the end of the
9209 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
9210 current block, set its end location using SetEndLocation().
9211 (statement_expression): StatementExpression constructor now takes the
9212 lexer.Location as additional argument.
9213 (for_statement, declare_local_variables): Likewise.
9214 (declare_local_variables): When creating a new implicit block, use the
9215 new Block constructor and pass it the lexer.Location.
9217 2002-03-28 Miguel de Icaza <miguel@ximian.com>
9219 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
9220 members also on the parent interfaces recursively.
9222 2002-03-27 Miguel de Icaza <miguel@ximian.com>
9224 * report.cs: Use new formats, since Gonzalo finished the missing
9227 * expression.cs (Binary.ResolveOperator): added missing operator|
9228 operator& and operator^ for bool/bool.
9230 * cs-parser.jay: CheckDef now takes a Location argument that is
9231 used to report errors more precisly (instead of reporting the end
9232 of a definition, we try to track something which is a lot closer
9233 to the source of the problem).
9235 * cs-tokenizer.cs: Track global token use, so we can properly flag
9236 the use of #define/#undef after the first token has been seen.
9238 Also, rename the reportXXXX to Error_DescriptiveName
9240 * decl.cs (DeclSpace.IsTopLevel): Move property here from
9241 TypeContainer, so that Enum and Interface can use this too.
9243 * class.cs (TypeContainer.LookupInterfaceOrClass,
9244 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
9245 `builder' argument. Typically this was used to pass the parent
9246 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
9249 The problem is that a nested class could trigger the definition of
9250 a toplevel class, and the builder would be obviously wrong in that
9253 So we drop this argument, and we compute dynamically the
9254 TypeBuilder/ModuleBuilder (the correct information was available
9255 to us anyways from DeclSpace.Parent)
9257 * interface.cs (Interface.DefineInterface): Drop builder
9258 parameter cleanup like class.cs
9260 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
9263 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
9266 (Try.Emit): Propagate the returns value from the statement.
9268 (Return.Emit): Even if we are leavning
9270 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
9272 * modifiers.cs: Fix the computation of MethodAttributes flags.
9274 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
9276 * driver.cs: allow compilation of files that start with '/'.
9277 Add a default case when checking the argument of --target.
9279 2002-03-25 Miguel de Icaza <miguel@ximian.com>
9281 * interface.cs: Implement the same search algorithm for types in
9284 * delegate.cs: Do not allow multiple definition.
9286 * Recovered ChangeLog that got accidentally amputated
9288 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
9290 * rootcontext.cs: Load manually enum to allow core classes to
9291 contain enumerations.
9293 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
9294 Update to new static methods in TypeManager.
9296 * typemanager.cs (GetMethod, GetConstructor): Use our
9297 implementation of FindMembers to find the members, since during
9298 corlib compilation, the types are TypeBuilders and GetMethod and
9299 GetConstructor do not work.
9301 Make all methods in TypeManager static.
9303 (InitCodeHelpers): Split the functionality from
9304 the InitCodeTypes function.
9306 * driver.cs: Call InitCodeHelpers after we have populated the
9309 * cs-parser.jay (delegate_declaration): we did not used to compute
9310 the delegate name correctly for void delegates.
9312 2002-03-24 Miguel de Icaza <miguel@ximian.com>
9314 * rootcontext.cs (RootContext): Init the interface_resolve_order
9315 and type_container_resolve_order always.
9317 (ResolveCore, BootstrapCorlib_ResolveClass,
9318 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
9319 compiler when compiling with --nostdlib
9321 * class.cs (TypeContainer.DefineType): Check that our parent is
9322 not null. This test is most important when we are bootstraping
9325 * codegen.cs: Split out the symbol writing code.
9327 2002-03-25 Martin Baulig <martin@gnome.org>
9329 * driver.cs (-g): Made -g an alias for --debug.
9331 2002-03-24 Martin Baulig <martin@gnome.org>
9333 * codegen.cs (SymbolWriter): New public variable. Returns the
9334 current symbol writer.
9335 (CodeGen): Added `bool want_debugging_support' argument to the
9336 constructor. If true, tell the ModuleBuild that we want debugging
9337 support and ask it for the ISymbolWriter.
9338 (Save): If we have a symbol writer, call it's Close() method after
9339 saving the assembly.
9341 * driver.c (--debug): New command line argument to create a
9342 debugger information file.
9344 * location.cs (SymbolDocument): New public property. Returns an
9345 ISymbolDocumentWriter object for the current source file or null
9346 if we don't have a symbol writer.
9348 2002-03-21 Miguel de Icaza <miguel@ximian.com>
9350 * driver.cs (LoadAssembly): Correctly return when all the paths
9351 have been tried and not before.
9353 * statement.cs (Switch.Emit): return the actual coverage for this
9354 statement (returns/not-returns)
9356 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
9357 switch of the statement if we are the last switch section. That
9358 kills two problems: try/catch problems (we used to emit an empty
9359 nop at the end) and switch statements where all branches would
9362 2002-03-19 Miguel de Icaza <miguel@ximian.com>
9364 * driver.cs: Add default assemblies (the equivalent to the
9365 Microsoft CSC.RSP file)
9367 * cs-tokenizer.cs: When updating `cols and setting it to zero,
9368 also update tokens_seen and set it to false.
9370 * driver.cs: Implement --recurse for Mike.
9372 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
9373 correctly splitting out the paths.
9375 2002-03-18 Miguel de Icaza <miguel@ximian.com>
9377 * interface.cs (Interface.PopulateProperty): Instead of using
9378 `parent' as the declaration space for the set parameters, use
9381 * support.cs (InternalParameters): InternalParameters constructor
9382 takes a DeclSpace instead of a TypeContainer.
9384 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
9385 types are being initialized, load the address of it before calling
9388 (New): Provide a mechanism to disable the generation of local
9389 value type temporaries when the caller will be providing us with
9390 an address to store it.
9392 (ArrayCreation.EmitDynamicInitializers): Use it.
9394 2002-03-17 Miguel de Icaza <miguel@ximian.com>
9396 * expression.cs (Invocation.EmitArguments): Only probe for array
9397 property if there is more than one argument. Sorry about that.
9399 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
9402 * class.cs (Method.LabelParameters): Fix incorrect code path that
9403 prevented the `ParamArrayAttribute' from being applied to the
9406 2002-03-16 Miguel de Icaza <miguel@ximian.com>
9408 * support.cs (ReflectionParameters): Correctly compute whether the
9409 last argument is a params array. Fixes the problem with
9412 * typemanager.cs: Make the assemblies array always be non-null
9413 (empty, but non-null)
9415 * tree.cs (RecordDecl): New function that abstracts the recording
9416 of names. This reports error 101, and provides a pointer to the
9417 previous declaration. Fixes a crash in the compiler.
9419 * cs-parser.jay (constructor_declaration): Update to new grammar,
9420 and provide a constructor_body that can be empty.
9422 2002-03-15 Miguel de Icaza <miguel@ximian.com>
9424 * driver.cs: Add support for --resources.
9426 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
9427 Make all types for the various array helper methods be integer.
9429 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9430 CheckState to ConvCast.
9432 (ConvCast): Now it takes a `checked' state argument, to avoid
9433 depending on the emit context for the conversion, and just using
9434 the resolve time setting.
9436 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
9437 instead of Invocation.EmitArguments. We do not emit the original
9438 arguments, instead we emit those which have been converted to
9439 unsigned int expressions.
9441 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
9443 * codegen.cs: ditto.
9445 * expression.cs (LocalVariableReference): Drop the use of the
9446 Store function that depended on the variable index.
9448 * statement.cs (VariableInfo): Drop the `Idx' property from this
9449 class, as this is not taking into account the indexes for
9450 temporaries tat we generate during the execution, getting the
9453 * class.cs: First emit class initializers, then call the parent
9456 * expression.cs (Binary): Fix opcode emision.
9457 (UnaryMutator.EmitCode): Support checked code generation
9459 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9460 matches for events for both the Static and Instance scans,
9461 pointing to the same element. Fix that.
9463 2002-03-14 Miguel de Icaza <miguel@ximian.com>
9465 * rootcontext.cs (ResolveTree): Always set the
9466 interface_resolve_order, because nested interfaces will be calling
9469 * class.cs (GetInterfaceOrClass): Track the same resolution
9470 process used by TypeManager.LookupType. This fixes the nested
9471 type lookups in class declarations (separate path from
9474 (TypeContainer.DefineType): Also define nested interfaces.
9475 (TypeContainer.RegisterOrder): New public function used to
9476 register the order in which child interfaces need to be closed.
9478 Nested interfaces need to be closed after their parents have been
9481 * interface.cs (InterfaceAttr): Put all the logic for computing
9482 the interface attribute here.
9484 (DefineInterface): Register our interface order with the
9485 RootContext or with the TypeContainer depending on the case.
9487 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9489 * cs-parser.jay: rework foreach statement to work with the new
9490 changes to the policy on SimpleNames.
9492 * report.cs: support Stacktrace on warnings as well.
9494 * makefile: drop --unsafe and /unsafe from the compile.
9496 2002-03-13 Ravi Pratap <ravi@ximian.com>
9498 * ecore.cs (StandardConversionExists): Modify to take an Expression
9499 as the first parameter. Ensure we do null -> reference type conversion
9502 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9503 temporary Expression objects.
9505 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9507 * interface.cs: workaround bug in method overloading resolution
9508 (there is already a bugzilla bug for it).
9510 2002-03-12 Miguel de Icaza <miguel@ximian.com>
9512 We could also solve this problem by having a separate path for
9513 performing type lookups, instead of DoResolve, we could have a
9514 ResolveType entry point, and only participating pieces of the
9515 production (simplename, deref, array) would implement this.
9517 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9518 signal SimpleName to only resolve type names and not attempt to
9519 resolve anything else.
9521 * expression.cs (Cast): Set the flag.
9523 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9525 * class.cs: Only report 108 if there is no `new' modifier.
9527 * cs-parser.jay: rework foreach statement to work with the new
9528 changes to the policy on SimpleNames.
9530 * report.cs: support Stacktrace on warnings as well.
9532 * makefile: drop --unsafe and /unsafe from the compile.
9534 2002-03-11 Miguel de Icaza <miguel@ximian.com>
9536 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9537 lookups here, instead of doing that at parse time. This means
9538 that our grammar will not introduce `LocalVariableReferences' as
9539 expressions at this point. That solves the problem of code like
9547 This is only half the fix. The full fix requires parameters to
9548 also be handled in this way.
9550 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9551 makes the use more obvious of the DeclSpace. The
9552 ec.TypeContainer.TypeBuilder is now only used to pull the
9555 My theory is that I can get rid of the TypeBuilder completely from
9556 the EmitContext, and have typecasts where it is used (from
9557 DeclSpace to where it matters).
9559 The only pending problem is that the code that implements Aliases
9560 is on TypeContainer, and probably should go in DeclSpace.
9562 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9563 lookups here, instead of doing that at parse time. This means
9564 that our grammar will not introduce `LocalVariableReferences' as
9565 expressions at this point. That solves the problem of code like
9573 This is only half the fix. The full fix requires parameters to
9574 also be handled in this way.
9576 * class.cs (Property.DefineMethod): When implementing an interface
9577 method, set newslot, when implementing an abstract method, do not
9578 set the flag (before we tried never setting it, or always setting
9579 it, which is the difference).
9580 (Indexer.DefineMethod): same.
9581 (Method.DefineMethod): same.
9583 * ecore.cs: Only set the status used flag if we get back a Field.
9585 * attribute.cs: Temporary hack, so Paolo can keep working.
9587 2002-03-08 Ravi Pratap <ravi@ximian.com>
9589 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9590 the unmanaged type in the case we have a MarshalAs attribute.
9592 (Resolve): Handle the case when we are parsing the special MarshalAs
9593 attribute [we need to store the unmanaged type to use later]
9595 * typemanager.cs (marshal_as_attr_type): Built in type for the
9596 MarshalAs Attribute.
9598 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
9599 on parameters and accordingly set the marshalling info.
9601 2002-03-09 Miguel de Icaza <miguel@ximian.com>
9603 * class.cs: Optimizing slightly by removing redundant code after
9604 we switched to the `NoTypes' return value.
9605 (Property.DefineMethod): use NoTypes here too.
9607 This fixes the bug I introduced in my last batch of changes.
9609 2002-03-05 Ravi Pratap <ravi@ximian.com>
9611 * tree.cs (RecordEnum): Add. We now keep track of enums too.
9613 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9614 Enums since those are types too.
9616 * cs-parser.jay (enum_declaration): Record enums as we parse them.
9618 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
9619 thanks to a call during the lookup process.
9621 2002-03-07 Miguel de Icaza <miguel@ximian.com>
9623 * statement.cs (Foreach): Lots of work to accomodate a particular
9624 kind of foreach statement that I had not kept in mind. It is
9625 possible to have foreachs on classes that provide a GetEnumerator
9626 method that return objects that implement the "pattern" for using
9627 a foreach, there is no need to support GetEnumerator
9630 This is needed to compile nant.
9632 * decl.cs: Only report 114 if the member is not `Finalize' and if
9633 the warning level is at least 2.
9635 * class.cs: Moved the compare function from Method to
9638 (MethodSignature.InheritableMemberSignatureCompare): Add new
9639 filter function that is used to extract inheritable methods from a
9642 (Method.Define): Use the new `inheritable_method_signature_filter'
9645 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9648 2002-03-06 Miguel de Icaza <miguel@ximian.com>
9650 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9652 * cs-parser.jay: Add opt_semicolon to the interface declaration.
9654 * expression.cs: Pass location information to
9655 ConvertImplicitStandard.
9657 * class.cs: Added debugging code to track return values from
9660 2002-03-05 Miguel de Icaza <miguel@ximian.com>
9662 * expression.cs (Is.DoResolve): If either side of the `is' is an
9663 interface, do not flag the warning.
9665 * ecore.cs (ImplicitReferenceConversion): We need a separate test
9668 * report.cs: Allow for --fatal to be used with --probe.
9670 * typemanager.cs (NoTypes): Move the definition for the empty Type
9673 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9675 (TypeContainer.DefineProxy): New function used to proxy to parent
9676 implementations when implementing interfaces.
9677 (TypeContainer.ParentImplements): used to lookup if our parent
9678 implements a public function that is required by an interface.
9679 (TypeContainer.VerifyPendingMethods): Hook this up.
9681 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9682 `modules' and `assemblies' arraylists into arrays. We only grow
9683 these are the very early start up of the program, so this improves
9684 the speedof LookupType (nicely measured).
9686 * expression.cs (MakeByteBlob): Replaced unsafe code with
9687 BitConverter, as suggested by Paolo.
9689 * cfold.cs (ConstantFold.Binary): Special case: perform constant
9690 folding of string concatenation, but if either side is a string,
9691 and the other is not, then return null, and let the runtime use
9692 the concatenation on the string plus the object (using
9695 2002-03-04 Miguel de Icaza <miguel@ximian.com>
9697 Constant Folding has been implemented now.
9699 * expression.cs (Unary.Reduce): Do not throw an exception, catch
9700 the error instead on types that are not supported in one's
9703 * constant.cs (Constant and all children): New set of functions to
9704 perform implict and explicit conversions.
9706 * ecore.cs (EnumConstant): Implement the new functions to perform
9707 conversion by proxying to the child expression.
9709 * codegen.cs: (ConstantCheckState): Constant evaluation has its
9710 own separate setting that can not be turned off from the command
9711 line using --unchecked or --checked and is only controlled using
9712 the checked/unchecked statements and expressions. This setting is
9713 used by the constant folder to flag errors.
9715 * expression.cs (CheckedExpr, UncheckedExpr): Set the
9716 ConstantCheckState as well.
9718 During Resolve, they also have to flag the state, because the
9719 constant folder runs completely in the Resolve phase.
9721 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9724 2002-03-01 Miguel de Icaza <miguel@ximian.com>
9726 * cfold.cs: New file, this file contains the constant folder.
9728 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9729 argument to track whether we are using the resulting address to
9730 load or store a value and provide better error messages.
9732 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9733 new AddressOf arguments.
9735 * statement.cs (Foreach.EmitCollectionForeach): Update
9737 * expression.cs (Argument.Emit): Call AddressOf with proper
9738 arguments to track usage.
9740 (New.DoEmit): Call AddressOf with new arguments.
9742 (Unary.Emit): Adjust AddressOf call.
9744 2002-03-01 Ravi Pratap <ravi@ximian.com>
9746 * cs-parser.jay (member_access): Change the case for pre-defined types
9747 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
9750 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9753 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9754 essentially like methods and apply attributes like MethodImplOptions to them too.
9756 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9759 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9760 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
9763 * Update code everywhere accordingly.
9765 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
9767 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
9769 2002-02-28 Ravi Pratap <ravi@ximian.com>
9771 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
9772 try performing lookups against those instead of jumping straight into using
9773 the 'using' clauses.
9775 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
9777 (LookupType): Perform lookups in implicit parents too.
9779 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
9780 sequence as RootContext.LookupType.
9782 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
9783 the various cases of namespace lookups into this method.
9785 2002-03-01 Miguel de Icaza <miguel@ximian.com>
9787 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
9788 in positional arguments)
9790 * class.cs (Operator): Update the AllowedModifiers to contain
9793 * cs-parser.jay: Update operator declaration to allow for the
9794 operator body to be empty.
9796 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
9799 2002-02-27 Miguel de Icaza <miguel@ximian.com>
9801 * class.cs (Method.Emit): Label parameters.
9803 * driver.cs: Return 1 or 0 as the program exit code.
9805 2002-02-26 Miguel de Icaza <miguel@ximian.com>
9807 * expression.cs: Special case the `null' object when trying to
9808 auto-compute the type, as anything can be explicitly converted to
9811 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
9812 spotting this Paolo.
9814 (Expression.ImplicitNumericConversion): Perform comparissions of
9815 the type using the underlying type in the case of an enumeration
9816 rather than using the enumeration type for the compare.
9818 Cope with the underlying == type case, which is not possible to
9821 (Expression.ConvertNumericExplicit): Perform comparissions of
9822 the type using the underlying type in the case of an enumeration
9823 rather than using the enumeration type for the compare.
9825 * driver.cs: If the user does not supply an extension, assume .exe
9827 * cs-parser.jay (if_statement): Rewrote so that we can track the
9828 location for the if statement.
9830 * expression.cs (Binary.ConstantFold): Only concat strings when
9831 the operation is "+", not everything ;-)
9833 * statement.cs (Statement.EmitBoolExpression): Take a location
9835 (If, While, Do): Track location.
9837 * expression.cs (Binary.ResolveOperator): In the object + string
9838 case, I was missing a call to ConvertImplicit
9840 2002-02-25 Ravi Pratap <ravi@ximian.com>
9842 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
9843 Location arguments. Ensure we use RootContext.LookupType to do our work
9844 and not try to do a direct Type.GetType and ModuleBuilder.GetType
9846 * interface.cs (PopulateMethod): Handle the type of the parameter being
9849 * expression.cs (Invocation.BetterFunction): Handle the case when we
9850 have a params method with no fixed arguments and a call is made with no
9853 2002-02-25 Miguel de Icaza <miguel@ximian.com>
9855 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
9856 the verbatim-string-literal
9858 * support.cs (InternalParameters.ParameterModifier): handle null
9860 (InternalParameters.ParameterType): ditto.
9862 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
9863 duplicating the name of the variable parameter.
9864 (GetParameterByName): Fix bug where we were not looking up array
9865 paramters if they were the only present (thanks Paolo!).
9866 (GetParameterInfo): We only have an empty set of types if both
9867 fixed and array are set to null.
9868 (GetParameterInfo-idx): Handle FixedParameter == null
9870 * cs-parser.jay: Handle the case where there is no catch
9871 statements (missing null test).
9873 2002-02-22 Miguel de Icaza <miguel@ximian.com>
9875 * driver.cs (MainDriver): Be conservative on our command line
9878 Catch DirectoryNotFoundException when calling GetFiles.
9880 (SplitPathAndPattern): Used to split the input specification into
9881 a path and a pattern that we can feed to Directory.GetFiles.
9883 2002-02-21 Miguel de Icaza <miguel@ximian.com>
9885 * statement.cs (Fixed): Implement the last case of the Fixed
9886 statement (string handling).
9888 * expression.cs (StringPtr): New class used to return a char * to
9889 a string; Used by the Fixed statement.
9891 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
9893 * expression.cs (Binary.ResolveOperator): Remove redundant
9894 MemberLookup pn parent type.
9895 Optimize union call, we do not need a union if the types are the same.
9896 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
9899 Specialize the use of MemberLookup everywhere, instead of using
9900 the default settings.
9902 (StackAlloc): Implement stackalloc keyword.
9904 * cs-parser.jay: Add rule to parse stackalloc.
9906 * driver.cs: Handle /h, /help, /?
9908 * expression.cs (MakeByteBlob): Removed the hacks we had in place
9909 before we supported unsafe code.
9911 * makefile: add --unsafe to the self compilation of mcs.
9913 2002-02-20 Miguel de Icaza <miguel@ximian.com>
9915 * expression.cs (PointerArithmetic): New class that is used to
9916 perform pointer arithmetic.
9917 (Binary.Resolve): Handle pointer arithmetic
9918 Handle pointer comparission.
9919 (ArrayPtr): Utility expression class that is used to take the
9920 address of an array.
9922 (ElementAccess): Implement array access for pointers
9924 * statement.cs (Fixed): Implement fixed statement for arrays, we
9925 are missing one more case before we are done.
9927 * expression.cs (Indirection): Implement EmitAssign and set the
9928 ExprClass to Variable. This allows pointer dereferences to be
9929 treated as variables, and to have values assigned to them.
9931 * ecore.cs (Expression.StoreFromPtr): New utility function to
9932 store values dereferencing.
9934 2002-02-20 Ravi Pratap <ravi@ximian.com>
9936 * expression.cs (Binary.ResolveOperator): Ensure that we are
9937 not trying to operate on a void type - this fixes the reported
9940 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
9941 the parent implementation is sealed.
9943 * ../errors/cs0239.cs : Add.
9945 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
9947 * typemanager.cs (unverifiable_code_type): Corresponds to
9948 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
9949 which have unsafe code in them.
9951 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
9954 2002-02-19 Miguel de Icaza <miguel@ximian.com>
9956 * cs-tokenizer.cs: Add support for @"litreal strings"
9958 Make tokenizer accept pre-processor directives
9959 on any column (remove the old C-like limitation).
9961 * rootcontext.cs (EmitCode): Emit any global attributes.
9962 (AddGlobalAttributes): Used to keep track of assembly attributes.
9964 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
9966 * cs-parser.jay: Add support for global attributes.
9968 2002-02-17 Miguel de Icaza <miguel@ximian.com>
9970 * expression.cs (Indirection): New helper class. Unary will
9971 create Indirection classes to be able to implement the
9972 IMemoryLocation interface on it.
9974 2002-02-16 Miguel de Icaza <miguel@ximian.com>
9976 * cs-parser.jay (fixed_statement): reference the right statement.
9978 * statement.cs (Fixed.Emit): Finish implementing the fixed
9979 statement for the &x case.
9981 2002-02-14 Miguel de Icaza <miguel@ximian.com>
9983 * class.cs (Property.Define, Method.Define): Remove newslot when
9986 * modifiers.cs: My use of NewSlot when `Abstract' was set was
9987 wrong. NewSlot should only be used if the `new' keyword is present.
9989 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
9990 locating our system dir. Sorry about this.
9992 2002-02-13 Miguel de Icaza <miguel@ximian.com>
9994 * driver.cs (GetSystemDir): Compute correctly the location of our
9995 system assemblies. I was using the compiler directory instead of
9996 the library directory.
9998 2002-02-13 Ravi Pratap <ravi@ximian.com>
10000 * expression.cs (BetterFunction): Put back in what Miguel commented out
10001 since it is the correct fix. The problem is elsewhere ;-)
10003 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
10004 parameters of the parms method are themselves compatible or not !
10006 (StandardConversionExists): Fix very dangerous bug where we were forgetting
10007 to check that a class implements an interface before saying that an implicit
10008 conversion was allowed. Use ImplementsInterface to do the checking.
10010 2002-02-13 Miguel de Icaza <miguel@ximian.com>
10012 * class.cs (Method.Define): Track whether we are an explicit
10013 implementation or not. And only call DefineMethodOverride if we
10014 are an explicit implementation.
10016 (Property.DefineMethod): Ditto.
10018 2002-02-11 Ravi Pratap <ravi@ximian.com>
10020 * expression.cs (BetterFunction): Catch hideous bug which was
10021 preventing us from detecting ambiguous calls due to implicit casts i.e
10024 2002-01-29 Miguel de Icaza <miguel@ximian.com>
10026 * support.cs (Pair): Remove un-needed method. I figured why I was
10027 getting the error in cs-parser.jay, the variable in a foreach loop
10028 is readonly, and the compiler does not really treat this as a variable.
10030 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
10031 instead of EQUALS in grammar.
10033 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
10035 * expression.cs (Unary.DoResolve): Check whether the argument is
10038 2002-01-28 Miguel de Icaza <miguel@ximian.com>
10040 * support.cs: Api for Pair to set a value. Despite the fact that
10041 the variables are public the MS C# compiler refuses to compile
10042 code that accesses the field if the variable is part of a foreach
10045 * statement.cs (Fixed): Begin implementation of the fixed
10048 (Block.AddVariable): Return the VariableInfo on success and null
10049 on failure instead of true/false.
10051 * cs-parser.jay (foreach): Catch errors on variables already
10052 defined (we were ignoring this value before) and properly unwind
10053 the block hierarchy
10055 (fixed_statement): grammar for the fixed statement.
10057 2002-01-25 Miguel de Icaza <miguel@ximian.com>
10059 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
10060 pointer types to be incretemented.
10062 (SizeOf): Implement.
10064 * cs-parser.jay (pointer_member_access): Implement
10065 expr->IDENTIFIER production.
10067 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
10068 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
10071 (Unary): Implement indirection.
10073 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
10074 use in non-unsafe context).
10076 (SimpleName.DoResolve): Check for pointers in field access on safe
10079 (Expression.LoadFromPtr): Factor the load-indirect code in this
10080 function. This was duplicated in UnboxCast and ParameterReference
10082 2002-01-24 Miguel de Icaza <miguel@ximian.com>
10084 * expression.cs (ComposedCast): report an error if a pointer cast
10085 is used in a safe region.
10087 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
10088 pointer type casts in unsafe context.
10090 * codegen.cs (EmitContext): Set up IsUnsafe.
10092 * cs-parser.jay (non_expression_type): Add productions for pointer
10095 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
10096 code. We should not use force into static mode if the method is
10097 not virtual. Fixes bug in MIS
10099 * statement.cs (Do.Emit, While.Emit, For.Emit,
10100 Statement.EmitBoolExpression): Add support to Do and While to
10101 propagate infinite loop as `I do return' semantics.
10103 Improve the For case to also test for boolean constants.
10105 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
10106 to the list of attributes we can add.
10108 Remove `EmitContext' argument.
10110 * class.cs (Method.Define): Apply parameter attributes.
10111 (Constructor.Define): Apply parameter attributes.
10112 (MethodCore.LabelParameters): Move here the core of labeling
10115 * support.cs (ReflectionParameters.ParameterModifier,
10116 InternalParameters.ParameterModifier): Use IsByRef on the type and
10117 only return the OUT bit for these parameters instead of in/out/ref
10120 This is because I miss-understood things. The ParameterInfo.IsIn
10121 and IsOut represent whether the parameter has the [In] and [Out]
10124 2002-01-22 Miguel de Icaza <miguel@ximian.com>
10126 * ecore.cs (FieldExpr.Emit): Release temporaries.
10128 * assign.cs (LocalTemporary.Release): new function.
10130 * codegen.cs (EmitContext.GetTemporaryStorage,
10131 EmitContext.FreeTemporaryStorage): Rework the way we deal with
10132 temporary storage. Now we can "put back" localbuilders when we
10135 2002-01-21 Miguel de Icaza <miguel@ximian.com>
10137 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
10138 need to make a copy of the variable to generate verifiable code.
10140 2002-01-19 Miguel de Icaza <miguel@ximian.com>
10142 * driver.cs: Compute dynamically the system directory.
10144 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
10145 Slower, but more generally useful. Used by the abstract
10146 registering implementation.
10148 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
10149 the rules for the special rule on Type/instances. First check if
10150 we have the same name, and if so, try that special static path
10151 rather than the instance path.
10153 2002-01-18 Miguel de Icaza <miguel@ximian.com>
10155 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
10158 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
10159 Enum, ValueType, Delegate or Array for non-corlib compiles.
10161 * cs-tokenizer.cs: Catch long identifiers (645)
10163 * typemanager.cs (IndexerPropetyName): Ravi never tested this
10166 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
10167 fix, we were returning too early, so we were not registering
10168 pending methods from abstract classes.
10170 Do not register pending methods if the class is abstract.
10172 * expression.cs (Conditional.DoResolve): Report circular implicit
10173 conversions when we neecd to compute it for conditional
10176 (Is.DoResolve): If the expression is always of the provided type,
10177 flag warning 183. If the expression can not ever be of the
10178 provided type flag warning 184.
10180 * class.cs: Catch 169 as well.
10182 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
10185 2002-01-18 Nick Drochak <ndrochak@gol.com>
10187 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
10189 2002-01-17 Miguel de Icaza <miguel@ximian.com>
10191 * interface.cs: (PopulateMethod): Check for pointers being defined
10192 only if the unsafe context is active.
10193 (PopulateProperty): ditto.
10194 (PopulateIndexer): ditto.
10196 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
10197 specified. If pointers are present, make sure that they are
10198 present in an unsafe context.
10199 (Constructor, Constructor.Define): ditto.
10200 (Field, Field.Define): ditto.
10201 (Property, Property.Define): ditto.
10202 (Event, Event.Define): ditto.
10204 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
10205 hashtable if there are classes or structs defined.
10207 * expression.cs (LocalVariableReference.DoResolve): Simplify this
10208 code, as the constant resolution moved.
10210 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
10211 the metadata, so we can flag error 133.
10213 * decl.cs (MemberCore.UnsafeOK): New function to test that a
10214 pointer is being declared in an unsafe context.
10216 2002-01-16 Miguel de Icaza <miguel@ximian.com>
10218 * modifiers.cs (Modifiers.Check): Require a Location argument.
10219 Report error 227 for Unsafe use.
10221 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
10223 * statement.cs (For.Emit): If the test is null, then report that
10224 we do `return', as we wont reach anything afterwards.
10226 (Switch.SwitchGoverningType): Track the expression that matched
10229 * driver.cs: Allow negative numbers as an error code to flag.
10231 * cs-parser.jay: Handle 1551.
10233 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
10235 2002-01-15 Miguel de Icaza <miguel@ximian.com>
10237 * cs-parser.jay: Report 1518 (type declaration can only contain
10238 class, struct, interface, enum or delegate)
10240 (switch_label): Report 1523 (keywords `case' or `default' must
10243 (opt_switch_sections): Report 1522 (empty switch)
10245 * driver.cs: Report 1515 (response file specified multiple times)
10246 Report 1516 (Source file specified multiple times).
10248 * expression.cs (Argument.Resolve): Signal 1510
10250 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
10251 access not allowed in static code)
10253 2002-01-11 Ravi Pratap <ravi@ximian.com>
10255 * typemanager.cs (IsPointerType): Utility method which we are going
10258 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
10259 the object type, so we take care of that.
10261 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
10263 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
10264 added to non-params parameters :-)
10266 * typemanager.cs (CSharpName): Include 'void' type too.
10268 (void_ptr_type): Include in the set of core types.
10270 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
10273 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
10276 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
10277 completely forgotten about it.
10279 2002-01-10 Ravi Pratap <ravi@ximian.com>
10281 * cs-parser.jay (pointer_type): Add. This begins our implementation
10282 of parsing rules for unsafe code.
10284 (unsafe_statement): Implement.
10286 (embedded_statement): Modify to include the above.
10288 * statement.cs (Unsafe): Implement new class for unsafe blocks.
10290 * codegen.cs (EmitContext.InUnsafe): Add. This determines
10291 if the current context is an unsafe one.
10293 * cs-parser.jay (local_variable_pointer_type): Since local variable types
10294 are handled differently, we need separate rules for them.
10296 (local_variable_declaration): Update to use local_variable_pointer_type
10297 to allow variable declarations of unmanaged pointer types.
10299 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
10300 in unsafe contexts.
10302 * ../errors/cs0214.cs : Add.
10304 2002-01-16 Nick Drochak <ndrochak@gol.com>
10306 * makefile: remove 'response' file when cleaning.
10308 2002-01-15 Miguel de Icaza <miguel@ximian.com>
10310 * cs-parser.jay: Report 1524.
10312 2002-01-14 Miguel de Icaza <miguel@ximian.com>
10314 * typemanager.cs (RegisterMethod): drop checking if we have
10315 registered this from here
10317 2002-01-12 Miguel de Icaza <miguel@ximian.com>
10319 * class.cs (Method.EmitDestructor): Implement calling our base
10322 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
10323 value of InFinally.
10325 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
10326 this routine and will wrap the call in a try/catch block. Deal
10329 2002-01-11 Miguel de Icaza <miguel@ximian.com>
10331 * ecore.cs (Expression.MemberLookup): instead of taking a
10332 parameter `same_type' that was used to tell whether we could
10333 access private members we compute our containing type from the
10336 (FieldExpr): Added partial support for volatile fields. This does
10337 not work for volatile fields exposed from assemblies, as I can not
10338 figure out how to extract the modreq from it.
10340 Updated all the source files to use this.
10342 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
10343 because it is referenced by MemberLookup very often.
10345 2002-01-09 Ravi Pratap <ravi@ximian.com>
10347 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
10348 TypeBuilder.GetCustomAttributes to retrieve what we need.
10350 Get rid of redundant default_member_attr_type as this is the same as
10351 default_member_type which already exists.
10353 * interface.cs, attribute.cs : Update accordingly.
10355 2002-01-08 Miguel de Icaza <miguel@ximian.com>
10357 * typemanager.cs: Enable IndexerPropertyName again. It does not
10358 work for TYpeBuilders though. Ravi, can you please fix this?
10360 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
10362 * expression.cs (Argument.Emit): Handle the case of ref objects
10363 being passed to ref functions;
10365 (ParameterReference.EmitLoad): Loads the content of the pointer
10366 without dereferencing.
10368 2002-01-07 Miguel de Icaza <miguel@ximian.com>
10370 * cs-tokenizer.cs: Implemented the pre-processing expressions.
10372 2002-01-08 Ravi Pratap <ravi@ximian.com>
10374 * class.cs (Indexer.DefineMethod): Incorporate the interface
10375 type in the name of the method if we are doing explicit interface
10378 * expression.cs (ConversionExists): Remove as it is completely obsolete.
10380 (BetterConversion): Fix extremely trivial bug where we were referring to
10381 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
10384 * ../errors/bug16.cs : Add although we have fixed it.
10386 2002-01-07 Miguel de Icaza <miguel@ximian.com>
10388 * expression.cs (BaseIndexer): Begin implementation.
10390 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
10392 * cs-parser.jay (indexer_declarator): Use qualified_identifier
10393 production directly to remove a shift/reduce, and implement
10394 explicit interface implementation.
10396 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
10397 after a floating point suffix.
10399 * expression.cs (DoNumericPromotions): Improved the conversion for
10400 uint/uint. If we have a constant, we avoid doing a typecast to a
10403 * class.cs (Indexer): Implement explicit interface implementation
10406 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
10408 * class.cs: make the default instance constructor public and hidebysig.
10410 2001-01-03 Ravi Pratap <ravi@ximian.com>
10412 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
10413 so we can call it from elsewhere.
10415 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
10416 we emit it internally if the class has a defined indexer; otherwise the user
10417 emits it by decorating the class definition with the DefaultMemberAttribute.
10419 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
10420 attribute is not used on a type which defines an indexer.
10422 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
10423 character when we skip whitespace.
10425 * ../errors/cs0646.cs : Add.
10427 2002-01-03 Miguel de Icaza <miguel@ximian.com>
10429 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
10432 * makefile: Add practical target `mcs3.exe' which builds the third
10433 generation compiler.
10435 * expression.cs (New): Fix structures constructor calling.
10437 * class.cs (Property, Method, Indexer): Emit Final flag on the
10438 method if we are an interface implementation and we are not
10441 * ecore.cs (PropertyExpr): New public field `IsBase', tells
10442 whether this property is referencing a `base' method.
10444 * expression.cs (Invocation.EmitCall): take an extra argument:
10445 is_base, this is used to determine whether the `call' or
10446 `callvirt' opcode should be used.
10449 * delegate.cs: update EmitCall.
10451 * class.cs (Method.Define): Set NewSlot for the cases where we are
10452 not implementing an interface method.
10454 (Property.Define): ditto.
10456 2002-01-02 Miguel de Icaza <miguel@ximian.com>
10458 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10459 'r'. Allows mcs to parse itself fully.
10461 2002-01-02 Ravi Pratap <ravi@ximian.com>
10463 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10464 of the number of initializers that require the InitializeArray method.
10466 (CheckIndices): Store the Expression in all cases - not the plain value. Also
10467 update the above field where necessary.
10469 (MakeByteBlob): Update accordingly.
10471 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
10474 (EmitDynamicInitializers): Update in accordance with the new optimization.
10476 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10477 same OpCode applies.
10479 * cs-parser.jay : Fix some glaring errors I introduced.
10481 2002-01-01 Ravi Pratap <ravi@ximian.com>
10483 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10484 so that we can check for name clashes there too.
10486 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10487 for interface indexers.
10489 * interfaces.cs (Define): Emit the default member attribute.
10491 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10492 variable was being referred to while setting the value ;-)
10494 2002-01-01 Miguel de Icaza <miguel@ximian.com>
10496 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10497 byte-by-byte information when we know the data is zero.
10499 Make the block always a multiple of 4, because
10500 DefineInitializedData has a bug.
10502 * assign.cs: Fix, we should assign from the temporary, not from
10505 * expression.cs (MakeByteBlob): Fix my incorrect code.
10507 2001-12-31 Miguel de Icaza <miguel@ximian.com>
10509 * typemanager.cs (EnumToUnderlying): This function is used to get
10510 the underlying type from an enumeration, because it does not
10513 * constant.cs: Use the I4_S form for values between -128 and 127.
10515 * statement.cs (Block.LookupLabel): Looks up a label.
10516 (Block): Drop support for labeled blocks.
10518 (LabeledStatement): New kind of statement that represents a label
10521 (Goto): Finally implement this bad boy.
10523 * cs-parser.jay: Update to reflect new mechanism to implement
10526 2001-12-30 Miguel de Icaza <miguel@ximian.com>
10528 * codegen.cs (EmitContext.This): a codegen property that keeps the
10529 a single instance of this instead of creating many different this
10532 * delegate.cs (Delegate.DoResolve): Update to use the property;
10534 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10536 * expression.cs (BaseAccess.DoResolve): Ditto.
10538 2001-12-29 Ravi Pratap <ravi@ximian.com>
10540 * typemanager.cs (methodimpl_attr_type): Add to hold the type
10541 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10543 (InitCoreTypes): Update accordingly.
10545 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10546 so we can quickly store the state.
10548 (ApplyAttributes): Set the correct implementation flags
10549 for InternalCall methods.
10551 2001-12-29 Miguel de Icaza <miguel@ximian.com>
10553 * expression.cs (EmitCall): if a method is not virtual, then do
10554 not use callvirt on it.
10556 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10557 user defined stuff) requires the use of stobj, which takes an
10558 address on the stack instead of an array and an index. So emit
10559 the Ldelema operation for it.
10561 (EmitStoreOpcode): Use stobj for valuetypes.
10563 (UnaryMutator.EmitCode): Use the right 1 value depending on
10564 whether we are dealing with int64/uint64, float or doubles.
10566 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10567 constructors that I implemented last night.
10569 (Constructor.IsDefault): Fix to work properly for static
10572 * cs-parser.jay (CheckDef): report method signature errors.
10573 Update error number 103 to be 132.
10575 * decl.cs: New AdditionResult enumeration value: MethodExists.
10576 Although we do this check for methods later on in the semantic
10577 analysis, catching repeated default constructors is so easy that
10578 we catch these here.
10580 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10583 (ParameterReference.EmitAssign, Emit): handle
10586 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10587 (ArrayAccess.EmitStoreOpcode): ditto.
10589 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10591 * expression.cs (MakeByteBlob): Complete all the missing types
10592 (uint, short, ushort, byte, sbyte)
10594 * class.cs: Only init instance field initializers on instance
10597 Rename `constructors' to instance_constructors.
10599 (TypeContainer.AddConstructor): Only add constructors to the list
10600 if it is not static.
10602 Make sure that we handle default_static_constructor independently
10603 everywhere where we handle instance_constructors
10605 2001-12-28 Miguel de Icaza <miguel@ximian.com>
10607 * class.cs: Do not lookup or create a base initializer for a
10608 static constructor.
10610 (ConstructorInitializer.Resolve): use the proper type to lookup
10613 * cs-parser.jay: Report error 1585 (modifiers between type and name).
10615 * enum.cs, interface.cs: Remove CloseType, this is taken care by
10618 * decl.cs: CloseType is now an virtual method, the default
10619 implementation just closes this type.
10621 2001-12-28 Ravi Pratap <ravi@ximian.com>
10623 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10624 to PreserveSig by default. Also emit HideBySig on such methods.
10626 Basically, set the defaults to standard values.
10628 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10629 argument, if candidate is better, it can't be worse than the best !
10631 (Invocation): Re-write bits to differentiate between methods being
10632 applicable in their expanded form and their normal form - for params
10635 Get rid of use_standard everywhere as only standard conversions are allowed
10636 in overload resolution.
10638 More spec conformance.
10640 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10642 * driver.cs: Add --timestamp, to see where the compiler spends
10645 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10646 `this' in static code.
10648 (SimpleName.DoResolve): Implement in terms of a helper function
10649 that allows static-references to be passed upstream to
10652 (Expression.ResolveWithSimpleName): Resolve specially simple
10653 names when called by MemberAccess to implement the special
10656 (Expression.ImplicitReferenceConversion): Handle conversions from
10657 Null to reference types before others, as Null's type is
10660 * expression.cs (Invocation.EmitCall): Handle the special case of
10661 calling methods declared on a reference type from a ValueType
10662 (Base classes System.Object and System.Enum)
10664 (MemberAccess.Resolve): Only perform lookups on Enumerations if
10665 the left hand side is a TypeExpr, not on every enumeration.
10667 (Binary.Resolve): If types are reference types, then do a cast to
10668 object on operators != and == of both arguments.
10670 * typemanager.cs (FindMembers): Extract instance and static
10671 members if requested.
10673 * interface.cs (PopulateProperty): Use void_type instead of null
10674 as the return type for the setter method.
10676 (PopulateIndexer): ditto.
10678 2001-12-27 Ravi Pratap <ravi@ximian.com>
10680 * support.cs (ReflectionParameters): Fix minor bug where we
10681 were examining the wrong parameter for the ParamArray attribute.
10683 Cope with requests for the type of the parameter at position
10684 greater than the params parameter's. We now return the element
10685 type of the params array as that makes more sense.
10687 * expression.cs (Invocation.IsParamsMethodApplicable): Update
10688 accordingly as we no longer have to extract the element type
10691 (Invocation.OverloadResolve): Update.
10693 2001-12-27 Miguel de Icaza <miguel@ximian.com>
10695 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10696 against IEnumerator, test whether the return value is a descendant
10697 of the IEnumerator interface.
10699 * class.cs (Indexer.Define): Use an auxiliary method to implement
10700 the other bits of the method definition. Begin support for
10701 explicit interface implementation.
10703 (Property.DefineMethod): Use TypeManager.void_type instead of null
10704 for an empty return value.
10706 2001-12-26 Miguel de Icaza <miguel@ximian.com>
10708 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10709 dealing with a FieldExpr which is composed of a FieldBuilder, in
10710 the code path we did extract the constant, but we should have
10711 obtained the underlying value to be able to cast it (otherwise we
10712 end up in an infinite loop, this is what Ravi was running into).
10714 (ArrayCreation.UpdateIndices): Arrays might be empty.
10716 (MemberAccess.ResolveMemberAccess): Add support for section
10717 14.5.4.1 that deals with the special case of E.I when E is a type
10718 and something else, that I can be a reference to a static member.
10720 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10721 handle a particular array type to create byte blobs, it is just
10722 something we dont generate byteblobs for.
10724 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10727 * location.cs (Push): remove the key from the hashtable that we
10728 are about to add. This happens for empty files.
10730 * driver.cs: Dispose files after we have parsed them.
10732 (tokenize): new function that only runs the tokenizer on its
10733 input, for speed testing.
10735 2001-12-26 Ravi Pratap <ravi@ximian.com>
10737 * class.cs (Event.Define): Define the private field only if there
10738 are no accessors defined.
10740 * expression.cs (ResolveMemberAccess): If there is no associated
10741 field with the event, that means we have an event defined with its
10742 own accessors and we should flag error cs0070 since transforming
10743 ourselves into a field is not valid in that case.
10745 * ecore.cs (SimpleName.DoResolve): Same as above.
10747 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10748 and charset to sane values.
10750 2001-12-25 Ravi Pratap <ravi@ximian.com>
10752 * assign.cs (DoResolve): Perform check on events only if they
10753 are being accessed outside the declaring type.
10755 * cs-parser.jay (event_declarations): Update rules to correctly
10756 set the type of the implicit parameter etc.
10758 (add_accessor, remove_accessor): Set current local parameters.
10760 * expression.cs (Binary): For delegate addition and subtraction,
10761 cast the return value from the method into the appropriate delegate
10764 2001-12-24 Ravi Pratap <ravi@ximian.com>
10766 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
10767 of these as the workaround is unnecessary.
10769 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
10770 delegate data - none of that is needed at all.
10772 Re-write bits to extract the instance expression and the delegate method
10775 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
10778 * attribute.cs (ApplyAttributes): New method to take care of common tasks
10779 of attaching attributes instead of duplicating code everywhere.
10781 * everywhere : Update code to do attribute emission using the above method.
10783 2001-12-23 Miguel de Icaza <miguel@ximian.com>
10785 * expression.cs (IsParamsMethodApplicable): if there are not
10786 parameters, return immediately.
10788 * ecore.cs: The 0 literal can be implicity converted to an enum
10791 (SimpleName.DoResolve): First lookup the type, then lookup the
10794 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
10795 want to get its address. If the InstanceExpression is not
10796 addressable, store the result in a temporary variable, then get
10799 * codegen.cs: Only display 219 errors on warning level or above.
10801 * expression.cs (ArrayAccess): Make it implement the
10802 IMemoryLocation interface.
10804 (Binary.DoResolve): handle the operator == (object a, object b)
10805 and operator != (object a, object b) without incurring into a
10806 BoxedCast (because 5 != o should never be performed).
10808 Handle binary enumerator operators.
10810 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
10811 value type, otherwise use Ldelem_ref.
10813 Use precomputed names;
10815 (AddressOf): Implement address of
10817 * cs-parser.jay (labeled_statement): Fix recursive block
10818 addition by reworking the production.
10820 * expression.cs (New.DoEmit): New has a special case:
10822 If we are dealing with a ValueType, we have a few
10823 situations to deal with:
10825 * The target of New is a ValueType variable, that is
10826 easy, we just pass this as the variable reference
10828 * The target of New is being passed as an argument,
10829 to a boxing operation or a function that takes a
10832 In this case, we need to create a temporary variable
10833 that is the argument of New.
10836 2001-12-23 Ravi Pratap <ravi@ximian.com>
10838 * rootcontext.cs (LookupType): Check that current_type is not null before
10839 going about looking at nested types.
10841 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
10842 not implement the IAssignMethod interface any more.
10844 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
10845 where we tranform them into FieldExprs if they are being resolved from within
10846 the declaring type.
10848 * ecore.cs (SimpleName.DoResolve): Do the same here.
10850 * assign.cs (DoResolve, Emit): Clean up code considerably.
10852 * ../errors/bug10.cs : Add.
10854 * ../errors/cs0070.cs : Add.
10856 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
10858 * assign.cs : Get rid of EventIsLocal everywhere.
10860 2001-12-23 Miguel de Icaza <miguel@ximian.com>
10862 * ecore.cs (ConvertIntLiteral): finished the implementation.
10864 * statement.cs (SwitchLabel): Convert the value we are using as a
10865 key before looking up the table.
10867 2001-12-22 Miguel de Icaza <miguel@ximian.com>
10869 * codegen.cs (EmitTopBlock): Require a Location argument now.
10871 * cs-parser.jay (constructor_declarator): We need to setup
10872 current_local_parameters before we parse the
10873 opt_constructor_initializer, to allow the variables to be bound
10874 to the constructor arguments.
10876 * rootcontext.cs (LookupType): First lookup nested classes in our
10877 class and our parents before we go looking outside our class.
10879 * expression.cs (ConstantFold): Extract/debox the values at the
10882 * rootcontext.cs (EmitCode): Resolve the constants first before we
10883 resolve the types. This is not really needed, but it helps debugging.
10885 * statement.cs: report location.
10887 * cs-parser.jay: pass location to throw statement.
10889 * driver.cs: Small bug fix.
10891 * report.cs: Updated format to be 4-zero filled digits.
10893 2001-12-22 Ravi Pratap <ravi@ximian.com>
10895 * expression.cs (CheckIndices): Fix minor bug where the wrong
10896 variable was being referred to ;-)
10898 (DoEmit): Do not call EmitStaticInitializers when the
10899 underlying type is System.Object.
10901 2001-12-21 Ravi Pratap <ravi@ximian.com>
10903 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
10904 and do the usual workaround for SRE.
10906 * class.cs (MyEventBuilder.EventType): New member to get at the type
10907 of the event, quickly.
10909 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
10911 * assign.cs (Assign.DoResolve): Handle the case when the target
10912 is an EventExpr and perform the necessary checks.
10914 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
10917 (SimpleName.MemberStaticCheck): Include check for EventExpr.
10919 (EventExpr): Set the type in the constructor itself since we
10920 are meant to be born fully resolved.
10922 (EventExpr.Define): Revert code I wrote earlier.
10924 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
10925 instance expression is null. The instance expression is a This in that case
10926 or a null, depending on whether it is a static method or not.
10928 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
10929 refers to more than one method.
10931 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
10932 and accordingly flag errors.
10934 2001-12-21 Miguel de Icaza <miguel@ximian.com>
10936 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
10938 2001-12-22 Miguel de Icaza <miguel@ximian.com>
10940 * location.cs (ToString): Provide useful rutine.
10942 2001-12-21 Miguel de Icaza <miguel@ximian.com>
10944 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
10945 objects, return the actual integral boxed.
10947 * statement.cs (SwitchLabel): define an ILLabel for each
10950 (Switch.CheckSwitch): If the value is a Literal, extract
10951 the underlying literal.
10953 Also in the unused hashtable we had, add the SwitchLabel so we can
10954 quickly look this value up.
10956 * constant.cs: Implement a bunch of new constants. Rewrite
10957 Literal based on this. Made changes everywhere to adapt to this.
10959 * expression.cs (Expression.MakeByteBlob): Optimize routine by
10960 dereferencing array only once, and also copes with enumrations.
10962 bytes are two bytes wide, not one.
10964 (Cast): Perform constant conversions.
10966 * ecore.cs (TryImplicitIntConversion): Return literals instead of
10967 wrappers to the literals here.
10969 * expression.cs (DoNumericPromotions): long literals can converted
10970 to ulong implicity (this is taken care of elsewhere, but I was
10971 missing this spot).
10973 * ecore.cs (Expression.Literalize): Make the return type Literal,
10974 to improve type checking.
10976 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
10978 2001-12-20 Miguel de Icaza <miguel@ximian.com>
10980 * literal.cs: Revert code from ravi that checked the bounds. The
10981 bounds are sane by the definition of the type itself.
10983 * typemanager.cs: Fix implementation of ImplementsInterface. We
10984 need to actually look up in our parent hierarchy for interfaces
10987 * const.cs: Use the underlying type for enumerations
10989 * delegate.cs: Compute the basename for the delegate creation,
10990 that should fix the delegate test case, and restore the correct
10991 Type Lookup semantics in rootcontext
10993 * rootcontext.cs: Revert Ravi's last patch. The correct way of
10994 referencing a nested type with the Reflection API is using the "+"
10997 * cs-parser.jay: Do not require EOF token at the end.
10999 2001-12-20 Ravi Pratap <ravi@ximian.com>
11001 * rootcontext.cs (LookupType): Concatenate type names with
11002 a '.' instead of a '+' The test suite passes again.
11004 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
11005 field of the enumeration.
11007 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
11008 the case when the member is an EventExpr.
11010 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
11011 static has an associated instance expression.
11013 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
11015 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
11017 * class.cs (Event.Define): Register event and perform appropriate checks
11020 We define the Add and Remove methods even if the use provides none because
11021 in that case, we provide default implementations ourselves.
11023 Define a private field of the type of the event. This is done by the CSC compiler
11024 and we should be doing it too ;-)
11026 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
11027 More methods we use in code we generate.
11029 (multicast_delegate_type, delegate_type): Two separate types since the distinction
11032 (InitCoreTypes): Update accordingly for the above.
11034 * class.cs (Event.Emit): Generate code for default accessors that we provide
11036 (EmitDefaultMethod): Do the job in the above.
11038 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
11041 2001-12-20 Miguel de Icaza <miguel@ximian.com>
11043 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
11044 builders even if we were missing one.
11046 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
11047 pass the Basename as our class name instead of the Name. The
11048 basename will be correctly composed for us.
11050 * parameter.cs (Paramters): Now takes a Location argument.
11052 * decl.cs (DeclSpace.LookupType): Removed convenience function and
11053 make all the code call directly LookupType in RootContext and take
11054 this chance to pass the Location information everywhere.
11056 * Everywhere: pass Location information.
11058 2001-12-19 Miguel de Icaza <miguel@ximian.com>
11060 * class.cs (Constructor.Define): Updated way of detecting the
11061 length of the parameters.
11063 (TypeContainer.DefineType): Use basename as the type name for
11066 (TypeContainer.Define): Do not recursively define types here, as
11067 definition is taken care in order by the RootContext.
11069 * tree.cs: Keep track of namespaces in a per-file basis.
11071 * parameter.cs (Parameter.ComputeSignature): Update to use
11074 (Parameters.GetSignature): ditto.
11076 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
11077 instead of a TypeContainer.
11079 (Interface.SemanticAnalysis): Use `this' instead of our parent to
11080 resolve names. Because we need to be resolve in our context, not
11083 * driver.cs: Implement response files.
11085 * class.cs (TypeContainer.DefineType): If we are defined, do not
11086 redefine ourselves.
11088 (Event.Emit): Emit the code for add/remove handlers.
11089 (Event.Define): Save the MethodBuilders for add/remove.
11091 * typemanager.cs: Use pair here too.
11093 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
11094 DictionaryEntry requires the first argument to be non-null.
11096 (enum_declaration): Compute full name for registering the
11099 (delegate_declaration): Instead of using
11100 formal_parameter_list, use opt_formal_parameter_list as the list
11103 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
11104 (EventParsing): New property that controls whether `add' and
11105 `remove' are returned as tokens or identifiers (for events);
11107 2001-12-19 Ravi Pratap <ravi@ximian.com>
11109 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
11110 use MyEventBuilder only and let it wrap the real builder for us.
11112 (MyEventBuilder): Revamp constructor etc.
11114 Implement all operations that we perform on EventBuilder in precisely the same
11117 (FindMembers): Update to use the EventBuilder member.
11119 (Event.Emit): Update accordingly.
11121 2001-12-18 Ravi Pratap <ravi@ximian.com>
11123 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
11124 by calling the appropriate methods.
11126 (GetCustomAttributes): Make stubs as they cannot possibly do anything
11129 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
11131 2001-12-17 Ravi Pratap <ravi@ximian.com>
11133 * delegate.cs (Delegate.Populate): Check that the return type
11134 and various parameters types are indeed accessible.
11136 * class.cs (Constructor.Define): Same here.
11138 (Field.Define): Ditto.
11140 (Event.Define): Ditto.
11142 (Operator.Define): Check that the underlying Method defined itself
11143 correctly - so it's MethodBuilder should not be null.
11145 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
11146 expression happens to be null.
11148 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
11149 members but as of now we don't seem to be able to do anything really useful with it.
11151 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
11152 not the EventBuilder.
11154 2001-12-18 Miguel de Icaza <miguel@ximian.com>
11156 * cs-tokenizer.cs: Add support for defines.
11157 Add support for #if, #elif, #else, #endif
11159 (eval_var): evaluates a variable.
11160 (eval): stubbed for evaluating functions.
11162 * cs-parser.jay: Pass the defines information
11164 * driver.cs: Add --define command line option.
11166 * decl.cs: Move MemberCore here.
11168 Make it the base class for DeclSpace. This allows us to catch and
11169 report 108 and 109 for everything now.
11171 * class.cs (TypeContainer.Define): Extract all the members
11172 before populating and emit the warning 108 (new keyword required
11173 to override) instead of having each member implement this.
11175 (MemberCore.Define): New abstract method, we will be using this in
11176 the warning reporting engine in Populate.
11178 (Operator.Define): Adjust to new MemberCore protocol.
11180 * const.cs (Const): This does not derive from Expression, it is a
11181 temporary object we use to create fields, it is a MemberCore.
11183 * class.cs (Method.Define): Allow the entry point to be in a
11186 * driver.cs: Rewrite the argument handler to clean it up a bit.
11188 * rootcontext.cs: Made it just an auxiliary namespace feature by
11189 making everything static.
11191 * driver.cs: Adapt code to use RootContext type name instead of
11194 * delegate.cs: Remove RootContext argument.
11196 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
11199 * class.cs (Event.Define): The lookup can fail.
11201 * cs-tokenizer.cs: Begin implementation of pre-procesor.
11203 * expression.cs: Resolve the this instance before invoking the code.
11205 2001-12-17 Miguel de Icaza <miguel@ximian.com>
11207 * cs-parser.jay: Add a production in element_access that allows
11208 the thing to become a "type" reference. This way we can parse
11209 things like "(string [])" as a type.
11211 Note that this still does not handle the more complex rules of
11215 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
11217 * ecore.cs: (CopyNewMethods): new utility function used to
11218 assemble the list of methods from running FindMembers.
11220 (MemberLookup): Rework FindMembers so that
11222 2001-12-16 Miguel de Icaza <miguel@ximian.com>
11224 * class.cs (TypeContainer): Remove Delegates who fail to be
11227 * delegate.cs (Populate): Verify that we dont get null return
11228 values. TODO: Check for AsAccessible.
11230 * cs-parser.jay: Use basename to emit error 574 (destructor should
11231 have the same name as container class), not the full name.
11233 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
11234 possible representation.
11236 Also implements integer type suffixes U and L.
11238 2001-12-15 Miguel de Icaza <miguel@ximian.com>
11240 * expression.cs (ArrayCreation.DoResolve): We need to do the
11241 argument resolution *always*.
11243 * decl.cs: Make this hold the namespace. Hold the root context as
11245 (LookupType): Move here.
11247 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
11249 * location.cs (Row, Name): Fixed the code, it was always returning
11250 references to the first file.
11252 * interface.cs: Register properties defined through interfaces.
11254 * driver.cs: Add support for globbing on the command line
11256 * class.cs (Field): Make it derive from MemberCore as well.
11259 2001-12-15 Ravi Pratap <ravi@ximian.com>
11261 * class.cs (Event::Define): Check that the type of the event is a delegate
11262 type else flag error #66.
11264 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
11267 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
11268 values of EntryPoint, CharSet etc etc.
11270 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
11272 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
11273 be null and we should ignore this. I am not sure if this is really clean. Apparently,
11274 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
11275 which needs this to do its work.
11277 * ../errors/cs0066.cs : Add.
11279 2001-12-14 Miguel de Icaza <miguel@ximian.com>
11281 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
11284 * class.cs: (MethodSignature.MethodSignature): Removed hack that
11285 clears out the parameters field.
11286 (MemberSignatureCompare): Cleanup
11288 (MemberCore): New base class used to share code between MethodCore
11291 (RegisterRequiredImplementations) BindingFlags.Public requires
11292 either BindingFlags.Instace or Static. Use instance here.
11294 (Property): Refactored code to cope better with the full spec.
11296 * parameter.cs (GetParameterInfo): Return an empty array instead
11299 * class.cs (Property): Abstract or extern properties have no bodies.
11301 * parameter.cs (GetParameterInfo): return a zero-sized array.
11303 * class.cs (TypeContainer.MethodModifiersValid): Move all the
11304 method modifier validation to the typecontainer so we can reuse
11305 this on properties.
11307 (MethodCore.ParameterTypes): return an empty sized array of types.
11309 (Property.Define): Test property modifier validity.
11311 Add tests for sealed/override too.
11313 (Method.Emit): abstract or extern methods have no bodies.
11315 2001-12-14 Ravi Pratap <ravi@ximian.com>
11317 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
11320 (Method::Define, ::Emit): Modify accordingly.
11322 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
11324 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
11326 * makefile: Pass in /unsafe.
11328 2001-12-13 Miguel de Icaza <miguel@ximian.com>
11330 * class.cs (MakeKey): Kill routine.
11332 * class.cs (TypeContainer.Define): Correctly define explicit
11333 method implementations (they require the full interface name plus
11336 * typemanager.cs: Deply the PtrHashtable here and stop using the
11337 lame keys. Things work so much better.
11339 This of course broke everyone who depended on `RegisterMethod' to
11340 do the `test for existance' test. This has to be done elsewhere.
11342 * support.cs (PtrHashtable): A hashtable that avoid comparing with
11343 the object stupid Equals method (because, that like fails all over
11344 the place). We still do not use it.
11346 * class.cs (TypeContainer.SetRequiredInterface,
11347 TypeContainer.RequireMethods): Killed these two routines and moved
11348 all the functionality to RegisterRequiredImplementations.
11350 (TypeContainer.RegisterRequiredImplementations): This routine now
11351 registers all the implementations required in an array for the
11352 interfaces and abstract methods. We use an array of structures
11353 which can be computed ahead of time to reduce memory usage and we
11354 also assume that lookups are cheap as most classes will not
11355 implement too many interfaces.
11357 We also avoid creating too many MethodSignatures.
11359 (TypeContainer.IsInterfaceMethod): Update and optionally does not
11360 clear the "pending" bit if we find that there are problems with
11363 (TypeContainer.VerifyPendingMethods): Update to report errors of
11364 methods that look like implementations but are not.
11366 (TypeContainer.Define): Add support for explicit interface method
11369 2001-12-12 Miguel de Icaza <miguel@ximian.com>
11371 * typemanager.cs: Keep track of the parameters here instead of
11372 being a feature of the TypeContainer.
11374 * class.cs: Drop the registration of parameters here, as
11375 InterfaceMethods are also interface declarations.
11377 * delegate.cs: Register methods with the TypeManager not only with
11378 the TypeContainer. This code was buggy.
11380 * interface.cs: Full registation here.
11382 2001-12-11 Miguel de Icaza <miguel@ximian.com>
11384 * expression.cs: Remove reducer for binary expressions, it can not
11387 * const.cs: Put here the code that used to go into constant.cs
11389 * constant.cs: Put here the code for constants, this is a new base
11390 class for Literals.
11392 * literal.cs: Make Literal derive from Constant.
11394 2001-12-09 Miguel de Icaza <miguel@ximian.com>
11396 * statement.cs (Return.Emit): Report error 157 if the user
11397 attempts to return from a finally block.
11399 (Return.Emit): Instead of emitting a return, jump to the end of
11402 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
11403 LocalBuilder to store the result of the function. ReturnLabel is
11404 the target where we jump.
11407 2001-12-09 Radek Doulik <rodo@ximian.com>
11409 * cs-parser.jay: remember alias in current namespace
11411 * ecore.cs (SimpleName::DoResolve): use aliases for types or
11414 * class.cs (LookupAlias): lookup alias in my_namespace
11416 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
11418 (LookupAlias): lookup alias in this and if needed in parent
11421 2001-12-08 Miguel de Icaza <miguel@ximian.com>
11425 * rootcontext.cs: (ModuleBuilder) Made static, first step into
11426 making things static. I need this to avoid passing the
11427 TypeContainer when calling ParameterType.
11429 * support.cs (InternalParameters.ParameterType): Remove ugly hack
11430 that did string manipulation to compute the type and then call
11431 GetType. Use Parameter.ParameterType instead.
11433 * cs-tokenizer.cs: Consume the suffix for floating values.
11435 * expression.cs (ParameterReference): figure out whether this is a
11436 reference parameter or not. Kill an extra variable by computing
11437 the arg_idx during emission.
11439 * parameter.cs (Parameters.GetParameterInfo): New overloaded
11440 function that returns whether a parameter is an out/ref value or not.
11442 (Parameter.ParameterType): The type of the parameter (base,
11443 without ref/out applied).
11445 (Parameter.Resolve): Perform resolution here.
11446 (Parameter.ExternalType): The full type (with ref/out applied).
11448 * statement.cs (Using.Emit, Using.EmitExpression): Implement
11449 support for expressions on the using statement.
11451 2001-12-07 Miguel de Icaza <miguel@ximian.com>
11453 * statement.cs (Using.EmitLocalVariableDecls): Split the
11454 localvariable handling of the using statement.
11456 (Block.EmitMeta): Keep track of variable count across blocks. We
11457 were reusing slots on separate branches of blocks.
11459 (Try.Emit): Emit the general code block, we were not emitting it.
11461 Check the type of the declaration to be an IDisposable or
11462 something that can be implicity converted to it.
11464 Emit conversions if required.
11466 * ecore.cs (EmptyExpression): New utility class.
11467 (Expression.ImplicitConversionExists): New utility function.
11469 2001-12-06 Miguel de Icaza <miguel@ximian.com>
11471 * statement.cs (Using): Implement.
11473 * expression.cs (LocalVariableReference): Support read only variables.
11475 * statement.cs: Remove the explicit emit for the Leave opcode.
11476 (VariableInfo): Add a readonly field.
11478 2001-12-05 Miguel de Icaza <miguel@ximian.com>
11480 * ecore.cs (ConvCast): new class used to encapsulate the various
11481 explicit integer conversions that works in both checked and
11482 unchecked contexts.
11484 (Expression.ConvertNumericExplicit): Use new ConvCast class to
11485 properly generate the overflow opcodes.
11487 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11489 * statement.cs: The correct type for the EmptyExpression is the
11490 element_type, not the variable type. Ravi pointed this out.
11492 2001-12-04 Ravi Pratap <ravi@ximian.com>
11494 * class.cs (Method::Define): Handle PInvoke methods specially
11495 by using DefinePInvokeMethod instead of the usual one.
11497 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11498 above to do the task of extracting information and defining the method.
11500 2001-12-04 Ravi Pratap <ravi@ximian.com>
11502 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11503 of the condition for string type.
11505 (Emit): Move that here.
11507 (ArrayCreation::CheckIndices): Keep string literals in their expression
11510 (EmitDynamicInitializers): Handle strings appropriately.
11512 2001-12-04 Miguel de Icaza <miguel@ximian.com>
11514 * codegen.cs (EmitContext): Replace multiple variables with a
11515 single pointer to the current Switch statement.
11517 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11520 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11524 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11527 (Foreach.Emit): Foreach on arrays was not setting
11528 up the loop variables (for break/continue).
11530 (GotoCase): Semi-implented.
11532 2001-12-03 Ravi Pratap <ravi@ximian.com>
11534 * attribute.cs (CheckAttribute): Handle system attributes by using
11535 Attribute.GetAttributes to examine information we need.
11537 (GetValidPlaces): Same here.
11539 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11541 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11543 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11545 (Method::Define): Set appropriate flags if we have a DllImport attribute.
11547 (Method::Emit): Handle the case when we are a PInvoke method.
11549 2001-12-03 Miguel de Icaza <miguel@ximian.com>
11551 * expression.cs: Use ResolveWithSimpleName on compound names.
11553 2001-12-02 Ravi Pratap <ravi@ximian.com>
11555 * constant.cs (EmitConstant): Make sure we resolve the associated expression
11556 before trying to reduce it.
11558 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11560 * constant.cs (LookupConstantValue): Implement.
11562 (EmitConstant): Use the above in emitting the constant.
11564 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11565 that are user-defined by doing a LookupConstantValue on them.
11567 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11570 2001-11-29 Miguel de Icaza <miguel@ximian.com>
11572 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11574 (BaseAccess.DoResolve): Implement.
11576 (MemberAccess.DoResolve): Split this routine into a
11577 ResolveMemberAccess routine that can be used independently
11579 2001-11-28 Miguel de Icaza <miguel@ximian.com>
11581 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11582 As that share bits of the implementation. Is returns a boolean,
11583 while As returns the Type that is being probed.
11585 2001-12-01 Ravi Pratap <ravi@ximian.com>
11587 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11588 instead of a Literal - much easier.
11590 (EnumInTransit): Remove - utterly useless :-)
11592 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11594 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11596 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11597 chain when we have no associated expression.
11599 2001-11-30 Ravi Pratap <ravi@ximian.com>
11601 * constant.cs (Define): Use Location while reporting the errror.
11603 Also emit a warning when 'new' is used and there is no inherited
11606 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
11609 (LookupEnumValue): Implement to lookup an enum member's value and define it
11612 (Populate): Re-write accordingly to use the above routine.
11614 2001-11-27 Miguel de Icaza <miguel@ximian.com>
11616 * expression.cs (This): Fix prototype for DoResolveLValue to
11617 override the base class DoResolveLValue.
11619 * cs-parser.cs: Report errors cs574 and cs575 (destructor
11622 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11623 (we need to load the address of the field here). This fixes
11626 (FieldExpr.DoResolveLValue): Call the DoResolve
11627 function to initialize the Instance expression.
11629 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11630 correctly the GetEnumerator operation on a value type.
11632 * cs-parser.jay: Add more simple parsing error catches.
11634 * statement.cs (Switch): Add support for string switches.
11635 Handle null specially.
11637 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
11639 2001-11-28 Ravi Pratap <ravi@ximian.com>
11641 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11643 (declare_local_constant): New helper function.
11645 * statement.cs (AddConstant): Keep a separate record of constants
11647 (IsConstant): Implement to determine if a variable is a constant.
11649 (GetConstantExpression): Implement.
11651 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11653 * statement.cs (IsVariableDefined): Re-write.
11655 2001-11-27 Ravi Pratap <ravi@ximian.com>
11657 * class.cs (TypeContainer::FindMembers): Look for constants
11658 in the case when we are looking for MemberTypes.Field
11660 * expression.cs (MemberAccess::DoResolve): Check that in the
11661 case we are a FieldExpr and a Literal, we are not being accessed
11662 by an instance reference.
11664 * cs-parser.jay (local_constant_declaration): Implement.
11666 (declaration_statement): Implement for constant declarations.
11668 2001-11-26 Miguel de Icaza <miguel@ximian.com>
11670 * statement.cs (Switch): Catch double defaults.
11672 (Switch): More work on the switch() statement
11673 implementation. It works for integral values now, need to finish
11677 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11679 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11680 integer literals into other integer literals. To be used by
11683 2001-11-24 Ravi Pratap <ravi@ximian.com>
11685 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11688 (EmitDynamicInitializers): Cope with the above since we extract data
11689 directly from ArrayData now.
11691 (ExpectInitializers): Keep track of whether initializers are mandatory
11694 (Bounds): Make it a hashtable to prevent the same dimension being
11695 recorded for every element in that dimension.
11697 (EmitDynamicInitializers): Fix bug which prevented the Set array method
11700 Also fix bug which was causing the indices to be emitted in the reverse
11703 2001-11-24 Miguel de Icaza <miguel@ximian.com>
11705 * expression.cs (ArrayCreation): Implement the bits that Ravi left
11706 unfinished. They do not work, because the underlying code is
11709 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11711 * cs-parser.jay: Remove bogus fixme.
11713 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11714 on Switch statement.
11716 2001-11-23 Ravi Pratap <ravi@ximian.com>
11718 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11721 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11722 parameter. Apparently, any expression is allowed.
11724 (ValidateInitializers): Update accordingly.
11726 (CheckIndices): Fix some tricky bugs thanks to recursion.
11728 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
11729 I was being completely brain-dead.
11731 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11732 and re-write acordingly.
11734 (DelegateInvocation): Re-write accordingly.
11736 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11738 (MakeByteBlob): Handle types more correctly.
11740 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11741 initialization from expressions but it is incomplete because I am a complete
11744 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11746 * statement.cs (If.Emit): Fix a bug that generated incorrect code
11747 on If. Basically, we have to return `true' (ie, we do return to
11748 our caller) only if both branches of the if return.
11750 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11751 short-circuit operators, handle them as short circuit operators.
11753 (Cast.DoResolve): Resolve type.
11754 (Cast.Cast): Take an expression as the target type.
11756 * cs-parser.jay (cast_expression): Remove old hack that only
11757 allowed a limited set of types to be handled. Now we take a
11758 unary_expression and we resolve to a type during semantic
11761 Use the grammar productions from Rhys to handle casts (this is
11762 not complete like Rhys syntax yet, we fail to handle that corner
11763 case that C# has regarding (-x), but we will get there.
11765 2001-11-22 Ravi Pratap <ravi@ximian.com>
11767 * class.cs (EmitFieldInitializer): Take care of the case when we have a
11768 field which is an array type.
11770 * cs-parser.jay (declare_local_variables): Support array initialization too.
11772 * typemanager.cs (MakeKey): Implement.
11774 (everywhere): Use the above appropriately.
11776 * cs-parser.jay (for_statement): Update for array initialization while
11777 declaring variables.
11779 * ecore.cs : The error message was correct, it's the variable's names that
11780 were misleading ;-) Make the code more readable.
11782 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
11783 the correct type etc.
11785 (ConvertExplicit): Handle Enum types by examining the underlying type.
11787 2001-11-21 Ravi Pratap <ravi@ximian.com>
11789 * parameter.cs (GetCallingConvention): Always return
11790 CallingConventions.Standard for now.
11792 2001-11-22 Miguel de Icaza <miguel@ximian.com>
11794 * expression.cs (Binary.ResolveOperator): Update the values of `l'
11795 and `r' after calling DoNumericPromotions.
11797 * ecore.cs: Fix error message (the types were in the wrong order).
11799 * statement.cs (Foreach.ProbeCollectionType): Need to pass
11800 BindingFlags.Instance as well
11802 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
11803 implicit int literal conversion in an empty cast so that we
11804 propagate the right type upstream.
11806 (UnboxCast): new class used to unbox value types.
11807 (Expression.ConvertExplicit): Add explicit type conversions done
11810 (Expression.ImplicitNumericConversion): Oops, forgot to test for
11811 the target type before applying the implicit LongLiterals to ULong
11814 2001-11-21 Miguel de Icaza <miguel@ximian.com>
11816 * cs-parser.jay (for_statement): Reworked the way For works: now
11817 we declare manually any variables that are introduced in
11818 for_initializer to solve the problem of having out-of-band code
11819 emition (that is what got for broken).
11821 (declaration_statement): Perform the actual variable declaration
11822 that used to be done in local_variable_declaration here.
11824 (local_variable_declaration): Do not declare anything, just pass
11825 the information on a DictionaryEntry
11827 2001-11-20 Ravi Pratap <ravi@ximian.com>
11829 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
11830 re-write of the logic to now make it recursive.
11832 (UpdateIndices): Re-write accordingly.
11834 Store element data in a separate ArrayData list in the above methods.
11836 (MakeByteBlob): Implement to dump the array data into a byte array.
11838 2001-11-19 Ravi Pratap <ravi@ximian.com>
11840 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
11843 * constant.cs (Define): Implement.
11845 (EmitConstant): Re-write fully.
11847 Pass in location info.
11849 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
11852 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
11853 DictionaryEntry since we need location info too.
11855 (constant_declaration): Update accordingly.
11857 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
11858 code into another method : UpdateIndices.
11860 2001-11-18 Ravi Pratap <ravi@ximian.com>
11862 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
11863 some type checking etc.
11865 2001-11-17 Ravi Pratap <ravi@ximian.com>
11867 * expression.cs (ArrayCreation::ValidateInitializers): Implement
11868 bits to provide dimension info if the user skips doing that.
11870 Update second constructor to store the rank correctly.
11872 2001-11-16 Ravi Pratap <ravi@ximian.com>
11874 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
11875 and try to implement.
11877 * ../errors/cs0150.cs : Add.
11879 * ../errors/cs0178.cs : Add.
11881 2001-11-16 Miguel de Icaza <miguel@ximian.com>
11883 * statement.cs: Implement foreach on multi-dimensional arrays.
11885 * parameter.cs (Parameters.GetParameterByName): Also lookup the
11886 name of the params argument.
11888 * expression.cs: Use EmitStoreOpcode to get the right opcode while
11889 initializing the array.
11891 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
11892 we can use this elsewhere.
11894 * statement.cs: Finish implementation of foreach for single
11897 * cs-parser.jay: Use an out-of-band stack to pass information
11898 around, I wonder why I need this.
11900 foreach_block: Make the new foreach_block the current_block.
11902 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
11903 function used to return a static Parameters structure. Used for
11904 empty parameters, as those are created very frequently.
11906 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
11908 2001-11-15 Ravi Pratap <ravi@ximian.com>
11910 * interface.cs : Default modifier is private, not public. The
11911 make verify test passes again.
11913 2001-11-15 Ravi Pratap <ravi@ximian.com>
11915 * support.cs (ReflectionParameters): Fix logic to determine
11916 whether the last parameter is a params one. Test 9 passes again.
11918 * delegate.cs (Populate): Register the builders we define with
11919 RegisterParameterForBuilder. Test 19 passes again.
11921 * cs-parser.jay (property_declaration): Reference $6 instead
11922 of $$ to get at the location.
11924 (indexer_declaration): Similar stuff.
11926 (attribute): Ditto.
11928 * class.cs (Property): Register parameters for the Get and Set methods
11929 if they exist. Test 23 passes again.
11931 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
11932 call to EmitArguments as we are sure there aren't any params arguments.
11933 Test 32 passes again.
11935 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
11936 IndexOutOfRangeException.
11938 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
11939 Test 33 now passes again.
11941 2001-11-15 Miguel de Icaza <miguel@ximian.com>
11943 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
11944 broke a bunch of things. Will have to come up with a better way
11945 of tracking locations.
11947 * statement.cs: Implemented foreach for single dimension arrays.
11949 2001-11-09 Miguel de Icaza <miguel@ximian.com>
11951 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
11952 an error. This removes the lookup from the critical path.
11954 * cs-parser.jay: Removed use of temporary_loc, which is completely
11957 2001-11-14 Miguel de Icaza <miguel@ximian.com>
11959 * support.cs (ReflectionParameters.ParameterModifier): Report
11960 whether the argument is a PARAMS argument or not.
11962 * class.cs: Set the attribute `ParamArrayAttribute' on the
11963 parameter argument.
11965 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
11966 and cons_param_array_attribute (ConstructorInfo for
11967 ParamArrayAttribute).,
11969 * codegen.cs: Emit the return using the `Return' statement, that
11970 way we can report the error correctly for missing return values.
11972 * class.cs (Method.Emit): Clean up.
11974 * expression.cs (Argument.Resolve): Take another argument: the
11975 location where this argument is used. Notice that this is not
11976 part of the "Argument" class as to reduce the size of the
11977 structure (we know the approximate location anyways).
11979 Test if the argument is a variable-reference, if not, then
11980 complain with a 206.
11982 (Argument.Emit): Emit addresses of variables.
11984 (Argument.FullDesc): Simplify.
11986 (Invocation.DoResolve): Update for Argument.Resolve.
11988 (ElementAccess.DoResolve): ditto.
11990 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
11991 method should be virtual, as this method is always virtual.
11993 (NewDelegate.DoResolve): Update for Argument.Resolve.
11995 * class.cs (ConstructorInitializer.DoResolve): ditto.
11997 * attribute.cs (Attribute.Resolve): ditto.
11999 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12001 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
12003 * expression.cs (ParameterReference): Drop IStackStorage and implement
12004 IAssignMethod instead.
12006 (LocalVariableReference): ditto.
12008 * ecore.cs (FieldExpr): Drop IStackStorage and implement
12009 IAssignMethod instead.
12011 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12013 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
12014 enumerations that are used in heavily used structures derive from
12015 byte in a laughable and pathetic attempt to reduce memory usage.
12016 This is the kind of pre-optimzations that you should not do at
12017 home without adult supervision.
12019 * expression.cs (UnaryMutator): New class, used to handle ++ and
12020 -- separatedly from the other unary operators. Cleans up the
12021 code, and kills the ExpressionStatement dependency in Unary.
12023 (Unary): Removed `method' and `Arguments' from this class, making
12024 it smaller, and moving it all to SimpleCall, so I can reuse this
12025 code in other locations and avoid creating a lot of transient data
12026 strucutres when not required.
12028 * cs-parser.jay: Adjust for new changes.
12030 2001-11-11 Miguel de Icaza <miguel@ximian.com>
12032 * enum.cs (Enum.Populate): If there is a failure during
12035 * cs-parser.jay (opt_enum_base): we used to catch type errors
12036 here, but this is really incorrect. The type error should be
12037 catched during semantic analysis.
12039 2001-12-11 Ravi Pratap <ravi@ximian.com>
12041 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
12042 current_local_parameters as expected since I, in my stupidity, had forgotten
12045 * attribute.cs (GetValidPlaces): Fix stupid bug.
12047 * class.cs (Method::Emit): Perform check on applicability of attributes.
12049 (Constructor::Emit): Ditto.
12051 (Field::Emit): Ditto.
12053 (Field.Location): Store location information.
12055 (Property, Event, Indexer, Operator): Ditto.
12057 * cs-parser.jay (field_declaration): Pass in location for each field.
12059 * ../errors/cs0592.cs : Add.
12061 2001-11-12 Ravi Pratap <ravi@ximian.com>
12063 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
12065 (InitCoreTypes): Update accordingly.
12067 (RegisterAttrType, LookupAttr): Implement.
12069 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
12070 info about the same.
12072 (Resolve): Update to populate the above as necessary.
12074 (Error592): Helper.
12076 (GetValidPlaces): Helper to the above.
12078 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
12080 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
12082 2001-11-12 Ravi Pratap <ravi@ximian.com>
12084 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
12086 * ../errors/cs0617.cs : Add.
12088 2001-11-11 Ravi Pratap <ravi@ximian.com>
12090 * enum.cs (Emit): Rename to Populate to be more consistent with what
12091 we expect it to do and when exactly it is called.
12093 * class.cs, rootcontext.cs : Update accordingly.
12095 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
12096 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
12098 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
12100 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
12101 of a fieldinfo using the above, when dealing with a FieldBuilder.
12103 2001-11-10 Ravi Pratap <ravi@ximian.com>
12105 * ../errors/cs0031.cs : Add.
12107 * ../errors/cs1008.cs : Add.
12109 * ../errrors/cs0543.cs : Add.
12111 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
12114 (FindMembers): Implement.
12116 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
12117 enums and delegates too.
12119 (enum_types): Rename to builder_to_enum.
12121 (delegate_types): Rename to builder_to_delegate.
12123 * delegate.cs (FindMembers): Implement.
12125 2001-11-09 Ravi Pratap <ravi@ximian.com>
12127 * typemanager.cs (IsEnumType): Implement.
12129 * enum.cs (Emit): Re-write parts to account for the underlying type
12130 better and perform checking etc.
12132 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
12133 of the underlying type.
12135 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
12138 * enum.cs (error31): Helper to report error #31.
12140 * cs-parser.jay (enum_declaration): Store location of each member too.
12142 * enum.cs (member_to_location): New hashtable.
12144 (AddEnumMember): Update location hashtable.
12146 (Emit): Use the location of each member while reporting errors.
12148 2001-11-09 Miguel de Icaza <miguel@ximian.com>
12150 * cs-parser.jay: A for_initializer if is a
12151 local_variable_declaration really ammount to have an implicit
12152 block with the variable declaration and no initializer for for.
12154 * statement.cs (For.Emit): Cope with null initializers.
12156 This fixes the infinite loop on for initializers.
12158 2001-11-08 Miguel de Icaza <miguel@ximian.com>
12160 * enum.cs: More cleanup.
12162 * ecore.cs: Remove dead code.
12164 * class.cs (Property.Emit): More simplification.
12165 (Event.Emit): ditto.
12167 Reworked to have less levels of indentation.
12169 2001-11-08 Ravi Pratap <ravi@ximian.com>
12171 * class.cs (Property): Emit attributes.
12181 * enum.cs (Emit): Ditto.
12183 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
12186 * class.cs (Field, Event, etc.): Move attribute generation into the
12187 Emit method everywhere.
12189 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
12190 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
12191 as we had no way of defining nested enums !
12193 * rootcontext.cs : Adjust code accordingly.
12195 * typemanager.cs (AddEnumType): To keep track of enum types separately.
12197 2001-11-07 Ravi Pratap <ravi@ximian.com>
12199 * expression.cs (EvalConstantExpression): Move into ecore.cs
12201 * enum.cs (Enum): Rename some members and make them public and readonly
12202 according to our convention.
12204 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
12207 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
12209 (Enum::Emit): Write a simple version for now which doesn't try to compute
12210 expressions. I shall modify this to be more robust in just a while.
12212 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
12214 (TypeContainer::CloseType): Create the Enum types too.
12216 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
12218 * expression.cs (EvalConstantExpression): Get rid of completely.
12220 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
12221 user-defined values and other cases.
12223 (IsValidEnumLiteral): Helper function.
12225 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
12226 out there in the case we had a literal FieldExpr.
12228 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
12230 (Literalize): Revamp a bit to take two arguments.
12232 (EnumLiteral): New class which derives from Literal to wrap enum literals.
12234 2001-11-06 Ravi Pratap <ravi@ximian.com>
12236 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
12238 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
12240 (Resolve): Use the above to ensure we have proper initializers.
12242 2001-11-05 Ravi Pratap <ravi@ximian.com>
12244 * expression.cs (Expression::EvalConstantExpression): New method to
12245 evaluate constant expressions.
12247 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
12249 2001-11-07 Miguel de Icaza <miguel@ximian.com>
12251 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
12254 (Binary.ResolveOperator): Handle operator != (object a, object b)
12255 and operator == (object a, object b);
12257 (Binary.DoNumericPromotions): Indicate whether the numeric
12258 promotion was possible.
12260 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
12263 Made the ArrayAccess implement interface IAssignMethod instead of
12264 IStackStore as the order in which arguments are passed reflects
12267 * assign.cs: Instead of using expr.ExprClass to select the way of
12268 assinging, probe for the IStackStore/IAssignMethod interfaces.
12270 * typemanager.cs: Load InitializeArray definition.
12272 * rootcontext.cs (RootContext.MakeStaticData): Used to define
12273 static data that can be used to initialize arrays.
12275 2001-11-05 Miguel de Icaza <miguel@ximian.com>
12277 * expression.cs: Handle operator== and operator!= for booleans.
12279 (Conditioal.Reduce): Implement reducer for the ?: operator.
12281 (Conditional.Resolve): Implement dead code elimination.
12283 (Binary.Resolve): Catch string literals and return a new
12284 concatenated string.
12286 (Unary.Reduce): Implement reduction of unary expressions.
12288 * ecore.cs: Split out the expression core handling here.
12290 (Expression.Reduce): New method used to perform constant folding
12291 and CSE. This is needed to support constant-expressions.
12293 * statement.cs (Statement.EmitBoolExpression): Pass true and false
12294 targets, and optimize for !x.
12296 2001-11-04 Ravi Pratap <ravi@ximian.com>
12298 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
12299 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
12300 set custom atttributes.
12302 * literal.cs (Literal::GetValue): New abstract method to return the actual
12303 value of the literal, cast as an object.
12305 (*Literal): Implement GetValue method.
12307 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
12308 expressions to the arraylist but objects of type Argument.
12310 * class.cs (TypeContainer::Emit): Emit our attributes too.
12312 (Method::Emit, Constructor::Emit): Ditto.
12314 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
12315 to be ignoring earlier.
12317 2001-11-03 Ravi Pratap <ravi@ximian.com>
12319 * attribute.cs (AttributeSection::Define): Implement to do the business
12320 of constructing a CustomAttributeBuilder.
12322 (Attribute): New trivial class. Increases readability of code.
12324 * cs-parser.jay : Update accordingly.
12326 (positional_argument_list, named_argument_list, named_argument): New rules
12328 (attribute_arguments): Use the above so that we are more correct.
12330 2001-11-02 Ravi Pratap <ravi@ximian.com>
12332 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
12333 to perform all checks for a method with a params parameter.
12335 (Invocation::OverloadResolve): Update to use the above method and therefore
12336 cope correctly with params method invocations.
12338 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
12341 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
12342 constructors in our parent too because we can't afford to miss out on
12345 * attribute.cs (AttributeSection): New name for the class Attribute
12347 Other trivial changes to improve readability.
12349 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
12350 use the new class names.
12352 2001-11-01 Ravi Pratap <ravi@ximian.com>
12354 * class.cs (Method::Define): Complete definition for params types too
12356 (Indexer::Define): Ditto.
12358 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
12359 Cope everywhere with a request for info about the array parameter.
12361 2001-11-01 Ravi Pratap <ravi@ximian.com>
12363 * tree.cs (RecordNamespace): Fix up to check for the correct key.
12365 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
12366 local_variable_type to extract the string corresponding to the type.
12368 (local_variable_type): Fixup the action to use the new helper method.
12370 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
12373 * expression.cs : Clean out code which uses the above.
12375 2001-10-31 Ravi Pratap <ravi@ximian.com>
12377 * typemanager.cs (RegisterMethod): Check if we already have an existing key
12378 and bale out if necessary by returning a false.
12380 (RegisterProperty): Ditto.
12382 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
12383 and print out appropriate error messages.
12385 * interface.cs (everywhere): Ditto.
12387 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
12388 location to constructor.
12390 * class.cs (Property, Event, Indexer): Update accordingly.
12392 * ../errors/cs111.cs : Added.
12394 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
12395 of a method, as laid down by the spec.
12397 (Invocation::OverloadResolve): Use the above method.
12399 2001-10-31 Ravi Pratap <ravi@ximian.com>
12401 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
12402 now take a TypeContainer and a Parameters object.
12404 (ParameterData): Modify return type of ParameterModifier method to be
12405 Parameter.Modifier and not a string.
12407 (ReflectionParameters, InternalParameters): Update accordingly.
12409 * expression.cs (Argument::GetParameterModifier): Same here.
12411 * support.cs (InternalParameters::ParameterType): Find a better way of determining
12412 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
12413 symbol in it at all so maybe this is only for now.
12415 2001-10-30 Ravi Pratap <ravi@ximian.com>
12417 * support.cs (InternalParameters): Constructor now takes an extra argument
12418 which is the actual Parameters class.
12420 (ParameterDesc): Update to provide info on ref/out modifiers.
12422 * class.cs (everywhere): Update call to InternalParameters to pass in
12423 the second argument too.
12425 * support.cs (ParameterData): Add ParameterModifier, which is a method
12426 to return the modifier info [ref/out etc]
12428 (InternalParameters, ReflectionParameters): Implement the above.
12430 * expression.cs (Argument::ParameterModifier): Similar function to return
12431 info about the argument's modifiers.
12433 (Invocation::OverloadResolve): Update to take into account matching modifiers
12436 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
12437 a new SetFormalParameters object which we pass to InternalParameters.
12439 2001-10-30 Ravi Pratap <ravi@ximian.com>
12441 * expression.cs (NewArray): Merge into the ArrayCreation class.
12443 2001-10-29 Ravi Pratap <ravi@ximian.com>
12445 * expression.cs (NewArray): Merge classes NewBuiltinArray and
12446 NewUserdefinedArray into one as there wasn't much of a use in having
12449 * expression.cs (Argument): Change field's name to ArgType from Type.
12451 (Type): New readonly property which returns the proper type, taking into
12452 account ref/out modifiers.
12454 (everywhere): Adjust code accordingly for the above.
12456 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12457 whether we are emitting for a ref or out parameter.
12459 * expression.cs (Argument::Emit): Use the above field to set the state.
12461 (LocalVariableReference::Emit): Update to honour the flag and emit the
12464 * parameter.cs (Attributes): Set the correct flags for ref parameters.
12466 * expression.cs (Argument::FullDesc): New function to provide a full desc.
12468 * support.cs (ParameterData): Add method ParameterDesc to the interface.
12470 (ReflectionParameters, InternalParameters): Implement the above method.
12472 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12475 (Invocation::FullMethodDesc): Ditto.
12477 2001-10-29 Miguel de Icaza <miguel@ximian.com>
12479 * cs-parser.jay: Add extra production for the second form of array
12482 * expression.cs (ArrayCreation): Update to reflect the above
12485 * Small changes to prepare for Array initialization.
12487 2001-10-28 Miguel de Icaza <miguel@ximian.com>
12489 * typemanager.cs (ImplementsInterface): interface might be null;
12490 Deal with this problem;
12492 Also, we do store negative hits on the cache (null values), so use
12493 this instead of calling t.GetInterfaces on the type everytime.
12495 2001-10-28 Ravi Pratap <ravi@ximian.com>
12497 * typemanager.cs (IsBuiltinType): New method to help determine the same.
12499 * expression.cs (New::DoResolve): Get rid of array creation code and instead
12500 split functionality out into different classes.
12502 (New::FormArrayType): Move into NewBuiltinArray.
12504 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12507 (NewBuiltinArray): New class to handle creation of built-in arrays.
12509 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12510 account creation of one-dimensional arrays.
12512 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12514 (NewUserdefinedArray::DoResolve): Implement.
12516 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12518 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12519 we maintain inside the TypeManager. This is necessary to perform lookups on the
12522 (LookupType): Update to perform GetType on the module builders too.
12524 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12526 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12528 2001-10-23 Ravi Pratap <ravi@ximian.com>
12530 * expression.cs (New::DoResolve): Implement guts of array creation.
12532 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12534 2001-10-27 Miguel de Icaza <miguel@ximian.com>
12536 * expression.cs: Fix bug I introduced lsat night that broke
12539 (Expression.Resolve): Report a 246 error (can not resolve name)
12540 if we find a SimpleName in the stream.
12542 (Expression.ResolveLValue): Ditto.
12544 (Expression.ResolveWithSimpleName): This function is a variant of
12545 ResolveName, this one allows SimpleNames to be returned without a
12546 warning. The only consumer of SimpleNames is MemberAccess
12548 2001-10-26 Miguel de Icaza <miguel@ximian.com>
12550 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12551 might arrive here. I have my doubts that this is correct.
12553 * statement.cs (Lock): Implement lock statement.
12555 * cs-parser.jay: Small fixes to support `lock' and `using'
12557 * cs-tokenizer.cs: Remove extra space
12559 * driver.cs: New flag --checked, allows to turn on integer math
12562 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12563 Threading.Monitor.Exit
12565 2001-10-23 Miguel de Icaza <miguel@ximian.com>
12567 * expression.cs (IndexerAccess::DoResolveLValue): Set the
12568 Expression Class to be IndexerAccess.
12570 Notice that Indexer::DoResolve sets the eclass to Value.
12572 2001-10-22 Miguel de Icaza <miguel@ximian.com>
12574 * class.cs (TypeContainer::Emit): Emit code for indexers.
12576 * assign.cs (IAssignMethod): New interface implemented by Indexers
12577 and Properties for handling assignment.
12579 (Assign::Emit): Simplify and reuse code.
12581 * expression.cs (IndexerAccess, PropertyExpr): Implement
12582 IAssignMethod, clean up old code.
12584 2001-10-22 Ravi Pratap <ravi@ximian.com>
12586 * typemanager.cs (ImplementsInterface): New method to determine if a type
12587 implements a given interface. Provides a nice cache too.
12589 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12592 (ConvertReferenceExplicit): Ditto.
12594 * delegate.cs (Delegate::Populate): Update to define the parameters on the
12595 various methods, with correct names etc.
12597 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
12598 Operator.UnaryNegation.
12600 * cs-parser.jay (operator_declarator): Be a little clever in the case where
12601 we have a unary plus or minus operator.
12603 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
12606 * everywhere : update accordingly.
12608 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12611 * class.cs (Method::Define): For the case where we are implementing a method
12612 inherited from an interface, we need to set the MethodAttributes.Final flag too.
12613 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12615 2001-10-21 Ravi Pratap <ravi@ximian.com>
12617 * interface.cs (FindMembers): Implement to work around S.R.E
12620 * typemanager.cs (IsInterfaceType): Implement.
12622 (FindMembers): Update to handle interface types too.
12624 * expression.cs (ImplicitReferenceConversion): Re-write bits which
12625 use IsAssignableFrom as that is not correct - it doesn't work.
12627 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12628 and accordingly override EmitStatement.
12630 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12631 using the correct logic :-)
12633 2001-10-19 Ravi Pratap <ravi@ximian.com>
12635 * ../errors/cs-11.cs : Add to demonstrate error -11
12637 2001-10-17 Miguel de Icaza <miguel@ximian.com>
12639 * assign.cs (Assign::Resolve): Resolve right hand side first, and
12640 then pass this as a hint to ResolveLValue.
12642 * expression.cs (FieldExpr): Add Location information
12644 (FieldExpr::LValueResolve): Report assignment to readonly
12647 (Expression::ExprClassFromMemberInfo): Pass location information.
12649 (Expression::ResolveLValue): Add new method that resolves an
12652 (Expression::DoResolveLValue): Default invocation calls
12655 (Indexers): New class used to keep track of indexers in a given
12658 (IStackStore): Renamed from LValue, as it did not really describe
12659 what this did. Also ResolveLValue is gone from this interface and
12660 now is part of Expression.
12662 (ElementAccess): Depending on the element access type
12664 * typemanager.cs: Add `indexer_name_type' as a Core type
12665 (System.Runtime.CompilerServices.IndexerNameAttribute)
12667 * statement.cs (Goto): Take a location.
12669 2001-10-18 Ravi Pratap <ravi@ximian.com>
12671 * delegate.cs (Delegate::VerifyDelegate): New method to verify
12672 if two delegates are compatible.
12674 (NewDelegate::DoResolve): Update to take care of the case when
12675 we instantiate a delegate from another delegate.
12677 * typemanager.cs (FindMembers): Don't even try to look up members
12678 of Delegate types for now.
12680 2001-10-18 Ravi Pratap <ravi@ximian.com>
12682 * delegate.cs (NewDelegate): New class to take care of delegate
12685 * expression.cs (New): Split the delegate related code out into
12686 the NewDelegate class.
12688 * delegate.cs (DelegateInvocation): New class to handle delegate
12691 * expression.cs (Invocation): Split out delegate related code into
12692 the DelegateInvocation class.
12694 2001-10-17 Ravi Pratap <ravi@ximian.com>
12696 * expression.cs (New::DoResolve): Implement delegate creation fully
12697 and according to the spec.
12699 (New::DoEmit): Update to handle delegates differently.
12701 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12702 because of which we were printing out arguments in reverse order !
12704 * delegate.cs (VerifyMethod): Implement to check if the given method
12705 matches the delegate.
12707 (FullDelegateDesc): Implement.
12709 (VerifyApplicability): Implement.
12711 * expression.cs (Invocation::DoResolve): Update to accordingly handle
12712 delegate invocations too.
12714 (Invocation::Emit): Ditto.
12716 * ../errors/cs1593.cs : Added.
12718 * ../errors/cs1594.cs : Added.
12720 * delegate.cs (InstanceExpression, TargetMethod): New properties.
12722 2001-10-16 Ravi Pratap <ravi@ximian.com>
12724 * typemanager.cs (intptr_type): Core type for System.IntPtr
12726 (InitCoreTypes): Update for the same.
12728 (iasyncresult_type, asynccallback_type): Ditto.
12730 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12733 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12736 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12737 the builders for the 4 members of a delegate type :-)
12739 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12742 * expression.cs (New::DoResolve): Implement guts for delegate creation.
12744 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12746 2001-10-15 Miguel de Icaza <miguel@ximian.com>
12748 * statement.cs (Break::Emit): Implement.
12749 (Continue::Emit): Implement.
12751 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
12752 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
12753 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
12754 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
12757 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12758 properties that track the label for the current loop (begin of the
12759 loop and end of the loop).
12761 2001-10-15 Ravi Pratap <ravi@ximian.com>
12763 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
12764 use of emitting anything at all.
12766 * class.cs, rootcontext.cs : Get rid of calls to the same.
12768 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
12770 (Populate): Define the constructor correctly and set the implementation
12773 * typemanager.cs (delegate_types): New hashtable to hold delegates that
12776 (AddDelegateType): Implement.
12778 (IsDelegateType): Implement helper method.
12780 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
12782 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
12783 and accordingly handle it.
12785 * delegate.cs (Populate): Take TypeContainer argument.
12786 Implement bits to define the Invoke method. However, I still haven't figured out
12787 how to take care of the native int bit :-(
12789 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
12790 Qualify the name of the delegate, not its return type !
12792 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
12795 (StandardConversionExists): Checking for array types turns out to be recursive.
12797 (ConvertReferenceExplicit): Implement array conversion.
12799 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
12801 2001-10-12 Ravi Pratap <ravi@ximian.com>
12803 * cs-parser.jay (delegate_declaration): Store the fully qualified
12804 name as it is a type declaration.
12806 * delegate.cs (ReturnType, Name): Rename members to these. Make them
12809 (DefineDelegate): Renamed from Define. Does the same thing essentially,
12810 as TypeContainer::DefineType.
12812 (Populate): Method in which all the definition of the various methods (Invoke)
12815 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
12818 (CloseDelegate): Finally creates the delegate.
12820 * class.cs (TypeContainer::DefineType): Update to define delegates.
12821 (Populate, Emit and CloseType): Do the same thing here too.
12823 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
12824 delegates in all these operations.
12826 2001-10-14 Miguel de Icaza <miguel@ximian.com>
12828 * expression.cs: LocalTemporary: a new expression used to
12829 reference a temporary that has been created.
12831 * assign.cs: Handle PropertyAccess back here, so that we can
12832 provide the proper semantic access to properties.
12834 * expression.cs (Expression::ConvertReferenceExplicit): Implement
12835 a few more explicit conversions.
12837 * modifiers.cs: `NEW' modifier maps to HideBySig.
12839 * expression.cs (PropertyExpr): Make this into an
12840 ExpressionStatement, and support the EmitStatement code path.
12842 Perform get/set error checking, clean up the interface.
12844 * assign.cs: recognize PropertyExprs as targets, and if so, turn
12845 them into toplevel access objects.
12847 2001-10-12 Miguel de Icaza <miguel@ximian.com>
12849 * expression.cs: PropertyExpr::PropertyExpr: use work around the
12852 * typemanager.cs: Keep track here of our PropertyBuilders again to
12853 work around lameness in SRE.
12855 2001-10-11 Miguel de Icaza <miguel@ximian.com>
12857 * expression.cs (LValue::LValueResolve): New method in the
12858 interface, used to perform a second resolution pass for LValues.
12860 (This::DoResolve): Catch the use of this in static methods.
12862 (This::LValueResolve): Implement.
12864 (This::Store): Remove warning, assigning to `this' in structures
12867 (Invocation::Emit): Deal with invocation of
12868 methods on value types. We need to pass the address to structure
12869 methods rather than the object itself. (The equivalent code to
12870 emit "this" for structures leaves the entire structure on the
12871 stack instead of a pointer to it).
12873 (ParameterReference::DoResolve): Compute the real index for the
12874 argument based on whether the method takes or not a `this' pointer
12875 (ie, the method is static).
12877 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
12878 value types returned from functions when we need to invoke a
12879 method on the sturcture.
12882 2001-10-11 Ravi Pratap <ravi@ximian.com>
12884 * class.cs (TypeContainer::DefineType): Method to actually do the business of
12885 defining the type in the Modulebuilder or Typebuilder. This is to take
12886 care of nested types which need to be defined on the TypeBuilder using
12887 DefineNestedMethod.
12889 (TypeContainer::GetClassBases): Implement. Essentially the code from the
12890 methods in RootContext, only ported to be part of TypeContainer.
12892 (TypeContainer::GetInterfaceOrClass): Ditto.
12894 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
12896 * interface.cs (Interface::DefineInterface): New method. Does exactly
12897 what RootContext.CreateInterface did earlier, only it takes care of nested types
12900 (Interface::GetInterfaces): Move from RootContext here and port.
12902 (Interface::GetInterfaceByName): Same here.
12904 * rootcontext.cs (ResolveTree): Re-write.
12906 (PopulateTypes): Re-write.
12908 * class.cs (TypeContainer::Populate): Populate nested types too.
12909 (TypeContainer::Emit): Emit nested members too.
12911 * typemanager.cs (AddUserType): Do not make use of the FullName property,
12912 instead just use the name argument passed in as it is already fully
12915 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
12916 to TypeContainer mapping to see if a type is user-defined.
12918 * class.cs (TypeContainer::CloseType): Implement.
12920 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
12921 the default constructor.
12923 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
12926 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
12928 * interface.cs (CloseType): Create the type here.
12930 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
12933 Remove all the methods which are now in TypeContainer.
12935 2001-10-10 Ravi Pratap <ravi@ximian.com>
12937 * delegate.cs (Define): Re-write bits to define the delegate
12940 2001-10-10 Miguel de Icaza <miguel@ximian.com>
12942 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
12944 * expression.cs (ImplicitReferenceConversion): handle null as well
12945 as a source to convert to any reference type.
12947 * statement.cs (Return): Perform any implicit conversions to
12948 expected return type.
12950 Validate use of return statement.
12952 * codegen.cs (EmitContext): Pass the expected return type here.
12954 * class.cs (Method, Constructor, Property): Pass expected return
12955 type to EmitContext.
12957 2001-10-09 Miguel de Icaza <miguel@ximian.com>
12959 * expression.cs: Make DoResolve take an EmitContext instead of a
12962 Replaced `l' and `location' for `loc', for consistency.
12964 (Error, Warning): Remove unneeded Tc argument.
12966 * assign.cs, literal.cs, constant.cs: Update to new calling
12969 * codegen.cs: EmitContext now contains a flag indicating whether
12970 code is being generated in a static method or not.
12972 * cs-parser.jay: DecomposeQI, new function that replaces the old
12973 QualifiedIdentifier. Now we always decompose the assembled
12974 strings from qualified_identifier productions into a group of
12977 2001-10-08 Miguel de Icaza <miguel@ximian.com>
12979 * rootcontext.cs: Deal with field-less struct types correctly now
12980 by passing the size option to Define Type.
12982 * class.cs: Removed hack that created one static field.
12984 2001-10-07 Miguel de Icaza <miguel@ximian.com>
12986 * statement.cs: Moved most of the code generation here.
12988 2001-10-09 Ravi Pratap <ravi@ximian.com>
12990 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
12993 (ElementAccess): Remove useless bits for now - keep checks as the spec
12996 2001-10-08 Ravi Pratap <ravi@ximian.com>
12998 * expression.cs (ElementAccess::DoResolve): Remove my crap code
12999 and start performing checks according to the spec.
13001 2001-10-07 Ravi Pratap <ravi@ximian.com>
13003 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
13004 rank_specifiers instead.
13006 (rank_specifiers): Change the order in which the rank specifiers are stored
13008 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
13010 * expression.cs (ElementAccess): Implement the LValue interface too.
13012 2001-10-06 Ravi Pratap <ravi@ximian.com>
13014 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
13015 except that user defined conversions are not included.
13017 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
13018 perform the conversion of the return type, if necessary.
13020 (New::DoResolve): Check whether we are creating an array or an object
13021 and accordingly do the needful.
13023 (New::Emit): Same here.
13025 (New::DoResolve): Implement guts of array creation.
13027 (New::FormLookupType): Helper function.
13029 2001-10-07 Miguel de Icaza <miguel@ximian.com>
13031 * codegen.cs: Removed most of the code generation here, and move the
13032 corresponding code generation bits to the statement classes.
13034 Added support for try/catch/finalize and throw.
13036 * cs-parser.jay: Added support for try/catch/finalize.
13038 * class.cs: Catch static methods having the flags override,
13039 virtual or abstract.
13041 * expression.cs (UserCast): This user cast was not really doing
13042 what it was supposed to do. Which is to be born in fully resolved
13043 state. Parts of the resolution were being performed at Emit time!
13047 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13049 * expression.cs: Implicity convert the result from UserCast.
13051 2001-10-05 Ravi Pratap <ravi@ximian.com>
13053 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
13054 prevented it from working correctly.
13056 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
13057 merely ConvertImplicit.
13059 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13061 * typemanager.cs: Make the LookupTypeContainer function static,
13062 and not per-instance.
13064 * class.cs: Make static FindMembers (the one that takes a Type
13067 * codegen.cs: Add EmitForeach here.
13069 * cs-parser.jay: Make foreach a toplevel object instead of the
13070 inline expansion, as we need to perform semantic analysis on it.
13072 2001-10-05 Ravi Pratap <ravi@ximian.com>
13074 * expression.cs (Expression::ImplicitUserConversion): Rename to
13075 UserDefinedConversion.
13077 (Expression::UserDefinedConversion): Take an extra argument specifying
13078 whether we look for explicit user conversions too.
13080 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
13082 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
13084 (ExplicitUserConversion): Make it a call to UserDefinedConversion
13085 with the appropriate arguments.
13087 * cs-parser.jay (cast_expression): Record location too.
13089 * expression.cs (Cast): Record location info.
13091 (Expression::ConvertExplicit): Take location argument.
13093 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
13094 to determine if we are doing explicit conversions.
13096 (UserCast::Emit): Update accordingly.
13098 (Expression::ConvertExplicit): Report an error if everything fails.
13100 * ../errors/cs0030.cs : Add.
13102 2001-10-04 Miguel de Icaza <miguel@ximian.com>
13104 * modifiers.cs: If the ABSTRACT keyword is present, also set the
13105 virtual and newslot bits.
13107 * class.cs (TypeContainer::RegisterRequiredImplementations):
13108 Record methods we need.
13110 (TypeContainer::MakeKey): Helper function to make keys for
13111 MethodBases, since the Methodbase key is useless.
13113 (TypeContainer::Populate): Call RegisterRequiredImplementations
13114 before defining the methods.
13116 Create a mapping for method_builders_to_methods ahead of time
13117 instead of inside a tight loop.
13119 (::RequireMethods): Accept an object as the data to set into the
13120 hashtable so we can report interface vs abstract method mismatch.
13122 2001-10-03 Miguel de Icaza <miguel@ximian.com>
13124 * report.cs: Make all of it static.
13126 * rootcontext.cs: Drop object_type and value_type computations, as
13127 we have those in the TypeManager anyways.
13129 Drop report instance variable too, now it is a global.
13131 * driver.cs: Use try/catch on command line handling.
13133 Add --probe option to debug the error reporting system with a test
13136 * report.cs: Add support for exiting program when a probe
13137 condition is reached.
13139 2001-10-03 Ravi Pratap <ravi@ximian.com>
13141 * expression.cs (Binary::DoNumericPromotions): Fix the case when
13142 we do a forcible conversion regardless of type, to check if
13143 ForceConversion returns a null.
13145 (Binary::error19): Use location to report error.
13147 (Unary::error23): Use location here too.
13149 * ../errors/cs0019.cs : Check in.
13151 * ../errors/cs0023.cs : Check in.
13153 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
13154 case of a non-null MethodInfo object with a length of 0 !
13156 (Binary::ResolveOperator): Flag error if overload resolution fails to find
13157 an applicable member - according to the spec :-)
13158 Also fix logic to find members in base types.
13160 (Unary::ResolveOperator): Same here.
13162 (Unary::report23): Change name to error23 and make first argument a TypeContainer
13163 as I was getting thoroughly confused between this and error19 :-)
13165 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
13166 (::FindMostEncompassedType): Implement.
13167 (::FindMostEncompassingType): Implement.
13168 (::StandardConversionExists): Implement.
13170 (UserImplicitCast): Re-vamp. We now need info about most specific
13171 source and target types so that we can do the necessary conversions.
13173 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
13174 mathematical union with no duplicates.
13176 2001-10-03 Miguel de Icaza <miguel@ximian.com>
13178 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
13179 in order from base classes to child classes, so that we can in
13180 child classes look up in our parent for method names and
13181 attributes (required for handling abstract, virtual, new, override
13182 constructs: we need to instrospect our base class, and if we dont
13183 populate the classes in order, the introspection might be
13184 incorrect. For example, a method could query its parent before
13185 the parent has any methods and would determine that the parent has
13186 no abstract methods (while it could have had them)).
13188 (RootContext::CreateType): Record the order in which we define the
13191 2001-10-02 Miguel de Icaza <miguel@ximian.com>
13193 * class.cs (TypeContainer::Populate): Also method definitions can
13194 fail now, keep track of this.
13196 (TypeContainer::FindMembers): Implement support for
13197 DeclaredOnly/noDeclaredOnly flag.
13199 (Constructor::Emit) Return the ConstructorBuilder.
13201 (Method::Emit) Return the MethodBuilder.
13202 Check for abstract or virtual methods to be public.
13204 * rootcontext.cs (RootContext::CreateType): Register all the
13205 abstract methods required for the class to be complete and the
13206 interface methods that must be implemented.
13208 * cs-parser.jay: Report error 501 (method requires body if it is
13209 not marked abstract or extern).
13211 * expression.cs (TypeOf::Emit): Implement.
13213 * typemanager.cs: runtime_handle_type, new global type.
13215 * class.cs (Property::Emit): Generate code for properties.
13217 2001-10-02 Ravi Pratap <ravi@ximian.com>
13219 * expression.cs (Unary::ResolveOperator): Find operators on base type
13220 too - we now conform exactly to the spec.
13222 (Binary::ResolveOperator): Same here.
13224 * class.cs (Operator::Define): Fix minor quirk in the tests.
13226 * ../errors/cs0215.cs : Added.
13228 * ../errors/cs0556.cs : Added.
13230 * ../errors/cs0555.cs : Added.
13232 2001-10-01 Miguel de Icaza <miguel@ximian.com>
13234 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
13235 single integer which is really efficient
13237 2001-10-01 Ravi Pratap <ravi@ximian.com>
13239 * expression.cs (Expression::ImplicitUserConversion): Use location
13240 even in the case when we are examining True operators.
13242 * class.cs (Operator::Define): Perform extensive checks to conform
13243 with the rules for operator overloading in the spec.
13245 * expression.cs (Expression::ImplicitReferenceConversion): Implement
13246 some of the other conversions mentioned in the spec.
13248 * typemanager.cs (array_type): New static member for the System.Array built-in
13251 (cloneable_interface): For System.ICloneable interface.
13253 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
13254 we start resolving the tree and populating types.
13256 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
13258 2001-10-01 Miguel de Icaza <miguel@ximian.com>
13260 * expression.cs (Expression::ExprClassFromMemberInfo,
13261 Expression::Literalize): Create literal expressions from
13262 FieldInfos which are literals.
13264 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
13265 type casts, because they were wrong. The test suite in tests
13268 (ImplicitNumericConversion): ushort to ulong requires a widening
13271 Int32 constant to long requires widening cast as well.
13273 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
13274 for integers because the type on the stack is not i4.
13276 2001-09-30 Miguel de Icaza <miguel@ximian.com>
13278 * expression.cs (report118): require location argument.
13280 * parameter.cs: Do not dereference potential null value.
13282 * class.cs: Catch methods that lack the `new' keyword when
13283 overriding a name. Report warnings when `new' is used without
13284 anything being there to override.
13286 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
13288 * class.cs: Only add constructor to hashtable if it is non-null
13289 (as now constructors can fail on define).
13291 (TypeManager, Class, Struct): Take location arguments.
13293 Catch field instance initialization in structs as errors.
13295 accepting_filter: a new filter for FindMembers that is static so
13296 that we dont create an instance per invocation.
13298 (Constructor::Define): Catch errors where a struct constructor is
13301 * cs-parser.jay: Pass location information for various new
13304 * delegate.cs (Delegate): take a location argument.
13306 * driver.cs: Do not call EmitCode if there were problesm in the
13307 Definition of the types, as many Builders wont be there.
13309 * decl.cs (Decl::Decl): Require a location argument.
13311 * cs-tokenizer.cs: Handle properly hex constants that can not fit
13312 into integers, and find the most appropiate integer for it.
13314 * literal.cs: Implement ULongLiteral.
13316 * rootcontext.cs: Provide better information about the location of
13317 failure when CreateType fails.
13319 2001-09-29 Miguel de Icaza <miguel@ximian.com>
13321 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
13324 * expression.cs (Binary::CheckShiftArguments): Add missing type
13326 (Binary::ResolveOperator): Add type to the logical and and logical
13327 or, Bitwise And/Or and Exclusive Or code paths, it was missing
13330 (Binary::DoNumericPromotions): In the case where either argument
13331 is ulong (and most signed types combined with ulong cause an
13332 error) perform implicit integer constant conversions as well.
13334 2001-09-28 Miguel de Icaza <miguel@ximian.com>
13336 * expression.cs (UserImplicitCast): Method should always be
13338 (Invocation::BetterConversion): Simplified test for IntLiteral.
13340 (Expression::ImplicitNumericConversion): Split this routine out.
13341 Put the code that performs implicit constant integer conversions
13344 (Expression::Resolve): Become a wrapper around DoResolve so we can
13345 check eclass and type being set after resolve.
13347 (Invocation::Badness): Remove this dead function
13349 (Binary::ResolveOperator): Do not compute the expensive argumnets
13350 unless we have a union for it.
13352 (Probe::Emit): Is needs to do an isinst and then
13353 compare against null.
13355 (::CanConvert): Added Location argument. If the Location argument
13356 is null (Location.Null), then we do not report errors. This is
13357 used by the `probe' mechanism of the Explicit conversion. We do
13358 not want to generate an error for something that the user
13359 explicitly requested to be casted. But the pipeline for an
13360 explicit cast first tests for potential implicit casts.
13362 So for now, if the Location is null, it means `Probe only' to
13363 avoid adding another argument. Might have to revise this
13366 (ClassCast): New class used to type cast objects into arbitrary
13367 classes (used in Explicit Reference Conversions).
13369 Implement `as' as well.
13371 Reverted all the patches from Ravi below: they were broken:
13373 * The use of `level' as a mechanism to stop recursive
13374 invocations is wrong. That was there just to catch the
13375 bug with a strack trace but not as a way of addressing
13378 To fix the problem we have to *understand* what is going
13379 on and the interactions and come up with a plan, not
13380 just get things going.
13382 * The use of the type conversion cache that I proposed
13383 last night had an open topic: How does this work across
13384 protection domains. A user defined conversion might not
13385 be public in the location where we are applying the
13386 conversion, a different conversion might be selected
13387 (ie, private A->B (better) but public B->A (worse),
13388 inside A, A->B applies, but outside it, B->A will
13391 * On top of that (ie, even if the above is solved),
13392 conversions in a cache need to be abstract. Ie, `To
13393 convert from an Int to a Short use an OpcodeCast', not
13394 `To convert from an Int to a Short use the OpcodeCast on
13395 the variable 5' (which is what this patch was doing).
13397 2001-09-28 Ravi Pratap <ravi@ximian.com>
13399 * expression.cs (Invocation::ConversionExists): Re-write to use
13400 the conversion cache
13402 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
13403 cache all conversions done, not just user-defined ones.
13405 (Invocation::BetterConversion): The real culprit. Use ConversionExists
13406 to determine if a conversion exists instead of acutually trying to
13407 perform the conversion. It's faster too.
13409 (Expression::ConvertExplicit): Modify to use ConversionExists to check
13410 and only then attempt the implicit conversion.
13412 2001-09-28 Ravi Pratap <ravi@ximian.com>
13414 * expression.cs (ConvertImplicit): Use a cache for conversions
13415 already found. Check level of recursion and bail out if necessary.
13417 2001-09-28 Miguel de Icaza <miguel@ximian.com>
13419 * typemanager.cs (string_concat_string_string, string_concat_object_object):
13420 Export standard methods that we expect for string operations.
13422 * statement.cs (Block::UsageWarning): Track usage of variables and
13423 report the errors for not used variables.
13425 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
13428 2001-09-27 Miguel de Icaza <miguel@ximian.com>
13430 * codegen.cs: remove unnneded code
13432 * expression.cs: Removed BuiltinTypeAccess class
13434 Fix the order in which implicit conversions are
13437 The previous fixed dropped support for boxed conversions (adding a
13438 test to the test suite now)
13440 (UserImplicitCast::CanConvert): Remove test for source being null,
13441 that code is broken. We should not feed a null to begin with, if
13442 we do, then we should track the bug where the problem originates
13443 and not try to cover it up here.
13445 Return a resolved expression of type UserImplicitCast on success
13446 rather than true/false. Ravi: this is what I was talking about,
13447 the pattern is to use a static method as a "constructor" for
13450 Also, do not create arguments until the very last minute,
13451 otherwise we always create the arguments even for lookups that
13452 will never be performed.
13454 (UserImplicitCast::Resolve): Eliminate, objects of type
13455 UserImplicitCast are born in a fully resolved state.
13457 * typemanager.cs (InitCoreTypes): Init also value_type
13458 (System.ValueType).
13460 * expression.cs (Cast::Resolve): First resolve the child expression.
13462 (LValue): Add new method AddressOf to be used by
13465 Change the argument of Store to take an EmitContext instead of an
13466 ILGenerator, because things like FieldExpr need to be able to call
13467 their children expression to generate the instance code.
13469 (Expression::Error, Expression::Warning): Sugar functions for
13472 (Expression::MemberLookup): Accept a TypeContainer instead of a
13473 Report as the first argument.
13475 (Expression::ResolvePrimary): Killed. I still want to improve
13476 this as currently the code is just not right.
13478 (Expression::ResolveMemberAccess): Simplify, but it is still
13481 (Unary::Resolve): Catch errors in AddressOf operators.
13483 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13484 index to a byte for the short-version, or the compiler will choose
13485 the wrong Emit call, which generates the wrong data.
13487 (ParameterReference::Emit, ::Store): same.
13489 (FieldExpr::AddressOf): Implement.
13491 * typemanager.cs: TypeManager: made public variable instead of
13494 * driver.cs: document --fatal.
13496 * report.cs (ErrorMessage, WarningMessage): new names for the old
13497 Error and Warning classes.
13499 * cs-parser.jay (member_access): Turn built-in access to types
13500 into a normal simplename
13502 2001-09-27 Ravi Pratap <ravi@ximian.com>
13504 * expression.cs (Invocation::BetterConversion): Fix to cope
13505 with q being null, since this was introducing a bug.
13507 * expression.cs (ConvertImplicit): Do built-in conversions first.
13509 2001-09-27 Ravi Pratap <ravi@ximian.com>
13511 * expression.cs (UserImplicitCast::Resolve): Fix bug.
13513 2001-09-27 Ravi Pratap <ravi@ximian.com>
13515 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13516 I had introduced long ago (what's new ?).
13518 * expression.cs (UserImplicitCast::CanConvert): Static method to do
13519 the work of all the checking.
13520 (ConvertImplicit): Call CanConvert and only then create object if necessary.
13521 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13523 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13524 that is the right way.
13526 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
13527 overloading resolution. Use everywhere instead of cutting and pasting code.
13529 (Binary::ResolveOperator): Use MakeUnionSet.
13531 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
13532 we have to convert to bool types. Not complete yet.
13534 2001-09-27 Miguel de Icaza <miguel@ximian.com>
13536 * typemanager.cs (TypeManager::CSharpName): support ushort.
13538 * expression.cs (Expression::TryImplicitIntConversion): Attempts
13539 to provide an expression that performsn an implicit constant int
13540 conversion (section 6.1.6).
13541 (Expression::ConvertImplicitRequired): Reworked to include
13542 implicit constant expression conversions.
13544 (Expression::ConvertNumericExplicit): Finished.
13546 (Invocation::Emit): If InstanceExpression is null, then it means
13547 that we perform a call on this.
13549 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13551 * expression.cs (Unary::Emit): Remove some dead code.
13552 (Probe): Implement Resolve and Emit for `is'.
13553 (Expression::ConvertImplicitRequired): Attempt to do constant
13554 expression conversions here. Maybe should be moved to
13555 ConvertImplicit, but I am not sure.
13556 (Expression::ImplicitLongConstantConversionPossible,
13557 Expression::ImplicitIntConstantConversionPossible): New functions
13558 that tell whether is it possible to apply an implicit constant
13559 expression conversion.
13561 (ConvertNumericExplicit): Started work on explicit numeric
13564 * cs-parser.jay: Update operator constants.
13566 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13567 (Parameters::GetSignature): Hook up VerifyArgs here.
13568 (Parameters::VerifyArgs): Verifies that no two arguments have the
13571 * class.cs (Operator): Update the operator names to reflect the
13572 ones that the spec expects (as we are just stringizing the
13575 * expression.cs (Unary::ResolveOperator): Fix bug: Use
13576 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13577 previous usage did only work for our methods.
13578 (Expression::ConvertImplicit): Handle decimal implicit numeric
13579 conversions as well.
13580 (Expression::InternalTypeConstructor): Used to invoke constructors
13581 on internal types for default promotions.
13583 (Unary::Emit): Implement special handling for the pre/post
13584 increment/decrement for overloaded operators, as they need to have
13585 the same semantics as the other operators.
13587 (Binary::ResolveOperator): ditto.
13588 (Invocation::ConversionExists): ditto.
13589 (UserImplicitCast::Resolve): ditto.
13591 2001-09-26 Ravi Pratap <ravi@ximian.com>
13593 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13594 operator, return after emitting body. Regression tests pass again !
13596 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13597 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13598 (Invocation::OverloadResolve): Ditto.
13599 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13601 * everywhere : update calls to the above methods accordingly.
13603 2001-09-26 Miguel de Icaza <miguel@ximian.com>
13605 * assign.cs (Assign): Make it inherit from ExpressionStatement.
13607 * expression.cs (ExpressionStatement): New base class used for
13608 expressions that can appear in statements, so that we can provide
13609 an alternate path to generate expression that do not leave a value
13612 (Expression::Emit, and all the derivatives): We no longer return
13613 whether a value is left on the stack or not. Every expression
13614 after being emitted leaves a single value on the stack.
13616 * codegen.cs (EmitContext::EmitStatementExpression): Use the
13617 facilties of ExpressionStatement if possible.
13619 * cs-parser.jay: Update statement_expression.
13621 2001-09-25 Miguel de Icaza <miguel@ximian.com>
13623 * driver.cs: Change the wording of message
13625 2001-09-25 Ravi Pratap <ravi@ximian.com>
13627 * expression.cs (Binary::ResolveOperator): Had forgottten to set
13628 the type of the expression to the return type of the method if
13629 we have an overloaded operator match ! The regression tests pass again !
13630 (Unary::ResolveOperator): Ditto.
13632 * expression.cs (Invocation::ConversionExists): Correct the member lookup
13633 to find "op_Implicit", not "implicit" ;-)
13634 (UserImplicitCast): New class to take care of user-defined implicit conversions.
13635 (ConvertImplicit, ForceConversion): Take TypeContainer argument
13637 * everywhere : Correct calls to the above accordingly.
13639 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13640 (ConvertImplicit): Do user-defined conversion if it exists.
13642 2001-09-24 Miguel de Icaza <miguel@ximian.com>
13644 * assign.cs: track location.
13645 (Resolve): Use implicit conversions on assignment.
13647 * literal.cs: Oops. Not good, Emit of short access values should
13648 pass (Bytes) or the wrong argument will be selected.
13650 * expression.cs (Unary::Emit): Emit code for -expr.
13652 (Unary::ResolveOperator): Handle `Substract' for non-constants
13653 (substract from zero from the non-constants).
13654 Deal with Doubles as well.
13656 (Expression::ConvertImplicitRequired): New routine that reports an
13657 error if no implicit conversion exists.
13659 (Invocation::OverloadResolve): Store the converted implicit
13660 expressions if we make them
13662 2001-09-24 Ravi Pratap <ravi@ximian.com>
13664 * class.cs (ConstructorInitializer): Take a Location argument.
13665 (ConstructorBaseInitializer): Same here.
13666 (ConstructorThisInitializer): Same here.
13668 * cs-parser.jay : Update all calls accordingly.
13670 * expression.cs (Unary, Binary, New): Take location argument.
13671 Update accordingly everywhere.
13673 * cs-parser.jay : Update all calls to the above to take a location
13676 * class.cs : Ditto.
13678 2001-09-24 Ravi Pratap <ravi@ximian.com>
13680 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13681 (Invocation::BetterConversion): Same here
13682 (Invocation::ConversionExists): Ditto.
13684 (Invocation::ConversionExists): Implement.
13686 2001-09-22 Ravi Pratap <ravi@ximian.com>
13688 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13689 Also take an additional TypeContainer argument.
13691 * All over : Pass in TypeContainer as argument to OverloadResolve.
13693 * typemanager.cs (CSharpName): Update to check for the string type and return
13696 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13699 2001-09-21 Ravi Pratap <ravi@ximian.com>
13701 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13702 (Invocation::BetterFunction): Implement.
13703 (Invocation::BetterConversion): Implement.
13704 (Invocation::ConversionExists): Skeleton, no implementation yet.
13706 Okay, things work fine !
13708 2001-09-21 Miguel de Icaza <miguel@ximian.com>
13710 * typemanager.cs: declare and load enum_type, delegate_type and
13713 * expression.cs (Expression::Emit): Now emit returns a value that
13714 tells whether a value is left on the stack or not. This strategy
13715 might be reveted tomorrow with a mechanism that would address
13716 multiple assignments.
13717 (Expression::report118): Utility routine to report mismatches on
13720 (Unary::Report23): Report impossible type/operator combination
13723 (Unary::IsIncrementableNumber): Whether the type can be
13724 incremented or decremented with add.
13725 (Unary::ResolveOperator): Also allow enumerations to be bitwise
13727 (Unary::ResolveOperator): Implement ++, !, ~,
13729 (Invocation::Emit): Deal with new Emit convetion.
13731 * All Expression derivatives: Updated their Emit method to return
13732 whether they leave values on the stack or not.
13734 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13735 stack for expressions that are statements.
13737 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13739 * expression.cs (LValue): New interface. Must be implemented by
13741 (LocalVariableReference, ParameterReference, FieldExpr): Implement
13744 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13745 interface for generating code, simplifies the code.
13747 2001-09-20 Ravi Pratap <ravi@ximian.com>
13749 * expression.cs (everywhere): Comment out return statements in ::Resolve
13750 methods to avoid the warnings.
13752 2001-09-20 Miguel de Icaza <miguel@ximian.com>
13754 * driver.cs (parse): Report error 2001 if we can not open the
13757 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13760 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
13763 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
13764 otherwise nested blocks end up with the same index.
13766 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
13768 * expression.cs: Instead of having FIXMEs in the Resolve
13769 functions, throw exceptions so it is obvious that we are facing a
13772 * cs-parser.jay (invocation_expression): Pass Location information.
13774 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
13775 Use a basename for those routines because .NET does not like paths
13778 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
13781 2001-09-19 Miguel de Icaza <miguel@ximian.com>
13783 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
13784 are loading the correct data types (throws an exception if not).
13785 (TypeManager::InitCoreTypes): Use CoreLookupType
13787 * expression.cs (Unary::ResolveOperator): return the child
13788 expression for expressions which are just +expr.
13789 (Unary::ResolveOperator): Return negative literals for -LITERAL
13790 expressions (otherwise they are Unary {Literal}).
13791 (Invocation::Badness): Take into account `Implicit constant
13792 expression conversions'.
13794 * literal.cs (LongLiteral): Implement long literal class.
13795 (IntLiteral): export the `Value' of the intliteral.
13797 2001-09-19 Ravi Pratap <ravi@ximian.com>
13799 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
13801 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
13802 instead of 'Operator'
13804 * expression.cs (Binary::ResolveOperator): Update accordingly.
13805 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
13808 * cs-parser.jay (unary_expression): Update to use the new names.
13810 * gen-treedump.cs (GetUnary): Same here.
13812 * expression.cs (Unary::Resolve): Implement.
13813 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
13814 operators are found instead of making noise ;-)
13815 (Unary::ResolveOperator): New method to do precisely the same thing which
13816 Binary::ResolveOperator does for Binary expressions.
13817 (Unary.method, .Arguments): Add.
13818 (Unary::OperName): Implement.
13819 (Unary::ForceConversion): Copy and Paste !
13821 * class.cs (Operator::Define): Fix a small bug for the case when we have
13824 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
13825 for the inbuilt operators. Only overloading works for now ;-)
13827 2001-09-18 Miguel de Icaza <miguel@ximian.com>
13829 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
13830 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
13832 * expression.cs (This::Emit): Implement.
13833 (This::Resolve): Implement.
13834 (TypeOf:Resolve): Implement.
13835 (Expression::ResolveSimpleName): Add an implicit this to instance
13837 (MemberAccess::Resolve): Deal with Parameters and Fields.
13838 Bind instance variable to Field expressions.
13839 (FieldExpr::Instance): New field used to track the expression that
13840 represents the object instance.
13841 (FieldExpr::Resolve): Track potential errors from MemberLookup not
13843 (FieldExpr::Emit): Implement.
13845 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
13846 the last instruction contains a return opcode to avoid generating
13847 the last `ret' instruction (this generates correct code, and it is
13848 nice to pass the peverify output).
13850 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
13851 initializer for static and instance variables.
13852 (Constructor::Emit): Allow initializer to be null in the case of
13853 static constructors. Only emit initializer for instance
13856 (TypeContainer::FindMembers): Return a null array if there are no
13859 Also fix the code for the MemberTypes.Method branch, as it was not
13860 scanning that for operators (or tried to access null variables before).
13862 * assign.cs (Assign::Emit): Handle instance and static fields.
13866 * driver.cs: Stop compilation if there are parse errors.
13868 * cs-parser.jay (constructor_declaration): Provide default base
13869 initializer for non-static constructors.
13870 (constructor_declarator): Do not provide a default base
13871 initializers if none was specified.
13872 Catch the fact that constructors should not have parameters.
13874 * class.cs: Do not emit parent class initializers for static
13875 constructors, that should be flagged as an error.
13877 2001-09-18 Ravi Pratap <ravi@ximian.com>
13879 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
13880 Move back code into TypeContainer::Populate.
13882 2001-09-18 Ravi Pratap <ravi@ximian.com>
13884 * class.cs (TypeContainer::AddConstructor): Fix the check to
13885 compare against Name, not Basename.
13886 (Operator::OpType): Change Plus and Minus to Add and Subtract.
13888 * cs-parser.jay : Update accordingly.
13890 * class.cs (TypeContainer::FindMembers): For the case where we are searching
13891 for methods, don't forget to look into the operators too.
13892 (RegisterMethodBuilder): Helper method to take care of this for
13893 methods, constructors and operators.
13894 (Operator::Define): Completely revamp.
13895 (Operator.OperatorMethod, MethodName): New fields.
13896 (TypeContainer::Populate): Move the registering of builders into
13897 RegisterMethodBuilder.
13898 (Operator::Emit): Re-write.
13900 * expression.cs (Binary::Emit): Comment out code path to emit method
13901 invocation stuff for the case when we have a user defined operator. I am
13902 just not able to get it right !
13904 2001-09-17 Miguel de Icaza <miguel@ximian.com>
13906 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
13909 (Expression::MemberLookup): Provide a version that allows to
13910 specify the MemberTypes and BindingFlags.
13912 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
13913 so it was not fetching variable information from outer blocks.
13915 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
13916 Beforefieldinit as it was buggy.
13918 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
13919 that Ravi put here.
13921 * class.cs (Constructor::Emit): Only emit if block is not null.
13922 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
13923 deal with this by semantically definining it as if the user had
13926 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
13927 constructors as we now "emit" them at a higher level.
13929 (TypeContainer::DefineDefaultConstructor): Used to define the
13930 default constructors if none was provided.
13932 (ConstructorInitializer): Add methods Resolve and Emit.
13934 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
13936 2001-09-17 Ravi Pratap <ravi@ximian.com>
13938 * class.cs (TypeContainer::EmitDefaultConstructor): Register
13939 the default constructor builder with our hashtable for methodbuilders
13942 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
13943 and argument_count is 0 in which case we have a match.
13944 (Binary::ResolveOperator): More null checking and miscellaneous coding
13947 2001-09-17 Ravi Pratap <ravi@ximian.com>
13949 * rootcontext.cs (IsNameSpace): Compare against null.
13951 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
13953 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
13954 and Unary::Operator.
13956 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
13959 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
13960 we have overloaded operators.
13961 (Binary::ResolveOperator): Implement the part which does the operator overload
13964 * class.cs (Operator::Emit): Implement.
13965 (TypeContainer::Emit): Emit the operators we have too.
13967 * expression.cs (Binary::Emit): Update to emit the appropriate code for
13968 the case when we have a user-defined operator.
13970 2001-09-17 Miguel de Icaza <miguel@ximian.com>
13972 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
13974 2001-09-16 Ravi Pratap <ravi@ximian.com>
13976 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
13977 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
13978 (Constructor::Emit): Implement.
13979 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
13980 if we have no work to do.
13981 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
13984 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
13985 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
13987 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
13990 2001-09-15 Ravi Pratap <ravi@ximian.com>
13992 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
13994 (Tree::RecordNamespace): Method to do what the name says ;-)
13995 (Tree::Namespaces): Property to get at the namespaces hashtable.
13997 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
14000 * rootcontext.cs (IsNamespace): Fixed it :-)
14002 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14004 * class.cs (TypeContainer::FindMembers): Add support for
14006 (MethodCore): New class that encapsulates both the shared aspects
14007 of a Constructor and a Method.
14008 (Method, Constructor): Factored pieces into MethodCore.
14010 * driver.cs: Added --fatal which makes errors throw exceptions.
14011 Load System assembly as well as part of the standard library.
14013 * report.cs: Allow throwing exceptions on errors for debugging.
14015 * modifiers.cs: Do not use `parent', instead use the real type
14016 container to evaluate permission settings.
14018 * class.cs: Put Ravi's patch back in. He is right, and we will
14019 have to cope with the
14021 2001-09-14 Ravi Pratap <ravi@ximian.com>
14023 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
14024 FamORAssem, not FamANDAssem.
14026 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14028 * driver.cs: Added --parse option that only parses its input files
14031 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
14032 incorrect. IsTopLevel is not used to tell whether an object is
14033 root_types or not (that can be achieved by testing this ==
14034 root_types). But to see if this is a top-level *class* (not
14035 necessarly our "toplevel" container).
14037 2001-09-14 Ravi Pratap <ravi@ximian.com>
14039 * enum.cs (Enum::Define): Modify to call the Lookup method on the
14040 parent instead of a direct call to GetType.
14042 2001-09-14 Ravi Pratap <ravi@ximian.com>
14044 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
14045 Modifiers.TypeAttr. This should just be a call to that method.
14047 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
14048 object so that we can determine if we are top-level or not.
14050 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
14053 * enum.cs (Enum::Define): Ditto.
14055 * modifiers.cs (FieldAttr): Re-write.
14057 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
14058 (TypeContainer::HaveStaticConstructor): New property to provide access
14059 to precisely that info.
14061 * modifiers.cs (MethodAttr): Re-write.
14062 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
14064 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
14065 of top-level types as claimed.
14067 2001-09-13 Miguel de Icaza <miguel@ximian.com>
14069 * expression.cs (MemberLookup): Fruitless attempt to lookup
14070 constructors. Maybe I need to emit default constructors? That
14071 might be it (currently .NET emits this for me automatically).
14072 (Invocation::OverloadResolve): Cope with Arguments == null.
14073 (Invocation::EmitArguments): new function, shared by the new
14074 constructor and us.
14075 (Invocation::Emit): Handle static and instance methods. Emit
14076 proper call instruction for virtual or non-virtual invocations.
14077 (New::Emit): Implement.
14078 (New::Resolve): Implement.
14079 (MemberAccess:Resolve): Implement.
14080 (MethodGroupExpr::InstanceExpression): used conforming to the spec
14081 to track instances.
14082 (FieldExpr::Resolve): Set type.
14084 * support.cs: Handle empty arguments.
14086 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
14087 SimpleLookup): Auxiliary routines to help parse a qualifier
14090 Update qualifier_identifier rule.
14092 * codegen.cs: Removed debugging messages.
14094 * class.cs: Make this a global thing, this acts just as a "key" to
14095 objects that we might have around.
14097 (Populate): Only initialize method_builders_to_methods once.
14099 * expression.cs (PropertyExpr): Initialize type from the
14102 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
14103 Resolve pattern. Attempt to implicitly convert value to boolean.
14106 * expression.cs: Set the type for the int32/int32 argument case.
14107 (Binary::ResolveOperator): Set the return type to boolean for
14108 comparission operators
14110 * typemanager.cs: Remove debugging print code.
14112 (Invocation::Resolve): resolve type.
14114 * class.cs: Allocate a MemberInfo of the correct size, as the code
14115 elsewhere depends on the test to reflect the correct contents.
14117 (Method::) Keep track of parameters, due to System.Reflection holes
14119 (TypeContainer::Populate): Keep track of MethodBuilders to Method
14122 (TypeContainer::FindMembers): Use ArrayList and then copy an array
14123 of the exact size and return that.
14125 (Class::LookupMethodByBuilder): New function that maps
14126 MethodBuilders to its methods. Required to locate the information
14127 on methods because System.Reflection bit us again.
14129 * support.cs: New file, contains an interface ParameterData and
14130 two implementations: ReflectionParameters and InternalParameters
14131 used to access Parameter information. We will need to grow this
14134 * expression.cs (Invocation::GetParameterData): implement a cache
14135 and a wrapper around the ParameterData creation for methods.
14136 (Invocation::OverloadResolve): Use new code.
14138 2001-09-13 Ravi Pratap <ravi@ximian.com>
14140 * class.cs (TypeContainer::EmitField): Remove and move into
14141 (Field::Define): here and modify accordingly.
14142 (Field.FieldBuilder): New member.
14143 (TypeContainer::Populate): Update accordingly.
14144 (TypeContainer::FindMembers): Implement.
14146 2001-09-13 Miguel de Icaza <miguel@ximian.com>
14148 * statement.cs: (VariableInfo::VariableType): New field to be
14149 initialized with the full type once it is resolved.
14151 2001-09-12 Miguel de Icaza <miguel@ximian.com>
14153 * parameter.cs (GetParameterInfo): Use a type cache to compute
14154 things only once, and to reuse this information
14156 * expression.cs (LocalVariableReference::Emit): Implement.
14157 (OpcodeCast::Emit): fix.
14159 (ParameterReference::Resolve): Implement.
14160 (ParameterReference::Emit): Implement.
14162 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
14163 that are expressions need to stay as Expressions.
14165 * typemanager.cs (CSharpName): Returns the C# name of a type if
14168 * expression.cs (Expression::ConvertImplicit): New function that
14169 implements implicit type conversions.
14171 (Expression::ImplicitReferenceConversion): Implements implicit
14172 reference conversions.
14174 (EmptyCast): New type for transparent casts.
14176 (OpcodeCast): New type for casts of types that are performed with
14177 a sequence of bytecodes.
14179 (BoxedCast): New type used for casting value types into reference
14180 types. Emits a box opcode.
14182 (Binary::DoNumericPromotions): Implements numeric promotions of
14183 and computation of the Binary::Type.
14185 (Binary::EmitBranchable): Optimization.
14187 (Binary::Emit): Implement code emission for expressions.
14189 * typemanager.cs (TypeManager): Added two new core types: sbyte
14192 2001-09-12 Ravi Pratap <ravi@ximian.com>
14194 * class.cs (TypeContainer::FindMembers): Method which does exactly
14195 what Type.FindMembers does, only we don't have to use reflection. No
14196 implementation yet.
14198 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
14199 typecontainer objects as we need to get at them.
14200 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
14202 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
14203 typecontainer object.
14205 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
14206 of just a Report object.
14208 2001-09-11 Ravi Pratap <ravi@ximian.com>
14210 * class.cs (Event::Define): Go back to using the prefixes "add_" and
14212 (TypeContainer::Populate): Now define the delegates of the type too.
14213 (TypeContainer.Delegates): Property to access the list of delegates defined
14216 * delegates.cs (Delegate::Define): Implement partially.
14218 * modifiers.cs (TypeAttr): Handle more flags.
14220 2001-09-11 Ravi Pratap <ravi@ximian.com>
14222 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
14224 (Operator::Define): Re-write logic to get types by using the LookupType method
14225 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
14226 (Indexer::Define): Ditto.
14227 (Event::Define): Ditto.
14228 (Property::Define): Ditto.
14230 2001-09-10 Ravi Pratap <ravi@ximian.com>
14232 * class.cs (TypeContainer::Populate): Now define operators too.
14233 (TypeContainer.Operators): New property to access the list of operators
14235 (Operator.OperatorMethodBuilder): New member to hold the method builder
14236 for the operator we are defining.
14237 (Operator::Define): Implement.
14239 2001-09-10 Ravi Pratap <ravi@ximian.com>
14241 * class.cs (Event::Define): Make the prefixes of the accessor methods
14242 addOn_ and removeOn_
14244 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
14245 of the location being passed in too. Ideally, this should go later since all
14246 error reporting should be done through the Report object.
14248 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
14249 (Populate): Iterate thru the indexers we have and define them too.
14250 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
14251 for the get and set accessors.
14252 (Indexer::Define): Implement.
14254 2001-09-09 Miguel de Icaza <miguel@ximian.com>
14256 * expression.cs (Binary::Resolve): Beginning of it. I scratched
14257 my previous implementation, did not work.
14259 * typemanager.cs: Add a couple of missing types (the longs).
14261 * literal.cs: Use TypeManager.bool_type instead of getting it.
14263 * expression.cs (EventExpr): New kind of expressions.
14264 (Expressio::ExprClassFromMemberInfo): finish
14266 2001-09-08 Miguel de Icaza <miguel@ximian.com>
14268 * assign.cs: Emit stores to static fields differently.
14270 2001-09-08 Ravi Pratap <ravi@ximian.com>
14272 * Merge in changes and adjust code to tackle conflicts. Backed out my
14273 code in Assign::Resolve ;-)
14275 2001-09-08 Ravi Pratap <ravi@ximian.com>
14277 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
14278 instead Report.Error and also pass in the location.
14279 (CSharpParser::Lexer): New readonly property to return the reference
14280 to the Tokenizer object.
14281 (declare_local_variables): Use Report.Error with location instead of plain
14285 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
14286 (Operator.CheckBinaryOperator): Ditto.
14288 * cs-parser.jay (operator_declarator): Update accordingly.
14290 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
14291 (CheckBinaryOperator): Same here.
14293 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
14294 on the name without any prefixes of namespace names etc. This is because we
14295 already might have something already fully qualified like
14296 'System.Console.WriteLine'
14298 * assign.cs (Resolve): Begin implementation. Stuck ;-)
14300 2001-09-07 Ravi Pratap <ravi@ximian.com>
14302 * cs-tokenizer.cs (location): Return a string which also contains
14305 * expression.cs (ElementAccess): New class for expressions of the
14306 type 'element access.'
14307 (BaseAccess): New class for expressions of the type 'base access.'
14308 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
14311 * cs-parser.jay (element_access): Implement action.
14312 (base_access): Implement actions.
14313 (checked_expression, unchecked_expression): Implement.
14315 * cs-parser.jay (local_variable_type): Correct and implement.
14316 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
14318 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
14320 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
14321 name and the specifiers.
14323 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
14325 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
14326 making them all public ;-)
14328 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
14331 2001-09-07 Miguel de Icaza <miguel@ximian.com>
14333 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
14335 (FieldExpr, PropertyExprs): New resolved expressions.
14336 (SimpleName::MemberStaticCheck): Perform static checks for access
14337 to non-static fields on static methods. Maybe this should be
14338 generalized for MemberAccesses.
14339 (SimpleName::ResolveSimpleName): More work on simple name
14342 * cs-parser.jay (primary_expression/qualified_identifier): track
14343 the parameter index.
14345 * codegen.cs (CodeGen::Save): Catch save exception, report error.
14346 (EmitContext::EmitBoolExpression): Chain to expression generation
14347 instead of temporary hack.
14348 (::EmitStatementExpression): Put generic expression code generation.
14350 * assign.cs (Assign::Emit): Implement variable assignments to
14351 local variables, parameters and fields.
14353 2001-09-06 Miguel de Icaza <miguel@ximian.com>
14355 * statement.cs (Block::GetVariableInfo): New method, returns the
14356 VariableInfo for a variable name in a block.
14357 (Block::GetVariableType): Implement in terms of GetVariableInfo
14359 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
14360 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
14362 2001-09-06 Ravi Pratap <ravi@ximian.com>
14364 * cs-parser.jay (operator_declaration): Continue on my quest : update
14365 to take attributes argument.
14366 (event_declaration): Ditto.
14367 (enum_declaration): Ditto.
14368 (indexer_declaration): Ditto.
14370 * class.cs (Operator::Operator): Update constructor accordingly.
14371 (Event::Event): Ditto.
14373 * delegate.cs (Delegate::Delegate): Same here.
14375 * enum.cs (Enum::Enum): Same here.
14377 2001-09-05 Ravi Pratap <ravi@ximian.com>
14379 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
14381 * ../tests/cs0658.cs : New file to demonstrate error 0658.
14383 * attribute.cs (Attributes): New class to encapsulate all attributes which were
14384 being passed around as an arraylist.
14385 (Attributes::AddAttribute): Method to add attribute sections.
14387 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
14388 (struct_declaration): Update accordingly.
14389 (constant_declaration): Update.
14390 (field_declaration): Update.
14391 (method_header): Update.
14392 (fixed_parameter): Update.
14393 (parameter_array): Ditto.
14394 (property_declaration): Ditto.
14395 (destructor_declaration): Ditto.
14397 * class.cs (Struct::Struct): Update constructors accordingly.
14398 (Class::Class): Ditto.
14399 (Field::Field): Ditto.
14400 (Method::Method): Ditto.
14401 (Property::Property): Ditto.
14402 (TypeContainer::OptAttribute): update property's return type.
14404 * interface.cs (Interface.opt_attributes): New member.
14405 (Interface::Interface): Update to take the extra Attributes argument.
14407 * parameter.cs (Parameter::Parameter): Ditto.
14409 * constant.cs (Constant::Constant): Ditto.
14411 * interface.cs (InterfaceMemberBase): New OptAttributes field.
14412 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
14413 the attributes as a parameter.
14414 (InterfaceProperty): Update constructor call.
14415 (InterfaceEvent): Ditto.
14416 (InterfaceMethod): Ditto.
14417 (InterfaceIndexer): Ditto.
14419 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
14420 pass the attributes too.
14421 (interface_event_declaration): Ditto.
14422 (interface_property_declaration): Ditto.
14423 (interface_method_declaration): Ditto.
14424 (interface_declaration): Ditto.
14426 2001-09-05 Miguel de Icaza <miguel@ximian.com>
14428 * class.cs (Method::Define): Track the "static Main" definition to
14429 create an entry point.
14431 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
14432 EntryPoint if we find it.
14434 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
14435 (EmitContext::ig): Make this variable public.
14437 * driver.cs: Make the default output file be the first file name
14438 with the .exe extension.
14440 Detect empty compilations
14442 Handle various kinds of output targets. Handle --target and
14443 rename -t to --dumper.
14445 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
14446 methods inherited from Expression return now an Expression. This
14447 will is used during the tree rewriting as we resolve them during
14450 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14451 the spec. Missing entirely is the information about
14452 accessability of elements of it.
14454 (Expression::ExprClassFromMemberInfo): New constructor for
14455 Expressions that creates a fully initialized Expression based on
14456 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14459 (Invocation::Resolve): Begin implementing resolution of invocations.
14461 * literal.cs (StringLiteral): Implement Emit.
14463 2001-09-05 Ravi Pratap <ravi@ximian.com>
14465 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14468 2001-09-04 Ravi Pratap <ravi@ximian.com>
14470 * cs-parser.jay (attribute_arguments): Implement actions.
14471 (attribute): Fix bug in production. Implement action.
14472 (attribute_list): Implement.
14473 (attribute_target): Implement.
14474 (attribute_target_specifier, opt_target_specifier): Implement
14475 (CheckAttributeTarget): New method to check if the attribute target
14477 (attribute_section): Implement.
14478 (opt_attributes): Implement.
14480 * attribute.cs : New file to handle attributes.
14481 (Attribute): Class to hold attribute info.
14483 * cs-parser.jay (opt_attribute_target_specifier): Remove production
14484 (attribute_section): Modify production to use 2 different rules to
14485 achieve the same thing. 1 s/r conflict down !
14486 Clean out commented, useless, non-reducing dimension_separator rules.
14488 * class.cs (TypeContainer.attributes): New member to hold list
14489 of attributes for a type.
14490 (Struct::Struct): Modify to take one more argument, the attribute list.
14491 (Class::Class): Ditto.
14492 (Field::Field): Ditto.
14493 (Method::Method): Ditto.
14494 (Property::Property): Ditto.
14496 * cs-parser.jay (struct_declaration): Update constructor call to
14497 pass in the attributes too.
14498 (class_declaration): Ditto.
14499 (constant_declaration): Ditto.
14500 (field_declaration): Ditto.
14501 (method_header): Ditto.
14502 (fixed_parameter): Ditto.
14503 (parameter_array): Ditto.
14504 (property_declaration): Ditto.
14506 * constant.cs (Constant::Constant): Update constructor similarly.
14507 Use System.Collections.
14509 * parameter.cs (Parameter::Parameter): Update as above.
14511 2001-09-02 Ravi Pratap <ravi@ximian.com>
14513 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14514 (TypeContainer.delegates): New member to hold list of delegates.
14516 * cs-parser.jay (delegate_declaration): Implement the action correctly
14517 this time as I seem to be on crack ;-)
14519 2001-09-02 Miguel de Icaza <miguel@ximian.com>
14521 * rootcontext.cs (RootContext::IsNamespace): new function, used to
14522 tell whether an identifier represents a namespace.
14524 * expression.cs (NamespaceExpr): A namespace expression, used only
14525 temporarly during expression resolution.
14526 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14527 utility functions to resolve names on expressions.
14529 2001-09-01 Miguel de Icaza <miguel@ximian.com>
14531 * codegen.cs: Add hook for StatementExpressions.
14533 * class.cs: Fix inverted test for static flag in methods.
14535 2001-09-02 Ravi Pratap <ravi@ximian.com>
14537 * class.cs (Operator::CheckUnaryOperator): Correct error number used
14538 to make it coincide with MS' number.
14539 (Operator::CheckBinaryOperator): Ditto.
14541 * ../errors/errors.txt : Remove error numbers added earlier.
14543 * ../errors/cs1019.cs : Test case for error # 1019
14545 * ../errros/cs1020.cs : Test case for error # 1020
14547 * cs-parser.jay : Clean out commented cruft.
14548 (dimension_separators, dimension_separator): Comment out. Ostensibly not
14549 used anywhere - non-reducing rule.
14550 (namespace_declarations): Non-reducing rule - comment out.
14552 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14553 with TypeContainer::AddEnum.
14555 * delegate.cs : New file for delegate handling classes.
14556 (Delegate): Class for declaring delegates.
14558 * makefile : Update.
14560 * cs-parser.jay (delegate_declaration): Implement.
14562 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
14564 * class.cs (Event::Define): Implement.
14565 (Event.EventBuilder): New member.
14567 * class.cs (TypeContainer::Populate): Update to define all enums and events
14569 (Events): New property for the events arraylist we hold. Shouldn't we move to using
14570 readonly fields for all these cases ?
14572 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14574 * class.cs (Property): Revamp to use the convention of making fields readonly.
14575 Accordingly modify code elsewhere.
14577 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14578 the Define method of the Property class.
14580 * class.cs : Clean up applied patch and update references to variables etc. Fix
14582 (TypeContainer::Populate): Update to define all the properties we have. Also
14583 define all enumerations.
14585 * enum.cs (Define): Implement.
14587 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
14589 * cs-parser.jay (overloadable_operator): The semantic value is an
14590 enum of the Operator class.
14591 (operator_declarator): Implement actions.
14592 (operator_declaration): Implement.
14594 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14595 validity of definitions.
14596 (Operator::CheckBinaryOperator): Static method to check for binary operators
14597 (TypeContainer::AddOperator): New method to add an operator to a type.
14599 * cs-parser.jay (indexer_declaration): Added line to actually call the
14600 AddIndexer method so it gets added ;-)
14602 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
14603 already taken care of by the MS compiler ?
14605 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14607 * class.cs (Operator): New class for operator declarations.
14608 (Operator::OpType): Enum for the various operators.
14610 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
14612 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14613 ostensibly handle this in semantic analysis.
14615 * cs-parser.jay (general_catch_clause): Comment out
14616 (specific_catch_clauses, specific_catch_clause): Ditto.
14617 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14618 (catch_args, opt_catch_args): New productions.
14619 (catch_clause): Rewrite to use the new productions above
14620 (catch_clauses): Modify accordingly.
14621 (opt_catch_clauses): New production to use in try_statement
14622 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14623 and re-write the code in the actions to extract the specific and
14624 general catch clauses by being a little smart ;-)
14626 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14627 Hooray, try and catch statements parse fine !
14629 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14631 * statement.cs (Block::GetVariableType): Fix logic to extract the type
14632 string from the hashtable of variables.
14634 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14635 I end up making that mistake ;-)
14636 (catch_clauses): Fixed gross error which made Key and Value of the
14637 DictionaryEntry the same : $1 !!
14639 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14641 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14643 * cs-parser.jay (event_declaration): Correct to remove the semicolon
14644 when the add and remove accessors are specified.
14646 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
14648 * cs-parser.jay (IndexerDeclaration): New helper class to hold
14649 information about indexer_declarator.
14650 (indexer_declarator): Implement actions.
14651 (parsing_indexer): New local boolean used to keep track of whether
14652 we are parsing indexers or properties. This is necessary because
14653 implicit_parameters come into picture even for the get accessor in the
14654 case of an indexer.
14655 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14657 * class.cs (Indexer): New class for indexer declarations.
14658 (TypeContainer::AddIndexer): New method to add an indexer to a type.
14659 (TypeContainer::indexers): New member to hold list of indexers for the
14662 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14664 * cs-parser.jay (add_accessor_declaration): Implement action.
14665 (remove_accessor_declaration): Implement action.
14666 (event_accessors_declaration): Implement
14667 (variable_declarators): swap statements for first rule - trivial.
14669 * class.cs (Event): New class to hold information about event
14671 (TypeContainer::AddEvent): New method to add an event to a type
14672 (TypeContainer::events): New member to hold list of events.
14674 * cs-parser.jay (event_declaration): Implement actions.
14676 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
14678 * cs-parser.jay (dim_separators): Implement. Make it a string
14679 concatenating all the commas together, just as they appear.
14680 (opt_dim_separators): Modify accordingly
14681 (rank_specifiers): Update accordingly. Basically do the same
14682 thing - instead, collect the brackets here.
14683 (opt_rank_sepcifiers): Modify accordingly.
14684 (array_type): Modify to actually return the complete type string
14685 instead of ignoring the rank_specifiers.
14686 (expression_list): Implement to collect the expressions
14687 (variable_initializer): Implement. We make it a list of expressions
14688 essentially so that we can handle the array_initializer case neatly too.
14689 (variable_initializer_list): Implement.
14690 (array_initializer): Make it a list of variable_initializers
14691 (opt_array_initializer): Modify accordingly.
14693 * expression.cs (New::NType): Add enumeration to help us
14694 keep track of whether we have an object/delegate creation
14695 or an array creation.
14696 (New:NewType, New::Rank, New::Indices, New::Initializers): New
14697 members to hold data about array creation.
14698 (New:New): Modify to update NewType
14699 (New:New): New Overloaded contructor for the array creation
14702 * cs-parser.jay (array_creation_expression): Implement to call
14703 the overloaded New constructor.
14705 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
14707 * class.cs (TypeContainer::Constructors): Return member
14708 constructors instead of returning null.
14710 2001-08-26 Miguel de Icaza <miguel@ximian.com>
14712 * typemanager.cs (InitCoreTypes): Initialize the various core
14713 types after we have populated the type manager with the user
14714 defined types (this distinction will be important later while
14715 compiling corlib.dll)
14717 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14718 on Expression Classification. Now all expressions have a method
14719 `Resolve' and a method `Emit'.
14721 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14722 generation from working. Also add some temporary debugging
14725 2001-08-24 Miguel de Icaza <miguel@ximian.com>
14727 * codegen.cs: Lots of code generation pieces. This is only the
14728 beginning, will continue tomorrow with more touches of polish. We
14729 handle the fundamentals of if, while, do, for, return. Others are
14730 trickier and I need to start working on invocations soon.
14732 * gen-treedump.cs: Bug fix, use s.Increment here instead of
14735 * codegen.cs (EmitContext): New struct, used during code
14736 emission to keep a context. Most of the code generation will be
14739 * cs-parser.jay: Add embedded blocks to the list of statements of
14740 this block. So code generation proceeds in a top down fashion.
14742 2001-08-23 Miguel de Icaza <miguel@ximian.com>
14744 * statement.cs: Add support for multiple child blocks.
14746 2001-08-22 Miguel de Icaza <miguel@ximian.com>
14748 * codegen.cs (EmitCode): New function, will emit the code for a
14749 Block of code given a TypeContainer and its ILGenerator.
14751 * statement.cs (Block): Standard public readonly optimization.
14752 (Block::Block constructors): Link children.
14753 (Block::Child): Child Linker.
14754 (Block::EmitVariables): Emits IL variable declarations.
14756 * class.cs: Drop support for MethodGroups here, delay until
14758 (Method::): Applied the same simplification that I did before, and
14759 move from Properties to public readonly fields.
14760 (Method::ParameterTypes): Returns the parameter types for the
14761 function, and implements a cache that will be useful later when I
14762 do error checking and the semantic analysis on the methods is
14764 (Constructor::GetCallingConvention): Renamed from CallingConvetion
14765 and made a method, optional argument tells whether this is a class
14766 or a structure to apply the `has-this' bit.
14767 (Method::GetCallingConvention): Implement, returns the calling
14769 (Method::Define): Defines the type, a second pass is performed
14770 later to populate the methods.
14772 (Constructor::ParameterTypes): implement a cache similar to the
14773 one on Method::ParameterTypes, useful later when we do semantic
14776 (TypeContainer::EmitMethod): New method. Emits methods.
14778 * expression.cs: Removed MethodGroup class from here.
14780 * parameter.cs (Parameters::GetCallingConvention): new method.
14782 2001-08-21 Miguel de Icaza <miguel@ximian.com>
14784 * class.cs (TypeContainer::Populate): Drop RootContext from the
14787 (Constructor::CallingConvention): Returns the calling convention.
14788 (Constructor::ParameterTypes): Returns the constructor parameter
14791 (TypeContainer::AddConstructor): Keep track of default constructor
14792 and the default static constructor.
14794 (Constructor::) Another class that starts using `public readonly'
14795 instead of properties.
14797 (Constructor::IsDefault): Whether this is a default constructor.
14799 (Field::) use readonly public fields instead of properties also.
14801 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
14802 track of static constructors; If none is used, turn on
14803 BeforeFieldInit in the TypeAttributes.
14805 * cs-parser.jay (opt_argument_list): now the return can be null
14806 for the cases where there are no arguments.
14808 (constructor_declarator): If there is no implicit `base' or
14809 `this', then invoke the default parent constructor.
14811 * modifiers.cs (MethodAttr): New static function maps a set of
14812 modifiers flags into a MethodAttributes enum
14813 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
14814 MethodAttr, TypeAttr to represent the various mappings where the
14815 modifiers are used.
14816 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
14818 2001-08-19 Miguel de Icaza <miguel@ximian.com>
14820 * parameter.cs (GetParameterInfo): Fix bug where there would be no
14823 * interface.cs (PopulateIndexer): Implemented the code generator
14824 for interface indexers.
14826 2001-08-17 Miguel de Icaza <miguel@ximian.com>
14828 * interface.cs (InterfaceMemberBase): Now we track the new status
14831 (PopulateProperty): Implement property population. Woohoo! Got
14832 Methods and Properties going today.
14834 Removed all the properties for interfaces, and replaced them with
14835 `public readonly' fields.
14837 2001-08-16 Miguel de Icaza <miguel@ximian.com>
14839 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
14840 initialize their hashtables/arraylists only when they are needed
14841 instead of doing this always.
14843 * parameter.cs: Handle refs and out parameters.
14845 * cs-parser.jay: Use an ArrayList to construct the arguments
14846 instead of the ParameterCollection, and then cast that to a
14849 * parameter.cs: Drop the use of ParameterCollection and use
14850 instead arrays of Parameters.
14852 (GetParameterInfo): Use the Type, not the Name when resolving
14855 2001-08-13 Miguel de Icaza <miguel@ximian.com>
14857 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
14858 and instead use public readonly fields.
14860 * class.cs: Put back walking code for type containers.
14862 2001-08-11 Miguel de Icaza <miguel@ximian.com>
14864 * class.cs (MakeConstant): Code to define constants.
14866 * rootcontext.cs (LookupType): New function. Used to locate types
14869 2001-08-08 Miguel de Icaza <miguel@ximian.com>
14871 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
14872 this System.Reflection code is. Kudos to Microsoft
14874 * typemanager.cs: Implement a type cache and avoid loading all
14875 types at boot time. Wrap in LookupType the internals. This made
14876 the compiler so much faster. Wow. I rule!
14878 * driver.cs: Make sure we always load mscorlib first (for
14879 debugging purposes, nothing really important).
14881 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
14882 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
14884 * rootcontext.cs: Lookup types on their namespace; Lookup types
14885 on namespaces that have been imported using the `using' keyword.
14887 * class.cs (TypeContainer::TypeAttr): Virtualize.
14888 (Class::TypeAttr): Return attributes suitable for this bad boy.
14889 (Struct::TypeAttr): ditto.
14890 Handle nested classes.
14891 (TypeContainer::) Remove all the type visiting code, it is now
14892 replaced with the rootcontext.cs code
14894 * rootcontext.cs (GetClassBases): Added support for structs.
14896 2001-08-06 Miguel de Icaza <miguel@ximian.com>
14898 * interface.cs, statement.cs, class.cs, parameter.cs,
14899 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
14900 Drop use of TypeRefs, and use strings instead.
14902 2001-08-04 Miguel de Icaza <miguel@ximian.com>
14906 * class.cs (Struct::Struct): set the SEALED flags after
14907 checking the modifiers.
14908 (TypeContainer::TypeAttr): new property, returns the
14909 TypeAttributes for a class.
14911 * cs-parser.jay (type_list): Oops, list production was creating a
14912 new list of base types.
14914 * rootcontext.cs (StdLib): New property.
14915 (GetInterfaceTypeByName): returns an interface by type name, and
14916 encapsulates error handling here.
14917 (GetInterfaces): simplified.
14918 (ResolveTree): Encapsulated all the tree resolution here.
14919 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
14922 * driver.cs: Add support for --nostdlib, to avoid loading the
14923 default assemblies.
14924 (Main): Do not put tree resolution here.
14926 * rootcontext.cs: Beginning of the class resolution.
14928 2001-08-03 Miguel de Icaza <miguel@ximian.com>
14930 * rootcontext.cs: Provide better error reporting.
14932 * cs-parser.jay (interface_base): set our $$ to be interfaces.
14934 * rootcontext.cs (CreateInterface): Handle the case where there
14935 are no parent interfaces.
14937 (CloseTypes): Routine to flush types at the end.
14938 (CreateInterface): Track types.
14939 (GetInterfaces): Returns an array of Types from the list of
14940 defined interfaces.
14942 * typemanager.c (AddUserType): Mechanism to track user types (puts
14943 the type on the global type hash, and allows us to close it at the
14946 2001-08-02 Miguel de Icaza <miguel@ximian.com>
14948 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
14949 RecordInterface instead.
14951 * cs-parser.jay: Updated to reflect changes above.
14953 * decl.cs (Definition): Keep track of the TypeBuilder type that
14954 represents this type here. Not sure we will use it in the long
14955 run, but wont hurt for now.
14957 * driver.cs: Smaller changes to accomodate the new code.
14959 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
14962 * rootcontext.cs (CreateInterface): New method, used to create
14963 the System.TypeBuilder type for interfaces.
14964 (ResolveInterfaces): new entry point to resolve the interface
14966 (CodeGen): Property, used to keep track of the code generator.
14968 2001-07-26 Miguel de Icaza <miguel@ximian.com>
14970 * cs-parser.jay: Add a second production for delegate_declaration
14973 (enum_body): Put an opt_comma here instead of putting it on
14974 enum_body or enum_member_declarations so we can handle trailing
14975 commas on enumeration members. Gets rid of a shift/reduce.
14977 (type_list): Need a COMMA in the middle.
14979 (indexer_declaration): Tell tokenizer to recognize get/set
14981 * Remove old targets.
14983 * Re-add the parser target.
14985 2001-07-13 Simon Cozens <simon@simon-cozens.org>
14987 * cs-parser.jay: Add precendence rules for a number of operators
14988 ot reduce the number of shift/reduce conflicts in the grammar.
14990 2001-07-17 Miguel de Icaza <miguel@ximian.com>
14992 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
14995 Get rid of old crufty code.
14997 * rootcontext.cs: Use this to keep track of the parsed
14998 representation and the defined types available to the program.
15000 * gen-treedump.cs: adjust for new convention.
15002 * type.cs: Split out the type manager, and the assembly builder
15005 * typemanager.cs: the type manager will live here now.
15007 * cil-codegen.cs: And the code generator here.
15009 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
15011 * makefile: Fixed up for easy making.
15013 2001-07-13 Simon Cozens <simon@simon-cozens.org>
15015 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
15018 (unary_expression): Expand pre_increment_expression and
15019 post_decrement_expression to reduce a shift/reduce.
15021 2001-07-11 Simon Cozens
15023 * cs-tokenizer.cs: Hex numbers should begin with a 0.
15025 Improve allow_keyword_as_indent name.
15027 2001-06-19 Miguel de Icaza <miguel@ximian.com>
15029 * Adjustments for Beta2.
15031 2001-06-13 Miguel de Icaza <miguel@ximian.com>
15033 * decl.cs: Added `Define' abstract method.
15034 (InTransit): new property, used to catch recursive definitions.
15036 * interface.cs: Implement `Define'.
15038 * modifiers.cs: Map Modifiers.constants to
15039 System.Reflection.TypeAttribute flags.
15041 * class.cs: Keep track of types and user-defined types.
15042 (BuilderInit): New method for creating an assembly
15043 (ResolveType): New function to launch the resolution process, only
15044 used by interfaces for now.
15046 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
15047 that are inserted into the name space.
15049 2001-06-08 Miguel de Icaza <miguel@ximian.com>
15051 * ARGH. I have screwed up my tree so many times due to the use of
15052 rsync rather than using CVS. Going to fix this at once.
15054 * driver.cs: Objetify driver. Load assemblies, use assemblies to
15057 2001-06-07 Miguel de Icaza <miguel@ximian.com>
15059 * Experiment successful: Use System.Type rather that our own
15062 2001-05-25 Miguel de Icaza <miguel@ximian.com>
15064 * cs-parser.jay: Removed nsAliases from here.
15066 Use new namespaces, handle `using XXX;'
15068 * namespace.cs: Reimplemented namespace handling, use a recursive
15069 definition of the class. Now we can keep track of using clauses
15070 and catch invalid using clauses.
15072 2001-05-24 Miguel de Icaza <miguel@ximian.com>
15074 * gen-treedump.cs: Adapted for all the renaming.
15076 * expression.cs (Expression): this class now has a Type property
15077 which returns an expression Type.
15079 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
15080 `Type', as this has a different meaning now in the base
15082 2001-05-22 Miguel de Icaza <miguel@ximian.com>
15084 * interface.cs, class.cs: Removed from all the sources the
15085 references to signature computation, as we can not do method
15086 signature computation during the parsing time, as we are not
15087 trying to solve at that point distinguishing:
15091 void a (NS.Blah x) {}
15094 Which depending on the context might be valid or not, as we do not
15095 know if Blah is the same thing as NS.Blah at that point.
15097 * Redid everything so the code uses TypeRefs now instead of
15098 Types. TypeRefs are just temporary type placeholders, that need
15099 to be resolved. They initially have a pointer to a string and the
15100 current scope in which they are used. This is used later by the
15101 compiler to resolve the reference to an actual Type.
15103 * DeclSpace is no longer a CIR.Type, and neither are
15104 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
15105 are all DeclSpaces, but no Types.
15107 * type.cs (TypeRefManager): This implements the TypeRef manager,
15108 which keeps track of all the types that need to be resolved after
15109 the parsing has finished.
15111 2001-05-13 Miguel de Icaza <miguel@ximian.com>
15113 * ARGH. We are going to have to store `foreach' as a class rather
15114 than resolving it, as we need to verify error 1579 after name
15115 resolution. *OR* we could keep a flag that says `This request to
15116 IEnumerator comes from a foreach statement' which we can then use
15117 to generate the error.
15119 2001-05-10 Miguel de Icaza <miguel@ximian.com>
15121 * class.cs (TypeContainer.AddMethod): we now add methods to the
15122 MethodGroup instead of the method hashtable.
15124 * expression.cs: Add MethodGroup abstraction, which gets us one
15125 step closer to the specification in the way we handle method
15128 * cs-parser.jay (primary_expression): qualified_identifier now
15129 tried to match up an identifier to a local variable reference or
15130 to a parameter reference.
15132 current_local_parameters is now a parser global variable that
15133 points to the current parameters for the block, used during name
15136 (property_declaration): Now creates an implicit `value' argument to
15139 2001-05-09 Miguel de Icaza <miguel@ximian.com>
15141 * parameter.cs: Do not use `param' arguments as part of the
15142 signature, per the spec.
15144 2001-05-08 Miguel de Icaza <miguel@ximian.com>
15146 * decl.cs: Base class for classes, structs and interfaces. This
15147 is the "Declaration Space"
15149 * cs-parser.jay: Use CheckDef for checking declaration errors
15150 instead of having one on each function.
15152 * class.cs: Factor out some code for handling error handling in
15153 accordance to the "Declarations" section in the "Basic Concepts"
15154 chapter in the ECMA C# spec.
15156 * interface.cs: Make all interface member classes derive from
15157 InterfaceMemberBase.
15159 2001-05-07 Miguel de Icaza <miguel@ximian.com>
15161 * Many things: all interfaces are parsed and generated in
15162 gen-treedump. Support for member variables, constructors,
15163 destructors, properties, constants is there.
15165 Beginning of the IL backend, but very little done, just there for
15168 2001-04-29 Miguel de Icaza <miguel@ximian.com>
15170 * cs-parser.jay: Fix labeled statement.
15172 * cs-tokenizer.cs (escape): Escape " and ' always.
15173 ref_line, ref_name: keep track of the line/filename as instructed
15174 by #line by the compiler.
15177 2001-04-27 Miguel de Icaza <miguel@ximian.com>
15179 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
15180 to match the values in System.CodeDOM.
15182 Divid renamed to Divide.
15184 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
15186 (Statements.set): remove.
15188 * System.CodeDOM/CodeCatchClause.cs: always have a valid
15191 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
15192 falseStatements always have valid values.
15194 * cs-parser.jay: Use System.CodeDOM now.