1 2004-10-24 Marek Safar <marek.safar@seznam.cz>
3 Fixed bugs #63705, #67130
4 * decl.cs (MemberCache.MemberCache): Add parameter to distinguish
5 imported and defined interfaces.
6 (CacheEntry, EntryType): Changed to protected internal.
8 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
11 * typemanager.cs (LookupInterfaceContainer): New method.
12 Fills member container from base interfaces.
14 2004-10-20 Marek Safar <marek.safar@seznam.cz>
16 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
18 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
20 2004-10-18 Martin Baulig <martin@ximian.com>
22 Merged latest changes into gmcs. Please keep this comment in
23 here, it makes it easier for me to see what changed in MCS since
24 the last time I merged.
26 2004-10-18 Martin Baulig <martin@ximian.com>
28 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
29 `Type' directly, but call ResolveType() on it.
30 (Catch.Resolve): Likewise.
31 (Foreach.Resolve): Likewise.
33 2004-10-18 Martin Baulig <martin@ximian.com>
35 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
36 `Type' directly, but call ResolveType() on it.
37 (Probe.DoResolve): Likewise.
38 (ArrayCreation.LookupType): Likewise.
39 (TypeOf.DoResolve): Likewise.
40 (SizeOf.DoResolve): Likewise.
42 2004-10-18 Martin Baulig <martin@ximian.com>
44 * expression.cs (Invocation.BetterFunction): Put back
45 TypeManager.TypeToCoreType().
47 2004-10-18 Raja R Harinath <rharinath@novell.com>
49 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
52 2004-10-18 Martin Baulig <martin@ximian.com>
54 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
55 `Type' directly, but call ResolveType() on it.
57 2004-10-18 Martin Baulig <martin@ximian.com>
59 * class.cs (FieldMember.Define): Don't access the TypeExpr's
60 `Type' directly, but call ResolveType() on it.
61 (MemberBase.DoDefine): Likewise.
63 * expression.cs (New.DoResolve): Don't access the TypeExpr's
64 `Type' directly, but call ResolveType() on it.
65 (ComposedCast.DoResolveAsTypeStep): Likewise.
67 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
68 `Type' directly, but call ResolveType() on it.
70 2004-10-17 John Luke <john.luke@gmail.com>
72 * class.cs (Operator.GetSignatureForError): use CSharpName
74 * parameter.cs (Parameter.GetSignatureForError): Returns
75 correct name even if was not defined.
77 2004-10-13 Raja R Harinath <rharinath@novell.com>
80 * class.cs (TypeContainer.EmitContext): New property.
81 (DefineNestedTypes): Create an emitcontext for each part.
82 (MethodCore.DoDefineParameters): Use container's emitcontext.
83 Pass type array to InternalParameters.
84 (MemberBase.DoDefine): Use container's emitcontext.
85 (FieldMember.Define): Likewise.
86 (Event.Define): Likewise.
87 (SetMethod.GetParameterInfo): Change argument to EmitContext.
88 Pass type array to InternalParameters.
89 (SetIndexerMethod.GetParameterInfo): Likewise.
90 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
91 * delegate.cs (Define): Pass emitcontext to
92 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
93 array to InternalParameters.
94 * expression.cs (ParameterReference.DoResolveBase): Pass
95 emitcontext to GetParameterInfo.
96 (ComposedCast.DoResolveAsTypeStep): Remove check on
98 * parameter.cs (Parameter.Resolve): Change argument to
99 EmitContext. Use ResolveAsTypeTerminal.
100 (Parameter.GetSignature): Change argument to EmitContext.
101 (Parameters.ComputeSignature): Likewise.
102 (Parameters.ComputeParameterTypes): Likewise.
103 (Parameters.GetParameterInfo): Likewise.
104 (Parameters.ComputeAndDefineParameterTypes): Likewise.
105 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
106 * support.cs (InternalParameters..ctor): Remove variant that takes
108 * typemanager.cs (system_intptr_expr): New.
109 (InitExpressionTypes): Initialize it.
111 2004-10-12 Chris Toshok <toshok@ximian.com>
113 * cs-parser.jay: fix location for try_statement and catch_clause.
115 2004-10-11 Martin Baulig <martin@ximian.com>
117 * report.cs: Don't make --fatal abort on warnings, we have
118 -warnaserror for that.
120 2004-10-07 Raja R Harinath <rharinath@novell.com>
122 More DeclSpace.ResolveType avoidance.
123 * decl.cs (MemberCore.InUnsafe): New property.
124 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
125 with newly created EmitContext.
126 (FieldMember.Define): Likewise.
127 * delegate.cs (Delegate.Define): Likewise.
128 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
129 only if normal name-lookup fails.
130 (TypeExpr.DoResolve): Enable error-checking.
131 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
132 (SizeOf.DoResolve): Likewise.
133 (ComposedCast.DoResolveAsTypeStep): Likewise.
134 (StackAlloc.DoResolve): Likewise.
135 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
136 (Block.Unsafe): New property.
137 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
138 (Unsafe): Set 'unsafe' flag of contained block.
139 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
140 (Fixed.Resolve): Likewise.
141 (Catch.Resolve): Likewise.
142 (Using.ResolveLocalVariableDecls): Likewise.
143 (Foreach.Resolve): Likewise.
145 2004-10-05 John Luke <john.luke@gmail.com>
147 * cs-parser.jay: add location to error CS0175
149 2004-10-04 Miguel de Icaza <miguel@ximian.com>
151 * ecore.cs (Expression.Constantity): Add support for turning null
154 * const.cs (Const.Define): Allow constants to be reference types
155 as long as the value is Null.
157 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
159 * namespace.cs (NamespaceEntry.Using): No matter which warning
160 level is set, check if this namespace name has already been added.
162 2004-10-03 Ben Maurer <bmaurer@ximian.com>
164 * expression.cs: reftype [!=]= null should always use br[true,false].
167 2004-10-03 Marek Safar <marek.safar@seznam.cz>
170 * attribute.cs: Enum conversion moved to
171 GetAttributeArgumentExpression to be applied to the all
174 2004-10-01 Raja R Harinath <rharinath@novell.com>
176 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
177 * class.c (TypeContainer.DefineType): Flag error if
178 base types aren't accessible due to access permissions.
179 * decl.cs (DeclSpace.ResolveType): Move logic to
180 Expression.ResolveAsTypeTerminal.
181 (DeclSpace.ResolveTypeExpr): Thin layer over
182 Expression.ResolveAsTypeTerminal.
183 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
184 Refactor code into NestedAccess. Use it.
185 (DeclSpace.NestedAccess): New.
186 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
187 argument to silence errors. Check access permissions.
188 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
189 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
190 (Cast.DoResolve): Likewise.
191 (New.DoResolve): Likewise.
192 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
193 (TypeOf.DoResolve): Likewise.
195 * expression.cs (Invocation.BetterConversion): Return the Type of
196 the better conversion. Implement section 14.4.2.3 more faithfully.
197 (Invocation.BetterFunction): Make boolean. Make correspondence to
198 section 14.4.2.2 explicit.
199 (Invocation.OverloadResolve): Update.
200 (Invocation): Remove is_base field.
201 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
202 (Invocation.Emit): Likewise.
204 2004-09-27 Raja R Harinath <rharinath@novell.com>
206 * README: Update to changes.
208 2004-09-24 Marek Safar <marek.safar@seznam.cz>
210 * cs-parser.jay: Reverted 642 warning fix.
212 2004-09-23 Marek Safar <marek.safar@seznam.cz>
215 * decl.cs (FindMemberWithSameName): Indexer can have more than
218 2004-09-23 Marek Safar <marek.safar@seznam.cz>
220 * expression.cs (LocalVariableReference.DoResolveLValue):
221 Do not report warning 219 for out values.
222 (EmptyExpression.Null): New member to avoid extra allocations.
224 2004-09-23 Marek Safar <marek.safar@seznam.cz>
226 * cs-parser.jay: Fix wrong warning 642 report.
228 * cs-tokenizer.cs (CheckNextToken): New helper;
229 Inspect next character if is same as expected.
231 2004-09-23 Martin Baulig <martin@ximian.com>
233 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
234 (Convert.ImplicitReferenceConversionExists): Likewise.
236 2004-09-23 Marek Safar <marek.safar@seznam.cz>
238 * class.cs (Operator.Define): Add error 448 and 559 report.
240 2004-09-22 Marek Safar <marek.safar@seznam.cz>
242 * class.cs (MemberBase.IsTypePermitted): New protected
243 method for checking error CS0610.
245 2004-09-22 Marek Safar <marek.safar@seznam.cz>
247 * class.cs (TypeContainer.HasExplicitLayout): New property
248 Returns whether container has StructLayout attribute set Explicit.
249 (FieldMember): New abstract class for consts and fields.
250 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
251 (Field): Reuse FieldMember.
253 * const.cs (Const): Reuse FieldMember.
255 * rootcontext.cs: EmitConstants call moved to class.
257 2004-09-22 Martin Baulig <martin@ximian.com>
259 Thanks to Peter Sestoft for this bug report.
261 * expression.cs (Conditional): If both the `trueExpr' and the
262 `falseExpr' is a NullLiteral, return a NullLiteral.
264 2004-09-22 Martin Baulig <martin@ximian.com>
266 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
267 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
268 for the "get_Current" call.
270 2004-09-22 Martin Baulig <martin@ximian.com>
272 Marek and me just fixed one of our oldest bugs: #28562 :-)
274 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
276 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
277 we're an EnumConstant, just return that.
278 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
279 an EnumConstant. In this case, we need to use GetValueAsEnumType()
280 to get the value which'll actually be written into the attribute.
281 However, we have to use GetValue() to access the attribute's value
284 2004-09-22 Marek Safar <marek.safar@seznam.cz>
286 * constant.cs (Constant.IsNegative): New abstract property
289 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
290 (StackAlloc.DoResolve): Reused IsNegative.
292 2004-09-21 Martin Baulig <martin@ximian.com>
294 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
295 if we're used in an iterator, we may be called from different
298 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
299 we actually have an exception block.
301 2004-09-20 John Luke <jluke@cfl.rr.com>
303 * class.cs, cs-parser.jay: Improve the error report for 1520:
304 report the actual line where the error happens, not where the
307 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
308 Pass location information that was available elsewhere.
310 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
312 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
313 runtime to delay sign assemblies.
315 2004-09-19 Miguel de Icaza <miguel@ximian.com>
317 * cs-parser.jay: Do not report the stack trace, this is barely
320 2004-08-22 John Luke <john.luke@gmail.com>
322 * driver.cs : check that a resource id is not already used
323 before adding it, report CS1508 if it is, bug #63637
325 2004-09-19 Miguel de Icaza <miguel@ximian.com>
327 * ecore.cs: Removed dead code.
329 2004-09-18 Marek Safar <marek.safar@seznam.cz>
331 * class.cs: Do not report warning CS0067 on the interfaces.
333 2004-09-16 Marek Safar <marek.safar@seznam.cz>
335 * cs-parser.jay: Add error 504 report.
337 2004-09-16 Marek Safar <marek.safar@seznam.cz>
339 * rootcontext.cs: WarningLevel is 4 by default now.
341 * statement.cs (Fixed.Resolve): Do not null
344 2004-09-16 Marek Safar <marek.safar@seznam.cz>
347 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
348 deep search when property is not virtual.
349 (PropertyExpr.ResolveAccessors): Make one call for both
352 2004-09-15 Marek Safar <marek.safar@seznam.cz>
355 * statement.cs: Error 152 report constains also location.
357 2004-09-15 Marek Safar <marek.safar@seznam.cz>
360 * const.cs: Explicitly set constant as static.
362 2004-09-15 Marek Safar <marek.safar@seznam.cz>
365 * cs-parser.jay: Add error 1017 report.
367 2004-09-15 Marek Safar <marek.safar@seznam.cz>
369 Fixed bug #59980, #64224
370 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
372 * typemanager.cs (IsSpecialMethod): Simplified
374 2004-09-14 Marek Safar <marek.safar@seznam.cz>
376 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
377 condition with better params.
379 2004-09-14 Marek Safar <marek.safar@seznam.cz>
382 * attribute.cs (Resolve): Property has to have both
385 2004-09-14 Martin Baulig <martin@ximian.com>
387 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
389 2004-09-14 Marek Safar <marek.safar@seznam.cz>
392 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
393 called and is obsolete then this member suppress message
394 when call is inside next [Obsolete] method or type.
396 * expression.cs: Use TestObsoleteMethodUsage member.
398 2004-09-14 Martin Baulig <martin@ximian.com>
400 * cs-parser.jay: Sync a bit with the GMCS version.
402 2004-09-14 Martin Baulig <martin@ximian.com>
404 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
405 (CSharpParser.yacc_verbose_flag): New public field.
407 * genericparser.cs: Removed.
409 2004-09-14 Raja R Harinath <rharinath@novell.com>
411 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
413 2004-09-13 Marek Safar <marek.safar@seznam.cz>
415 * class.cs (MethodCore.CheckBase): Fix bug #65757.
417 2004-09-10 Martin Baulig <martin@ximian.com>
419 Backported my MemberName changes from GMCS into MCS.
421 - we are now using a special `MemberName' class instead of using
422 strings; in GMCS, the `MemberName' also contains the type
425 - changed the grammar rules a bit:
426 * the old `member_name' is now a `namespace_or_type_name':
427 The rule is that we use `namespace_or_type_name' everywhere
428 where we expect either a "member name" (GetEnumerator) or a
429 "member name" with an explicit interface name
430 (IEnumerable.GetEnumerator).
431 In GMCS, the explicit interface name may include type arguments
432 (IEnumerable<T>.GetEnumerator).
433 * we use `member_name' instead of just `IDENTIFIER' for
435 The rule is that we use `member_name' wherever a member may
436 have type parameters in GMCS.
438 * decl.cs (MemberName): New public class.
439 (MemberCore.MemberName): New public readonly field.
440 (MemberCore.ctor): Take a `MemberName' argument, not a string.
441 (DeclSpace): Likewise.
443 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
444 * enum.cs (Enum.ctor): Likewise.
446 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
448 (AliasEntry.ctor): Take a MemberName, not an Expression.
449 (AliasEntry.UsingAlias): Likewise.
451 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
452 (IMethodData.MemberName): Changed type from string to MemberName.
453 (MemberBase.ExplicitInterfaceName): Likewise.
454 (AbstractPropertyEventMethod.SetupName): Make this private.
455 (AbstractPropertyEventMethod.ctor): Added `string prefix'
456 argument; compute the member name here.
457 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
458 on the `member.MemberName' and the `prefix'.
460 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
462 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
463 thus, we get a `MemberName' instead of a `string'. These
464 declarations may have type parameters in GMCS.
465 (interface_method_declaration, delegate_declaration): Likewise.
466 (class_declaration, interface_declaration): Likewise.
467 (method_header): Use `namespace_or_type_name' instead of
468 `member_name'. We may be an explicit interface implementation.
469 (property_declaration, event_declaration): Likewise.
470 (member_name): This is now just an `IDENTIFIER', not a
471 `namespace_or_type_name'.
472 (type_name, interface_type): Removed.
473 (namespace_or_type_name): Return a MemberName, not an Expression.
474 (primary_expression): Use `member_name' instead of `IDENTIFIER';
475 call GetTypeExpression() on the MemberName to get an expression.
476 (IndexerDeclaration.interface_type): Changed type from string to
478 (MakeName): Operate on MemberName's instead of string's.
480 2004-09-13 Raja R Harinath <rharinath@novell.com>
483 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
484 (NamespaceEntry.Lookup): Add new argument to flag if we want the
485 lookup to avoid symbols introduced by 'using'.
486 * rootcontext.cs (NamespaceLookup): Update.
488 2004-09-12 Marek Safar <marek.safar@seznam.cz>
490 * class.cs (TypeContainer.DoDefineMembers): Do not call
491 DefineDefaultConstructor for static classes.
493 2004-09-12 Marek Safar <marek.safar@seznam.cz>
495 * attribute.cs (Attribute.Resolve): Add error 653 report.
497 * class.cs (Class.ApplyAttributeBuilder): Add error 641
499 (Method.ApplyAttributeBuilder): Add error 685 report.
500 (Operator.Define): Add error 564 report.
502 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
504 * expression.cs (Invocation.DoResolve): Add error
507 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
510 2004-09-11 Marek Safar <marek.safar@seznam.cz>
512 * class.cs (ConstructorInitializer.Resolve):
513 Wrong error number (515->516).
515 2004-09-11 Marek Safar <marek.safar@seznam.cz>
517 * class.cs (Indexer.Define): Add error 631 report.
519 2004-09-11 Marek Safar <marek.safar@seznam.cz>
521 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
523 2004-09-11 Marek Safar <marek.safar@seznam.cz>
525 * expression.cs (Probe.DoResolve): Add error CS0241 report.
527 2004-09-10 Marek Safar <marek.safar@seznam.cz>
529 * cs-parser.jay: Added error CS0241 report.
531 2004-09-10 Raja R Harinath <rharinath@novell.com>
533 * cs-parser.jay (fixed_statement): Introduce a scope for the
534 declaration in the 'fixed' statement.
536 2004-09-09 Marek Safar <marek.safar@seznam.cz>
538 * cs-parser.jay: Added CS0230 error report.
540 2004-09-09 Marek Safar <marek.safar@seznam.cz>
542 * cs-parser.jay: Added errors CS0231 and CS0257 report.
544 2004-09-09 Marek Safar <marek.safar@seznam.cz>
546 * expression.cs (Argument.Resolve): Added error CS0192 and
549 2004-09-09 Marek Safar <marek.safar@seznam.cz>
551 C# 2.0 #pragma warning feature
553 * cs-tokenizer.cs (PreProcessPragma): New method;
554 Handles #pragma directive.
556 * report.cs (WarningRegions): New class; Support
557 class for #pragma warning directive. It tests whether
558 warning is enabled for a given line.
560 2004-09-08 Miguel de Icaza <miguel@ximian.com>
562 * const.cs: Add more descriptive error report, tahnks to
565 2004-09-08 Marek Safar <marek.safar@seznam.cz>
567 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
569 2004-09-07 Miguel de Icaza <miguel@ximian.com>
571 * expression.cs: Apply patch from Ben: Remove dead code from
572 ArrayCreation, and remove the TurnintoConstant call in const.cs,
573 as that code just threw an exception anwyays.
575 * const.cs: Remove the call to the turnintoconstant, for details
578 * literal.cs: The type of the null-literal is the null type; So
579 we use a placeholder type (literal.cs:System.Null, defined here)
582 * expression.cs (Conditional.DoResolve): Remove some old code that
583 is no longer needed, conversions have been fixed.
585 (ArrayCreationExpression.DoResolve): Return false if we fail to
586 resolve the inner expression.
588 2004-09-07 Raja R Harinath <rharinath@novell.com>
591 * cs-parser.jay (delegate_declaration): Record a delegate
592 declaration as a type declaration.
593 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
595 2004-09-06 Miguel de Icaza <miguel@ximian.com>
597 * parameter.cs: Do not crash if the type can not be resolved.
599 * expression.cs: Report errors with unsafe pointers, fixes #64896
601 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
603 * expression.cs: Pointer arith always needs to do a conv.i
604 if the operand is a long. fix 65320
606 2004-09-04 Marek Safar <marek.safar@seznam.cz>
608 Fixed cs0619-37.cs, cs0619-38.cs
610 * enum.cs (GetObsoleteAttribute): Removed.
612 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
613 on Enum member is double staged. The first is tested member
616 2004-09-04 Marek Safar <marek.safar@seznam.cz>
618 Fixed #56986, #63631, #65231
620 * class.cs: (TypeContainer.AddToMemberContainer): New method,
621 adds member to name container.
622 (TypeContainer.AddToTypeContainer): New method, adds type to
624 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
625 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
626 AddOperator): Simplified by reusing AddToMemberContainer.
627 (TypeContainer.UserDefinedStaticConstructor): Changed to property
629 (Method.CheckForDuplications): Fixed implementation to test all
631 (MemberBase): Detection whether member is explicit interface
632 implementation is now in constructor.
633 (MemberBase.UpdateMemberName): Handles IndexerName.
634 (Accessor): Changed to keep also location information.
635 (AbstractPropertyEventMethod): Is derived from MemberCore.
636 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
637 will be emited or not.
638 (PropertyBase.AreAccessorsDuplicateImplementation):
639 Tests whether accessors are not in collision with some method.
640 (Operator): Is derived from MethodCore to simplify common
643 * decl.cs (Flags.TestMethodDuplication): Test for duplication
645 (DeclSpace.AddToContainer): Adds the member to defined_names
646 table. It tests for duplications and enclosing name conflicts.
648 * enum.cs (EnumMember): Clean up to reuse the base structures
650 2004-09-03 Martin Baulig <martin@ximian.com>
652 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
653 into TypeContainer, to make partial classes work again.
655 2004-09-03 Martin Baulig <martin@ximian.com>
657 * rootcontext.cs (RootContext.V2): Removed.
659 2004-03-23 Martin Baulig <martin@ximian.com>
661 * expression.cs (Invocation.OverloadResolve): Added `bool
662 may_fail' argument and use it instead of the Location.IsNull() hack.
664 2004-09-03 Martin Baulig <martin@ximian.com>
666 Merged latest changes into gmcs. Please keep this comment in
667 here, it makes it easier for me to see what changed in MCS since
668 the last time I merged.
670 2004-09-03 Raja R Harinath <rharinath@novell.com>
673 * expression.cs (BetterConversion): Don't allow either conversion
674 to be null. Remove redundant implicit conversion test when 'q ==
675 null' -- when this function is invoked, we already know that the
676 implicit conversion exists.
677 (BetterFunction): Assume that 'best' is non-null. Remove
678 redundant reimplementation of IsApplicable when 'best' is null.
679 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
681 (IsAncestralType): Extract from OverloadResolve.
682 (OverloadResolve): Make robust to the MethodGroupExpr being
683 unsorted. Implement all the logic of Section 14.5.5.1, and
684 support overloading of methods from multiple applicable types.
685 Clean up logic somewhat. Don't pass null methods to BetterFunction.
687 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
688 (RealError, Warning): Append type of report to related symbol.
690 2004-09-03 Marek Safar <marek.safar@seznam.cz>
692 * enum.cs: Fixed CLS-Compliance checks for enum members.
693 Error tests cs3008-8.cs, cs3014-8.cs
695 2004-09-02 Marek Safar <marek.safar@seznam.cz>
697 Fixed bug #62342, #63102
698 * class.cs: ImplementIndexer uses member.IsExplicitImpl
699 like ImplementMethod.
701 2004-09-02 Marek Safar <marek.safar@seznam.cz>
703 * attribute.cs (Attribute.GetAttributeArgumentExpression):
706 2004-09-02 Martin Baulig <martin@ximian.com>
708 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
709 TypeManager.GetArgumentTypes() rather than calling GetParameters()
712 2004-09-01 Marek Safar <marek.safar@seznam.cz>
714 C# 2.0 Static classes implemented
716 * class.cs (TypeContainer): instance_constructors,
717 initialized_fields, initialized_static_fields,
718 default_constructor, base_inteface_types are protected to be
719 accessible from StaticClass.
720 (TypeContainer.DefineDefaultConstructor): New virtual method
721 for custom default constructor generating
722 (StaticClass): New class to handle "Static classes" feature.
724 * cs-parser.jay: Handle static keyword on class like instance
727 * driver.cs: Added "/langversion" command line switch with two
728 options (iso-1, default).
730 2004-08-31 Marek Safar <marek.safar@seznam.cz>
732 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
734 2004-08-31 Miguel de Icaza <miguel@ximian.com>
736 * delegate.cs: Style.
738 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
740 * delegate.cs: Add seperate instance expr field for miguel.
742 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
744 * PointerArithmetic (Resolve): make sure we are not doing
745 pointer arith on void*. Also, make sure we are resolved
746 by not setting eclass until resolve.
748 All callers: Make sure that PointerArithmetic gets resolved.
750 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
752 * ArrayCreation (LookupType): If the type does not resolve
753 to an array, give an error.
755 2004-08-27 Marek Safar <marek.safar@seznam.cz>
757 * statement.cs (Try.Resolve): Fixed bug #64222
759 2004-08-27 Martin Baulig <martin@ximian.com>
762 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
765 2004-08-26 Marek Safar <marek.safar@seznam.cz>
767 * ecore.cs (Constantify): Get underlying type via
768 System.Enum.GetUnderlyingType to avoid StackOverflow on the
769 Windows in special cases.
771 2004-08-26 Marek Safar <marek.safar@seznam.cz>
773 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
774 for obtaining also private methods.
775 (GetRemoveMethod): Used GetRemoveMethod (true)
776 for obtaining also private methods.
778 2004-08-24 Martin Baulig <martin@ximian.com>
780 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
781 MethodAttributes.HideBySig for operators.
783 2004-08-23 Martin Baulig <martin@ximian.com>
785 Back to the old error reporting system :-)
787 * report.cs (Message): Removed.
788 (Report.MessageData, ErrorData, WarningData): Removed.
789 (Report.Error, Warning): Back to the old system.
791 2004-08-23 Martin Baulig <martin@ximian.com>
793 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
795 * class.cs (TypeContainer.ParentContainer): New public virtual
796 method; replaces the explicit interface implementation.
797 (ClassPart.ParentContainer): Override.
799 2004-08-23 Martin Baulig <martin@ximian.com>
801 * statement.cs (Switch): Added support for constant switches; see
802 #59428 or test-285.cs.
804 2004-08-22 Marek Safar <marek.safar@seznam.cz>
807 * statement.cs (GetEnumeratorFilter): Removed useless
808 logic because C# specs is strict. GetEnumerator must be
811 2004-08-22 Martin Baulig <martin@ximian.com>
813 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
814 a switch and may break, reset the barrier. Fixes #59867.
816 2004-08-22 Marek Safar <marek.safar@seznam.cz>
818 CLS-Compliance speed up (~5% for corlib)
820 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
821 New method. Tests container for CLS-Compliant names
823 * class.cs (TypeContainer.VerifyClsName): New method.
824 Checks whether container name is CLS Compliant.
825 (Constructor): Implements IMethodData.
827 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
828 low-case table for CLS Compliance test.
829 (MemberCache.VerifyClsParameterConflict): New method.
830 Checks method parameters for CS3006 error.
832 * enum.cs (EnumMember): Is derived from MemberCore.
833 (Enum.VerifyClsName): Optimized for better performance.
835 2004-08-06 Marek Safar <marek.safar@seznam.cz>
837 * report.cs: Renamed Error_T to Error and changed all
840 2004-08-06 Marek Safar <marek.safar@seznam.cz>
842 * class.cs (TypeContainer.IndexerArrayList): New inner class
843 container for indexers.
844 (TypeContainer.DefaultIndexerName): New constant for default
845 indexer name. Replaced all "Item" with this constant.
846 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
848 * typemanager.cs (TypeManager.default_member_ctor): Cache here
849 DefaultMemberAttribute constructor.
851 2004-08-05 Martin Baulig <martin@ximian.com>
853 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
856 2004-08-05 Marek Safar <marek.safar@seznam.cz>
858 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
859 multi platforms problem.
861 * compiler.csproj: Included shared files.
863 2004-08-04 Marek Safar <marek.safar@seznam.cz>
865 Fix bug 60333, 55971 in the more general way
866 * attribute.cs (Attribute.GetAttributeArgumentExpression):
867 Added arg_type argument for constant conversion.
868 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
870 2004-08-04 Marek Safar <marek.safar@seznam.cz>
873 * class.cs (TypeContainer ): New inner classes MethodArrayList,
874 OperatorArrayList, MethodCoreArrayList for typecontainer
875 containers. Changed class member types to these new types.
876 (MethodArrayList.DefineMembers): Added test for CS0659.
878 2004-08-04 Miguel de Icaza <miguel@ximian.com>
880 * cfold.cs: Synchronize the folding with the code in expression.cs
881 Binary.DoNumericPromotions for uint operands.
883 * attribute.cs: Revert patch from Raja, it introduced a regression
884 while building Blam-1.2.1 (hard to isolate a test case).
886 2004-08-04 Marek Safar <marek.safar@seznam.cz>
890 (TypeContainer.Define): Renamed to DefineContainerMembers because of
892 (MethodCore.parent_method): New member. The method we're overriding
893 if this is an override method.
894 (MethodCore.CheckBase): Moved from Method class and made common.
895 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
897 (MethodCore.CheckForDuplications): New abstract method. For custom
898 member duplication search in a container
899 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
900 method and its return type.
901 (Event.conflict_symbol): New member. Symbol with same name in the
905 (MemberCache.FindMemberWithSameName): New method. The method
906 is looking for conflict with inherited symbols.
908 2004-08-04 Martin Baulig <martin@ximian.com>
910 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
912 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
914 2004-08-03 Marek Safar <marek.safar@seznam.cz>
916 * report.cs (Message): New enum for better error, warning reference in
918 (MessageData): New inner abstract class. It generally handles printing of
919 error and warning messages.
920 Removed unused Error, Warning, Message methods.
922 2004-08-03 Marek Safar <marek.safar@seznam.cz>
924 Fix for cs0592-8.cs test
926 (Attributable.ValidAttributeTargets): Made public.
927 (Attribute.ExplicitTarget): New member for explicit target value.
928 (Attribute.CheckTargets): Now we translate explicit attribute
929 target to Target here.
931 2004-08-03 Ben Maurer <bmaurer@ximian.com>
933 * ecore.cs (MethodGroupExpr): new IsBase property.
935 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
937 * delegate.cs (DelegateCreation): store a MethodGroupExpr
938 rather than an instance expr.
940 (DelegateCreation.Emit): Use the method group rather than
941 the instance expression. Also, if you have base.Foo as the
942 method for a delegate, make sure to emit ldftn, not ldftnvirt.
944 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
946 (NewDelegate.DoResolve): Only check for the existance of Invoke
947 if the method is going to be needed. Use MethodGroupExpr.
949 (NewDelegate.Emit): Remove, DelegateCreation implements this.
951 * expression.cs: For pointer arith., make sure to use
952 the size of the type, not the size of the pointer to
955 2004-08-03 Marek Safar <marek.safar@seznam.cz>
958 * class.cs (Class): Added error CS0502 test.
960 2004-08-03 John Luke <jluke@cfl.rr.com>
961 Raja R Harinath <rharinath@novell.com>
964 * attribute.cs (Attribute.complained_before): New flag.
965 (Attribute.ResolveType, Attribute.Resolve),
966 (Attribute.DefinePInvokeMethod): Set it.
967 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
969 2004-08-03 Martin Baulig <martin@ximian.com>
971 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
972 use a user-defined operator; we still need to do numeric
973 promotions in case one argument is a builtin type and the other
974 one has an implicit conversion to that type. Fixes #62322.
976 2004-08-02 Martin Baulig <martin@ximian.com>
978 * statement.cs (LocalInfo.Flags): Added `IsThis'.
979 (LocalInfo.IsThis): New public property.
980 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
982 2004-08-01 Martin Baulig <martin@ximian.com>
984 * class.cs (TypeContainer.GetClassBases): Don't set the default
985 here since we may get called from GetPartialBases().
986 (TypeContainer.DefineType): If GetClassBases() didn't return a
987 parent, use the default one.
989 2004-07-30 Duncan Mak <duncan@ximian.com>
991 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
993 2004-07-30 Martin Baulig <martin@ximian.com>
995 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
997 * class.cs (SourceMethod): New public class, derive from the
998 symbol writer's ISourceMethod.
999 (Method): Use the new symbol writer API.
1001 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
1002 as argument and use the new symbol writer.
1005 (SourceFile): Implement the symbol writer's ISourceFile.
1006 (Location.SymbolDocument): Removed.
1007 (Location.SourceFile): New public property.
1009 * symbolwriter.cs: Use the new symbol writer API.
1011 2004-07-30 Raja R Harinath <rharinath@novell.com>
1013 * Makefile (install-local): Remove. Functionality moved to
1016 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
1018 * Makefile: Install mcs.exe.config file together with mcs.exe.
1019 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
1020 correct runtime version.
1022 2004-07-25 Martin Baulig <martin@ximian.com>
1025 (TypeContainer.RegisterOrder): Removed, this was unused.
1026 (TypeContainer, interface_order): Removed.
1027 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
1028 TypeContainer as argument since we can also be called with a
1029 `PartialContainer' for a partial class/struct/interface.
1030 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
1031 of checking whether we're an `Interface' - we could be a
1033 (PartialContainer.Register): Override; call
1034 AddClass()/AddStruct()/AddInterface() on our parent.
1036 * cs-parser.jay (interface_member_declaration): Add things to the
1037 `current_container', not the `current_class'.
1039 * rootcontext.cs (RegisterOrder): The overloaded version which
1040 takes an `Interface' was unused, removed.
1042 * typemanager.cs (TypeManager.LookupInterface): Return a
1043 `TypeContainer', not an `Interface'.
1044 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
1045 contain a `PartialContainer' for an interface, so check it's
1046 `Kind' to figure out what it is.
1048 2004-07-25 Martin Baulig <martin@ximian.com>
1050 * class.cs (Class.DefaultTypeAttributes): New public constant.
1051 (Struct.DefaultTypeAttributes): Likewise.
1052 (Interface.DefaultTypeAttributes): Likewise.
1053 (PartialContainer.TypeAttr): Override this and add the
1054 DefaultTypeAttributes.
1056 2004-07-25 Martin Baulig <martin@ximian.com>
1058 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
1059 we can just use the `Parent' field instead.
1061 2004-07-25 Martin Baulig <martin@ximian.com>
1063 * class.cs (TypeContainer.Emit): Renamed to EmitType().
1065 2004-07-25 Martin Baulig <martin@ximian.com>
1067 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
1068 our parts before defining any methods.
1069 (TypeContainer.VerifyImplements): Make this virtual.
1070 (ClassPart.VerifyImplements): Override and call VerifyImplements()
1071 on our PartialContainer.
1073 2004-07-25 Martin Baulig <martin@ximian.com>
1075 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
1077 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
1078 argument, we can just use the `Parent' field instead.
1081 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
1082 (MemberBase.DoDefine): Likewise.
1084 2004-07-24 Martin Baulig <martin@ximian.com>
1086 * decl.cs (MemberCore.Parent): New public field.
1087 (DeclSpace.Parent): Moved to MemberCore.
1089 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
1090 (MemberBase.ctor): Added TypeContainer argument, pass it to our
1092 (FieldBase, Field, Operator): Likewise.
1093 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
1094 (EventField, Event): Likewise.
1096 2004-07-23 Martin Baulig <martin@ximian.com>
1098 * class.cs (PartialContainer): New public class.
1099 (ClassPart): New public class.
1100 (TypeContainer): Added support for partial classes.
1101 (TypeContainer.GetClassBases): Splitted some of the functionality
1102 out into GetNormalBases() and GetPartialBases().
1104 * cs-tokenizer.cs (Token.PARTIAL): New token.
1105 (Tokenizer.consume_identifier): Added some hacks to recognize
1106 `partial', but only if it's immediately followed by `class',
1107 `struct' or `interface'.
1109 * cs-parser.jay: Added support for partial clases.
1111 2004-07-23 Martin Baulig <martin@ximian.com>
1113 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
1114 a `DeclSpace' and also made it readonly.
1115 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
1116 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
1117 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
1119 * cs-parser.jay: Pass the `current_class', not the
1120 `current_container' (at the moment, this is still the same thing)
1121 to a new Method, Property, Event, Indexer or Constructor.
1123 2004-07-23 Martin Baulig <martin@ximian.com>
1125 * cs-parser.jay (CSharpParser): Added a new `current_class' field
1126 and removed the `current_interface' one.
1127 (struct_declaration, class_declaration, interface_declaration):
1128 Set `current_class' to the newly created class/struct/interface;
1129 set their `Bases' and call Register() before parsing their body.
1131 2004-07-23 Martin Baulig <martin@ximian.com>
1133 * class.cs (Kind): New public enum.
1134 (TypeContainer): Made this class abstract.
1135 (TypeContainer.Kind): New public readonly field.
1136 (TypeContainer.CheckDef): New public method; moved here from
1138 (TypeContainer.Register): New public abstract method.
1139 (TypeContainer.GetPendingImplementations): New public abstract
1141 (TypeContainer.GetClassBases): Removed the `is_class' and
1142 `is_iface' parameters.
1143 (TypeContainer.DefineNestedTypes): Formerly known as
1145 (ClassOrStruct): Made this class abstract.
1147 * tree.cs (RootTypes): New public type.
1149 2004-07-20 Martin Baulig <martin@ximian.com>
1151 * tree.cs (Tree.RecordNamespace): Removed.
1152 (Tree.Namespaces): Removed.
1154 * rootcontext.cs (RootContext.IsNamespace): Removed.
1156 * cs-parser.jay (namespace_declaration): Just create a new
1157 NamespaceEntry here.
1159 2004-07-20 Martin Baulig <martin@ximian.com>
1161 * statement.cs (ExceptionStatement): New abstract class. This is
1162 now used as a base class for everyone who's using `finally'.
1163 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
1164 our local variables before using them.
1166 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
1167 virtual method. This is used by Yield.Resolve() to "steal" an
1168 outer block's `finally' clauses.
1169 (FlowBranchingException): The .ctor now takes an ExceptionStatement
1172 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
1173 version which takes an ExceptionStatement. This version must be
1174 used to create exception branchings.
1177 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
1178 (Iterator.EmitMoveNext): Added exception support; protect the
1179 block with a `fault' clause, properly handle 'finally' clauses.
1180 (Iterator.EmitDispose): Run all the `finally' clauses here.
1182 2004-07-20 Martin Baulig <martin@ximian.com>
1184 * iterator.cs: This is the first of a set of changes in the
1185 iterator code. Match the spec more closely: if we're an
1186 IEnumerable, then GetEnumerator() must be called. The first time
1187 GetEnumerator() is called, it returns the current instance; all
1188 subsequent invocations (if any) must create a copy.
1190 2004-07-19 Miguel de Icaza <miguel@ximian.com>
1192 * expression.cs: Resolve the constant expression before returning
1195 2004-07-19 Martin Baulig <martin@ximian.com>
1197 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
1198 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
1199 the return type of the new EmitContext.
1201 2004-07-18 Martin Baulig <martin@ximian.com>
1203 * class.cs (Property.Define): Fix iterators.
1205 * iterators.cs (Iterator.Define): Moved the
1206 `container.AddInterator (this)' call here from the .ctor; only do
1207 it if we resolved successfully.
1209 2004-07-17 Miguel de Icaza <miguel@ximian.com>
1211 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
1212 `true' for preprocessing directives that we parse. The return
1213 value indicates whether we should return to regular tokenizing or
1214 not, not whether it was parsed successfully.
1216 In the past if we were in: #if false ... #line #endif, we would
1217 resume parsing after `#line'. See bug 61604.
1219 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
1220 building: IsEnumType should return true only for enums, not for
1221 enums or System.Enum itself. This fixes #61593.
1223 Likely what happened is that corlib was wrong: mcs depended on
1224 this bug in some places. The bug got fixed, we had to add the
1225 hack, which caused bug 61593.
1227 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
1228 that was a workaround for the older conditions.
1230 2004-07-16 Ben Maurer <bmaurer@ximian.com>
1232 * assign.cs: IAssignMethod has a new interface, as documented
1233 inline. All assignment code now uses this new api.
1235 * ecore.cs, expression.cs: All classes which implement
1236 IAssignMethod now use the new interface.
1238 * expression.cs (Invocation): add a hack to EmitCall so that
1239 IndexerAccess can be the target of a compound assignment without
1240 evaluating its arguments twice.
1242 * statement.cs: Handle changes in Invocation api.
1244 2004-07-16 Martin Baulig <martin@ximian.com>
1246 * iterators.cs: Rewrote this. We're now using one single Proxy
1247 class for both the IEnumerable and the IEnumerator interface and
1248 `Iterator' derives from Class so we can use the high-level API.
1250 * class.cs (TypeContainer.AddIterator): New method.
1251 (TypeContainer.DoDefineType): New protected virtual method, which
1252 is called from DefineType().
1253 (TypeContainer.DoDefineMembers): Call DefineType() and
1254 DefineMembers() on all our iterators.
1255 (TypeContainer.Emit): Call Emit() on all our iterators.
1256 (TypeContainer.CloseType): Call CloseType() on all our iterators.
1258 * codegen.cs (EmitContext.CurrentIterator): New public field.
1260 2004-07-15 Martin Baulig <martin@ximian.com>
1263 (TypeManager.not_supported_exception_type): New type.
1265 2004-07-14 Martin Baulig <martin@ximian.com>
1267 * iterators.cs: Use real error numbers.
1269 2004-07-14 Martin Baulig <martin@ximian.com>
1271 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
1272 requires this to be a System.Collection.IEnumerable and not a
1273 class implementing that interface.
1274 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
1276 2004-07-13 Marek Safar <marek.safar@seznam.cz>
1278 * class.cs: Fixed previous fix, it broke some error tests.
1280 2004-07-12 Martin Baulig <martin@ximian.com>
1282 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
1285 2004-07-09 Miguel de Icaza <miguel@ximian.com>
1287 * assign.cs (LocalTemporary): Add new argument: is_address,If
1288 `is_address' is true, then the value that we store is the address
1289 to the real value, and not the value itself.
1291 * ecore.cs (PropertyExpr): use the new local temporary
1292 stuff to allow us to handle X.Y += z (where X is a struct)
1294 2004-07-08 Martin Baulig <martin@ximian.com>
1296 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
1297 not always return, just like we're doing in Using.Resolve().
1299 2004-07-07 Miguel de Icaza <miguel@ximian.com>
1301 * cs-parser.jay (fixed_statement): flag this as Pinned.
1303 2004-07-06 Miguel de Icaza <miguel@ximian.com>
1305 * typemanager.cs (TypeManager): Removed MakePinned method, this
1306 mechanism is replaced with the .NET 2.x compatible mechanism of
1307 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
1309 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
1310 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
1311 `IsFixed' property which has a different meaning.
1313 2004-07-02 Raja R Harinath <rharinath@novell.com>
1315 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
1316 visible from inside a nested class, not just the names of the
1317 immediately enclosing class.
1320 2004-06-24 Raja R Harinath <rharinath@novell.com>
1322 * expression.cs (BetterConversion): Remove buggy special-case
1323 handling of "implicit constant expression conversions". At this
1324 point, we already know that the conversion is possible -- we're
1325 only checking to see which is better.
1327 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1329 * cs-parser.jay: Added error CS0210 test.
1331 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1333 * cs-parser.jay: Added error CS0134 test.
1335 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1338 * cs-parser.jay: Added error CS0145 test.
1340 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1342 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
1344 2004-06-23 Ben Maurer <bmaurer@ximian.com>
1346 * expression.cs (StackAlloc.Resolve): The argument may not
1347 be a constant; deal with this case.
1349 2004-06-23 Marek Safar <marek.safar@seznam.cz>
1351 * attribute.cs (IndexerName_GetIndexerName): Renamed to
1352 GetIndexerAttributeValue.
1353 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
1355 * class.cs (Indexer.Define): Added error tests for CS0415,
1358 2004-06-23 Miguel de Icaza <miguel@ximian.com>
1360 * attribute.cs (Attribute.Resolve): Keep field code in sync with
1363 2004-06-23 Martin Baulig <martin@ximian.com>
1365 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
1366 neither return nor throw, reset the barrier as well. Fixes #60457.
1368 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
1370 * class.cs : EventAttributes is now set to None by default.
1371 This fixes bug #60459.
1373 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1376 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1377 Don't throw exception but return null (it's sufficient now).
1379 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1381 * typemanager.cs (GetArgumentTypes): Faster implementation.
1383 2004-06-18 Martin Baulig <martin@ximian.com>
1385 * attribute.cs (Attribute.Resolve): Check whether we're an
1386 EmptyCast which a Constant child. Fixes #60333.
1388 2004-06-17 Ben Maurer <bmaurer@ximian.com>
1390 * statement.cs (EmitCollectionForeach): Account for the fact that
1391 not all valuetypes are in areas which we can take the address of.
1392 For these variables, we store to a temporary variable. Also, make
1393 sure that we dont emit a `callvirt' on a valuetype method.
1395 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1397 * expression.cs (StackAlloc.DoReSolve): Added test for
1398 negative parameter (CS0247).
1400 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1403 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
1405 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1408 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
1411 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1413 Fix bug #58254 & cs1555.cs, cs1556.cs
1414 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
1416 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1418 * cs-parser.jay: Added error CS1669 test for indexers.
1420 2004-06-11 Martin Baulig <martin@ximian.com>
1422 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
1423 call this twice: for params and varargs methods.
1425 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1428 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
1430 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1432 * attribute.cs (Attribute.GetValidTargets): Made public.
1435 (AbstractPropertyEventMethod): New class for better code sharing.
1436 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
1438 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
1440 2004-06-11 Raja R Harinath <rharinath@novell.com>
1443 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
1444 that the call to Resolve is part of a MemberAccess.
1445 (Expression.Resolve): Use it for SimpleName resolution.
1446 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
1447 Add 'intermediate' boolean argument.
1448 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
1449 error message when the SimpleName can be resolved ambiguously
1450 between an expression and a type.
1451 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
1453 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
1454 call on the left-side.
1456 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1459 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
1461 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1463 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
1465 2004-06-11 Martin Baulig <martin@ximian.com>
1467 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
1468 varargs methods if applicable.
1470 2004-06-11 Martin Baulig <martin@ximian.com>
1472 * expression.cs (Invocation.EmitCall): Don't use
1473 `method.CallingConvention == CallingConventions.VarArgs' since the
1474 method could also have `CallingConventions.HasThis'.
1476 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1478 * class.cs (Event.GetSignatureForError): Implemented.
1479 Fixed crash in error test cs3010.cs
1481 2004-06-10 Miguel de Icaza <miguel@ximian.com>
1483 * cs-tokenizer.cs: Change the way we track __arglist to be
1484 consistent with the other keywords.
1486 2004-06-09 Miguel de Icaza <miguel@ximian.com>
1488 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
1491 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
1493 * codegen.cs: Check that all referenced assemblies have a strongname
1494 before strongnaming the compiled assembly. If not report error CS1577.
1495 Fix bug #56563. Patch by Jackson Harper.
1496 * typemanager.cs: Added a method to return all referenced assemblies.
1497 Fix bug #56563. Patch by Jackson Harper.
1499 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1502 (Method.ApplyAttributeBuilder): Moved and added conditional
1503 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
1506 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
1508 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1511 * class.cs: (EventField.attribute_targets): Changed default target.
1513 2004-06-08 Martin Baulig <martin@ximian.com>
1515 * expression.cs (Invocation.EmitCall): Enable varargs methods.
1517 2004-06-08 Martin Baulig <martin@ximian.com>
1519 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
1521 2004-06-07 Martin Baulig <martin@ximian.com>
1523 Added support for varargs methods.
1525 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
1528 * cs-parser.jay: Added support for `__arglist'.
1530 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
1532 * expression.cs (Argument.AType): Added `ArgList'.
1533 (Invocation): Added support for varargs methods.
1534 (ArglistAccess): New public class.
1535 (Arglist): New public class.
1537 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
1539 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
1540 a method's top-level block if the method has varargs.
1542 * support.cs (ReflectionParameters, InternalParameters): Added
1543 support for varargs methods.
1545 2004-06-07 Miguel de Icaza <miguel@ximian.com>
1547 * class.cs: Provide location in indexer error report.
1549 * driver.cs: Use standard names.
1551 * namespace.cs: Catch the use of using after a namespace has been
1552 declared also on using aliases.
1554 2004-06-03 Raja R Harinath <rharinath@novell.com>
1557 * typemanager.cs (closure_private_ok, closure_invocation_type)
1558 (closure_qualifier_type, closure_invocation_assembly)
1559 (FilterWithClosure): Move to ...
1560 (Closure): New internal nested class.
1561 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
1562 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
1563 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
1564 (MemberLookup, MemberLookupFailed): Use it.
1565 * expression.cs (New.DoResolve): Treat the lookup for the
1566 constructor as being qualified by the 'new'ed type.
1567 (Indexers.GetIndexersForTypeOrInterface): Update.
1569 2004-06-03 Marek Safar <marek.safar@seznam.cz>
1572 (GetConditionalAttributeValue): New method. Returns
1573 condition of ConditionalAttribute.
1574 (SearchMulti): New method. Returns all attributes of type 't'.
1575 Use it when attribute is AllowMultiple = true.
1576 (IsConditionalMethodExcluded): New method.
1579 (Method.IsExcluded): Implemented. Returns true if method has conditional
1580 attribute and the conditions is not defined (method is excluded).
1581 (IMethodData): Extended interface for ConditionalAttribute support.
1582 (PropertyMethod.IsExcluded): Implemented.
1585 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
1588 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
1591 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
1593 * expression.cs (ArrayCreationExpression): Make this just an
1594 `expression'. It can't be a statement, so the code here was
1597 2004-06-02 Marek Safar <marek.safar@seznam.cz>
1600 * typemanager.cs (GetFullNameSignature): New method for
1603 2004-06-02 Marek Safar <marek.safar@seznam.cz>
1606 * class.cs (MemberBase.GetSignatureForError): New virtual method.
1607 Use this method when MethodBuilder is null.
1608 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
1609 Added test for error CS0626 (MONO reports error for this situation).
1610 (IMethodData.GetSignatureForError): Extended interface.
1612 2004-06-01 Marek Safar <marek.safar@seznam.cz>
1615 (AttributeTester.GetObsoleteAttribute): Returns instance of
1616 ObsoleteAttribute when type is obsolete.
1619 (TypeContainer.VerifyObsoleteAttribute): Override.
1620 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
1621 (MethodCode.VerifyObsoleteAttribute): Override.
1622 (MemberBase.VerifyObsoleteAttribute): Override.
1625 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
1626 and report proper error.
1629 Delegate.VerifyObsoleteAttribute): Override.
1632 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
1633 and report proper error.
1634 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
1637 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
1641 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
1642 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
1643 Added test for ObsoleteAttribute.
1646 (Catch): Derived from Statement.
1648 2004-06-01 Marek Safar <marek.safar@seznam.cz>
1650 Fixed bug #59071 & cs0160.cs
1652 * statement.cs (Try.Resolve): Check here whether order of catch
1653 clauses matches their dependencies.
1655 2004-05-31 Miguel de Icaza <miguel@ximian.com>
1657 * Reverted patch to namespace.cs (Use lookuptypedirect). This
1658 caused a regression: #59343. Referencing nested classes from an
1659 assembly stopped working.
1661 2004-05-31 Martin Baulig <martin@ximian.com>
1663 MCS is now frozen for beta 2.
1665 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1667 * convert.cs: add a trivial cache for overload operator resolution.
1669 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1671 * decl.cs: If possible, use lookuptypedirect here. We can only do
1672 this if there is no `.' after the namespace. Avoids using
1673 LookupType, which does lots of slow processing.
1674 (FindNestedType) New method, does what it says :-).
1675 * namespace.cs: use LookupTypeDirect.
1676 * rootcontext.cs: use membercache, if possible.
1677 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
1679 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1682 According to the spec,
1684 In a member access of the form E.I, if E is a single identifier,
1685 and if the meaning of E as a simple-name (§7.5.2) is a constant,
1686 field, property, localvariable, or parameter with the same type as
1687 the meaning of E as a type-name (§3.8), then both possible
1688 meanings of E are permitted.
1690 We did not check that E as a simple-name had the same type as E as
1693 This trivial check gives us 5-7% on bootstrap time.
1695 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1697 * expression.cs (Invocation.OverloadResolve): Avoid the
1698 use of hashtables and boxing here by allocating on demand.
1700 2004-05-30 Martin Baulig <martin@ximian.com>
1702 * rootcontext.cs (RootContext.LookupType): Don't cache things if
1703 we're doing a silent lookup. Don't try to lookup nested types in
1704 TypeManager.object_type (thanks to Ben Maurer).
1706 2004-05-30 Martin Baulig <martin@ximian.com>
1708 Committing a patch from Ben Maurer.
1710 * rootcontext.cs (RootContext.LookupType): Cache negative results.
1712 2004-05-29 Martin Baulig <martin@ximian.com>
1714 * class.cs (IMethodData.ShouldIgnore): New method.
1716 * typemanager.cs (TypeManager.MethodFlags): Don't take a
1717 `Location' argument, we don't need it anywhere. Use
1718 `IMethodData.ShouldIgnore ()' instead of
1719 `MethodData.GetMethodFlags ()'.
1720 (TypeManager.AddMethod): Removed.
1721 (TypeManager.AddMethod2): Renamed to AddMethod.
1723 2004-05-29 Martin Baulig <martin@ximian.com>
1725 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
1727 * convert.cs (Convert.ImplicitReferenceConversion): If we're
1728 converting from a class type S to an interface type and we already
1729 have an object on the stack, don't box it again. Fixes #52578.
1731 2004-05-29 Martin Baulig <martin@ximian.com>
1733 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1734 Added support for `params' parameters. Fixes #59267.
1736 2004-05-29 Martin Baulig <martin@ximian.com>
1738 * literal.cs (NullPointer): Provide a private .ctor which sets
1739 `type' to TypeManager.object_type. Fixes #59048.
1741 2004-05-29 Martin Baulig <martin@ximian.com>
1743 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
1744 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
1746 * ecore.cs (EventExpr.instance_expr): Make the field private.
1748 2004-05-26 Marek Safar <marek.safar@seznam.cz>
1750 Fixed bug #50080 & cs0214-2.cs
1751 * expression.cs (Cast.DoResolve): Check unsafe context here.
1753 * statement.cs (Resolve.DoResolve): Likewise.
1755 2004-05-26 Martin Baulig <martin@ximian.com>
1757 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
1759 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
1760 (RootContext.LookupType): Pass down the `silent' flag.
1762 2004-05-25 Martin Baulig <martin@ximian.com>
1765 (MethodGroupExpr.IdenticalTypeName): New public property.
1766 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
1767 expression actually refers to a type.
1769 2004-05-25 Martin Baulig <martin@ximian.com>
1771 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
1772 for #56176 and made it actually work.
1774 2004-05-25 Martin Baulig <martin@ximian.com>
1776 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
1777 (FieldExpr, PropertyExpr): Override and implement
1778 CacheTemporaries. Fixes #52279.
1780 2004-05-25 Miguel de Icaza <miguel@ximian.com>
1782 * location.cs: In the new compiler listing a file twice is a
1783 warning, not an error.
1785 2004-05-24 Martin Baulig <martin@ximian.com>
1787 * enum.cs (Enum.DefineType): For the `BaseType' to be a
1788 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
1790 2004-05-24 Martin Baulig <martin@ximian.com>
1792 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
1793 walking the `using' list. Fixes #53921.
1795 2004-05-24 Martin Baulig <martin@ximian.com>
1797 * const.cs (Const.LookupConstantValue): Added support for
1798 EmptyCast's; fixes #55251.
1800 2004-05-24 Martin Baulig <martin@ximian.com>
1802 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
1803 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
1804 which does the CS0135 check. The reason is that we first need to
1805 check whether the variable actually exists.
1807 2004-05-24 Martin Baulig <martin@ximian.com>
1809 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
1810 than RootContext.LookupType() to find the explicit interface
1813 2004-05-24 Raja R Harinath <rharinath@novell.com>
1815 * Makefile: Simplify. Use executable.make.
1816 * mcs.exe.sources: New file. List of sources of mcs.exe.
1818 2004-05-24 Anders Carlsson <andersca@gnome.org>
1822 Use the invariant culture when doing String.Compare for CLS case
1825 2004-05-23 Martin Baulig <martin@ximian.com>
1827 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
1828 don't have any dots. Fixes #52622, added cs0246-8.cs.
1830 * namespace.cs (NamespaceEntry.Lookup): Likewise.
1832 2004-05-23 Marek Safar <marek.safar@seznam.cz>
1834 * class.cs (MemberBase.Define): Reuse MemberType member for
1835 resolved type. Other methods can use it too.
1837 2004-05-23 Martin Baulig <martin@ximian.com>
1839 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
1840 the variable also exists in the current block (otherwise, we need
1841 to report a CS0103). Fixes #58670.
1843 2004-05-23 Martin Baulig <martin@ximian.com>
1845 * flowanalysis.cs (Reachability.Reachable): Compute this
1846 on-the-fly rather than storing it as a field.
1848 2004-05-23 Martin Baulig <martin@ximian.com>
1850 * flowanalysis.cs (Reachability.And): Manually compute the
1851 resulting `barrier' from the reachability.
1853 2004-05-23 Marek Safar <marek.safar@seznam.cz>
1856 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
1857 instance of ObsoleteAttribute when symbol is obsolete.
1860 (IMethodData): Extended interface for ObsoleteAttribute support.
1862 2004-05-22 Marek Safar <marek.safar@seznam.cz>
1864 * attribute.cs: Fix bug #55970
1866 2004-05-22 Marek Safar <marek.safar@seznam.cz>
1870 (GetObsoleteAttribute): New method. Creates the instance of
1872 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
1873 ObsoleteAttribute when member is obsolete.
1874 (AttributeTester.Report_ObsoleteMessage): Common method for
1875 Obsolete error/warning reporting.
1878 (TypeContainer.base_classs_type): New member for storing parent type.
1881 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
1882 for this MemberCore.
1884 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1886 * attribute.cs, const.cs: Fix bug #58590
1888 2004-05-21 Martin Baulig <martin@ximian.com>
1890 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
1891 out parameters if the end of the method is unreachable. Fixes
1894 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1896 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
1897 Hari was right, why extra method.
1899 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1901 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
1903 2004-05-20 Martin Baulig <martin@ximian.com>
1905 Merged this back from gmcs to keep the differences to a minumum.
1907 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
1908 instead of a Declspace.
1909 (Attribute.ResolveType): Likewise.
1910 (Attributes.Search): Likewise.
1911 (Attributes.Contains): Likewise.
1912 (Attributes.GetClsCompliantAttribute): Likewise.
1914 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
1916 (MethodData.ApplyAttributes): Take an EmitContext instead of a
1919 2004-05-19 Marek Safar <marek.safar@seznam.cz>
1921 Fix bug #58688 (MCS does not report error when the same attribute
1924 * attribute.cs (Attribute.Emit): Distinction between null and default.
1926 2004-05-19 Raja R Harinath <rharinath@novell.com>
1928 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
1929 of a top-level attribute without an attribute target.
1930 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
1932 (Attribute.Conditional_GetConditionName),
1933 (Attribute.Obsolete_GetObsoleteMessage): Update.
1934 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
1935 part of ScanForIndexerName.
1936 (Attribute.CanIgnoreInvalidAttribute): New function.
1937 (Attribute.ScanForIndexerName): Move to ...
1938 (Attributes.ScanForIndexerName): ... here.
1939 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
1940 (Attributes.Search): New internal variant that can choose not to
1941 complain if types aren't resolved. The original signature now
1943 (Attributes.GetClsCompliantAttribute): Use internal variant, with
1944 complaints suppressed.
1945 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
1946 only if it not useful.
1947 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
1948 top-level for attributes that are shared between the assembly
1949 and a top-level class.
1950 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
1951 * class.cs: Update to reflect changes.
1952 (DefineIndexers): Fuse loops.
1953 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
1954 a couple more variants of attribute names.
1956 2004-05-18 Marek Safar <marek.safar@seznam.cz>
1958 Fix bug #52585 (Implemented explicit attribute declaration)
1961 (Attributable.ValidAttributeTargets): New abstract method. It gets
1962 list of valid attribute targets for explicit target declaration.
1963 (Attribute.Target): It holds target itself.
1964 (AttributeSection): Removed.
1965 (Attribute.CheckTargets): New method. It checks whether attribute
1966 target is valid for the current element.
1969 (EventProperty): New class. For events that are declared like
1970 property (with add and remove accessors).
1971 (EventField): New class. For events that are declared like field.
1974 * cs-parser.jay: Implemented explicit attribute target declaration.
1976 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
1977 Override ValidAttributeTargets.
1980 (ReturnParameter): Class for applying custom attributes on
1982 (ParameterAtribute): New class. Class for applying custom
1983 attributes on the parameter type.
1985 2004-05-17 Miguel de Icaza <miguel@ximian.com>
1987 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
1990 (Method): Allow UNSAFE here.
1992 * modifiers.cs: Support unsafe reporting.
1994 2004-05-17 Marek Safar <marek.safar@seznam.cz>
1996 * decl.cs: Fix bug #58478.
1998 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2000 * statement.cs: When checking for unreachable code on an EmptyStatement,
2001 set the location. Fixes bug #58488.
2003 2004-05-13 Miguel de Icaza <miguel@ximian.com>
2005 * driver.cs: Add -pkg handling.
2007 From Gonzalo: UseShelLExecute=false
2009 2004-05-12 Marek Safar <marek.safar@seznam.cz>
2012 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
2014 (Attribute.IsClsCompliaceRequired): Moved to base for better
2016 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
2017 when attribute is AttributeUsageAttribute.
2018 (Attribute.GetValidTargets): Simplified.
2019 (Attribute.GetAttributeUsage): New method returns AttributeUsage
2020 attribute for this type.
2021 (Attribute.ApplyAttributes): Method renamed to Emit and make
2023 (GlobalAttributeSection): New class for special handling of global
2024 attributes (assembly, module).
2025 (AttributeSection.Emit): New method.
2027 * class.cs: Implemented Attributable abstract methods.
2028 (MethodCore.LabelParameters): Moved to Parameter class.
2029 (Accessor): Is back simple class.
2030 (PropertyMethod): Implemented Attributable abstract class.
2031 (DelegateMethod): Implemented Attributable abstract class.
2032 (Event): New constructor for disctintion between normal Event
2033 and Event with accessors.
2035 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
2037 * codegen.cs, const.cs, decl.cs, delegate.cs:
2038 (CommonAssemblyModulClass): Implemented Attributable abstract class
2041 * enum.cs: Implement IAttributeSupport interface.
2042 (EnumMember): New class for emum members. Implemented Attributable
2046 (ParameterBase): Is abstract.
2047 (ReturnParameter): New class for easier [return:] attribute handling.
2049 * typemanager.cs: Removed builder_to_attr.
2051 2004-05-11 Raja R Harinath <rharinath@novell.com>
2054 * attribute.cs (Attribute.GetPositionalValue): New function.
2055 * class.cs (TypeContainer.VerifyMembers): New function.
2056 (TypeContainer.Emit): Use it.
2057 (ClassOrStruct): New base class for Class and Struct.
2058 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
2059 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
2061 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
2062 then each non-static field should have a FieldOffset attribute.
2063 Otherwise, none of the fields should have a FieldOffset attribute.
2064 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
2065 and FieldOffset attributes.
2066 * typemanager.cs (TypeManager.struct_layout_attribute_type)
2067 (TypeManager.field_offset_attribute_type): New core types.
2068 (TypeManager.InitCoreTypes): Initialize them.
2070 2004-05-11 Michal Moskal <malekith@pld-linux.org>
2072 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
2073 Return correct type.
2076 2004-05-09 Miguel de Icaza <miguel@ximian.com>
2078 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
2079 be implicitly converted to ulong.
2081 * expression.cs: The logic for allowing operator &, | and ^ worked
2082 was wrong, it worked before because we did not report an error in
2083 an else branch. Fixes 57895.
2085 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
2086 allow volatile fields to be reference types.
2088 2004-05-07 Miguel de Icaza <miguel@ximian.com>
2090 * driver.cs: Add support for /debug-
2092 2004-05-07 Raja R Harinath <rharinath@novell.com>
2094 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
2095 Add a 'complain' parameter to silence errors.
2096 (Attribute.Resolve): Update to changes. Put in sanity check to catch
2097 silently overlooked type-resolutions.
2098 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
2100 (Attributes.Search): New function.
2101 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
2102 (Attributes.GetAttributeFullName): Remove hack.
2103 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
2104 Update to reflect changes.
2105 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
2106 Use Attributes.Search instead of nested loops.
2108 2004-05-07 Marek Safar <marek.safar@seznam.cz>
2111 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
2112 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
2113 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
2115 * report.cs: (Report.Warning): Renamed to Warning_T because of
2116 parameter collision.
2118 2004-05-05 Raja R Harinath <rharinath@novell.com>
2120 * expression.cs (MemberAccess.ResolveMemberAccess):
2121 Exit with non-zero status after Report.Error.
2122 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
2124 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
2126 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2128 * support.cs: Don't hang when the file is empty.
2130 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2132 * support.cs: In SeekableStreamReader, compute the preamble size of the
2133 underlying stream. Position changes should take into account that initial
2136 2004-05-03 Todd Berman <tberman@sevenl.net>
2138 * driver.cs: remove unused GetSysVersion function.
2140 2004-05-03 Todd Berman <tberman@sevenl.net>
2142 * driver.cs: Remove the hack from saturday, as well as the hack
2143 from jackson (LoadAssemblyFromGac), also adds the CWD to the
2144 link_paths to get that bit proper.
2146 2004-05-01 Todd Berman <tberman@sevenl.net>
2148 * driver.cs: Try a LoadFrom before a Load, this checks the current
2149 path. This is currently a bug in mono that is be fixed, however, this
2150 provides a workaround for now. This will be removed when the bug
2153 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
2155 * CryptoConvert.cs: Updated to latest version. Fix issue with
2156 incomplete key pairs (#57941).
2158 2004-05-01 Todd Berman <tberman@sevenl.net>
2160 * driver.cs: Remove '.' from path_chars, now System.* loads properly
2163 2004-04-30 Jackson Harper <jackson@ximian.com>
2165 * codegen.cs: Open keys readonly.
2167 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2169 * typemanager.cs: don't report cyclic struct layout when a struct
2170 contains 2 or more fields of the same type. Failed for Pango.AttrShape
2171 which has 2 Pango.Rectangle fields.
2173 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
2175 * expression.cs: Handle IntPtr comparisons with IL code
2176 rather than a method call.
2178 2004-04-29 Martin Baulig <martin@ximian.com>
2180 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
2181 the list of PropertyInfo's in class hierarchy and find the
2182 accessor. Fixes #56013.
2184 2004-04-29 Martin Baulig <martin@ximian.com>
2186 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
2188 2004-04-29 Martin Baulig <martin@ximian.com>
2190 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2192 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
2194 2004-04-29 Martin Baulig <martin@ximian.com>
2196 * class.cs (ConstructorInitializer.Resolve): Check whether the
2197 parent .ctor is accessible. Fixes #52146.
2199 2004-04-29 Martin Baulig <martin@ximian.com>
2201 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2203 * statement.cs (Using.EmitLocalVariableDecls): Use
2204 TypeManager.idisposable_type, not typeof (IDisposable).
2205 (Foreach.EmitCollectionForeach): Added support for valuetypes.
2207 2004-04-29 Martin Baulig <martin@ximian.com>
2209 * class.cs (Event.Define): Don't emit the field and don't set
2210 RTSpecialName and SpecialName for events on interfaces. Fixes
2213 2004-04-29 Raja R Harinath <rharinath@novell.com>
2215 Refactor Attribute.ApplyAttributes.
2216 * attribute.cs (Attributable): New base class for objects that can
2217 have Attributes applied on them.
2218 (Attribute): Make AttributeUsage fields public.
2219 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
2220 (Attribute.IsInternalCall): New property.
2221 (Attribute.UsageAttr): Convert to a public read-only property.
2222 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
2223 (Attribute.ResolveType, Attribute.Resolve)
2224 (Attribute.ScanForIndexerName): Update to reflect changes.
2225 (Attribute.CheckAttributeTarget): Re-format.
2226 (Attribute.ApplyAttributes): Refactor, to various
2227 Attributable.ApplyAttributeBuilder methods.
2228 * decl.cs (MemberCore): Make Attributable.
2229 * class.cs (Accessor): Make Attributable.
2230 (MethodData.ApplyAttributes): Use proper attribute types, not
2232 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
2233 (TypeContainer.ApplyAttributeBuilder)
2234 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
2235 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
2236 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
2237 (Operator.ApplyAttributeBuilder): New factored-out methods.
2238 * const.cs (Const.ApplyAttributeBuilder): Likewise.
2239 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
2240 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
2241 * parameter.cs (ParameterBase): New Attributable base class
2242 that can also represent Return types.
2243 (Parameter): Update to the changes.
2245 2004-04-29 Jackson Harper <jackson@ximian.com>
2247 * driver.cs: Prefer the corlib system version when looking for
2248 assemblies in the GAC. This is still a hack, but its a better hack
2251 2004-04-29 Marek Safar <marek.safar@seznam.cz>
2253 * decl.cs, enum.cs: Improved error 3005 reporting.
2255 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
2256 (related_symbols): New private member for list of symbols
2257 related to reported error/warning.
2259 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
2261 2004-04-29 Martin Baulig <martin@ximian.com>
2263 * ecore.cs (Expression.Constantify): If we're an enum and
2264 TypeManager.TypeToCoreType() doesn't give us another type, use
2265 t.UnderlyingSystemType. Fixes #56178.
2267 2004-04-29 Martin Baulig <martin@ximian.com>
2269 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
2270 interfaces and for each interface, only add members directly
2271 declared in that interface. Fixes #53255.
2273 2004-04-28 Martin Baulig <martin@ximian.com>
2275 * expression.cs (ConditionalLogicalOperator): Use a temporary
2276 variable for `left' to avoid that we evaluate it more than once;
2279 2004-04-28 Martin Baulig <martin@ximian.com>
2281 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
2284 2004-04-28 Martin Baulig <martin@ximian.com>
2286 * statement.cs (LocalInfo.Resolve): Check whether the type is not
2289 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
2290 whether the type is not void (CS1547).
2292 2004-04-28 Martin Baulig <martin@ximian.com>
2294 * expression.cs (Unary.DoResolveLValue): Override this and report
2295 CS0131 for anything but Operator.Indirection.
2297 2004-04-28 Martin Baulig <martin@ximian.com>
2299 Committing a patch from Ben Maurer; see bug #50820.
2301 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2304 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2307 2004-04-28 Martin Baulig <martin@ximian.com>
2309 Committing a patch from Ben Maurer; see bug #50820.
2311 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2314 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2317 2004-04-28 Martin Baulig <martin@ximian.com>
2319 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
2320 (Block.AddLabel): Call DoLookupLabel() to only search in the
2323 2004-04-28 Martin Baulig <martin@ximian.com>
2325 * cfold.cs (ConstantFold.BinaryFold): Added special support for
2326 comparing StringConstants and NullLiterals in Equality and Inequality.
2328 2004-04-28 Jackson Harper <jackson@ximian.com>
2330 * driver.cs: Attempt to load referenced assemblies from the
2331 GAC. This is the quick and dirty version of this method that
2332 doesnt take into account versions and just takes the first
2333 canidate found. Will be good enough for now as we will not have more
2334 then one version installed into the GAC until I update this method.
2336 2004-04-28 Martin Baulig <martin@ximian.com>
2338 * typemanager.cs (TypeManager.CheckStructCycles): New public
2339 static method to check for cycles in the struct layout.
2341 * rootcontext.cs (RootContext.PopulateTypes): Call
2342 TypeManager.CheckStructCycles() for each TypeContainer.
2343 [Note: We only need to visit each type once.]
2345 2004-04-28 Martin Baulig <martin@ximian.com>
2347 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
2349 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
2350 success and added `out object value'. Use a `bool resolved' field
2351 to check whether we've already been called rather than
2352 `ConstantValue != null' since this breaks for NullLiterals.
2354 2004-04-28 Raja R Harinath <rharinath@novell.com>
2356 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
2357 setting of this flag, since the 'set' method may be non-public.
2359 2004-04-28 Raja R Harinath <rharinath@novell.com>
2361 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
2362 check on current_vector.Block.
2364 2004-04-27 Martin Baulig <martin@ximian.com>
2366 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
2367 a field initializer. Fixes #56459.
2369 2004-04-27 Martin Baulig <martin@ximian.com>
2371 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
2372 we're not attempting to use an indexer. Fixes #52154.
2374 2004-04-27 Martin Baulig <martin@ximian.com>
2376 * statement.cs (Return): Don't create a return label if we don't
2377 need it; reverts my change from January 20th. Thanks to Ben
2380 2004-04-27 Martin Baulig <martin@ximian.com>
2382 According to the spec, `goto' can only leave a nested scope, but
2385 * statement.cs (Block.LookupLabel): Only lookup in the current
2386 block, don't recurse into parent or child blocks.
2387 (Block.AddLabel): Check in parent and child blocks, report
2388 CS0140/CS0158 if we find a duplicate.
2389 (Block): Removed this indexer for label lookups.
2390 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
2391 this already does the error reporting for us.
2394 (FlowBranching.UsageVector.Block): New public variable; may be null.
2395 (FlowBranching.CreateSibling): Added `Block' argument.
2396 (FlowBranching.LookupLabel): New public virtual method. Lookup a
2397 label for the target of a `goto' and check whether we're not
2398 leaving a `finally'.
2400 2004-04-27 Martin Baulig <martin@ximian.com>
2402 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2403 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
2406 2004-04-27 Martin Baulig <martin@ximian.com>
2408 * statement.cs (Block.AddLabel): Also check for implicit blocks
2409 and added a CS0158 check.
2411 2004-04-27 Martin Baulig <martin@ximian.com>
2413 * flowanalysis.cs (FlowBranchingLoop): New class.
2414 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
2415 UsageVector's instead of an ArrayList.
2416 (FlowBranching.Label): Likewise.
2417 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
2418 (FlowBranching.AddBreakVector): New method.
2420 2004-04-27 Miguel de Icaza <miguel@ximian.com>
2422 * attribute.cs: Small regression fix: only convert the type if we
2423 the type is different, fixes System.Drawing build.
2425 2004-04-27 Martin Baulig <martin@ximian.com>
2427 * attribute.cs (Attribute.Resolve): If we have a constant value
2428 for a named field or property, implicity convert it to the correct
2431 2004-04-27 Raja R Harinath <rharinath@novell.com>
2433 * statement.cs (Block.Block): Implicit blocks share
2434 'child_variable_names' fields with parent blocks.
2435 (Block.AddChildVariableNames): Remove.
2436 (Block.AddVariable): Mark variable as "used by a child block" in
2437 every surrounding block.
2438 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
2439 been used in a child block, complain about violation of "Invariant
2440 meaning in blocks" rule.
2441 * cs-parser.jay (declare_local_variables): Don't use
2442 AddChildVariableNames.
2443 (foreach_statement): Don't create an implicit block: 'foreach'
2446 2004-04-23 Miguel de Icaza <miguel@ximian.com>
2448 * convert.cs (ImplicitNumericConversion): 0 is also positive when
2449 converting from 0L to ulong. Fixes 57522.
2451 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2453 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
2454 derived class hides via 'new' keyword field from base class (test-242.cs).
2455 TODO: Handle this in the more general way.
2457 * class.cs (CheckBase): Ditto.
2459 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2461 * decl.cs (caching_flags): New member for storing cached values
2463 (MemberCore.Flags): New enum where bit flags for caching_flags
2465 (MemberCore.cls_compliance): Moved to caching_flags.
2466 (DeclSpace.Created): Moved to caching_flags.
2468 * class.cs: Use caching_flags instead of DeclSpace.Created
2470 2004-04-21 Miguel de Icaza <miguel@ximian.com>
2472 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
2473 if we are only a derived class, not a nested class.
2475 * typemanager.cs: Same as above, but do this at the MemberLookup
2476 level (used by field and methods, properties are handled in
2477 PropertyExpr). Allow for the qualified access if we are a nested
2480 2004-04-21 Marek Safar <marek.safar@seznam.cz>
2482 * class.cs: Refactoring.
2483 (IMethodData): New inteface; Holds links to parent members
2484 to avoid member duplication (reduced memory allocation).
2485 (Method): Implemented IMethodData interface.
2486 (PropertyBase): New inner classes for get/set methods.
2487 (PropertyBase.PropertyMethod): Implemented IMethodData interface
2488 (Event): New inner classes for add/remove methods.
2489 (Event.DelegateMethod): Implemented IMethodData interface.
2491 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
2492 EmitContext (related to class.cs refactoring).
2494 2004-04-21 Raja R Harinath <rharinath@novell.com>
2496 * delegate.cs (Delegate.VerifyApplicability): If the number of
2497 arguments are the same as the number of parameters, first try to
2498 verify applicability ignoring any 'params' modifier on the last
2502 2004-04-16 Raja R Harinath <rharinath@novell.com>
2504 * class.cs (TypeContainer.AddIndexer): Use
2505 'ExplicitInterfaceName' to determine if interface name was
2506 explicitly specified. 'InterfaceType' is not initialized at this time.
2507 (TypeContainer.DefineIndexers): Remove use of temporary list. The
2508 Indexers array is already in the required order. Initialize
2509 'IndexerName' only if there are normal indexers.
2510 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
2511 (TypeContainer.Emit): Emit DefaultMember attribute only if
2512 IndexerName is initialized.
2515 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
2517 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
2520 2004-04-15 Raja R Harinath <rharinath@novell.com>
2522 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
2526 * attribute.cs (Attribute.Resolve): Check for duplicate named
2530 2004-04-15 Miguel de Icaza <miguel@ximian.com>
2532 * iterators.cs (MarkYield): track whether we are in an exception,
2533 and generate code accordingly. Use a temporary value to store the
2534 result for our state.
2536 I had ignored a bit the interaction of try/catch with iterators
2537 since their behavior was not entirely obvious, but now it is
2538 possible to verify that our behavior is the same as MS .NET 2.0
2542 2004-04-14 Miguel de Icaza <miguel@ximian.com>
2544 * iterators.cs: Avoid creating temporaries if there is no work to
2547 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
2548 Enumerations, use TypeManager.EnumToUnderlying and call
2551 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
2554 (This.Emit): Use EmitContext.EmitThis to emit our
2557 (This.EmitAssign): Ditto.
2559 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
2560 codepaths, we will move all the functionality into
2563 (FieldExpr.EmitAssign): Ditto.
2565 This fixes several hidden bugs that I uncovered while doing a code
2566 review of this today.
2568 * codegen.cs (EmitThis): reworked so the semantics are more clear
2569 and also support value types "this" instances.
2571 * iterators.cs: Changed so that for iterators in value types, we
2572 do not pass the value type as a parameter.
2574 Initialization of the enumerator helpers is now done in the caller
2575 instead of passing the parameters to the constructors and having
2576 the constructor set the fields.
2578 The fields have now `assembly' visibility instead of private.
2580 2004-04-11 Miguel de Icaza <miguel@ximian.com>
2582 * expression.cs (Argument.Resolve): Check if fields passed as ref
2583 or out are contained in a MarshalByRefObject.
2585 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
2586 another compiler type.
2588 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
2590 * class.cs (Indexer.Define): use the new name checking method.
2591 Also, return false on an error.
2592 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
2593 (is_identifier_[start/part]_character): make static.
2595 2004-04-10 Miguel de Icaza <miguel@ximian.com>
2597 * expression.cs (Binary.ResolveOperator): Do no append strings
2598 twice: since we can be invoked more than once (array evaluation)
2599 on the same concatenation, take care of this here. Based on a fix
2600 from Ben (bug #56454)
2602 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
2604 * codegen.cs: Fix another case where CS1548 must be reported (when
2605 delay-sign isn't specified and no private is available #56564). Fix
2606 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
2607 error when MCS is used on the MS runtime and we need to delay-sign
2608 (which seems unsupported by AssemblyBuilder - see #56621).
2610 2004-04-08 Marek Safar <marek.safar@seznam.cz>
2612 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
2613 (TypeManager.ComputeNamespaces): Faster implementation for
2616 * compiler.csproj: Updated AssemblyName to mcs.
2618 2004-04-07 Miguel de Icaza <miguel@ximian.com>
2620 * rootcontext.cs: Add new types to the boot resolution.
2622 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
2623 MulticastDelegate is not allowed.
2625 * typemanager.cs: Add new types to lookup: System.TypedReference
2628 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
2629 check for TypedReference or ArgIterator, they are not allowed.
2631 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
2632 makes us properly catch 1510 in some conditions (see bug 56016 for
2635 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
2637 * CryptoConvert.cs: update from corlib version
2640 2004-04-05 Miguel de Icaza <miguel@ximian.com>
2642 * class.cs (Indexer.Define): Check indexername declaration
2644 2004-04-05 Marek Safar <marek.safar@seznam.cz>
2646 * attribute.cs (IsClsCompliant): Fixed problem with handling
2647 all three states (compliant, not-compliant, undetected).
2649 2004-03-30 Marek Safar <marek.safar@seznam.cz>
2651 * attribute.cs (Attribute): Location is now public.
2652 (Resolve): Store resolved arguments (pos_values) in attribute class.
2653 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
2654 (GetClsCompliantAttributeValue): New method that gets
2655 CLSCompliantAttribute value.
2656 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
2657 if exists else null.
2658 (AttributeTester): New class for CLS-Compliant verification routines.
2660 * class.cs (Emit): Add CLS-Compliant verification.
2661 (Method.GetSignatureForError): Implemented.
2662 (Constructor.GetSignatureForError): Implemented
2663 (Constructor.HasCompliantArgs): Returns if constructor has
2664 CLS-Compliant arguments.
2665 (Constructor.Emit): Override.
2666 (Construcor.IsIdentifierClsCompliant): New method; For constructors
2667 is needed to test only parameters.
2668 (FieldBase.GetSignatureForError): Implemented.
2669 (TypeContainer): New member for storing base interfaces.
2670 (TypeContainer.FindMembers): Search in base interfaces too.
2672 * codegen.cs (GetClsComplianceAttribute): New method that gets
2673 assembly or module CLSCompliantAttribute value.
2674 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
2676 (ModuleClass.Emit): Add error 3012 test.
2678 * const.cs (Emit): Override and call base for CLS-Compliant tests.
2680 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
2681 state for all decl types.
2682 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
2683 if CLS-Compliant tests are required.
2684 (IsClsCompliaceRequired): New method. Analyze whether code
2685 must be CLS-Compliant.
2686 (IsExposedFromAssembly): New method. Returns true when MemberCore
2687 is exposed from assembly.
2688 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
2689 value or gets cached value.
2690 (HasClsCompliantAttribute): New method. Returns true if MemberCore
2691 is explicitly marked with CLSCompliantAttribute.
2692 (IsIdentifierClsCompliant): New abstract method. This method is
2693 used to testing error 3005.
2694 (IsIdentifierAndParamClsCompliant): New method. Common helper method
2695 for identifier and parameters CLS-Compliant testing.
2696 (VerifyClsCompliance): New method. The main virtual method for
2697 CLS-Compliant verifications.
2698 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
2699 null. I don't know why is null (too many public members !).
2700 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
2701 and get value of first CLSCompliantAttribute that found.
2703 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
2704 (VerifyClsCompliance): Override and add extra tests.
2706 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
2707 clscheck- disable CLS-Compliant verification event if assembly is has
2708 CLSCompliantAttribute(true).
2710 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
2711 ApllyAttribute is now called in emit section as in the other cases.
2712 Possible future Emit integration.
2713 (IsIdentifierClsCompliant): New override.
2714 (VerifyClsCompliance): New override.
2715 (GetEnumeratorName): Returns full enum name.
2717 * parameter.cs (GetSignatureForError): Implemented.
2719 * report.cs (WarningData): New struct for Warning message information.
2720 (LocationOfPreviousError): New method.
2721 (Warning): New method. Reports warning based on the warning table.
2722 (Error_T): New method. Reports error based on the error table.
2724 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
2725 verifications are done here.
2727 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
2729 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
2730 CLSCompliantAttribute.
2731 (all_imported_types): New member holds all imported types from other
2733 (LoadAllImportedTypes): New method fills static table with exported types
2734 from all referenced assemblies.
2735 (Modules): New property returns all assembly modules.
2737 2004-03-30 Miguel de Icaza <miguel@ximian.com>
2739 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
2740 throwing a parser error.
2742 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
2743 which removes the hardcoded get_/set_ prefixes for properties, as
2744 IL allows for the properties to be named something else.
2748 * expression.cs: Do not override operand before we know if it is
2751 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2753 * typemanager.cs: support for pinned variables.
2755 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2757 * decl.cs, typemanager.cs: Avoid using an arraylist
2758 as a buffer if there is only one result set.
2760 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2762 * expression.cs: Make sure you cant call a static method
2763 with an instance expression, bug #56174.
2765 2004-03-29 Miguel de Icaza <miguel@ximian.com>
2767 * class.cs (IsDuplicateImplementation): Improve error reporting to
2768 flag 663 (method only differs in parameter modifier).
2770 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
2771 in preprocessor directives.
2773 * location.cs (LookupFile): Allow for the empty path.
2775 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
2776 better approach for some of that patch, but its failing with the
2777 CharSet enumeration. For now try/catch will do.
2779 * typemanager.cs: Do not crash if a struct does not have fields.
2782 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2784 * expression.cs: cs0213, cant fix a fixed expression.
2787 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2789 * cs-parser.jay: detect invalid embeded statements gracefully.
2792 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2794 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
2797 the invocation type may not be a subclass of the tye of the item/
2798 The type of the item must be a subclass of the invocation item.
2803 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
2805 * attribute.cs: Added methods to get a string and a bool from an
2806 attribute. Required to information from AssemblyKeyFileAttribute,
2807 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
2808 * codegen.cs: Modified AssemblyName creation to include support for
2809 strongnames. Catch additional exceptions to report them as CS1548.
2810 * compiler.csproj: Updated include CryptoConvert.cs.
2811 * compiler.csproj.user: Removed file - user specific configuration.
2812 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
2813 Mono.Security assembly. The original class is maintained and tested in
2814 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
2815 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
2816 like CSC 8.0 (C# v2) supports.
2817 * Makefile: Added CryptoConvert.cs to mcs sources.
2818 * rootcontext.cs: Added new options for strongnames.
2820 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
2822 * driver.cs: For --expect-error, report error code `2'
2823 if the program compiled with no errors, error code `1' if
2824 it compiled with an error other than the one expected.
2826 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
2828 * compiler.csproj: Updated for Visual Studio .NET 2003.
2829 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
2830 * compiler.sln: Updated for Visual Studio .NET 2003.
2832 2004-03-24 Ravi Pratap M <ravi@ximian.com>
2834 * expression.cs: Fix bug #47234. We basically need to apply the
2835 rule that we prefer the conversion of null to a reference type
2836 when faced with a conversion to 'object' (csc behaviour).
2838 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2840 * statement.cs: Shorter form for foreach, eliminates
2841 a local variable. r=Martin.
2843 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2845 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
2846 checks if we can use brtrue/brfalse to test for 0.
2847 * expression.cs: use the above in the test for using brtrue/brfalse.
2850 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2852 * expression.cs: Rewrite string concat stuff. Benefits:
2854 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
2855 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
2856 rather than a concat chain.
2858 * typemanager.cs: Add lookups for more concat overloads.
2860 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2862 * expression.cs: Emit shorter il code for array init.
2879 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
2881 * statement.cs: Before, two switch blocks would be merged if the
2882 total size of the blocks (end_item - begin_item + 1) was less than
2883 two times the combined sizes of the blocks.
2885 Now, it will only merge if after the merge at least half of the
2890 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
2892 * class.cs : csc build fix for GetMethods(). See bug #52503.
2894 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
2896 * expression.cs: Make sure fp comparisons work with NaN.
2897 This fixes bug #54303. Mig approved this patch a long
2898 time ago, but we were not able to test b/c the runtime
2901 2004-03-19 Miguel de Icaza <miguel@ximian.com>
2903 * ecore.cs (TypExpr.GetHashCode): implement this overload.
2905 2004-03-19 Martin Baulig <martin@ximian.com>
2907 * class.cs (MemberCore.IsDuplicateImplementation): Report the
2908 error here and not in our caller.
2910 2004-03-19 Martin Baulig <martin@ximian.com>
2912 * interface.cs: Completely killed this file.
2913 (Interface): We're now a TypeContainer and live in class.cs.
2915 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
2916 argument; we're now also called for interfaces.
2917 (TypeContainer.DefineMembers): Allow this method being called
2919 (TypeContainer.GetMethods): New public method; formerly known as
2920 Interface.GetMethod(). This is used by PendingImplementation.
2921 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
2922 it's now private and non-static.
2923 (Interface): Moved this here; it's now implemented similar to
2925 (Method, Property, Event, Indexer): Added `bool is_interface'
2926 argument to their .ctor's.
2927 (MemberBase.IsInterface): New public field.
2929 * cs-parser.jay: Create normal Method, Property, Event, Indexer
2930 instances instead of InterfaceMethod, InterfaceProperty, etc.
2931 (opt_interface_base): Removed; we now use `opt_class_base' instead.
2932 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
2934 2004-03-19 Martin Baulig <martin@ximian.com>
2936 * class.cs (MethodCore.IsDuplicateImplementation): New private
2937 method which does the CS0111 checking.
2938 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
2939 Use IsDuplicateImplementation().
2941 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
2943 * decl.cs (FindMemberToOverride): New method to find the correct
2944 method or property to override in the base class.
2946 - Make Method/Property use the above method to find the
2947 version in the base class.
2948 - Remove the InheritableMemberSignatureCompare as it is now
2951 This patch makes large code bases much faster to compile, as it is
2952 O(n) rather than O(n^2) to do this validation.
2954 Also, it fixes bug 52458 which is that nested classes are not
2955 taken into account when finding the base class member.
2957 Reviewed/Approved by Martin.
2959 2004-03-17 Marek Safar <marek.safar@seznam.cz>
2961 * interface.cs: In all interface classes removed redundant
2962 member initialization.
2964 2004-03-16 Martin Baulig <martin@ximian.com>
2966 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
2968 2004-03-15 Miguel de Icaza <miguel@ximian.com>
2970 * decl.cs (DefineTypeAndParents): New helper method to define a
2971 type's containers before the type itself is defined; This is a
2972 bug exposed by the recent changes to Windows.Forms when an
2973 implemented interface was defined inside a class that had not been
2976 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
2978 (Check): Loop correctly to report errors modifiers
2979 (UNSAFE was not in the loop, since it was the same as TOP).
2981 * interface.cs: Every interface member now takes a ModFlags,
2982 instead of a "is_new" bool, which we set on the base MemberCore.
2984 Every place where we called "UnsafeOk" in the interface, now we
2985 call the proper member (InterfaceMethod.UnsafeOK) instead to get
2986 the unsafe settings from the member declaration instead of the
2987 container interface.
2989 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
2991 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
2992 `set_indexer_name' to the pending bits (one per type).
2994 We fixed a bug today that was picking the wrong method to
2995 override, since for properties the existing InterfaceMethod code
2996 basically ignored the method name. Now we make sure that the
2997 method name is one of the valid indexer names.
2999 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
3001 * support.cs (SeekableStreamReader): Keep track of stream byte
3002 positions and don't mix them with character offsets to the buffer.
3004 Patch from Gustavo Giráldez
3006 2004-03-15 Marek Safar <marek.safar@seznam.cz>
3008 * interface.cs (InterfaceSetGetBase): Removed double member
3009 initialization, base class does it as well.
3011 2004-03-13 Martin Baulig <martin@ximian.com>
3013 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
3014 when compiling corlib.
3016 2004-03-13 Miguel de Icaza <miguel@ximian.com>
3018 * convert.cs (ExplicitConversion): We were reporting an error on
3019 certain conversions (object_type source to a value type, when the
3020 expression was `null') before we had a chance to pass it through
3021 the user defined conversions.
3023 * driver.cs: Replace / and \ in resource specifications to dots.
3026 * class.cs: Add check for duplicate operators. Fixes 52477
3028 2004-03-11 Miguel de Icaza <miguel@ximian.com>
3030 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
3031 that are in the middle of the statements, not only at the end.
3034 * class.cs (TypeContainer.AddField): No longer set the
3035 `HaveStaticConstructor' flag, now we call it
3036 `UserDefineStaticConstructor' to diferentiate the slightly
3037 semantic difference.
3039 The situation is that we were not adding BeforeFieldInit (from
3040 Modifiers.TypeAttr) to classes that could have it.
3041 BeforeFieldInit should be set to classes that have no static
3046 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
3048 And most importantly Zoltan's comment:
3050 http://bugzilla.ximian.com/show_bug.cgi?id=44229
3052 "I think beforefieldinit means 'it's ok to initialize the type sometime
3053 before its static fields are used', i.e. initialization does not need
3054 to be triggered by the first access to the type. Setting this flag
3055 helps the JIT to compile better code, since it can run the static
3056 constructor at JIT time, and does not need to generate code to call it
3057 (possibly lots of times) at runtime. Unfortunately, mcs does not set
3058 this flag for lots of classes like String.
3060 csc sets this flag if the type does not have an explicit static
3061 constructor. The reasoning seems to be that if there are only static
3062 initalizers for a type, and no static constructor, then the programmer
3063 does not care when this initialization happens, so beforefieldinit
3066 This bug prevents the AOT compiler from being usable, since it
3067 generates so many calls to mono_runtime_class_init that the AOT code
3068 is much slower than the JITted code. The JITted code is faster,
3069 because it does not generate these calls if the vtable is type is
3070 already initialized, which is true in the majority of cases. But the
3071 AOT compiler can't do this."
3073 2004-03-10 Miguel de Icaza <miguel@ximian.com>
3075 * class.cs (MethodData.Emit): Refactor the code so symbolic
3076 information is generated for destructors; For some reasons we
3077 were taking a code path that did not generate symbolic information
3080 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
3082 * class.cs: Create a Constructor.CheckBase method that
3083 takes care of all validation type code. The method
3084 contains some code that was moved from Define.
3086 It also includes new code that checks for duplicate ctors.
3087 This fixes bug #55148.
3089 2004-03-09 Joshua Tauberer <tauberer@for.net>
3091 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
3092 a { ... }-style array creation invokes EmitStaticInitializers
3093 which is not good for reference-type arrays. String, decimal
3094 and now null constants (NullCast) are not counted toward
3095 static initializers.
3097 2004-03-05 Martin Baulig <martin@ximian.com>
3099 * location.cs (SourceFile.HasLineDirective): New public field;
3100 specifies whether the file contains or is referenced by a "#line"
3102 (Location.DefineSymbolDocuments): Ignore source files which
3103 either contain or are referenced by a "#line" directive.
3105 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
3107 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
3108 direct access to our parent, so check the method inline there.
3110 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
3112 * expression.cs (Invocation.EmitCall): Miguel's last commit
3113 caused a regression. If you had:
3118 In Foo the implict this would be null.
3120 2004-02-27 Miguel de Icaza <miguel@ximian.com>
3122 * expression.cs (Invocation.EmitCall): If the method is not
3123 virtual, do not emit a CallVirt to it, use Call.
3125 * typemanager.cs (GetFullNameSignature): Improve the method to
3126 cope with ".ctor" and replace it with the type name.
3128 * class.cs (ConstructorInitializer.Resolve): Now the method takes
3129 as an argument the ConstructorBuilder where it is being defined,
3130 to catch the recursive constructor invocations.
3132 2004-02-26 Miguel de Icaza <miguel@ximian.com>
3134 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
3135 routines to check if a type is an enumerable/enumerator allow
3136 classes that implement the IEnumerable or IEnumerator interfaces.
3138 * class.cs (Property, Operator): Implement IIteratorContainer, and
3139 implement SetYields.
3141 (Property.Define): Do the block swapping for get_methods in the
3142 context of iterators. We need to check if Properties also
3143 include indexers or not.
3145 (Operator): Assign the Block before invoking the
3146 OperatorMethod.Define, so we can trigger the Iterator code
3149 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
3150 Property and Operator classes are not created when we parse the
3151 declarator but until we have the block completed, so we use a
3152 singleton SimpleIteratorContainer.Simple to flag whether the
3153 SetYields has been invoked.
3155 We propagate this setting then to the Property or the Operator to
3156 allow the `yield' to function.
3158 2004-02-25 Marek Safar <marek.safar@seznam.cz>
3160 * codegen.cs: Implemented attribute support for modules.
3161 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
3162 Assembly/Module functionality.
3164 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
3165 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
3166 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
3168 2004-02-16 Marek Safar <marek.safar@seznam.cz>
3170 * interface.cs (FindMembers): The operation is performed on all base
3171 interfaces and not only on the first. It is required for future CLS Compliance patch.
3173 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
3175 * statement.cs, codegen.cs:
3176 This patch deals with patterns such as:
3178 public class List : IEnumerable {
3180 public MyEnumerator GetEnumerator () {
3181 return new MyEnumerator(this);
3184 IEnumerator IEnumerable.GetEnumerator () {
3188 public struct MyEnumerator : IEnumerator {
3193 Before, there were a few things we did wrong:
3194 1) we would emit callvirt on a struct, which is illegal
3195 2) we emited ldarg when we needed to emit ldarga
3196 3) we would mistakenly call the interface methods on an enumerator
3197 type that derived from IEnumerator and was in another assembly. For example:
3199 public class MyEnumerator : IEnumerator
3201 Would have the interface methods called, even if there were public impls of the
3202 method. In a struct, this lead to invalid IL code.
3204 2004-02-11 Marek Safar <marek.safar@seznam.cz>
3206 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
3209 * delegate.cs (Define): Fixed crash when delegate type is undefined.
3211 2004-02-11 Miguel de Icaza <miguel@ximian.com>
3213 * cs-parser.jay: Fix small regression: we were not testing V2
3214 compiler features correctly.
3216 * interface.cs: If the emit context is null, then create one
3218 2004-02-09 Marek Safar <marek.safar@seznam.cz>
3220 * decl.cs (GetSignatureForError): New virtual method to get full name
3223 * attribute.cs (IAttributeSupport): New interface for attribute setting.
3224 Now it is possible to rewrite ApplyAttributes method to be less if/else.
3226 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
3227 Duplicated members and code in these classes has been removed.
3228 Better encapsulation in these classes.
3230 2004-02-07 Miguel de Icaza <miguel@ximian.com>
3232 * assign.cs (Assign.DoResolve): When dealing with compound
3233 assignments, there is a new rule in ECMA C# 2.4 (might have been
3234 there before, but it is documented here) that states that in:
3238 If b is of type int, and the `op' is a shift-operator, then the
3239 above is evaluated as:
3243 * expression.cs (Binary.ResolveOperator): Instead of testing for
3244 int/uint/long/ulong, try to implicitly convert to any of those
3245 types and use that in pointer arithmetic.
3247 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
3248 method to print information for from the type, not from the
3249 null-method we were given.
3251 2004-02-01 Duncan Mak <duncan@ximian.com>
3253 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
3254 parsing for cmd, fixes bug #53694.
3256 2004-02-04 Marek Safar <marek.safar@seznam.cz>
3258 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
3259 in the member name duplication tests. Property and operator name duplication
3260 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
3262 2004-02-03 Marek Safar <marek.safar@seznam.cz>
3264 * interface.cs (PopulateMethod): Fixed crash when interface method
3265 returns not existing type (error test cs0246-3.cs).
3267 2004-02-02 Ravi Pratap M <ravi@ximian.com>
3269 * cs-parser.jay (interface_accessors): Re-write actions to also
3270 store attributes attached to get and set methods. Fix spelling
3273 (inteface_property_declaration): Modify accordingly.
3275 (InterfaceAccessorInfo): New helper class to store information to pass
3276 around between rules that use interface_accessors.
3278 * interface.cs (Emit): Apply attributes on the get and set
3279 accessors of properties and indexers too.
3281 * attribute.cs (ApplyAttributes): Modify accordingly to use the
3282 right MethodBuilder when applying attributes to the get and set accessors.
3284 2004-01-31 Miguel de Icaza <miguel@ximian.com>
3286 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
3288 2004-01-26 Miguel de Icaza <miguel@ximian.com>
3290 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
3292 2004-01-25 Miguel de Icaza <miguel@ximian.com>
3294 * cs-parser.jay: Remove YIELD token, instead use the new grammar
3295 changes that treat `yield' specially when present before `break'
3298 * cs-tokenizer.cs: yield is no longer a keyword.
3300 2004-01-23 Marek Safar <marek.safar@seznam.cz>
3302 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
3303 setting for default constructors.
3304 For default constructors are almost every time set wrong Modifier. The
3305 generated IL code has been alright. But inside mcs this values was
3306 wrong and this was reason why several of my CLS Compliance tests
3309 2004-01-22 Martin Baulig <martin@ximian.com>
3311 * cs-parser.jay (namespace_or_type_name): Return an Expression,
3312 not a QualifiedIdentifier. This is what `type_name_expression'
3313 was previously doing.
3314 (type_name_expression): Removed; the code is now in
3315 `namespace_or_type_name'.
3316 (qualified_identifier): Removed, use `namespace_or_type_name'
3318 (QualifiedIdentifier): Removed this class.
3320 2004-01-22 Martin Baulig <martin@ximian.com>
3322 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
3323 not a string as alias name.
3325 2004-01-21 Miguel de Icaza <miguel@ximian.com>
3327 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
3328 #52730 bug, and instead compute correctly the need to use a
3329 temporary variable when requesting an address based on the
3330 static/instace modified of the field and the constructor.
3332 2004-01-21 Martin Baulig <martin@ximian.com>
3334 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
3335 class and namespace before looking up aliases. Fixes #52517.
3337 2004-01-21 Martin Baulig <martin@ximian.com>
3339 * flowanalysis.cs (UsageVector.Merge): Allow variables being
3340 assinged in a 'try'; fixes exception4.cs.
3342 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3343 * class.cs : Implemented parameter-less constructor for TypeContainer
3345 * decl.cs: Attributes are now stored here. New property OptAttributes
3347 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
3349 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
3351 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3353 * typemanager.cs (CSharpSignature): Now reports also inner class name.
3354 (CSharpSignature): New method for indexer and property signature.
3356 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3358 * pending.cs (IsVirtualFilter): Faster implementation.
3360 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3362 * typemanager.cs: Avoid inclusion of same assembly more than once.
3364 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3366 * cs-parser.jay: Fixed problem where the last assembly attribute
3367 has been applied also to following declaration (class, struct, etc.)
3369 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3371 * class.cs: Added error CS0538, CS0539 reporting.
3372 Fixed crash on Microsoft runtime when field type is void.
3374 * cs-parser.jay: Added error CS0537 reporting.
3376 * pending.cs: Added error CS0535 reporting.
3377 Improved error report for errors CS0536, CS0534.
3379 2004-01-20 Miguel de Icaza <miguel@ximian.com>
3381 Merge a few bits from the Anonymous Method MCS tree.
3383 * statement.cs (ToplevelBlock): New class for toplevel methods,
3384 will hold anonymous methods, lifted variables.
3386 * cs-parser.jay: Create toplevel blocks for delegates and for
3387 regular blocks of code.
3389 2004-01-20 Martin Baulig <martin@ximian.com>
3391 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
3392 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
3393 and `NeedExplicitReturn'; added `IsLastStatement'.
3394 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
3395 have a `ReturnLabel' or we're not unreachable.
3397 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
3398 child's reachability; don't just override ours with it. Fixes
3399 #58058 (lluis's example).
3400 (FlowBranching): Added public InTryOrCatch(), InCatch(),
3401 InFinally(), InLoop(), InSwitch() and
3402 BreakCrossesTryCatchBoundary() methods.
3404 * statement.cs (Return): Do all error checking in Resolve().
3405 Unless we are the last statement in a top-level block, always
3406 create a return label and jump to it.
3407 (Break, Continue): Do all error checking in Resolve(); also make
3408 sure we aren't leaving a `finally'.
3409 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
3410 statement in a top-level block.
3411 (Block.Flags): Added `IsDestructor'.
3412 (Block.IsDestructor): New public property.
3414 2004-01-20 Martin Baulig <martin@ximian.com>
3416 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
3418 2004-01-20 Martin Baulig <martin@ximian.com>
3420 * statement.cs (Statement.ResolveUnreachable): New public method.
3421 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
3422 (Block.Resolve): Resolve unreachable statements.
3424 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3426 * expression.cs: We need to fix the case where we do
3427 not have a temp variable here.
3429 * assign.cs: Only expression compound assignments need
3430 temporary variables.
3432 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3434 * flowanalysis.cs: Reduce memory allocation in a few ways:
3435 - A block with no variables should not allocate a bit
3437 - A method with no out parameters does not need any tracking
3438 for assignment of the parameters, so we need not allocate
3441 public readonly Type[] VariableTypes;
3442 public readonly string[] VariableNames;
3443 Are redundant. The data is already stored in the variable
3444 map, so we need not allocate another array for it.
3445 - We need to add alot of checks for if (params | locals) == null
3446 due to the first two changes.
3448 2004-01-18 Miguel de Icaza <miguel@ximian.com>
3450 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
3451 implement IMemoryLocation, we store a copy on a local variable and
3452 take the address of it. Patch from Benjamin Jemlich
3454 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
3455 to use a special "type_name_expression" rule which reduces the
3456 number of "QualifiedIdentifier" classes created, and instead
3457 directly creates MemberAccess expressions.
3459 2004-01-17 Miguel de Icaza <miguel@ximian.com>
3461 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
3462 that fixes #52853. Null literal assignment to ValueType
3464 * class.cs (MethodData.Emit): Instead of checking the name of the
3465 method to determine if its a destructor, create a new derived
3466 class from Method called Destructor, and test for that.
3468 * cs-parser.jay: Create a Destructor object instead of a Method.
3470 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
3474 2004-01-16 Miguel de Icaza <miguel@ximian.com>
3476 * expression.cs (Binary.ResolveOperator): Perform an implicit
3477 conversion from MethodGroups to their delegate types on the
3480 * delegate.cs: Introduce a new class DelegateCreation that is the
3481 base class for `NewDelegate' and `ImplicitDelegateCreation',
3482 factor some code in here.
3484 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
3485 conversion from MethodGroups to compatible delegate types.
3487 * ecore.cs (Expression.Resolve): Do not flag error 654
3488 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
3489 we allow conversions from MethodGroups to delegate types now.
3491 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
3492 assignments in v2 either.
3494 2004-01-10 Miguel de Icaza <miguel@ximian.com>
3496 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
3497 static read-only fields in ctors.
3499 Applied patch from Benjamin Jemlich
3501 * expression.cs (UnaryMutator): Avoid leaking local variables.
3503 2004-01-09 Miguel de Icaza <miguel@ximian.com>
3505 * cs-tokenizer.cs (IsCastToken): Allow the various native types
3506 here to return true, as they can be used like this:
3510 Fixed 49836 and all the other dups
3512 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
3514 * driver.cs: Implement /win32res and /win32icon.
3516 2004-01-08 Miguel de Icaza <miguel@ximian.com>
3518 * cs-parser.jay: Add a rule to improve error handling for the
3519 common mistake of placing modifiers after the type.
3521 2004-01-07 Miguel de Icaza <miguel@ximian.com>
3523 * cs-parser.jay (interface_event_declaration): Catch
3524 initialization of events on interfaces, and report cs0068
3526 * cs-parser.jay (interface_event_declaration): Catch
3527 initialization of events.
3529 * ecore.cs: Better report missing constructors.
3531 * expression.cs (Binary.ResolveOperator): My previous bug fix had
3532 the error reporting done in the wrong place. Fix.
3534 * expression.cs (Binary.ResolveOperator): Catch the
3535 operator + (E x, E y) error earlier, and later allow for implicit
3536 conversions in operator +/- (E e, U x) from U to the underlying
3539 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
3540 52596, if the container class is abstract, the default constructor
3541 is protected otherwise its public (before, we were always public).
3543 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
3546 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
3547 Jemlich that fixes bug #52597, MCS was generating invalid code for
3548 idisposable structs. Thanks to Ben for following up with this
3551 2004-01-06 Miguel de Icaza <miguel@ximian.com>
3553 * driver.cs: Allow assemblies without code to be generated, fixes
3556 2004-01-07 Nick Drochak <ndrochak@gol.com>
3558 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
3560 2004-01-05 Miguel de Icaza <miguel@ximian.com>
3562 * cs-parser.jay: Add rules to improve error reporting if fields or
3563 methods are declared at the namespace level (error 116)
3565 * Add rules to catch event add/remove
3567 2004-01-04 David Sheldon <dave-mono@earth.li>
3569 * expression.cs: Added matching ")" to error message for
3572 2004-01-03 Todd Berman <tberman@gentoo.org>
3574 * ecore.cs, attribute.cs:
3575 Applying fix from #52429.
3577 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3579 * ecore.cs, expression.cs, statement.cs:
3580 Total rewrite of how we handle branching. We
3581 now handle complex boolean expressions with fewer
3582 jumps. As well if (x == 0) no longer emits a ceq.
3584 if (x is Foo) is much faster now, because we generate
3587 Overall, we get a pretty big improvement on our benchmark
3588 tests. The code we generate is smaller and more readable.
3590 I did a full two-stage bootstrap. The patch was reviewed
3591 by Martin and Miguel.
3593 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3595 * cs-parser.jay: Make primary_expression not take a QI.
3596 we dont need this because the member_access rule covers
3597 us here. So we replace the rule with just IDENTIFIER.
3599 This has two good effects. First, we remove a s/r conflict.
3600 Second, we allocate many fewer QualifiedIdentifier objects.
3602 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3604 * attribute.cs: Handle MarshalAs attributes as pseudo, and
3605 set the correct information via SRE. This prevents
3606 hanging on the MS runtime. Fixes #29374.
3608 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3610 * convert.cs: correctly handle conversions to value types
3611 from Enum and ValueType as unboxing conversions.
3613 Fixes bug #52569. Patch by Benjamin Jemlich.
3615 2004-01-02 Ravi Pratap <ravi@ximian.com>
3617 * expression.cs (BetterConversion): Prefer int -> uint
3618 over int -> ulong (csc's behaviour). This fixed bug #52046.
3620 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
3622 * decl.cs (MemberCache.FindMembers): now returns a
3625 * typemanager.cs: In general, go with with ^^.
3626 (CopyNewMethods): take an IList.
3627 (RealMemberLookup): Only allocate an arraylist
3628 if we copy from two sets of methods.
3630 This change basically does two things:
3631 1) Fewer array lists allocated due to CopyNewMethods.
3632 2) the explicit cast in MemberList costed ALOT.
3634 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
3636 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
3637 a hashtable to avoid needless string allocations when an identifier is
3638 used more than once (the common case).
3640 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3642 * pending.cs: MS's TypeBuilder.GetInterfaces ()
3643 is broken, it will not return anything. So, we
3644 have to use the information we have in mcs to
3647 * typemanager.cs: Add a cache for GetInterfaces,
3648 since this will now be used more often (due to ^^)
3650 (GetExplicitInterfaces) New method that gets the
3651 declared, not effective, interfaces on a type
3652 builder (eg, if you have interface IFoo, interface
3653 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
3656 This patch makes MCS able to bootstrap itself on
3659 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3661 * expression.cs: Remove the Nop's that Miguel put
3664 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3666 * report.cs, codegen.cs: Give the real stack trace to
3667 the error when an exception is thrown.
3669 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3671 * decl.cs: only allocate hashtables for ifaces if
3674 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3676 * expression.cs: fix the error from cs0121-2.cs
3677 (a parent interface has two child interfaces that
3678 have a function with the same name and 0 params
3679 and the function is called through the parent).
3681 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
3683 * class.cs, rootcontext.cs, typmanager.cs: do not
3686 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
3688 * codegen.cs: remove stack for the ec flow branching.
3689 It is already a linked list, so no need.
3691 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
3693 * Makefile: Allow custom profiler here.
3695 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
3697 * typemanager.cs (LookupType):
3698 - Use a static char [], because split takes
3699 a param array for args, so it was allocating
3701 - Do not store true in a hashtable, it boxes.
3703 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
3705 * flowanalysis.cs: bytify common enums.
3707 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
3709 * modifiers.cs: Add a new set of flags for the
3710 flags allowed on explicit interface impls.
3711 * cs-parser.jay: catch the use of modifiers in
3712 interfaces correctly.
3713 * class.cs: catch private void IFoo.Blah ().
3715 All related to bug #50572.
3717 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
3719 * decl.cs: Rewrite the consistant accessability checking.
3720 Accessability is not linear, it must be implemented in
3721 a tableish way. Fixes #49704.
3723 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
3725 * expression.cs: Handle negation in a checked context.
3726 We must use subtraction from zero. Fixes #38674.
3728 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
3730 * class.cs: Ignore static void main in DLLs.
3731 * rootcontext.cs: Handle the target type here,
3732 since we are have to access it from class.cs
3733 * driver.cs: account for the above.
3735 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
3737 * report.cs: Give line numbers and files if available.
3739 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
3741 * driver.cs: Implement /addmodule.
3743 * typemanager.cs: Change 'modules' field so it now contains Modules not
3746 2003-12-20 Martin Baulig <martin@ximian.com>
3748 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
3749 (FieldBase.IsAssigned): Removed this field.
3750 (FieldBase.SetAssigned): New public method.
3751 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
3753 2003-12-20 Martin Baulig <martin@ximian.com>
3755 * expression.cs (LocalVariableReference.DoResolve): Don't set
3756 `vi.Used' if we're called from DoResolveLValue().
3758 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
3759 returns the usage vector it just merged into the current one -
3760 pass this one to UsageWarning().
3761 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
3762 of the `EmitContext', don't call this recursively on our children.
3764 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
3766 * driver.cs: Implement /target:module.
3768 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
3770 * support.cs (CharArrayHashtable): New helper class.
3772 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
3773 char arrays, not strings, so we can avoid creating a string in
3774 consume_identifier if the identifier is a keyword.
3776 2003-12-16 Martin Baulig <martin@ximian.com>
3778 * statement.cs (LocalInfo.Assigned): Removed this property.
3779 (LocalInfo.Flags): Removed `Assigned'.
3780 (LocalInfo.IsAssigned): New public method; takes the EmitContext
3781 and uses flow analysis.
3782 (Block.UsageWarning): Made this method private.
3783 (Block.Resolve): Call UsageWarning() if appropriate.
3785 * expression.cs (LocalVariableReference.DoResolve): Always set
3786 LocalInfo.Used here.
3788 2003-12-13 Martin Baulig <martin@ximian.com>
3790 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
3791 any value here; we're now using flow analysis to figure out
3792 whether a statement/block returns a value.
3794 2003-12-13 Martin Baulig <martin@ximian.com>
3796 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
3798 (FlowBranching.MergeFinally): Don't call
3799 `branching.CheckOutParameters()' here, this is called in
3801 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
3802 when adding the `finally' vector.
3804 2003-12-13 Martin Baulig <martin@ximian.com>
3807 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
3808 actually work and also fix #48962.
3810 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
3812 * decl.cs: Do not check System.Object for nested types,
3813 since we know it does not have any. Big bang for buck:
3818 corlib: 17.99 seconds
3822 corlib: 17.39 seconds
3824 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
3826 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
3827 time we are returning 0 members, so we save alot here.
3829 2003-12-11 Martin Baulig <martin@ximian.com>
3831 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
3832 `MergeChild()', also just take the `FlowBranching' as argument;
3833 call Merge() on it and return the result.
3834 (FlowBranching.Merge): We don't need to do anything if we just
3837 2003-12-11 Martin Baulig <martin@ximian.com>
3839 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
3840 them in an `ArrayList' to reduce memory usage. Thanks to Ben
3841 Maurer for this idea.
3843 2003-12-11 Martin Baulig <martin@ximian.com>
3845 * flowanalysis.cs (MergeResult): This class is now gone; we now
3846 use the `UsageVector' for this. The reason for this is that if a
3847 branching just has one sibling, we don't need to "merge" them at
3848 all - that's the next step to do.
3849 (FlowBranching.Merge): We now return a `UsageVector' instead of a
3852 2003-12-11 Martin Baulig <martin@ximian.com>
3854 Reworked flow analyis and made it more precise and bug-free. The
3855 most important change is that we're now using a special `Reachability'
3856 class instead of having "magic" meanings of `FlowReturns'. I'll
3857 do some more cleanups and optimizations and also add some more
3858 documentation this week.
3860 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
3861 largely reworked this class.
3862 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
3863 the new `Reachability' class instead of having "magic" values here.
3864 (FlowBranching): We're now using an instance of `Reachability'
3865 instead of having separate `Returns', `Breaks' etc. fields.
3867 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
3868 based on flow analysis; ignore the return value of block.Emit ().
3870 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
3872 * driver.cs typemanager.cs: Find the mono extensions to corlib even
3873 if they are private.
3875 2003-12-09 Martin Baulig <martin@ximian.com>
3877 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
3878 call them directly on the UsageVector.
3880 2003-12-09 Martin Baulig <martin@ximian.com>
3882 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
3883 Changed return type from `FlowReturns' to `Reachability'.
3885 2003-12-09 Martin Baulig <martin@ximian.com>
3887 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
3888 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
3889 `Reachable' fields with a single `Reachability' one.
3891 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3893 * class.cs (FindMembers): Remove foreach's.
3906 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3911 This patch does a few things:
3912 1. EmptyStatement is now a singleton, so it is never reallocated.
3913 2. All blah is EmptyStatement constructs have been changed to
3914 blah == EmptyStatement.Value, which is much faster and valid
3915 now that EmptyStatement is a singleton.
3916 3. When resolving a block, rather than allocating a new array for
3917 the non-empty statements, empty statements are replaced with
3918 EmptyStatement.Value
3919 4. Some recursive functions have been made non-recursive.
3920 Mainly the performance impact is from (3), however (1) and (2) are needed for
3921 this to work. (4) does not make a big difference in normal situations, however
3922 it makes the profile look saner.
3927 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3928 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3929 Total memory allocated: 56397 KB
3932 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
3933 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
3934 Total memory allocated: 55666 KB
3936 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3938 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
3939 than the hashtable in a hashtable version
3941 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
3942 we always end up concating a string. This results in a huge perf
3943 loss, because many strings have to be tracked by the GC. In this
3944 patch, we first use a hashtable that works with two keys, so that
3945 the strings do not need to be concat'ed.
3956 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3958 * Makefile: Add a new target `do-time' that does a quick and simple
3959 profile, leaving easy to parse output.
3961 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
3963 * codegen.cs (Init): Create the dynamic assembly with
3964 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
3966 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
3968 * support.cs: Make the PtrHashtable use only one
3969 instance of its comparer.
3971 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
3973 * typemanager.cs: Fix lookup of GetNamespaces.
3975 2003-11-29 Miguel de Icaza <miguel@ximian.com>
3977 * expression.cs: Removed redundant line.
3979 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
3980 ArrayLists, use for loops with bounds.
3982 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
3985 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
3986 arraylists, use for loop with bounds.
3988 The above three changes give us a 0.071 second performance
3989 improvement out of 3.294 seconds down to 3.223. On my machine
3990 the above changes reduced the memory usage by 1,387 KB during
3993 * cs-parser.jay (QualifiedIdentifier): New class used to represent
3994 QualifiedIdentifiers. Before we created a new string through
3995 concatenation, and mostly later on, the result would be
3996 manipulated by DecomposeQI through string manipulation.
3998 This reduced the compiler memory usage for bootstrapping from
3999 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
4000 compile times in 0.05 seconds.
4002 2003-11-28 Dick Porter <dick@ximian.com>
4004 * support.cs: Do string compares with the Invariant culture.
4012 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
4013 the comparison is done with the Invariant culture.
4015 2003-11-27 Miguel de Icaza <miguel@ximian.com>
4017 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
4018 GetEnumerator method.
4020 (ProbeCollectionType): Iterate starting at the most specific type
4021 upwards looking for a GetEnumerator
4023 * expression.cs: Shift count can be up to 31 for int/uint and 63
4026 2003-11-26 Miguel de Icaza <miguel@ximian.com>
4028 * statement.cs (Block.LookupLabel): Also look for the label on the
4029 children blocks. Use a hash table to keep track of visited
4032 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
4033 we actually did transform the other operand, otherwise fall back
4034 to the common codepath that casts to long.
4036 * cs-tokenizer.cs: Use the same code pattern as the int case.
4037 Maybe I should do the parsing myself, and avoid depending on the
4038 Parse routines to get this done.
4040 2003-11-25 Miguel de Icaza <miguel@ximian.com>
4042 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4043 which fixes bug 51347. This time test it.
4045 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
4046 attributes for example can not tell the difference between these.
4047 The difference was only a syntax feature of the language.
4049 * attribute.cs: Apply attributes to delegates.
4051 * delegate.cs: Call the apply attributes method.
4053 2003-11-24 Miguel de Icaza <miguel@ximian.com>
4055 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
4056 comparing 0 vs Byte.MinValue, not the value
4058 (ImplicitConversionRequired): When reporting a conversion error,
4059 use error 31 to print out the constant error instead of the
4062 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4063 which fixes bug 51347.
4065 2003-11-22 Miguel de Icaza <miguel@ximian.com>
4067 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
4068 which fixes the -warnaserror command line option.
4070 2003-11-21 Miguel de Icaza <miguel@ximian.com>
4072 * cfold.cs (DoNumericPromotions): During constant folding of
4073 additions on UIntConstant, special case intconstants with
4074 IntConstants like we do on the expression binary operator.
4076 2003-11-12 Miguel de Icaza <miguel@ximian.com>
4078 * convert.cs (ImplicitReferenceConversion): We were missing a case
4079 (System.Enum are not value types or class types, so we need to
4080 classify them separatedly).
4082 * driver.cs: We do not support error 2007.
4084 2003-11-12 Jackson Harper <jackson@ximian.com>
4086 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
4087 system directory. Also use the full file name so users can
4088 libraries names mscorlib-o-tron.dll in a non system dir.
4090 2003-11-10 Martin Baulig <martin@ximian.com>
4092 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
4093 (TypeManager.InitCoreTypes): Initialize them here, but instead of
4094 calling `ResolveType()' on them, directly assign their `Type'.
4096 2003-11-08 Martin Baulig <martin@ximian.com>
4098 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
4099 return value and the `out parent' parameter.
4100 (TypeContainer.DefineType): Moved the CS0644 check into
4101 GetClassBases(). Don't pass the interface types to the
4102 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
4103 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
4105 * ecore.cs (TypeExpr.IsAttribute): New property.
4106 (TypeExpr.GetInterfaces): New method.
4108 * interface.cs (Interface.GetInterfaceTypeByName): Return a
4109 TypeExpr instead of a Type.
4110 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
4111 (Interface.DefineType): Don't pass the interface types to the
4112 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
4113 them later and then call `TypeBulider.AddInterfaceImplementation()'.
4115 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
4116 instead of a `Type[]'.
4117 (TypeManager.RegisterBuilder): Likewise.
4118 (TypeManager.AddUserInterface): Likewise.
4119 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
4120 `Type[]' and also return a `TypeExpr[]'.
4121 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
4123 2003-11-08 Martin Baulig <martin@ximian.com>
4125 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
4128 2003-11-08 Martin Baulig <martin@ximian.com>
4130 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
4131 TypeManager.ResolveExpressionTypes().
4133 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
4134 instead of an Expression.
4135 (TypeExpr): This is now an abstract base class for `TypeExpression'.
4136 (TypeExpression): New public class; formerly known as `TypeExpr'.
4138 * expression.cs (ComposedCast): Derive from TypeExpr.
4140 * typemanager.cs (TypeManager.system_*_expr): These are now
4141 TypExpr's instead of Expression's.
4142 (TypeManager.ResolveExpressionTypes): New public static function;
4143 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
4146 2003-11-06 Miguel de Icaza <miguel@ximian.com>
4148 * expression.cs (New.DoResolve): Do not dereference value that
4149 might be a null return.
4151 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
4152 sure that the constant value has the right type. Fixes an
4153 unreported bug, similar to 50425.
4155 * const.cs (Const.LookupConstantValue): Call
4156 ImplicitStandardConversionExists before doing a conversion to
4157 avoid havng the TypeManager.ChangeType do conversions.
4159 Reduced the number of casts used
4161 (Const.ChangeType): New routine to enable reuse of the constant
4162 type changing code from statement.
4164 * typemanager.cs (ChangeType): Move common initialization to
4165 static global variables.
4169 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
4170 every value type to go through, even if it was void. Fix that.
4172 * cs-tokenizer.cs: Use is_identifier_start_character on the start
4173 character of the define, and the is_identifier_part_character for
4174 the rest of the string.
4176 2003-11-05 Miguel de Icaza <miguel@ximian.com>
4178 * expression.cs (UnaryMutator.EmitCode): When I updated
4179 LocalVariableReference.DoResolve, I overdid it, and dropped an
4180 optimization done on local variable references.
4182 2003-11-04 Miguel de Icaza <miguel@ximian.com>
4184 * ecore.cs: Convert the return from Ldlen into an int.
4186 2003-10-20 Miguel de Icaza <miguel@ximian.com>
4188 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
4189 the accessibility, this is a special case for toplevel non-public
4190 classes (internal for instance).
4192 2003-10-20 Nick Drochak <ndrochak@gol.com>
4194 * ecore.cs: Fix typo and build. Needed another right paren.
4196 2003-10-19 Miguel de Icaza <miguel@ximian.com>
4198 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
4199 `internal' case regular and protected, but not allowing protected
4200 to be evaluated later. Bug 49840
4202 2003-10-15 Miguel de Icaza <miguel@ximian.com>
4204 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
4205 to kb.Nlast, and not the kb.nFirst to isolate the switch
4208 Extract the underlying type, so enumerations of long/ulong are
4209 treated like long/ulong.
4211 2003-10-14 Miguel de Icaza <miguel@ximian.com>
4213 * expression.cs (New): Overload the meaning of RequestedType to
4214 track the possible creation of the NewDelegate type, since
4215 DoResolve is invoked more than once for new constructors on field
4218 See bugs: #48800 and #37014
4220 * cs-parser.jay (declare_local_constants): Take an arraylist
4221 instead of a single constant.
4223 (local_constant_declaration): It should take a
4224 constant_declarators, not a constant_declarator. Fixes 49487
4226 * convert.cs: Fix error report.
4228 2003-10-13 Jackson Harper <jackson@ximian.com>
4230 * typemanager.cs (TypeToCoreType): Add float and double this fixes
4233 2003-10-09 Martin Baulig <martin@ximian.com>
4235 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
4237 (MethodCore.DoDefineParameters): Removed the TypeContainer
4238 argument; use the DeclSpace which was passed to the .ctor instead.
4239 (MethodCore.CheckParameter): Take a DeclSpace instead of a
4240 TypeContainer; we only need a DeclSpace here.
4242 2003-10-09 Martin Baulig <martin@ximian.com>
4244 * class.cs (MethodData): Added additional `DeclSpace ds' argument
4246 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
4247 EmitContext's .ctor.
4249 2003-10-09 Martin Baulig <martin@ximian.com>
4251 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
4252 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
4253 AsAccessible(), moved them as well.
4255 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
4257 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
4259 * cs-parser.jay : Renamed yyName to yyNames related to jay.
4261 2003-10-07 Miguel de Icaza <miguel@ximian.com>
4263 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
4264 generation for >=, as spotted by Paolo, bug 48679.
4265 Patch from David Waite.
4267 * cs-tokenizer.cs: Add handling for #pragma.
4269 * cs-parser.jay: Allow for both yield and yield return in the
4270 syntax. The anti-cobolization of C# fight will go on!
4272 * class.cs (TypeBuilder.DefineType): Catch error condition here
4273 (Parent.DefineType erroring out and returning null).
4275 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4276 coping with enumerations variables, we were mistakenly processing
4277 them as a regular value type instead of built-in types. Fixes the
4280 * typemanager.cs (IsBuiltinOrEnum): New method.
4282 2003-09-30 Miguel de Icaza <miguel@ximian.com>
4284 * cs-parser.jay: Upgrade: yield now needs the return clause.
4286 2003-09-19 Martin Baulig <martin@ximian.com>
4288 * decl.cs (MemberCache.SetupCacheForInterface): Take a
4289 `MemberCache parent' argument. Normally, an interface doesn't
4290 have a parent type except System.Object, but we use this in gmcs
4291 for generic type parameters.
4293 2003-09-18 Martin Baulig <martin@ximian.com>
4295 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
4296 on `type.IsInterface'; don't check whether the type has a parent
4297 to determine whether it's an interface.
4299 2003-09-15 Martin Baulig <martin@ximian.com>
4301 * class.cs (TypeContainer.DefineType): Added an error flag to
4302 avoid reporting duplicate CS0146's ("class definition is
4305 * driver.cs (Driver.MainDriver): Abort if
4306 RootContext.ResolveTree() reported any errors.
4308 2003-09-07 Martin Baulig <martin@ximian.com>
4310 * report.cs (Error, Warning): Added overloaded versions which take
4311 a `params object[] args' and call String.Format().
4313 2003-09-07 Martin Baulig <martin@ximian.com>
4315 * decl.cs (DeclSpace..ctor): Don't call
4316 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
4317 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
4318 (DeclSpace.RecordDecl): New method.
4320 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
4322 2003-09-02 Ravi Pratap <ravi@ximian.com>
4324 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
4325 value attributes to be applied to ParameterBuilders.
4327 * class.cs (MethodCore.LabelParameters): Make static and more
4328 generic so that it can be used from other places - like interface
4329 methods, for instance.
4331 * interface.cs (Interface.Emit): Call LabelParameters before
4332 emitting attributes on the InterfaceMethod.
4334 2003-08-26 Martin Baulig <martin@ximian.com>
4336 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
4337 resolving aliases; fixes #47927.
4339 2003-08-26 Martin Baulig <martin@ximian.com>
4341 * statement.cs (Using.DoResolve): This is internally emitting a
4342 try/finally clause, so we need to set ec.NeedExplicitReturn if we
4343 do not always return. Fixes #47681.
4345 2003-08-26 Martin Baulig <martin@ximian.com>
4347 * decl.cs (MemberCore): Moved WarningNotHiding(),
4348 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
4350 (AdditionResult): Make this nested in DeclSpace.
4351 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
4352 argument; call NamespaceEntry.Define() unless we're nested in a
4355 * namespace.cs (Namespace.DefineName): New public function. This
4356 is called from DeclSpace's .ctor to add
4357 (Namespace.Lookup): Include DeclSpaces in the lookup.
4359 * class.cs (Operator): Derive from MemberBase, not MemberCore.
4361 * const.cs (Const): Derive from MemberBase, not MemberCore.
4363 2003-08-25 Martin Baulig <martin@ximian.com>
4365 * convert.cs (Convert.ExplicitReferenceConversion): When
4366 converting from an interface type to a class, unbox if the target
4367 type is a struct type. Fixes #47822.
4369 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4371 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
4374 2003-08-22 Martin Baulig <martin@ximian.com>
4376 * class.cs (TypeManager.DefineType): When defining a nested type,
4377 call DefineType() on our parent; fixes #47801.
4379 2003-08-22 Martin Baulig <martin@ximian.com>
4381 * class.cs (MethodData.Define): While checking if a method is an
4382 interface implementation, improve the test a bit more to fix #47654.
4384 2003-08-22 Martin Baulig <martin@ximian.com>
4386 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
4387 correctly; fixes #47722.
4389 2003-08-22 Martin Baulig <martin@ximian.com>
4391 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
4392 LocalVariableReference, ensure it's not read-only. Fixes #47536.
4394 * statement.cs (Fixed.DoResolve): Make all variables read-only.
4396 2003-08-22 Martin Baulig <martin@ximian.com>
4398 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
4399 can only be assigned in static constructors. Fixes #47161.
4401 2003-08-22 Martin Baulig <martin@ximian.com>
4403 Rewrote and improved the flow analysis code.
4405 * flowbranching.cs (FlowBranching): Make this class abstract.
4406 (FlowBranching.CreateBranching): New static function to create a
4408 (FlowBranchingBlock, FlowBranchingException): New classes.
4409 (FlowBranching.UsageVector.Type): New public readonly field.
4410 (FlowBranching.UsageVector.Breaks): Removed the setter.
4411 (FlowBranching.UsageVector.Returns): Removed the setter.
4412 (FlowBranching.UsageVector): Added Break(), Return(),
4413 NeverReachable() and Throw() methods to modify the reachability.
4414 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
4415 done by FlowBranching.Merge().
4416 (FlowBranching.UsageVector.MergeChild): New method; merges the
4417 merge result into the current vector.
4418 (FlowBranching.Merge): New abstract method to merge a branching.
4420 2003-08-12 Martin Baulig <martin@ximian.com>
4422 * expression.cs (Indirection.CacheTemporaries): Create the
4423 LocalTemporary with the pointer type, not its element type.
4425 2003-08-10 Miguel de Icaza <miguel@ximian.com>
4427 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
4428 token was a keyword or not.
4430 Add `error' options where an IDENTIFIER was expected; Provide
4431 CheckToken and CheckIdentifierToken convenience error reporting
4434 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
4436 * decl.cs: Rename `NamespaceEntry Namespace' public field into
4437 NameSpaceEntry NameSpaceEntry.
4439 (LookupInterfaceOrClass): Avoid creating a full qualified name
4440 from namespace and name: avoid doing lookups when we know the
4441 namespace is non-existant. Use new Tree.LookupByNamespace which
4442 looks up DeclSpaces based on their namespace, name pair.
4444 * driver.cs: Provide a new `parser verbose' to display the
4445 exception thrown during parsing. This is turned off by default
4446 now, so the output of a failure from mcs is more graceful.
4448 * namespace.cs: Track all the namespaces defined in a hashtable
4451 (IsNamespace): New method
4453 2003-08-09 Miguel de Icaza <miguel@ximian.com>
4455 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
4456 we know that we need to concatenate (full typename can never be
4461 * statement.cs: Use a bitfield; Do not initialize to null things
4462 which are done by the constructor by default.
4464 * cs-parser.jay: bug fix, parameter was 4, not 3.
4466 * expression.cs: Just use the property;
4468 * statement.cs: No need for GetVariableInfo method.
4470 2003-08-08 Martin Baulig <martin@ximian.com>
4472 * flowanalysis.cs (FlowReturns): This is now nested in the
4473 `FlowBranching' class.
4474 (MyBitVector): Moved this here from statement.cs.
4475 (FlowBranching.SiblingType): New enum type.
4476 (FlowBranching.CreateSibling): Added `SiblingType' argument.
4478 2003-08-07 Martin Baulig <martin@ximian.com>
4480 * flowanalysis.cs (FlowBranchingType): This is now nested in the
4481 `FlowBranching' class and called `BranchingType'.
4483 2003-08-07 Martin Baulig <martin@ximian.com>
4485 * flowanalysis.cs: Moved all the control flow analysis code into
4488 2003-08-07 Martin Baulig <martin@ximian.com>
4490 * assign.cs (Assign.DoResolve): `target' must either be an
4491 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
4494 2003-08-07 Miguel de Icaza <miguel@ximian.com>
4496 * expression.cs (BinaryMethod): This kind of expression is created by the
4497 Binary class if it determines that the operator has to be handled
4500 (BinaryDelegate): This kind of expression is created if we are
4501 dealing with a + or - operator on delegates.
4503 (Binary): remove method, argumetns, and DelegateOperator: when
4504 dealing with methods,
4506 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
4508 * statement.cs (Block): use bitfields for the three extra booleans
4509 we had in use. Remove unused topblock parameter.
4511 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
4513 * assign.cs: Drop extra unneeded tests.
4515 2003-08-06 Miguel de Icaza <miguel@ximian.com>
4517 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
4519 * statement.cs (Foreach): Use VariableStorage instead of
4522 * codegen.cs (VariableStorage): New class used by clients that
4523 require a variable stored: locals or fields for variables that
4524 need to live across yield.
4526 Maybe provide a convenience api for EmitThis+EmitLoad?
4528 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
4531 2003-08-05 Miguel de Icaza <miguel@ximian.com>
4533 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
4534 RemapParameterLValue): New methods that are used to turn a
4535 precomputed FieldInfo into an expression like this:
4539 The idea is to use this instead of making LocalVariableReference
4540 have more than one meaning.
4542 * cs-parser.jay: Add error production to BASE.
4544 * ecore.cs: Deal with TypeManager.GetField returning null, which
4545 is now a valid return value.
4547 (FieldExprNoAddress): New expression for Fields whose address can
4550 * expression.cs (LocalVariableReference): During the resolve
4551 phases, create new expressions if we are in a remapping context.
4552 Remove code that dealt with remapping here.
4554 (ParameterReference): same.
4556 (ProxyInstance): New expression, like the `This' expression, but
4557 it is born fully resolved. We know what we are doing, so remove
4558 the errors that are targeted to user-provided uses of `this'.
4560 * statement.cs (Foreach): our variable is now stored as an
4561 Expression; During resolution, follow the protocol, dont just
4562 assume it will return this.
4564 2003-08-06 Martin Baulig <martin@ximian.com>
4566 * support.cs (SeekableStreamReader.cs): New public class.
4568 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
4569 SeekableStreamReader instead of the normal StreamReader.
4571 2003-08-04 Martin Baulig <martin@ximian.com>
4573 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
4574 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
4575 deambiguate casts and delegate invocations.
4576 (parenthesized_expression): Use the new tokens to ensure this is
4577 not a cast of method invocation.
4579 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
4580 when reading a `)' and Deambiguate_CloseParens () was previously
4583 * expression.cs (ParenthesizedExpression): New class. This is
4584 just used for the CS0075 test.
4585 (Binary.DoResolve): Check for CS0075.
4587 2003-07-29 Ravi Pratap <ravi@ximian.com>
4589 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
4590 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
4591 reference comparison.
4593 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
4594 examine the ReturnType for equality - this is necessary in the
4595 cases of implicit and explicit operators whose signature also
4596 includes the return type.
4598 2003-07-26 Miguel de Icaza <miguel@ximian.com>
4600 * namespace.cs: Cache the result of the namespace computation,
4601 instead of computing it every time.
4603 2003-07-24 Miguel de Icaza <miguel@ximian.com>
4605 * decl.cs: Use a global arraylist that we reuse over invocations
4606 to avoid excesive memory consumption. Reduces memory usage on an
4607 mcs compile by one meg (45 average).
4609 * typemanager.cs (LookupTypeReflection): In .NET pointers are
4610 private, work around that.
4612 2003-07-23 Miguel de Icaza <miguel@ximian.com>
4614 * literal.cs (IntLiteral): Define Zero and One static literals.
4616 * cs-parser.jay (integer_literal): use static literals to reduce
4617 memory usage for the most used literals (0, 1 and -1). 211kb
4618 reduced in memory usage.
4620 Replace all calls to `new ArrayList' with `new
4621 ArrayList(4)' which is a good average number for most allocations,
4622 and also requires only 16 bytes of memory for its buffer by
4625 This reduced MCS memory usage in seven megabytes for the RSS after
4628 2003-07-28 Ravi Pratap <ravi@ximian.com>
4630 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
4631 handle params methods the correct way by forming only one
4632 applicable set with params and normal methods in them. Earlier we
4633 were looking at params methods only if we found no normal methods
4634 which was not the correct thing to do.
4636 (Invocation.BetterFunction): Take separate arguments indicating
4637 when candidate and the best method are params methods in their
4640 This fixes bugs #43367 and #46199.
4642 * attribute.cs: Documentation updates.
4644 (CheckAttribute): Rename to CheckAttributeTarget.
4645 (GetValidPlaces): Rename to GetValidTargets.
4647 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
4648 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
4652 2003-07-28 Martin Baulig <martin@ximian.com>
4654 * class.cs (TypeContainer.DefineMembers): Use the base type's full
4655 name when looking up the base class of a nested class. Fixes #46977.
4657 2003-07-26 Martin Baulig <martin@ximian.com>
4659 * expression.cs (Indexers.Indexer): New nested struct; contains
4660 getter, setter and the indexer's type.
4661 (Indexers.Properties): This is now an ArrayList of
4663 (IndexerAccess.DoResolveLValue): Correctly set the type if the
4664 indexer doesn't have any getters.
4666 * assign.cs (Assign.DoResolve): Also do the implicit conversions
4667 for embedded property and indexer assignments.
4669 2003-07-26 Martin Baulig <martin@ximian.com>
4671 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
4672 preprocessor directive is not the first non-whitespace character
4675 2003-07-26 Martin Baulig <martin@ximian.com>
4677 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
4678 namespace parsing, follow the spec more closely.
4680 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
4681 NamespaceEntry.Lookup().
4683 2003-07-25 Martin Baulig <martin@ximian.com>
4685 * MethodCore.cs (OverridesSomething): New public field; it's set
4686 from TypeContainer.DefineMembers if this method overrides
4687 something (which doesn't need to be a method). Fix #39462.
4689 2003-07-25 Ravi Pratap <ravi@ximian.com>
4691 * typemanager.cs (GetMembers): Ensure that the list of members is
4692 reversed. This keeps things in sync.
4694 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
4695 find an AttributeUsage attribute.
4697 * expression.cs (Invocation.OverloadResolve): Perform the check
4698 which disallows Invoke to be directly called on a Delegate.
4700 (Error_InvokeOnDelegate): Report error cs1533.
4702 2003-07-25 Martin Baulig <martin@ximian.com>
4704 * expression.cs (Indexers.GetIndexersForType): Only look in the
4705 interface hierarchy if the requested type is already an
4706 interface. Fixes #46788 while keeping #46502 fixed.
4708 2003-07-25 Martin Baulig <martin@ximian.com>
4710 * class.cs (TypeContainer.DefineMembers): Check whether all
4711 readonly fields have been assigned and report warning CS0649 if
4714 * statement.cs (LocalInfo.IsFixed): Always return true if this is
4717 2003-07-24 Ravi Pratap <ravi@ximian.com>
4719 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
4720 returned from GetMethods to make things consistent with the
4721 assumptions MCS makes about ordering of methods.
4723 This should comprehensively fix bug #45127 and it does :-)
4725 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
4726 ordering is actually reverse.
4728 * Clean up some debug messages I left lying around.
4730 * interface.cs (Populate*): Get rid of code which emits attributes
4731 since the stage in which we emit attributes is the 'Emit' stage,
4732 not the define stage.
4734 (Emit): Move attribute emission for interface members here.
4736 2003-07-22 Ravi Pratap <ravi@ximian.com>
4738 * expression.cs (Invocation.OverloadResolve): Follow the spec more
4739 closely: we eliminate methods in base types when we have an
4740 applicable method in a top-level type.
4742 Please see section 14.5.5.1 for an exact description of what goes
4745 This fixes bug #45127 and a host of other related to corlib compilation.
4747 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
4748 array is the method corresponding to the top-level type (this is
4749 because of the changes made to icall.c) so we change this
4752 (MethodGroupExpr.Name): This too.
4754 * typemanager.cs (GetElementType): New method which does the right
4755 thing when compiling corlib.
4757 * everywhere: Make use of the above in the relevant places.
4759 2003-07-22 Martin Baulig <martin@ximian.com>
4761 * cs-parser.jay (invocation_expression): Moved
4762 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
4763 `cast_expression', but create a InvocationOrCast which later
4764 resolves to either an Invocation or a Cast.
4766 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
4767 method; call this before EmitStatement() to make sure that this
4768 expression can be used as a statement.
4770 * expression.cs (InvocationOrCast): New class; resolves to either
4771 an Invocation or a Cast.
4773 * statement.cs (StatementExpression): Call ResolveStatement() on
4774 the ExpressionStatement before emitting it.
4776 2003-07-21 Martin Baulig <martin@ximian.com>
4778 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
4779 `ref' and `out' attributes match; fixes #46220.
4780 (MemberAccess.ResolveMemberAccess): You can't reference a type
4781 through an expression; fixes #33180.
4782 (Indexers.GetIndexersForType): Don't return the indexers from
4783 interfaces the class implements; fixes #46502.
4785 2003-07-21 Martin Baulig <martin@ximian.com>
4787 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
4788 CS0661 checks; fixes bug #30442.
4790 2003-07-21 Martin Baulig <martin@ximian.com>
4792 * decl.cs (AdditionResult): Added `Error'.
4794 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
4796 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
4797 makes cs0031.cs actually work.
4799 2003-07-20 Martin Baulig <martin@ximian.com>
4801 * namespace.cs: Fixed that bug which caused a crash when compiling
4804 2003-07-20 Miguel de Icaza <miguel@ximian.com>
4806 * typemanager.cs (LookupTypeReflection): Never expose types which
4807 are NotPublic, NestedPrivate, NestedAssembly, or
4808 NestedFamANDAssem. We used to return these, and later do a check
4809 that would report a meaningful error, but the problem is that we
4810 would not get the real match, if there was a name override.
4812 2003-07-18 Miguel de Icaza <miguel@ximian.com>
4814 * namespace.cs (Namespace, Name): Do not compute the namespace
4815 name dynamically, compute it in the constructor. This reduced
4816 memory usage by 1697 KB.
4818 * driver.cs: Use --pause to pause at the end.
4820 2003-07-17 Peter Williams <peter@newton.cx>
4822 * Makefile: Change the name of the test target so that it doesn't
4823 conflict with the recursive test target.
4825 2003-07-17 Miguel de Icaza <miguel@ximian.com>
4827 * expression.cs (LocalVariableReference.Emit, EmitAssign,
4828 AddressOf): Do not use EmitThis, that was wrong, use the actual
4831 2003-07-15 Miguel de Icaza <miguel@ximian.com>
4833 * class.cs (MethodData.Define): While checking if a method is an
4834 interface implementation, improve the test: If we are not public
4835 (use new test here: use the computed MethodAttributes directly,
4836 instead of the parsed modifier flags) check if the `implementing'
4837 method comes from an interface or not.
4839 * pending.cs (VerifyPendingMethods): Slightly better error
4842 * makefile: add test target that does the mcs bootstrap.
4844 2003-07-16 Ravi Pratap <ravi@ximian.com>
4846 * interface.cs (Define): Do nothing here since there are no
4847 members to populate etc. Move the attribute emission out of here
4848 since this was just totally the wrong place to put it. Attribute
4849 application happens during the 'Emit' phase, not in the 'Define'
4852 (Emit): Add this method and move the attribute emission here
4854 * rootcontext.cs (EmitCode): Call the Emit method on interface
4857 2003-07-14 Ravi Pratap M <ravi@ximian.com>
4859 * expression.cs (OverloadResolve): Report error only if Location
4860 is not 'Null' which means that there was a probe going on.
4862 2003-07-14 Martin Baulig <martin@ximian.com>
4864 * expression.cs (ConditionalLogicalOperator): New public class to
4865 implement user defined conditional logical operators.
4866 This is section 14.11.2 in the spec and bug #40505.
4868 2003-07-14 Martin Baulig <martin@ximian.com>
4870 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
4872 2003-07-14 Martin Baulig <martin@ximian.com>
4874 * codegen.cs (EmitContext.InFixedInitializer): New public field.
4876 * ecore.cs (IVariable.VerifyFixed): New interface method.
4878 * expression.cs (Unary.ResolveOperator): When resolving the `&'
4879 operator, check whether the variable is actually fixed. Fixes bug
4880 #36055. Set a variable definitely assigned when taking its
4881 address as required by the spec.
4883 * statement.cs (LocalInfo.IsFixed): New field.
4884 (LocalInfo.MakePinned): Set `IsFixed' to true.
4886 2003-07-14 Ravi Pratap M <ravi@ximian.com>
4888 * attribute.cs (Attribute.Resolve): While doing a Member lookup
4889 for .ctors, ensure that we only ask for members declared in the
4890 attribute type (BindingFlags.DeclaredOnly).
4894 * expression.cs (Error_WrongNumArguments): Report error 1501
4895 correctly the way CSC does.
4897 2003-07-13 Martin Baulig <martin@ximian.com>
4899 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
4900 lookup on the fully qualified name, to make things like "X.X" work
4901 where "X.X" is a fully qualified type name, but we also have a
4902 namespace "X" in the using list. Fixes #41975.
4904 2003-07-13 Martin Baulig <martin@ximian.com>
4906 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
4907 function. If we're a CompoundAssign, we need to create an embedded
4908 CompoundAssign, not an embedded Assign.
4909 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
4912 2003-07-13 Martin Baulig <martin@ximian.com>
4914 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
4915 work to fix bug #46088.
4917 2003-07-13 Ravi Pratap <ravi@ximian.com>
4919 * class.cs (Operator.Emit): Do not emit attributes here - it is
4920 taken care of by the Method class that we delegate too. This takes
4923 2003-07-10 Martin Baulig <martin@ximian.com>
4925 * expression.cs (TypeOfVoid): New class.
4926 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
4928 2003-07-10 Martin Baulig <martin@ximian.com>
4930 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
4933 2003-07-10 Martin Baulig <martin@ximian.com>
4935 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
4936 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
4938 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
4940 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
4942 2003-07-10 Martin Baulig <martin@ximian.com>
4944 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
4945 of decimal. Fixes #42850.
4947 NOTE: I also fixed the created byte blob, but this doesn't work on
4948 the MS runtime and csc never produces any byte blobs for decimal
4951 2003-07-10 Martin Baulig <martin@ximian.com>
4953 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
4954 structs; fixes #32068.
4955 (Block.AddChildVariableNames): Fixed #44302.
4957 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4959 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
4961 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4963 * attribute.cs: And this test is onger needed.
4965 2003-07-08 Martin Baulig <martin@ximian.com>
4967 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
4968 inaccessible types. Fixes #36313.
4970 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
4972 * namespace.cs (NamespaceEntry): Create implicit entries for all
4973 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
4974 implicit entries for N1.N2 and N1.
4976 2003-07-08 Martin Baulig <martin@ximian.com>
4978 Rewrote the handling of namespaces to fix a lot of the issues
4979 wrt. `using' aliases etc.
4981 * namespace.cs (Namespace): Splitted this class into a
4982 per-assembly `Namespace' and a per-file `NamespaceEntry'.
4984 * typemanager.cs (TypeManager.IsNamespace): Removed.
4985 (TypeManager.ComputeNamespaces): Only compute namespaces from
4986 loaded assemblies here, not the namespaces from the assembly we're
4987 currently compiling.
4989 2003-07-08 Martin Baulig <martin@ximian.com>
4991 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
4993 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4995 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
4998 I thought about the memory savings here, but LookupTypeReflection
4999 is used under already very constrained scenarios. Compiling
5000 corlib or mcs only exposes one hit, so it would not really reduce
5001 any memory consumption.
5003 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5005 * typemanager.cs: fixes bug #45889 by only adding public types from
5006 other assemblies to the list of known types.
5008 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5010 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
5011 on the type we resolved.
5013 2003-07-05 Martin Baulig <martin@ximian.com>
5015 * pending.cs (PendingImplementation.ParentImplements): Don't
5016 create the proxy if the parent is abstract.
5018 * class.cs (TypeContainer.DefineIndexers): Process explicit
5019 interface implementations first. Fixes #37714.
5021 2003-07-04 Miguel de Icaza <miguel@ximian.com>
5023 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
5024 defined recursively; but since we modify the input parameters
5025 (left is set to `this' temporarily), we reset this value if the
5026 left_is_explicit is false, which gives the original semantics to
5029 * literal.cs (NullPointer): new class used to represent a null
5030 literal in a pointer context.
5032 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
5033 type is a pointer, use a NullPointer object instead of a
5034 NullLiteral. Closes 43687
5036 (ExplicitConversion): Convert pointer values using
5037 the conv opcode to the proper type.
5039 * ecore.cs (New): change ValueTypeVariable property into a method,
5040 that returns whether the valuetype is suitable for being used.
5042 * expression.cs (Binary.DoNumericPromotions): Only return if we
5043 the int constant was a valid uint, and we can return both left and
5044 right as uints. If not, we continue processing, to trigger the
5045 type conversion. This fixes 39018.
5047 * statement.cs (Block.EmitMeta): During constant resolution, set
5048 the CurrentBlock property on the emitcontext, so that we resolve
5049 constants propertly.
5051 2003-07-02 Martin Baulig <martin@ximian.com>
5053 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
5054 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
5056 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
5057 than emitting it here.
5059 * statement.cs: Fixed some more flow analysis bugs.
5061 2003-07-02 Martin Baulig <martin@ximian.com>
5063 * class.cs (MethodData.Define): When implementing interface
5064 methods, set Final unless we're Virtual.
5066 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
5067 check work for interface methods.
5069 2003-07-01 Martin Baulig <martin@ximian.com>
5071 * ecore.cs (EmitContext.This): Replaced this property with a
5072 GetThis() method which takes a Location argument. This ensures
5073 that we get the correct error location for a CS0188.
5075 2003-07-01 Miguel de Icaza <miguel@ximian.com>
5077 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
5078 ImplicitStandardConversion.
5080 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
5082 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
5084 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
5087 2003-06-30 Miguel de Icaza <miguel@ximian.com>
5089 * class.cs (Constructor.Define): Turn off initlocals for unsafe
5092 (MethodData.Define): Turn off initlocals for unsafe methods.
5094 2003-06-29 Miguel de Icaza <miguel@ximian.com>
5096 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
5097 complete; Fixes #37521.
5099 * delegate.cs: Use Modifiers.TypeAttr to compute the
5100 TypeAttributes, instead of rolling our own. This makes the flags
5101 correct for the delegates.
5103 2003-06-28 Miguel de Icaza <miguel@ximian.com>
5105 * class.cs (Constructor.Define): Set the private flag for static
5106 constructors as well.
5108 * cs-parser.jay (statement_expression): Set the return value to
5109 null, to avoid a crash when we catch an error.
5111 2003-06-24 Miguel de Icaza <miguel@ximian.com>
5113 * cs-parser.jay: Applied patch from Jackson that adds support for
5114 extern and unsafe modifiers to destructor declarations.
5116 * expression.cs: Report error 21 if the user is trying to index a
5119 * driver.cs: Add an error message, suggested by the bug report.
5121 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
5122 if we do not have a ": this ()" constructor initializer. Fixes 45149
5124 2003-06-14 Miguel de Icaza <miguel@ximian.com>
5126 * namespace.cs: Add some information to reduce FAQs.
5128 2003-06-13 Miguel de Icaza <miguel@ximian.com>
5130 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
5131 underlying enumeration types. Fixes #43915.
5133 * expression.cs: Treat ushort/short as legal values to be used in
5136 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
5138 * delegate.cs: transfer custom attributes for paramenters from
5139 the delegate declaration to Invoke and BeginInvoke.
5141 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
5143 * attribute.cs: handle custom marshalers and emit marshal info
5146 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
5148 * makefile.gnu: Added anonymous.cs to the compiler sources.
5150 2003-05-28 Miguel de Icaza <miguel@ximian.com>
5152 * iterators.cs: Change the name of the proxy class to include two
5155 * cs-parser.jay: Update grammar to include anonymous methods.
5157 * anonymous.cs: new file.
5159 2003-05-27 Miguel de Icaza <miguel@ximian.com>
5161 * class.cs (Field.Define): Add missing test for pointers and
5164 2003-05-27 Ravi Pratap <ravi@ximian.com>
5166 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
5167 we use the stobj opcode.
5169 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
5170 since it wasn't the correct fix.
5172 It still is puzzling that we are required to use stobj for IntPtr
5173 which seems to be a ValueType.
5175 2003-05-26 Miguel de Icaza <miguel@ximian.com>
5177 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
5178 during regular simple name resolution. Now, the trick is that
5179 instead of returning for processing the simplename, we do a
5180 TypeManager.LookupType (ie, a rooted lookup as opposed to a
5181 contextual lookup type). If a match is found, return that, if
5182 not, return for further composition.
5184 This fixes long-standing 30485.
5186 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
5187 using the address to initialize an object, do an Stobj instead of
5188 using the regular Stelem.
5190 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
5191 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
5192 Because if we are a BaseIndexerAccess that value will be true.
5195 * statement.cs (GotoCase.Resolve): Return after reporting an
5196 error, do not attempt to continue.
5198 * expression.cs (PointerArithmetic.Emit): If our operand is a
5199 long, convert our constants to match the operand before
5200 multiplying. Convert to I type before adding. Fixes 43670.
5202 2003-05-14 Ravi Pratap <ravi@ximian.com>
5204 * enum.cs (ImplicitConversionExists) : Rename to
5205 ImplicitEnumConversionExists to remove ambiguity.
5207 * ecore.cs (NullCast): New type of cast expression class which
5208 basically is very similar to EmptyCast with the difference being
5209 it still is a constant since it is used only to cast a null to
5213 * convert.cs (ImplicitReferenceConversion): When casting a null
5214 literal, we return a NullCast.
5216 * literal.cs (NullLiteralTyped): Remove - I don't see why this
5217 should be around anymore.
5219 The renaming (reported was slightly wrong). Corrections:
5221 ConvertImplicitStandard -> ImplicitConversionStandard
5222 ConvertExplicitStandard -> ExplicitConversionStandard
5224 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
5225 before passing them in !
5227 * convert.cs (ImplicitConversionStandard): When comparing for
5228 equal expr and target types, ensure that expr is not a
5231 In general, we must not be checking (expr_type ==
5232 target_type) in the top level conversion methods
5233 (ImplicitConversion, ExplicitConversion etc). This checking is
5234 done in the methods that they delegate to.
5236 2003-05-20 Miguel de Icaza <miguel@ximian.com>
5238 * convert.cs: Move Error_CannotConvertType,
5239 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
5240 ImplicitNumericConversion, ImplicitConversionExists,
5241 ImplicitUserConversionExists, StandardConversionExists,
5242 FindMostEncompassedType, FindMostSpecificSource,
5243 FindMostSpecificTarget, ImplicitUserConversion,
5244 ExplicitUserConversion, GetConversionOperators,
5245 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
5246 TryImplicitIntConversion, Error_CannotConvertImplicit,
5247 ConvertImplicitRequired, ConvertNumericExplicit,
5248 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
5249 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
5252 Perform the following renames:
5254 StandardConversionExists -> ImplicitStandardConversionExists
5255 ConvertImplicit -> ImplicitConversion
5256 ConvertImplicitStandard -> ImplicitStandardConversion
5257 TryImplicitIntConversion -> ImplicitIntConversion
5258 ConvertImplicitRequired -> ImplicitConversionRequired
5259 ConvertNumericExplicit -> ExplicitNumericConversion
5260 ConvertReferenceExplicit -> ExplicitReferenceConversion
5261 ConvertExplicit -> ExplicitConversion
5262 ConvertExplicitStandard -> ExplicitStandardConversion
5264 2003-05-19 Martin Baulig <martin@ximian.com>
5266 * statement.cs (TypeInfo.StructInfo): Made this type protected.
5267 (TypeInfo): Added support for structs having structs as fields.
5269 * ecore.cs (FieldExpr): Implement IVariable.
5270 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
5271 VariableInfo for the field.
5273 2003-05-18 Martin Baulig <martin@ximian.com>
5275 * expression.cs (This.DoResolve): Report a CS0027 if we're
5276 emitting a field initializer.
5278 2003-05-18 Martin Baulig <martin@ximian.com>
5280 * expression.cs (This.ResolveBase): New public function.
5281 (This.DoResolve): Check for CS0188.
5283 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
5286 * ecore.cs (MethodGroupExpr.DoResolve): Set the
5287 `instance_expression' to null if we don't have any non-static
5290 2003-05-18 Martin Baulig <martin@ximian.com>
5292 Reworked the way how local variables and parameters are handled by
5293 the flow analysis code.
5295 * statement.cs (TypeInfo, VariableMap): New public classes.
5296 (VariableInfo): New public class. This is now responsible for
5297 checking whether a variable has been assigned. It is used for
5298 parameters and local variables.
5299 (Block.EmitMeta): Take the InternalParameters as argument; compute
5300 the layout of the flow vectors here.
5301 (Block.LocalMap, Block.ParameterMap): New public properties.
5302 (FlowBranching): The .ctor doesn't get the InternalParameters
5303 anymore since Block.EmitMeta() now computes the layout of the flow
5305 (MyStructInfo): This class is now known as `StructInfo' and nested
5306 in `TypeInfo'; we don't access this directly anymore.
5308 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
5309 property and removed IsAssigned(), IsFieldAssigned(),
5310 SetAssigned() and SetFieldAssigned(); we now call them on the
5311 VariableInfo so we don't need to duplicate this code everywhere.
5313 * expression.cs (ParameterReference): Added `Block block' argument
5315 (LocalVariableReference, ParameterReference, This): The new
5316 VariableInfo class is now responsible for all the definite
5319 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
5320 IsParameterAssigned, SetParameterAssigned): Removed.
5322 2003-05-18 Martin Baulig <martin@ximian.com>
5324 * typemanager.cs (InitCoreTypes): Try calling
5325 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
5326 the 3-args-version. Corlib now also needs our `void_type'.
5327 (GetMethod): Added overloaded version which takes an optional
5328 `bool report_errors' to allow lookups of optional methods.
5330 2003-05-12 Martin Baulig <martin@ximian.com>
5332 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
5333 only used for locals and not for parameters.
5335 2003-05-12 Miguel de Icaza <miguel@ximian.com>
5337 * support.cs (InternalParameters.ParameterType): Return the
5338 ExternalType of the parameter.
5340 * parameter.cs (Parameter.ExternalType): drop the two arguments,
5343 2003-05-11 Miguel de Icaza <miguel@ximian.com>
5345 * class.cs (MethodData.Define): Do not set the `newslot' on
5346 interface members, if they are also flagged as "override".
5348 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
5349 better code for ++i and i++. This only works for static fields
5350 and local variables.
5352 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
5353 want to pull the DeclSpace out of the builder_to_declspace instead
5354 of the TypeBuilder (like in TypeContainer.FindMembers).
5356 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
5357 instead of LookupTypeContainer. Fixes the crash on .NET for
5358 looking up interface members.
5360 * const.cs: Create our own emit context during the Definition
5361 stage, so that constants are evaluated in the proper context, when
5362 a recursive definition happens.
5364 2003-05-11 Martin Baulig <martin@ximian.com>
5366 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
5367 new block for a switch section.
5368 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
5369 the adding/lookup in the switch block. Fixes #39828.
5371 2003-05-09 Miguel de Icaza <miguel@ximian.com>
5373 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
5374 functionality: I needed to convert the data after I had performed
5375 the add/sub operation into the operands type size.
5377 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
5378 pass the type for the box operation, otherwise the resulting
5379 object would have been of type object.
5381 (BoxedCast): Add constructor to specify the type to box as.
5383 2003-05-07 Miguel de Icaza <miguel@ximian.com>
5385 * iterators.cs: I was reusing the `count' variable inadvertently,
5386 take steps to not allow this to happen.
5388 2003-05-06 Miguel de Icaza <miguel@ximian.com>
5390 * attribute.cs (Attribute.Resolve): Params attributes are encoded
5391 by creating an array at the point where the params starts and
5392 putting all those arguments there, then adjusting the size of the
5395 2003-05-05 Miguel de Icaza <miguel@ximian.com>
5397 * expression.cs (New.AddressOf): Implement interface
5398 IMemoryLocation. This is used when the `new' operator is used in
5399 the context of an invocation to a method on a value type.
5401 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
5404 * namespace.cs: Also check the using aliases here.
5406 * driver.cs: Move the test for using validity after the types have
5407 been entered, so we do a single pass that also includes the using
5410 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
5411 in the regular case. CreateSiblingForFinally is doing extra
5414 * attribute.cs (GetAttributeArgumentExpression): Store the result
5415 on an out value, and use the return value to indicate failure
5416 instead of using null (which is a valid return for Constant.GetValue).
5418 * statement.cs: Perform the analysis flow for the increment
5419 portion after the statement, because this will be the real flow of
5420 execution. Fixes #42385
5422 * codegen.cs (EmitContext.EmitArgument,
5423 EmitContext.EmitStoreArgument): New helper functions when the
5424 RemapToProxy flag is set.
5426 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
5429 Add support for remapping parameters.
5431 * iterators.cs: Propagate parameter values; Store parameter
5432 values in the proxy classes.
5434 2003-05-04 Miguel de Icaza <miguel@ximian.com>
5436 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
5437 need a proxy reference; I do not know what I was thinking
5439 * cs-parser.jay (constructor_initializer): catch another error,
5440 and display nice message.
5442 (field_declaration): catch void field declaration
5443 to flag a better error.
5445 * class.cs (MemberBase.CheckBase): Report an error instead of a
5446 warning if a new protected member is declared in a struct.
5447 (Field.Define): catch the error of readonly/volatile.
5449 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
5451 (FieldExpr.AddressOf): ditto. Catch error where the address of a
5452 volatile variable is taken
5454 2003-05-02 Miguel de Icaza <miguel@ximian.com>
5456 * statement.cs (Fixed.Resolve): Report an error if we are not in
5459 2003-05-01 Miguel de Icaza <miguel@ximian.com>
5461 * typemanager.cs: reuse the code that handles type clashes for
5462 delegates and enumerations.
5464 * class.cs (Report28): Always report.
5466 * expression.cs (EncodeAsAttribute): Allow nulls here.
5468 2003-04-28 Miguel de Icaza <miguel@ximian.com>
5470 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
5471 the functionality for testing whether an expression is valid for
5472 an attribute here. Also handle the case of arrays of elements
5475 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
5476 encoding a linear array into an array of objects that are suitable
5477 to be passed to an CustomAttributeBuilder.
5479 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
5481 * ecore.cs: (FieldExpr): Handle field remapping here.
5483 * iteratators.cs: Pass the instance variable (if the method is an
5484 instance method) to the constructors, so we can access the field
5485 variables on the class.
5487 TODO: Test this with structs. I think the THIS variable on
5488 structs might have to be a pointer, and not a refenrece
5490 2003-04-27 Miguel de Icaza <miguel@ximian.com>
5492 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
5493 local variables to fields in a proxy class.
5495 * iterators.cs (PopulateProxy): Rename our internal fields to
5497 Create a <THIS> field if we are an instance method, so we can
5498 reference our parent container variables.
5499 (MapVariable): Called back from the EmitContext code to enter a
5500 new variable to field mapping into the proxy class (we just create
5504 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
5505 for using the remapped locals to fields.
5507 I placed the code here, because that gives the same semantics to
5508 local variables, and only changes the Emit code.
5510 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
5511 statements inside iterators.
5512 (VariableInfo): Add a FieldBuilder for the cases when we are
5513 remapping local variables to fields in a proxy class
5515 * ecore.cs (SimpleNameResolve): Avoid testing two times for
5516 current_block != null.
5518 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
5519 not cope with strings, as it has been moved to the
5520 TableSwitchEmit. Fixed bug in switch generation.
5522 * expression.cs (New.DoResolve): Provide more context for the user
5523 when reporting an error.
5525 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
5528 * expression.cs (MemberAccess.DoResolve): When we get a type back,
5529 check the permissions for it. Note than in a type-resolution
5530 context the check was already present in DeclSpace.ResolveType,
5531 but was missing from the MemberAccess.
5533 (ArrayCreation.CheckIndices): warn if the user has
5534 more nested levels of expressions, but there are no more
5535 dimensions specified. Avoids crash on bug 41906.
5537 2003-04-26 Miguel de Icaza <miguel@ximian.com>
5539 * statement.cs (Block): replace Implicit bool, for a generic
5541 New flag: `Unchecked'. This is used during the EmitMeta phase
5542 (which is out-of-line with the regular Resolve/Emit process for a
5543 statement, as this is done ahead of time, but still gets a chance
5544 to call constant resolve).
5546 (Block.Flags): new enum for adding a new flag.
5548 (Block.EmitMeta): track the state of unchecked.
5550 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
5551 to enable constant resolution to work there as well.
5553 2003-04-22 Miguel de Icaza <miguel@ximian.com>
5555 * typemanager.cs (ienumerable_type): Also look up
5556 System.Collections.IEnumerable.
5558 2003-04-21 Miguel de Icaza <miguel@ximian.com>
5560 TODO: Test more than one conditional per method.
5562 * class.cs (Indexer.Define): Report the location where the user is
5563 referencing the unsupported feature.
5565 (MethodData): Overload the use of `conditionals' to
5566 minimize the creation of needless ArrayLists. This saves roughly
5567 212kb on my machine.
5569 (Method): Implement the new IIteratorContainer interface.
5570 (Method.SetYields): Implement the method by setting the ModFlags
5571 to contain METHOD_YIELDS.
5573 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
5574 which just got set to null.
5576 * iterators.cs: New file.
5578 (Yield, YieldBreak): New statements.
5580 * statement.cs (Return.Resolve): Flag an error if we are used in
5583 * codegen.cs (InIterator): New flag set if the code is being
5584 compiled in an iterator method.
5586 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
5587 internal modifier, and we just use it to avoid adding extra
5588 fields, as this is seldom used.
5590 * cs-parser.jay: Add yield_statement (yield and yield break).
5592 * driver.cs: New flag -v2 to turn on version 2 features.
5594 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
5595 hashtable when v2 is enabled.
5597 2003-04-20 Miguel de Icaza <miguel@ximian.com>
5599 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
5600 there is already a namespace defined with this name.
5602 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
5603 people upgraded their corlibs.
5605 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
5606 always use fully qualified types, no need to use the compiler
5609 (TypeManager.IsNamespace): Use binarysearch.
5611 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
5612 AddDelegate): I did not quite use the new IsValid API properly: I
5613 have to pass the short-name and the fullname. I was passing only
5614 the basename instead of the fullname sometimes.
5616 (TypeContainer.DefineType): call NamespaceClash.
5618 * interface.cs (Interface.DefineType): use NamespaceClash before
5621 * delegate.cs (Delegate.DefineType): use NamespaceClash before
5624 * enum.cs: (Enum.DefineType): use NamespaceClash before
5627 * typemanager.cs (: 3-line patch that gives us some tasty 11%
5628 speed increase. First, use the negative_hits cache when we get a
5629 negative. Second, add the type with its full original name
5630 instead of the new . and + encoded name (reflection uses + to
5631 separate type from a nested type). Use LookupTypeReflection
5632 directly which bypasses the type->name hashtable (that we already
5633 know does not contain the type.
5635 * decl.cs (DeclSpace.ResolveTypeExpr): track the
5636 location/container type.
5638 * driver.cs: When passing utf8, use directly the UTF8Encoding.
5640 2003-04-19 Miguel de Icaza <miguel@ximian.com>
5642 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
5644 * delegate.cs (NewDelegate.Resolve): Test whether an instance
5645 method is being referenced in the method group from a static
5646 context, and report error 120 if so.
5648 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
5651 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
5652 is created, we create the A namespace).
5654 * cs-parser.jay: A namespace also introduces a DeclarationFound.
5657 2003-04-18 Miguel de Icaza <miguel@ximian.com>
5659 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
5660 invocation to ModuleBuilder.GetType with the same values will
5661 return a new type instance, so we need to cache its return
5664 * expression.cs (Binary.ResolveOperator): Only allow the compare
5665 operators on enums if they are of the same type.
5667 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
5668 types of ValueType on their own case. Before we were giving them
5669 the same treatment as objects.
5671 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
5672 fullname. Short name is used to compare against container name.
5673 Fullname is used to check against defined namespace names.
5675 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
5676 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
5678 (Method.CheckBase): Call parent.
5679 (MemberBase.CheckBase): Check for protected members on sealed
5681 (PropertyBase.CheckBase): Call parent.
5682 (Field.Define): Call parent.
5684 * report.cs: Negative error codes are now mapped to 8000 - code,
5685 so that the display is render more nicely.
5687 * typemanager.cs: Do not use try/catch, instead report a regular
5690 (GetPointerType, GetReferenceType): These methods provide
5691 mechanisms to obtain the T* and T& from a T. We had the code
5692 previously scattered around the code base, and it also used
5693 TypeManager.LookupType that would go through plenty of caches.
5694 This one goes directly to the type source.
5696 In some places we did the Type.GetType followed by
5697 ModuleBuilder.GetType, but not in others, so this unifies the
5700 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
5701 statements now that we have namespace information.
5703 * typemanager.cs (IsNamespace): New method, returns whether the
5704 string presented is a namespace or not.
5706 (ComputeNamespaces): New public entry point, computes the list of
5707 available namespaces, using the GetNamespaces API call in Mono, or
5708 the slower version in MS.NET.
5710 Now before we start the semantic analysis phase, we have a
5711 complete list of namespaces including everything that the user has
5714 Deleted old code to cache namespaces in .nsc files.
5716 2003-04-17 Miguel de Icaza <miguel@ximian.com>
5718 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
5719 class/struct location definition Location for the implicit
5720 constructor location.
5722 (Operator.Define): Use the location of the operator for the
5723 implicit Method definition.
5725 (Constructor.Emit): use the constructor location for the implicit
5726 base initializer constructor.
5728 * ecore.cs: Remove ITypeExpression. This interface is now gone,
5729 and the Expression class now contains two new methods:
5731 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
5732 isolate type lookup from the rest of the resolution process.
5734 Since we use Expressions to hold type definitions due to the way
5735 we parse the input we have historically overloaded Resolve to
5736 perform the Type lookups if a special flag is passed. Now this is
5737 eliminated and two methods take their place.
5739 The differences in the two methods between xStep and xTerminal is
5740 that xStep is involved in our current lookup system that uses
5741 SimpleNames to compose a name, while xTerminal is used just to
5742 catch the case where the simplename lookup failed.
5744 2003-04-16 Miguel de Icaza <miguel@ximian.com>
5746 * expression.cs (ResolveMemberAccess): Remove redundant code.
5747 TypeExpr expressions are always born fully resolved.
5749 * interface.cs (PopulateMethod): Do not lookup the types twice.
5750 We were doing it once during SemanticAnalysis and once during
5753 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
5754 in local variable type definitions, were being returned as a
5755 SimpleName (we decomposed everything into a string), that is
5756 because primary_expression was being used instead of a type in the
5757 grammar (reduce/reduce conflicts).
5759 The part that was wrong is that we converted the expression into a
5760 string (an oversimplification in one hand, compounded with primary
5761 expressions doing string concatenation).
5767 Would return "A.B.C[]" as a SimpleName. This stopped things like
5768 using clauses from working on this particular context. And a type
5769 was being matched directly against "A.B.C[]".
5771 We now use the correct approach, and allow for ComposedCast to be
5772 part of the unary expression. So the "A.B.C []" become a composed
5773 cast of "A.B.C" (as a nested group of MemberAccess with a
5774 SimpleName at the end) plus the rank composition "[]".
5778 2003-04-10 Miguel de Icaza <miguel@ximian.com>
5780 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
5781 for the access level checking.
5783 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
5784 `TypeContainer container', because I kept getting confused when I
5785 was debugging this code.
5787 * expression.cs (Indexers): Instead of tracking getters/setters,
5788 we now track them in parallel. We create one arraylist less, but
5789 most importantly it is possible now for the LValue code to find a
5790 matching get for a set.
5792 (IndexerAccess.DoResolveLValue): Update the code.
5793 GetIndexersForType has been modified already to extract all the
5794 indexers from a type. The code assumed it did not.
5796 Also make the code set the correct return type for the indexer.
5797 This was fixed a long time ago for properties, but was missing for
5798 indexers. It used to be void_type.
5800 (Binary.Emit): Test first for doubles instead of
5801 floats, as they are more common.
5803 (Binary.EmitBranchable): Use the .un version of the branch opcodes
5804 when dealing with floats and the <=, >= operators. This fixes bug
5807 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
5808 to load the array value by emitting a load on the foreach variable
5809 type. This was incorrect.
5811 We now emit the code to load an element using the the array
5812 variable type, and then we emit the conversion operator.
5816 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
5818 * attribute.cs: Avoid allocation of ArrayLists in the common case.
5820 2003-04-09 Miguel de Icaza <miguel@ximian.com>
5822 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
5823 test for protection before we test for signatures.
5825 (MethodSignature.ToString): implement.
5827 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
5828 to the case where we reduced into a LongConstant.
5830 * decl.cs (CheckAccessLevel): If the type is an array, we can not
5831 depend on whether the information is acurrate, because the
5832 Microsoft runtime will always claim that the array type is public,
5833 regardless of the real state.
5835 If the type is a pointer, another problem happens: the type is
5836 reported as non-public in Microsoft.
5838 In both cases we have to call CheckAccessLevel recursively with
5839 the underlying type as the argument to be tested.
5841 2003-04-08 Miguel de Icaza <miguel@ximian.com>
5843 * assign.cs (Assign.Emit): If we are dealing with a compound
5844 assignment expression, we should use the code path that stores the
5845 intermediate result in a temporary value. This fixes #40903.
5847 *expression.cs (Indirection.ToString): Provide ToString method for
5850 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
5852 * class.cs: Null out fields holding references to Block objects so
5853 they can be garbage collected.
5855 * expression.cs (OverloadResolve): Remove unused local.
5857 2003-04-07 Martin Baulig <martin@ximian.com>
5859 * codegen.cs (EmitContext.CurrentFile): New public field.
5860 (EmitContext.Mark): Use the CurrentFile to check whether the
5861 location is in the correct file.
5862 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
5864 2003-04-07 Martin Baulig <martin@ximian.com>
5866 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
5868 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
5869 location. [FIXME: The location argument which gets passed to this
5870 method is sometimes wrong!]
5872 2003-04-07 Nick Drochak <ndrochak@gol.com>
5874 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
5876 2003-04-07 Miguel de Icaza <miguel@ximian.com>
5878 * expression.cs (Indirection.EmitAssign): We were using the
5879 temporary, but returning immediately instead of continuing the
5882 2003-04-06 Martin Baulig <martin@ximian.com>
5884 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
5885 if it's a nested child, but also deriving from the outer class.
5888 * typemanager.cs (IsNestedChildOf): Make this work if it's a
5889 nested child, but also deriving from the outer class. See
5891 (FilterWithClosure): We may access private members of the outer
5892 class if we're a nested child and deriving from the outer class.
5893 (RealMemberLookup): Only set `closure_private_ok' if the
5894 `original_bf' contained BindingFlags.NonPublic.
5896 2003-04-05 Martin Baulig <martin@ximian.com>
5898 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
5900 2003-04-02 Miguel de Icaza <miguel@ximian.com>
5902 * class.cs (Event.Define): Do not allow abstract events to have
5905 2003-04-01 Miguel de Icaza <miguel@ximian.com>
5907 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
5908 block in event declarations.
5910 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
5911 value type, get its address.
5913 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
5914 leaving a class on the stack instead of a boolean value (int
5915 0/1). Change the code so we compare against null, and then the
5916 result against zero.
5918 * class.cs (TypeContainer.GetClassBases): We were checking for the
5919 parent class being sealed too late.
5921 * expression.cs (Binary.Emit): For <= and >= when dealing with
5922 floating point values, use cgt.un and clt.un instead of cgt and
5925 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
5927 * statement.cs: Apply the same optimization as MS: skip the
5928 GetEnumerator returning an IEnumerator, and use the one returning a
5929 CharEnumerator instead. This allows us to avoid the try-finally block
5932 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
5934 * cs-parser.jay: Attributes cannot be applied to
5935 namespaces. Fixes #40473
5937 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5940 (Add*): check if the name is valid using the full name for constants,
5941 fields, properties and events.
5943 2003-03-28 Miguel de Icaza <miguel@ximian.com>
5945 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
5946 char constants to be part of the enumeration.
5948 * expression.cs (Conditional.DoResolve): Add support for operator
5949 true. Implements the missing functionality from 14.12
5951 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
5952 operator true/false as required by the spec.
5954 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
5955 implicit conversion to boolean.
5957 * statement.cs (Statement.ResolveBoolean): A boolean expression is
5958 also one where the type implements `operator true'.
5960 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
5961 get an expression that will invoke operator true based on an
5964 (GetConversionOperators): Removed the hack that called op_True
5967 (Expression.ResolveBoolean): Move this from Statement.
5969 2003-03-17 Miguel de Icaza <miguel@ximian.com>
5971 * ecore.cs (FieldExpr): do not allow initialization of initonly
5972 fields on derived classes
5974 2003-03-13 Martin Baulig <martin@ximian.com>
5976 * statement.cs (Block.Emit): Call ig.BeginScope() and
5977 ig.EndScope() when compiling with debugging info; call
5978 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
5980 2003-03-08 Miguel de Icaza <miguel@ximian.com>
5982 * expression.cs (Indexers): Do not construct immediately, allow
5983 for new members to be appended as we go. Fixes 38143
5985 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5987 * expression.cs: save/restore context when resolving an unchecked
5990 2003-03-05 Miguel de Icaza <miguel@ximian.com>
5992 * cfold.cs: Catch division by zero in modulus operator during
5995 2003-03-03 Miguel de Icaza <miguel@ximian.com>
5997 * interface.cs (Interface.DefineMembers): Avoid defining members
6000 2003-02-27 Miguel de Icaza <miguel@ximian.com>
6002 * driver.cs: handle the +/- options for -noconfig
6004 * statement.cs (Unckeched.Resolve): Also track the state of
6005 unchecked in the Resolve phase.
6007 2003-02-27 Martin Baulig <martin@ximian.com>
6009 * ecore.cs (Expression.MemberLookup): Don't create a
6010 MethodGroupExpr for something which is not a method. Fixes #38291.
6012 2003-02-25 Miguel de Icaza <miguel@ximian.com>
6014 * class.cs (MemberBase.CheckParameters): Also check that the type
6015 is unmanaged if it is a pointer.
6017 * expression.cs (SizeOf.Resolve): Add location information.
6019 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
6020 a managed type is declared.
6022 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
6023 parameter modifiers as well. Fixes bug 38606
6025 * class.cs: Very sad. Am backing out the speed up changes
6026 introduced by the ArrayList -> Array in the TypeContainer, as they
6027 were not actually that much faster, and introduced a bug (no error
6028 reports on duplicated methods).
6030 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
6031 source first, this will guarantee that we have a valid expression
6032 before calling in lower levels functions that will require a
6033 resolved object. Then use this original_source in the
6034 target.ResolveLValue instead of the original source that was
6037 Another change. Use target.Resolve instead of LValueResolve.
6038 Although we are resolving for LValues, we will let the Assign code
6039 take care of that (it will be called again from Resolve). This
6040 basically allows code like this:
6042 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
6043 class Y { void A (X x) { x [0] += o; }
6045 The problem was that the indexer was trying to resolve for
6046 set_Item (idx, object o) and never finding one. The real set_Item
6047 was set_Item (idx, X). By delaying the process we get the right
6052 2003-02-23 Martin Baulig <martin@ximian.com>
6054 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
6055 while calling DoEmit ().
6057 * codegen.cs (EmitContext.Mark): Don't mark locations in other
6058 source files; if you use the #line directive inside a method, the
6059 compiler stops emitting line numbers for the debugger until it
6060 reaches the end of the method or another #line directive which
6061 restores the original file.
6063 2003-02-23 Martin Baulig <martin@ximian.com>
6065 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
6067 2003-02-23 Martin Baulig <martin@ximian.com>
6069 * statement.cs (Block.AddChildVariableNames): We need to call this
6070 recursively, not just for our immediate children.
6072 2003-02-23 Martin Baulig <martin@ximian.com>
6074 * class.cs (Event.Define): Always make the field private, like csc does.
6076 * typemanager.cs (TypeManager.RealMemberLookup): Make events
6077 actually work, fixes bug #37521.
6079 2003-02-23 Miguel de Icaza <miguel@ximian.com>
6081 * delegate.cs: When creating the various temporary "Parameters"
6082 classes, make sure that we call the ComputeAndDefineParameterTypes
6083 on those new parameters (just like we do with the formal ones), to
6084 allow them to be resolved in the context of the DeclSpace.
6086 This fixes the bug that Dick observed in Bugzilla #38530.
6088 2003-02-22 Miguel de Icaza <miguel@ximian.com>
6090 * expression.cs (ResolveMemberAccess): When resolving a constant,
6091 do not attempt to pull a constant if the value was not able to
6092 generate a valid constant.
6094 * const.cs (LookupConstantValue): Do not report more errors than required.
6096 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6098 * expression.cs: fixes bug #38328.
6100 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6102 * class.cs: Changed all the various members that can be part of a
6103 class from being an ArrayList to be an Array of the right type.
6104 During the DefineType type_list, interface_list, delegate_list and
6105 enum_list are turned into types, interfaces, delegates and enums
6108 And during the member population, indexer_list, event_list,
6109 constant_list, field_list, instance_constructor_list, method_list,
6110 operator_list and property_list are turned into their real arrays.
6112 Although we could probably perform this operation earlier, for
6113 good error reporting we need to keep the lists and remove the
6114 lists for longer than required.
6116 This optimization was triggered by Paolo profiling the compiler
6117 speed on the output of `gen-sample-program.pl' perl script.
6119 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
6120 not crash in methods like MemberLookupFailed that use this field.
6122 This problem arises when the compiler fails to resolve a type
6123 during interface type definition for example.
6125 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6127 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
6128 inherit from System.Object, so we have to stop at null, not only
6129 when reaching System.Object.
6131 2003-02-17 Miguel de Icaza <miguel@ximian.com>
6133 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
6134 DeclaredOnly because the parent indexer might have had a different
6135 name, but did not loop until the top of the hierarchy was reached.
6137 The problem this one fixes is 35492: when a class implemented an
6138 indexer from an interface, we were getting the interface method
6139 (which was abstract) and we were flagging an error (can not invoke
6142 This also keeps bug 33089 functioning, and test-148 functioning.
6144 * typemanager.cs (IsSpecialMethod): The correct way of figuring
6145 out if a method is special is to see if it is declared in a
6146 property or event, or whether it is one of the predefined operator
6147 names. This should fix correctly #36804.
6149 2003-02-15 Miguel de Icaza <miguel@ximian.com>
6151 The goal here is to remove the dependency on EmptyCast.Peel ().
6152 Killing it completely.
6154 The problem is that currently in a number of places where
6155 constants are expected, we have to "probe" for an EmptyCast, and
6156 Peel, which is not the correct thing to do, as this will be
6157 repetitive and will likely lead to errors.
6159 The idea is to remove any EmptyCasts that are used in casts that
6160 can be reduced to constants, so we only have to cope with
6163 This bug hunt was triggered by Bug 37363 and the desire to remove
6164 the duplicate pattern where we were "peeling" emptycasts to check
6165 whether they were constants. Now constants will always be
6168 * ecore.cs: Use an enumconstant here instead of wrapping with
6171 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
6172 throwing me off. By handling this we can get rid of a few hacks.
6174 * statement.cs (Switch): Removed Peel() code.
6176 2003-02-14 Miguel de Icaza <miguel@ximian.com>
6178 * class.cs: Location information for error 508
6180 * expression.cs (New.DoResolve): Add a guard against double
6181 resolution of an expression.
6183 The New DoResolve might be called twice when initializing field
6184 expressions (see EmitFieldInitializers, the call to
6185 GetInitializerExpression will perform a resolve on the expression,
6186 and later the assign will trigger another resolution
6188 This leads to bugs (#37014)
6190 * delegate.cs: The signature for EndInvoke should contain any ref
6191 or out parameters as well. We were not doing this in the past.
6193 * class.cs (Field.Define): Do not overwrite the type definition
6194 inside the `volatile' group. Turns out that volatile enumerations
6195 were changing the type here to perform a validity test, which
6198 2003-02-12 Miguel de Icaza <miguel@ximian.com>
6200 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
6201 and structs, we do not want to load the instance variable
6203 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
6204 enum_type has to be handled like an object reference (implicit
6205 conversions exists from this to object), but the regular IsClass
6206 and IsValueType tests will never return true for this one.
6208 Also we use TypeManager.IsValueType instead of type.IsValueType,
6209 just for consistency with the rest of the code (this is only
6210 needed if we ever use the construct exposed by test-180.cs inside
6211 corlib, which we dont today).
6213 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
6215 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
6218 2003-02-09 Martin Baulig <martin@ximian.com>
6220 * namespace.cs (Namespace..ctor): Added SourceFile argument.
6221 (Namespace.DefineNamespaces): New static public method; this is
6222 called when we're compiling with debugging to add all namespaces
6225 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
6226 pass it to the Namespace's .ctor.
6228 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
6229 and MethodBase arguments; pass the namespace ID to the symwriter;
6230 pass the MethodBase instead of the token to the symwriter.
6231 (SymbolWriter.DefineNamespace): New method to add a namespace to
6234 2003-02-09 Martin Baulig <martin@ximian.com>
6236 * symbolwriter.cs: New file. This is a wrapper around
6237 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
6238 methods here in near future.
6240 2003-02-09 Martin Baulig <martin@ximian.com>
6242 * codegen.cs (EmitContext.Mark): Just pass the arguments to
6243 ILGenerator.MarkSequencePoint() which are actually used by the
6246 2003-02-09 Martin Baulig <martin@ximian.com>
6248 * location.cs (SourceFile): New public sealed class. This
6249 contains the name and an index which is used in the location's token.
6250 (Location): Reserve an appropriate number of bits in the token for
6251 the source file instead of walking over that list, this gives us a
6252 really huge performance improvement when compiling with debugging.
6254 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
6255 `SourceFile' argument instead of a string.
6256 (Driver.ProcessFile): Add all the files via Location.AddFile(),
6257 but don't parse/tokenize here, we need to generate the list of all
6258 source files before we do that.
6259 (Driver.ProcessFiles): New static function. Parses/tokenizes all
6262 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
6263 instead of a string.
6265 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
6268 2003-02-09 Martin Baulig <martin@ximian.com>
6270 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
6271 filename on `#line default'.
6273 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
6275 * statement.cs: don't clear the pinned var when the fixed statement
6276 returns from the method (fixes bug#37752).
6278 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
6280 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
6283 2003-02-07 Martin Baulig <martin@ximian.com>
6285 * driver.cs: Removed the `--debug-args' command line argument.
6287 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
6288 automatically by the AsssemblyBuilder.
6289 (CodeGen.InitializeSymbolWriter): We don't need to call any
6290 initialization function on the symbol writer anymore. This method
6291 doesn't take any arguments.
6293 2003-02-03 Miguel de Icaza <miguel@ximian.com>
6295 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
6296 from referenced assemblies as well.
6298 2003-02-02 Martin Baulig <martin@ximian.com>
6300 * class.cs (MethodData.Emit): Generate debugging info for external methods.
6302 2003-02-02 Martin Baulig <martin@ximian.com>
6304 * class.cs (Constructor.Emit): Open the symbol writer before
6305 emitting the constructor initializer.
6306 (ConstructorInitializer.Emit): Call ec.Mark() to allow
6307 single-stepping through constructor initializers.
6309 2003-01-30 Miguel de Icaza <miguel@ximian.com>
6311 * class.cs: Handle error 549: do not allow virtual methods in
6314 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
6316 * decl.cs: Check access levels when resolving types
6318 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
6320 * statement.cs: Add parameters and locals set in catch blocks that might
6321 return to set vector
6323 2003-01-29 Miguel de Icaza <miguel@ximian.com>
6325 * class.cs (Operator): Set the SpecialName flags for operators.
6327 * expression.cs (Invocation.DoResolve): Only block calls to
6328 accessors and operators on SpecialName methods.
6330 (Cast.TryReduce): Handle conversions from char constants.
6333 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
6335 * statement.cs: small memory and time optimization in FlowBranching.
6337 2003-01-28 Pedro Mart <yoros@wanadoo.es>
6339 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
6340 problem that the last fix but in the other sid (Set).
6342 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
6343 access when there is no indexer in the hierarchy.
6345 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
6347 * class.cs: Combine some if statements.
6349 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6351 * driver.cs: fixed bug #37187.
6353 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
6355 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
6356 any indexer, it's needed to build a list with all the indexers in the
6357 hierarchy (AllGetters), else we have problems. Fixes #35653.
6359 2003-01-23 Miguel de Icaza <miguel@ximian.com>
6361 * class.cs (MethodData.Define): It is wrong for an interface
6362 implementation to be static in both cases: explicit and implicit.
6363 We were only handling this in one case.
6365 Improve the if situation there to not have negations.
6367 * class.cs (Field.Define): Turns out that we do not need to check
6368 the unsafe bit on field definition, only on usage. Remove the test.
6370 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6372 * driver.cs: use assembly.Location instead of Codebase (the latest
6373 patch made mcs fail when using MS assemblies).
6375 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
6377 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
6378 get the path to *corlib.dll.
6380 2003-01-21 Nick Drochak <ndrochak@gol.com>
6384 * typemanager.cs: Remove compiler warnings
6386 2003-01-20 Duncan Mak <duncan@ximian.com>
6388 * AssemblyInfo.cs: Bump the version number to 0.19.
6390 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6392 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
6394 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
6396 * class.cs (Constructor::Emit): Emit debugging info for constructors.
6398 2003-01-17 Miguel de Icaza <miguel@ximian.com>
6400 * cs-parser.jay: Small fix: we were not comparing the constructor
6401 name correctly. Thanks to Zoltan for the initial pointer.
6403 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
6405 * cs-tokenizer.cs: Set file name when specified with #line
6407 2003-01-15 Miguel de Icaza <miguel@ximian.com>
6409 * cs-parser.jay: Only perform the constructor checks here if we
6410 are named like the class; This will help provider a better
6411 error. The constructor path is taken when a type definition is
6412 not found, but most likely the user forgot to add the type, so
6413 report that rather than the constructor error.
6415 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
6417 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
6420 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6422 * cs-parser.jay: Add cleanup call.
6424 2003-01-13 Duncan Mak <duncan@ximian.com>
6426 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
6427 consistent with other methods.
6429 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6431 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
6433 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
6435 * attribute.cs: only set GuidAttr to true when we have a
6438 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6442 * typemanager.cs: fixes to allow mcs compile corlib with the new
6443 Type.IsSubclassOf fix.
6445 2003-01-08 Miguel de Icaza <miguel@ximian.com>
6447 * expression.cs (LocalVariableReference.DoResolve): Classify a
6448 constant as a value, not as a variable. Also, set the type for
6451 * cs-parser.jay (fixed_statement): take a type instead of a
6452 pointer_type, so we can produce a better error message later.
6454 * statement.cs (Fixed.Resolve): Flag types that are not pointers
6457 (For.DoEmit): Make inifinite loops have a
6458 non-conditional branch back.
6460 (Fixed.DoEmit): First populate the pinned variables, then emit the
6461 statement, then clear the variables. Before I was emitting the
6462 code once for each fixed piece.
6465 2003-01-08 Martin Baulig <martin@ximian.com>
6467 * statement.cs (FlowBranching.MergeChild): A break in a
6468 SWITCH_SECTION does not leave a loop. Fixes #36155.
6470 2003-01-08 Martin Baulig <martin@ximian.com>
6472 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
6473 lives in the same number space than `param_map'. Fixes #36154.
6475 2003-01-07 Miguel de Icaza <miguel@ximian.com>
6477 * cs-parser.jay (constructor_declaration): Set the
6478 Constructor.ModFlags before probing for it. This makes the
6479 compiler report 514, 515 and 132 (the code was there, but got
6482 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
6483 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
6484 (GotoCase.Resolve): Set `Returns' to ALWAYS.
6486 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
6488 * enum.cs: create the enum static fields using the enum type.
6490 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
6492 * class.cs: don't try to create the ParamBuilder for the return
6493 type if it's not needed (and handle it breaking for the ms runtime
6496 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
6498 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
6500 2002-12-29 Miguel de Icaza <miguel@ximian.com>
6502 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
6503 the command. This showed up while compiling the JANET source
6504 code, which used \r as its only newline separator.
6506 2002-12-28 Miguel de Icaza <miguel@ximian.com>
6508 * class.cs (Method.Define): If we are an operator (because it
6509 reuses our code), then set the SpecialName and HideBySig. #36128
6511 2002-12-22 Miguel de Icaza <miguel@ximian.com>
6513 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
6514 exception, report error 120 `object reference required'.
6516 * driver.cs: Add --pause option, used during to measure the size
6517 of the process as it goes with --timestamp.
6519 * expression.cs (Invocation.DoResolve): Do not allow methods with
6520 SpecialName to be invoked.
6522 2002-12-21 Miguel de Icaza <miguel@ximian.com>
6524 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
6525 number before adding it.
6527 2002-12-21 Ravi Pratap <ravi@ximian.com>
6529 * ecore.cs (StandardImplicitConversion): When in an unsafe
6530 context, we allow conversion between void * to any other pointer
6531 type. This fixes bug #35973.
6533 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
6535 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
6536 is not thrown when extensionless outputs are used
6538 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6540 * rootcontext.cs: fixed compilation of corlib.
6542 2002-12-19 Miguel de Icaza <miguel@ximian.com>
6544 * attribute.cs (Attributes.Contains): Add new method.
6546 * class.cs (MethodCore.LabelParameters): if the parameter is an
6547 `out' parameter, check that no attribute `[In]' has been passed.
6549 * enum.cs: Handle the `value__' name in an enumeration.
6551 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
6553 * decl.cs: Added special case to allow overrides on "protected
6556 2002-12-18 Ravi Pratap <ravi@ximian.com>
6558 * attribute.cs (Attributes.AddAttributeSection): Rename to this
6559 since it makes much more sense.
6561 (Attributes.ctor): Don't require a Location parameter.
6563 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
6565 * attribute.cs (ApplyAttributes): Remove extra Location parameters
6566 since we already have that information per attribute.
6568 * everywhere : make appropriate changes.
6570 * class.cs (LabelParameters): Write the code which actually
6571 applies attributes to the return type. We can't do this on the MS
6572 .NET runtime so we flag a warning in the case an exception is
6575 2002-12-18 Miguel de Icaza <miguel@ximian.com>
6577 * const.cs: Handle implicit null conversions here too.
6579 2002-12-17 Ravi Pratap <ravi@ximian.com>
6581 * class.cs (MethodCore.LabelParameters): Remove the extra
6582 Type [] parameter since it is completely unnecessary. Instead
6583 pass in the method's attributes so that we can extract
6584 the "return" attribute.
6586 2002-12-17 Miguel de Icaza <miguel@ximian.com>
6588 * cs-parser.jay (parse): Use Report.Error to flag errors instead
6589 of ignoring it and letting the compile continue.
6591 * typemanager.cs (ChangeType): use an extra argument to return an
6592 error condition instead of throwing an exception.
6594 2002-12-15 Miguel de Icaza <miguel@ximian.com>
6596 * expression.cs (Unary.TryReduce): mimic the code for the regular
6597 code path. Perform an implicit cast in the cases where we can
6598 implicitly convert to one of the integral types, and then reduce
6599 based on that constant. This fixes bug #35483.
6601 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6603 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
6605 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6607 * namespace.cs: fixed bug #35489.
6609 2002-12-12 Miguel de Icaza <miguel@ximian.com>
6611 * class.cs: Remove some dead code.
6613 * cs-parser.jay: Estimate the number of methods needed
6614 (RootContext.MethodCount);
6616 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
6617 numbers instead of StringBuilders.
6619 * support.cs (PtrHashtable): Add constructor with initial size;
6620 We can now reduce reallocations of the method table.
6622 2002-12-10 Ravi Pratap <ravi@ximian.com>
6624 * attribute.cs (ApplyAttributes): Keep track of the emitted
6625 attributes on a per-target basis. This fixes bug #35413.
6627 2002-12-10 Miguel de Icaza <miguel@ximian.com>
6629 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
6630 default to the Windows 1252 encoding.
6632 (UnixParseOption): Support version, thanks to Alp for the missing
6635 * AssemblyInfo.cs: Add nice assembly information.
6637 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
6640 * cs-parser.jay: Allow a trailing comma before the close bracked
6641 in the attribute_section production.
6643 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
6644 address of the instance was being taken, I will take this out,
6645 because we take the address of the object immediately here.
6647 2002-12-09 Ravi Pratap <ravi@ximian.com>
6649 * typemanager.cs (AreMultipleAllowed): Take care of the most
6650 obvious case where attribute type is not in the current assembly -
6653 2002-12-08 Miguel de Icaza <miguel@ximian.com>
6655 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
6656 definitions, instead of doing that afterwards.
6658 Also we use a nice little hack, depending on the constructor, we
6659 know if we are a "composed" name or a simple name. Hence, we
6660 avoid the IndexOf test, and we avoid
6662 * codegen.cs: Add code to assist in a bug reporter to track down
6663 the source of a compiler crash.
6665 2002-12-07 Ravi Pratap <ravi@ximian.com>
6667 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
6668 types have been emitted for a given element and flag an error
6669 if something which does not have AllowMultiple set is used more
6672 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
6673 attribute types and their corresponding AllowMultiple properties
6675 (AreMultipleAllowed): Check the property for a given type.
6677 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
6678 property in the case we have a TypeContainer.
6680 (Attributes.AddAttribute): Detect duplicates and just skip on
6681 adding them. This trivial fix catches a pretty gross error in our
6682 attribute emission - global attributes were being emitted twice!
6684 Bugzilla bug #33187 is now fixed.
6686 2002-12-06 Miguel de Icaza <miguel@ximian.com>
6688 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
6691 * expression.cs (Binary.ResolveOperator): I can only use the
6692 Concat (string, string, string) and Concat (string, string,
6693 string, string) if the child is actually a concatenation of
6696 2002-12-04 Miguel de Icaza <miguel@ximian.com>
6698 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
6699 context where we need a 2-character lookahead.
6701 * pending.cs (PendingImplementation): Rework so we can keep track
6702 of interface types all the time, and flag those which were
6703 implemented by parents as optional.
6705 2002-12-03 Miguel de Icaza <miguel@ximian.com>
6707 * expression.cs (Binary.ResolveOperator): Use
6708 String.Concat(string,string,string) or
6709 String.Concat(string,string,string,string) when possible.
6711 * typemanager: More helper methods.
6714 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
6716 * pending.cs: remove the bogus return from GetMissingInterfaces()
6717 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
6719 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6721 * namespace.cs: avoid duplicated 'using xxx' being added to
6722 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
6723 when we get more than one 'using' statement for the same namespace.
6724 Report a CS0105 warning for it.
6726 2002-11-30 Miguel de Icaza <miguel@ximian.com>
6728 * cs-tokenizer.cs (consume_identifier): use read directly, instead
6729 of calling getChar/putback, uses internal knowledge of it.
6731 (xtoken): Reorder tokenizer so most common patterns are checked
6732 first. This reduces the compilation time in another 5% (from 8.11s
6733 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
6735 The parsing time is 22% of the compilation in mcs, and from that
6736 64% is spent on the tokenization process.
6738 I tried using a binary search for keywords, but this is slower
6739 than the hashtable. Another option would be to do a couple of
6742 * Not use a StringBuilder, instead use an array of chars,
6743 with a set value. Notice that this way we could catch
6744 the 645 error without having to do it *afterwards*.
6746 * We could write a hand-parser to avoid the hashtable
6747 compares altogether.
6749 The identifier consumption process takes 37% of the tokenization
6750 time. Another 15% is spent on is_number. 56% of the time spent
6751 on is_number is spent on Int64.Parse:
6753 * We could probably choose based on the string length to
6754 use Int32.Parse or Int64.Parse and avoid all the 64-bit
6757 Another 3% is spend on wrapping `xtoken' in the `token' function.
6759 Handle 0xa0 as whitespace (#34752)
6761 2002-11-26 Miguel de Icaza <miguel@ximian.com>
6763 * typemanager.cs (IsCLRType): New routine to tell whether a type
6764 is one of the builtin types.
6766 Maybe it needs to use TypeCodes to be faster. Maybe we could use
6767 typecode in more places instead of doing pointer comparissions.
6768 We could leverage some knowledge about the way the typecodes are
6771 New code to cache namespaces in assemblies, it is currently not
6772 invoked, to be used soon.
6774 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
6776 * expression.cs (Binary.ResolveOperator): specially handle
6777 strings, and do not perform user-defined operator overloading for
6780 2002-11-24 Miguel de Icaza <miguel@ximian.com>
6782 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
6783 internalcall as it is a pretty simple operation; Avoid whenever
6784 possible to call Char.IsLetter.
6786 (consume_identifier): Cut by half the number of
6787 hashtable calls by merging the is_keyword and GetKeyword behavior.
6789 Do not short-circuit, because if we do, we
6790 report errors (ie, #if false && true would produce an invalid
6794 2002-11-24 Martin Baulig <martin@ximian.com>
6796 * expression.cs (Cast.TryReduce): If we're in checked syntax,
6797 check constant ranges and report a CS0221. Fixes #33186.
6799 2002-11-24 Martin Baulig <martin@ximian.com>
6801 * cs-parser.jay: Make this work for uninitialized variable
6802 declarations in the `for' initializer. Fixes #32416.
6804 2002-11-24 Martin Baulig <martin@ximian.com>
6806 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
6807 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
6809 2002-11-24 Martin Baulig <martin@ximian.com>
6811 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
6812 argument; if true, we also check for user-defined conversions.
6813 This is only needed if both arguments are of a user-defined type.
6814 Fixes #30443, added test-175.cs.
6815 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
6817 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
6819 2002-11-24 Martin Baulig <martin@ximian.com>
6821 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
6822 function to get the store opcode.
6823 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
6824 only emit the Ldelema if the store opcode is Stobj. You must run
6825 both test-34 and test-167 to test this. Fixes #34529.
6827 2002-11-23 Martin Baulig <martin@ximian.com>
6829 * ecore.cs (Expression.MemberLookup): Added additional
6830 `qualifier_type' argument which is used when we're being called
6831 from MemberAccess.DoResolve() and null if we're called from a
6833 (Expression.MemberLookupFailed): New method to report errors; this
6834 does the CS1540 check and reports the correct error message.
6836 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
6837 argument for the CS1540 check and redone the way how we're dealing
6838 with private members. See the comment in the source code for details.
6839 (FilterWithClosure): Reverted this back to revision 1.197; renamed
6840 `closure_start_type' to `closure_qualifier_type' and check whether
6841 it's not null. It was not this filter being broken, it was just
6842 being called with the wrong arguments.
6844 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
6845 and pass it the correct `qualifier_type'; this also does the error
6848 2002-11-22 Miguel de Icaza <miguel@ximian.com>
6850 * expression.cs (Invocation.EmitParams): If the we are dealing
6851 with a non-built-in value type, load its address as well.
6853 (ArrayCreation): Use a a pretty constant instead
6854 of the hardcoded value 2. Use 6 instead of 2 for the number of
6855 static initializers.
6857 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
6858 because they are not really value types, just glorified integers.
6860 * driver.cs: Do not append .exe, the CSC compiler does not do it.
6862 * ecore.cs: Remove redundant code for enumerations, make them use
6863 the same code path as everything else, fixes the casting issue
6864 with enumerations in Windows.Forms.
6866 * attribute.cs: Do only cast to string if it is a string, the
6867 validation happens later.
6869 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
6870 people upgrade their corlibs.
6872 * ecore.cs: Oops, enumerations were not following the entire code path
6874 2002-11-21 Miguel de Icaza <miguel@ximian.com>
6876 * typemanager.cs (FilterWithClosure): Commented out the test for
6877 1540 in typemanager.cs, as it has problems when accessing
6878 protected methods from a parent class (see test-174.cs).
6880 * attribute.cs (Attribute.ValidateGuid): new method.
6881 (Attribute.Resolve): Use above.
6883 2002-11-19 Miguel de Icaza <miguel@ximian.com>
6885 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
6887 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
6888 handling for enumerations, as we only needed the TypeContainer
6889 functionality to begin with (this is required for the fix below to
6890 work for enums that reference constants in a container class for
6893 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
6895 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
6896 a valid TypeBuilder to perform lookups on.o
6898 * class.cs (InheritableMemberSignatureCompare): Use true in the
6899 call to GetGetMethod and GetSetMethod, because we are comparing
6900 the signature, and we need to get the methods *even* if they are
6903 (PropertyBase.CheckBase): ditto.
6905 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
6906 GotoCase.Resolve): Use Peel on EmpytCasts.
6908 * ecore.cs (EmptyCast): drop child, add Peel method.
6910 2002-11-17 Martin Baulig <martin@ximian.com>
6912 * ecore.cs (EmptyCast.Child): New public property.
6914 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
6915 label resolved to an EmptyCast. Fixes #34162.
6916 (GotoCase.Resolve): Likewise.
6917 (Block.EmitMeta): Likewise.
6919 2002-11-17 Martin Baulig <martin@ximian.com>
6921 * expression.cs (Invocation.BetterConversion): Prefer int over
6922 uint; short over ushort; long over ulong for integer literals.
6923 Use ImplicitConversionExists instead of StandardConversionExists
6924 since we also need to check for user-defined implicit conversions.
6925 Fixes #34165. Added test-173.cs.
6927 2002-11-16 Martin Baulig <martin@ximian.com>
6929 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
6930 with the `true' and `false' literals. Fixes #33151.
6932 2002-11-16 Martin Baulig <martin@ximian.com>
6934 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
6935 October 22nd; don't do the cs1540 check for static members.
6937 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
6938 now using our own filter here and doing the cs1540 check again.
6940 2002-11-16 Martin Baulig <martin@ximian.com>
6942 * support.cs (InternalParameters): Don't crash if we don't have
6943 any fixed parameters. Fixes #33532.
6945 2002-11-16 Martin Baulig <martin@ximian.com>
6947 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
6948 when looking up static methods to make this work on Windows.
6951 2002-11-16 Martin Baulig <martin@ximian.com>
6953 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
6954 a setter rather than using PropertyInfo.CanWrite.
6956 2002-11-15 Nick Drochak <ndrochak@gol.com>
6958 * class.cs: Allow acces to block member by subclasses. Fixes build
6961 2002-11-14 Martin Baulig <martin@ximian.com>
6963 * class.cs (Constructor.Emit): Added the extern/block check.
6966 2002-11-14 Martin Baulig <martin@ximian.com>
6968 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
6969 iteration while looking for indexers, this is needed because the
6970 indexer may have a different name in our base classes. Fixed the
6971 error reporting (no indexers at all, not get accessor, no
6972 overloaded match). Fixes bug #33089.
6973 (IndexerAccess.DoResolveLValue): Likewise.
6975 2002-11-14 Martin Baulig <martin@ximian.com>
6977 * class.cs (PropertyBase.CheckBase): Make this work for multiple
6978 indexers. Fixes the first part of bug #33089.
6979 (MethodSignature.InheritableMemberSignatureCompare): Added support
6982 2002-11-13 Ravi Pratap <ravi@ximian.com>
6984 * attribute.cs (Attribute.Resolve): Catch the
6985 NullReferenceException and report it since it isn't supposed to
6988 2002-11-12 Miguel de Icaza <miguel@ximian.com>
6990 * expression.cs (Binary.EmitBranchable): Also handle the cases for
6991 LogicalOr and LogicalAnd that can benefit from recursively
6992 handling EmitBranchable. The code now should be nice for Paolo.
6994 2002-11-08 Miguel de Icaza <miguel@ximian.com>
6996 * typemanager.cs (LookupType): Added a negative-hit hashtable for
6997 the Type lookups, as we perform quite a number of lookups on
6998 non-Types. This can be removed once we can deterministically tell
6999 whether we have a type or a namespace in advance.
7001 But this might require special hacks from our corlib.
7005 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
7006 and double which avoids a conversion from an integer to a double.
7008 * expression.cs: tiny optimization, avoid calling IsConstant,
7009 because it effectively performs the lookup twice.
7011 2002-11-06 Miguel de Icaza <miguel@ximian.com>
7013 But a bogus return here to keep the semantics of the old code
7014 until the Mono runtime is fixed.
7016 * pending.cs (GetMissingInterfaces): New method used to remove all
7017 the interfaces that are already implemented by our parent
7018 classes from the list of pending methods.
7020 * interface.cs: Add checks for calls after ResolveTypeExpr.
7022 2002-11-05 Miguel de Icaza <miguel@ximian.com>
7024 * class.cs (Class.Emit): Report warning 67: event not used if the
7025 warning level is beyond 3.
7027 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
7028 being a NullLiteral.
7030 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
7033 * class.cs (TypeContainer.GetClassBases): Cover a missing code
7034 path that might fail if a type can not be resolved.
7036 * expression.cs (Binary.Emit): Emit unsigned versions of the
7039 * driver.cs: use error 5.
7041 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
7043 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
7045 2002-11-01 Miguel de Icaza <miguel@ximian.com>
7047 * cs-parser.jay (switch_section): A beautiful patch from Martin
7048 Baulig that fixed 33094.
7050 2002-10-31 Miguel de Icaza <miguel@ximian.com>
7052 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
7053 Check whether the base is abstract and report an error if so.
7055 * expression.cs (IndexerAccess.DoResolveLValue,
7056 IndexerAccess.DoResolve): ditto.
7058 (Invocation.DoResolve): ditto.
7060 (Invocation.FullMethodDesc): Improve the report string.
7062 * statement.cs (Block): Eliminate IsVariableDefined as it is
7063 basically just a wrapper for GetVariableInfo.
7065 * ecore.cs (SimpleName): Use new
7067 * support.cs (ReflectionParamter.ParameterType): We unwrap the
7068 type, as we return the actual parameter ref/unref state on a
7071 2002-10-30 Miguel de Icaza <miguel@ximian.com>
7073 * support.cs: Return proper flags REF/OUT fixing the previous
7076 * expression.cs: Reverted last patch, that was wrong. Is_ref is
7077 not used to mean `ref' but `ref or out' in ParameterReference
7079 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
7080 full type signature instead of calling TypeManger.CSharpName
7083 * support.cs (InternalParameters.ParameterDesc): Do not compare
7084 directly to the modflags, because REF/OUT will actually be bitsets
7087 * delegate.cs (VerifyMethod): Check also the modifiers.
7089 * cs-tokenizer.cs: Fix bug where floating point values with an
7090 exponent where a sign was missing was ignored.
7092 * driver.cs: Allow multiple assemblies to be specified in a single
7095 2002-10-28 Miguel de Icaza <miguel@ximian.com>
7097 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
7098 because identifiers after a parenthesis would end up in this kind
7099 of production, and we needed to desamiguate it for having casts
7102 (UserDefinedType *) xxx
7104 2002-10-24 Miguel de Icaza <miguel@ximian.com>
7106 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
7107 we should set on the Bindingflags.NonPublic, but not turn on
7108 private_ok. private_ok controls whether a Private member is
7109 returned (this is chekced on the filter routine), while the
7110 BindingFlags.NonPublic just controls whether private/protected
7111 will be allowed. This fixes the problem part of the problem of
7112 private properties being allowed to be used in derived classes.
7114 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
7115 so we can call the children DoResolveLValue method (this will
7116 properly signal errors on lvalue assignments to base properties)
7118 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
7119 getter are null, and we have a property info, we know that this
7120 happened because the lookup failed, so we report an error 122 for
7121 protection level violation.
7123 We also silently return if setter and getter are null in the
7124 resolve functions, this condition only happens if we have flagged
7125 the error before. This is the other half of the problem.
7127 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
7128 not have accessibility information, that is why we were returning
7129 true in the filter function in typemanager.cs.
7131 To properly report 122 (property is inaccessible because of its
7132 protection level) correctly, we report this error in ResolveAccess
7133 by failing if both the setter and the getter are lacking (ie, the
7136 DoResolve and DoLResolve have been modified to check for both
7137 setter/getter being null and returning silently, the reason being
7138 that I did not want to put the knowledge about this error in upper
7141 int old = Report.Errors;
7142 x = new PropertyExpr (...);
7143 if (old != Report.Errors)
7148 So the property expr is returned, but it is invalid, so the error
7149 will be flagged during the resolve process.
7151 * class.cs: Remove InheritablePropertySignatureCompare from the
7152 class, as we no longer depend on the property signature to compute
7153 whether it is possible to implement a method or not.
7155 The reason is that calling PropertyInfo.GetGetMethod will return
7156 null (in .NET, in Mono it works, and we should change this), in
7157 cases where the Get Method does not exist in that particular
7162 class X { public virtual int A { get { return 1; } } }
7164 class Z : Y { public override int A { get { return 2; } } }
7166 Would fail in Z because the parent (Y) would not have the property
7167 defined. So we avoid this completely now (because the alternative
7168 fix was ugly and slow), and we now depend exclusively on the
7171 (PropertyBase.CheckBase): Use a method-base mechanism to find our
7172 reference method, instead of using the property.
7174 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
7175 routines are gone now.
7177 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
7178 names, they were incorrectly named.
7180 * cs-tokenizer.cs: Return are more gentle token on failure.
7182 * pending.cs (PendingImplementation.InterfaceMethod): This routine
7183 had an out-of-sync index variable, which caused it to remove from
7184 the list of pending methods the wrong method sometimes.
7186 2002-10-22 Miguel de Icaza <miguel@ximian.com>
7188 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
7189 CanWrite, because those refer to this particular instance of the
7190 property, and do not take into account the fact that we can
7191 override single members of a property.
7193 Constructor requires an EmitContext. The resolution process does
7194 not happen here, but we need to compute the accessors before,
7195 because the resolution does not always happen for properties.
7197 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
7198 subclass, before we did not update this flag, but we did update
7201 (GetAccessors): Drop this routine, as it did not work in the
7202 presence of partially overwritten set/get methods.
7204 Notice that this broke the cs1540 detection, but that will require
7207 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7211 * driver.cs: issue a warning instead of an error if we don't support
7212 debugging for the platform. Also ignore a couple of errors that may
7213 arise when trying to write the symbols. Undo my previous patch.
7215 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7217 * driver.cs: ignore /debug switch except for Unix platforms.
7219 2002-10-23 Nick Drochak <ndrochak@gol.com>
7221 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
7223 2002-10-21 Miguel de Icaza <miguel@ximian.com>
7225 * driver.cs: Do not make mcs-debug conditional, so we do not break
7228 * statement.cs (UsageVector.MergeChildren): I would like Martin to
7229 review this patch. But basically after all the children variables
7230 have been merged, the value of "Breaks" was not being set to
7231 new_breaks for Switch blocks. I think that it should be set after
7232 it has executed. Currently I set this to the value of new_breaks,
7233 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
7234 conservative, but I do not understand this code very well.
7236 I did not break anything in the build, so that is good ;-)
7238 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
7240 2002-10-20 Mark Crichton <crichton@gimp.org>
7242 * cfold.cs: Fixed compile blocker. Really fixed it this time.
7244 2002-10-20 Nick Drochak <ndrochak@gol.com>
7246 * cfold.cs: Fixed compile blocker.
7248 2002-10-20 Miguel de Icaza <miguel@ximian.com>
7250 * driver.cs: I was chekcing the key, not the file.
7252 2002-10-19 Ravi Pratap <ravi@ximian.com>
7254 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
7255 message that we were generating - we just need to silently return
7258 2002-10-19 Miguel de Icaza <miguel@ximian.com>
7260 * class.cs (Event.Define): Change my previous commit, as this
7261 breaks the debugger. This is a temporary hack, as it seems like
7262 the compiler is generating events incorrectly to begin with.
7264 * expression.cs (Binary.ResolveOperator): Added support for
7265 "U operator - (E x, E y)"
7267 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
7270 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
7271 init-only variables, but this path did not take into account that
7272 there might be also instance readonly variables. Correct this
7275 This fixes bug 32253
7277 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
7280 * driver.cs: Change the extension for modules to `netmodule'
7282 * cs-parser.jay: Improved slightly the location tracking for
7283 the debugger symbols.
7285 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
7286 modifiers that were specified instead of the hardcoded value
7287 (FamAndAssem). This was basically ignoring the static modifier,
7288 and others. Fixes 32429.
7290 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
7291 fixed a bug in the process (32476)
7293 * expression.cs (ArrayAccess.EmitAssign): Patch from
7294 hwang_rob@yahoo.ca that fixes bug 31834.3
7296 2002-10-18 Miguel de Icaza <miguel@ximian.com>
7298 * driver.cs: Make the module extension .netmodule.
7300 2002-10-16 Miguel de Icaza <miguel@ximian.com>
7302 * driver.cs: Report an error if the resource file is not found
7303 instead of crashing.
7305 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
7306 false, like Emit does.
7308 2002-10-16 Nick Drochak <ndrochak@gol.com>
7310 * typemanager.cs: Remove unused private member. Also reported mcs
7311 bug to report this as a warning like csc.
7313 2002-10-15 Martin Baulig <martin@gnome.org>
7315 * statement.cs (Statement.Emit): Made this a virtual method; emits
7316 the line number info and calls DoEmit().
7317 (Statement.DoEmit): New protected abstract method, formerly knows
7318 as Statement.Emit().
7320 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
7322 2002-10-11 Miguel de Icaza <miguel@ximian.com>
7324 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
7325 have fixed a remaining problem: not every AddXXXX was adding a
7326 fully qualified name.
7328 Now everyone registers a fully qualified name in the DeclSpace as
7329 being defined instead of the partial name.
7331 Downsides: we are slower than we need to be due to the excess
7332 copies and the names being registered this way.
7334 The reason for this is that we currently depend (on the corlib
7335 bootstrap for instance) that types are fully qualified, because
7336 we dump all the types in the namespace, and we should really have
7337 types inserted into the proper namespace, so we can only store the
7338 basenames in the defined_names array.
7340 2002-10-10 Martin Baulig <martin@gnome.org>
7342 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
7343 from bug #31834, see the bug report for a testcase which is
7346 2002-10-10 Martin Baulig <martin@gnome.org>
7348 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
7349 flow analysis code for this.
7351 * statement.cs (Do, While, For): Tell the flow analysis code about
7353 (FlowBranching.UsageVector): Added support for infinite loops.
7354 (Block.Resolve): Moved the dead code elimination here and use flow
7357 2002-10-09 Miguel de Icaza <miguel@ximian.com>
7359 * class.cs (Field.Define): Catch cycles on struct type
7362 * typemanager.cs (IsUnmanagedtype): Do not recursively check
7363 fields if the fields are static. We only need to check instance
7366 * expression.cs (As.DoResolve): Test for reference type.
7368 * statement.cs (Using.ResolveExpression): Use
7369 ConvertImplicitRequired, not ConvertImplicit which reports an
7371 (Using.ResolveLocalVariableDecls): ditto.
7373 * expression.cs (Binary.ResolveOperator): Report errors in a few
7374 places where we had to.
7376 * typemanager.cs (IsUnmanagedtype): Finish implementation.
7378 2002-10-08 Miguel de Icaza <miguel@ximian.com>
7380 * expression.cs: Use StoreFromPtr instead of extracting the type
7381 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
7383 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
7384 an enumeration value to a System.Enum, but System.Enum is not a
7385 value type, but an class type, so we need to box.
7387 (Expression.ConvertExplicit): One codepath could return
7388 errors but not flag them. Fix this. Fixes #31853
7390 * parameter.cs (Resolve): Do not allow void as a parameter type.
7392 2002-10-06 Martin Baulig <martin@gnome.org>
7394 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
7395 if it's a class type and not a struct. Fixes #31815.
7397 2002-10-06 Martin Baulig <martin@gnome.org>
7399 * statement.cs: Reworked the flow analysis code a bit to make it
7400 usable for dead code elimination.
7402 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7404 * cs-parser.jay: allow empty source files. Fixes bug #31781.
7406 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7408 * expression.cs (ComposedCast.DoResolveType): A quick workaround
7409 to fix the test 165, will investigate deeper.
7411 2002-10-04 Martin Baulig <martin@gnome.org>
7413 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
7414 finally blocks actually work.
7415 (Try.Resolve): We don't need to create a sibling for `finally' if
7416 there is no finally block.
7418 2002-10-04 Martin Baulig <martin@gnome.org>
7420 * class.cs (Constructor.Define): The default accessibility for a
7421 non-default constructor is private, not public.
7423 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7425 * class.cs (Constructor): Make AllowedModifiers public, add
7428 * cs-parser.jay: Perform the modifiers test here, as the
7429 constructor for the Constructor class usually receives a zero
7430 because of the way we create it (first we create, later we
7431 customize, and we were never checking the modifiers).
7433 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
7434 is a version of LookupTypeReflection that includes the type-name
7435 cache. This can be used as a fast path for functions that know
7436 the fully qualified name and are only calling into *.GetType() to
7437 obtain a composed type.
7439 This is also used by TypeManager.LookupType during its type
7442 (LookupType): We now also track the real type name, as sometimes
7443 we can get a quey for the real type name from things like
7444 ComposedCast. This fixes bug 31422.
7446 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
7447 complete type fullname, it does not have to go through the type
7448 resolution system to obtain the composed version of the type (for
7449 obtaining arrays or pointers).
7451 (Conditional.Emit): Use the EmitBoolExpression to
7452 generate nicer code, as requested by Paolo.
7454 (ArrayCreation.CheckIndices): Use the patch from
7455 hwang_rob@yahoo.ca to validate the array initializers.
7457 2002-10-03 Miguel de Icaza <miguel@ximian.com>
7459 * class.cs (ConstructorInitializer.Emit): simplify code by using
7460 Invocation.EmitCall, and at the same time, fix the bugs in calling
7461 parent constructors that took variable arguments.
7463 * ecore.cs (Expression.ConvertNumericExplicit,
7464 Expression.ImplicitNumericConversion): Remove the code that
7465 manually wrapped decimal (InternalTypeConstructor call is now gone
7468 * expression.cs (Cast.TryReduce): Also handle decimal types when
7469 trying to perform a constant fold on the type.
7471 * typemanager.cs (IsUnmanagedtype): Partially implemented.
7473 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
7474 that only turned off an error report, and did nothing else.
7476 2002-10-02 Miguel de Icaza <miguel@ximian.com>
7478 * driver.cs: Handle and ignore /fullpaths
7480 2002-10-01 Miguel de Icaza <miguel@ximian.com>
7482 * expression.cs (Binary.ResolveOperator): Catch the case where
7483 DoNumericPromotions returns true,
7485 (Binary.DoNumericPromotions): Simplify the code, and the tests.
7487 2002-09-27 Miguel de Icaza <miguel@ximian.com>
7489 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
7492 2002-09-26 Miguel de Icaza <miguel@ximian.com>
7494 * ecore.cs (ConvertNumericExplicit): It is not enough that the
7495 conversion exists, but it is also required that the conversion be
7496 performed. This manifested in "(Type64Enum) 2".
7498 * class.cs (TypeManager.AddMethod): The fix is not to change
7499 AddEnum, because that one was using a fully qualified name (every
7500 DeclSpace derivative does), but to change the AddMethod routine
7501 that was using an un-namespaced name. This now correctly reports
7502 the duplicated name.
7504 Revert patch until I can properly fix it. The issue
7505 is that we have a shared Type space across all namespaces
7506 currently, which is wrong.
7508 Options include making the Namespace a DeclSpace, and merge
7509 current_namespace/current_container in the parser.
7511 2002-09-25 Miguel de Icaza <miguel@ximian.com>
7513 * cs-parser.jay: Improve error reporting when we get a different
7514 kind of expression in local_variable_type and
7515 local_variable_pointer_type.
7517 Propagate this to avoid missleading errors being reported.
7519 * ecore.cs (ImplicitReferenceConversion): treat
7520 TypeManager.value_type as a target just like object_type. As
7525 Is valid, and needs to result in the int 1 being boxed before it
7526 is assigned to the value type v.
7528 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
7529 to validate the enumeration name.
7531 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
7532 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
7533 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
7535 * ecore.cs (TryImplicitIntConversion): When doing an
7536 implicit-enumeration-conversion, check if the type is 64-bits and
7537 perform a conversion before passing to EnumConstant.
7539 2002-09-23 Miguel de Icaza <miguel@ximian.com>
7541 * decl.cs (Error_AmbiguousTypeReference); New routine used to
7542 report ambiguous type references. Unlike the MS version, we
7543 report what the ambiguity is. Innovation at work ;-)
7545 (DeclSpace.FindType): Require a location argument to
7546 display when we display an ambiguous error.
7548 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
7550 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
7552 * expression.cs (EmitDynamicInitializers): Apply patch from
7553 hwang_rob@yahoo.ca that fixes the order in which we emit our
7556 2002-09-21 Martin Baulig <martin@gnome.org>
7558 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
7559 delegate takes no arguments.
7561 2002-09-20 Miguel de Icaza <miguel@ximian.com>
7563 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
7566 * expression.cs: Extract the underlying type.
7568 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
7570 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
7572 2002-09-19 Miguel de Icaza <miguel@ximian.com>
7574 * class.cs (TypeContainer.DefineType): We can not use the nice
7575 PackingSize with the size set to 1 DefineType method, because it
7576 will not allow us to define the interfaces that the struct
7579 This completes the fixing of bug 27287
7581 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
7582 means also structs. This fixes part of the problem.
7583 (Expresion.ImplicitReferenceConversionExists): ditto.
7585 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
7586 error if there were no errors reported during the type lookup
7587 process, to avoid duplicates or redundant errors. Without this
7588 you would get an ambiguous errors plus a type not found. We have
7589 beaten the user enough with the first error.
7591 (DeclSparce.FindType): Emit a warning if we have an ambiguous
7594 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
7595 during the resolution process, stop the lookup, this avoids
7596 repeated error reports (same error twice).
7598 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
7600 * typemanager.cs (LookupType): Redo the type lookup code to match
7601 the needs of System.Reflection.
7603 The issue is that System.Reflection requires references to nested
7604 types to begin with a "+" sign instead of a dot. So toplevel
7605 types look like: "NameSpace.TopLevelClass", and nested ones look
7606 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
7609 2002-09-19 Martin Baulig <martin@gnome.org>
7611 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
7612 says that a method always returns or always throws an exception,
7613 don't report the CS0161.
7615 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
7616 set `Returns = new_returns'.
7618 2002-09-19 Martin Baulig <martin@gnome.org>
7620 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
7621 to an enum constant, check for a CS0176.
7623 2002-09-18 Miguel de Icaza <miguel@ximian.com>
7625 * class.cs (TypeContainer.CheckPairedOperators): Now we check
7626 for operators that must be in pairs and report errors.
7628 * ecore.cs (SimpleName.DoResolveType): During the initial type
7629 resolution process, when we define types recursively, we must
7630 check first for types in our current scope before we perform
7631 lookups in the enclosing scopes.
7633 * expression.cs (MakeByteBlob): Handle Decimal blobs.
7635 (Invocation.VerifyArgumentsCompat): Call
7636 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
7637 I thought we were supposed to always call this, but there are a
7638 few places in the code where we dont do it.
7640 2002-09-17 Miguel de Icaza <miguel@ximian.com>
7642 * driver.cs: Add support in -linkres and -resource to specify the
7643 name of the identifier.
7645 2002-09-16 Miguel de Icaza <miguel@ximian.com>
7647 * ecore.cs (StandardConversionExists): Sync with the conversion
7648 code: allow anything-* to void* conversions.
7650 (FindMostSpecificSource): Use an Expression argument
7651 instead of a Type, because we might be handed over a Literal which
7652 gets a few more implicit conversions that plain types do not. So
7653 this information was being lost.
7655 Also, we drop the temporary type-holder expression when not
7658 2002-09-17 Martin Baulig <martin@gnome.org>
7660 * class.cs (PropertyBase.CheckBase): Don't check the base class if
7661 this is an explicit interface implementation.
7663 2002-09-17 Martin Baulig <martin@gnome.org>
7665 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
7666 different `IndexerName' attributes.
7668 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
7669 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
7670 virtual CommonResolve().
7672 2002-09-16 Miguel de Icaza <miguel@ximian.com>
7674 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
7675 and convert that to the UnderlyingType.
7677 * statement.cs (Foreach.Resolve): Indexers are just like variables
7678 or PropertyAccesses.
7680 * cs-tokenizer.cs (consume_string): Track line numbers and columns
7681 inside quoted strings, we were not doing this before.
7683 2002-09-16 Martin Baulig <martin@gnome.org>
7685 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
7686 resolve it. This is needed for the definite assignment check of the
7687 instance expression, fixes bug #29846.
7688 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
7690 2002-09-16 Nick Drochak <ndrochak@gol.com>
7692 * parameter.cs: Fix compile error. Cannot reference static member
7693 from an instance object. Is this an mcs bug?
7695 2002-09-14 Martin Baulig <martin@gnome.org>
7697 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
7698 multiple times. Fixes bug #30295, added test-166.cs.
7700 2002-09-14 Martin Baulig <martin@gnome.org>
7702 * statement.cs (Block.Emit): Don't emit unreachable code.
7703 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
7705 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
7707 2002-09-14 Martin Baulig <martin@gnome.org>
7709 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
7712 2002-09-14 Martin Baulig <martin@gnome.org>
7714 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
7715 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
7716 be false on the ms runtime.
7718 2002-09-13 Martin Baulig <martin@gnome.org>
7720 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
7721 the CS0038 error message.
7723 2002-09-12 Miguel de Icaza <miguel@ximian.com>
7725 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
7726 constant inside, return it.
7728 2002-09-12 Martin Baulig <martin@gnome.org>
7730 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
7731 implicit conversion can be done between enum types.
7733 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
7734 check whether an implicit conversion to the current enum's UnderlyingType
7735 exists and report an error if not.
7737 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
7738 without debugging support.
7740 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
7741 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
7743 2002-09-12 Martin Baulig <martin@gnome.org>
7745 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
7747 * ecore.cs (IMemberExpr.DeclaringType): New property.
7748 (SimpleName.SimpleNameResolve): Check whether we're accessing a
7749 nonstatic member of an outer type (CS0038).
7751 2002-09-11 Miguel de Icaza <miguel@ximian.com>
7753 * driver.cs: Activate the using-error detector at warning level
7754 4 (at least for MS-compatible APIs).
7756 * namespace.cs (VerifyUsing): Small buglett fix.
7758 * pending.cs (PendingImplementation): pass the container pointer.
7760 * interface.cs (GetMethods): Allow for recursive definition. Long
7761 term, I would like to move every type to support recursive
7762 definitions, not the current ordering mechanism that we have right
7765 The situation is this: Attributes are handled before interfaces,
7766 so we can apply attributes to interfaces. But some attributes
7767 implement interfaces, we will now handle the simple cases
7768 (recursive definitions will just get an error).
7770 * parameter.cs: Only invalidate types at the end if we fail to
7773 2002-09-09 Martin Baulig <martin@gnome.org>
7775 * ecore.cs (PropertyExpr.Emit): Also check for
7776 TypeManager.system_int_array_get_length so this'll also work when
7777 compiling corlib. Fixes #30003.
7779 2002-09-09 Martin Baulig <martin@gnome.org>
7781 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
7782 and throw an exception if we can't get the type's size. Fixed #30040,
7785 2002-09-09 Martin Baulig <martin@gnome.org>
7787 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
7789 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
7790 context. Fixes bug #30027.
7792 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
7793 virtual functions. Fixes bug #30043, added test-164.cs.
7795 2002-09-08 Ravi Pratap <ravi@ximian.com>
7797 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
7799 2002-09-08 Nick Drochak <ndrochak@gol.com>
7801 * driver.cs: Use an object to get the windows codepage since it's not a
7804 2002-09-08 Miguel de Icaza <miguel@ximian.com>
7806 * statement.cs (For.Emit): for infinite loops (test == null)
7807 return whether there is a break inside, not always "true".
7809 * namespace.cs (UsingEntry): New struct to hold the name of the
7810 using definition, the location where it is defined, and whether it
7811 has been used in a successful type lookup.
7813 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
7818 2002-09-06 Ravi Pratap <ravi@ximian.com>
7820 * attribute.cs : Fix incorrect code which relied on catching
7821 a NullReferenceException to detect a null being passed in
7822 where an object was expected.
7824 2002-09-06 Miguel de Icaza <miguel@ximian.com>
7826 * statement.cs (Try): flag the catch variable as assigned
7828 * expression.cs (Cast): Simplified by using ResolveType instead of
7831 * statement.cs (Catch): Fix bug by using ResolveType.
7833 2002-09-06 Ravi Pratap <ravi@ximian.com>
7835 * expression.cs (BetterConversion): Special case for when we have
7836 a NullLiteral as the argument and we have to choose between string
7837 and object types - we choose string the way csc does.
7839 * attribute.cs (Attribute.Resolve): Catch the
7840 NullReferenceException and report error #182 since the Mono
7841 runtime no more has the bug and having this exception raised means
7842 we tried to select a constructor which takes an object and is
7845 2002-09-05 Ravi Pratap <ravi@ximian.com>
7847 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
7848 message (1502, 1503) when we can't locate a method after overload
7849 resolution. This is much more informative and closes the bug
7852 * interface.cs (PopulateMethod): Return if there are no argument
7853 types. Fixes a NullReferenceException bug.
7855 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
7856 expressions too. Previously we were checking only in one place for
7857 positional arguments leaving out named arguments.
7859 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
7860 type to the enum type is not allowed. Remove code corresponding to
7863 (ConvertNumericExplicit): Allow explicit conversions from
7864 the underlying type to enum type. This precisely follows the spec
7865 and closes a bug filed by Gonzalo.
7867 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7870 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
7872 2002-09-03 Miguel de Icaza <miguel@ximian.com>
7874 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
7875 it was important that we stored the right value after the
7876 reduction in `converted'.
7878 2002-09-04 Martin Baulig <martin@gnome.org>
7880 * location.cs (Location.SymbolDocument): Use full pathnames for the
7883 2002-08-30 Miguel de Icaza <miguel@ximian.com>
7885 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
7886 of the expression resolve mechanism, because that will catch the
7887 SimpleName error failures.
7889 (Conditional): If we can not resolve the
7890 expression, return, do not crash.
7892 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7895 (location): display token name instead of its number.
7897 2002-08-28 Martin Baulig <martin@gnome.org>
7899 * expression.cs (Binary.ResolveOperator): Don't silently return
7900 but return an error if an operator cannot be applied between two
7903 2002-08-28 Martin Baulig <martin@gnome.org>
7905 * class.cs (Constructor.Define): Set the permission attributes
7906 correctly instead of making all constructors public.
7908 2002-08-28 Martin Baulig <martin@gnome.org>
7910 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
7911 for private members before reporting a CS0103; if we find anything,
7914 2002-08-28 Martin Baulig <martin@gnome.org>
7916 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
7917 to check whether `closure_start_type == closure_invocation_type',
7918 we also need to check whether `m.DeclaringType == closure_invocation_type'
7919 before bypassing the permission checks. We might be accessing
7920 protected/private members from the base class.
7921 (TypeManager.RealMemberLookup): Only set private_ok if private
7922 members were requested via BindingFlags.NonPublic.
7924 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
7926 * expression.cs (MemberAccess.ResolveMemberAccess): Set
7927 MethodGroupExpr.IsExplicitImpl if appropriate.
7928 (Invocation.DoResolve): Don't report the CS0120 for explicit
7929 interface implementations.
7931 2002-08-27 Martin Baulig <martin@gnome.org>
7933 * expression.cs (Invocation.DoResolve): If this is a static
7934 method and we don't have an InstanceExpression, we must report
7937 2002-08-25 Martin Baulig <martin@gnome.org>
7939 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
7940 `==' between a valuetype and an object.
7942 2002-08-25 Miguel de Icaza <miguel@ximian.com>
7944 * ecore.cs (TypeExpr): Provide a ToString method.
7946 2002-08-24 Martin Baulig <martin@gnome.org>
7948 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
7949 now called proggie.dbg and it's a binary file.
7951 2002-08-23 Martin Baulig <martin@gnome.org>
7953 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
7955 2002-08-23 Martin Baulig <martin@gnome.org>
7957 * struct.cs (MyStructInfo.ctor): Make this work with empty
7958 structs; it's not allowed to use foreach() on null.
7960 2002-08-23 Martin Baulig <martin@gnome.org>
7962 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
7963 writer the full pathname of the generated assembly.
7965 2002-08-23 Martin Baulig <martin@gnome.org>
7967 * statements.cs (FlowBranching.UsageVector.MergeChildren):
7968 A `finally' block never returns or breaks; improved handling of
7971 2002-08-23 Martin Baulig <martin@gnome.org>
7973 * statement.cs (Throw.Resolve): Allow `throw null'.
7975 2002-08-23 Martin Baulig <martin@gnome.org>
7977 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
7978 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
7979 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
7980 MemberLookup would return a wrong event if this is an explicit
7981 interface implementation and the class has an event with the same
7984 2002-08-23 Martin Baulig <martin@gnome.org>
7986 * statement.cs (Block.AddChildVariableNames): New public method.
7987 (Block.AddChildVariableName): Likewise.
7988 (Block.IsVariableNameUsedInChildBlock): Likewise.
7989 (Block.AddVariable): Check whether a variable name has already
7990 been used in a child block.
7992 * cs-parser.jay (declare_local_variables): Mark all variable names
7993 from the current block as being used in a child block in the
7996 2002-08-23 Martin Baulig <martin@gnome.org>
7998 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
7999 find the symbol writer.
8001 * driver.cs: csc also allows the arguments to /define being
8002 separated by commas, not only by semicolons.
8004 2002-08-23 Martin Baulig <martin@gnome.org>
8006 * interface.cs (Interface.GetMembers): Added static check for events.
8008 2002-08-15 Martin Baulig <martin@gnome.org>
8010 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
8011 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
8013 * ecore.cs (Expression.MemberLookup): Added documentation and explained
8014 why the MethodData.EmitDestructor() change was necessary.
8016 2002-08-20 Martin Baulig <martin@gnome.org>
8018 * class.cs (TypeContainer.FindMembers): Added static check for events.
8020 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
8022 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
8023 use Type.GetEvents(), not Type.FindMembers().
8025 2002-08-20 Martin Baulig <martin@gnome.org>
8027 * decl.cs (MemberCache): Added a special method cache which will
8028 be used for method-only searched. This ensures that a method
8029 search will return a MethodInfo with the correct ReflectedType for
8032 2002-08-20 Martin Baulig <martin@gnome.org>
8034 * decl.cs (DeclSpace.FindMembers): Made this public.
8036 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8038 * delegate.cs: fixed build on windows.
8039 [FIXME: Filed as bug #29150: MCS must report these errors.]
8041 2002-08-19 Ravi Pratap <ravi@ximian.com>
8043 * ecore.cs (StandardConversionExists): Return a false
8044 if we are trying to convert the void type to anything else
8045 since that is not allowed.
8047 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
8048 we flag error 70 in the event an event is trying to be accessed
8049 directly from outside the declaring type.
8051 2002-08-20 Martin Baulig <martin@gnome.org>
8053 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
8054 MemberCache from typemanager.cs to decl.cs.
8056 2002-08-19 Martin Baulig <martin@gnome.org>
8058 * class.cs (TypeContainer): Implement IMemberContainer.
8059 (TypeContainer.DefineMembers): Create the MemberCache.
8060 (TypeContainer.FindMembers): Do better BindingFlags checking; only
8061 return public members if BindingFlags.Public was given, check
8062 whether members are static.
8064 2002-08-16 Martin Baulig <martin@gnome.org>
8066 * decl.cs (DeclSpace.Define): Splitted this in Define and
8067 DefineMembers. DefineMembers is called first and initializes the
8070 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
8071 DefineMembers() on all our DeclSpaces.
8073 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
8074 but call DefineMembers() on all nested interfaces. We call their
8075 Define() in our new Define() function.
8077 * interface.cs (Interface): Implement IMemberContainer.
8078 (Interface.Define): Moved all code except the attribute stuf to
8080 (Interface.DefineMembers): Initialize the member cache.
8082 * typemanager.cs (IMemberFinder): Removed this interface, we don't
8083 need this anymore since we can use MemberCache.FindMembers directly.
8085 2002-08-19 Martin Baulig <martin@gnome.org>
8087 * typemanager.cs (MemberCache): When creating the cache for an
8088 interface type, add all inherited members.
8089 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
8090 to `out bool used_cache' and documented it.
8091 (TypeManager.MemberLookup): If we already used the cache in the first
8092 iteration, we don't need to do the interfaces check.
8094 2002-08-19 Martin Baulig <martin@gnome.org>
8096 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
8097 here from IMemberFinder and don't implement this interface anymore.
8098 (DeclSpace.MemberCache): Moved here from IMemberFinder.
8100 * typemanager.cs (IMemberFinder): This interface is now only used by
8101 classes which actually support the member cache.
8102 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
8103 since we only put DeclSpaces into this Hashtable.
8104 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
8105 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
8107 2002-08-16 Martin Baulig <martin@gnome.org>
8109 * typemanager.cs (ICachingMemberFinder): Removed.
8110 (IMemberFinder.MemberCache): New property.
8111 (TypeManager.FindMembers): Merged this with RealFindMembers().
8112 This function will never be called from TypeManager.MemberLookup()
8113 so we can't use the cache here, just the IMemberFinder.
8114 (TypeManager.MemberLookup_FindMembers): Check whether the
8115 IMemberFinder has a MemberCache and call the cache's FindMembers
8117 (MemberCache): Rewrote larger parts of this yet another time and
8118 cleaned it up a bit.
8120 2002-08-15 Miguel de Icaza <miguel@ximian.com>
8122 * driver.cs (LoadArgs): Support quoting.
8124 (Usage): Show the CSC-like command line arguments.
8126 Improved a few error messages.
8128 2002-08-15 Martin Baulig <martin@gnome.org>
8130 * typemanager.cs (IMemberContainer.Type): New property.
8131 (IMemberContainer.IsInterface): New property.
8133 The following changes are conditional to BROKEN_RUNTIME, which is
8134 defined at the top of the file.
8136 * typemanager.cs (MemberCache.MemberCache): Don't add the base
8137 class'es members, but add all members from TypeHandle.ObjectType
8138 if we're an interface.
8139 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
8140 is the current type.
8141 (MemberCache.CacheEntry.Container): Removed this field.
8142 (TypeHandle.GetMembers): Include inherited members.
8144 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8146 * typemanager.cs: fixed compilation and added a comment on a field that
8149 2002-08-15 Martin Baulig <martin@gnome.org>
8151 * class.cs (ConstructorInitializer.Resolve): In the
8152 Expression.MemberLookup call, use the queried_type as
8155 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
8156 declared' attribute, it's always true.
8157 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
8158 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
8159 temporary wrapper for FindMembers which tells MemberLookup whether
8160 members from the base classes are included in the return value.
8161 This will go away soon.
8162 (TypeManager.MemberLookup): Use this temporary hack here; once the
8163 new MemberCache is completed, we don't need to do the DeclaredOnly
8164 looping here anymore since the MemberCache will take care of this.
8165 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
8166 (MemberCache): When creating the MemberCache for a class, get
8167 members from the current class and all its base classes.
8168 (MemberCache.CacheEntry.Container): New field. This is a
8169 temporary hack until the Mono runtime is fixed to distinguish
8170 between ReflectedType and DeclaringType. It allows us to use MCS
8171 with both the MS runtime and the unfixed Mono runtime without
8172 problems and without accecting performance.
8173 (MemberCache.SearchMembers): The DeclaredOnly looping from
8174 TypeManager.MemberLookup is now done here.
8176 2002-08-14 Martin Baulig <martin@gnome.org>
8178 * statement.cs (MyStructInfo.MyStructInfo): Don't call
8179 Type.GetFields on dynamic types but get the fields from the
8180 corresponding TypeContainer.
8181 (MyStructInfo.GetStructInfo): Added check for enum types.
8183 * typemanager.cs (MemberList.IsSynchronized): Implemented.
8184 (MemberList.SyncRoot): Implemented.
8185 (TypeManager.FilterWithClosure): No need to check permissions if
8186 closure_start_type == closure_invocation_type, don't crash if
8187 closure_invocation_type is null.
8189 2002-08-13 Martin Baulig <martin@gnome.org>
8191 Rewrote TypeContainer.FindMembers to use a member cache. This
8192 gives us a speed increase of about 35% for the self-hosting MCS
8193 build and of about 15-20% for the class libs (both on GNU/Linux).
8195 * report.cs (Timer): New class to get enhanced profiling. This
8196 whole class is "TIMER" conditional since it remarkably slows down
8199 * class.cs (MemberList): New class. This is an IList wrapper
8200 which we're now using instead of passing MemberInfo[]'s around to
8201 avoid copying this array unnecessarily.
8202 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
8203 (ICachingMemberFinder, IMemberContainer): New interface.
8204 (TypeManager.FilterWithClosure): If `criteria' is null, the name
8205 has already been checked, otherwise use it for the name comparision.
8206 (TypeManager.FindMembers): Renamed to RealMemberFinder and
8207 provided wrapper which tries to use ICachingMemberFinder.FindMembers
8208 if possible. Returns a MemberList, not a MemberInfo [].
8209 (TypeHandle): New class, implements IMemberContainer. We create
8210 one instance of this class per type, it contains a MemberCache
8211 which is used to do the member lookups.
8212 (MemberCache): New class. Each instance of this class contains
8213 all members of a type and a name-based hash table.
8214 (MemberCache.FindMembers): This is our new member lookup
8215 function. First, it looks up all members of the requested name in
8216 the hash table. Then, it walks this list and sorts out all
8217 applicable members and returns them.
8219 2002-08-13 Martin Baulig <martin@gnome.org>
8221 In addition to a nice code cleanup, this gives us a performance
8222 increase of about 1.4% on GNU/Linux - not much, but it's already
8223 half a second for the self-hosting MCS compilation.
8225 * typemanager.cs (IMemberFinder): New interface. It is used by
8226 TypeManager.FindMembers to call FindMembers on a TypeContainer,
8227 Enum, Delegate or Interface.
8228 (TypeManager.finder_to_member_finder): New PtrHashtable.
8229 (TypeManager.finder_to_container): Removed.
8230 (TypeManager.finder_to_delegate): Removed.
8231 (TypeManager.finder_to_interface): Removed.
8232 (TypeManager.finder_to_enum): Removed.
8234 * interface.cs (Interface): Implement IMemberFinder.
8236 * delegate.cs (Delegate): Implement IMemberFinder.
8238 * enum.cs (Enum): Implement IMemberFinder.
8240 * class.cs (TypeContainer): Implement IMemberFinder.
8242 2002-08-12 Martin Baulig <martin@gnome.org>
8244 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
8246 2002-08-12 Martin Baulig <martin@gnome.org>
8248 * ecore.cs (ITypeExpression): New interface for expressions which
8250 (TypeExpression): Renamed to TypeLookupExpression.
8251 (Expression.DoResolve): If we're doing a types-only lookup, the
8252 expression must implement the ITypeExpression interface and we
8253 call DoResolveType() on it.
8254 (SimpleName): Implement the new ITypeExpression interface.
8255 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
8256 hack, the situation that we're only looking up types can't happen
8257 anymore when this method is called. Moved the type lookup code to
8258 DoResolveType() and call it.
8259 (SimpleName.DoResolveType): This ITypeExpression interface method
8260 is now doing the types-only lookup.
8261 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
8262 (ResolveFlags): Added MaskExprClass.
8264 * expression.cs (MemberAccess): Implement the ITypeExpression
8266 (MemberAccess.DoResolve): Added support for a types-only lookup
8267 when we're called via ITypeExpression.DoResolveType().
8268 (ComposedCast): Implement the ITypeExpression interface.
8270 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
8271 Expression.Resolve() with ResolveFlags.Type instead.
8273 2002-08-12 Martin Baulig <martin@gnome.org>
8275 * interface.cs (Interface.Define): Apply attributes.
8277 * attribute.cs (Attribute.ApplyAttributes): Added support for
8278 interface attributes.
8280 2002-08-11 Martin Baulig <martin@gnome.org>
8282 * statement.cs (Block.Emit): Only check the "this" variable if we
8283 do not always throw an exception.
8285 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
8286 whether the property has a set accessor.
8288 2002-08-11 Martin Baulig <martin@gnome.org>
8290 Added control flow analysis support for structs.
8292 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
8293 with control flow analysis turned off.
8294 (IVariable): New interface.
8295 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
8296 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
8297 (FieldExpr.DoResolve): Resolve the instance expression with flow
8298 analysis turned off and do the definite assignment check after the
8299 resolving when we know what the expression will resolve to.
8301 * expression.cs (LocalVariableReference, ParameterReference):
8302 Implement the new IVariable interface, only call the flow analysis
8303 code if ec.DoFlowAnalysis is true.
8304 (This): Added constructor which takes a Block argument. Implement
8305 the new IVariable interface.
8306 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
8307 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
8308 This does the definite assignment checks for struct members.
8310 * class.cs (Constructor.Emit): If this is a non-static `struct'
8311 constructor which doesn't have any initializer, call
8312 Block.AddThisVariable() to tell the flow analysis code that all
8313 struct elements must be initialized before control returns from
8316 * statement.cs (MyStructInfo): New public class.
8317 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
8318 argument to this indexer. If non-zero, check an individual struct
8319 member, not the whole struct.
8320 (FlowBranching.CheckOutParameters): Check struct members.
8321 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
8322 overloaded versions of these methods which take an additional
8323 `int field_idx' argument to check struct members.
8324 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
8325 overloaded versions of these methods which take an additional
8326 `string field_name' argument to check struct member.s
8327 (VariableInfo): Implement the IVariable interface.
8328 (VariableInfo.StructInfo): New public property. Returns the
8329 MyStructInfo instance of the variable if it's a struct or null.
8330 (Block.AddThisVariable): New public method. This is called from
8331 Constructor.Emit() for non-static `struct' constructor which do
8332 not have any initializer. It creates a special variable for the
8333 "this" instance variable which will be checked by the flow
8334 analysis code to ensure that all of the struct's fields are
8335 initialized before control returns from the constructor.
8336 (UsageVector): Added support for struct members. If a
8337 variable/parameter is a struct with N members, we reserve a slot
8338 in the usage vector for each member. A struct is considered fully
8339 initialized if either the struct itself (slot 0) or all its
8340 members are initialized.
8342 2002-08-08 Martin Baulig <martin@gnome.org>
8344 * driver.cs (Driver.MainDriver): Only report an error CS5001
8345 if there were no compilation errors.
8347 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
8348 `UnsafeContext' property to determine whether the parent is in
8349 unsafe context rather than checking the parent's ModFlags:
8350 classes nested in an unsafe class are unsafe as well.
8352 2002-08-08 Martin Baulig <martin@gnome.org>
8354 * statement.cs (UsageVector.MergeChildren): Distinguish between
8355 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
8356 we return. Added test17() and test18() to test-154.cs.
8358 2002-08-08 Martin Baulig <martin@gnome.org>
8360 * typemanager.cs (TypeManager.FilterWithClosure): If we have
8361 Family access, make sure the invoking type isn't a subclass of the
8362 queried type (that'd be a CS1540).
8364 * ecore.cs (Expression.MemberLookup): Added overloaded version of
8365 this method which takes an additional `Type invocation_type'.
8367 * expression.cs (BaseAccess.DoResolve): Use the base type as
8368 invocation and query type.
8369 (MemberAccess.DoResolve): If the lookup failed and we're about to
8370 report a CS0122, try a lookup with the ec.ContainerType - if this
8371 succeeds, we must report a CS1540.
8373 2002-08-08 Martin Baulig <martin@gnome.org>
8375 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
8376 (MethodGroupExpr): Implement the IMemberExpr interface.
8378 * expression (MemberAccess.ResolveMemberAccess): No need to have
8379 any special code for MethodGroupExprs anymore, they're now
8382 2002-08-08 Martin Baulig <martin@gnome.org>
8384 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
8385 Family, FamANDAssem and FamORAssem permissions.
8386 (TypeManager.IsSubclassOrNestedChildOf): New public method.
8388 2002-08-08 Martin Baulig <martin@gnome.org>
8390 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
8391 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
8394 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
8396 * driver.cs: implemented /resource option to embed managed resources.
8398 2002-08-07 Martin Baulig <martin@gnome.org>
8400 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
8401 (FieldBase.HasFieldInitializer): New public property.
8402 (FieldBase.GetInitializerExpression): New public method. Resolves and
8403 returns the field initializer and makes sure it is only resolved once.
8404 (TypeContainer.EmitFieldInitializers): Call
8405 FieldBase.GetInitializerExpression to get the initializer, this ensures
8406 that it isn't resolved multiple times.
8408 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
8409 the resolving process (SimpleName/MemberLookup) that we're currently
8410 emitting a field initializer (which must not access any instance members,
8411 this is an error CS0236).
8413 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
8414 argument, if the `IsFieldInitializer' flag is set, we must report and
8415 error CS0236 and not an error CS0120.
8417 2002-08-07 Martin Baulig <martin@gnome.org>
8419 * ecore.cs (IMemberExpr): New public interface.
8420 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
8421 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
8422 if the expression is an IMemberExpr.
8424 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
8425 to be null, implicitly default to `this' if we're non-static in
8426 this case. Simplified the code a lot by using the new IMemberExpr
8427 interface. Also fixed bug #28176 here.
8429 2002-08-06 Martin Baulig <martin@gnome.org>
8431 * cs-parser.jay (SimpleLookup): Removed. We need to create
8432 ParameterReferences during semantic analysis so that we can do a
8433 type-only search when resolving Cast, TypeOf and SizeOf.
8434 (block): Pass the `current_local_parameters' to the Block's
8437 * class.cs (ConstructorInitializer): Added `Parameters parameters'
8438 argument to the constructor.
8439 (ConstructorInitializer.Resolve): Create a temporary implicit
8440 block with the parameters.
8442 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
8443 references here if we aren't doing a type-only search.
8445 * statement.cs (Block): Added constructor which takes a
8446 `Parameters parameters' argument.
8447 (Block.Parameters): New public property.
8449 * support.cs (InternalParameters.Parameters): Renamed `parameters'
8450 to `Parameters' and made it public readonly.
8452 2002-08-06 Martin Baulig <martin@gnome.org>
8454 * ecore.cs (Expression.Warning): Made this public as well.
8456 * report.cs (Report.Debug): Print the contents of collections.
8458 2002-08-06 Martin Baulig <martin@gnome.org>
8460 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
8461 used to tell Resolve() which kinds of expressions it may return.
8462 (Expression.Resolve): Added overloaded version of this method which
8463 takes a `ResolveFlags flags' argument. This can be used to tell
8464 Resolve() which kinds of expressions it may return. Reports a
8466 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
8467 ResolveFlags.SimpleName.
8468 (Expression.Error118): Added overloaded version of this method which
8469 takes a `ResolveFlags flags' argument. It uses the flags to determine
8470 which kinds of expressions are allowed.
8472 * expression.cs (Argument.ResolveMethodGroup): New public method.
8473 Resolves an argument, but allows a MethodGroup to be returned.
8474 This is used when invoking a delegate.
8476 * TODO: Updated a bit.
8478 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8480 Fixed compilation with csc.
8482 * ecore.cs: Expression.Error made public. Is this correct? Should
8483 Warning be made public too?
8485 * expression.cs: use ea.Location instead of ea.loc.
8486 [FIXME: Filed as bug #28607: MCS must report these errors.]
8488 2002-08-06 Martin Baulig <martin@gnome.org>
8490 * ecore.cs (Expression.loc): Moved the location here instead of
8491 duplicating it in all derived classes.
8492 (Expression.Location): New public property.
8493 (Expression.Error, Expression.Warning): Made them non-static and
8494 removed the location argument.
8495 (Expression.Warning): Added overloaded version which takes an
8496 `int level' argument.
8497 (Expression.Error118): Make this non-static and removed the
8498 expression and location arguments.
8499 (TypeExpr): Added location argument to the constructor.
8501 * expression.cs (StaticCallExpr): Added location argument to
8503 (Indirection, PointerArithmetic): Likewise.
8504 (CheckedExpr, UnCheckedExpr): Likewise.
8505 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
8506 (StringPtr): Likewise.
8509 2002-08-05 Martin Baulig <martin@gnome.org>
8511 * expression.cs (BaseAccess.DoResolve): Actually report errors.
8513 * assign.cs (Assign.DoResolve): Check whether the source
8514 expression is a value or variable.
8516 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
8517 while resolving the corresponding blocks.
8519 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
8520 an error, don't silently return null.
8522 * statement.cs (Block.AddVariable): Do the error reporting here
8523 and distinguish between CS0128 and CS0136.
8524 (Block.DoResolve): Report all unused labels (warning CS0164).
8525 (LabeledStatement): Pass the location to the constructor.
8526 (LabeledStatement.HasBeenReferenced): New property.
8527 (LabeledStatement.Resolve): Set it to true here.
8529 * statement.cs (Return.Emit): Return success even after reporting
8530 a type mismatch error (CS0126 or CS0127), this is what csc does and
8531 it avoids confusing the users with any consecutive errors.
8533 2002-08-05 Martin Baulig <martin@gnome.org>
8535 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
8537 * const.cs (Const.LookupConstantValue): Catch circular definitions.
8539 * expression.cs (MemberAccess.DoResolve): Silently return if an
8540 error has already been reported.
8542 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
8543 error has already been reported.
8545 2002-08-05 Martin Baulig <martin@gnome.org>
8547 * statement.cs (UsageVector): Only initialize the `parameters'
8548 vector if we actually have any "out" parameters.
8550 2002-08-05 Martin Baulig <martin@gnome.org>
8552 * expression.cs (Binary.ResolveOperator): When combining delegates,
8553 they must have the same type.
8555 2002-08-05 Martin Baulig <martin@gnome.org>
8557 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
8558 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
8559 work with the ms runtime and we also don't need it: if we're a
8560 PropertyBuilder and not in the `indexer_arguments' hash, then we
8561 are a property and not an indexer.
8563 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
8564 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
8565 since the latter one doesn't work with the ms runtime.
8567 2002-08-03 Martin Baulig <martin@gnome.org>
8569 Fixed bugs #27998 and #22735.
8571 * class.cs (Method.IsOperator): New public field.
8572 (Method.CheckBase): Report CS0111 if there's already a method
8573 with the same parameters in the current class. Report CS0508 when
8574 attempting to change the return type of an inherited method.
8575 (MethodData.Emit): Report CS0179 if a method doesn't have a body
8576 and it's not marked abstract or extern.
8577 (PropertyBase): New abstract base class for Property and Indexer.
8578 (PropertyBase.CheckBase): Moved here from Property and made it work
8580 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
8581 the same so we can reuse it there.
8582 (Property, Indexer): Derive from PropertyBase.
8583 (MethodSignature.inheritable_property_signature_filter): New delegate
8584 to find properties and indexers.
8586 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
8587 argument and improved error reporting.
8589 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
8590 EmptyReadOnlyParameters and made it a property.
8592 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
8593 version of this method which takes a `PropertyInfo indexer'.
8594 (TypeManager.RegisterIndexer): New method.
8596 * class.cs: Added myself as author of this file :-)
8598 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8600 * class.cs: fixed compilation on windoze.
8602 2002-08-03 Martin Baulig <martin@gnome.org>
8604 * interface.cs (Interface.GetInterfaceBases): Check whether all
8605 base interfaces are at least as accessible than the current one.
8607 * class.cs (TypeContainer.GetClassBases): Check whether base types
8608 are at least as accessible than the current type.
8609 (TypeContainer.AsAccessible): Implemented and made non-static.
8610 (MemberBase.CheckParameters): Report errors if the accessibility
8613 * delegate.cs (Delegate.Delegate): The default visibility is
8614 internal for top-level types and private for nested types.
8615 (Delegate.Define): Report errors if the accessibility checks fail.
8617 * enum.cs (Enum.Enum): The default visibility is internal for
8618 top-level types and private for nested types.
8619 (Enum.DefineType): Compute the correct visibility.
8621 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
8622 function which takes a `bool is_toplevel' instead of a TypeContainer.
8624 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
8627 2002-08-02 Martin Baulig <martin@gnome.org>
8629 * expression.cs (LocalVariableReferenc): Added constructor which
8630 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
8631 (LocalVariableReference.IsReadOnly): New property.
8632 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
8633 variable is readonly, use our own readonly flag to do this; you can
8634 use the new constructor to get a writable reference to a read-only
8637 * cs-parser.jay (foreach_statement, using_statement): Get a writable
8638 reference to the local variable.
8640 2002-08-01 Miguel de Icaza <miguel@ximian.com>
8642 * rootcontext.cs (ResolveCore): Also include System.Exception
8644 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
8645 we reach an EmptyStatement.
8647 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
8650 * expression.cs (Binary.ResolveOperator): Check error result in
8653 use brtrue/brfalse directly and avoid compares to null.
8655 2002-08-02 Martin Baulig <martin@gnome.org>
8657 * class.cs (TypeContainer.Define): Define all nested interfaces here.
8658 Fixes bug #28407, added test-155.cs.
8660 2002-08-01 Martin Baulig <martin@gnome.org>
8662 * class.cs (Event.EmitDefaultMethod): Make this work with static
8663 events. Fixes #28311, added verify-3.cs.
8665 2002-08-01 Martin Baulig <martin@gnome.org>
8667 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
8668 `is_disposable' fields.
8669 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
8670 `hm.is_disposable' if we're using the collection pattern.
8671 (Foreach.EmitCollectionForeach): Use the correct type for the
8672 enumerator's local variable, only emit the try/finally block if
8673 necessary (fixes #27713).
8675 2002-08-01 Martin Baulig <martin@gnome.org>
8677 * ecore.cs (Expression.report118): Renamed to Error118 and made
8680 * statement.cs (Throw.Resolve): Check whether the expression is of
8681 the correct type (CS0118) and whether the type derives from
8682 System.Exception (CS0155).
8683 (Catch.Resolve): New method. Do the type lookup here and check
8684 whether it derives from System.Exception (CS0155).
8685 (Catch.CatchType, Catch.IsGeneral): New public properties.
8687 * typemanager.cs (TypeManager.exception_type): Added.
8689 2002-07-31 Miguel de Icaza <miguel@ximian.com>
8691 * driver.cs: Updated About function.
8693 2002-07-31 Martin Baulig <martin@gnome.org>
8695 Implemented Control Flow Analysis.
8697 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
8698 (EmitContext.CurrentBranching): Added.
8699 (EmitContext.StartFlowBranching): Added.
8700 (EmitContext.EndFlowBranching): Added.
8701 (EmitContext.KillFlowBranching): Added.
8702 (EmitContext.IsVariableAssigned): Added.
8703 (EmitContext.SetVariableAssigned): Added.
8704 (EmitContext.IsParameterAssigned): Added.
8705 (EmitContext.SetParameterAssigned): Added.
8706 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
8707 Added control flow analysis stuff here.
8709 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
8710 resolve the expression as lvalue.
8711 (LocalVariableReference.DoResolve): Check whether the variable has
8712 already been assigned.
8713 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
8714 the parameter as assigned here.
8715 (ParameterReference.DoResolve): Check whether the parameter has already
8717 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
8718 expression as lvalue.
8720 * statement.cs (FlowBranching): New class for the flow analysis code.
8721 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
8722 (LabeledStatement.IsDefined): New public property.
8723 (LabeledStatement.AddUsageVector): New public method to tell flow
8724 analyis that the label may be reached via a forward jump.
8725 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
8727 (VariableInfo.Number): New public field. This is used by flow analysis
8728 to number all locals of a block.
8729 (Block.CountVariables): New public property. This is the number of
8730 local variables in this block (including the locals from all parent
8732 (Block.EmitMeta): Number all the variables.
8734 * statement.cs: Added flow analysis support to all classes.
8736 2002-07-31 Martin Baulig <martin@gnome.org>
8738 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
8739 To get debugging messages, compile mcs with /define:MCS_DEBUG and
8740 then use this argument.
8742 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
8744 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
8745 use this to specify /define options.
8747 2002-07-29 Martin Baulig <martin@gnome.org>
8749 * statement.cs (Fixed): Moved all code that does variable lookups
8750 and resolvings from Emit to Resolve.
8752 * statement.cs (For): Moved all code that does variable lookups
8753 and resolvings from Emit to Resolve.
8755 * statement.cs (Using): Moved all code that does variable lookups
8756 and resolvings from Emit to Resolve.
8758 2002-07-29 Martin Baulig <martin@gnome.org>
8760 * attribute.cs (Attribute.Resolve): Explicitly catch a
8761 System.NullReferenceException when creating the
8762 CustromAttributeBuilder and report a different warning message.
8764 2002-07-29 Martin Baulig <martin@gnome.org>
8766 * support.cs (ParameterData.ParameterName): Added method to
8767 get the name of a parameter.
8769 * typemanager.cs (TypeManager.IsValueType): New public method.
8771 2002-07-29 Martin Baulig <martin@gnome.org>
8773 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
8774 is a flag which specifies that it's either ref or out.
8775 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
8776 the out parameter to `out Parameter.Modifier mod', also set the
8777 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
8779 * support.cs (InternalParameters.ParameterModifier): Distinguish
8780 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8781 Parameter.Modifier.ISBYREF flag if it's either ref or out.
8783 * expression.cs (Argument.GetParameterModifier): Distinguish
8784 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8785 Parameter.Modifier.ISBYREF flag if it's either ref or out.
8787 2002-07-29 Martin Baulig <martin@gnome.org>
8789 * expression.cs (ParameterReference.ParameterReference): Added
8790 `Location loc' argument to the constructor.
8792 * cs-parser.jay: Pass location to ParameterReference.
8794 2002-07-28 Miguel de Icaza <miguel@ximian.com>
8796 * statement.cs (Try): Initialize the location.
8798 * cs-parser.jay: pass location to Try.
8800 * expression.cs (Unary.Reduce): Change the prototype to return
8801 whether a constant fold could be performed or not. The result is
8802 returned in an out parameters. In the case of Indirection and
8803 AddressOf, we want to perform the full tests.
8805 2002-07-26 Miguel de Icaza <miguel@ximian.com>
8807 * statement.cs (Statement.Emit): Flag dead code.
8809 2002-07-27 Andrew Birkett <andy@nobugs.org>
8811 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
8813 2002-07-27 Martin Baulig <martin@gnome.org>
8815 * class.cs (MethodData.Define): Put back call to
8816 TypeManager.AddMethod(), accidentally commented this out.
8818 * report.cs (Debug): New public method to print debugging information,
8819 this is `[Conditional ("DEBUG")]'.
8821 2002-07-26 Martin Baulig <martin@gnome.org>
8823 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
8824 (switch_statement): Push the current_block to the switch_stack and
8825 pop it again when we're done with the switch.
8826 (switch_section): The new block is a child of the current_block.
8827 Fixes bug #24007, added test-152.cs.
8829 2002-07-27 Martin Baulig <martin@gnome.org>
8831 * expression.cs (Invocation.EmitArguments): When calling a varargs
8832 function with only its fixed arguments, we need to pass an empty
8835 2002-07-27 Martin Baulig <martin@gnome.org>
8837 Mono 0.13 has been released.
8839 2002-07-25 Miguel de Icaza <miguel@ximian.com>
8841 * driver.cs: Rename --resource to --linkres, because that is what
8842 we do currently, we dont support --resource yet.
8844 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
8846 2002-07-25 Martin Baulig <martin@gnome.org>
8848 * class.cs (MethodData): New public class. This is a `method builder'
8849 class for a method or one accessor of a Property/Indexer/Event.
8850 (MethodData.GetMethodFlags): Moved here from MemberBase.
8851 (MethodData.ApplyAttributes): Likewise.
8852 (MethodData.ApplyObsoleteAttribute): Likewise.
8853 (MethodData.ApplyConditionalAttribute): Likewise.
8854 (MethodData.ApplyDllImportAttribute): Likewise.
8855 (MethodData.CheckAbstractAndExternal): Likewise.
8856 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
8857 (MethodData.Emit): Formerly known as Method.Emit().
8858 (MemberBase): Moved everything which was specific to a single
8859 accessor/method to MethodData.
8860 (Method): Create a new MethodData and call Define() and Emit() on it.
8861 (Property, Indexer, Event): Create a new MethodData objects for each
8862 accessor and call Define() and Emit() on them.
8864 2002-07-25 Martin Baulig <martin@gnome.org>
8866 Made MethodCore derive from MemberBase to reuse the code from there.
8867 MemberBase now also checks for attributes.
8869 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
8870 (MemberBase.GetMethodFlags): Moved here from class Method and marked
8872 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
8873 `CallingConventions cc' and `Attributes opt_attrs' arguments.
8874 (MemberBase.ApplyAttributes): New virtual method; applies the
8875 attributes to a method or accessor.
8876 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
8877 (MemberBase.ApplyConditionalAttribute): Likewise.
8878 (MemberBase.ApplyDllImportAttribute): Likewise.
8879 (MemberBase.CheckAbstractAndExternal): Likewise.
8880 (MethodCore.ParameterTypes): This is now a property instead of a
8881 method, it's initialized from DoDefineParameters().
8882 (MethodCore.ParameterInfo): Removed the set accessor.
8883 (MethodCore.DoDefineParameters): New protected virtual method to
8884 initialize ParameterTypes and ParameterInfo.
8885 (Method.GetReturnType): We can now simply return the MemberType.
8886 (Method.GetMethodFlags): Override the MemberBase version and add
8887 the conditional flags.
8888 (Method.CheckBase): Moved some code from Define() here, call
8889 DoDefineParameters() here.
8890 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
8891 here to avoid some larger code duplication.
8892 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
8893 ensure that abstract and external accessors don't declare a body.
8895 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
8896 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
8897 lookup in the attribute's parent classes, so we need to abort as soon
8898 as we found the first match.
8899 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
8900 the attribute has no arguments.
8902 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
8905 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8907 * cs-parser.jay: reverted previous patch.
8909 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8911 * cs-parser.jay: fixed bug #22119.
8913 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8915 * attribute.cs: fixed compilation. The error was:
8916 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
8917 be assigned to before control leaves the current method."
8918 [FIXME: Filed as bug #28186: MCS must report this error.]
8920 2002-07-25 Martin Baulig <martin@gnome.org>
8922 * attribute.cs (Attribute.Conditional_GetConditionName): New static
8923 method to pull the condition name ouf of a Conditional attribute.
8924 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
8925 the obsolete message and error flag out of an Obsolete attribute.
8927 * class.cs (Method.GetMethodFlags): New public method to get the
8928 TypeManager.MethodFlags for this method.
8929 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
8931 (Method.Define): Get and apply the Obsolete and Conditional attributes;
8932 if we're overriding a virtual function, set the new private variable
8933 `parent_method'; call the new TypeManager.AddMethod().
8935 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
8936 the MethodBuilder and the Method in a PtrHashtable.
8937 (TypeManager.builder_to_method): Added for this purpose.
8938 (TypeManager.MethodFlags): Added IsObsoleteError.
8939 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
8940 Obsolete and Conditional arguments in MethodBuilders. If we discover
8941 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
8942 the message from the attribute.
8944 2002-07-24 Martin Baulig <martin@gnome.org>
8946 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
8947 preprocessor directives, ensure that the argument to #define/#undef is
8948 exactly one identifier and that it's actually an identifier.
8950 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
8953 2002-07-24 Martin Baulig <martin@gnome.org>
8955 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
8956 initialize it to TypeManager.object_type in the constructor.
8957 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
8958 of the `hm.get_current' method if we're using the collection pattern.
8959 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
8960 for the explicit conversion to make it work when we're using the collection
8961 pattern and the `Current' property has a different return type than `object'.
8964 2002-07-24 Martin Baulig <martin@gnome.org>
8966 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
8967 does not match, but don't report any errors. This method is called in
8968 order for all methods in a MethodGroupExpr until a matching method is
8969 found, so we don't want to bail out if the first method doesn't match.
8970 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
8971 matches, report the 123. Fixes #28070.
8973 2002-07-24 Martin Baulig <martin@gnome.org>
8975 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
8976 TypeManager.TypeToCoreType() to the top of the method so the
8977 following equality checks will work. Fixes #28107.
8979 2002-07-24 Martin Baulig <martin@gnome.org>
8981 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
8982 operand is of type uint, and the other operand is of type sbyte,
8983 short or int, the operands are converted to type long." -
8984 Actually do what this comment already told us. Fixes bug #28106,
8987 2002-07-24 Martin Baulig <martin@gnome.org>
8989 * class.cs (MethodBase): New abstract class. This is now a base
8990 class for Property, Indexer and Event to avoid some code duplication
8991 in their Define() and DefineMethods() methods.
8992 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
8993 generic methods for Define() and DefineMethods().
8994 (FieldBase): Derive from MemberBase, not MemberCore.
8995 (Property): Derive from MemberBase, not MemberCore.
8996 (Property.DefineMethod): Moved all the code from this method to the
8997 new MethodBase.DefineAccessor(), just call it with appropriate
8999 (Property.Define): Call the new Property.DoDefine(), this does some
9000 sanity checks and we don't need to duplicate the code everywhere.
9001 (Event): Derive from MemberBase, not MemberCore.
9002 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
9003 accessors, this will also make them work with interface events.
9004 (Indexer): Derive from MemberBase, not MemberCore.
9005 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
9006 (Indexer.Define): Use the new MethodBase functions.
9008 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
9009 argument to the constructor.
9010 (Interface.FindMembers): Added support for interface events.
9011 (Interface.PopluateEvent): Implemented.
9013 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
9015 2002-07-22 Miguel de Icaza <miguel@ximian.com>
9017 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
9018 but this is required to check for a method name being the same as
9019 the containing class.
9023 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9025 * interface.cs: initialize variable.
9027 2002-07-23 Martin Baulig <martin@gnome.org>
9029 Implemented the IndexerName attribute in interfaces.
9031 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
9032 name if this is an explicit interface implementation.
9033 (Indexer.InterfaceIndexerName): New public variable. If we're
9034 implementing an interface indexer, this is the IndexerName in that
9035 interface. Otherwise, it's the IndexerName.
9036 (Indexer.DefineMethod): If we're implementing interface indexer,
9037 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
9038 and Pending.ImplementIndexer methods.
9039 (Indexer.Define): Also define the PropertyBuilder if we're
9040 implementing an interface indexer and this is neither an explicit
9041 interface implementation nor do the IndexerName match the one in
9044 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
9045 If a method is defined here, then we always need to create a proxy
9046 for it. This is used when implementing interface indexers.
9047 (Pending.IsInterfaceIndexer): New public method.
9048 (Pending.ImplementIndexer): New public method.
9049 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
9050 This is used when implementing interface indexers to define a proxy
9052 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
9053 define a proxy if necessary.
9055 * interface.cs (Interface.IndexerName): New public variable.
9056 (Interface.PopulateIndexer): Set the IndexerName.
9057 (Interface.DefineIndexers): New private method. Populate all the
9058 indexers and make sure their IndexerNames match.
9060 * typemanager.cs (IndexerPropertyName): Added support for interface
9063 2002-07-22 Martin Baulig <martin@gnome.org>
9065 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
9066 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
9067 ret if HasReturnLabel.
9068 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
9071 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
9072 and set the ec.LoopBeginTryCatchLevel.
9073 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
9074 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
9075 the current ec.TryCatchLevel, the branch goes out of an exception
9076 block. In this case, we need to use Leave and not Br.
9078 2002-07-22 Martin Baulig <martin@gnome.org>
9080 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
9081 block unless the block does not always return or it is contained in
9082 another try { ... } catch { ... } block. Fixes bug #26506.
9083 Added verify-1.cs to the test suite.
9085 2002-07-22 Martin Baulig <martin@gnome.org>
9087 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
9088 then we do not always return. Fixes bug #24985.
9090 2002-07-22 Martin Baulig <martin@gnome.org>
9092 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
9093 lookup on a per-class level; ie. walk up the class hierarchy until we
9094 found at least one applicable method, then choose the best among them.
9095 Fixes bug #24463 and test-29.cs.
9097 2002-07-22 Martin Baulig <martin@gnome.org>
9099 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
9100 return types of the methods. The return type is not part of the
9101 signature and we must not check it to make the `new' modifier work.
9102 Fixes bug #27999, also added test-147.cs.
9103 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
9105 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
9106 on the method's return type.
9108 2002-07-21 Martin Baulig <martin@gnome.org>
9110 * assign.cs: Make this work if the rightmost source is a constant and
9111 we need to do an implicit type conversion. Also adding a few more tests
9112 to test-38.cs which should have caught this.
9114 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
9115 target in the makefile for this. The makefile.gnu is primarily intended
9116 for end-users who don't want to debug the compiler.
9118 2002-07-21 Martin Baulig <martin@gnome.org>
9120 * assign.cs: Improved the Assign class so it can now handle embedded
9121 assignments (X = Y = Z = something). As a side-effect this'll now also
9122 consume less local variables. test-38.cs now passes with MCS, added
9123 a few new test cases to that test.
9125 2002-07-20 Martin Baulig <martin@gnome.org>
9127 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
9128 instructions. Fixes bug #27977, also added test-146.cs.
9130 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9132 * cs-tokenizer.cs: fixed getHex ().
9134 2002-07-19 Martin Baulig <martin@gnome.org>
9136 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
9137 not Type.GetType() to lookup the array type. This is needed when
9138 we're constructing an array of a user-defined type.
9139 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
9140 single-dimensional arrays, but also for single-dimensial arrays of
9143 2002-07-19 Martin Baulig <martin@gnome.org>
9145 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
9146 this function is called, it's not allowed to share LocalBuilders
9149 2002-07-19 Martin Baulig <martin@gnome.org>
9151 * expression.cs (Argument.Resolve): Report an error 118 when trying
9152 to pass a type as argument.
9154 2002-07-18 Martin Baulig <martin@gnome.org>
9156 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
9157 Conv_R_Un for the signed `long' type.
9159 2002-07-15 Miguel de Icaza <miguel@ximian.com>
9161 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
9162 `expr' for the temporary result, as that will fail if we do
9163 multiple resolves on the same expression.
9165 2002-07-05 Miguel de Icaza <miguel@ximian.com>
9167 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
9168 ec.TypeContainer for looking up aliases.
9170 * class.cs (TypeContainer): Remove LookupAlias from here.
9172 * decl.cs (DeclSpace); Move here.
9174 2002-07-01 Miguel de Icaza <miguel@ximian.com>
9176 * class.cs (FindMembers): Only call filter if the constructor
9177 bulider is not null.
9179 Also handle delegates in `NestedTypes' now. Now we will perform
9180 type lookups using the standard resolution process. This also
9183 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
9184 This uses Expressions (the limited kind that can be parsed by the
9185 tree) instead of strings.
9187 * expression.cs (ComposedCast.ToString): Implement, used to flag
9188 errors since now we have to render expressions.
9190 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
9193 * ecore.cs (SimpleName.ToString): ditto.
9195 * cs-parser.jay: Instead of using strings to assemble types, use
9196 Expressions to assemble the type (using SimpleName, ComposedCast,
9197 MemberAccess). This should fix the type lookups in declarations,
9198 because we were using a different code path for this.
9200 * statement.cs (Block.Resolve): Continue processing statements
9201 even when there is an error.
9203 2002-07-17 Miguel de Icaza <miguel@ximian.com>
9205 * class.cs (Event.Define): Also remove the `remove' method from
9206 the list of pending items.
9208 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
9209 generate more compact code.
9211 2002-07-17 Martin Baulig <martin@gnome.org>
9213 * const.cs (Const.LookupConstantValue): Add support for constant
9214 `unchecked' and `checked' expressions.
9215 Also adding test case test-140.cs for this.
9217 2002-07-17 Martin Baulig <martin@gnome.org>
9219 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
9220 check whether mi.ReturnType implements the IEnumerator interface; the
9221 `==' and the IsAssignableFrom() will fail in this situation.
9223 2002-07-16 Ravi Pratap <ravi@ximian.com>
9225 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
9228 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9230 * expression.cs: fixed bug #27811.
9232 2002-07-14 Miguel de Icaza <miguel@ximian.com>
9234 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
9235 Molaro: when we are a ref, the value already contains a pointer
9236 value, do not take the address of it.
9238 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9239 * removed mb-parser.jay and mb-tokenizer.cs
9241 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9243 * expression.cs: check against the building corlib void type.
9245 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
9247 * ecore.cs: fix for valuetype static readonly fields: when
9248 initializing them, we need their address, not the address of a copy.
9250 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
9252 * typemanager.cs: register also enum_type in corlib.
9254 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9256 * class.cs: allow calling this (but not base) initializers in structs.
9258 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
9260 * ecore.cs: make sure we compare against the building base types
9263 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
9265 * typemanager.cs: fix TypeToCoreType() to handle void and object
9266 (corlib gets no more typerefs after this change).
9268 2002-07-12 Miguel de Icaza <miguel@ximian.com>
9270 * expression.cs (ArrayCreation.EmitArrayArguments): use
9271 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
9273 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
9274 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
9275 array indexes, the runtime actually forbids them.
9277 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
9278 for array arguments here.
9280 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
9281 instead of the default for ValueTypes.
9283 (New.DoEmit): Use IsValueType instead of
9284 IsSubclassOf (value_type)
9285 (New.DoResolve): ditto.
9286 (Invocation.EmitCall): ditto.
9288 * assign.cs (Assign): ditto.
9290 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
9291 Statements *are* currently doing part of their resolution during
9294 Expressions do always resolve during resolve, but statements are
9295 only required to propagate resolution to their children.
9297 2002-07-11 Miguel de Icaza <miguel@ximian.com>
9299 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
9301 (LoadAssembly): Do not add the dll if it is already specified
9303 (MainDriver): Add the System directory to the link path at the end,
9304 after all the other -L arguments.
9306 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
9307 wrong opcode for loading bytes and bools (ldelem.i1 instead of
9308 ldelem.u1) and using the opposite for sbytes.
9310 This fixes Digger, and we can finally run it.
9312 * driver.cs (UnixParseOption): Move the option parsing here.
9313 (CSCParseOption): Implement CSC-like parsing of options.
9315 We now support both modes of operation, the old Unix way, and the
9316 new CSC-like way. This should help those who wanted to make cross
9319 The only thing broken is that /r:, /reference: and /lib: are not
9320 implemented, because I want to make those have the same semantics
9321 as the CSC compiler has, and kill once and for all the confussion
9322 around this. Will be doing this tomorrow.
9324 * statement.cs (Unsafe.Resolve): The state is checked during
9325 resolve, not emit, so we have to set the flags for IsUnsfe here.
9327 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9329 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
9330 not catch the Error_ObjectRefRequired in SimpleName (as it is
9331 possible to have a class/instance variable name that later gets
9332 deambiguated), we have to check this here.
9334 2002-07-10 Ravi Pratap <ravi@ximian.com>
9336 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
9337 make static and put into Expression.
9339 (Event.Define): Register the private field of the event with the
9340 TypeManager so that GetFieldFromEvent can get at it.
9342 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
9343 keep track of the private field associated with an event which
9346 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
9349 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
9351 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9353 * expression.cs (Binary.EmitBranchable): this routine emits the
9354 Binary expression in a branchable context. This basically means:
9355 we need to branch somewhere, not just get the value on the stack.
9357 This works together with Statement.EmitBoolExpression.
9359 * statement.cs (Statement.EmitBoolExpression): Use
9362 2002-07-09 Miguel de Icaza <miguel@ximian.com>
9364 * statement.cs (For): Reduce the number of jumps in loops.
9366 (For): Implement loop inversion for the For statement.
9368 (Break): We can be breaking out of a Try/Catch controlled section
9369 (foreach might have an implicit try/catch clause), so we need to
9370 use Leave instead of Br.
9372 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
9373 now). If the instace expression supports IMemoryLocation, we use
9374 the AddressOf method from the IMemoryLocation to extract the
9375 address instead of emitting the instance.
9377 This showed up with `This', as we were emitting the instance
9378 always (Emit) instead of the Address of This. Particularly
9379 interesting when This is a value type, as we dont want the Emit
9380 effect (which was to load the object).
9382 2002-07-08 Miguel de Icaza <miguel@ximian.com>
9384 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
9386 * statement.cs (Checked): Set the CheckedState during the resolve
9387 process too, as the ConvCast operations track the checked state on
9388 the resolve process, and not emit.
9390 * cs-parser.jay (namespace_member_declaration): Flag that we have
9391 found a declaration when we do. This is used to flag error 1529
9393 * driver.cs: Report ok when we display the help only.
9395 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
9397 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
9399 2002-07-04 Miguel de Icaza <miguel@ximian.com>
9401 * cs-tokenizer.cs (define): We also have to track locally the
9402 defines. AllDefines is just used for the Conditional Attribute,
9403 but we also need the local defines for the current source code.
9405 2002-07-03 Miguel de Icaza <miguel@ximian.com>
9407 * statement.cs (While, For, Do): These loops can exit through a
9408 Break statement, use this information to tell whether the
9409 statement is the last piece of code.
9411 (Break): Flag that we break.
9413 * codegen.cs (EmitContexts): New `Breaks' state variable.
9415 2002-07-03 Martin Baulig <martin@gnome.org>
9417 * class.cs (TypeContainer.MethodModifiersValid): Allow override
9418 modifiers in method declarations in structs. Otherwise, you won't
9419 be able to override things like Object.Equals().
9421 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9423 * class.cs (Method, Property, Indexer): Do not allow the public
9424 modifier to be used in explicit interface implementations.
9426 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
9427 override modifiers in method declarations in structs
9429 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
9431 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
9432 integer or real overflow, report an error
9434 2002-07-02 Martin Baulig <martin@gnome.org>
9436 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
9437 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
9438 to tell the runtime about our newly created System.Object and
9439 System.ValueType types.
9441 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9443 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
9444 struct instead of Ldarg/Starg.
9446 2002-07-02 Martin Baulig <martin@gnome.org>
9448 * expression.cs (Indirection.Indirection): Call
9449 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
9451 2002-07-02 Martin Baulig <martin@gnome.org>
9453 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
9454 ValueType, call TypeManager.TypeToCoreType() on it.
9455 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
9456 the OpCodes.Newarr argument.
9458 2002-07-02 Martin Baulig <martin@gnome.org>
9460 * expression.cs (Invocation.EmitCall): When compiling corlib,
9461 replace all calls to the system's System.Array type to calls to
9462 the newly created one.
9464 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
9465 System.Array methods.
9466 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
9467 from the system's System.Array type which must be replaced.
9469 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
9471 * typemanager.cs: load unverifiable_code_ctor so we can build
9472 corlib using the correct type. Avoid using GetTypeCode() with
9474 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
9475 TypeManager.object_type to allow building corlib.
9477 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
9479 * ecore.cs: handle System.Enum separately in LoadFromPtr().
9481 2002-07-01 Martin Baulig <martin@gnome.org>
9483 * class.cs: Make the last change actually work, we need to check
9484 whether `ifaces != null' to avoid a crash.
9486 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9488 * class.cs: when we build structs without fields that implement
9489 interfaces, we need to add the interfaces separately, since there is
9490 no API to both set the size and add the interfaces at type creation
9493 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9495 * expression.cs: the dimension arguments to the array constructors
9496 need to be converted if they are a long.
9498 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
9500 * class.cs: don't emit ldarg.0 if there is no parent constructor
9501 (fixes showstopper for corlib).
9503 2002-06-29 Martin Baulig <martin@gnome.org>
9505 MCS now compiles corlib on GNU/Linux :-)
9507 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
9508 ie. check for MethodImplOptions.InternalCall.
9510 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
9511 and TypeManager.attribute_type are null, so we must explicitly check
9512 whether parent is not null to find out whether it's an attribute type.
9513 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
9514 and SetBuilder, not only if the property is neither abstract nor external.
9515 This is necessary to set the MethodImplOptions on the accessor methods.
9516 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
9517 SetBuilder, see Property.Emit().
9519 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
9520 populate "System.Object", "System.ValueType" and "System.Attribute" since
9521 they've already been populated from BootCorlib_PopulateCoreTypes().
9523 2002-06-29 Martin Baulig <martin@gnome.org>
9525 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
9526 is the NullLiteral, we also need to make sure that target_type is not
9529 2002-06-29 Martin Baulig <martin@gnome.org>
9531 * rootcontext.cs (RootContext.ResolveCore): We must initialize
9532 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
9533 before calling BootstrapCorlib_ResolveDelegate ().
9535 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9537 * statement.cs: fixed build-breaker. All tests passed ok.
9539 2002-06-27 Martin Baulig <martin@gnome.org>
9541 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
9542 for System.Decimal when compiling corlib.
9544 2002-06-27 Martin Baulig <martin@gnome.org>
9546 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
9547 switch blocks which contain nothing but a default clause.
9549 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
9551 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
9553 2002-06-27 Martin Baulig <martin@gnome.org>
9555 * ecore.cs (PropertyExpr.PropertyExpr): Call
9556 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
9558 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
9559 is already a TypeBuilder.
9561 2002-06-27 Martin Baulig <martin@gnome.org>
9563 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
9564 `target_type == TypeManager.array_type', not IsAssignableFrom() in
9565 the "from an array-type to System.Array" case. This makes it work
9566 when compiling corlib.
9568 2002-06-27 Martin Baulig <martin@gnome.org>
9570 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
9571 non-static PropertyExpr, set its InstanceExpression. This makes
9572 the `ICollection.Count' property work in System/Array.cs.
9574 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
9576 * driver.cs: Made error handling more consistent. Errors now
9577 tracked by Report class, so many methods which used to return int
9578 now return void. Main() now prints success/failure and
9579 errors/warnings message.
9581 Renamed '--probe' compiler argument to '--expect-error'. Removed
9582 the magic number return values (123 and 124). Now, if the
9583 expected error occurs, the compiler exits with success (exit value
9584 0). If the compilation completes without seeing that particular
9585 error, the compiler exits with failure (exit value 1). The
9586 makefile in mcs/errors has been changed to handle the new behaviour.
9588 * report.cs: Made 'expected error' number a property and renamed
9589 it from 'Probe' to 'ExpectedError'.
9591 * genericparser.cs: Removed error handling support, since it is
9592 now all done by Report class.
9594 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
9595 class, so parse() no longer returns an int.
9597 * namespace.cs: Use Report.Error instead of GenericParser.error
9599 2002-06-22 Miguel de Icaza <miguel@ximian.com>
9601 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
9602 TypeContainer.AddOperator): At the front of the list put the
9603 explicit implementations, so they get resolved/defined first.
9605 2002-06-21 Miguel de Icaza <miguel@ximian.com>
9607 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
9608 interface type is implemented by this TypeContainer. Used during
9609 explicit interface implementation.
9611 (Property.Define, Indexer.Define, Method.Define): Validate that
9612 the given interface in the explicit implementation is one of the
9613 base classes for the containing type.
9615 Also if we are explicitly implementing an interface, but there is
9616 no match in the pending implementation table, report an error.
9618 (Property.Define): Only define the property if we are
9619 not explicitly implementing a property from an interface. Use the
9620 correct name also for those properties (the same CSC uses,
9621 although that is really not needed).
9623 (Property.Emit): Do not emit attributes for explicitly implemented
9624 properties, as there is no TypeBuilder.
9626 (Indexer.Emit): ditto.
9628 Hiding then means that we do not really *implement* a pending
9629 implementation, which makes code fail.
9631 2002-06-22 Martin Baulig <martin@gnome.org>
9633 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
9634 the return value of Object.GetType(). [FIXME: we need to do this whenever
9635 we get a type back from the reflection library].
9637 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
9639 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
9641 2002-06-20 Miguel de Icaza <miguel@ximian.com>
9643 * attribute.cs: Return null if we can not look up the type.
9645 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
9646 the interface types found.
9648 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
9649 interface types found.
9651 * typemanager.cs (GetInterfaces): Make this routine returns alll
9652 the interfaces and work around the lame differences between
9653 System.Type and System.Reflection.Emit.TypeBuilder in the results
9654 result for GetInterfaces.
9656 (ExpandInterfaces): Given an array of interface types, expand and
9657 eliminate repeated ocurrences of an interface. This expands in
9658 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
9661 2002-06-21 Martin Baulig <martin@gnome.org>
9663 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
9666 2002-06-21 Martin Baulig <martin@gnome.org>
9668 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
9669 and called with one of the core types, return the corresponding typebuilder for
9672 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
9675 2002-06-21 Martin Baulig <martin@gnome.org>
9677 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
9678 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
9679 (Expression.ConvertReferenceExplicit): Likewise.
9681 * expression.cs (ElementAccess.DoResolve): Likewise.
9682 (ElementAccess.DoResolveLValue): Likewise.
9684 2002-06-10 Martin Baulig <martin@gnome.org>
9686 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
9687 add the "value" parameter to the parameter list.
9689 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
9692 2002-06-19 Miguel de Icaza <miguel@ximian.com>
9694 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
9695 the argument to an int, uint, long or ulong, per the spec. Also
9696 catch negative constants in array creation.
9698 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
9700 * class.cs: do not allow the same interface to appear twice in
9701 the definition list.
9703 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
9705 * ecore.cs: don't use ldlen with System.Array.
9707 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
9709 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
9711 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
9713 * modifiers.cs: produce correct field attributes for protected
9714 internal. Easy fix so miguel can work on ther harder stuff:-)
9716 2002-06-18 Miguel de Icaza <miguel@ximian.com>
9718 * pending.cs: New file. Move the code from class.cs here.
9719 Support clearning the pending flag for all methods (when not doing
9720 explicit interface implementation).
9722 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
9724 * rootcontext.cs: added a couple more types needed to bootstrap.
9726 2002-06-17 Miguel de Icaza <miguel@ximian.com>
9728 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
9729 constructor in the type, instead of any constructor in the type
9730 hierarchy. Thanks to Paolo for finding this bug (it showed up as
9731 a bug in the Mono runtime when applying the params attribute).
9733 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9734 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
9736 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
9738 * expression.cs (Unary.ResolveOperator): Use TypeManager
9739 to resolve the type.
9741 2002-06-13 Ravi Pratap <ravi@ximian.com>
9743 * cs-parser.jay (enum_member_declaration): Pass in the attributes
9746 * enum.cs (AddEnumMember): Add support to store the attributes associated
9747 with each member too.
9749 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
9750 field builders too - this takes care of the enum member case.
9752 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
9754 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
9755 address-of operator on both value types and pointers.
9757 2002-06-10 Martin Baulig <martin@gnome.org>
9759 * interface.cs (Interface.PopulateIndexer): Add the indexer's
9760 PropertyBuilder to the `property_builders' list.
9762 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
9763 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
9764 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
9765 find any indexers which are inherited from an interface.
9767 2002-06-09 Martin Baulig <martin@gnome.org>
9769 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
9770 the same type as the constant if necessary. There's also a test-130.cs
9773 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
9775 * typemanager.cs (TypeManager.ChangeType): Previously known as
9776 Enum.ChangeEnumType().
9778 2002-06-09 Martin Baulig <martin@gnome.org>
9780 * expression.cs (Cast.TryReduce): Added support for consts.
9782 2002-06-08 Ravi Pratap <ravi@ximian.com>
9784 * class.cs (Accessor): Hold attributes information so we can pass
9787 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
9788 Modify to pass in attributes attached to the methods.
9790 (add_accessor_declaration, remove_accessor_declaration): Ditto.
9792 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
9793 to handle the Accessor kind :-)
9795 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
9797 2002-06-08 Martin Baulig <martin@gnome.org>
9799 * expression.cs (Unary.TryReduceNegative): Added support for
9802 2002-06-08 Martin Baulig <martin@gnome.org>
9804 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
9805 name can't be found in the `defined_names' - the caller will do a
9806 MemberLookup in this case and thus find methods in System.Enum
9807 such as Enum.IsDefined().
9809 2002-06-08 Martin Baulig <martin@gnome.org>
9811 * enum.cs (Enum.ChangeEnumType): This is a custom version of
9812 Convert.ChangeType() which works with TypeBuilder created types.
9813 (Enum.LookupEnumValue, Enum.Define): Use it here.
9815 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
9816 `TypeBuilder.BaseType != null' check.
9817 (TypeContainer.FindMembers): Only lookup parent members if we
9818 actually have a parent.
9819 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
9820 (ConstructorInitializer.Resolve): Likewise.
9822 * interface.cs (Interface.FindMembers): Added
9823 `TypeBuilder.BaseType != null' check.
9825 * rootcontext.cs (RootContext.ResolveCore): Added
9826 "System.Runtime.CompilerServices.IndexerNameAttribute" to
9827 classes_second_stage.
9829 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
9830 debug_type and trace_type when compiling with --nostdlib.
9832 2002-06-07 Martin Baulig <martin@gnome.org>
9834 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
9835 (AddField): Set it to true when adding a non-static field.
9836 (DefineType): Use `have_nonstatic_fields' to find out whether we
9837 have non-static fields, not `Fields != null'.
9839 2002-06-02 Miguel de Icaza <miguel@ximian.com>
9841 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
9842 dereferencing a null on the static-field code path)
9844 2002-05-30 Martin Baulig <martin@gnome.org>
9846 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
9847 to take command line arguments. Use reflection to call the new
9848 custom `Initialize' function on the symbol writer and pass it the
9849 command line arguments.
9851 * driver.cs (--debug-args): New command line argument to pass command
9852 line arguments to the symbol writer.
9854 2002-05-28 Miguel de Icaza <miguel@ximian.com>
9856 * assign.cs (DoResolve): Forgot to do the implicit conversion to
9857 the target type for indexers and properties. Thanks to Joe for
9860 2002-05-27 Miguel de Icaza <miguel@ximian.com>
9862 * typemanager.cs (MethodFlags): returns the method flags
9863 (Obsolete/ShouldIgnore) that control warning emission and whether
9864 the invocation should be made, or ignored.
9866 * expression.cs (Invocation.Emit): Remove previous hack, we should
9867 not do this on matching a base type, we should do this based on an attribute
9869 Only emit calls to System.Diagnostics.Debug and
9870 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
9871 on the command line.
9873 * rootcontext.cs: Global settings for tracing and debugging.
9875 * cs-tokenizer.cs (define): New utility function to track
9876 defines. Set the global settings for TRACE and DEBUG if found.
9878 2002-05-25 Ravi Pratap <ravi@ximian.com>
9880 * interface.cs (Populate*): Pass in the TypeContainer as well as
9881 the DeclSpace as parameters so that we can create EmitContexts and
9882 then use that to apply attributes etc.
9884 (PopulateMethod, PopulateEvent, PopulateProperty)
9885 (PopulateIndexer): Apply attributes everywhere.
9887 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
9890 (ApplyAttributes): Update accordingly.
9892 We now apply interface attributes for all members too.
9894 2002-05-26 Miguel de Icaza <miguel@ximian.com>
9896 * class.cs (Indexer.Define); Correctly check if we are explicit
9897 implementation (instead of checking the Name for a ".", we
9898 directly look up if the InterfaceType was specified).
9900 Delay the creation of the PropertyBuilder.
9902 Only create the PropertyBuilder if we are not an explicit
9903 interface implementation. This means that explicit interface
9904 implementation members do not participate in regular function
9905 lookups, and hence fixes another major ambiguity problem in
9906 overload resolution (that was the visible effect).
9908 (DefineMethod): Return whether we are doing an interface
9911 * typemanager.cs: Temporary hack until we get attributes in
9912 interfaces (Ravi is working on that) and we get IndexerName
9913 support in interfaces.
9915 * interface.cs: Register the indexers as properties.
9917 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
9918 warning, I have verified that this is a bug in the .NET runtime
9919 (JavaScript suffers of the same problem).
9921 * typemanager.cs (MemberLookup): When looking up members for
9922 interfaces, the parent of an interface is the implicit
9923 System.Object (so we succeed in searches of Object methods in an
9924 interface method invocation. Example: IEnumerable x; x.ToString
9927 2002-05-25 Miguel de Icaza <miguel@ximian.com>
9929 * class.cs (Event): Events should also register if they do
9930 implement the methods that an interface requires.
9932 * typemanager.cs (MemberLookup); use the new GetInterfaces
9935 (GetInterfaces): The code used to lookup interfaces for a type is
9936 used in more than one place, factor it here.
9938 * driver.cs: Track the errors at the bottom of the file, we kept
9941 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
9942 instance if the method we are calling is static!
9944 2002-05-24 Miguel de Icaza <miguel@ximian.com>
9946 * attribute.cs (ApplyAttributes): Make this function filter out
9947 the IndexerName attribute (as that attribute in reality is never
9948 applied) and return the string constant for the IndexerName
9951 * class.cs (TypeContainer.Emit): Validate that all the indexers
9952 have the same IndexerName attribute, and if so, set the
9953 DefaultName attribute on the class.
9955 * typemanager.cs: The return value might contain other stuff (not
9956 only methods). For instance, consider a method with an "Item"
9957 property and an Item method.
9959 * class.cs: If there is a problem with the parameter types,
9962 2002-05-24 Ravi Pratap <ravi@ximian.com>
9964 * ecore.cs (ImplicitConversionExists): Wrapper function which also
9965 looks at user defined conversion after making a call to
9966 StandardConversionExists - we need this for overload resolution.
9968 * expression.cs : Update accordingly the various method calls.
9970 This fixes 2 bugs filed against implicit user defined conversions
9972 2002-05-22 Miguel de Icaza <miguel@ximian.com>
9974 * statement.cs: Track the result of the assignment.
9976 2002-05-21 Miguel de Icaza <miguel@ximian.com>
9978 * expression.cs (MemberAccess): Improved error reporting for
9979 inaccessible members.
9981 2002-05-22 Martin Baulig <martin@gnome.org>
9983 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
9984 itself with debugging support.
9986 2002-05-22 Martin Baulig <martin@gnome.org>
9988 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
9989 Removed, this isn't needed anymore.
9991 2002-05-20 Martin Baulig <martin@gnome.org>
9993 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
9994 be underlying type for an enum.
9996 2002-05-20 Miguel de Icaza <miguel@ximian.com>
9998 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
9999 that splits out the loading of just the core types.
10001 * rootcontext.cs (ResolveCore): Split the struct resolution in
10002 two, so we can load the enumeration underlying types before any
10005 * expression.cs (Is): Bandaid until we fix properly Switch (see
10006 bug #24985 for details).
10008 * typemanager.cs (ImplementsInterface): The hashtable will contain
10009 a null if there are no interfaces implemented.
10011 2002-05-18 Miguel de Icaza <miguel@ximian.com>
10013 * cs-parser.jay (indexer_declarator): It is fine to have array
10016 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10018 * typemanager.cs: (RegisterBuilder): New function used to register
10019 TypeBuilders that implement interfaces. Since
10020 TypeBuilder.GetInterfaces (as usual) does not work with lame
10022 (AddUserType): register interfaces.
10024 (ImplementsInterface): Use the builder_to_ifaces hash if we are
10025 dealing with TypeBuilder. Also, arrays are showing up as
10026 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
10027 methods can not be invoked on them!
10029 * ecore.cs (ExplicitReferenceConversionExists): Made public.
10030 (ImplicitReferenceConversionExists): Split out from
10031 StandardConversionExists.
10033 * expression.cs (As): We were only implementing one of the three
10034 cases for the as operator. We now implement them all.
10035 (Is): Implement the various other cases for Is as well.
10037 * typemanager.cs (CACHE): New define used to control if we want or
10038 not the FindMembers cache. Seems to have a negative impact on
10039 performance currently
10041 (MemberLookup): Nested types have full acess to
10042 enclosing type members
10044 Remove code that coped with instance/static returns for events, we
10045 now catch this in RealFindMembers.
10047 (RealFindMembers): only perform static lookup if the instance
10048 lookup did not return a type or an event.
10050 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10052 * assign.cs (CompoundAssign): We pass more semantic information
10053 now to Compound Assignments than we did before: now we have all
10054 the information at hand, and now we resolve the target *before* we
10055 do the expression expansion, which allows the "CacheValue" method
10056 to have the effect we intended (before, a [x] += 1 would generate
10057 two differen ArrayAccess expressions from the ElementAccess,
10058 during the resolution process).
10060 (CompoundAssign.DoResolve): Resolve target and original_source here.
10062 2002-05-16 Miguel de Icaza <miguel@ximian.com>
10064 * expression.cs (ArrayAccess): dropped debugging information.
10066 * typemanager.cs: Small bug fix: I was always returning i_members,
10067 instead of one of i_members or s_members (depending on which had
10070 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
10071 method is invoked before any code generation takes place, and it
10072 is a mechanism to inform that the expression will be invoked more
10073 than once, and that the method should use temporary values to
10074 avoid having side effects
10076 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
10078 * ecore.cs (Expression.CacheTemporaries): Provide empty default
10081 * expression.cs (Indirection, ArrayAccess): Add support for
10082 CacheTemporaries in these two bad boys.
10084 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
10085 ldobj or ldind_ref.
10086 (StoreFromPtr): Handle stobj as well.
10088 * expression.cs (UnaryMutator): Share more code.
10090 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
10091 down: I was not tracking the Filter function as well, which
10092 was affecting the results of the cache.
10094 2002-05-15 Miguel de Icaza <miguel@ximian.com>
10096 * attribute.cs: Remove the hack to handle the CharSet property on
10099 2002-05-14 Miguel de Icaza <miguel@ximian.com>
10101 * attribute.cs (DoResolve): More uglyness, we now only try to
10102 resolve the attribute partially, to extract the CharSet
10103 information (only if we are a StructLayout attribute). Otherwise
10105 (GetExtraTypeInfo): Add some code to conditionally kill in the
10106 future this. I am more and more convinced that the .NET
10107 framework has special code to handle the attribute setting on
10110 * expression.cs (IsParamsMethodApplicable): Revert my previous
10111 foreach change here, it was wrong.
10113 2002-05-13 Miguel de Icaza <miguel@ximian.com>
10115 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
10116 (pp_expr): do not abort on unknown input, just return.
10117 (eval): abort if there are pending chars.
10119 * attribute.cs (Attribute.Resolve): Positional parameters are
10120 optional. Deal with that case.
10122 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
10123 the Ansi/Unicode/Auto information for the type.
10125 (TypeContainer.DefineType): instantiate the EmitContext here, as
10126 we will be using it during the type definition (to resolve
10127 attributes) and during the emit phase.
10129 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
10130 to pull type information out of the attributes
10132 (Attribute.Resolve): track the constructor builder, and allow for
10133 multiple invocations (structs and classes will use this).
10135 * ecore.cs (MemberLookupFinal): new version with all the
10136 parameters customizable.
10138 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
10139 constructors. Return if the result value is null (as the error
10140 would have been flagged already by MemberLookupFinal)
10142 Do not allow instances of abstract classes or interfaces to be
10145 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
10146 We have to compare the assembly property here when dealing with
10147 FamANDAssem and Assembly access modifiers, because we might be
10148 creating an assembly from *modules* (that means that we are not
10149 getting TypeBuilders for types defined in other modules that are
10150 part of this assembly).
10152 (Method.Emit): If the method is marked abstract and has a body,
10155 (TypeContainer.DefineMembers): If both the defined member and the
10156 parent name match are methods, then do not emit any warnings: let
10157 the Method.Define routine take care of flagging warnings. But if
10158 there is a mismatch (method overrides something else, or method is
10159 overriwritten by something, then emit warning).
10161 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
10162 set to null, this means `do not check for the return type on the
10165 (Method.Define): set the return type for the method signature to
10166 null, so that we get methods with the same name and parameters and
10167 different return types. This is used to flag warning 114 (you are
10168 hiding a method, and you probably want to use the new/override
10171 * typemanager.cs (MemberLookup): Implemented proper access
10172 control, closing a long standing set of bug reports. The problem
10173 was that the Framework only has two bits: Public and NonPublic,
10174 and NonPublic includes private and protected methods, but we need
10175 to enforce the FamANDAssem, FamOrAssem and Family.
10177 2002-05-11 Miguel de Icaza <miguel@ximian.com>
10179 * statement.cs (GotoCase): Return true: Ammounts to giving up
10180 knowledge on whether we return or not, and letting the other case
10181 be responsible for it.
10183 2002-05-10 Miguel de Icaza <miguel@ximian.com>
10185 * driver.cs: Do not load directories for each file processed, only
10186 do it if there is a pattern.
10188 * ecore.cs: Report readonly assigns here as well, as we might have
10189 been resolved only by MemberAccess.
10191 (SimpleName.SimpleNameResolve): Also be useful for LValue
10192 resolution. We need this to propagate assign to local readonly variables
10194 * typemanager.cs: Use a ptrhashtable for the criteria, because we
10195 do not want to reuse potential criteria memory.
10197 * class.cs (MyEventBuilder): Set reflected_type;
10199 * ecore.cs (Constantify): Added support for constifying bools.
10201 (RootContext.LookupType): Added a cache for values looked up in
10202 the declaration space.
10204 * typemanager.cs (FindMembers): Now is a front-end to
10205 RealFindMembers, and provides a two-level hashtable-based cache to
10208 15% performance improvement: from 22.5 to 19.2 seconds.
10210 * expression.cs (IsParamsMethodApplicable): use foreach.
10211 (Invocation.DoResolve): ditto.
10212 (New.DoResolve): ditto.
10213 (ArrayCreation.DoResolve): ditto.
10215 * ecore.cs (FindMostEncompassingType): use foreach.
10217 * delegate.cs (NewDelegate.DoResolve): Use foreach
10219 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
10220 (RemoveMethods): use foreach.
10222 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
10223 nested foreach statements instead of for, and also break out of
10224 the inner loop once a match is found.
10226 (Invocation.OverloadResolve): Use foreach, simplify the code.
10228 2002-05-08 Miguel de Icaza <miguel@ximian.com>
10230 * cfold.cs (BinaryFold): During an enumeration evaluation context,
10231 we actually unwrap the expression to allow for extra information
10234 * expression.cs: Use Shr_Un on unsigned operations.
10236 2002-05-08 Ravi Pratap <ravi@ximian.com>
10238 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
10239 applicable operators was not being considered correctly. This closes
10240 the bug Miguel reported.
10242 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
10244 * attribute.cs: check that the type derives from System.Attribute
10245 and report the correct error in that case (moved the duplicate code to
10246 its own method, too).
10248 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
10250 * attribute.cs: lookup attribute type name as the spec says: first the
10251 bare attribute name and then name + "Attribute" (nant compiles with
10252 mcs after this fix).
10254 2002-05-07 Miguel de Icaza <miguel@ximian.com>
10256 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
10257 Because of the way we parse things, we should try to see if a
10258 UIntConstant can fit in an integer.
10260 2002-05-07 Ravi Pratap <ravi@ximian.com>
10262 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
10263 when we are in an explicit context.
10265 (ConvertReferenceExplicit): When converting from Iface type S to Class
10266 T make sure the rules are implemented as an OR.
10268 * parameter.cs (ParameterType): Make it a property for now although the
10269 purpose really isn't anything immediate.
10271 * expression.cs (Is*Applicable): Do better checking on the parameter type
10272 of a ref/out parameter. The ones from the system assemblies are already
10273 marked with the correct type so we don't need to do any correction.
10275 * ecore.cs (StandardConversionExists): Conversion from Interface types to
10276 the object type is standard too so include that.
10278 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10280 * ecore.cs (StandardConversionExists): Augment with missing code:
10281 deal with IntConstant, LongConstants and Enumerations.
10283 * assign.cs: Report the error, instead of failing silently
10285 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
10286 typecontainer that they are declared, because the
10287 typecontainer/namespace will have the list of using clauses that
10288 need to be applied.
10290 Assembly Attributes were escaping the normal registration
10293 (EmitCode): Apply attributes within an EmitContext that represents
10294 the container they were declared on.
10296 * cs-parser.jay: Track bases for structs. How did I get this wrong?
10298 2002-05-06 Ravi Pratap <ravi@ximian.com>
10300 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
10301 Revamp completely - make much cleaner as we now operate only
10304 (FindMostSpecificSource, FindMostSpecificTarget): New methods
10305 to implement the logic detailed in the spec more correctly.
10307 (UserDefinedConversion): Update accordingly.
10309 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10311 * statement.cs: Return flow analysis information up.
10313 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
10316 (token): Do not consume an extra character before calling
10319 2002-05-06 Piers Haken <piersh@friskit.com>
10321 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
10323 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10325 * class.cs (Constructor.Emit): Set the IsStatic flag in the
10326 EmitContext during the instance constructor initializer
10327 resolution, to stop access to instance variables.
10329 This is mandated by the spec, last paragraph of the `constructor
10330 initializers' section.
10332 2002-05-05 Miguel de Icaza <miguel@ximian.com>
10334 * cs-parser.jay, class.cs (Accessor): new class used to represent
10335 an accessor (get or set). In the past we used `null' to represent
10336 a missing accessor. But this is ambiguous because there was no
10337 way to tell in abstract indexers/properties if one of them was
10340 Now there is a way of addressing that.
10342 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
10343 instead of FindMembers.
10345 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
10346 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
10348 * attribute.cs: Treat indexers and properties as the same in terms
10349 of applying attributes
10351 * ecore.cs (FindMostEncompassedType): Use statically initialized
10352 EmptyExpressions()s like we do elsewhere to avoid creating useless
10353 objects (and we take this out of the tight loop).
10355 (GetConversionOperators): Move the code to extract the actual
10356 operators to a separate routine to clean things up.
10358 2002-05-04 Miguel de Icaza <miguel@ximian.com>
10360 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
10361 events are always registered FieldBuilders.
10363 * class.cs (FieldBase): New class shared by Fields
10365 * delegate.cs: If we are a toplevel delegate, use our full name.
10366 If we are a nested delegate, then only use our tail name.
10368 2002-05-02 Ravi Pratap <ravi@ximian.com>
10370 * expression.cs (IsApplicable): Ensure that we add the "&" to
10371 ref/out types before comparing it with the type of the argument.
10373 (IsParamsMethodApplicable): Ditto.
10375 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
10378 * delegate.cs : Handle the case when we have more than one applicable
10379 method. Flag an error only when we finish checking all.
10381 2002-05-02 Miguel de Icaza <miguel@ximian.com>
10383 * expression.cs: Add support for boolean static initializers.
10385 2002-05-01 Miguel de Icaza <miguel@ximian.com>
10387 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
10389 * parameter.cs (ComputeParameterTypes,
10390 ComputeAndDefineParameterTypes): Better error handling: now we
10391 clear the `types' cache if we fail during any of the type lookups.
10392 We also return the status code correctly to our caller
10394 * delegate.cs: If we fail to define a delegate, abort the extra
10397 * expression.cs (Binary.ResolveOperator): for
10398 operator==(object,object) and operator !=(object, object) we also
10399 have to verify that there is an implicit conversion from one to
10402 (ArrayAccess.DoResolve): Array Access can operate on
10405 2002-04-30 Miguel de Icaza <miguel@ximian.com>
10407 * assign.cs (CompoundAssign): A new class used as a "flag" that
10408 the assignment actually is happening as part of a compound
10409 assignment operator.
10411 During compound assignment, a few new rules exist to enable things
10418 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
10419 to the type of x) if y is implicitly convertible to the type of x,
10420 and the operator is a builtin operator and the return type of the
10421 operator is explicitly convertible to the type of x.
10423 * rootcontext.cs: Reset warning level to 2. 4 catches various
10424 "interesting" features in mcs, we must clean this up at some
10425 point, but currently am trying to kill other bugs ;-)
10427 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
10428 in container classes as well.
10430 * expression.cs (Binary.ResolveOperator): Handle string case
10431 before anything else (as operator overloading does emit an error
10432 before doing anything else).
10434 This code could go away when we move to a table driven model, but
10435 i could not come up with a good plan last night.
10437 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
10439 * typemanager.cs (CSharpName): reimplementation using regex.
10440 * class.cs: added null check for fields in Emit
10441 * rootcontext.cs: set warninglevel to 4
10443 2002-04-29 Miguel de Icaza <miguel@ximian.com>
10445 * typemanager.cs (CSharpName): reimplemented with Lupus
10448 2002-04-28 Miguel de Icaza <miguel@ximian.com>
10450 * statement.cs (If): correclty implement Resolve, because we were
10451 not catching sem errors in there. The same process is needed
10453 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
10456 (Statement.Warning_DeadCodeFound): Factorize code.
10457 (While): Report dead code here too.
10459 (Statement): Added Resolve virtual method to allow
10460 for resolution split from the emit code.
10462 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10464 * statement.cs (EmitBoolExpression): No longer try to resolve the
10466 (MakeBoolean): New utility function that resolve, implicitly
10467 converts to boolean and tags the expression.
10470 (If, Do): Implement dead code elimination.
10471 (While): Implement loop inversion
10473 (Do, While, For, If): Resolve the expression prior to calling our
10476 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
10479 - added method Report28 (warning: program has more than one entry point)
10480 - added method IsEntryPoint, implements paragraph 10.1 of the spec
10481 - modified method Method.Define, the part at the end of the method
10483 * rootcontext.cs: added static public Location EntryPointLocation;
10485 * ../errors/cs0028.cs : Add test case for the above warning.
10488 - modified method CSharpName to allow arrays of primitive type to
10489 be printed nicely (e.g. instead of System.Int32[][] it now prints
10491 - added method CSharpSignature: returns the signature of a method
10492 in string format to be used in reporting errors, warnings, etc.
10494 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
10497 2002-04-26 Ravi Pratap <ravi@ximian.com>
10499 * delegate.cs (Define): Fix extremely silly bug where I was
10500 setting the type of the 'object' parameter of the BeginInvoke
10501 method to System.IAsyncResult instead of System.Object ;-)
10503 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10505 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
10508 (Constructor.Emit): return if we fail to initialize the
10509 constructor. Another door closed!
10511 * expression.cs (New.DoResolve): Improve error message (from -6 to
10512 1501). Use DeclaredOnly lookup to find the exact constructor.
10514 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
10515 loop. This is useful.
10517 * cs-parser.jay: Adjust the default parameters so that destructors
10518 have the proper signature.
10520 2002-04-26 Martin Baulig <martin@gnome.org>
10522 * driver.cs (LoadAssembly): If `assembly' contains any characters
10523 which are only valid in path names and not in assembly names
10524 (currently slash, backslash and point), use Assembly.LoadFrom ()
10525 instead of Assembly.Load () on the `assembly' (before iteration
10526 over the link_paths).
10528 2002-04-26 Martin Baulig <martin@gnome.org>
10530 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
10532 2002-04-25 Miguel de Icaza <miguel@ximian.com>
10534 * class.cs (Property): use the new typemanager.MemberLookup
10536 (TypeContainer.MemberLookup): Implement using the
10537 TypeManager.MemberLookup now.
10539 * typemanager.cs: Make MemberLookup a function of the TypeManager,
10540 and return MemberInfos, so that these can be used without an
10541 EmitContext (what we had before).
10543 2002-04-24 Miguel de Icaza <miguel@ximian.com>
10545 * expression.cs: Fix the case where the argument to params if the
10546 type of the params. I omitted handling this before. Fixed
10548 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10550 * driver.cs: Call BootCorlib_PopulateCoreType
10552 * class.cs (Property.CheckBase): Check for properties only, not
10555 * interface.cs: Temporary hack: try/catch around the
10556 CustomAttributeBuilder, because I am getting an exception that I
10559 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
10560 types whose definitions are required to be there (attributes are
10561 defined before standard types).
10563 Compute definitions as we boot the various types, as they are used
10564 immediately (value_type class will need object_type, but if we do
10565 not initialize object_type, we will pass a null, which will let
10566 the runtime pick the System.Object from the existing corlib, which
10567 is not what we want).
10569 2002-04-22 Patrik Torstensson <totte@labs2.com>
10571 * cs-tokenizer.cs: fixed a number of trim() issues.
10573 2002-04-22 Ravi Pratap <ravi@ximian.com>
10575 * expression.cs (Argument.Type): Ensure that we return the correct
10576 type when we have out or ref parameters [in which case we
10579 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10581 * class.cs (Property, Indexer): Allow extern modifier in there.
10583 * typemanager.cs (InitBaseTypes): Initializes object_type and
10584 value_type, since those will be used early on during the bootstrap
10585 process to compile corlib.
10587 (InitCoreTypes): Move code from here to InitBaseTypes.
10589 2002-04-21 Miguel de Icaza <miguel@ximian.com>
10591 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
10592 single-dimension arrays as using the ldlen opcode.
10594 Daniel Lewis discovered this optimization.
10596 * typemanager.cs: Add signature for System.Array::get_Length
10598 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10600 * statement.cs: report the error when the foreach does not apply to an
10601 array nor a collection.
10603 2002-04-19 Miguel de Icaza <miguel@ximian.com>
10605 * expression.cs: Add implicit conversions to the operator ~.
10607 * constant.cs (DecimalConstant.Emit): Emit decimal value.
10609 * typemanager.cs: Locate the decimal constructor.
10611 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10613 * attribute.cs: use the new property of TypeOf.
10614 * expression.cs: added 'get' property around typearg.
10616 These changes fix a build breaker reported by NickD. Is this the
10617 correct way to fix? If not, please, revert my changes and make it
10620 2002-04-17 Miguel de Icaza <miguel@ximian.com>
10622 * attribute.cs: Add support for typeof in attribute invocations.
10623 I am not sure that this is right though.
10625 2002-04-14 Duncan Mak <duncan@ximian.com>
10627 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
10628 Binary.Operator.Division case.
10630 2002-04-13 Ravi Pratap <ravi@ximian.com>
10632 * class.cs (DefineType): Ensure that we do a proper check on
10633 attribute types and also register it with the TypeManager.
10635 (TypeContainer.Targets): The default for attribute types is
10636 AttributeTargets.All.
10638 * attribute.cs (ApplyAttributes): Registering the attribute type
10639 is done elsewhere, not when we discover we have a Usage attribute.
10641 2002-04-12 Ravi Pratap <ravi@ximian.com>
10643 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
10644 and get rid of is_delegate parameter.
10646 * everywhere : update.
10648 2002-04-12 Ravi Pratap <ravi@ximian.com>
10650 * cs-parser.jay (compilation_unit): Revamp completely to use
10651 some new ideas that I got from Rhys' grammar to solve the problems
10652 with assembly level attributes.
10654 (outer_declaration): New grammar production.
10656 (attribute_sections): Add.
10658 (opt_attributes): Base on attribute_sections
10660 (namespace_declaration): Allow opt_attributes to tackle the case
10661 when we have assembly level attributes - we are clever in this
10664 * attribute.cs (ApplyAttributes): Do not worry about assembly
10665 attributes in the non-global context.
10667 * rootcontext.cs (AddGlobalAttributes): Go back to using this
10668 instead of SetGlobalAttributes.
10670 * class.cs, rootcontext.cs : Ensure we define and generate
10671 attribute types before anything else.
10673 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
10674 and flag the new error -20 for the case when the attribute type
10675 does not have valid targets specified. csc does not catch this.
10677 * ../errors/errors.txt : update for error # -20
10679 2002-04-11 Ravi Pratap <ravi@ximian.com>
10681 * support.cs (InternalParameters.ParameterModifier): Do some null
10682 checking and return sane values.
10684 * class.cs (Method.Define): If we are a PInvoke method, ensure
10685 that we are static and extern. Report error # 601
10687 * ../errors/cs0601.cs : Add test case for the above error.
10689 2002-04-07 Ravi Pratap <ravi@ximian.com>
10691 * rootcontext.cs (attribute_types): We need to keep type of
10692 all attribute types separately and emit code for them first.
10694 (RegisterAttribute) : Implement.
10696 * class.cs (DefineType): Check if the current Type is a custom
10697 attribute type and register it accordingly.
10699 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
10700 adding the first attribute twice and rename to
10702 (SetGlobalAttributes): this.
10704 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
10707 * attribute.cs (ApplyAttributes): Take an additional argument telling us
10708 if we are processing global arguments. Hmm, I am unsure of this.
10710 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10712 * expression.cs: added static array of strings to avoid calling
10713 Enum.ToString () for Operator in Binary. Significant recover of
10716 2002-04-10 Miguel de Icaza <miguel@ximian.com>
10718 * class.cs (FindMembers): Allow the Builders of the various
10719 members to be null. If they are skip them. This only happens
10720 during the PInvoke declaration.
10722 2002-04-09 Miguel de Icaza <miguel@ximian.com>
10724 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
10725 failure, so we do not keep going afterwards.
10727 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
10728 wanted to pass `false' as the `is_delegate' argument. If this is
10729 the case, why not use delegate_type == null to mean `is_delegate =
10730 false' and anything else as is_delegate = true.
10732 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
10734 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
10735 code for the section, not the beginning of the tests.
10737 2002-04-08 Miguel de Icaza <miguel@ximian.com>
10739 * cfold.cs: Handle operator + (Enum x, Underlying x)
10741 * expression.cs (Binary): same. Warn about errors where we have
10742 Enum/Enum in operator + as well.
10744 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
10747 - added support for switch(bool)
10748 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
10749 - add TableSwitchEmit() to handle table-based switch statements
10751 2002-04-05 Ravi Pratap <ravi@ximian.com>
10753 * expression.cs (Invocation.OverloadResolve): Factor out code which
10754 does parameter compatibility checking with arguments so that we can
10755 re-use the code even from Delegate.VerifyApplicability
10757 (VerifyArgumentsCompat): Move above code here.
10759 * delegate.cs (VerifyApplicability): Get rid of duplicate code
10760 and instead make a call to the above method.
10762 2002-03-31 Ravi Pratap <ravi@ximian.com>
10764 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
10765 We use it to keep track of classes which are attribute types.
10767 2002-04-02 Miguel de Icaza <miguel@ximian.com>
10769 * delegate.cs (Delegate.Define): Correctly define the types in the
10770 presence of fixed and array parameters.
10772 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
10775 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
10776 include NonPublic after the first iteration.
10778 * class.cs (Indexer.CheckBase): Only check if both parents are
10781 * cs-parser.jay (accessor_body): If empty, set to null.
10783 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
10784 same code path here to resolve constants names that we did have in
10785 MemberAccess.DoResolve. There is too much code duplicated here.
10787 2002-04-01 Miguel de Icaza <miguel@ximian.com>
10789 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
10791 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
10794 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
10795 tokens, numbers and strings.
10797 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
10800 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
10801 asyncronous parameters and the regular parameters.
10803 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
10804 specify the target directory.
10806 * expression.cs: (This.DoResolve): Simplify
10807 (As.Emit): Optimize, do not generate IsInst if the expression is
10808 always of the given type.
10810 (Is.DoResolve): Bug fix, we were reporting both always/never for
10813 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
10814 creating too many unnecessary arrays.
10816 2002-03-31 Miguel de Icaza <miguel@ximian.com>
10818 * class.cs (EmitFieldInitializer): Use Assign expression to assign
10819 fields instead of rolling our own initializer. Takes care of all
10820 implicit conversions, and drops unnecessary static checks/argument.
10822 2002-03-31 Dick Porter <dick@ximian.com>
10824 * driver.cs: use the GetDirectories() return values properly, and
10825 use "/" as path separator.
10827 2002-03-30 Miguel de Icaza <miguel@ximian.com>
10829 * expression.cs (Unary): Optimize - - expr into expr.
10830 (Binary): Optimize a + (-b) into a -b.
10832 * codegen.cs (CodeGen): Made all methods static.
10834 2002-03-29 Miguel de Icaza <miguel@ximian.com>
10838 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
10839 TypeBuilder property.
10841 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
10844 * tree.cs: Removed the various RecordXXXX, and replaced with a
10845 single RecordDecl. Removed all the accessor methods, and just
10846 left a single access point Type
10848 * enum.cs: Rename DefineEnum to DefineType.
10850 * decl.cs: New abstract method `DefineType' used to unify the
10851 Defines for Enumerations, Interfaces, TypeContainers and
10854 (FindType): Moved LookupInterfaceOrClass here. Moved the
10855 LookupBaseClasses method that used to live in class.cs and
10856 interface.cs here, and renamed to FindType.
10858 * delegate.cs: Implement DefineType. Take advantage of the
10859 refactored pattern for locating the parent builder without taking
10860 the parent_builder argument (which we know does not work if we are
10861 nested, and triggering a toplevel definition).
10863 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10865 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
10866 accessibility of a member has changed during override and report
10869 * class.cs (Method.Define, Property.Define): Only complain on
10870 overrides if the method is private, any other accessibility is
10871 fine (and since we just checked the permission is the same, we are
10874 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
10875 and elif are processed always. The other pre-processing
10876 directives are only processed if we are "taking" the path
10878 2002-03-29 Martin Baulig <martin@gnome.org>
10880 * class.cs (Method.Emit): Only emit symbolic debugging info if the
10881 current location is not Null.
10883 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
10884 a separate method so we can profile it.
10886 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
10887 `span.Seconds' are just seconds, but no minutes or hours.
10888 (MainDriver): Profile the CodeGen.SaveSymbols calls.
10890 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10892 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
10893 Remove the gratuitous set of Final:
10895 // If an interface implementation, then we can set Final.
10896 if (((flags & MethodAttributes.Abstract) == 0) &&
10897 implementing.DeclaringType.IsInterface)
10898 flags |= MethodAttributes.Final;
10900 I do not know what I was smoking when I used that.
10903 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
10904 step into fixing the name resolution issues for delegates and
10905 unifying the toplevel name resolution.
10907 2002-03-28 Martin Baulig <martin@gnome.org>
10909 * class.cs (Method.Emit): If we have a symbol writer, call its
10910 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
10911 tell it about the current method.
10913 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
10914 writer that we're going to emit the first byte of IL code for a new
10915 statement (a new source line).
10916 (EmitContext.EmitTopBlock): If we have a symbol writer, call
10917 EmitContext.Mark() before emitting any code.
10919 * location.cs (SymbolDocument): Return null when we're Null.
10921 * statement.cs (Statement): Moved the `Location loc' variable here.
10922 (Statement.EmitBoolExpression): If we have a symbol writer, call
10923 ec.Mark() before emitting any code to tell it that we're at the
10924 beginning of a new statement.
10925 (StatementExpression): Added `Location' argument to the constructor.
10926 (Block): Added public readonly variable `StartLocation' and public
10927 variable `EndLocation'. The latter is to be set using SetEndLocation().
10928 (Block): Added constructor which takes a start and end location.
10929 (Block.SetEndLocation): New method. This sets the end location.
10930 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
10931 local variables we create.
10932 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
10933 each statement and do also mark the begin and end of the block.
10935 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
10936 tell it the current lexer.Location, use Location.Null for the end of the
10938 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
10939 current block, set its end location using SetEndLocation().
10940 (statement_expression): StatementExpression constructor now takes the
10941 lexer.Location as additional argument.
10942 (for_statement, declare_local_variables): Likewise.
10943 (declare_local_variables): When creating a new implicit block, use the
10944 new Block constructor and pass it the lexer.Location.
10946 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10948 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
10949 members also on the parent interfaces recursively.
10951 2002-03-27 Miguel de Icaza <miguel@ximian.com>
10953 * report.cs: Use new formats, since Gonzalo finished the missing
10956 * expression.cs (Binary.ResolveOperator): added missing operator|
10957 operator& and operator^ for bool/bool.
10959 * cs-parser.jay: CheckDef now takes a Location argument that is
10960 used to report errors more precisly (instead of reporting the end
10961 of a definition, we try to track something which is a lot closer
10962 to the source of the problem).
10964 * cs-tokenizer.cs: Track global token use, so we can properly flag
10965 the use of #define/#undef after the first token has been seen.
10967 Also, rename the reportXXXX to Error_DescriptiveName
10969 * decl.cs (DeclSpace.IsTopLevel): Move property here from
10970 TypeContainer, so that Enum and Interface can use this too.
10972 * class.cs (TypeContainer.LookupInterfaceOrClass,
10973 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
10974 `builder' argument. Typically this was used to pass the parent
10975 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
10978 The problem is that a nested class could trigger the definition of
10979 a toplevel class, and the builder would be obviously wrong in that
10982 So we drop this argument, and we compute dynamically the
10983 TypeBuilder/ModuleBuilder (the correct information was available
10984 to us anyways from DeclSpace.Parent)
10986 * interface.cs (Interface.DefineInterface): Drop builder
10987 parameter cleanup like class.cs
10989 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
10992 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
10995 (Try.Emit): Propagate the returns value from the statement.
10997 (Return.Emit): Even if we are leavning
10999 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
11001 * modifiers.cs: Fix the computation of MethodAttributes flags.
11003 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
11005 * driver.cs: allow compilation of files that start with '/'.
11006 Add a default case when checking the argument of --target.
11008 2002-03-25 Miguel de Icaza <miguel@ximian.com>
11010 * interface.cs: Implement the same search algorithm for types in
11011 the interface code.
11013 * delegate.cs: Do not allow multiple definition.
11015 * Recovered ChangeLog that got accidentally amputated
11017 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
11019 * rootcontext.cs: Load manually enum to allow core classes to
11020 contain enumerations.
11022 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
11023 Update to new static methods in TypeManager.
11025 * typemanager.cs (GetMethod, GetConstructor): Use our
11026 implementation of FindMembers to find the members, since during
11027 corlib compilation, the types are TypeBuilders and GetMethod and
11028 GetConstructor do not work.
11030 Make all methods in TypeManager static.
11032 (InitCodeHelpers): Split the functionality from
11033 the InitCodeTypes function.
11035 * driver.cs: Call InitCodeHelpers after we have populated the
11038 * cs-parser.jay (delegate_declaration): we did not used to compute
11039 the delegate name correctly for void delegates.
11041 2002-03-24 Miguel de Icaza <miguel@ximian.com>
11043 * rootcontext.cs (RootContext): Init the interface_resolve_order
11044 and type_container_resolve_order always.
11046 (ResolveCore, BootstrapCorlib_ResolveClass,
11047 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
11048 compiler when compiling with --nostdlib
11050 * class.cs (TypeContainer.DefineType): Check that our parent is
11051 not null. This test is most important when we are bootstraping
11054 * codegen.cs: Split out the symbol writing code.
11056 2002-03-25 Martin Baulig <martin@gnome.org>
11058 * driver.cs (-g): Made -g an alias for --debug.
11060 2002-03-24 Martin Baulig <martin@gnome.org>
11062 * codegen.cs (SymbolWriter): New public variable. Returns the
11063 current symbol writer.
11064 (CodeGen): Added `bool want_debugging_support' argument to the
11065 constructor. If true, tell the ModuleBuild that we want debugging
11066 support and ask it for the ISymbolWriter.
11067 (Save): If we have a symbol writer, call it's Close() method after
11068 saving the assembly.
11070 * driver.c (--debug): New command line argument to create a
11071 debugger information file.
11073 * location.cs (SymbolDocument): New public property. Returns an
11074 ISymbolDocumentWriter object for the current source file or null
11075 if we don't have a symbol writer.
11077 2002-03-21 Miguel de Icaza <miguel@ximian.com>
11079 * driver.cs (LoadAssembly): Correctly return when all the paths
11080 have been tried and not before.
11082 * statement.cs (Switch.Emit): return the actual coverage for this
11083 statement (returns/not-returns)
11085 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
11086 switch of the statement if we are the last switch section. That
11087 kills two problems: try/catch problems (we used to emit an empty
11088 nop at the end) and switch statements where all branches would
11091 2002-03-19 Miguel de Icaza <miguel@ximian.com>
11093 * driver.cs: Add default assemblies (the equivalent to the
11094 Microsoft CSC.RSP file)
11096 * cs-tokenizer.cs: When updating `cols and setting it to zero,
11097 also update tokens_seen and set it to false.
11099 * driver.cs: Implement --recurse for Mike.
11101 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
11102 correctly splitting out the paths.
11104 2002-03-18 Miguel de Icaza <miguel@ximian.com>
11106 * interface.cs (Interface.PopulateProperty): Instead of using
11107 `parent' as the declaration space for the set parameters, use
11110 * support.cs (InternalParameters): InternalParameters constructor
11111 takes a DeclSpace instead of a TypeContainer.
11113 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
11114 types are being initialized, load the address of it before calling
11117 (New): Provide a mechanism to disable the generation of local
11118 value type temporaries when the caller will be providing us with
11119 an address to store it.
11121 (ArrayCreation.EmitDynamicInitializers): Use it.
11123 2002-03-17 Miguel de Icaza <miguel@ximian.com>
11125 * expression.cs (Invocation.EmitArguments): Only probe for array
11126 property if there is more than one argument. Sorry about that.
11128 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
11129 empty param arrays.
11131 * class.cs (Method.LabelParameters): Fix incorrect code path that
11132 prevented the `ParamArrayAttribute' from being applied to the
11135 2002-03-16 Miguel de Icaza <miguel@ximian.com>
11137 * support.cs (ReflectionParameters): Correctly compute whether the
11138 last argument is a params array. Fixes the problem with
11141 * typemanager.cs: Make the assemblies array always be non-null
11142 (empty, but non-null)
11144 * tree.cs (RecordDecl): New function that abstracts the recording
11145 of names. This reports error 101, and provides a pointer to the
11146 previous declaration. Fixes a crash in the compiler.
11148 * cs-parser.jay (constructor_declaration): Update to new grammar,
11149 and provide a constructor_body that can be empty.
11151 2002-03-15 Miguel de Icaza <miguel@ximian.com>
11153 * driver.cs: Add support for --resources.
11155 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
11156 Make all types for the various array helper methods be integer.
11158 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
11159 CheckState to ConvCast.
11161 (ConvCast): Now it takes a `checked' state argument, to avoid
11162 depending on the emit context for the conversion, and just using
11163 the resolve time setting.
11165 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
11166 instead of Invocation.EmitArguments. We do not emit the original
11167 arguments, instead we emit those which have been converted to
11168 unsigned int expressions.
11170 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
11172 * codegen.cs: ditto.
11174 * expression.cs (LocalVariableReference): Drop the use of the
11175 Store function that depended on the variable index.
11177 * statement.cs (VariableInfo): Drop the `Idx' property from this
11178 class, as this is not taking into account the indexes for
11179 temporaries tat we generate during the execution, getting the
11182 * class.cs: First emit class initializers, then call the parent
11185 * expression.cs (Binary): Fix opcode emision.
11186 (UnaryMutator.EmitCode): Support checked code generation
11188 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
11189 matches for events for both the Static and Instance scans,
11190 pointing to the same element. Fix that.
11192 2002-03-14 Miguel de Icaza <miguel@ximian.com>
11194 * rootcontext.cs (ResolveTree): Always set the
11195 interface_resolve_order, because nested interfaces will be calling
11198 * class.cs (GetInterfaceOrClass): Track the same resolution
11199 process used by TypeManager.LookupType. This fixes the nested
11200 type lookups in class declarations (separate path from
11203 (TypeContainer.DefineType): Also define nested interfaces.
11204 (TypeContainer.RegisterOrder): New public function used to
11205 register the order in which child interfaces need to be closed.
11207 Nested interfaces need to be closed after their parents have been
11210 * interface.cs (InterfaceAttr): Put all the logic for computing
11211 the interface attribute here.
11213 (DefineInterface): Register our interface order with the
11214 RootContext or with the TypeContainer depending on the case.
11216 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11218 * cs-parser.jay: rework foreach statement to work with the new
11219 changes to the policy on SimpleNames.
11221 * report.cs: support Stacktrace on warnings as well.
11223 * makefile: drop --unsafe and /unsafe from the compile.
11225 2002-03-13 Ravi Pratap <ravi@ximian.com>
11227 * ecore.cs (StandardConversionExists): Modify to take an Expression
11228 as the first parameter. Ensure we do null -> reference type conversion
11231 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
11232 temporary Expression objects.
11234 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
11236 * interface.cs: workaround bug in method overloading resolution
11237 (there is already a bugzilla bug for it).
11239 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11241 We could also solve this problem by having a separate path for
11242 performing type lookups, instead of DoResolve, we could have a
11243 ResolveType entry point, and only participating pieces of the
11244 production (simplename, deref, array) would implement this.
11246 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
11247 signal SimpleName to only resolve type names and not attempt to
11248 resolve anything else.
11250 * expression.cs (Cast): Set the flag.
11252 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
11254 * class.cs: Only report 108 if there is no `new' modifier.
11256 * cs-parser.jay: rework foreach statement to work with the new
11257 changes to the policy on SimpleNames.
11259 * report.cs: support Stacktrace on warnings as well.
11261 * makefile: drop --unsafe and /unsafe from the compile.
11263 2002-03-11 Miguel de Icaza <miguel@ximian.com>
11265 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11266 lookups here, instead of doing that at parse time. This means
11267 that our grammar will not introduce `LocalVariableReferences' as
11268 expressions at this point. That solves the problem of code like
11272 static void Main ()
11276 This is only half the fix. The full fix requires parameters to
11277 also be handled in this way.
11279 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
11280 makes the use more obvious of the DeclSpace. The
11281 ec.TypeContainer.TypeBuilder is now only used to pull the
11282 TypeBuilder for it.
11284 My theory is that I can get rid of the TypeBuilder completely from
11285 the EmitContext, and have typecasts where it is used (from
11286 DeclSpace to where it matters).
11288 The only pending problem is that the code that implements Aliases
11289 is on TypeContainer, and probably should go in DeclSpace.
11291 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11292 lookups here, instead of doing that at parse time. This means
11293 that our grammar will not introduce `LocalVariableReferences' as
11294 expressions at this point. That solves the problem of code like
11298 static void Main ()
11302 This is only half the fix. The full fix requires parameters to
11303 also be handled in this way.
11305 * class.cs (Property.DefineMethod): When implementing an interface
11306 method, set newslot, when implementing an abstract method, do not
11307 set the flag (before we tried never setting it, or always setting
11308 it, which is the difference).
11309 (Indexer.DefineMethod): same.
11310 (Method.DefineMethod): same.
11312 * ecore.cs: Only set the status used flag if we get back a Field.
11314 * attribute.cs: Temporary hack, so Paolo can keep working.
11316 2002-03-08 Ravi Pratap <ravi@ximian.com>
11318 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
11319 the unmanaged type in the case we have a MarshalAs attribute.
11321 (Resolve): Handle the case when we are parsing the special MarshalAs
11322 attribute [we need to store the unmanaged type to use later]
11324 * typemanager.cs (marshal_as_attr_type): Built in type for the
11325 MarshalAs Attribute.
11327 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
11328 on parameters and accordingly set the marshalling info.
11330 2002-03-09 Miguel de Icaza <miguel@ximian.com>
11332 * class.cs: Optimizing slightly by removing redundant code after
11333 we switched to the `NoTypes' return value.
11334 (Property.DefineMethod): use NoTypes here too.
11336 This fixes the bug I introduced in my last batch of changes.
11338 2002-03-05 Ravi Pratap <ravi@ximian.com>
11340 * tree.cs (RecordEnum): Add. We now keep track of enums too.
11342 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
11343 Enums since those are types too.
11345 * cs-parser.jay (enum_declaration): Record enums as we parse them.
11347 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
11348 thanks to a call during the lookup process.
11350 2002-03-07 Miguel de Icaza <miguel@ximian.com>
11352 * statement.cs (Foreach): Lots of work to accomodate a particular
11353 kind of foreach statement that I had not kept in mind. It is
11354 possible to have foreachs on classes that provide a GetEnumerator
11355 method that return objects that implement the "pattern" for using
11356 a foreach, there is no need to support GetEnumerator
11359 This is needed to compile nant.
11361 * decl.cs: Only report 114 if the member is not `Finalize' and if
11362 the warning level is at least 2.
11364 * class.cs: Moved the compare function from Method to
11367 (MethodSignature.InheritableMemberSignatureCompare): Add new
11368 filter function that is used to extract inheritable methods from a
11371 (Method.Define): Use the new `inheritable_method_signature_filter'
11374 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
11377 2002-03-06 Miguel de Icaza <miguel@ximian.com>
11379 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
11381 * cs-parser.jay: Add opt_semicolon to the interface declaration.
11383 * expression.cs: Pass location information to
11384 ConvertImplicitStandard.
11386 * class.cs: Added debugging code to track return values from
11389 2002-03-05 Miguel de Icaza <miguel@ximian.com>
11391 * expression.cs (Is.DoResolve): If either side of the `is' is an
11392 interface, do not flag the warning.
11394 * ecore.cs (ImplicitReferenceConversion): We need a separate test
11397 * report.cs: Allow for --fatal to be used with --probe.
11399 * typemanager.cs (NoTypes): Move the definition for the empty Type
11402 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
11404 (TypeContainer.DefineProxy): New function used to proxy to parent
11405 implementations when implementing interfaces.
11406 (TypeContainer.ParentImplements): used to lookup if our parent
11407 implements a public function that is required by an interface.
11408 (TypeContainer.VerifyPendingMethods): Hook this up.
11410 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
11411 `modules' and `assemblies' arraylists into arrays. We only grow
11412 these are the very early start up of the program, so this improves
11413 the speedof LookupType (nicely measured).
11415 * expression.cs (MakeByteBlob): Replaced unsafe code with
11416 BitConverter, as suggested by Paolo.
11418 * cfold.cs (ConstantFold.Binary): Special case: perform constant
11419 folding of string concatenation, but if either side is a string,
11420 and the other is not, then return null, and let the runtime use
11421 the concatenation on the string plus the object (using
11422 `Object.ToString').
11424 2002-03-04 Miguel de Icaza <miguel@ximian.com>
11426 Constant Folding has been implemented now.
11428 * expression.cs (Unary.Reduce): Do not throw an exception, catch
11429 the error instead on types that are not supported in one's
11432 * constant.cs (Constant and all children): New set of functions to
11433 perform implict and explicit conversions.
11435 * ecore.cs (EnumConstant): Implement the new functions to perform
11436 conversion by proxying to the child expression.
11438 * codegen.cs: (ConstantCheckState): Constant evaluation has its
11439 own separate setting that can not be turned off from the command
11440 line using --unchecked or --checked and is only controlled using
11441 the checked/unchecked statements and expressions. This setting is
11442 used by the constant folder to flag errors.
11444 * expression.cs (CheckedExpr, UncheckedExpr): Set the
11445 ConstantCheckState as well.
11447 During Resolve, they also have to flag the state, because the
11448 constant folder runs completely in the Resolve phase.
11450 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
11453 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11455 * cfold.cs: New file, this file contains the constant folder.
11457 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
11458 argument to track whether we are using the resulting address to
11459 load or store a value and provide better error messages.
11461 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
11462 new AddressOf arguments.
11464 * statement.cs (Foreach.EmitCollectionForeach): Update
11466 * expression.cs (Argument.Emit): Call AddressOf with proper
11467 arguments to track usage.
11469 (New.DoEmit): Call AddressOf with new arguments.
11471 (Unary.Emit): Adjust AddressOf call.
11473 2002-03-01 Ravi Pratap <ravi@ximian.com>
11475 * cs-parser.jay (member_access): Change the case for pre-defined types
11476 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
11479 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
11482 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
11483 essentially like methods and apply attributes like MethodImplOptions to them too.
11485 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
11488 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
11489 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
11492 * Update code everywhere accordingly.
11494 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
11496 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
11498 2002-02-28 Ravi Pratap <ravi@ximian.com>
11500 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
11501 try performing lookups against those instead of jumping straight into using
11502 the 'using' clauses.
11504 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
11506 (LookupType): Perform lookups in implicit parents too.
11508 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
11509 sequence as RootContext.LookupType.
11511 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
11512 the various cases of namespace lookups into this method.
11514 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11516 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
11517 in positional arguments)
11519 * class.cs (Operator): Update the AllowedModifiers to contain
11522 * cs-parser.jay: Update operator declaration to allow for the
11523 operator body to be empty.
11525 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
11528 2002-02-27 Miguel de Icaza <miguel@ximian.com>
11530 * class.cs (Method.Emit): Label parameters.
11532 * driver.cs: Return 1 or 0 as the program exit code.
11534 2002-02-26 Miguel de Icaza <miguel@ximian.com>
11536 * expression.cs: Special case the `null' object when trying to
11537 auto-compute the type, as anything can be explicitly converted to
11540 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
11541 spotting this Paolo.
11543 (Expression.ImplicitNumericConversion): Perform comparissions of
11544 the type using the underlying type in the case of an enumeration
11545 rather than using the enumeration type for the compare.
11547 Cope with the underlying == type case, which is not possible to
11550 (Expression.ConvertNumericExplicit): Perform comparissions of
11551 the type using the underlying type in the case of an enumeration
11552 rather than using the enumeration type for the compare.
11554 * driver.cs: If the user does not supply an extension, assume .exe
11556 * cs-parser.jay (if_statement): Rewrote so that we can track the
11557 location for the if statement.
11559 * expression.cs (Binary.ConstantFold): Only concat strings when
11560 the operation is "+", not everything ;-)
11562 * statement.cs (Statement.EmitBoolExpression): Take a location
11564 (If, While, Do): Track location.
11566 * expression.cs (Binary.ResolveOperator): In the object + string
11567 case, I was missing a call to ConvertImplicit
11569 2002-02-25 Ravi Pratap <ravi@ximian.com>
11571 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
11572 Location arguments. Ensure we use RootContext.LookupType to do our work
11573 and not try to do a direct Type.GetType and ModuleBuilder.GetType
11575 * interface.cs (PopulateMethod): Handle the type of the parameter being
11578 * expression.cs (Invocation.BetterFunction): Handle the case when we
11579 have a params method with no fixed arguments and a call is made with no
11582 2002-02-25 Miguel de Icaza <miguel@ximian.com>
11584 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
11585 the verbatim-string-literal
11587 * support.cs (InternalParameters.ParameterModifier): handle null
11589 (InternalParameters.ParameterType): ditto.
11591 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
11592 duplicating the name of the variable parameter.
11593 (GetParameterByName): Fix bug where we were not looking up array
11594 paramters if they were the only present (thanks Paolo!).
11595 (GetParameterInfo): We only have an empty set of types if both
11596 fixed and array are set to null.
11597 (GetParameterInfo-idx): Handle FixedParameter == null
11599 * cs-parser.jay: Handle the case where there is no catch
11600 statements (missing null test).
11602 2002-02-22 Miguel de Icaza <miguel@ximian.com>
11604 * driver.cs (MainDriver): Be conservative on our command line
11607 Catch DirectoryNotFoundException when calling GetFiles.
11609 (SplitPathAndPattern): Used to split the input specification into
11610 a path and a pattern that we can feed to Directory.GetFiles.
11612 2002-02-21 Miguel de Icaza <miguel@ximian.com>
11614 * statement.cs (Fixed): Implement the last case of the Fixed
11615 statement (string handling).
11617 * expression.cs (StringPtr): New class used to return a char * to
11618 a string; Used by the Fixed statement.
11620 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
11622 * expression.cs (Binary.ResolveOperator): Remove redundant
11623 MemberLookup pn parent type.
11624 Optimize union call, we do not need a union if the types are the same.
11625 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
11628 Specialize the use of MemberLookup everywhere, instead of using
11629 the default settings.
11631 (StackAlloc): Implement stackalloc keyword.
11633 * cs-parser.jay: Add rule to parse stackalloc.
11635 * driver.cs: Handle /h, /help, /?
11637 * expression.cs (MakeByteBlob): Removed the hacks we had in place
11638 before we supported unsafe code.
11640 * makefile: add --unsafe to the self compilation of mcs.
11642 2002-02-20 Miguel de Icaza <miguel@ximian.com>
11644 * expression.cs (PointerArithmetic): New class that is used to
11645 perform pointer arithmetic.
11646 (Binary.Resolve): Handle pointer arithmetic
11647 Handle pointer comparission.
11648 (ArrayPtr): Utility expression class that is used to take the
11649 address of an array.
11651 (ElementAccess): Implement array access for pointers
11653 * statement.cs (Fixed): Implement fixed statement for arrays, we
11654 are missing one more case before we are done.
11656 * expression.cs (Indirection): Implement EmitAssign and set the
11657 ExprClass to Variable. This allows pointer dereferences to be
11658 treated as variables, and to have values assigned to them.
11660 * ecore.cs (Expression.StoreFromPtr): New utility function to
11661 store values dereferencing.
11663 2002-02-20 Ravi Pratap <ravi@ximian.com>
11665 * expression.cs (Binary.ResolveOperator): Ensure that we are
11666 not trying to operate on a void type - this fixes the reported
11669 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
11670 the parent implementation is sealed.
11672 * ../errors/cs0239.cs : Add.
11674 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
11676 * typemanager.cs (unverifiable_code_type): Corresponds to
11677 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
11678 which have unsafe code in them.
11680 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
11683 2002-02-19 Miguel de Icaza <miguel@ximian.com>
11685 * cs-tokenizer.cs: Add support for @"litreal strings"
11687 Make tokenizer accept pre-processor directives
11688 on any column (remove the old C-like limitation).
11690 * rootcontext.cs (EmitCode): Emit any global attributes.
11691 (AddGlobalAttributes): Used to keep track of assembly attributes.
11693 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
11695 * cs-parser.jay: Add support for global attributes.
11697 2002-02-17 Miguel de Icaza <miguel@ximian.com>
11699 * expression.cs (Indirection): New helper class. Unary will
11700 create Indirection classes to be able to implement the
11701 IMemoryLocation interface on it.
11703 2002-02-16 Miguel de Icaza <miguel@ximian.com>
11705 * cs-parser.jay (fixed_statement): reference the right statement.
11707 * statement.cs (Fixed.Emit): Finish implementing the fixed
11708 statement for the &x case.
11710 2002-02-14 Miguel de Icaza <miguel@ximian.com>
11712 * class.cs (Property.Define, Method.Define): Remove newslot when
11715 * modifiers.cs: My use of NewSlot when `Abstract' was set was
11716 wrong. NewSlot should only be used if the `new' keyword is present.
11718 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
11719 locating our system dir. Sorry about this.
11721 2002-02-13 Miguel de Icaza <miguel@ximian.com>
11723 * driver.cs (GetSystemDir): Compute correctly the location of our
11724 system assemblies. I was using the compiler directory instead of
11725 the library directory.
11727 2002-02-13 Ravi Pratap <ravi@ximian.com>
11729 * expression.cs (BetterFunction): Put back in what Miguel commented out
11730 since it is the correct fix. The problem is elsewhere ;-)
11732 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
11733 parameters of the parms method are themselves compatible or not !
11735 (StandardConversionExists): Fix very dangerous bug where we were forgetting
11736 to check that a class implements an interface before saying that an implicit
11737 conversion was allowed. Use ImplementsInterface to do the checking.
11739 2002-02-13 Miguel de Icaza <miguel@ximian.com>
11741 * class.cs (Method.Define): Track whether we are an explicit
11742 implementation or not. And only call DefineMethodOverride if we
11743 are an explicit implementation.
11745 (Property.DefineMethod): Ditto.
11747 2002-02-11 Ravi Pratap <ravi@ximian.com>
11749 * expression.cs (BetterFunction): Catch hideous bug which was
11750 preventing us from detecting ambiguous calls due to implicit casts i.e
11753 2002-01-29 Miguel de Icaza <miguel@ximian.com>
11755 * support.cs (Pair): Remove un-needed method. I figured why I was
11756 getting the error in cs-parser.jay, the variable in a foreach loop
11757 is readonly, and the compiler does not really treat this as a variable.
11759 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
11760 instead of EQUALS in grammar.
11762 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
11764 * expression.cs (Unary.DoResolve): Check whether the argument is
11767 2002-01-28 Miguel de Icaza <miguel@ximian.com>
11769 * support.cs: Api for Pair to set a value. Despite the fact that
11770 the variables are public the MS C# compiler refuses to compile
11771 code that accesses the field if the variable is part of a foreach
11774 * statement.cs (Fixed): Begin implementation of the fixed
11777 (Block.AddVariable): Return the VariableInfo on success and null
11778 on failure instead of true/false.
11780 * cs-parser.jay (foreach): Catch errors on variables already
11781 defined (we were ignoring this value before) and properly unwind
11782 the block hierarchy
11784 (fixed_statement): grammar for the fixed statement.
11786 2002-01-25 Miguel de Icaza <miguel@ximian.com>
11788 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
11789 pointer types to be incretemented.
11791 (SizeOf): Implement.
11793 * cs-parser.jay (pointer_member_access): Implement
11794 expr->IDENTIFIER production.
11796 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
11797 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
11800 (Unary): Implement indirection.
11802 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
11803 use in non-unsafe context).
11805 (SimpleName.DoResolve): Check for pointers in field access on safe
11808 (Expression.LoadFromPtr): Factor the load-indirect code in this
11809 function. This was duplicated in UnboxCast and ParameterReference
11811 2002-01-24 Miguel de Icaza <miguel@ximian.com>
11813 * expression.cs (ComposedCast): report an error if a pointer cast
11814 is used in a safe region.
11816 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
11817 pointer type casts in unsafe context.
11819 * codegen.cs (EmitContext): Set up IsUnsafe.
11821 * cs-parser.jay (non_expression_type): Add productions for pointer
11824 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
11825 code. We should not use force into static mode if the method is
11826 not virtual. Fixes bug in MIS
11828 * statement.cs (Do.Emit, While.Emit, For.Emit,
11829 Statement.EmitBoolExpression): Add support to Do and While to
11830 propagate infinite loop as `I do return' semantics.
11832 Improve the For case to also test for boolean constants.
11834 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
11835 to the list of attributes we can add.
11837 Remove `EmitContext' argument.
11839 * class.cs (Method.Define): Apply parameter attributes.
11840 (Constructor.Define): Apply parameter attributes.
11841 (MethodCore.LabelParameters): Move here the core of labeling
11844 * support.cs (ReflectionParameters.ParameterModifier,
11845 InternalParameters.ParameterModifier): Use IsByRef on the type and
11846 only return the OUT bit for these parameters instead of in/out/ref
11849 This is because I miss-understood things. The ParameterInfo.IsIn
11850 and IsOut represent whether the parameter has the [In] and [Out]
11853 2002-01-22 Miguel de Icaza <miguel@ximian.com>
11855 * ecore.cs (FieldExpr.Emit): Release temporaries.
11857 * assign.cs (LocalTemporary.Release): new function.
11859 * codegen.cs (EmitContext.GetTemporaryStorage,
11860 EmitContext.FreeTemporaryStorage): Rework the way we deal with
11861 temporary storage. Now we can "put back" localbuilders when we
11864 2002-01-21 Miguel de Icaza <miguel@ximian.com>
11866 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
11867 need to make a copy of the variable to generate verifiable code.
11869 2002-01-19 Miguel de Icaza <miguel@ximian.com>
11871 * driver.cs: Compute dynamically the system directory.
11873 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
11874 Slower, but more generally useful. Used by the abstract
11875 registering implementation.
11877 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
11878 the rules for the special rule on Type/instances. First check if
11879 we have the same name, and if so, try that special static path
11880 rather than the instance path.
11882 2002-01-18 Miguel de Icaza <miguel@ximian.com>
11884 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
11887 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
11888 Enum, ValueType, Delegate or Array for non-corlib compiles.
11890 * cs-tokenizer.cs: Catch long identifiers (645)
11892 * typemanager.cs (IndexerPropetyName): Ravi never tested this
11895 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
11896 fix, we were returning too early, so we were not registering
11897 pending methods from abstract classes.
11899 Do not register pending methods if the class is abstract.
11901 * expression.cs (Conditional.DoResolve): Report circular implicit
11902 conversions when we neecd to compute it for conditional
11905 (Is.DoResolve): If the expression is always of the provided type,
11906 flag warning 183. If the expression can not ever be of the
11907 provided type flag warning 184.
11909 * class.cs: Catch 169 as well.
11911 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
11914 2002-01-18 Nick Drochak <ndrochak@gol.com>
11916 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
11918 2002-01-17 Miguel de Icaza <miguel@ximian.com>
11920 * interface.cs: (PopulateMethod): Check for pointers being defined
11921 only if the unsafe context is active.
11922 (PopulateProperty): ditto.
11923 (PopulateIndexer): ditto.
11925 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
11926 specified. If pointers are present, make sure that they are
11927 present in an unsafe context.
11928 (Constructor, Constructor.Define): ditto.
11929 (Field, Field.Define): ditto.
11930 (Property, Property.Define): ditto.
11931 (Event, Event.Define): ditto.
11933 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
11934 hashtable if there are classes or structs defined.
11936 * expression.cs (LocalVariableReference.DoResolve): Simplify this
11937 code, as the constant resolution moved.
11939 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
11940 the metadata, so we can flag error 133.
11942 * decl.cs (MemberCore.UnsafeOK): New function to test that a
11943 pointer is being declared in an unsafe context.
11945 2002-01-16 Miguel de Icaza <miguel@ximian.com>
11947 * modifiers.cs (Modifiers.Check): Require a Location argument.
11948 Report error 227 for Unsafe use.
11950 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
11952 * statement.cs (For.Emit): If the test is null, then report that
11953 we do `return', as we wont reach anything afterwards.
11955 (Switch.SwitchGoverningType): Track the expression that matched
11958 * driver.cs: Allow negative numbers as an error code to flag.
11960 * cs-parser.jay: Handle 1551.
11962 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
11964 2002-01-15 Miguel de Icaza <miguel@ximian.com>
11966 * cs-parser.jay: Report 1518 (type declaration can only contain
11967 class, struct, interface, enum or delegate)
11969 (switch_label): Report 1523 (keywords `case' or `default' must
11972 (opt_switch_sections): Report 1522 (empty switch)
11974 * driver.cs: Report 1515 (response file specified multiple times)
11975 Report 1516 (Source file specified multiple times).
11977 * expression.cs (Argument.Resolve): Signal 1510
11979 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
11980 access not allowed in static code)
11982 2002-01-11 Ravi Pratap <ravi@ximian.com>
11984 * typemanager.cs (IsPointerType): Utility method which we are going
11987 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
11988 the object type, so we take care of that.
11990 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
11992 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
11993 added to non-params parameters :-)
11995 * typemanager.cs (CSharpName): Include 'void' type too.
11997 (void_ptr_type): Include in the set of core types.
11999 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
12002 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
12005 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
12006 completely forgotten about it.
12008 2002-01-10 Ravi Pratap <ravi@ximian.com>
12010 * cs-parser.jay (pointer_type): Add. This begins our implementation
12011 of parsing rules for unsafe code.
12013 (unsafe_statement): Implement.
12015 (embedded_statement): Modify to include the above.
12017 * statement.cs (Unsafe): Implement new class for unsafe blocks.
12019 * codegen.cs (EmitContext.InUnsafe): Add. This determines
12020 if the current context is an unsafe one.
12022 * cs-parser.jay (local_variable_pointer_type): Since local variable types
12023 are handled differently, we need separate rules for them.
12025 (local_variable_declaration): Update to use local_variable_pointer_type
12026 to allow variable declarations of unmanaged pointer types.
12028 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
12029 in unsafe contexts.
12031 * ../errors/cs0214.cs : Add.
12033 2002-01-16 Nick Drochak <ndrochak@gol.com>
12035 * makefile: remove 'response' file when cleaning.
12037 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12039 * cs-parser.jay: Report 1524.
12041 2002-01-14 Miguel de Icaza <miguel@ximian.com>
12043 * typemanager.cs (RegisterMethod): drop checking if we have
12044 registered this from here
12046 2002-01-12 Miguel de Icaza <miguel@ximian.com>
12048 * class.cs (Method.EmitDestructor): Implement calling our base
12051 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
12052 value of InFinally.
12054 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
12055 this routine and will wrap the call in a try/catch block. Deal
12058 2002-01-11 Miguel de Icaza <miguel@ximian.com>
12060 * ecore.cs (Expression.MemberLookup): instead of taking a
12061 parameter `same_type' that was used to tell whether we could
12062 access private members we compute our containing type from the
12065 (FieldExpr): Added partial support for volatile fields. This does
12066 not work for volatile fields exposed from assemblies, as I can not
12067 figure out how to extract the modreq from it.
12069 Updated all the source files to use this.
12071 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
12072 because it is referenced by MemberLookup very often.
12074 2002-01-09 Ravi Pratap <ravi@ximian.com>
12076 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
12077 TypeBuilder.GetCustomAttributes to retrieve what we need.
12079 Get rid of redundant default_member_attr_type as this is the same as
12080 default_member_type which already exists.
12082 * interface.cs, attribute.cs : Update accordingly.
12084 2002-01-08 Miguel de Icaza <miguel@ximian.com>
12086 * typemanager.cs: Enable IndexerPropertyName again. It does not
12087 work for TYpeBuilders though. Ravi, can you please fix this?
12089 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
12091 * expression.cs (Argument.Emit): Handle the case of ref objects
12092 being passed to ref functions;
12094 (ParameterReference.EmitLoad): Loads the content of the pointer
12095 without dereferencing.
12097 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12099 * cs-tokenizer.cs: Implemented the pre-processing expressions.
12101 2002-01-08 Ravi Pratap <ravi@ximian.com>
12103 * class.cs (Indexer.DefineMethod): Incorporate the interface
12104 type in the name of the method if we are doing explicit interface
12107 * expression.cs (ConversionExists): Remove as it is completely obsolete.
12109 (BetterConversion): Fix extremely trivial bug where we were referring to
12110 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
12113 * ../errors/bug16.cs : Add although we have fixed it.
12115 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12117 * expression.cs (BaseIndexer): Begin implementation.
12119 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
12121 * cs-parser.jay (indexer_declarator): Use qualified_identifier
12122 production directly to remove a shift/reduce, and implement
12123 explicit interface implementation.
12125 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
12126 after a floating point suffix.
12128 * expression.cs (DoNumericPromotions): Improved the conversion for
12129 uint/uint. If we have a constant, we avoid doing a typecast to a
12132 * class.cs (Indexer): Implement explicit interface implementation
12135 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
12137 * class.cs: make the default instance constructor public and hidebysig.
12139 2001-01-03 Ravi Pratap <ravi@ximian.com>
12141 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
12142 so we can call it from elsewhere.
12144 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
12145 we emit it internally if the class has a defined indexer; otherwise the user
12146 emits it by decorating the class definition with the DefaultMemberAttribute.
12148 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
12149 attribute is not used on a type which defines an indexer.
12151 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
12152 character when we skip whitespace.
12154 * ../errors/cs0646.cs : Add.
12156 2002-01-03 Miguel de Icaza <miguel@ximian.com>
12158 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
12161 * makefile: Add practical target `mcs3.exe' which builds the third
12162 generation compiler.
12164 * expression.cs (New): Fix structures constructor calling.
12166 * class.cs (Property, Method, Indexer): Emit Final flag on the
12167 method if we are an interface implementation and we are not
12170 * ecore.cs (PropertyExpr): New public field `IsBase', tells
12171 whether this property is referencing a `base' method.
12173 * expression.cs (Invocation.EmitCall): take an extra argument:
12174 is_base, this is used to determine whether the `call' or
12175 `callvirt' opcode should be used.
12178 * delegate.cs: update EmitCall.
12180 * class.cs (Method.Define): Set NewSlot for the cases where we are
12181 not implementing an interface method.
12183 (Property.Define): ditto.
12185 2002-01-02 Miguel de Icaza <miguel@ximian.com>
12187 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
12188 'r'. Allows mcs to parse itself fully.
12190 2002-01-02 Ravi Pratap <ravi@ximian.com>
12192 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
12193 of the number of initializers that require the InitializeArray method.
12195 (CheckIndices): Store the Expression in all cases - not the plain value. Also
12196 update the above field where necessary.
12198 (MakeByteBlob): Update accordingly.
12200 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
12203 (EmitDynamicInitializers): Update in accordance with the new optimization.
12205 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
12206 same OpCode applies.
12208 * cs-parser.jay : Fix some glaring errors I introduced.
12210 2002-01-01 Ravi Pratap <ravi@ximian.com>
12212 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
12213 so that we can check for name clashes there too.
12215 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
12216 for interface indexers.
12218 * interfaces.cs (Define): Emit the default member attribute.
12220 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
12221 variable was being referred to while setting the value ;-)
12223 2002-01-01 Miguel de Icaza <miguel@ximian.com>
12225 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
12226 byte-by-byte information when we know the data is zero.
12228 Make the block always a multiple of 4, because
12229 DefineInitializedData has a bug.
12231 * assign.cs: Fix, we should assign from the temporary, not from
12234 * expression.cs (MakeByteBlob): Fix my incorrect code.
12236 2001-12-31 Miguel de Icaza <miguel@ximian.com>
12238 * typemanager.cs (EnumToUnderlying): This function is used to get
12239 the underlying type from an enumeration, because it does not
12242 * constant.cs: Use the I4_S form for values between -128 and 127.
12244 * statement.cs (Block.LookupLabel): Looks up a label.
12245 (Block): Drop support for labeled blocks.
12247 (LabeledStatement): New kind of statement that represents a label
12250 (Goto): Finally implement this bad boy.
12252 * cs-parser.jay: Update to reflect new mechanism to implement
12255 2001-12-30 Miguel de Icaza <miguel@ximian.com>
12257 * codegen.cs (EmitContext.This): a codegen property that keeps the
12258 a single instance of this instead of creating many different this
12261 * delegate.cs (Delegate.DoResolve): Update to use the property;
12263 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
12265 * expression.cs (BaseAccess.DoResolve): Ditto.
12267 2001-12-29 Ravi Pratap <ravi@ximian.com>
12269 * typemanager.cs (methodimpl_attr_type): Add to hold the type
12270 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
12272 (InitCoreTypes): Update accordingly.
12274 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
12275 so we can quickly store the state.
12277 (ApplyAttributes): Set the correct implementation flags
12278 for InternalCall methods.
12280 2001-12-29 Miguel de Icaza <miguel@ximian.com>
12282 * expression.cs (EmitCall): if a method is not virtual, then do
12283 not use callvirt on it.
12285 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
12286 user defined stuff) requires the use of stobj, which takes an
12287 address on the stack instead of an array and an index. So emit
12288 the Ldelema operation for it.
12290 (EmitStoreOpcode): Use stobj for valuetypes.
12292 (UnaryMutator.EmitCode): Use the right 1 value depending on
12293 whether we are dealing with int64/uint64, float or doubles.
12295 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
12296 constructors that I implemented last night.
12298 (Constructor.IsDefault): Fix to work properly for static
12301 * cs-parser.jay (CheckDef): report method signature errors.
12302 Update error number 103 to be 132.
12304 * decl.cs: New AdditionResult enumeration value: MethodExists.
12305 Although we do this check for methods later on in the semantic
12306 analysis, catching repeated default constructors is so easy that
12307 we catch these here.
12309 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
12312 (ParameterReference.EmitAssign, Emit): handle
12315 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
12316 (ArrayAccess.EmitStoreOpcode): ditto.
12318 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
12320 * expression.cs (MakeByteBlob): Complete all the missing types
12321 (uint, short, ushort, byte, sbyte)
12323 * class.cs: Only init instance field initializers on instance
12326 Rename `constructors' to instance_constructors.
12328 (TypeContainer.AddConstructor): Only add constructors to the list
12329 if it is not static.
12331 Make sure that we handle default_static_constructor independently
12332 everywhere where we handle instance_constructors
12334 2001-12-28 Miguel de Icaza <miguel@ximian.com>
12336 * class.cs: Do not lookup or create a base initializer for a
12337 static constructor.
12339 (ConstructorInitializer.Resolve): use the proper type to lookup
12342 * cs-parser.jay: Report error 1585 (modifiers between type and name).
12344 * enum.cs, interface.cs: Remove CloseType, this is taken care by
12347 * decl.cs: CloseType is now an virtual method, the default
12348 implementation just closes this type.
12350 2001-12-28 Ravi Pratap <ravi@ximian.com>
12352 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
12353 to PreserveSig by default. Also emit HideBySig on such methods.
12355 Basically, set the defaults to standard values.
12357 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
12358 argument, if candidate is better, it can't be worse than the best !
12360 (Invocation): Re-write bits to differentiate between methods being
12361 applicable in their expanded form and their normal form - for params
12364 Get rid of use_standard everywhere as only standard conversions are allowed
12365 in overload resolution.
12367 More spec conformance.
12369 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12371 * driver.cs: Add --timestamp, to see where the compiler spends
12374 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
12375 `this' in static code.
12377 (SimpleName.DoResolve): Implement in terms of a helper function
12378 that allows static-references to be passed upstream to
12381 (Expression.ResolveWithSimpleName): Resolve specially simple
12382 names when called by MemberAccess to implement the special
12385 (Expression.ImplicitReferenceConversion): Handle conversions from
12386 Null to reference types before others, as Null's type is
12389 * expression.cs (Invocation.EmitCall): Handle the special case of
12390 calling methods declared on a reference type from a ValueType
12391 (Base classes System.Object and System.Enum)
12393 (MemberAccess.Resolve): Only perform lookups on Enumerations if
12394 the left hand side is a TypeExpr, not on every enumeration.
12396 (Binary.Resolve): If types are reference types, then do a cast to
12397 object on operators != and == of both arguments.
12399 * typemanager.cs (FindMembers): Extract instance and static
12400 members if requested.
12402 * interface.cs (PopulateProperty): Use void_type instead of null
12403 as the return type for the setter method.
12405 (PopulateIndexer): ditto.
12407 2001-12-27 Ravi Pratap <ravi@ximian.com>
12409 * support.cs (ReflectionParameters): Fix minor bug where we
12410 were examining the wrong parameter for the ParamArray attribute.
12412 Cope with requests for the type of the parameter at position
12413 greater than the params parameter's. We now return the element
12414 type of the params array as that makes more sense.
12416 * expression.cs (Invocation.IsParamsMethodApplicable): Update
12417 accordingly as we no longer have to extract the element type
12420 (Invocation.OverloadResolve): Update.
12422 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12424 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
12425 against IEnumerator, test whether the return value is a descendant
12426 of the IEnumerator interface.
12428 * class.cs (Indexer.Define): Use an auxiliary method to implement
12429 the other bits of the method definition. Begin support for
12430 explicit interface implementation.
12432 (Property.DefineMethod): Use TypeManager.void_type instead of null
12433 for an empty return value.
12435 2001-12-26 Miguel de Icaza <miguel@ximian.com>
12437 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
12438 dealing with a FieldExpr which is composed of a FieldBuilder, in
12439 the code path we did extract the constant, but we should have
12440 obtained the underlying value to be able to cast it (otherwise we
12441 end up in an infinite loop, this is what Ravi was running into).
12443 (ArrayCreation.UpdateIndices): Arrays might be empty.
12445 (MemberAccess.ResolveMemberAccess): Add support for section
12446 14.5.4.1 that deals with the special case of E.I when E is a type
12447 and something else, that I can be a reference to a static member.
12449 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
12450 handle a particular array type to create byte blobs, it is just
12451 something we dont generate byteblobs for.
12453 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
12456 * location.cs (Push): remove the key from the hashtable that we
12457 are about to add. This happens for empty files.
12459 * driver.cs: Dispose files after we have parsed them.
12461 (tokenize): new function that only runs the tokenizer on its
12462 input, for speed testing.
12464 2001-12-26 Ravi Pratap <ravi@ximian.com>
12466 * class.cs (Event.Define): Define the private field only if there
12467 are no accessors defined.
12469 * expression.cs (ResolveMemberAccess): If there is no associated
12470 field with the event, that means we have an event defined with its
12471 own accessors and we should flag error cs0070 since transforming
12472 ourselves into a field is not valid in that case.
12474 * ecore.cs (SimpleName.DoResolve): Same as above.
12476 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
12477 and charset to sane values.
12479 2001-12-25 Ravi Pratap <ravi@ximian.com>
12481 * assign.cs (DoResolve): Perform check on events only if they
12482 are being accessed outside the declaring type.
12484 * cs-parser.jay (event_declarations): Update rules to correctly
12485 set the type of the implicit parameter etc.
12487 (add_accessor, remove_accessor): Set current local parameters.
12489 * expression.cs (Binary): For delegate addition and subtraction,
12490 cast the return value from the method into the appropriate delegate
12493 2001-12-24 Ravi Pratap <ravi@ximian.com>
12495 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
12496 of these as the workaround is unnecessary.
12498 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
12499 delegate data - none of that is needed at all.
12501 Re-write bits to extract the instance expression and the delegate method
12504 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
12507 * attribute.cs (ApplyAttributes): New method to take care of common tasks
12508 of attaching attributes instead of duplicating code everywhere.
12510 * everywhere : Update code to do attribute emission using the above method.
12512 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12514 * expression.cs (IsParamsMethodApplicable): if there are not
12515 parameters, return immediately.
12517 * ecore.cs: The 0 literal can be implicity converted to an enum
12520 (SimpleName.DoResolve): First lookup the type, then lookup the
12523 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
12524 want to get its address. If the InstanceExpression is not
12525 addressable, store the result in a temporary variable, then get
12528 * codegen.cs: Only display 219 errors on warning level or above.
12530 * expression.cs (ArrayAccess): Make it implement the
12531 IMemoryLocation interface.
12533 (Binary.DoResolve): handle the operator == (object a, object b)
12534 and operator != (object a, object b) without incurring into a
12535 BoxedCast (because 5 != o should never be performed).
12537 Handle binary enumerator operators.
12539 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
12540 value type, otherwise use Ldelem_ref.
12542 Use precomputed names;
12544 (AddressOf): Implement address of
12546 * cs-parser.jay (labeled_statement): Fix recursive block
12547 addition by reworking the production.
12549 * expression.cs (New.DoEmit): New has a special case:
12551 If we are dealing with a ValueType, we have a few
12552 situations to deal with:
12554 * The target of New is a ValueType variable, that is
12555 easy, we just pass this as the variable reference
12557 * The target of New is being passed as an argument,
12558 to a boxing operation or a function that takes a
12561 In this case, we need to create a temporary variable
12562 that is the argument of New.
12565 2001-12-23 Ravi Pratap <ravi@ximian.com>
12567 * rootcontext.cs (LookupType): Check that current_type is not null before
12568 going about looking at nested types.
12570 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
12571 not implement the IAssignMethod interface any more.
12573 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
12574 where we tranform them into FieldExprs if they are being resolved from within
12575 the declaring type.
12577 * ecore.cs (SimpleName.DoResolve): Do the same here.
12579 * assign.cs (DoResolve, Emit): Clean up code considerably.
12581 * ../errors/bug10.cs : Add.
12583 * ../errors/cs0070.cs : Add.
12585 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
12587 * assign.cs : Get rid of EventIsLocal everywhere.
12589 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12591 * ecore.cs (ConvertIntLiteral): finished the implementation.
12593 * statement.cs (SwitchLabel): Convert the value we are using as a
12594 key before looking up the table.
12596 2001-12-22 Miguel de Icaza <miguel@ximian.com>
12598 * codegen.cs (EmitTopBlock): Require a Location argument now.
12600 * cs-parser.jay (constructor_declarator): We need to setup
12601 current_local_parameters before we parse the
12602 opt_constructor_initializer, to allow the variables to be bound
12603 to the constructor arguments.
12605 * rootcontext.cs (LookupType): First lookup nested classes in our
12606 class and our parents before we go looking outside our class.
12608 * expression.cs (ConstantFold): Extract/debox the values at the
12611 * rootcontext.cs (EmitCode): Resolve the constants first before we
12612 resolve the types. This is not really needed, but it helps debugging.
12614 * statement.cs: report location.
12616 * cs-parser.jay: pass location to throw statement.
12618 * driver.cs: Small bug fix.
12620 * report.cs: Updated format to be 4-zero filled digits.
12622 2001-12-22 Ravi Pratap <ravi@ximian.com>
12624 * expression.cs (CheckIndices): Fix minor bug where the wrong
12625 variable was being referred to ;-)
12627 (DoEmit): Do not call EmitStaticInitializers when the
12628 underlying type is System.Object.
12630 2001-12-21 Ravi Pratap <ravi@ximian.com>
12632 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
12633 and do the usual workaround for SRE.
12635 * class.cs (MyEventBuilder.EventType): New member to get at the type
12636 of the event, quickly.
12638 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
12640 * assign.cs (Assign.DoResolve): Handle the case when the target
12641 is an EventExpr and perform the necessary checks.
12643 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
12646 (SimpleName.MemberStaticCheck): Include check for EventExpr.
12648 (EventExpr): Set the type in the constructor itself since we
12649 are meant to be born fully resolved.
12651 (EventExpr.Define): Revert code I wrote earlier.
12653 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
12654 instance expression is null. The instance expression is a This in that case
12655 or a null, depending on whether it is a static method or not.
12657 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
12658 refers to more than one method.
12660 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
12661 and accordingly flag errors.
12663 2001-12-21 Miguel de Icaza <miguel@ximian.com>
12665 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
12667 2001-12-22 Miguel de Icaza <miguel@ximian.com>
12669 * location.cs (ToString): Provide useful rutine.
12671 2001-12-21 Miguel de Icaza <miguel@ximian.com>
12673 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
12674 objects, return the actual integral boxed.
12676 * statement.cs (SwitchLabel): define an ILLabel for each
12679 (Switch.CheckSwitch): If the value is a Literal, extract
12680 the underlying literal.
12682 Also in the unused hashtable we had, add the SwitchLabel so we can
12683 quickly look this value up.
12685 * constant.cs: Implement a bunch of new constants. Rewrite
12686 Literal based on this. Made changes everywhere to adapt to this.
12688 * expression.cs (Expression.MakeByteBlob): Optimize routine by
12689 dereferencing array only once, and also copes with enumrations.
12691 bytes are two bytes wide, not one.
12693 (Cast): Perform constant conversions.
12695 * ecore.cs (TryImplicitIntConversion): Return literals instead of
12696 wrappers to the literals here.
12698 * expression.cs (DoNumericPromotions): long literals can converted
12699 to ulong implicity (this is taken care of elsewhere, but I was
12700 missing this spot).
12702 * ecore.cs (Expression.Literalize): Make the return type Literal,
12703 to improve type checking.
12705 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
12707 2001-12-20 Miguel de Icaza <miguel@ximian.com>
12709 * literal.cs: Revert code from ravi that checked the bounds. The
12710 bounds are sane by the definition of the type itself.
12712 * typemanager.cs: Fix implementation of ImplementsInterface. We
12713 need to actually look up in our parent hierarchy for interfaces
12716 * const.cs: Use the underlying type for enumerations
12718 * delegate.cs: Compute the basename for the delegate creation,
12719 that should fix the delegate test case, and restore the correct
12720 Type Lookup semantics in rootcontext
12722 * rootcontext.cs: Revert Ravi's last patch. The correct way of
12723 referencing a nested type with the Reflection API is using the "+"
12726 * cs-parser.jay: Do not require EOF token at the end.
12728 2001-12-20 Ravi Pratap <ravi@ximian.com>
12730 * rootcontext.cs (LookupType): Concatenate type names with
12731 a '.' instead of a '+' The test suite passes again.
12733 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
12734 field of the enumeration.
12736 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
12737 the case when the member is an EventExpr.
12739 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
12740 static has an associated instance expression.
12742 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
12744 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
12746 * class.cs (Event.Define): Register event and perform appropriate checks
12749 We define the Add and Remove methods even if the use provides none because
12750 in that case, we provide default implementations ourselves.
12752 Define a private field of the type of the event. This is done by the CSC compiler
12753 and we should be doing it too ;-)
12755 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
12756 More methods we use in code we generate.
12758 (multicast_delegate_type, delegate_type): Two separate types since the distinction
12761 (InitCoreTypes): Update accordingly for the above.
12763 * class.cs (Event.Emit): Generate code for default accessors that we provide
12765 (EmitDefaultMethod): Do the job in the above.
12767 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
12770 2001-12-20 Miguel de Icaza <miguel@ximian.com>
12772 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
12773 builders even if we were missing one.
12775 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
12776 pass the Basename as our class name instead of the Name. The
12777 basename will be correctly composed for us.
12779 * parameter.cs (Paramters): Now takes a Location argument.
12781 * decl.cs (DeclSpace.LookupType): Removed convenience function and
12782 make all the code call directly LookupType in RootContext and take
12783 this chance to pass the Location information everywhere.
12785 * Everywhere: pass Location information.
12787 2001-12-19 Miguel de Icaza <miguel@ximian.com>
12789 * class.cs (Constructor.Define): Updated way of detecting the
12790 length of the parameters.
12792 (TypeContainer.DefineType): Use basename as the type name for
12795 (TypeContainer.Define): Do not recursively define types here, as
12796 definition is taken care in order by the RootContext.
12798 * tree.cs: Keep track of namespaces in a per-file basis.
12800 * parameter.cs (Parameter.ComputeSignature): Update to use
12803 (Parameters.GetSignature): ditto.
12805 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
12806 instead of a TypeContainer.
12808 (Interface.SemanticAnalysis): Use `this' instead of our parent to
12809 resolve names. Because we need to be resolve in our context, not
12812 * driver.cs: Implement response files.
12814 * class.cs (TypeContainer.DefineType): If we are defined, do not
12815 redefine ourselves.
12817 (Event.Emit): Emit the code for add/remove handlers.
12818 (Event.Define): Save the MethodBuilders for add/remove.
12820 * typemanager.cs: Use pair here too.
12822 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
12823 DictionaryEntry requires the first argument to be non-null.
12825 (enum_declaration): Compute full name for registering the
12828 (delegate_declaration): Instead of using
12829 formal_parameter_list, use opt_formal_parameter_list as the list
12832 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
12833 (EventParsing): New property that controls whether `add' and
12834 `remove' are returned as tokens or identifiers (for events);
12836 2001-12-19 Ravi Pratap <ravi@ximian.com>
12838 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
12839 use MyEventBuilder only and let it wrap the real builder for us.
12841 (MyEventBuilder): Revamp constructor etc.
12843 Implement all operations that we perform on EventBuilder in precisely the same
12846 (FindMembers): Update to use the EventBuilder member.
12848 (Event.Emit): Update accordingly.
12850 2001-12-18 Ravi Pratap <ravi@ximian.com>
12852 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
12853 by calling the appropriate methods.
12855 (GetCustomAttributes): Make stubs as they cannot possibly do anything
12858 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
12860 2001-12-17 Ravi Pratap <ravi@ximian.com>
12862 * delegate.cs (Delegate.Populate): Check that the return type
12863 and various parameters types are indeed accessible.
12865 * class.cs (Constructor.Define): Same here.
12867 (Field.Define): Ditto.
12869 (Event.Define): Ditto.
12871 (Operator.Define): Check that the underlying Method defined itself
12872 correctly - so it's MethodBuilder should not be null.
12874 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
12875 expression happens to be null.
12877 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
12878 members but as of now we don't seem to be able to do anything really useful with it.
12880 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
12881 not the EventBuilder.
12883 2001-12-18 Miguel de Icaza <miguel@ximian.com>
12885 * cs-tokenizer.cs: Add support for defines.
12886 Add support for #if, #elif, #else, #endif
12888 (eval_var): evaluates a variable.
12889 (eval): stubbed for evaluating functions.
12891 * cs-parser.jay: Pass the defines information
12893 * driver.cs: Add --define command line option.
12895 * decl.cs: Move MemberCore here.
12897 Make it the base class for DeclSpace. This allows us to catch and
12898 report 108 and 109 for everything now.
12900 * class.cs (TypeContainer.Define): Extract all the members
12901 before populating and emit the warning 108 (new keyword required
12902 to override) instead of having each member implement this.
12904 (MemberCore.Define): New abstract method, we will be using this in
12905 the warning reporting engine in Populate.
12907 (Operator.Define): Adjust to new MemberCore protocol.
12909 * const.cs (Const): This does not derive from Expression, it is a
12910 temporary object we use to create fields, it is a MemberCore.
12912 * class.cs (Method.Define): Allow the entry point to be in a
12915 * driver.cs: Rewrite the argument handler to clean it up a bit.
12917 * rootcontext.cs: Made it just an auxiliary namespace feature by
12918 making everything static.
12920 * driver.cs: Adapt code to use RootContext type name instead of
12923 * delegate.cs: Remove RootContext argument.
12925 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
12928 * class.cs (Event.Define): The lookup can fail.
12930 * cs-tokenizer.cs: Begin implementation of pre-procesor.
12932 * expression.cs: Resolve the this instance before invoking the code.
12934 2001-12-17 Miguel de Icaza <miguel@ximian.com>
12936 * cs-parser.jay: Add a production in element_access that allows
12937 the thing to become a "type" reference. This way we can parse
12938 things like "(string [])" as a type.
12940 Note that this still does not handle the more complex rules of
12944 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
12946 * ecore.cs: (CopyNewMethods): new utility function used to
12947 assemble the list of methods from running FindMembers.
12949 (MemberLookup): Rework FindMembers so that
12951 2001-12-16 Miguel de Icaza <miguel@ximian.com>
12953 * class.cs (TypeContainer): Remove Delegates who fail to be
12956 * delegate.cs (Populate): Verify that we dont get null return
12957 values. TODO: Check for AsAccessible.
12959 * cs-parser.jay: Use basename to emit error 574 (destructor should
12960 have the same name as container class), not the full name.
12962 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
12963 possible representation.
12965 Also implements integer type suffixes U and L.
12967 2001-12-15 Miguel de Icaza <miguel@ximian.com>
12969 * expression.cs (ArrayCreation.DoResolve): We need to do the
12970 argument resolution *always*.
12972 * decl.cs: Make this hold the namespace. Hold the root context as
12974 (LookupType): Move here.
12976 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
12978 * location.cs (Row, Name): Fixed the code, it was always returning
12979 references to the first file.
12981 * interface.cs: Register properties defined through interfaces.
12983 * driver.cs: Add support for globbing on the command line
12985 * class.cs (Field): Make it derive from MemberCore as well.
12988 2001-12-15 Ravi Pratap <ravi@ximian.com>
12990 * class.cs (Event::Define): Check that the type of the event is a delegate
12991 type else flag error #66.
12993 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
12996 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
12997 values of EntryPoint, CharSet etc etc.
12999 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
13001 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
13002 be null and we should ignore this. I am not sure if this is really clean. Apparently,
13003 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
13004 which needs this to do its work.
13006 * ../errors/cs0066.cs : Add.
13008 2001-12-14 Miguel de Icaza <miguel@ximian.com>
13010 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
13013 * class.cs: (MethodSignature.MethodSignature): Removed hack that
13014 clears out the parameters field.
13015 (MemberSignatureCompare): Cleanup
13017 (MemberCore): New base class used to share code between MethodCore
13020 (RegisterRequiredImplementations) BindingFlags.Public requires
13021 either BindingFlags.Instace or Static. Use instance here.
13023 (Property): Refactored code to cope better with the full spec.
13025 * parameter.cs (GetParameterInfo): Return an empty array instead
13028 * class.cs (Property): Abstract or extern properties have no bodies.
13030 * parameter.cs (GetParameterInfo): return a zero-sized array.
13032 * class.cs (TypeContainer.MethodModifiersValid): Move all the
13033 method modifier validation to the typecontainer so we can reuse
13034 this on properties.
13036 (MethodCore.ParameterTypes): return an empty sized array of types.
13038 (Property.Define): Test property modifier validity.
13040 Add tests for sealed/override too.
13042 (Method.Emit): abstract or extern methods have no bodies.
13044 2001-12-14 Ravi Pratap <ravi@ximian.com>
13046 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
13049 (Method::Define, ::Emit): Modify accordingly.
13051 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
13053 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
13055 * makefile: Pass in /unsafe.
13057 2001-12-13 Miguel de Icaza <miguel@ximian.com>
13059 * class.cs (MakeKey): Kill routine.
13061 * class.cs (TypeContainer.Define): Correctly define explicit
13062 method implementations (they require the full interface name plus
13065 * typemanager.cs: Deply the PtrHashtable here and stop using the
13066 lame keys. Things work so much better.
13068 This of course broke everyone who depended on `RegisterMethod' to
13069 do the `test for existance' test. This has to be done elsewhere.
13071 * support.cs (PtrHashtable): A hashtable that avoid comparing with
13072 the object stupid Equals method (because, that like fails all over
13073 the place). We still do not use it.
13075 * class.cs (TypeContainer.SetRequiredInterface,
13076 TypeContainer.RequireMethods): Killed these two routines and moved
13077 all the functionality to RegisterRequiredImplementations.
13079 (TypeContainer.RegisterRequiredImplementations): This routine now
13080 registers all the implementations required in an array for the
13081 interfaces and abstract methods. We use an array of structures
13082 which can be computed ahead of time to reduce memory usage and we
13083 also assume that lookups are cheap as most classes will not
13084 implement too many interfaces.
13086 We also avoid creating too many MethodSignatures.
13088 (TypeContainer.IsInterfaceMethod): Update and optionally does not
13089 clear the "pending" bit if we find that there are problems with
13092 (TypeContainer.VerifyPendingMethods): Update to report errors of
13093 methods that look like implementations but are not.
13095 (TypeContainer.Define): Add support for explicit interface method
13098 2001-12-12 Miguel de Icaza <miguel@ximian.com>
13100 * typemanager.cs: Keep track of the parameters here instead of
13101 being a feature of the TypeContainer.
13103 * class.cs: Drop the registration of parameters here, as
13104 InterfaceMethods are also interface declarations.
13106 * delegate.cs: Register methods with the TypeManager not only with
13107 the TypeContainer. This code was buggy.
13109 * interface.cs: Full registation here.
13111 2001-12-11 Miguel de Icaza <miguel@ximian.com>
13113 * expression.cs: Remove reducer for binary expressions, it can not
13116 * const.cs: Put here the code that used to go into constant.cs
13118 * constant.cs: Put here the code for constants, this is a new base
13119 class for Literals.
13121 * literal.cs: Make Literal derive from Constant.
13123 2001-12-09 Miguel de Icaza <miguel@ximian.com>
13125 * statement.cs (Return.Emit): Report error 157 if the user
13126 attempts to return from a finally block.
13128 (Return.Emit): Instead of emitting a return, jump to the end of
13131 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
13132 LocalBuilder to store the result of the function. ReturnLabel is
13133 the target where we jump.
13136 2001-12-09 Radek Doulik <rodo@ximian.com>
13138 * cs-parser.jay: remember alias in current namespace
13140 * ecore.cs (SimpleName::DoResolve): use aliases for types or
13143 * class.cs (LookupAlias): lookup alias in my_namespace
13145 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
13147 (LookupAlias): lookup alias in this and if needed in parent
13150 2001-12-08 Miguel de Icaza <miguel@ximian.com>
13154 * rootcontext.cs: (ModuleBuilder) Made static, first step into
13155 making things static. I need this to avoid passing the
13156 TypeContainer when calling ParameterType.
13158 * support.cs (InternalParameters.ParameterType): Remove ugly hack
13159 that did string manipulation to compute the type and then call
13160 GetType. Use Parameter.ParameterType instead.
13162 * cs-tokenizer.cs: Consume the suffix for floating values.
13164 * expression.cs (ParameterReference): figure out whether this is a
13165 reference parameter or not. Kill an extra variable by computing
13166 the arg_idx during emission.
13168 * parameter.cs (Parameters.GetParameterInfo): New overloaded
13169 function that returns whether a parameter is an out/ref value or not.
13171 (Parameter.ParameterType): The type of the parameter (base,
13172 without ref/out applied).
13174 (Parameter.Resolve): Perform resolution here.
13175 (Parameter.ExternalType): The full type (with ref/out applied).
13177 * statement.cs (Using.Emit, Using.EmitExpression): Implement
13178 support for expressions on the using statement.
13180 2001-12-07 Miguel de Icaza <miguel@ximian.com>
13182 * statement.cs (Using.EmitLocalVariableDecls): Split the
13183 localvariable handling of the using statement.
13185 (Block.EmitMeta): Keep track of variable count across blocks. We
13186 were reusing slots on separate branches of blocks.
13188 (Try.Emit): Emit the general code block, we were not emitting it.
13190 Check the type of the declaration to be an IDisposable or
13191 something that can be implicity converted to it.
13193 Emit conversions if required.
13195 * ecore.cs (EmptyExpression): New utility class.
13196 (Expression.ImplicitConversionExists): New utility function.
13198 2001-12-06 Miguel de Icaza <miguel@ximian.com>
13200 * statement.cs (Using): Implement.
13202 * expression.cs (LocalVariableReference): Support read only variables.
13204 * statement.cs: Remove the explicit emit for the Leave opcode.
13205 (VariableInfo): Add a readonly field.
13207 2001-12-05 Miguel de Icaza <miguel@ximian.com>
13209 * ecore.cs (ConvCast): new class used to encapsulate the various
13210 explicit integer conversions that works in both checked and
13211 unchecked contexts.
13213 (Expression.ConvertNumericExplicit): Use new ConvCast class to
13214 properly generate the overflow opcodes.
13216 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13218 * statement.cs: The correct type for the EmptyExpression is the
13219 element_type, not the variable type. Ravi pointed this out.
13221 2001-12-04 Ravi Pratap <ravi@ximian.com>
13223 * class.cs (Method::Define): Handle PInvoke methods specially
13224 by using DefinePInvokeMethod instead of the usual one.
13226 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
13227 above to do the task of extracting information and defining the method.
13229 2001-12-04 Ravi Pratap <ravi@ximian.com>
13231 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
13232 of the condition for string type.
13234 (Emit): Move that here.
13236 (ArrayCreation::CheckIndices): Keep string literals in their expression
13239 (EmitDynamicInitializers): Handle strings appropriately.
13241 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13243 * codegen.cs (EmitContext): Replace multiple variables with a
13244 single pointer to the current Switch statement.
13246 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
13249 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13253 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
13256 (Foreach.Emit): Foreach on arrays was not setting
13257 up the loop variables (for break/continue).
13259 (GotoCase): Semi-implented.
13261 2001-12-03 Ravi Pratap <ravi@ximian.com>
13263 * attribute.cs (CheckAttribute): Handle system attributes by using
13264 Attribute.GetAttributes to examine information we need.
13266 (GetValidPlaces): Same here.
13268 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
13270 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
13272 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
13274 (Method::Define): Set appropriate flags if we have a DllImport attribute.
13276 (Method::Emit): Handle the case when we are a PInvoke method.
13278 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13280 * expression.cs: Use ResolveWithSimpleName on compound names.
13282 2001-12-02 Ravi Pratap <ravi@ximian.com>
13284 * constant.cs (EmitConstant): Make sure we resolve the associated expression
13285 before trying to reduce it.
13287 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
13289 * constant.cs (LookupConstantValue): Implement.
13291 (EmitConstant): Use the above in emitting the constant.
13293 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
13294 that are user-defined by doing a LookupConstantValue on them.
13296 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
13299 2001-11-29 Miguel de Icaza <miguel@ximian.com>
13301 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
13303 (BaseAccess.DoResolve): Implement.
13305 (MemberAccess.DoResolve): Split this routine into a
13306 ResolveMemberAccess routine that can be used independently
13308 2001-11-28 Miguel de Icaza <miguel@ximian.com>
13310 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
13311 As that share bits of the implementation. Is returns a boolean,
13312 while As returns the Type that is being probed.
13314 2001-12-01 Ravi Pratap <ravi@ximian.com>
13316 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
13317 instead of a Literal - much easier.
13319 (EnumInTransit): Remove - utterly useless :-)
13321 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
13323 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
13325 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
13326 chain when we have no associated expression.
13328 2001-11-30 Ravi Pratap <ravi@ximian.com>
13330 * constant.cs (Define): Use Location while reporting the errror.
13332 Also emit a warning when 'new' is used and there is no inherited
13335 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
13338 (LookupEnumValue): Implement to lookup an enum member's value and define it
13341 (Populate): Re-write accordingly to use the above routine.
13343 2001-11-27 Miguel de Icaza <miguel@ximian.com>
13345 * expression.cs (This): Fix prototype for DoResolveLValue to
13346 override the base class DoResolveLValue.
13348 * cs-parser.cs: Report errors cs574 and cs575 (destructor
13351 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
13352 (we need to load the address of the field here). This fixes
13355 (FieldExpr.DoResolveLValue): Call the DoResolve
13356 function to initialize the Instance expression.
13358 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
13359 correctly the GetEnumerator operation on a value type.
13361 * cs-parser.jay: Add more simple parsing error catches.
13363 * statement.cs (Switch): Add support for string switches.
13364 Handle null specially.
13366 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
13368 2001-11-28 Ravi Pratap <ravi@ximian.com>
13370 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
13372 (declare_local_constant): New helper function.
13374 * statement.cs (AddConstant): Keep a separate record of constants
13376 (IsConstant): Implement to determine if a variable is a constant.
13378 (GetConstantExpression): Implement.
13380 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
13382 * statement.cs (IsVariableDefined): Re-write.
13384 2001-11-27 Ravi Pratap <ravi@ximian.com>
13386 * class.cs (TypeContainer::FindMembers): Look for constants
13387 in the case when we are looking for MemberTypes.Field
13389 * expression.cs (MemberAccess::DoResolve): Check that in the
13390 case we are a FieldExpr and a Literal, we are not being accessed
13391 by an instance reference.
13393 * cs-parser.jay (local_constant_declaration): Implement.
13395 (declaration_statement): Implement for constant declarations.
13397 2001-11-26 Miguel de Icaza <miguel@ximian.com>
13399 * statement.cs (Switch): Catch double defaults.
13401 (Switch): More work on the switch() statement
13402 implementation. It works for integral values now, need to finish
13406 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13408 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
13409 integer literals into other integer literals. To be used by
13412 2001-11-24 Ravi Pratap <ravi@ximian.com>
13414 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
13417 (EmitDynamicInitializers): Cope with the above since we extract data
13418 directly from ArrayData now.
13420 (ExpectInitializers): Keep track of whether initializers are mandatory
13423 (Bounds): Make it a hashtable to prevent the same dimension being
13424 recorded for every element in that dimension.
13426 (EmitDynamicInitializers): Fix bug which prevented the Set array method
13429 Also fix bug which was causing the indices to be emitted in the reverse
13432 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13434 * expression.cs (ArrayCreation): Implement the bits that Ravi left
13435 unfinished. They do not work, because the underlying code is
13438 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13440 * cs-parser.jay: Remove bogus fixme.
13442 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
13443 on Switch statement.
13445 2001-11-23 Ravi Pratap <ravi@ximian.com>
13447 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
13450 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
13451 parameter. Apparently, any expression is allowed.
13453 (ValidateInitializers): Update accordingly.
13455 (CheckIndices): Fix some tricky bugs thanks to recursion.
13457 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
13458 I was being completely brain-dead.
13460 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
13461 and re-write acordingly.
13463 (DelegateInvocation): Re-write accordingly.
13465 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
13467 (MakeByteBlob): Handle types more correctly.
13469 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
13470 initialization from expressions but it is incomplete because I am a complete
13473 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13475 * statement.cs (If.Emit): Fix a bug that generated incorrect code
13476 on If. Basically, we have to return `true' (ie, we do return to
13477 our caller) only if both branches of the if return.
13479 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
13480 short-circuit operators, handle them as short circuit operators.
13482 (Cast.DoResolve): Resolve type.
13483 (Cast.Cast): Take an expression as the target type.
13485 * cs-parser.jay (cast_expression): Remove old hack that only
13486 allowed a limited set of types to be handled. Now we take a
13487 unary_expression and we resolve to a type during semantic
13490 Use the grammar productions from Rhys to handle casts (this is
13491 not complete like Rhys syntax yet, we fail to handle that corner
13492 case that C# has regarding (-x), but we will get there.
13494 2001-11-22 Ravi Pratap <ravi@ximian.com>
13496 * class.cs (EmitFieldInitializer): Take care of the case when we have a
13497 field which is an array type.
13499 * cs-parser.jay (declare_local_variables): Support array initialization too.
13501 * typemanager.cs (MakeKey): Implement.
13503 (everywhere): Use the above appropriately.
13505 * cs-parser.jay (for_statement): Update for array initialization while
13506 declaring variables.
13508 * ecore.cs : The error message was correct, it's the variable's names that
13509 were misleading ;-) Make the code more readable.
13511 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
13512 the correct type etc.
13514 (ConvertExplicit): Handle Enum types by examining the underlying type.
13516 2001-11-21 Ravi Pratap <ravi@ximian.com>
13518 * parameter.cs (GetCallingConvention): Always return
13519 CallingConventions.Standard for now.
13521 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13523 * expression.cs (Binary.ResolveOperator): Update the values of `l'
13524 and `r' after calling DoNumericPromotions.
13526 * ecore.cs: Fix error message (the types were in the wrong order).
13528 * statement.cs (Foreach.ProbeCollectionType): Need to pass
13529 BindingFlags.Instance as well
13531 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
13532 implicit int literal conversion in an empty cast so that we
13533 propagate the right type upstream.
13535 (UnboxCast): new class used to unbox value types.
13536 (Expression.ConvertExplicit): Add explicit type conversions done
13539 (Expression.ImplicitNumericConversion): Oops, forgot to test for
13540 the target type before applying the implicit LongLiterals to ULong
13543 2001-11-21 Miguel de Icaza <miguel@ximian.com>
13545 * cs-parser.jay (for_statement): Reworked the way For works: now
13546 we declare manually any variables that are introduced in
13547 for_initializer to solve the problem of having out-of-band code
13548 emition (that is what got for broken).
13550 (declaration_statement): Perform the actual variable declaration
13551 that used to be done in local_variable_declaration here.
13553 (local_variable_declaration): Do not declare anything, just pass
13554 the information on a DictionaryEntry
13556 2001-11-20 Ravi Pratap <ravi@ximian.com>
13558 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
13559 re-write of the logic to now make it recursive.
13561 (UpdateIndices): Re-write accordingly.
13563 Store element data in a separate ArrayData list in the above methods.
13565 (MakeByteBlob): Implement to dump the array data into a byte array.
13567 2001-11-19 Ravi Pratap <ravi@ximian.com>
13569 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
13572 * constant.cs (Define): Implement.
13574 (EmitConstant): Re-write fully.
13576 Pass in location info.
13578 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
13581 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
13582 DictionaryEntry since we need location info too.
13584 (constant_declaration): Update accordingly.
13586 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
13587 code into another method : UpdateIndices.
13589 2001-11-18 Ravi Pratap <ravi@ximian.com>
13591 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
13592 some type checking etc.
13594 2001-11-17 Ravi Pratap <ravi@ximian.com>
13596 * expression.cs (ArrayCreation::ValidateInitializers): Implement
13597 bits to provide dimension info if the user skips doing that.
13599 Update second constructor to store the rank correctly.
13601 2001-11-16 Ravi Pratap <ravi@ximian.com>
13603 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
13604 and try to implement.
13606 * ../errors/cs0150.cs : Add.
13608 * ../errors/cs0178.cs : Add.
13610 2001-11-16 Miguel de Icaza <miguel@ximian.com>
13612 * statement.cs: Implement foreach on multi-dimensional arrays.
13614 * parameter.cs (Parameters.GetParameterByName): Also lookup the
13615 name of the params argument.
13617 * expression.cs: Use EmitStoreOpcode to get the right opcode while
13618 initializing the array.
13620 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
13621 we can use this elsewhere.
13623 * statement.cs: Finish implementation of foreach for single
13626 * cs-parser.jay: Use an out-of-band stack to pass information
13627 around, I wonder why I need this.
13629 foreach_block: Make the new foreach_block the current_block.
13631 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
13632 function used to return a static Parameters structure. Used for
13633 empty parameters, as those are created very frequently.
13635 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
13637 2001-11-15 Ravi Pratap <ravi@ximian.com>
13639 * interface.cs : Default modifier is private, not public. The
13640 make verify test passes again.
13642 2001-11-15 Ravi Pratap <ravi@ximian.com>
13644 * support.cs (ReflectionParameters): Fix logic to determine
13645 whether the last parameter is a params one. Test 9 passes again.
13647 * delegate.cs (Populate): Register the builders we define with
13648 RegisterParameterForBuilder. Test 19 passes again.
13650 * cs-parser.jay (property_declaration): Reference $6 instead
13651 of $$ to get at the location.
13653 (indexer_declaration): Similar stuff.
13655 (attribute): Ditto.
13657 * class.cs (Property): Register parameters for the Get and Set methods
13658 if they exist. Test 23 passes again.
13660 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
13661 call to EmitArguments as we are sure there aren't any params arguments.
13662 Test 32 passes again.
13664 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
13665 IndexOutOfRangeException.
13667 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
13668 Test 33 now passes again.
13670 2001-11-15 Miguel de Icaza <miguel@ximian.com>
13672 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
13673 broke a bunch of things. Will have to come up with a better way
13674 of tracking locations.
13676 * statement.cs: Implemented foreach for single dimension arrays.
13678 2001-11-09 Miguel de Icaza <miguel@ximian.com>
13680 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
13681 an error. This removes the lookup from the critical path.
13683 * cs-parser.jay: Removed use of temporary_loc, which is completely
13686 2001-11-14 Miguel de Icaza <miguel@ximian.com>
13688 * support.cs (ReflectionParameters.ParameterModifier): Report
13689 whether the argument is a PARAMS argument or not.
13691 * class.cs: Set the attribute `ParamArrayAttribute' on the
13692 parameter argument.
13694 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
13695 and cons_param_array_attribute (ConstructorInfo for
13696 ParamArrayAttribute).,
13698 * codegen.cs: Emit the return using the `Return' statement, that
13699 way we can report the error correctly for missing return values.
13701 * class.cs (Method.Emit): Clean up.
13703 * expression.cs (Argument.Resolve): Take another argument: the
13704 location where this argument is used. Notice that this is not
13705 part of the "Argument" class as to reduce the size of the
13706 structure (we know the approximate location anyways).
13708 Test if the argument is a variable-reference, if not, then
13709 complain with a 206.
13711 (Argument.Emit): Emit addresses of variables.
13713 (Argument.FullDesc): Simplify.
13715 (Invocation.DoResolve): Update for Argument.Resolve.
13717 (ElementAccess.DoResolve): ditto.
13719 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
13720 method should be virtual, as this method is always virtual.
13722 (NewDelegate.DoResolve): Update for Argument.Resolve.
13724 * class.cs (ConstructorInitializer.DoResolve): ditto.
13726 * attribute.cs (Attribute.Resolve): ditto.
13728 2001-11-13 Miguel de Icaza <miguel@ximian.com>
13730 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
13732 * expression.cs (ParameterReference): Drop IStackStorage and implement
13733 IAssignMethod instead.
13735 (LocalVariableReference): ditto.
13737 * ecore.cs (FieldExpr): Drop IStackStorage and implement
13738 IAssignMethod instead.
13740 2001-11-13 Miguel de Icaza <miguel@ximian.com>
13742 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
13743 enumerations that are used in heavily used structures derive from
13744 byte in a laughable and pathetic attempt to reduce memory usage.
13745 This is the kind of pre-optimzations that you should not do at
13746 home without adult supervision.
13748 * expression.cs (UnaryMutator): New class, used to handle ++ and
13749 -- separatedly from the other unary operators. Cleans up the
13750 code, and kills the ExpressionStatement dependency in Unary.
13752 (Unary): Removed `method' and `Arguments' from this class, making
13753 it smaller, and moving it all to SimpleCall, so I can reuse this
13754 code in other locations and avoid creating a lot of transient data
13755 strucutres when not required.
13757 * cs-parser.jay: Adjust for new changes.
13759 2001-11-11 Miguel de Icaza <miguel@ximian.com>
13761 * enum.cs (Enum.Populate): If there is a failure during
13764 * cs-parser.jay (opt_enum_base): we used to catch type errors
13765 here, but this is really incorrect. The type error should be
13766 catched during semantic analysis.
13768 2001-12-11 Ravi Pratap <ravi@ximian.com>
13770 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
13771 current_local_parameters as expected since I, in my stupidity, had forgotten
13774 * attribute.cs (GetValidPlaces): Fix stupid bug.
13776 * class.cs (Method::Emit): Perform check on applicability of attributes.
13778 (Constructor::Emit): Ditto.
13780 (Field::Emit): Ditto.
13782 (Field.Location): Store location information.
13784 (Property, Event, Indexer, Operator): Ditto.
13786 * cs-parser.jay (field_declaration): Pass in location for each field.
13788 * ../errors/cs0592.cs : Add.
13790 2001-11-12 Ravi Pratap <ravi@ximian.com>
13792 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
13794 (InitCoreTypes): Update accordingly.
13796 (RegisterAttrType, LookupAttr): Implement.
13798 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
13799 info about the same.
13801 (Resolve): Update to populate the above as necessary.
13803 (Error592): Helper.
13805 (GetValidPlaces): Helper to the above.
13807 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
13809 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
13811 2001-11-12 Ravi Pratap <ravi@ximian.com>
13813 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
13815 * ../errors/cs0617.cs : Add.
13817 2001-11-11 Ravi Pratap <ravi@ximian.com>
13819 * enum.cs (Emit): Rename to Populate to be more consistent with what
13820 we expect it to do and when exactly it is called.
13822 * class.cs, rootcontext.cs : Update accordingly.
13824 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
13825 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
13827 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
13829 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
13830 of a fieldinfo using the above, when dealing with a FieldBuilder.
13832 2001-11-10 Ravi Pratap <ravi@ximian.com>
13834 * ../errors/cs0031.cs : Add.
13836 * ../errors/cs1008.cs : Add.
13838 * ../errrors/cs0543.cs : Add.
13840 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
13843 (FindMembers): Implement.
13845 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
13846 enums and delegates too.
13848 (enum_types): Rename to builder_to_enum.
13850 (delegate_types): Rename to builder_to_delegate.
13852 * delegate.cs (FindMembers): Implement.
13854 2001-11-09 Ravi Pratap <ravi@ximian.com>
13856 * typemanager.cs (IsEnumType): Implement.
13858 * enum.cs (Emit): Re-write parts to account for the underlying type
13859 better and perform checking etc.
13861 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
13862 of the underlying type.
13864 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
13867 * enum.cs (error31): Helper to report error #31.
13869 * cs-parser.jay (enum_declaration): Store location of each member too.
13871 * enum.cs (member_to_location): New hashtable.
13873 (AddEnumMember): Update location hashtable.
13875 (Emit): Use the location of each member while reporting errors.
13877 2001-11-09 Miguel de Icaza <miguel@ximian.com>
13879 * cs-parser.jay: A for_initializer if is a
13880 local_variable_declaration really ammount to have an implicit
13881 block with the variable declaration and no initializer for for.
13883 * statement.cs (For.Emit): Cope with null initializers.
13885 This fixes the infinite loop on for initializers.
13887 2001-11-08 Miguel de Icaza <miguel@ximian.com>
13889 * enum.cs: More cleanup.
13891 * ecore.cs: Remove dead code.
13893 * class.cs (Property.Emit): More simplification.
13894 (Event.Emit): ditto.
13896 Reworked to have less levels of indentation.
13898 2001-11-08 Ravi Pratap <ravi@ximian.com>
13900 * class.cs (Property): Emit attributes.
13910 * enum.cs (Emit): Ditto.
13912 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
13915 * class.cs (Field, Event, etc.): Move attribute generation into the
13916 Emit method everywhere.
13918 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
13919 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
13920 as we had no way of defining nested enums !
13922 * rootcontext.cs : Adjust code accordingly.
13924 * typemanager.cs (AddEnumType): To keep track of enum types separately.
13926 2001-11-07 Ravi Pratap <ravi@ximian.com>
13928 * expression.cs (EvalConstantExpression): Move into ecore.cs
13930 * enum.cs (Enum): Rename some members and make them public and readonly
13931 according to our convention.
13933 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
13936 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
13938 (Enum::Emit): Write a simple version for now which doesn't try to compute
13939 expressions. I shall modify this to be more robust in just a while.
13941 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
13943 (TypeContainer::CloseType): Create the Enum types too.
13945 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
13947 * expression.cs (EvalConstantExpression): Get rid of completely.
13949 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
13950 user-defined values and other cases.
13952 (IsValidEnumLiteral): Helper function.
13954 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
13955 out there in the case we had a literal FieldExpr.
13957 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
13959 (Literalize): Revamp a bit to take two arguments.
13961 (EnumLiteral): New class which derives from Literal to wrap enum literals.
13963 2001-11-06 Ravi Pratap <ravi@ximian.com>
13965 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
13967 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
13969 (Resolve): Use the above to ensure we have proper initializers.
13971 2001-11-05 Ravi Pratap <ravi@ximian.com>
13973 * expression.cs (Expression::EvalConstantExpression): New method to
13974 evaluate constant expressions.
13976 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
13978 2001-11-07 Miguel de Icaza <miguel@ximian.com>
13980 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
13983 (Binary.ResolveOperator): Handle operator != (object a, object b)
13984 and operator == (object a, object b);
13986 (Binary.DoNumericPromotions): Indicate whether the numeric
13987 promotion was possible.
13989 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
13992 Made the ArrayAccess implement interface IAssignMethod instead of
13993 IStackStore as the order in which arguments are passed reflects
13996 * assign.cs: Instead of using expr.ExprClass to select the way of
13997 assinging, probe for the IStackStore/IAssignMethod interfaces.
13999 * typemanager.cs: Load InitializeArray definition.
14001 * rootcontext.cs (RootContext.MakeStaticData): Used to define
14002 static data that can be used to initialize arrays.
14004 2001-11-05 Miguel de Icaza <miguel@ximian.com>
14006 * expression.cs: Handle operator== and operator!= for booleans.
14008 (Conditioal.Reduce): Implement reducer for the ?: operator.
14010 (Conditional.Resolve): Implement dead code elimination.
14012 (Binary.Resolve): Catch string literals and return a new
14013 concatenated string.
14015 (Unary.Reduce): Implement reduction of unary expressions.
14017 * ecore.cs: Split out the expression core handling here.
14019 (Expression.Reduce): New method used to perform constant folding
14020 and CSE. This is needed to support constant-expressions.
14022 * statement.cs (Statement.EmitBoolExpression): Pass true and false
14023 targets, and optimize for !x.
14025 2001-11-04 Ravi Pratap <ravi@ximian.com>
14027 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
14028 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
14029 set custom atttributes.
14031 * literal.cs (Literal::GetValue): New abstract method to return the actual
14032 value of the literal, cast as an object.
14034 (*Literal): Implement GetValue method.
14036 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
14037 expressions to the arraylist but objects of type Argument.
14039 * class.cs (TypeContainer::Emit): Emit our attributes too.
14041 (Method::Emit, Constructor::Emit): Ditto.
14043 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
14044 to be ignoring earlier.
14046 2001-11-03 Ravi Pratap <ravi@ximian.com>
14048 * attribute.cs (AttributeSection::Define): Implement to do the business
14049 of constructing a CustomAttributeBuilder.
14051 (Attribute): New trivial class. Increases readability of code.
14053 * cs-parser.jay : Update accordingly.
14055 (positional_argument_list, named_argument_list, named_argument): New rules
14057 (attribute_arguments): Use the above so that we are more correct.
14059 2001-11-02 Ravi Pratap <ravi@ximian.com>
14061 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
14062 to perform all checks for a method with a params parameter.
14064 (Invocation::OverloadResolve): Update to use the above method and therefore
14065 cope correctly with params method invocations.
14067 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
14070 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
14071 constructors in our parent too because we can't afford to miss out on
14074 * attribute.cs (AttributeSection): New name for the class Attribute
14076 Other trivial changes to improve readability.
14078 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
14079 use the new class names.
14081 2001-11-01 Ravi Pratap <ravi@ximian.com>
14083 * class.cs (Method::Define): Complete definition for params types too
14085 (Indexer::Define): Ditto.
14087 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
14088 Cope everywhere with a request for info about the array parameter.
14090 2001-11-01 Ravi Pratap <ravi@ximian.com>
14092 * tree.cs (RecordNamespace): Fix up to check for the correct key.
14094 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
14095 local_variable_type to extract the string corresponding to the type.
14097 (local_variable_type): Fixup the action to use the new helper method.
14099 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
14102 * expression.cs : Clean out code which uses the above.
14104 2001-10-31 Ravi Pratap <ravi@ximian.com>
14106 * typemanager.cs (RegisterMethod): Check if we already have an existing key
14107 and bale out if necessary by returning a false.
14109 (RegisterProperty): Ditto.
14111 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
14112 and print out appropriate error messages.
14114 * interface.cs (everywhere): Ditto.
14116 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
14117 location to constructor.
14119 * class.cs (Property, Event, Indexer): Update accordingly.
14121 * ../errors/cs111.cs : Added.
14123 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
14124 of a method, as laid down by the spec.
14126 (Invocation::OverloadResolve): Use the above method.
14128 2001-10-31 Ravi Pratap <ravi@ximian.com>
14130 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
14131 now take a TypeContainer and a Parameters object.
14133 (ParameterData): Modify return type of ParameterModifier method to be
14134 Parameter.Modifier and not a string.
14136 (ReflectionParameters, InternalParameters): Update accordingly.
14138 * expression.cs (Argument::GetParameterModifier): Same here.
14140 * support.cs (InternalParameters::ParameterType): Find a better way of determining
14141 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
14142 symbol in it at all so maybe this is only for now.
14144 2001-10-30 Ravi Pratap <ravi@ximian.com>
14146 * support.cs (InternalParameters): Constructor now takes an extra argument
14147 which is the actual Parameters class.
14149 (ParameterDesc): Update to provide info on ref/out modifiers.
14151 * class.cs (everywhere): Update call to InternalParameters to pass in
14152 the second argument too.
14154 * support.cs (ParameterData): Add ParameterModifier, which is a method
14155 to return the modifier info [ref/out etc]
14157 (InternalParameters, ReflectionParameters): Implement the above.
14159 * expression.cs (Argument::ParameterModifier): Similar function to return
14160 info about the argument's modifiers.
14162 (Invocation::OverloadResolve): Update to take into account matching modifiers
14165 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
14166 a new SetFormalParameters object which we pass to InternalParameters.
14168 2001-10-30 Ravi Pratap <ravi@ximian.com>
14170 * expression.cs (NewArray): Merge into the ArrayCreation class.
14172 2001-10-29 Ravi Pratap <ravi@ximian.com>
14174 * expression.cs (NewArray): Merge classes NewBuiltinArray and
14175 NewUserdefinedArray into one as there wasn't much of a use in having
14178 * expression.cs (Argument): Change field's name to ArgType from Type.
14180 (Type): New readonly property which returns the proper type, taking into
14181 account ref/out modifiers.
14183 (everywhere): Adjust code accordingly for the above.
14185 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
14186 whether we are emitting for a ref or out parameter.
14188 * expression.cs (Argument::Emit): Use the above field to set the state.
14190 (LocalVariableReference::Emit): Update to honour the flag and emit the
14193 * parameter.cs (Attributes): Set the correct flags for ref parameters.
14195 * expression.cs (Argument::FullDesc): New function to provide a full desc.
14197 * support.cs (ParameterData): Add method ParameterDesc to the interface.
14199 (ReflectionParameters, InternalParameters): Implement the above method.
14201 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
14204 (Invocation::FullMethodDesc): Ditto.
14206 2001-10-29 Miguel de Icaza <miguel@ximian.com>
14208 * cs-parser.jay: Add extra production for the second form of array
14211 * expression.cs (ArrayCreation): Update to reflect the above
14214 * Small changes to prepare for Array initialization.
14216 2001-10-28 Miguel de Icaza <miguel@ximian.com>
14218 * typemanager.cs (ImplementsInterface): interface might be null;
14219 Deal with this problem;
14221 Also, we do store negative hits on the cache (null values), so use
14222 this instead of calling t.GetInterfaces on the type everytime.
14224 2001-10-28 Ravi Pratap <ravi@ximian.com>
14226 * typemanager.cs (IsBuiltinType): New method to help determine the same.
14228 * expression.cs (New::DoResolve): Get rid of array creation code and instead
14229 split functionality out into different classes.
14231 (New::FormArrayType): Move into NewBuiltinArray.
14233 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
14236 (NewBuiltinArray): New class to handle creation of built-in arrays.
14238 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
14239 account creation of one-dimensional arrays.
14241 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
14243 (NewUserdefinedArray::DoResolve): Implement.
14245 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
14247 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
14248 we maintain inside the TypeManager. This is necessary to perform lookups on the
14251 (LookupType): Update to perform GetType on the module builders too.
14253 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
14255 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
14257 2001-10-23 Ravi Pratap <ravi@ximian.com>
14259 * expression.cs (New::DoResolve): Implement guts of array creation.
14261 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
14263 2001-10-27 Miguel de Icaza <miguel@ximian.com>
14265 * expression.cs: Fix bug I introduced lsat night that broke
14268 (Expression.Resolve): Report a 246 error (can not resolve name)
14269 if we find a SimpleName in the stream.
14271 (Expression.ResolveLValue): Ditto.
14273 (Expression.ResolveWithSimpleName): This function is a variant of
14274 ResolveName, this one allows SimpleNames to be returned without a
14275 warning. The only consumer of SimpleNames is MemberAccess
14277 2001-10-26 Miguel de Icaza <miguel@ximian.com>
14279 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
14280 might arrive here. I have my doubts that this is correct.
14282 * statement.cs (Lock): Implement lock statement.
14284 * cs-parser.jay: Small fixes to support `lock' and `using'
14286 * cs-tokenizer.cs: Remove extra space
14288 * driver.cs: New flag --checked, allows to turn on integer math
14291 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
14292 Threading.Monitor.Exit
14294 2001-10-23 Miguel de Icaza <miguel@ximian.com>
14296 * expression.cs (IndexerAccess::DoResolveLValue): Set the
14297 Expression Class to be IndexerAccess.
14299 Notice that Indexer::DoResolve sets the eclass to Value.
14301 2001-10-22 Miguel de Icaza <miguel@ximian.com>
14303 * class.cs (TypeContainer::Emit): Emit code for indexers.
14305 * assign.cs (IAssignMethod): New interface implemented by Indexers
14306 and Properties for handling assignment.
14308 (Assign::Emit): Simplify and reuse code.
14310 * expression.cs (IndexerAccess, PropertyExpr): Implement
14311 IAssignMethod, clean up old code.
14313 2001-10-22 Ravi Pratap <ravi@ximian.com>
14315 * typemanager.cs (ImplementsInterface): New method to determine if a type
14316 implements a given interface. Provides a nice cache too.
14318 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
14321 (ConvertReferenceExplicit): Ditto.
14323 * delegate.cs (Delegate::Populate): Update to define the parameters on the
14324 various methods, with correct names etc.
14326 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
14327 Operator.UnaryNegation.
14329 * cs-parser.jay (operator_declarator): Be a little clever in the case where
14330 we have a unary plus or minus operator.
14332 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
14335 * everywhere : update accordingly.
14337 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
14340 * class.cs (Method::Define): For the case where we are implementing a method
14341 inherited from an interface, we need to set the MethodAttributes.Final flag too.
14342 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
14344 2001-10-21 Ravi Pratap <ravi@ximian.com>
14346 * interface.cs (FindMembers): Implement to work around S.R.E
14349 * typemanager.cs (IsInterfaceType): Implement.
14351 (FindMembers): Update to handle interface types too.
14353 * expression.cs (ImplicitReferenceConversion): Re-write bits which
14354 use IsAssignableFrom as that is not correct - it doesn't work.
14356 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
14357 and accordingly override EmitStatement.
14359 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
14360 using the correct logic :-)
14362 2001-10-19 Ravi Pratap <ravi@ximian.com>
14364 * ../errors/cs-11.cs : Add to demonstrate error -11
14366 2001-10-17 Miguel de Icaza <miguel@ximian.com>
14368 * assign.cs (Assign::Resolve): Resolve right hand side first, and
14369 then pass this as a hint to ResolveLValue.
14371 * expression.cs (FieldExpr): Add Location information
14373 (FieldExpr::LValueResolve): Report assignment to readonly
14376 (Expression::ExprClassFromMemberInfo): Pass location information.
14378 (Expression::ResolveLValue): Add new method that resolves an
14381 (Expression::DoResolveLValue): Default invocation calls
14384 (Indexers): New class used to keep track of indexers in a given
14387 (IStackStore): Renamed from LValue, as it did not really describe
14388 what this did. Also ResolveLValue is gone from this interface and
14389 now is part of Expression.
14391 (ElementAccess): Depending on the element access type
14393 * typemanager.cs: Add `indexer_name_type' as a Core type
14394 (System.Runtime.CompilerServices.IndexerNameAttribute)
14396 * statement.cs (Goto): Take a location.
14398 2001-10-18 Ravi Pratap <ravi@ximian.com>
14400 * delegate.cs (Delegate::VerifyDelegate): New method to verify
14401 if two delegates are compatible.
14403 (NewDelegate::DoResolve): Update to take care of the case when
14404 we instantiate a delegate from another delegate.
14406 * typemanager.cs (FindMembers): Don't even try to look up members
14407 of Delegate types for now.
14409 2001-10-18 Ravi Pratap <ravi@ximian.com>
14411 * delegate.cs (NewDelegate): New class to take care of delegate
14414 * expression.cs (New): Split the delegate related code out into
14415 the NewDelegate class.
14417 * delegate.cs (DelegateInvocation): New class to handle delegate
14420 * expression.cs (Invocation): Split out delegate related code into
14421 the DelegateInvocation class.
14423 2001-10-17 Ravi Pratap <ravi@ximian.com>
14425 * expression.cs (New::DoResolve): Implement delegate creation fully
14426 and according to the spec.
14428 (New::DoEmit): Update to handle delegates differently.
14430 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
14431 because of which we were printing out arguments in reverse order !
14433 * delegate.cs (VerifyMethod): Implement to check if the given method
14434 matches the delegate.
14436 (FullDelegateDesc): Implement.
14438 (VerifyApplicability): Implement.
14440 * expression.cs (Invocation::DoResolve): Update to accordingly handle
14441 delegate invocations too.
14443 (Invocation::Emit): Ditto.
14445 * ../errors/cs1593.cs : Added.
14447 * ../errors/cs1594.cs : Added.
14449 * delegate.cs (InstanceExpression, TargetMethod): New properties.
14451 2001-10-16 Ravi Pratap <ravi@ximian.com>
14453 * typemanager.cs (intptr_type): Core type for System.IntPtr
14455 (InitCoreTypes): Update for the same.
14457 (iasyncresult_type, asynccallback_type): Ditto.
14459 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
14462 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
14465 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
14466 the builders for the 4 members of a delegate type :-)
14468 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
14471 * expression.cs (New::DoResolve): Implement guts for delegate creation.
14473 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
14475 2001-10-15 Miguel de Icaza <miguel@ximian.com>
14477 * statement.cs (Break::Emit): Implement.
14478 (Continue::Emit): Implement.
14480 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
14481 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
14482 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
14483 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
14486 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
14487 properties that track the label for the current loop (begin of the
14488 loop and end of the loop).
14490 2001-10-15 Ravi Pratap <ravi@ximian.com>
14492 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
14493 use of emitting anything at all.
14495 * class.cs, rootcontext.cs : Get rid of calls to the same.
14497 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
14499 (Populate): Define the constructor correctly and set the implementation
14502 * typemanager.cs (delegate_types): New hashtable to hold delegates that
14505 (AddDelegateType): Implement.
14507 (IsDelegateType): Implement helper method.
14509 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
14511 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
14512 and accordingly handle it.
14514 * delegate.cs (Populate): Take TypeContainer argument.
14515 Implement bits to define the Invoke method. However, I still haven't figured out
14516 how to take care of the native int bit :-(
14518 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
14519 Qualify the name of the delegate, not its return type !
14521 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
14524 (StandardConversionExists): Checking for array types turns out to be recursive.
14526 (ConvertReferenceExplicit): Implement array conversion.
14528 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
14530 2001-10-12 Ravi Pratap <ravi@ximian.com>
14532 * cs-parser.jay (delegate_declaration): Store the fully qualified
14533 name as it is a type declaration.
14535 * delegate.cs (ReturnType, Name): Rename members to these. Make them
14538 (DefineDelegate): Renamed from Define. Does the same thing essentially,
14539 as TypeContainer::DefineType.
14541 (Populate): Method in which all the definition of the various methods (Invoke)
14544 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
14547 (CloseDelegate): Finally creates the delegate.
14549 * class.cs (TypeContainer::DefineType): Update to define delegates.
14550 (Populate, Emit and CloseType): Do the same thing here too.
14552 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
14553 delegates in all these operations.
14555 2001-10-14 Miguel de Icaza <miguel@ximian.com>
14557 * expression.cs: LocalTemporary: a new expression used to
14558 reference a temporary that has been created.
14560 * assign.cs: Handle PropertyAccess back here, so that we can
14561 provide the proper semantic access to properties.
14563 * expression.cs (Expression::ConvertReferenceExplicit): Implement
14564 a few more explicit conversions.
14566 * modifiers.cs: `NEW' modifier maps to HideBySig.
14568 * expression.cs (PropertyExpr): Make this into an
14569 ExpressionStatement, and support the EmitStatement code path.
14571 Perform get/set error checking, clean up the interface.
14573 * assign.cs: recognize PropertyExprs as targets, and if so, turn
14574 them into toplevel access objects.
14576 2001-10-12 Miguel de Icaza <miguel@ximian.com>
14578 * expression.cs: PropertyExpr::PropertyExpr: use work around the
14581 * typemanager.cs: Keep track here of our PropertyBuilders again to
14582 work around lameness in SRE.
14584 2001-10-11 Miguel de Icaza <miguel@ximian.com>
14586 * expression.cs (LValue::LValueResolve): New method in the
14587 interface, used to perform a second resolution pass for LValues.
14589 (This::DoResolve): Catch the use of this in static methods.
14591 (This::LValueResolve): Implement.
14593 (This::Store): Remove warning, assigning to `this' in structures
14596 (Invocation::Emit): Deal with invocation of
14597 methods on value types. We need to pass the address to structure
14598 methods rather than the object itself. (The equivalent code to
14599 emit "this" for structures leaves the entire structure on the
14600 stack instead of a pointer to it).
14602 (ParameterReference::DoResolve): Compute the real index for the
14603 argument based on whether the method takes or not a `this' pointer
14604 (ie, the method is static).
14606 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
14607 value types returned from functions when we need to invoke a
14608 method on the sturcture.
14611 2001-10-11 Ravi Pratap <ravi@ximian.com>
14613 * class.cs (TypeContainer::DefineType): Method to actually do the business of
14614 defining the type in the Modulebuilder or Typebuilder. This is to take
14615 care of nested types which need to be defined on the TypeBuilder using
14616 DefineNestedMethod.
14618 (TypeContainer::GetClassBases): Implement. Essentially the code from the
14619 methods in RootContext, only ported to be part of TypeContainer.
14621 (TypeContainer::GetInterfaceOrClass): Ditto.
14623 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
14625 * interface.cs (Interface::DefineInterface): New method. Does exactly
14626 what RootContext.CreateInterface did earlier, only it takes care of nested types
14629 (Interface::GetInterfaces): Move from RootContext here and port.
14631 (Interface::GetInterfaceByName): Same here.
14633 * rootcontext.cs (ResolveTree): Re-write.
14635 (PopulateTypes): Re-write.
14637 * class.cs (TypeContainer::Populate): Populate nested types too.
14638 (TypeContainer::Emit): Emit nested members too.
14640 * typemanager.cs (AddUserType): Do not make use of the FullName property,
14641 instead just use the name argument passed in as it is already fully
14644 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
14645 to TypeContainer mapping to see if a type is user-defined.
14647 * class.cs (TypeContainer::CloseType): Implement.
14649 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
14650 the default constructor.
14652 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
14655 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
14657 * interface.cs (CloseType): Create the type here.
14659 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
14662 Remove all the methods which are now in TypeContainer.
14664 2001-10-10 Ravi Pratap <ravi@ximian.com>
14666 * delegate.cs (Define): Re-write bits to define the delegate
14669 2001-10-10 Miguel de Icaza <miguel@ximian.com>
14671 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
14673 * expression.cs (ImplicitReferenceConversion): handle null as well
14674 as a source to convert to any reference type.
14676 * statement.cs (Return): Perform any implicit conversions to
14677 expected return type.
14679 Validate use of return statement.
14681 * codegen.cs (EmitContext): Pass the expected return type here.
14683 * class.cs (Method, Constructor, Property): Pass expected return
14684 type to EmitContext.
14686 2001-10-09 Miguel de Icaza <miguel@ximian.com>
14688 * expression.cs: Make DoResolve take an EmitContext instead of a
14691 Replaced `l' and `location' for `loc', for consistency.
14693 (Error, Warning): Remove unneeded Tc argument.
14695 * assign.cs, literal.cs, constant.cs: Update to new calling
14698 * codegen.cs: EmitContext now contains a flag indicating whether
14699 code is being generated in a static method or not.
14701 * cs-parser.jay: DecomposeQI, new function that replaces the old
14702 QualifiedIdentifier. Now we always decompose the assembled
14703 strings from qualified_identifier productions into a group of
14706 2001-10-08 Miguel de Icaza <miguel@ximian.com>
14708 * rootcontext.cs: Deal with field-less struct types correctly now
14709 by passing the size option to Define Type.
14711 * class.cs: Removed hack that created one static field.
14713 2001-10-07 Miguel de Icaza <miguel@ximian.com>
14715 * statement.cs: Moved most of the code generation here.
14717 2001-10-09 Ravi Pratap <ravi@ximian.com>
14719 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
14722 (ElementAccess): Remove useless bits for now - keep checks as the spec
14725 2001-10-08 Ravi Pratap <ravi@ximian.com>
14727 * expression.cs (ElementAccess::DoResolve): Remove my crap code
14728 and start performing checks according to the spec.
14730 2001-10-07 Ravi Pratap <ravi@ximian.com>
14732 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
14733 rank_specifiers instead.
14735 (rank_specifiers): Change the order in which the rank specifiers are stored
14737 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
14739 * expression.cs (ElementAccess): Implement the LValue interface too.
14741 2001-10-06 Ravi Pratap <ravi@ximian.com>
14743 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
14744 except that user defined conversions are not included.
14746 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
14747 perform the conversion of the return type, if necessary.
14749 (New::DoResolve): Check whether we are creating an array or an object
14750 and accordingly do the needful.
14752 (New::Emit): Same here.
14754 (New::DoResolve): Implement guts of array creation.
14756 (New::FormLookupType): Helper function.
14758 2001-10-07 Miguel de Icaza <miguel@ximian.com>
14760 * codegen.cs: Removed most of the code generation here, and move the
14761 corresponding code generation bits to the statement classes.
14763 Added support for try/catch/finalize and throw.
14765 * cs-parser.jay: Added support for try/catch/finalize.
14767 * class.cs: Catch static methods having the flags override,
14768 virtual or abstract.
14770 * expression.cs (UserCast): This user cast was not really doing
14771 what it was supposed to do. Which is to be born in fully resolved
14772 state. Parts of the resolution were being performed at Emit time!
14776 2001-10-05 Miguel de Icaza <miguel@ximian.com>
14778 * expression.cs: Implicity convert the result from UserCast.
14780 2001-10-05 Ravi Pratap <ravi@ximian.com>
14782 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
14783 prevented it from working correctly.
14785 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
14786 merely ConvertImplicit.
14788 2001-10-05 Miguel de Icaza <miguel@ximian.com>
14790 * typemanager.cs: Make the LookupTypeContainer function static,
14791 and not per-instance.
14793 * class.cs: Make static FindMembers (the one that takes a Type
14796 * codegen.cs: Add EmitForeach here.
14798 * cs-parser.jay: Make foreach a toplevel object instead of the
14799 inline expansion, as we need to perform semantic analysis on it.
14801 2001-10-05 Ravi Pratap <ravi@ximian.com>
14803 * expression.cs (Expression::ImplicitUserConversion): Rename to
14804 UserDefinedConversion.
14806 (Expression::UserDefinedConversion): Take an extra argument specifying
14807 whether we look for explicit user conversions too.
14809 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
14811 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
14813 (ExplicitUserConversion): Make it a call to UserDefinedConversion
14814 with the appropriate arguments.
14816 * cs-parser.jay (cast_expression): Record location too.
14818 * expression.cs (Cast): Record location info.
14820 (Expression::ConvertExplicit): Take location argument.
14822 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
14823 to determine if we are doing explicit conversions.
14825 (UserCast::Emit): Update accordingly.
14827 (Expression::ConvertExplicit): Report an error if everything fails.
14829 * ../errors/cs0030.cs : Add.
14831 2001-10-04 Miguel de Icaza <miguel@ximian.com>
14833 * modifiers.cs: If the ABSTRACT keyword is present, also set the
14834 virtual and newslot bits.
14836 * class.cs (TypeContainer::RegisterRequiredImplementations):
14837 Record methods we need.
14839 (TypeContainer::MakeKey): Helper function to make keys for
14840 MethodBases, since the Methodbase key is useless.
14842 (TypeContainer::Populate): Call RegisterRequiredImplementations
14843 before defining the methods.
14845 Create a mapping for method_builders_to_methods ahead of time
14846 instead of inside a tight loop.
14848 (::RequireMethods): Accept an object as the data to set into the
14849 hashtable so we can report interface vs abstract method mismatch.
14851 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14853 * report.cs: Make all of it static.
14855 * rootcontext.cs: Drop object_type and value_type computations, as
14856 we have those in the TypeManager anyways.
14858 Drop report instance variable too, now it is a global.
14860 * driver.cs: Use try/catch on command line handling.
14862 Add --probe option to debug the error reporting system with a test
14865 * report.cs: Add support for exiting program when a probe
14866 condition is reached.
14868 2001-10-03 Ravi Pratap <ravi@ximian.com>
14870 * expression.cs (Binary::DoNumericPromotions): Fix the case when
14871 we do a forcible conversion regardless of type, to check if
14872 ForceConversion returns a null.
14874 (Binary::error19): Use location to report error.
14876 (Unary::error23): Use location here too.
14878 * ../errors/cs0019.cs : Check in.
14880 * ../errors/cs0023.cs : Check in.
14882 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
14883 case of a non-null MethodInfo object with a length of 0 !
14885 (Binary::ResolveOperator): Flag error if overload resolution fails to find
14886 an applicable member - according to the spec :-)
14887 Also fix logic to find members in base types.
14889 (Unary::ResolveOperator): Same here.
14891 (Unary::report23): Change name to error23 and make first argument a TypeContainer
14892 as I was getting thoroughly confused between this and error19 :-)
14894 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
14895 (::FindMostEncompassedType): Implement.
14896 (::FindMostEncompassingType): Implement.
14897 (::StandardConversionExists): Implement.
14899 (UserImplicitCast): Re-vamp. We now need info about most specific
14900 source and target types so that we can do the necessary conversions.
14902 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
14903 mathematical union with no duplicates.
14905 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14907 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
14908 in order from base classes to child classes, so that we can in
14909 child classes look up in our parent for method names and
14910 attributes (required for handling abstract, virtual, new, override
14911 constructs: we need to instrospect our base class, and if we dont
14912 populate the classes in order, the introspection might be
14913 incorrect. For example, a method could query its parent before
14914 the parent has any methods and would determine that the parent has
14915 no abstract methods (while it could have had them)).
14917 (RootContext::CreateType): Record the order in which we define the
14920 2001-10-02 Miguel de Icaza <miguel@ximian.com>
14922 * class.cs (TypeContainer::Populate): Also method definitions can
14923 fail now, keep track of this.
14925 (TypeContainer::FindMembers): Implement support for
14926 DeclaredOnly/noDeclaredOnly flag.
14928 (Constructor::Emit) Return the ConstructorBuilder.
14930 (Method::Emit) Return the MethodBuilder.
14931 Check for abstract or virtual methods to be public.
14933 * rootcontext.cs (RootContext::CreateType): Register all the
14934 abstract methods required for the class to be complete and the
14935 interface methods that must be implemented.
14937 * cs-parser.jay: Report error 501 (method requires body if it is
14938 not marked abstract or extern).
14940 * expression.cs (TypeOf::Emit): Implement.
14942 * typemanager.cs: runtime_handle_type, new global type.
14944 * class.cs (Property::Emit): Generate code for properties.
14946 2001-10-02 Ravi Pratap <ravi@ximian.com>
14948 * expression.cs (Unary::ResolveOperator): Find operators on base type
14949 too - we now conform exactly to the spec.
14951 (Binary::ResolveOperator): Same here.
14953 * class.cs (Operator::Define): Fix minor quirk in the tests.
14955 * ../errors/cs0215.cs : Added.
14957 * ../errors/cs0556.cs : Added.
14959 * ../errors/cs0555.cs : Added.
14961 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14963 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
14964 single integer which is really efficient
14966 2001-10-01 Ravi Pratap <ravi@ximian.com>
14968 * expression.cs (Expression::ImplicitUserConversion): Use location
14969 even in the case when we are examining True operators.
14971 * class.cs (Operator::Define): Perform extensive checks to conform
14972 with the rules for operator overloading in the spec.
14974 * expression.cs (Expression::ImplicitReferenceConversion): Implement
14975 some of the other conversions mentioned in the spec.
14977 * typemanager.cs (array_type): New static member for the System.Array built-in
14980 (cloneable_interface): For System.ICloneable interface.
14982 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
14983 we start resolving the tree and populating types.
14985 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
14987 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14989 * expression.cs (Expression::ExprClassFromMemberInfo,
14990 Expression::Literalize): Create literal expressions from
14991 FieldInfos which are literals.
14993 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
14994 type casts, because they were wrong. The test suite in tests
14997 (ImplicitNumericConversion): ushort to ulong requires a widening
15000 Int32 constant to long requires widening cast as well.
15002 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
15003 for integers because the type on the stack is not i4.
15005 2001-09-30 Miguel de Icaza <miguel@ximian.com>
15007 * expression.cs (report118): require location argument.
15009 * parameter.cs: Do not dereference potential null value.
15011 * class.cs: Catch methods that lack the `new' keyword when
15012 overriding a name. Report warnings when `new' is used without
15013 anything being there to override.
15015 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
15017 * class.cs: Only add constructor to hashtable if it is non-null
15018 (as now constructors can fail on define).
15020 (TypeManager, Class, Struct): Take location arguments.
15022 Catch field instance initialization in structs as errors.
15024 accepting_filter: a new filter for FindMembers that is static so
15025 that we dont create an instance per invocation.
15027 (Constructor::Define): Catch errors where a struct constructor is
15030 * cs-parser.jay: Pass location information for various new
15033 * delegate.cs (Delegate): take a location argument.
15035 * driver.cs: Do not call EmitCode if there were problesm in the
15036 Definition of the types, as many Builders wont be there.
15038 * decl.cs (Decl::Decl): Require a location argument.
15040 * cs-tokenizer.cs: Handle properly hex constants that can not fit
15041 into integers, and find the most appropiate integer for it.
15043 * literal.cs: Implement ULongLiteral.
15045 * rootcontext.cs: Provide better information about the location of
15046 failure when CreateType fails.
15048 2001-09-29 Miguel de Icaza <miguel@ximian.com>
15050 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
15053 * expression.cs (Binary::CheckShiftArguments): Add missing type
15055 (Binary::ResolveOperator): Add type to the logical and and logical
15056 or, Bitwise And/Or and Exclusive Or code paths, it was missing
15059 (Binary::DoNumericPromotions): In the case where either argument
15060 is ulong (and most signed types combined with ulong cause an
15061 error) perform implicit integer constant conversions as well.
15063 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15065 * expression.cs (UserImplicitCast): Method should always be
15067 (Invocation::BetterConversion): Simplified test for IntLiteral.
15069 (Expression::ImplicitNumericConversion): Split this routine out.
15070 Put the code that performs implicit constant integer conversions
15073 (Expression::Resolve): Become a wrapper around DoResolve so we can
15074 check eclass and type being set after resolve.
15076 (Invocation::Badness): Remove this dead function
15078 (Binary::ResolveOperator): Do not compute the expensive argumnets
15079 unless we have a union for it.
15081 (Probe::Emit): Is needs to do an isinst and then
15082 compare against null.
15084 (::CanConvert): Added Location argument. If the Location argument
15085 is null (Location.Null), then we do not report errors. This is
15086 used by the `probe' mechanism of the Explicit conversion. We do
15087 not want to generate an error for something that the user
15088 explicitly requested to be casted. But the pipeline for an
15089 explicit cast first tests for potential implicit casts.
15091 So for now, if the Location is null, it means `Probe only' to
15092 avoid adding another argument. Might have to revise this
15095 (ClassCast): New class used to type cast objects into arbitrary
15096 classes (used in Explicit Reference Conversions).
15098 Implement `as' as well.
15100 Reverted all the patches from Ravi below: they were broken:
15102 * The use of `level' as a mechanism to stop recursive
15103 invocations is wrong. That was there just to catch the
15104 bug with a strack trace but not as a way of addressing
15107 To fix the problem we have to *understand* what is going
15108 on and the interactions and come up with a plan, not
15109 just get things going.
15111 * The use of the type conversion cache that I proposed
15112 last night had an open topic: How does this work across
15113 protection domains. A user defined conversion might not
15114 be public in the location where we are applying the
15115 conversion, a different conversion might be selected
15116 (ie, private A->B (better) but public B->A (worse),
15117 inside A, A->B applies, but outside it, B->A will
15120 * On top of that (ie, even if the above is solved),
15121 conversions in a cache need to be abstract. Ie, `To
15122 convert from an Int to a Short use an OpcodeCast', not
15123 `To convert from an Int to a Short use the OpcodeCast on
15124 the variable 5' (which is what this patch was doing).
15126 2001-09-28 Ravi Pratap <ravi@ximian.com>
15128 * expression.cs (Invocation::ConversionExists): Re-write to use
15129 the conversion cache
15131 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
15132 cache all conversions done, not just user-defined ones.
15134 (Invocation::BetterConversion): The real culprit. Use ConversionExists
15135 to determine if a conversion exists instead of acutually trying to
15136 perform the conversion. It's faster too.
15138 (Expression::ConvertExplicit): Modify to use ConversionExists to check
15139 and only then attempt the implicit conversion.
15141 2001-09-28 Ravi Pratap <ravi@ximian.com>
15143 * expression.cs (ConvertImplicit): Use a cache for conversions
15144 already found. Check level of recursion and bail out if necessary.
15146 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15148 * typemanager.cs (string_concat_string_string, string_concat_object_object):
15149 Export standard methods that we expect for string operations.
15151 * statement.cs (Block::UsageWarning): Track usage of variables and
15152 report the errors for not used variables.
15154 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
15157 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15159 * codegen.cs: remove unnneded code
15161 * expression.cs: Removed BuiltinTypeAccess class
15163 Fix the order in which implicit conversions are
15166 The previous fixed dropped support for boxed conversions (adding a
15167 test to the test suite now)
15169 (UserImplicitCast::CanConvert): Remove test for source being null,
15170 that code is broken. We should not feed a null to begin with, if
15171 we do, then we should track the bug where the problem originates
15172 and not try to cover it up here.
15174 Return a resolved expression of type UserImplicitCast on success
15175 rather than true/false. Ravi: this is what I was talking about,
15176 the pattern is to use a static method as a "constructor" for
15179 Also, do not create arguments until the very last minute,
15180 otherwise we always create the arguments even for lookups that
15181 will never be performed.
15183 (UserImplicitCast::Resolve): Eliminate, objects of type
15184 UserImplicitCast are born in a fully resolved state.
15186 * typemanager.cs (InitCoreTypes): Init also value_type
15187 (System.ValueType).
15189 * expression.cs (Cast::Resolve): First resolve the child expression.
15191 (LValue): Add new method AddressOf to be used by
15194 Change the argument of Store to take an EmitContext instead of an
15195 ILGenerator, because things like FieldExpr need to be able to call
15196 their children expression to generate the instance code.
15198 (Expression::Error, Expression::Warning): Sugar functions for
15201 (Expression::MemberLookup): Accept a TypeContainer instead of a
15202 Report as the first argument.
15204 (Expression::ResolvePrimary): Killed. I still want to improve
15205 this as currently the code is just not right.
15207 (Expression::ResolveMemberAccess): Simplify, but it is still
15210 (Unary::Resolve): Catch errors in AddressOf operators.
15212 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
15213 index to a byte for the short-version, or the compiler will choose
15214 the wrong Emit call, which generates the wrong data.
15216 (ParameterReference::Emit, ::Store): same.
15218 (FieldExpr::AddressOf): Implement.
15220 * typemanager.cs: TypeManager: made public variable instead of
15223 * driver.cs: document --fatal.
15225 * report.cs (ErrorMessage, WarningMessage): new names for the old
15226 Error and Warning classes.
15228 * cs-parser.jay (member_access): Turn built-in access to types
15229 into a normal simplename
15231 2001-09-27 Ravi Pratap <ravi@ximian.com>
15233 * expression.cs (Invocation::BetterConversion): Fix to cope
15234 with q being null, since this was introducing a bug.
15236 * expression.cs (ConvertImplicit): Do built-in conversions first.
15238 2001-09-27 Ravi Pratap <ravi@ximian.com>
15240 * expression.cs (UserImplicitCast::Resolve): Fix bug.
15242 2001-09-27 Ravi Pratap <ravi@ximian.com>
15244 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15245 I had introduced long ago (what's new ?).
15247 * expression.cs (UserImplicitCast::CanConvert): Static method to do
15248 the work of all the checking.
15249 (ConvertImplicit): Call CanConvert and only then create object if necessary.
15250 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
15252 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
15253 that is the right way.
15255 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
15256 overloading resolution. Use everywhere instead of cutting and pasting code.
15258 (Binary::ResolveOperator): Use MakeUnionSet.
15260 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
15261 we have to convert to bool types. Not complete yet.
15263 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15265 * typemanager.cs (TypeManager::CSharpName): support ushort.
15267 * expression.cs (Expression::TryImplicitIntConversion): Attempts
15268 to provide an expression that performsn an implicit constant int
15269 conversion (section 6.1.6).
15270 (Expression::ConvertImplicitRequired): Reworked to include
15271 implicit constant expression conversions.
15273 (Expression::ConvertNumericExplicit): Finished.
15275 (Invocation::Emit): If InstanceExpression is null, then it means
15276 that we perform a call on this.
15278 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15280 * expression.cs (Unary::Emit): Remove some dead code.
15281 (Probe): Implement Resolve and Emit for `is'.
15282 (Expression::ConvertImplicitRequired): Attempt to do constant
15283 expression conversions here. Maybe should be moved to
15284 ConvertImplicit, but I am not sure.
15285 (Expression::ImplicitLongConstantConversionPossible,
15286 Expression::ImplicitIntConstantConversionPossible): New functions
15287 that tell whether is it possible to apply an implicit constant
15288 expression conversion.
15290 (ConvertNumericExplicit): Started work on explicit numeric
15293 * cs-parser.jay: Update operator constants.
15295 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
15296 (Parameters::GetSignature): Hook up VerifyArgs here.
15297 (Parameters::VerifyArgs): Verifies that no two arguments have the
15300 * class.cs (Operator): Update the operator names to reflect the
15301 ones that the spec expects (as we are just stringizing the
15304 * expression.cs (Unary::ResolveOperator): Fix bug: Use
15305 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
15306 previous usage did only work for our methods.
15307 (Expression::ConvertImplicit): Handle decimal implicit numeric
15308 conversions as well.
15309 (Expression::InternalTypeConstructor): Used to invoke constructors
15310 on internal types for default promotions.
15312 (Unary::Emit): Implement special handling for the pre/post
15313 increment/decrement for overloaded operators, as they need to have
15314 the same semantics as the other operators.
15316 (Binary::ResolveOperator): ditto.
15317 (Invocation::ConversionExists): ditto.
15318 (UserImplicitCast::Resolve): ditto.
15320 2001-09-26 Ravi Pratap <ravi@ximian.com>
15322 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
15323 operator, return after emitting body. Regression tests pass again !
15325 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
15326 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
15327 (Invocation::OverloadResolve): Ditto.
15328 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
15330 * everywhere : update calls to the above methods accordingly.
15332 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15334 * assign.cs (Assign): Make it inherit from ExpressionStatement.
15336 * expression.cs (ExpressionStatement): New base class used for
15337 expressions that can appear in statements, so that we can provide
15338 an alternate path to generate expression that do not leave a value
15341 (Expression::Emit, and all the derivatives): We no longer return
15342 whether a value is left on the stack or not. Every expression
15343 after being emitted leaves a single value on the stack.
15345 * codegen.cs (EmitContext::EmitStatementExpression): Use the
15346 facilties of ExpressionStatement if possible.
15348 * cs-parser.jay: Update statement_expression.
15350 2001-09-25 Miguel de Icaza <miguel@ximian.com>
15352 * driver.cs: Change the wording of message
15354 2001-09-25 Ravi Pratap <ravi@ximian.com>
15356 * expression.cs (Binary::ResolveOperator): Had forgottten to set
15357 the type of the expression to the return type of the method if
15358 we have an overloaded operator match ! The regression tests pass again !
15359 (Unary::ResolveOperator): Ditto.
15361 * expression.cs (Invocation::ConversionExists): Correct the member lookup
15362 to find "op_Implicit", not "implicit" ;-)
15363 (UserImplicitCast): New class to take care of user-defined implicit conversions.
15364 (ConvertImplicit, ForceConversion): Take TypeContainer argument
15366 * everywhere : Correct calls to the above accordingly.
15368 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
15369 (ConvertImplicit): Do user-defined conversion if it exists.
15371 2001-09-24 Miguel de Icaza <miguel@ximian.com>
15373 * assign.cs: track location.
15374 (Resolve): Use implicit conversions on assignment.
15376 * literal.cs: Oops. Not good, Emit of short access values should
15377 pass (Bytes) or the wrong argument will be selected.
15379 * expression.cs (Unary::Emit): Emit code for -expr.
15381 (Unary::ResolveOperator): Handle `Substract' for non-constants
15382 (substract from zero from the non-constants).
15383 Deal with Doubles as well.
15385 (Expression::ConvertImplicitRequired): New routine that reports an
15386 error if no implicit conversion exists.
15388 (Invocation::OverloadResolve): Store the converted implicit
15389 expressions if we make them
15391 2001-09-24 Ravi Pratap <ravi@ximian.com>
15393 * class.cs (ConstructorInitializer): Take a Location argument.
15394 (ConstructorBaseInitializer): Same here.
15395 (ConstructorThisInitializer): Same here.
15397 * cs-parser.jay : Update all calls accordingly.
15399 * expression.cs (Unary, Binary, New): Take location argument.
15400 Update accordingly everywhere.
15402 * cs-parser.jay : Update all calls to the above to take a location
15405 * class.cs : Ditto.
15407 2001-09-24 Ravi Pratap <ravi@ximian.com>
15409 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
15410 (Invocation::BetterConversion): Same here
15411 (Invocation::ConversionExists): Ditto.
15413 (Invocation::ConversionExists): Implement.
15415 2001-09-22 Ravi Pratap <ravi@ximian.com>
15417 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
15418 Also take an additional TypeContainer argument.
15420 * All over : Pass in TypeContainer as argument to OverloadResolve.
15422 * typemanager.cs (CSharpName): Update to check for the string type and return
15425 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
15428 2001-09-21 Ravi Pratap <ravi@ximian.com>
15430 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
15431 (Invocation::BetterFunction): Implement.
15432 (Invocation::BetterConversion): Implement.
15433 (Invocation::ConversionExists): Skeleton, no implementation yet.
15435 Okay, things work fine !
15437 2001-09-21 Miguel de Icaza <miguel@ximian.com>
15439 * typemanager.cs: declare and load enum_type, delegate_type and
15442 * expression.cs (Expression::Emit): Now emit returns a value that
15443 tells whether a value is left on the stack or not. This strategy
15444 might be reveted tomorrow with a mechanism that would address
15445 multiple assignments.
15446 (Expression::report118): Utility routine to report mismatches on
15449 (Unary::Report23): Report impossible type/operator combination
15452 (Unary::IsIncrementableNumber): Whether the type can be
15453 incremented or decremented with add.
15454 (Unary::ResolveOperator): Also allow enumerations to be bitwise
15456 (Unary::ResolveOperator): Implement ++, !, ~,
15458 (Invocation::Emit): Deal with new Emit convetion.
15460 * All Expression derivatives: Updated their Emit method to return
15461 whether they leave values on the stack or not.
15463 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
15464 stack for expressions that are statements.
15466 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15468 * expression.cs (LValue): New interface. Must be implemented by
15470 (LocalVariableReference, ParameterReference, FieldExpr): Implement
15473 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
15474 interface for generating code, simplifies the code.
15476 2001-09-20 Ravi Pratap <ravi@ximian.com>
15478 * expression.cs (everywhere): Comment out return statements in ::Resolve
15479 methods to avoid the warnings.
15481 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15483 * driver.cs (parse): Report error 2001 if we can not open the
15486 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
15489 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
15492 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
15493 otherwise nested blocks end up with the same index.
15495 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
15497 * expression.cs: Instead of having FIXMEs in the Resolve
15498 functions, throw exceptions so it is obvious that we are facing a
15501 * cs-parser.jay (invocation_expression): Pass Location information.
15503 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
15504 Use a basename for those routines because .NET does not like paths
15507 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
15510 2001-09-19 Miguel de Icaza <miguel@ximian.com>
15512 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
15513 are loading the correct data types (throws an exception if not).
15514 (TypeManager::InitCoreTypes): Use CoreLookupType
15516 * expression.cs (Unary::ResolveOperator): return the child
15517 expression for expressions which are just +expr.
15518 (Unary::ResolveOperator): Return negative literals for -LITERAL
15519 expressions (otherwise they are Unary {Literal}).
15520 (Invocation::Badness): Take into account `Implicit constant
15521 expression conversions'.
15523 * literal.cs (LongLiteral): Implement long literal class.
15524 (IntLiteral): export the `Value' of the intliteral.
15526 2001-09-19 Ravi Pratap <ravi@ximian.com>
15528 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
15530 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
15531 instead of 'Operator'
15533 * expression.cs (Binary::ResolveOperator): Update accordingly.
15534 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
15537 * cs-parser.jay (unary_expression): Update to use the new names.
15539 * gen-treedump.cs (GetUnary): Same here.
15541 * expression.cs (Unary::Resolve): Implement.
15542 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
15543 operators are found instead of making noise ;-)
15544 (Unary::ResolveOperator): New method to do precisely the same thing which
15545 Binary::ResolveOperator does for Binary expressions.
15546 (Unary.method, .Arguments): Add.
15547 (Unary::OperName): Implement.
15548 (Unary::ForceConversion): Copy and Paste !
15550 * class.cs (Operator::Define): Fix a small bug for the case when we have
15553 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
15554 for the inbuilt operators. Only overloading works for now ;-)
15556 2001-09-18 Miguel de Icaza <miguel@ximian.com>
15558 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
15559 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
15561 * expression.cs (This::Emit): Implement.
15562 (This::Resolve): Implement.
15563 (TypeOf:Resolve): Implement.
15564 (Expression::ResolveSimpleName): Add an implicit this to instance
15566 (MemberAccess::Resolve): Deal with Parameters and Fields.
15567 Bind instance variable to Field expressions.
15568 (FieldExpr::Instance): New field used to track the expression that
15569 represents the object instance.
15570 (FieldExpr::Resolve): Track potential errors from MemberLookup not
15572 (FieldExpr::Emit): Implement.
15574 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
15575 the last instruction contains a return opcode to avoid generating
15576 the last `ret' instruction (this generates correct code, and it is
15577 nice to pass the peverify output).
15579 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
15580 initializer for static and instance variables.
15581 (Constructor::Emit): Allow initializer to be null in the case of
15582 static constructors. Only emit initializer for instance
15585 (TypeContainer::FindMembers): Return a null array if there are no
15588 Also fix the code for the MemberTypes.Method branch, as it was not
15589 scanning that for operators (or tried to access null variables before).
15591 * assign.cs (Assign::Emit): Handle instance and static fields.
15595 * driver.cs: Stop compilation if there are parse errors.
15597 * cs-parser.jay (constructor_declaration): Provide default base
15598 initializer for non-static constructors.
15599 (constructor_declarator): Do not provide a default base
15600 initializers if none was specified.
15601 Catch the fact that constructors should not have parameters.
15603 * class.cs: Do not emit parent class initializers for static
15604 constructors, that should be flagged as an error.
15606 2001-09-18 Ravi Pratap <ravi@ximian.com>
15608 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
15609 Move back code into TypeContainer::Populate.
15611 2001-09-18 Ravi Pratap <ravi@ximian.com>
15613 * class.cs (TypeContainer::AddConstructor): Fix the check to
15614 compare against Name, not Basename.
15615 (Operator::OpType): Change Plus and Minus to Add and Subtract.
15617 * cs-parser.jay : Update accordingly.
15619 * class.cs (TypeContainer::FindMembers): For the case where we are searching
15620 for methods, don't forget to look into the operators too.
15621 (RegisterMethodBuilder): Helper method to take care of this for
15622 methods, constructors and operators.
15623 (Operator::Define): Completely revamp.
15624 (Operator.OperatorMethod, MethodName): New fields.
15625 (TypeContainer::Populate): Move the registering of builders into
15626 RegisterMethodBuilder.
15627 (Operator::Emit): Re-write.
15629 * expression.cs (Binary::Emit): Comment out code path to emit method
15630 invocation stuff for the case when we have a user defined operator. I am
15631 just not able to get it right !
15633 2001-09-17 Miguel de Icaza <miguel@ximian.com>
15635 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
15638 (Expression::MemberLookup): Provide a version that allows to
15639 specify the MemberTypes and BindingFlags.
15641 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
15642 so it was not fetching variable information from outer blocks.
15644 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
15645 Beforefieldinit as it was buggy.
15647 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
15648 that Ravi put here.
15650 * class.cs (Constructor::Emit): Only emit if block is not null.
15651 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
15652 deal with this by semantically definining it as if the user had
15655 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
15656 constructors as we now "emit" them at a higher level.
15658 (TypeContainer::DefineDefaultConstructor): Used to define the
15659 default constructors if none was provided.
15661 (ConstructorInitializer): Add methods Resolve and Emit.
15663 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
15665 2001-09-17 Ravi Pratap <ravi@ximian.com>
15667 * class.cs (TypeContainer::EmitDefaultConstructor): Register
15668 the default constructor builder with our hashtable for methodbuilders
15671 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
15672 and argument_count is 0 in which case we have a match.
15673 (Binary::ResolveOperator): More null checking and miscellaneous coding
15676 2001-09-17 Ravi Pratap <ravi@ximian.com>
15678 * rootcontext.cs (IsNameSpace): Compare against null.
15680 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
15682 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
15683 and Unary::Operator.
15685 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
15688 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
15689 we have overloaded operators.
15690 (Binary::ResolveOperator): Implement the part which does the operator overload
15693 * class.cs (Operator::Emit): Implement.
15694 (TypeContainer::Emit): Emit the operators we have too.
15696 * expression.cs (Binary::Emit): Update to emit the appropriate code for
15697 the case when we have a user-defined operator.
15699 2001-09-17 Miguel de Icaza <miguel@ximian.com>
15701 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
15703 2001-09-16 Ravi Pratap <ravi@ximian.com>
15705 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
15706 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
15707 (Constructor::Emit): Implement.
15708 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
15709 if we have no work to do.
15710 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
15713 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
15714 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
15716 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
15719 2001-09-15 Ravi Pratap <ravi@ximian.com>
15721 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
15723 (Tree::RecordNamespace): Method to do what the name says ;-)
15724 (Tree::Namespaces): Property to get at the namespaces hashtable.
15726 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
15729 * rootcontext.cs (IsNamespace): Fixed it :-)
15731 2001-09-14 Miguel de Icaza <miguel@ximian.com>
15733 * class.cs (TypeContainer::FindMembers): Add support for
15735 (MethodCore): New class that encapsulates both the shared aspects
15736 of a Constructor and a Method.
15737 (Method, Constructor): Factored pieces into MethodCore.
15739 * driver.cs: Added --fatal which makes errors throw exceptions.
15740 Load System assembly as well as part of the standard library.
15742 * report.cs: Allow throwing exceptions on errors for debugging.
15744 * modifiers.cs: Do not use `parent', instead use the real type
15745 container to evaluate permission settings.
15747 * class.cs: Put Ravi's patch back in. He is right, and we will
15748 have to cope with the
15750 2001-09-14 Ravi Pratap <ravi@ximian.com>
15752 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
15753 FamORAssem, not FamANDAssem.
15755 2001-09-14 Miguel de Icaza <miguel@ximian.com>
15757 * driver.cs: Added --parse option that only parses its input files
15760 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
15761 incorrect. IsTopLevel is not used to tell whether an object is
15762 root_types or not (that can be achieved by testing this ==
15763 root_types). But to see if this is a top-level *class* (not
15764 necessarly our "toplevel" container).
15766 2001-09-14 Ravi Pratap <ravi@ximian.com>
15768 * enum.cs (Enum::Define): Modify to call the Lookup method on the
15769 parent instead of a direct call to GetType.
15771 2001-09-14 Ravi Pratap <ravi@ximian.com>
15773 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
15774 Modifiers.TypeAttr. This should just be a call to that method.
15776 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
15777 object so that we can determine if we are top-level or not.
15779 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
15782 * enum.cs (Enum::Define): Ditto.
15784 * modifiers.cs (FieldAttr): Re-write.
15786 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
15787 (TypeContainer::HaveStaticConstructor): New property to provide access
15788 to precisely that info.
15790 * modifiers.cs (MethodAttr): Re-write.
15791 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
15793 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
15794 of top-level types as claimed.
15796 2001-09-13 Miguel de Icaza <miguel@ximian.com>
15798 * expression.cs (MemberLookup): Fruitless attempt to lookup
15799 constructors. Maybe I need to emit default constructors? That
15800 might be it (currently .NET emits this for me automatically).
15801 (Invocation::OverloadResolve): Cope with Arguments == null.
15802 (Invocation::EmitArguments): new function, shared by the new
15803 constructor and us.
15804 (Invocation::Emit): Handle static and instance methods. Emit
15805 proper call instruction for virtual or non-virtual invocations.
15806 (New::Emit): Implement.
15807 (New::Resolve): Implement.
15808 (MemberAccess:Resolve): Implement.
15809 (MethodGroupExpr::InstanceExpression): used conforming to the spec
15810 to track instances.
15811 (FieldExpr::Resolve): Set type.
15813 * support.cs: Handle empty arguments.
15815 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
15816 SimpleLookup): Auxiliary routines to help parse a qualifier
15819 Update qualifier_identifier rule.
15821 * codegen.cs: Removed debugging messages.
15823 * class.cs: Make this a global thing, this acts just as a "key" to
15824 objects that we might have around.
15826 (Populate): Only initialize method_builders_to_methods once.
15828 * expression.cs (PropertyExpr): Initialize type from the
15831 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
15832 Resolve pattern. Attempt to implicitly convert value to boolean.
15835 * expression.cs: Set the type for the int32/int32 argument case.
15836 (Binary::ResolveOperator): Set the return type to boolean for
15837 comparission operators
15839 * typemanager.cs: Remove debugging print code.
15841 (Invocation::Resolve): resolve type.
15843 * class.cs: Allocate a MemberInfo of the correct size, as the code
15844 elsewhere depends on the test to reflect the correct contents.
15846 (Method::) Keep track of parameters, due to System.Reflection holes
15848 (TypeContainer::Populate): Keep track of MethodBuilders to Method
15851 (TypeContainer::FindMembers): Use ArrayList and then copy an array
15852 of the exact size and return that.
15854 (Class::LookupMethodByBuilder): New function that maps
15855 MethodBuilders to its methods. Required to locate the information
15856 on methods because System.Reflection bit us again.
15858 * support.cs: New file, contains an interface ParameterData and
15859 two implementations: ReflectionParameters and InternalParameters
15860 used to access Parameter information. We will need to grow this
15863 * expression.cs (Invocation::GetParameterData): implement a cache
15864 and a wrapper around the ParameterData creation for methods.
15865 (Invocation::OverloadResolve): Use new code.
15867 2001-09-13 Ravi Pratap <ravi@ximian.com>
15869 * class.cs (TypeContainer::EmitField): Remove and move into
15870 (Field::Define): here and modify accordingly.
15871 (Field.FieldBuilder): New member.
15872 (TypeContainer::Populate): Update accordingly.
15873 (TypeContainer::FindMembers): Implement.
15875 2001-09-13 Miguel de Icaza <miguel@ximian.com>
15877 * statement.cs: (VariableInfo::VariableType): New field to be
15878 initialized with the full type once it is resolved.
15880 2001-09-12 Miguel de Icaza <miguel@ximian.com>
15882 * parameter.cs (GetParameterInfo): Use a type cache to compute
15883 things only once, and to reuse this information
15885 * expression.cs (LocalVariableReference::Emit): Implement.
15886 (OpcodeCast::Emit): fix.
15888 (ParameterReference::Resolve): Implement.
15889 (ParameterReference::Emit): Implement.
15891 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
15892 that are expressions need to stay as Expressions.
15894 * typemanager.cs (CSharpName): Returns the C# name of a type if
15897 * expression.cs (Expression::ConvertImplicit): New function that
15898 implements implicit type conversions.
15900 (Expression::ImplicitReferenceConversion): Implements implicit
15901 reference conversions.
15903 (EmptyCast): New type for transparent casts.
15905 (OpcodeCast): New type for casts of types that are performed with
15906 a sequence of bytecodes.
15908 (BoxedCast): New type used for casting value types into reference
15909 types. Emits a box opcode.
15911 (Binary::DoNumericPromotions): Implements numeric promotions of
15912 and computation of the Binary::Type.
15914 (Binary::EmitBranchable): Optimization.
15916 (Binary::Emit): Implement code emission for expressions.
15918 * typemanager.cs (TypeManager): Added two new core types: sbyte
15921 2001-09-12 Ravi Pratap <ravi@ximian.com>
15923 * class.cs (TypeContainer::FindMembers): Method which does exactly
15924 what Type.FindMembers does, only we don't have to use reflection. No
15925 implementation yet.
15927 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
15928 typecontainer objects as we need to get at them.
15929 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
15931 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
15932 typecontainer object.
15934 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
15935 of just a Report object.
15937 2001-09-11 Ravi Pratap <ravi@ximian.com>
15939 * class.cs (Event::Define): Go back to using the prefixes "add_" and
15941 (TypeContainer::Populate): Now define the delegates of the type too.
15942 (TypeContainer.Delegates): Property to access the list of delegates defined
15945 * delegates.cs (Delegate::Define): Implement partially.
15947 * modifiers.cs (TypeAttr): Handle more flags.
15949 2001-09-11 Ravi Pratap <ravi@ximian.com>
15951 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
15953 (Operator::Define): Re-write logic to get types by using the LookupType method
15954 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
15955 (Indexer::Define): Ditto.
15956 (Event::Define): Ditto.
15957 (Property::Define): Ditto.
15959 2001-09-10 Ravi Pratap <ravi@ximian.com>
15961 * class.cs (TypeContainer::Populate): Now define operators too.
15962 (TypeContainer.Operators): New property to access the list of operators
15964 (Operator.OperatorMethodBuilder): New member to hold the method builder
15965 for the operator we are defining.
15966 (Operator::Define): Implement.
15968 2001-09-10 Ravi Pratap <ravi@ximian.com>
15970 * class.cs (Event::Define): Make the prefixes of the accessor methods
15971 addOn_ and removeOn_
15973 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
15974 of the location being passed in too. Ideally, this should go later since all
15975 error reporting should be done through the Report object.
15977 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
15978 (Populate): Iterate thru the indexers we have and define them too.
15979 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
15980 for the get and set accessors.
15981 (Indexer::Define): Implement.
15983 2001-09-09 Miguel de Icaza <miguel@ximian.com>
15985 * expression.cs (Binary::Resolve): Beginning of it. I scratched
15986 my previous implementation, did not work.
15988 * typemanager.cs: Add a couple of missing types (the longs).
15990 * literal.cs: Use TypeManager.bool_type instead of getting it.
15992 * expression.cs (EventExpr): New kind of expressions.
15993 (Expressio::ExprClassFromMemberInfo): finish
15995 2001-09-08 Miguel de Icaza <miguel@ximian.com>
15997 * assign.cs: Emit stores to static fields differently.
15999 2001-09-08 Ravi Pratap <ravi@ximian.com>
16001 * Merge in changes and adjust code to tackle conflicts. Backed out my
16002 code in Assign::Resolve ;-)
16004 2001-09-08 Ravi Pratap <ravi@ximian.com>
16006 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
16007 instead Report.Error and also pass in the location.
16008 (CSharpParser::Lexer): New readonly property to return the reference
16009 to the Tokenizer object.
16010 (declare_local_variables): Use Report.Error with location instead of plain
16014 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
16015 (Operator.CheckBinaryOperator): Ditto.
16017 * cs-parser.jay (operator_declarator): Update accordingly.
16019 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
16020 (CheckBinaryOperator): Same here.
16022 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
16023 on the name without any prefixes of namespace names etc. This is because we
16024 already might have something already fully qualified like
16025 'System.Console.WriteLine'
16027 * assign.cs (Resolve): Begin implementation. Stuck ;-)
16029 2001-09-07 Ravi Pratap <ravi@ximian.com>
16031 * cs-tokenizer.cs (location): Return a string which also contains
16034 * expression.cs (ElementAccess): New class for expressions of the
16035 type 'element access.'
16036 (BaseAccess): New class for expressions of the type 'base access.'
16037 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
16040 * cs-parser.jay (element_access): Implement action.
16041 (base_access): Implement actions.
16042 (checked_expression, unchecked_expression): Implement.
16044 * cs-parser.jay (local_variable_type): Correct and implement.
16045 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
16047 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
16049 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
16050 name and the specifiers.
16052 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
16054 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
16055 making them all public ;-)
16057 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
16060 2001-09-07 Miguel de Icaza <miguel@ximian.com>
16062 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
16064 (FieldExpr, PropertyExprs): New resolved expressions.
16065 (SimpleName::MemberStaticCheck): Perform static checks for access
16066 to non-static fields on static methods. Maybe this should be
16067 generalized for MemberAccesses.
16068 (SimpleName::ResolveSimpleName): More work on simple name
16071 * cs-parser.jay (primary_expression/qualified_identifier): track
16072 the parameter index.
16074 * codegen.cs (CodeGen::Save): Catch save exception, report error.
16075 (EmitContext::EmitBoolExpression): Chain to expression generation
16076 instead of temporary hack.
16077 (::EmitStatementExpression): Put generic expression code generation.
16079 * assign.cs (Assign::Emit): Implement variable assignments to
16080 local variables, parameters and fields.
16082 2001-09-06 Miguel de Icaza <miguel@ximian.com>
16084 * statement.cs (Block::GetVariableInfo): New method, returns the
16085 VariableInfo for a variable name in a block.
16086 (Block::GetVariableType): Implement in terms of GetVariableInfo
16088 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
16089 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
16091 2001-09-06 Ravi Pratap <ravi@ximian.com>
16093 * cs-parser.jay (operator_declaration): Continue on my quest : update
16094 to take attributes argument.
16095 (event_declaration): Ditto.
16096 (enum_declaration): Ditto.
16097 (indexer_declaration): Ditto.
16099 * class.cs (Operator::Operator): Update constructor accordingly.
16100 (Event::Event): Ditto.
16102 * delegate.cs (Delegate::Delegate): Same here.
16104 * enum.cs (Enum::Enum): Same here.
16106 2001-09-05 Ravi Pratap <ravi@ximian.com>
16108 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
16110 * ../tests/cs0658.cs : New file to demonstrate error 0658.
16112 * attribute.cs (Attributes): New class to encapsulate all attributes which were
16113 being passed around as an arraylist.
16114 (Attributes::AddAttribute): Method to add attribute sections.
16116 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
16117 (struct_declaration): Update accordingly.
16118 (constant_declaration): Update.
16119 (field_declaration): Update.
16120 (method_header): Update.
16121 (fixed_parameter): Update.
16122 (parameter_array): Ditto.
16123 (property_declaration): Ditto.
16124 (destructor_declaration): Ditto.
16126 * class.cs (Struct::Struct): Update constructors accordingly.
16127 (Class::Class): Ditto.
16128 (Field::Field): Ditto.
16129 (Method::Method): Ditto.
16130 (Property::Property): Ditto.
16131 (TypeContainer::OptAttribute): update property's return type.
16133 * interface.cs (Interface.opt_attributes): New member.
16134 (Interface::Interface): Update to take the extra Attributes argument.
16136 * parameter.cs (Parameter::Parameter): Ditto.
16138 * constant.cs (Constant::Constant): Ditto.
16140 * interface.cs (InterfaceMemberBase): New OptAttributes field.
16141 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
16142 the attributes as a parameter.
16143 (InterfaceProperty): Update constructor call.
16144 (InterfaceEvent): Ditto.
16145 (InterfaceMethod): Ditto.
16146 (InterfaceIndexer): Ditto.
16148 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
16149 pass the attributes too.
16150 (interface_event_declaration): Ditto.
16151 (interface_property_declaration): Ditto.
16152 (interface_method_declaration): Ditto.
16153 (interface_declaration): Ditto.
16155 2001-09-05 Miguel de Icaza <miguel@ximian.com>
16157 * class.cs (Method::Define): Track the "static Main" definition to
16158 create an entry point.
16160 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
16161 EntryPoint if we find it.
16163 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
16164 (EmitContext::ig): Make this variable public.
16166 * driver.cs: Make the default output file be the first file name
16167 with the .exe extension.
16169 Detect empty compilations
16171 Handle various kinds of output targets. Handle --target and
16172 rename -t to --dumper.
16174 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
16175 methods inherited from Expression return now an Expression. This
16176 will is used during the tree rewriting as we resolve them during
16179 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
16180 the spec. Missing entirely is the information about
16181 accessability of elements of it.
16183 (Expression::ExprClassFromMemberInfo): New constructor for
16184 Expressions that creates a fully initialized Expression based on
16185 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
16188 (Invocation::Resolve): Begin implementing resolution of invocations.
16190 * literal.cs (StringLiteral): Implement Emit.
16192 2001-09-05 Ravi Pratap <ravi@ximian.com>
16194 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
16197 2001-09-04 Ravi Pratap <ravi@ximian.com>
16199 * cs-parser.jay (attribute_arguments): Implement actions.
16200 (attribute): Fix bug in production. Implement action.
16201 (attribute_list): Implement.
16202 (attribute_target): Implement.
16203 (attribute_target_specifier, opt_target_specifier): Implement
16204 (CheckAttributeTarget): New method to check if the attribute target
16206 (attribute_section): Implement.
16207 (opt_attributes): Implement.
16209 * attribute.cs : New file to handle attributes.
16210 (Attribute): Class to hold attribute info.
16212 * cs-parser.jay (opt_attribute_target_specifier): Remove production
16213 (attribute_section): Modify production to use 2 different rules to
16214 achieve the same thing. 1 s/r conflict down !
16215 Clean out commented, useless, non-reducing dimension_separator rules.
16217 * class.cs (TypeContainer.attributes): New member to hold list
16218 of attributes for a type.
16219 (Struct::Struct): Modify to take one more argument, the attribute list.
16220 (Class::Class): Ditto.
16221 (Field::Field): Ditto.
16222 (Method::Method): Ditto.
16223 (Property::Property): Ditto.
16225 * cs-parser.jay (struct_declaration): Update constructor call to
16226 pass in the attributes too.
16227 (class_declaration): Ditto.
16228 (constant_declaration): Ditto.
16229 (field_declaration): Ditto.
16230 (method_header): Ditto.
16231 (fixed_parameter): Ditto.
16232 (parameter_array): Ditto.
16233 (property_declaration): Ditto.
16235 * constant.cs (Constant::Constant): Update constructor similarly.
16236 Use System.Collections.
16238 * parameter.cs (Parameter::Parameter): Update as above.
16240 2001-09-02 Ravi Pratap <ravi@ximian.com>
16242 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
16243 (TypeContainer.delegates): New member to hold list of delegates.
16245 * cs-parser.jay (delegate_declaration): Implement the action correctly
16246 this time as I seem to be on crack ;-)
16248 2001-09-02 Miguel de Icaza <miguel@ximian.com>
16250 * rootcontext.cs (RootContext::IsNamespace): new function, used to
16251 tell whether an identifier represents a namespace.
16253 * expression.cs (NamespaceExpr): A namespace expression, used only
16254 temporarly during expression resolution.
16255 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
16256 utility functions to resolve names on expressions.
16258 2001-09-01 Miguel de Icaza <miguel@ximian.com>
16260 * codegen.cs: Add hook for StatementExpressions.
16262 * class.cs: Fix inverted test for static flag in methods.
16264 2001-09-02 Ravi Pratap <ravi@ximian.com>
16266 * class.cs (Operator::CheckUnaryOperator): Correct error number used
16267 to make it coincide with MS' number.
16268 (Operator::CheckBinaryOperator): Ditto.
16270 * ../errors/errors.txt : Remove error numbers added earlier.
16272 * ../errors/cs1019.cs : Test case for error # 1019
16274 * ../errros/cs1020.cs : Test case for error # 1020
16276 * cs-parser.jay : Clean out commented cruft.
16277 (dimension_separators, dimension_separator): Comment out. Ostensibly not
16278 used anywhere - non-reducing rule.
16279 (namespace_declarations): Non-reducing rule - comment out.
16281 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
16282 with TypeContainer::AddEnum.
16284 * delegate.cs : New file for delegate handling classes.
16285 (Delegate): Class for declaring delegates.
16287 * makefile : Update.
16289 * cs-parser.jay (delegate_declaration): Implement.
16291 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
16293 * class.cs (Event::Define): Implement.
16294 (Event.EventBuilder): New member.
16296 * class.cs (TypeContainer::Populate): Update to define all enums and events
16298 (Events): New property for the events arraylist we hold. Shouldn't we move to using
16299 readonly fields for all these cases ?
16301 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16303 * class.cs (Property): Revamp to use the convention of making fields readonly.
16304 Accordingly modify code elsewhere.
16306 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
16307 the Define method of the Property class.
16309 * class.cs : Clean up applied patch and update references to variables etc. Fix
16311 (TypeContainer::Populate): Update to define all the properties we have. Also
16312 define all enumerations.
16314 * enum.cs (Define): Implement.
16316 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16318 * cs-parser.jay (overloadable_operator): The semantic value is an
16319 enum of the Operator class.
16320 (operator_declarator): Implement actions.
16321 (operator_declaration): Implement.
16323 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
16324 validity of definitions.
16325 (Operator::CheckBinaryOperator): Static method to check for binary operators
16326 (TypeContainer::AddOperator): New method to add an operator to a type.
16328 * cs-parser.jay (indexer_declaration): Added line to actually call the
16329 AddIndexer method so it gets added ;-)
16331 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
16332 already taken care of by the MS compiler ?
16334 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16336 * class.cs (Operator): New class for operator declarations.
16337 (Operator::OpType): Enum for the various operators.
16339 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16341 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
16342 ostensibly handle this in semantic analysis.
16344 * cs-parser.jay (general_catch_clause): Comment out
16345 (specific_catch_clauses, specific_catch_clause): Ditto.
16346 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
16347 (catch_args, opt_catch_args): New productions.
16348 (catch_clause): Rewrite to use the new productions above
16349 (catch_clauses): Modify accordingly.
16350 (opt_catch_clauses): New production to use in try_statement
16351 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
16352 and re-write the code in the actions to extract the specific and
16353 general catch clauses by being a little smart ;-)
16355 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
16356 Hooray, try and catch statements parse fine !
16358 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16360 * statement.cs (Block::GetVariableType): Fix logic to extract the type
16361 string from the hashtable of variables.
16363 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
16364 I end up making that mistake ;-)
16365 (catch_clauses): Fixed gross error which made Key and Value of the
16366 DictionaryEntry the same : $1 !!
16368 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16370 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
16372 * cs-parser.jay (event_declaration): Correct to remove the semicolon
16373 when the add and remove accessors are specified.
16375 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16377 * cs-parser.jay (IndexerDeclaration): New helper class to hold
16378 information about indexer_declarator.
16379 (indexer_declarator): Implement actions.
16380 (parsing_indexer): New local boolean used to keep track of whether
16381 we are parsing indexers or properties. This is necessary because
16382 implicit_parameters come into picture even for the get accessor in the
16383 case of an indexer.
16384 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
16386 * class.cs (Indexer): New class for indexer declarations.
16387 (TypeContainer::AddIndexer): New method to add an indexer to a type.
16388 (TypeContainer::indexers): New member to hold list of indexers for the
16391 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16393 * cs-parser.jay (add_accessor_declaration): Implement action.
16394 (remove_accessor_declaration): Implement action.
16395 (event_accessors_declaration): Implement
16396 (variable_declarators): swap statements for first rule - trivial.
16398 * class.cs (Event): New class to hold information about event
16400 (TypeContainer::AddEvent): New method to add an event to a type
16401 (TypeContainer::events): New member to hold list of events.
16403 * cs-parser.jay (event_declaration): Implement actions.
16405 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16407 * cs-parser.jay (dim_separators): Implement. Make it a string
16408 concatenating all the commas together, just as they appear.
16409 (opt_dim_separators): Modify accordingly
16410 (rank_specifiers): Update accordingly. Basically do the same
16411 thing - instead, collect the brackets here.
16412 (opt_rank_sepcifiers): Modify accordingly.
16413 (array_type): Modify to actually return the complete type string
16414 instead of ignoring the rank_specifiers.
16415 (expression_list): Implement to collect the expressions
16416 (variable_initializer): Implement. We make it a list of expressions
16417 essentially so that we can handle the array_initializer case neatly too.
16418 (variable_initializer_list): Implement.
16419 (array_initializer): Make it a list of variable_initializers
16420 (opt_array_initializer): Modify accordingly.
16422 * expression.cs (New::NType): Add enumeration to help us
16423 keep track of whether we have an object/delegate creation
16424 or an array creation.
16425 (New:NewType, New::Rank, New::Indices, New::Initializers): New
16426 members to hold data about array creation.
16427 (New:New): Modify to update NewType
16428 (New:New): New Overloaded contructor for the array creation
16431 * cs-parser.jay (array_creation_expression): Implement to call
16432 the overloaded New constructor.
16434 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
16436 * class.cs (TypeContainer::Constructors): Return member
16437 constructors instead of returning null.
16439 2001-08-26 Miguel de Icaza <miguel@ximian.com>
16441 * typemanager.cs (InitCoreTypes): Initialize the various core
16442 types after we have populated the type manager with the user
16443 defined types (this distinction will be important later while
16444 compiling corlib.dll)
16446 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
16447 on Expression Classification. Now all expressions have a method
16448 `Resolve' and a method `Emit'.
16450 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
16451 generation from working. Also add some temporary debugging
16454 2001-08-24 Miguel de Icaza <miguel@ximian.com>
16456 * codegen.cs: Lots of code generation pieces. This is only the
16457 beginning, will continue tomorrow with more touches of polish. We
16458 handle the fundamentals of if, while, do, for, return. Others are
16459 trickier and I need to start working on invocations soon.
16461 * gen-treedump.cs: Bug fix, use s.Increment here instead of
16464 * codegen.cs (EmitContext): New struct, used during code
16465 emission to keep a context. Most of the code generation will be
16468 * cs-parser.jay: Add embedded blocks to the list of statements of
16469 this block. So code generation proceeds in a top down fashion.
16471 2001-08-23 Miguel de Icaza <miguel@ximian.com>
16473 * statement.cs: Add support for multiple child blocks.
16475 2001-08-22 Miguel de Icaza <miguel@ximian.com>
16477 * codegen.cs (EmitCode): New function, will emit the code for a
16478 Block of code given a TypeContainer and its ILGenerator.
16480 * statement.cs (Block): Standard public readonly optimization.
16481 (Block::Block constructors): Link children.
16482 (Block::Child): Child Linker.
16483 (Block::EmitVariables): Emits IL variable declarations.
16485 * class.cs: Drop support for MethodGroups here, delay until
16487 (Method::): Applied the same simplification that I did before, and
16488 move from Properties to public readonly fields.
16489 (Method::ParameterTypes): Returns the parameter types for the
16490 function, and implements a cache that will be useful later when I
16491 do error checking and the semantic analysis on the methods is
16493 (Constructor::GetCallingConvention): Renamed from CallingConvetion
16494 and made a method, optional argument tells whether this is a class
16495 or a structure to apply the `has-this' bit.
16496 (Method::GetCallingConvention): Implement, returns the calling
16498 (Method::Define): Defines the type, a second pass is performed
16499 later to populate the methods.
16501 (Constructor::ParameterTypes): implement a cache similar to the
16502 one on Method::ParameterTypes, useful later when we do semantic
16505 (TypeContainer::EmitMethod): New method. Emits methods.
16507 * expression.cs: Removed MethodGroup class from here.
16509 * parameter.cs (Parameters::GetCallingConvention): new method.
16511 2001-08-21 Miguel de Icaza <miguel@ximian.com>
16513 * class.cs (TypeContainer::Populate): Drop RootContext from the
16516 (Constructor::CallingConvention): Returns the calling convention.
16517 (Constructor::ParameterTypes): Returns the constructor parameter
16520 (TypeContainer::AddConstructor): Keep track of default constructor
16521 and the default static constructor.
16523 (Constructor::) Another class that starts using `public readonly'
16524 instead of properties.
16526 (Constructor::IsDefault): Whether this is a default constructor.
16528 (Field::) use readonly public fields instead of properties also.
16530 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
16531 track of static constructors; If none is used, turn on
16532 BeforeFieldInit in the TypeAttributes.
16534 * cs-parser.jay (opt_argument_list): now the return can be null
16535 for the cases where there are no arguments.
16537 (constructor_declarator): If there is no implicit `base' or
16538 `this', then invoke the default parent constructor.
16540 * modifiers.cs (MethodAttr): New static function maps a set of
16541 modifiers flags into a MethodAttributes enum
16542 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
16543 MethodAttr, TypeAttr to represent the various mappings where the
16544 modifiers are used.
16545 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
16547 2001-08-19 Miguel de Icaza <miguel@ximian.com>
16549 * parameter.cs (GetParameterInfo): Fix bug where there would be no
16552 * interface.cs (PopulateIndexer): Implemented the code generator
16553 for interface indexers.
16555 2001-08-17 Miguel de Icaza <miguel@ximian.com>
16557 * interface.cs (InterfaceMemberBase): Now we track the new status
16560 (PopulateProperty): Implement property population. Woohoo! Got
16561 Methods and Properties going today.
16563 Removed all the properties for interfaces, and replaced them with
16564 `public readonly' fields.
16566 2001-08-16 Miguel de Icaza <miguel@ximian.com>
16568 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
16569 initialize their hashtables/arraylists only when they are needed
16570 instead of doing this always.
16572 * parameter.cs: Handle refs and out parameters.
16574 * cs-parser.jay: Use an ArrayList to construct the arguments
16575 instead of the ParameterCollection, and then cast that to a
16578 * parameter.cs: Drop the use of ParameterCollection and use
16579 instead arrays of Parameters.
16581 (GetParameterInfo): Use the Type, not the Name when resolving
16584 2001-08-13 Miguel de Icaza <miguel@ximian.com>
16586 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
16587 and instead use public readonly fields.
16589 * class.cs: Put back walking code for type containers.
16591 2001-08-11 Miguel de Icaza <miguel@ximian.com>
16593 * class.cs (MakeConstant): Code to define constants.
16595 * rootcontext.cs (LookupType): New function. Used to locate types
16598 2001-08-08 Miguel de Icaza <miguel@ximian.com>
16600 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
16601 this System.Reflection code is. Kudos to Microsoft
16603 * typemanager.cs: Implement a type cache and avoid loading all
16604 types at boot time. Wrap in LookupType the internals. This made
16605 the compiler so much faster. Wow. I rule!
16607 * driver.cs: Make sure we always load mscorlib first (for
16608 debugging purposes, nothing really important).
16610 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
16611 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
16613 * rootcontext.cs: Lookup types on their namespace; Lookup types
16614 on namespaces that have been imported using the `using' keyword.
16616 * class.cs (TypeContainer::TypeAttr): Virtualize.
16617 (Class::TypeAttr): Return attributes suitable for this bad boy.
16618 (Struct::TypeAttr): ditto.
16619 Handle nested classes.
16620 (TypeContainer::) Remove all the type visiting code, it is now
16621 replaced with the rootcontext.cs code
16623 * rootcontext.cs (GetClassBases): Added support for structs.
16625 2001-08-06 Miguel de Icaza <miguel@ximian.com>
16627 * interface.cs, statement.cs, class.cs, parameter.cs,
16628 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
16629 Drop use of TypeRefs, and use strings instead.
16631 2001-08-04 Miguel de Icaza <miguel@ximian.com>
16635 * class.cs (Struct::Struct): set the SEALED flags after
16636 checking the modifiers.
16637 (TypeContainer::TypeAttr): new property, returns the
16638 TypeAttributes for a class.
16640 * cs-parser.jay (type_list): Oops, list production was creating a
16641 new list of base types.
16643 * rootcontext.cs (StdLib): New property.
16644 (GetInterfaceTypeByName): returns an interface by type name, and
16645 encapsulates error handling here.
16646 (GetInterfaces): simplified.
16647 (ResolveTree): Encapsulated all the tree resolution here.
16648 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
16651 * driver.cs: Add support for --nostdlib, to avoid loading the
16652 default assemblies.
16653 (Main): Do not put tree resolution here.
16655 * rootcontext.cs: Beginning of the class resolution.
16657 2001-08-03 Miguel de Icaza <miguel@ximian.com>
16659 * rootcontext.cs: Provide better error reporting.
16661 * cs-parser.jay (interface_base): set our $$ to be interfaces.
16663 * rootcontext.cs (CreateInterface): Handle the case where there
16664 are no parent interfaces.
16666 (CloseTypes): Routine to flush types at the end.
16667 (CreateInterface): Track types.
16668 (GetInterfaces): Returns an array of Types from the list of
16669 defined interfaces.
16671 * typemanager.c (AddUserType): Mechanism to track user types (puts
16672 the type on the global type hash, and allows us to close it at the
16675 2001-08-02 Miguel de Icaza <miguel@ximian.com>
16677 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
16678 RecordInterface instead.
16680 * cs-parser.jay: Updated to reflect changes above.
16682 * decl.cs (Definition): Keep track of the TypeBuilder type that
16683 represents this type here. Not sure we will use it in the long
16684 run, but wont hurt for now.
16686 * driver.cs: Smaller changes to accomodate the new code.
16688 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
16691 * rootcontext.cs (CreateInterface): New method, used to create
16692 the System.TypeBuilder type for interfaces.
16693 (ResolveInterfaces): new entry point to resolve the interface
16695 (CodeGen): Property, used to keep track of the code generator.
16697 2001-07-26 Miguel de Icaza <miguel@ximian.com>
16699 * cs-parser.jay: Add a second production for delegate_declaration
16702 (enum_body): Put an opt_comma here instead of putting it on
16703 enum_body or enum_member_declarations so we can handle trailing
16704 commas on enumeration members. Gets rid of a shift/reduce.
16706 (type_list): Need a COMMA in the middle.
16708 (indexer_declaration): Tell tokenizer to recognize get/set
16710 * Remove old targets.
16712 * Re-add the parser target.
16714 2001-07-13 Simon Cozens <simon@simon-cozens.org>
16716 * cs-parser.jay: Add precendence rules for a number of operators
16717 ot reduce the number of shift/reduce conflicts in the grammar.
16719 2001-07-17 Miguel de Icaza <miguel@ximian.com>
16721 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
16724 Get rid of old crufty code.
16726 * rootcontext.cs: Use this to keep track of the parsed
16727 representation and the defined types available to the program.
16729 * gen-treedump.cs: adjust for new convention.
16731 * type.cs: Split out the type manager, and the assembly builder
16734 * typemanager.cs: the type manager will live here now.
16736 * cil-codegen.cs: And the code generator here.
16738 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
16740 * makefile: Fixed up for easy making.
16742 2001-07-13 Simon Cozens <simon@simon-cozens.org>
16744 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
16747 (unary_expression): Expand pre_increment_expression and
16748 post_decrement_expression to reduce a shift/reduce.
16750 2001-07-11 Simon Cozens
16752 * cs-tokenizer.cs: Hex numbers should begin with a 0.
16754 Improve allow_keyword_as_indent name.
16756 2001-06-19 Miguel de Icaza <miguel@ximian.com>
16758 * Adjustments for Beta2.
16760 2001-06-13 Miguel de Icaza <miguel@ximian.com>
16762 * decl.cs: Added `Define' abstract method.
16763 (InTransit): new property, used to catch recursive definitions.
16765 * interface.cs: Implement `Define'.
16767 * modifiers.cs: Map Modifiers.constants to
16768 System.Reflection.TypeAttribute flags.
16770 * class.cs: Keep track of types and user-defined types.
16771 (BuilderInit): New method for creating an assembly
16772 (ResolveType): New function to launch the resolution process, only
16773 used by interfaces for now.
16775 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
16776 that are inserted into the name space.
16778 2001-06-08 Miguel de Icaza <miguel@ximian.com>
16780 * ARGH. I have screwed up my tree so many times due to the use of
16781 rsync rather than using CVS. Going to fix this at once.
16783 * driver.cs: Objetify driver. Load assemblies, use assemblies to
16786 2001-06-07 Miguel de Icaza <miguel@ximian.com>
16788 * Experiment successful: Use System.Type rather that our own
16791 2001-05-25 Miguel de Icaza <miguel@ximian.com>
16793 * cs-parser.jay: Removed nsAliases from here.
16795 Use new namespaces, handle `using XXX;'
16797 * namespace.cs: Reimplemented namespace handling, use a recursive
16798 definition of the class. Now we can keep track of using clauses
16799 and catch invalid using clauses.
16801 2001-05-24 Miguel de Icaza <miguel@ximian.com>
16803 * gen-treedump.cs: Adapted for all the renaming.
16805 * expression.cs (Expression): this class now has a Type property
16806 which returns an expression Type.
16808 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
16809 `Type', as this has a different meaning now in the base
16811 2001-05-22 Miguel de Icaza <miguel@ximian.com>
16813 * interface.cs, class.cs: Removed from all the sources the
16814 references to signature computation, as we can not do method
16815 signature computation during the parsing time, as we are not
16816 trying to solve at that point distinguishing:
16820 void a (NS.Blah x) {}
16823 Which depending on the context might be valid or not, as we do not
16824 know if Blah is the same thing as NS.Blah at that point.
16826 * Redid everything so the code uses TypeRefs now instead of
16827 Types. TypeRefs are just temporary type placeholders, that need
16828 to be resolved. They initially have a pointer to a string and the
16829 current scope in which they are used. This is used later by the
16830 compiler to resolve the reference to an actual Type.
16832 * DeclSpace is no longer a CIR.Type, and neither are
16833 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
16834 are all DeclSpaces, but no Types.
16836 * type.cs (TypeRefManager): This implements the TypeRef manager,
16837 which keeps track of all the types that need to be resolved after
16838 the parsing has finished.
16840 2001-05-13 Miguel de Icaza <miguel@ximian.com>
16842 * ARGH. We are going to have to store `foreach' as a class rather
16843 than resolving it, as we need to verify error 1579 after name
16844 resolution. *OR* we could keep a flag that says `This request to
16845 IEnumerator comes from a foreach statement' which we can then use
16846 to generate the error.
16848 2001-05-10 Miguel de Icaza <miguel@ximian.com>
16850 * class.cs (TypeContainer.AddMethod): we now add methods to the
16851 MethodGroup instead of the method hashtable.
16853 * expression.cs: Add MethodGroup abstraction, which gets us one
16854 step closer to the specification in the way we handle method
16857 * cs-parser.jay (primary_expression): qualified_identifier now
16858 tried to match up an identifier to a local variable reference or
16859 to a parameter reference.
16861 current_local_parameters is now a parser global variable that
16862 points to the current parameters for the block, used during name
16865 (property_declaration): Now creates an implicit `value' argument to
16868 2001-05-09 Miguel de Icaza <miguel@ximian.com>
16870 * parameter.cs: Do not use `param' arguments as part of the
16871 signature, per the spec.
16873 2001-05-08 Miguel de Icaza <miguel@ximian.com>
16875 * decl.cs: Base class for classes, structs and interfaces. This
16876 is the "Declaration Space"
16878 * cs-parser.jay: Use CheckDef for checking declaration errors
16879 instead of having one on each function.
16881 * class.cs: Factor out some code for handling error handling in
16882 accordance to the "Declarations" section in the "Basic Concepts"
16883 chapter in the ECMA C# spec.
16885 * interface.cs: Make all interface member classes derive from
16886 InterfaceMemberBase.
16888 2001-05-07 Miguel de Icaza <miguel@ximian.com>
16890 * Many things: all interfaces are parsed and generated in
16891 gen-treedump. Support for member variables, constructors,
16892 destructors, properties, constants is there.
16894 Beginning of the IL backend, but very little done, just there for
16897 2001-04-29 Miguel de Icaza <miguel@ximian.com>
16899 * cs-parser.jay: Fix labeled statement.
16901 * cs-tokenizer.cs (escape): Escape " and ' always.
16902 ref_line, ref_name: keep track of the line/filename as instructed
16903 by #line by the compiler.
16906 2001-04-27 Miguel de Icaza <miguel@ximian.com>
16908 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
16909 to match the values in System.CodeDOM.
16911 Divid renamed to Divide.
16913 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
16915 (Statements.set): remove.
16917 * System.CodeDOM/CodeCatchClause.cs: always have a valid
16920 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
16921 falseStatements always have valid values.
16923 * cs-parser.jay: Use System.CodeDOM now.