1 2004-05-20 Martin Baulig <martin@ximian.com>
3 * delegate.cs: Convert this file to Unix mode - like the original
6 2004-05-20 Martin Baulig <martin@ximian.com>
8 * attribute.cs: Convert this file to Unix mode - like the original
11 2004-05-19 Marek Safar <marek.safar@seznam.cz>
13 Fix bug #58688 (MCS does not report error when the same attribute
16 * attribute.cs (Attribute.Emit): Distinction between null and default.
18 2004-05-19 Raja R Harinath <rharinath@novell.com>
20 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
21 of a top-level attribute without an attribute target.
22 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
24 (Attribute.Conditional_GetConditionName),
25 (Attribute.Obsolete_GetObsoleteMessage): Update.
26 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
27 part of ScanForIndexerName.
28 (Attribute.CanIgnoreInvalidAttribute): New function.
29 (Attribute.ScanForIndexerName): Move to ...
30 (Attributes.ScanForIndexerName): ... here.
31 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
32 (Attributes.Search): New internal variant that can choose not to
33 complain if types aren't resolved. The original signature now
35 (Attributes.GetClsCompliantAttribute): Use internal variant, with
36 complaints suppressed.
37 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
38 only if it not useful.
39 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
40 top-level for attributes that are shared between the assembly
41 and a top-level class.
42 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
43 * class.cs: Update to reflect changes.
44 (DefineIndexers): Fuse loops.
45 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
46 a couple more variants of attribute names.
48 2004-05-18 Marek Safar <marek.safar@seznam.cz>
50 Fix bug #52585 (Implemented explicit attribute declaration)
53 (Attributable.ValidAttributeTargets): New abstract method. It gets
54 list of valid attribute targets for explicit target declaration.
55 (Attribute.Target): It holds target itself.
56 (AttributeSection): Removed.
57 (Attribute.CheckTargets): New method. It checks whether attribute
58 target is valid for the current element.
61 (EventProperty): New class. For events that are declared like
62 property (with add and remove accessors).
63 (EventField): New class. For events that are declared like field.
66 * cs-parser.jay: Implemented explicit attribute target declaration.
68 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
69 Override ValidAttributeTargets.
72 (ReturnParameter): Class for applying custom attributes on
74 (ParameterAtribute): New class. Class for applying custom
75 attributes on the parameter type.
77 2004-05-17 Miguel de Icaza <miguel@ximian.com>
79 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
82 (Method): Allow UNSAFE here.
84 * modifiers.cs: Support unsafe reporting.
86 2004-05-17 Marek Safar <marek.safar@seznam.cz>
88 * decl.cs: Fix bug #58478.
90 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
92 * statement.cs: When checking for unreachable code on an EmptyStatement,
93 set the location. Fixes bug #58488.
95 2004-05-13 Miguel de Icaza <miguel@ximian.com>
97 * driver.cs: Add -pkg handling.
99 From Gonzalo: UseShelLExecute=false
101 2004-05-12 Marek Safar <marek.safar@seznam.cz>
104 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
106 (Attribute.IsClsCompliaceRequired): Moved to base for better
108 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
109 when attribute is AttributeUsageAttribute.
110 (Attribute.GetValidTargets): Simplified.
111 (Attribute.GetAttributeUsage): New method returns AttributeUsage
112 attribute for this type.
113 (Attribute.ApplyAttributes): Method renamed to Emit and make
115 (GlobalAttributeSection): New class for special handling of global
116 attributes (assembly, module).
117 (AttributeSection.Emit): New method.
119 * class.cs: Implemented Attributable abstract methods.
120 (MethodCore.LabelParameters): Moved to Parameter class.
121 (Accessor): Is back simple class.
122 (PropertyMethod): Implemented Attributable abstract class.
123 (DelegateMethod): Implemented Attributable abstract class.
124 (Event): New constructor for disctintion between normal Event
125 and Event with accessors.
127 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
129 * codegen.cs, const.cs, decl.cs, delegate.cs:
130 (CommonAssemblyModulClass): Implemented Attributable abstract class
133 * enum.cs: Implement IAttributeSupport interface.
134 (EnumMember): New class for emum members. Implemented Attributable
138 (ParameterBase): Is abstract.
139 (ReturnParameter): New class for easier [return:] attribute handling.
141 * typemanager.cs: Removed builder_to_attr.
143 2004-05-11 Raja R Harinath <rharinath@novell.com>
146 * attribute.cs (Attribute.GetPositionalValue): New function.
147 * class.cs (TypeContainer.VerifyMembers): New function.
148 (TypeContainer.Emit): Use it.
149 (ClassOrStruct): New base class for Class and Struct.
150 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
151 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
153 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
154 then each non-static field should have a FieldOffset attribute.
155 Otherwise, none of the fields should have a FieldOffset attribute.
156 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
157 and FieldOffset attributes.
158 * typemanager.cs (TypeManager.struct_layout_attribute_type)
159 (TypeManager.field_offset_attribute_type): New core types.
160 (TypeManager.InitCoreTypes): Initialize them.
162 2004-05-11 Michal Moskal <malekith@pld-linux.org>
164 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
168 2004-05-09 Miguel de Icaza <miguel@ximian.com>
170 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
171 be implicitly converted to ulong.
173 * expression.cs: The logic for allowing operator &, | and ^ worked
174 was wrong, it worked before because we did not report an error in
175 an else branch. Fixes 57895.
177 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
178 allow volatile fields to be reference types.
180 2004-05-07 Miguel de Icaza <miguel@ximian.com>
182 * driver.cs: Add support for /debug-
184 2004-05-07 Raja R Harinath <rharinath@novell.com>
186 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
187 Add a 'complain' parameter to silence errors.
188 (Attribute.Resolve): Update to changes. Put in sanity check to catch
189 silently overlooked type-resolutions.
190 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
192 (Attributes.Search): New function.
193 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
194 (Attributes.GetAttributeFullName): Remove hack.
195 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
196 Update to reflect changes.
197 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
198 Use Attributes.Search instead of nested loops.
200 2004-05-07 Marek Safar <marek.safar@seznam.cz>
203 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
204 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
205 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
207 * report.cs: (Report.Warning): Renamed to Warning_T because of
210 2004-05-05 Raja R Harinath <rharinath@novell.com>
212 * expression.cs (MemberAccess.ResolveMemberAccess):
213 Exit with non-zero status after Report.Error.
214 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
216 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
218 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
220 * support.cs: Don't hang when the file is empty.
222 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
224 * support.cs: In SeekableStreamReader, compute the preamble size of the
225 underlying stream. Position changes should take into account that initial
228 2004-05-03 Todd Berman <tberman@sevenl.net>
230 * driver.cs: remove unused GetSysVersion function.
232 2004-05-03 Todd Berman <tberman@sevenl.net>
234 * driver.cs: Remove the hack from saturday, as well as the hack
235 from jackson (LoadAssemblyFromGac), also adds the CWD to the
236 link_paths to get that bit proper.
238 2004-05-01 Todd Berman <tberman@sevenl.net>
240 * driver.cs: Try a LoadFrom before a Load, this checks the current
241 path. This is currently a bug in mono that is be fixed, however, this
242 provides a workaround for now. This will be removed when the bug
245 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
247 * CryptoConvert.cs: Updated to latest version. Fix issue with
248 incomplete key pairs (#57941).
250 2004-05-01 Todd Berman <tberman@sevenl.net>
252 * driver.cs: Remove '.' from path_chars, now System.* loads properly
255 2004-04-30 Jackson Harper <jackson@ximian.com>
257 * codegen.cs: Open keys readonly.
259 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
261 * typemanager.cs: don't report cyclic struct layout when a struct
262 contains 2 or more fields of the same type. Failed for Pango.AttrShape
263 which has 2 Pango.Rectangle fields.
265 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
267 * expression.cs: Handle IntPtr comparisons with IL code
268 rather than a method call.
270 2004-04-29 Martin Baulig <martin@ximian.com>
272 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
273 the list of PropertyInfo's in class hierarchy and find the
274 accessor. Fixes #56013.
276 2004-04-29 Martin Baulig <martin@ximian.com>
278 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
280 2004-04-29 Martin Baulig <martin@ximian.com>
282 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
284 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
286 2004-04-29 Martin Baulig <martin@ximian.com>
288 * class.cs (ConstructorInitializer.Resolve): Check whether the
289 parent .ctor is accessible. Fixes #52146.
291 2004-04-29 Martin Baulig <martin@ximian.com>
293 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
295 * statement.cs (Using.EmitLocalVariableDecls): Use
296 TypeManager.idisposable_type, not typeof (IDisposable).
297 (Foreach.EmitCollectionForeach): Added support for valuetypes.
299 2004-04-29 Martin Baulig <martin@ximian.com>
301 * class.cs (Event.Define): Don't emit the field and don't set
302 RTSpecialName and SpecialName for events on interfaces. Fixes
305 2004-04-29 Raja R Harinath <rharinath@novell.com>
307 Refactor Attribute.ApplyAttributes.
308 * attribute.cs (Attributable): New base class for objects that can
309 have Attributes applied on them.
310 (Attribute): Make AttributeUsage fields public.
311 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
312 (Attribute.IsInternalCall): New property.
313 (Attribute.UsageAttr): Convert to a public read-only property.
314 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
315 (Attribute.ResolveType, Attribute.Resolve)
316 (Attribute.ScanForIndexerName): Update to reflect changes.
317 (Attribute.CheckAttributeTarget): Re-format.
318 (Attribute.ApplyAttributes): Refactor, to various
319 Attributable.ApplyAttributeBuilder methods.
320 * decl.cs (MemberCore): Make Attributable.
321 * class.cs (Accessor): Make Attributable.
322 (MethodData.ApplyAttributes): Use proper attribute types, not
324 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
325 (TypeContainer.ApplyAttributeBuilder)
326 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
327 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
328 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
329 (Operator.ApplyAttributeBuilder): New factored-out methods.
330 * const.cs (Const.ApplyAttributeBuilder): Likewise.
331 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
332 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
333 * parameter.cs (ParameterBase): New Attributable base class
334 that can also represent Return types.
335 (Parameter): Update to the changes.
337 2004-04-29 Jackson Harper <jackson@ximian.com>
339 * driver.cs: Prefer the corlib system version when looking for
340 assemblies in the GAC. This is still a hack, but its a better hack
343 2004-04-29 Marek Safar <marek.safar@seznam.cz>
345 * decl.cs, enum.cs: Improved error 3005 reporting.
347 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
348 (related_symbols): New private member for list of symbols
349 related to reported error/warning.
351 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
353 2004-04-29 Martin Baulig <martin@ximian.com>
355 * ecore.cs (Expression.Constantify): If we're an enum and
356 TypeManager.TypeToCoreType() doesn't give us another type, use
357 t.UnderlyingSystemType. Fixes #56178.
359 2004-04-29 Martin Baulig <martin@ximian.com>
361 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
362 interfaces and for each interface, only add members directly
363 declared in that interface. Fixes #53255.
365 2004-04-28 Martin Baulig <martin@ximian.com>
367 * expression.cs (ConditionalLogicalOperator): Use a temporary
368 variable for `left' to avoid that we evaluate it more than once;
371 2004-04-28 Martin Baulig <martin@ximian.com>
373 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
376 2004-04-28 Martin Baulig <martin@ximian.com>
378 * statement.cs (LocalInfo.Resolve): Check whether the type is not
381 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
382 whether the type is not void (CS1547).
384 2004-04-28 Martin Baulig <martin@ximian.com>
386 * expression.cs (Unary.DoResolveLValue): Override this and report
387 CS0131 for anything but Operator.Indirection.
389 2004-04-28 Martin Baulig <martin@ximian.com>
391 Committing a patch from Ben Maurer; see bug #50820.
393 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
396 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
399 2004-04-28 Martin Baulig <martin@ximian.com>
401 Committing a patch from Ben Maurer; see bug #50820.
403 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
406 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
409 2004-04-28 Martin Baulig <martin@ximian.com>
411 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
412 (Block.AddLabel): Call DoLookupLabel() to only search in the
415 2004-04-28 Martin Baulig <martin@ximian.com>
417 * cfold.cs (ConstantFold.BinaryFold): Added special support for
418 comparing StringConstants and NullLiterals in Equality and Inequality.
420 2004-04-28 Jackson Harper <jackson@ximian.com>
422 * driver.cs: Attempt to load referenced assemblies from the
423 GAC. This is the quick and dirty version of this method that
424 doesnt take into account versions and just takes the first
425 canidate found. Will be good enough for now as we will not have more
426 then one version installed into the GAC until I update this method.
428 2004-04-28 Martin Baulig <martin@ximian.com>
430 * typemanager.cs (TypeManager.CheckStructCycles): New public
431 static method to check for cycles in the struct layout.
433 * rootcontext.cs (RootContext.PopulateTypes): Call
434 TypeManager.CheckStructCycles() for each TypeContainer.
435 [Note: We only need to visit each type once.]
437 2004-04-28 Martin Baulig <martin@ximian.com>
439 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
441 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
442 success and added `out object value'. Use a `bool resolved' field
443 to check whether we've already been called rather than
444 `ConstantValue != null' since this breaks for NullLiterals.
446 2004-04-28 Raja R Harinath <rharinath@novell.com>
448 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
449 setting of this flag, since the 'set' method may be non-public.
451 2004-04-28 Raja R Harinath <rharinath@novell.com>
453 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
454 check on current_vector.Block.
456 2004-04-27 Martin Baulig <martin@ximian.com>
458 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
459 a field initializer. Fixes #56459.
461 2004-04-27 Martin Baulig <martin@ximian.com>
463 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
464 we're not attempting to use an indexer. Fixes #52154.
466 2004-04-27 Martin Baulig <martin@ximian.com>
468 * statement.cs (Return): Don't create a return label if we don't
469 need it; reverts my change from January 20th. Thanks to Ben
472 2004-04-27 Martin Baulig <martin@ximian.com>
474 According to the spec, `goto' can only leave a nested scope, but
477 * statement.cs (Block.LookupLabel): Only lookup in the current
478 block, don't recurse into parent or child blocks.
479 (Block.AddLabel): Check in parent and child blocks, report
480 CS0140/CS0158 if we find a duplicate.
481 (Block): Removed this indexer for label lookups.
482 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
483 this already does the error reporting for us.
486 (FlowBranching.UsageVector.Block): New public variable; may be null.
487 (FlowBranching.CreateSibling): Added `Block' argument.
488 (FlowBranching.LookupLabel): New public virtual method. Lookup a
489 label for the target of a `goto' and check whether we're not
492 2004-04-27 Martin Baulig <martin@ximian.com>
494 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
495 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
498 2004-04-27 Martin Baulig <martin@ximian.com>
500 * statement.cs (Block.AddLabel): Also check for implicit blocks
501 and added a CS0158 check.
503 2004-04-27 Martin Baulig <martin@ximian.com>
505 * flowanalysis.cs (FlowBranchingLoop): New class.
506 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
507 UsageVector's instead of an ArrayList.
508 (FlowBranching.Label): Likewise.
509 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
510 (FlowBranching.AddBreakVector): New method.
512 2004-04-27 Miguel de Icaza <miguel@ximian.com>
514 * attribute.cs: Small regression fix: only convert the type if we
515 the type is different, fixes System.Drawing build.
517 2004-04-27 Martin Baulig <martin@ximian.com>
519 * attribute.cs (Attribute.Resolve): If we have a constant value
520 for a named field or property, implicity convert it to the correct
523 2004-04-27 Raja R Harinath <rharinath@novell.com>
525 * statement.cs (Block.Block): Implicit blocks share
526 'child_variable_names' fields with parent blocks.
527 (Block.AddChildVariableNames): Remove.
528 (Block.AddVariable): Mark variable as "used by a child block" in
529 every surrounding block.
530 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
531 been used in a child block, complain about violation of "Invariant
532 meaning in blocks" rule.
533 * cs-parser.jay (declare_local_variables): Don't use
534 AddChildVariableNames.
535 (foreach_statement): Don't create an implicit block: 'foreach'
538 2004-04-23 Miguel de Icaza <miguel@ximian.com>
540 * convert.cs (ImplicitNumericConversion): 0 is also positive when
541 converting from 0L to ulong. Fixes 57522.
543 2004-04-22 Marek Safar <marek.safar@seznam.cz>
545 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
546 derived class hides via 'new' keyword field from base class (test-242.cs).
547 TODO: Handle this in the more general way.
549 * class.cs (CheckBase): Ditto.
551 2004-04-22 Marek Safar <marek.safar@seznam.cz>
553 * decl.cs (caching_flags): New member for storing cached values
555 (MemberCore.Flags): New enum where bit flags for caching_flags
557 (MemberCore.cls_compliance): Moved to caching_flags.
558 (DeclSpace.Created): Moved to caching_flags.
560 * class.cs: Use caching_flags instead of DeclSpace.Created
562 2004-04-21 Miguel de Icaza <miguel@ximian.com>
564 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
565 if we are only a derived class, not a nested class.
567 * typemanager.cs: Same as above, but do this at the MemberLookup
568 level (used by field and methods, properties are handled in
569 PropertyExpr). Allow for the qualified access if we are a nested
572 2004-04-21 Marek Safar <marek.safar@seznam.cz>
574 * class.cs: Refactoring.
575 (IMethodData): New inteface; Holds links to parent members
576 to avoid member duplication (reduced memory allocation).
577 (Method): Implemented IMethodData interface.
578 (PropertyBase): New inner classes for get/set methods.
579 (PropertyBase.PropertyMethod): Implemented IMethodData interface
580 (Event): New inner classes for add/remove methods.
581 (Event.DelegateMethod): Implemented IMethodData interface.
583 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
584 EmitContext (related to class.cs refactoring).
586 2004-04-21 Raja R Harinath <rharinath@novell.com>
588 * delegate.cs (Delegate.VerifyApplicability): If the number of
589 arguments are the same as the number of parameters, first try to
590 verify applicability ignoring any 'params' modifier on the last
594 2004-04-08 Martin Baulig <martin@ximian.com>
596 Merged latest changes into gmcs. Please keep this comment in
597 here, it makes it easier for me to see what changed in MCS since
598 the last time I merged.
600 2004-04-16 Raja R Harinath <rharinath@novell.com>
602 * class.cs (TypeContainer.AddIndexer): Use
603 'ExplicitInterfaceName' to determine if interface name was
604 explicitly specified. 'InterfaceType' is not initialized at this time.
605 (TypeContainer.DefineIndexers): Remove use of temporary list. The
606 Indexers array is already in the required order. Initialize
607 'IndexerName' only if there are normal indexers.
608 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
609 (TypeContainer.Emit): Emit DefaultMember attribute only if
610 IndexerName is initialized.
613 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
615 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
618 2004-04-15 Raja R Harinath <rharinath@novell.com>
620 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
624 * attribute.cs (Attribute.Resolve): Check for duplicate named
628 2004-04-15 Miguel de Icaza <miguel@ximian.com>
630 * iterators.cs (MarkYield): track whether we are in an exception,
631 and generate code accordingly. Use a temporary value to store the
632 result for our state.
634 I had ignored a bit the interaction of try/catch with iterators
635 since their behavior was not entirely obvious, but now it is
636 possible to verify that our behavior is the same as MS .NET 2.0
640 2004-04-14 Miguel de Icaza <miguel@ximian.com>
642 * iterators.cs: Avoid creating temporaries if there is no work to
645 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
646 Enumerations, use TypeManager.EnumToUnderlying and call
649 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
652 (This.Emit): Use EmitContext.EmitThis to emit our
655 (This.EmitAssign): Ditto.
657 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
658 codepaths, we will move all the functionality into
661 (FieldExpr.EmitAssign): Ditto.
663 This fixes several hidden bugs that I uncovered while doing a code
664 review of this today.
666 * codegen.cs (EmitThis): reworked so the semantics are more clear
667 and also support value types "this" instances.
669 * iterators.cs: Changed so that for iterators in value types, we
670 do not pass the value type as a parameter.
672 Initialization of the enumerator helpers is now done in the caller
673 instead of passing the parameters to the constructors and having
674 the constructor set the fields.
676 The fields have now `assembly' visibility instead of private.
678 2004-04-11 Miguel de Icaza <miguel@ximian.com>
680 * expression.cs (Argument.Resolve): Check if fields passed as ref
681 or out are contained in a MarshalByRefObject.
683 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
684 another compiler type.
686 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
688 * class.cs (Indexer.Define): use the new name checking method.
689 Also, return false on an error.
690 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
691 (is_identifier_[start/part]_character): make static.
693 2004-04-10 Miguel de Icaza <miguel@ximian.com>
695 * expression.cs (Binary.ResolveOperator): Do no append strings
696 twice: since we can be invoked more than once (array evaluation)
697 on the same concatenation, take care of this here. Based on a fix
698 from Ben (bug #56454)
700 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
702 * codegen.cs: Fix another case where CS1548 must be reported (when
703 delay-sign isn't specified and no private is available #56564). Fix
704 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
705 error when MCS is used on the MS runtime and we need to delay-sign
706 (which seems unsupported by AssemblyBuilder - see #56621).
708 2004-04-08 Marek Safar <marek.safar@seznam.cz>
710 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
711 (TypeManager.ComputeNamespaces): Faster implementation for
714 * compiler.csproj: Updated AssemblyName to mcs.
716 2004-05-11 Jackson Harper <jackson@ximian.com>
718 * Makefile: Preserve MONO_PATH
720 2004-05-11 Jackson Harper <jackson@ximian.com>
722 * Makefile: Use mono and mcs to build gmcs
724 2004-05-03 Miguel de Icaza <miguel@ximian.com>
726 * codegen.cs: Add patch from Robert Shade
727 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
730 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
732 * CryptoConvert.cs: Updated to latest version. Fix issue with
733 incomplete key pairs (#57941).
735 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
737 * codegen.cs: Fix another case where CS1548 must be reported (when
738 delay-sign isn't specified and no private is available #56564). Fix
739 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
740 error when MCS is used on the MS runtime and we need to delay-sign
741 (which seems unsupported by AssemblyBuilder - see #56621).
743 2004-04-29 Jackson Harper <jackson@ximian.com>
745 * Makefile: Set MONO_PATH to use the bootstrap corlib
746 * driver.cs: Check the GAC for referenced assemblies.
748 2004-04-29 Martin Baulig <martin@ximian.com>
750 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
752 2004-04-07 Martin Baulig <martin@ximian.com>
754 * expression.cs (Binary.ResolveOperator): Added special case for
755 Equality/Inequality between a type parameter and a null literal.
757 2004-04-07 Martin Baulig <martin@ximian.com>
759 * convert.cs: Check null literal -> type parameter conversions.
761 2004-04-07 Martin Baulig <martin@ximian.com>
763 * generic.cs (ConstructedType.CheckConstraints): Enforce the
764 `class' and `struct' constraints.
766 2004-04-07 Martin Baulig <martin@ximian.com>
768 * generic.cs (SpecialConstraint): New public enum.
769 (Constraints.Resolve): Added support for the `class' and `struct'
772 * cs-parser.jay (type_parameter_constraint): Added support for the
773 `class' and `struct' constraints.
775 2004-04-07 Martin Baulig <martin@ximian.com>
777 * support.cs (GenericConstraints): Replaced `Types' by
778 `ClassConstraint' and `InterfaceConstraints'; added
779 `HasClassConstraint'.
781 2004-04-07 Martin Baulig <martin@ximian.com>
784 (Constraints.InterfaceConstraints): New public property.
785 (Constraints.Types): Make this property public
786 (TypeParameter): Implement IMemberContainer.
787 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
788 instead of a TypeBuilder/MethodBuilder; pass the interface
789 constraints to TypeManager.AddTypeParameter().
790 (TypeParameter.DefineType): Just take an EmitContext and no
791 TypeBuilder/MethodBuilder. Use the new public API.
793 * typemanager.cs (TypeManager.AddTypeParameter): Added
794 `TypeExpr[]' argument; add the interfaces to the
795 `builder_to_ifaces' hash.
796 (TypeManager.LookupMemberContainer): For
797 GenericTypeParameterBuilders, get the TypeParameter from the
798 `builder_to_type_param'.
799 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
800 the TypeParameter and call FindMembers on it.
802 2004-04-07 Martin Baulig <martin@ximian.com>
805 (MethodCore.GenericMethod): Moved this field here from Method.
806 (MethodCore.IsDuplicateImplementation): Take the number of type
807 parameters into account if we're a generic method.
809 * expression.cs (Invocation.InferTypeArguments): Don't return true
810 if `arguments' is null; we still need to check whether we actually
811 don't need to infer anything in this case.
812 (MemberAccess): Merged the functionality from GenericMemberAccess
815 * generic.cs (GenericMemberAccess): Removed.
817 2004-04-05 Martin Baulig <martin@ximian.com>
819 * decl.cs (MemberCore): For generic classes, interfaces and
820 structs, `Name' now includes the number of type parameters
822 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
823 encode the number of type arguments in the type name.
825 * expression.cs (Expression.MemberLookup): Removed the
826 `num_type_args' argument; we now encode the number of type
827 arguments in the type name.
829 * ecore.cs (SimpleName): Encode the number of type arguments in
830 the type name itself.
832 * generic.cs (ConstructedType): Likewise.
834 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
835 `MemberName'; we now include the number of type parameters in the
838 * typemanager.cs (TypeManager.CheckGeneric): Removed.
839 (TypeManager.MemberLookup): Removed the
840 `num_type_args' argument; we now encode the number of type
841 arguments in the type name.
843 2004-04-03 Martin Baulig <martin@ximian.com>
845 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
846 (MemberCore.MemberName): Moved here from MemberBase.
847 (DeclSpace.SetParameterInfo): Just take the constraints as an
848 ArrayList; we already have the type parameters in our
849 `MemberName'; also do the CS0080 reporting here.
851 * cs-parser.jay (struct_declaration): Use `member_name' instead of
852 `IDENTIFIER opt_type_parameter_list'; when constructing our
853 `MemberName', it'll already include our type parameters.
854 (class_declaration, interface_declaration): Likewise.
855 (delegate_declaration): Likewise.
856 (MakeName): Take a MemberName and return a MemberName.
857 The following two changes are required to avoid shift/reduce conflicts:
858 (member_name): Don't include a TypeName anymore; ie. this is now
859 just 'IDENTIFIER opt_type_parameter_list'.
860 (property_declaration, event_declaration): Use a
861 `namespace_or_type_name' instead of a `member_name'.
863 2004-04-03 Martin Baulig <martin@ximian.com>
865 * decl.cs (MemberName): Renamed to `TypeName' and created a new
867 (TypeName): Formerly known as MemberName.
869 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
870 instead of a `MemberName'.
872 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
873 (member_name): New rule; create a MemberName.
875 2004-04-02 Martin Baulig <martin@ximian.com>
877 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
880 2004-04-02 Martin Baulig <martin@ximian.com>
882 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
883 support for nested types.
885 2004-04-02 Martin Baulig <martin@ximian.com>
887 * ecore.cs (IAlias): New public interface.
888 (TypeExpr, TypeExpression): Implement IAlias.
889 (TypeAliasExpression): New public class.
891 * namespace.cs (Namespace): Implement IAlias.
892 (Namespace.Lookup): Return an IAlias instead on an object.
893 (Namespace.DefineName): Take an IAlias instead of an object.
894 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
896 (NamespaceEntry.UsingAlias): Take a Membername instead of an
898 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
900 (NamespaceEntry.Lookup): Likewise.
902 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
905 * decl.cs (DeclSpace): Implement IAlias.
906 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
908 * generic.cs (ConstructedType): Improved error checking.
910 2004-04-02 Martin Baulig <martin@ximian.com>
912 * convert.cs: Added type parameter conversions.
915 (UnboxCast.Emit): Emit an `unbox.any' for type params.
916 (ClassCast.Emit): If the source type is a type parameter, box it.
917 If the target type is a type parameter, emit an `unbox.any'
918 instead of a `classcast'.1
920 2004-04-01 Martin Baulig <martin@ximian.com>
922 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
924 2004-04-01 Martin Baulig <martin@ximian.com>
926 * expression.cs (Invocation.EmitCall): If we're invoking a method
927 on a type parameter, use the new `Constrained' prefix opcode.
929 2004-04-01 Martin Baulig <martin@ximian.com>
931 * generic.cs (ConstructedType.CheckConstraints): Use
932 Convert.ImplicitStandardConversionExists(); user-defined implicit
933 conversions are not allowed according to the spec.
935 2004-03-30 Martin Baulig <martin@ximian.com>
937 * expression.cs (New): Added support for type parameters.
940 (TypeManager.activator_type): New public static field.
941 (TypeManager.activator_create_instance): Likewise.
943 2004-03-30 Martin Baulig <martin@ximian.com>
945 * typemanager.cs (TypeManager.HasConstructorConstraint): New
948 2004-03-30 Martin Baulig <martin@ximian.com>
950 * generic.cs (ConstructedType.CheckConstraints): Actually follow
951 the spec here: the argument type must be convertible to the
954 2004-03-30 Martin Baulig <martin@ximian.com>
957 (TypeParameter.Define, TypeParameter.DefineMethod): Call
958 TypeManager.AddTypeParameter().
959 (ConstructedType.CheckConstraints): Re-enable this and actually
960 check whether we have a constructor constraint.
963 (TypeManager.builder_to_type_param): New static field.
964 (TypeManager.AddTypeParameter): New static method.
965 (TypeManager.LookupTypeParameter): New public method.
967 2004-03-30 Martin Baulig <martin@ximian.com>
969 * generic.cs (TypeParameter.DefineType): Return a boolean and use
970 the new API to actually define the constructor constraint.
973 (TypeManager.new_constraint_attr_type): New static field.
974 (TypeManager.InitCoreTypes): Initialize it.
976 2004-03-30 Martin Baulig <martin@ximian.com>
978 * generic.cs (Constraints): Completed error checking, use correct
981 2004-03-29 Martin Baulig <martin@ximian.com>
983 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
985 * expression.cs (Invocation.InferTypeArguments): Added overloaded
986 public version which takes a `ParameterData pd' instead of an
989 2004-03-29 Martin Baulig <martin@ximian.com>
991 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
994 2004-03-29 Martin Baulig <martin@ximian.com>
996 * expression.cs (Argument.ResolveMethodGroup): If we're a
997 ConstructedType, call GetMemberAccess() on it.
999 2004-03-29 Martin Baulig <martin@ximian.com>
1001 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
1002 (MethodCore.CheckGenericOverride): When overriding a generic
1003 method, check whether the constraints match.
1005 * support.cs (GenericConstraints): New public interface.
1006 (ParameterData.GenericConstraints): New public method.
1008 * parameter.cs (Parameter.Resolve): Check whether we're a generic
1009 method parameter and compute our constraints if appropriate.
1010 (Parameter.GenericConstraints): New public property.
1012 * generic.cs (Constraints): Implement GenericConstraints.
1014 2004-03-29 Martin Baulig <martin@ximian.com>
1016 * decl.cs (MemberCache.FindMemberToOverride): Use
1017 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
1019 2004-03-29 Martin Baulig <martin@ximian.com>
1021 * generic.cs (GenericMethod.Define): Resolve our type parameters.
1023 2004-03-29 Martin Baulig <martin@ximian.com>
1025 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
1026 not allowed on non-generic declarations").
1028 2004-03-29 Martin Baulig <martin@ximian.com>
1030 * expression.cs (Invocation.InferTypeArguments): Added overloaded
1031 public version of this method.
1033 * class.cs (MethodCore.IsDuplicateImplementation): Use
1034 Invocation.InferTypeArguments() to check this.
1036 2004-03-29 Martin Baulig <martin@ximian.com>
1038 * convert.cs: Use TypeManager.IsDelegateType() instead of
1039 comparing types correctly.
1041 2004-03-29 Martin Baulig <martin@ximian.com>
1043 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
1044 types directly to make it work for generic instances.
1046 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
1048 2004-03-29 Martin Baulig <martin@ximian.com>
1050 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
1053 2004-03-24 Martin Baulig <martin@ximian.com>
1055 * decl.cs (DeclSpace.FindType): Also use
1056 TypeManager.CheckGeneric() for types from the using clauses.
1058 2004-03-23 Martin Baulig <martin@ximian.com>
1060 * expression.cs (Invocation.OverloadResolve): Added `bool
1061 may_fail' argument and use it instead of the Location.IsNull() hack.
1063 2004-03-23 Martin Baulig <martin@ximian.com>
1065 * expression.cs (Invocation.InferType): Use correct type inference
1068 2004-03-23 Martin Baulig <martin@ximian.com>
1070 * ecore.cs (MethodGroupExpr.Name): Use
1071 TypeManager.CSharpSignature() instead of just the name.
1073 * expression.cs (Invocation.OverloadResolve): Provide better error
1075 (Invocation.DoResolve): OverloadResolve() never returns null
1076 without reporting an error, so removed the error -6 reporting here.
1078 2004-03-23 Martin Baulig <martin@ximian.com>
1080 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
1083 * cs-parser.jay (delegate_declaration): Support generic delegates.
1085 * delegate.cs: Support generic delegates.
1087 2004-03-22 Martin Baulig <martin@ximian.com>
1089 * expression.cs (Invocation.InferParamsTypeArguments): New static
1090 method; does type inference for params arguments.
1092 2004-03-21 Martin Baulig <martin@ximian.com>
1094 * typemanager.cs (TypeManager.IsGenericMethod): New public static
1095 method; checks whether a method is a generic method.
1097 * expression.cs (Invocation.InferTypeArguments): New static method;
1098 infer type arguments for generic method invocation.
1100 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
1101 property; we set this to true if we're resolving a generic method
1102 invocation and the user specified type arguments, ie. we're not
1103 doing type inference.
1105 2004-03-20 Martin Baulig <martin@ximian.com>
1107 * class.cs (MethodData.DeclaringType): New public property.
1108 (MethodData.Define): Set DeclaringType here.
1109 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
1110 instead of OperatorMethodBuilder.DeclaringType.
1112 2004-03-20 Martin Baulig <martin@ximian.com>
1114 * cs-tokenizer.cs (xtoken): Return a special
1115 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
1117 * cs-parser.jay (default_value_expression): Switch to the new
1120 2004-03-19 Martin Baulig <martin@ximian.com>
1122 * decl.cs (MemberName): New class. We use this to "construct"
1123 namespace_or_type_name's.
1125 * generics.cs (TypeArguments.GetDeclarations): New public method;
1126 returns the type arguments as a string[] and reports a CS0081 if
1127 one of them is not an identifier.
1129 * class.cs (MemberBase): The .ctor now takes the name as a
1130 MemberName instead of a string.
1131 (MemberBase.ExplicitInterfaceName): Changed type from string to
1133 (MemberBase.DoDefine): If we're an explicit implementation, the
1134 InterfaceType may be a generic instance.
1136 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
1137 (namespace_name): Call MemberName.GetName () to transform the
1138 MemberName into a string and ensure we don't have any type
1140 (type_name): Call MemberName.GetTypeExpression() to transfrom the
1141 MemberName into an expression.
1142 (method_header): Use namespace_or_type_name instead of member_name.
1144 2004-04-07 Miguel de Icaza <miguel@ximian.com>
1146 * rootcontext.cs: Add new types to the boot resolution.
1148 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
1149 MulticastDelegate is not allowed.
1151 * typemanager.cs: Add new types to lookup: System.TypedReference
1154 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
1155 check for TypedReference or ArgIterator, they are not allowed.
1157 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
1158 makes us properly catch 1510 in some conditions (see bug 56016 for
1161 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
1163 * CryptoConvert.cs: update from corlib version
1166 2004-04-05 Miguel de Icaza <miguel@ximian.com>
1168 * class.cs (Indexer.Define): Check indexername declaration
1170 2004-04-05 Marek Safar <marek.safar@seznam.cz>
1172 * attribute.cs (IsClsCompliant): Fixed problem with handling
1173 all three states (compliant, not-compliant, undetected).
1175 2004-03-30 Marek Safar <marek.safar@seznam.cz>
1177 * attribute.cs (Attribute): Location is now public.
1178 (Resolve): Store resolved arguments (pos_values) in attribute class.
1179 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
1180 (GetClsCompliantAttributeValue): New method that gets
1181 CLSCompliantAttribute value.
1182 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
1183 if exists else null.
1184 (AttributeTester): New class for CLS-Compliant verification routines.
1186 * class.cs (Emit): Add CLS-Compliant verification.
1187 (Method.GetSignatureForError): Implemented.
1188 (Constructor.GetSignatureForError): Implemented
1189 (Constructor.HasCompliantArgs): Returns if constructor has
1190 CLS-Compliant arguments.
1191 (Constructor.Emit): Override.
1192 (Construcor.IsIdentifierClsCompliant): New method; For constructors
1193 is needed to test only parameters.
1194 (FieldBase.GetSignatureForError): Implemented.
1195 (TypeContainer): New member for storing base interfaces.
1196 (TypeContainer.FindMembers): Search in base interfaces too.
1198 * codegen.cs (GetClsComplianceAttribute): New method that gets
1199 assembly or module CLSCompliantAttribute value.
1200 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
1202 (ModuleClass.Emit): Add error 3012 test.
1204 * const.cs (Emit): Override and call base for CLS-Compliant tests.
1206 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
1207 state for all decl types.
1208 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
1209 if CLS-Compliant tests are required.
1210 (IsClsCompliaceRequired): New method. Analyze whether code
1211 must be CLS-Compliant.
1212 (IsExposedFromAssembly): New method. Returns true when MemberCore
1213 is exposed from assembly.
1214 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
1215 value or gets cached value.
1216 (HasClsCompliantAttribute): New method. Returns true if MemberCore
1217 is explicitly marked with CLSCompliantAttribute.
1218 (IsIdentifierClsCompliant): New abstract method. This method is
1219 used to testing error 3005.
1220 (IsIdentifierAndParamClsCompliant): New method. Common helper method
1221 for identifier and parameters CLS-Compliant testing.
1222 (VerifyClsCompliance): New method. The main virtual method for
1223 CLS-Compliant verifications.
1224 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
1225 null. I don't know why is null (too many public members !).
1226 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
1227 and get value of first CLSCompliantAttribute that found.
1229 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
1230 (VerifyClsCompliance): Override and add extra tests.
1232 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
1233 clscheck- disable CLS-Compliant verification event if assembly is has
1234 CLSCompliantAttribute(true).
1236 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
1237 ApllyAttribute is now called in emit section as in the other cases.
1238 Possible future Emit integration.
1239 (IsIdentifierClsCompliant): New override.
1240 (VerifyClsCompliance): New override.
1241 (GetEnumeratorName): Returns full enum name.
1243 * parameter.cs (GetSignatureForError): Implemented.
1245 * report.cs (WarningData): New struct for Warning message information.
1246 (LocationOfPreviousError): New method.
1247 (Warning): New method. Reports warning based on the warning table.
1248 (Error_T): New method. Reports error based on the error table.
1250 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
1251 verifications are done here.
1253 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
1255 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
1256 CLSCompliantAttribute.
1257 (all_imported_types): New member holds all imported types from other
1259 (LoadAllImportedTypes): New method fills static table with exported types
1260 from all referenced assemblies.
1261 (Modules): New property returns all assembly modules.
1263 2004-03-30 Miguel de Icaza <miguel@ximian.com>
1265 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
1266 throwing a parser error.
1268 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
1269 which removes the hardcoded get_/set_ prefixes for properties, as
1270 IL allows for the properties to be named something else.
1274 * expression.cs: Do not override operand before we know if it is
1277 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1279 * typemanager.cs: support for pinned variables.
1281 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1283 * decl.cs, typemanager.cs: Avoid using an arraylist
1284 as a buffer if there is only one result set.
1286 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
1288 * expression.cs: Make sure you cant call a static method
1289 with an instance expression, bug #56174.
1291 2004-03-29 Miguel de Icaza <miguel@ximian.com>
1293 * class.cs (IsDuplicateImplementation): Improve error reporting to
1294 flag 663 (method only differs in parameter modifier).
1296 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
1297 in preprocessor directives.
1299 * location.cs (LookupFile): Allow for the empty path.
1301 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
1302 better approach for some of that patch, but its failing with the
1303 CharSet enumeration. For now try/catch will do.
1305 * typemanager.cs: Do not crash if a struct does not have fields.
1308 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1310 * expression.cs: cs0213, cant fix a fixed expression.
1313 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1315 * cs-parser.jay: detect invalid embeded statements gracefully.
1318 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
1320 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
1323 the invocation type may not be a subclass of the tye of the item/
1324 The type of the item must be a subclass of the invocation item.
1329 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
1331 * attribute.cs: Added methods to get a string and a bool from an
1332 attribute. Required to information from AssemblyKeyFileAttribute,
1333 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
1334 * codegen.cs: Modified AssemblyName creation to include support for
1335 strongnames. Catch additional exceptions to report them as CS1548.
1336 * compiler.csproj: Updated include CryptoConvert.cs.
1337 * compiler.csproj.user: Removed file - user specific configuration.
1338 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
1339 Mono.Security assembly. The original class is maintained and tested in
1340 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
1341 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
1342 like CSC 8.0 (C# v2) supports.
1343 * Makefile: Added CryptoConvert.cs to mcs sources.
1344 * rootcontext.cs: Added new options for strongnames.
1346 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
1348 * driver.cs: For --expect-error, report error code `2'
1349 if the program compiled with no errors, error code `1' if
1350 it compiled with an error other than the one expected.
1352 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
1354 * compiler.csproj: Updated for Visual Studio .NET 2003.
1355 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
1356 * compiler.sln: Updated for Visual Studio .NET 2003.
1358 2004-03-24 Ravi Pratap M <ravi@ximian.com>
1360 * expression.cs: Fix bug #47234. We basically need to apply the
1361 rule that we prefer the conversion of null to a reference type
1362 when faced with a conversion to 'object' (csc behaviour).
1364 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1366 * statement.cs: Shorter form for foreach, eliminates
1367 a local variable. r=Martin.
1369 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1371 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
1372 checks if we can use brtrue/brfalse to test for 0.
1373 * expression.cs: use the above in the test for using brtrue/brfalse.
1376 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1378 * expression.cs: Rewrite string concat stuff. Benefits:
1380 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
1381 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
1382 rather than a concat chain.
1384 * typemanager.cs: Add lookups for more concat overloads.
1386 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
1388 * expression.cs: Emit shorter il code for array init.
1405 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
1407 * statement.cs: Before, two switch blocks would be merged if the
1408 total size of the blocks (end_item - begin_item + 1) was less than
1409 two times the combined sizes of the blocks.
1411 Now, it will only merge if after the merge at least half of the
1416 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
1418 * class.cs : csc build fix for GetMethods(). See bug #52503.
1420 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
1422 * expression.cs: Make sure fp comparisons work with NaN.
1423 This fixes bug #54303. Mig approved this patch a long
1424 time ago, but we were not able to test b/c the runtime
1427 2004-03-19 Miguel de Icaza <miguel@ximian.com>
1429 * ecore.cs (TypExpr.GetHashCode): implement this overload.
1431 2004-03-19 Martin Baulig <martin@ximian.com>
1433 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
1434 two overloads may unify for some type parameter substitutions and
1435 report a CS0408 if appropriate.
1437 2004-03-19 Martin Baulig <martin@ximian.com>
1439 * class.cs (MemberCore.IsDuplicateImplementation): Report the
1440 error here and not in our caller.
1442 2004-03-19 Martin Baulig <martin@ximian.com>
1444 * interface.cs: Completely killed this file.
1445 (Interface): We're now a TypeContainer and live in class.cs.
1447 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
1448 argument; we're now also called for interfaces.
1449 (TypeContainer.DefineMembers): Allow this method being called
1451 (TypeContainer.GetMethods): New public method; formerly known as
1452 Interface.GetMethod(). This is used by PendingImplementation.
1453 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
1454 it's now private and non-static.
1455 (Interface): Moved this here; it's now implemented similar to
1457 (Method, Property, Event, Indexer): Added `bool is_interface'
1458 argument to their .ctor's.
1459 (MemberBase.IsInterface): New public field.
1461 * cs-parser.jay: Create normal Method, Property, Event, Indexer
1462 instances instead of InterfaceMethod, InterfaceProperty, etc.
1463 (opt_interface_base): Removed; we now use `opt_class_base' instead.
1464 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
1466 2004-03-19 Martin Baulig <martin@ximian.com>
1468 * class.cs (MethodCore.IsDuplicateImplementation): New private
1469 method which does the CS0111 checking.
1470 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
1471 Use IsDuplicateImplementation().
1473 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
1475 * decl.cs (FindMemberToOverride): New method to find the correct
1476 method or property to override in the base class.
1478 - Make Method/Property use the above method to find the
1479 version in the base class.
1480 - Remove the InheritableMemberSignatureCompare as it is now
1483 This patch makes large code bases much faster to compile, as it is
1484 O(n) rather than O(n^2) to do this validation.
1486 Also, it fixes bug 52458 which is that nested classes are not
1487 taken into account when finding the base class member.
1489 Reviewed/Approved by Martin.
1491 2004-03-17 Martin Baulig <martin@ximian.com>
1493 * expression.cs (MemberAccess.DoResolve): Take the parent's number
1494 of type arguments into account; use the `real_num_type_args'
1495 approach like in DoResolveAsTypeStep().
1497 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
1500 2004-03-17 Marek Safar <marek.safar@seznam.cz>
1502 * interface.cs: In all interface classes removed redundant
1503 member initialization.
1505 2004-03-16 Martin Baulig <martin@ximian.com>
1507 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1509 2004-03-15 Miguel de Icaza <miguel@ximian.com>
1511 * decl.cs (DefineTypeAndParents): New helper method to define a
1512 type's containers before the type itself is defined; This is a
1513 bug exposed by the recent changes to Windows.Forms when an
1514 implemented interface was defined inside a class that had not been
1517 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
1519 (Check): Loop correctly to report errors modifiers
1520 (UNSAFE was not in the loop, since it was the same as TOP).
1522 * interface.cs: Every interface member now takes a ModFlags,
1523 instead of a "is_new" bool, which we set on the base MemberCore.
1525 Every place where we called "UnsafeOk" in the interface, now we
1526 call the proper member (InterfaceMethod.UnsafeOK) instead to get
1527 the unsafe settings from the member declaration instead of the
1528 container interface.
1530 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
1532 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1533 `set_indexer_name' to the pending bits (one per type).
1535 We fixed a bug today that was picking the wrong method to
1536 override, since for properties the existing InterfaceMethod code
1537 basically ignored the method name. Now we make sure that the
1538 method name is one of the valid indexer names.
1540 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
1542 * support.cs (SeekableStreamReader): Keep track of stream byte
1543 positions and don't mix them with character offsets to the buffer.
1545 Patch from Gustavo Giráldez
1547 2004-03-15 Marek Safar <marek.safar@seznam.cz>
1549 * interface.cs (InterfaceSetGetBase): Removed double member
1550 initialization, base class does it as well.
1552 2004-03-13 Martin Baulig <martin@ximian.com>
1554 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
1555 when compiling corlib.
1557 2004-03-13 Miguel de Icaza <miguel@ximian.com>
1559 * convert.cs (ExplicitConversion): We were reporting an error on
1560 certain conversions (object_type source to a value type, when the
1561 expression was `null') before we had a chance to pass it through
1562 the user defined conversions.
1564 * driver.cs: Replace / and \ in resource specifications to dots.
1567 * class.cs: Add check for duplicate operators. Fixes 52477
1569 2004-03-11 Miguel de Icaza <miguel@ximian.com>
1571 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
1572 that are in the middle of the statements, not only at the end.
1575 * class.cs (TypeContainer.AddField): No longer set the
1576 `HaveStaticConstructor' flag, now we call it
1577 `UserDefineStaticConstructor' to diferentiate the slightly
1578 semantic difference.
1580 The situation is that we were not adding BeforeFieldInit (from
1581 Modifiers.TypeAttr) to classes that could have it.
1582 BeforeFieldInit should be set to classes that have no static
1587 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
1589 And most importantly Zoltan's comment:
1591 http://bugzilla.ximian.com/show_bug.cgi?id=44229
1593 "I think beforefieldinit means 'it's ok to initialize the type sometime
1594 before its static fields are used', i.e. initialization does not need
1595 to be triggered by the first access to the type. Setting this flag
1596 helps the JIT to compile better code, since it can run the static
1597 constructor at JIT time, and does not need to generate code to call it
1598 (possibly lots of times) at runtime. Unfortunately, mcs does not set
1599 this flag for lots of classes like String.
1601 csc sets this flag if the type does not have an explicit static
1602 constructor. The reasoning seems to be that if there are only static
1603 initalizers for a type, and no static constructor, then the programmer
1604 does not care when this initialization happens, so beforefieldinit
1607 This bug prevents the AOT compiler from being usable, since it
1608 generates so many calls to mono_runtime_class_init that the AOT code
1609 is much slower than the JITted code. The JITted code is faster,
1610 because it does not generate these calls if the vtable is type is
1611 already initialized, which is true in the majority of cases. But the
1612 AOT compiler can't do this."
1614 2004-03-10 Miguel de Icaza <miguel@ximian.com>
1616 * class.cs (MethodData.Emit): Refactor the code so symbolic
1617 information is generated for destructors; For some reasons we
1618 were taking a code path that did not generate symbolic information
1621 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
1623 * class.cs: Create a Constructor.CheckBase method that
1624 takes care of all validation type code. The method
1625 contains some code that was moved from Define.
1627 It also includes new code that checks for duplicate ctors.
1628 This fixes bug #55148.
1630 2004-03-09 Joshua Tauberer <tauberer@for.net>
1632 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
1633 a { ... }-style array creation invokes EmitStaticInitializers
1634 which is not good for reference-type arrays. String, decimal
1635 and now null constants (NullCast) are not counted toward
1636 static initializers.
1638 2004-03-05 Martin Baulig <martin@ximian.com>
1640 * location.cs (SourceFile.HasLineDirective): New public field;
1641 specifies whether the file contains or is referenced by a "#line"
1643 (Location.DefineSymbolDocuments): Ignore source files which
1644 either contain or are referenced by a "#line" directive.
1646 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
1648 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
1649 direct access to our parent, so check the method inline there.
1651 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
1653 * expression.cs (Invocation.EmitCall): Miguel's last commit
1654 caused a regression. If you had:
1659 In Foo the implict this would be null.
1661 2004-02-27 Miguel de Icaza <miguel@ximian.com>
1663 * expression.cs (Invocation.EmitCall): If the method is not
1664 virtual, do not emit a CallVirt to it, use Call.
1666 * typemanager.cs (GetFullNameSignature): Improve the method to
1667 cope with ".ctor" and replace it with the type name.
1669 * class.cs (ConstructorInitializer.Resolve): Now the method takes
1670 as an argument the ConstructorBuilder where it is being defined,
1671 to catch the recursive constructor invocations.
1673 2004-03-16 Martin Baulig <martin@ximian.com>
1675 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
1676 ConstructedType, call ResolveType() on it to get the type rather
1677 than just using `expr.Type'.
1679 2004-03-16 Martin Baulig <martin@ximian.com>
1681 * generics.cs (ConstructedType.GetMemberAccess): Take the
1682 EmitContext instead on the TypeExpr and use
1683 ec.TypeContainer.CurrentType/ec.ContainerType.
1685 2004-03-16 Martin Baulig <martin@ximian.com>
1687 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
1688 parameters before aliases.
1690 2004-03-16 Martin Baulig <martin@ximian.com>
1692 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
1693 New oublic function; checks whether two generic instances may become
1694 equal under some instantiations (26.3.1).
1696 * class.cs (TypeContainer.Define): Call
1697 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
1700 2004-03-16 Martin Baulig <martin@ximian.com>
1702 * class.cs (TypeContainer.GetClassBases): Moved
1703 Error_TypeParameterAsBase() here and also check whether the base
1704 class is not an attribute.
1706 2004-03-16 Martin Baulig <martin@ximian.com>
1708 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1710 2004-03-16 Martin Baulig <martin@ximian.com>
1712 * class.cs (Error_TypeParameterAsBase): Use correct error number
1715 2004-03-16 Martin Baulig <martin@ximian.com>
1717 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
1720 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
1723 2004-03-15 Martin Baulig <martin@ximian.com>
1725 * typemanager.cs (TypeManager.GetFullName): New public method.
1726 (TypeManager.MemberLookup): Added `int_num_type_arguments'
1727 argument; only return members with the correct number of type
1729 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
1730 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
1731 whether the number of type arguments matches.
1733 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
1734 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
1736 * expression.cs (MemberAccess): Added public `NumTypeArguments'
1737 field; it's set by the protected .ctor when we're actually a
1738 GenericMemberAccess.
1739 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
1740 arguments and pass it to MemberLookupFinal ().
1742 * ecore.cs (Expression.MemberLookup): Added `int
1743 num_type_arguments' argument; only return members with the correct
1744 number of type arguments.
1745 (Expression.MemberLookupFailed): Check whether the MemberLookup
1746 failed because we did not have the correct number of type
1747 arguments; report CS0305 in this case.
1749 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
1750 `e.ResolveAsTypeTerminal()' already did so.
1752 2004-03-15 Martin Baulig <martin@ximian.com>
1754 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
1755 we're a ConstructedType; in this case, the caller must report an
1756 error (for instance CS0131).
1758 * generic.cs (TypeArguments): Added Location argument to the .ctor.
1759 (TypeArguments.Resolve): Actually report errors here.
1761 2004-03-15 Miguel de Icaza <miguel@ximian.com>
1763 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1764 `set_indexer_name' to the pending bits (one per type).
1766 We fixed a bug today that was picking the wrong method to
1767 override, since for properties the existing InterfaceMethod code
1768 basically ignored the method name. Now we make sure that the
1769 method name is one of the valid indexer names.
1771 2004-03-15 Martin Baulig <martin@ximian.com>
1773 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
1774 for generic instances.
1776 2004-03-13 Martin Baulig <martin@ximian.com>
1778 * class.cs (TypeContainer.DefineType): Call
1779 TypeManager.AddUserType() immediately after creating the
1780 TypeBuilder; pass all type parameters when creating the
1783 * decl.cs (DeclSpace.FindNestedType): New public method.
1784 (DeclSpace.FindType): Added `int num_type_args' argument; only
1785 return types with the correct number of type parameters.
1786 (DeclSpace.CountTypeParams): New public property.
1788 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
1789 the number of type parameters; defaults to zero.
1791 * generic.cs (TypeArguments.Count): New public property.
1792 (ConstructedType.DoResolveAsTypeStep): First call
1793 ds.FindNestedType() to find out whether we're nested in the
1794 current generic type; in this case, we inherit all type parameters
1795 from the current class.
1797 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
1798 num_type_args' argument.
1799 (RootContext.LookupType): Added overloaded version which takes the
1800 number of type arguments; only return types with the correct
1801 number of type arguments.
1803 * typemanager.cs (TypeManager.CheckGeneric): New public function;
1804 checks whether `Type t' has `int num_type_args'.
1806 2004-03-13 Martin Baulig <martin@ximian.com>
1808 * generic.cs (GenericMethod.DefineType): New method; calls
1809 DefineType() on all the type parameters.
1811 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
1812 (MethodData.Define): If we're a generic method, call
1813 GenericMethod.DefineType() to define the type parameters.
1815 2004-03-10 Martin Baulig <martin@ximian.com>
1817 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
1818 instead of IsAssignableFrom.
1820 2004-03-10 Martin Baulig <martin@ximian.com>
1822 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
1824 * support.cs (ParameterData.HasArrayParameter): New property.
1825 (ReflectionParameters.ctor): Take a MethodBase instead of a
1826 ParameterInfo[]. If we have any type parameters, get the generic
1827 method definition and ask it whether we have variable arguments.
1829 2004-02-26 Miguel de Icaza <miguel@ximian.com>
1831 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
1832 routines to check if a type is an enumerable/enumerator allow
1833 classes that implement the IEnumerable or IEnumerator interfaces.
1835 * class.cs (Property, Operator): Implement IIteratorContainer, and
1836 implement SetYields.
1838 (Property.Define): Do the block swapping for get_methods in the
1839 context of iterators. We need to check if Properties also
1840 include indexers or not.
1842 (Operator): Assign the Block before invoking the
1843 OperatorMethod.Define, so we can trigger the Iterator code
1846 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
1847 Property and Operator classes are not created when we parse the
1848 declarator but until we have the block completed, so we use a
1849 singleton SimpleIteratorContainer.Simple to flag whether the
1850 SetYields has been invoked.
1852 We propagate this setting then to the Property or the Operator to
1853 allow the `yield' to function.
1855 2004-02-25 Marek Safar <marek.safar@seznam.cz>
1857 * codegen.cs: Implemented attribute support for modules.
1858 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
1859 Assembly/Module functionality.
1861 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
1862 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
1863 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
1865 2004-02-16 Marek Safar <marek.safar@seznam.cz>
1867 * interface.cs (FindMembers): The operation is performed on all base
1868 interfaces and not only on the first. It is required for future CLS Compliance patch.
1870 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
1872 * statement.cs, codegen.cs:
1873 This patch deals with patterns such as:
1875 public class List : IEnumerable {
1877 public MyEnumerator GetEnumerator () {
1878 return new MyEnumerator(this);
1881 IEnumerator IEnumerable.GetEnumerator () {
1885 public struct MyEnumerator : IEnumerator {
1890 Before, there were a few things we did wrong:
1891 1) we would emit callvirt on a struct, which is illegal
1892 2) we emited ldarg when we needed to emit ldarga
1893 3) we would mistakenly call the interface methods on an enumerator
1894 type that derived from IEnumerator and was in another assembly. For example:
1896 public class MyEnumerator : IEnumerator
1898 Would have the interface methods called, even if there were public impls of the
1899 method. In a struct, this lead to invalid IL code.
1901 2004-02-11 Marek Safar <marek.safar@seznam.cz>
1903 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
1906 * delegate.cs (Define): Fixed crash when delegate type is undefined.
1908 2004-02-11 Miguel de Icaza <miguel@ximian.com>
1910 * cs-parser.jay: Fix small regression: we were not testing V2
1911 compiler features correctly.
1913 * interface.cs: If the emit context is null, then create one
1915 2004-02-09 Marek Safar <marek.safar@seznam.cz>
1917 * decl.cs (GetSignatureForError): New virtual method to get full name
1920 * attribute.cs (IAttributeSupport): New interface for attribute setting.
1921 Now it is possible to rewrite ApplyAttributes method to be less if/else.
1923 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
1924 Duplicated members and code in these classes has been removed.
1925 Better encapsulation in these classes.
1927 2004-02-07 Miguel de Icaza <miguel@ximian.com>
1929 * assign.cs (Assign.DoResolve): When dealing with compound
1930 assignments, there is a new rule in ECMA C# 2.4 (might have been
1931 there before, but it is documented here) that states that in:
1935 If b is of type int, and the `op' is a shift-operator, then the
1936 above is evaluated as:
1940 * expression.cs (Binary.ResolveOperator): Instead of testing for
1941 int/uint/long/ulong, try to implicitly convert to any of those
1942 types and use that in pointer arithmetic.
1944 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
1945 method to print information for from the type, not from the
1946 null-method we were given.
1948 2004-02-01 Duncan Mak <duncan@ximian.com>
1950 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
1951 parsing for cmd, fixes bug #53694.
1953 2004-02-04 Marek Safar <marek.safar@seznam.cz>
1955 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
1956 in the member name duplication tests. Property and operator name duplication
1957 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
1959 2004-02-03 Marek Safar <marek.safar@seznam.cz>
1961 * interface.cs (PopulateMethod): Fixed crash when interface method
1962 returns not existing type (error test cs0246-3.cs).
1964 2004-02-02 Ravi Pratap M <ravi@ximian.com>
1966 * cs-parser.jay (interface_accessors): Re-write actions to also
1967 store attributes attached to get and set methods. Fix spelling
1970 (inteface_property_declaration): Modify accordingly.
1972 (InterfaceAccessorInfo): New helper class to store information to pass
1973 around between rules that use interface_accessors.
1975 * interface.cs (Emit): Apply attributes on the get and set
1976 accessors of properties and indexers too.
1978 * attribute.cs (ApplyAttributes): Modify accordingly to use the
1979 right MethodBuilder when applying attributes to the get and set accessors.
1981 2004-01-31 Miguel de Icaza <miguel@ximian.com>
1983 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
1985 2004-01-26 Miguel de Icaza <miguel@ximian.com>
1987 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
1989 2004-01-25 Miguel de Icaza <miguel@ximian.com>
1991 * cs-parser.jay: Remove YIELD token, instead use the new grammar
1992 changes that treat `yield' specially when present before `break'
1995 * cs-tokenizer.cs: yield is no longer a keyword.
1997 2004-01-23 Marek Safar <marek.safar@seznam.cz>
1999 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
2000 setting for default constructors.
2001 For default constructors are almost every time set wrong Modifier. The
2002 generated IL code has been alright. But inside mcs this values was
2003 wrong and this was reason why several of my CLS Compliance tests
2006 2004-02-27 Martin Baulig <martin@ximian.com>
2008 * generics.cs (ConstructedType.ResolveType): Make the nested type
2009 stuff actually work.
2011 2004-02-25 Martin Baulig <martin@ximian.com>
2013 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
2014 property; returns the type parameters just from the current type,
2015 ie. with the ones from outer classes.
2016 (DeclSpace.LookupGeneric): First search in the current class, then
2018 (DeclSpace.initialize_type_params): When hiding a type parameter
2019 from an outer class, put it into the `type_param_list' anyways.
2021 * expression.cs (MemberAccess.expr): Made this field protected.
2023 * class.cs (TypeContainer.Define): The `CurrentType' just contains
2024 the type parameters from the current class.
2026 * generic.cs (ConstructedType.ResolveType): Support nested generic
2027 types by taking the type parameters which we inherit from outer
2028 classes into account.
2029 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
2030 support for nested generic types.
2032 2004-02-23 Martin Baulig <martin@ximian.com>
2034 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
2035 field and check whether we're nested inside a generic type.
2036 (DeclSpace.ResolveType): If we're resolving to a generic type
2037 definition, create a ConstructedType and return its resolved type.
2038 (DeclSpace.initialize_type_params): New private method;
2039 initializes the `type_param_list' field from the type parameters
2040 from this and all enclosing classes.
2041 (DeclSpace.TypeParameters): Call initialize_type_params() unless
2042 we're already initialized.
2044 2004-02-23 Martin Baulig <martin@ximian.com>
2046 * class.cs (Method.Define): Create the generic method before
2048 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
2049 the TypeContainer one); we use this for generic methods.
2051 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
2052 parent's TypeBuilder.
2054 2004-02-18 Martin Baulig <martin@ximian.com>
2056 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
2057 to check for equality.
2059 2004-02-05 Martin Baulig <martin@ximian.com>
2061 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
2062 `ec.TypeContainer.CurrentType', use it instead of
2063 `ec.ContainerType' to check whether we're in the type's ctor.
2065 2004-01-29 Martin Baulig <martin@ximian.com>
2067 * expression.cs (Invocation.DoResolve): If we're a
2068 `ConstructedType', then we're actually a generic method, so
2069 rewrite the expr as a GenericMemberAccess.
2071 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
2072 here; manually parse it into a string.
2074 2004-01-28 Martin Baulig <martin@ximian.com>
2076 * typemanager.cs (TypeManager.IsEqual): New static method.
2077 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
2078 check for equality instead of using `=='.
2080 2004-01-26 Martin Baulig <martin@ximian.com>
2082 * decl.cs (DeclSpace.CurrentType): New public field.
2084 * expression.cs (This.ResolveBase): If we have an
2085 `ec.TypeContainer.CurrentType', use it instead of
2088 * class.cs (TypeContainer.DefineType): If we're a generic type,
2089 create the `CurrentType' (unresolved).
2090 (TypeContainer.GenericType): New private field.
2091 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
2092 it and store it in `GenericType' before creating the MemberCache.
2093 (TypeContainer.GetMembers): If we have a `GenericType', call
2094 TypeManager.FindMembers() on it.
2096 * interface.cs (Interface.GenericType): New private field.
2097 (Interface.DefineType): If we're a generic type, create the
2098 `CurrentType' (unresolved).
2099 (Interface.DefineMembers): If we have a `CurrentType', resolve it
2100 and store it in `GenericType' before creating the MemberCache.
2101 (Interface.GetMembers): If we have a `GenericType', call
2102 TypeManager.FindMembers() on it.
2104 2004-01-22 Martin Baulig <martin@ximian.com>
2106 * cs-parser.jay (namespace_or_type_name): Return an Expression,
2107 not a QualifiedIdentifier. This is what `type_name_expression'
2108 was previously doing.
2109 (type_name_expression): Removed; the code is now in
2110 `namespace_or_type_name'.
2111 (qualified_identifier): Removed, use `namespace_or_type_name'
2113 (QualifiedIdentifier): Removed this class.
2115 2004-01-22 Martin Baulig <martin@ximian.com>
2117 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
2118 not a string as alias name.
2120 2004-01-21 Miguel de Icaza <miguel@ximian.com>
2122 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
2123 #52730 bug, and instead compute correctly the need to use a
2124 temporary variable when requesting an address based on the
2125 static/instace modified of the field and the constructor.
2127 2004-01-21 Martin Baulig <martin@ximian.com>
2129 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
2130 class and namespace before looking up aliases. Fixes #52517.
2132 2004-01-21 Martin Baulig <martin@ximian.com>
2134 * flowanalysis.cs (UsageVector.Merge): Allow variables being
2135 assinged in a 'try'; fixes exception4.cs.
2137 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2138 * class.cs : Implemented parameter-less constructor for TypeContainer
2140 * decl.cs: Attributes are now stored here. New property OptAttributes
2142 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
2144 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
2146 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2148 * typemanager.cs (CSharpSignature): Now reports also inner class name.
2149 (CSharpSignature): New method for indexer and property signature.
2151 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2153 * pending.cs (IsVirtualFilter): Faster implementation.
2155 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2157 * typemanager.cs: Avoid inclusion of same assembly more than once.
2159 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2161 * cs-parser.jay: Fixed problem where the last assembly attribute
2162 has been applied also to following declaration (class, struct, etc.)
2164 2004-01-21 Marek Safar <marek.safar@seznam.cz>
2166 * class.cs: Added error CS0538, CS0539 reporting.
2167 Fixed crash on Microsoft runtime when field type is void.
2169 * cs-parser.jay: Added error CS0537 reporting.
2171 * pending.cs: Added error CS0535 reporting.
2172 Improved error report for errors CS0536, CS0534.
2174 2004-01-20 Miguel de Icaza <miguel@ximian.com>
2176 Merge a few bits from the Anonymous Method MCS tree.
2178 * statement.cs (ToplevelBlock): New class for toplevel methods,
2179 will hold anonymous methods, lifted variables.
2181 * cs-parser.jay: Create toplevel blocks for delegates and for
2182 regular blocks of code.
2184 2004-01-20 Martin Baulig <martin@ximian.com>
2186 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
2187 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
2188 and `NeedExplicitReturn'; added `IsLastStatement'.
2189 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
2190 have a `ReturnLabel' or we're not unreachable.
2192 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
2193 child's reachability; don't just override ours with it. Fixes
2194 #58058 (lluis's example).
2195 (FlowBranching): Added public InTryOrCatch(), InCatch(),
2196 InFinally(), InLoop(), InSwitch() and
2197 BreakCrossesTryCatchBoundary() methods.
2199 * statement.cs (Return): Do all error checking in Resolve().
2200 Unless we are the last statement in a top-level block, always
2201 create a return label and jump to it.
2202 (Break, Continue): Do all error checking in Resolve(); also make
2203 sure we aren't leaving a `finally'.
2204 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
2205 statement in a top-level block.
2206 (Block.Flags): Added `IsDestructor'.
2207 (Block.IsDestructor): New public property.
2209 2004-01-20 Martin Baulig <martin@ximian.com>
2211 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
2213 2004-01-20 Martin Baulig <martin@ximian.com>
2215 * statement.cs (Statement.ResolveUnreachable): New public method.
2216 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
2217 (Block.Resolve): Resolve unreachable statements.
2219 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
2221 * expression.cs: We need to fix the case where we do
2222 not have a temp variable here.
2224 * assign.cs: Only expression compound assignments need
2225 temporary variables.
2227 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
2229 * flowanalysis.cs: Reduce memory allocation in a few ways:
2230 - A block with no variables should not allocate a bit
2232 - A method with no out parameters does not need any tracking
2233 for assignment of the parameters, so we need not allocate
2236 public readonly Type[] VariableTypes;
2237 public readonly string[] VariableNames;
2238 Are redundant. The data is already stored in the variable
2239 map, so we need not allocate another array for it.
2240 - We need to add alot of checks for if (params | locals) == null
2241 due to the first two changes.
2243 2004-01-18 Miguel de Icaza <miguel@ximian.com>
2245 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
2246 implement IMemoryLocation, we store a copy on a local variable and
2247 take the address of it. Patch from Benjamin Jemlich
2249 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
2250 to use a special "type_name_expression" rule which reduces the
2251 number of "QualifiedIdentifier" classes created, and instead
2252 directly creates MemberAccess expressions.
2254 2004-01-17 Miguel de Icaza <miguel@ximian.com>
2256 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
2257 that fixes #52853. Null literal assignment to ValueType
2259 * class.cs (MethodData.Emit): Instead of checking the name of the
2260 method to determine if its a destructor, create a new derived
2261 class from Method called Destructor, and test for that.
2263 * cs-parser.jay: Create a Destructor object instead of a Method.
2265 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
2269 2004-01-16 Miguel de Icaza <miguel@ximian.com>
2271 * expression.cs (Binary.ResolveOperator): Perform an implicit
2272 conversion from MethodGroups to their delegate types on the
2275 * delegate.cs: Introduce a new class DelegateCreation that is the
2276 base class for `NewDelegate' and `ImplicitDelegateCreation',
2277 factor some code in here.
2279 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
2280 conversion from MethodGroups to compatible delegate types.
2282 * ecore.cs (Expression.Resolve): Do not flag error 654
2283 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
2284 we allow conversions from MethodGroups to delegate types now.
2286 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
2287 assignments in v2 either.
2289 2004-01-10 Miguel de Icaza <miguel@ximian.com>
2291 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
2292 static read-only fields in ctors.
2294 Applied patch from Benjamin Jemlich
2296 * expression.cs (UnaryMutator): Avoid leaking local variables.
2298 2004-01-09 Miguel de Icaza <miguel@ximian.com>
2300 * cs-tokenizer.cs (IsCastToken): Allow the various native types
2301 here to return true, as they can be used like this:
2305 Fixed 49836 and all the other dups
2307 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
2309 * driver.cs: Implement /win32res and /win32icon.
2311 2004-01-08 Miguel de Icaza <miguel@ximian.com>
2313 * cs-parser.jay: Add a rule to improve error handling for the
2314 common mistake of placing modifiers after the type.
2316 2004-01-07 Miguel de Icaza <miguel@ximian.com>
2318 * cs-parser.jay (interface_event_declaration): Catch
2319 initialization of events on interfaces, and report cs0068
2321 * cs-parser.jay (interface_event_declaration): Catch
2322 initialization of events.
2324 * ecore.cs: Better report missing constructors.
2326 * expression.cs (Binary.ResolveOperator): My previous bug fix had
2327 the error reporting done in the wrong place. Fix.
2329 * expression.cs (Binary.ResolveOperator): Catch the
2330 operator + (E x, E y) error earlier, and later allow for implicit
2331 conversions in operator +/- (E e, U x) from U to the underlying
2334 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
2335 52596, if the container class is abstract, the default constructor
2336 is protected otherwise its public (before, we were always public).
2338 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
2341 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
2342 Jemlich that fixes bug #52597, MCS was generating invalid code for
2343 idisposable structs. Thanks to Ben for following up with this
2346 2004-01-06 Miguel de Icaza <miguel@ximian.com>
2348 * driver.cs: Allow assemblies without code to be generated, fixes
2351 2004-01-07 Nick Drochak <ndrochak@gol.com>
2353 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
2355 2004-01-05 Miguel de Icaza <miguel@ximian.com>
2357 * cs-parser.jay: Add rules to improve error reporting if fields or
2358 methods are declared at the namespace level (error 116)
2360 * Add rules to catch event add/remove
2362 2004-01-04 David Sheldon <dave-mono@earth.li>
2364 * expression.cs: Added matching ")" to error message for
2367 2004-01-03 Todd Berman <tberman@gentoo.org>
2369 * ecore.cs, attribute.cs:
2370 Applying fix from #52429.
2372 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2374 * ecore.cs, expression.cs, statement.cs:
2375 Total rewrite of how we handle branching. We
2376 now handle complex boolean expressions with fewer
2377 jumps. As well if (x == 0) no longer emits a ceq.
2379 if (x is Foo) is much faster now, because we generate
2382 Overall, we get a pretty big improvement on our benchmark
2383 tests. The code we generate is smaller and more readable.
2385 I did a full two-stage bootstrap. The patch was reviewed
2386 by Martin and Miguel.
2388 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2390 * cs-parser.jay: Make primary_expression not take a QI.
2391 we dont need this because the member_access rule covers
2392 us here. So we replace the rule with just IDENTIFIER.
2394 This has two good effects. First, we remove a s/r conflict.
2395 Second, we allocate many fewer QualifiedIdentifier objects.
2397 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2399 * attribute.cs: Handle MarshalAs attributes as pseudo, and
2400 set the correct information via SRE. This prevents
2401 hanging on the MS runtime. Fixes #29374.
2403 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
2405 * convert.cs: correctly handle conversions to value types
2406 from Enum and ValueType as unboxing conversions.
2408 Fixes bug #52569. Patch by Benjamin Jemlich.
2410 2004-01-02 Ravi Pratap <ravi@ximian.com>
2412 * expression.cs (BetterConversion): Prefer int -> uint
2413 over int -> ulong (csc's behaviour). This fixed bug #52046.
2415 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
2417 * decl.cs (MemberCache.FindMembers): now returns a
2420 * typemanager.cs: In general, go with with ^^.
2421 (CopyNewMethods): take an IList.
2422 (RealMemberLookup): Only allocate an arraylist
2423 if we copy from two sets of methods.
2425 This change basically does two things:
2426 1) Fewer array lists allocated due to CopyNewMethods.
2427 2) the explicit cast in MemberList costed ALOT.
2429 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
2431 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
2432 a hashtable to avoid needless string allocations when an identifier is
2433 used more than once (the common case).
2435 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2437 * pending.cs: MS's TypeBuilder.GetInterfaces ()
2438 is broken, it will not return anything. So, we
2439 have to use the information we have in mcs to
2442 * typemanager.cs: Add a cache for GetInterfaces,
2443 since this will now be used more often (due to ^^)
2445 (GetExplicitInterfaces) New method that gets the
2446 declared, not effective, interfaces on a type
2447 builder (eg, if you have interface IFoo, interface
2448 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
2451 This patch makes MCS able to bootstrap itself on
2454 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
2456 * expression.cs: Remove the Nop's that Miguel put
2459 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2461 * report.cs, codegen.cs: Give the real stack trace to
2462 the error when an exception is thrown.
2464 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2466 * decl.cs: only allocate hashtables for ifaces if
2469 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
2471 * expression.cs: fix the error from cs0121-2.cs
2472 (a parent interface has two child interfaces that
2473 have a function with the same name and 0 params
2474 and the function is called through the parent).
2476 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
2478 * class.cs, rootcontext.cs, typmanager.cs: do not
2481 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
2483 * codegen.cs: remove stack for the ec flow branching.
2484 It is already a linked list, so no need.
2486 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
2488 * Makefile: Allow custom profiler here.
2490 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2492 * typemanager.cs (LookupType):
2493 - Use a static char [], because split takes
2494 a param array for args, so it was allocating
2496 - Do not store true in a hashtable, it boxes.
2498 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
2500 * flowanalysis.cs: bytify common enums.
2502 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2504 * modifiers.cs: Add a new set of flags for the
2505 flags allowed on explicit interface impls.
2506 * cs-parser.jay: catch the use of modifiers in
2507 interfaces correctly.
2508 * class.cs: catch private void IFoo.Blah ().
2510 All related to bug #50572.
2512 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2514 * decl.cs: Rewrite the consistant accessability checking.
2515 Accessability is not linear, it must be implemented in
2516 a tableish way. Fixes #49704.
2518 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
2520 * expression.cs: Handle negation in a checked context.
2521 We must use subtraction from zero. Fixes #38674.
2523 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2525 * class.cs: Ignore static void main in DLLs.
2526 * rootcontext.cs: Handle the target type here,
2527 since we are have to access it from class.cs
2528 * driver.cs: account for the above.
2530 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
2532 * report.cs: Give line numbers and files if available.
2534 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
2536 * driver.cs: Implement /addmodule.
2538 * typemanager.cs: Change 'modules' field so it now contains Modules not
2541 2003-12-20 Martin Baulig <martin@ximian.com>
2543 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
2544 (FieldBase.IsAssigned): Removed this field.
2545 (FieldBase.SetAssigned): New public method.
2546 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
2548 2003-12-20 Martin Baulig <martin@ximian.com>
2550 * expression.cs (LocalVariableReference.DoResolve): Don't set
2551 `vi.Used' if we're called from DoResolveLValue().
2553 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
2554 returns the usage vector it just merged into the current one -
2555 pass this one to UsageWarning().
2556 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
2557 of the `EmitContext', don't call this recursively on our children.
2559 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
2561 * driver.cs: Implement /target:module.
2563 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
2565 * support.cs (CharArrayHashtable): New helper class.
2567 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
2568 char arrays, not strings, so we can avoid creating a string in
2569 consume_identifier if the identifier is a keyword.
2571 2003-12-16 Martin Baulig <martin@ximian.com>
2573 * statement.cs (LocalInfo.Assigned): Removed this property.
2574 (LocalInfo.Flags): Removed `Assigned'.
2575 (LocalInfo.IsAssigned): New public method; takes the EmitContext
2576 and uses flow analysis.
2577 (Block.UsageWarning): Made this method private.
2578 (Block.Resolve): Call UsageWarning() if appropriate.
2580 * expression.cs (LocalVariableReference.DoResolve): Always set
2581 LocalInfo.Used here.
2583 2003-12-13 Martin Baulig <martin@ximian.com>
2585 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
2586 any value here; we're now using flow analysis to figure out
2587 whether a statement/block returns a value.
2589 2003-12-13 Martin Baulig <martin@ximian.com>
2591 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
2593 (FlowBranching.MergeFinally): Don't call
2594 `branching.CheckOutParameters()' here, this is called in
2596 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
2597 when adding the `finally' vector.
2599 2003-12-13 Martin Baulig <martin@ximian.com>
2602 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
2603 actually work and also fix #48962.
2605 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
2607 * decl.cs: Do not check System.Object for nested types,
2608 since we know it does not have any. Big bang for buck:
2613 corlib: 17.99 seconds
2617 corlib: 17.39 seconds
2619 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
2621 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
2622 time we are returning 0 members, so we save alot here.
2624 2003-12-11 Martin Baulig <martin@ximian.com>
2626 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
2627 `MergeChild()', also just take the `FlowBranching' as argument;
2628 call Merge() on it and return the result.
2629 (FlowBranching.Merge): We don't need to do anything if we just
2632 2003-12-11 Martin Baulig <martin@ximian.com>
2634 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
2635 them in an `ArrayList' to reduce memory usage. Thanks to Ben
2636 Maurer for this idea.
2638 2003-12-11 Martin Baulig <martin@ximian.com>
2640 * flowanalysis.cs (MergeResult): This class is now gone; we now
2641 use the `UsageVector' for this. The reason for this is that if a
2642 branching just has one sibling, we don't need to "merge" them at
2643 all - that's the next step to do.
2644 (FlowBranching.Merge): We now return a `UsageVector' instead of a
2647 2003-12-11 Martin Baulig <martin@ximian.com>
2649 Reworked flow analyis and made it more precise and bug-free. The
2650 most important change is that we're now using a special `Reachability'
2651 class instead of having "magic" meanings of `FlowReturns'. I'll
2652 do some more cleanups and optimizations and also add some more
2653 documentation this week.
2655 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
2656 largely reworked this class.
2657 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
2658 the new `Reachability' class instead of having "magic" values here.
2659 (FlowBranching): We're now using an instance of `Reachability'
2660 instead of having separate `Returns', `Breaks' etc. fields.
2662 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
2663 based on flow analysis; ignore the return value of block.Emit ().
2665 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
2667 * driver.cs typemanager.cs: Find the mono extensions to corlib even
2668 if they are private.
2670 2003-12-09 Martin Baulig <martin@ximian.com>
2672 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
2673 call them directly on the UsageVector.
2675 2003-12-09 Martin Baulig <martin@ximian.com>
2677 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
2678 Changed return type from `FlowReturns' to `Reachability'.
2680 2003-12-09 Martin Baulig <martin@ximian.com>
2682 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
2683 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
2684 `Reachable' fields with a single `Reachability' one.
2686 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2688 * class.cs (FindMembers): Remove foreach's.
2701 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2706 This patch does a few things:
2707 1. EmptyStatement is now a singleton, so it is never reallocated.
2708 2. All blah is EmptyStatement constructs have been changed to
2709 blah == EmptyStatement.Value, which is much faster and valid
2710 now that EmptyStatement is a singleton.
2711 3. When resolving a block, rather than allocating a new array for
2712 the non-empty statements, empty statements are replaced with
2713 EmptyStatement.Value
2714 4. Some recursive functions have been made non-recursive.
2715 Mainly the performance impact is from (3), however (1) and (2) are needed for
2716 this to work. (4) does not make a big difference in normal situations, however
2717 it makes the profile look saner.
2722 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2723 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2724 Total memory allocated: 56397 KB
2727 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
2728 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
2729 Total memory allocated: 55666 KB
2731 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2733 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
2734 than the hashtable in a hashtable version
2736 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
2737 we always end up concating a string. This results in a huge perf
2738 loss, because many strings have to be tracked by the GC. In this
2739 patch, we first use a hashtable that works with two keys, so that
2740 the strings do not need to be concat'ed.
2751 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
2753 * Makefile: Add a new target `do-time' that does a quick and simple
2754 profile, leaving easy to parse output.
2756 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
2758 * codegen.cs (Init): Create the dynamic assembly with
2759 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
2761 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
2763 * support.cs: Make the PtrHashtable use only one
2764 instance of its comparer.
2766 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
2768 * typemanager.cs: Fix lookup of GetNamespaces.
2770 2003-11-29 Miguel de Icaza <miguel@ximian.com>
2772 * expression.cs: Removed redundant line.
2774 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
2775 ArrayLists, use for loops with bounds.
2777 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
2780 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
2781 arraylists, use for loop with bounds.
2783 The above three changes give us a 0.071 second performance
2784 improvement out of 3.294 seconds down to 3.223. On my machine
2785 the above changes reduced the memory usage by 1,387 KB during
2788 * cs-parser.jay (QualifiedIdentifier): New class used to represent
2789 QualifiedIdentifiers. Before we created a new string through
2790 concatenation, and mostly later on, the result would be
2791 manipulated by DecomposeQI through string manipulation.
2793 This reduced the compiler memory usage for bootstrapping from
2794 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
2795 compile times in 0.05 seconds.
2797 2003-11-28 Dick Porter <dick@ximian.com>
2799 * support.cs: Do string compares with the Invariant culture.
2807 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
2808 the comparison is done with the Invariant culture.
2810 2003-11-27 Miguel de Icaza <miguel@ximian.com>
2812 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
2813 GetEnumerator method.
2815 (ProbeCollectionType): Iterate starting at the most specific type
2816 upwards looking for a GetEnumerator
2818 * expression.cs: Shift count can be up to 31 for int/uint and 63
2821 2003-11-26 Miguel de Icaza <miguel@ximian.com>
2823 * statement.cs (Block.LookupLabel): Also look for the label on the
2824 children blocks. Use a hash table to keep track of visited
2827 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
2828 we actually did transform the other operand, otherwise fall back
2829 to the common codepath that casts to long.
2831 * cs-tokenizer.cs: Use the same code pattern as the int case.
2832 Maybe I should do the parsing myself, and avoid depending on the
2833 Parse routines to get this done.
2835 2003-11-25 Miguel de Icaza <miguel@ximian.com>
2837 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2838 which fixes bug 51347. This time test it.
2840 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
2841 attributes for example can not tell the difference between these.
2842 The difference was only a syntax feature of the language.
2844 * attribute.cs: Apply attributes to delegates.
2846 * delegate.cs: Call the apply attributes method.
2848 2003-11-24 Miguel de Icaza <miguel@ximian.com>
2850 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
2851 comparing 0 vs Byte.MinValue, not the value
2853 (ImplicitConversionRequired): When reporting a conversion error,
2854 use error 31 to print out the constant error instead of the
2857 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
2858 which fixes bug 51347.
2860 2003-11-22 Miguel de Icaza <miguel@ximian.com>
2862 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
2863 which fixes the -warnaserror command line option.
2865 2003-11-21 Miguel de Icaza <miguel@ximian.com>
2867 * cfold.cs (DoNumericPromotions): During constant folding of
2868 additions on UIntConstant, special case intconstants with
2869 IntConstants like we do on the expression binary operator.
2871 2003-11-12 Miguel de Icaza <miguel@ximian.com>
2873 * convert.cs (ImplicitReferenceConversion): We were missing a case
2874 (System.Enum are not value types or class types, so we need to
2875 classify them separatedly).
2877 * driver.cs: We do not support error 2007.
2879 2003-11-12 Jackson Harper <jackson@ximian.com>
2881 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
2882 system directory. Also use the full file name so users can
2883 libraries names mscorlib-o-tron.dll in a non system dir.
2885 2004-01-04 David Sheldon <dave-mono@earth.li>
2887 * expression.cs: Added matching ")" to error message for CS0077.
2889 2003-12-19 Martin Baulig <martin@ximian.com>
2891 * typemanager.cs (TypeManager.IsEqualGenericType): New public
2892 static method; see documentation in the method.
2893 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
2895 * convert.cs (Convert.ImplicitReferenceConversion,
2896 Convert.ImplicitReferenceConversionExists): Add support for
2897 generic type declarations; see gen-36.cs.
2899 2003-12-19 Martin Baulig <martin@ximian.com>
2901 * pending.cs (Pending.InterfaceMethod): Use
2902 `Type.IsAssignableFrom()' instead of `=='.
2904 2003-12-18 Martin Baulig <martin@ximian.com>
2906 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
2909 * convert.cs (Convert.ImplicitStandardConversionExists): Use
2910 `expr_type.Equals (target_type)' instead of `=='.
2912 2003-12-08 Martin Baulig <martin@ximian.com>
2914 * generics.cs (Constraints.Types): Removed.
2915 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
2917 (Constraints.ResolveTypes): New public method; resolves the
2918 TypeExpr's to Type's.
2919 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
2920 longer takes the constraints.
2921 (TypeParameter.DefineMethod): Likewise.
2922 (TypeParameter.DefineType): New public method. Calls
2923 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
2926 2003-12-08 Martin Baulig <martin@ximian.com>
2928 * convert.cs (Convert.ImplicitConversionStandard): Use
2929 `expr_type.Equals (target_type)' instead of `=='.
2931 2003-12-08 Martin Baulig <martin@ximian.com>
2933 * typemanager.cs (TypeManager.GetReferenceType): Call
2934 `Type.MakeByRefType ()'.
2936 2003-12-08 Martin Baulig <martin@ximian.com>
2938 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
2939 just has some special meaning in some situations. For instance,
2940 it is allowed to use `where' as the name of a variable etc.
2942 2003-12-04 Martin Baulig <martin@ximian.com>
2944 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
2945 `Type.MakeArrayType()' for array types.
2947 2003-11-18 Miguel de Icaza <miguel@ximian.com>
2949 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
2952 (SizeOf.DoResolve): assign the `type_queried' field. This gets
2955 2003-11-16 Martin Baulig <martin@ximian.com>
2957 * codegen.cs (EmitContext.IsGeneric): Removed.
2959 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
2960 ResolveGeneric() on the DeclSpace.
2962 2003-11-16 Martin Baulig <martin@ximian.com>
2964 * generic.cs (TypeArguments.Resolve):
2965 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
2966 `ResolveType()' on it to get the Type.
2968 2003-11-15 Martin Baulig <martin@ximian.com>
2970 * generic.cs (ConstructedType.GetInterfaces): Override this.
2972 2003-11-14 Martin Baulig <martin@ximian.com>
2974 * interface.cs (Interface.DefineType): Define all type parameters
2975 before adding the interfaces we inherit.
2977 2003-11-11 Martin Baulig <martin@ximian.com>
2979 * generic.cs (ConstructedType.ResolveType): Always call
2980 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
2982 2003-11-10 Martin Baulig <martin@ximian.com>
2984 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
2985 (TypeManager.InitCoreTypes): Initialize them here, but instead of
2986 calling `ResolveType()' on them, directly assign their `Type'.
2988 2003-11-08 Martin Baulig <martin@ximian.com>
2990 * generic.cs (ConstructedType): Override `IsClass' etc.
2992 2003-11-08 Martin Baulig <martin@ximian.com>
2994 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
2995 return value and the `out parent' parameter.
2996 (TypeContainer.DefineType): Moved the CS0644 check into
2997 GetClassBases(). Don't pass the interface types to the
2998 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
2999 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
3001 * ecore.cs (TypeExpr.IsAttribute): New property.
3002 (TypeExpr.GetInterfaces): New method.
3004 * interface.cs (Interface.GetInterfaceTypeByName): Return a
3005 TypeExpr instead of a Type.
3006 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
3007 (Interface.DefineType): Don't pass the interface types to the
3008 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
3009 them later and then call `TypeBulider.AddInterfaceImplementation()'.
3011 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
3012 instead of a `Type[]'.
3013 (TypeManager.RegisterBuilder): Likewise.
3014 (TypeManager.AddUserInterface): Likewise.
3015 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
3016 `Type[]' and also return a `TypeExpr[]'.
3017 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
3019 2003-11-08 Martin Baulig <martin@ximian.com>
3021 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
3024 2003-11-08 Martin Baulig <martin@ximian.com>
3026 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
3027 TypeManager.ResolveExpressionTypes().
3029 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
3030 instead of an Expression.
3031 (TypeExpr): This is now an abstract base class for `TypeExpression'.
3032 (TypeExpression): New public class; formerly known as `TypeExpr'.
3034 * expression.cs (ComposedCast): Derive from TypeExpr.
3036 * typemanager.cs (TypeManager.system_*_expr): These are now
3037 TypExpr's instead of Expression's.
3038 (TypeManager.ResolveExpressionTypes): New public static function;
3039 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
3042 2003-11-06 Miguel de Icaza <miguel@ximian.com>
3044 * expression.cs (New.DoResolve): Do not dereference value that
3045 might be a null return.
3047 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
3048 sure that the constant value has the right type. Fixes an
3049 unreported bug, similar to 50425.
3051 * const.cs (Const.LookupConstantValue): Call
3052 ImplicitStandardConversionExists before doing a conversion to
3053 avoid havng the TypeManager.ChangeType do conversions.
3055 Reduced the number of casts used
3057 (Const.ChangeType): New routine to enable reuse of the constant
3058 type changing code from statement.
3060 * typemanager.cs (ChangeType): Move common initialization to
3061 static global variables.
3065 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
3066 every value type to go through, even if it was void. Fix that.
3068 * cs-tokenizer.cs: Use is_identifier_start_character on the start
3069 character of the define, and the is_identifier_part_character for
3070 the rest of the string.
3072 2003-11-05 Miguel de Icaza <miguel@ximian.com>
3074 * expression.cs (UnaryMutator.EmitCode): When I updated
3075 LocalVariableReference.DoResolve, I overdid it, and dropped an
3076 optimization done on local variable references.
3078 2003-11-04 Miguel de Icaza <miguel@ximian.com>
3080 * ecore.cs: Convert the return from Ldlen into an int.
3082 2003-10-20 Miguel de Icaza <miguel@ximian.com>
3084 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
3085 the accessibility, this is a special case for toplevel non-public
3086 classes (internal for instance).
3088 2003-10-20 Nick Drochak <ndrochak@gol.com>
3090 * ecore.cs: Fix typo and build. Needed another right paren.
3092 2003-10-19 Miguel de Icaza <miguel@ximian.com>
3094 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
3095 `internal' case regular and protected, but not allowing protected
3096 to be evaluated later. Bug 49840
3098 2003-10-15 Miguel de Icaza <miguel@ximian.com>
3100 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
3101 to kb.Nlast, and not the kb.nFirst to isolate the switch
3104 Extract the underlying type, so enumerations of long/ulong are
3105 treated like long/ulong.
3107 2003-10-14 Miguel de Icaza <miguel@ximian.com>
3109 * expression.cs (New): Overload the meaning of RequestedType to
3110 track the possible creation of the NewDelegate type, since
3111 DoResolve is invoked more than once for new constructors on field
3114 See bugs: #48800 and #37014
3116 * cs-parser.jay (declare_local_constants): Take an arraylist
3117 instead of a single constant.
3119 (local_constant_declaration): It should take a
3120 constant_declarators, not a constant_declarator. Fixes 49487
3122 * convert.cs: Fix error report.
3124 2003-10-13 Jackson Harper <jackson@ximian.com>
3126 * typemanager.cs (TypeToCoreType): Add float and double this fixes
3129 2003-11-03 Martin Baulig <martin@ximian.com>
3131 * expression.cs (ArrayAccess.GetStoreOpcode): Added
3132 `out bool has_type_arg'; if set, we need to pass the type to
3134 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
3135 Stelem_Any/Ldelem_Any for generic parameters.
3137 2003-11-02 Martin Baulig <martin@ximian.com>
3139 * expression.cs (Invocation.EmitCall): Use
3140 `TypeManager.IsValueType()' to check whether it's a value type.
3141 Don't set `struct_call' when calling a method on a type parameter.
3143 2003-11-02 Martin Baulig <martin@ximian.com>
3145 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
3146 and removed the TypeBuilder argument.
3148 * typemanager.cs (TypeManager.IsValueType): Return
3149 `t.IsGenericParameter || t.IsValueType'.
3151 2003-10-25 Martin Baulig <martin@ximian.com>
3153 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
3154 call ConstructedType.Resolve() on it.
3156 * generic.cs (ConstructedType.Resolve): Set `type' on success.
3158 2003-10-25 Martin Baulig <martin@ximian.com>
3160 * class.cs (TypeContainer.GetClassBases): Changed
3161 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
3162 CS8214 reporting here.
3163 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
3164 instead of a `Type' for our parent. In case of a recursive
3165 declaration (see tests/gen-23.cs for an example), our parent is a
3166 ConstructedType and it doesn't have its type set. So, first
3167 create our own TypeBuilder, then call constructed.Resolve() to get
3168 the parent's type and finally TypeBuilder.SetParent() it.
3170 * ecore.cs (TypeExpr.Name): New public virtual property.
3173 (ConstructedType): We're now a TypeExpr and not just an Expression.
3174 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
3175 arguments here; this is done later.
3176 (ConstructedType.Resolve): New public method to resolve the type
3177 arguments and bind them.
3179 2003-10-21 Martin Baulig <martin@ximian.com>
3181 * convert.cs: Use `TypeManager.IsValueType' instead of
3182 'type.IsValueType' everywhere.
3184 * typemanager.cs (TypeManager.IsValueType): Return true for type
3185 parameters. The reason for this is that we need to box a type
3186 parameter when converting it to a reference type.
3188 * cs-parser.jay: Added support for default value expressions.
3190 * generics.cs (DefaultValueExpression): New public class.
3192 2003-10-17 Martin Baulig <martin@ximian.com>
3194 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
3195 TypeContainer so we can also use this for Interfaces.
3196 (TypeParameter.Resolve): Likewise.
3198 * interface.cs (Interface.DefineType): Added support for generic
3201 * cs-parser.jay: Added support for generic structs and interfaces.
3203 2003-10-17 Martin Baulig <martin@ximian.com>
3205 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
3206 call generic methods :-)
3208 2003-10-16 Martin Baulig <martin@ximian.com>
3210 * cs-parser.jay (namespace_or_type_name): Only create a
3211 GenericMemberAccess if we actually have type arguments.
3213 2003-10-13 Martin Baulig <martin@ximian.com>
3215 * class.cs (Method.Define): If we're a generic method, call
3216 TypeBuilder.DefineGenericMethod () before resolving
3218 (MethodData): Added .ctor which takes an additional MethodBuilder
3219 argument; this is used for generic methods.
3220 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
3221 we already have a MethodBuilder.
3223 2003-10-10 Martin Baulig <martin@ximian.com>
3225 * class.cs (Method): Added .ctor which takes a `GenericMethod'
3226 instead of a `DeclSpace'. This is used for generic methods.
3228 * cs-parser.jay (method_header): Added support for generic
3229 methods; create a `GenericMethod' instance and pass it to the
3230 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
3231 parameters and locals.
3233 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
3234 since we already have the location. Check whether we're a generic
3235 type declaration or a generic method and create the correct type
3238 * generic.cs (TypeParameter.DefineMethod): New public method.
3239 (GenericMethod): New public class; derives from DeclSpace and is
3240 used for generic methods.
3242 2003-10-09 Martin Baulig <martin@ximian.com>
3244 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
3246 (MethodCore.DoDefineParameters): Removed the TypeContainer
3247 argument; use the DeclSpace which was passed to the .ctor instead.
3248 (MethodCore.CheckParameter): Take a DeclSpace instead of a
3249 TypeContainer; we only need a DeclSpace here.
3251 2003-10-09 Martin Baulig <martin@ximian.com>
3253 * class.cs (MethodData): Added additional `DeclSpace ds' argument
3255 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
3256 EmitContext's .ctor.
3258 2003-10-09 Martin Baulig <martin@ximian.com>
3260 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
3261 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
3262 AsAccessible(), moved them as well.
3264 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
3266 2003-10-07 Miguel de Icaza <miguel@ximian.com>
3268 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
3269 generation for >=, as spotted by Paolo, bug 48679.
3270 Patch from David Waite.
3272 * cs-tokenizer.cs: Add handling for #pragma.
3274 * cs-parser.jay: Allow for both yield and yield return in the
3275 syntax. The anti-cobolization of C# fight will go on!
3277 * class.cs (TypeBuilder.DefineType): Catch error condition here
3278 (Parent.DefineType erroring out and returning null).
3280 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3281 coping with enumerations variables, we were mistakenly processing
3282 them as a regular value type instead of built-in types. Fixes the
3285 * typemanager.cs (IsBuiltinOrEnum): New method.
3287 2003-09-30 Miguel de Icaza <miguel@ximian.com>
3289 * cs-parser.jay: Upgrade: yield now needs the return clause.
3291 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
3293 * cs-parser.jay : Renamed yyName to yyNames related to jay.
3295 2003-09-29 Martin Baulig <martin@ximian.com>
3297 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
3298 inflated generic methods.
3300 * generics.cs (ConstructedType): Distinguish between open and
3301 closed constructed types; correctly resolve the arguments.
3303 2003-09-22 Martin Baulig <martin@ximian.com>
3305 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
3306 all type arguments meet their constraints.
3308 2003-09-19 Martin Baulig <martin@ximian.com>
3310 * decl.cs (MemberCache.SetupCacheForInterface): Take a
3311 `MemberCache parent' argument. Normally, an interface doesn't
3312 have a parent type except System.Object, but we use this in gmcs
3313 for generic type parameters.
3315 2003-09-18 Martin Baulig <martin@ximian.com>
3317 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
3318 on `type.IsInterface'; don't check whether the type has a parent
3319 to determine whether it's an interface.
3321 2003-09-17 Martin Baulig <martin@ximian.com>
3323 * generic.cs (ConstructedType.ToString): Always use `name' as the
3326 2003-09-15 Martin Baulig <martin@ximian.com>
3328 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
3330 * generic.cs (Constraints.Resolve): New public method; this is
3331 called to resolve the constraint types and to check whether all
3332 the constraints are correct.
3333 (Constraints.Types): New public property.
3334 (TypeParameter.Resolve): New public method; resolves all the
3337 * class.cs (TypeContainer.DefineType): Call
3338 TypeParameter.Resolve() before actually defining the type.
3340 2003-09-15 Martin Baulig <martin@ximian.com>
3342 * class.cs (TypeContainer.DefineType): Added an error flag to
3343 avoid reporting duplicate CS0146's ("class definition is
3346 * driver.cs (Driver.MainDriver): Abort if
3347 RootContext.ResolveTree() reported any errors.
3349 2003-09-07 Martin Baulig <martin@ximian.com>
3351 * report.cs (Error, Warning): Added overloaded versions which take
3352 a `params object[] args' and call String.Format().
3354 2003-09-07 Martin Baulig <martin@ximian.com>
3356 * decl.cs (DeclSpace..ctor): Don't call
3357 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
3358 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
3359 (DeclSpace.RecordDecl): New method.
3361 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
3363 2003-09-02 Ravi Pratap <ravi@ximian.com>
3365 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
3366 value attributes to be applied to ParameterBuilders.
3368 * class.cs (MethodCore.LabelParameters): Make static and more
3369 generic so that it can be used from other places - like interface
3370 methods, for instance.
3372 * interface.cs (Interface.Emit): Call LabelParameters before
3373 emitting attributes on the InterfaceMethod.
3375 2003-09-07 Martin Baulig <martin@ximian.com>
3377 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
3378 if the number of type parameters doesn't match.
3380 2003-09-04 Martin Baulig <martin@ximian.com>
3382 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
3383 for arrays of generic type params (ie. `!0[]').
3385 2003-09-04 Martin Baulig <martin@ximian.com>
3387 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
3390 2003-09-04 Martin Baulig <martin@ximian.com>
3392 * decl.cs (DeclSpace.LookupGeneric): New method.
3393 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
3396 * generic.cs (TypeParameterExpr): Take a TypeParameter as
3397 argument, not just a string.
3398 (TypeParameter.Define): New public method; this is called to
3399 actually define the generic parameter; after this, you can use the
3400 new `Type' property to get the type.
3402 2003-09-04 Martin Baulig <martin@ximian.com>
3404 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
3405 is now an ArrayList; initialize the result of the `TypeParameters'
3407 (DeclSpace.GetGenericData): Removed.
3408 (DeclSpace.LookupGeneric): Temporarily removed; we need to
3409 implement this in a different way.
3410 (DeclSpace.GetTypeParameters): Removed; there's now a
3411 `TypeParameters' property.
3412 (DeclSpace.TypeParameters): New public property.
3414 * generic.cs (Constraints): Make this class public.
3415 (TypeParameter): New public class.
3417 2003-09-04 Martin Baulig <martin@ximian.com>
3419 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
3422 * class.cs (TypeContainer.DefineType): Call
3423 TypeBuilder.DefineGenericParameter () on all generic parameters if
3424 this is a generic type.
3426 2003-08-28 Martin Baulig <martin@ximian.com>
3428 * sample-stack.il: Compile this with ilasm: "ilasm /dll
3431 * sample-hello.cs: Compile this with gmcs: "gmcs
3432 /r:sample-stack.dll sample-hello.cs".
3434 2003-08-28 Martin Baulig <martin@ximian.com>
3436 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
3437 the parameters to the generic type.
3439 2003-08-28 Martin Baulig <martin@ximian.com>
3441 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
3443 2003-08-28 Martin Baulig <martin@ximian.com>
3445 * cs-parser.jay (opt_type_argument_list): Use
3446 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
3447 (primary_expression): Replace `qualified_identifier' with `type_name'.
3448 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
3450 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
3451 parser to check whether it is syntactically a type parameter list;
3452 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
3455 2003-08-26 Martin Baulig <martin@ximian.com>
3457 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
3458 resolving aliases; fixes #47927.
3460 2003-08-26 Martin Baulig <martin@ximian.com>
3462 * statement.cs (Using.DoResolve): This is internally emitting a
3463 try/finally clause, so we need to set ec.NeedExplicitReturn if we
3464 do not always return. Fixes #47681.
3466 2003-08-26 Martin Baulig <martin@ximian.com>
3468 * decl.cs (MemberCore): Moved WarningNotHiding(),
3469 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
3471 (AdditionResult): Make this nested in DeclSpace.
3472 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
3473 argument; call NamespaceEntry.Define() unless we're nested in a
3476 * namespace.cs (Namespace.DefineName): New public function. This
3477 is called from DeclSpace's .ctor to add
3478 (Namespace.Lookup): Include DeclSpaces in the lookup.
3480 * class.cs (Operator): Derive from MemberBase, not MemberCore.
3482 * const.cs (Const): Derive from MemberBase, not MemberCore.
3484 2003-08-25 Martin Baulig <martin@ximian.com>
3486 * convert.cs (Convert.ExplicitReferenceConversion): When
3487 converting from an interface type to a class, unbox if the target
3488 type is a struct type. Fixes #47822.
3490 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3492 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
3495 2003-08-22 Martin Baulig <martin@ximian.com>
3497 * class.cs (TypeManager.DefineType): When defining a nested type,
3498 call DefineType() on our parent; fixes #47801.
3500 2003-08-22 Martin Baulig <martin@ximian.com>
3502 * class.cs (MethodData.Define): While checking if a method is an
3503 interface implementation, improve the test a bit more to fix #47654.
3505 2003-08-22 Martin Baulig <martin@ximian.com>
3507 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
3508 correctly; fixes #47722.
3510 2003-08-22 Martin Baulig <martin@ximian.com>
3512 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
3513 LocalVariableReference, ensure it's not read-only. Fixes #47536.
3515 * statement.cs (Fixed.DoResolve): Make all variables read-only.
3517 2003-08-22 Martin Baulig <martin@ximian.com>
3519 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
3520 can only be assigned in static constructors. Fixes #47161.
3522 2003-08-22 Martin Baulig <martin@ximian.com>
3524 Rewrote and improved the flow analysis code.
3526 * flowbranching.cs (FlowBranching): Make this class abstract.
3527 (FlowBranching.CreateBranching): New static function to create a
3529 (FlowBranchingBlock, FlowBranchingException): New classes.
3530 (FlowBranching.UsageVector.Type): New public readonly field.
3531 (FlowBranching.UsageVector.Breaks): Removed the setter.
3532 (FlowBranching.UsageVector.Returns): Removed the setter.
3533 (FlowBranching.UsageVector): Added Break(), Return(),
3534 NeverReachable() and Throw() methods to modify the reachability.
3535 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
3536 done by FlowBranching.Merge().
3537 (FlowBranching.UsageVector.MergeChild): New method; merges the
3538 merge result into the current vector.
3539 (FlowBranching.Merge): New abstract method to merge a branching.
3541 2003-08-12 Martin Baulig <martin@ximian.com>
3543 * expression.cs (Indirection.CacheTemporaries): Create the
3544 LocalTemporary with the pointer type, not its element type.
3546 2003-08-10 Miguel de Icaza <miguel@ximian.com>
3548 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
3549 token was a keyword or not.
3551 Add `error' options where an IDENTIFIER was expected; Provide
3552 CheckToken and CheckIdentifierToken convenience error reporting
3555 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
3557 * decl.cs: Rename `NamespaceEntry Namespace' public field into
3558 NameSpaceEntry NameSpaceEntry.
3560 (LookupInterfaceOrClass): Avoid creating a full qualified name
3561 from namespace and name: avoid doing lookups when we know the
3562 namespace is non-existant. Use new Tree.LookupByNamespace which
3563 looks up DeclSpaces based on their namespace, name pair.
3565 * driver.cs: Provide a new `parser verbose' to display the
3566 exception thrown during parsing. This is turned off by default
3567 now, so the output of a failure from mcs is more graceful.
3569 * namespace.cs: Track all the namespaces defined in a hashtable
3572 (IsNamespace): New method
3574 2003-08-09 Miguel de Icaza <miguel@ximian.com>
3576 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
3577 we know that we need to concatenate (full typename can never be
3582 * statement.cs: Use a bitfield; Do not initialize to null things
3583 which are done by the constructor by default.
3585 * cs-parser.jay: bug fix, parameter was 4, not 3.
3587 * expression.cs: Just use the property;
3589 * statement.cs: No need for GetVariableInfo method.
3591 2003-08-08 Martin Baulig <martin@ximian.com>
3593 * flowanalysis.cs (FlowReturns): This is now nested in the
3594 `FlowBranching' class.
3595 (MyBitVector): Moved this here from statement.cs.
3596 (FlowBranching.SiblingType): New enum type.
3597 (FlowBranching.CreateSibling): Added `SiblingType' argument.
3599 2003-08-07 Martin Baulig <martin@ximian.com>
3601 * flowanalysis.cs (FlowBranchingType): This is now nested in the
3602 `FlowBranching' class and called `BranchingType'.
3604 2003-08-07 Martin Baulig <martin@ximian.com>
3606 * flowanalysis.cs: Moved all the control flow analysis code into
3609 2003-08-07 Martin Baulig <martin@ximian.com>
3611 * assign.cs (Assign.DoResolve): `target' must either be an
3612 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
3615 2003-08-07 Miguel de Icaza <miguel@ximian.com>
3617 * expression.cs (BinaryMethod): This kind of expression is created by the
3618 Binary class if it determines that the operator has to be handled
3621 (BinaryDelegate): This kind of expression is created if we are
3622 dealing with a + or - operator on delegates.
3624 (Binary): remove method, argumetns, and DelegateOperator: when
3625 dealing with methods,
3627 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
3629 * statement.cs (Block): use bitfields for the three extra booleans
3630 we had in use. Remove unused topblock parameter.
3632 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
3634 * assign.cs: Drop extra unneeded tests.
3636 2003-08-06 Miguel de Icaza <miguel@ximian.com>
3638 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
3640 * statement.cs (Foreach): Use VariableStorage instead of
3643 * codegen.cs (VariableStorage): New class used by clients that
3644 require a variable stored: locals or fields for variables that
3645 need to live across yield.
3647 Maybe provide a convenience api for EmitThis+EmitLoad?
3649 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
3652 2003-08-05 Miguel de Icaza <miguel@ximian.com>
3654 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
3655 RemapParameterLValue): New methods that are used to turn a
3656 precomputed FieldInfo into an expression like this:
3660 The idea is to use this instead of making LocalVariableReference
3661 have more than one meaning.
3663 * cs-parser.jay: Add error production to BASE.
3665 * ecore.cs: Deal with TypeManager.GetField returning null, which
3666 is now a valid return value.
3668 (FieldExprNoAddress): New expression for Fields whose address can
3671 * expression.cs (LocalVariableReference): During the resolve
3672 phases, create new expressions if we are in a remapping context.
3673 Remove code that dealt with remapping here.
3675 (ParameterReference): same.
3677 (ProxyInstance): New expression, like the `This' expression, but
3678 it is born fully resolved. We know what we are doing, so remove
3679 the errors that are targeted to user-provided uses of `this'.
3681 * statement.cs (Foreach): our variable is now stored as an
3682 Expression; During resolution, follow the protocol, dont just
3683 assume it will return this.
3685 2003-08-06 Martin Baulig <martin@ximian.com>
3687 * support.cs (SeekableStreamReader.cs): New public class.
3689 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
3690 SeekableStreamReader instead of the normal StreamReader.
3692 2003-08-04 Martin Baulig <martin@ximian.com>
3694 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
3695 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
3696 deambiguate casts and delegate invocations.
3697 (parenthesized_expression): Use the new tokens to ensure this is
3698 not a cast of method invocation.
3700 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
3701 when reading a `)' and Deambiguate_CloseParens () was previously
3704 * expression.cs (ParenthesizedExpression): New class. This is
3705 just used for the CS0075 test.
3706 (Binary.DoResolve): Check for CS0075.
3708 2003-07-29 Ravi Pratap <ravi@ximian.com>
3710 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
3711 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
3712 reference comparison.
3714 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
3715 examine the ReturnType for equality - this is necessary in the
3716 cases of implicit and explicit operators whose signature also
3717 includes the return type.
3719 2003-07-26 Miguel de Icaza <miguel@ximian.com>
3721 * namespace.cs: Cache the result of the namespace computation,
3722 instead of computing it every time.
3724 2003-07-24 Miguel de Icaza <miguel@ximian.com>
3726 * decl.cs: Use a global arraylist that we reuse over invocations
3727 to avoid excesive memory consumption. Reduces memory usage on an
3728 mcs compile by one meg (45 average).
3730 * typemanager.cs (LookupTypeReflection): In .NET pointers are
3731 private, work around that.
3733 2003-07-23 Miguel de Icaza <miguel@ximian.com>
3735 * literal.cs (IntLiteral): Define Zero and One static literals.
3737 * cs-parser.jay (integer_literal): use static literals to reduce
3738 memory usage for the most used literals (0, 1 and -1). 211kb
3739 reduced in memory usage.
3741 Replace all calls to `new ArrayList' with `new
3742 ArrayList(4)' which is a good average number for most allocations,
3743 and also requires only 16 bytes of memory for its buffer by
3746 This reduced MCS memory usage in seven megabytes for the RSS after
3749 2003-07-28 Ravi Pratap <ravi@ximian.com>
3751 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
3752 handle params methods the correct way by forming only one
3753 applicable set with params and normal methods in them. Earlier we
3754 were looking at params methods only if we found no normal methods
3755 which was not the correct thing to do.
3757 (Invocation.BetterFunction): Take separate arguments indicating
3758 when candidate and the best method are params methods in their
3761 This fixes bugs #43367 and #46199.
3763 * attribute.cs: Documentation updates.
3765 (CheckAttribute): Rename to CheckAttributeTarget.
3766 (GetValidPlaces): Rename to GetValidTargets.
3768 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
3769 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
3773 2003-07-28 Miguel de Icaza <miguel@ximian.com>
3775 * codegen.cs: Compute IsGeneric correctly.
3777 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
3780 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
3781 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
3782 regressions, and I was chasing more bugs than I required.
3784 * interface.cs: Use expressions for base type names (like classes
3785 and structs have been doing for a while now), and resolve that.
3786 This patch should probably go into head as well.
3788 This makes it one less user of FindType.
3790 2003-07-24 Miguel de Icaza <miguel@ximian.com>
3792 This compiler can not self host currently. Need to fix that.
3794 * Makefile: compile to `gmcs.exe'
3796 * driver.cs: Turn on v2 by default on gmcs.
3798 * generic.cs (ConstructedType): Does no longer take a container
3799 type argument; That will be taken care of later.
3801 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
3802 Use SimpleName to resolve for now, so we can continue the work on
3803 the parser, until we get Type.GetType that understands generics.
3805 (ConstructedType.ToString): Implement
3807 (TypeArguments.Resolve): Resolve the child expressions as types.
3809 * cs-parser.jay: Rename interface_constraints to
3810 type_parameter_constraints
3812 (namespace_or_type_name): Only use constructed types for the basic
3813 construction, we will deal with identifier<...> later.
3815 (type/type_name): No longer call DecomposeQI, as
3816 namespace_or_type_name is always decoded now.
3818 2003-07-22 Ravi Pratap <ravi@ximian.com>
3820 * expression.cs (Invocation.OverloadResolve): Follow the spec more
3821 closely: we eliminate methods in base types when we have an
3822 applicable method in a top-level type.
3824 Please see section 14.5.5.1 for an exact description of what goes
3827 This fixes bug #45127 and a host of other related to corlib compilation.
3829 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
3830 array is the method corresponding to the top-level type (this is
3831 because of the changes made to icall.c) so we change this
3834 (MethodGroupExpr.Name): This too.
3836 * typemanager.cs (GetElementType): New method which does the right
3837 thing when compiling corlib.
3839 * everywhere: Make use of the above in the relevant places.
3841 2003-07-22 Martin Baulig <martin@ximian.com>
3843 * cs-parser.jay (invocation_expression): Moved
3844 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
3845 `cast_expression', but create a InvocationOrCast which later
3846 resolves to either an Invocation or a Cast.
3848 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
3849 method; call this before EmitStatement() to make sure that this
3850 expression can be used as a statement.
3852 * expression.cs (InvocationOrCast): New class; resolves to either
3853 an Invocation or a Cast.
3855 * statement.cs (StatementExpression): Call ResolveStatement() on
3856 the ExpressionStatement before emitting it.
3858 2003-07-21 Martin Baulig <martin@ximian.com>
3860 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
3861 `ref' and `out' attributes match; fixes #46220.
3862 (MemberAccess.ResolveMemberAccess): You can't reference a type
3863 through an expression; fixes #33180.
3864 (Indexers.GetIndexersForType): Don't return the indexers from
3865 interfaces the class implements; fixes #46502.
3867 2003-07-21 Martin Baulig <martin@ximian.com>
3869 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
3870 CS0661 checks; fixes bug #30442.
3872 2003-07-21 Martin Baulig <martin@ximian.com>
3874 * decl.cs (AdditionResult): Added `Error'.
3876 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
3878 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
3879 cs0031.cs actually work.
3881 2003-07-20 Miguel de Icaza <miguel@ximian.com>
3883 * cs-parser.jay (namespace_name): do not use
3884 namespace_or_type_name, use qualified_identifier, because
3885 namespace_or_type_name will soon return a composed expression
3886 instead of a string.
3888 (namespace_or_type_name): Instead of returning a string, now this
3889 production returns an expression.
3891 * codegen.cs (EmitContext): Setup IsGeneric property based on
3892 whether our DeclSpace is generic, our the method is generic.
3894 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
3895 the method is generic.
3897 * cs-parser.jay (type_arguments, opt_type_argument_list,
3898 type_parameters, type_parameter_list, opt_type_parameter_list,
3899 type_parameter,, opt_type_parameter_constraints_clauses,
3900 type_parameter_constraints_clauses,
3901 type_parameter_constraint_clause, type_parameter_constraint,
3902 interface_constraints): Add new production
3904 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
3905 DeclSpace is generic or not.
3907 (DeclSpace.SetParameterInfo): New routine, used to set the
3908 parameter info for a type.
3910 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
3911 returns a GenericTypeExpr
3913 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
3914 generic, lookup the generic argument.
3916 * attribute.cs: Do not allow TypeParameterExpressions in
3919 * class.cs: Do not allow the Main method to be defined in a
3922 * expression.cs (SizeOf): Do not allow generic types to be used as
3923 arguments to sizeof.
3925 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
3926 it: whether a type is generic or not. Only works for types we are
3927 currently building for now.
3929 2003-07-20 Martin Baulig <martin@ximian.com>
3931 * namespace.cs: Fixed that bug which caused a crash when compiling
3934 2003-07-20 Miguel de Icaza <miguel@ximian.com>
3936 * typemanager.cs (LookupTypeReflection): Never expose types which
3937 are NotPublic, NestedPrivate, NestedAssembly, or
3938 NestedFamANDAssem. We used to return these, and later do a check
3939 that would report a meaningful error, but the problem is that we
3940 would not get the real match, if there was a name override.
3942 2003-07-18 Miguel de Icaza <miguel@ximian.com>
3944 * namespace.cs (Namespace, Name): Do not compute the namespace
3945 name dynamically, compute it in the constructor. This reduced
3946 memory usage by 1697 KB.
3948 * driver.cs: Use --pause to pause at the end.
3950 2003-07-17 Peter Williams <peter@newton.cx>
3952 * Makefile: Change the name of the test target so that it doesn't
3953 conflict with the recursive test target.
3955 2003-07-17 Miguel de Icaza <miguel@ximian.com>
3957 * expression.cs (LocalVariableReference.Emit, EmitAssign,
3958 AddressOf): Do not use EmitThis, that was wrong, use the actual
3961 2003-07-15 Miguel de Icaza <miguel@ximian.com>
3963 * class.cs (MethodData.Define): While checking if a method is an
3964 interface implementation, improve the test: If we are not public
3965 (use new test here: use the computed MethodAttributes directly,
3966 instead of the parsed modifier flags) check if the `implementing'
3967 method comes from an interface or not.
3969 * pending.cs (VerifyPendingMethods): Slightly better error
3972 * makefile: add test target that does the mcs bootstrap.
3974 2003-07-16 Ravi Pratap <ravi@ximian.com>
3976 * interface.cs (Define): Do nothing here since there are no
3977 members to populate etc. Move the attribute emission out of here
3978 since this was just totally the wrong place to put it. Attribute
3979 application happens during the 'Emit' phase, not in the 'Define'
3982 (Emit): Add this method and move the attribute emission here
3984 * rootcontext.cs (EmitCode): Call the Emit method on interface
3987 2003-07-14 Ravi Pratap M <ravi@ximian.com>
3989 * expression.cs (OverloadResolve): Report error only if Location
3990 is not 'Null' which means that there was a probe going on.
3992 2003-07-14 Martin Baulig <martin@ximian.com>
3994 * expression.cs (ConditionalLogicalOperator): New public class to
3995 implement user defined conditional logical operators.
3996 This is section 14.11.2 in the spec and bug #40505.
3998 2003-07-14 Martin Baulig <martin@ximian.com>
4000 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
4002 2003-07-14 Martin Baulig <martin@ximian.com>
4004 * codegen.cs (EmitContext.InFixedInitializer): New public field.
4006 * ecore.cs (IVariable.VerifyFixed): New interface method.
4008 * expression.cs (Unary.ResolveOperator): When resolving the `&'
4009 operator, check whether the variable is actually fixed. Fixes bug
4010 #36055. Set a variable definitely assigned when taking its
4011 address as required by the spec.
4013 * statement.cs (LocalInfo.IsFixed): New field.
4014 (LocalInfo.MakePinned): Set `IsFixed' to true.
4016 2003-07-14 Ravi Pratap M <ravi@ximian.com>
4018 * attribute.cs (Attribute.Resolve): While doing a Member lookup
4019 for .ctors, ensure that we only ask for members declared in the
4020 attribute type (BindingFlags.DeclaredOnly).
4024 * expression.cs (Error_WrongNumArguments): Report error 1501
4025 correctly the way CSC does.
4027 2003-07-13 Martin Baulig <martin@ximian.com>
4029 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
4030 lookup on the fully qualified name, to make things like "X.X" work
4031 where "X.X" is a fully qualified type name, but we also have a
4032 namespace "X" in the using list. Fixes #41975.
4034 2003-07-13 Martin Baulig <martin@ximian.com>
4036 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
4037 function. If we're a CompoundAssign, we need to create an embedded
4038 CompoundAssign, not an embedded Assign.
4039 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
4042 2003-07-13 Martin Baulig <martin@ximian.com>
4044 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
4045 work to fix bug #46088.
4047 2003-07-13 Ravi Pratap <ravi@ximian.com>
4049 * class.cs (Operator.Emit): Do not emit attributes here - it is
4050 taken care of by the Method class that we delegate too. This takes
4053 2003-07-10 Martin Baulig <martin@ximian.com>
4055 * expression.cs (TypeOfVoid): New class.
4056 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
4058 2003-07-10 Martin Baulig <martin@ximian.com>
4060 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
4063 2003-07-10 Martin Baulig <martin@ximian.com>
4065 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
4066 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
4068 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
4070 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
4072 2003-07-10 Martin Baulig <martin@ximian.com>
4074 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
4075 of decimal. Fixes #42850.
4077 NOTE: I also fixed the created byte blob, but this doesn't work on
4078 the MS runtime and csc never produces any byte blobs for decimal
4081 2003-07-10 Martin Baulig <martin@ximian.com>
4083 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
4084 structs; fixes #32068.
4085 (Block.AddChildVariableNames): Fixed #44302.
4087 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4089 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
4091 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4093 * attribute.cs: And this test is onger needed.
4095 2003-07-08 Martin Baulig <martin@ximian.com>
4097 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
4098 inaccessible types. Fixes #36313.
4100 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
4102 * namespace.cs (NamespaceEntry): Create implicit entries for all
4103 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
4104 implicit entries for N1.N2 and N1.
4106 2003-07-08 Martin Baulig <martin@ximian.com>
4108 Rewrote the handling of namespaces to fix a lot of the issues
4109 wrt. `using' aliases etc.
4111 * namespace.cs (Namespace): Splitted this class into a
4112 per-assembly `Namespace' and a per-file `NamespaceEntry'.
4114 * typemanager.cs (TypeManager.IsNamespace): Removed.
4115 (TypeManager.ComputeNamespaces): Only compute namespaces from
4116 loaded assemblies here, not the namespaces from the assembly we're
4117 currently compiling.
4119 2003-07-08 Martin Baulig <martin@ximian.com>
4121 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
4123 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4125 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
4128 I thought about the memory savings here, but LookupTypeReflection
4129 is used under already very constrained scenarios. Compiling
4130 corlib or mcs only exposes one hit, so it would not really reduce
4131 any memory consumption.
4133 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4135 * typemanager.cs: fixes bug #45889 by only adding public types from
4136 other assemblies to the list of known types.
4138 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4140 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
4141 on the type we resolved.
4143 2003-07-05 Martin Baulig <martin@ximian.com>
4145 * pending.cs (PendingImplementation.ParentImplements): Don't
4146 create the proxy if the parent is abstract.
4148 * class.cs (TypeContainer.DefineIndexers): Process explicit
4149 interface implementations first. Fixes #37714.
4151 2003-07-04 Miguel de Icaza <miguel@ximian.com>
4153 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
4154 defined recursively; but since we modify the input parameters
4155 (left is set to `this' temporarily), we reset this value if the
4156 left_is_explicit is false, which gives the original semantics to
4159 * literal.cs (NullPointer): new class used to represent a null
4160 literal in a pointer context.
4162 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
4163 type is a pointer, use a NullPointer object instead of a
4164 NullLiteral. Closes 43687
4166 (ExplicitConversion): Convert pointer values using
4167 the conv opcode to the proper type.
4169 * ecore.cs (New): change ValueTypeVariable property into a method,
4170 that returns whether the valuetype is suitable for being used.
4172 * expression.cs (Binary.DoNumericPromotions): Only return if we
4173 the int constant was a valid uint, and we can return both left and
4174 right as uints. If not, we continue processing, to trigger the
4175 type conversion. This fixes 39018.
4177 * statement.cs (Block.EmitMeta): During constant resolution, set
4178 the CurrentBlock property on the emitcontext, so that we resolve
4179 constants propertly.
4181 2003-07-02 Martin Baulig <martin@ximian.com>
4183 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
4184 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
4186 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
4187 than emitting it here.
4189 * statement.cs: Fixed some more flow analysis bugs.
4191 2003-07-02 Martin Baulig <martin@ximian.com>
4193 * class.cs (MethodData.Define): When implementing interface
4194 methods, set Final unless we're Virtual.
4196 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
4197 check work for interface methods.
4199 2003-07-01 Martin Baulig <martin@ximian.com>
4201 * ecore.cs (EmitContext.This): Replaced this property with a
4202 GetThis() method which takes a Location argument. This ensures
4203 that we get the correct error location for a CS0188.
4205 2003-07-01 Miguel de Icaza <miguel@ximian.com>
4207 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
4208 ImplicitStandardConversion.
4210 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
4212 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
4214 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
4217 2003-06-30 Miguel de Icaza <miguel@ximian.com>
4219 * class.cs (Constructor.Define): Turn off initlocals for unsafe
4222 (MethodData.Define): Turn off initlocals for unsafe methods.
4224 2003-06-29 Miguel de Icaza <miguel@ximian.com>
4226 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
4227 complete; Fixes #37521.
4229 * delegate.cs: Use Modifiers.TypeAttr to compute the
4230 TypeAttributes, instead of rolling our own. This makes the flags
4231 correct for the delegates.
4233 2003-06-28 Miguel de Icaza <miguel@ximian.com>
4235 * class.cs (Constructor.Define): Set the private flag for static
4236 constructors as well.
4238 * cs-parser.jay (statement_expression): Set the return value to
4239 null, to avoid a crash when we catch an error.
4241 2003-06-24 Miguel de Icaza <miguel@ximian.com>
4243 * cs-parser.jay: Applied patch from Jackson that adds support for
4244 extern and unsafe modifiers to destructor declarations.
4246 * expression.cs: Report error 21 if the user is trying to index a
4249 * driver.cs: Add an error message, suggested by the bug report.
4251 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
4252 if we do not have a ": this ()" constructor initializer. Fixes 45149
4254 2003-06-14 Miguel de Icaza <miguel@ximian.com>
4256 * namespace.cs: Add some information to reduce FAQs.
4258 2003-06-13 Miguel de Icaza <miguel@ximian.com>
4260 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
4261 underlying enumeration types. Fixes #43915.
4263 * expression.cs: Treat ushort/short as legal values to be used in
4266 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
4268 * delegate.cs: transfer custom attributes for paramenters from
4269 the delegate declaration to Invoke and BeginInvoke.
4271 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
4273 * attribute.cs: handle custom marshalers and emit marshal info
4276 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
4278 * makefile.gnu: Added anonymous.cs to the compiler sources.
4280 2003-05-28 Miguel de Icaza <miguel@ximian.com>
4282 * iterators.cs: Change the name of the proxy class to include two
4285 * cs-parser.jay: Update grammar to include anonymous methods.
4287 * anonymous.cs: new file.
4289 2003-05-27 Miguel de Icaza <miguel@ximian.com>
4291 * class.cs (Field.Define): Add missing test for pointers and
4294 2003-05-27 Ravi Pratap <ravi@ximian.com>
4296 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
4297 we use the stobj opcode.
4299 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
4300 since it wasn't the correct fix.
4302 It still is puzzling that we are required to use stobj for IntPtr
4303 which seems to be a ValueType.
4305 2003-05-26 Miguel de Icaza <miguel@ximian.com>
4307 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
4308 during regular simple name resolution. Now, the trick is that
4309 instead of returning for processing the simplename, we do a
4310 TypeManager.LookupType (ie, a rooted lookup as opposed to a
4311 contextual lookup type). If a match is found, return that, if
4312 not, return for further composition.
4314 This fixes long-standing 30485.
4316 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4317 using the address to initialize an object, do an Stobj instead of
4318 using the regular Stelem.
4320 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
4321 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
4322 Because if we are a BaseIndexerAccess that value will be true.
4325 * statement.cs (GotoCase.Resolve): Return after reporting an
4326 error, do not attempt to continue.
4328 * expression.cs (PointerArithmetic.Emit): If our operand is a
4329 long, convert our constants to match the operand before
4330 multiplying. Convert to I type before adding. Fixes 43670.
4332 2003-05-14 Ravi Pratap <ravi@ximian.com>
4334 * enum.cs (ImplicitConversionExists) : Rename to
4335 ImplicitEnumConversionExists to remove ambiguity.
4337 * ecore.cs (NullCast): New type of cast expression class which
4338 basically is very similar to EmptyCast with the difference being
4339 it still is a constant since it is used only to cast a null to
4343 * convert.cs (ImplicitReferenceConversion): When casting a null
4344 literal, we return a NullCast.
4346 * literal.cs (NullLiteralTyped): Remove - I don't see why this
4347 should be around anymore.
4349 The renaming (reported was slightly wrong). Corrections:
4351 ConvertImplicitStandard -> ImplicitConversionStandard
4352 ConvertExplicitStandard -> ExplicitConversionStandard
4354 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
4355 before passing them in !
4357 * convert.cs (ImplicitConversionStandard): When comparing for
4358 equal expr and target types, ensure that expr is not a
4361 In general, we must not be checking (expr_type ==
4362 target_type) in the top level conversion methods
4363 (ImplicitConversion, ExplicitConversion etc). This checking is
4364 done in the methods that they delegate to.
4366 2003-05-20 Miguel de Icaza <miguel@ximian.com>
4368 * convert.cs: Move Error_CannotConvertType,
4369 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
4370 ImplicitNumericConversion, ImplicitConversionExists,
4371 ImplicitUserConversionExists, StandardConversionExists,
4372 FindMostEncompassedType, FindMostSpecificSource,
4373 FindMostSpecificTarget, ImplicitUserConversion,
4374 ExplicitUserConversion, GetConversionOperators,
4375 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
4376 TryImplicitIntConversion, Error_CannotConvertImplicit,
4377 ConvertImplicitRequired, ConvertNumericExplicit,
4378 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
4379 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
4382 Perform the following renames:
4384 StandardConversionExists -> ImplicitStandardConversionExists
4385 ConvertImplicit -> ImplicitConversion
4386 ConvertImplicitStandard -> ImplicitStandardConversion
4387 TryImplicitIntConversion -> ImplicitIntConversion
4388 ConvertImplicitRequired -> ImplicitConversionRequired
4389 ConvertNumericExplicit -> ExplicitNumericConversion
4390 ConvertReferenceExplicit -> ExplicitReferenceConversion
4391 ConvertExplicit -> ExplicitConversion
4392 ConvertExplicitStandard -> ExplicitStandardConversion
4394 2003-05-19 Martin Baulig <martin@ximian.com>
4396 * statement.cs (TypeInfo.StructInfo): Made this type protected.
4397 (TypeInfo): Added support for structs having structs as fields.
4399 * ecore.cs (FieldExpr): Implement IVariable.
4400 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
4401 VariableInfo for the field.
4403 2003-05-18 Martin Baulig <martin@ximian.com>
4405 * expression.cs (This.DoResolve): Report a CS0027 if we're
4406 emitting a field initializer.
4408 2003-05-18 Martin Baulig <martin@ximian.com>
4410 * expression.cs (This.ResolveBase): New public function.
4411 (This.DoResolve): Check for CS0188.
4413 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
4416 * ecore.cs (MethodGroupExpr.DoResolve): Set the
4417 `instance_expression' to null if we don't have any non-static
4420 2003-05-18 Martin Baulig <martin@ximian.com>
4422 Reworked the way how local variables and parameters are handled by
4423 the flow analysis code.
4425 * statement.cs (TypeInfo, VariableMap): New public classes.
4426 (VariableInfo): New public class. This is now responsible for
4427 checking whether a variable has been assigned. It is used for
4428 parameters and local variables.
4429 (Block.EmitMeta): Take the InternalParameters as argument; compute
4430 the layout of the flow vectors here.
4431 (Block.LocalMap, Block.ParameterMap): New public properties.
4432 (FlowBranching): The .ctor doesn't get the InternalParameters
4433 anymore since Block.EmitMeta() now computes the layout of the flow
4435 (MyStructInfo): This class is now known as `StructInfo' and nested
4436 in `TypeInfo'; we don't access this directly anymore.
4438 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
4439 property and removed IsAssigned(), IsFieldAssigned(),
4440 SetAssigned() and SetFieldAssigned(); we now call them on the
4441 VariableInfo so we don't need to duplicate this code everywhere.
4443 * expression.cs (ParameterReference): Added `Block block' argument
4445 (LocalVariableReference, ParameterReference, This): The new
4446 VariableInfo class is now responsible for all the definite
4449 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
4450 IsParameterAssigned, SetParameterAssigned): Removed.
4452 2003-05-18 Martin Baulig <martin@ximian.com>
4454 * typemanager.cs (InitCoreTypes): Try calling
4455 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
4456 the 3-args-version. Corlib now also needs our `void_type'.
4457 (GetMethod): Added overloaded version which takes an optional
4458 `bool report_errors' to allow lookups of optional methods.
4460 2003-05-12 Martin Baulig <martin@ximian.com>
4462 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
4463 only used for locals and not for parameters.
4465 2003-05-12 Miguel de Icaza <miguel@ximian.com>
4467 * support.cs (InternalParameters.ParameterType): Return the
4468 ExternalType of the parameter.
4470 * parameter.cs (Parameter.ExternalType): drop the two arguments,
4473 2003-05-11 Miguel de Icaza <miguel@ximian.com>
4475 * class.cs (MethodData.Define): Do not set the `newslot' on
4476 interface members, if they are also flagged as "override".
4478 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
4479 better code for ++i and i++. This only works for static fields
4480 and local variables.
4482 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
4483 want to pull the DeclSpace out of the builder_to_declspace instead
4484 of the TypeBuilder (like in TypeContainer.FindMembers).
4486 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
4487 instead of LookupTypeContainer. Fixes the crash on .NET for
4488 looking up interface members.
4490 * const.cs: Create our own emit context during the Definition
4491 stage, so that constants are evaluated in the proper context, when
4492 a recursive definition happens.
4494 2003-05-11 Martin Baulig <martin@ximian.com>
4496 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
4497 new block for a switch section.
4498 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
4499 the adding/lookup in the switch block. Fixes #39828.
4501 2003-05-09 Miguel de Icaza <miguel@ximian.com>
4503 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
4504 functionality: I needed to convert the data after I had performed
4505 the add/sub operation into the operands type size.
4507 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
4508 pass the type for the box operation, otherwise the resulting
4509 object would have been of type object.
4511 (BoxedCast): Add constructor to specify the type to box as.
4513 2003-05-07 Miguel de Icaza <miguel@ximian.com>
4515 * iterators.cs: I was reusing the `count' variable inadvertently,
4516 take steps to not allow this to happen.
4518 2003-05-06 Miguel de Icaza <miguel@ximian.com>
4520 * attribute.cs (Attribute.Resolve): Params attributes are encoded
4521 by creating an array at the point where the params starts and
4522 putting all those arguments there, then adjusting the size of the
4525 2003-05-05 Miguel de Icaza <miguel@ximian.com>
4527 * expression.cs (New.AddressOf): Implement interface
4528 IMemoryLocation. This is used when the `new' operator is used in
4529 the context of an invocation to a method on a value type.
4531 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
4534 * namespace.cs: Also check the using aliases here.
4536 * driver.cs: Move the test for using validity after the types have
4537 been entered, so we do a single pass that also includes the using
4540 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
4541 in the regular case. CreateSiblingForFinally is doing extra
4544 * attribute.cs (GetAttributeArgumentExpression): Store the result
4545 on an out value, and use the return value to indicate failure
4546 instead of using null (which is a valid return for Constant.GetValue).
4548 * statement.cs: Perform the analysis flow for the increment
4549 portion after the statement, because this will be the real flow of
4550 execution. Fixes #42385
4552 * codegen.cs (EmitContext.EmitArgument,
4553 EmitContext.EmitStoreArgument): New helper functions when the
4554 RemapToProxy flag is set.
4556 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
4559 Add support for remapping parameters.
4561 * iterators.cs: Propagate parameter values; Store parameter
4562 values in the proxy classes.
4564 2003-05-04 Miguel de Icaza <miguel@ximian.com>
4566 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
4567 need a proxy reference; I do not know what I was thinking
4569 * cs-parser.jay (constructor_initializer): catch another error,
4570 and display nice message.
4572 (field_declaration): catch void field declaration
4573 to flag a better error.
4575 * class.cs (MemberBase.CheckBase): Report an error instead of a
4576 warning if a new protected member is declared in a struct.
4577 (Field.Define): catch the error of readonly/volatile.
4579 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
4581 (FieldExpr.AddressOf): ditto. Catch error where the address of a
4582 volatile variable is taken
4584 2003-05-02 Miguel de Icaza <miguel@ximian.com>
4586 * statement.cs (Fixed.Resolve): Report an error if we are not in
4589 2003-05-01 Miguel de Icaza <miguel@ximian.com>
4591 * typemanager.cs: reuse the code that handles type clashes for
4592 delegates and enumerations.
4594 * class.cs (Report28): Always report.
4596 * expression.cs (EncodeAsAttribute): Allow nulls here.
4598 2003-04-28 Miguel de Icaza <miguel@ximian.com>
4600 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
4601 the functionality for testing whether an expression is valid for
4602 an attribute here. Also handle the case of arrays of elements
4605 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
4606 encoding a linear array into an array of objects that are suitable
4607 to be passed to an CustomAttributeBuilder.
4609 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
4611 * ecore.cs: (FieldExpr): Handle field remapping here.
4613 * iteratators.cs: Pass the instance variable (if the method is an
4614 instance method) to the constructors, so we can access the field
4615 variables on the class.
4617 TODO: Test this with structs. I think the THIS variable on
4618 structs might have to be a pointer, and not a refenrece
4620 2003-04-27 Miguel de Icaza <miguel@ximian.com>
4622 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
4623 local variables to fields in a proxy class.
4625 * iterators.cs (PopulateProxy): Rename our internal fields to
4627 Create a <THIS> field if we are an instance method, so we can
4628 reference our parent container variables.
4629 (MapVariable): Called back from the EmitContext code to enter a
4630 new variable to field mapping into the proxy class (we just create
4634 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
4635 for using the remapped locals to fields.
4637 I placed the code here, because that gives the same semantics to
4638 local variables, and only changes the Emit code.
4640 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
4641 statements inside iterators.
4642 (VariableInfo): Add a FieldBuilder for the cases when we are
4643 remapping local variables to fields in a proxy class
4645 * ecore.cs (SimpleNameResolve): Avoid testing two times for
4646 current_block != null.
4648 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
4649 not cope with strings, as it has been moved to the
4650 TableSwitchEmit. Fixed bug in switch generation.
4652 * expression.cs (New.DoResolve): Provide more context for the user
4653 when reporting an error.
4655 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
4658 * expression.cs (MemberAccess.DoResolve): When we get a type back,
4659 check the permissions for it. Note than in a type-resolution
4660 context the check was already present in DeclSpace.ResolveType,
4661 but was missing from the MemberAccess.
4663 (ArrayCreation.CheckIndices): warn if the user has
4664 more nested levels of expressions, but there are no more
4665 dimensions specified. Avoids crash on bug 41906.
4667 2003-04-26 Miguel de Icaza <miguel@ximian.com>
4669 * statement.cs (Block): replace Implicit bool, for a generic
4671 New flag: `Unchecked'. This is used during the EmitMeta phase
4672 (which is out-of-line with the regular Resolve/Emit process for a
4673 statement, as this is done ahead of time, but still gets a chance
4674 to call constant resolve).
4676 (Block.Flags): new enum for adding a new flag.
4678 (Block.EmitMeta): track the state of unchecked.
4680 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
4681 to enable constant resolution to work there as well.
4683 2003-04-22 Miguel de Icaza <miguel@ximian.com>
4685 * typemanager.cs (ienumerable_type): Also look up
4686 System.Collections.IEnumerable.
4688 2003-04-21 Miguel de Icaza <miguel@ximian.com>
4690 TODO: Test more than one conditional per method.
4692 * class.cs (Indexer.Define): Report the location where the user is
4693 referencing the unsupported feature.
4695 (MethodData): Overload the use of `conditionals' to
4696 minimize the creation of needless ArrayLists. This saves roughly
4697 212kb on my machine.
4699 (Method): Implement the new IIteratorContainer interface.
4700 (Method.SetYields): Implement the method by setting the ModFlags
4701 to contain METHOD_YIELDS.
4703 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
4704 which just got set to null.
4706 * iterators.cs: New file.
4708 (Yield, YieldBreak): New statements.
4710 * statement.cs (Return.Resolve): Flag an error if we are used in
4713 * codegen.cs (InIterator): New flag set if the code is being
4714 compiled in an iterator method.
4716 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
4717 internal modifier, and we just use it to avoid adding extra
4718 fields, as this is seldom used.
4720 * cs-parser.jay: Add yield_statement (yield and yield break).
4722 * driver.cs: New flag -v2 to turn on version 2 features.
4724 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
4725 hashtable when v2 is enabled.
4727 2003-04-20 Miguel de Icaza <miguel@ximian.com>
4729 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
4730 there is already a namespace defined with this name.
4732 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
4733 people upgraded their corlibs.
4735 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
4736 always use fully qualified types, no need to use the compiler
4739 (TypeManager.IsNamespace): Use binarysearch.
4741 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
4742 AddDelegate): I did not quite use the new IsValid API properly: I
4743 have to pass the short-name and the fullname. I was passing only
4744 the basename instead of the fullname sometimes.
4746 (TypeContainer.DefineType): call NamespaceClash.
4748 * interface.cs (Interface.DefineType): use NamespaceClash before
4751 * delegate.cs (Delegate.DefineType): use NamespaceClash before
4754 * enum.cs: (Enum.DefineType): use NamespaceClash before
4757 * typemanager.cs (: 3-line patch that gives us some tasty 11%
4758 speed increase. First, use the negative_hits cache when we get a
4759 negative. Second, add the type with its full original name
4760 instead of the new . and + encoded name (reflection uses + to
4761 separate type from a nested type). Use LookupTypeReflection
4762 directly which bypasses the type->name hashtable (that we already
4763 know does not contain the type.
4765 * decl.cs (DeclSpace.ResolveTypeExpr): track the
4766 location/container type.
4768 * driver.cs: When passing utf8, use directly the UTF8Encoding.
4770 2003-04-19 Miguel de Icaza <miguel@ximian.com>
4772 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
4774 * delegate.cs (NewDelegate.Resolve): Test whether an instance
4775 method is being referenced in the method group from a static
4776 context, and report error 120 if so.
4778 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
4781 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
4782 is created, we create the A namespace).
4784 * cs-parser.jay: A namespace also introduces a DeclarationFound.
4787 2003-04-18 Miguel de Icaza <miguel@ximian.com>
4789 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
4790 invocation to ModuleBuilder.GetType with the same values will
4791 return a new type instance, so we need to cache its return
4794 * expression.cs (Binary.ResolveOperator): Only allow the compare
4795 operators on enums if they are of the same type.
4797 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
4798 types of ValueType on their own case. Before we were giving them
4799 the same treatment as objects.
4801 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
4802 fullname. Short name is used to compare against container name.
4803 Fullname is used to check against defined namespace names.
4805 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
4806 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
4808 (Method.CheckBase): Call parent.
4809 (MemberBase.CheckBase): Check for protected members on sealed
4811 (PropertyBase.CheckBase): Call parent.
4812 (Field.Define): Call parent.
4814 * report.cs: Negative error codes are now mapped to 8000 - code,
4815 so that the display is render more nicely.
4817 * typemanager.cs: Do not use try/catch, instead report a regular
4820 (GetPointerType, GetReferenceType): These methods provide
4821 mechanisms to obtain the T* and T& from a T. We had the code
4822 previously scattered around the code base, and it also used
4823 TypeManager.LookupType that would go through plenty of caches.
4824 This one goes directly to the type source.
4826 In some places we did the Type.GetType followed by
4827 ModuleBuilder.GetType, but not in others, so this unifies the
4830 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
4831 statements now that we have namespace information.
4833 * typemanager.cs (IsNamespace): New method, returns whether the
4834 string presented is a namespace or not.
4836 (ComputeNamespaces): New public entry point, computes the list of
4837 available namespaces, using the GetNamespaces API call in Mono, or
4838 the slower version in MS.NET.
4840 Now before we start the semantic analysis phase, we have a
4841 complete list of namespaces including everything that the user has
4844 Deleted old code to cache namespaces in .nsc files.
4846 2003-04-17 Miguel de Icaza <miguel@ximian.com>
4848 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
4849 class/struct location definition Location for the implicit
4850 constructor location.
4852 (Operator.Define): Use the location of the operator for the
4853 implicit Method definition.
4855 (Constructor.Emit): use the constructor location for the implicit
4856 base initializer constructor.
4858 * ecore.cs: Remove ITypeExpression. This interface is now gone,
4859 and the Expression class now contains two new methods:
4861 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
4862 isolate type lookup from the rest of the resolution process.
4864 Since we use Expressions to hold type definitions due to the way
4865 we parse the input we have historically overloaded Resolve to
4866 perform the Type lookups if a special flag is passed. Now this is
4867 eliminated and two methods take their place.
4869 The differences in the two methods between xStep and xTerminal is
4870 that xStep is involved in our current lookup system that uses
4871 SimpleNames to compose a name, while xTerminal is used just to
4872 catch the case where the simplename lookup failed.
4874 2003-04-16 Miguel de Icaza <miguel@ximian.com>
4876 * expression.cs (ResolveMemberAccess): Remove redundant code.
4877 TypeExpr expressions are always born fully resolved.
4879 * interface.cs (PopulateMethod): Do not lookup the types twice.
4880 We were doing it once during SemanticAnalysis and once during
4883 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
4884 in local variable type definitions, were being returned as a
4885 SimpleName (we decomposed everything into a string), that is
4886 because primary_expression was being used instead of a type in the
4887 grammar (reduce/reduce conflicts).
4889 The part that was wrong is that we converted the expression into a
4890 string (an oversimplification in one hand, compounded with primary
4891 expressions doing string concatenation).
4897 Would return "A.B.C[]" as a SimpleName. This stopped things like
4898 using clauses from working on this particular context. And a type
4899 was being matched directly against "A.B.C[]".
4901 We now use the correct approach, and allow for ComposedCast to be
4902 part of the unary expression. So the "A.B.C []" become a composed
4903 cast of "A.B.C" (as a nested group of MemberAccess with a
4904 SimpleName at the end) plus the rank composition "[]".
4908 2003-04-10 Miguel de Icaza <miguel@ximian.com>
4910 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
4911 for the access level checking.
4913 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
4914 `TypeContainer container', because I kept getting confused when I
4915 was debugging this code.
4917 * expression.cs (Indexers): Instead of tracking getters/setters,
4918 we now track them in parallel. We create one arraylist less, but
4919 most importantly it is possible now for the LValue code to find a
4920 matching get for a set.
4922 (IndexerAccess.DoResolveLValue): Update the code.
4923 GetIndexersForType has been modified already to extract all the
4924 indexers from a type. The code assumed it did not.
4926 Also make the code set the correct return type for the indexer.
4927 This was fixed a long time ago for properties, but was missing for
4928 indexers. It used to be void_type.
4930 (Binary.Emit): Test first for doubles instead of
4931 floats, as they are more common.
4933 (Binary.EmitBranchable): Use the .un version of the branch opcodes
4934 when dealing with floats and the <=, >= operators. This fixes bug
4937 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
4938 to load the array value by emitting a load on the foreach variable
4939 type. This was incorrect.
4941 We now emit the code to load an element using the the array
4942 variable type, and then we emit the conversion operator.
4946 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
4948 * attribute.cs: Avoid allocation of ArrayLists in the common case.
4950 2003-04-09 Miguel de Icaza <miguel@ximian.com>
4952 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
4953 test for protection before we test for signatures.
4955 (MethodSignature.ToString): implement.
4957 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
4958 to the case where we reduced into a LongConstant.
4960 * decl.cs (CheckAccessLevel): If the type is an array, we can not
4961 depend on whether the information is acurrate, because the
4962 Microsoft runtime will always claim that the array type is public,
4963 regardless of the real state.
4965 If the type is a pointer, another problem happens: the type is
4966 reported as non-public in Microsoft.
4968 In both cases we have to call CheckAccessLevel recursively with
4969 the underlying type as the argument to be tested.
4971 2003-04-08 Miguel de Icaza <miguel@ximian.com>
4973 * assign.cs (Assign.Emit): If we are dealing with a compound
4974 assignment expression, we should use the code path that stores the
4975 intermediate result in a temporary value. This fixes #40903.
4977 *expression.cs (Indirection.ToString): Provide ToString method for
4980 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
4982 * class.cs: Null out fields holding references to Block objects so
4983 they can be garbage collected.
4985 * expression.cs (OverloadResolve): Remove unused local.
4987 2003-04-07 Martin Baulig <martin@ximian.com>
4989 * codegen.cs (EmitContext.CurrentFile): New public field.
4990 (EmitContext.Mark): Use the CurrentFile to check whether the
4991 location is in the correct file.
4992 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
4994 2003-04-07 Martin Baulig <martin@ximian.com>
4996 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
4998 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
4999 location. [FIXME: The location argument which gets passed to this
5000 method is sometimes wrong!]
5002 2003-04-07 Nick Drochak <ndrochak@gol.com>
5004 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
5006 2003-04-07 Miguel de Icaza <miguel@ximian.com>
5008 * expression.cs (Indirection.EmitAssign): We were using the
5009 temporary, but returning immediately instead of continuing the
5012 2003-04-06 Martin Baulig <martin@ximian.com>
5014 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
5015 if it's a nested child, but also deriving from the outer class.
5018 * typemanager.cs (IsNestedChildOf): Make this work if it's a
5019 nested child, but also deriving from the outer class. See
5021 (FilterWithClosure): We may access private members of the outer
5022 class if we're a nested child and deriving from the outer class.
5023 (RealMemberLookup): Only set `closure_private_ok' if the
5024 `original_bf' contained BindingFlags.NonPublic.
5026 2003-04-05 Martin Baulig <martin@ximian.com>
5028 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
5029 probe if its a type parameter, and if so, flag an error.
5031 * decl.cs: Move here the SetParameterInfo code from class.cs.
5032 Handle IsGeneric here.
5034 Handle a variety of errors in the parameter info definition.
5036 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
5037 type parameters here.
5039 * cs-parser.jay (class_declaration): report errors for parameters
5042 2003-01-21 Miguel de Icaza <miguel@ximian.com>
5044 * generic.cs: New file, contains support code for generics.
5046 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
5047 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
5049 Update parser for the above removals.
5051 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
5052 now taken care of in the parser.
5054 2003-04-02 Miguel de Icaza <miguel@ximian.com>
5056 * class.cs (Event.Define): Do not allow abstract events to have
5059 2003-04-01 Miguel de Icaza <miguel@ximian.com>
5061 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
5062 block in event declarations.
5064 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
5065 value type, get its address.
5067 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
5068 leaving a class on the stack instead of a boolean value (int
5069 0/1). Change the code so we compare against null, and then the
5070 result against zero.
5072 * class.cs (TypeContainer.GetClassBases): We were checking for the
5073 parent class being sealed too late.
5075 * expression.cs (Binary.Emit): For <= and >= when dealing with
5076 floating point values, use cgt.un and clt.un instead of cgt and
5079 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
5081 * statement.cs: Apply the same optimization as MS: skip the
5082 GetEnumerator returning an IEnumerator, and use the one returning a
5083 CharEnumerator instead. This allows us to avoid the try-finally block
5086 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
5088 * cs-parser.jay: Attributes cannot be applied to
5089 namespaces. Fixes #40473
5091 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5094 (Add*): check if the name is valid using the full name for constants,
5095 fields, properties and events.
5097 2003-03-28 Miguel de Icaza <miguel@ximian.com>
5099 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
5100 char constants to be part of the enumeration.
5102 * expression.cs (Conditional.DoResolve): Add support for operator
5103 true. Implements the missing functionality from 14.12
5105 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
5106 operator true/false as required by the spec.
5108 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
5109 implicit conversion to boolean.
5111 * statement.cs (Statement.ResolveBoolean): A boolean expression is
5112 also one where the type implements `operator true'.
5114 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
5115 get an expression that will invoke operator true based on an
5118 (GetConversionOperators): Removed the hack that called op_True
5121 (Expression.ResolveBoolean): Move this from Statement.
5123 2003-03-17 Miguel de Icaza <miguel@ximian.com>
5125 * ecore.cs (FieldExpr): do not allow initialization of initonly
5126 fields on derived classes
5128 2003-03-13 Martin Baulig <martin@ximian.com>
5130 * statement.cs (Block.Emit): Call ig.BeginScope() and
5131 ig.EndScope() when compiling with debugging info; call
5132 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
5134 2003-03-08 Miguel de Icaza <miguel@ximian.com>
5136 * expression.cs (Indexers): Do not construct immediately, allow
5137 for new members to be appended as we go. Fixes 38143
5139 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5141 * expression.cs: save/restore context when resolving an unchecked
5144 2003-03-05 Miguel de Icaza <miguel@ximian.com>
5146 * cfold.cs: Catch division by zero in modulus operator during
5149 2003-03-03 Miguel de Icaza <miguel@ximian.com>
5151 * interface.cs (Interface.DefineMembers): Avoid defining members
5154 2003-02-27 Miguel de Icaza <miguel@ximian.com>
5156 * driver.cs: handle the +/- options for -noconfig
5158 * statement.cs (Unckeched.Resolve): Also track the state of
5159 unchecked in the Resolve phase.
5161 2003-02-27 Martin Baulig <martin@ximian.com>
5163 * ecore.cs (Expression.MemberLookup): Don't create a
5164 MethodGroupExpr for something which is not a method. Fixes #38291.
5166 2003-02-25 Miguel de Icaza <miguel@ximian.com>
5168 * class.cs (MemberBase.CheckParameters): Also check that the type
5169 is unmanaged if it is a pointer.
5171 * expression.cs (SizeOf.Resolve): Add location information.
5173 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
5174 a managed type is declared.
5176 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
5177 parameter modifiers as well. Fixes bug 38606
5179 * class.cs: Very sad. Am backing out the speed up changes
5180 introduced by the ArrayList -> Array in the TypeContainer, as they
5181 were not actually that much faster, and introduced a bug (no error
5182 reports on duplicated methods).
5184 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
5185 source first, this will guarantee that we have a valid expression
5186 before calling in lower levels functions that will require a
5187 resolved object. Then use this original_source in the
5188 target.ResolveLValue instead of the original source that was
5191 Another change. Use target.Resolve instead of LValueResolve.
5192 Although we are resolving for LValues, we will let the Assign code
5193 take care of that (it will be called again from Resolve). This
5194 basically allows code like this:
5196 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
5197 class Y { void A (X x) { x [0] += o; }
5199 The problem was that the indexer was trying to resolve for
5200 set_Item (idx, object o) and never finding one. The real set_Item
5201 was set_Item (idx, X). By delaying the process we get the right
5206 2003-02-23 Martin Baulig <martin@ximian.com>
5208 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
5209 while calling DoEmit ().
5211 * codegen.cs (EmitContext.Mark): Don't mark locations in other
5212 source files; if you use the #line directive inside a method, the
5213 compiler stops emitting line numbers for the debugger until it
5214 reaches the end of the method or another #line directive which
5215 restores the original file.
5217 2003-02-23 Martin Baulig <martin@ximian.com>
5219 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
5221 2003-02-23 Martin Baulig <martin@ximian.com>
5223 * statement.cs (Block.AddChildVariableNames): We need to call this
5224 recursively, not just for our immediate children.
5226 2003-02-23 Martin Baulig <martin@ximian.com>
5228 * class.cs (Event.Define): Always make the field private, like csc does.
5230 * typemanager.cs (TypeManager.RealMemberLookup): Make events
5231 actually work, fixes bug #37521.
5233 2003-02-23 Miguel de Icaza <miguel@ximian.com>
5235 * delegate.cs: When creating the various temporary "Parameters"
5236 classes, make sure that we call the ComputeAndDefineParameterTypes
5237 on those new parameters (just like we do with the formal ones), to
5238 allow them to be resolved in the context of the DeclSpace.
5240 This fixes the bug that Dick observed in Bugzilla #38530.
5242 2003-02-22 Miguel de Icaza <miguel@ximian.com>
5244 * expression.cs (ResolveMemberAccess): When resolving a constant,
5245 do not attempt to pull a constant if the value was not able to
5246 generate a valid constant.
5248 * const.cs (LookupConstantValue): Do not report more errors than required.
5250 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5252 * expression.cs: fixes bug #38328.
5254 2003-02-18 Miguel de Icaza <miguel@ximian.com>
5256 * class.cs: Changed all the various members that can be part of a
5257 class from being an ArrayList to be an Array of the right type.
5258 During the DefineType type_list, interface_list, delegate_list and
5259 enum_list are turned into types, interfaces, delegates and enums
5262 And during the member population, indexer_list, event_list,
5263 constant_list, field_list, instance_constructor_list, method_list,
5264 operator_list and property_list are turned into their real arrays.
5266 Although we could probably perform this operation earlier, for
5267 good error reporting we need to keep the lists and remove the
5268 lists for longer than required.
5270 This optimization was triggered by Paolo profiling the compiler
5271 speed on the output of `gen-sample-program.pl' perl script.
5273 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
5274 not crash in methods like MemberLookupFailed that use this field.
5276 This problem arises when the compiler fails to resolve a type
5277 during interface type definition for example.
5279 2003-02-18 Miguel de Icaza <miguel@ximian.com>
5281 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
5282 inherit from System.Object, so we have to stop at null, not only
5283 when reaching System.Object.
5285 2003-02-17 Miguel de Icaza <miguel@ximian.com>
5287 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
5288 DeclaredOnly because the parent indexer might have had a different
5289 name, but did not loop until the top of the hierarchy was reached.
5291 The problem this one fixes is 35492: when a class implemented an
5292 indexer from an interface, we were getting the interface method
5293 (which was abstract) and we were flagging an error (can not invoke
5296 This also keeps bug 33089 functioning, and test-148 functioning.
5298 * typemanager.cs (IsSpecialMethod): The correct way of figuring
5299 out if a method is special is to see if it is declared in a
5300 property or event, or whether it is one of the predefined operator
5301 names. This should fix correctly #36804.
5303 2003-02-15 Miguel de Icaza <miguel@ximian.com>
5305 The goal here is to remove the dependency on EmptyCast.Peel ().
5306 Killing it completely.
5308 The problem is that currently in a number of places where
5309 constants are expected, we have to "probe" for an EmptyCast, and
5310 Peel, which is not the correct thing to do, as this will be
5311 repetitive and will likely lead to errors.
5313 The idea is to remove any EmptyCasts that are used in casts that
5314 can be reduced to constants, so we only have to cope with
5317 This bug hunt was triggered by Bug 37363 and the desire to remove
5318 the duplicate pattern where we were "peeling" emptycasts to check
5319 whether they were constants. Now constants will always be
5322 * ecore.cs: Use an enumconstant here instead of wrapping with
5325 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
5326 throwing me off. By handling this we can get rid of a few hacks.
5328 * statement.cs (Switch): Removed Peel() code.
5330 2003-02-14 Miguel de Icaza <miguel@ximian.com>
5332 * class.cs: Location information for error 508
5334 * expression.cs (New.DoResolve): Add a guard against double
5335 resolution of an expression.
5337 The New DoResolve might be called twice when initializing field
5338 expressions (see EmitFieldInitializers, the call to
5339 GetInitializerExpression will perform a resolve on the expression,
5340 and later the assign will trigger another resolution
5342 This leads to bugs (#37014)
5344 * delegate.cs: The signature for EndInvoke should contain any ref
5345 or out parameters as well. We were not doing this in the past.
5347 * class.cs (Field.Define): Do not overwrite the type definition
5348 inside the `volatile' group. Turns out that volatile enumerations
5349 were changing the type here to perform a validity test, which
5352 2003-02-12 Miguel de Icaza <miguel@ximian.com>
5354 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
5355 and structs, we do not want to load the instance variable
5357 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
5358 enum_type has to be handled like an object reference (implicit
5359 conversions exists from this to object), but the regular IsClass
5360 and IsValueType tests will never return true for this one.
5362 Also we use TypeManager.IsValueType instead of type.IsValueType,
5363 just for consistency with the rest of the code (this is only
5364 needed if we ever use the construct exposed by test-180.cs inside
5365 corlib, which we dont today).
5367 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
5369 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
5372 2003-02-09 Martin Baulig <martin@ximian.com>
5374 * namespace.cs (Namespace..ctor): Added SourceFile argument.
5375 (Namespace.DefineNamespaces): New static public method; this is
5376 called when we're compiling with debugging to add all namespaces
5379 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
5380 pass it to the Namespace's .ctor.
5382 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
5383 and MethodBase arguments; pass the namespace ID to the symwriter;
5384 pass the MethodBase instead of the token to the symwriter.
5385 (SymbolWriter.DefineNamespace): New method to add a namespace to
5388 2003-02-09 Martin Baulig <martin@ximian.com>
5390 * symbolwriter.cs: New file. This is a wrapper around
5391 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
5392 methods here in near future.
5394 2003-02-09 Martin Baulig <martin@ximian.com>
5396 * codegen.cs (EmitContext.Mark): Just pass the arguments to
5397 ILGenerator.MarkSequencePoint() which are actually used by the
5400 2003-02-09 Martin Baulig <martin@ximian.com>
5402 * location.cs (SourceFile): New public sealed class. This
5403 contains the name and an index which is used in the location's token.
5404 (Location): Reserve an appropriate number of bits in the token for
5405 the source file instead of walking over that list, this gives us a
5406 really huge performance improvement when compiling with debugging.
5408 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
5409 `SourceFile' argument instead of a string.
5410 (Driver.ProcessFile): Add all the files via Location.AddFile(),
5411 but don't parse/tokenize here, we need to generate the list of all
5412 source files before we do that.
5413 (Driver.ProcessFiles): New static function. Parses/tokenizes all
5416 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
5417 instead of a string.
5419 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
5422 2003-02-09 Martin Baulig <martin@ximian.com>
5424 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
5425 filename on `#line default'.
5427 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
5429 * statement.cs: don't clear the pinned var when the fixed statement
5430 returns from the method (fixes bug#37752).
5432 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
5434 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
5437 2003-02-07 Martin Baulig <martin@ximian.com>
5439 * driver.cs: Removed the `--debug-args' command line argument.
5441 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
5442 automatically by the AsssemblyBuilder.
5443 (CodeGen.InitializeSymbolWriter): We don't need to call any
5444 initialization function on the symbol writer anymore. This method
5445 doesn't take any arguments.
5447 2003-02-03 Miguel de Icaza <miguel@ximian.com>
5449 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
5450 from referenced assemblies as well.
5452 2003-02-02 Martin Baulig <martin@ximian.com>
5454 * class.cs (MethodData.Emit): Generate debugging info for external methods.
5456 2003-02-02 Martin Baulig <martin@ximian.com>
5458 * class.cs (Constructor.Emit): Open the symbol writer before
5459 emitting the constructor initializer.
5460 (ConstructorInitializer.Emit): Call ec.Mark() to allow
5461 single-stepping through constructor initializers.
5463 2003-01-30 Miguel de Icaza <miguel@ximian.com>
5465 * class.cs: Handle error 549: do not allow virtual methods in
5468 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
5470 * decl.cs: Check access levels when resolving types
5472 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
5474 * statement.cs: Add parameters and locals set in catch blocks that might
5475 return to set vector
5477 2003-01-29 Miguel de Icaza <miguel@ximian.com>
5479 * class.cs (Operator): Set the SpecialName flags for operators.
5481 * expression.cs (Invocation.DoResolve): Only block calls to
5482 accessors and operators on SpecialName methods.
5484 (Cast.TryReduce): Handle conversions from char constants.
5487 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
5489 * statement.cs: small memory and time optimization in FlowBranching.
5491 2003-01-28 Pedro Mart <yoros@wanadoo.es>
5493 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
5494 problem that the last fix but in the other sid (Set).
5496 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
5497 access when there is no indexer in the hierarchy.
5499 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
5501 * class.cs: Combine some if statements.
5503 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5505 * driver.cs: fixed bug #37187.
5507 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
5509 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
5510 any indexer, it's needed to build a list with all the indexers in the
5511 hierarchy (AllGetters), else we have problems. Fixes #35653.
5513 2003-01-23 Miguel de Icaza <miguel@ximian.com>
5515 * class.cs (MethodData.Define): It is wrong for an interface
5516 implementation to be static in both cases: explicit and implicit.
5517 We were only handling this in one case.
5519 Improve the if situation there to not have negations.
5521 * class.cs (Field.Define): Turns out that we do not need to check
5522 the unsafe bit on field definition, only on usage. Remove the test.
5524 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5526 * driver.cs: use assembly.Location instead of Codebase (the latest
5527 patch made mcs fail when using MS assemblies).
5529 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
5531 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
5532 get the path to *corlib.dll.
5534 2003-01-21 Nick Drochak <ndrochak@gol.com>
5538 * typemanager.cs: Remove compiler warnings
5540 2003-01-20 Duncan Mak <duncan@ximian.com>
5542 * AssemblyInfo.cs: Bump the version number to 0.19.
5544 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5546 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
5548 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
5550 * class.cs (Constructor::Emit): Emit debugging info for constructors.
5552 2003-01-17 Miguel de Icaza <miguel@ximian.com>
5554 * cs-parser.jay: Small fix: we were not comparing the constructor
5555 name correctly. Thanks to Zoltan for the initial pointer.
5557 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
5559 * cs-tokenizer.cs: Set file name when specified with #line
5561 2003-01-15 Miguel de Icaza <miguel@ximian.com>
5563 * cs-parser.jay: Only perform the constructor checks here if we
5564 are named like the class; This will help provider a better
5565 error. The constructor path is taken when a type definition is
5566 not found, but most likely the user forgot to add the type, so
5567 report that rather than the constructor error.
5569 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
5571 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
5574 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
5576 * cs-parser.jay: Add cleanup call.
5578 2003-01-13 Duncan Mak <duncan@ximian.com>
5580 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
5581 consistent with other methods.
5583 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
5585 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
5587 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
5589 * attribute.cs: only set GuidAttr to true when we have a
5592 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5596 * typemanager.cs: fixes to allow mcs compile corlib with the new
5597 Type.IsSubclassOf fix.
5599 2003-01-08 Miguel de Icaza <miguel@ximian.com>
5601 * expression.cs (LocalVariableReference.DoResolve): Classify a
5602 constant as a value, not as a variable. Also, set the type for
5605 * cs-parser.jay (fixed_statement): take a type instead of a
5606 pointer_type, so we can produce a better error message later.
5608 * statement.cs (Fixed.Resolve): Flag types that are not pointers
5611 (For.DoEmit): Make inifinite loops have a
5612 non-conditional branch back.
5614 (Fixed.DoEmit): First populate the pinned variables, then emit the
5615 statement, then clear the variables. Before I was emitting the
5616 code once for each fixed piece.
5619 2003-01-08 Martin Baulig <martin@ximian.com>
5621 * statement.cs (FlowBranching.MergeChild): A break in a
5622 SWITCH_SECTION does not leave a loop. Fixes #36155.
5624 2003-01-08 Martin Baulig <martin@ximian.com>
5626 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
5627 lives in the same number space than `param_map'. Fixes #36154.
5629 2003-01-07 Miguel de Icaza <miguel@ximian.com>
5631 * cs-parser.jay (constructor_declaration): Set the
5632 Constructor.ModFlags before probing for it. This makes the
5633 compiler report 514, 515 and 132 (the code was there, but got
5636 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
5637 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
5638 (GotoCase.Resolve): Set `Returns' to ALWAYS.
5640 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
5642 * enum.cs: create the enum static fields using the enum type.
5644 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
5646 * class.cs: don't try to create the ParamBuilder for the return
5647 type if it's not needed (and handle it breaking for the ms runtime
5650 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
5652 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
5654 2002-12-29 Miguel de Icaza <miguel@ximian.com>
5656 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
5657 the command. This showed up while compiling the JANET source
5658 code, which used \r as its only newline separator.
5660 2002-12-28 Miguel de Icaza <miguel@ximian.com>
5662 * class.cs (Method.Define): If we are an operator (because it
5663 reuses our code), then set the SpecialName and HideBySig. #36128
5665 2002-12-22 Miguel de Icaza <miguel@ximian.com>
5667 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
5668 exception, report error 120 `object reference required'.
5670 * driver.cs: Add --pause option, used during to measure the size
5671 of the process as it goes with --timestamp.
5673 * expression.cs (Invocation.DoResolve): Do not allow methods with
5674 SpecialName to be invoked.
5676 2002-12-21 Miguel de Icaza <miguel@ximian.com>
5678 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
5679 number before adding it.
5681 2002-12-21 Ravi Pratap <ravi@ximian.com>
5683 * ecore.cs (StandardImplicitConversion): When in an unsafe
5684 context, we allow conversion between void * to any other pointer
5685 type. This fixes bug #35973.
5687 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
5689 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
5690 is not thrown when extensionless outputs are used
5692 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5694 * rootcontext.cs: fixed compilation of corlib.
5696 2002-12-19 Miguel de Icaza <miguel@ximian.com>
5698 * attribute.cs (Attributes.Contains): Add new method.
5700 * class.cs (MethodCore.LabelParameters): if the parameter is an
5701 `out' parameter, check that no attribute `[In]' has been passed.
5703 * enum.cs: Handle the `value__' name in an enumeration.
5705 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
5707 * decl.cs: Added special case to allow overrides on "protected
5710 2002-12-18 Ravi Pratap <ravi@ximian.com>
5712 * attribute.cs (Attributes.AddAttributeSection): Rename to this
5713 since it makes much more sense.
5715 (Attributes.ctor): Don't require a Location parameter.
5717 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
5719 * attribute.cs (ApplyAttributes): Remove extra Location parameters
5720 since we already have that information per attribute.
5722 * everywhere : make appropriate changes.
5724 * class.cs (LabelParameters): Write the code which actually
5725 applies attributes to the return type. We can't do this on the MS
5726 .NET runtime so we flag a warning in the case an exception is
5729 2002-12-18 Miguel de Icaza <miguel@ximian.com>
5731 * const.cs: Handle implicit null conversions here too.
5733 2002-12-17 Ravi Pratap <ravi@ximian.com>
5735 * class.cs (MethodCore.LabelParameters): Remove the extra
5736 Type [] parameter since it is completely unnecessary. Instead
5737 pass in the method's attributes so that we can extract
5738 the "return" attribute.
5740 2002-12-17 Miguel de Icaza <miguel@ximian.com>
5742 * cs-parser.jay (parse): Use Report.Error to flag errors instead
5743 of ignoring it and letting the compile continue.
5745 * typemanager.cs (ChangeType): use an extra argument to return an
5746 error condition instead of throwing an exception.
5748 2002-12-15 Miguel de Icaza <miguel@ximian.com>
5750 * expression.cs (Unary.TryReduce): mimic the code for the regular
5751 code path. Perform an implicit cast in the cases where we can
5752 implicitly convert to one of the integral types, and then reduce
5753 based on that constant. This fixes bug #35483.
5755 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5757 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
5759 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5761 * namespace.cs: fixed bug #35489.
5763 2002-12-12 Miguel de Icaza <miguel@ximian.com>
5765 * class.cs: Remove some dead code.
5767 * cs-parser.jay: Estimate the number of methods needed
5768 (RootContext.MethodCount);
5770 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
5771 numbers instead of StringBuilders.
5773 * support.cs (PtrHashtable): Add constructor with initial size;
5774 We can now reduce reallocations of the method table.
5776 2002-12-10 Ravi Pratap <ravi@ximian.com>
5778 * attribute.cs (ApplyAttributes): Keep track of the emitted
5779 attributes on a per-target basis. This fixes bug #35413.
5781 2002-12-10 Miguel de Icaza <miguel@ximian.com>
5783 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
5784 default to the Windows 1252 encoding.
5786 (UnixParseOption): Support version, thanks to Alp for the missing
5789 * AssemblyInfo.cs: Add nice assembly information.
5791 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
5794 * cs-parser.jay: Allow a trailing comma before the close bracked
5795 in the attribute_section production.
5797 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
5798 address of the instance was being taken, I will take this out,
5799 because we take the address of the object immediately here.
5801 2002-12-09 Ravi Pratap <ravi@ximian.com>
5803 * typemanager.cs (AreMultipleAllowed): Take care of the most
5804 obvious case where attribute type is not in the current assembly -
5807 2002-12-08 Miguel de Icaza <miguel@ximian.com>
5809 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
5810 definitions, instead of doing that afterwards.
5812 Also we use a nice little hack, depending on the constructor, we
5813 know if we are a "composed" name or a simple name. Hence, we
5814 avoid the IndexOf test, and we avoid
5816 * codegen.cs: Add code to assist in a bug reporter to track down
5817 the source of a compiler crash.
5819 2002-12-07 Ravi Pratap <ravi@ximian.com>
5821 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
5822 types have been emitted for a given element and flag an error
5823 if something which does not have AllowMultiple set is used more
5826 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
5827 attribute types and their corresponding AllowMultiple properties
5829 (AreMultipleAllowed): Check the property for a given type.
5831 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
5832 property in the case we have a TypeContainer.
5834 (Attributes.AddAttribute): Detect duplicates and just skip on
5835 adding them. This trivial fix catches a pretty gross error in our
5836 attribute emission - global attributes were being emitted twice!
5838 Bugzilla bug #33187 is now fixed.
5840 2002-12-06 Miguel de Icaza <miguel@ximian.com>
5842 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
5845 * expression.cs (Binary.ResolveOperator): I can only use the
5846 Concat (string, string, string) and Concat (string, string,
5847 string, string) if the child is actually a concatenation of
5850 2002-12-04 Miguel de Icaza <miguel@ximian.com>
5852 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
5853 context where we need a 2-character lookahead.
5855 * pending.cs (PendingImplementation): Rework so we can keep track
5856 of interface types all the time, and flag those which were
5857 implemented by parents as optional.
5859 2002-12-03 Miguel de Icaza <miguel@ximian.com>
5861 * expression.cs (Binary.ResolveOperator): Use
5862 String.Concat(string,string,string) or
5863 String.Concat(string,string,string,string) when possible.
5865 * typemanager: More helper methods.
5868 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
5870 * pending.cs: remove the bogus return from GetMissingInterfaces()
5871 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
5873 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5875 * namespace.cs: avoid duplicated 'using xxx' being added to
5876 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
5877 when we get more than one 'using' statement for the same namespace.
5878 Report a CS0105 warning for it.
5880 2002-11-30 Miguel de Icaza <miguel@ximian.com>
5882 * cs-tokenizer.cs (consume_identifier): use read directly, instead
5883 of calling getChar/putback, uses internal knowledge of it.
5885 (xtoken): Reorder tokenizer so most common patterns are checked
5886 first. This reduces the compilation time in another 5% (from 8.11s
5887 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
5889 The parsing time is 22% of the compilation in mcs, and from that
5890 64% is spent on the tokenization process.
5892 I tried using a binary search for keywords, but this is slower
5893 than the hashtable. Another option would be to do a couple of
5896 * Not use a StringBuilder, instead use an array of chars,
5897 with a set value. Notice that this way we could catch
5898 the 645 error without having to do it *afterwards*.
5900 * We could write a hand-parser to avoid the hashtable
5901 compares altogether.
5903 The identifier consumption process takes 37% of the tokenization
5904 time. Another 15% is spent on is_number. 56% of the time spent
5905 on is_number is spent on Int64.Parse:
5907 * We could probably choose based on the string length to
5908 use Int32.Parse or Int64.Parse and avoid all the 64-bit
5911 Another 3% is spend on wrapping `xtoken' in the `token' function.
5913 Handle 0xa0 as whitespace (#34752)
5915 2002-11-26 Miguel de Icaza <miguel@ximian.com>
5917 * typemanager.cs (IsCLRType): New routine to tell whether a type
5918 is one of the builtin types.
5920 Maybe it needs to use TypeCodes to be faster. Maybe we could use
5921 typecode in more places instead of doing pointer comparissions.
5922 We could leverage some knowledge about the way the typecodes are
5925 New code to cache namespaces in assemblies, it is currently not
5926 invoked, to be used soon.
5928 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
5930 * expression.cs (Binary.ResolveOperator): specially handle
5931 strings, and do not perform user-defined operator overloading for
5934 2002-11-24 Miguel de Icaza <miguel@ximian.com>
5936 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
5937 internalcall as it is a pretty simple operation; Avoid whenever
5938 possible to call Char.IsLetter.
5940 (consume_identifier): Cut by half the number of
5941 hashtable calls by merging the is_keyword and GetKeyword behavior.
5943 Do not short-circuit, because if we do, we
5944 report errors (ie, #if false && true would produce an invalid
5948 2002-11-24 Martin Baulig <martin@ximian.com>
5950 * expression.cs (Cast.TryReduce): If we're in checked syntax,
5951 check constant ranges and report a CS0221. Fixes #33186.
5953 2002-11-24 Martin Baulig <martin@ximian.com>
5955 * cs-parser.jay: Make this work for uninitialized variable
5956 declarations in the `for' initializer. Fixes #32416.
5958 2002-11-24 Martin Baulig <martin@ximian.com>
5960 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
5961 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
5963 2002-11-24 Martin Baulig <martin@ximian.com>
5965 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
5966 argument; if true, we also check for user-defined conversions.
5967 This is only needed if both arguments are of a user-defined type.
5968 Fixes #30443, added test-175.cs.
5969 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
5971 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
5973 2002-11-24 Martin Baulig <martin@ximian.com>
5975 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
5976 function to get the store opcode.
5977 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
5978 only emit the Ldelema if the store opcode is Stobj. You must run
5979 both test-34 and test-167 to test this. Fixes #34529.
5981 2002-11-23 Martin Baulig <martin@ximian.com>
5983 * ecore.cs (Expression.MemberLookup): Added additional
5984 `qualifier_type' argument which is used when we're being called
5985 from MemberAccess.DoResolve() and null if we're called from a
5987 (Expression.MemberLookupFailed): New method to report errors; this
5988 does the CS1540 check and reports the correct error message.
5990 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
5991 argument for the CS1540 check and redone the way how we're dealing
5992 with private members. See the comment in the source code for details.
5993 (FilterWithClosure): Reverted this back to revision 1.197; renamed
5994 `closure_start_type' to `closure_qualifier_type' and check whether
5995 it's not null. It was not this filter being broken, it was just
5996 being called with the wrong arguments.
5998 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
5999 and pass it the correct `qualifier_type'; this also does the error
6002 2002-11-22 Miguel de Icaza <miguel@ximian.com>
6004 * expression.cs (Invocation.EmitParams): If the we are dealing
6005 with a non-built-in value type, load its address as well.
6007 (ArrayCreation): Use a a pretty constant instead
6008 of the hardcoded value 2. Use 6 instead of 2 for the number of
6009 static initializers.
6011 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
6012 because they are not really value types, just glorified integers.
6014 * driver.cs: Do not append .exe, the CSC compiler does not do it.
6016 * ecore.cs: Remove redundant code for enumerations, make them use
6017 the same code path as everything else, fixes the casting issue
6018 with enumerations in Windows.Forms.
6020 * attribute.cs: Do only cast to string if it is a string, the
6021 validation happens later.
6023 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
6024 people upgrade their corlibs.
6026 * ecore.cs: Oops, enumerations were not following the entire code path
6028 2002-11-21 Miguel de Icaza <miguel@ximian.com>
6030 * typemanager.cs (FilterWithClosure): Commented out the test for
6031 1540 in typemanager.cs, as it has problems when accessing
6032 protected methods from a parent class (see test-174.cs).
6034 * attribute.cs (Attribute.ValidateGuid): new method.
6035 (Attribute.Resolve): Use above.
6037 2002-11-19 Miguel de Icaza <miguel@ximian.com>
6039 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
6041 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
6042 handling for enumerations, as we only needed the TypeContainer
6043 functionality to begin with (this is required for the fix below to
6044 work for enums that reference constants in a container class for
6047 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
6049 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
6050 a valid TypeBuilder to perform lookups on.o
6052 * class.cs (InheritableMemberSignatureCompare): Use true in the
6053 call to GetGetMethod and GetSetMethod, because we are comparing
6054 the signature, and we need to get the methods *even* if they are
6057 (PropertyBase.CheckBase): ditto.
6059 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
6060 GotoCase.Resolve): Use Peel on EmpytCasts.
6062 * ecore.cs (EmptyCast): drop child, add Peel method.
6064 2002-11-17 Martin Baulig <martin@ximian.com>
6066 * ecore.cs (EmptyCast.Child): New public property.
6068 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
6069 label resolved to an EmptyCast. Fixes #34162.
6070 (GotoCase.Resolve): Likewise.
6071 (Block.EmitMeta): Likewise.
6073 2002-11-17 Martin Baulig <martin@ximian.com>
6075 * expression.cs (Invocation.BetterConversion): Prefer int over
6076 uint; short over ushort; long over ulong for integer literals.
6077 Use ImplicitConversionExists instead of StandardConversionExists
6078 since we also need to check for user-defined implicit conversions.
6079 Fixes #34165. Added test-173.cs.
6081 2002-11-16 Martin Baulig <martin@ximian.com>
6083 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
6084 with the `true' and `false' literals. Fixes #33151.
6086 2002-11-16 Martin Baulig <martin@ximian.com>
6088 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
6089 October 22nd; don't do the cs1540 check for static members.
6091 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
6092 now using our own filter here and doing the cs1540 check again.
6094 2002-11-16 Martin Baulig <martin@ximian.com>
6096 * support.cs (InternalParameters): Don't crash if we don't have
6097 any fixed parameters. Fixes #33532.
6099 2002-11-16 Martin Baulig <martin@ximian.com>
6101 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
6102 when looking up static methods to make this work on Windows.
6105 2002-11-16 Martin Baulig <martin@ximian.com>
6107 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
6108 a setter rather than using PropertyInfo.CanWrite.
6110 2002-11-15 Nick Drochak <ndrochak@gol.com>
6112 * class.cs: Allow acces to block member by subclasses. Fixes build
6115 2002-11-14 Martin Baulig <martin@ximian.com>
6117 * class.cs (Constructor.Emit): Added the extern/block check.
6120 2002-11-14 Martin Baulig <martin@ximian.com>
6122 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
6123 iteration while looking for indexers, this is needed because the
6124 indexer may have a different name in our base classes. Fixed the
6125 error reporting (no indexers at all, not get accessor, no
6126 overloaded match). Fixes bug #33089.
6127 (IndexerAccess.DoResolveLValue): Likewise.
6129 2002-11-14 Martin Baulig <martin@ximian.com>
6131 * class.cs (PropertyBase.CheckBase): Make this work for multiple
6132 indexers. Fixes the first part of bug #33089.
6133 (MethodSignature.InheritableMemberSignatureCompare): Added support
6136 2002-11-13 Ravi Pratap <ravi@ximian.com>
6138 * attribute.cs (Attribute.Resolve): Catch the
6139 NullReferenceException and report it since it isn't supposed to
6142 2002-11-12 Miguel de Icaza <miguel@ximian.com>
6144 * expression.cs (Binary.EmitBranchable): Also handle the cases for
6145 LogicalOr and LogicalAnd that can benefit from recursively
6146 handling EmitBranchable. The code now should be nice for Paolo.
6148 2002-11-08 Miguel de Icaza <miguel@ximian.com>
6150 * typemanager.cs (LookupType): Added a negative-hit hashtable for
6151 the Type lookups, as we perform quite a number of lookups on
6152 non-Types. This can be removed once we can deterministically tell
6153 whether we have a type or a namespace in advance.
6155 But this might require special hacks from our corlib.
6159 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
6160 and double which avoids a conversion from an integer to a double.
6162 * expression.cs: tiny optimization, avoid calling IsConstant,
6163 because it effectively performs the lookup twice.
6165 2002-11-06 Miguel de Icaza <miguel@ximian.com>
6167 But a bogus return here to keep the semantics of the old code
6168 until the Mono runtime is fixed.
6170 * pending.cs (GetMissingInterfaces): New method used to remove all
6171 the interfaces that are already implemented by our parent
6172 classes from the list of pending methods.
6174 * interface.cs: Add checks for calls after ResolveTypeExpr.
6176 2002-11-05 Miguel de Icaza <miguel@ximian.com>
6178 * class.cs (Class.Emit): Report warning 67: event not used if the
6179 warning level is beyond 3.
6181 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
6182 being a NullLiteral.
6184 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
6187 * class.cs (TypeContainer.GetClassBases): Cover a missing code
6188 path that might fail if a type can not be resolved.
6190 * expression.cs (Binary.Emit): Emit unsigned versions of the
6193 * driver.cs: use error 5.
6195 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
6197 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
6199 2002-11-01 Miguel de Icaza <miguel@ximian.com>
6201 * cs-parser.jay (switch_section): A beautiful patch from Martin
6202 Baulig that fixed 33094.
6204 2002-10-31 Miguel de Icaza <miguel@ximian.com>
6206 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
6207 Check whether the base is abstract and report an error if so.
6209 * expression.cs (IndexerAccess.DoResolveLValue,
6210 IndexerAccess.DoResolve): ditto.
6212 (Invocation.DoResolve): ditto.
6214 (Invocation.FullMethodDesc): Improve the report string.
6216 * statement.cs (Block): Eliminate IsVariableDefined as it is
6217 basically just a wrapper for GetVariableInfo.
6219 * ecore.cs (SimpleName): Use new
6221 * support.cs (ReflectionParamter.ParameterType): We unwrap the
6222 type, as we return the actual parameter ref/unref state on a
6225 2002-10-30 Miguel de Icaza <miguel@ximian.com>
6227 * support.cs: Return proper flags REF/OUT fixing the previous
6230 * expression.cs: Reverted last patch, that was wrong. Is_ref is
6231 not used to mean `ref' but `ref or out' in ParameterReference
6233 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
6234 full type signature instead of calling TypeManger.CSharpName
6237 * support.cs (InternalParameters.ParameterDesc): Do not compare
6238 directly to the modflags, because REF/OUT will actually be bitsets
6241 * delegate.cs (VerifyMethod): Check also the modifiers.
6243 * cs-tokenizer.cs: Fix bug where floating point values with an
6244 exponent where a sign was missing was ignored.
6246 * driver.cs: Allow multiple assemblies to be specified in a single
6249 2002-10-28 Miguel de Icaza <miguel@ximian.com>
6251 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
6252 because identifiers after a parenthesis would end up in this kind
6253 of production, and we needed to desamiguate it for having casts
6256 (UserDefinedType *) xxx
6258 2002-10-24 Miguel de Icaza <miguel@ximian.com>
6260 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
6261 we should set on the Bindingflags.NonPublic, but not turn on
6262 private_ok. private_ok controls whether a Private member is
6263 returned (this is chekced on the filter routine), while the
6264 BindingFlags.NonPublic just controls whether private/protected
6265 will be allowed. This fixes the problem part of the problem of
6266 private properties being allowed to be used in derived classes.
6268 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
6269 so we can call the children DoResolveLValue method (this will
6270 properly signal errors on lvalue assignments to base properties)
6272 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
6273 getter are null, and we have a property info, we know that this
6274 happened because the lookup failed, so we report an error 122 for
6275 protection level violation.
6277 We also silently return if setter and getter are null in the
6278 resolve functions, this condition only happens if we have flagged
6279 the error before. This is the other half of the problem.
6281 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
6282 not have accessibility information, that is why we were returning
6283 true in the filter function in typemanager.cs.
6285 To properly report 122 (property is inaccessible because of its
6286 protection level) correctly, we report this error in ResolveAccess
6287 by failing if both the setter and the getter are lacking (ie, the
6290 DoResolve and DoLResolve have been modified to check for both
6291 setter/getter being null and returning silently, the reason being
6292 that I did not want to put the knowledge about this error in upper
6295 int old = Report.Errors;
6296 x = new PropertyExpr (...);
6297 if (old != Report.Errors)
6302 So the property expr is returned, but it is invalid, so the error
6303 will be flagged during the resolve process.
6305 * class.cs: Remove InheritablePropertySignatureCompare from the
6306 class, as we no longer depend on the property signature to compute
6307 whether it is possible to implement a method or not.
6309 The reason is that calling PropertyInfo.GetGetMethod will return
6310 null (in .NET, in Mono it works, and we should change this), in
6311 cases where the Get Method does not exist in that particular
6316 class X { public virtual int A { get { return 1; } } }
6318 class Z : Y { public override int A { get { return 2; } } }
6320 Would fail in Z because the parent (Y) would not have the property
6321 defined. So we avoid this completely now (because the alternative
6322 fix was ugly and slow), and we now depend exclusively on the
6325 (PropertyBase.CheckBase): Use a method-base mechanism to find our
6326 reference method, instead of using the property.
6328 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
6329 routines are gone now.
6331 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
6332 names, they were incorrectly named.
6334 * cs-tokenizer.cs: Return are more gentle token on failure.
6336 * pending.cs (PendingImplementation.InterfaceMethod): This routine
6337 had an out-of-sync index variable, which caused it to remove from
6338 the list of pending methods the wrong method sometimes.
6340 2002-10-22 Miguel de Icaza <miguel@ximian.com>
6342 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
6343 CanWrite, because those refer to this particular instance of the
6344 property, and do not take into account the fact that we can
6345 override single members of a property.
6347 Constructor requires an EmitContext. The resolution process does
6348 not happen here, but we need to compute the accessors before,
6349 because the resolution does not always happen for properties.
6351 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
6352 subclass, before we did not update this flag, but we did update
6355 (GetAccessors): Drop this routine, as it did not work in the
6356 presence of partially overwritten set/get methods.
6358 Notice that this broke the cs1540 detection, but that will require
6361 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6365 * driver.cs: issue a warning instead of an error if we don't support
6366 debugging for the platform. Also ignore a couple of errors that may
6367 arise when trying to write the symbols. Undo my previous patch.
6369 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6371 * driver.cs: ignore /debug switch except for Unix platforms.
6373 2002-10-23 Nick Drochak <ndrochak@gol.com>
6375 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
6377 2002-10-21 Miguel de Icaza <miguel@ximian.com>
6379 * driver.cs: Do not make mcs-debug conditional, so we do not break
6382 * statement.cs (UsageVector.MergeChildren): I would like Martin to
6383 review this patch. But basically after all the children variables
6384 have been merged, the value of "Breaks" was not being set to
6385 new_breaks for Switch blocks. I think that it should be set after
6386 it has executed. Currently I set this to the value of new_breaks,
6387 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
6388 conservative, but I do not understand this code very well.
6390 I did not break anything in the build, so that is good ;-)
6392 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
6394 2002-10-20 Mark Crichton <crichton@gimp.org>
6396 * cfold.cs: Fixed compile blocker. Really fixed it this time.
6398 2002-10-20 Nick Drochak <ndrochak@gol.com>
6400 * cfold.cs: Fixed compile blocker.
6402 2002-10-20 Miguel de Icaza <miguel@ximian.com>
6404 * driver.cs: I was chekcing the key, not the file.
6406 2002-10-19 Ravi Pratap <ravi@ximian.com>
6408 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
6409 message that we were generating - we just need to silently return
6412 2002-10-19 Miguel de Icaza <miguel@ximian.com>
6414 * class.cs (Event.Define): Change my previous commit, as this
6415 breaks the debugger. This is a temporary hack, as it seems like
6416 the compiler is generating events incorrectly to begin with.
6418 * expression.cs (Binary.ResolveOperator): Added support for
6419 "U operator - (E x, E y)"
6421 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
6424 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
6425 init-only variables, but this path did not take into account that
6426 there might be also instance readonly variables. Correct this
6429 This fixes bug 32253
6431 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
6434 * driver.cs: Change the extension for modules to `netmodule'
6436 * cs-parser.jay: Improved slightly the location tracking for
6437 the debugger symbols.
6439 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
6440 modifiers that were specified instead of the hardcoded value
6441 (FamAndAssem). This was basically ignoring the static modifier,
6442 and others. Fixes 32429.
6444 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
6445 fixed a bug in the process (32476)
6447 * expression.cs (ArrayAccess.EmitAssign): Patch from
6448 hwang_rob@yahoo.ca that fixes bug 31834.3
6450 2002-10-18 Miguel de Icaza <miguel@ximian.com>
6452 * driver.cs: Make the module extension .netmodule.
6454 2002-10-16 Miguel de Icaza <miguel@ximian.com>
6456 * driver.cs: Report an error if the resource file is not found
6457 instead of crashing.
6459 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
6460 false, like Emit does.
6462 2002-10-16 Nick Drochak <ndrochak@gol.com>
6464 * typemanager.cs: Remove unused private member. Also reported mcs
6465 bug to report this as a warning like csc.
6467 2002-10-15 Martin Baulig <martin@gnome.org>
6469 * statement.cs (Statement.Emit): Made this a virtual method; emits
6470 the line number info and calls DoEmit().
6471 (Statement.DoEmit): New protected abstract method, formerly knows
6472 as Statement.Emit().
6474 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
6476 2002-10-11 Miguel de Icaza <miguel@ximian.com>
6478 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
6479 have fixed a remaining problem: not every AddXXXX was adding a
6480 fully qualified name.
6482 Now everyone registers a fully qualified name in the DeclSpace as
6483 being defined instead of the partial name.
6485 Downsides: we are slower than we need to be due to the excess
6486 copies and the names being registered this way.
6488 The reason for this is that we currently depend (on the corlib
6489 bootstrap for instance) that types are fully qualified, because
6490 we dump all the types in the namespace, and we should really have
6491 types inserted into the proper namespace, so we can only store the
6492 basenames in the defined_names array.
6494 2002-10-10 Martin Baulig <martin@gnome.org>
6496 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
6497 from bug #31834, see the bug report for a testcase which is
6500 2002-10-10 Martin Baulig <martin@gnome.org>
6502 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
6503 flow analysis code for this.
6505 * statement.cs (Do, While, For): Tell the flow analysis code about
6507 (FlowBranching.UsageVector): Added support for infinite loops.
6508 (Block.Resolve): Moved the dead code elimination here and use flow
6511 2002-10-09 Miguel de Icaza <miguel@ximian.com>
6513 * class.cs (Field.Define): Catch cycles on struct type
6516 * typemanager.cs (IsUnmanagedtype): Do not recursively check
6517 fields if the fields are static. We only need to check instance
6520 * expression.cs (As.DoResolve): Test for reference type.
6522 * statement.cs (Using.ResolveExpression): Use
6523 ConvertImplicitRequired, not ConvertImplicit which reports an
6525 (Using.ResolveLocalVariableDecls): ditto.
6527 * expression.cs (Binary.ResolveOperator): Report errors in a few
6528 places where we had to.
6530 * typemanager.cs (IsUnmanagedtype): Finish implementation.
6532 2002-10-08 Miguel de Icaza <miguel@ximian.com>
6534 * expression.cs: Use StoreFromPtr instead of extracting the type
6535 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
6537 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
6538 an enumeration value to a System.Enum, but System.Enum is not a
6539 value type, but an class type, so we need to box.
6541 (Expression.ConvertExplicit): One codepath could return
6542 errors but not flag them. Fix this. Fixes #31853
6544 * parameter.cs (Resolve): Do not allow void as a parameter type.
6546 2002-10-06 Martin Baulig <martin@gnome.org>
6548 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
6549 if it's a class type and not a struct. Fixes #31815.
6551 2002-10-06 Martin Baulig <martin@gnome.org>
6553 * statement.cs: Reworked the flow analysis code a bit to make it
6554 usable for dead code elimination.
6556 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6558 * cs-parser.jay: allow empty source files. Fixes bug #31781.
6560 2002-10-04 Miguel de Icaza <miguel@ximian.com>
6562 * expression.cs (ComposedCast.DoResolveType): A quick workaround
6563 to fix the test 165, will investigate deeper.
6565 2002-10-04 Martin Baulig <martin@gnome.org>
6567 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
6568 finally blocks actually work.
6569 (Try.Resolve): We don't need to create a sibling for `finally' if
6570 there is no finally block.
6572 2002-10-04 Martin Baulig <martin@gnome.org>
6574 * class.cs (Constructor.Define): The default accessibility for a
6575 non-default constructor is private, not public.
6577 2002-10-04 Miguel de Icaza <miguel@ximian.com>
6579 * class.cs (Constructor): Make AllowedModifiers public, add
6582 * cs-parser.jay: Perform the modifiers test here, as the
6583 constructor for the Constructor class usually receives a zero
6584 because of the way we create it (first we create, later we
6585 customize, and we were never checking the modifiers).
6587 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
6588 is a version of LookupTypeReflection that includes the type-name
6589 cache. This can be used as a fast path for functions that know
6590 the fully qualified name and are only calling into *.GetType() to
6591 obtain a composed type.
6593 This is also used by TypeManager.LookupType during its type
6596 (LookupType): We now also track the real type name, as sometimes
6597 we can get a quey for the real type name from things like
6598 ComposedCast. This fixes bug 31422.
6600 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
6601 complete type fullname, it does not have to go through the type
6602 resolution system to obtain the composed version of the type (for
6603 obtaining arrays or pointers).
6605 (Conditional.Emit): Use the EmitBoolExpression to
6606 generate nicer code, as requested by Paolo.
6608 (ArrayCreation.CheckIndices): Use the patch from
6609 hwang_rob@yahoo.ca to validate the array initializers.
6611 2002-10-03 Miguel de Icaza <miguel@ximian.com>
6613 * class.cs (ConstructorInitializer.Emit): simplify code by using
6614 Invocation.EmitCall, and at the same time, fix the bugs in calling
6615 parent constructors that took variable arguments.
6617 * ecore.cs (Expression.ConvertNumericExplicit,
6618 Expression.ImplicitNumericConversion): Remove the code that
6619 manually wrapped decimal (InternalTypeConstructor call is now gone
6622 * expression.cs (Cast.TryReduce): Also handle decimal types when
6623 trying to perform a constant fold on the type.
6625 * typemanager.cs (IsUnmanagedtype): Partially implemented.
6627 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
6628 that only turned off an error report, and did nothing else.
6630 2002-10-02 Miguel de Icaza <miguel@ximian.com>
6632 * driver.cs: Handle and ignore /fullpaths
6634 2002-10-01 Miguel de Icaza <miguel@ximian.com>
6636 * expression.cs (Binary.ResolveOperator): Catch the case where
6637 DoNumericPromotions returns true,
6639 (Binary.DoNumericPromotions): Simplify the code, and the tests.
6641 2002-09-27 Miguel de Icaza <miguel@ximian.com>
6643 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
6646 2002-09-26 Miguel de Icaza <miguel@ximian.com>
6648 * ecore.cs (ConvertNumericExplicit): It is not enough that the
6649 conversion exists, but it is also required that the conversion be
6650 performed. This manifested in "(Type64Enum) 2".
6652 * class.cs (TypeManager.AddMethod): The fix is not to change
6653 AddEnum, because that one was using a fully qualified name (every
6654 DeclSpace derivative does), but to change the AddMethod routine
6655 that was using an un-namespaced name. This now correctly reports
6656 the duplicated name.
6658 Revert patch until I can properly fix it. The issue
6659 is that we have a shared Type space across all namespaces
6660 currently, which is wrong.
6662 Options include making the Namespace a DeclSpace, and merge
6663 current_namespace/current_container in the parser.
6665 2002-09-25 Miguel de Icaza <miguel@ximian.com>
6667 * cs-parser.jay: Improve error reporting when we get a different
6668 kind of expression in local_variable_type and
6669 local_variable_pointer_type.
6671 Propagate this to avoid missleading errors being reported.
6673 * ecore.cs (ImplicitReferenceConversion): treat
6674 TypeManager.value_type as a target just like object_type. As
6679 Is valid, and needs to result in the int 1 being boxed before it
6680 is assigned to the value type v.
6682 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
6683 to validate the enumeration name.
6685 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
6686 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
6687 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
6689 * ecore.cs (TryImplicitIntConversion): When doing an
6690 implicit-enumeration-conversion, check if the type is 64-bits and
6691 perform a conversion before passing to EnumConstant.
6693 2002-09-23 Miguel de Icaza <miguel@ximian.com>
6695 * decl.cs (Error_AmbiguousTypeReference); New routine used to
6696 report ambiguous type references. Unlike the MS version, we
6697 report what the ambiguity is. Innovation at work ;-)
6699 (DeclSpace.FindType): Require a location argument to
6700 display when we display an ambiguous error.
6702 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
6704 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
6706 * expression.cs (EmitDynamicInitializers): Apply patch from
6707 hwang_rob@yahoo.ca that fixes the order in which we emit our
6710 2002-09-21 Martin Baulig <martin@gnome.org>
6712 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
6713 delegate takes no arguments.
6715 2002-09-20 Miguel de Icaza <miguel@ximian.com>
6717 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
6720 * expression.cs: Extract the underlying type.
6722 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
6724 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
6726 2002-09-19 Miguel de Icaza <miguel@ximian.com>
6728 * class.cs (TypeContainer.DefineType): We can not use the nice
6729 PackingSize with the size set to 1 DefineType method, because it
6730 will not allow us to define the interfaces that the struct
6733 This completes the fixing of bug 27287
6735 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
6736 means also structs. This fixes part of the problem.
6737 (Expresion.ImplicitReferenceConversionExists): ditto.
6739 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
6740 error if there were no errors reported during the type lookup
6741 process, to avoid duplicates or redundant errors. Without this
6742 you would get an ambiguous errors plus a type not found. We have
6743 beaten the user enough with the first error.
6745 (DeclSparce.FindType): Emit a warning if we have an ambiguous
6748 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
6749 during the resolution process, stop the lookup, this avoids
6750 repeated error reports (same error twice).
6752 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
6754 * typemanager.cs (LookupType): Redo the type lookup code to match
6755 the needs of System.Reflection.
6757 The issue is that System.Reflection requires references to nested
6758 types to begin with a "+" sign instead of a dot. So toplevel
6759 types look like: "NameSpace.TopLevelClass", and nested ones look
6760 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
6763 2002-09-19 Martin Baulig <martin@gnome.org>
6765 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
6766 says that a method always returns or always throws an exception,
6767 don't report the CS0161.
6769 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
6770 set `Returns = new_returns'.
6772 2002-09-19 Martin Baulig <martin@gnome.org>
6774 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
6775 to an enum constant, check for a CS0176.
6777 2002-09-18 Miguel de Icaza <miguel@ximian.com>
6779 * class.cs (TypeContainer.CheckPairedOperators): Now we check
6780 for operators that must be in pairs and report errors.
6782 * ecore.cs (SimpleName.DoResolveType): During the initial type
6783 resolution process, when we define types recursively, we must
6784 check first for types in our current scope before we perform
6785 lookups in the enclosing scopes.
6787 * expression.cs (MakeByteBlob): Handle Decimal blobs.
6789 (Invocation.VerifyArgumentsCompat): Call
6790 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
6791 I thought we were supposed to always call this, but there are a
6792 few places in the code where we dont do it.
6794 2002-09-17 Miguel de Icaza <miguel@ximian.com>
6796 * driver.cs: Add support in -linkres and -resource to specify the
6797 name of the identifier.
6799 2002-09-16 Miguel de Icaza <miguel@ximian.com>
6801 * ecore.cs (StandardConversionExists): Sync with the conversion
6802 code: allow anything-* to void* conversions.
6804 (FindMostSpecificSource): Use an Expression argument
6805 instead of a Type, because we might be handed over a Literal which
6806 gets a few more implicit conversions that plain types do not. So
6807 this information was being lost.
6809 Also, we drop the temporary type-holder expression when not
6812 2002-09-17 Martin Baulig <martin@gnome.org>
6814 * class.cs (PropertyBase.CheckBase): Don't check the base class if
6815 this is an explicit interface implementation.
6817 2002-09-17 Martin Baulig <martin@gnome.org>
6819 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
6820 different `IndexerName' attributes.
6822 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
6823 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
6824 virtual CommonResolve().
6826 2002-09-16 Miguel de Icaza <miguel@ximian.com>
6828 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
6829 and convert that to the UnderlyingType.
6831 * statement.cs (Foreach.Resolve): Indexers are just like variables
6832 or PropertyAccesses.
6834 * cs-tokenizer.cs (consume_string): Track line numbers and columns
6835 inside quoted strings, we were not doing this before.
6837 2002-09-16 Martin Baulig <martin@gnome.org>
6839 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
6840 resolve it. This is needed for the definite assignment check of the
6841 instance expression, fixes bug #29846.
6842 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
6844 2002-09-16 Nick Drochak <ndrochak@gol.com>
6846 * parameter.cs: Fix compile error. Cannot reference static member
6847 from an instance object. Is this an mcs bug?
6849 2002-09-14 Martin Baulig <martin@gnome.org>
6851 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
6852 multiple times. Fixes bug #30295, added test-166.cs.
6854 2002-09-14 Martin Baulig <martin@gnome.org>
6856 * statement.cs (Block.Emit): Don't emit unreachable code.
6857 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
6859 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
6861 2002-09-14 Martin Baulig <martin@gnome.org>
6863 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
6866 2002-09-14 Martin Baulig <martin@gnome.org>
6868 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
6869 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
6870 be false on the ms runtime.
6872 2002-09-13 Martin Baulig <martin@gnome.org>
6874 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
6875 the CS0038 error message.
6877 2002-09-12 Miguel de Icaza <miguel@ximian.com>
6879 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
6880 constant inside, return it.
6882 2002-09-12 Martin Baulig <martin@gnome.org>
6884 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
6885 implicit conversion can be done between enum types.
6887 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
6888 check whether an implicit conversion to the current enum's UnderlyingType
6889 exists and report an error if not.
6891 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
6892 without debugging support.
6894 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
6895 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
6897 2002-09-12 Martin Baulig <martin@gnome.org>
6899 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
6901 * ecore.cs (IMemberExpr.DeclaringType): New property.
6902 (SimpleName.SimpleNameResolve): Check whether we're accessing a
6903 nonstatic member of an outer type (CS0038).
6905 2002-09-11 Miguel de Icaza <miguel@ximian.com>
6907 * driver.cs: Activate the using-error detector at warning level
6908 4 (at least for MS-compatible APIs).
6910 * namespace.cs (VerifyUsing): Small buglett fix.
6912 * pending.cs (PendingImplementation): pass the container pointer.
6914 * interface.cs (GetMethods): Allow for recursive definition. Long
6915 term, I would like to move every type to support recursive
6916 definitions, not the current ordering mechanism that we have right
6919 The situation is this: Attributes are handled before interfaces,
6920 so we can apply attributes to interfaces. But some attributes
6921 implement interfaces, we will now handle the simple cases
6922 (recursive definitions will just get an error).
6924 * parameter.cs: Only invalidate types at the end if we fail to
6927 2002-09-09 Martin Baulig <martin@gnome.org>
6929 * ecore.cs (PropertyExpr.Emit): Also check for
6930 TypeManager.system_int_array_get_length so this'll also work when
6931 compiling corlib. Fixes #30003.
6933 2002-09-09 Martin Baulig <martin@gnome.org>
6935 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
6936 and throw an exception if we can't get the type's size. Fixed #30040,
6939 2002-09-09 Martin Baulig <martin@gnome.org>
6941 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
6943 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
6944 context. Fixes bug #30027.
6946 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
6947 virtual functions. Fixes bug #30043, added test-164.cs.
6949 2002-09-08 Ravi Pratap <ravi@ximian.com>
6951 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
6953 2002-09-08 Nick Drochak <ndrochak@gol.com>
6955 * driver.cs: Use an object to get the windows codepage since it's not a
6958 2002-09-08 Miguel de Icaza <miguel@ximian.com>
6960 * statement.cs (For.Emit): for infinite loops (test == null)
6961 return whether there is a break inside, not always "true".
6963 * namespace.cs (UsingEntry): New struct to hold the name of the
6964 using definition, the location where it is defined, and whether it
6965 has been used in a successful type lookup.
6967 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
6972 2002-09-06 Ravi Pratap <ravi@ximian.com>
6974 * attribute.cs : Fix incorrect code which relied on catching
6975 a NullReferenceException to detect a null being passed in
6976 where an object was expected.
6978 2002-09-06 Miguel de Icaza <miguel@ximian.com>
6980 * statement.cs (Try): flag the catch variable as assigned
6982 * expression.cs (Cast): Simplified by using ResolveType instead of
6985 * statement.cs (Catch): Fix bug by using ResolveType.
6987 2002-09-06 Ravi Pratap <ravi@ximian.com>
6989 * expression.cs (BetterConversion): Special case for when we have
6990 a NullLiteral as the argument and we have to choose between string
6991 and object types - we choose string the way csc does.
6993 * attribute.cs (Attribute.Resolve): Catch the
6994 NullReferenceException and report error #182 since the Mono
6995 runtime no more has the bug and having this exception raised means
6996 we tried to select a constructor which takes an object and is
6999 2002-09-05 Ravi Pratap <ravi@ximian.com>
7001 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
7002 message (1502, 1503) when we can't locate a method after overload
7003 resolution. This is much more informative and closes the bug
7006 * interface.cs (PopulateMethod): Return if there are no argument
7007 types. Fixes a NullReferenceException bug.
7009 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
7010 expressions too. Previously we were checking only in one place for
7011 positional arguments leaving out named arguments.
7013 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
7014 type to the enum type is not allowed. Remove code corresponding to
7017 (ConvertNumericExplicit): Allow explicit conversions from
7018 the underlying type to enum type. This precisely follows the spec
7019 and closes a bug filed by Gonzalo.
7021 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7024 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
7026 2002-09-03 Miguel de Icaza <miguel@ximian.com>
7028 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
7029 it was important that we stored the right value after the
7030 reduction in `converted'.
7032 2002-09-04 Martin Baulig <martin@gnome.org>
7034 * location.cs (Location.SymbolDocument): Use full pathnames for the
7037 2002-08-30 Miguel de Icaza <miguel@ximian.com>
7039 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
7040 of the expression resolve mechanism, because that will catch the
7041 SimpleName error failures.
7043 (Conditional): If we can not resolve the
7044 expression, return, do not crash.
7046 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7049 (location): display token name instead of its number.
7051 2002-08-28 Martin Baulig <martin@gnome.org>
7053 * expression.cs (Binary.ResolveOperator): Don't silently return
7054 but return an error if an operator cannot be applied between two
7057 2002-08-28 Martin Baulig <martin@gnome.org>
7059 * class.cs (Constructor.Define): Set the permission attributes
7060 correctly instead of making all constructors public.
7062 2002-08-28 Martin Baulig <martin@gnome.org>
7064 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
7065 for private members before reporting a CS0103; if we find anything,
7068 2002-08-28 Martin Baulig <martin@gnome.org>
7070 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
7071 to check whether `closure_start_type == closure_invocation_type',
7072 we also need to check whether `m.DeclaringType == closure_invocation_type'
7073 before bypassing the permission checks. We might be accessing
7074 protected/private members from the base class.
7075 (TypeManager.RealMemberLookup): Only set private_ok if private
7076 members were requested via BindingFlags.NonPublic.
7078 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
7080 * expression.cs (MemberAccess.ResolveMemberAccess): Set
7081 MethodGroupExpr.IsExplicitImpl if appropriate.
7082 (Invocation.DoResolve): Don't report the CS0120 for explicit
7083 interface implementations.
7085 2002-08-27 Martin Baulig <martin@gnome.org>
7087 * expression.cs (Invocation.DoResolve): If this is a static
7088 method and we don't have an InstanceExpression, we must report
7091 2002-08-25 Martin Baulig <martin@gnome.org>
7093 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
7094 `==' between a valuetype and an object.
7096 2002-08-25 Miguel de Icaza <miguel@ximian.com>
7098 * ecore.cs (TypeExpr): Provide a ToString method.
7100 2002-08-24 Martin Baulig <martin@gnome.org>
7102 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
7103 now called proggie.dbg and it's a binary file.
7105 2002-08-23 Martin Baulig <martin@gnome.org>
7107 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
7109 2002-08-23 Martin Baulig <martin@gnome.org>
7111 * struct.cs (MyStructInfo.ctor): Make this work with empty
7112 structs; it's not allowed to use foreach() on null.
7114 2002-08-23 Martin Baulig <martin@gnome.org>
7116 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
7117 writer the full pathname of the generated assembly.
7119 2002-08-23 Martin Baulig <martin@gnome.org>
7121 * statements.cs (FlowBranching.UsageVector.MergeChildren):
7122 A `finally' block never returns or breaks; improved handling of
7125 2002-08-23 Martin Baulig <martin@gnome.org>
7127 * statement.cs (Throw.Resolve): Allow `throw null'.
7129 2002-08-23 Martin Baulig <martin@gnome.org>
7131 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
7132 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
7133 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
7134 MemberLookup would return a wrong event if this is an explicit
7135 interface implementation and the class has an event with the same
7138 2002-08-23 Martin Baulig <martin@gnome.org>
7140 * statement.cs (Block.AddChildVariableNames): New public method.
7141 (Block.AddChildVariableName): Likewise.
7142 (Block.IsVariableNameUsedInChildBlock): Likewise.
7143 (Block.AddVariable): Check whether a variable name has already
7144 been used in a child block.
7146 * cs-parser.jay (declare_local_variables): Mark all variable names
7147 from the current block as being used in a child block in the
7150 2002-08-23 Martin Baulig <martin@gnome.org>
7152 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
7153 find the symbol writer.
7155 * driver.cs: csc also allows the arguments to /define being
7156 separated by commas, not only by semicolons.
7158 2002-08-23 Martin Baulig <martin@gnome.org>
7160 * interface.cs (Interface.GetMembers): Added static check for events.
7162 2002-08-15 Martin Baulig <martin@gnome.org>
7164 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
7165 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
7167 * ecore.cs (Expression.MemberLookup): Added documentation and explained
7168 why the MethodData.EmitDestructor() change was necessary.
7170 2002-08-20 Martin Baulig <martin@gnome.org>
7172 * class.cs (TypeContainer.FindMembers): Added static check for events.
7174 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
7176 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
7177 use Type.GetEvents(), not Type.FindMembers().
7179 2002-08-20 Martin Baulig <martin@gnome.org>
7181 * decl.cs (MemberCache): Added a special method cache which will
7182 be used for method-only searched. This ensures that a method
7183 search will return a MethodInfo with the correct ReflectedType for
7186 2002-08-20 Martin Baulig <martin@gnome.org>
7188 * decl.cs (DeclSpace.FindMembers): Made this public.
7190 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7192 * delegate.cs: fixed build on windows.
7193 [FIXME: Filed as bug #29150: MCS must report these errors.]
7195 2002-08-19 Ravi Pratap <ravi@ximian.com>
7197 * ecore.cs (StandardConversionExists): Return a false
7198 if we are trying to convert the void type to anything else
7199 since that is not allowed.
7201 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
7202 we flag error 70 in the event an event is trying to be accessed
7203 directly from outside the declaring type.
7205 2002-08-20 Martin Baulig <martin@gnome.org>
7207 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
7208 MemberCache from typemanager.cs to decl.cs.
7210 2002-08-19 Martin Baulig <martin@gnome.org>
7212 * class.cs (TypeContainer): Implement IMemberContainer.
7213 (TypeContainer.DefineMembers): Create the MemberCache.
7214 (TypeContainer.FindMembers): Do better BindingFlags checking; only
7215 return public members if BindingFlags.Public was given, check
7216 whether members are static.
7218 2002-08-16 Martin Baulig <martin@gnome.org>
7220 * decl.cs (DeclSpace.Define): Splitted this in Define and
7221 DefineMembers. DefineMembers is called first and initializes the
7224 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
7225 DefineMembers() on all our DeclSpaces.
7227 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
7228 but call DefineMembers() on all nested interfaces. We call their
7229 Define() in our new Define() function.
7231 * interface.cs (Interface): Implement IMemberContainer.
7232 (Interface.Define): Moved all code except the attribute stuf to
7234 (Interface.DefineMembers): Initialize the member cache.
7236 * typemanager.cs (IMemberFinder): Removed this interface, we don't
7237 need this anymore since we can use MemberCache.FindMembers directly.
7239 2002-08-19 Martin Baulig <martin@gnome.org>
7241 * typemanager.cs (MemberCache): When creating the cache for an
7242 interface type, add all inherited members.
7243 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
7244 to `out bool used_cache' and documented it.
7245 (TypeManager.MemberLookup): If we already used the cache in the first
7246 iteration, we don't need to do the interfaces check.
7248 2002-08-19 Martin Baulig <martin@gnome.org>
7250 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
7251 here from IMemberFinder and don't implement this interface anymore.
7252 (DeclSpace.MemberCache): Moved here from IMemberFinder.
7254 * typemanager.cs (IMemberFinder): This interface is now only used by
7255 classes which actually support the member cache.
7256 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
7257 since we only put DeclSpaces into this Hashtable.
7258 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
7259 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
7261 2002-08-16 Martin Baulig <martin@gnome.org>
7263 * typemanager.cs (ICachingMemberFinder): Removed.
7264 (IMemberFinder.MemberCache): New property.
7265 (TypeManager.FindMembers): Merged this with RealFindMembers().
7266 This function will never be called from TypeManager.MemberLookup()
7267 so we can't use the cache here, just the IMemberFinder.
7268 (TypeManager.MemberLookup_FindMembers): Check whether the
7269 IMemberFinder has a MemberCache and call the cache's FindMembers
7271 (MemberCache): Rewrote larger parts of this yet another time and
7272 cleaned it up a bit.
7274 2002-08-15 Miguel de Icaza <miguel@ximian.com>
7276 * driver.cs (LoadArgs): Support quoting.
7278 (Usage): Show the CSC-like command line arguments.
7280 Improved a few error messages.
7282 2002-08-15 Martin Baulig <martin@gnome.org>
7284 * typemanager.cs (IMemberContainer.Type): New property.
7285 (IMemberContainer.IsInterface): New property.
7287 The following changes are conditional to BROKEN_RUNTIME, which is
7288 defined at the top of the file.
7290 * typemanager.cs (MemberCache.MemberCache): Don't add the base
7291 class'es members, but add all members from TypeHandle.ObjectType
7292 if we're an interface.
7293 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
7294 is the current type.
7295 (MemberCache.CacheEntry.Container): Removed this field.
7296 (TypeHandle.GetMembers): Include inherited members.
7298 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7300 * typemanager.cs: fixed compilation and added a comment on a field that
7303 2002-08-15 Martin Baulig <martin@gnome.org>
7305 * class.cs (ConstructorInitializer.Resolve): In the
7306 Expression.MemberLookup call, use the queried_type as
7309 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
7310 declared' attribute, it's always true.
7311 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
7312 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
7313 temporary wrapper for FindMembers which tells MemberLookup whether
7314 members from the base classes are included in the return value.
7315 This will go away soon.
7316 (TypeManager.MemberLookup): Use this temporary hack here; once the
7317 new MemberCache is completed, we don't need to do the DeclaredOnly
7318 looping here anymore since the MemberCache will take care of this.
7319 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
7320 (MemberCache): When creating the MemberCache for a class, get
7321 members from the current class and all its base classes.
7322 (MemberCache.CacheEntry.Container): New field. This is a
7323 temporary hack until the Mono runtime is fixed to distinguish
7324 between ReflectedType and DeclaringType. It allows us to use MCS
7325 with both the MS runtime and the unfixed Mono runtime without
7326 problems and without accecting performance.
7327 (MemberCache.SearchMembers): The DeclaredOnly looping from
7328 TypeManager.MemberLookup is now done here.
7330 2002-08-14 Martin Baulig <martin@gnome.org>
7332 * statement.cs (MyStructInfo.MyStructInfo): Don't call
7333 Type.GetFields on dynamic types but get the fields from the
7334 corresponding TypeContainer.
7335 (MyStructInfo.GetStructInfo): Added check for enum types.
7337 * typemanager.cs (MemberList.IsSynchronized): Implemented.
7338 (MemberList.SyncRoot): Implemented.
7339 (TypeManager.FilterWithClosure): No need to check permissions if
7340 closure_start_type == closure_invocation_type, don't crash if
7341 closure_invocation_type is null.
7343 2002-08-13 Martin Baulig <martin@gnome.org>
7345 Rewrote TypeContainer.FindMembers to use a member cache. This
7346 gives us a speed increase of about 35% for the self-hosting MCS
7347 build and of about 15-20% for the class libs (both on GNU/Linux).
7349 * report.cs (Timer): New class to get enhanced profiling. This
7350 whole class is "TIMER" conditional since it remarkably slows down
7353 * class.cs (MemberList): New class. This is an IList wrapper
7354 which we're now using instead of passing MemberInfo[]'s around to
7355 avoid copying this array unnecessarily.
7356 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
7357 (ICachingMemberFinder, IMemberContainer): New interface.
7358 (TypeManager.FilterWithClosure): If `criteria' is null, the name
7359 has already been checked, otherwise use it for the name comparision.
7360 (TypeManager.FindMembers): Renamed to RealMemberFinder and
7361 provided wrapper which tries to use ICachingMemberFinder.FindMembers
7362 if possible. Returns a MemberList, not a MemberInfo [].
7363 (TypeHandle): New class, implements IMemberContainer. We create
7364 one instance of this class per type, it contains a MemberCache
7365 which is used to do the member lookups.
7366 (MemberCache): New class. Each instance of this class contains
7367 all members of a type and a name-based hash table.
7368 (MemberCache.FindMembers): This is our new member lookup
7369 function. First, it looks up all members of the requested name in
7370 the hash table. Then, it walks this list and sorts out all
7371 applicable members and returns them.
7373 2002-08-13 Martin Baulig <martin@gnome.org>
7375 In addition to a nice code cleanup, this gives us a performance
7376 increase of about 1.4% on GNU/Linux - not much, but it's already
7377 half a second for the self-hosting MCS compilation.
7379 * typemanager.cs (IMemberFinder): New interface. It is used by
7380 TypeManager.FindMembers to call FindMembers on a TypeContainer,
7381 Enum, Delegate or Interface.
7382 (TypeManager.finder_to_member_finder): New PtrHashtable.
7383 (TypeManager.finder_to_container): Removed.
7384 (TypeManager.finder_to_delegate): Removed.
7385 (TypeManager.finder_to_interface): Removed.
7386 (TypeManager.finder_to_enum): Removed.
7388 * interface.cs (Interface): Implement IMemberFinder.
7390 * delegate.cs (Delegate): Implement IMemberFinder.
7392 * enum.cs (Enum): Implement IMemberFinder.
7394 * class.cs (TypeContainer): Implement IMemberFinder.
7396 2002-08-12 Martin Baulig <martin@gnome.org>
7398 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
7400 2002-08-12 Martin Baulig <martin@gnome.org>
7402 * ecore.cs (ITypeExpression): New interface for expressions which
7404 (TypeExpression): Renamed to TypeLookupExpression.
7405 (Expression.DoResolve): If we're doing a types-only lookup, the
7406 expression must implement the ITypeExpression interface and we
7407 call DoResolveType() on it.
7408 (SimpleName): Implement the new ITypeExpression interface.
7409 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
7410 hack, the situation that we're only looking up types can't happen
7411 anymore when this method is called. Moved the type lookup code to
7412 DoResolveType() and call it.
7413 (SimpleName.DoResolveType): This ITypeExpression interface method
7414 is now doing the types-only lookup.
7415 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
7416 (ResolveFlags): Added MaskExprClass.
7418 * expression.cs (MemberAccess): Implement the ITypeExpression
7420 (MemberAccess.DoResolve): Added support for a types-only lookup
7421 when we're called via ITypeExpression.DoResolveType().
7422 (ComposedCast): Implement the ITypeExpression interface.
7424 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
7425 Expression.Resolve() with ResolveFlags.Type instead.
7427 2002-08-12 Martin Baulig <martin@gnome.org>
7429 * interface.cs (Interface.Define): Apply attributes.
7431 * attribute.cs (Attribute.ApplyAttributes): Added support for
7432 interface attributes.
7434 2002-08-11 Martin Baulig <martin@gnome.org>
7436 * statement.cs (Block.Emit): Only check the "this" variable if we
7437 do not always throw an exception.
7439 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
7440 whether the property has a set accessor.
7442 2002-08-11 Martin Baulig <martin@gnome.org>
7444 Added control flow analysis support for structs.
7446 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
7447 with control flow analysis turned off.
7448 (IVariable): New interface.
7449 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
7450 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
7451 (FieldExpr.DoResolve): Resolve the instance expression with flow
7452 analysis turned off and do the definite assignment check after the
7453 resolving when we know what the expression will resolve to.
7455 * expression.cs (LocalVariableReference, ParameterReference):
7456 Implement the new IVariable interface, only call the flow analysis
7457 code if ec.DoFlowAnalysis is true.
7458 (This): Added constructor which takes a Block argument. Implement
7459 the new IVariable interface.
7460 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
7461 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
7462 This does the definite assignment checks for struct members.
7464 * class.cs (Constructor.Emit): If this is a non-static `struct'
7465 constructor which doesn't have any initializer, call
7466 Block.AddThisVariable() to tell the flow analysis code that all
7467 struct elements must be initialized before control returns from
7470 * statement.cs (MyStructInfo): New public class.
7471 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
7472 argument to this indexer. If non-zero, check an individual struct
7473 member, not the whole struct.
7474 (FlowBranching.CheckOutParameters): Check struct members.
7475 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
7476 overloaded versions of these methods which take an additional
7477 `int field_idx' argument to check struct members.
7478 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
7479 overloaded versions of these methods which take an additional
7480 `string field_name' argument to check struct member.s
7481 (VariableInfo): Implement the IVariable interface.
7482 (VariableInfo.StructInfo): New public property. Returns the
7483 MyStructInfo instance of the variable if it's a struct or null.
7484 (Block.AddThisVariable): New public method. This is called from
7485 Constructor.Emit() for non-static `struct' constructor which do
7486 not have any initializer. It creates a special variable for the
7487 "this" instance variable which will be checked by the flow
7488 analysis code to ensure that all of the struct's fields are
7489 initialized before control returns from the constructor.
7490 (UsageVector): Added support for struct members. If a
7491 variable/parameter is a struct with N members, we reserve a slot
7492 in the usage vector for each member. A struct is considered fully
7493 initialized if either the struct itself (slot 0) or all its
7494 members are initialized.
7496 2002-08-08 Martin Baulig <martin@gnome.org>
7498 * driver.cs (Driver.MainDriver): Only report an error CS5001
7499 if there were no compilation errors.
7501 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
7502 `UnsafeContext' property to determine whether the parent is in
7503 unsafe context rather than checking the parent's ModFlags:
7504 classes nested in an unsafe class are unsafe as well.
7506 2002-08-08 Martin Baulig <martin@gnome.org>
7508 * statement.cs (UsageVector.MergeChildren): Distinguish between
7509 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
7510 we return. Added test17() and test18() to test-154.cs.
7512 2002-08-08 Martin Baulig <martin@gnome.org>
7514 * typemanager.cs (TypeManager.FilterWithClosure): If we have
7515 Family access, make sure the invoking type isn't a subclass of the
7516 queried type (that'd be a CS1540).
7518 * ecore.cs (Expression.MemberLookup): Added overloaded version of
7519 this method which takes an additional `Type invocation_type'.
7521 * expression.cs (BaseAccess.DoResolve): Use the base type as
7522 invocation and query type.
7523 (MemberAccess.DoResolve): If the lookup failed and we're about to
7524 report a CS0122, try a lookup with the ec.ContainerType - if this
7525 succeeds, we must report a CS1540.
7527 2002-08-08 Martin Baulig <martin@gnome.org>
7529 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
7530 (MethodGroupExpr): Implement the IMemberExpr interface.
7532 * expression (MemberAccess.ResolveMemberAccess): No need to have
7533 any special code for MethodGroupExprs anymore, they're now
7536 2002-08-08 Martin Baulig <martin@gnome.org>
7538 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
7539 Family, FamANDAssem and FamORAssem permissions.
7540 (TypeManager.IsSubclassOrNestedChildOf): New public method.
7542 2002-08-08 Martin Baulig <martin@gnome.org>
7544 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
7545 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
7548 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
7550 * driver.cs: implemented /resource option to embed managed resources.
7552 2002-08-07 Martin Baulig <martin@gnome.org>
7554 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
7555 (FieldBase.HasFieldInitializer): New public property.
7556 (FieldBase.GetInitializerExpression): New public method. Resolves and
7557 returns the field initializer and makes sure it is only resolved once.
7558 (TypeContainer.EmitFieldInitializers): Call
7559 FieldBase.GetInitializerExpression to get the initializer, this ensures
7560 that it isn't resolved multiple times.
7562 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
7563 the resolving process (SimpleName/MemberLookup) that we're currently
7564 emitting a field initializer (which must not access any instance members,
7565 this is an error CS0236).
7567 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
7568 argument, if the `IsFieldInitializer' flag is set, we must report and
7569 error CS0236 and not an error CS0120.
7571 2002-08-07 Martin Baulig <martin@gnome.org>
7573 * ecore.cs (IMemberExpr): New public interface.
7574 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
7575 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
7576 if the expression is an IMemberExpr.
7578 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
7579 to be null, implicitly default to `this' if we're non-static in
7580 this case. Simplified the code a lot by using the new IMemberExpr
7581 interface. Also fixed bug #28176 here.
7583 2002-08-06 Martin Baulig <martin@gnome.org>
7585 * cs-parser.jay (SimpleLookup): Removed. We need to create
7586 ParameterReferences during semantic analysis so that we can do a
7587 type-only search when resolving Cast, TypeOf and SizeOf.
7588 (block): Pass the `current_local_parameters' to the Block's
7591 * class.cs (ConstructorInitializer): Added `Parameters parameters'
7592 argument to the constructor.
7593 (ConstructorInitializer.Resolve): Create a temporary implicit
7594 block with the parameters.
7596 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
7597 references here if we aren't doing a type-only search.
7599 * statement.cs (Block): Added constructor which takes a
7600 `Parameters parameters' argument.
7601 (Block.Parameters): New public property.
7603 * support.cs (InternalParameters.Parameters): Renamed `parameters'
7604 to `Parameters' and made it public readonly.
7606 2002-08-06 Martin Baulig <martin@gnome.org>
7608 * ecore.cs (Expression.Warning): Made this public as well.
7610 * report.cs (Report.Debug): Print the contents of collections.
7612 2002-08-06 Martin Baulig <martin@gnome.org>
7614 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
7615 used to tell Resolve() which kinds of expressions it may return.
7616 (Expression.Resolve): Added overloaded version of this method which
7617 takes a `ResolveFlags flags' argument. This can be used to tell
7618 Resolve() which kinds of expressions it may return. Reports a
7620 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
7621 ResolveFlags.SimpleName.
7622 (Expression.Error118): Added overloaded version of this method which
7623 takes a `ResolveFlags flags' argument. It uses the flags to determine
7624 which kinds of expressions are allowed.
7626 * expression.cs (Argument.ResolveMethodGroup): New public method.
7627 Resolves an argument, but allows a MethodGroup to be returned.
7628 This is used when invoking a delegate.
7630 * TODO: Updated a bit.
7632 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7634 Fixed compilation with csc.
7636 * ecore.cs: Expression.Error made public. Is this correct? Should
7637 Warning be made public too?
7639 * expression.cs: use ea.Location instead of ea.loc.
7640 [FIXME: Filed as bug #28607: MCS must report these errors.]
7642 2002-08-06 Martin Baulig <martin@gnome.org>
7644 * ecore.cs (Expression.loc): Moved the location here instead of
7645 duplicating it in all derived classes.
7646 (Expression.Location): New public property.
7647 (Expression.Error, Expression.Warning): Made them non-static and
7648 removed the location argument.
7649 (Expression.Warning): Added overloaded version which takes an
7650 `int level' argument.
7651 (Expression.Error118): Make this non-static and removed the
7652 expression and location arguments.
7653 (TypeExpr): Added location argument to the constructor.
7655 * expression.cs (StaticCallExpr): Added location argument to
7657 (Indirection, PointerArithmetic): Likewise.
7658 (CheckedExpr, UnCheckedExpr): Likewise.
7659 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
7660 (StringPtr): Likewise.
7663 2002-08-05 Martin Baulig <martin@gnome.org>
7665 * expression.cs (BaseAccess.DoResolve): Actually report errors.
7667 * assign.cs (Assign.DoResolve): Check whether the source
7668 expression is a value or variable.
7670 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
7671 while resolving the corresponding blocks.
7673 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
7674 an error, don't silently return null.
7676 * statement.cs (Block.AddVariable): Do the error reporting here
7677 and distinguish between CS0128 and CS0136.
7678 (Block.DoResolve): Report all unused labels (warning CS0164).
7679 (LabeledStatement): Pass the location to the constructor.
7680 (LabeledStatement.HasBeenReferenced): New property.
7681 (LabeledStatement.Resolve): Set it to true here.
7683 * statement.cs (Return.Emit): Return success even after reporting
7684 a type mismatch error (CS0126 or CS0127), this is what csc does and
7685 it avoids confusing the users with any consecutive errors.
7687 2002-08-05 Martin Baulig <martin@gnome.org>
7689 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
7691 * const.cs (Const.LookupConstantValue): Catch circular definitions.
7693 * expression.cs (MemberAccess.DoResolve): Silently return if an
7694 error has already been reported.
7696 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
7697 error has already been reported.
7699 2002-08-05 Martin Baulig <martin@gnome.org>
7701 * statement.cs (UsageVector): Only initialize the `parameters'
7702 vector if we actually have any "out" parameters.
7704 2002-08-05 Martin Baulig <martin@gnome.org>
7706 * expression.cs (Binary.ResolveOperator): When combining delegates,
7707 they must have the same type.
7709 2002-08-05 Martin Baulig <martin@gnome.org>
7711 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
7712 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
7713 work with the ms runtime and we also don't need it: if we're a
7714 PropertyBuilder and not in the `indexer_arguments' hash, then we
7715 are a property and not an indexer.
7717 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
7718 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
7719 since the latter one doesn't work with the ms runtime.
7721 2002-08-03 Martin Baulig <martin@gnome.org>
7723 Fixed bugs #27998 and #22735.
7725 * class.cs (Method.IsOperator): New public field.
7726 (Method.CheckBase): Report CS0111 if there's already a method
7727 with the same parameters in the current class. Report CS0508 when
7728 attempting to change the return type of an inherited method.
7729 (MethodData.Emit): Report CS0179 if a method doesn't have a body
7730 and it's not marked abstract or extern.
7731 (PropertyBase): New abstract base class for Property and Indexer.
7732 (PropertyBase.CheckBase): Moved here from Property and made it work
7734 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
7735 the same so we can reuse it there.
7736 (Property, Indexer): Derive from PropertyBase.
7737 (MethodSignature.inheritable_property_signature_filter): New delegate
7738 to find properties and indexers.
7740 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
7741 argument and improved error reporting.
7743 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
7744 EmptyReadOnlyParameters and made it a property.
7746 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
7747 version of this method which takes a `PropertyInfo indexer'.
7748 (TypeManager.RegisterIndexer): New method.
7750 * class.cs: Added myself as author of this file :-)
7752 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7754 * class.cs: fixed compilation on windoze.
7756 2002-08-03 Martin Baulig <martin@gnome.org>
7758 * interface.cs (Interface.GetInterfaceBases): Check whether all
7759 base interfaces are at least as accessible than the current one.
7761 * class.cs (TypeContainer.GetClassBases): Check whether base types
7762 are at least as accessible than the current type.
7763 (TypeContainer.AsAccessible): Implemented and made non-static.
7764 (MemberBase.CheckParameters): Report errors if the accessibility
7767 * delegate.cs (Delegate.Delegate): The default visibility is
7768 internal for top-level types and private for nested types.
7769 (Delegate.Define): Report errors if the accessibility checks fail.
7771 * enum.cs (Enum.Enum): The default visibility is internal for
7772 top-level types and private for nested types.
7773 (Enum.DefineType): Compute the correct visibility.
7775 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
7776 function which takes a `bool is_toplevel' instead of a TypeContainer.
7778 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
7781 2002-08-02 Martin Baulig <martin@gnome.org>
7783 * expression.cs (LocalVariableReferenc): Added constructor which
7784 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
7785 (LocalVariableReference.IsReadOnly): New property.
7786 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
7787 variable is readonly, use our own readonly flag to do this; you can
7788 use the new constructor to get a writable reference to a read-only
7791 * cs-parser.jay (foreach_statement, using_statement): Get a writable
7792 reference to the local variable.
7794 2002-08-01 Miguel de Icaza <miguel@ximian.com>
7796 * rootcontext.cs (ResolveCore): Also include System.Exception
7798 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
7799 we reach an EmptyStatement.
7801 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
7804 * expression.cs (Binary.ResolveOperator): Check error result in
7807 use brtrue/brfalse directly and avoid compares to null.
7809 2002-08-02 Martin Baulig <martin@gnome.org>
7811 * class.cs (TypeContainer.Define): Define all nested interfaces here.
7812 Fixes bug #28407, added test-155.cs.
7814 2002-08-01 Martin Baulig <martin@gnome.org>
7816 * class.cs (Event.EmitDefaultMethod): Make this work with static
7817 events. Fixes #28311, added verify-3.cs.
7819 2002-08-01 Martin Baulig <martin@gnome.org>
7821 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
7822 `is_disposable' fields.
7823 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
7824 `hm.is_disposable' if we're using the collection pattern.
7825 (Foreach.EmitCollectionForeach): Use the correct type for the
7826 enumerator's local variable, only emit the try/finally block if
7827 necessary (fixes #27713).
7829 2002-08-01 Martin Baulig <martin@gnome.org>
7831 * ecore.cs (Expression.report118): Renamed to Error118 and made
7834 * statement.cs (Throw.Resolve): Check whether the expression is of
7835 the correct type (CS0118) and whether the type derives from
7836 System.Exception (CS0155).
7837 (Catch.Resolve): New method. Do the type lookup here and check
7838 whether it derives from System.Exception (CS0155).
7839 (Catch.CatchType, Catch.IsGeneral): New public properties.
7841 * typemanager.cs (TypeManager.exception_type): Added.
7843 2002-07-31 Miguel de Icaza <miguel@ximian.com>
7845 * driver.cs: Updated About function.
7847 2002-07-31 Martin Baulig <martin@gnome.org>
7849 Implemented Control Flow Analysis.
7851 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
7852 (EmitContext.CurrentBranching): Added.
7853 (EmitContext.StartFlowBranching): Added.
7854 (EmitContext.EndFlowBranching): Added.
7855 (EmitContext.KillFlowBranching): Added.
7856 (EmitContext.IsVariableAssigned): Added.
7857 (EmitContext.SetVariableAssigned): Added.
7858 (EmitContext.IsParameterAssigned): Added.
7859 (EmitContext.SetParameterAssigned): Added.
7860 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
7861 Added control flow analysis stuff here.
7863 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
7864 resolve the expression as lvalue.
7865 (LocalVariableReference.DoResolve): Check whether the variable has
7866 already been assigned.
7867 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
7868 the parameter as assigned here.
7869 (ParameterReference.DoResolve): Check whether the parameter has already
7871 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
7872 expression as lvalue.
7874 * statement.cs (FlowBranching): New class for the flow analysis code.
7875 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
7876 (LabeledStatement.IsDefined): New public property.
7877 (LabeledStatement.AddUsageVector): New public method to tell flow
7878 analyis that the label may be reached via a forward jump.
7879 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
7881 (VariableInfo.Number): New public field. This is used by flow analysis
7882 to number all locals of a block.
7883 (Block.CountVariables): New public property. This is the number of
7884 local variables in this block (including the locals from all parent
7886 (Block.EmitMeta): Number all the variables.
7888 * statement.cs: Added flow analysis support to all classes.
7890 2002-07-31 Martin Baulig <martin@gnome.org>
7892 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
7893 To get debugging messages, compile mcs with /define:MCS_DEBUG and
7894 then use this argument.
7896 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
7898 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
7899 use this to specify /define options.
7901 2002-07-29 Martin Baulig <martin@gnome.org>
7903 * statement.cs (Fixed): Moved all code that does variable lookups
7904 and resolvings from Emit to Resolve.
7906 * statement.cs (For): Moved all code that does variable lookups
7907 and resolvings from Emit to Resolve.
7909 * statement.cs (Using): Moved all code that does variable lookups
7910 and resolvings from Emit to Resolve.
7912 2002-07-29 Martin Baulig <martin@gnome.org>
7914 * attribute.cs (Attribute.Resolve): Explicitly catch a
7915 System.NullReferenceException when creating the
7916 CustromAttributeBuilder and report a different warning message.
7918 2002-07-29 Martin Baulig <martin@gnome.org>
7920 * support.cs (ParameterData.ParameterName): Added method to
7921 get the name of a parameter.
7923 * typemanager.cs (TypeManager.IsValueType): New public method.
7925 2002-07-29 Martin Baulig <martin@gnome.org>
7927 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
7928 is a flag which specifies that it's either ref or out.
7929 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
7930 the out parameter to `out Parameter.Modifier mod', also set the
7931 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
7933 * support.cs (InternalParameters.ParameterModifier): Distinguish
7934 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7935 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7937 * expression.cs (Argument.GetParameterModifier): Distinguish
7938 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7939 Parameter.Modifier.ISBYREF flag if it's either ref or out.
7941 2002-07-29 Martin Baulig <martin@gnome.org>
7943 * expression.cs (ParameterReference.ParameterReference): Added
7944 `Location loc' argument to the constructor.
7946 * cs-parser.jay: Pass location to ParameterReference.
7948 2002-07-28 Miguel de Icaza <miguel@ximian.com>
7950 * statement.cs (Try): Initialize the location.
7952 * cs-parser.jay: pass location to Try.
7954 * expression.cs (Unary.Reduce): Change the prototype to return
7955 whether a constant fold could be performed or not. The result is
7956 returned in an out parameters. In the case of Indirection and
7957 AddressOf, we want to perform the full tests.
7959 2002-07-26 Miguel de Icaza <miguel@ximian.com>
7961 * statement.cs (Statement.Emit): Flag dead code.
7963 2002-07-27 Andrew Birkett <andy@nobugs.org>
7965 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
7967 2002-07-27 Martin Baulig <martin@gnome.org>
7969 * class.cs (MethodData.Define): Put back call to
7970 TypeManager.AddMethod(), accidentally commented this out.
7972 * report.cs (Debug): New public method to print debugging information,
7973 this is `[Conditional ("DEBUG")]'.
7975 2002-07-26 Martin Baulig <martin@gnome.org>
7977 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
7978 (switch_statement): Push the current_block to the switch_stack and
7979 pop it again when we're done with the switch.
7980 (switch_section): The new block is a child of the current_block.
7981 Fixes bug #24007, added test-152.cs.
7983 2002-07-27 Martin Baulig <martin@gnome.org>
7985 * expression.cs (Invocation.EmitArguments): When calling a varargs
7986 function with only its fixed arguments, we need to pass an empty
7989 2002-07-27 Martin Baulig <martin@gnome.org>
7991 Mono 0.13 has been released.
7993 2002-07-25 Miguel de Icaza <miguel@ximian.com>
7995 * driver.cs: Rename --resource to --linkres, because that is what
7996 we do currently, we dont support --resource yet.
7998 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
8000 2002-07-25 Martin Baulig <martin@gnome.org>
8002 * class.cs (MethodData): New public class. This is a `method builder'
8003 class for a method or one accessor of a Property/Indexer/Event.
8004 (MethodData.GetMethodFlags): Moved here from MemberBase.
8005 (MethodData.ApplyAttributes): Likewise.
8006 (MethodData.ApplyObsoleteAttribute): Likewise.
8007 (MethodData.ApplyConditionalAttribute): Likewise.
8008 (MethodData.ApplyDllImportAttribute): Likewise.
8009 (MethodData.CheckAbstractAndExternal): Likewise.
8010 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
8011 (MethodData.Emit): Formerly known as Method.Emit().
8012 (MemberBase): Moved everything which was specific to a single
8013 accessor/method to MethodData.
8014 (Method): Create a new MethodData and call Define() and Emit() on it.
8015 (Property, Indexer, Event): Create a new MethodData objects for each
8016 accessor and call Define() and Emit() on them.
8018 2002-07-25 Martin Baulig <martin@gnome.org>
8020 Made MethodCore derive from MemberBase to reuse the code from there.
8021 MemberBase now also checks for attributes.
8023 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
8024 (MemberBase.GetMethodFlags): Moved here from class Method and marked
8026 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
8027 `CallingConventions cc' and `Attributes opt_attrs' arguments.
8028 (MemberBase.ApplyAttributes): New virtual method; applies the
8029 attributes to a method or accessor.
8030 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
8031 (MemberBase.ApplyConditionalAttribute): Likewise.
8032 (MemberBase.ApplyDllImportAttribute): Likewise.
8033 (MemberBase.CheckAbstractAndExternal): Likewise.
8034 (MethodCore.ParameterTypes): This is now a property instead of a
8035 method, it's initialized from DoDefineParameters().
8036 (MethodCore.ParameterInfo): Removed the set accessor.
8037 (MethodCore.DoDefineParameters): New protected virtual method to
8038 initialize ParameterTypes and ParameterInfo.
8039 (Method.GetReturnType): We can now simply return the MemberType.
8040 (Method.GetMethodFlags): Override the MemberBase version and add
8041 the conditional flags.
8042 (Method.CheckBase): Moved some code from Define() here, call
8043 DoDefineParameters() here.
8044 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
8045 here to avoid some larger code duplication.
8046 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
8047 ensure that abstract and external accessors don't declare a body.
8049 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
8050 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
8051 lookup in the attribute's parent classes, so we need to abort as soon
8052 as we found the first match.
8053 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
8054 the attribute has no arguments.
8056 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
8059 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8061 * cs-parser.jay: reverted previous patch.
8063 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8065 * cs-parser.jay: fixed bug #22119.
8067 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8069 * attribute.cs: fixed compilation. The error was:
8070 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
8071 be assigned to before control leaves the current method."
8072 [FIXME: Filed as bug #28186: MCS must report this error.]
8074 2002-07-25 Martin Baulig <martin@gnome.org>
8076 * attribute.cs (Attribute.Conditional_GetConditionName): New static
8077 method to pull the condition name ouf of a Conditional attribute.
8078 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
8079 the obsolete message and error flag out of an Obsolete attribute.
8081 * class.cs (Method.GetMethodFlags): New public method to get the
8082 TypeManager.MethodFlags for this method.
8083 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
8085 (Method.Define): Get and apply the Obsolete and Conditional attributes;
8086 if we're overriding a virtual function, set the new private variable
8087 `parent_method'; call the new TypeManager.AddMethod().
8089 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
8090 the MethodBuilder and the Method in a PtrHashtable.
8091 (TypeManager.builder_to_method): Added for this purpose.
8092 (TypeManager.MethodFlags): Added IsObsoleteError.
8093 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
8094 Obsolete and Conditional arguments in MethodBuilders. If we discover
8095 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
8096 the message from the attribute.
8098 2002-07-24 Martin Baulig <martin@gnome.org>
8100 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
8101 preprocessor directives, ensure that the argument to #define/#undef is
8102 exactly one identifier and that it's actually an identifier.
8104 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
8107 2002-07-24 Martin Baulig <martin@gnome.org>
8109 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
8110 initialize it to TypeManager.object_type in the constructor.
8111 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
8112 of the `hm.get_current' method if we're using the collection pattern.
8113 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
8114 for the explicit conversion to make it work when we're using the collection
8115 pattern and the `Current' property has a different return type than `object'.
8118 2002-07-24 Martin Baulig <martin@gnome.org>
8120 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
8121 does not match, but don't report any errors. This method is called in
8122 order for all methods in a MethodGroupExpr until a matching method is
8123 found, so we don't want to bail out if the first method doesn't match.
8124 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
8125 matches, report the 123. Fixes #28070.
8127 2002-07-24 Martin Baulig <martin@gnome.org>
8129 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
8130 TypeManager.TypeToCoreType() to the top of the method so the
8131 following equality checks will work. Fixes #28107.
8133 2002-07-24 Martin Baulig <martin@gnome.org>
8135 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
8136 operand is of type uint, and the other operand is of type sbyte,
8137 short or int, the operands are converted to type long." -
8138 Actually do what this comment already told us. Fixes bug #28106,
8141 2002-07-24 Martin Baulig <martin@gnome.org>
8143 * class.cs (MethodBase): New abstract class. This is now a base
8144 class for Property, Indexer and Event to avoid some code duplication
8145 in their Define() and DefineMethods() methods.
8146 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
8147 generic methods for Define() and DefineMethods().
8148 (FieldBase): Derive from MemberBase, not MemberCore.
8149 (Property): Derive from MemberBase, not MemberCore.
8150 (Property.DefineMethod): Moved all the code from this method to the
8151 new MethodBase.DefineAccessor(), just call it with appropriate
8153 (Property.Define): Call the new Property.DoDefine(), this does some
8154 sanity checks and we don't need to duplicate the code everywhere.
8155 (Event): Derive from MemberBase, not MemberCore.
8156 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
8157 accessors, this will also make them work with interface events.
8158 (Indexer): Derive from MemberBase, not MemberCore.
8159 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
8160 (Indexer.Define): Use the new MethodBase functions.
8162 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
8163 argument to the constructor.
8164 (Interface.FindMembers): Added support for interface events.
8165 (Interface.PopluateEvent): Implemented.
8167 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
8169 2002-07-22 Miguel de Icaza <miguel@ximian.com>
8171 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
8172 but this is required to check for a method name being the same as
8173 the containing class.
8177 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8179 * interface.cs: initialize variable.
8181 2002-07-23 Martin Baulig <martin@gnome.org>
8183 Implemented the IndexerName attribute in interfaces.
8185 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
8186 name if this is an explicit interface implementation.
8187 (Indexer.InterfaceIndexerName): New public variable. If we're
8188 implementing an interface indexer, this is the IndexerName in that
8189 interface. Otherwise, it's the IndexerName.
8190 (Indexer.DefineMethod): If we're implementing interface indexer,
8191 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
8192 and Pending.ImplementIndexer methods.
8193 (Indexer.Define): Also define the PropertyBuilder if we're
8194 implementing an interface indexer and this is neither an explicit
8195 interface implementation nor do the IndexerName match the one in
8198 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
8199 If a method is defined here, then we always need to create a proxy
8200 for it. This is used when implementing interface indexers.
8201 (Pending.IsInterfaceIndexer): New public method.
8202 (Pending.ImplementIndexer): New public method.
8203 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
8204 This is used when implementing interface indexers to define a proxy
8206 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
8207 define a proxy if necessary.
8209 * interface.cs (Interface.IndexerName): New public variable.
8210 (Interface.PopulateIndexer): Set the IndexerName.
8211 (Interface.DefineIndexers): New private method. Populate all the
8212 indexers and make sure their IndexerNames match.
8214 * typemanager.cs (IndexerPropertyName): Added support for interface
8217 2002-07-22 Martin Baulig <martin@gnome.org>
8219 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
8220 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
8221 ret if HasReturnLabel.
8222 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
8225 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
8226 and set the ec.LoopBeginTryCatchLevel.
8227 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
8228 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
8229 the current ec.TryCatchLevel, the branch goes out of an exception
8230 block. In this case, we need to use Leave and not Br.
8232 2002-07-22 Martin Baulig <martin@gnome.org>
8234 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
8235 block unless the block does not always return or it is contained in
8236 another try { ... } catch { ... } block. Fixes bug #26506.
8237 Added verify-1.cs to the test suite.
8239 2002-07-22 Martin Baulig <martin@gnome.org>
8241 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
8242 then we do not always return. Fixes bug #24985.
8244 2002-07-22 Martin Baulig <martin@gnome.org>
8246 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
8247 lookup on a per-class level; ie. walk up the class hierarchy until we
8248 found at least one applicable method, then choose the best among them.
8249 Fixes bug #24463 and test-29.cs.
8251 2002-07-22 Martin Baulig <martin@gnome.org>
8253 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
8254 return types of the methods. The return type is not part of the
8255 signature and we must not check it to make the `new' modifier work.
8256 Fixes bug #27999, also added test-147.cs.
8257 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
8259 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
8260 on the method's return type.
8262 2002-07-21 Martin Baulig <martin@gnome.org>
8264 * assign.cs: Make this work if the rightmost source is a constant and
8265 we need to do an implicit type conversion. Also adding a few more tests
8266 to test-38.cs which should have caught this.
8268 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
8269 target in the makefile for this. The makefile.gnu is primarily intended
8270 for end-users who don't want to debug the compiler.
8272 2002-07-21 Martin Baulig <martin@gnome.org>
8274 * assign.cs: Improved the Assign class so it can now handle embedded
8275 assignments (X = Y = Z = something). As a side-effect this'll now also
8276 consume less local variables. test-38.cs now passes with MCS, added
8277 a few new test cases to that test.
8279 2002-07-20 Martin Baulig <martin@gnome.org>
8281 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
8282 instructions. Fixes bug #27977, also added test-146.cs.
8284 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8286 * cs-tokenizer.cs: fixed getHex ().
8288 2002-07-19 Martin Baulig <martin@gnome.org>
8290 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
8291 not Type.GetType() to lookup the array type. This is needed when
8292 we're constructing an array of a user-defined type.
8293 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
8294 single-dimensional arrays, but also for single-dimensial arrays of
8297 2002-07-19 Martin Baulig <martin@gnome.org>
8299 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
8300 this function is called, it's not allowed to share LocalBuilders
8303 2002-07-19 Martin Baulig <martin@gnome.org>
8305 * expression.cs (Argument.Resolve): Report an error 118 when trying
8306 to pass a type as argument.
8308 2002-07-18 Martin Baulig <martin@gnome.org>
8310 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
8311 Conv_R_Un for the signed `long' type.
8313 2002-07-15 Miguel de Icaza <miguel@ximian.com>
8315 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
8316 `expr' for the temporary result, as that will fail if we do
8317 multiple resolves on the same expression.
8319 2002-07-05 Miguel de Icaza <miguel@ximian.com>
8321 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
8322 ec.TypeContainer for looking up aliases.
8324 * class.cs (TypeContainer): Remove LookupAlias from here.
8326 * decl.cs (DeclSpace); Move here.
8328 2002-07-01 Miguel de Icaza <miguel@ximian.com>
8330 * class.cs (FindMembers): Only call filter if the constructor
8331 bulider is not null.
8333 Also handle delegates in `NestedTypes' now. Now we will perform
8334 type lookups using the standard resolution process. This also
8337 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
8338 This uses Expressions (the limited kind that can be parsed by the
8339 tree) instead of strings.
8341 * expression.cs (ComposedCast.ToString): Implement, used to flag
8342 errors since now we have to render expressions.
8344 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
8347 * ecore.cs (SimpleName.ToString): ditto.
8349 * cs-parser.jay: Instead of using strings to assemble types, use
8350 Expressions to assemble the type (using SimpleName, ComposedCast,
8351 MemberAccess). This should fix the type lookups in declarations,
8352 because we were using a different code path for this.
8354 * statement.cs (Block.Resolve): Continue processing statements
8355 even when there is an error.
8357 2002-07-17 Miguel de Icaza <miguel@ximian.com>
8359 * class.cs (Event.Define): Also remove the `remove' method from
8360 the list of pending items.
8362 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
8363 generate more compact code.
8365 2002-07-17 Martin Baulig <martin@gnome.org>
8367 * const.cs (Const.LookupConstantValue): Add support for constant
8368 `unchecked' and `checked' expressions.
8369 Also adding test case test-140.cs for this.
8371 2002-07-17 Martin Baulig <martin@gnome.org>
8373 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
8374 check whether mi.ReturnType implements the IEnumerator interface; the
8375 `==' and the IsAssignableFrom() will fail in this situation.
8377 2002-07-16 Ravi Pratap <ravi@ximian.com>
8379 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
8382 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8384 * expression.cs: fixed bug #27811.
8386 2002-07-14 Miguel de Icaza <miguel@ximian.com>
8388 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
8389 Molaro: when we are a ref, the value already contains a pointer
8390 value, do not take the address of it.
8392 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
8393 * removed mb-parser.jay and mb-tokenizer.cs
8395 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
8397 * expression.cs: check against the building corlib void type.
8399 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
8401 * ecore.cs: fix for valuetype static readonly fields: when
8402 initializing them, we need their address, not the address of a copy.
8404 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
8406 * typemanager.cs: register also enum_type in corlib.
8408 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
8410 * class.cs: allow calling this (but not base) initializers in structs.
8412 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
8414 * ecore.cs: make sure we compare against the building base types
8417 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
8419 * typemanager.cs: fix TypeToCoreType() to handle void and object
8420 (corlib gets no more typerefs after this change).
8422 2002-07-12 Miguel de Icaza <miguel@ximian.com>
8424 * expression.cs (ArrayCreation.EmitArrayArguments): use
8425 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
8427 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
8428 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
8429 array indexes, the runtime actually forbids them.
8431 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
8432 for array arguments here.
8434 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
8435 instead of the default for ValueTypes.
8437 (New.DoEmit): Use IsValueType instead of
8438 IsSubclassOf (value_type)
8439 (New.DoResolve): ditto.
8440 (Invocation.EmitCall): ditto.
8442 * assign.cs (Assign): ditto.
8444 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
8445 Statements *are* currently doing part of their resolution during
8448 Expressions do always resolve during resolve, but statements are
8449 only required to propagate resolution to their children.
8451 2002-07-11 Miguel de Icaza <miguel@ximian.com>
8453 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
8455 (LoadAssembly): Do not add the dll if it is already specified
8457 (MainDriver): Add the System directory to the link path at the end,
8458 after all the other -L arguments.
8460 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
8461 wrong opcode for loading bytes and bools (ldelem.i1 instead of
8462 ldelem.u1) and using the opposite for sbytes.
8464 This fixes Digger, and we can finally run it.
8466 * driver.cs (UnixParseOption): Move the option parsing here.
8467 (CSCParseOption): Implement CSC-like parsing of options.
8469 We now support both modes of operation, the old Unix way, and the
8470 new CSC-like way. This should help those who wanted to make cross
8473 The only thing broken is that /r:, /reference: and /lib: are not
8474 implemented, because I want to make those have the same semantics
8475 as the CSC compiler has, and kill once and for all the confussion
8476 around this. Will be doing this tomorrow.
8478 * statement.cs (Unsafe.Resolve): The state is checked during
8479 resolve, not emit, so we have to set the flags for IsUnsfe here.
8481 2002-07-10 Miguel de Icaza <miguel@ximian.com>
8483 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
8484 not catch the Error_ObjectRefRequired in SimpleName (as it is
8485 possible to have a class/instance variable name that later gets
8486 deambiguated), we have to check this here.
8488 2002-07-10 Ravi Pratap <ravi@ximian.com>
8490 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
8491 make static and put into Expression.
8493 (Event.Define): Register the private field of the event with the
8494 TypeManager so that GetFieldFromEvent can get at it.
8496 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
8497 keep track of the private field associated with an event which
8500 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
8503 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
8505 2002-07-10 Miguel de Icaza <miguel@ximian.com>
8507 * expression.cs (Binary.EmitBranchable): this routine emits the
8508 Binary expression in a branchable context. This basically means:
8509 we need to branch somewhere, not just get the value on the stack.
8511 This works together with Statement.EmitBoolExpression.
8513 * statement.cs (Statement.EmitBoolExpression): Use
8516 2002-07-09 Miguel de Icaza <miguel@ximian.com>
8518 * statement.cs (For): Reduce the number of jumps in loops.
8520 (For): Implement loop inversion for the For statement.
8522 (Break): We can be breaking out of a Try/Catch controlled section
8523 (foreach might have an implicit try/catch clause), so we need to
8524 use Leave instead of Br.
8526 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
8527 now). If the instace expression supports IMemoryLocation, we use
8528 the AddressOf method from the IMemoryLocation to extract the
8529 address instead of emitting the instance.
8531 This showed up with `This', as we were emitting the instance
8532 always (Emit) instead of the Address of This. Particularly
8533 interesting when This is a value type, as we dont want the Emit
8534 effect (which was to load the object).
8536 2002-07-08 Miguel de Icaza <miguel@ximian.com>
8538 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
8540 * statement.cs (Checked): Set the CheckedState during the resolve
8541 process too, as the ConvCast operations track the checked state on
8542 the resolve process, and not emit.
8544 * cs-parser.jay (namespace_member_declaration): Flag that we have
8545 found a declaration when we do. This is used to flag error 1529
8547 * driver.cs: Report ok when we display the help only.
8549 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
8551 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
8553 2002-07-04 Miguel de Icaza <miguel@ximian.com>
8555 * cs-tokenizer.cs (define): We also have to track locally the
8556 defines. AllDefines is just used for the Conditional Attribute,
8557 but we also need the local defines for the current source code.
8559 2002-07-03 Miguel de Icaza <miguel@ximian.com>
8561 * statement.cs (While, For, Do): These loops can exit through a
8562 Break statement, use this information to tell whether the
8563 statement is the last piece of code.
8565 (Break): Flag that we break.
8567 * codegen.cs (EmitContexts): New `Breaks' state variable.
8569 2002-07-03 Martin Baulig <martin@gnome.org>
8571 * class.cs (TypeContainer.MethodModifiersValid): Allow override
8572 modifiers in method declarations in structs. Otherwise, you won't
8573 be able to override things like Object.Equals().
8575 2002-07-02 Miguel de Icaza <miguel@ximian.com>
8577 * class.cs (Method, Property, Indexer): Do not allow the public
8578 modifier to be used in explicit interface implementations.
8580 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
8581 override modifiers in method declarations in structs
8583 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
8585 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
8586 integer or real overflow, report an error
8588 2002-07-02 Martin Baulig <martin@gnome.org>
8590 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
8591 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
8592 to tell the runtime about our newly created System.Object and
8593 System.ValueType types.
8595 2002-07-02 Miguel de Icaza <miguel@ximian.com>
8597 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
8598 struct instead of Ldarg/Starg.
8600 2002-07-02 Martin Baulig <martin@gnome.org>
8602 * expression.cs (Indirection.Indirection): Call
8603 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
8605 2002-07-02 Martin Baulig <martin@gnome.org>
8607 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
8608 ValueType, call TypeManager.TypeToCoreType() on it.
8609 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
8610 the OpCodes.Newarr argument.
8612 2002-07-02 Martin Baulig <martin@gnome.org>
8614 * expression.cs (Invocation.EmitCall): When compiling corlib,
8615 replace all calls to the system's System.Array type to calls to
8616 the newly created one.
8618 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
8619 System.Array methods.
8620 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
8621 from the system's System.Array type which must be replaced.
8623 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
8625 * typemanager.cs: load unverifiable_code_ctor so we can build
8626 corlib using the correct type. Avoid using GetTypeCode() with
8628 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
8629 TypeManager.object_type to allow building corlib.
8631 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
8633 * ecore.cs: handle System.Enum separately in LoadFromPtr().
8635 2002-07-01 Martin Baulig <martin@gnome.org>
8637 * class.cs: Make the last change actually work, we need to check
8638 whether `ifaces != null' to avoid a crash.
8640 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
8642 * class.cs: when we build structs without fields that implement
8643 interfaces, we need to add the interfaces separately, since there is
8644 no API to both set the size and add the interfaces at type creation
8647 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
8649 * expression.cs: the dimension arguments to the array constructors
8650 need to be converted if they are a long.
8652 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
8654 * class.cs: don't emit ldarg.0 if there is no parent constructor
8655 (fixes showstopper for corlib).
8657 2002-06-29 Martin Baulig <martin@gnome.org>
8659 MCS now compiles corlib on GNU/Linux :-)
8661 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
8662 ie. check for MethodImplOptions.InternalCall.
8664 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
8665 and TypeManager.attribute_type are null, so we must explicitly check
8666 whether parent is not null to find out whether it's an attribute type.
8667 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
8668 and SetBuilder, not only if the property is neither abstract nor external.
8669 This is necessary to set the MethodImplOptions on the accessor methods.
8670 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
8671 SetBuilder, see Property.Emit().
8673 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
8674 populate "System.Object", "System.ValueType" and "System.Attribute" since
8675 they've already been populated from BootCorlib_PopulateCoreTypes().
8677 2002-06-29 Martin Baulig <martin@gnome.org>
8679 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
8680 is the NullLiteral, we also need to make sure that target_type is not
8683 2002-06-29 Martin Baulig <martin@gnome.org>
8685 * rootcontext.cs (RootContext.ResolveCore): We must initialize
8686 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
8687 before calling BootstrapCorlib_ResolveDelegate ().
8689 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8691 * statement.cs: fixed build-breaker. All tests passed ok.
8693 2002-06-27 Martin Baulig <martin@gnome.org>
8695 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
8696 for System.Decimal when compiling corlib.
8698 2002-06-27 Martin Baulig <martin@gnome.org>
8700 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
8701 switch blocks which contain nothing but a default clause.
8703 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
8705 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
8707 2002-06-27 Martin Baulig <martin@gnome.org>
8709 * ecore.cs (PropertyExpr.PropertyExpr): Call
8710 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
8712 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
8713 is already a TypeBuilder.
8715 2002-06-27 Martin Baulig <martin@gnome.org>
8717 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
8718 `target_type == TypeManager.array_type', not IsAssignableFrom() in
8719 the "from an array-type to System.Array" case. This makes it work
8720 when compiling corlib.
8722 2002-06-27 Martin Baulig <martin@gnome.org>
8724 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
8725 non-static PropertyExpr, set its InstanceExpression. This makes
8726 the `ICollection.Count' property work in System/Array.cs.
8728 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
8730 * driver.cs: Made error handling more consistent. Errors now
8731 tracked by Report class, so many methods which used to return int
8732 now return void. Main() now prints success/failure and
8733 errors/warnings message.
8735 Renamed '--probe' compiler argument to '--expect-error'. Removed
8736 the magic number return values (123 and 124). Now, if the
8737 expected error occurs, the compiler exits with success (exit value
8738 0). If the compilation completes without seeing that particular
8739 error, the compiler exits with failure (exit value 1). The
8740 makefile in mcs/errors has been changed to handle the new behaviour.
8742 * report.cs: Made 'expected error' number a property and renamed
8743 it from 'Probe' to 'ExpectedError'.
8745 * genericparser.cs: Removed error handling support, since it is
8746 now all done by Report class.
8748 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
8749 class, so parse() no longer returns an int.
8751 * namespace.cs: Use Report.Error instead of GenericParser.error
8753 2002-06-22 Miguel de Icaza <miguel@ximian.com>
8755 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
8756 TypeContainer.AddOperator): At the front of the list put the
8757 explicit implementations, so they get resolved/defined first.
8759 2002-06-21 Miguel de Icaza <miguel@ximian.com>
8761 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
8762 interface type is implemented by this TypeContainer. Used during
8763 explicit interface implementation.
8765 (Property.Define, Indexer.Define, Method.Define): Validate that
8766 the given interface in the explicit implementation is one of the
8767 base classes for the containing type.
8769 Also if we are explicitly implementing an interface, but there is
8770 no match in the pending implementation table, report an error.
8772 (Property.Define): Only define the property if we are
8773 not explicitly implementing a property from an interface. Use the
8774 correct name also for those properties (the same CSC uses,
8775 although that is really not needed).
8777 (Property.Emit): Do not emit attributes for explicitly implemented
8778 properties, as there is no TypeBuilder.
8780 (Indexer.Emit): ditto.
8782 Hiding then means that we do not really *implement* a pending
8783 implementation, which makes code fail.
8785 2002-06-22 Martin Baulig <martin@gnome.org>
8787 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
8788 the return value of Object.GetType(). [FIXME: we need to do this whenever
8789 we get a type back from the reflection library].
8791 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
8793 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
8795 2002-06-20 Miguel de Icaza <miguel@ximian.com>
8797 * attribute.cs: Return null if we can not look up the type.
8799 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
8800 the interface types found.
8802 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
8803 interface types found.
8805 * typemanager.cs (GetInterfaces): Make this routine returns alll
8806 the interfaces and work around the lame differences between
8807 System.Type and System.Reflection.Emit.TypeBuilder in the results
8808 result for GetInterfaces.
8810 (ExpandInterfaces): Given an array of interface types, expand and
8811 eliminate repeated ocurrences of an interface. This expands in
8812 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
8815 2002-06-21 Martin Baulig <martin@gnome.org>
8817 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
8820 2002-06-21 Martin Baulig <martin@gnome.org>
8822 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
8823 and called with one of the core types, return the corresponding typebuilder for
8826 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
8829 2002-06-21 Martin Baulig <martin@gnome.org>
8831 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
8832 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
8833 (Expression.ConvertReferenceExplicit): Likewise.
8835 * expression.cs (ElementAccess.DoResolve): Likewise.
8836 (ElementAccess.DoResolveLValue): Likewise.
8838 2002-06-10 Martin Baulig <martin@gnome.org>
8840 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
8841 add the "value" parameter to the parameter list.
8843 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
8846 2002-06-19 Miguel de Icaza <miguel@ximian.com>
8848 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
8849 the argument to an int, uint, long or ulong, per the spec. Also
8850 catch negative constants in array creation.
8852 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
8854 * class.cs: do not allow the same interface to appear twice in
8855 the definition list.
8857 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
8859 * ecore.cs: don't use ldlen with System.Array.
8861 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
8863 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
8865 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
8867 * modifiers.cs: produce correct field attributes for protected
8868 internal. Easy fix so miguel can work on ther harder stuff:-)
8870 2002-06-18 Miguel de Icaza <miguel@ximian.com>
8872 * pending.cs: New file. Move the code from class.cs here.
8873 Support clearning the pending flag for all methods (when not doing
8874 explicit interface implementation).
8876 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
8878 * rootcontext.cs: added a couple more types needed to bootstrap.
8880 2002-06-17 Miguel de Icaza <miguel@ximian.com>
8882 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
8883 constructor in the type, instead of any constructor in the type
8884 hierarchy. Thanks to Paolo for finding this bug (it showed up as
8885 a bug in the Mono runtime when applying the params attribute).
8887 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
8888 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
8890 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
8892 * expression.cs (Unary.ResolveOperator): Use TypeManager
8893 to resolve the type.
8895 2002-06-13 Ravi Pratap <ravi@ximian.com>
8897 * cs-parser.jay (enum_member_declaration): Pass in the attributes
8900 * enum.cs (AddEnumMember): Add support to store the attributes associated
8901 with each member too.
8903 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
8904 field builders too - this takes care of the enum member case.
8906 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
8908 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
8909 address-of operator on both value types and pointers.
8911 2002-06-10 Martin Baulig <martin@gnome.org>
8913 * interface.cs (Interface.PopulateIndexer): Add the indexer's
8914 PropertyBuilder to the `property_builders' list.
8916 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
8917 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
8918 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
8919 find any indexers which are inherited from an interface.
8921 2002-06-09 Martin Baulig <martin@gnome.org>
8923 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
8924 the same type as the constant if necessary. There's also a test-130.cs
8927 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
8929 * typemanager.cs (TypeManager.ChangeType): Previously known as
8930 Enum.ChangeEnumType().
8932 2002-06-09 Martin Baulig <martin@gnome.org>
8934 * expression.cs (Cast.TryReduce): Added support for consts.
8936 2002-06-08 Ravi Pratap <ravi@ximian.com>
8938 * class.cs (Accessor): Hold attributes information so we can pass
8941 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
8942 Modify to pass in attributes attached to the methods.
8944 (add_accessor_declaration, remove_accessor_declaration): Ditto.
8946 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
8947 to handle the Accessor kind :-)
8949 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
8951 2002-06-08 Martin Baulig <martin@gnome.org>
8953 * expression.cs (Unary.TryReduceNegative): Added support for
8956 2002-06-08 Martin Baulig <martin@gnome.org>
8958 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
8959 name can't be found in the `defined_names' - the caller will do a
8960 MemberLookup in this case and thus find methods in System.Enum
8961 such as Enum.IsDefined().
8963 2002-06-08 Martin Baulig <martin@gnome.org>
8965 * enum.cs (Enum.ChangeEnumType): This is a custom version of
8966 Convert.ChangeType() which works with TypeBuilder created types.
8967 (Enum.LookupEnumValue, Enum.Define): Use it here.
8969 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
8970 `TypeBuilder.BaseType != null' check.
8971 (TypeContainer.FindMembers): Only lookup parent members if we
8972 actually have a parent.
8973 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
8974 (ConstructorInitializer.Resolve): Likewise.
8976 * interface.cs (Interface.FindMembers): Added
8977 `TypeBuilder.BaseType != null' check.
8979 * rootcontext.cs (RootContext.ResolveCore): Added
8980 "System.Runtime.CompilerServices.IndexerNameAttribute" to
8981 classes_second_stage.
8983 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
8984 debug_type and trace_type when compiling with --nostdlib.
8986 2002-06-07 Martin Baulig <martin@gnome.org>
8988 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
8989 (AddField): Set it to true when adding a non-static field.
8990 (DefineType): Use `have_nonstatic_fields' to find out whether we
8991 have non-static fields, not `Fields != null'.
8993 2002-06-02 Miguel de Icaza <miguel@ximian.com>
8995 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
8996 dereferencing a null on the static-field code path)
8998 2002-05-30 Martin Baulig <martin@gnome.org>
9000 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
9001 to take command line arguments. Use reflection to call the new
9002 custom `Initialize' function on the symbol writer and pass it the
9003 command line arguments.
9005 * driver.cs (--debug-args): New command line argument to pass command
9006 line arguments to the symbol writer.
9008 2002-05-28 Miguel de Icaza <miguel@ximian.com>
9010 * assign.cs (DoResolve): Forgot to do the implicit conversion to
9011 the target type for indexers and properties. Thanks to Joe for
9014 2002-05-27 Miguel de Icaza <miguel@ximian.com>
9016 * typemanager.cs (MethodFlags): returns the method flags
9017 (Obsolete/ShouldIgnore) that control warning emission and whether
9018 the invocation should be made, or ignored.
9020 * expression.cs (Invocation.Emit): Remove previous hack, we should
9021 not do this on matching a base type, we should do this based on an attribute
9023 Only emit calls to System.Diagnostics.Debug and
9024 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
9025 on the command line.
9027 * rootcontext.cs: Global settings for tracing and debugging.
9029 * cs-tokenizer.cs (define): New utility function to track
9030 defines. Set the global settings for TRACE and DEBUG if found.
9032 2002-05-25 Ravi Pratap <ravi@ximian.com>
9034 * interface.cs (Populate*): Pass in the TypeContainer as well as
9035 the DeclSpace as parameters so that we can create EmitContexts and
9036 then use that to apply attributes etc.
9038 (PopulateMethod, PopulateEvent, PopulateProperty)
9039 (PopulateIndexer): Apply attributes everywhere.
9041 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
9044 (ApplyAttributes): Update accordingly.
9046 We now apply interface attributes for all members too.
9048 2002-05-26 Miguel de Icaza <miguel@ximian.com>
9050 * class.cs (Indexer.Define); Correctly check if we are explicit
9051 implementation (instead of checking the Name for a ".", we
9052 directly look up if the InterfaceType was specified).
9054 Delay the creation of the PropertyBuilder.
9056 Only create the PropertyBuilder if we are not an explicit
9057 interface implementation. This means that explicit interface
9058 implementation members do not participate in regular function
9059 lookups, and hence fixes another major ambiguity problem in
9060 overload resolution (that was the visible effect).
9062 (DefineMethod): Return whether we are doing an interface
9065 * typemanager.cs: Temporary hack until we get attributes in
9066 interfaces (Ravi is working on that) and we get IndexerName
9067 support in interfaces.
9069 * interface.cs: Register the indexers as properties.
9071 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
9072 warning, I have verified that this is a bug in the .NET runtime
9073 (JavaScript suffers of the same problem).
9075 * typemanager.cs (MemberLookup): When looking up members for
9076 interfaces, the parent of an interface is the implicit
9077 System.Object (so we succeed in searches of Object methods in an
9078 interface method invocation. Example: IEnumerable x; x.ToString
9081 2002-05-25 Miguel de Icaza <miguel@ximian.com>
9083 * class.cs (Event): Events should also register if they do
9084 implement the methods that an interface requires.
9086 * typemanager.cs (MemberLookup); use the new GetInterfaces
9089 (GetInterfaces): The code used to lookup interfaces for a type is
9090 used in more than one place, factor it here.
9092 * driver.cs: Track the errors at the bottom of the file, we kept
9095 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
9096 instance if the method we are calling is static!
9098 2002-05-24 Miguel de Icaza <miguel@ximian.com>
9100 * attribute.cs (ApplyAttributes): Make this function filter out
9101 the IndexerName attribute (as that attribute in reality is never
9102 applied) and return the string constant for the IndexerName
9105 * class.cs (TypeContainer.Emit): Validate that all the indexers
9106 have the same IndexerName attribute, and if so, set the
9107 DefaultName attribute on the class.
9109 * typemanager.cs: The return value might contain other stuff (not
9110 only methods). For instance, consider a method with an "Item"
9111 property and an Item method.
9113 * class.cs: If there is a problem with the parameter types,
9116 2002-05-24 Ravi Pratap <ravi@ximian.com>
9118 * ecore.cs (ImplicitConversionExists): Wrapper function which also
9119 looks at user defined conversion after making a call to
9120 StandardConversionExists - we need this for overload resolution.
9122 * expression.cs : Update accordingly the various method calls.
9124 This fixes 2 bugs filed against implicit user defined conversions
9126 2002-05-22 Miguel de Icaza <miguel@ximian.com>
9128 * statement.cs: Track the result of the assignment.
9130 2002-05-21 Miguel de Icaza <miguel@ximian.com>
9132 * expression.cs (MemberAccess): Improved error reporting for
9133 inaccessible members.
9135 2002-05-22 Martin Baulig <martin@gnome.org>
9137 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
9138 itself with debugging support.
9140 2002-05-22 Martin Baulig <martin@gnome.org>
9142 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
9143 Removed, this isn't needed anymore.
9145 2002-05-20 Martin Baulig <martin@gnome.org>
9147 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
9148 be underlying type for an enum.
9150 2002-05-20 Miguel de Icaza <miguel@ximian.com>
9152 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
9153 that splits out the loading of just the core types.
9155 * rootcontext.cs (ResolveCore): Split the struct resolution in
9156 two, so we can load the enumeration underlying types before any
9159 * expression.cs (Is): Bandaid until we fix properly Switch (see
9160 bug #24985 for details).
9162 * typemanager.cs (ImplementsInterface): The hashtable will contain
9163 a null if there are no interfaces implemented.
9165 2002-05-18 Miguel de Icaza <miguel@ximian.com>
9167 * cs-parser.jay (indexer_declarator): It is fine to have array
9170 2002-05-17 Miguel de Icaza <miguel@ximian.com>
9172 * typemanager.cs: (RegisterBuilder): New function used to register
9173 TypeBuilders that implement interfaces. Since
9174 TypeBuilder.GetInterfaces (as usual) does not work with lame
9176 (AddUserType): register interfaces.
9178 (ImplementsInterface): Use the builder_to_ifaces hash if we are
9179 dealing with TypeBuilder. Also, arrays are showing up as
9180 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
9181 methods can not be invoked on them!
9183 * ecore.cs (ExplicitReferenceConversionExists): Made public.
9184 (ImplicitReferenceConversionExists): Split out from
9185 StandardConversionExists.
9187 * expression.cs (As): We were only implementing one of the three
9188 cases for the as operator. We now implement them all.
9189 (Is): Implement the various other cases for Is as well.
9191 * typemanager.cs (CACHE): New define used to control if we want or
9192 not the FindMembers cache. Seems to have a negative impact on
9193 performance currently
9195 (MemberLookup): Nested types have full acess to
9196 enclosing type members
9198 Remove code that coped with instance/static returns for events, we
9199 now catch this in RealFindMembers.
9201 (RealFindMembers): only perform static lookup if the instance
9202 lookup did not return a type or an event.
9204 2002-05-17 Miguel de Icaza <miguel@ximian.com>
9206 * assign.cs (CompoundAssign): We pass more semantic information
9207 now to Compound Assignments than we did before: now we have all
9208 the information at hand, and now we resolve the target *before* we
9209 do the expression expansion, which allows the "CacheValue" method
9210 to have the effect we intended (before, a [x] += 1 would generate
9211 two differen ArrayAccess expressions from the ElementAccess,
9212 during the resolution process).
9214 (CompoundAssign.DoResolve): Resolve target and original_source here.
9216 2002-05-16 Miguel de Icaza <miguel@ximian.com>
9218 * expression.cs (ArrayAccess): dropped debugging information.
9220 * typemanager.cs: Small bug fix: I was always returning i_members,
9221 instead of one of i_members or s_members (depending on which had
9224 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
9225 method is invoked before any code generation takes place, and it
9226 is a mechanism to inform that the expression will be invoked more
9227 than once, and that the method should use temporary values to
9228 avoid having side effects
9230 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
9232 * ecore.cs (Expression.CacheTemporaries): Provide empty default
9235 * expression.cs (Indirection, ArrayAccess): Add support for
9236 CacheTemporaries in these two bad boys.
9238 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
9240 (StoreFromPtr): Handle stobj as well.
9242 * expression.cs (UnaryMutator): Share more code.
9244 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
9245 down: I was not tracking the Filter function as well, which
9246 was affecting the results of the cache.
9248 2002-05-15 Miguel de Icaza <miguel@ximian.com>
9250 * attribute.cs: Remove the hack to handle the CharSet property on
9253 2002-05-14 Miguel de Icaza <miguel@ximian.com>
9255 * attribute.cs (DoResolve): More uglyness, we now only try to
9256 resolve the attribute partially, to extract the CharSet
9257 information (only if we are a StructLayout attribute). Otherwise
9259 (GetExtraTypeInfo): Add some code to conditionally kill in the
9260 future this. I am more and more convinced that the .NET
9261 framework has special code to handle the attribute setting on
9264 * expression.cs (IsParamsMethodApplicable): Revert my previous
9265 foreach change here, it was wrong.
9267 2002-05-13 Miguel de Icaza <miguel@ximian.com>
9269 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
9270 (pp_expr): do not abort on unknown input, just return.
9271 (eval): abort if there are pending chars.
9273 * attribute.cs (Attribute.Resolve): Positional parameters are
9274 optional. Deal with that case.
9276 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
9277 the Ansi/Unicode/Auto information for the type.
9279 (TypeContainer.DefineType): instantiate the EmitContext here, as
9280 we will be using it during the type definition (to resolve
9281 attributes) and during the emit phase.
9283 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
9284 to pull type information out of the attributes
9286 (Attribute.Resolve): track the constructor builder, and allow for
9287 multiple invocations (structs and classes will use this).
9289 * ecore.cs (MemberLookupFinal): new version with all the
9290 parameters customizable.
9292 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
9293 constructors. Return if the result value is null (as the error
9294 would have been flagged already by MemberLookupFinal)
9296 Do not allow instances of abstract classes or interfaces to be
9299 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
9300 We have to compare the assembly property here when dealing with
9301 FamANDAssem and Assembly access modifiers, because we might be
9302 creating an assembly from *modules* (that means that we are not
9303 getting TypeBuilders for types defined in other modules that are
9304 part of this assembly).
9306 (Method.Emit): If the method is marked abstract and has a body,
9309 (TypeContainer.DefineMembers): If both the defined member and the
9310 parent name match are methods, then do not emit any warnings: let
9311 the Method.Define routine take care of flagging warnings. But if
9312 there is a mismatch (method overrides something else, or method is
9313 overriwritten by something, then emit warning).
9315 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
9316 set to null, this means `do not check for the return type on the
9319 (Method.Define): set the return type for the method signature to
9320 null, so that we get methods with the same name and parameters and
9321 different return types. This is used to flag warning 114 (you are
9322 hiding a method, and you probably want to use the new/override
9325 * typemanager.cs (MemberLookup): Implemented proper access
9326 control, closing a long standing set of bug reports. The problem
9327 was that the Framework only has two bits: Public and NonPublic,
9328 and NonPublic includes private and protected methods, but we need
9329 to enforce the FamANDAssem, FamOrAssem and Family.
9331 2002-05-11 Miguel de Icaza <miguel@ximian.com>
9333 * statement.cs (GotoCase): Return true: Ammounts to giving up
9334 knowledge on whether we return or not, and letting the other case
9335 be responsible for it.
9337 2002-05-10 Miguel de Icaza <miguel@ximian.com>
9339 * driver.cs: Do not load directories for each file processed, only
9340 do it if there is a pattern.
9342 * ecore.cs: Report readonly assigns here as well, as we might have
9343 been resolved only by MemberAccess.
9345 (SimpleName.SimpleNameResolve): Also be useful for LValue
9346 resolution. We need this to propagate assign to local readonly variables
9348 * typemanager.cs: Use a ptrhashtable for the criteria, because we
9349 do not want to reuse potential criteria memory.
9351 * class.cs (MyEventBuilder): Set reflected_type;
9353 * ecore.cs (Constantify): Added support for constifying bools.
9355 (RootContext.LookupType): Added a cache for values looked up in
9356 the declaration space.
9358 * typemanager.cs (FindMembers): Now is a front-end to
9359 RealFindMembers, and provides a two-level hashtable-based cache to
9362 15% performance improvement: from 22.5 to 19.2 seconds.
9364 * expression.cs (IsParamsMethodApplicable): use foreach.
9365 (Invocation.DoResolve): ditto.
9366 (New.DoResolve): ditto.
9367 (ArrayCreation.DoResolve): ditto.
9369 * ecore.cs (FindMostEncompassingType): use foreach.
9371 * delegate.cs (NewDelegate.DoResolve): Use foreach
9373 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
9374 (RemoveMethods): use foreach.
9376 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
9377 nested foreach statements instead of for, and also break out of
9378 the inner loop once a match is found.
9380 (Invocation.OverloadResolve): Use foreach, simplify the code.
9382 2002-05-08 Miguel de Icaza <miguel@ximian.com>
9384 * cfold.cs (BinaryFold): During an enumeration evaluation context,
9385 we actually unwrap the expression to allow for extra information
9388 * expression.cs: Use Shr_Un on unsigned operations.
9390 2002-05-08 Ravi Pratap <ravi@ximian.com>
9392 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
9393 applicable operators was not being considered correctly. This closes
9394 the bug Miguel reported.
9396 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
9398 * attribute.cs: check that the type derives from System.Attribute
9399 and report the correct error in that case (moved the duplicate code to
9400 its own method, too).
9402 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
9404 * attribute.cs: lookup attribute type name as the spec says: first the
9405 bare attribute name and then name + "Attribute" (nant compiles with
9406 mcs after this fix).
9408 2002-05-07 Miguel de Icaza <miguel@ximian.com>
9410 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
9411 Because of the way we parse things, we should try to see if a
9412 UIntConstant can fit in an integer.
9414 2002-05-07 Ravi Pratap <ravi@ximian.com>
9416 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
9417 when we are in an explicit context.
9419 (ConvertReferenceExplicit): When converting from Iface type S to Class
9420 T make sure the rules are implemented as an OR.
9422 * parameter.cs (ParameterType): Make it a property for now although the
9423 purpose really isn't anything immediate.
9425 * expression.cs (Is*Applicable): Do better checking on the parameter type
9426 of a ref/out parameter. The ones from the system assemblies are already
9427 marked with the correct type so we don't need to do any correction.
9429 * ecore.cs (StandardConversionExists): Conversion from Interface types to
9430 the object type is standard too so include that.
9432 2002-05-06 Miguel de Icaza <miguel@ximian.com>
9434 * ecore.cs (StandardConversionExists): Augment with missing code:
9435 deal with IntConstant, LongConstants and Enumerations.
9437 * assign.cs: Report the error, instead of failing silently
9439 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
9440 typecontainer that they are declared, because the
9441 typecontainer/namespace will have the list of using clauses that
9444 Assembly Attributes were escaping the normal registration
9447 (EmitCode): Apply attributes within an EmitContext that represents
9448 the container they were declared on.
9450 * cs-parser.jay: Track bases for structs. How did I get this wrong?
9452 2002-05-06 Ravi Pratap <ravi@ximian.com>
9454 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
9455 Revamp completely - make much cleaner as we now operate only
9458 (FindMostSpecificSource, FindMostSpecificTarget): New methods
9459 to implement the logic detailed in the spec more correctly.
9461 (UserDefinedConversion): Update accordingly.
9463 2002-05-06 Miguel de Icaza <miguel@ximian.com>
9465 * statement.cs: Return flow analysis information up.
9467 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
9470 (token): Do not consume an extra character before calling
9473 2002-05-06 Piers Haken <piersh@friskit.com>
9475 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
9477 2002-05-06 Miguel de Icaza <miguel@ximian.com>
9479 * class.cs (Constructor.Emit): Set the IsStatic flag in the
9480 EmitContext during the instance constructor initializer
9481 resolution, to stop access to instance variables.
9483 This is mandated by the spec, last paragraph of the `constructor
9484 initializers' section.
9486 2002-05-05 Miguel de Icaza <miguel@ximian.com>
9488 * cs-parser.jay, class.cs (Accessor): new class used to represent
9489 an accessor (get or set). In the past we used `null' to represent
9490 a missing accessor. But this is ambiguous because there was no
9491 way to tell in abstract indexers/properties if one of them was
9494 Now there is a way of addressing that.
9496 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
9497 instead of FindMembers.
9499 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
9500 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
9502 * attribute.cs: Treat indexers and properties as the same in terms
9503 of applying attributes
9505 * ecore.cs (FindMostEncompassedType): Use statically initialized
9506 EmptyExpressions()s like we do elsewhere to avoid creating useless
9507 objects (and we take this out of the tight loop).
9509 (GetConversionOperators): Move the code to extract the actual
9510 operators to a separate routine to clean things up.
9512 2002-05-04 Miguel de Icaza <miguel@ximian.com>
9514 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
9515 events are always registered FieldBuilders.
9517 * class.cs (FieldBase): New class shared by Fields
9519 * delegate.cs: If we are a toplevel delegate, use our full name.
9520 If we are a nested delegate, then only use our tail name.
9522 2002-05-02 Ravi Pratap <ravi@ximian.com>
9524 * expression.cs (IsApplicable): Ensure that we add the "&" to
9525 ref/out types before comparing it with the type of the argument.
9527 (IsParamsMethodApplicable): Ditto.
9529 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
9532 * delegate.cs : Handle the case when we have more than one applicable
9533 method. Flag an error only when we finish checking all.
9535 2002-05-02 Miguel de Icaza <miguel@ximian.com>
9537 * expression.cs: Add support for boolean static initializers.
9539 2002-05-01 Miguel de Icaza <miguel@ximian.com>
9541 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
9543 * parameter.cs (ComputeParameterTypes,
9544 ComputeAndDefineParameterTypes): Better error handling: now we
9545 clear the `types' cache if we fail during any of the type lookups.
9546 We also return the status code correctly to our caller
9548 * delegate.cs: If we fail to define a delegate, abort the extra
9551 * expression.cs (Binary.ResolveOperator): for
9552 operator==(object,object) and operator !=(object, object) we also
9553 have to verify that there is an implicit conversion from one to
9556 (ArrayAccess.DoResolve): Array Access can operate on
9559 2002-04-30 Miguel de Icaza <miguel@ximian.com>
9561 * assign.cs (CompoundAssign): A new class used as a "flag" that
9562 the assignment actually is happening as part of a compound
9563 assignment operator.
9565 During compound assignment, a few new rules exist to enable things
9572 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
9573 to the type of x) if y is implicitly convertible to the type of x,
9574 and the operator is a builtin operator and the return type of the
9575 operator is explicitly convertible to the type of x.
9577 * rootcontext.cs: Reset warning level to 2. 4 catches various
9578 "interesting" features in mcs, we must clean this up at some
9579 point, but currently am trying to kill other bugs ;-)
9581 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
9582 in container classes as well.
9584 * expression.cs (Binary.ResolveOperator): Handle string case
9585 before anything else (as operator overloading does emit an error
9586 before doing anything else).
9588 This code could go away when we move to a table driven model, but
9589 i could not come up with a good plan last night.
9591 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
9593 * typemanager.cs (CSharpName): reimplementation using regex.
9594 * class.cs: added null check for fields in Emit
9595 * rootcontext.cs: set warninglevel to 4
9597 2002-04-29 Miguel de Icaza <miguel@ximian.com>
9599 * typemanager.cs (CSharpName): reimplemented with Lupus
9602 2002-04-28 Miguel de Icaza <miguel@ximian.com>
9604 * statement.cs (If): correclty implement Resolve, because we were
9605 not catching sem errors in there. The same process is needed
9607 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
9610 (Statement.Warning_DeadCodeFound): Factorize code.
9611 (While): Report dead code here too.
9613 (Statement): Added Resolve virtual method to allow
9614 for resolution split from the emit code.
9616 2002-04-26 Miguel de Icaza <miguel@ximian.com>
9618 * statement.cs (EmitBoolExpression): No longer try to resolve the
9620 (MakeBoolean): New utility function that resolve, implicitly
9621 converts to boolean and tags the expression.
9624 (If, Do): Implement dead code elimination.
9625 (While): Implement loop inversion
9627 (Do, While, For, If): Resolve the expression prior to calling our
9630 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
9633 - added method Report28 (warning: program has more than one entry point)
9634 - added method IsEntryPoint, implements paragraph 10.1 of the spec
9635 - modified method Method.Define, the part at the end of the method
9637 * rootcontext.cs: added static public Location EntryPointLocation;
9639 * ../errors/cs0028.cs : Add test case for the above warning.
9642 - modified method CSharpName to allow arrays of primitive type to
9643 be printed nicely (e.g. instead of System.Int32[][] it now prints
9645 - added method CSharpSignature: returns the signature of a method
9646 in string format to be used in reporting errors, warnings, etc.
9648 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
9651 2002-04-26 Ravi Pratap <ravi@ximian.com>
9653 * delegate.cs (Define): Fix extremely silly bug where I was
9654 setting the type of the 'object' parameter of the BeginInvoke
9655 method to System.IAsyncResult instead of System.Object ;-)
9657 2002-04-26 Miguel de Icaza <miguel@ximian.com>
9659 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
9662 (Constructor.Emit): return if we fail to initialize the
9663 constructor. Another door closed!
9665 * expression.cs (New.DoResolve): Improve error message (from -6 to
9666 1501). Use DeclaredOnly lookup to find the exact constructor.
9668 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
9669 loop. This is useful.
9671 * cs-parser.jay: Adjust the default parameters so that destructors
9672 have the proper signature.
9674 2002-04-26 Martin Baulig <martin@gnome.org>
9676 * driver.cs (LoadAssembly): If `assembly' contains any characters
9677 which are only valid in path names and not in assembly names
9678 (currently slash, backslash and point), use Assembly.LoadFrom ()
9679 instead of Assembly.Load () on the `assembly' (before iteration
9680 over the link_paths).
9682 2002-04-26 Martin Baulig <martin@gnome.org>
9684 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
9686 2002-04-25 Miguel de Icaza <miguel@ximian.com>
9688 * class.cs (Property): use the new typemanager.MemberLookup
9690 (TypeContainer.MemberLookup): Implement using the
9691 TypeManager.MemberLookup now.
9693 * typemanager.cs: Make MemberLookup a function of the TypeManager,
9694 and return MemberInfos, so that these can be used without an
9695 EmitContext (what we had before).
9697 2002-04-24 Miguel de Icaza <miguel@ximian.com>
9699 * expression.cs: Fix the case where the argument to params if the
9700 type of the params. I omitted handling this before. Fixed
9702 2002-04-22 Miguel de Icaza <miguel@ximian.com>
9704 * driver.cs: Call BootCorlib_PopulateCoreType
9706 * class.cs (Property.CheckBase): Check for properties only, not
9709 * interface.cs: Temporary hack: try/catch around the
9710 CustomAttributeBuilder, because I am getting an exception that I
9713 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
9714 types whose definitions are required to be there (attributes are
9715 defined before standard types).
9717 Compute definitions as we boot the various types, as they are used
9718 immediately (value_type class will need object_type, but if we do
9719 not initialize object_type, we will pass a null, which will let
9720 the runtime pick the System.Object from the existing corlib, which
9721 is not what we want).
9723 2002-04-22 Patrik Torstensson <totte@labs2.com>
9725 * cs-tokenizer.cs: fixed a number of trim() issues.
9727 2002-04-22 Ravi Pratap <ravi@ximian.com>
9729 * expression.cs (Argument.Type): Ensure that we return the correct
9730 type when we have out or ref parameters [in which case we
9733 2002-04-22 Miguel de Icaza <miguel@ximian.com>
9735 * class.cs (Property, Indexer): Allow extern modifier in there.
9737 * typemanager.cs (InitBaseTypes): Initializes object_type and
9738 value_type, since those will be used early on during the bootstrap
9739 process to compile corlib.
9741 (InitCoreTypes): Move code from here to InitBaseTypes.
9743 2002-04-21 Miguel de Icaza <miguel@ximian.com>
9745 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
9746 single-dimension arrays as using the ldlen opcode.
9748 Daniel Lewis discovered this optimization.
9750 * typemanager.cs: Add signature for System.Array::get_Length
9752 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9754 * statement.cs: report the error when the foreach does not apply to an
9755 array nor a collection.
9757 2002-04-19 Miguel de Icaza <miguel@ximian.com>
9759 * expression.cs: Add implicit conversions to the operator ~.
9761 * constant.cs (DecimalConstant.Emit): Emit decimal value.
9763 * typemanager.cs: Locate the decimal constructor.
9765 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9767 * attribute.cs: use the new property of TypeOf.
9768 * expression.cs: added 'get' property around typearg.
9770 These changes fix a build breaker reported by NickD. Is this the
9771 correct way to fix? If not, please, revert my changes and make it
9774 2002-04-17 Miguel de Icaza <miguel@ximian.com>
9776 * attribute.cs: Add support for typeof in attribute invocations.
9777 I am not sure that this is right though.
9779 2002-04-14 Duncan Mak <duncan@ximian.com>
9781 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
9782 Binary.Operator.Division case.
9784 2002-04-13 Ravi Pratap <ravi@ximian.com>
9786 * class.cs (DefineType): Ensure that we do a proper check on
9787 attribute types and also register it with the TypeManager.
9789 (TypeContainer.Targets): The default for attribute types is
9790 AttributeTargets.All.
9792 * attribute.cs (ApplyAttributes): Registering the attribute type
9793 is done elsewhere, not when we discover we have a Usage attribute.
9795 2002-04-12 Ravi Pratap <ravi@ximian.com>
9797 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
9798 and get rid of is_delegate parameter.
9800 * everywhere : update.
9802 2002-04-12 Ravi Pratap <ravi@ximian.com>
9804 * cs-parser.jay (compilation_unit): Revamp completely to use
9805 some new ideas that I got from Rhys' grammar to solve the problems
9806 with assembly level attributes.
9808 (outer_declaration): New grammar production.
9810 (attribute_sections): Add.
9812 (opt_attributes): Base on attribute_sections
9814 (namespace_declaration): Allow opt_attributes to tackle the case
9815 when we have assembly level attributes - we are clever in this
9818 * attribute.cs (ApplyAttributes): Do not worry about assembly
9819 attributes in the non-global context.
9821 * rootcontext.cs (AddGlobalAttributes): Go back to using this
9822 instead of SetGlobalAttributes.
9824 * class.cs, rootcontext.cs : Ensure we define and generate
9825 attribute types before anything else.
9827 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
9828 and flag the new error -20 for the case when the attribute type
9829 does not have valid targets specified. csc does not catch this.
9831 * ../errors/errors.txt : update for error # -20
9833 2002-04-11 Ravi Pratap <ravi@ximian.com>
9835 * support.cs (InternalParameters.ParameterModifier): Do some null
9836 checking and return sane values.
9838 * class.cs (Method.Define): If we are a PInvoke method, ensure
9839 that we are static and extern. Report error # 601
9841 * ../errors/cs0601.cs : Add test case for the above error.
9843 2002-04-07 Ravi Pratap <ravi@ximian.com>
9845 * rootcontext.cs (attribute_types): We need to keep type of
9846 all attribute types separately and emit code for them first.
9848 (RegisterAttribute) : Implement.
9850 * class.cs (DefineType): Check if the current Type is a custom
9851 attribute type and register it accordingly.
9853 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
9854 adding the first attribute twice and rename to
9856 (SetGlobalAttributes): this.
9858 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
9861 * attribute.cs (ApplyAttributes): Take an additional argument telling us
9862 if we are processing global arguments. Hmm, I am unsure of this.
9864 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9866 * expression.cs: added static array of strings to avoid calling
9867 Enum.ToString () for Operator in Binary. Significant recover of
9870 2002-04-10 Miguel de Icaza <miguel@ximian.com>
9872 * class.cs (FindMembers): Allow the Builders of the various
9873 members to be null. If they are skip them. This only happens
9874 during the PInvoke declaration.
9876 2002-04-09 Miguel de Icaza <miguel@ximian.com>
9878 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
9879 failure, so we do not keep going afterwards.
9881 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
9882 wanted to pass `false' as the `is_delegate' argument. If this is
9883 the case, why not use delegate_type == null to mean `is_delegate =
9884 false' and anything else as is_delegate = true.
9886 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
9888 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
9889 code for the section, not the beginning of the tests.
9891 2002-04-08 Miguel de Icaza <miguel@ximian.com>
9893 * cfold.cs: Handle operator + (Enum x, Underlying x)
9895 * expression.cs (Binary): same. Warn about errors where we have
9896 Enum/Enum in operator + as well.
9898 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
9901 - added support for switch(bool)
9902 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
9903 - add TableSwitchEmit() to handle table-based switch statements
9905 2002-04-05 Ravi Pratap <ravi@ximian.com>
9907 * expression.cs (Invocation.OverloadResolve): Factor out code which
9908 does parameter compatibility checking with arguments so that we can
9909 re-use the code even from Delegate.VerifyApplicability
9911 (VerifyArgumentsCompat): Move above code here.
9913 * delegate.cs (VerifyApplicability): Get rid of duplicate code
9914 and instead make a call to the above method.
9916 2002-03-31 Ravi Pratap <ravi@ximian.com>
9918 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
9919 We use it to keep track of classes which are attribute types.
9921 2002-04-02 Miguel de Icaza <miguel@ximian.com>
9923 * delegate.cs (Delegate.Define): Correctly define the types in the
9924 presence of fixed and array parameters.
9926 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
9929 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
9930 include NonPublic after the first iteration.
9932 * class.cs (Indexer.CheckBase): Only check if both parents are
9935 * cs-parser.jay (accessor_body): If empty, set to null.
9937 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
9938 same code path here to resolve constants names that we did have in
9939 MemberAccess.DoResolve. There is too much code duplicated here.
9941 2002-04-01 Miguel de Icaza <miguel@ximian.com>
9943 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
9945 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
9948 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
9949 tokens, numbers and strings.
9951 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
9954 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
9955 asyncronous parameters and the regular parameters.
9957 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
9958 specify the target directory.
9960 * expression.cs: (This.DoResolve): Simplify
9961 (As.Emit): Optimize, do not generate IsInst if the expression is
9962 always of the given type.
9964 (Is.DoResolve): Bug fix, we were reporting both always/never for
9967 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
9968 creating too many unnecessary arrays.
9970 2002-03-31 Miguel de Icaza <miguel@ximian.com>
9972 * class.cs (EmitFieldInitializer): Use Assign expression to assign
9973 fields instead of rolling our own initializer. Takes care of all
9974 implicit conversions, and drops unnecessary static checks/argument.
9976 2002-03-31 Dick Porter <dick@ximian.com>
9978 * driver.cs: use the GetDirectories() return values properly, and
9979 use "/" as path separator.
9981 2002-03-30 Miguel de Icaza <miguel@ximian.com>
9983 * expression.cs (Unary): Optimize - - expr into expr.
9984 (Binary): Optimize a + (-b) into a -b.
9986 * codegen.cs (CodeGen): Made all methods static.
9988 2002-03-29 Miguel de Icaza <miguel@ximian.com>
9992 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
9993 TypeBuilder property.
9995 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
9998 * tree.cs: Removed the various RecordXXXX, and replaced with a
9999 single RecordDecl. Removed all the accessor methods, and just
10000 left a single access point Type
10002 * enum.cs: Rename DefineEnum to DefineType.
10004 * decl.cs: New abstract method `DefineType' used to unify the
10005 Defines for Enumerations, Interfaces, TypeContainers and
10008 (FindType): Moved LookupInterfaceOrClass here. Moved the
10009 LookupBaseClasses method that used to live in class.cs and
10010 interface.cs here, and renamed to FindType.
10012 * delegate.cs: Implement DefineType. Take advantage of the
10013 refactored pattern for locating the parent builder without taking
10014 the parent_builder argument (which we know does not work if we are
10015 nested, and triggering a toplevel definition).
10017 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10019 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
10020 accessibility of a member has changed during override and report
10023 * class.cs (Method.Define, Property.Define): Only complain on
10024 overrides if the method is private, any other accessibility is
10025 fine (and since we just checked the permission is the same, we are
10028 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
10029 and elif are processed always. The other pre-processing
10030 directives are only processed if we are "taking" the path
10032 2002-03-29 Martin Baulig <martin@gnome.org>
10034 * class.cs (Method.Emit): Only emit symbolic debugging info if the
10035 current location is not Null.
10037 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
10038 a separate method so we can profile it.
10040 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
10041 `span.Seconds' are just seconds, but no minutes or hours.
10042 (MainDriver): Profile the CodeGen.SaveSymbols calls.
10044 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10046 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
10047 Remove the gratuitous set of Final:
10049 // If an interface implementation, then we can set Final.
10050 if (((flags & MethodAttributes.Abstract) == 0) &&
10051 implementing.DeclaringType.IsInterface)
10052 flags |= MethodAttributes.Final;
10054 I do not know what I was smoking when I used that.
10057 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
10058 step into fixing the name resolution issues for delegates and
10059 unifying the toplevel name resolution.
10061 2002-03-28 Martin Baulig <martin@gnome.org>
10063 * class.cs (Method.Emit): If we have a symbol writer, call its
10064 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
10065 tell it about the current method.
10067 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
10068 writer that we're going to emit the first byte of IL code for a new
10069 statement (a new source line).
10070 (EmitContext.EmitTopBlock): If we have a symbol writer, call
10071 EmitContext.Mark() before emitting any code.
10073 * location.cs (SymbolDocument): Return null when we're Null.
10075 * statement.cs (Statement): Moved the `Location loc' variable here.
10076 (Statement.EmitBoolExpression): If we have a symbol writer, call
10077 ec.Mark() before emitting any code to tell it that we're at the
10078 beginning of a new statement.
10079 (StatementExpression): Added `Location' argument to the constructor.
10080 (Block): Added public readonly variable `StartLocation' and public
10081 variable `EndLocation'. The latter is to be set using SetEndLocation().
10082 (Block): Added constructor which takes a start and end location.
10083 (Block.SetEndLocation): New method. This sets the end location.
10084 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
10085 local variables we create.
10086 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
10087 each statement and do also mark the begin and end of the block.
10089 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
10090 tell it the current lexer.Location, use Location.Null for the end of the
10092 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
10093 current block, set its end location using SetEndLocation().
10094 (statement_expression): StatementExpression constructor now takes the
10095 lexer.Location as additional argument.
10096 (for_statement, declare_local_variables): Likewise.
10097 (declare_local_variables): When creating a new implicit block, use the
10098 new Block constructor and pass it the lexer.Location.
10100 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10102 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
10103 members also on the parent interfaces recursively.
10105 2002-03-27 Miguel de Icaza <miguel@ximian.com>
10107 * report.cs: Use new formats, since Gonzalo finished the missing
10110 * expression.cs (Binary.ResolveOperator): added missing operator|
10111 operator& and operator^ for bool/bool.
10113 * cs-parser.jay: CheckDef now takes a Location argument that is
10114 used to report errors more precisly (instead of reporting the end
10115 of a definition, we try to track something which is a lot closer
10116 to the source of the problem).
10118 * cs-tokenizer.cs: Track global token use, so we can properly flag
10119 the use of #define/#undef after the first token has been seen.
10121 Also, rename the reportXXXX to Error_DescriptiveName
10123 * decl.cs (DeclSpace.IsTopLevel): Move property here from
10124 TypeContainer, so that Enum and Interface can use this too.
10126 * class.cs (TypeContainer.LookupInterfaceOrClass,
10127 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
10128 `builder' argument. Typically this was used to pass the parent
10129 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
10132 The problem is that a nested class could trigger the definition of
10133 a toplevel class, and the builder would be obviously wrong in that
10136 So we drop this argument, and we compute dynamically the
10137 TypeBuilder/ModuleBuilder (the correct information was available
10138 to us anyways from DeclSpace.Parent)
10140 * interface.cs (Interface.DefineInterface): Drop builder
10141 parameter cleanup like class.cs
10143 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
10146 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
10149 (Try.Emit): Propagate the returns value from the statement.
10151 (Return.Emit): Even if we are leavning
10153 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
10155 * modifiers.cs: Fix the computation of MethodAttributes flags.
10157 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
10159 * driver.cs: allow compilation of files that start with '/'.
10160 Add a default case when checking the argument of --target.
10162 2002-03-25 Miguel de Icaza <miguel@ximian.com>
10164 * interface.cs: Implement the same search algorithm for types in
10165 the interface code.
10167 * delegate.cs: Do not allow multiple definition.
10169 * Recovered ChangeLog that got accidentally amputated
10171 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
10173 * rootcontext.cs: Load manually enum to allow core classes to
10174 contain enumerations.
10176 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
10177 Update to new static methods in TypeManager.
10179 * typemanager.cs (GetMethod, GetConstructor): Use our
10180 implementation of FindMembers to find the members, since during
10181 corlib compilation, the types are TypeBuilders and GetMethod and
10182 GetConstructor do not work.
10184 Make all methods in TypeManager static.
10186 (InitCodeHelpers): Split the functionality from
10187 the InitCodeTypes function.
10189 * driver.cs: Call InitCodeHelpers after we have populated the
10192 * cs-parser.jay (delegate_declaration): we did not used to compute
10193 the delegate name correctly for void delegates.
10195 2002-03-24 Miguel de Icaza <miguel@ximian.com>
10197 * rootcontext.cs (RootContext): Init the interface_resolve_order
10198 and type_container_resolve_order always.
10200 (ResolveCore, BootstrapCorlib_ResolveClass,
10201 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
10202 compiler when compiling with --nostdlib
10204 * class.cs (TypeContainer.DefineType): Check that our parent is
10205 not null. This test is most important when we are bootstraping
10208 * codegen.cs: Split out the symbol writing code.
10210 2002-03-25 Martin Baulig <martin@gnome.org>
10212 * driver.cs (-g): Made -g an alias for --debug.
10214 2002-03-24 Martin Baulig <martin@gnome.org>
10216 * codegen.cs (SymbolWriter): New public variable. Returns the
10217 current symbol writer.
10218 (CodeGen): Added `bool want_debugging_support' argument to the
10219 constructor. If true, tell the ModuleBuild that we want debugging
10220 support and ask it for the ISymbolWriter.
10221 (Save): If we have a symbol writer, call it's Close() method after
10222 saving the assembly.
10224 * driver.c (--debug): New command line argument to create a
10225 debugger information file.
10227 * location.cs (SymbolDocument): New public property. Returns an
10228 ISymbolDocumentWriter object for the current source file or null
10229 if we don't have a symbol writer.
10231 2002-03-21 Miguel de Icaza <miguel@ximian.com>
10233 * driver.cs (LoadAssembly): Correctly return when all the paths
10234 have been tried and not before.
10236 * statement.cs (Switch.Emit): return the actual coverage for this
10237 statement (returns/not-returns)
10239 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
10240 switch of the statement if we are the last switch section. That
10241 kills two problems: try/catch problems (we used to emit an empty
10242 nop at the end) and switch statements where all branches would
10245 2002-03-19 Miguel de Icaza <miguel@ximian.com>
10247 * driver.cs: Add default assemblies (the equivalent to the
10248 Microsoft CSC.RSP file)
10250 * cs-tokenizer.cs: When updating `cols and setting it to zero,
10251 also update tokens_seen and set it to false.
10253 * driver.cs: Implement --recurse for Mike.
10255 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
10256 correctly splitting out the paths.
10258 2002-03-18 Miguel de Icaza <miguel@ximian.com>
10260 * interface.cs (Interface.PopulateProperty): Instead of using
10261 `parent' as the declaration space for the set parameters, use
10264 * support.cs (InternalParameters): InternalParameters constructor
10265 takes a DeclSpace instead of a TypeContainer.
10267 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
10268 types are being initialized, load the address of it before calling
10271 (New): Provide a mechanism to disable the generation of local
10272 value type temporaries when the caller will be providing us with
10273 an address to store it.
10275 (ArrayCreation.EmitDynamicInitializers): Use it.
10277 2002-03-17 Miguel de Icaza <miguel@ximian.com>
10279 * expression.cs (Invocation.EmitArguments): Only probe for array
10280 property if there is more than one argument. Sorry about that.
10282 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
10283 empty param arrays.
10285 * class.cs (Method.LabelParameters): Fix incorrect code path that
10286 prevented the `ParamArrayAttribute' from being applied to the
10289 2002-03-16 Miguel de Icaza <miguel@ximian.com>
10291 * support.cs (ReflectionParameters): Correctly compute whether the
10292 last argument is a params array. Fixes the problem with
10295 * typemanager.cs: Make the assemblies array always be non-null
10296 (empty, but non-null)
10298 * tree.cs (RecordDecl): New function that abstracts the recording
10299 of names. This reports error 101, and provides a pointer to the
10300 previous declaration. Fixes a crash in the compiler.
10302 * cs-parser.jay (constructor_declaration): Update to new grammar,
10303 and provide a constructor_body that can be empty.
10305 2002-03-15 Miguel de Icaza <miguel@ximian.com>
10307 * driver.cs: Add support for --resources.
10309 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
10310 Make all types for the various array helper methods be integer.
10312 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
10313 CheckState to ConvCast.
10315 (ConvCast): Now it takes a `checked' state argument, to avoid
10316 depending on the emit context for the conversion, and just using
10317 the resolve time setting.
10319 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
10320 instead of Invocation.EmitArguments. We do not emit the original
10321 arguments, instead we emit those which have been converted to
10322 unsigned int expressions.
10324 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
10326 * codegen.cs: ditto.
10328 * expression.cs (LocalVariableReference): Drop the use of the
10329 Store function that depended on the variable index.
10331 * statement.cs (VariableInfo): Drop the `Idx' property from this
10332 class, as this is not taking into account the indexes for
10333 temporaries tat we generate during the execution, getting the
10336 * class.cs: First emit class initializers, then call the parent
10339 * expression.cs (Binary): Fix opcode emision.
10340 (UnaryMutator.EmitCode): Support checked code generation
10342 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
10343 matches for events for both the Static and Instance scans,
10344 pointing to the same element. Fix that.
10346 2002-03-14 Miguel de Icaza <miguel@ximian.com>
10348 * rootcontext.cs (ResolveTree): Always set the
10349 interface_resolve_order, because nested interfaces will be calling
10352 * class.cs (GetInterfaceOrClass): Track the same resolution
10353 process used by TypeManager.LookupType. This fixes the nested
10354 type lookups in class declarations (separate path from
10357 (TypeContainer.DefineType): Also define nested interfaces.
10358 (TypeContainer.RegisterOrder): New public function used to
10359 register the order in which child interfaces need to be closed.
10361 Nested interfaces need to be closed after their parents have been
10364 * interface.cs (InterfaceAttr): Put all the logic for computing
10365 the interface attribute here.
10367 (DefineInterface): Register our interface order with the
10368 RootContext or with the TypeContainer depending on the case.
10370 2002-03-12 Miguel de Icaza <miguel@ximian.com>
10372 * cs-parser.jay: rework foreach statement to work with the new
10373 changes to the policy on SimpleNames.
10375 * report.cs: support Stacktrace on warnings as well.
10377 * makefile: drop --unsafe and /unsafe from the compile.
10379 2002-03-13 Ravi Pratap <ravi@ximian.com>
10381 * ecore.cs (StandardConversionExists): Modify to take an Expression
10382 as the first parameter. Ensure we do null -> reference type conversion
10385 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
10386 temporary Expression objects.
10388 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
10390 * interface.cs: workaround bug in method overloading resolution
10391 (there is already a bugzilla bug for it).
10393 2002-03-12 Miguel de Icaza <miguel@ximian.com>
10395 We could also solve this problem by having a separate path for
10396 performing type lookups, instead of DoResolve, we could have a
10397 ResolveType entry point, and only participating pieces of the
10398 production (simplename, deref, array) would implement this.
10400 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
10401 signal SimpleName to only resolve type names and not attempt to
10402 resolve anything else.
10404 * expression.cs (Cast): Set the flag.
10406 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
10408 * class.cs: Only report 108 if there is no `new' modifier.
10410 * cs-parser.jay: rework foreach statement to work with the new
10411 changes to the policy on SimpleNames.
10413 * report.cs: support Stacktrace on warnings as well.
10415 * makefile: drop --unsafe and /unsafe from the compile.
10417 2002-03-11 Miguel de Icaza <miguel@ximian.com>
10419 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
10420 lookups here, instead of doing that at parse time. This means
10421 that our grammar will not introduce `LocalVariableReferences' as
10422 expressions at this point. That solves the problem of code like
10426 static void Main ()
10430 This is only half the fix. The full fix requires parameters to
10431 also be handled in this way.
10433 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
10434 makes the use more obvious of the DeclSpace. The
10435 ec.TypeContainer.TypeBuilder is now only used to pull the
10436 TypeBuilder for it.
10438 My theory is that I can get rid of the TypeBuilder completely from
10439 the EmitContext, and have typecasts where it is used (from
10440 DeclSpace to where it matters).
10442 The only pending problem is that the code that implements Aliases
10443 is on TypeContainer, and probably should go in DeclSpace.
10445 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
10446 lookups here, instead of doing that at parse time. This means
10447 that our grammar will not introduce `LocalVariableReferences' as
10448 expressions at this point. That solves the problem of code like
10452 static void Main ()
10456 This is only half the fix. The full fix requires parameters to
10457 also be handled in this way.
10459 * class.cs (Property.DefineMethod): When implementing an interface
10460 method, set newslot, when implementing an abstract method, do not
10461 set the flag (before we tried never setting it, or always setting
10462 it, which is the difference).
10463 (Indexer.DefineMethod): same.
10464 (Method.DefineMethod): same.
10466 * ecore.cs: Only set the status used flag if we get back a Field.
10468 * attribute.cs: Temporary hack, so Paolo can keep working.
10470 2002-03-08 Ravi Pratap <ravi@ximian.com>
10472 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
10473 the unmanaged type in the case we have a MarshalAs attribute.
10475 (Resolve): Handle the case when we are parsing the special MarshalAs
10476 attribute [we need to store the unmanaged type to use later]
10478 * typemanager.cs (marshal_as_attr_type): Built in type for the
10479 MarshalAs Attribute.
10481 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
10482 on parameters and accordingly set the marshalling info.
10484 2002-03-09 Miguel de Icaza <miguel@ximian.com>
10486 * class.cs: Optimizing slightly by removing redundant code after
10487 we switched to the `NoTypes' return value.
10488 (Property.DefineMethod): use NoTypes here too.
10490 This fixes the bug I introduced in my last batch of changes.
10492 2002-03-05 Ravi Pratap <ravi@ximian.com>
10494 * tree.cs (RecordEnum): Add. We now keep track of enums too.
10496 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
10497 Enums since those are types too.
10499 * cs-parser.jay (enum_declaration): Record enums as we parse them.
10501 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
10502 thanks to a call during the lookup process.
10504 2002-03-07 Miguel de Icaza <miguel@ximian.com>
10506 * statement.cs (Foreach): Lots of work to accomodate a particular
10507 kind of foreach statement that I had not kept in mind. It is
10508 possible to have foreachs on classes that provide a GetEnumerator
10509 method that return objects that implement the "pattern" for using
10510 a foreach, there is no need to support GetEnumerator
10513 This is needed to compile nant.
10515 * decl.cs: Only report 114 if the member is not `Finalize' and if
10516 the warning level is at least 2.
10518 * class.cs: Moved the compare function from Method to
10521 (MethodSignature.InheritableMemberSignatureCompare): Add new
10522 filter function that is used to extract inheritable methods from a
10525 (Method.Define): Use the new `inheritable_method_signature_filter'
10528 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
10531 2002-03-06 Miguel de Icaza <miguel@ximian.com>
10533 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
10535 * cs-parser.jay: Add opt_semicolon to the interface declaration.
10537 * expression.cs: Pass location information to
10538 ConvertImplicitStandard.
10540 * class.cs: Added debugging code to track return values from
10543 2002-03-05 Miguel de Icaza <miguel@ximian.com>
10545 * expression.cs (Is.DoResolve): If either side of the `is' is an
10546 interface, do not flag the warning.
10548 * ecore.cs (ImplicitReferenceConversion): We need a separate test
10551 * report.cs: Allow for --fatal to be used with --probe.
10553 * typemanager.cs (NoTypes): Move the definition for the empty Type
10556 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
10558 (TypeContainer.DefineProxy): New function used to proxy to parent
10559 implementations when implementing interfaces.
10560 (TypeContainer.ParentImplements): used to lookup if our parent
10561 implements a public function that is required by an interface.
10562 (TypeContainer.VerifyPendingMethods): Hook this up.
10564 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
10565 `modules' and `assemblies' arraylists into arrays. We only grow
10566 these are the very early start up of the program, so this improves
10567 the speedof LookupType (nicely measured).
10569 * expression.cs (MakeByteBlob): Replaced unsafe code with
10570 BitConverter, as suggested by Paolo.
10572 * cfold.cs (ConstantFold.Binary): Special case: perform constant
10573 folding of string concatenation, but if either side is a string,
10574 and the other is not, then return null, and let the runtime use
10575 the concatenation on the string plus the object (using
10576 `Object.ToString').
10578 2002-03-04 Miguel de Icaza <miguel@ximian.com>
10580 Constant Folding has been implemented now.
10582 * expression.cs (Unary.Reduce): Do not throw an exception, catch
10583 the error instead on types that are not supported in one's
10586 * constant.cs (Constant and all children): New set of functions to
10587 perform implict and explicit conversions.
10589 * ecore.cs (EnumConstant): Implement the new functions to perform
10590 conversion by proxying to the child expression.
10592 * codegen.cs: (ConstantCheckState): Constant evaluation has its
10593 own separate setting that can not be turned off from the command
10594 line using --unchecked or --checked and is only controlled using
10595 the checked/unchecked statements and expressions. This setting is
10596 used by the constant folder to flag errors.
10598 * expression.cs (CheckedExpr, UncheckedExpr): Set the
10599 ConstantCheckState as well.
10601 During Resolve, they also have to flag the state, because the
10602 constant folder runs completely in the Resolve phase.
10604 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
10607 2002-03-01 Miguel de Icaza <miguel@ximian.com>
10609 * cfold.cs: New file, this file contains the constant folder.
10611 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
10612 argument to track whether we are using the resulting address to
10613 load or store a value and provide better error messages.
10615 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
10616 new AddressOf arguments.
10618 * statement.cs (Foreach.EmitCollectionForeach): Update
10620 * expression.cs (Argument.Emit): Call AddressOf with proper
10621 arguments to track usage.
10623 (New.DoEmit): Call AddressOf with new arguments.
10625 (Unary.Emit): Adjust AddressOf call.
10627 2002-03-01 Ravi Pratap <ravi@ximian.com>
10629 * cs-parser.jay (member_access): Change the case for pre-defined types
10630 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
10633 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
10636 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
10637 essentially like methods and apply attributes like MethodImplOptions to them too.
10639 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
10642 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
10643 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
10646 * Update code everywhere accordingly.
10648 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
10650 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
10652 2002-02-28 Ravi Pratap <ravi@ximian.com>
10654 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
10655 try performing lookups against those instead of jumping straight into using
10656 the 'using' clauses.
10658 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
10660 (LookupType): Perform lookups in implicit parents too.
10662 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
10663 sequence as RootContext.LookupType.
10665 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
10666 the various cases of namespace lookups into this method.
10668 2002-03-01 Miguel de Icaza <miguel@ximian.com>
10670 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
10671 in positional arguments)
10673 * class.cs (Operator): Update the AllowedModifiers to contain
10676 * cs-parser.jay: Update operator declaration to allow for the
10677 operator body to be empty.
10679 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
10682 2002-02-27 Miguel de Icaza <miguel@ximian.com>
10684 * class.cs (Method.Emit): Label parameters.
10686 * driver.cs: Return 1 or 0 as the program exit code.
10688 2002-02-26 Miguel de Icaza <miguel@ximian.com>
10690 * expression.cs: Special case the `null' object when trying to
10691 auto-compute the type, as anything can be explicitly converted to
10694 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
10695 spotting this Paolo.
10697 (Expression.ImplicitNumericConversion): Perform comparissions of
10698 the type using the underlying type in the case of an enumeration
10699 rather than using the enumeration type for the compare.
10701 Cope with the underlying == type case, which is not possible to
10704 (Expression.ConvertNumericExplicit): Perform comparissions of
10705 the type using the underlying type in the case of an enumeration
10706 rather than using the enumeration type for the compare.
10708 * driver.cs: If the user does not supply an extension, assume .exe
10710 * cs-parser.jay (if_statement): Rewrote so that we can track the
10711 location for the if statement.
10713 * expression.cs (Binary.ConstantFold): Only concat strings when
10714 the operation is "+", not everything ;-)
10716 * statement.cs (Statement.EmitBoolExpression): Take a location
10718 (If, While, Do): Track location.
10720 * expression.cs (Binary.ResolveOperator): In the object + string
10721 case, I was missing a call to ConvertImplicit
10723 2002-02-25 Ravi Pratap <ravi@ximian.com>
10725 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
10726 Location arguments. Ensure we use RootContext.LookupType to do our work
10727 and not try to do a direct Type.GetType and ModuleBuilder.GetType
10729 * interface.cs (PopulateMethod): Handle the type of the parameter being
10732 * expression.cs (Invocation.BetterFunction): Handle the case when we
10733 have a params method with no fixed arguments and a call is made with no
10736 2002-02-25 Miguel de Icaza <miguel@ximian.com>
10738 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
10739 the verbatim-string-literal
10741 * support.cs (InternalParameters.ParameterModifier): handle null
10743 (InternalParameters.ParameterType): ditto.
10745 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
10746 duplicating the name of the variable parameter.
10747 (GetParameterByName): Fix bug where we were not looking up array
10748 paramters if they were the only present (thanks Paolo!).
10749 (GetParameterInfo): We only have an empty set of types if both
10750 fixed and array are set to null.
10751 (GetParameterInfo-idx): Handle FixedParameter == null
10753 * cs-parser.jay: Handle the case where there is no catch
10754 statements (missing null test).
10756 2002-02-22 Miguel de Icaza <miguel@ximian.com>
10758 * driver.cs (MainDriver): Be conservative on our command line
10761 Catch DirectoryNotFoundException when calling GetFiles.
10763 (SplitPathAndPattern): Used to split the input specification into
10764 a path and a pattern that we can feed to Directory.GetFiles.
10766 2002-02-21 Miguel de Icaza <miguel@ximian.com>
10768 * statement.cs (Fixed): Implement the last case of the Fixed
10769 statement (string handling).
10771 * expression.cs (StringPtr): New class used to return a char * to
10772 a string; Used by the Fixed statement.
10774 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
10776 * expression.cs (Binary.ResolveOperator): Remove redundant
10777 MemberLookup pn parent type.
10778 Optimize union call, we do not need a union if the types are the same.
10779 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
10782 Specialize the use of MemberLookup everywhere, instead of using
10783 the default settings.
10785 (StackAlloc): Implement stackalloc keyword.
10787 * cs-parser.jay: Add rule to parse stackalloc.
10789 * driver.cs: Handle /h, /help, /?
10791 * expression.cs (MakeByteBlob): Removed the hacks we had in place
10792 before we supported unsafe code.
10794 * makefile: add --unsafe to the self compilation of mcs.
10796 2002-02-20 Miguel de Icaza <miguel@ximian.com>
10798 * expression.cs (PointerArithmetic): New class that is used to
10799 perform pointer arithmetic.
10800 (Binary.Resolve): Handle pointer arithmetic
10801 Handle pointer comparission.
10802 (ArrayPtr): Utility expression class that is used to take the
10803 address of an array.
10805 (ElementAccess): Implement array access for pointers
10807 * statement.cs (Fixed): Implement fixed statement for arrays, we
10808 are missing one more case before we are done.
10810 * expression.cs (Indirection): Implement EmitAssign and set the
10811 ExprClass to Variable. This allows pointer dereferences to be
10812 treated as variables, and to have values assigned to them.
10814 * ecore.cs (Expression.StoreFromPtr): New utility function to
10815 store values dereferencing.
10817 2002-02-20 Ravi Pratap <ravi@ximian.com>
10819 * expression.cs (Binary.ResolveOperator): Ensure that we are
10820 not trying to operate on a void type - this fixes the reported
10823 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
10824 the parent implementation is sealed.
10826 * ../errors/cs0239.cs : Add.
10828 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
10830 * typemanager.cs (unverifiable_code_type): Corresponds to
10831 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
10832 which have unsafe code in them.
10834 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
10837 2002-02-19 Miguel de Icaza <miguel@ximian.com>
10839 * cs-tokenizer.cs: Add support for @"litreal strings"
10841 Make tokenizer accept pre-processor directives
10842 on any column (remove the old C-like limitation).
10844 * rootcontext.cs (EmitCode): Emit any global attributes.
10845 (AddGlobalAttributes): Used to keep track of assembly attributes.
10847 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
10849 * cs-parser.jay: Add support for global attributes.
10851 2002-02-17 Miguel de Icaza <miguel@ximian.com>
10853 * expression.cs (Indirection): New helper class. Unary will
10854 create Indirection classes to be able to implement the
10855 IMemoryLocation interface on it.
10857 2002-02-16 Miguel de Icaza <miguel@ximian.com>
10859 * cs-parser.jay (fixed_statement): reference the right statement.
10861 * statement.cs (Fixed.Emit): Finish implementing the fixed
10862 statement for the &x case.
10864 2002-02-14 Miguel de Icaza <miguel@ximian.com>
10866 * class.cs (Property.Define, Method.Define): Remove newslot when
10869 * modifiers.cs: My use of NewSlot when `Abstract' was set was
10870 wrong. NewSlot should only be used if the `new' keyword is present.
10872 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
10873 locating our system dir. Sorry about this.
10875 2002-02-13 Miguel de Icaza <miguel@ximian.com>
10877 * driver.cs (GetSystemDir): Compute correctly the location of our
10878 system assemblies. I was using the compiler directory instead of
10879 the library directory.
10881 2002-02-13 Ravi Pratap <ravi@ximian.com>
10883 * expression.cs (BetterFunction): Put back in what Miguel commented out
10884 since it is the correct fix. The problem is elsewhere ;-)
10886 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
10887 parameters of the parms method are themselves compatible or not !
10889 (StandardConversionExists): Fix very dangerous bug where we were forgetting
10890 to check that a class implements an interface before saying that an implicit
10891 conversion was allowed. Use ImplementsInterface to do the checking.
10893 2002-02-13 Miguel de Icaza <miguel@ximian.com>
10895 * class.cs (Method.Define): Track whether we are an explicit
10896 implementation or not. And only call DefineMethodOverride if we
10897 are an explicit implementation.
10899 (Property.DefineMethod): Ditto.
10901 2002-02-11 Ravi Pratap <ravi@ximian.com>
10903 * expression.cs (BetterFunction): Catch hideous bug which was
10904 preventing us from detecting ambiguous calls due to implicit casts i.e
10907 2002-01-29 Miguel de Icaza <miguel@ximian.com>
10909 * support.cs (Pair): Remove un-needed method. I figured why I was
10910 getting the error in cs-parser.jay, the variable in a foreach loop
10911 is readonly, and the compiler does not really treat this as a variable.
10913 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
10914 instead of EQUALS in grammar.
10916 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
10918 * expression.cs (Unary.DoResolve): Check whether the argument is
10921 2002-01-28 Miguel de Icaza <miguel@ximian.com>
10923 * support.cs: Api for Pair to set a value. Despite the fact that
10924 the variables are public the MS C# compiler refuses to compile
10925 code that accesses the field if the variable is part of a foreach
10928 * statement.cs (Fixed): Begin implementation of the fixed
10931 (Block.AddVariable): Return the VariableInfo on success and null
10932 on failure instead of true/false.
10934 * cs-parser.jay (foreach): Catch errors on variables already
10935 defined (we were ignoring this value before) and properly unwind
10936 the block hierarchy
10938 (fixed_statement): grammar for the fixed statement.
10940 2002-01-25 Miguel de Icaza <miguel@ximian.com>
10942 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
10943 pointer types to be incretemented.
10945 (SizeOf): Implement.
10947 * cs-parser.jay (pointer_member_access): Implement
10948 expr->IDENTIFIER production.
10950 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
10951 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
10954 (Unary): Implement indirection.
10956 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
10957 use in non-unsafe context).
10959 (SimpleName.DoResolve): Check for pointers in field access on safe
10962 (Expression.LoadFromPtr): Factor the load-indirect code in this
10963 function. This was duplicated in UnboxCast and ParameterReference
10965 2002-01-24 Miguel de Icaza <miguel@ximian.com>
10967 * expression.cs (ComposedCast): report an error if a pointer cast
10968 is used in a safe region.
10970 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
10971 pointer type casts in unsafe context.
10973 * codegen.cs (EmitContext): Set up IsUnsafe.
10975 * cs-parser.jay (non_expression_type): Add productions for pointer
10978 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
10979 code. We should not use force into static mode if the method is
10980 not virtual. Fixes bug in MIS
10982 * statement.cs (Do.Emit, While.Emit, For.Emit,
10983 Statement.EmitBoolExpression): Add support to Do and While to
10984 propagate infinite loop as `I do return' semantics.
10986 Improve the For case to also test for boolean constants.
10988 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
10989 to the list of attributes we can add.
10991 Remove `EmitContext' argument.
10993 * class.cs (Method.Define): Apply parameter attributes.
10994 (Constructor.Define): Apply parameter attributes.
10995 (MethodCore.LabelParameters): Move here the core of labeling
10998 * support.cs (ReflectionParameters.ParameterModifier,
10999 InternalParameters.ParameterModifier): Use IsByRef on the type and
11000 only return the OUT bit for these parameters instead of in/out/ref
11003 This is because I miss-understood things. The ParameterInfo.IsIn
11004 and IsOut represent whether the parameter has the [In] and [Out]
11007 2002-01-22 Miguel de Icaza <miguel@ximian.com>
11009 * ecore.cs (FieldExpr.Emit): Release temporaries.
11011 * assign.cs (LocalTemporary.Release): new function.
11013 * codegen.cs (EmitContext.GetTemporaryStorage,
11014 EmitContext.FreeTemporaryStorage): Rework the way we deal with
11015 temporary storage. Now we can "put back" localbuilders when we
11018 2002-01-21 Miguel de Icaza <miguel@ximian.com>
11020 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
11021 need to make a copy of the variable to generate verifiable code.
11023 2002-01-19 Miguel de Icaza <miguel@ximian.com>
11025 * driver.cs: Compute dynamically the system directory.
11027 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
11028 Slower, but more generally useful. Used by the abstract
11029 registering implementation.
11031 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
11032 the rules for the special rule on Type/instances. First check if
11033 we have the same name, and if so, try that special static path
11034 rather than the instance path.
11036 2002-01-18 Miguel de Icaza <miguel@ximian.com>
11038 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
11041 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
11042 Enum, ValueType, Delegate or Array for non-corlib compiles.
11044 * cs-tokenizer.cs: Catch long identifiers (645)
11046 * typemanager.cs (IndexerPropetyName): Ravi never tested this
11049 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
11050 fix, we were returning too early, so we were not registering
11051 pending methods from abstract classes.
11053 Do not register pending methods if the class is abstract.
11055 * expression.cs (Conditional.DoResolve): Report circular implicit
11056 conversions when we neecd to compute it for conditional
11059 (Is.DoResolve): If the expression is always of the provided type,
11060 flag warning 183. If the expression can not ever be of the
11061 provided type flag warning 184.
11063 * class.cs: Catch 169 as well.
11065 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
11068 2002-01-18 Nick Drochak <ndrochak@gol.com>
11070 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
11072 2002-01-17 Miguel de Icaza <miguel@ximian.com>
11074 * interface.cs: (PopulateMethod): Check for pointers being defined
11075 only if the unsafe context is active.
11076 (PopulateProperty): ditto.
11077 (PopulateIndexer): ditto.
11079 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
11080 specified. If pointers are present, make sure that they are
11081 present in an unsafe context.
11082 (Constructor, Constructor.Define): ditto.
11083 (Field, Field.Define): ditto.
11084 (Property, Property.Define): ditto.
11085 (Event, Event.Define): ditto.
11087 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
11088 hashtable if there are classes or structs defined.
11090 * expression.cs (LocalVariableReference.DoResolve): Simplify this
11091 code, as the constant resolution moved.
11093 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
11094 the metadata, so we can flag error 133.
11096 * decl.cs (MemberCore.UnsafeOK): New function to test that a
11097 pointer is being declared in an unsafe context.
11099 2002-01-16 Miguel de Icaza <miguel@ximian.com>
11101 * modifiers.cs (Modifiers.Check): Require a Location argument.
11102 Report error 227 for Unsafe use.
11104 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
11106 * statement.cs (For.Emit): If the test is null, then report that
11107 we do `return', as we wont reach anything afterwards.
11109 (Switch.SwitchGoverningType): Track the expression that matched
11112 * driver.cs: Allow negative numbers as an error code to flag.
11114 * cs-parser.jay: Handle 1551.
11116 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
11118 2002-01-15 Miguel de Icaza <miguel@ximian.com>
11120 * cs-parser.jay: Report 1518 (type declaration can only contain
11121 class, struct, interface, enum or delegate)
11123 (switch_label): Report 1523 (keywords `case' or `default' must
11126 (opt_switch_sections): Report 1522 (empty switch)
11128 * driver.cs: Report 1515 (response file specified multiple times)
11129 Report 1516 (Source file specified multiple times).
11131 * expression.cs (Argument.Resolve): Signal 1510
11133 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
11134 access not allowed in static code)
11136 2002-01-11 Ravi Pratap <ravi@ximian.com>
11138 * typemanager.cs (IsPointerType): Utility method which we are going
11141 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
11142 the object type, so we take care of that.
11144 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
11146 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
11147 added to non-params parameters :-)
11149 * typemanager.cs (CSharpName): Include 'void' type too.
11151 (void_ptr_type): Include in the set of core types.
11153 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
11156 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
11159 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
11160 completely forgotten about it.
11162 2002-01-10 Ravi Pratap <ravi@ximian.com>
11164 * cs-parser.jay (pointer_type): Add. This begins our implementation
11165 of parsing rules for unsafe code.
11167 (unsafe_statement): Implement.
11169 (embedded_statement): Modify to include the above.
11171 * statement.cs (Unsafe): Implement new class for unsafe blocks.
11173 * codegen.cs (EmitContext.InUnsafe): Add. This determines
11174 if the current context is an unsafe one.
11176 * cs-parser.jay (local_variable_pointer_type): Since local variable types
11177 are handled differently, we need separate rules for them.
11179 (local_variable_declaration): Update to use local_variable_pointer_type
11180 to allow variable declarations of unmanaged pointer types.
11182 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
11183 in unsafe contexts.
11185 * ../errors/cs0214.cs : Add.
11187 2002-01-16 Nick Drochak <ndrochak@gol.com>
11189 * makefile: remove 'response' file when cleaning.
11191 2002-01-15 Miguel de Icaza <miguel@ximian.com>
11193 * cs-parser.jay: Report 1524.
11195 2002-01-14 Miguel de Icaza <miguel@ximian.com>
11197 * typemanager.cs (RegisterMethod): drop checking if we have
11198 registered this from here
11200 2002-01-12 Miguel de Icaza <miguel@ximian.com>
11202 * class.cs (Method.EmitDestructor): Implement calling our base
11205 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
11206 value of InFinally.
11208 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
11209 this routine and will wrap the call in a try/catch block. Deal
11212 2002-01-11 Miguel de Icaza <miguel@ximian.com>
11214 * ecore.cs (Expression.MemberLookup): instead of taking a
11215 parameter `same_type' that was used to tell whether we could
11216 access private members we compute our containing type from the
11219 (FieldExpr): Added partial support for volatile fields. This does
11220 not work for volatile fields exposed from assemblies, as I can not
11221 figure out how to extract the modreq from it.
11223 Updated all the source files to use this.
11225 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
11226 because it is referenced by MemberLookup very often.
11228 2002-01-09 Ravi Pratap <ravi@ximian.com>
11230 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
11231 TypeBuilder.GetCustomAttributes to retrieve what we need.
11233 Get rid of redundant default_member_attr_type as this is the same as
11234 default_member_type which already exists.
11236 * interface.cs, attribute.cs : Update accordingly.
11238 2002-01-08 Miguel de Icaza <miguel@ximian.com>
11240 * typemanager.cs: Enable IndexerPropertyName again. It does not
11241 work for TYpeBuilders though. Ravi, can you please fix this?
11243 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
11245 * expression.cs (Argument.Emit): Handle the case of ref objects
11246 being passed to ref functions;
11248 (ParameterReference.EmitLoad): Loads the content of the pointer
11249 without dereferencing.
11251 2002-01-07 Miguel de Icaza <miguel@ximian.com>
11253 * cs-tokenizer.cs: Implemented the pre-processing expressions.
11255 2002-01-08 Ravi Pratap <ravi@ximian.com>
11257 * class.cs (Indexer.DefineMethod): Incorporate the interface
11258 type in the name of the method if we are doing explicit interface
11261 * expression.cs (ConversionExists): Remove as it is completely obsolete.
11263 (BetterConversion): Fix extremely trivial bug where we were referring to
11264 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
11267 * ../errors/bug16.cs : Add although we have fixed it.
11269 2002-01-07 Miguel de Icaza <miguel@ximian.com>
11271 * expression.cs (BaseIndexer): Begin implementation.
11273 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
11275 * cs-parser.jay (indexer_declarator): Use qualified_identifier
11276 production directly to remove a shift/reduce, and implement
11277 explicit interface implementation.
11279 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
11280 after a floating point suffix.
11282 * expression.cs (DoNumericPromotions): Improved the conversion for
11283 uint/uint. If we have a constant, we avoid doing a typecast to a
11286 * class.cs (Indexer): Implement explicit interface implementation
11289 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
11291 * class.cs: make the default instance constructor public and hidebysig.
11293 2001-01-03 Ravi Pratap <ravi@ximian.com>
11295 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
11296 so we can call it from elsewhere.
11298 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
11299 we emit it internally if the class has a defined indexer; otherwise the user
11300 emits it by decorating the class definition with the DefaultMemberAttribute.
11302 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
11303 attribute is not used on a type which defines an indexer.
11305 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
11306 character when we skip whitespace.
11308 * ../errors/cs0646.cs : Add.
11310 2002-01-03 Miguel de Icaza <miguel@ximian.com>
11312 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
11315 * makefile: Add practical target `mcs3.exe' which builds the third
11316 generation compiler.
11318 * expression.cs (New): Fix structures constructor calling.
11320 * class.cs (Property, Method, Indexer): Emit Final flag on the
11321 method if we are an interface implementation and we are not
11324 * ecore.cs (PropertyExpr): New public field `IsBase', tells
11325 whether this property is referencing a `base' method.
11327 * expression.cs (Invocation.EmitCall): take an extra argument:
11328 is_base, this is used to determine whether the `call' or
11329 `callvirt' opcode should be used.
11332 * delegate.cs: update EmitCall.
11334 * class.cs (Method.Define): Set NewSlot for the cases where we are
11335 not implementing an interface method.
11337 (Property.Define): ditto.
11339 2002-01-02 Miguel de Icaza <miguel@ximian.com>
11341 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
11342 'r'. Allows mcs to parse itself fully.
11344 2002-01-02 Ravi Pratap <ravi@ximian.com>
11346 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
11347 of the number of initializers that require the InitializeArray method.
11349 (CheckIndices): Store the Expression in all cases - not the plain value. Also
11350 update the above field where necessary.
11352 (MakeByteBlob): Update accordingly.
11354 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
11357 (EmitDynamicInitializers): Update in accordance with the new optimization.
11359 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
11360 same OpCode applies.
11362 * cs-parser.jay : Fix some glaring errors I introduced.
11364 2002-01-01 Ravi Pratap <ravi@ximian.com>
11366 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
11367 so that we can check for name clashes there too.
11369 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
11370 for interface indexers.
11372 * interfaces.cs (Define): Emit the default member attribute.
11374 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
11375 variable was being referred to while setting the value ;-)
11377 2002-01-01 Miguel de Icaza <miguel@ximian.com>
11379 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
11380 byte-by-byte information when we know the data is zero.
11382 Make the block always a multiple of 4, because
11383 DefineInitializedData has a bug.
11385 * assign.cs: Fix, we should assign from the temporary, not from
11388 * expression.cs (MakeByteBlob): Fix my incorrect code.
11390 2001-12-31 Miguel de Icaza <miguel@ximian.com>
11392 * typemanager.cs (EnumToUnderlying): This function is used to get
11393 the underlying type from an enumeration, because it does not
11396 * constant.cs: Use the I4_S form for values between -128 and 127.
11398 * statement.cs (Block.LookupLabel): Looks up a label.
11399 (Block): Drop support for labeled blocks.
11401 (LabeledStatement): New kind of statement that represents a label
11404 (Goto): Finally implement this bad boy.
11406 * cs-parser.jay: Update to reflect new mechanism to implement
11409 2001-12-30 Miguel de Icaza <miguel@ximian.com>
11411 * codegen.cs (EmitContext.This): a codegen property that keeps the
11412 a single instance of this instead of creating many different this
11415 * delegate.cs (Delegate.DoResolve): Update to use the property;
11417 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
11419 * expression.cs (BaseAccess.DoResolve): Ditto.
11421 2001-12-29 Ravi Pratap <ravi@ximian.com>
11423 * typemanager.cs (methodimpl_attr_type): Add to hold the type
11424 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
11426 (InitCoreTypes): Update accordingly.
11428 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
11429 so we can quickly store the state.
11431 (ApplyAttributes): Set the correct implementation flags
11432 for InternalCall methods.
11434 2001-12-29 Miguel de Icaza <miguel@ximian.com>
11436 * expression.cs (EmitCall): if a method is not virtual, then do
11437 not use callvirt on it.
11439 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
11440 user defined stuff) requires the use of stobj, which takes an
11441 address on the stack instead of an array and an index. So emit
11442 the Ldelema operation for it.
11444 (EmitStoreOpcode): Use stobj for valuetypes.
11446 (UnaryMutator.EmitCode): Use the right 1 value depending on
11447 whether we are dealing with int64/uint64, float or doubles.
11449 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
11450 constructors that I implemented last night.
11452 (Constructor.IsDefault): Fix to work properly for static
11455 * cs-parser.jay (CheckDef): report method signature errors.
11456 Update error number 103 to be 132.
11458 * decl.cs: New AdditionResult enumeration value: MethodExists.
11459 Although we do this check for methods later on in the semantic
11460 analysis, catching repeated default constructors is so easy that
11461 we catch these here.
11463 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
11466 (ParameterReference.EmitAssign, Emit): handle
11469 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
11470 (ArrayAccess.EmitStoreOpcode): ditto.
11472 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
11474 * expression.cs (MakeByteBlob): Complete all the missing types
11475 (uint, short, ushort, byte, sbyte)
11477 * class.cs: Only init instance field initializers on instance
11480 Rename `constructors' to instance_constructors.
11482 (TypeContainer.AddConstructor): Only add constructors to the list
11483 if it is not static.
11485 Make sure that we handle default_static_constructor independently
11486 everywhere where we handle instance_constructors
11488 2001-12-28 Miguel de Icaza <miguel@ximian.com>
11490 * class.cs: Do not lookup or create a base initializer for a
11491 static constructor.
11493 (ConstructorInitializer.Resolve): use the proper type to lookup
11496 * cs-parser.jay: Report error 1585 (modifiers between type and name).
11498 * enum.cs, interface.cs: Remove CloseType, this is taken care by
11501 * decl.cs: CloseType is now an virtual method, the default
11502 implementation just closes this type.
11504 2001-12-28 Ravi Pratap <ravi@ximian.com>
11506 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
11507 to PreserveSig by default. Also emit HideBySig on such methods.
11509 Basically, set the defaults to standard values.
11511 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
11512 argument, if candidate is better, it can't be worse than the best !
11514 (Invocation): Re-write bits to differentiate between methods being
11515 applicable in their expanded form and their normal form - for params
11518 Get rid of use_standard everywhere as only standard conversions are allowed
11519 in overload resolution.
11521 More spec conformance.
11523 2001-12-27 Miguel de Icaza <miguel@ximian.com>
11525 * driver.cs: Add --timestamp, to see where the compiler spends
11528 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
11529 `this' in static code.
11531 (SimpleName.DoResolve): Implement in terms of a helper function
11532 that allows static-references to be passed upstream to
11535 (Expression.ResolveWithSimpleName): Resolve specially simple
11536 names when called by MemberAccess to implement the special
11539 (Expression.ImplicitReferenceConversion): Handle conversions from
11540 Null to reference types before others, as Null's type is
11543 * expression.cs (Invocation.EmitCall): Handle the special case of
11544 calling methods declared on a reference type from a ValueType
11545 (Base classes System.Object and System.Enum)
11547 (MemberAccess.Resolve): Only perform lookups on Enumerations if
11548 the left hand side is a TypeExpr, not on every enumeration.
11550 (Binary.Resolve): If types are reference types, then do a cast to
11551 object on operators != and == of both arguments.
11553 * typemanager.cs (FindMembers): Extract instance and static
11554 members if requested.
11556 * interface.cs (PopulateProperty): Use void_type instead of null
11557 as the return type for the setter method.
11559 (PopulateIndexer): ditto.
11561 2001-12-27 Ravi Pratap <ravi@ximian.com>
11563 * support.cs (ReflectionParameters): Fix minor bug where we
11564 were examining the wrong parameter for the ParamArray attribute.
11566 Cope with requests for the type of the parameter at position
11567 greater than the params parameter's. We now return the element
11568 type of the params array as that makes more sense.
11570 * expression.cs (Invocation.IsParamsMethodApplicable): Update
11571 accordingly as we no longer have to extract the element type
11574 (Invocation.OverloadResolve): Update.
11576 2001-12-27 Miguel de Icaza <miguel@ximian.com>
11578 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
11579 against IEnumerator, test whether the return value is a descendant
11580 of the IEnumerator interface.
11582 * class.cs (Indexer.Define): Use an auxiliary method to implement
11583 the other bits of the method definition. Begin support for
11584 explicit interface implementation.
11586 (Property.DefineMethod): Use TypeManager.void_type instead of null
11587 for an empty return value.
11589 2001-12-26 Miguel de Icaza <miguel@ximian.com>
11591 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
11592 dealing with a FieldExpr which is composed of a FieldBuilder, in
11593 the code path we did extract the constant, but we should have
11594 obtained the underlying value to be able to cast it (otherwise we
11595 end up in an infinite loop, this is what Ravi was running into).
11597 (ArrayCreation.UpdateIndices): Arrays might be empty.
11599 (MemberAccess.ResolveMemberAccess): Add support for section
11600 14.5.4.1 that deals with the special case of E.I when E is a type
11601 and something else, that I can be a reference to a static member.
11603 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
11604 handle a particular array type to create byte blobs, it is just
11605 something we dont generate byteblobs for.
11607 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
11610 * location.cs (Push): remove the key from the hashtable that we
11611 are about to add. This happens for empty files.
11613 * driver.cs: Dispose files after we have parsed them.
11615 (tokenize): new function that only runs the tokenizer on its
11616 input, for speed testing.
11618 2001-12-26 Ravi Pratap <ravi@ximian.com>
11620 * class.cs (Event.Define): Define the private field only if there
11621 are no accessors defined.
11623 * expression.cs (ResolveMemberAccess): If there is no associated
11624 field with the event, that means we have an event defined with its
11625 own accessors and we should flag error cs0070 since transforming
11626 ourselves into a field is not valid in that case.
11628 * ecore.cs (SimpleName.DoResolve): Same as above.
11630 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
11631 and charset to sane values.
11633 2001-12-25 Ravi Pratap <ravi@ximian.com>
11635 * assign.cs (DoResolve): Perform check on events only if they
11636 are being accessed outside the declaring type.
11638 * cs-parser.jay (event_declarations): Update rules to correctly
11639 set the type of the implicit parameter etc.
11641 (add_accessor, remove_accessor): Set current local parameters.
11643 * expression.cs (Binary): For delegate addition and subtraction,
11644 cast the return value from the method into the appropriate delegate
11647 2001-12-24 Ravi Pratap <ravi@ximian.com>
11649 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
11650 of these as the workaround is unnecessary.
11652 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
11653 delegate data - none of that is needed at all.
11655 Re-write bits to extract the instance expression and the delegate method
11658 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
11661 * attribute.cs (ApplyAttributes): New method to take care of common tasks
11662 of attaching attributes instead of duplicating code everywhere.
11664 * everywhere : Update code to do attribute emission using the above method.
11666 2001-12-23 Miguel de Icaza <miguel@ximian.com>
11668 * expression.cs (IsParamsMethodApplicable): if there are not
11669 parameters, return immediately.
11671 * ecore.cs: The 0 literal can be implicity converted to an enum
11674 (SimpleName.DoResolve): First lookup the type, then lookup the
11677 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
11678 want to get its address. If the InstanceExpression is not
11679 addressable, store the result in a temporary variable, then get
11682 * codegen.cs: Only display 219 errors on warning level or above.
11684 * expression.cs (ArrayAccess): Make it implement the
11685 IMemoryLocation interface.
11687 (Binary.DoResolve): handle the operator == (object a, object b)
11688 and operator != (object a, object b) without incurring into a
11689 BoxedCast (because 5 != o should never be performed).
11691 Handle binary enumerator operators.
11693 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
11694 value type, otherwise use Ldelem_ref.
11696 Use precomputed names;
11698 (AddressOf): Implement address of
11700 * cs-parser.jay (labeled_statement): Fix recursive block
11701 addition by reworking the production.
11703 * expression.cs (New.DoEmit): New has a special case:
11705 If we are dealing with a ValueType, we have a few
11706 situations to deal with:
11708 * The target of New is a ValueType variable, that is
11709 easy, we just pass this as the variable reference
11711 * The target of New is being passed as an argument,
11712 to a boxing operation or a function that takes a
11715 In this case, we need to create a temporary variable
11716 that is the argument of New.
11719 2001-12-23 Ravi Pratap <ravi@ximian.com>
11721 * rootcontext.cs (LookupType): Check that current_type is not null before
11722 going about looking at nested types.
11724 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
11725 not implement the IAssignMethod interface any more.
11727 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
11728 where we tranform them into FieldExprs if they are being resolved from within
11729 the declaring type.
11731 * ecore.cs (SimpleName.DoResolve): Do the same here.
11733 * assign.cs (DoResolve, Emit): Clean up code considerably.
11735 * ../errors/bug10.cs : Add.
11737 * ../errors/cs0070.cs : Add.
11739 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
11741 * assign.cs : Get rid of EventIsLocal everywhere.
11743 2001-12-23 Miguel de Icaza <miguel@ximian.com>
11745 * ecore.cs (ConvertIntLiteral): finished the implementation.
11747 * statement.cs (SwitchLabel): Convert the value we are using as a
11748 key before looking up the table.
11750 2001-12-22 Miguel de Icaza <miguel@ximian.com>
11752 * codegen.cs (EmitTopBlock): Require a Location argument now.
11754 * cs-parser.jay (constructor_declarator): We need to setup
11755 current_local_parameters before we parse the
11756 opt_constructor_initializer, to allow the variables to be bound
11757 to the constructor arguments.
11759 * rootcontext.cs (LookupType): First lookup nested classes in our
11760 class and our parents before we go looking outside our class.
11762 * expression.cs (ConstantFold): Extract/debox the values at the
11765 * rootcontext.cs (EmitCode): Resolve the constants first before we
11766 resolve the types. This is not really needed, but it helps debugging.
11768 * statement.cs: report location.
11770 * cs-parser.jay: pass location to throw statement.
11772 * driver.cs: Small bug fix.
11774 * report.cs: Updated format to be 4-zero filled digits.
11776 2001-12-22 Ravi Pratap <ravi@ximian.com>
11778 * expression.cs (CheckIndices): Fix minor bug where the wrong
11779 variable was being referred to ;-)
11781 (DoEmit): Do not call EmitStaticInitializers when the
11782 underlying type is System.Object.
11784 2001-12-21 Ravi Pratap <ravi@ximian.com>
11786 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
11787 and do the usual workaround for SRE.
11789 * class.cs (MyEventBuilder.EventType): New member to get at the type
11790 of the event, quickly.
11792 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
11794 * assign.cs (Assign.DoResolve): Handle the case when the target
11795 is an EventExpr and perform the necessary checks.
11797 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
11800 (SimpleName.MemberStaticCheck): Include check for EventExpr.
11802 (EventExpr): Set the type in the constructor itself since we
11803 are meant to be born fully resolved.
11805 (EventExpr.Define): Revert code I wrote earlier.
11807 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
11808 instance expression is null. The instance expression is a This in that case
11809 or a null, depending on whether it is a static method or not.
11811 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
11812 refers to more than one method.
11814 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
11815 and accordingly flag errors.
11817 2001-12-21 Miguel de Icaza <miguel@ximian.com>
11819 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
11821 2001-12-22 Miguel de Icaza <miguel@ximian.com>
11823 * location.cs (ToString): Provide useful rutine.
11825 2001-12-21 Miguel de Icaza <miguel@ximian.com>
11827 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
11828 objects, return the actual integral boxed.
11830 * statement.cs (SwitchLabel): define an ILLabel for each
11833 (Switch.CheckSwitch): If the value is a Literal, extract
11834 the underlying literal.
11836 Also in the unused hashtable we had, add the SwitchLabel so we can
11837 quickly look this value up.
11839 * constant.cs: Implement a bunch of new constants. Rewrite
11840 Literal based on this. Made changes everywhere to adapt to this.
11842 * expression.cs (Expression.MakeByteBlob): Optimize routine by
11843 dereferencing array only once, and also copes with enumrations.
11845 bytes are two bytes wide, not one.
11847 (Cast): Perform constant conversions.
11849 * ecore.cs (TryImplicitIntConversion): Return literals instead of
11850 wrappers to the literals here.
11852 * expression.cs (DoNumericPromotions): long literals can converted
11853 to ulong implicity (this is taken care of elsewhere, but I was
11854 missing this spot).
11856 * ecore.cs (Expression.Literalize): Make the return type Literal,
11857 to improve type checking.
11859 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
11861 2001-12-20 Miguel de Icaza <miguel@ximian.com>
11863 * literal.cs: Revert code from ravi that checked the bounds. The
11864 bounds are sane by the definition of the type itself.
11866 * typemanager.cs: Fix implementation of ImplementsInterface. We
11867 need to actually look up in our parent hierarchy for interfaces
11870 * const.cs: Use the underlying type for enumerations
11872 * delegate.cs: Compute the basename for the delegate creation,
11873 that should fix the delegate test case, and restore the correct
11874 Type Lookup semantics in rootcontext
11876 * rootcontext.cs: Revert Ravi's last patch. The correct way of
11877 referencing a nested type with the Reflection API is using the "+"
11880 * cs-parser.jay: Do not require EOF token at the end.
11882 2001-12-20 Ravi Pratap <ravi@ximian.com>
11884 * rootcontext.cs (LookupType): Concatenate type names with
11885 a '.' instead of a '+' The test suite passes again.
11887 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
11888 field of the enumeration.
11890 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
11891 the case when the member is an EventExpr.
11893 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
11894 static has an associated instance expression.
11896 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
11898 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
11900 * class.cs (Event.Define): Register event and perform appropriate checks
11903 We define the Add and Remove methods even if the use provides none because
11904 in that case, we provide default implementations ourselves.
11906 Define a private field of the type of the event. This is done by the CSC compiler
11907 and we should be doing it too ;-)
11909 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
11910 More methods we use in code we generate.
11912 (multicast_delegate_type, delegate_type): Two separate types since the distinction
11915 (InitCoreTypes): Update accordingly for the above.
11917 * class.cs (Event.Emit): Generate code for default accessors that we provide
11919 (EmitDefaultMethod): Do the job in the above.
11921 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
11924 2001-12-20 Miguel de Icaza <miguel@ximian.com>
11926 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
11927 builders even if we were missing one.
11929 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
11930 pass the Basename as our class name instead of the Name. The
11931 basename will be correctly composed for us.
11933 * parameter.cs (Paramters): Now takes a Location argument.
11935 * decl.cs (DeclSpace.LookupType): Removed convenience function and
11936 make all the code call directly LookupType in RootContext and take
11937 this chance to pass the Location information everywhere.
11939 * Everywhere: pass Location information.
11941 2001-12-19 Miguel de Icaza <miguel@ximian.com>
11943 * class.cs (Constructor.Define): Updated way of detecting the
11944 length of the parameters.
11946 (TypeContainer.DefineType): Use basename as the type name for
11949 (TypeContainer.Define): Do not recursively define types here, as
11950 definition is taken care in order by the RootContext.
11952 * tree.cs: Keep track of namespaces in a per-file basis.
11954 * parameter.cs (Parameter.ComputeSignature): Update to use
11957 (Parameters.GetSignature): ditto.
11959 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
11960 instead of a TypeContainer.
11962 (Interface.SemanticAnalysis): Use `this' instead of our parent to
11963 resolve names. Because we need to be resolve in our context, not
11966 * driver.cs: Implement response files.
11968 * class.cs (TypeContainer.DefineType): If we are defined, do not
11969 redefine ourselves.
11971 (Event.Emit): Emit the code for add/remove handlers.
11972 (Event.Define): Save the MethodBuilders for add/remove.
11974 * typemanager.cs: Use pair here too.
11976 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
11977 DictionaryEntry requires the first argument to be non-null.
11979 (enum_declaration): Compute full name for registering the
11982 (delegate_declaration): Instead of using
11983 formal_parameter_list, use opt_formal_parameter_list as the list
11986 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
11987 (EventParsing): New property that controls whether `add' and
11988 `remove' are returned as tokens or identifiers (for events);
11990 2001-12-19 Ravi Pratap <ravi@ximian.com>
11992 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
11993 use MyEventBuilder only and let it wrap the real builder for us.
11995 (MyEventBuilder): Revamp constructor etc.
11997 Implement all operations that we perform on EventBuilder in precisely the same
12000 (FindMembers): Update to use the EventBuilder member.
12002 (Event.Emit): Update accordingly.
12004 2001-12-18 Ravi Pratap <ravi@ximian.com>
12006 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
12007 by calling the appropriate methods.
12009 (GetCustomAttributes): Make stubs as they cannot possibly do anything
12012 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
12014 2001-12-17 Ravi Pratap <ravi@ximian.com>
12016 * delegate.cs (Delegate.Populate): Check that the return type
12017 and various parameters types are indeed accessible.
12019 * class.cs (Constructor.Define): Same here.
12021 (Field.Define): Ditto.
12023 (Event.Define): Ditto.
12025 (Operator.Define): Check that the underlying Method defined itself
12026 correctly - so it's MethodBuilder should not be null.
12028 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
12029 expression happens to be null.
12031 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
12032 members but as of now we don't seem to be able to do anything really useful with it.
12034 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
12035 not the EventBuilder.
12037 2001-12-18 Miguel de Icaza <miguel@ximian.com>
12039 * cs-tokenizer.cs: Add support for defines.
12040 Add support for #if, #elif, #else, #endif
12042 (eval_var): evaluates a variable.
12043 (eval): stubbed for evaluating functions.
12045 * cs-parser.jay: Pass the defines information
12047 * driver.cs: Add --define command line option.
12049 * decl.cs: Move MemberCore here.
12051 Make it the base class for DeclSpace. This allows us to catch and
12052 report 108 and 109 for everything now.
12054 * class.cs (TypeContainer.Define): Extract all the members
12055 before populating and emit the warning 108 (new keyword required
12056 to override) instead of having each member implement this.
12058 (MemberCore.Define): New abstract method, we will be using this in
12059 the warning reporting engine in Populate.
12061 (Operator.Define): Adjust to new MemberCore protocol.
12063 * const.cs (Const): This does not derive from Expression, it is a
12064 temporary object we use to create fields, it is a MemberCore.
12066 * class.cs (Method.Define): Allow the entry point to be in a
12069 * driver.cs: Rewrite the argument handler to clean it up a bit.
12071 * rootcontext.cs: Made it just an auxiliary namespace feature by
12072 making everything static.
12074 * driver.cs: Adapt code to use RootContext type name instead of
12077 * delegate.cs: Remove RootContext argument.
12079 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
12082 * class.cs (Event.Define): The lookup can fail.
12084 * cs-tokenizer.cs: Begin implementation of pre-procesor.
12086 * expression.cs: Resolve the this instance before invoking the code.
12088 2001-12-17 Miguel de Icaza <miguel@ximian.com>
12090 * cs-parser.jay: Add a production in element_access that allows
12091 the thing to become a "type" reference. This way we can parse
12092 things like "(string [])" as a type.
12094 Note that this still does not handle the more complex rules of
12098 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
12100 * ecore.cs: (CopyNewMethods): new utility function used to
12101 assemble the list of methods from running FindMembers.
12103 (MemberLookup): Rework FindMembers so that
12105 2001-12-16 Miguel de Icaza <miguel@ximian.com>
12107 * class.cs (TypeContainer): Remove Delegates who fail to be
12110 * delegate.cs (Populate): Verify that we dont get null return
12111 values. TODO: Check for AsAccessible.
12113 * cs-parser.jay: Use basename to emit error 574 (destructor should
12114 have the same name as container class), not the full name.
12116 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
12117 possible representation.
12119 Also implements integer type suffixes U and L.
12121 2001-12-15 Miguel de Icaza <miguel@ximian.com>
12123 * expression.cs (ArrayCreation.DoResolve): We need to do the
12124 argument resolution *always*.
12126 * decl.cs: Make this hold the namespace. Hold the root context as
12128 (LookupType): Move here.
12130 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
12132 * location.cs (Row, Name): Fixed the code, it was always returning
12133 references to the first file.
12135 * interface.cs: Register properties defined through interfaces.
12137 * driver.cs: Add support for globbing on the command line
12139 * class.cs (Field): Make it derive from MemberCore as well.
12142 2001-12-15 Ravi Pratap <ravi@ximian.com>
12144 * class.cs (Event::Define): Check that the type of the event is a delegate
12145 type else flag error #66.
12147 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
12150 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
12151 values of EntryPoint, CharSet etc etc.
12153 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
12155 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
12156 be null and we should ignore this. I am not sure if this is really clean. Apparently,
12157 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
12158 which needs this to do its work.
12160 * ../errors/cs0066.cs : Add.
12162 2001-12-14 Miguel de Icaza <miguel@ximian.com>
12164 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
12167 * class.cs: (MethodSignature.MethodSignature): Removed hack that
12168 clears out the parameters field.
12169 (MemberSignatureCompare): Cleanup
12171 (MemberCore): New base class used to share code between MethodCore
12174 (RegisterRequiredImplementations) BindingFlags.Public requires
12175 either BindingFlags.Instace or Static. Use instance here.
12177 (Property): Refactored code to cope better with the full spec.
12179 * parameter.cs (GetParameterInfo): Return an empty array instead
12182 * class.cs (Property): Abstract or extern properties have no bodies.
12184 * parameter.cs (GetParameterInfo): return a zero-sized array.
12186 * class.cs (TypeContainer.MethodModifiersValid): Move all the
12187 method modifier validation to the typecontainer so we can reuse
12188 this on properties.
12190 (MethodCore.ParameterTypes): return an empty sized array of types.
12192 (Property.Define): Test property modifier validity.
12194 Add tests for sealed/override too.
12196 (Method.Emit): abstract or extern methods have no bodies.
12198 2001-12-14 Ravi Pratap <ravi@ximian.com>
12200 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
12203 (Method::Define, ::Emit): Modify accordingly.
12205 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
12207 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
12209 * makefile: Pass in /unsafe.
12211 2001-12-13 Miguel de Icaza <miguel@ximian.com>
12213 * class.cs (MakeKey): Kill routine.
12215 * class.cs (TypeContainer.Define): Correctly define explicit
12216 method implementations (they require the full interface name plus
12219 * typemanager.cs: Deply the PtrHashtable here and stop using the
12220 lame keys. Things work so much better.
12222 This of course broke everyone who depended on `RegisterMethod' to
12223 do the `test for existance' test. This has to be done elsewhere.
12225 * support.cs (PtrHashtable): A hashtable that avoid comparing with
12226 the object stupid Equals method (because, that like fails all over
12227 the place). We still do not use it.
12229 * class.cs (TypeContainer.SetRequiredInterface,
12230 TypeContainer.RequireMethods): Killed these two routines and moved
12231 all the functionality to RegisterRequiredImplementations.
12233 (TypeContainer.RegisterRequiredImplementations): This routine now
12234 registers all the implementations required in an array for the
12235 interfaces and abstract methods. We use an array of structures
12236 which can be computed ahead of time to reduce memory usage and we
12237 also assume that lookups are cheap as most classes will not
12238 implement too many interfaces.
12240 We also avoid creating too many MethodSignatures.
12242 (TypeContainer.IsInterfaceMethod): Update and optionally does not
12243 clear the "pending" bit if we find that there are problems with
12246 (TypeContainer.VerifyPendingMethods): Update to report errors of
12247 methods that look like implementations but are not.
12249 (TypeContainer.Define): Add support for explicit interface method
12252 2001-12-12 Miguel de Icaza <miguel@ximian.com>
12254 * typemanager.cs: Keep track of the parameters here instead of
12255 being a feature of the TypeContainer.
12257 * class.cs: Drop the registration of parameters here, as
12258 InterfaceMethods are also interface declarations.
12260 * delegate.cs: Register methods with the TypeManager not only with
12261 the TypeContainer. This code was buggy.
12263 * interface.cs: Full registation here.
12265 2001-12-11 Miguel de Icaza <miguel@ximian.com>
12267 * expression.cs: Remove reducer for binary expressions, it can not
12270 * const.cs: Put here the code that used to go into constant.cs
12272 * constant.cs: Put here the code for constants, this is a new base
12273 class for Literals.
12275 * literal.cs: Make Literal derive from Constant.
12277 2001-12-09 Miguel de Icaza <miguel@ximian.com>
12279 * statement.cs (Return.Emit): Report error 157 if the user
12280 attempts to return from a finally block.
12282 (Return.Emit): Instead of emitting a return, jump to the end of
12285 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
12286 LocalBuilder to store the result of the function. ReturnLabel is
12287 the target where we jump.
12290 2001-12-09 Radek Doulik <rodo@ximian.com>
12292 * cs-parser.jay: remember alias in current namespace
12294 * ecore.cs (SimpleName::DoResolve): use aliases for types or
12297 * class.cs (LookupAlias): lookup alias in my_namespace
12299 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
12301 (LookupAlias): lookup alias in this and if needed in parent
12304 2001-12-08 Miguel de Icaza <miguel@ximian.com>
12308 * rootcontext.cs: (ModuleBuilder) Made static, first step into
12309 making things static. I need this to avoid passing the
12310 TypeContainer when calling ParameterType.
12312 * support.cs (InternalParameters.ParameterType): Remove ugly hack
12313 that did string manipulation to compute the type and then call
12314 GetType. Use Parameter.ParameterType instead.
12316 * cs-tokenizer.cs: Consume the suffix for floating values.
12318 * expression.cs (ParameterReference): figure out whether this is a
12319 reference parameter or not. Kill an extra variable by computing
12320 the arg_idx during emission.
12322 * parameter.cs (Parameters.GetParameterInfo): New overloaded
12323 function that returns whether a parameter is an out/ref value or not.
12325 (Parameter.ParameterType): The type of the parameter (base,
12326 without ref/out applied).
12328 (Parameter.Resolve): Perform resolution here.
12329 (Parameter.ExternalType): The full type (with ref/out applied).
12331 * statement.cs (Using.Emit, Using.EmitExpression): Implement
12332 support for expressions on the using statement.
12334 2001-12-07 Miguel de Icaza <miguel@ximian.com>
12336 * statement.cs (Using.EmitLocalVariableDecls): Split the
12337 localvariable handling of the using statement.
12339 (Block.EmitMeta): Keep track of variable count across blocks. We
12340 were reusing slots on separate branches of blocks.
12342 (Try.Emit): Emit the general code block, we were not emitting it.
12344 Check the type of the declaration to be an IDisposable or
12345 something that can be implicity converted to it.
12347 Emit conversions if required.
12349 * ecore.cs (EmptyExpression): New utility class.
12350 (Expression.ImplicitConversionExists): New utility function.
12352 2001-12-06 Miguel de Icaza <miguel@ximian.com>
12354 * statement.cs (Using): Implement.
12356 * expression.cs (LocalVariableReference): Support read only variables.
12358 * statement.cs: Remove the explicit emit for the Leave opcode.
12359 (VariableInfo): Add a readonly field.
12361 2001-12-05 Miguel de Icaza <miguel@ximian.com>
12363 * ecore.cs (ConvCast): new class used to encapsulate the various
12364 explicit integer conversions that works in both checked and
12365 unchecked contexts.
12367 (Expression.ConvertNumericExplicit): Use new ConvCast class to
12368 properly generate the overflow opcodes.
12370 2001-12-04 Miguel de Icaza <miguel@ximian.com>
12372 * statement.cs: The correct type for the EmptyExpression is the
12373 element_type, not the variable type. Ravi pointed this out.
12375 2001-12-04 Ravi Pratap <ravi@ximian.com>
12377 * class.cs (Method::Define): Handle PInvoke methods specially
12378 by using DefinePInvokeMethod instead of the usual one.
12380 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
12381 above to do the task of extracting information and defining the method.
12383 2001-12-04 Ravi Pratap <ravi@ximian.com>
12385 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
12386 of the condition for string type.
12388 (Emit): Move that here.
12390 (ArrayCreation::CheckIndices): Keep string literals in their expression
12393 (EmitDynamicInitializers): Handle strings appropriately.
12395 2001-12-04 Miguel de Icaza <miguel@ximian.com>
12397 * codegen.cs (EmitContext): Replace multiple variables with a
12398 single pointer to the current Switch statement.
12400 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
12403 2001-12-03 Miguel de Icaza <miguel@ximian.com>
12407 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
12410 (Foreach.Emit): Foreach on arrays was not setting
12411 up the loop variables (for break/continue).
12413 (GotoCase): Semi-implented.
12415 2001-12-03 Ravi Pratap <ravi@ximian.com>
12417 * attribute.cs (CheckAttribute): Handle system attributes by using
12418 Attribute.GetAttributes to examine information we need.
12420 (GetValidPlaces): Same here.
12422 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
12424 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
12426 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
12428 (Method::Define): Set appropriate flags if we have a DllImport attribute.
12430 (Method::Emit): Handle the case when we are a PInvoke method.
12432 2001-12-03 Miguel de Icaza <miguel@ximian.com>
12434 * expression.cs: Use ResolveWithSimpleName on compound names.
12436 2001-12-02 Ravi Pratap <ravi@ximian.com>
12438 * constant.cs (EmitConstant): Make sure we resolve the associated expression
12439 before trying to reduce it.
12441 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
12443 * constant.cs (LookupConstantValue): Implement.
12445 (EmitConstant): Use the above in emitting the constant.
12447 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
12448 that are user-defined by doing a LookupConstantValue on them.
12450 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
12453 2001-11-29 Miguel de Icaza <miguel@ximian.com>
12455 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
12457 (BaseAccess.DoResolve): Implement.
12459 (MemberAccess.DoResolve): Split this routine into a
12460 ResolveMemberAccess routine that can be used independently
12462 2001-11-28 Miguel de Icaza <miguel@ximian.com>
12464 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
12465 As that share bits of the implementation. Is returns a boolean,
12466 while As returns the Type that is being probed.
12468 2001-12-01 Ravi Pratap <ravi@ximian.com>
12470 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
12471 instead of a Literal - much easier.
12473 (EnumInTransit): Remove - utterly useless :-)
12475 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
12477 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
12479 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
12480 chain when we have no associated expression.
12482 2001-11-30 Ravi Pratap <ravi@ximian.com>
12484 * constant.cs (Define): Use Location while reporting the errror.
12486 Also emit a warning when 'new' is used and there is no inherited
12489 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
12492 (LookupEnumValue): Implement to lookup an enum member's value and define it
12495 (Populate): Re-write accordingly to use the above routine.
12497 2001-11-27 Miguel de Icaza <miguel@ximian.com>
12499 * expression.cs (This): Fix prototype for DoResolveLValue to
12500 override the base class DoResolveLValue.
12502 * cs-parser.cs: Report errors cs574 and cs575 (destructor
12505 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
12506 (we need to load the address of the field here). This fixes
12509 (FieldExpr.DoResolveLValue): Call the DoResolve
12510 function to initialize the Instance expression.
12512 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
12513 correctly the GetEnumerator operation on a value type.
12515 * cs-parser.jay: Add more simple parsing error catches.
12517 * statement.cs (Switch): Add support for string switches.
12518 Handle null specially.
12520 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
12522 2001-11-28 Ravi Pratap <ravi@ximian.com>
12524 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
12526 (declare_local_constant): New helper function.
12528 * statement.cs (AddConstant): Keep a separate record of constants
12530 (IsConstant): Implement to determine if a variable is a constant.
12532 (GetConstantExpression): Implement.
12534 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
12536 * statement.cs (IsVariableDefined): Re-write.
12538 2001-11-27 Ravi Pratap <ravi@ximian.com>
12540 * class.cs (TypeContainer::FindMembers): Look for constants
12541 in the case when we are looking for MemberTypes.Field
12543 * expression.cs (MemberAccess::DoResolve): Check that in the
12544 case we are a FieldExpr and a Literal, we are not being accessed
12545 by an instance reference.
12547 * cs-parser.jay (local_constant_declaration): Implement.
12549 (declaration_statement): Implement for constant declarations.
12551 2001-11-26 Miguel de Icaza <miguel@ximian.com>
12553 * statement.cs (Switch): Catch double defaults.
12555 (Switch): More work on the switch() statement
12556 implementation. It works for integral values now, need to finish
12560 2001-11-24 Miguel de Icaza <miguel@ximian.com>
12562 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
12563 integer literals into other integer literals. To be used by
12566 2001-11-24 Ravi Pratap <ravi@ximian.com>
12568 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
12571 (EmitDynamicInitializers): Cope with the above since we extract data
12572 directly from ArrayData now.
12574 (ExpectInitializers): Keep track of whether initializers are mandatory
12577 (Bounds): Make it a hashtable to prevent the same dimension being
12578 recorded for every element in that dimension.
12580 (EmitDynamicInitializers): Fix bug which prevented the Set array method
12583 Also fix bug which was causing the indices to be emitted in the reverse
12586 2001-11-24 Miguel de Icaza <miguel@ximian.com>
12588 * expression.cs (ArrayCreation): Implement the bits that Ravi left
12589 unfinished. They do not work, because the underlying code is
12592 2001-11-22 Miguel de Icaza <miguel@ximian.com>
12594 * cs-parser.jay: Remove bogus fixme.
12596 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
12597 on Switch statement.
12599 2001-11-23 Ravi Pratap <ravi@ximian.com>
12601 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
12604 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
12605 parameter. Apparently, any expression is allowed.
12607 (ValidateInitializers): Update accordingly.
12609 (CheckIndices): Fix some tricky bugs thanks to recursion.
12611 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
12612 I was being completely brain-dead.
12614 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
12615 and re-write acordingly.
12617 (DelegateInvocation): Re-write accordingly.
12619 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
12621 (MakeByteBlob): Handle types more correctly.
12623 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
12624 initialization from expressions but it is incomplete because I am a complete
12627 2001-11-22 Miguel de Icaza <miguel@ximian.com>
12629 * statement.cs (If.Emit): Fix a bug that generated incorrect code
12630 on If. Basically, we have to return `true' (ie, we do return to
12631 our caller) only if both branches of the if return.
12633 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
12634 short-circuit operators, handle them as short circuit operators.
12636 (Cast.DoResolve): Resolve type.
12637 (Cast.Cast): Take an expression as the target type.
12639 * cs-parser.jay (cast_expression): Remove old hack that only
12640 allowed a limited set of types to be handled. Now we take a
12641 unary_expression and we resolve to a type during semantic
12644 Use the grammar productions from Rhys to handle casts (this is
12645 not complete like Rhys syntax yet, we fail to handle that corner
12646 case that C# has regarding (-x), but we will get there.
12648 2001-11-22 Ravi Pratap <ravi@ximian.com>
12650 * class.cs (EmitFieldInitializer): Take care of the case when we have a
12651 field which is an array type.
12653 * cs-parser.jay (declare_local_variables): Support array initialization too.
12655 * typemanager.cs (MakeKey): Implement.
12657 (everywhere): Use the above appropriately.
12659 * cs-parser.jay (for_statement): Update for array initialization while
12660 declaring variables.
12662 * ecore.cs : The error message was correct, it's the variable's names that
12663 were misleading ;-) Make the code more readable.
12665 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
12666 the correct type etc.
12668 (ConvertExplicit): Handle Enum types by examining the underlying type.
12670 2001-11-21 Ravi Pratap <ravi@ximian.com>
12672 * parameter.cs (GetCallingConvention): Always return
12673 CallingConventions.Standard for now.
12675 2001-11-22 Miguel de Icaza <miguel@ximian.com>
12677 * expression.cs (Binary.ResolveOperator): Update the values of `l'
12678 and `r' after calling DoNumericPromotions.
12680 * ecore.cs: Fix error message (the types were in the wrong order).
12682 * statement.cs (Foreach.ProbeCollectionType): Need to pass
12683 BindingFlags.Instance as well
12685 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
12686 implicit int literal conversion in an empty cast so that we
12687 propagate the right type upstream.
12689 (UnboxCast): new class used to unbox value types.
12690 (Expression.ConvertExplicit): Add explicit type conversions done
12693 (Expression.ImplicitNumericConversion): Oops, forgot to test for
12694 the target type before applying the implicit LongLiterals to ULong
12697 2001-11-21 Miguel de Icaza <miguel@ximian.com>
12699 * cs-parser.jay (for_statement): Reworked the way For works: now
12700 we declare manually any variables that are introduced in
12701 for_initializer to solve the problem of having out-of-band code
12702 emition (that is what got for broken).
12704 (declaration_statement): Perform the actual variable declaration
12705 that used to be done in local_variable_declaration here.
12707 (local_variable_declaration): Do not declare anything, just pass
12708 the information on a DictionaryEntry
12710 2001-11-20 Ravi Pratap <ravi@ximian.com>
12712 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
12713 re-write of the logic to now make it recursive.
12715 (UpdateIndices): Re-write accordingly.
12717 Store element data in a separate ArrayData list in the above methods.
12719 (MakeByteBlob): Implement to dump the array data into a byte array.
12721 2001-11-19 Ravi Pratap <ravi@ximian.com>
12723 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
12726 * constant.cs (Define): Implement.
12728 (EmitConstant): Re-write fully.
12730 Pass in location info.
12732 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
12735 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
12736 DictionaryEntry since we need location info too.
12738 (constant_declaration): Update accordingly.
12740 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
12741 code into another method : UpdateIndices.
12743 2001-11-18 Ravi Pratap <ravi@ximian.com>
12745 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
12746 some type checking etc.
12748 2001-11-17 Ravi Pratap <ravi@ximian.com>
12750 * expression.cs (ArrayCreation::ValidateInitializers): Implement
12751 bits to provide dimension info if the user skips doing that.
12753 Update second constructor to store the rank correctly.
12755 2001-11-16 Ravi Pratap <ravi@ximian.com>
12757 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
12758 and try to implement.
12760 * ../errors/cs0150.cs : Add.
12762 * ../errors/cs0178.cs : Add.
12764 2001-11-16 Miguel de Icaza <miguel@ximian.com>
12766 * statement.cs: Implement foreach on multi-dimensional arrays.
12768 * parameter.cs (Parameters.GetParameterByName): Also lookup the
12769 name of the params argument.
12771 * expression.cs: Use EmitStoreOpcode to get the right opcode while
12772 initializing the array.
12774 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
12775 we can use this elsewhere.
12777 * statement.cs: Finish implementation of foreach for single
12780 * cs-parser.jay: Use an out-of-band stack to pass information
12781 around, I wonder why I need this.
12783 foreach_block: Make the new foreach_block the current_block.
12785 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
12786 function used to return a static Parameters structure. Used for
12787 empty parameters, as those are created very frequently.
12789 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
12791 2001-11-15 Ravi Pratap <ravi@ximian.com>
12793 * interface.cs : Default modifier is private, not public. The
12794 make verify test passes again.
12796 2001-11-15 Ravi Pratap <ravi@ximian.com>
12798 * support.cs (ReflectionParameters): Fix logic to determine
12799 whether the last parameter is a params one. Test 9 passes again.
12801 * delegate.cs (Populate): Register the builders we define with
12802 RegisterParameterForBuilder. Test 19 passes again.
12804 * cs-parser.jay (property_declaration): Reference $6 instead
12805 of $$ to get at the location.
12807 (indexer_declaration): Similar stuff.
12809 (attribute): Ditto.
12811 * class.cs (Property): Register parameters for the Get and Set methods
12812 if they exist. Test 23 passes again.
12814 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
12815 call to EmitArguments as we are sure there aren't any params arguments.
12816 Test 32 passes again.
12818 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
12819 IndexOutOfRangeException.
12821 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
12822 Test 33 now passes again.
12824 2001-11-15 Miguel de Icaza <miguel@ximian.com>
12826 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
12827 broke a bunch of things. Will have to come up with a better way
12828 of tracking locations.
12830 * statement.cs: Implemented foreach for single dimension arrays.
12832 2001-11-09 Miguel de Icaza <miguel@ximian.com>
12834 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
12835 an error. This removes the lookup from the critical path.
12837 * cs-parser.jay: Removed use of temporary_loc, which is completely
12840 2001-11-14 Miguel de Icaza <miguel@ximian.com>
12842 * support.cs (ReflectionParameters.ParameterModifier): Report
12843 whether the argument is a PARAMS argument or not.
12845 * class.cs: Set the attribute `ParamArrayAttribute' on the
12846 parameter argument.
12848 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
12849 and cons_param_array_attribute (ConstructorInfo for
12850 ParamArrayAttribute).,
12852 * codegen.cs: Emit the return using the `Return' statement, that
12853 way we can report the error correctly for missing return values.
12855 * class.cs (Method.Emit): Clean up.
12857 * expression.cs (Argument.Resolve): Take another argument: the
12858 location where this argument is used. Notice that this is not
12859 part of the "Argument" class as to reduce the size of the
12860 structure (we know the approximate location anyways).
12862 Test if the argument is a variable-reference, if not, then
12863 complain with a 206.
12865 (Argument.Emit): Emit addresses of variables.
12867 (Argument.FullDesc): Simplify.
12869 (Invocation.DoResolve): Update for Argument.Resolve.
12871 (ElementAccess.DoResolve): ditto.
12873 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
12874 method should be virtual, as this method is always virtual.
12876 (NewDelegate.DoResolve): Update for Argument.Resolve.
12878 * class.cs (ConstructorInitializer.DoResolve): ditto.
12880 * attribute.cs (Attribute.Resolve): ditto.
12882 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12884 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
12886 * expression.cs (ParameterReference): Drop IStackStorage and implement
12887 IAssignMethod instead.
12889 (LocalVariableReference): ditto.
12891 * ecore.cs (FieldExpr): Drop IStackStorage and implement
12892 IAssignMethod instead.
12894 2001-11-13 Miguel de Icaza <miguel@ximian.com>
12896 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
12897 enumerations that are used in heavily used structures derive from
12898 byte in a laughable and pathetic attempt to reduce memory usage.
12899 This is the kind of pre-optimzations that you should not do at
12900 home without adult supervision.
12902 * expression.cs (UnaryMutator): New class, used to handle ++ and
12903 -- separatedly from the other unary operators. Cleans up the
12904 code, and kills the ExpressionStatement dependency in Unary.
12906 (Unary): Removed `method' and `Arguments' from this class, making
12907 it smaller, and moving it all to SimpleCall, so I can reuse this
12908 code in other locations and avoid creating a lot of transient data
12909 strucutres when not required.
12911 * cs-parser.jay: Adjust for new changes.
12913 2001-11-11 Miguel de Icaza <miguel@ximian.com>
12915 * enum.cs (Enum.Populate): If there is a failure during
12918 * cs-parser.jay (opt_enum_base): we used to catch type errors
12919 here, but this is really incorrect. The type error should be
12920 catched during semantic analysis.
12922 2001-12-11 Ravi Pratap <ravi@ximian.com>
12924 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
12925 current_local_parameters as expected since I, in my stupidity, had forgotten
12928 * attribute.cs (GetValidPlaces): Fix stupid bug.
12930 * class.cs (Method::Emit): Perform check on applicability of attributes.
12932 (Constructor::Emit): Ditto.
12934 (Field::Emit): Ditto.
12936 (Field.Location): Store location information.
12938 (Property, Event, Indexer, Operator): Ditto.
12940 * cs-parser.jay (field_declaration): Pass in location for each field.
12942 * ../errors/cs0592.cs : Add.
12944 2001-11-12 Ravi Pratap <ravi@ximian.com>
12946 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
12948 (InitCoreTypes): Update accordingly.
12950 (RegisterAttrType, LookupAttr): Implement.
12952 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
12953 info about the same.
12955 (Resolve): Update to populate the above as necessary.
12957 (Error592): Helper.
12959 (GetValidPlaces): Helper to the above.
12961 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
12963 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
12965 2001-11-12 Ravi Pratap <ravi@ximian.com>
12967 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
12969 * ../errors/cs0617.cs : Add.
12971 2001-11-11 Ravi Pratap <ravi@ximian.com>
12973 * enum.cs (Emit): Rename to Populate to be more consistent with what
12974 we expect it to do and when exactly it is called.
12976 * class.cs, rootcontext.cs : Update accordingly.
12978 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
12979 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
12981 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
12983 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
12984 of a fieldinfo using the above, when dealing with a FieldBuilder.
12986 2001-11-10 Ravi Pratap <ravi@ximian.com>
12988 * ../errors/cs0031.cs : Add.
12990 * ../errors/cs1008.cs : Add.
12992 * ../errrors/cs0543.cs : Add.
12994 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
12997 (FindMembers): Implement.
12999 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
13000 enums and delegates too.
13002 (enum_types): Rename to builder_to_enum.
13004 (delegate_types): Rename to builder_to_delegate.
13006 * delegate.cs (FindMembers): Implement.
13008 2001-11-09 Ravi Pratap <ravi@ximian.com>
13010 * typemanager.cs (IsEnumType): Implement.
13012 * enum.cs (Emit): Re-write parts to account for the underlying type
13013 better and perform checking etc.
13015 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
13016 of the underlying type.
13018 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
13021 * enum.cs (error31): Helper to report error #31.
13023 * cs-parser.jay (enum_declaration): Store location of each member too.
13025 * enum.cs (member_to_location): New hashtable.
13027 (AddEnumMember): Update location hashtable.
13029 (Emit): Use the location of each member while reporting errors.
13031 2001-11-09 Miguel de Icaza <miguel@ximian.com>
13033 * cs-parser.jay: A for_initializer if is a
13034 local_variable_declaration really ammount to have an implicit
13035 block with the variable declaration and no initializer for for.
13037 * statement.cs (For.Emit): Cope with null initializers.
13039 This fixes the infinite loop on for initializers.
13041 2001-11-08 Miguel de Icaza <miguel@ximian.com>
13043 * enum.cs: More cleanup.
13045 * ecore.cs: Remove dead code.
13047 * class.cs (Property.Emit): More simplification.
13048 (Event.Emit): ditto.
13050 Reworked to have less levels of indentation.
13052 2001-11-08 Ravi Pratap <ravi@ximian.com>
13054 * class.cs (Property): Emit attributes.
13064 * enum.cs (Emit): Ditto.
13066 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
13069 * class.cs (Field, Event, etc.): Move attribute generation into the
13070 Emit method everywhere.
13072 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
13073 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
13074 as we had no way of defining nested enums !
13076 * rootcontext.cs : Adjust code accordingly.
13078 * typemanager.cs (AddEnumType): To keep track of enum types separately.
13080 2001-11-07 Ravi Pratap <ravi@ximian.com>
13082 * expression.cs (EvalConstantExpression): Move into ecore.cs
13084 * enum.cs (Enum): Rename some members and make them public and readonly
13085 according to our convention.
13087 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
13090 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
13092 (Enum::Emit): Write a simple version for now which doesn't try to compute
13093 expressions. I shall modify this to be more robust in just a while.
13095 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
13097 (TypeContainer::CloseType): Create the Enum types too.
13099 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
13101 * expression.cs (EvalConstantExpression): Get rid of completely.
13103 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
13104 user-defined values and other cases.
13106 (IsValidEnumLiteral): Helper function.
13108 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
13109 out there in the case we had a literal FieldExpr.
13111 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
13113 (Literalize): Revamp a bit to take two arguments.
13115 (EnumLiteral): New class which derives from Literal to wrap enum literals.
13117 2001-11-06 Ravi Pratap <ravi@ximian.com>
13119 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
13121 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
13123 (Resolve): Use the above to ensure we have proper initializers.
13125 2001-11-05 Ravi Pratap <ravi@ximian.com>
13127 * expression.cs (Expression::EvalConstantExpression): New method to
13128 evaluate constant expressions.
13130 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
13132 2001-11-07 Miguel de Icaza <miguel@ximian.com>
13134 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
13137 (Binary.ResolveOperator): Handle operator != (object a, object b)
13138 and operator == (object a, object b);
13140 (Binary.DoNumericPromotions): Indicate whether the numeric
13141 promotion was possible.
13143 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
13146 Made the ArrayAccess implement interface IAssignMethod instead of
13147 IStackStore as the order in which arguments are passed reflects
13150 * assign.cs: Instead of using expr.ExprClass to select the way of
13151 assinging, probe for the IStackStore/IAssignMethod interfaces.
13153 * typemanager.cs: Load InitializeArray definition.
13155 * rootcontext.cs (RootContext.MakeStaticData): Used to define
13156 static data that can be used to initialize arrays.
13158 2001-11-05 Miguel de Icaza <miguel@ximian.com>
13160 * expression.cs: Handle operator== and operator!= for booleans.
13162 (Conditioal.Reduce): Implement reducer for the ?: operator.
13164 (Conditional.Resolve): Implement dead code elimination.
13166 (Binary.Resolve): Catch string literals and return a new
13167 concatenated string.
13169 (Unary.Reduce): Implement reduction of unary expressions.
13171 * ecore.cs: Split out the expression core handling here.
13173 (Expression.Reduce): New method used to perform constant folding
13174 and CSE. This is needed to support constant-expressions.
13176 * statement.cs (Statement.EmitBoolExpression): Pass true and false
13177 targets, and optimize for !x.
13179 2001-11-04 Ravi Pratap <ravi@ximian.com>
13181 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
13182 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
13183 set custom atttributes.
13185 * literal.cs (Literal::GetValue): New abstract method to return the actual
13186 value of the literal, cast as an object.
13188 (*Literal): Implement GetValue method.
13190 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
13191 expressions to the arraylist but objects of type Argument.
13193 * class.cs (TypeContainer::Emit): Emit our attributes too.
13195 (Method::Emit, Constructor::Emit): Ditto.
13197 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
13198 to be ignoring earlier.
13200 2001-11-03 Ravi Pratap <ravi@ximian.com>
13202 * attribute.cs (AttributeSection::Define): Implement to do the business
13203 of constructing a CustomAttributeBuilder.
13205 (Attribute): New trivial class. Increases readability of code.
13207 * cs-parser.jay : Update accordingly.
13209 (positional_argument_list, named_argument_list, named_argument): New rules
13211 (attribute_arguments): Use the above so that we are more correct.
13213 2001-11-02 Ravi Pratap <ravi@ximian.com>
13215 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
13216 to perform all checks for a method with a params parameter.
13218 (Invocation::OverloadResolve): Update to use the above method and therefore
13219 cope correctly with params method invocations.
13221 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
13224 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
13225 constructors in our parent too because we can't afford to miss out on
13228 * attribute.cs (AttributeSection): New name for the class Attribute
13230 Other trivial changes to improve readability.
13232 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
13233 use the new class names.
13235 2001-11-01 Ravi Pratap <ravi@ximian.com>
13237 * class.cs (Method::Define): Complete definition for params types too
13239 (Indexer::Define): Ditto.
13241 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
13242 Cope everywhere with a request for info about the array parameter.
13244 2001-11-01 Ravi Pratap <ravi@ximian.com>
13246 * tree.cs (RecordNamespace): Fix up to check for the correct key.
13248 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
13249 local_variable_type to extract the string corresponding to the type.
13251 (local_variable_type): Fixup the action to use the new helper method.
13253 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
13256 * expression.cs : Clean out code which uses the above.
13258 2001-10-31 Ravi Pratap <ravi@ximian.com>
13260 * typemanager.cs (RegisterMethod): Check if we already have an existing key
13261 and bale out if necessary by returning a false.
13263 (RegisterProperty): Ditto.
13265 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
13266 and print out appropriate error messages.
13268 * interface.cs (everywhere): Ditto.
13270 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
13271 location to constructor.
13273 * class.cs (Property, Event, Indexer): Update accordingly.
13275 * ../errors/cs111.cs : Added.
13277 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
13278 of a method, as laid down by the spec.
13280 (Invocation::OverloadResolve): Use the above method.
13282 2001-10-31 Ravi Pratap <ravi@ximian.com>
13284 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
13285 now take a TypeContainer and a Parameters object.
13287 (ParameterData): Modify return type of ParameterModifier method to be
13288 Parameter.Modifier and not a string.
13290 (ReflectionParameters, InternalParameters): Update accordingly.
13292 * expression.cs (Argument::GetParameterModifier): Same here.
13294 * support.cs (InternalParameters::ParameterType): Find a better way of determining
13295 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
13296 symbol in it at all so maybe this is only for now.
13298 2001-10-30 Ravi Pratap <ravi@ximian.com>
13300 * support.cs (InternalParameters): Constructor now takes an extra argument
13301 which is the actual Parameters class.
13303 (ParameterDesc): Update to provide info on ref/out modifiers.
13305 * class.cs (everywhere): Update call to InternalParameters to pass in
13306 the second argument too.
13308 * support.cs (ParameterData): Add ParameterModifier, which is a method
13309 to return the modifier info [ref/out etc]
13311 (InternalParameters, ReflectionParameters): Implement the above.
13313 * expression.cs (Argument::ParameterModifier): Similar function to return
13314 info about the argument's modifiers.
13316 (Invocation::OverloadResolve): Update to take into account matching modifiers
13319 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
13320 a new SetFormalParameters object which we pass to InternalParameters.
13322 2001-10-30 Ravi Pratap <ravi@ximian.com>
13324 * expression.cs (NewArray): Merge into the ArrayCreation class.
13326 2001-10-29 Ravi Pratap <ravi@ximian.com>
13328 * expression.cs (NewArray): Merge classes NewBuiltinArray and
13329 NewUserdefinedArray into one as there wasn't much of a use in having
13332 * expression.cs (Argument): Change field's name to ArgType from Type.
13334 (Type): New readonly property which returns the proper type, taking into
13335 account ref/out modifiers.
13337 (everywhere): Adjust code accordingly for the above.
13339 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
13340 whether we are emitting for a ref or out parameter.
13342 * expression.cs (Argument::Emit): Use the above field to set the state.
13344 (LocalVariableReference::Emit): Update to honour the flag and emit the
13347 * parameter.cs (Attributes): Set the correct flags for ref parameters.
13349 * expression.cs (Argument::FullDesc): New function to provide a full desc.
13351 * support.cs (ParameterData): Add method ParameterDesc to the interface.
13353 (ReflectionParameters, InternalParameters): Implement the above method.
13355 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
13358 (Invocation::FullMethodDesc): Ditto.
13360 2001-10-29 Miguel de Icaza <miguel@ximian.com>
13362 * cs-parser.jay: Add extra production for the second form of array
13365 * expression.cs (ArrayCreation): Update to reflect the above
13368 * Small changes to prepare for Array initialization.
13370 2001-10-28 Miguel de Icaza <miguel@ximian.com>
13372 * typemanager.cs (ImplementsInterface): interface might be null;
13373 Deal with this problem;
13375 Also, we do store negative hits on the cache (null values), so use
13376 this instead of calling t.GetInterfaces on the type everytime.
13378 2001-10-28 Ravi Pratap <ravi@ximian.com>
13380 * typemanager.cs (IsBuiltinType): New method to help determine the same.
13382 * expression.cs (New::DoResolve): Get rid of array creation code and instead
13383 split functionality out into different classes.
13385 (New::FormArrayType): Move into NewBuiltinArray.
13387 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
13390 (NewBuiltinArray): New class to handle creation of built-in arrays.
13392 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
13393 account creation of one-dimensional arrays.
13395 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
13397 (NewUserdefinedArray::DoResolve): Implement.
13399 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
13401 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
13402 we maintain inside the TypeManager. This is necessary to perform lookups on the
13405 (LookupType): Update to perform GetType on the module builders too.
13407 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
13409 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
13411 2001-10-23 Ravi Pratap <ravi@ximian.com>
13413 * expression.cs (New::DoResolve): Implement guts of array creation.
13415 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
13417 2001-10-27 Miguel de Icaza <miguel@ximian.com>
13419 * expression.cs: Fix bug I introduced lsat night that broke
13422 (Expression.Resolve): Report a 246 error (can not resolve name)
13423 if we find a SimpleName in the stream.
13425 (Expression.ResolveLValue): Ditto.
13427 (Expression.ResolveWithSimpleName): This function is a variant of
13428 ResolveName, this one allows SimpleNames to be returned without a
13429 warning. The only consumer of SimpleNames is MemberAccess
13431 2001-10-26 Miguel de Icaza <miguel@ximian.com>
13433 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
13434 might arrive here. I have my doubts that this is correct.
13436 * statement.cs (Lock): Implement lock statement.
13438 * cs-parser.jay: Small fixes to support `lock' and `using'
13440 * cs-tokenizer.cs: Remove extra space
13442 * driver.cs: New flag --checked, allows to turn on integer math
13445 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
13446 Threading.Monitor.Exit
13448 2001-10-23 Miguel de Icaza <miguel@ximian.com>
13450 * expression.cs (IndexerAccess::DoResolveLValue): Set the
13451 Expression Class to be IndexerAccess.
13453 Notice that Indexer::DoResolve sets the eclass to Value.
13455 2001-10-22 Miguel de Icaza <miguel@ximian.com>
13457 * class.cs (TypeContainer::Emit): Emit code for indexers.
13459 * assign.cs (IAssignMethod): New interface implemented by Indexers
13460 and Properties for handling assignment.
13462 (Assign::Emit): Simplify and reuse code.
13464 * expression.cs (IndexerAccess, PropertyExpr): Implement
13465 IAssignMethod, clean up old code.
13467 2001-10-22 Ravi Pratap <ravi@ximian.com>
13469 * typemanager.cs (ImplementsInterface): New method to determine if a type
13470 implements a given interface. Provides a nice cache too.
13472 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
13475 (ConvertReferenceExplicit): Ditto.
13477 * delegate.cs (Delegate::Populate): Update to define the parameters on the
13478 various methods, with correct names etc.
13480 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
13481 Operator.UnaryNegation.
13483 * cs-parser.jay (operator_declarator): Be a little clever in the case where
13484 we have a unary plus or minus operator.
13486 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
13489 * everywhere : update accordingly.
13491 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
13494 * class.cs (Method::Define): For the case where we are implementing a method
13495 inherited from an interface, we need to set the MethodAttributes.Final flag too.
13496 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
13498 2001-10-21 Ravi Pratap <ravi@ximian.com>
13500 * interface.cs (FindMembers): Implement to work around S.R.E
13503 * typemanager.cs (IsInterfaceType): Implement.
13505 (FindMembers): Update to handle interface types too.
13507 * expression.cs (ImplicitReferenceConversion): Re-write bits which
13508 use IsAssignableFrom as that is not correct - it doesn't work.
13510 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
13511 and accordingly override EmitStatement.
13513 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
13514 using the correct logic :-)
13516 2001-10-19 Ravi Pratap <ravi@ximian.com>
13518 * ../errors/cs-11.cs : Add to demonstrate error -11
13520 2001-10-17 Miguel de Icaza <miguel@ximian.com>
13522 * assign.cs (Assign::Resolve): Resolve right hand side first, and
13523 then pass this as a hint to ResolveLValue.
13525 * expression.cs (FieldExpr): Add Location information
13527 (FieldExpr::LValueResolve): Report assignment to readonly
13530 (Expression::ExprClassFromMemberInfo): Pass location information.
13532 (Expression::ResolveLValue): Add new method that resolves an
13535 (Expression::DoResolveLValue): Default invocation calls
13538 (Indexers): New class used to keep track of indexers in a given
13541 (IStackStore): Renamed from LValue, as it did not really describe
13542 what this did. Also ResolveLValue is gone from this interface and
13543 now is part of Expression.
13545 (ElementAccess): Depending on the element access type
13547 * typemanager.cs: Add `indexer_name_type' as a Core type
13548 (System.Runtime.CompilerServices.IndexerNameAttribute)
13550 * statement.cs (Goto): Take a location.
13552 2001-10-18 Ravi Pratap <ravi@ximian.com>
13554 * delegate.cs (Delegate::VerifyDelegate): New method to verify
13555 if two delegates are compatible.
13557 (NewDelegate::DoResolve): Update to take care of the case when
13558 we instantiate a delegate from another delegate.
13560 * typemanager.cs (FindMembers): Don't even try to look up members
13561 of Delegate types for now.
13563 2001-10-18 Ravi Pratap <ravi@ximian.com>
13565 * delegate.cs (NewDelegate): New class to take care of delegate
13568 * expression.cs (New): Split the delegate related code out into
13569 the NewDelegate class.
13571 * delegate.cs (DelegateInvocation): New class to handle delegate
13574 * expression.cs (Invocation): Split out delegate related code into
13575 the DelegateInvocation class.
13577 2001-10-17 Ravi Pratap <ravi@ximian.com>
13579 * expression.cs (New::DoResolve): Implement delegate creation fully
13580 and according to the spec.
13582 (New::DoEmit): Update to handle delegates differently.
13584 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
13585 because of which we were printing out arguments in reverse order !
13587 * delegate.cs (VerifyMethod): Implement to check if the given method
13588 matches the delegate.
13590 (FullDelegateDesc): Implement.
13592 (VerifyApplicability): Implement.
13594 * expression.cs (Invocation::DoResolve): Update to accordingly handle
13595 delegate invocations too.
13597 (Invocation::Emit): Ditto.
13599 * ../errors/cs1593.cs : Added.
13601 * ../errors/cs1594.cs : Added.
13603 * delegate.cs (InstanceExpression, TargetMethod): New properties.
13605 2001-10-16 Ravi Pratap <ravi@ximian.com>
13607 * typemanager.cs (intptr_type): Core type for System.IntPtr
13609 (InitCoreTypes): Update for the same.
13611 (iasyncresult_type, asynccallback_type): Ditto.
13613 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
13616 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
13619 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
13620 the builders for the 4 members of a delegate type :-)
13622 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
13625 * expression.cs (New::DoResolve): Implement guts for delegate creation.
13627 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
13629 2001-10-15 Miguel de Icaza <miguel@ximian.com>
13631 * statement.cs (Break::Emit): Implement.
13632 (Continue::Emit): Implement.
13634 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
13635 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
13636 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
13637 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
13640 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
13641 properties that track the label for the current loop (begin of the
13642 loop and end of the loop).
13644 2001-10-15 Ravi Pratap <ravi@ximian.com>
13646 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
13647 use of emitting anything at all.
13649 * class.cs, rootcontext.cs : Get rid of calls to the same.
13651 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
13653 (Populate): Define the constructor correctly and set the implementation
13656 * typemanager.cs (delegate_types): New hashtable to hold delegates that
13659 (AddDelegateType): Implement.
13661 (IsDelegateType): Implement helper method.
13663 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
13665 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
13666 and accordingly handle it.
13668 * delegate.cs (Populate): Take TypeContainer argument.
13669 Implement bits to define the Invoke method. However, I still haven't figured out
13670 how to take care of the native int bit :-(
13672 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
13673 Qualify the name of the delegate, not its return type !
13675 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
13678 (StandardConversionExists): Checking for array types turns out to be recursive.
13680 (ConvertReferenceExplicit): Implement array conversion.
13682 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
13684 2001-10-12 Ravi Pratap <ravi@ximian.com>
13686 * cs-parser.jay (delegate_declaration): Store the fully qualified
13687 name as it is a type declaration.
13689 * delegate.cs (ReturnType, Name): Rename members to these. Make them
13692 (DefineDelegate): Renamed from Define. Does the same thing essentially,
13693 as TypeContainer::DefineType.
13695 (Populate): Method in which all the definition of the various methods (Invoke)
13698 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
13701 (CloseDelegate): Finally creates the delegate.
13703 * class.cs (TypeContainer::DefineType): Update to define delegates.
13704 (Populate, Emit and CloseType): Do the same thing here too.
13706 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
13707 delegates in all these operations.
13709 2001-10-14 Miguel de Icaza <miguel@ximian.com>
13711 * expression.cs: LocalTemporary: a new expression used to
13712 reference a temporary that has been created.
13714 * assign.cs: Handle PropertyAccess back here, so that we can
13715 provide the proper semantic access to properties.
13717 * expression.cs (Expression::ConvertReferenceExplicit): Implement
13718 a few more explicit conversions.
13720 * modifiers.cs: `NEW' modifier maps to HideBySig.
13722 * expression.cs (PropertyExpr): Make this into an
13723 ExpressionStatement, and support the EmitStatement code path.
13725 Perform get/set error checking, clean up the interface.
13727 * assign.cs: recognize PropertyExprs as targets, and if so, turn
13728 them into toplevel access objects.
13730 2001-10-12 Miguel de Icaza <miguel@ximian.com>
13732 * expression.cs: PropertyExpr::PropertyExpr: use work around the
13735 * typemanager.cs: Keep track here of our PropertyBuilders again to
13736 work around lameness in SRE.
13738 2001-10-11 Miguel de Icaza <miguel@ximian.com>
13740 * expression.cs (LValue::LValueResolve): New method in the
13741 interface, used to perform a second resolution pass for LValues.
13743 (This::DoResolve): Catch the use of this in static methods.
13745 (This::LValueResolve): Implement.
13747 (This::Store): Remove warning, assigning to `this' in structures
13750 (Invocation::Emit): Deal with invocation of
13751 methods on value types. We need to pass the address to structure
13752 methods rather than the object itself. (The equivalent code to
13753 emit "this" for structures leaves the entire structure on the
13754 stack instead of a pointer to it).
13756 (ParameterReference::DoResolve): Compute the real index for the
13757 argument based on whether the method takes or not a `this' pointer
13758 (ie, the method is static).
13760 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
13761 value types returned from functions when we need to invoke a
13762 method on the sturcture.
13765 2001-10-11 Ravi Pratap <ravi@ximian.com>
13767 * class.cs (TypeContainer::DefineType): Method to actually do the business of
13768 defining the type in the Modulebuilder or Typebuilder. This is to take
13769 care of nested types which need to be defined on the TypeBuilder using
13770 DefineNestedMethod.
13772 (TypeContainer::GetClassBases): Implement. Essentially the code from the
13773 methods in RootContext, only ported to be part of TypeContainer.
13775 (TypeContainer::GetInterfaceOrClass): Ditto.
13777 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
13779 * interface.cs (Interface::DefineInterface): New method. Does exactly
13780 what RootContext.CreateInterface did earlier, only it takes care of nested types
13783 (Interface::GetInterfaces): Move from RootContext here and port.
13785 (Interface::GetInterfaceByName): Same here.
13787 * rootcontext.cs (ResolveTree): Re-write.
13789 (PopulateTypes): Re-write.
13791 * class.cs (TypeContainer::Populate): Populate nested types too.
13792 (TypeContainer::Emit): Emit nested members too.
13794 * typemanager.cs (AddUserType): Do not make use of the FullName property,
13795 instead just use the name argument passed in as it is already fully
13798 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
13799 to TypeContainer mapping to see if a type is user-defined.
13801 * class.cs (TypeContainer::CloseType): Implement.
13803 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
13804 the default constructor.
13806 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
13809 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
13811 * interface.cs (CloseType): Create the type here.
13813 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
13816 Remove all the methods which are now in TypeContainer.
13818 2001-10-10 Ravi Pratap <ravi@ximian.com>
13820 * delegate.cs (Define): Re-write bits to define the delegate
13823 2001-10-10 Miguel de Icaza <miguel@ximian.com>
13825 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
13827 * expression.cs (ImplicitReferenceConversion): handle null as well
13828 as a source to convert to any reference type.
13830 * statement.cs (Return): Perform any implicit conversions to
13831 expected return type.
13833 Validate use of return statement.
13835 * codegen.cs (EmitContext): Pass the expected return type here.
13837 * class.cs (Method, Constructor, Property): Pass expected return
13838 type to EmitContext.
13840 2001-10-09 Miguel de Icaza <miguel@ximian.com>
13842 * expression.cs: Make DoResolve take an EmitContext instead of a
13845 Replaced `l' and `location' for `loc', for consistency.
13847 (Error, Warning): Remove unneeded Tc argument.
13849 * assign.cs, literal.cs, constant.cs: Update to new calling
13852 * codegen.cs: EmitContext now contains a flag indicating whether
13853 code is being generated in a static method or not.
13855 * cs-parser.jay: DecomposeQI, new function that replaces the old
13856 QualifiedIdentifier. Now we always decompose the assembled
13857 strings from qualified_identifier productions into a group of
13860 2001-10-08 Miguel de Icaza <miguel@ximian.com>
13862 * rootcontext.cs: Deal with field-less struct types correctly now
13863 by passing the size option to Define Type.
13865 * class.cs: Removed hack that created one static field.
13867 2001-10-07 Miguel de Icaza <miguel@ximian.com>
13869 * statement.cs: Moved most of the code generation here.
13871 2001-10-09 Ravi Pratap <ravi@ximian.com>
13873 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
13876 (ElementAccess): Remove useless bits for now - keep checks as the spec
13879 2001-10-08 Ravi Pratap <ravi@ximian.com>
13881 * expression.cs (ElementAccess::DoResolve): Remove my crap code
13882 and start performing checks according to the spec.
13884 2001-10-07 Ravi Pratap <ravi@ximian.com>
13886 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
13887 rank_specifiers instead.
13889 (rank_specifiers): Change the order in which the rank specifiers are stored
13891 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
13893 * expression.cs (ElementAccess): Implement the LValue interface too.
13895 2001-10-06 Ravi Pratap <ravi@ximian.com>
13897 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
13898 except that user defined conversions are not included.
13900 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
13901 perform the conversion of the return type, if necessary.
13903 (New::DoResolve): Check whether we are creating an array or an object
13904 and accordingly do the needful.
13906 (New::Emit): Same here.
13908 (New::DoResolve): Implement guts of array creation.
13910 (New::FormLookupType): Helper function.
13912 2001-10-07 Miguel de Icaza <miguel@ximian.com>
13914 * codegen.cs: Removed most of the code generation here, and move the
13915 corresponding code generation bits to the statement classes.
13917 Added support for try/catch/finalize and throw.
13919 * cs-parser.jay: Added support for try/catch/finalize.
13921 * class.cs: Catch static methods having the flags override,
13922 virtual or abstract.
13924 * expression.cs (UserCast): This user cast was not really doing
13925 what it was supposed to do. Which is to be born in fully resolved
13926 state. Parts of the resolution were being performed at Emit time!
13930 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13932 * expression.cs: Implicity convert the result from UserCast.
13934 2001-10-05 Ravi Pratap <ravi@ximian.com>
13936 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
13937 prevented it from working correctly.
13939 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
13940 merely ConvertImplicit.
13942 2001-10-05 Miguel de Icaza <miguel@ximian.com>
13944 * typemanager.cs: Make the LookupTypeContainer function static,
13945 and not per-instance.
13947 * class.cs: Make static FindMembers (the one that takes a Type
13950 * codegen.cs: Add EmitForeach here.
13952 * cs-parser.jay: Make foreach a toplevel object instead of the
13953 inline expansion, as we need to perform semantic analysis on it.
13955 2001-10-05 Ravi Pratap <ravi@ximian.com>
13957 * expression.cs (Expression::ImplicitUserConversion): Rename to
13958 UserDefinedConversion.
13960 (Expression::UserDefinedConversion): Take an extra argument specifying
13961 whether we look for explicit user conversions too.
13963 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
13965 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
13967 (ExplicitUserConversion): Make it a call to UserDefinedConversion
13968 with the appropriate arguments.
13970 * cs-parser.jay (cast_expression): Record location too.
13972 * expression.cs (Cast): Record location info.
13974 (Expression::ConvertExplicit): Take location argument.
13976 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
13977 to determine if we are doing explicit conversions.
13979 (UserCast::Emit): Update accordingly.
13981 (Expression::ConvertExplicit): Report an error if everything fails.
13983 * ../errors/cs0030.cs : Add.
13985 2001-10-04 Miguel de Icaza <miguel@ximian.com>
13987 * modifiers.cs: If the ABSTRACT keyword is present, also set the
13988 virtual and newslot bits.
13990 * class.cs (TypeContainer::RegisterRequiredImplementations):
13991 Record methods we need.
13993 (TypeContainer::MakeKey): Helper function to make keys for
13994 MethodBases, since the Methodbase key is useless.
13996 (TypeContainer::Populate): Call RegisterRequiredImplementations
13997 before defining the methods.
13999 Create a mapping for method_builders_to_methods ahead of time
14000 instead of inside a tight loop.
14002 (::RequireMethods): Accept an object as the data to set into the
14003 hashtable so we can report interface vs abstract method mismatch.
14005 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14007 * report.cs: Make all of it static.
14009 * rootcontext.cs: Drop object_type and value_type computations, as
14010 we have those in the TypeManager anyways.
14012 Drop report instance variable too, now it is a global.
14014 * driver.cs: Use try/catch on command line handling.
14016 Add --probe option to debug the error reporting system with a test
14019 * report.cs: Add support for exiting program when a probe
14020 condition is reached.
14022 2001-10-03 Ravi Pratap <ravi@ximian.com>
14024 * expression.cs (Binary::DoNumericPromotions): Fix the case when
14025 we do a forcible conversion regardless of type, to check if
14026 ForceConversion returns a null.
14028 (Binary::error19): Use location to report error.
14030 (Unary::error23): Use location here too.
14032 * ../errors/cs0019.cs : Check in.
14034 * ../errors/cs0023.cs : Check in.
14036 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
14037 case of a non-null MethodInfo object with a length of 0 !
14039 (Binary::ResolveOperator): Flag error if overload resolution fails to find
14040 an applicable member - according to the spec :-)
14041 Also fix logic to find members in base types.
14043 (Unary::ResolveOperator): Same here.
14045 (Unary::report23): Change name to error23 and make first argument a TypeContainer
14046 as I was getting thoroughly confused between this and error19 :-)
14048 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
14049 (::FindMostEncompassedType): Implement.
14050 (::FindMostEncompassingType): Implement.
14051 (::StandardConversionExists): Implement.
14053 (UserImplicitCast): Re-vamp. We now need info about most specific
14054 source and target types so that we can do the necessary conversions.
14056 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
14057 mathematical union with no duplicates.
14059 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14061 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
14062 in order from base classes to child classes, so that we can in
14063 child classes look up in our parent for method names and
14064 attributes (required for handling abstract, virtual, new, override
14065 constructs: we need to instrospect our base class, and if we dont
14066 populate the classes in order, the introspection might be
14067 incorrect. For example, a method could query its parent before
14068 the parent has any methods and would determine that the parent has
14069 no abstract methods (while it could have had them)).
14071 (RootContext::CreateType): Record the order in which we define the
14074 2001-10-02 Miguel de Icaza <miguel@ximian.com>
14076 * class.cs (TypeContainer::Populate): Also method definitions can
14077 fail now, keep track of this.
14079 (TypeContainer::FindMembers): Implement support for
14080 DeclaredOnly/noDeclaredOnly flag.
14082 (Constructor::Emit) Return the ConstructorBuilder.
14084 (Method::Emit) Return the MethodBuilder.
14085 Check for abstract or virtual methods to be public.
14087 * rootcontext.cs (RootContext::CreateType): Register all the
14088 abstract methods required for the class to be complete and the
14089 interface methods that must be implemented.
14091 * cs-parser.jay: Report error 501 (method requires body if it is
14092 not marked abstract or extern).
14094 * expression.cs (TypeOf::Emit): Implement.
14096 * typemanager.cs: runtime_handle_type, new global type.
14098 * class.cs (Property::Emit): Generate code for properties.
14100 2001-10-02 Ravi Pratap <ravi@ximian.com>
14102 * expression.cs (Unary::ResolveOperator): Find operators on base type
14103 too - we now conform exactly to the spec.
14105 (Binary::ResolveOperator): Same here.
14107 * class.cs (Operator::Define): Fix minor quirk in the tests.
14109 * ../errors/cs0215.cs : Added.
14111 * ../errors/cs0556.cs : Added.
14113 * ../errors/cs0555.cs : Added.
14115 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14117 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
14118 single integer which is really efficient
14120 2001-10-01 Ravi Pratap <ravi@ximian.com>
14122 * expression.cs (Expression::ImplicitUserConversion): Use location
14123 even in the case when we are examining True operators.
14125 * class.cs (Operator::Define): Perform extensive checks to conform
14126 with the rules for operator overloading in the spec.
14128 * expression.cs (Expression::ImplicitReferenceConversion): Implement
14129 some of the other conversions mentioned in the spec.
14131 * typemanager.cs (array_type): New static member for the System.Array built-in
14134 (cloneable_interface): For System.ICloneable interface.
14136 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
14137 we start resolving the tree and populating types.
14139 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
14141 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14143 * expression.cs (Expression::ExprClassFromMemberInfo,
14144 Expression::Literalize): Create literal expressions from
14145 FieldInfos which are literals.
14147 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
14148 type casts, because they were wrong. The test suite in tests
14151 (ImplicitNumericConversion): ushort to ulong requires a widening
14154 Int32 constant to long requires widening cast as well.
14156 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
14157 for integers because the type on the stack is not i4.
14159 2001-09-30 Miguel de Icaza <miguel@ximian.com>
14161 * expression.cs (report118): require location argument.
14163 * parameter.cs: Do not dereference potential null value.
14165 * class.cs: Catch methods that lack the `new' keyword when
14166 overriding a name. Report warnings when `new' is used without
14167 anything being there to override.
14169 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
14171 * class.cs: Only add constructor to hashtable if it is non-null
14172 (as now constructors can fail on define).
14174 (TypeManager, Class, Struct): Take location arguments.
14176 Catch field instance initialization in structs as errors.
14178 accepting_filter: a new filter for FindMembers that is static so
14179 that we dont create an instance per invocation.
14181 (Constructor::Define): Catch errors where a struct constructor is
14184 * cs-parser.jay: Pass location information for various new
14187 * delegate.cs (Delegate): take a location argument.
14189 * driver.cs: Do not call EmitCode if there were problesm in the
14190 Definition of the types, as many Builders wont be there.
14192 * decl.cs (Decl::Decl): Require a location argument.
14194 * cs-tokenizer.cs: Handle properly hex constants that can not fit
14195 into integers, and find the most appropiate integer for it.
14197 * literal.cs: Implement ULongLiteral.
14199 * rootcontext.cs: Provide better information about the location of
14200 failure when CreateType fails.
14202 2001-09-29 Miguel de Icaza <miguel@ximian.com>
14204 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
14207 * expression.cs (Binary::CheckShiftArguments): Add missing type
14209 (Binary::ResolveOperator): Add type to the logical and and logical
14210 or, Bitwise And/Or and Exclusive Or code paths, it was missing
14213 (Binary::DoNumericPromotions): In the case where either argument
14214 is ulong (and most signed types combined with ulong cause an
14215 error) perform implicit integer constant conversions as well.
14217 2001-09-28 Miguel de Icaza <miguel@ximian.com>
14219 * expression.cs (UserImplicitCast): Method should always be
14221 (Invocation::BetterConversion): Simplified test for IntLiteral.
14223 (Expression::ImplicitNumericConversion): Split this routine out.
14224 Put the code that performs implicit constant integer conversions
14227 (Expression::Resolve): Become a wrapper around DoResolve so we can
14228 check eclass and type being set after resolve.
14230 (Invocation::Badness): Remove this dead function
14232 (Binary::ResolveOperator): Do not compute the expensive argumnets
14233 unless we have a union for it.
14235 (Probe::Emit): Is needs to do an isinst and then
14236 compare against null.
14238 (::CanConvert): Added Location argument. If the Location argument
14239 is null (Location.Null), then we do not report errors. This is
14240 used by the `probe' mechanism of the Explicit conversion. We do
14241 not want to generate an error for something that the user
14242 explicitly requested to be casted. But the pipeline for an
14243 explicit cast first tests for potential implicit casts.
14245 So for now, if the Location is null, it means `Probe only' to
14246 avoid adding another argument. Might have to revise this
14249 (ClassCast): New class used to type cast objects into arbitrary
14250 classes (used in Explicit Reference Conversions).
14252 Implement `as' as well.
14254 Reverted all the patches from Ravi below: they were broken:
14256 * The use of `level' as a mechanism to stop recursive
14257 invocations is wrong. That was there just to catch the
14258 bug with a strack trace but not as a way of addressing
14261 To fix the problem we have to *understand* what is going
14262 on and the interactions and come up with a plan, not
14263 just get things going.
14265 * The use of the type conversion cache that I proposed
14266 last night had an open topic: How does this work across
14267 protection domains. A user defined conversion might not
14268 be public in the location where we are applying the
14269 conversion, a different conversion might be selected
14270 (ie, private A->B (better) but public B->A (worse),
14271 inside A, A->B applies, but outside it, B->A will
14274 * On top of that (ie, even if the above is solved),
14275 conversions in a cache need to be abstract. Ie, `To
14276 convert from an Int to a Short use an OpcodeCast', not
14277 `To convert from an Int to a Short use the OpcodeCast on
14278 the variable 5' (which is what this patch was doing).
14280 2001-09-28 Ravi Pratap <ravi@ximian.com>
14282 * expression.cs (Invocation::ConversionExists): Re-write to use
14283 the conversion cache
14285 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
14286 cache all conversions done, not just user-defined ones.
14288 (Invocation::BetterConversion): The real culprit. Use ConversionExists
14289 to determine if a conversion exists instead of acutually trying to
14290 perform the conversion. It's faster too.
14292 (Expression::ConvertExplicit): Modify to use ConversionExists to check
14293 and only then attempt the implicit conversion.
14295 2001-09-28 Ravi Pratap <ravi@ximian.com>
14297 * expression.cs (ConvertImplicit): Use a cache for conversions
14298 already found. Check level of recursion and bail out if necessary.
14300 2001-09-28 Miguel de Icaza <miguel@ximian.com>
14302 * typemanager.cs (string_concat_string_string, string_concat_object_object):
14303 Export standard methods that we expect for string operations.
14305 * statement.cs (Block::UsageWarning): Track usage of variables and
14306 report the errors for not used variables.
14308 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
14311 2001-09-27 Miguel de Icaza <miguel@ximian.com>
14313 * codegen.cs: remove unnneded code
14315 * expression.cs: Removed BuiltinTypeAccess class
14317 Fix the order in which implicit conversions are
14320 The previous fixed dropped support for boxed conversions (adding a
14321 test to the test suite now)
14323 (UserImplicitCast::CanConvert): Remove test for source being null,
14324 that code is broken. We should not feed a null to begin with, if
14325 we do, then we should track the bug where the problem originates
14326 and not try to cover it up here.
14328 Return a resolved expression of type UserImplicitCast on success
14329 rather than true/false. Ravi: this is what I was talking about,
14330 the pattern is to use a static method as a "constructor" for
14333 Also, do not create arguments until the very last minute,
14334 otherwise we always create the arguments even for lookups that
14335 will never be performed.
14337 (UserImplicitCast::Resolve): Eliminate, objects of type
14338 UserImplicitCast are born in a fully resolved state.
14340 * typemanager.cs (InitCoreTypes): Init also value_type
14341 (System.ValueType).
14343 * expression.cs (Cast::Resolve): First resolve the child expression.
14345 (LValue): Add new method AddressOf to be used by
14348 Change the argument of Store to take an EmitContext instead of an
14349 ILGenerator, because things like FieldExpr need to be able to call
14350 their children expression to generate the instance code.
14352 (Expression::Error, Expression::Warning): Sugar functions for
14355 (Expression::MemberLookup): Accept a TypeContainer instead of a
14356 Report as the first argument.
14358 (Expression::ResolvePrimary): Killed. I still want to improve
14359 this as currently the code is just not right.
14361 (Expression::ResolveMemberAccess): Simplify, but it is still
14364 (Unary::Resolve): Catch errors in AddressOf operators.
14366 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
14367 index to a byte for the short-version, or the compiler will choose
14368 the wrong Emit call, which generates the wrong data.
14370 (ParameterReference::Emit, ::Store): same.
14372 (FieldExpr::AddressOf): Implement.
14374 * typemanager.cs: TypeManager: made public variable instead of
14377 * driver.cs: document --fatal.
14379 * report.cs (ErrorMessage, WarningMessage): new names for the old
14380 Error and Warning classes.
14382 * cs-parser.jay (member_access): Turn built-in access to types
14383 into a normal simplename
14385 2001-09-27 Ravi Pratap <ravi@ximian.com>
14387 * expression.cs (Invocation::BetterConversion): Fix to cope
14388 with q being null, since this was introducing a bug.
14390 * expression.cs (ConvertImplicit): Do built-in conversions first.
14392 2001-09-27 Ravi Pratap <ravi@ximian.com>
14394 * expression.cs (UserImplicitCast::Resolve): Fix bug.
14396 2001-09-27 Ravi Pratap <ravi@ximian.com>
14398 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
14399 I had introduced long ago (what's new ?).
14401 * expression.cs (UserImplicitCast::CanConvert): Static method to do
14402 the work of all the checking.
14403 (ConvertImplicit): Call CanConvert and only then create object if necessary.
14404 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
14406 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
14407 that is the right way.
14409 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
14410 overloading resolution. Use everywhere instead of cutting and pasting code.
14412 (Binary::ResolveOperator): Use MakeUnionSet.
14414 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
14415 we have to convert to bool types. Not complete yet.
14417 2001-09-27 Miguel de Icaza <miguel@ximian.com>
14419 * typemanager.cs (TypeManager::CSharpName): support ushort.
14421 * expression.cs (Expression::TryImplicitIntConversion): Attempts
14422 to provide an expression that performsn an implicit constant int
14423 conversion (section 6.1.6).
14424 (Expression::ConvertImplicitRequired): Reworked to include
14425 implicit constant expression conversions.
14427 (Expression::ConvertNumericExplicit): Finished.
14429 (Invocation::Emit): If InstanceExpression is null, then it means
14430 that we perform a call on this.
14432 2001-09-26 Miguel de Icaza <miguel@ximian.com>
14434 * expression.cs (Unary::Emit): Remove some dead code.
14435 (Probe): Implement Resolve and Emit for `is'.
14436 (Expression::ConvertImplicitRequired): Attempt to do constant
14437 expression conversions here. Maybe should be moved to
14438 ConvertImplicit, but I am not sure.
14439 (Expression::ImplicitLongConstantConversionPossible,
14440 Expression::ImplicitIntConstantConversionPossible): New functions
14441 that tell whether is it possible to apply an implicit constant
14442 expression conversion.
14444 (ConvertNumericExplicit): Started work on explicit numeric
14447 * cs-parser.jay: Update operator constants.
14449 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
14450 (Parameters::GetSignature): Hook up VerifyArgs here.
14451 (Parameters::VerifyArgs): Verifies that no two arguments have the
14454 * class.cs (Operator): Update the operator names to reflect the
14455 ones that the spec expects (as we are just stringizing the
14458 * expression.cs (Unary::ResolveOperator): Fix bug: Use
14459 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
14460 previous usage did only work for our methods.
14461 (Expression::ConvertImplicit): Handle decimal implicit numeric
14462 conversions as well.
14463 (Expression::InternalTypeConstructor): Used to invoke constructors
14464 on internal types for default promotions.
14466 (Unary::Emit): Implement special handling for the pre/post
14467 increment/decrement for overloaded operators, as they need to have
14468 the same semantics as the other operators.
14470 (Binary::ResolveOperator): ditto.
14471 (Invocation::ConversionExists): ditto.
14472 (UserImplicitCast::Resolve): ditto.
14474 2001-09-26 Ravi Pratap <ravi@ximian.com>
14476 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
14477 operator, return after emitting body. Regression tests pass again !
14479 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
14480 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
14481 (Invocation::OverloadResolve): Ditto.
14482 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
14484 * everywhere : update calls to the above methods accordingly.
14486 2001-09-26 Miguel de Icaza <miguel@ximian.com>
14488 * assign.cs (Assign): Make it inherit from ExpressionStatement.
14490 * expression.cs (ExpressionStatement): New base class used for
14491 expressions that can appear in statements, so that we can provide
14492 an alternate path to generate expression that do not leave a value
14495 (Expression::Emit, and all the derivatives): We no longer return
14496 whether a value is left on the stack or not. Every expression
14497 after being emitted leaves a single value on the stack.
14499 * codegen.cs (EmitContext::EmitStatementExpression): Use the
14500 facilties of ExpressionStatement if possible.
14502 * cs-parser.jay: Update statement_expression.
14504 2001-09-25 Miguel de Icaza <miguel@ximian.com>
14506 * driver.cs: Change the wording of message
14508 2001-09-25 Ravi Pratap <ravi@ximian.com>
14510 * expression.cs (Binary::ResolveOperator): Had forgottten to set
14511 the type of the expression to the return type of the method if
14512 we have an overloaded operator match ! The regression tests pass again !
14513 (Unary::ResolveOperator): Ditto.
14515 * expression.cs (Invocation::ConversionExists): Correct the member lookup
14516 to find "op_Implicit", not "implicit" ;-)
14517 (UserImplicitCast): New class to take care of user-defined implicit conversions.
14518 (ConvertImplicit, ForceConversion): Take TypeContainer argument
14520 * everywhere : Correct calls to the above accordingly.
14522 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
14523 (ConvertImplicit): Do user-defined conversion if it exists.
14525 2001-09-24 Miguel de Icaza <miguel@ximian.com>
14527 * assign.cs: track location.
14528 (Resolve): Use implicit conversions on assignment.
14530 * literal.cs: Oops. Not good, Emit of short access values should
14531 pass (Bytes) or the wrong argument will be selected.
14533 * expression.cs (Unary::Emit): Emit code for -expr.
14535 (Unary::ResolveOperator): Handle `Substract' for non-constants
14536 (substract from zero from the non-constants).
14537 Deal with Doubles as well.
14539 (Expression::ConvertImplicitRequired): New routine that reports an
14540 error if no implicit conversion exists.
14542 (Invocation::OverloadResolve): Store the converted implicit
14543 expressions if we make them
14545 2001-09-24 Ravi Pratap <ravi@ximian.com>
14547 * class.cs (ConstructorInitializer): Take a Location argument.
14548 (ConstructorBaseInitializer): Same here.
14549 (ConstructorThisInitializer): Same here.
14551 * cs-parser.jay : Update all calls accordingly.
14553 * expression.cs (Unary, Binary, New): Take location argument.
14554 Update accordingly everywhere.
14556 * cs-parser.jay : Update all calls to the above to take a location
14559 * class.cs : Ditto.
14561 2001-09-24 Ravi Pratap <ravi@ximian.com>
14563 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
14564 (Invocation::BetterConversion): Same here
14565 (Invocation::ConversionExists): Ditto.
14567 (Invocation::ConversionExists): Implement.
14569 2001-09-22 Ravi Pratap <ravi@ximian.com>
14571 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
14572 Also take an additional TypeContainer argument.
14574 * All over : Pass in TypeContainer as argument to OverloadResolve.
14576 * typemanager.cs (CSharpName): Update to check for the string type and return
14579 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
14582 2001-09-21 Ravi Pratap <ravi@ximian.com>
14584 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
14585 (Invocation::BetterFunction): Implement.
14586 (Invocation::BetterConversion): Implement.
14587 (Invocation::ConversionExists): Skeleton, no implementation yet.
14589 Okay, things work fine !
14591 2001-09-21 Miguel de Icaza <miguel@ximian.com>
14593 * typemanager.cs: declare and load enum_type, delegate_type and
14596 * expression.cs (Expression::Emit): Now emit returns a value that
14597 tells whether a value is left on the stack or not. This strategy
14598 might be reveted tomorrow with a mechanism that would address
14599 multiple assignments.
14600 (Expression::report118): Utility routine to report mismatches on
14603 (Unary::Report23): Report impossible type/operator combination
14606 (Unary::IsIncrementableNumber): Whether the type can be
14607 incremented or decremented with add.
14608 (Unary::ResolveOperator): Also allow enumerations to be bitwise
14610 (Unary::ResolveOperator): Implement ++, !, ~,
14612 (Invocation::Emit): Deal with new Emit convetion.
14614 * All Expression derivatives: Updated their Emit method to return
14615 whether they leave values on the stack or not.
14617 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
14618 stack for expressions that are statements.
14620 2001-09-20 Miguel de Icaza <miguel@ximian.com>
14622 * expression.cs (LValue): New interface. Must be implemented by
14624 (LocalVariableReference, ParameterReference, FieldExpr): Implement
14627 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
14628 interface for generating code, simplifies the code.
14630 2001-09-20 Ravi Pratap <ravi@ximian.com>
14632 * expression.cs (everywhere): Comment out return statements in ::Resolve
14633 methods to avoid the warnings.
14635 2001-09-20 Miguel de Icaza <miguel@ximian.com>
14637 * driver.cs (parse): Report error 2001 if we can not open the
14640 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
14643 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
14646 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
14647 otherwise nested blocks end up with the same index.
14649 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
14651 * expression.cs: Instead of having FIXMEs in the Resolve
14652 functions, throw exceptions so it is obvious that we are facing a
14655 * cs-parser.jay (invocation_expression): Pass Location information.
14657 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
14658 Use a basename for those routines because .NET does not like paths
14661 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
14664 2001-09-19 Miguel de Icaza <miguel@ximian.com>
14666 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
14667 are loading the correct data types (throws an exception if not).
14668 (TypeManager::InitCoreTypes): Use CoreLookupType
14670 * expression.cs (Unary::ResolveOperator): return the child
14671 expression for expressions which are just +expr.
14672 (Unary::ResolveOperator): Return negative literals for -LITERAL
14673 expressions (otherwise they are Unary {Literal}).
14674 (Invocation::Badness): Take into account `Implicit constant
14675 expression conversions'.
14677 * literal.cs (LongLiteral): Implement long literal class.
14678 (IntLiteral): export the `Value' of the intliteral.
14680 2001-09-19 Ravi Pratap <ravi@ximian.com>
14682 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
14684 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
14685 instead of 'Operator'
14687 * expression.cs (Binary::ResolveOperator): Update accordingly.
14688 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
14691 * cs-parser.jay (unary_expression): Update to use the new names.
14693 * gen-treedump.cs (GetUnary): Same here.
14695 * expression.cs (Unary::Resolve): Implement.
14696 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
14697 operators are found instead of making noise ;-)
14698 (Unary::ResolveOperator): New method to do precisely the same thing which
14699 Binary::ResolveOperator does for Binary expressions.
14700 (Unary.method, .Arguments): Add.
14701 (Unary::OperName): Implement.
14702 (Unary::ForceConversion): Copy and Paste !
14704 * class.cs (Operator::Define): Fix a small bug for the case when we have
14707 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
14708 for the inbuilt operators. Only overloading works for now ;-)
14710 2001-09-18 Miguel de Icaza <miguel@ximian.com>
14712 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
14713 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
14715 * expression.cs (This::Emit): Implement.
14716 (This::Resolve): Implement.
14717 (TypeOf:Resolve): Implement.
14718 (Expression::ResolveSimpleName): Add an implicit this to instance
14720 (MemberAccess::Resolve): Deal with Parameters and Fields.
14721 Bind instance variable to Field expressions.
14722 (FieldExpr::Instance): New field used to track the expression that
14723 represents the object instance.
14724 (FieldExpr::Resolve): Track potential errors from MemberLookup not
14726 (FieldExpr::Emit): Implement.
14728 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
14729 the last instruction contains a return opcode to avoid generating
14730 the last `ret' instruction (this generates correct code, and it is
14731 nice to pass the peverify output).
14733 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
14734 initializer for static and instance variables.
14735 (Constructor::Emit): Allow initializer to be null in the case of
14736 static constructors. Only emit initializer for instance
14739 (TypeContainer::FindMembers): Return a null array if there are no
14742 Also fix the code for the MemberTypes.Method branch, as it was not
14743 scanning that for operators (or tried to access null variables before).
14745 * assign.cs (Assign::Emit): Handle instance and static fields.
14749 * driver.cs: Stop compilation if there are parse errors.
14751 * cs-parser.jay (constructor_declaration): Provide default base
14752 initializer for non-static constructors.
14753 (constructor_declarator): Do not provide a default base
14754 initializers if none was specified.
14755 Catch the fact that constructors should not have parameters.
14757 * class.cs: Do not emit parent class initializers for static
14758 constructors, that should be flagged as an error.
14760 2001-09-18 Ravi Pratap <ravi@ximian.com>
14762 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
14763 Move back code into TypeContainer::Populate.
14765 2001-09-18 Ravi Pratap <ravi@ximian.com>
14767 * class.cs (TypeContainer::AddConstructor): Fix the check to
14768 compare against Name, not Basename.
14769 (Operator::OpType): Change Plus and Minus to Add and Subtract.
14771 * cs-parser.jay : Update accordingly.
14773 * class.cs (TypeContainer::FindMembers): For the case where we are searching
14774 for methods, don't forget to look into the operators too.
14775 (RegisterMethodBuilder): Helper method to take care of this for
14776 methods, constructors and operators.
14777 (Operator::Define): Completely revamp.
14778 (Operator.OperatorMethod, MethodName): New fields.
14779 (TypeContainer::Populate): Move the registering of builders into
14780 RegisterMethodBuilder.
14781 (Operator::Emit): Re-write.
14783 * expression.cs (Binary::Emit): Comment out code path to emit method
14784 invocation stuff for the case when we have a user defined operator. I am
14785 just not able to get it right !
14787 2001-09-17 Miguel de Icaza <miguel@ximian.com>
14789 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
14792 (Expression::MemberLookup): Provide a version that allows to
14793 specify the MemberTypes and BindingFlags.
14795 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
14796 so it was not fetching variable information from outer blocks.
14798 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
14799 Beforefieldinit as it was buggy.
14801 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
14802 that Ravi put here.
14804 * class.cs (Constructor::Emit): Only emit if block is not null.
14805 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
14806 deal with this by semantically definining it as if the user had
14809 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
14810 constructors as we now "emit" them at a higher level.
14812 (TypeContainer::DefineDefaultConstructor): Used to define the
14813 default constructors if none was provided.
14815 (ConstructorInitializer): Add methods Resolve and Emit.
14817 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
14819 2001-09-17 Ravi Pratap <ravi@ximian.com>
14821 * class.cs (TypeContainer::EmitDefaultConstructor): Register
14822 the default constructor builder with our hashtable for methodbuilders
14825 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
14826 and argument_count is 0 in which case we have a match.
14827 (Binary::ResolveOperator): More null checking and miscellaneous coding
14830 2001-09-17 Ravi Pratap <ravi@ximian.com>
14832 * rootcontext.cs (IsNameSpace): Compare against null.
14834 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
14836 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
14837 and Unary::Operator.
14839 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
14842 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
14843 we have overloaded operators.
14844 (Binary::ResolveOperator): Implement the part which does the operator overload
14847 * class.cs (Operator::Emit): Implement.
14848 (TypeContainer::Emit): Emit the operators we have too.
14850 * expression.cs (Binary::Emit): Update to emit the appropriate code for
14851 the case when we have a user-defined operator.
14853 2001-09-17 Miguel de Icaza <miguel@ximian.com>
14855 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
14857 2001-09-16 Ravi Pratap <ravi@ximian.com>
14859 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
14860 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
14861 (Constructor::Emit): Implement.
14862 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
14863 if we have no work to do.
14864 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
14867 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
14868 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
14870 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
14873 2001-09-15 Ravi Pratap <ravi@ximian.com>
14875 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
14877 (Tree::RecordNamespace): Method to do what the name says ;-)
14878 (Tree::Namespaces): Property to get at the namespaces hashtable.
14880 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
14883 * rootcontext.cs (IsNamespace): Fixed it :-)
14885 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14887 * class.cs (TypeContainer::FindMembers): Add support for
14889 (MethodCore): New class that encapsulates both the shared aspects
14890 of a Constructor and a Method.
14891 (Method, Constructor): Factored pieces into MethodCore.
14893 * driver.cs: Added --fatal which makes errors throw exceptions.
14894 Load System assembly as well as part of the standard library.
14896 * report.cs: Allow throwing exceptions on errors for debugging.
14898 * modifiers.cs: Do not use `parent', instead use the real type
14899 container to evaluate permission settings.
14901 * class.cs: Put Ravi's patch back in. He is right, and we will
14902 have to cope with the
14904 2001-09-14 Ravi Pratap <ravi@ximian.com>
14906 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
14907 FamORAssem, not FamANDAssem.
14909 2001-09-14 Miguel de Icaza <miguel@ximian.com>
14911 * driver.cs: Added --parse option that only parses its input files
14914 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
14915 incorrect. IsTopLevel is not used to tell whether an object is
14916 root_types or not (that can be achieved by testing this ==
14917 root_types). But to see if this is a top-level *class* (not
14918 necessarly our "toplevel" container).
14920 2001-09-14 Ravi Pratap <ravi@ximian.com>
14922 * enum.cs (Enum::Define): Modify to call the Lookup method on the
14923 parent instead of a direct call to GetType.
14925 2001-09-14 Ravi Pratap <ravi@ximian.com>
14927 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
14928 Modifiers.TypeAttr. This should just be a call to that method.
14930 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
14931 object so that we can determine if we are top-level or not.
14933 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
14936 * enum.cs (Enum::Define): Ditto.
14938 * modifiers.cs (FieldAttr): Re-write.
14940 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
14941 (TypeContainer::HaveStaticConstructor): New property to provide access
14942 to precisely that info.
14944 * modifiers.cs (MethodAttr): Re-write.
14945 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
14947 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
14948 of top-level types as claimed.
14950 2001-09-13 Miguel de Icaza <miguel@ximian.com>
14952 * expression.cs (MemberLookup): Fruitless attempt to lookup
14953 constructors. Maybe I need to emit default constructors? That
14954 might be it (currently .NET emits this for me automatically).
14955 (Invocation::OverloadResolve): Cope with Arguments == null.
14956 (Invocation::EmitArguments): new function, shared by the new
14957 constructor and us.
14958 (Invocation::Emit): Handle static and instance methods. Emit
14959 proper call instruction for virtual or non-virtual invocations.
14960 (New::Emit): Implement.
14961 (New::Resolve): Implement.
14962 (MemberAccess:Resolve): Implement.
14963 (MethodGroupExpr::InstanceExpression): used conforming to the spec
14964 to track instances.
14965 (FieldExpr::Resolve): Set type.
14967 * support.cs: Handle empty arguments.
14969 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
14970 SimpleLookup): Auxiliary routines to help parse a qualifier
14973 Update qualifier_identifier rule.
14975 * codegen.cs: Removed debugging messages.
14977 * class.cs: Make this a global thing, this acts just as a "key" to
14978 objects that we might have around.
14980 (Populate): Only initialize method_builders_to_methods once.
14982 * expression.cs (PropertyExpr): Initialize type from the
14985 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
14986 Resolve pattern. Attempt to implicitly convert value to boolean.
14989 * expression.cs: Set the type for the int32/int32 argument case.
14990 (Binary::ResolveOperator): Set the return type to boolean for
14991 comparission operators
14993 * typemanager.cs: Remove debugging print code.
14995 (Invocation::Resolve): resolve type.
14997 * class.cs: Allocate a MemberInfo of the correct size, as the code
14998 elsewhere depends on the test to reflect the correct contents.
15000 (Method::) Keep track of parameters, due to System.Reflection holes
15002 (TypeContainer::Populate): Keep track of MethodBuilders to Method
15005 (TypeContainer::FindMembers): Use ArrayList and then copy an array
15006 of the exact size and return that.
15008 (Class::LookupMethodByBuilder): New function that maps
15009 MethodBuilders to its methods. Required to locate the information
15010 on methods because System.Reflection bit us again.
15012 * support.cs: New file, contains an interface ParameterData and
15013 two implementations: ReflectionParameters and InternalParameters
15014 used to access Parameter information. We will need to grow this
15017 * expression.cs (Invocation::GetParameterData): implement a cache
15018 and a wrapper around the ParameterData creation for methods.
15019 (Invocation::OverloadResolve): Use new code.
15021 2001-09-13 Ravi Pratap <ravi@ximian.com>
15023 * class.cs (TypeContainer::EmitField): Remove and move into
15024 (Field::Define): here and modify accordingly.
15025 (Field.FieldBuilder): New member.
15026 (TypeContainer::Populate): Update accordingly.
15027 (TypeContainer::FindMembers): Implement.
15029 2001-09-13 Miguel de Icaza <miguel@ximian.com>
15031 * statement.cs: (VariableInfo::VariableType): New field to be
15032 initialized with the full type once it is resolved.
15034 2001-09-12 Miguel de Icaza <miguel@ximian.com>
15036 * parameter.cs (GetParameterInfo): Use a type cache to compute
15037 things only once, and to reuse this information
15039 * expression.cs (LocalVariableReference::Emit): Implement.
15040 (OpcodeCast::Emit): fix.
15042 (ParameterReference::Resolve): Implement.
15043 (ParameterReference::Emit): Implement.
15045 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
15046 that are expressions need to stay as Expressions.
15048 * typemanager.cs (CSharpName): Returns the C# name of a type if
15051 * expression.cs (Expression::ConvertImplicit): New function that
15052 implements implicit type conversions.
15054 (Expression::ImplicitReferenceConversion): Implements implicit
15055 reference conversions.
15057 (EmptyCast): New type for transparent casts.
15059 (OpcodeCast): New type for casts of types that are performed with
15060 a sequence of bytecodes.
15062 (BoxedCast): New type used for casting value types into reference
15063 types. Emits a box opcode.
15065 (Binary::DoNumericPromotions): Implements numeric promotions of
15066 and computation of the Binary::Type.
15068 (Binary::EmitBranchable): Optimization.
15070 (Binary::Emit): Implement code emission for expressions.
15072 * typemanager.cs (TypeManager): Added two new core types: sbyte
15075 2001-09-12 Ravi Pratap <ravi@ximian.com>
15077 * class.cs (TypeContainer::FindMembers): Method which does exactly
15078 what Type.FindMembers does, only we don't have to use reflection. No
15079 implementation yet.
15081 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
15082 typecontainer objects as we need to get at them.
15083 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
15085 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
15086 typecontainer object.
15088 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
15089 of just a Report object.
15091 2001-09-11 Ravi Pratap <ravi@ximian.com>
15093 * class.cs (Event::Define): Go back to using the prefixes "add_" and
15095 (TypeContainer::Populate): Now define the delegates of the type too.
15096 (TypeContainer.Delegates): Property to access the list of delegates defined
15099 * delegates.cs (Delegate::Define): Implement partially.
15101 * modifiers.cs (TypeAttr): Handle more flags.
15103 2001-09-11 Ravi Pratap <ravi@ximian.com>
15105 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
15107 (Operator::Define): Re-write logic to get types by using the LookupType method
15108 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
15109 (Indexer::Define): Ditto.
15110 (Event::Define): Ditto.
15111 (Property::Define): Ditto.
15113 2001-09-10 Ravi Pratap <ravi@ximian.com>
15115 * class.cs (TypeContainer::Populate): Now define operators too.
15116 (TypeContainer.Operators): New property to access the list of operators
15118 (Operator.OperatorMethodBuilder): New member to hold the method builder
15119 for the operator we are defining.
15120 (Operator::Define): Implement.
15122 2001-09-10 Ravi Pratap <ravi@ximian.com>
15124 * class.cs (Event::Define): Make the prefixes of the accessor methods
15125 addOn_ and removeOn_
15127 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
15128 of the location being passed in too. Ideally, this should go later since all
15129 error reporting should be done through the Report object.
15131 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
15132 (Populate): Iterate thru the indexers we have and define them too.
15133 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
15134 for the get and set accessors.
15135 (Indexer::Define): Implement.
15137 2001-09-09 Miguel de Icaza <miguel@ximian.com>
15139 * expression.cs (Binary::Resolve): Beginning of it. I scratched
15140 my previous implementation, did not work.
15142 * typemanager.cs: Add a couple of missing types (the longs).
15144 * literal.cs: Use TypeManager.bool_type instead of getting it.
15146 * expression.cs (EventExpr): New kind of expressions.
15147 (Expressio::ExprClassFromMemberInfo): finish
15149 2001-09-08 Miguel de Icaza <miguel@ximian.com>
15151 * assign.cs: Emit stores to static fields differently.
15153 2001-09-08 Ravi Pratap <ravi@ximian.com>
15155 * Merge in changes and adjust code to tackle conflicts. Backed out my
15156 code in Assign::Resolve ;-)
15158 2001-09-08 Ravi Pratap <ravi@ximian.com>
15160 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
15161 instead Report.Error and also pass in the location.
15162 (CSharpParser::Lexer): New readonly property to return the reference
15163 to the Tokenizer object.
15164 (declare_local_variables): Use Report.Error with location instead of plain
15168 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
15169 (Operator.CheckBinaryOperator): Ditto.
15171 * cs-parser.jay (operator_declarator): Update accordingly.
15173 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
15174 (CheckBinaryOperator): Same here.
15176 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
15177 on the name without any prefixes of namespace names etc. This is because we
15178 already might have something already fully qualified like
15179 'System.Console.WriteLine'
15181 * assign.cs (Resolve): Begin implementation. Stuck ;-)
15183 2001-09-07 Ravi Pratap <ravi@ximian.com>
15185 * cs-tokenizer.cs (location): Return a string which also contains
15188 * expression.cs (ElementAccess): New class for expressions of the
15189 type 'element access.'
15190 (BaseAccess): New class for expressions of the type 'base access.'
15191 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
15194 * cs-parser.jay (element_access): Implement action.
15195 (base_access): Implement actions.
15196 (checked_expression, unchecked_expression): Implement.
15198 * cs-parser.jay (local_variable_type): Correct and implement.
15199 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
15201 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
15203 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
15204 name and the specifiers.
15206 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
15208 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
15209 making them all public ;-)
15211 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
15214 2001-09-07 Miguel de Icaza <miguel@ximian.com>
15216 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
15218 (FieldExpr, PropertyExprs): New resolved expressions.
15219 (SimpleName::MemberStaticCheck): Perform static checks for access
15220 to non-static fields on static methods. Maybe this should be
15221 generalized for MemberAccesses.
15222 (SimpleName::ResolveSimpleName): More work on simple name
15225 * cs-parser.jay (primary_expression/qualified_identifier): track
15226 the parameter index.
15228 * codegen.cs (CodeGen::Save): Catch save exception, report error.
15229 (EmitContext::EmitBoolExpression): Chain to expression generation
15230 instead of temporary hack.
15231 (::EmitStatementExpression): Put generic expression code generation.
15233 * assign.cs (Assign::Emit): Implement variable assignments to
15234 local variables, parameters and fields.
15236 2001-09-06 Miguel de Icaza <miguel@ximian.com>
15238 * statement.cs (Block::GetVariableInfo): New method, returns the
15239 VariableInfo for a variable name in a block.
15240 (Block::GetVariableType): Implement in terms of GetVariableInfo
15242 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
15243 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
15245 2001-09-06 Ravi Pratap <ravi@ximian.com>
15247 * cs-parser.jay (operator_declaration): Continue on my quest : update
15248 to take attributes argument.
15249 (event_declaration): Ditto.
15250 (enum_declaration): Ditto.
15251 (indexer_declaration): Ditto.
15253 * class.cs (Operator::Operator): Update constructor accordingly.
15254 (Event::Event): Ditto.
15256 * delegate.cs (Delegate::Delegate): Same here.
15258 * enum.cs (Enum::Enum): Same here.
15260 2001-09-05 Ravi Pratap <ravi@ximian.com>
15262 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
15264 * ../tests/cs0658.cs : New file to demonstrate error 0658.
15266 * attribute.cs (Attributes): New class to encapsulate all attributes which were
15267 being passed around as an arraylist.
15268 (Attributes::AddAttribute): Method to add attribute sections.
15270 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
15271 (struct_declaration): Update accordingly.
15272 (constant_declaration): Update.
15273 (field_declaration): Update.
15274 (method_header): Update.
15275 (fixed_parameter): Update.
15276 (parameter_array): Ditto.
15277 (property_declaration): Ditto.
15278 (destructor_declaration): Ditto.
15280 * class.cs (Struct::Struct): Update constructors accordingly.
15281 (Class::Class): Ditto.
15282 (Field::Field): Ditto.
15283 (Method::Method): Ditto.
15284 (Property::Property): Ditto.
15285 (TypeContainer::OptAttribute): update property's return type.
15287 * interface.cs (Interface.opt_attributes): New member.
15288 (Interface::Interface): Update to take the extra Attributes argument.
15290 * parameter.cs (Parameter::Parameter): Ditto.
15292 * constant.cs (Constant::Constant): Ditto.
15294 * interface.cs (InterfaceMemberBase): New OptAttributes field.
15295 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
15296 the attributes as a parameter.
15297 (InterfaceProperty): Update constructor call.
15298 (InterfaceEvent): Ditto.
15299 (InterfaceMethod): Ditto.
15300 (InterfaceIndexer): Ditto.
15302 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
15303 pass the attributes too.
15304 (interface_event_declaration): Ditto.
15305 (interface_property_declaration): Ditto.
15306 (interface_method_declaration): Ditto.
15307 (interface_declaration): Ditto.
15309 2001-09-05 Miguel de Icaza <miguel@ximian.com>
15311 * class.cs (Method::Define): Track the "static Main" definition to
15312 create an entry point.
15314 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
15315 EntryPoint if we find it.
15317 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
15318 (EmitContext::ig): Make this variable public.
15320 * driver.cs: Make the default output file be the first file name
15321 with the .exe extension.
15323 Detect empty compilations
15325 Handle various kinds of output targets. Handle --target and
15326 rename -t to --dumper.
15328 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
15329 methods inherited from Expression return now an Expression. This
15330 will is used during the tree rewriting as we resolve them during
15333 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
15334 the spec. Missing entirely is the information about
15335 accessability of elements of it.
15337 (Expression::ExprClassFromMemberInfo): New constructor for
15338 Expressions that creates a fully initialized Expression based on
15339 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
15342 (Invocation::Resolve): Begin implementing resolution of invocations.
15344 * literal.cs (StringLiteral): Implement Emit.
15346 2001-09-05 Ravi Pratap <ravi@ximian.com>
15348 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
15351 2001-09-04 Ravi Pratap <ravi@ximian.com>
15353 * cs-parser.jay (attribute_arguments): Implement actions.
15354 (attribute): Fix bug in production. Implement action.
15355 (attribute_list): Implement.
15356 (attribute_target): Implement.
15357 (attribute_target_specifier, opt_target_specifier): Implement
15358 (CheckAttributeTarget): New method to check if the attribute target
15360 (attribute_section): Implement.
15361 (opt_attributes): Implement.
15363 * attribute.cs : New file to handle attributes.
15364 (Attribute): Class to hold attribute info.
15366 * cs-parser.jay (opt_attribute_target_specifier): Remove production
15367 (attribute_section): Modify production to use 2 different rules to
15368 achieve the same thing. 1 s/r conflict down !
15369 Clean out commented, useless, non-reducing dimension_separator rules.
15371 * class.cs (TypeContainer.attributes): New member to hold list
15372 of attributes for a type.
15373 (Struct::Struct): Modify to take one more argument, the attribute list.
15374 (Class::Class): Ditto.
15375 (Field::Field): Ditto.
15376 (Method::Method): Ditto.
15377 (Property::Property): Ditto.
15379 * cs-parser.jay (struct_declaration): Update constructor call to
15380 pass in the attributes too.
15381 (class_declaration): Ditto.
15382 (constant_declaration): Ditto.
15383 (field_declaration): Ditto.
15384 (method_header): Ditto.
15385 (fixed_parameter): Ditto.
15386 (parameter_array): Ditto.
15387 (property_declaration): Ditto.
15389 * constant.cs (Constant::Constant): Update constructor similarly.
15390 Use System.Collections.
15392 * parameter.cs (Parameter::Parameter): Update as above.
15394 2001-09-02 Ravi Pratap <ravi@ximian.com>
15396 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
15397 (TypeContainer.delegates): New member to hold list of delegates.
15399 * cs-parser.jay (delegate_declaration): Implement the action correctly
15400 this time as I seem to be on crack ;-)
15402 2001-09-02 Miguel de Icaza <miguel@ximian.com>
15404 * rootcontext.cs (RootContext::IsNamespace): new function, used to
15405 tell whether an identifier represents a namespace.
15407 * expression.cs (NamespaceExpr): A namespace expression, used only
15408 temporarly during expression resolution.
15409 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
15410 utility functions to resolve names on expressions.
15412 2001-09-01 Miguel de Icaza <miguel@ximian.com>
15414 * codegen.cs: Add hook for StatementExpressions.
15416 * class.cs: Fix inverted test for static flag in methods.
15418 2001-09-02 Ravi Pratap <ravi@ximian.com>
15420 * class.cs (Operator::CheckUnaryOperator): Correct error number used
15421 to make it coincide with MS' number.
15422 (Operator::CheckBinaryOperator): Ditto.
15424 * ../errors/errors.txt : Remove error numbers added earlier.
15426 * ../errors/cs1019.cs : Test case for error # 1019
15428 * ../errros/cs1020.cs : Test case for error # 1020
15430 * cs-parser.jay : Clean out commented cruft.
15431 (dimension_separators, dimension_separator): Comment out. Ostensibly not
15432 used anywhere - non-reducing rule.
15433 (namespace_declarations): Non-reducing rule - comment out.
15435 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
15436 with TypeContainer::AddEnum.
15438 * delegate.cs : New file for delegate handling classes.
15439 (Delegate): Class for declaring delegates.
15441 * makefile : Update.
15443 * cs-parser.jay (delegate_declaration): Implement.
15445 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
15447 * class.cs (Event::Define): Implement.
15448 (Event.EventBuilder): New member.
15450 * class.cs (TypeContainer::Populate): Update to define all enums and events
15452 (Events): New property for the events arraylist we hold. Shouldn't we move to using
15453 readonly fields for all these cases ?
15455 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
15457 * class.cs (Property): Revamp to use the convention of making fields readonly.
15458 Accordingly modify code elsewhere.
15460 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
15461 the Define method of the Property class.
15463 * class.cs : Clean up applied patch and update references to variables etc. Fix
15465 (TypeContainer::Populate): Update to define all the properties we have. Also
15466 define all enumerations.
15468 * enum.cs (Define): Implement.
15470 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
15472 * cs-parser.jay (overloadable_operator): The semantic value is an
15473 enum of the Operator class.
15474 (operator_declarator): Implement actions.
15475 (operator_declaration): Implement.
15477 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
15478 validity of definitions.
15479 (Operator::CheckBinaryOperator): Static method to check for binary operators
15480 (TypeContainer::AddOperator): New method to add an operator to a type.
15482 * cs-parser.jay (indexer_declaration): Added line to actually call the
15483 AddIndexer method so it gets added ;-)
15485 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
15486 already taken care of by the MS compiler ?
15488 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
15490 * class.cs (Operator): New class for operator declarations.
15491 (Operator::OpType): Enum for the various operators.
15493 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
15495 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
15496 ostensibly handle this in semantic analysis.
15498 * cs-parser.jay (general_catch_clause): Comment out
15499 (specific_catch_clauses, specific_catch_clause): Ditto.
15500 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
15501 (catch_args, opt_catch_args): New productions.
15502 (catch_clause): Rewrite to use the new productions above
15503 (catch_clauses): Modify accordingly.
15504 (opt_catch_clauses): New production to use in try_statement
15505 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
15506 and re-write the code in the actions to extract the specific and
15507 general catch clauses by being a little smart ;-)
15509 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
15510 Hooray, try and catch statements parse fine !
15512 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
15514 * statement.cs (Block::GetVariableType): Fix logic to extract the type
15515 string from the hashtable of variables.
15517 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
15518 I end up making that mistake ;-)
15519 (catch_clauses): Fixed gross error which made Key and Value of the
15520 DictionaryEntry the same : $1 !!
15522 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
15524 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
15526 * cs-parser.jay (event_declaration): Correct to remove the semicolon
15527 when the add and remove accessors are specified.
15529 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
15531 * cs-parser.jay (IndexerDeclaration): New helper class to hold
15532 information about indexer_declarator.
15533 (indexer_declarator): Implement actions.
15534 (parsing_indexer): New local boolean used to keep track of whether
15535 we are parsing indexers or properties. This is necessary because
15536 implicit_parameters come into picture even for the get accessor in the
15537 case of an indexer.
15538 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
15540 * class.cs (Indexer): New class for indexer declarations.
15541 (TypeContainer::AddIndexer): New method to add an indexer to a type.
15542 (TypeContainer::indexers): New member to hold list of indexers for the
15545 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
15547 * cs-parser.jay (add_accessor_declaration): Implement action.
15548 (remove_accessor_declaration): Implement action.
15549 (event_accessors_declaration): Implement
15550 (variable_declarators): swap statements for first rule - trivial.
15552 * class.cs (Event): New class to hold information about event
15554 (TypeContainer::AddEvent): New method to add an event to a type
15555 (TypeContainer::events): New member to hold list of events.
15557 * cs-parser.jay (event_declaration): Implement actions.
15559 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
15561 * cs-parser.jay (dim_separators): Implement. Make it a string
15562 concatenating all the commas together, just as they appear.
15563 (opt_dim_separators): Modify accordingly
15564 (rank_specifiers): Update accordingly. Basically do the same
15565 thing - instead, collect the brackets here.
15566 (opt_rank_sepcifiers): Modify accordingly.
15567 (array_type): Modify to actually return the complete type string
15568 instead of ignoring the rank_specifiers.
15569 (expression_list): Implement to collect the expressions
15570 (variable_initializer): Implement. We make it a list of expressions
15571 essentially so that we can handle the array_initializer case neatly too.
15572 (variable_initializer_list): Implement.
15573 (array_initializer): Make it a list of variable_initializers
15574 (opt_array_initializer): Modify accordingly.
15576 * expression.cs (New::NType): Add enumeration to help us
15577 keep track of whether we have an object/delegate creation
15578 or an array creation.
15579 (New:NewType, New::Rank, New::Indices, New::Initializers): New
15580 members to hold data about array creation.
15581 (New:New): Modify to update NewType
15582 (New:New): New Overloaded contructor for the array creation
15585 * cs-parser.jay (array_creation_expression): Implement to call
15586 the overloaded New constructor.
15588 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
15590 * class.cs (TypeContainer::Constructors): Return member
15591 constructors instead of returning null.
15593 2001-08-26 Miguel de Icaza <miguel@ximian.com>
15595 * typemanager.cs (InitCoreTypes): Initialize the various core
15596 types after we have populated the type manager with the user
15597 defined types (this distinction will be important later while
15598 compiling corlib.dll)
15600 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
15601 on Expression Classification. Now all expressions have a method
15602 `Resolve' and a method `Emit'.
15604 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
15605 generation from working. Also add some temporary debugging
15608 2001-08-24 Miguel de Icaza <miguel@ximian.com>
15610 * codegen.cs: Lots of code generation pieces. This is only the
15611 beginning, will continue tomorrow with more touches of polish. We
15612 handle the fundamentals of if, while, do, for, return. Others are
15613 trickier and I need to start working on invocations soon.
15615 * gen-treedump.cs: Bug fix, use s.Increment here instead of
15618 * codegen.cs (EmitContext): New struct, used during code
15619 emission to keep a context. Most of the code generation will be
15622 * cs-parser.jay: Add embedded blocks to the list of statements of
15623 this block. So code generation proceeds in a top down fashion.
15625 2001-08-23 Miguel de Icaza <miguel@ximian.com>
15627 * statement.cs: Add support for multiple child blocks.
15629 2001-08-22 Miguel de Icaza <miguel@ximian.com>
15631 * codegen.cs (EmitCode): New function, will emit the code for a
15632 Block of code given a TypeContainer and its ILGenerator.
15634 * statement.cs (Block): Standard public readonly optimization.
15635 (Block::Block constructors): Link children.
15636 (Block::Child): Child Linker.
15637 (Block::EmitVariables): Emits IL variable declarations.
15639 * class.cs: Drop support for MethodGroups here, delay until
15641 (Method::): Applied the same simplification that I did before, and
15642 move from Properties to public readonly fields.
15643 (Method::ParameterTypes): Returns the parameter types for the
15644 function, and implements a cache that will be useful later when I
15645 do error checking and the semantic analysis on the methods is
15647 (Constructor::GetCallingConvention): Renamed from CallingConvetion
15648 and made a method, optional argument tells whether this is a class
15649 or a structure to apply the `has-this' bit.
15650 (Method::GetCallingConvention): Implement, returns the calling
15652 (Method::Define): Defines the type, a second pass is performed
15653 later to populate the methods.
15655 (Constructor::ParameterTypes): implement a cache similar to the
15656 one on Method::ParameterTypes, useful later when we do semantic
15659 (TypeContainer::EmitMethod): New method. Emits methods.
15661 * expression.cs: Removed MethodGroup class from here.
15663 * parameter.cs (Parameters::GetCallingConvention): new method.
15665 2001-08-21 Miguel de Icaza <miguel@ximian.com>
15667 * class.cs (TypeContainer::Populate): Drop RootContext from the
15670 (Constructor::CallingConvention): Returns the calling convention.
15671 (Constructor::ParameterTypes): Returns the constructor parameter
15674 (TypeContainer::AddConstructor): Keep track of default constructor
15675 and the default static constructor.
15677 (Constructor::) Another class that starts using `public readonly'
15678 instead of properties.
15680 (Constructor::IsDefault): Whether this is a default constructor.
15682 (Field::) use readonly public fields instead of properties also.
15684 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
15685 track of static constructors; If none is used, turn on
15686 BeforeFieldInit in the TypeAttributes.
15688 * cs-parser.jay (opt_argument_list): now the return can be null
15689 for the cases where there are no arguments.
15691 (constructor_declarator): If there is no implicit `base' or
15692 `this', then invoke the default parent constructor.
15694 * modifiers.cs (MethodAttr): New static function maps a set of
15695 modifiers flags into a MethodAttributes enum
15696 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
15697 MethodAttr, TypeAttr to represent the various mappings where the
15698 modifiers are used.
15699 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
15701 2001-08-19 Miguel de Icaza <miguel@ximian.com>
15703 * parameter.cs (GetParameterInfo): Fix bug where there would be no
15706 * interface.cs (PopulateIndexer): Implemented the code generator
15707 for interface indexers.
15709 2001-08-17 Miguel de Icaza <miguel@ximian.com>
15711 * interface.cs (InterfaceMemberBase): Now we track the new status
15714 (PopulateProperty): Implement property population. Woohoo! Got
15715 Methods and Properties going today.
15717 Removed all the properties for interfaces, and replaced them with
15718 `public readonly' fields.
15720 2001-08-16 Miguel de Icaza <miguel@ximian.com>
15722 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
15723 initialize their hashtables/arraylists only when they are needed
15724 instead of doing this always.
15726 * parameter.cs: Handle refs and out parameters.
15728 * cs-parser.jay: Use an ArrayList to construct the arguments
15729 instead of the ParameterCollection, and then cast that to a
15732 * parameter.cs: Drop the use of ParameterCollection and use
15733 instead arrays of Parameters.
15735 (GetParameterInfo): Use the Type, not the Name when resolving
15738 2001-08-13 Miguel de Icaza <miguel@ximian.com>
15740 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
15741 and instead use public readonly fields.
15743 * class.cs: Put back walking code for type containers.
15745 2001-08-11 Miguel de Icaza <miguel@ximian.com>
15747 * class.cs (MakeConstant): Code to define constants.
15749 * rootcontext.cs (LookupType): New function. Used to locate types
15752 2001-08-08 Miguel de Icaza <miguel@ximian.com>
15754 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
15755 this System.Reflection code is. Kudos to Microsoft
15757 * typemanager.cs: Implement a type cache and avoid loading all
15758 types at boot time. Wrap in LookupType the internals. This made
15759 the compiler so much faster. Wow. I rule!
15761 * driver.cs: Make sure we always load mscorlib first (for
15762 debugging purposes, nothing really important).
15764 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
15765 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
15767 * rootcontext.cs: Lookup types on their namespace; Lookup types
15768 on namespaces that have been imported using the `using' keyword.
15770 * class.cs (TypeContainer::TypeAttr): Virtualize.
15771 (Class::TypeAttr): Return attributes suitable for this bad boy.
15772 (Struct::TypeAttr): ditto.
15773 Handle nested classes.
15774 (TypeContainer::) Remove all the type visiting code, it is now
15775 replaced with the rootcontext.cs code
15777 * rootcontext.cs (GetClassBases): Added support for structs.
15779 2001-08-06 Miguel de Icaza <miguel@ximian.com>
15781 * interface.cs, statement.cs, class.cs, parameter.cs,
15782 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
15783 Drop use of TypeRefs, and use strings instead.
15785 2001-08-04 Miguel de Icaza <miguel@ximian.com>
15789 * class.cs (Struct::Struct): set the SEALED flags after
15790 checking the modifiers.
15791 (TypeContainer::TypeAttr): new property, returns the
15792 TypeAttributes for a class.
15794 * cs-parser.jay (type_list): Oops, list production was creating a
15795 new list of base types.
15797 * rootcontext.cs (StdLib): New property.
15798 (GetInterfaceTypeByName): returns an interface by type name, and
15799 encapsulates error handling here.
15800 (GetInterfaces): simplified.
15801 (ResolveTree): Encapsulated all the tree resolution here.
15802 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
15805 * driver.cs: Add support for --nostdlib, to avoid loading the
15806 default assemblies.
15807 (Main): Do not put tree resolution here.
15809 * rootcontext.cs: Beginning of the class resolution.
15811 2001-08-03 Miguel de Icaza <miguel@ximian.com>
15813 * rootcontext.cs: Provide better error reporting.
15815 * cs-parser.jay (interface_base): set our $$ to be interfaces.
15817 * rootcontext.cs (CreateInterface): Handle the case where there
15818 are no parent interfaces.
15820 (CloseTypes): Routine to flush types at the end.
15821 (CreateInterface): Track types.
15822 (GetInterfaces): Returns an array of Types from the list of
15823 defined interfaces.
15825 * typemanager.c (AddUserType): Mechanism to track user types (puts
15826 the type on the global type hash, and allows us to close it at the
15829 2001-08-02 Miguel de Icaza <miguel@ximian.com>
15831 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
15832 RecordInterface instead.
15834 * cs-parser.jay: Updated to reflect changes above.
15836 * decl.cs (Definition): Keep track of the TypeBuilder type that
15837 represents this type here. Not sure we will use it in the long
15838 run, but wont hurt for now.
15840 * driver.cs: Smaller changes to accomodate the new code.
15842 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
15845 * rootcontext.cs (CreateInterface): New method, used to create
15846 the System.TypeBuilder type for interfaces.
15847 (ResolveInterfaces): new entry point to resolve the interface
15849 (CodeGen): Property, used to keep track of the code generator.
15851 2001-07-26 Miguel de Icaza <miguel@ximian.com>
15853 * cs-parser.jay: Add a second production for delegate_declaration
15856 (enum_body): Put an opt_comma here instead of putting it on
15857 enum_body or enum_member_declarations so we can handle trailing
15858 commas on enumeration members. Gets rid of a shift/reduce.
15860 (type_list): Need a COMMA in the middle.
15862 (indexer_declaration): Tell tokenizer to recognize get/set
15864 * Remove old targets.
15866 * Re-add the parser target.
15868 2001-07-13 Simon Cozens <simon@simon-cozens.org>
15870 * cs-parser.jay: Add precendence rules for a number of operators
15871 ot reduce the number of shift/reduce conflicts in the grammar.
15873 2001-07-17 Miguel de Icaza <miguel@ximian.com>
15875 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
15878 Get rid of old crufty code.
15880 * rootcontext.cs: Use this to keep track of the parsed
15881 representation and the defined types available to the program.
15883 * gen-treedump.cs: adjust for new convention.
15885 * type.cs: Split out the type manager, and the assembly builder
15888 * typemanager.cs: the type manager will live here now.
15890 * cil-codegen.cs: And the code generator here.
15892 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
15894 * makefile: Fixed up for easy making.
15896 2001-07-13 Simon Cozens <simon@simon-cozens.org>
15898 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
15901 (unary_expression): Expand pre_increment_expression and
15902 post_decrement_expression to reduce a shift/reduce.
15904 2001-07-11 Simon Cozens
15906 * cs-tokenizer.cs: Hex numbers should begin with a 0.
15908 Improve allow_keyword_as_indent name.
15910 2001-06-19 Miguel de Icaza <miguel@ximian.com>
15912 * Adjustments for Beta2.
15914 2001-06-13 Miguel de Icaza <miguel@ximian.com>
15916 * decl.cs: Added `Define' abstract method.
15917 (InTransit): new property, used to catch recursive definitions.
15919 * interface.cs: Implement `Define'.
15921 * modifiers.cs: Map Modifiers.constants to
15922 System.Reflection.TypeAttribute flags.
15924 * class.cs: Keep track of types and user-defined types.
15925 (BuilderInit): New method for creating an assembly
15926 (ResolveType): New function to launch the resolution process, only
15927 used by interfaces for now.
15929 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
15930 that are inserted into the name space.
15932 2001-06-08 Miguel de Icaza <miguel@ximian.com>
15934 * ARGH. I have screwed up my tree so many times due to the use of
15935 rsync rather than using CVS. Going to fix this at once.
15937 * driver.cs: Objetify driver. Load assemblies, use assemblies to
15940 2001-06-07 Miguel de Icaza <miguel@ximian.com>
15942 * Experiment successful: Use System.Type rather that our own
15945 2001-05-25 Miguel de Icaza <miguel@ximian.com>
15947 * cs-parser.jay: Removed nsAliases from here.
15949 Use new namespaces, handle `using XXX;'
15951 * namespace.cs: Reimplemented namespace handling, use a recursive
15952 definition of the class. Now we can keep track of using clauses
15953 and catch invalid using clauses.
15955 2001-05-24 Miguel de Icaza <miguel@ximian.com>
15957 * gen-treedump.cs: Adapted for all the renaming.
15959 * expression.cs (Expression): this class now has a Type property
15960 which returns an expression Type.
15962 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
15963 `Type', as this has a different meaning now in the base
15965 2001-05-22 Miguel de Icaza <miguel@ximian.com>
15967 * interface.cs, class.cs: Removed from all the sources the
15968 references to signature computation, as we can not do method
15969 signature computation during the parsing time, as we are not
15970 trying to solve at that point distinguishing:
15974 void a (NS.Blah x) {}
15977 Which depending on the context might be valid or not, as we do not
15978 know if Blah is the same thing as NS.Blah at that point.
15980 * Redid everything so the code uses TypeRefs now instead of
15981 Types. TypeRefs are just temporary type placeholders, that need
15982 to be resolved. They initially have a pointer to a string and the
15983 current scope in which they are used. This is used later by the
15984 compiler to resolve the reference to an actual Type.
15986 * DeclSpace is no longer a CIR.Type, and neither are
15987 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
15988 are all DeclSpaces, but no Types.
15990 * type.cs (TypeRefManager): This implements the TypeRef manager,
15991 which keeps track of all the types that need to be resolved after
15992 the parsing has finished.
15994 2001-05-13 Miguel de Icaza <miguel@ximian.com>
15996 * ARGH. We are going to have to store `foreach' as a class rather
15997 than resolving it, as we need to verify error 1579 after name
15998 resolution. *OR* we could keep a flag that says `This request to
15999 IEnumerator comes from a foreach statement' which we can then use
16000 to generate the error.
16002 2001-05-10 Miguel de Icaza <miguel@ximian.com>
16004 * class.cs (TypeContainer.AddMethod): we now add methods to the
16005 MethodGroup instead of the method hashtable.
16007 * expression.cs: Add MethodGroup abstraction, which gets us one
16008 step closer to the specification in the way we handle method
16011 * cs-parser.jay (primary_expression): qualified_identifier now
16012 tried to match up an identifier to a local variable reference or
16013 to a parameter reference.
16015 current_local_parameters is now a parser global variable that
16016 points to the current parameters for the block, used during name
16019 (property_declaration): Now creates an implicit `value' argument to
16022 2001-05-09 Miguel de Icaza <miguel@ximian.com>
16024 * parameter.cs: Do not use `param' arguments as part of the
16025 signature, per the spec.
16027 2001-05-08 Miguel de Icaza <miguel@ximian.com>
16029 * decl.cs: Base class for classes, structs and interfaces. This
16030 is the "Declaration Space"
16032 * cs-parser.jay: Use CheckDef for checking declaration errors
16033 instead of having one on each function.
16035 * class.cs: Factor out some code for handling error handling in
16036 accordance to the "Declarations" section in the "Basic Concepts"
16037 chapter in the ECMA C# spec.
16039 * interface.cs: Make all interface member classes derive from
16040 InterfaceMemberBase.
16042 2001-05-07 Miguel de Icaza <miguel@ximian.com>
16044 * Many things: all interfaces are parsed and generated in
16045 gen-treedump. Support for member variables, constructors,
16046 destructors, properties, constants is there.
16048 Beginning of the IL backend, but very little done, just there for
16051 2001-04-29 Miguel de Icaza <miguel@ximian.com>
16053 * cs-parser.jay: Fix labeled statement.
16055 * cs-tokenizer.cs (escape): Escape " and ' always.
16056 ref_line, ref_name: keep track of the line/filename as instructed
16057 by #line by the compiler.
16060 2001-04-27 Miguel de Icaza <miguel@ximian.com>
16062 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
16063 to match the values in System.CodeDOM.
16065 Divid renamed to Divide.
16067 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
16069 (Statements.set): remove.
16071 * System.CodeDOM/CodeCatchClause.cs: always have a valid
16074 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
16075 falseStatements always have valid values.
16077 * cs-parser.jay: Use System.CodeDOM now.