1 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
3 * namespace.cs (NamespaceEntry.Using): No matter which warning
4 level is set, check if this namespace name has already been added.
6 2004-10-03 Ben Maurer <bmaurer@ximian.com>
8 * expression.cs: reftype [!=]= null should always use br[true,false].
11 2004-10-03 Marek Safar <marek.safar@seznam.cz>
14 * attribute.cs: Enum conversion moved to
15 GetAttributeArgumentExpression to be applied to the all
18 2004-10-01 Raja R Harinath <rharinath@novell.com>
20 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
21 * class.c (TypeContainer.DefineType): Flag error if
22 base types aren't accessible due to access permissions.
23 * decl.cs (DeclSpace.ResolveType): Move logic to
24 Expression.ResolveAsTypeTerminal.
25 (DeclSpace.ResolveTypeExpr): Thin layer over
26 Expression.ResolveAsTypeTerminal.
27 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
28 Refactor code into NestedAccess. Use it.
29 (DeclSpace.NestedAccess): New.
30 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
31 argument to silence errors. Check access permissions.
32 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
33 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
34 (Cast.DoResolve): Likewise.
35 (New.DoResolve): Likewise.
36 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
37 (TypeOf.DoResolve): Likewise.
39 * expression.cs (Invocation.BetterConversion): Return the Type of
40 the better conversion. Implement section 14.4.2.3 more faithfully.
41 (Invocation.BetterFunction): Make boolean. Make correspondence to
42 section 14.4.2.2 explicit.
43 (Invocation.OverloadResolve): Update.
44 (Invocation): Remove is_base field.
45 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
46 (Invocation.Emit): Likewise.
48 2004-09-27 Raja R Harinath <rharinath@novell.com>
50 * README: Update to changes.
52 2004-09-24 Marek Safar <marek.safar@seznam.cz>
54 * cs-parser.jay: Reverted 642 warning fix.
56 2004-09-23 Marek Safar <marek.safar@seznam.cz>
59 * decl.cs (FindMemberWithSameName): Indexer can have more than
62 2004-09-23 Marek Safar <marek.safar@seznam.cz>
64 * expression.cs (LocalVariableReference.DoResolveLValue):
65 Do not report warning 219 for out values.
66 (EmptyExpression.Null): New member to avoid extra allocations.
68 2004-09-23 Marek Safar <marek.safar@seznam.cz>
70 * cs-parser.jay: Fix wrong warning 642 report.
72 * cs-tokenizer.cs (CheckNextToken): New helper;
73 Inspect next character if is same as expected.
75 2004-09-23 Martin Baulig <martin@ximian.com>
77 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
78 (Convert.ImplicitReferenceConversionExists): Likewise.
80 2004-09-23 Martin Baulig <martin@ximian.com>
82 Merged latest changes into gmcs. Please keep this comment in
83 here, it makes it easier for me to see what changed in MCS since
84 the last time I merged.
86 2004-09-23 Marek Safar <marek.safar@seznam.cz>
88 * class.cs (Operator.Define): Add error 448 and 559 report.
90 2004-09-22 Marek Safar <marek.safar@seznam.cz>
92 * class.cs (MemberBase.IsTypePermitted): New protected
93 method for checking error CS0610.
95 2004-09-22 Marek Safar <marek.safar@seznam.cz>
97 * class.cs (TypeContainer.HasExplicitLayout): New property
98 Returns whether container has StructLayout attribute set Explicit.
99 (FieldMember): New abstract class for consts and fields.
100 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
101 (Field): Reuse FieldMember.
103 * const.cs (Const): Reuse FieldMember.
105 * rootcontext.cs: EmitConstants call moved to class.
107 2004-09-22 Martin Baulig <martin@ximian.com>
109 Thanks to Peter Sestoft for this bug report.
111 * expression.cs (Conditional): If both the `trueExpr' and the
112 `falseExpr' is a NullLiteral, return a NullLiteral.
114 2004-09-22 Martin Baulig <martin@ximian.com>
116 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
117 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
118 for the "get_Current" call.
120 2004-09-22 Martin Baulig <martin@ximian.com>
122 Marek and me just fixed one of our oldest bugs: #28562 :-)
124 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
126 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
127 we're an EnumConstant, just return that.
128 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
129 an EnumConstant. In this case, we need to use GetValueAsEnumType()
130 to get the value which'll actually be written into the attribute.
131 However, we have to use GetValue() to access the attribute's value
134 2004-09-22 Marek Safar <marek.safar@seznam.cz>
136 * constant.cs (Constant.IsNegative): New abstract property
139 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
140 (StackAlloc.DoResolve): Reused IsNegative.
142 2004-09-21 Martin Baulig <martin@ximian.com>
144 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
145 if we're used in an iterator, we may be called from different
148 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
149 we actually have an exception block.
151 2004-09-20 John Luke <jluke@cfl.rr.com>
153 * class.cs, cs-parser.jay: Improve the error report for 1520:
154 report the actual line where the error happens, not where the
157 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
158 Pass location information that was available elsewhere.
160 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
162 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
163 runtime to delay sign assemblies.
165 2004-09-19 Miguel de Icaza <miguel@ximian.com>
167 * cs-parser.jay: Do not report the stack trace, this is barely
170 2004-08-22 John Luke <john.luke@gmail.com>
172 * driver.cs : check that a resource id is not already used
173 before adding it, report CS1508 if it is, bug #63637
175 2004-09-19 Miguel de Icaza <miguel@ximian.com>
177 * ecore.cs: Removed dead code.
179 2004-09-18 Marek Safar <marek.safar@seznam.cz>
181 * class.cs: Do not report warning CS0067 on the interfaces.
183 2004-09-16 Marek Safar <marek.safar@seznam.cz>
185 * cs-parser.jay: Add error 504 report.
187 2004-09-16 Marek Safar <marek.safar@seznam.cz>
189 * rootcontext.cs: WarningLevel is 4 by default now.
191 * statement.cs (Fixed.Resolve): Do not null
194 2004-09-16 Marek Safar <marek.safar@seznam.cz>
197 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
198 deep search when property is not virtual.
199 (PropertyExpr.ResolveAccessors): Make one call for both
202 2004-09-15 Marek Safar <marek.safar@seznam.cz>
205 * statement.cs: Error 152 report constains also location.
207 2004-09-15 Marek Safar <marek.safar@seznam.cz>
210 * const.cs: Explicitly set constant as static.
212 2004-09-15 Marek Safar <marek.safar@seznam.cz>
215 * cs-parser.jay: Add error 1017 report.
217 2004-09-15 Marek Safar <marek.safar@seznam.cz>
219 Fixed bug #59980, #64224
220 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
222 * typemanager.cs (IsSpecialMethod): Simplified
224 2004-09-14 Marek Safar <marek.safar@seznam.cz>
226 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
227 condition with better params.
229 2004-09-14 Marek Safar <marek.safar@seznam.cz>
232 * attribute.cs (Resolve): Property has to have both
235 2004-09-14 Martin Baulig <martin@ximian.com>
237 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
239 2004-09-14 Marek Safar <marek.safar@seznam.cz>
242 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
243 called and is obsolete then this member suppress message
244 when call is inside next [Obsolete] method or type.
246 * expression.cs: Use TestObsoleteMethodUsage member.
248 2004-09-14 Martin Baulig <martin@ximian.com>
250 * cs-parser.jay: Sync a bit with the GMCS version.
252 2004-09-14 Martin Baulig <martin@ximian.com>
254 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
255 (CSharpParser.yacc_verbose_flag): New public field.
257 * genericparser.cs: Removed.
259 2004-09-14 Raja R Harinath <rharinath@novell.com>
261 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
263 2004-09-13 Marek Safar <marek.safar@seznam.cz>
265 * class.cs (MethodCore.CheckBase): Fix bug #65757.
267 2004-09-10 Martin Baulig <martin@ximian.com>
269 Backported my MemberName changes from GMCS into MCS.
271 - we are now using a special `MemberName' class instead of using
272 strings; in GMCS, the `MemberName' also contains the type
275 - changed the grammar rules a bit:
276 * the old `member_name' is now a `namespace_or_type_name':
277 The rule is that we use `namespace_or_type_name' everywhere
278 where we expect either a "member name" (GetEnumerator) or a
279 "member name" with an explicit interface name
280 (IEnumerable.GetEnumerator).
281 In GMCS, the explicit interface name may include type arguments
282 (IEnumerable<T>.GetEnumerator).
283 * we use `member_name' instead of just `IDENTIFIER' for
285 The rule is that we use `member_name' wherever a member may
286 have type parameters in GMCS.
288 * decl.cs (MemberName): New public class.
289 (MemberCore.MemberName): New public readonly field.
290 (MemberCore.ctor): Take a `MemberName' argument, not a string.
291 (DeclSpace): Likewise.
293 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
294 * enum.cs (Enum.ctor): Likewise.
296 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
298 (AliasEntry.ctor): Take a MemberName, not an Expression.
299 (AliasEntry.UsingAlias): Likewise.
301 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
302 (IMethodData.MemberName): Changed type from string to MemberName.
303 (MemberBase.ExplicitInterfaceName): Likewise.
304 (AbstractPropertyEventMethod.SetupName): Make this private.
305 (AbstractPropertyEventMethod.ctor): Added `string prefix'
306 argument; compute the member name here.
307 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
308 on the `member.MemberName' and the `prefix'.
310 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
312 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
313 thus, we get a `MemberName' instead of a `string'. These
314 declarations may have type parameters in GMCS.
315 (interface_method_declaration, delegate_declaration): Likewise.
316 (class_declaration, interface_declaration): Likewise.
317 (method_header): Use `namespace_or_type_name' instead of
318 `member_name'. We may be an explicit interface implementation.
319 (property_declaration, event_declaration): Likewise.
320 (member_name): This is now just an `IDENTIFIER', not a
321 `namespace_or_type_name'.
322 (type_name, interface_type): Removed.
323 (namespace_or_type_name): Return a MemberName, not an Expression.
324 (primary_expression): Use `member_name' instead of `IDENTIFIER';
325 call GetTypeExpression() on the MemberName to get an expression.
326 (IndexerDeclaration.interface_type): Changed type from string to
328 (MakeName): Operate on MemberName's instead of string's.
330 2004-09-13 Raja R Harinath <rharinath@novell.com>
333 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
334 (NamespaceEntry.Lookup): Add new argument to flag if we want the
335 lookup to avoid symbols introduced by 'using'.
336 * rootcontext.cs (NamespaceLookup): Update.
338 2004-09-12 Marek Safar <marek.safar@seznam.cz>
340 * class.cs (TypeContainer.DoDefineMembers): Do not call
341 DefineDefaultConstructor for static classes.
343 2004-09-12 Marek Safar <marek.safar@seznam.cz>
345 * attribute.cs (Attribute.Resolve): Add error 653 report.
347 * class.cs (Class.ApplyAttributeBuilder): Add error 641
349 (Method.ApplyAttributeBuilder): Add error 685 report.
350 (Operator.Define): Add error 564 report.
352 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
354 * expression.cs (Invocation.DoResolve): Add error
357 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
360 2004-09-11 Marek Safar <marek.safar@seznam.cz>
362 * class.cs (ConstructorInitializer.Resolve):
363 Wrong error number (515->516).
365 2004-09-11 Marek Safar <marek.safar@seznam.cz>
367 * class.cs (Indexer.Define): Add error 631 report.
369 2004-09-11 Marek Safar <marek.safar@seznam.cz>
371 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
373 2004-09-11 Marek Safar <marek.safar@seznam.cz>
375 * expression.cs (Probe.DoResolve): Add error CS0241 report.
377 2004-09-10 Marek Safar <marek.safar@seznam.cz>
379 * cs-parser.jay: Added error CS0241 report.
381 2004-09-10 Raja R Harinath <rharinath@novell.com>
383 * cs-parser.jay (fixed_statement): Introduce a scope for the
384 declaration in the 'fixed' statement.
386 2004-09-09 Marek Safar <marek.safar@seznam.cz>
388 * cs-parser.jay: Added CS0230 error report.
390 2004-09-09 Marek Safar <marek.safar@seznam.cz>
392 * cs-parser.jay: Added errors CS0231 and CS0257 report.
394 2004-09-09 Marek Safar <marek.safar@seznam.cz>
396 * expression.cs (Argument.Resolve): Added error CS0192 and
399 2004-09-09 Marek Safar <marek.safar@seznam.cz>
401 C# 2.0 #pragma warning feature
403 * cs-tokenizer.cs (PreProcessPragma): New method;
404 Handles #pragma directive.
406 * report.cs (WarningRegions): New class; Support
407 class for #pragma warning directive. It tests whether
408 warning is enabled for a given line.
410 2004-09-08 Miguel de Icaza <miguel@ximian.com>
412 * const.cs: Add more descriptive error report, tahnks to
415 2004-09-08 Marek Safar <marek.safar@seznam.cz>
417 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
419 2004-09-07 Miguel de Icaza <miguel@ximian.com>
421 * expression.cs: Apply patch from Ben: Remove dead code from
422 ArrayCreation, and remove the TurnintoConstant call in const.cs,
423 as that code just threw an exception anwyays.
425 * const.cs: Remove the call to the turnintoconstant, for details
428 * literal.cs: The type of the null-literal is the null type; So
429 we use a placeholder type (literal.cs:System.Null, defined here)
432 * expression.cs (Conditional.DoResolve): Remove some old code that
433 is no longer needed, conversions have been fixed.
435 (ArrayCreationExpression.DoResolve): Return false if we fail to
436 resolve the inner expression.
438 2004-09-07 Raja R Harinath <rharinath@novell.com>
441 * cs-parser.jay (delegate_declaration): Record a delegate
442 declaration as a type declaration.
443 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
445 2004-09-06 Miguel de Icaza <miguel@ximian.com>
447 * parameter.cs: Do not crash if the type can not be resolved.
449 * expression.cs: Report errors with unsafe pointers, fixes #64896
451 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
453 * expression.cs: Pointer arith always needs to do a conv.i
454 if the operand is a long. fix 65320
456 2004-09-04 Marek Safar <marek.safar@seznam.cz>
458 Fixed cs0619-37.cs, cs0619-38.cs
460 * enum.cs (GetObsoleteAttribute): Removed.
462 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
463 on Enum member is double staged. The first is tested member
466 2004-09-04 Marek Safar <marek.safar@seznam.cz>
468 Fixed #56986, #63631, #65231
470 * class.cs: (TypeContainer.AddToMemberContainer): New method,
471 adds member to name container.
472 (TypeContainer.AddToTypeContainer): New method, adds type to
474 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
475 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
476 AddOperator): Simplified by reusing AddToMemberContainer.
477 (TypeContainer.UserDefinedStaticConstructor): Changed to property
479 (Method.CheckForDuplications): Fixed implementation to test all
481 (MemberBase): Detection whether member is explicit interface
482 implementation is now in constructor.
483 (MemberBase.UpdateMemberName): Handles IndexerName.
484 (Accessor): Changed to keep also location information.
485 (AbstractPropertyEventMethod): Is derived from MemberCore.
486 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
487 will be emited or not.
488 (PropertyBase.AreAccessorsDuplicateImplementation):
489 Tests whether accessors are not in collision with some method.
490 (Operator): Is derived from MethodCore to simplify common
493 * decl.cs (Flags.TestMethodDuplication): Test for duplication
495 (DeclSpace.AddToContainer): Adds the member to defined_names
496 table. It tests for duplications and enclosing name conflicts.
498 * enum.cs (EnumMember): Clean up to reuse the base structures
500 2004-09-03 Martin Baulig <martin@ximian.com>
502 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
503 into TypeContainer, to make partial classes work again.
505 2004-09-03 Martin Baulig <martin@ximian.com>
507 * rootcontext.cs (RootContext.V2): Removed.
509 2004-03-23 Martin Baulig <martin@ximian.com>
511 * expression.cs (Invocation.OverloadResolve): Added `bool
512 may_fail' argument and use it instead of the Location.IsNull() hack.
514 2004-09-03 Martin Baulig <martin@ximian.com>
516 Merged latest changes into gmcs. Please keep this comment in
517 here, it makes it easier for me to see what changed in MCS since
518 the last time I merged.
520 2004-09-03 Raja R Harinath <rharinath@novell.com>
523 * expression.cs (BetterConversion): Don't allow either conversion
524 to be null. Remove redundant implicit conversion test when 'q ==
525 null' -- when this function is invoked, we already know that the
526 implicit conversion exists.
527 (BetterFunction): Assume that 'best' is non-null. Remove
528 redundant reimplementation of IsApplicable when 'best' is null.
529 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
531 (IsAncestralType): Extract from OverloadResolve.
532 (OverloadResolve): Make robust to the MethodGroupExpr being
533 unsorted. Implement all the logic of Section 14.5.5.1, and
534 support overloading of methods from multiple applicable types.
535 Clean up logic somewhat. Don't pass null methods to BetterFunction.
537 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
538 (RealError, Warning): Append type of report to related symbol.
540 2004-09-03 Marek Safar <marek.safar@seznam.cz>
542 * enum.cs: Fixed CLS-Compliance checks for enum members.
543 Error tests cs3008-8.cs, cs3014-8.cs
545 2004-09-02 Marek Safar <marek.safar@seznam.cz>
547 Fixed bug #62342, #63102
548 * class.cs: ImplementIndexer uses member.IsExplicitImpl
549 like ImplementMethod.
551 2004-09-02 Marek Safar <marek.safar@seznam.cz>
553 * attribute.cs (Attribute.GetAttributeArgumentExpression):
556 2004-09-02 Martin Baulig <martin@ximian.com>
558 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
559 TypeManager.GetArgumentTypes() rather than calling GetParameters()
562 2004-09-01 Marek Safar <marek.safar@seznam.cz>
564 C# 2.0 Static classes implemented
566 * class.cs (TypeContainer): instance_constructors,
567 initialized_fields, initialized_static_fields,
568 default_constructor, base_inteface_types are protected to be
569 accessible from StaticClass.
570 (TypeContainer.DefineDefaultConstructor): New virtual method
571 for custom default constructor generating
572 (StaticClass): New class to handle "Static classes" feature.
574 * cs-parser.jay: Handle static keyword on class like instance
577 * driver.cs: Added "/langversion" command line switch with two
578 options (iso-1, default).
580 2004-08-31 Marek Safar <marek.safar@seznam.cz>
582 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
584 2004-08-31 Miguel de Icaza <miguel@ximian.com>
586 * delegate.cs: Style.
588 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
590 * delegate.cs: Add seperate instance expr field for miguel.
592 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
594 * PointerArithmetic (Resolve): make sure we are not doing
595 pointer arith on void*. Also, make sure we are resolved
596 by not setting eclass until resolve.
598 All callers: Make sure that PointerArithmetic gets resolved.
600 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
602 * ArrayCreation (LookupType): If the type does not resolve
603 to an array, give an error.
605 2004-08-27 Marek Safar <marek.safar@seznam.cz>
607 * statement.cs (Try.Resolve): Fixed bug #64222
609 2004-08-27 Martin Baulig <martin@ximian.com>
612 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
615 2004-08-26 Marek Safar <marek.safar@seznam.cz>
617 * ecore.cs (Constantify): Get underlying type via
618 System.Enum.GetUnderlyingType to avoid StackOverflow on the
619 Windows in special cases.
621 2004-08-26 Marek Safar <marek.safar@seznam.cz>
623 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
624 for obtaining also private methods.
625 (GetRemoveMethod): Used GetRemoveMethod (true)
626 for obtaining also private methods.
628 2004-08-24 Martin Baulig <martin@ximian.com>
630 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
631 MethodAttributes.HideBySig for operators.
633 2004-08-23 Martin Baulig <martin@ximian.com>
635 Back to the old error reporting system :-)
637 * report.cs (Message): Removed.
638 (Report.MessageData, ErrorData, WarningData): Removed.
639 (Report.Error, Warning): Back to the old system.
641 2004-08-23 Martin Baulig <martin@ximian.com>
643 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
645 * class.cs (TypeContainer.ParentContainer): New public virtual
646 method; replaces the explicit interface implementation.
647 (ClassPart.ParentContainer): Override.
649 2004-08-23 Martin Baulig <martin@ximian.com>
651 * statement.cs (Switch): Added support for constant switches; see
652 #59428 or test-285.cs.
654 2004-08-22 Marek Safar <marek.safar@seznam.cz>
657 * statement.cs (GetEnumeratorFilter): Removed useless
658 logic because C# specs is strict. GetEnumerator must be
661 2004-08-22 Martin Baulig <martin@ximian.com>
663 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
664 a switch and may break, reset the barrier. Fixes #59867.
666 2004-08-22 Marek Safar <marek.safar@seznam.cz>
668 CLS-Compliance speed up (~5% for corlib)
670 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
671 New method. Tests container for CLS-Compliant names
673 * class.cs (TypeContainer.VerifyClsName): New method.
674 Checks whether container name is CLS Compliant.
675 (Constructor): Implements IMethodData.
677 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
678 low-case table for CLS Compliance test.
679 (MemberCache.VerifyClsParameterConflict): New method.
680 Checks method parameters for CS3006 error.
682 * enum.cs (EnumMember): Is derived from MemberCore.
683 (Enum.VerifyClsName): Optimized for better performance.
685 2004-08-06 Marek Safar <marek.safar@seznam.cz>
687 * report.cs: Renamed Error_T to Error and changed all
690 2004-08-06 Marek Safar <marek.safar@seznam.cz>
692 * class.cs (TypeContainer.IndexerArrayList): New inner class
693 container for indexers.
694 (TypeContainer.DefaultIndexerName): New constant for default
695 indexer name. Replaced all "Item" with this constant.
696 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
698 * typemanager.cs (TypeManager.default_member_ctor): Cache here
699 DefaultMemberAttribute constructor.
701 2004-08-05 Martin Baulig <martin@ximian.com>
703 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
706 2004-08-05 Marek Safar <marek.safar@seznam.cz>
708 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
709 multi platforms problem.
711 * compiler.csproj: Included shared files.
713 2004-08-04 Marek Safar <marek.safar@seznam.cz>
715 Fix bug 60333, 55971 in the more general way
716 * attribute.cs (Attribute.GetAttributeArgumentExpression):
717 Added arg_type argument for constant conversion.
718 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
720 2004-08-04 Marek Safar <marek.safar@seznam.cz>
723 * class.cs (TypeContainer ): New inner classes MethodArrayList,
724 OperatorArrayList, MethodCoreArrayList for typecontainer
725 containers. Changed class member types to these new types.
726 (MethodArrayList.DefineMembers): Added test for CS0659.
728 2004-08-04 Miguel de Icaza <miguel@ximian.com>
730 * cfold.cs: Synchronize the folding with the code in expression.cs
731 Binary.DoNumericPromotions for uint operands.
733 * attribute.cs: Revert patch from Raja, it introduced a regression
734 while building Blam-1.2.1 (hard to isolate a test case).
736 2004-08-04 Marek Safar <marek.safar@seznam.cz>
740 (TypeContainer.Define): Renamed to DefineContainerMembers because of
742 (MethodCore.parent_method): New member. The method we're overriding
743 if this is an override method.
744 (MethodCore.CheckBase): Moved from Method class and made common.
745 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
747 (MethodCore.CheckForDuplications): New abstract method. For custom
748 member duplication search in a container
749 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
750 method and its return type.
751 (Event.conflict_symbol): New member. Symbol with same name in the
755 (MemberCache.FindMemberWithSameName): New method. The method
756 is looking for conflict with inherited symbols.
758 2004-08-04 Martin Baulig <martin@ximian.com>
760 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
762 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
764 2004-08-03 Marek Safar <marek.safar@seznam.cz>
766 * report.cs (Message): New enum for better error, warning reference in
768 (MessageData): New inner abstract class. It generally handles printing of
769 error and warning messages.
770 Removed unused Error, Warning, Message methods.
772 2004-08-03 Marek Safar <marek.safar@seznam.cz>
774 Fix for cs0592-8.cs test
776 (Attributable.ValidAttributeTargets): Made public.
777 (Attribute.ExplicitTarget): New member for explicit target value.
778 (Attribute.CheckTargets): Now we translate explicit attribute
779 target to Target here.
781 2004-08-03 Ben Maurer <bmaurer@ximian.com>
783 * ecore.cs (MethodGroupExpr): new IsBase property.
785 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
787 * delegate.cs (DelegateCreation): store a MethodGroupExpr
788 rather than an instance expr.
790 (DelegateCreation.Emit): Use the method group rather than
791 the instance expression. Also, if you have base.Foo as the
792 method for a delegate, make sure to emit ldftn, not ldftnvirt.
794 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
796 (NewDelegate.DoResolve): Only check for the existance of Invoke
797 if the method is going to be needed. Use MethodGroupExpr.
799 (NewDelegate.Emit): Remove, DelegateCreation implements this.
801 * expression.cs: For pointer arith., make sure to use
802 the size of the type, not the size of the pointer to
805 2004-08-03 Marek Safar <marek.safar@seznam.cz>
808 * class.cs (Class): Added error CS0502 test.
810 2004-08-03 John Luke <jluke@cfl.rr.com>
811 Raja R Harinath <rharinath@novell.com>
814 * attribute.cs (Attribute.complained_before): New flag.
815 (Attribute.ResolveType, Attribute.Resolve),
816 (Attribute.DefinePInvokeMethod): Set it.
817 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
819 2004-08-03 Martin Baulig <martin@ximian.com>
821 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
822 use a user-defined operator; we still need to do numeric
823 promotions in case one argument is a builtin type and the other
824 one has an implicit conversion to that type. Fixes #62322.
826 2004-08-02 Martin Baulig <martin@ximian.com>
828 * statement.cs (LocalInfo.Flags): Added `IsThis'.
829 (LocalInfo.IsThis): New public property.
830 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
832 2004-08-01 Martin Baulig <martin@ximian.com>
834 * class.cs (TypeContainer.GetClassBases): Don't set the default
835 here since we may get called from GetPartialBases().
836 (TypeContainer.DefineType): If GetClassBases() didn't return a
837 parent, use the default one.
839 2004-07-30 Duncan Mak <duncan@ximian.com>
841 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
843 2004-07-30 Martin Baulig <martin@ximian.com>
845 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
847 * class.cs (SourceMethod): New public class, derive from the
848 symbol writer's ISourceMethod.
849 (Method): Use the new symbol writer API.
851 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
852 as argument and use the new symbol writer.
855 (SourceFile): Implement the symbol writer's ISourceFile.
856 (Location.SymbolDocument): Removed.
857 (Location.SourceFile): New public property.
859 * symbolwriter.cs: Use the new symbol writer API.
861 2004-07-30 Raja R Harinath <rharinath@novell.com>
863 * Makefile (install-local): Remove. Functionality moved to
866 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
868 * Makefile: Install mcs.exe.config file together with mcs.exe.
869 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
870 correct runtime version.
872 2004-07-25 Martin Baulig <martin@ximian.com>
875 (TypeContainer.RegisterOrder): Removed, this was unused.
876 (TypeContainer, interface_order): Removed.
877 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
878 TypeContainer as argument since we can also be called with a
879 `PartialContainer' for a partial class/struct/interface.
880 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
881 of checking whether we're an `Interface' - we could be a
883 (PartialContainer.Register): Override; call
884 AddClass()/AddStruct()/AddInterface() on our parent.
886 * cs-parser.jay (interface_member_declaration): Add things to the
887 `current_container', not the `current_class'.
889 * rootcontext.cs (RegisterOrder): The overloaded version which
890 takes an `Interface' was unused, removed.
892 * typemanager.cs (TypeManager.LookupInterface): Return a
893 `TypeContainer', not an `Interface'.
894 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
895 contain a `PartialContainer' for an interface, so check it's
896 `Kind' to figure out what it is.
898 2004-07-25 Martin Baulig <martin@ximian.com>
900 * class.cs (Class.DefaultTypeAttributes): New public constant.
901 (Struct.DefaultTypeAttributes): Likewise.
902 (Interface.DefaultTypeAttributes): Likewise.
903 (PartialContainer.TypeAttr): Override this and add the
904 DefaultTypeAttributes.
906 2004-07-25 Martin Baulig <martin@ximian.com>
908 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
909 we can just use the `Parent' field instead.
911 2004-07-25 Martin Baulig <martin@ximian.com>
913 * class.cs (TypeContainer.Emit): Renamed to EmitType().
915 2004-07-25 Martin Baulig <martin@ximian.com>
917 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
918 our parts before defining any methods.
919 (TypeContainer.VerifyImplements): Make this virtual.
920 (ClassPart.VerifyImplements): Override and call VerifyImplements()
921 on our PartialContainer.
923 2004-07-25 Martin Baulig <martin@ximian.com>
925 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
927 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
928 argument, we can just use the `Parent' field instead.
931 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
932 (MemberBase.DoDefine): Likewise.
934 2004-07-24 Martin Baulig <martin@ximian.com>
936 * decl.cs (MemberCore.Parent): New public field.
937 (DeclSpace.Parent): Moved to MemberCore.
939 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
940 (MemberBase.ctor): Added TypeContainer argument, pass it to our
942 (FieldBase, Field, Operator): Likewise.
943 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
944 (EventField, Event): Likewise.
946 2004-07-23 Martin Baulig <martin@ximian.com>
948 * class.cs (PartialContainer): New public class.
949 (ClassPart): New public class.
950 (TypeContainer): Added support for partial classes.
951 (TypeContainer.GetClassBases): Splitted some of the functionality
952 out into GetNormalBases() and GetPartialBases().
954 * cs-tokenizer.cs (Token.PARTIAL): New token.
955 (Tokenizer.consume_identifier): Added some hacks to recognize
956 `partial', but only if it's immediately followed by `class',
957 `struct' or `interface'.
959 * cs-parser.jay: Added support for partial clases.
961 2004-07-23 Martin Baulig <martin@ximian.com>
963 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
964 a `DeclSpace' and also made it readonly.
965 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
966 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
967 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
969 * cs-parser.jay: Pass the `current_class', not the
970 `current_container' (at the moment, this is still the same thing)
971 to a new Method, Property, Event, Indexer or Constructor.
973 2004-07-23 Martin Baulig <martin@ximian.com>
975 * cs-parser.jay (CSharpParser): Added a new `current_class' field
976 and removed the `current_interface' one.
977 (struct_declaration, class_declaration, interface_declaration):
978 Set `current_class' to the newly created class/struct/interface;
979 set their `Bases' and call Register() before parsing their body.
981 2004-07-23 Martin Baulig <martin@ximian.com>
983 * class.cs (Kind): New public enum.
984 (TypeContainer): Made this class abstract.
985 (TypeContainer.Kind): New public readonly field.
986 (TypeContainer.CheckDef): New public method; moved here from
988 (TypeContainer.Register): New public abstract method.
989 (TypeContainer.GetPendingImplementations): New public abstract
991 (TypeContainer.GetClassBases): Removed the `is_class' and
992 `is_iface' parameters.
993 (TypeContainer.DefineNestedTypes): Formerly known as
995 (ClassOrStruct): Made this class abstract.
997 * tree.cs (RootTypes): New public type.
999 2004-07-20 Martin Baulig <martin@ximian.com>
1001 * tree.cs (Tree.RecordNamespace): Removed.
1002 (Tree.Namespaces): Removed.
1004 * rootcontext.cs (RootContext.IsNamespace): Removed.
1006 * cs-parser.jay (namespace_declaration): Just create a new
1007 NamespaceEntry here.
1009 2004-07-20 Martin Baulig <martin@ximian.com>
1011 * statement.cs (ExceptionStatement): New abstract class. This is
1012 now used as a base class for everyone who's using `finally'.
1013 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
1014 our local variables before using them.
1016 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
1017 virtual method. This is used by Yield.Resolve() to "steal" an
1018 outer block's `finally' clauses.
1019 (FlowBranchingException): The .ctor now takes an ExceptionStatement
1022 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
1023 version which takes an ExceptionStatement. This version must be
1024 used to create exception branchings.
1027 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
1028 (Iterator.EmitMoveNext): Added exception support; protect the
1029 block with a `fault' clause, properly handle 'finally' clauses.
1030 (Iterator.EmitDispose): Run all the `finally' clauses here.
1032 2004-07-20 Martin Baulig <martin@ximian.com>
1034 * iterator.cs: This is the first of a set of changes in the
1035 iterator code. Match the spec more closely: if we're an
1036 IEnumerable, then GetEnumerator() must be called. The first time
1037 GetEnumerator() is called, it returns the current instance; all
1038 subsequent invocations (if any) must create a copy.
1040 2004-07-19 Miguel de Icaza <miguel@ximian.com>
1042 * expression.cs: Resolve the constant expression before returning
1045 2004-07-19 Martin Baulig <martin@ximian.com>
1047 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
1048 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
1049 the return type of the new EmitContext.
1051 2004-07-18 Martin Baulig <martin@ximian.com>
1053 * class.cs (Property.Define): Fix iterators.
1055 * iterators.cs (Iterator.Define): Moved the
1056 `container.AddInterator (this)' call here from the .ctor; only do
1057 it if we resolved successfully.
1059 2004-07-17 Miguel de Icaza <miguel@ximian.com>
1061 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
1062 `true' for preprocessing directives that we parse. The return
1063 value indicates whether we should return to regular tokenizing or
1064 not, not whether it was parsed successfully.
1066 In the past if we were in: #if false ... #line #endif, we would
1067 resume parsing after `#line'. See bug 61604.
1069 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
1070 building: IsEnumType should return true only for enums, not for
1071 enums or System.Enum itself. This fixes #61593.
1073 Likely what happened is that corlib was wrong: mcs depended on
1074 this bug in some places. The bug got fixed, we had to add the
1075 hack, which caused bug 61593.
1077 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
1078 that was a workaround for the older conditions.
1080 2004-07-16 Ben Maurer <bmaurer@ximian.com>
1082 * assign.cs: IAssignMethod has a new interface, as documented
1083 inline. All assignment code now uses this new api.
1085 * ecore.cs, expression.cs: All classes which implement
1086 IAssignMethod now use the new interface.
1088 * expression.cs (Invocation): add a hack to EmitCall so that
1089 IndexerAccess can be the target of a compound assignment without
1090 evaluating its arguments twice.
1092 * statement.cs: Handle changes in Invocation api.
1094 2004-07-16 Martin Baulig <martin@ximian.com>
1096 * iterators.cs: Rewrote this. We're now using one single Proxy
1097 class for both the IEnumerable and the IEnumerator interface and
1098 `Iterator' derives from Class so we can use the high-level API.
1100 * class.cs (TypeContainer.AddIterator): New method.
1101 (TypeContainer.DoDefineType): New protected virtual method, which
1102 is called from DefineType().
1103 (TypeContainer.DoDefineMembers): Call DefineType() and
1104 DefineMembers() on all our iterators.
1105 (TypeContainer.Emit): Call Emit() on all our iterators.
1106 (TypeContainer.CloseType): Call CloseType() on all our iterators.
1108 * codegen.cs (EmitContext.CurrentIterator): New public field.
1110 2004-07-15 Martin Baulig <martin@ximian.com>
1113 (TypeManager.not_supported_exception_type): New type.
1115 2004-07-14 Martin Baulig <martin@ximian.com>
1117 * iterators.cs: Use real error numbers.
1119 2004-07-14 Martin Baulig <martin@ximian.com>
1121 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
1122 requires this to be a System.Collection.IEnumerable and not a
1123 class implementing that interface.
1124 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
1126 2004-07-13 Marek Safar <marek.safar@seznam.cz>
1128 * class.cs: Fixed previous fix, it broke some error tests.
1130 2004-07-12 Martin Baulig <martin@ximian.com>
1132 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
1135 2004-07-09 Miguel de Icaza <miguel@ximian.com>
1137 * assign.cs (LocalTemporary): Add new argument: is_address,If
1138 `is_address' is true, then the value that we store is the address
1139 to the real value, and not the value itself.
1141 * ecore.cs (PropertyExpr): use the new local temporary
1142 stuff to allow us to handle X.Y += z (where X is a struct)
1144 2004-07-08 Martin Baulig <martin@ximian.com>
1146 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
1147 not always return, just like we're doing in Using.Resolve().
1149 2004-07-07 Miguel de Icaza <miguel@ximian.com>
1151 * cs-parser.jay (fixed_statement): flag this as Pinned.
1153 2004-07-06 Miguel de Icaza <miguel@ximian.com>
1155 * typemanager.cs (TypeManager): Removed MakePinned method, this
1156 mechanism is replaced with the .NET 2.x compatible mechanism of
1157 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
1159 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
1160 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
1161 `IsFixed' property which has a different meaning.
1163 2004-07-02 Raja R Harinath <rharinath@novell.com>
1165 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
1166 visible from inside a nested class, not just the names of the
1167 immediately enclosing class.
1170 2004-06-24 Raja R Harinath <rharinath@novell.com>
1172 * expression.cs (BetterConversion): Remove buggy special-case
1173 handling of "implicit constant expression conversions". At this
1174 point, we already know that the conversion is possible -- we're
1175 only checking to see which is better.
1177 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1179 * cs-parser.jay: Added error CS0210 test.
1181 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1183 * cs-parser.jay: Added error CS0134 test.
1185 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1188 * cs-parser.jay: Added error CS0145 test.
1190 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1192 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
1194 2004-06-23 Ben Maurer <bmaurer@ximian.com>
1196 * expression.cs (StackAlloc.Resolve): The argument may not
1197 be a constant; deal with this case.
1199 2004-06-23 Marek Safar <marek.safar@seznam.cz>
1201 * attribute.cs (IndexerName_GetIndexerName): Renamed to
1202 GetIndexerAttributeValue.
1203 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
1205 * class.cs (Indexer.Define): Added error tests for CS0415,
1208 2004-06-23 Miguel de Icaza <miguel@ximian.com>
1210 * attribute.cs (Attribute.Resolve): Keep field code in sync with
1213 2004-06-23 Martin Baulig <martin@ximian.com>
1215 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
1216 neither return nor throw, reset the barrier as well. Fixes #60457.
1218 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
1220 * class.cs : EventAttributes is now set to None by default.
1221 This fixes bug #60459.
1223 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1226 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1227 Don't throw exception but return null (it's sufficient now).
1229 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1231 * typemanager.cs (GetArgumentTypes): Faster implementation.
1233 2004-06-18 Martin Baulig <martin@ximian.com>
1235 * attribute.cs (Attribute.Resolve): Check whether we're an
1236 EmptyCast which a Constant child. Fixes #60333.
1238 2004-06-17 Ben Maurer <bmaurer@ximian.com>
1240 * statement.cs (EmitCollectionForeach): Account for the fact that
1241 not all valuetypes are in areas which we can take the address of.
1242 For these variables, we store to a temporary variable. Also, make
1243 sure that we dont emit a `callvirt' on a valuetype method.
1245 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1247 * expression.cs (StackAlloc.DoReSolve): Added test for
1248 negative parameter (CS0247).
1250 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1253 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
1255 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1258 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
1261 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1263 Fix bug #58254 & cs1555.cs, cs1556.cs
1264 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
1266 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1268 * cs-parser.jay: Added error CS1669 test for indexers.
1270 2004-06-11 Martin Baulig <martin@ximian.com>
1272 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
1273 call this twice: for params and varargs methods.
1275 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1278 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
1280 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1282 * attribute.cs (Attribute.GetValidTargets): Made public.
1285 (AbstractPropertyEventMethod): New class for better code sharing.
1286 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
1288 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
1290 2004-06-11 Raja R Harinath <rharinath@novell.com>
1293 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
1294 that the call to Resolve is part of a MemberAccess.
1295 (Expression.Resolve): Use it for SimpleName resolution.
1296 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
1297 Add 'intermediate' boolean argument.
1298 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
1299 error message when the SimpleName can be resolved ambiguously
1300 between an expression and a type.
1301 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
1303 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
1304 call on the left-side.
1306 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1309 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
1311 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1313 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
1315 2004-06-11 Martin Baulig <martin@ximian.com>
1317 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
1318 varargs methods if applicable.
1320 2004-06-11 Martin Baulig <martin@ximian.com>
1322 * expression.cs (Invocation.EmitCall): Don't use
1323 `method.CallingConvention == CallingConventions.VarArgs' since the
1324 method could also have `CallingConventions.HasThis'.
1326 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1328 * class.cs (Event.GetSignatureForError): Implemented.
1329 Fixed crash in error test cs3010.cs
1331 2004-06-10 Miguel de Icaza <miguel@ximian.com>
1333 * cs-tokenizer.cs: Change the way we track __arglist to be
1334 consistent with the other keywords.
1336 2004-06-09 Miguel de Icaza <miguel@ximian.com>
1338 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
1341 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
1343 * codegen.cs: Check that all referenced assemblies have a strongname
1344 before strongnaming the compiled assembly. If not report error CS1577.
1345 Fix bug #56563. Patch by Jackson Harper.
1346 * typemanager.cs: Added a method to return all referenced assemblies.
1347 Fix bug #56563. Patch by Jackson Harper.
1349 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1352 (Method.ApplyAttributeBuilder): Moved and added conditional
1353 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
1356 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
1358 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1361 * class.cs: (EventField.attribute_targets): Changed default target.
1363 2004-06-08 Martin Baulig <martin@ximian.com>
1365 * expression.cs (Invocation.EmitCall): Enable varargs methods.
1367 2004-06-08 Martin Baulig <martin@ximian.com>
1369 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
1371 2004-06-07 Martin Baulig <martin@ximian.com>
1373 Added support for varargs methods.
1375 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
1378 * cs-parser.jay: Added support for `__arglist'.
1380 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
1382 * expression.cs (Argument.AType): Added `ArgList'.
1383 (Invocation): Added support for varargs methods.
1384 (ArglistAccess): New public class.
1385 (Arglist): New public class.
1387 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
1389 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
1390 a method's top-level block if the method has varargs.
1392 * support.cs (ReflectionParameters, InternalParameters): Added
1393 support for varargs methods.
1395 2004-06-07 Miguel de Icaza <miguel@ximian.com>
1397 * class.cs: Provide location in indexer error report.
1399 * driver.cs: Use standard names.
1401 * namespace.cs: Catch the use of using after a namespace has been
1402 declared also on using aliases.
1404 2004-06-03 Raja R Harinath <rharinath@novell.com>
1407 * typemanager.cs (closure_private_ok, closure_invocation_type)
1408 (closure_qualifier_type, closure_invocation_assembly)
1409 (FilterWithClosure): Move to ...
1410 (Closure): New internal nested class.
1411 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
1412 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
1413 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
1414 (MemberLookup, MemberLookupFailed): Use it.
1415 * expression.cs (New.DoResolve): Treat the lookup for the
1416 constructor as being qualified by the 'new'ed type.
1417 (Indexers.GetIndexersForTypeOrInterface): Update.
1419 2004-06-03 Marek Safar <marek.safar@seznam.cz>
1422 (GetConditionalAttributeValue): New method. Returns
1423 condition of ConditionalAttribute.
1424 (SearchMulti): New method. Returns all attributes of type 't'.
1425 Use it when attribute is AllowMultiple = true.
1426 (IsConditionalMethodExcluded): New method.
1429 (Method.IsExcluded): Implemented. Returns true if method has conditional
1430 attribute and the conditions is not defined (method is excluded).
1431 (IMethodData): Extended interface for ConditionalAttribute support.
1432 (PropertyMethod.IsExcluded): Implemented.
1435 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
1438 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
1441 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
1443 * expression.cs (ArrayCreationExpression): Make this just an
1444 `expression'. It can't be a statement, so the code here was
1447 2004-06-02 Marek Safar <marek.safar@seznam.cz>
1450 * typemanager.cs (GetFullNameSignature): New method for
1453 2004-06-02 Marek Safar <marek.safar@seznam.cz>
1456 * class.cs (MemberBase.GetSignatureForError): New virtual method.
1457 Use this method when MethodBuilder is null.
1458 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
1459 Added test for error CS0626 (MONO reports error for this situation).
1460 (IMethodData.GetSignatureForError): Extended interface.
1462 2004-06-01 Marek Safar <marek.safar@seznam.cz>
1465 (AttributeTester.GetObsoleteAttribute): Returns instance of
1466 ObsoleteAttribute when type is obsolete.
1469 (TypeContainer.VerifyObsoleteAttribute): Override.
1470 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
1471 (MethodCode.VerifyObsoleteAttribute): Override.
1472 (MemberBase.VerifyObsoleteAttribute): Override.
1475 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
1476 and report proper error.
1479 Delegate.VerifyObsoleteAttribute): Override.
1482 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
1483 and report proper error.
1484 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
1487 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
1491 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
1492 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
1493 Added test for ObsoleteAttribute.
1496 (Catch): Derived from Statement.
1498 2004-06-01 Marek Safar <marek.safar@seznam.cz>
1500 Fixed bug #59071 & cs0160.cs
1502 * statement.cs (Try.Resolve): Check here whether order of catch
1503 clauses matches their dependencies.
1505 2004-05-31 Miguel de Icaza <miguel@ximian.com>
1507 * Reverted patch to namespace.cs (Use lookuptypedirect). This
1508 caused a regression: #59343. Referencing nested classes from an
1509 assembly stopped working.
1511 2004-05-31 Martin Baulig <martin@ximian.com>
1513 MCS is now frozen for beta 2.
1515 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1517 * convert.cs: add a trivial cache for overload operator resolution.
1519 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1521 * decl.cs: If possible, use lookuptypedirect here. We can only do
1522 this if there is no `.' after the namespace. Avoids using
1523 LookupType, which does lots of slow processing.
1524 (FindNestedType) New method, does what it says :-).
1525 * namespace.cs: use LookupTypeDirect.
1526 * rootcontext.cs: use membercache, if possible.
1527 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
1529 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1532 According to the spec,
1534 In a member access of the form E.I, if E is a single identifier,
1535 and if the meaning of E as a simple-name (§7.5.2) is a constant,
1536 field, property, localvariable, or parameter with the same type as
1537 the meaning of E as a type-name (§3.8), then both possible
1538 meanings of E are permitted.
1540 We did not check that E as a simple-name had the same type as E as
1543 This trivial check gives us 5-7% on bootstrap time.
1545 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
1547 * expression.cs (Invocation.OverloadResolve): Avoid the
1548 use of hashtables and boxing here by allocating on demand.
1550 2004-05-30 Martin Baulig <martin@ximian.com>
1552 * rootcontext.cs (RootContext.LookupType): Don't cache things if
1553 we're doing a silent lookup. Don't try to lookup nested types in
1554 TypeManager.object_type (thanks to Ben Maurer).
1556 2004-05-30 Martin Baulig <martin@ximian.com>
1558 Committing a patch from Ben Maurer.
1560 * rootcontext.cs (RootContext.LookupType): Cache negative results.
1562 2004-05-29 Martin Baulig <martin@ximian.com>
1564 * class.cs (IMethodData.ShouldIgnore): New method.
1566 * typemanager.cs (TypeManager.MethodFlags): Don't take a
1567 `Location' argument, we don't need it anywhere. Use
1568 `IMethodData.ShouldIgnore ()' instead of
1569 `MethodData.GetMethodFlags ()'.
1570 (TypeManager.AddMethod): Removed.
1571 (TypeManager.AddMethod2): Renamed to AddMethod.
1573 2004-05-29 Martin Baulig <martin@ximian.com>
1575 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
1577 * convert.cs (Convert.ImplicitReferenceConversion): If we're
1578 converting from a class type S to an interface type and we already
1579 have an object on the stack, don't box it again. Fixes #52578.
1581 2004-05-29 Martin Baulig <martin@ximian.com>
1583 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1584 Added support for `params' parameters. Fixes #59267.
1586 2004-05-29 Martin Baulig <martin@ximian.com>
1588 * literal.cs (NullPointer): Provide a private .ctor which sets
1589 `type' to TypeManager.object_type. Fixes #59048.
1591 2004-05-29 Martin Baulig <martin@ximian.com>
1593 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
1594 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
1596 * ecore.cs (EventExpr.instance_expr): Make the field private.
1598 2004-05-26 Marek Safar <marek.safar@seznam.cz>
1600 Fixed bug #50080 & cs0214-2.cs
1601 * expression.cs (Cast.DoResolve): Check unsafe context here.
1603 * statement.cs (Resolve.DoResolve): Likewise.
1605 2004-05-26 Martin Baulig <martin@ximian.com>
1607 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
1609 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
1610 (RootContext.LookupType): Pass down the `silent' flag.
1612 2004-05-25 Martin Baulig <martin@ximian.com>
1615 (MethodGroupExpr.IdenticalTypeName): New public property.
1616 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
1617 expression actually refers to a type.
1619 2004-05-25 Martin Baulig <martin@ximian.com>
1621 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
1622 for #56176 and made it actually work.
1624 2004-05-25 Martin Baulig <martin@ximian.com>
1626 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
1627 (FieldExpr, PropertyExpr): Override and implement
1628 CacheTemporaries. Fixes #52279.
1630 2004-05-25 Miguel de Icaza <miguel@ximian.com>
1632 * location.cs: In the new compiler listing a file twice is a
1633 warning, not an error.
1635 2004-05-24 Martin Baulig <martin@ximian.com>
1637 * enum.cs (Enum.DefineType): For the `BaseType' to be a
1638 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
1640 2004-05-24 Martin Baulig <martin@ximian.com>
1642 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
1643 walking the `using' list. Fixes #53921.
1645 2004-05-24 Martin Baulig <martin@ximian.com>
1647 * const.cs (Const.LookupConstantValue): Added support for
1648 EmptyCast's; fixes #55251.
1650 2004-05-24 Martin Baulig <martin@ximian.com>
1652 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
1653 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
1654 which does the CS0135 check. The reason is that we first need to
1655 check whether the variable actually exists.
1657 2004-05-24 Martin Baulig <martin@ximian.com>
1659 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
1660 than RootContext.LookupType() to find the explicit interface
1663 2004-05-24 Raja R Harinath <rharinath@novell.com>
1665 * Makefile: Simplify. Use executable.make.
1666 * mcs.exe.sources: New file. List of sources of mcs.exe.
1668 2004-05-24 Anders Carlsson <andersca@gnome.org>
1672 Use the invariant culture when doing String.Compare for CLS case
1675 2004-05-23 Martin Baulig <martin@ximian.com>
1677 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
1678 don't have any dots. Fixes #52622, added cs0246-8.cs.
1680 * namespace.cs (NamespaceEntry.Lookup): Likewise.
1682 2004-05-23 Marek Safar <marek.safar@seznam.cz>
1684 * class.cs (MemberBase.Define): Reuse MemberType member for
1685 resolved type. Other methods can use it too.
1687 2004-05-23 Martin Baulig <martin@ximian.com>
1689 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
1690 the variable also exists in the current block (otherwise, we need
1691 to report a CS0103). Fixes #58670.
1693 2004-05-23 Martin Baulig <martin@ximian.com>
1695 * flowanalysis.cs (Reachability.Reachable): Compute this
1696 on-the-fly rather than storing it as a field.
1698 2004-05-23 Martin Baulig <martin@ximian.com>
1700 * flowanalysis.cs (Reachability.And): Manually compute the
1701 resulting `barrier' from the reachability.
1703 2004-05-23 Marek Safar <marek.safar@seznam.cz>
1706 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
1707 instance of ObsoleteAttribute when symbol is obsolete.
1710 (IMethodData): Extended interface for ObsoleteAttribute support.
1712 2004-05-22 Marek Safar <marek.safar@seznam.cz>
1714 * attribute.cs: Fix bug #55970
1716 2004-05-22 Marek Safar <marek.safar@seznam.cz>
1720 (GetObsoleteAttribute): New method. Creates the instance of
1722 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
1723 ObsoleteAttribute when member is obsolete.
1724 (AttributeTester.Report_ObsoleteMessage): Common method for
1725 Obsolete error/warning reporting.
1728 (TypeContainer.base_classs_type): New member for storing parent type.
1731 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
1732 for this MemberCore.
1734 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1736 * attribute.cs, const.cs: Fix bug #58590
1738 2004-05-21 Martin Baulig <martin@ximian.com>
1740 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
1741 out parameters if the end of the method is unreachable. Fixes
1744 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1746 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
1747 Hari was right, why extra method.
1749 2004-05-21 Marek Safar <marek.safar@seznam.cz>
1751 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
1753 2004-05-20 Martin Baulig <martin@ximian.com>
1755 Merged this back from gmcs to keep the differences to a minumum.
1757 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
1758 instead of a Declspace.
1759 (Attribute.ResolveType): Likewise.
1760 (Attributes.Search): Likewise.
1761 (Attributes.Contains): Likewise.
1762 (Attributes.GetClsCompliantAttribute): Likewise.
1764 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
1766 (MethodData.ApplyAttributes): Take an EmitContext instead of a
1769 2004-05-19 Marek Safar <marek.safar@seznam.cz>
1771 Fix bug #58688 (MCS does not report error when the same attribute
1774 * attribute.cs (Attribute.Emit): Distinction between null and default.
1776 2004-05-19 Raja R Harinath <rharinath@novell.com>
1778 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
1779 of a top-level attribute without an attribute target.
1780 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
1782 (Attribute.Conditional_GetConditionName),
1783 (Attribute.Obsolete_GetObsoleteMessage): Update.
1784 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
1785 part of ScanForIndexerName.
1786 (Attribute.CanIgnoreInvalidAttribute): New function.
1787 (Attribute.ScanForIndexerName): Move to ...
1788 (Attributes.ScanForIndexerName): ... here.
1789 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
1790 (Attributes.Search): New internal variant that can choose not to
1791 complain if types aren't resolved. The original signature now
1793 (Attributes.GetClsCompliantAttribute): Use internal variant, with
1794 complaints suppressed.
1795 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
1796 only if it not useful.
1797 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
1798 top-level for attributes that are shared between the assembly
1799 and a top-level class.
1800 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
1801 * class.cs: Update to reflect changes.
1802 (DefineIndexers): Fuse loops.
1803 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
1804 a couple more variants of attribute names.
1806 2004-05-18 Marek Safar <marek.safar@seznam.cz>
1808 Fix bug #52585 (Implemented explicit attribute declaration)
1811 (Attributable.ValidAttributeTargets): New abstract method. It gets
1812 list of valid attribute targets for explicit target declaration.
1813 (Attribute.Target): It holds target itself.
1814 (AttributeSection): Removed.
1815 (Attribute.CheckTargets): New method. It checks whether attribute
1816 target is valid for the current element.
1819 (EventProperty): New class. For events that are declared like
1820 property (with add and remove accessors).
1821 (EventField): New class. For events that are declared like field.
1824 * cs-parser.jay: Implemented explicit attribute target declaration.
1826 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
1827 Override ValidAttributeTargets.
1830 (ReturnParameter): Class for applying custom attributes on
1832 (ParameterAtribute): New class. Class for applying custom
1833 attributes on the parameter type.
1835 2004-05-17 Miguel de Icaza <miguel@ximian.com>
1837 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
1840 (Method): Allow UNSAFE here.
1842 * modifiers.cs: Support unsafe reporting.
1844 2004-05-17 Marek Safar <marek.safar@seznam.cz>
1846 * decl.cs: Fix bug #58478.
1848 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1850 * statement.cs: When checking for unreachable code on an EmptyStatement,
1851 set the location. Fixes bug #58488.
1853 2004-05-13 Miguel de Icaza <miguel@ximian.com>
1855 * driver.cs: Add -pkg handling.
1857 From Gonzalo: UseShelLExecute=false
1859 2004-05-12 Marek Safar <marek.safar@seznam.cz>
1862 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
1864 (Attribute.IsClsCompliaceRequired): Moved to base for better
1866 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
1867 when attribute is AttributeUsageAttribute.
1868 (Attribute.GetValidTargets): Simplified.
1869 (Attribute.GetAttributeUsage): New method returns AttributeUsage
1870 attribute for this type.
1871 (Attribute.ApplyAttributes): Method renamed to Emit and make
1873 (GlobalAttributeSection): New class for special handling of global
1874 attributes (assembly, module).
1875 (AttributeSection.Emit): New method.
1877 * class.cs: Implemented Attributable abstract methods.
1878 (MethodCore.LabelParameters): Moved to Parameter class.
1879 (Accessor): Is back simple class.
1880 (PropertyMethod): Implemented Attributable abstract class.
1881 (DelegateMethod): Implemented Attributable abstract class.
1882 (Event): New constructor for disctintion between normal Event
1883 and Event with accessors.
1885 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
1887 * codegen.cs, const.cs, decl.cs, delegate.cs:
1888 (CommonAssemblyModulClass): Implemented Attributable abstract class
1891 * enum.cs: Implement IAttributeSupport interface.
1892 (EnumMember): New class for emum members. Implemented Attributable
1896 (ParameterBase): Is abstract.
1897 (ReturnParameter): New class for easier [return:] attribute handling.
1899 * typemanager.cs: Removed builder_to_attr.
1901 2004-05-11 Raja R Harinath <rharinath@novell.com>
1904 * attribute.cs (Attribute.GetPositionalValue): New function.
1905 * class.cs (TypeContainer.VerifyMembers): New function.
1906 (TypeContainer.Emit): Use it.
1907 (ClassOrStruct): New base class for Class and Struct.
1908 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
1909 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
1911 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
1912 then each non-static field should have a FieldOffset attribute.
1913 Otherwise, none of the fields should have a FieldOffset attribute.
1914 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
1915 and FieldOffset attributes.
1916 * typemanager.cs (TypeManager.struct_layout_attribute_type)
1917 (TypeManager.field_offset_attribute_type): New core types.
1918 (TypeManager.InitCoreTypes): Initialize them.
1920 2004-05-11 Michal Moskal <malekith@pld-linux.org>
1922 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
1923 Return correct type.
1926 2004-05-09 Miguel de Icaza <miguel@ximian.com>
1928 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
1929 be implicitly converted to ulong.
1931 * expression.cs: The logic for allowing operator &, | and ^ worked
1932 was wrong, it worked before because we did not report an error in
1933 an else branch. Fixes 57895.
1935 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
1936 allow volatile fields to be reference types.
1938 2004-05-07 Miguel de Icaza <miguel@ximian.com>
1940 * driver.cs: Add support for /debug-
1942 2004-05-07 Raja R Harinath <rharinath@novell.com>
1944 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
1945 Add a 'complain' parameter to silence errors.
1946 (Attribute.Resolve): Update to changes. Put in sanity check to catch
1947 silently overlooked type-resolutions.
1948 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
1950 (Attributes.Search): New function.
1951 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
1952 (Attributes.GetAttributeFullName): Remove hack.
1953 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
1954 Update to reflect changes.
1955 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1956 Use Attributes.Search instead of nested loops.
1958 2004-05-07 Marek Safar <marek.safar@seznam.cz>
1961 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
1962 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
1963 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
1965 * report.cs: (Report.Warning): Renamed to Warning_T because of
1966 parameter collision.
1968 2004-05-05 Raja R Harinath <rharinath@novell.com>
1970 * expression.cs (MemberAccess.ResolveMemberAccess):
1971 Exit with non-zero status after Report.Error.
1972 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
1974 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
1976 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
1978 * support.cs: Don't hang when the file is empty.
1980 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
1982 * support.cs: In SeekableStreamReader, compute the preamble size of the
1983 underlying stream. Position changes should take into account that initial
1986 2004-05-03 Todd Berman <tberman@sevenl.net>
1988 * driver.cs: remove unused GetSysVersion function.
1990 2004-05-03 Todd Berman <tberman@sevenl.net>
1992 * driver.cs: Remove the hack from saturday, as well as the hack
1993 from jackson (LoadAssemblyFromGac), also adds the CWD to the
1994 link_paths to get that bit proper.
1996 2004-05-01 Todd Berman <tberman@sevenl.net>
1998 * driver.cs: Try a LoadFrom before a Load, this checks the current
1999 path. This is currently a bug in mono that is be fixed, however, this
2000 provides a workaround for now. This will be removed when the bug
2003 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
2005 * CryptoConvert.cs: Updated to latest version. Fix issue with
2006 incomplete key pairs (#57941).
2008 2004-05-01 Todd Berman <tberman@sevenl.net>
2010 * driver.cs: Remove '.' from path_chars, now System.* loads properly
2013 2004-04-30 Jackson Harper <jackson@ximian.com>
2015 * codegen.cs: Open keys readonly.
2017 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2019 * typemanager.cs: don't report cyclic struct layout when a struct
2020 contains 2 or more fields of the same type. Failed for Pango.AttrShape
2021 which has 2 Pango.Rectangle fields.
2023 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
2025 * expression.cs: Handle IntPtr comparisons with IL code
2026 rather than a method call.
2028 2004-04-29 Martin Baulig <martin@ximian.com>
2030 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
2031 the list of PropertyInfo's in class hierarchy and find the
2032 accessor. Fixes #56013.
2034 2004-04-29 Martin Baulig <martin@ximian.com>
2036 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
2038 2004-04-29 Martin Baulig <martin@ximian.com>
2040 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2042 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
2044 2004-04-29 Martin Baulig <martin@ximian.com>
2046 * class.cs (ConstructorInitializer.Resolve): Check whether the
2047 parent .ctor is accessible. Fixes #52146.
2049 2004-04-29 Martin Baulig <martin@ximian.com>
2051 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2053 * statement.cs (Using.EmitLocalVariableDecls): Use
2054 TypeManager.idisposable_type, not typeof (IDisposable).
2055 (Foreach.EmitCollectionForeach): Added support for valuetypes.
2057 2004-04-29 Martin Baulig <martin@ximian.com>
2059 * class.cs (Event.Define): Don't emit the field and don't set
2060 RTSpecialName and SpecialName for events on interfaces. Fixes
2063 2004-04-29 Raja R Harinath <rharinath@novell.com>
2065 Refactor Attribute.ApplyAttributes.
2066 * attribute.cs (Attributable): New base class for objects that can
2067 have Attributes applied on them.
2068 (Attribute): Make AttributeUsage fields public.
2069 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
2070 (Attribute.IsInternalCall): New property.
2071 (Attribute.UsageAttr): Convert to a public read-only property.
2072 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
2073 (Attribute.ResolveType, Attribute.Resolve)
2074 (Attribute.ScanForIndexerName): Update to reflect changes.
2075 (Attribute.CheckAttributeTarget): Re-format.
2076 (Attribute.ApplyAttributes): Refactor, to various
2077 Attributable.ApplyAttributeBuilder methods.
2078 * decl.cs (MemberCore): Make Attributable.
2079 * class.cs (Accessor): Make Attributable.
2080 (MethodData.ApplyAttributes): Use proper attribute types, not
2082 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
2083 (TypeContainer.ApplyAttributeBuilder)
2084 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
2085 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
2086 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
2087 (Operator.ApplyAttributeBuilder): New factored-out methods.
2088 * const.cs (Const.ApplyAttributeBuilder): Likewise.
2089 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
2090 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
2091 * parameter.cs (ParameterBase): New Attributable base class
2092 that can also represent Return types.
2093 (Parameter): Update to the changes.
2095 2004-04-29 Jackson Harper <jackson@ximian.com>
2097 * driver.cs: Prefer the corlib system version when looking for
2098 assemblies in the GAC. This is still a hack, but its a better hack
2101 2004-04-29 Marek Safar <marek.safar@seznam.cz>
2103 * decl.cs, enum.cs: Improved error 3005 reporting.
2105 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
2106 (related_symbols): New private member for list of symbols
2107 related to reported error/warning.
2109 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
2111 2004-04-29 Martin Baulig <martin@ximian.com>
2113 * ecore.cs (Expression.Constantify): If we're an enum and
2114 TypeManager.TypeToCoreType() doesn't give us another type, use
2115 t.UnderlyingSystemType. Fixes #56178.
2117 2004-04-29 Martin Baulig <martin@ximian.com>
2119 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
2120 interfaces and for each interface, only add members directly
2121 declared in that interface. Fixes #53255.
2123 2004-04-28 Martin Baulig <martin@ximian.com>
2125 * expression.cs (ConditionalLogicalOperator): Use a temporary
2126 variable for `left' to avoid that we evaluate it more than once;
2129 2004-04-28 Martin Baulig <martin@ximian.com>
2131 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
2134 2004-04-28 Martin Baulig <martin@ximian.com>
2136 * statement.cs (LocalInfo.Resolve): Check whether the type is not
2139 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
2140 whether the type is not void (CS1547).
2142 2004-04-28 Martin Baulig <martin@ximian.com>
2144 * expression.cs (Unary.DoResolveLValue): Override this and report
2145 CS0131 for anything but Operator.Indirection.
2147 2004-04-28 Martin Baulig <martin@ximian.com>
2149 Committing a patch from Ben Maurer; see bug #50820.
2151 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2154 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2157 2004-04-28 Martin Baulig <martin@ximian.com>
2159 Committing a patch from Ben Maurer; see bug #50820.
2161 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2164 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2167 2004-04-28 Martin Baulig <martin@ximian.com>
2169 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
2170 (Block.AddLabel): Call DoLookupLabel() to only search in the
2173 2004-04-28 Martin Baulig <martin@ximian.com>
2175 * cfold.cs (ConstantFold.BinaryFold): Added special support for
2176 comparing StringConstants and NullLiterals in Equality and Inequality.
2178 2004-04-28 Jackson Harper <jackson@ximian.com>
2180 * driver.cs: Attempt to load referenced assemblies from the
2181 GAC. This is the quick and dirty version of this method that
2182 doesnt take into account versions and just takes the first
2183 canidate found. Will be good enough for now as we will not have more
2184 then one version installed into the GAC until I update this method.
2186 2004-04-28 Martin Baulig <martin@ximian.com>
2188 * typemanager.cs (TypeManager.CheckStructCycles): New public
2189 static method to check for cycles in the struct layout.
2191 * rootcontext.cs (RootContext.PopulateTypes): Call
2192 TypeManager.CheckStructCycles() for each TypeContainer.
2193 [Note: We only need to visit each type once.]
2195 2004-04-28 Martin Baulig <martin@ximian.com>
2197 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
2199 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
2200 success and added `out object value'. Use a `bool resolved' field
2201 to check whether we've already been called rather than
2202 `ConstantValue != null' since this breaks for NullLiterals.
2204 2004-04-28 Raja R Harinath <rharinath@novell.com>
2206 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
2207 setting of this flag, since the 'set' method may be non-public.
2209 2004-04-28 Raja R Harinath <rharinath@novell.com>
2211 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
2212 check on current_vector.Block.
2214 2004-04-27 Martin Baulig <martin@ximian.com>
2216 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
2217 a field initializer. Fixes #56459.
2219 2004-04-27 Martin Baulig <martin@ximian.com>
2221 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
2222 we're not attempting to use an indexer. Fixes #52154.
2224 2004-04-27 Martin Baulig <martin@ximian.com>
2226 * statement.cs (Return): Don't create a return label if we don't
2227 need it; reverts my change from January 20th. Thanks to Ben
2230 2004-04-27 Martin Baulig <martin@ximian.com>
2232 According to the spec, `goto' can only leave a nested scope, but
2235 * statement.cs (Block.LookupLabel): Only lookup in the current
2236 block, don't recurse into parent or child blocks.
2237 (Block.AddLabel): Check in parent and child blocks, report
2238 CS0140/CS0158 if we find a duplicate.
2239 (Block): Removed this indexer for label lookups.
2240 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
2241 this already does the error reporting for us.
2244 (FlowBranching.UsageVector.Block): New public variable; may be null.
2245 (FlowBranching.CreateSibling): Added `Block' argument.
2246 (FlowBranching.LookupLabel): New public virtual method. Lookup a
2247 label for the target of a `goto' and check whether we're not
2248 leaving a `finally'.
2250 2004-04-27 Martin Baulig <martin@ximian.com>
2252 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2253 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
2256 2004-04-27 Martin Baulig <martin@ximian.com>
2258 * statement.cs (Block.AddLabel): Also check for implicit blocks
2259 and added a CS0158 check.
2261 2004-04-27 Martin Baulig <martin@ximian.com>
2263 * flowanalysis.cs (FlowBranchingLoop): New class.
2264 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
2265 UsageVector's instead of an ArrayList.
2266 (FlowBranching.Label): Likewise.
2267 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
2268 (FlowBranching.AddBreakVector): New method.
2270 2004-04-27 Miguel de Icaza <miguel@ximian.com>
2272 * attribute.cs: Small regression fix: only convert the type if we
2273 the type is different, fixes System.Drawing build.
2275 2004-04-27 Martin Baulig <martin@ximian.com>
2277 * attribute.cs (Attribute.Resolve): If we have a constant value
2278 for a named field or property, implicity convert it to the correct
2281 2004-04-27 Raja R Harinath <rharinath@novell.com>
2283 * statement.cs (Block.Block): Implicit blocks share
2284 'child_variable_names' fields with parent blocks.
2285 (Block.AddChildVariableNames): Remove.
2286 (Block.AddVariable): Mark variable as "used by a child block" in
2287 every surrounding block.
2288 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
2289 been used in a child block, complain about violation of "Invariant
2290 meaning in blocks" rule.
2291 * cs-parser.jay (declare_local_variables): Don't use
2292 AddChildVariableNames.
2293 (foreach_statement): Don't create an implicit block: 'foreach'
2296 2004-04-23 Miguel de Icaza <miguel@ximian.com>
2298 * convert.cs (ImplicitNumericConversion): 0 is also positive when
2299 converting from 0L to ulong. Fixes 57522.
2301 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2303 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
2304 derived class hides via 'new' keyword field from base class (test-242.cs).
2305 TODO: Handle this in the more general way.
2307 * class.cs (CheckBase): Ditto.
2309 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2311 * decl.cs (caching_flags): New member for storing cached values
2313 (MemberCore.Flags): New enum where bit flags for caching_flags
2315 (MemberCore.cls_compliance): Moved to caching_flags.
2316 (DeclSpace.Created): Moved to caching_flags.
2318 * class.cs: Use caching_flags instead of DeclSpace.Created
2320 2004-04-21 Miguel de Icaza <miguel@ximian.com>
2322 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
2323 if we are only a derived class, not a nested class.
2325 * typemanager.cs: Same as above, but do this at the MemberLookup
2326 level (used by field and methods, properties are handled in
2327 PropertyExpr). Allow for the qualified access if we are a nested
2330 2004-04-21 Marek Safar <marek.safar@seznam.cz>
2332 * class.cs: Refactoring.
2333 (IMethodData): New inteface; Holds links to parent members
2334 to avoid member duplication (reduced memory allocation).
2335 (Method): Implemented IMethodData interface.
2336 (PropertyBase): New inner classes for get/set methods.
2337 (PropertyBase.PropertyMethod): Implemented IMethodData interface
2338 (Event): New inner classes for add/remove methods.
2339 (Event.DelegateMethod): Implemented IMethodData interface.
2341 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
2342 EmitContext (related to class.cs refactoring).
2344 2004-04-21 Raja R Harinath <rharinath@novell.com>
2346 * delegate.cs (Delegate.VerifyApplicability): If the number of
2347 arguments are the same as the number of parameters, first try to
2348 verify applicability ignoring any 'params' modifier on the last
2352 2004-04-16 Raja R Harinath <rharinath@novell.com>
2354 * class.cs (TypeContainer.AddIndexer): Use
2355 'ExplicitInterfaceName' to determine if interface name was
2356 explicitly specified. 'InterfaceType' is not initialized at this time.
2357 (TypeContainer.DefineIndexers): Remove use of temporary list. The
2358 Indexers array is already in the required order. Initialize
2359 'IndexerName' only if there are normal indexers.
2360 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
2361 (TypeContainer.Emit): Emit DefaultMember attribute only if
2362 IndexerName is initialized.
2365 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
2367 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
2370 2004-04-15 Raja R Harinath <rharinath@novell.com>
2372 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
2376 * attribute.cs (Attribute.Resolve): Check for duplicate named
2380 2004-04-15 Miguel de Icaza <miguel@ximian.com>
2382 * iterators.cs (MarkYield): track whether we are in an exception,
2383 and generate code accordingly. Use a temporary value to store the
2384 result for our state.
2386 I had ignored a bit the interaction of try/catch with iterators
2387 since their behavior was not entirely obvious, but now it is
2388 possible to verify that our behavior is the same as MS .NET 2.0
2392 2004-04-14 Miguel de Icaza <miguel@ximian.com>
2394 * iterators.cs: Avoid creating temporaries if there is no work to
2397 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
2398 Enumerations, use TypeManager.EnumToUnderlying and call
2401 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
2404 (This.Emit): Use EmitContext.EmitThis to emit our
2407 (This.EmitAssign): Ditto.
2409 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
2410 codepaths, we will move all the functionality into
2413 (FieldExpr.EmitAssign): Ditto.
2415 This fixes several hidden bugs that I uncovered while doing a code
2416 review of this today.
2418 * codegen.cs (EmitThis): reworked so the semantics are more clear
2419 and also support value types "this" instances.
2421 * iterators.cs: Changed so that for iterators in value types, we
2422 do not pass the value type as a parameter.
2424 Initialization of the enumerator helpers is now done in the caller
2425 instead of passing the parameters to the constructors and having
2426 the constructor set the fields.
2428 The fields have now `assembly' visibility instead of private.
2430 2004-04-11 Miguel de Icaza <miguel@ximian.com>
2432 * expression.cs (Argument.Resolve): Check if fields passed as ref
2433 or out are contained in a MarshalByRefObject.
2435 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
2436 another compiler type.
2438 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
2440 * class.cs (Indexer.Define): use the new name checking method.
2441 Also, return false on an error.
2442 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
2443 (is_identifier_[start/part]_character): make static.
2445 2004-04-10 Miguel de Icaza <miguel@ximian.com>
2447 * expression.cs (Binary.ResolveOperator): Do no append strings
2448 twice: since we can be invoked more than once (array evaluation)
2449 on the same concatenation, take care of this here. Based on a fix
2450 from Ben (bug #56454)
2452 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
2454 * codegen.cs: Fix another case where CS1548 must be reported (when
2455 delay-sign isn't specified and no private is available #56564). Fix
2456 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
2457 error when MCS is used on the MS runtime and we need to delay-sign
2458 (which seems unsupported by AssemblyBuilder - see #56621).
2460 2004-04-08 Marek Safar <marek.safar@seznam.cz>
2462 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
2463 (TypeManager.ComputeNamespaces): Faster implementation for
2466 * compiler.csproj: Updated AssemblyName to mcs.
2468 2004-04-07 Miguel de Icaza <miguel@ximian.com>
2470 * rootcontext.cs: Add new types to the boot resolution.
2472 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
2473 MulticastDelegate is not allowed.
2475 * typemanager.cs: Add new types to lookup: System.TypedReference
2478 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
2479 check for TypedReference or ArgIterator, they are not allowed.
2481 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
2482 makes us properly catch 1510 in some conditions (see bug 56016 for
2485 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
2487 * CryptoConvert.cs: update from corlib version
2490 2004-04-05 Miguel de Icaza <miguel@ximian.com>
2492 * class.cs (Indexer.Define): Check indexername declaration
2494 2004-04-05 Marek Safar <marek.safar@seznam.cz>
2496 * attribute.cs (IsClsCompliant): Fixed problem with handling
2497 all three states (compliant, not-compliant, undetected).
2499 2004-03-30 Marek Safar <marek.safar@seznam.cz>
2501 * attribute.cs (Attribute): Location is now public.
2502 (Resolve): Store resolved arguments (pos_values) in attribute class.
2503 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
2504 (GetClsCompliantAttributeValue): New method that gets
2505 CLSCompliantAttribute value.
2506 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
2507 if exists else null.
2508 (AttributeTester): New class for CLS-Compliant verification routines.
2510 * class.cs (Emit): Add CLS-Compliant verification.
2511 (Method.GetSignatureForError): Implemented.
2512 (Constructor.GetSignatureForError): Implemented
2513 (Constructor.HasCompliantArgs): Returns if constructor has
2514 CLS-Compliant arguments.
2515 (Constructor.Emit): Override.
2516 (Construcor.IsIdentifierClsCompliant): New method; For constructors
2517 is needed to test only parameters.
2518 (FieldBase.GetSignatureForError): Implemented.
2519 (TypeContainer): New member for storing base interfaces.
2520 (TypeContainer.FindMembers): Search in base interfaces too.
2522 * codegen.cs (GetClsComplianceAttribute): New method that gets
2523 assembly or module CLSCompliantAttribute value.
2524 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
2526 (ModuleClass.Emit): Add error 3012 test.
2528 * const.cs (Emit): Override and call base for CLS-Compliant tests.
2530 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
2531 state for all decl types.
2532 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
2533 if CLS-Compliant tests are required.
2534 (IsClsCompliaceRequired): New method. Analyze whether code
2535 must be CLS-Compliant.
2536 (IsExposedFromAssembly): New method. Returns true when MemberCore
2537 is exposed from assembly.
2538 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
2539 value or gets cached value.
2540 (HasClsCompliantAttribute): New method. Returns true if MemberCore
2541 is explicitly marked with CLSCompliantAttribute.
2542 (IsIdentifierClsCompliant): New abstract method. This method is
2543 used to testing error 3005.
2544 (IsIdentifierAndParamClsCompliant): New method. Common helper method
2545 for identifier and parameters CLS-Compliant testing.
2546 (VerifyClsCompliance): New method. The main virtual method for
2547 CLS-Compliant verifications.
2548 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
2549 null. I don't know why is null (too many public members !).
2550 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
2551 and get value of first CLSCompliantAttribute that found.
2553 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
2554 (VerifyClsCompliance): Override and add extra tests.
2556 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
2557 clscheck- disable CLS-Compliant verification event if assembly is has
2558 CLSCompliantAttribute(true).
2560 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
2561 ApllyAttribute is now called in emit section as in the other cases.
2562 Possible future Emit integration.
2563 (IsIdentifierClsCompliant): New override.
2564 (VerifyClsCompliance): New override.
2565 (GetEnumeratorName): Returns full enum name.
2567 * parameter.cs (GetSignatureForError): Implemented.
2569 * report.cs (WarningData): New struct for Warning message information.
2570 (LocationOfPreviousError): New method.
2571 (Warning): New method. Reports warning based on the warning table.
2572 (Error_T): New method. Reports error based on the error table.
2574 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
2575 verifications are done here.
2577 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
2579 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
2580 CLSCompliantAttribute.
2581 (all_imported_types): New member holds all imported types from other
2583 (LoadAllImportedTypes): New method fills static table with exported types
2584 from all referenced assemblies.
2585 (Modules): New property returns all assembly modules.
2587 2004-03-30 Miguel de Icaza <miguel@ximian.com>
2589 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
2590 throwing a parser error.
2592 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
2593 which removes the hardcoded get_/set_ prefixes for properties, as
2594 IL allows for the properties to be named something else.
2598 * expression.cs: Do not override operand before we know if it is
2601 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2603 * typemanager.cs: support for pinned variables.
2605 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2607 * decl.cs, typemanager.cs: Avoid using an arraylist
2608 as a buffer if there is only one result set.
2610 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
2612 * expression.cs: Make sure you cant call a static method
2613 with an instance expression, bug #56174.
2615 2004-03-29 Miguel de Icaza <miguel@ximian.com>
2617 * class.cs (IsDuplicateImplementation): Improve error reporting to
2618 flag 663 (method only differs in parameter modifier).
2620 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
2621 in preprocessor directives.
2623 * location.cs (LookupFile): Allow for the empty path.
2625 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
2626 better approach for some of that patch, but its failing with the
2627 CharSet enumeration. For now try/catch will do.
2629 * typemanager.cs: Do not crash if a struct does not have fields.
2632 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2634 * expression.cs: cs0213, cant fix a fixed expression.
2637 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2639 * cs-parser.jay: detect invalid embeded statements gracefully.
2642 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
2644 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
2647 the invocation type may not be a subclass of the tye of the item/
2648 The type of the item must be a subclass of the invocation item.
2653 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
2655 * attribute.cs: Added methods to get a string and a bool from an
2656 attribute. Required to information from AssemblyKeyFileAttribute,
2657 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
2658 * codegen.cs: Modified AssemblyName creation to include support for
2659 strongnames. Catch additional exceptions to report them as CS1548.
2660 * compiler.csproj: Updated include CryptoConvert.cs.
2661 * compiler.csproj.user: Removed file - user specific configuration.
2662 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
2663 Mono.Security assembly. The original class is maintained and tested in
2664 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
2665 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
2666 like CSC 8.0 (C# v2) supports.
2667 * Makefile: Added CryptoConvert.cs to mcs sources.
2668 * rootcontext.cs: Added new options for strongnames.
2670 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
2672 * driver.cs: For --expect-error, report error code `2'
2673 if the program compiled with no errors, error code `1' if
2674 it compiled with an error other than the one expected.
2676 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
2678 * compiler.csproj: Updated for Visual Studio .NET 2003.
2679 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
2680 * compiler.sln: Updated for Visual Studio .NET 2003.
2682 2004-03-24 Ravi Pratap M <ravi@ximian.com>
2684 * expression.cs: Fix bug #47234. We basically need to apply the
2685 rule that we prefer the conversion of null to a reference type
2686 when faced with a conversion to 'object' (csc behaviour).
2688 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2690 * statement.cs: Shorter form for foreach, eliminates
2691 a local variable. r=Martin.
2693 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2695 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
2696 checks if we can use brtrue/brfalse to test for 0.
2697 * expression.cs: use the above in the test for using brtrue/brfalse.
2700 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2702 * expression.cs: Rewrite string concat stuff. Benefits:
2704 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
2705 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
2706 rather than a concat chain.
2708 * typemanager.cs: Add lookups for more concat overloads.
2710 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
2712 * expression.cs: Emit shorter il code for array init.
2729 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
2731 * statement.cs: Before, two switch blocks would be merged if the
2732 total size of the blocks (end_item - begin_item + 1) was less than
2733 two times the combined sizes of the blocks.
2735 Now, it will only merge if after the merge at least half of the
2740 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
2742 * class.cs : csc build fix for GetMethods(). See bug #52503.
2744 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
2746 * expression.cs: Make sure fp comparisons work with NaN.
2747 This fixes bug #54303. Mig approved this patch a long
2748 time ago, but we were not able to test b/c the runtime
2751 2004-03-19 Miguel de Icaza <miguel@ximian.com>
2753 * ecore.cs (TypExpr.GetHashCode): implement this overload.
2755 2004-03-19 Martin Baulig <martin@ximian.com>
2757 * class.cs (MemberCore.IsDuplicateImplementation): Report the
2758 error here and not in our caller.
2760 2004-03-19 Martin Baulig <martin@ximian.com>
2762 * interface.cs: Completely killed this file.
2763 (Interface): We're now a TypeContainer and live in class.cs.
2765 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
2766 argument; we're now also called for interfaces.
2767 (TypeContainer.DefineMembers): Allow this method being called
2769 (TypeContainer.GetMethods): New public method; formerly known as
2770 Interface.GetMethod(). This is used by PendingImplementation.
2771 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
2772 it's now private and non-static.
2773 (Interface): Moved this here; it's now implemented similar to
2775 (Method, Property, Event, Indexer): Added `bool is_interface'
2776 argument to their .ctor's.
2777 (MemberBase.IsInterface): New public field.
2779 * cs-parser.jay: Create normal Method, Property, Event, Indexer
2780 instances instead of InterfaceMethod, InterfaceProperty, etc.
2781 (opt_interface_base): Removed; we now use `opt_class_base' instead.
2782 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
2784 2004-03-19 Martin Baulig <martin@ximian.com>
2786 * class.cs (MethodCore.IsDuplicateImplementation): New private
2787 method which does the CS0111 checking.
2788 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
2789 Use IsDuplicateImplementation().
2791 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
2793 * decl.cs (FindMemberToOverride): New method to find the correct
2794 method or property to override in the base class.
2796 - Make Method/Property use the above method to find the
2797 version in the base class.
2798 - Remove the InheritableMemberSignatureCompare as it is now
2801 This patch makes large code bases much faster to compile, as it is
2802 O(n) rather than O(n^2) to do this validation.
2804 Also, it fixes bug 52458 which is that nested classes are not
2805 taken into account when finding the base class member.
2807 Reviewed/Approved by Martin.
2809 2004-03-17 Marek Safar <marek.safar@seznam.cz>
2811 * interface.cs: In all interface classes removed redundant
2812 member initialization.
2814 2004-03-16 Martin Baulig <martin@ximian.com>
2816 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
2818 2004-03-15 Miguel de Icaza <miguel@ximian.com>
2820 * decl.cs (DefineTypeAndParents): New helper method to define a
2821 type's containers before the type itself is defined; This is a
2822 bug exposed by the recent changes to Windows.Forms when an
2823 implemented interface was defined inside a class that had not been
2826 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
2828 (Check): Loop correctly to report errors modifiers
2829 (UNSAFE was not in the loop, since it was the same as TOP).
2831 * interface.cs: Every interface member now takes a ModFlags,
2832 instead of a "is_new" bool, which we set on the base MemberCore.
2834 Every place where we called "UnsafeOk" in the interface, now we
2835 call the proper member (InterfaceMethod.UnsafeOK) instead to get
2836 the unsafe settings from the member declaration instead of the
2837 container interface.
2839 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
2841 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
2842 `set_indexer_name' to the pending bits (one per type).
2844 We fixed a bug today that was picking the wrong method to
2845 override, since for properties the existing InterfaceMethod code
2846 basically ignored the method name. Now we make sure that the
2847 method name is one of the valid indexer names.
2849 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
2851 * support.cs (SeekableStreamReader): Keep track of stream byte
2852 positions and don't mix them with character offsets to the buffer.
2854 Patch from Gustavo Giráldez
2856 2004-03-15 Marek Safar <marek.safar@seznam.cz>
2858 * interface.cs (InterfaceSetGetBase): Removed double member
2859 initialization, base class does it as well.
2861 2004-03-13 Martin Baulig <martin@ximian.com>
2863 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
2864 when compiling corlib.
2866 2004-03-13 Miguel de Icaza <miguel@ximian.com>
2868 * convert.cs (ExplicitConversion): We were reporting an error on
2869 certain conversions (object_type source to a value type, when the
2870 expression was `null') before we had a chance to pass it through
2871 the user defined conversions.
2873 * driver.cs: Replace / and \ in resource specifications to dots.
2876 * class.cs: Add check for duplicate operators. Fixes 52477
2878 2004-03-11 Miguel de Icaza <miguel@ximian.com>
2880 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
2881 that are in the middle of the statements, not only at the end.
2884 * class.cs (TypeContainer.AddField): No longer set the
2885 `HaveStaticConstructor' flag, now we call it
2886 `UserDefineStaticConstructor' to diferentiate the slightly
2887 semantic difference.
2889 The situation is that we were not adding BeforeFieldInit (from
2890 Modifiers.TypeAttr) to classes that could have it.
2891 BeforeFieldInit should be set to classes that have no static
2896 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
2898 And most importantly Zoltan's comment:
2900 http://bugzilla.ximian.com/show_bug.cgi?id=44229
2902 "I think beforefieldinit means 'it's ok to initialize the type sometime
2903 before its static fields are used', i.e. initialization does not need
2904 to be triggered by the first access to the type. Setting this flag
2905 helps the JIT to compile better code, since it can run the static
2906 constructor at JIT time, and does not need to generate code to call it
2907 (possibly lots of times) at runtime. Unfortunately, mcs does not set
2908 this flag for lots of classes like String.
2910 csc sets this flag if the type does not have an explicit static
2911 constructor. The reasoning seems to be that if there are only static
2912 initalizers for a type, and no static constructor, then the programmer
2913 does not care when this initialization happens, so beforefieldinit
2916 This bug prevents the AOT compiler from being usable, since it
2917 generates so many calls to mono_runtime_class_init that the AOT code
2918 is much slower than the JITted code. The JITted code is faster,
2919 because it does not generate these calls if the vtable is type is
2920 already initialized, which is true in the majority of cases. But the
2921 AOT compiler can't do this."
2923 2004-03-10 Miguel de Icaza <miguel@ximian.com>
2925 * class.cs (MethodData.Emit): Refactor the code so symbolic
2926 information is generated for destructors; For some reasons we
2927 were taking a code path that did not generate symbolic information
2930 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
2932 * class.cs: Create a Constructor.CheckBase method that
2933 takes care of all validation type code. The method
2934 contains some code that was moved from Define.
2936 It also includes new code that checks for duplicate ctors.
2937 This fixes bug #55148.
2939 2004-03-09 Joshua Tauberer <tauberer@for.net>
2941 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
2942 a { ... }-style array creation invokes EmitStaticInitializers
2943 which is not good for reference-type arrays. String, decimal
2944 and now null constants (NullCast) are not counted toward
2945 static initializers.
2947 2004-03-05 Martin Baulig <martin@ximian.com>
2949 * location.cs (SourceFile.HasLineDirective): New public field;
2950 specifies whether the file contains or is referenced by a "#line"
2952 (Location.DefineSymbolDocuments): Ignore source files which
2953 either contain or are referenced by a "#line" directive.
2955 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
2957 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
2958 direct access to our parent, so check the method inline there.
2960 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
2962 * expression.cs (Invocation.EmitCall): Miguel's last commit
2963 caused a regression. If you had:
2968 In Foo the implict this would be null.
2970 2004-02-27 Miguel de Icaza <miguel@ximian.com>
2972 * expression.cs (Invocation.EmitCall): If the method is not
2973 virtual, do not emit a CallVirt to it, use Call.
2975 * typemanager.cs (GetFullNameSignature): Improve the method to
2976 cope with ".ctor" and replace it with the type name.
2978 * class.cs (ConstructorInitializer.Resolve): Now the method takes
2979 as an argument the ConstructorBuilder where it is being defined,
2980 to catch the recursive constructor invocations.
2982 2004-02-26 Miguel de Icaza <miguel@ximian.com>
2984 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
2985 routines to check if a type is an enumerable/enumerator allow
2986 classes that implement the IEnumerable or IEnumerator interfaces.
2988 * class.cs (Property, Operator): Implement IIteratorContainer, and
2989 implement SetYields.
2991 (Property.Define): Do the block swapping for get_methods in the
2992 context of iterators. We need to check if Properties also
2993 include indexers or not.
2995 (Operator): Assign the Block before invoking the
2996 OperatorMethod.Define, so we can trigger the Iterator code
2999 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
3000 Property and Operator classes are not created when we parse the
3001 declarator but until we have the block completed, so we use a
3002 singleton SimpleIteratorContainer.Simple to flag whether the
3003 SetYields has been invoked.
3005 We propagate this setting then to the Property or the Operator to
3006 allow the `yield' to function.
3008 2004-02-25 Marek Safar <marek.safar@seznam.cz>
3010 * codegen.cs: Implemented attribute support for modules.
3011 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
3012 Assembly/Module functionality.
3014 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
3015 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
3016 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
3018 2004-02-16 Marek Safar <marek.safar@seznam.cz>
3020 * interface.cs (FindMembers): The operation is performed on all base
3021 interfaces and not only on the first. It is required for future CLS Compliance patch.
3023 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
3025 * statement.cs, codegen.cs:
3026 This patch deals with patterns such as:
3028 public class List : IEnumerable {
3030 public MyEnumerator GetEnumerator () {
3031 return new MyEnumerator(this);
3034 IEnumerator IEnumerable.GetEnumerator () {
3038 public struct MyEnumerator : IEnumerator {
3043 Before, there were a few things we did wrong:
3044 1) we would emit callvirt on a struct, which is illegal
3045 2) we emited ldarg when we needed to emit ldarga
3046 3) we would mistakenly call the interface methods on an enumerator
3047 type that derived from IEnumerator and was in another assembly. For example:
3049 public class MyEnumerator : IEnumerator
3051 Would have the interface methods called, even if there were public impls of the
3052 method. In a struct, this lead to invalid IL code.
3054 2004-02-11 Marek Safar <marek.safar@seznam.cz>
3056 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
3059 * delegate.cs (Define): Fixed crash when delegate type is undefined.
3061 2004-02-11 Miguel de Icaza <miguel@ximian.com>
3063 * cs-parser.jay: Fix small regression: we were not testing V2
3064 compiler features correctly.
3066 * interface.cs: If the emit context is null, then create one
3068 2004-02-09 Marek Safar <marek.safar@seznam.cz>
3070 * decl.cs (GetSignatureForError): New virtual method to get full name
3073 * attribute.cs (IAttributeSupport): New interface for attribute setting.
3074 Now it is possible to rewrite ApplyAttributes method to be less if/else.
3076 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
3077 Duplicated members and code in these classes has been removed.
3078 Better encapsulation in these classes.
3080 2004-02-07 Miguel de Icaza <miguel@ximian.com>
3082 * assign.cs (Assign.DoResolve): When dealing with compound
3083 assignments, there is a new rule in ECMA C# 2.4 (might have been
3084 there before, but it is documented here) that states that in:
3088 If b is of type int, and the `op' is a shift-operator, then the
3089 above is evaluated as:
3093 * expression.cs (Binary.ResolveOperator): Instead of testing for
3094 int/uint/long/ulong, try to implicitly convert to any of those
3095 types and use that in pointer arithmetic.
3097 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
3098 method to print information for from the type, not from the
3099 null-method we were given.
3101 2004-02-01 Duncan Mak <duncan@ximian.com>
3103 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
3104 parsing for cmd, fixes bug #53694.
3106 2004-02-04 Marek Safar <marek.safar@seznam.cz>
3108 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
3109 in the member name duplication tests. Property and operator name duplication
3110 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
3112 2004-02-03 Marek Safar <marek.safar@seznam.cz>
3114 * interface.cs (PopulateMethod): Fixed crash when interface method
3115 returns not existing type (error test cs0246-3.cs).
3117 2004-02-02 Ravi Pratap M <ravi@ximian.com>
3119 * cs-parser.jay (interface_accessors): Re-write actions to also
3120 store attributes attached to get and set methods. Fix spelling
3123 (inteface_property_declaration): Modify accordingly.
3125 (InterfaceAccessorInfo): New helper class to store information to pass
3126 around between rules that use interface_accessors.
3128 * interface.cs (Emit): Apply attributes on the get and set
3129 accessors of properties and indexers too.
3131 * attribute.cs (ApplyAttributes): Modify accordingly to use the
3132 right MethodBuilder when applying attributes to the get and set accessors.
3134 2004-01-31 Miguel de Icaza <miguel@ximian.com>
3136 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
3138 2004-01-26 Miguel de Icaza <miguel@ximian.com>
3140 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
3142 2004-01-25 Miguel de Icaza <miguel@ximian.com>
3144 * cs-parser.jay: Remove YIELD token, instead use the new grammar
3145 changes that treat `yield' specially when present before `break'
3148 * cs-tokenizer.cs: yield is no longer a keyword.
3150 2004-01-23 Marek Safar <marek.safar@seznam.cz>
3152 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
3153 setting for default constructors.
3154 For default constructors are almost every time set wrong Modifier. The
3155 generated IL code has been alright. But inside mcs this values was
3156 wrong and this was reason why several of my CLS Compliance tests
3159 2004-01-22 Martin Baulig <martin@ximian.com>
3161 * cs-parser.jay (namespace_or_type_name): Return an Expression,
3162 not a QualifiedIdentifier. This is what `type_name_expression'
3163 was previously doing.
3164 (type_name_expression): Removed; the code is now in
3165 `namespace_or_type_name'.
3166 (qualified_identifier): Removed, use `namespace_or_type_name'
3168 (QualifiedIdentifier): Removed this class.
3170 2004-01-22 Martin Baulig <martin@ximian.com>
3172 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
3173 not a string as alias name.
3175 2004-01-21 Miguel de Icaza <miguel@ximian.com>
3177 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
3178 #52730 bug, and instead compute correctly the need to use a
3179 temporary variable when requesting an address based on the
3180 static/instace modified of the field and the constructor.
3182 2004-01-21 Martin Baulig <martin@ximian.com>
3184 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
3185 class and namespace before looking up aliases. Fixes #52517.
3187 2004-01-21 Martin Baulig <martin@ximian.com>
3189 * flowanalysis.cs (UsageVector.Merge): Allow variables being
3190 assinged in a 'try'; fixes exception4.cs.
3192 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3193 * class.cs : Implemented parameter-less constructor for TypeContainer
3195 * decl.cs: Attributes are now stored here. New property OptAttributes
3197 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
3199 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
3201 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3203 * typemanager.cs (CSharpSignature): Now reports also inner class name.
3204 (CSharpSignature): New method for indexer and property signature.
3206 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3208 * pending.cs (IsVirtualFilter): Faster implementation.
3210 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3212 * typemanager.cs: Avoid inclusion of same assembly more than once.
3214 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3216 * cs-parser.jay: Fixed problem where the last assembly attribute
3217 has been applied also to following declaration (class, struct, etc.)
3219 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3221 * class.cs: Added error CS0538, CS0539 reporting.
3222 Fixed crash on Microsoft runtime when field type is void.
3224 * cs-parser.jay: Added error CS0537 reporting.
3226 * pending.cs: Added error CS0535 reporting.
3227 Improved error report for errors CS0536, CS0534.
3229 2004-01-20 Miguel de Icaza <miguel@ximian.com>
3231 Merge a few bits from the Anonymous Method MCS tree.
3233 * statement.cs (ToplevelBlock): New class for toplevel methods,
3234 will hold anonymous methods, lifted variables.
3236 * cs-parser.jay: Create toplevel blocks for delegates and for
3237 regular blocks of code.
3239 2004-01-20 Martin Baulig <martin@ximian.com>
3241 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
3242 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
3243 and `NeedExplicitReturn'; added `IsLastStatement'.
3244 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
3245 have a `ReturnLabel' or we're not unreachable.
3247 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
3248 child's reachability; don't just override ours with it. Fixes
3249 #58058 (lluis's example).
3250 (FlowBranching): Added public InTryOrCatch(), InCatch(),
3251 InFinally(), InLoop(), InSwitch() and
3252 BreakCrossesTryCatchBoundary() methods.
3254 * statement.cs (Return): Do all error checking in Resolve().
3255 Unless we are the last statement in a top-level block, always
3256 create a return label and jump to it.
3257 (Break, Continue): Do all error checking in Resolve(); also make
3258 sure we aren't leaving a `finally'.
3259 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
3260 statement in a top-level block.
3261 (Block.Flags): Added `IsDestructor'.
3262 (Block.IsDestructor): New public property.
3264 2004-01-20 Martin Baulig <martin@ximian.com>
3266 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
3268 2004-01-20 Martin Baulig <martin@ximian.com>
3270 * statement.cs (Statement.ResolveUnreachable): New public method.
3271 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
3272 (Block.Resolve): Resolve unreachable statements.
3274 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3276 * expression.cs: We need to fix the case where we do
3277 not have a temp variable here.
3279 * assign.cs: Only expression compound assignments need
3280 temporary variables.
3282 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3284 * flowanalysis.cs: Reduce memory allocation in a few ways:
3285 - A block with no variables should not allocate a bit
3287 - A method with no out parameters does not need any tracking
3288 for assignment of the parameters, so we need not allocate
3291 public readonly Type[] VariableTypes;
3292 public readonly string[] VariableNames;
3293 Are redundant. The data is already stored in the variable
3294 map, so we need not allocate another array for it.
3295 - We need to add alot of checks for if (params | locals) == null
3296 due to the first two changes.
3298 2004-01-18 Miguel de Icaza <miguel@ximian.com>
3300 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
3301 implement IMemoryLocation, we store a copy on a local variable and
3302 take the address of it. Patch from Benjamin Jemlich
3304 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
3305 to use a special "type_name_expression" rule which reduces the
3306 number of "QualifiedIdentifier" classes created, and instead
3307 directly creates MemberAccess expressions.
3309 2004-01-17 Miguel de Icaza <miguel@ximian.com>
3311 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
3312 that fixes #52853. Null literal assignment to ValueType
3314 * class.cs (MethodData.Emit): Instead of checking the name of the
3315 method to determine if its a destructor, create a new derived
3316 class from Method called Destructor, and test for that.
3318 * cs-parser.jay: Create a Destructor object instead of a Method.
3320 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
3324 2004-01-16 Miguel de Icaza <miguel@ximian.com>
3326 * expression.cs (Binary.ResolveOperator): Perform an implicit
3327 conversion from MethodGroups to their delegate types on the
3330 * delegate.cs: Introduce a new class DelegateCreation that is the
3331 base class for `NewDelegate' and `ImplicitDelegateCreation',
3332 factor some code in here.
3334 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
3335 conversion from MethodGroups to compatible delegate types.
3337 * ecore.cs (Expression.Resolve): Do not flag error 654
3338 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
3339 we allow conversions from MethodGroups to delegate types now.
3341 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
3342 assignments in v2 either.
3344 2004-01-10 Miguel de Icaza <miguel@ximian.com>
3346 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
3347 static read-only fields in ctors.
3349 Applied patch from Benjamin Jemlich
3351 * expression.cs (UnaryMutator): Avoid leaking local variables.
3353 2004-01-09 Miguel de Icaza <miguel@ximian.com>
3355 * cs-tokenizer.cs (IsCastToken): Allow the various native types
3356 here to return true, as they can be used like this:
3360 Fixed 49836 and all the other dups
3362 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
3364 * driver.cs: Implement /win32res and /win32icon.
3366 2004-01-08 Miguel de Icaza <miguel@ximian.com>
3368 * cs-parser.jay: Add a rule to improve error handling for the
3369 common mistake of placing modifiers after the type.
3371 2004-01-07 Miguel de Icaza <miguel@ximian.com>
3373 * cs-parser.jay (interface_event_declaration): Catch
3374 initialization of events on interfaces, and report cs0068
3376 * cs-parser.jay (interface_event_declaration): Catch
3377 initialization of events.
3379 * ecore.cs: Better report missing constructors.
3381 * expression.cs (Binary.ResolveOperator): My previous bug fix had
3382 the error reporting done in the wrong place. Fix.
3384 * expression.cs (Binary.ResolveOperator): Catch the
3385 operator + (E x, E y) error earlier, and later allow for implicit
3386 conversions in operator +/- (E e, U x) from U to the underlying
3389 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
3390 52596, if the container class is abstract, the default constructor
3391 is protected otherwise its public (before, we were always public).
3393 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
3396 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
3397 Jemlich that fixes bug #52597, MCS was generating invalid code for
3398 idisposable structs. Thanks to Ben for following up with this
3401 2004-01-06 Miguel de Icaza <miguel@ximian.com>
3403 * driver.cs: Allow assemblies without code to be generated, fixes
3406 2004-01-07 Nick Drochak <ndrochak@gol.com>
3408 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
3410 2004-01-05 Miguel de Icaza <miguel@ximian.com>
3412 * cs-parser.jay: Add rules to improve error reporting if fields or
3413 methods are declared at the namespace level (error 116)
3415 * Add rules to catch event add/remove
3417 2004-01-04 David Sheldon <dave-mono@earth.li>
3419 * expression.cs: Added matching ")" to error message for
3422 2004-01-03 Todd Berman <tberman@gentoo.org>
3424 * ecore.cs, attribute.cs:
3425 Applying fix from #52429.
3427 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3429 * ecore.cs, expression.cs, statement.cs:
3430 Total rewrite of how we handle branching. We
3431 now handle complex boolean expressions with fewer
3432 jumps. As well if (x == 0) no longer emits a ceq.
3434 if (x is Foo) is much faster now, because we generate
3437 Overall, we get a pretty big improvement on our benchmark
3438 tests. The code we generate is smaller and more readable.
3440 I did a full two-stage bootstrap. The patch was reviewed
3441 by Martin and Miguel.
3443 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3445 * cs-parser.jay: Make primary_expression not take a QI.
3446 we dont need this because the member_access rule covers
3447 us here. So we replace the rule with just IDENTIFIER.
3449 This has two good effects. First, we remove a s/r conflict.
3450 Second, we allocate many fewer QualifiedIdentifier objects.
3452 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3454 * attribute.cs: Handle MarshalAs attributes as pseudo, and
3455 set the correct information via SRE. This prevents
3456 hanging on the MS runtime. Fixes #29374.
3458 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3460 * convert.cs: correctly handle conversions to value types
3461 from Enum and ValueType as unboxing conversions.
3463 Fixes bug #52569. Patch by Benjamin Jemlich.
3465 2004-01-02 Ravi Pratap <ravi@ximian.com>
3467 * expression.cs (BetterConversion): Prefer int -> uint
3468 over int -> ulong (csc's behaviour). This fixed bug #52046.
3470 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
3472 * decl.cs (MemberCache.FindMembers): now returns a
3475 * typemanager.cs: In general, go with with ^^.
3476 (CopyNewMethods): take an IList.
3477 (RealMemberLookup): Only allocate an arraylist
3478 if we copy from two sets of methods.
3480 This change basically does two things:
3481 1) Fewer array lists allocated due to CopyNewMethods.
3482 2) the explicit cast in MemberList costed ALOT.
3484 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
3486 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
3487 a hashtable to avoid needless string allocations when an identifier is
3488 used more than once (the common case).
3490 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3492 * pending.cs: MS's TypeBuilder.GetInterfaces ()
3493 is broken, it will not return anything. So, we
3494 have to use the information we have in mcs to
3497 * typemanager.cs: Add a cache for GetInterfaces,
3498 since this will now be used more often (due to ^^)
3500 (GetExplicitInterfaces) New method that gets the
3501 declared, not effective, interfaces on a type
3502 builder (eg, if you have interface IFoo, interface
3503 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
3506 This patch makes MCS able to bootstrap itself on
3509 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3511 * expression.cs: Remove the Nop's that Miguel put
3514 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3516 * report.cs, codegen.cs: Give the real stack trace to
3517 the error when an exception is thrown.
3519 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3521 * decl.cs: only allocate hashtables for ifaces if
3524 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3526 * expression.cs: fix the error from cs0121-2.cs
3527 (a parent interface has two child interfaces that
3528 have a function with the same name and 0 params
3529 and the function is called through the parent).
3531 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
3533 * class.cs, rootcontext.cs, typmanager.cs: do not
3536 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
3538 * codegen.cs: remove stack for the ec flow branching.
3539 It is already a linked list, so no need.
3541 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
3543 * Makefile: Allow custom profiler here.
3545 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
3547 * typemanager.cs (LookupType):
3548 - Use a static char [], because split takes
3549 a param array for args, so it was allocating
3551 - Do not store true in a hashtable, it boxes.
3553 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
3555 * flowanalysis.cs: bytify common enums.
3557 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
3559 * modifiers.cs: Add a new set of flags for the
3560 flags allowed on explicit interface impls.
3561 * cs-parser.jay: catch the use of modifiers in
3562 interfaces correctly.
3563 * class.cs: catch private void IFoo.Blah ().
3565 All related to bug #50572.
3567 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
3569 * decl.cs: Rewrite the consistant accessability checking.
3570 Accessability is not linear, it must be implemented in
3571 a tableish way. Fixes #49704.
3573 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
3575 * expression.cs: Handle negation in a checked context.
3576 We must use subtraction from zero. Fixes #38674.
3578 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
3580 * class.cs: Ignore static void main in DLLs.
3581 * rootcontext.cs: Handle the target type here,
3582 since we are have to access it from class.cs
3583 * driver.cs: account for the above.
3585 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
3587 * report.cs: Give line numbers and files if available.
3589 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
3591 * driver.cs: Implement /addmodule.
3593 * typemanager.cs: Change 'modules' field so it now contains Modules not
3596 2003-12-20 Martin Baulig <martin@ximian.com>
3598 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
3599 (FieldBase.IsAssigned): Removed this field.
3600 (FieldBase.SetAssigned): New public method.
3601 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
3603 2003-12-20 Martin Baulig <martin@ximian.com>
3605 * expression.cs (LocalVariableReference.DoResolve): Don't set
3606 `vi.Used' if we're called from DoResolveLValue().
3608 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
3609 returns the usage vector it just merged into the current one -
3610 pass this one to UsageWarning().
3611 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
3612 of the `EmitContext', don't call this recursively on our children.
3614 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
3616 * driver.cs: Implement /target:module.
3618 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
3620 * support.cs (CharArrayHashtable): New helper class.
3622 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
3623 char arrays, not strings, so we can avoid creating a string in
3624 consume_identifier if the identifier is a keyword.
3626 2003-12-16 Martin Baulig <martin@ximian.com>
3628 * statement.cs (LocalInfo.Assigned): Removed this property.
3629 (LocalInfo.Flags): Removed `Assigned'.
3630 (LocalInfo.IsAssigned): New public method; takes the EmitContext
3631 and uses flow analysis.
3632 (Block.UsageWarning): Made this method private.
3633 (Block.Resolve): Call UsageWarning() if appropriate.
3635 * expression.cs (LocalVariableReference.DoResolve): Always set
3636 LocalInfo.Used here.
3638 2003-12-13 Martin Baulig <martin@ximian.com>
3640 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
3641 any value here; we're now using flow analysis to figure out
3642 whether a statement/block returns a value.
3644 2003-12-13 Martin Baulig <martin@ximian.com>
3646 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
3648 (FlowBranching.MergeFinally): Don't call
3649 `branching.CheckOutParameters()' here, this is called in
3651 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
3652 when adding the `finally' vector.
3654 2003-12-13 Martin Baulig <martin@ximian.com>
3657 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
3658 actually work and also fix #48962.
3660 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
3662 * decl.cs: Do not check System.Object for nested types,
3663 since we know it does not have any. Big bang for buck:
3668 corlib: 17.99 seconds
3672 corlib: 17.39 seconds
3674 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
3676 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
3677 time we are returning 0 members, so we save alot here.
3679 2003-12-11 Martin Baulig <martin@ximian.com>
3681 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
3682 `MergeChild()', also just take the `FlowBranching' as argument;
3683 call Merge() on it and return the result.
3684 (FlowBranching.Merge): We don't need to do anything if we just
3687 2003-12-11 Martin Baulig <martin@ximian.com>
3689 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
3690 them in an `ArrayList' to reduce memory usage. Thanks to Ben
3691 Maurer for this idea.
3693 2003-12-11 Martin Baulig <martin@ximian.com>
3695 * flowanalysis.cs (MergeResult): This class is now gone; we now
3696 use the `UsageVector' for this. The reason for this is that if a
3697 branching just has one sibling, we don't need to "merge" them at
3698 all - that's the next step to do.
3699 (FlowBranching.Merge): We now return a `UsageVector' instead of a
3702 2003-12-11 Martin Baulig <martin@ximian.com>
3704 Reworked flow analyis and made it more precise and bug-free. The
3705 most important change is that we're now using a special `Reachability'
3706 class instead of having "magic" meanings of `FlowReturns'. I'll
3707 do some more cleanups and optimizations and also add some more
3708 documentation this week.
3710 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
3711 largely reworked this class.
3712 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
3713 the new `Reachability' class instead of having "magic" values here.
3714 (FlowBranching): We're now using an instance of `Reachability'
3715 instead of having separate `Returns', `Breaks' etc. fields.
3717 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
3718 based on flow analysis; ignore the return value of block.Emit ().
3720 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
3722 * driver.cs typemanager.cs: Find the mono extensions to corlib even
3723 if they are private.
3725 2003-12-09 Martin Baulig <martin@ximian.com>
3727 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
3728 call them directly on the UsageVector.
3730 2003-12-09 Martin Baulig <martin@ximian.com>
3732 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
3733 Changed return type from `FlowReturns' to `Reachability'.
3735 2003-12-09 Martin Baulig <martin@ximian.com>
3737 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
3738 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
3739 `Reachable' fields with a single `Reachability' one.
3741 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3743 * class.cs (FindMembers): Remove foreach's.
3756 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3761 This patch does a few things:
3762 1. EmptyStatement is now a singleton, so it is never reallocated.
3763 2. All blah is EmptyStatement constructs have been changed to
3764 blah == EmptyStatement.Value, which is much faster and valid
3765 now that EmptyStatement is a singleton.
3766 3. When resolving a block, rather than allocating a new array for
3767 the non-empty statements, empty statements are replaced with
3768 EmptyStatement.Value
3769 4. Some recursive functions have been made non-recursive.
3770 Mainly the performance impact is from (3), however (1) and (2) are needed for
3771 this to work. (4) does not make a big difference in normal situations, however
3772 it makes the profile look saner.
3777 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3778 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3779 Total memory allocated: 56397 KB
3782 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
3783 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
3784 Total memory allocated: 55666 KB
3786 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3788 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
3789 than the hashtable in a hashtable version
3791 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
3792 we always end up concating a string. This results in a huge perf
3793 loss, because many strings have to be tracked by the GC. In this
3794 patch, we first use a hashtable that works with two keys, so that
3795 the strings do not need to be concat'ed.
3806 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
3808 * Makefile: Add a new target `do-time' that does a quick and simple
3809 profile, leaving easy to parse output.
3811 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
3813 * codegen.cs (Init): Create the dynamic assembly with
3814 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
3816 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
3818 * support.cs: Make the PtrHashtable use only one
3819 instance of its comparer.
3821 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
3823 * typemanager.cs: Fix lookup of GetNamespaces.
3825 2003-11-29 Miguel de Icaza <miguel@ximian.com>
3827 * expression.cs: Removed redundant line.
3829 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
3830 ArrayLists, use for loops with bounds.
3832 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
3835 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
3836 arraylists, use for loop with bounds.
3838 The above three changes give us a 0.071 second performance
3839 improvement out of 3.294 seconds down to 3.223. On my machine
3840 the above changes reduced the memory usage by 1,387 KB during
3843 * cs-parser.jay (QualifiedIdentifier): New class used to represent
3844 QualifiedIdentifiers. Before we created a new string through
3845 concatenation, and mostly later on, the result would be
3846 manipulated by DecomposeQI through string manipulation.
3848 This reduced the compiler memory usage for bootstrapping from
3849 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
3850 compile times in 0.05 seconds.
3852 2003-11-28 Dick Porter <dick@ximian.com>
3854 * support.cs: Do string compares with the Invariant culture.
3862 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
3863 the comparison is done with the Invariant culture.
3865 2003-11-27 Miguel de Icaza <miguel@ximian.com>
3867 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
3868 GetEnumerator method.
3870 (ProbeCollectionType): Iterate starting at the most specific type
3871 upwards looking for a GetEnumerator
3873 * expression.cs: Shift count can be up to 31 for int/uint and 63
3876 2003-11-26 Miguel de Icaza <miguel@ximian.com>
3878 * statement.cs (Block.LookupLabel): Also look for the label on the
3879 children blocks. Use a hash table to keep track of visited
3882 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
3883 we actually did transform the other operand, otherwise fall back
3884 to the common codepath that casts to long.
3886 * cs-tokenizer.cs: Use the same code pattern as the int case.
3887 Maybe I should do the parsing myself, and avoid depending on the
3888 Parse routines to get this done.
3890 2003-11-25 Miguel de Icaza <miguel@ximian.com>
3892 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
3893 which fixes bug 51347. This time test it.
3895 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
3896 attributes for example can not tell the difference between these.
3897 The difference was only a syntax feature of the language.
3899 * attribute.cs: Apply attributes to delegates.
3901 * delegate.cs: Call the apply attributes method.
3903 2003-11-24 Miguel de Icaza <miguel@ximian.com>
3905 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
3906 comparing 0 vs Byte.MinValue, not the value
3908 (ImplicitConversionRequired): When reporting a conversion error,
3909 use error 31 to print out the constant error instead of the
3912 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
3913 which fixes bug 51347.
3915 2003-11-22 Miguel de Icaza <miguel@ximian.com>
3917 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
3918 which fixes the -warnaserror command line option.
3920 2003-11-21 Miguel de Icaza <miguel@ximian.com>
3922 * cfold.cs (DoNumericPromotions): During constant folding of
3923 additions on UIntConstant, special case intconstants with
3924 IntConstants like we do on the expression binary operator.
3926 2003-11-12 Miguel de Icaza <miguel@ximian.com>
3928 * convert.cs (ImplicitReferenceConversion): We were missing a case
3929 (System.Enum are not value types or class types, so we need to
3930 classify them separatedly).
3932 * driver.cs: We do not support error 2007.
3934 2003-11-12 Jackson Harper <jackson@ximian.com>
3936 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
3937 system directory. Also use the full file name so users can
3938 libraries names mscorlib-o-tron.dll in a non system dir.
3940 2003-11-10 Martin Baulig <martin@ximian.com>
3942 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
3943 (TypeManager.InitCoreTypes): Initialize them here, but instead of
3944 calling `ResolveType()' on them, directly assign their `Type'.
3946 2003-11-08 Martin Baulig <martin@ximian.com>
3948 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
3949 return value and the `out parent' parameter.
3950 (TypeContainer.DefineType): Moved the CS0644 check into
3951 GetClassBases(). Don't pass the interface types to the
3952 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
3953 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
3955 * ecore.cs (TypeExpr.IsAttribute): New property.
3956 (TypeExpr.GetInterfaces): New method.
3958 * interface.cs (Interface.GetInterfaceTypeByName): Return a
3959 TypeExpr instead of a Type.
3960 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
3961 (Interface.DefineType): Don't pass the interface types to the
3962 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
3963 them later and then call `TypeBulider.AddInterfaceImplementation()'.
3965 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
3966 instead of a `Type[]'.
3967 (TypeManager.RegisterBuilder): Likewise.
3968 (TypeManager.AddUserInterface): Likewise.
3969 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
3970 `Type[]' and also return a `TypeExpr[]'.
3971 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
3973 2003-11-08 Martin Baulig <martin@ximian.com>
3975 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
3978 2003-11-08 Martin Baulig <martin@ximian.com>
3980 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
3981 TypeManager.ResolveExpressionTypes().
3983 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
3984 instead of an Expression.
3985 (TypeExpr): This is now an abstract base class for `TypeExpression'.
3986 (TypeExpression): New public class; formerly known as `TypeExpr'.
3988 * expression.cs (ComposedCast): Derive from TypeExpr.
3990 * typemanager.cs (TypeManager.system_*_expr): These are now
3991 TypExpr's instead of Expression's.
3992 (TypeManager.ResolveExpressionTypes): New public static function;
3993 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
3996 2003-11-06 Miguel de Icaza <miguel@ximian.com>
3998 * expression.cs (New.DoResolve): Do not dereference value that
3999 might be a null return.
4001 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
4002 sure that the constant value has the right type. Fixes an
4003 unreported bug, similar to 50425.
4005 * const.cs (Const.LookupConstantValue): Call
4006 ImplicitStandardConversionExists before doing a conversion to
4007 avoid havng the TypeManager.ChangeType do conversions.
4009 Reduced the number of casts used
4011 (Const.ChangeType): New routine to enable reuse of the constant
4012 type changing code from statement.
4014 * typemanager.cs (ChangeType): Move common initialization to
4015 static global variables.
4019 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
4020 every value type to go through, even if it was void. Fix that.
4022 * cs-tokenizer.cs: Use is_identifier_start_character on the start
4023 character of the define, and the is_identifier_part_character for
4024 the rest of the string.
4026 2003-11-05 Miguel de Icaza <miguel@ximian.com>
4028 * expression.cs (UnaryMutator.EmitCode): When I updated
4029 LocalVariableReference.DoResolve, I overdid it, and dropped an
4030 optimization done on local variable references.
4032 2003-11-04 Miguel de Icaza <miguel@ximian.com>
4034 * ecore.cs: Convert the return from Ldlen into an int.
4036 2003-10-20 Miguel de Icaza <miguel@ximian.com>
4038 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
4039 the accessibility, this is a special case for toplevel non-public
4040 classes (internal for instance).
4042 2003-10-20 Nick Drochak <ndrochak@gol.com>
4044 * ecore.cs: Fix typo and build. Needed another right paren.
4046 2003-10-19 Miguel de Icaza <miguel@ximian.com>
4048 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
4049 `internal' case regular and protected, but not allowing protected
4050 to be evaluated later. Bug 49840
4052 2003-10-15 Miguel de Icaza <miguel@ximian.com>
4054 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
4055 to kb.Nlast, and not the kb.nFirst to isolate the switch
4058 Extract the underlying type, so enumerations of long/ulong are
4059 treated like long/ulong.
4061 2003-10-14 Miguel de Icaza <miguel@ximian.com>
4063 * expression.cs (New): Overload the meaning of RequestedType to
4064 track the possible creation of the NewDelegate type, since
4065 DoResolve is invoked more than once for new constructors on field
4068 See bugs: #48800 and #37014
4070 * cs-parser.jay (declare_local_constants): Take an arraylist
4071 instead of a single constant.
4073 (local_constant_declaration): It should take a
4074 constant_declarators, not a constant_declarator. Fixes 49487
4076 * convert.cs: Fix error report.
4078 2003-10-13 Jackson Harper <jackson@ximian.com>
4080 * typemanager.cs (TypeToCoreType): Add float and double this fixes
4083 2003-10-09 Martin Baulig <martin@ximian.com>
4085 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
4087 (MethodCore.DoDefineParameters): Removed the TypeContainer
4088 argument; use the DeclSpace which was passed to the .ctor instead.
4089 (MethodCore.CheckParameter): Take a DeclSpace instead of a
4090 TypeContainer; we only need a DeclSpace here.
4092 2003-10-09 Martin Baulig <martin@ximian.com>
4094 * class.cs (MethodData): Added additional `DeclSpace ds' argument
4096 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
4097 EmitContext's .ctor.
4099 2003-10-09 Martin Baulig <martin@ximian.com>
4101 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
4102 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
4103 AsAccessible(), moved them as well.
4105 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
4107 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
4109 * cs-parser.jay : Renamed yyName to yyNames related to jay.
4111 2003-10-07 Miguel de Icaza <miguel@ximian.com>
4113 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
4114 generation for >=, as spotted by Paolo, bug 48679.
4115 Patch from David Waite.
4117 * cs-tokenizer.cs: Add handling for #pragma.
4119 * cs-parser.jay: Allow for both yield and yield return in the
4120 syntax. The anti-cobolization of C# fight will go on!
4122 * class.cs (TypeBuilder.DefineType): Catch error condition here
4123 (Parent.DefineType erroring out and returning null).
4125 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4126 coping with enumerations variables, we were mistakenly processing
4127 them as a regular value type instead of built-in types. Fixes the
4130 * typemanager.cs (IsBuiltinOrEnum): New method.
4132 2003-09-30 Miguel de Icaza <miguel@ximian.com>
4134 * cs-parser.jay: Upgrade: yield now needs the return clause.
4136 2003-09-19 Martin Baulig <martin@ximian.com>
4138 * decl.cs (MemberCache.SetupCacheForInterface): Take a
4139 `MemberCache parent' argument. Normally, an interface doesn't
4140 have a parent type except System.Object, but we use this in gmcs
4141 for generic type parameters.
4143 2003-09-18 Martin Baulig <martin@ximian.com>
4145 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
4146 on `type.IsInterface'; don't check whether the type has a parent
4147 to determine whether it's an interface.
4149 2003-09-15 Martin Baulig <martin@ximian.com>
4151 * class.cs (TypeContainer.DefineType): Added an error flag to
4152 avoid reporting duplicate CS0146's ("class definition is
4155 * driver.cs (Driver.MainDriver): Abort if
4156 RootContext.ResolveTree() reported any errors.
4158 2003-09-07 Martin Baulig <martin@ximian.com>
4160 * report.cs (Error, Warning): Added overloaded versions which take
4161 a `params object[] args' and call String.Format().
4163 2003-09-07 Martin Baulig <martin@ximian.com>
4165 * decl.cs (DeclSpace..ctor): Don't call
4166 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
4167 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
4168 (DeclSpace.RecordDecl): New method.
4170 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
4172 2003-09-02 Ravi Pratap <ravi@ximian.com>
4174 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
4175 value attributes to be applied to ParameterBuilders.
4177 * class.cs (MethodCore.LabelParameters): Make static and more
4178 generic so that it can be used from other places - like interface
4179 methods, for instance.
4181 * interface.cs (Interface.Emit): Call LabelParameters before
4182 emitting attributes on the InterfaceMethod.
4184 2003-08-26 Martin Baulig <martin@ximian.com>
4186 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
4187 resolving aliases; fixes #47927.
4189 2003-08-26 Martin Baulig <martin@ximian.com>
4191 * statement.cs (Using.DoResolve): This is internally emitting a
4192 try/finally clause, so we need to set ec.NeedExplicitReturn if we
4193 do not always return. Fixes #47681.
4195 2003-08-26 Martin Baulig <martin@ximian.com>
4197 * decl.cs (MemberCore): Moved WarningNotHiding(),
4198 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
4200 (AdditionResult): Make this nested in DeclSpace.
4201 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
4202 argument; call NamespaceEntry.Define() unless we're nested in a
4205 * namespace.cs (Namespace.DefineName): New public function. This
4206 is called from DeclSpace's .ctor to add
4207 (Namespace.Lookup): Include DeclSpaces in the lookup.
4209 * class.cs (Operator): Derive from MemberBase, not MemberCore.
4211 * const.cs (Const): Derive from MemberBase, not MemberCore.
4213 2003-08-25 Martin Baulig <martin@ximian.com>
4215 * convert.cs (Convert.ExplicitReferenceConversion): When
4216 converting from an interface type to a class, unbox if the target
4217 type is a struct type. Fixes #47822.
4219 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4221 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
4224 2003-08-22 Martin Baulig <martin@ximian.com>
4226 * class.cs (TypeManager.DefineType): When defining a nested type,
4227 call DefineType() on our parent; fixes #47801.
4229 2003-08-22 Martin Baulig <martin@ximian.com>
4231 * class.cs (MethodData.Define): While checking if a method is an
4232 interface implementation, improve the test a bit more to fix #47654.
4234 2003-08-22 Martin Baulig <martin@ximian.com>
4236 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
4237 correctly; fixes #47722.
4239 2003-08-22 Martin Baulig <martin@ximian.com>
4241 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
4242 LocalVariableReference, ensure it's not read-only. Fixes #47536.
4244 * statement.cs (Fixed.DoResolve): Make all variables read-only.
4246 2003-08-22 Martin Baulig <martin@ximian.com>
4248 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
4249 can only be assigned in static constructors. Fixes #47161.
4251 2003-08-22 Martin Baulig <martin@ximian.com>
4253 Rewrote and improved the flow analysis code.
4255 * flowbranching.cs (FlowBranching): Make this class abstract.
4256 (FlowBranching.CreateBranching): New static function to create a
4258 (FlowBranchingBlock, FlowBranchingException): New classes.
4259 (FlowBranching.UsageVector.Type): New public readonly field.
4260 (FlowBranching.UsageVector.Breaks): Removed the setter.
4261 (FlowBranching.UsageVector.Returns): Removed the setter.
4262 (FlowBranching.UsageVector): Added Break(), Return(),
4263 NeverReachable() and Throw() methods to modify the reachability.
4264 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
4265 done by FlowBranching.Merge().
4266 (FlowBranching.UsageVector.MergeChild): New method; merges the
4267 merge result into the current vector.
4268 (FlowBranching.Merge): New abstract method to merge a branching.
4270 2003-08-12 Martin Baulig <martin@ximian.com>
4272 * expression.cs (Indirection.CacheTemporaries): Create the
4273 LocalTemporary with the pointer type, not its element type.
4275 2003-08-10 Miguel de Icaza <miguel@ximian.com>
4277 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
4278 token was a keyword or not.
4280 Add `error' options where an IDENTIFIER was expected; Provide
4281 CheckToken and CheckIdentifierToken convenience error reporting
4284 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
4286 * decl.cs: Rename `NamespaceEntry Namespace' public field into
4287 NameSpaceEntry NameSpaceEntry.
4289 (LookupInterfaceOrClass): Avoid creating a full qualified name
4290 from namespace and name: avoid doing lookups when we know the
4291 namespace is non-existant. Use new Tree.LookupByNamespace which
4292 looks up DeclSpaces based on their namespace, name pair.
4294 * driver.cs: Provide a new `parser verbose' to display the
4295 exception thrown during parsing. This is turned off by default
4296 now, so the output of a failure from mcs is more graceful.
4298 * namespace.cs: Track all the namespaces defined in a hashtable
4301 (IsNamespace): New method
4303 2003-08-09 Miguel de Icaza <miguel@ximian.com>
4305 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
4306 we know that we need to concatenate (full typename can never be
4311 * statement.cs: Use a bitfield; Do not initialize to null things
4312 which are done by the constructor by default.
4314 * cs-parser.jay: bug fix, parameter was 4, not 3.
4316 * expression.cs: Just use the property;
4318 * statement.cs: No need for GetVariableInfo method.
4320 2003-08-08 Martin Baulig <martin@ximian.com>
4322 * flowanalysis.cs (FlowReturns): This is now nested in the
4323 `FlowBranching' class.
4324 (MyBitVector): Moved this here from statement.cs.
4325 (FlowBranching.SiblingType): New enum type.
4326 (FlowBranching.CreateSibling): Added `SiblingType' argument.
4328 2003-08-07 Martin Baulig <martin@ximian.com>
4330 * flowanalysis.cs (FlowBranchingType): This is now nested in the
4331 `FlowBranching' class and called `BranchingType'.
4333 2003-08-07 Martin Baulig <martin@ximian.com>
4335 * flowanalysis.cs: Moved all the control flow analysis code into
4338 2003-08-07 Martin Baulig <martin@ximian.com>
4340 * assign.cs (Assign.DoResolve): `target' must either be an
4341 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
4344 2003-08-07 Miguel de Icaza <miguel@ximian.com>
4346 * expression.cs (BinaryMethod): This kind of expression is created by the
4347 Binary class if it determines that the operator has to be handled
4350 (BinaryDelegate): This kind of expression is created if we are
4351 dealing with a + or - operator on delegates.
4353 (Binary): remove method, argumetns, and DelegateOperator: when
4354 dealing with methods,
4356 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
4358 * statement.cs (Block): use bitfields for the three extra booleans
4359 we had in use. Remove unused topblock parameter.
4361 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
4363 * assign.cs: Drop extra unneeded tests.
4365 2003-08-06 Miguel de Icaza <miguel@ximian.com>
4367 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
4369 * statement.cs (Foreach): Use VariableStorage instead of
4372 * codegen.cs (VariableStorage): New class used by clients that
4373 require a variable stored: locals or fields for variables that
4374 need to live across yield.
4376 Maybe provide a convenience api for EmitThis+EmitLoad?
4378 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
4381 2003-08-05 Miguel de Icaza <miguel@ximian.com>
4383 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
4384 RemapParameterLValue): New methods that are used to turn a
4385 precomputed FieldInfo into an expression like this:
4389 The idea is to use this instead of making LocalVariableReference
4390 have more than one meaning.
4392 * cs-parser.jay: Add error production to BASE.
4394 * ecore.cs: Deal with TypeManager.GetField returning null, which
4395 is now a valid return value.
4397 (FieldExprNoAddress): New expression for Fields whose address can
4400 * expression.cs (LocalVariableReference): During the resolve
4401 phases, create new expressions if we are in a remapping context.
4402 Remove code that dealt with remapping here.
4404 (ParameterReference): same.
4406 (ProxyInstance): New expression, like the `This' expression, but
4407 it is born fully resolved. We know what we are doing, so remove
4408 the errors that are targeted to user-provided uses of `this'.
4410 * statement.cs (Foreach): our variable is now stored as an
4411 Expression; During resolution, follow the protocol, dont just
4412 assume it will return this.
4414 2003-08-06 Martin Baulig <martin@ximian.com>
4416 * support.cs (SeekableStreamReader.cs): New public class.
4418 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
4419 SeekableStreamReader instead of the normal StreamReader.
4421 2003-08-04 Martin Baulig <martin@ximian.com>
4423 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
4424 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
4425 deambiguate casts and delegate invocations.
4426 (parenthesized_expression): Use the new tokens to ensure this is
4427 not a cast of method invocation.
4429 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
4430 when reading a `)' and Deambiguate_CloseParens () was previously
4433 * expression.cs (ParenthesizedExpression): New class. This is
4434 just used for the CS0075 test.
4435 (Binary.DoResolve): Check for CS0075.
4437 2003-07-29 Ravi Pratap <ravi@ximian.com>
4439 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
4440 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
4441 reference comparison.
4443 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
4444 examine the ReturnType for equality - this is necessary in the
4445 cases of implicit and explicit operators whose signature also
4446 includes the return type.
4448 2003-07-26 Miguel de Icaza <miguel@ximian.com>
4450 * namespace.cs: Cache the result of the namespace computation,
4451 instead of computing it every time.
4453 2003-07-24 Miguel de Icaza <miguel@ximian.com>
4455 * decl.cs: Use a global arraylist that we reuse over invocations
4456 to avoid excesive memory consumption. Reduces memory usage on an
4457 mcs compile by one meg (45 average).
4459 * typemanager.cs (LookupTypeReflection): In .NET pointers are
4460 private, work around that.
4462 2003-07-23 Miguel de Icaza <miguel@ximian.com>
4464 * literal.cs (IntLiteral): Define Zero and One static literals.
4466 * cs-parser.jay (integer_literal): use static literals to reduce
4467 memory usage for the most used literals (0, 1 and -1). 211kb
4468 reduced in memory usage.
4470 Replace all calls to `new ArrayList' with `new
4471 ArrayList(4)' which is a good average number for most allocations,
4472 and also requires only 16 bytes of memory for its buffer by
4475 This reduced MCS memory usage in seven megabytes for the RSS after
4478 2003-07-28 Ravi Pratap <ravi@ximian.com>
4480 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
4481 handle params methods the correct way by forming only one
4482 applicable set with params and normal methods in them. Earlier we
4483 were looking at params methods only if we found no normal methods
4484 which was not the correct thing to do.
4486 (Invocation.BetterFunction): Take separate arguments indicating
4487 when candidate and the best method are params methods in their
4490 This fixes bugs #43367 and #46199.
4492 * attribute.cs: Documentation updates.
4494 (CheckAttribute): Rename to CheckAttributeTarget.
4495 (GetValidPlaces): Rename to GetValidTargets.
4497 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
4498 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
4502 2003-07-28 Martin Baulig <martin@ximian.com>
4504 * class.cs (TypeContainer.DefineMembers): Use the base type's full
4505 name when looking up the base class of a nested class. Fixes #46977.
4507 2003-07-26 Martin Baulig <martin@ximian.com>
4509 * expression.cs (Indexers.Indexer): New nested struct; contains
4510 getter, setter and the indexer's type.
4511 (Indexers.Properties): This is now an ArrayList of
4513 (IndexerAccess.DoResolveLValue): Correctly set the type if the
4514 indexer doesn't have any getters.
4516 * assign.cs (Assign.DoResolve): Also do the implicit conversions
4517 for embedded property and indexer assignments.
4519 2003-07-26 Martin Baulig <martin@ximian.com>
4521 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
4522 preprocessor directive is not the first non-whitespace character
4525 2003-07-26 Martin Baulig <martin@ximian.com>
4527 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
4528 namespace parsing, follow the spec more closely.
4530 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
4531 NamespaceEntry.Lookup().
4533 2003-07-25 Martin Baulig <martin@ximian.com>
4535 * MethodCore.cs (OverridesSomething): New public field; it's set
4536 from TypeContainer.DefineMembers if this method overrides
4537 something (which doesn't need to be a method). Fix #39462.
4539 2003-07-25 Ravi Pratap <ravi@ximian.com>
4541 * typemanager.cs (GetMembers): Ensure that the list of members is
4542 reversed. This keeps things in sync.
4544 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
4545 find an AttributeUsage attribute.
4547 * expression.cs (Invocation.OverloadResolve): Perform the check
4548 which disallows Invoke to be directly called on a Delegate.
4550 (Error_InvokeOnDelegate): Report error cs1533.
4552 2003-07-25 Martin Baulig <martin@ximian.com>
4554 * expression.cs (Indexers.GetIndexersForType): Only look in the
4555 interface hierarchy if the requested type is already an
4556 interface. Fixes #46788 while keeping #46502 fixed.
4558 2003-07-25 Martin Baulig <martin@ximian.com>
4560 * class.cs (TypeContainer.DefineMembers): Check whether all
4561 readonly fields have been assigned and report warning CS0649 if
4564 * statement.cs (LocalInfo.IsFixed): Always return true if this is
4567 2003-07-24 Ravi Pratap <ravi@ximian.com>
4569 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
4570 returned from GetMethods to make things consistent with the
4571 assumptions MCS makes about ordering of methods.
4573 This should comprehensively fix bug #45127 and it does :-)
4575 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
4576 ordering is actually reverse.
4578 * Clean up some debug messages I left lying around.
4580 * interface.cs (Populate*): Get rid of code which emits attributes
4581 since the stage in which we emit attributes is the 'Emit' stage,
4582 not the define stage.
4584 (Emit): Move attribute emission for interface members here.
4586 2003-07-22 Ravi Pratap <ravi@ximian.com>
4588 * expression.cs (Invocation.OverloadResolve): Follow the spec more
4589 closely: we eliminate methods in base types when we have an
4590 applicable method in a top-level type.
4592 Please see section 14.5.5.1 for an exact description of what goes
4595 This fixes bug #45127 and a host of other related to corlib compilation.
4597 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
4598 array is the method corresponding to the top-level type (this is
4599 because of the changes made to icall.c) so we change this
4602 (MethodGroupExpr.Name): This too.
4604 * typemanager.cs (GetElementType): New method which does the right
4605 thing when compiling corlib.
4607 * everywhere: Make use of the above in the relevant places.
4609 2003-07-22 Martin Baulig <martin@ximian.com>
4611 * cs-parser.jay (invocation_expression): Moved
4612 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
4613 `cast_expression', but create a InvocationOrCast which later
4614 resolves to either an Invocation or a Cast.
4616 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
4617 method; call this before EmitStatement() to make sure that this
4618 expression can be used as a statement.
4620 * expression.cs (InvocationOrCast): New class; resolves to either
4621 an Invocation or a Cast.
4623 * statement.cs (StatementExpression): Call ResolveStatement() on
4624 the ExpressionStatement before emitting it.
4626 2003-07-21 Martin Baulig <martin@ximian.com>
4628 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
4629 `ref' and `out' attributes match; fixes #46220.
4630 (MemberAccess.ResolveMemberAccess): You can't reference a type
4631 through an expression; fixes #33180.
4632 (Indexers.GetIndexersForType): Don't return the indexers from
4633 interfaces the class implements; fixes #46502.
4635 2003-07-21 Martin Baulig <martin@ximian.com>
4637 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
4638 CS0661 checks; fixes bug #30442.
4640 2003-07-21 Martin Baulig <martin@ximian.com>
4642 * decl.cs (AdditionResult): Added `Error'.
4644 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
4646 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
4647 makes cs0031.cs actually work.
4649 2003-07-20 Martin Baulig <martin@ximian.com>
4651 * namespace.cs: Fixed that bug which caused a crash when compiling
4654 2003-07-20 Miguel de Icaza <miguel@ximian.com>
4656 * typemanager.cs (LookupTypeReflection): Never expose types which
4657 are NotPublic, NestedPrivate, NestedAssembly, or
4658 NestedFamANDAssem. We used to return these, and later do a check
4659 that would report a meaningful error, but the problem is that we
4660 would not get the real match, if there was a name override.
4662 2003-07-18 Miguel de Icaza <miguel@ximian.com>
4664 * namespace.cs (Namespace, Name): Do not compute the namespace
4665 name dynamically, compute it in the constructor. This reduced
4666 memory usage by 1697 KB.
4668 * driver.cs: Use --pause to pause at the end.
4670 2003-07-17 Peter Williams <peter@newton.cx>
4672 * Makefile: Change the name of the test target so that it doesn't
4673 conflict with the recursive test target.
4675 2003-07-17 Miguel de Icaza <miguel@ximian.com>
4677 * expression.cs (LocalVariableReference.Emit, EmitAssign,
4678 AddressOf): Do not use EmitThis, that was wrong, use the actual
4681 2003-07-15 Miguel de Icaza <miguel@ximian.com>
4683 * class.cs (MethodData.Define): While checking if a method is an
4684 interface implementation, improve the test: If we are not public
4685 (use new test here: use the computed MethodAttributes directly,
4686 instead of the parsed modifier flags) check if the `implementing'
4687 method comes from an interface or not.
4689 * pending.cs (VerifyPendingMethods): Slightly better error
4692 * makefile: add test target that does the mcs bootstrap.
4694 2003-07-16 Ravi Pratap <ravi@ximian.com>
4696 * interface.cs (Define): Do nothing here since there are no
4697 members to populate etc. Move the attribute emission out of here
4698 since this was just totally the wrong place to put it. Attribute
4699 application happens during the 'Emit' phase, not in the 'Define'
4702 (Emit): Add this method and move the attribute emission here
4704 * rootcontext.cs (EmitCode): Call the Emit method on interface
4707 2003-07-14 Ravi Pratap M <ravi@ximian.com>
4709 * expression.cs (OverloadResolve): Report error only if Location
4710 is not 'Null' which means that there was a probe going on.
4712 2003-07-14 Martin Baulig <martin@ximian.com>
4714 * expression.cs (ConditionalLogicalOperator): New public class to
4715 implement user defined conditional logical operators.
4716 This is section 14.11.2 in the spec and bug #40505.
4718 2003-07-14 Martin Baulig <martin@ximian.com>
4720 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
4722 2003-07-14 Martin Baulig <martin@ximian.com>
4724 * codegen.cs (EmitContext.InFixedInitializer): New public field.
4726 * ecore.cs (IVariable.VerifyFixed): New interface method.
4728 * expression.cs (Unary.ResolveOperator): When resolving the `&'
4729 operator, check whether the variable is actually fixed. Fixes bug
4730 #36055. Set a variable definitely assigned when taking its
4731 address as required by the spec.
4733 * statement.cs (LocalInfo.IsFixed): New field.
4734 (LocalInfo.MakePinned): Set `IsFixed' to true.
4736 2003-07-14 Ravi Pratap M <ravi@ximian.com>
4738 * attribute.cs (Attribute.Resolve): While doing a Member lookup
4739 for .ctors, ensure that we only ask for members declared in the
4740 attribute type (BindingFlags.DeclaredOnly).
4744 * expression.cs (Error_WrongNumArguments): Report error 1501
4745 correctly the way CSC does.
4747 2003-07-13 Martin Baulig <martin@ximian.com>
4749 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
4750 lookup on the fully qualified name, to make things like "X.X" work
4751 where "X.X" is a fully qualified type name, but we also have a
4752 namespace "X" in the using list. Fixes #41975.
4754 2003-07-13 Martin Baulig <martin@ximian.com>
4756 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
4757 function. If we're a CompoundAssign, we need to create an embedded
4758 CompoundAssign, not an embedded Assign.
4759 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
4762 2003-07-13 Martin Baulig <martin@ximian.com>
4764 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
4765 work to fix bug #46088.
4767 2003-07-13 Ravi Pratap <ravi@ximian.com>
4769 * class.cs (Operator.Emit): Do not emit attributes here - it is
4770 taken care of by the Method class that we delegate too. This takes
4773 2003-07-10 Martin Baulig <martin@ximian.com>
4775 * expression.cs (TypeOfVoid): New class.
4776 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
4778 2003-07-10 Martin Baulig <martin@ximian.com>
4780 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
4783 2003-07-10 Martin Baulig <martin@ximian.com>
4785 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
4786 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
4788 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
4790 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
4792 2003-07-10 Martin Baulig <martin@ximian.com>
4794 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
4795 of decimal. Fixes #42850.
4797 NOTE: I also fixed the created byte blob, but this doesn't work on
4798 the MS runtime and csc never produces any byte blobs for decimal
4801 2003-07-10 Martin Baulig <martin@ximian.com>
4803 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
4804 structs; fixes #32068.
4805 (Block.AddChildVariableNames): Fixed #44302.
4807 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4809 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
4811 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4813 * attribute.cs: And this test is onger needed.
4815 2003-07-08 Martin Baulig <martin@ximian.com>
4817 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
4818 inaccessible types. Fixes #36313.
4820 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
4822 * namespace.cs (NamespaceEntry): Create implicit entries for all
4823 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
4824 implicit entries for N1.N2 and N1.
4826 2003-07-08 Martin Baulig <martin@ximian.com>
4828 Rewrote the handling of namespaces to fix a lot of the issues
4829 wrt. `using' aliases etc.
4831 * namespace.cs (Namespace): Splitted this class into a
4832 per-assembly `Namespace' and a per-file `NamespaceEntry'.
4834 * typemanager.cs (TypeManager.IsNamespace): Removed.
4835 (TypeManager.ComputeNamespaces): Only compute namespaces from
4836 loaded assemblies here, not the namespaces from the assembly we're
4837 currently compiling.
4839 2003-07-08 Martin Baulig <martin@ximian.com>
4841 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
4843 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4845 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
4848 I thought about the memory savings here, but LookupTypeReflection
4849 is used under already very constrained scenarios. Compiling
4850 corlib or mcs only exposes one hit, so it would not really reduce
4851 any memory consumption.
4853 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4855 * typemanager.cs: fixes bug #45889 by only adding public types from
4856 other assemblies to the list of known types.
4858 2003-07-07 Miguel de Icaza <miguel@ximian.com>
4860 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
4861 on the type we resolved.
4863 2003-07-05 Martin Baulig <martin@ximian.com>
4865 * pending.cs (PendingImplementation.ParentImplements): Don't
4866 create the proxy if the parent is abstract.
4868 * class.cs (TypeContainer.DefineIndexers): Process explicit
4869 interface implementations first. Fixes #37714.
4871 2003-07-04 Miguel de Icaza <miguel@ximian.com>
4873 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
4874 defined recursively; but since we modify the input parameters
4875 (left is set to `this' temporarily), we reset this value if the
4876 left_is_explicit is false, which gives the original semantics to
4879 * literal.cs (NullPointer): new class used to represent a null
4880 literal in a pointer context.
4882 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
4883 type is a pointer, use a NullPointer object instead of a
4884 NullLiteral. Closes 43687
4886 (ExplicitConversion): Convert pointer values using
4887 the conv opcode to the proper type.
4889 * ecore.cs (New): change ValueTypeVariable property into a method,
4890 that returns whether the valuetype is suitable for being used.
4892 * expression.cs (Binary.DoNumericPromotions): Only return if we
4893 the int constant was a valid uint, and we can return both left and
4894 right as uints. If not, we continue processing, to trigger the
4895 type conversion. This fixes 39018.
4897 * statement.cs (Block.EmitMeta): During constant resolution, set
4898 the CurrentBlock property on the emitcontext, so that we resolve
4899 constants propertly.
4901 2003-07-02 Martin Baulig <martin@ximian.com>
4903 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
4904 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
4906 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
4907 than emitting it here.
4909 * statement.cs: Fixed some more flow analysis bugs.
4911 2003-07-02 Martin Baulig <martin@ximian.com>
4913 * class.cs (MethodData.Define): When implementing interface
4914 methods, set Final unless we're Virtual.
4916 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
4917 check work for interface methods.
4919 2003-07-01 Martin Baulig <martin@ximian.com>
4921 * ecore.cs (EmitContext.This): Replaced this property with a
4922 GetThis() method which takes a Location argument. This ensures
4923 that we get the correct error location for a CS0188.
4925 2003-07-01 Miguel de Icaza <miguel@ximian.com>
4927 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
4928 ImplicitStandardConversion.
4930 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
4932 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
4934 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
4937 2003-06-30 Miguel de Icaza <miguel@ximian.com>
4939 * class.cs (Constructor.Define): Turn off initlocals for unsafe
4942 (MethodData.Define): Turn off initlocals for unsafe methods.
4944 2003-06-29 Miguel de Icaza <miguel@ximian.com>
4946 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
4947 complete; Fixes #37521.
4949 * delegate.cs: Use Modifiers.TypeAttr to compute the
4950 TypeAttributes, instead of rolling our own. This makes the flags
4951 correct for the delegates.
4953 2003-06-28 Miguel de Icaza <miguel@ximian.com>
4955 * class.cs (Constructor.Define): Set the private flag for static
4956 constructors as well.
4958 * cs-parser.jay (statement_expression): Set the return value to
4959 null, to avoid a crash when we catch an error.
4961 2003-06-24 Miguel de Icaza <miguel@ximian.com>
4963 * cs-parser.jay: Applied patch from Jackson that adds support for
4964 extern and unsafe modifiers to destructor declarations.
4966 * expression.cs: Report error 21 if the user is trying to index a
4969 * driver.cs: Add an error message, suggested by the bug report.
4971 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
4972 if we do not have a ": this ()" constructor initializer. Fixes 45149
4974 2003-06-14 Miguel de Icaza <miguel@ximian.com>
4976 * namespace.cs: Add some information to reduce FAQs.
4978 2003-06-13 Miguel de Icaza <miguel@ximian.com>
4980 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
4981 underlying enumeration types. Fixes #43915.
4983 * expression.cs: Treat ushort/short as legal values to be used in
4986 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
4988 * delegate.cs: transfer custom attributes for paramenters from
4989 the delegate declaration to Invoke and BeginInvoke.
4991 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
4993 * attribute.cs: handle custom marshalers and emit marshal info
4996 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
4998 * makefile.gnu: Added anonymous.cs to the compiler sources.
5000 2003-05-28 Miguel de Icaza <miguel@ximian.com>
5002 * iterators.cs: Change the name of the proxy class to include two
5005 * cs-parser.jay: Update grammar to include anonymous methods.
5007 * anonymous.cs: new file.
5009 2003-05-27 Miguel de Icaza <miguel@ximian.com>
5011 * class.cs (Field.Define): Add missing test for pointers and
5014 2003-05-27 Ravi Pratap <ravi@ximian.com>
5016 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
5017 we use the stobj opcode.
5019 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
5020 since it wasn't the correct fix.
5022 It still is puzzling that we are required to use stobj for IntPtr
5023 which seems to be a ValueType.
5025 2003-05-26 Miguel de Icaza <miguel@ximian.com>
5027 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
5028 during regular simple name resolution. Now, the trick is that
5029 instead of returning for processing the simplename, we do a
5030 TypeManager.LookupType (ie, a rooted lookup as opposed to a
5031 contextual lookup type). If a match is found, return that, if
5032 not, return for further composition.
5034 This fixes long-standing 30485.
5036 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
5037 using the address to initialize an object, do an Stobj instead of
5038 using the regular Stelem.
5040 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
5041 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
5042 Because if we are a BaseIndexerAccess that value will be true.
5045 * statement.cs (GotoCase.Resolve): Return after reporting an
5046 error, do not attempt to continue.
5048 * expression.cs (PointerArithmetic.Emit): If our operand is a
5049 long, convert our constants to match the operand before
5050 multiplying. Convert to I type before adding. Fixes 43670.
5052 2003-05-14 Ravi Pratap <ravi@ximian.com>
5054 * enum.cs (ImplicitConversionExists) : Rename to
5055 ImplicitEnumConversionExists to remove ambiguity.
5057 * ecore.cs (NullCast): New type of cast expression class which
5058 basically is very similar to EmptyCast with the difference being
5059 it still is a constant since it is used only to cast a null to
5063 * convert.cs (ImplicitReferenceConversion): When casting a null
5064 literal, we return a NullCast.
5066 * literal.cs (NullLiteralTyped): Remove - I don't see why this
5067 should be around anymore.
5069 The renaming (reported was slightly wrong). Corrections:
5071 ConvertImplicitStandard -> ImplicitConversionStandard
5072 ConvertExplicitStandard -> ExplicitConversionStandard
5074 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
5075 before passing them in !
5077 * convert.cs (ImplicitConversionStandard): When comparing for
5078 equal expr and target types, ensure that expr is not a
5081 In general, we must not be checking (expr_type ==
5082 target_type) in the top level conversion methods
5083 (ImplicitConversion, ExplicitConversion etc). This checking is
5084 done in the methods that they delegate to.
5086 2003-05-20 Miguel de Icaza <miguel@ximian.com>
5088 * convert.cs: Move Error_CannotConvertType,
5089 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
5090 ImplicitNumericConversion, ImplicitConversionExists,
5091 ImplicitUserConversionExists, StandardConversionExists,
5092 FindMostEncompassedType, FindMostSpecificSource,
5093 FindMostSpecificTarget, ImplicitUserConversion,
5094 ExplicitUserConversion, GetConversionOperators,
5095 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
5096 TryImplicitIntConversion, Error_CannotConvertImplicit,
5097 ConvertImplicitRequired, ConvertNumericExplicit,
5098 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
5099 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
5102 Perform the following renames:
5104 StandardConversionExists -> ImplicitStandardConversionExists
5105 ConvertImplicit -> ImplicitConversion
5106 ConvertImplicitStandard -> ImplicitStandardConversion
5107 TryImplicitIntConversion -> ImplicitIntConversion
5108 ConvertImplicitRequired -> ImplicitConversionRequired
5109 ConvertNumericExplicit -> ExplicitNumericConversion
5110 ConvertReferenceExplicit -> ExplicitReferenceConversion
5111 ConvertExplicit -> ExplicitConversion
5112 ConvertExplicitStandard -> ExplicitStandardConversion
5114 2003-05-19 Martin Baulig <martin@ximian.com>
5116 * statement.cs (TypeInfo.StructInfo): Made this type protected.
5117 (TypeInfo): Added support for structs having structs as fields.
5119 * ecore.cs (FieldExpr): Implement IVariable.
5120 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
5121 VariableInfo for the field.
5123 2003-05-18 Martin Baulig <martin@ximian.com>
5125 * expression.cs (This.DoResolve): Report a CS0027 if we're
5126 emitting a field initializer.
5128 2003-05-18 Martin Baulig <martin@ximian.com>
5130 * expression.cs (This.ResolveBase): New public function.
5131 (This.DoResolve): Check for CS0188.
5133 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
5136 * ecore.cs (MethodGroupExpr.DoResolve): Set the
5137 `instance_expression' to null if we don't have any non-static
5140 2003-05-18 Martin Baulig <martin@ximian.com>
5142 Reworked the way how local variables and parameters are handled by
5143 the flow analysis code.
5145 * statement.cs (TypeInfo, VariableMap): New public classes.
5146 (VariableInfo): New public class. This is now responsible for
5147 checking whether a variable has been assigned. It is used for
5148 parameters and local variables.
5149 (Block.EmitMeta): Take the InternalParameters as argument; compute
5150 the layout of the flow vectors here.
5151 (Block.LocalMap, Block.ParameterMap): New public properties.
5152 (FlowBranching): The .ctor doesn't get the InternalParameters
5153 anymore since Block.EmitMeta() now computes the layout of the flow
5155 (MyStructInfo): This class is now known as `StructInfo' and nested
5156 in `TypeInfo'; we don't access this directly anymore.
5158 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
5159 property and removed IsAssigned(), IsFieldAssigned(),
5160 SetAssigned() and SetFieldAssigned(); we now call them on the
5161 VariableInfo so we don't need to duplicate this code everywhere.
5163 * expression.cs (ParameterReference): Added `Block block' argument
5165 (LocalVariableReference, ParameterReference, This): The new
5166 VariableInfo class is now responsible for all the definite
5169 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
5170 IsParameterAssigned, SetParameterAssigned): Removed.
5172 2003-05-18 Martin Baulig <martin@ximian.com>
5174 * typemanager.cs (InitCoreTypes): Try calling
5175 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
5176 the 3-args-version. Corlib now also needs our `void_type'.
5177 (GetMethod): Added overloaded version which takes an optional
5178 `bool report_errors' to allow lookups of optional methods.
5180 2003-05-12 Martin Baulig <martin@ximian.com>
5182 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
5183 only used for locals and not for parameters.
5185 2003-05-12 Miguel de Icaza <miguel@ximian.com>
5187 * support.cs (InternalParameters.ParameterType): Return the
5188 ExternalType of the parameter.
5190 * parameter.cs (Parameter.ExternalType): drop the two arguments,
5193 2003-05-11 Miguel de Icaza <miguel@ximian.com>
5195 * class.cs (MethodData.Define): Do not set the `newslot' on
5196 interface members, if they are also flagged as "override".
5198 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
5199 better code for ++i and i++. This only works for static fields
5200 and local variables.
5202 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
5203 want to pull the DeclSpace out of the builder_to_declspace instead
5204 of the TypeBuilder (like in TypeContainer.FindMembers).
5206 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
5207 instead of LookupTypeContainer. Fixes the crash on .NET for
5208 looking up interface members.
5210 * const.cs: Create our own emit context during the Definition
5211 stage, so that constants are evaluated in the proper context, when
5212 a recursive definition happens.
5214 2003-05-11 Martin Baulig <martin@ximian.com>
5216 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
5217 new block for a switch section.
5218 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
5219 the adding/lookup in the switch block. Fixes #39828.
5221 2003-05-09 Miguel de Icaza <miguel@ximian.com>
5223 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
5224 functionality: I needed to convert the data after I had performed
5225 the add/sub operation into the operands type size.
5227 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
5228 pass the type for the box operation, otherwise the resulting
5229 object would have been of type object.
5231 (BoxedCast): Add constructor to specify the type to box as.
5233 2003-05-07 Miguel de Icaza <miguel@ximian.com>
5235 * iterators.cs: I was reusing the `count' variable inadvertently,
5236 take steps to not allow this to happen.
5238 2003-05-06 Miguel de Icaza <miguel@ximian.com>
5240 * attribute.cs (Attribute.Resolve): Params attributes are encoded
5241 by creating an array at the point where the params starts and
5242 putting all those arguments there, then adjusting the size of the
5245 2003-05-05 Miguel de Icaza <miguel@ximian.com>
5247 * expression.cs (New.AddressOf): Implement interface
5248 IMemoryLocation. This is used when the `new' operator is used in
5249 the context of an invocation to a method on a value type.
5251 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
5254 * namespace.cs: Also check the using aliases here.
5256 * driver.cs: Move the test for using validity after the types have
5257 been entered, so we do a single pass that also includes the using
5260 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
5261 in the regular case. CreateSiblingForFinally is doing extra
5264 * attribute.cs (GetAttributeArgumentExpression): Store the result
5265 on an out value, and use the return value to indicate failure
5266 instead of using null (which is a valid return for Constant.GetValue).
5268 * statement.cs: Perform the analysis flow for the increment
5269 portion after the statement, because this will be the real flow of
5270 execution. Fixes #42385
5272 * codegen.cs (EmitContext.EmitArgument,
5273 EmitContext.EmitStoreArgument): New helper functions when the
5274 RemapToProxy flag is set.
5276 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
5279 Add support for remapping parameters.
5281 * iterators.cs: Propagate parameter values; Store parameter
5282 values in the proxy classes.
5284 2003-05-04 Miguel de Icaza <miguel@ximian.com>
5286 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
5287 need a proxy reference; I do not know what I was thinking
5289 * cs-parser.jay (constructor_initializer): catch another error,
5290 and display nice message.
5292 (field_declaration): catch void field declaration
5293 to flag a better error.
5295 * class.cs (MemberBase.CheckBase): Report an error instead of a
5296 warning if a new protected member is declared in a struct.
5297 (Field.Define): catch the error of readonly/volatile.
5299 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
5301 (FieldExpr.AddressOf): ditto. Catch error where the address of a
5302 volatile variable is taken
5304 2003-05-02 Miguel de Icaza <miguel@ximian.com>
5306 * statement.cs (Fixed.Resolve): Report an error if we are not in
5309 2003-05-01 Miguel de Icaza <miguel@ximian.com>
5311 * typemanager.cs: reuse the code that handles type clashes for
5312 delegates and enumerations.
5314 * class.cs (Report28): Always report.
5316 * expression.cs (EncodeAsAttribute): Allow nulls here.
5318 2003-04-28 Miguel de Icaza <miguel@ximian.com>
5320 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
5321 the functionality for testing whether an expression is valid for
5322 an attribute here. Also handle the case of arrays of elements
5325 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
5326 encoding a linear array into an array of objects that are suitable
5327 to be passed to an CustomAttributeBuilder.
5329 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
5331 * ecore.cs: (FieldExpr): Handle field remapping here.
5333 * iteratators.cs: Pass the instance variable (if the method is an
5334 instance method) to the constructors, so we can access the field
5335 variables on the class.
5337 TODO: Test this with structs. I think the THIS variable on
5338 structs might have to be a pointer, and not a refenrece
5340 2003-04-27 Miguel de Icaza <miguel@ximian.com>
5342 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
5343 local variables to fields in a proxy class.
5345 * iterators.cs (PopulateProxy): Rename our internal fields to
5347 Create a <THIS> field if we are an instance method, so we can
5348 reference our parent container variables.
5349 (MapVariable): Called back from the EmitContext code to enter a
5350 new variable to field mapping into the proxy class (we just create
5354 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
5355 for using the remapped locals to fields.
5357 I placed the code here, because that gives the same semantics to
5358 local variables, and only changes the Emit code.
5360 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
5361 statements inside iterators.
5362 (VariableInfo): Add a FieldBuilder for the cases when we are
5363 remapping local variables to fields in a proxy class
5365 * ecore.cs (SimpleNameResolve): Avoid testing two times for
5366 current_block != null.
5368 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
5369 not cope with strings, as it has been moved to the
5370 TableSwitchEmit. Fixed bug in switch generation.
5372 * expression.cs (New.DoResolve): Provide more context for the user
5373 when reporting an error.
5375 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
5378 * expression.cs (MemberAccess.DoResolve): When we get a type back,
5379 check the permissions for it. Note than in a type-resolution
5380 context the check was already present in DeclSpace.ResolveType,
5381 but was missing from the MemberAccess.
5383 (ArrayCreation.CheckIndices): warn if the user has
5384 more nested levels of expressions, but there are no more
5385 dimensions specified. Avoids crash on bug 41906.
5387 2003-04-26 Miguel de Icaza <miguel@ximian.com>
5389 * statement.cs (Block): replace Implicit bool, for a generic
5391 New flag: `Unchecked'. This is used during the EmitMeta phase
5392 (which is out-of-line with the regular Resolve/Emit process for a
5393 statement, as this is done ahead of time, but still gets a chance
5394 to call constant resolve).
5396 (Block.Flags): new enum for adding a new flag.
5398 (Block.EmitMeta): track the state of unchecked.
5400 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
5401 to enable constant resolution to work there as well.
5403 2003-04-22 Miguel de Icaza <miguel@ximian.com>
5405 * typemanager.cs (ienumerable_type): Also look up
5406 System.Collections.IEnumerable.
5408 2003-04-21 Miguel de Icaza <miguel@ximian.com>
5410 TODO: Test more than one conditional per method.
5412 * class.cs (Indexer.Define): Report the location where the user is
5413 referencing the unsupported feature.
5415 (MethodData): Overload the use of `conditionals' to
5416 minimize the creation of needless ArrayLists. This saves roughly
5417 212kb on my machine.
5419 (Method): Implement the new IIteratorContainer interface.
5420 (Method.SetYields): Implement the method by setting the ModFlags
5421 to contain METHOD_YIELDS.
5423 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
5424 which just got set to null.
5426 * iterators.cs: New file.
5428 (Yield, YieldBreak): New statements.
5430 * statement.cs (Return.Resolve): Flag an error if we are used in
5433 * codegen.cs (InIterator): New flag set if the code is being
5434 compiled in an iterator method.
5436 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
5437 internal modifier, and we just use it to avoid adding extra
5438 fields, as this is seldom used.
5440 * cs-parser.jay: Add yield_statement (yield and yield break).
5442 * driver.cs: New flag -v2 to turn on version 2 features.
5444 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
5445 hashtable when v2 is enabled.
5447 2003-04-20 Miguel de Icaza <miguel@ximian.com>
5449 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
5450 there is already a namespace defined with this name.
5452 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
5453 people upgraded their corlibs.
5455 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
5456 always use fully qualified types, no need to use the compiler
5459 (TypeManager.IsNamespace): Use binarysearch.
5461 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
5462 AddDelegate): I did not quite use the new IsValid API properly: I
5463 have to pass the short-name and the fullname. I was passing only
5464 the basename instead of the fullname sometimes.
5466 (TypeContainer.DefineType): call NamespaceClash.
5468 * interface.cs (Interface.DefineType): use NamespaceClash before
5471 * delegate.cs (Delegate.DefineType): use NamespaceClash before
5474 * enum.cs: (Enum.DefineType): use NamespaceClash before
5477 * typemanager.cs (: 3-line patch that gives us some tasty 11%
5478 speed increase. First, use the negative_hits cache when we get a
5479 negative. Second, add the type with its full original name
5480 instead of the new . and + encoded name (reflection uses + to
5481 separate type from a nested type). Use LookupTypeReflection
5482 directly which bypasses the type->name hashtable (that we already
5483 know does not contain the type.
5485 * decl.cs (DeclSpace.ResolveTypeExpr): track the
5486 location/container type.
5488 * driver.cs: When passing utf8, use directly the UTF8Encoding.
5490 2003-04-19 Miguel de Icaza <miguel@ximian.com>
5492 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
5494 * delegate.cs (NewDelegate.Resolve): Test whether an instance
5495 method is being referenced in the method group from a static
5496 context, and report error 120 if so.
5498 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
5501 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
5502 is created, we create the A namespace).
5504 * cs-parser.jay: A namespace also introduces a DeclarationFound.
5507 2003-04-18 Miguel de Icaza <miguel@ximian.com>
5509 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
5510 invocation to ModuleBuilder.GetType with the same values will
5511 return a new type instance, so we need to cache its return
5514 * expression.cs (Binary.ResolveOperator): Only allow the compare
5515 operators on enums if they are of the same type.
5517 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
5518 types of ValueType on their own case. Before we were giving them
5519 the same treatment as objects.
5521 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
5522 fullname. Short name is used to compare against container name.
5523 Fullname is used to check against defined namespace names.
5525 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
5526 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
5528 (Method.CheckBase): Call parent.
5529 (MemberBase.CheckBase): Check for protected members on sealed
5531 (PropertyBase.CheckBase): Call parent.
5532 (Field.Define): Call parent.
5534 * report.cs: Negative error codes are now mapped to 8000 - code,
5535 so that the display is render more nicely.
5537 * typemanager.cs: Do not use try/catch, instead report a regular
5540 (GetPointerType, GetReferenceType): These methods provide
5541 mechanisms to obtain the T* and T& from a T. We had the code
5542 previously scattered around the code base, and it also used
5543 TypeManager.LookupType that would go through plenty of caches.
5544 This one goes directly to the type source.
5546 In some places we did the Type.GetType followed by
5547 ModuleBuilder.GetType, but not in others, so this unifies the
5550 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
5551 statements now that we have namespace information.
5553 * typemanager.cs (IsNamespace): New method, returns whether the
5554 string presented is a namespace or not.
5556 (ComputeNamespaces): New public entry point, computes the list of
5557 available namespaces, using the GetNamespaces API call in Mono, or
5558 the slower version in MS.NET.
5560 Now before we start the semantic analysis phase, we have a
5561 complete list of namespaces including everything that the user has
5564 Deleted old code to cache namespaces in .nsc files.
5566 2003-04-17 Miguel de Icaza <miguel@ximian.com>
5568 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
5569 class/struct location definition Location for the implicit
5570 constructor location.
5572 (Operator.Define): Use the location of the operator for the
5573 implicit Method definition.
5575 (Constructor.Emit): use the constructor location for the implicit
5576 base initializer constructor.
5578 * ecore.cs: Remove ITypeExpression. This interface is now gone,
5579 and the Expression class now contains two new methods:
5581 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
5582 isolate type lookup from the rest of the resolution process.
5584 Since we use Expressions to hold type definitions due to the way
5585 we parse the input we have historically overloaded Resolve to
5586 perform the Type lookups if a special flag is passed. Now this is
5587 eliminated and two methods take their place.
5589 The differences in the two methods between xStep and xTerminal is
5590 that xStep is involved in our current lookup system that uses
5591 SimpleNames to compose a name, while xTerminal is used just to
5592 catch the case where the simplename lookup failed.
5594 2003-04-16 Miguel de Icaza <miguel@ximian.com>
5596 * expression.cs (ResolveMemberAccess): Remove redundant code.
5597 TypeExpr expressions are always born fully resolved.
5599 * interface.cs (PopulateMethod): Do not lookup the types twice.
5600 We were doing it once during SemanticAnalysis and once during
5603 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
5604 in local variable type definitions, were being returned as a
5605 SimpleName (we decomposed everything into a string), that is
5606 because primary_expression was being used instead of a type in the
5607 grammar (reduce/reduce conflicts).
5609 The part that was wrong is that we converted the expression into a
5610 string (an oversimplification in one hand, compounded with primary
5611 expressions doing string concatenation).
5617 Would return "A.B.C[]" as a SimpleName. This stopped things like
5618 using clauses from working on this particular context. And a type
5619 was being matched directly against "A.B.C[]".
5621 We now use the correct approach, and allow for ComposedCast to be
5622 part of the unary expression. So the "A.B.C []" become a composed
5623 cast of "A.B.C" (as a nested group of MemberAccess with a
5624 SimpleName at the end) plus the rank composition "[]".
5628 2003-04-10 Miguel de Icaza <miguel@ximian.com>
5630 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
5631 for the access level checking.
5633 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
5634 `TypeContainer container', because I kept getting confused when I
5635 was debugging this code.
5637 * expression.cs (Indexers): Instead of tracking getters/setters,
5638 we now track them in parallel. We create one arraylist less, but
5639 most importantly it is possible now for the LValue code to find a
5640 matching get for a set.
5642 (IndexerAccess.DoResolveLValue): Update the code.
5643 GetIndexersForType has been modified already to extract all the
5644 indexers from a type. The code assumed it did not.
5646 Also make the code set the correct return type for the indexer.
5647 This was fixed a long time ago for properties, but was missing for
5648 indexers. It used to be void_type.
5650 (Binary.Emit): Test first for doubles instead of
5651 floats, as they are more common.
5653 (Binary.EmitBranchable): Use the .un version of the branch opcodes
5654 when dealing with floats and the <=, >= operators. This fixes bug
5657 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
5658 to load the array value by emitting a load on the foreach variable
5659 type. This was incorrect.
5661 We now emit the code to load an element using the the array
5662 variable type, and then we emit the conversion operator.
5666 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
5668 * attribute.cs: Avoid allocation of ArrayLists in the common case.
5670 2003-04-09 Miguel de Icaza <miguel@ximian.com>
5672 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
5673 test for protection before we test for signatures.
5675 (MethodSignature.ToString): implement.
5677 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
5678 to the case where we reduced into a LongConstant.
5680 * decl.cs (CheckAccessLevel): If the type is an array, we can not
5681 depend on whether the information is acurrate, because the
5682 Microsoft runtime will always claim that the array type is public,
5683 regardless of the real state.
5685 If the type is a pointer, another problem happens: the type is
5686 reported as non-public in Microsoft.
5688 In both cases we have to call CheckAccessLevel recursively with
5689 the underlying type as the argument to be tested.
5691 2003-04-08 Miguel de Icaza <miguel@ximian.com>
5693 * assign.cs (Assign.Emit): If we are dealing with a compound
5694 assignment expression, we should use the code path that stores the
5695 intermediate result in a temporary value. This fixes #40903.
5697 *expression.cs (Indirection.ToString): Provide ToString method for
5700 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
5702 * class.cs: Null out fields holding references to Block objects so
5703 they can be garbage collected.
5705 * expression.cs (OverloadResolve): Remove unused local.
5707 2003-04-07 Martin Baulig <martin@ximian.com>
5709 * codegen.cs (EmitContext.CurrentFile): New public field.
5710 (EmitContext.Mark): Use the CurrentFile to check whether the
5711 location is in the correct file.
5712 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
5714 2003-04-07 Martin Baulig <martin@ximian.com>
5716 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
5718 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
5719 location. [FIXME: The location argument which gets passed to this
5720 method is sometimes wrong!]
5722 2003-04-07 Nick Drochak <ndrochak@gol.com>
5724 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
5726 2003-04-07 Miguel de Icaza <miguel@ximian.com>
5728 * expression.cs (Indirection.EmitAssign): We were using the
5729 temporary, but returning immediately instead of continuing the
5732 2003-04-06 Martin Baulig <martin@ximian.com>
5734 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
5735 if it's a nested child, but also deriving from the outer class.
5738 * typemanager.cs (IsNestedChildOf): Make this work if it's a
5739 nested child, but also deriving from the outer class. See
5741 (FilterWithClosure): We may access private members of the outer
5742 class if we're a nested child and deriving from the outer class.
5743 (RealMemberLookup): Only set `closure_private_ok' if the
5744 `original_bf' contained BindingFlags.NonPublic.
5746 2003-04-05 Martin Baulig <martin@ximian.com>
5748 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
5750 2003-04-02 Miguel de Icaza <miguel@ximian.com>
5752 * class.cs (Event.Define): Do not allow abstract events to have
5755 2003-04-01 Miguel de Icaza <miguel@ximian.com>
5757 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
5758 block in event declarations.
5760 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
5761 value type, get its address.
5763 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
5764 leaving a class on the stack instead of a boolean value (int
5765 0/1). Change the code so we compare against null, and then the
5766 result against zero.
5768 * class.cs (TypeContainer.GetClassBases): We were checking for the
5769 parent class being sealed too late.
5771 * expression.cs (Binary.Emit): For <= and >= when dealing with
5772 floating point values, use cgt.un and clt.un instead of cgt and
5775 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
5777 * statement.cs: Apply the same optimization as MS: skip the
5778 GetEnumerator returning an IEnumerator, and use the one returning a
5779 CharEnumerator instead. This allows us to avoid the try-finally block
5782 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
5784 * cs-parser.jay: Attributes cannot be applied to
5785 namespaces. Fixes #40473
5787 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5790 (Add*): check if the name is valid using the full name for constants,
5791 fields, properties and events.
5793 2003-03-28 Miguel de Icaza <miguel@ximian.com>
5795 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
5796 char constants to be part of the enumeration.
5798 * expression.cs (Conditional.DoResolve): Add support for operator
5799 true. Implements the missing functionality from 14.12
5801 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
5802 operator true/false as required by the spec.
5804 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
5805 implicit conversion to boolean.
5807 * statement.cs (Statement.ResolveBoolean): A boolean expression is
5808 also one where the type implements `operator true'.
5810 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
5811 get an expression that will invoke operator true based on an
5814 (GetConversionOperators): Removed the hack that called op_True
5817 (Expression.ResolveBoolean): Move this from Statement.
5819 2003-03-17 Miguel de Icaza <miguel@ximian.com>
5821 * ecore.cs (FieldExpr): do not allow initialization of initonly
5822 fields on derived classes
5824 2003-03-13 Martin Baulig <martin@ximian.com>
5826 * statement.cs (Block.Emit): Call ig.BeginScope() and
5827 ig.EndScope() when compiling with debugging info; call
5828 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
5830 2003-03-08 Miguel de Icaza <miguel@ximian.com>
5832 * expression.cs (Indexers): Do not construct immediately, allow
5833 for new members to be appended as we go. Fixes 38143
5835 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5837 * expression.cs: save/restore context when resolving an unchecked
5840 2003-03-05 Miguel de Icaza <miguel@ximian.com>
5842 * cfold.cs: Catch division by zero in modulus operator during
5845 2003-03-03 Miguel de Icaza <miguel@ximian.com>
5847 * interface.cs (Interface.DefineMembers): Avoid defining members
5850 2003-02-27 Miguel de Icaza <miguel@ximian.com>
5852 * driver.cs: handle the +/- options for -noconfig
5854 * statement.cs (Unckeched.Resolve): Also track the state of
5855 unchecked in the Resolve phase.
5857 2003-02-27 Martin Baulig <martin@ximian.com>
5859 * ecore.cs (Expression.MemberLookup): Don't create a
5860 MethodGroupExpr for something which is not a method. Fixes #38291.
5862 2003-02-25 Miguel de Icaza <miguel@ximian.com>
5864 * class.cs (MemberBase.CheckParameters): Also check that the type
5865 is unmanaged if it is a pointer.
5867 * expression.cs (SizeOf.Resolve): Add location information.
5869 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
5870 a managed type is declared.
5872 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
5873 parameter modifiers as well. Fixes bug 38606
5875 * class.cs: Very sad. Am backing out the speed up changes
5876 introduced by the ArrayList -> Array in the TypeContainer, as they
5877 were not actually that much faster, and introduced a bug (no error
5878 reports on duplicated methods).
5880 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
5881 source first, this will guarantee that we have a valid expression
5882 before calling in lower levels functions that will require a
5883 resolved object. Then use this original_source in the
5884 target.ResolveLValue instead of the original source that was
5887 Another change. Use target.Resolve instead of LValueResolve.
5888 Although we are resolving for LValues, we will let the Assign code
5889 take care of that (it will be called again from Resolve). This
5890 basically allows code like this:
5892 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
5893 class Y { void A (X x) { x [0] += o; }
5895 The problem was that the indexer was trying to resolve for
5896 set_Item (idx, object o) and never finding one. The real set_Item
5897 was set_Item (idx, X). By delaying the process we get the right
5902 2003-02-23 Martin Baulig <martin@ximian.com>
5904 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
5905 while calling DoEmit ().
5907 * codegen.cs (EmitContext.Mark): Don't mark locations in other
5908 source files; if you use the #line directive inside a method, the
5909 compiler stops emitting line numbers for the debugger until it
5910 reaches the end of the method or another #line directive which
5911 restores the original file.
5913 2003-02-23 Martin Baulig <martin@ximian.com>
5915 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
5917 2003-02-23 Martin Baulig <martin@ximian.com>
5919 * statement.cs (Block.AddChildVariableNames): We need to call this
5920 recursively, not just for our immediate children.
5922 2003-02-23 Martin Baulig <martin@ximian.com>
5924 * class.cs (Event.Define): Always make the field private, like csc does.
5926 * typemanager.cs (TypeManager.RealMemberLookup): Make events
5927 actually work, fixes bug #37521.
5929 2003-02-23 Miguel de Icaza <miguel@ximian.com>
5931 * delegate.cs: When creating the various temporary "Parameters"
5932 classes, make sure that we call the ComputeAndDefineParameterTypes
5933 on those new parameters (just like we do with the formal ones), to
5934 allow them to be resolved in the context of the DeclSpace.
5936 This fixes the bug that Dick observed in Bugzilla #38530.
5938 2003-02-22 Miguel de Icaza <miguel@ximian.com>
5940 * expression.cs (ResolveMemberAccess): When resolving a constant,
5941 do not attempt to pull a constant if the value was not able to
5942 generate a valid constant.
5944 * const.cs (LookupConstantValue): Do not report more errors than required.
5946 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5948 * expression.cs: fixes bug #38328.
5950 2003-02-18 Miguel de Icaza <miguel@ximian.com>
5952 * class.cs: Changed all the various members that can be part of a
5953 class from being an ArrayList to be an Array of the right type.
5954 During the DefineType type_list, interface_list, delegate_list and
5955 enum_list are turned into types, interfaces, delegates and enums
5958 And during the member population, indexer_list, event_list,
5959 constant_list, field_list, instance_constructor_list, method_list,
5960 operator_list and property_list are turned into their real arrays.
5962 Although we could probably perform this operation earlier, for
5963 good error reporting we need to keep the lists and remove the
5964 lists for longer than required.
5966 This optimization was triggered by Paolo profiling the compiler
5967 speed on the output of `gen-sample-program.pl' perl script.
5969 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
5970 not crash in methods like MemberLookupFailed that use this field.
5972 This problem arises when the compiler fails to resolve a type
5973 during interface type definition for example.
5975 2003-02-18 Miguel de Icaza <miguel@ximian.com>
5977 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
5978 inherit from System.Object, so we have to stop at null, not only
5979 when reaching System.Object.
5981 2003-02-17 Miguel de Icaza <miguel@ximian.com>
5983 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
5984 DeclaredOnly because the parent indexer might have had a different
5985 name, but did not loop until the top of the hierarchy was reached.
5987 The problem this one fixes is 35492: when a class implemented an
5988 indexer from an interface, we were getting the interface method
5989 (which was abstract) and we were flagging an error (can not invoke
5992 This also keeps bug 33089 functioning, and test-148 functioning.
5994 * typemanager.cs (IsSpecialMethod): The correct way of figuring
5995 out if a method is special is to see if it is declared in a
5996 property or event, or whether it is one of the predefined operator
5997 names. This should fix correctly #36804.
5999 2003-02-15 Miguel de Icaza <miguel@ximian.com>
6001 The goal here is to remove the dependency on EmptyCast.Peel ().
6002 Killing it completely.
6004 The problem is that currently in a number of places where
6005 constants are expected, we have to "probe" for an EmptyCast, and
6006 Peel, which is not the correct thing to do, as this will be
6007 repetitive and will likely lead to errors.
6009 The idea is to remove any EmptyCasts that are used in casts that
6010 can be reduced to constants, so we only have to cope with
6013 This bug hunt was triggered by Bug 37363 and the desire to remove
6014 the duplicate pattern where we were "peeling" emptycasts to check
6015 whether they were constants. Now constants will always be
6018 * ecore.cs: Use an enumconstant here instead of wrapping with
6021 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
6022 throwing me off. By handling this we can get rid of a few hacks.
6024 * statement.cs (Switch): Removed Peel() code.
6026 2003-02-14 Miguel de Icaza <miguel@ximian.com>
6028 * class.cs: Location information for error 508
6030 * expression.cs (New.DoResolve): Add a guard against double
6031 resolution of an expression.
6033 The New DoResolve might be called twice when initializing field
6034 expressions (see EmitFieldInitializers, the call to
6035 GetInitializerExpression will perform a resolve on the expression,
6036 and later the assign will trigger another resolution
6038 This leads to bugs (#37014)
6040 * delegate.cs: The signature for EndInvoke should contain any ref
6041 or out parameters as well. We were not doing this in the past.
6043 * class.cs (Field.Define): Do not overwrite the type definition
6044 inside the `volatile' group. Turns out that volatile enumerations
6045 were changing the type here to perform a validity test, which
6048 2003-02-12 Miguel de Icaza <miguel@ximian.com>
6050 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
6051 and structs, we do not want to load the instance variable
6053 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
6054 enum_type has to be handled like an object reference (implicit
6055 conversions exists from this to object), but the regular IsClass
6056 and IsValueType tests will never return true for this one.
6058 Also we use TypeManager.IsValueType instead of type.IsValueType,
6059 just for consistency with the rest of the code (this is only
6060 needed if we ever use the construct exposed by test-180.cs inside
6061 corlib, which we dont today).
6063 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
6065 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
6068 2003-02-09 Martin Baulig <martin@ximian.com>
6070 * namespace.cs (Namespace..ctor): Added SourceFile argument.
6071 (Namespace.DefineNamespaces): New static public method; this is
6072 called when we're compiling with debugging to add all namespaces
6075 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
6076 pass it to the Namespace's .ctor.
6078 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
6079 and MethodBase arguments; pass the namespace ID to the symwriter;
6080 pass the MethodBase instead of the token to the symwriter.
6081 (SymbolWriter.DefineNamespace): New method to add a namespace to
6084 2003-02-09 Martin Baulig <martin@ximian.com>
6086 * symbolwriter.cs: New file. This is a wrapper around
6087 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
6088 methods here in near future.
6090 2003-02-09 Martin Baulig <martin@ximian.com>
6092 * codegen.cs (EmitContext.Mark): Just pass the arguments to
6093 ILGenerator.MarkSequencePoint() which are actually used by the
6096 2003-02-09 Martin Baulig <martin@ximian.com>
6098 * location.cs (SourceFile): New public sealed class. This
6099 contains the name and an index which is used in the location's token.
6100 (Location): Reserve an appropriate number of bits in the token for
6101 the source file instead of walking over that list, this gives us a
6102 really huge performance improvement when compiling with debugging.
6104 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
6105 `SourceFile' argument instead of a string.
6106 (Driver.ProcessFile): Add all the files via Location.AddFile(),
6107 but don't parse/tokenize here, we need to generate the list of all
6108 source files before we do that.
6109 (Driver.ProcessFiles): New static function. Parses/tokenizes all
6112 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
6113 instead of a string.
6115 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
6118 2003-02-09 Martin Baulig <martin@ximian.com>
6120 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
6121 filename on `#line default'.
6123 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
6125 * statement.cs: don't clear the pinned var when the fixed statement
6126 returns from the method (fixes bug#37752).
6128 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
6130 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
6133 2003-02-07 Martin Baulig <martin@ximian.com>
6135 * driver.cs: Removed the `--debug-args' command line argument.
6137 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
6138 automatically by the AsssemblyBuilder.
6139 (CodeGen.InitializeSymbolWriter): We don't need to call any
6140 initialization function on the symbol writer anymore. This method
6141 doesn't take any arguments.
6143 2003-02-03 Miguel de Icaza <miguel@ximian.com>
6145 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
6146 from referenced assemblies as well.
6148 2003-02-02 Martin Baulig <martin@ximian.com>
6150 * class.cs (MethodData.Emit): Generate debugging info for external methods.
6152 2003-02-02 Martin Baulig <martin@ximian.com>
6154 * class.cs (Constructor.Emit): Open the symbol writer before
6155 emitting the constructor initializer.
6156 (ConstructorInitializer.Emit): Call ec.Mark() to allow
6157 single-stepping through constructor initializers.
6159 2003-01-30 Miguel de Icaza <miguel@ximian.com>
6161 * class.cs: Handle error 549: do not allow virtual methods in
6164 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
6166 * decl.cs: Check access levels when resolving types
6168 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
6170 * statement.cs: Add parameters and locals set in catch blocks that might
6171 return to set vector
6173 2003-01-29 Miguel de Icaza <miguel@ximian.com>
6175 * class.cs (Operator): Set the SpecialName flags for operators.
6177 * expression.cs (Invocation.DoResolve): Only block calls to
6178 accessors and operators on SpecialName methods.
6180 (Cast.TryReduce): Handle conversions from char constants.
6183 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
6185 * statement.cs: small memory and time optimization in FlowBranching.
6187 2003-01-28 Pedro Mart <yoros@wanadoo.es>
6189 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
6190 problem that the last fix but in the other sid (Set).
6192 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
6193 access when there is no indexer in the hierarchy.
6195 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
6197 * class.cs: Combine some if statements.
6199 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6201 * driver.cs: fixed bug #37187.
6203 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
6205 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
6206 any indexer, it's needed to build a list with all the indexers in the
6207 hierarchy (AllGetters), else we have problems. Fixes #35653.
6209 2003-01-23 Miguel de Icaza <miguel@ximian.com>
6211 * class.cs (MethodData.Define): It is wrong for an interface
6212 implementation to be static in both cases: explicit and implicit.
6213 We were only handling this in one case.
6215 Improve the if situation there to not have negations.
6217 * class.cs (Field.Define): Turns out that we do not need to check
6218 the unsafe bit on field definition, only on usage. Remove the test.
6220 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6222 * driver.cs: use assembly.Location instead of Codebase (the latest
6223 patch made mcs fail when using MS assemblies).
6225 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
6227 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
6228 get the path to *corlib.dll.
6230 2003-01-21 Nick Drochak <ndrochak@gol.com>
6234 * typemanager.cs: Remove compiler warnings
6236 2003-01-20 Duncan Mak <duncan@ximian.com>
6238 * AssemblyInfo.cs: Bump the version number to 0.19.
6240 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6242 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
6244 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
6246 * class.cs (Constructor::Emit): Emit debugging info for constructors.
6248 2003-01-17 Miguel de Icaza <miguel@ximian.com>
6250 * cs-parser.jay: Small fix: we were not comparing the constructor
6251 name correctly. Thanks to Zoltan for the initial pointer.
6253 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
6255 * cs-tokenizer.cs: Set file name when specified with #line
6257 2003-01-15 Miguel de Icaza <miguel@ximian.com>
6259 * cs-parser.jay: Only perform the constructor checks here if we
6260 are named like the class; This will help provider a better
6261 error. The constructor path is taken when a type definition is
6262 not found, but most likely the user forgot to add the type, so
6263 report that rather than the constructor error.
6265 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
6267 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
6270 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6272 * cs-parser.jay: Add cleanup call.
6274 2003-01-13 Duncan Mak <duncan@ximian.com>
6276 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
6277 consistent with other methods.
6279 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6281 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
6283 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
6285 * attribute.cs: only set GuidAttr to true when we have a
6288 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6292 * typemanager.cs: fixes to allow mcs compile corlib with the new
6293 Type.IsSubclassOf fix.
6295 2003-01-08 Miguel de Icaza <miguel@ximian.com>
6297 * expression.cs (LocalVariableReference.DoResolve): Classify a
6298 constant as a value, not as a variable. Also, set the type for
6301 * cs-parser.jay (fixed_statement): take a type instead of a
6302 pointer_type, so we can produce a better error message later.
6304 * statement.cs (Fixed.Resolve): Flag types that are not pointers
6307 (For.DoEmit): Make inifinite loops have a
6308 non-conditional branch back.
6310 (Fixed.DoEmit): First populate the pinned variables, then emit the
6311 statement, then clear the variables. Before I was emitting the
6312 code once for each fixed piece.
6315 2003-01-08 Martin Baulig <martin@ximian.com>
6317 * statement.cs (FlowBranching.MergeChild): A break in a
6318 SWITCH_SECTION does not leave a loop. Fixes #36155.
6320 2003-01-08 Martin Baulig <martin@ximian.com>
6322 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
6323 lives in the same number space than `param_map'. Fixes #36154.
6325 2003-01-07 Miguel de Icaza <miguel@ximian.com>
6327 * cs-parser.jay (constructor_declaration): Set the
6328 Constructor.ModFlags before probing for it. This makes the
6329 compiler report 514, 515 and 132 (the code was there, but got
6332 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
6333 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
6334 (GotoCase.Resolve): Set `Returns' to ALWAYS.
6336 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
6338 * enum.cs: create the enum static fields using the enum type.
6340 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
6342 * class.cs: don't try to create the ParamBuilder for the return
6343 type if it's not needed (and handle it breaking for the ms runtime
6346 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
6348 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
6350 2002-12-29 Miguel de Icaza <miguel@ximian.com>
6352 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
6353 the command. This showed up while compiling the JANET source
6354 code, which used \r as its only newline separator.
6356 2002-12-28 Miguel de Icaza <miguel@ximian.com>
6358 * class.cs (Method.Define): If we are an operator (because it
6359 reuses our code), then set the SpecialName and HideBySig. #36128
6361 2002-12-22 Miguel de Icaza <miguel@ximian.com>
6363 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
6364 exception, report error 120 `object reference required'.
6366 * driver.cs: Add --pause option, used during to measure the size
6367 of the process as it goes with --timestamp.
6369 * expression.cs (Invocation.DoResolve): Do not allow methods with
6370 SpecialName to be invoked.
6372 2002-12-21 Miguel de Icaza <miguel@ximian.com>
6374 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
6375 number before adding it.
6377 2002-12-21 Ravi Pratap <ravi@ximian.com>
6379 * ecore.cs (StandardImplicitConversion): When in an unsafe
6380 context, we allow conversion between void * to any other pointer
6381 type. This fixes bug #35973.
6383 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
6385 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
6386 is not thrown when extensionless outputs are used
6388 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6390 * rootcontext.cs: fixed compilation of corlib.
6392 2002-12-19 Miguel de Icaza <miguel@ximian.com>
6394 * attribute.cs (Attributes.Contains): Add new method.
6396 * class.cs (MethodCore.LabelParameters): if the parameter is an
6397 `out' parameter, check that no attribute `[In]' has been passed.
6399 * enum.cs: Handle the `value__' name in an enumeration.
6401 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
6403 * decl.cs: Added special case to allow overrides on "protected
6406 2002-12-18 Ravi Pratap <ravi@ximian.com>
6408 * attribute.cs (Attributes.AddAttributeSection): Rename to this
6409 since it makes much more sense.
6411 (Attributes.ctor): Don't require a Location parameter.
6413 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
6415 * attribute.cs (ApplyAttributes): Remove extra Location parameters
6416 since we already have that information per attribute.
6418 * everywhere : make appropriate changes.
6420 * class.cs (LabelParameters): Write the code which actually
6421 applies attributes to the return type. We can't do this on the MS
6422 .NET runtime so we flag a warning in the case an exception is
6425 2002-12-18 Miguel de Icaza <miguel@ximian.com>
6427 * const.cs: Handle implicit null conversions here too.
6429 2002-12-17 Ravi Pratap <ravi@ximian.com>
6431 * class.cs (MethodCore.LabelParameters): Remove the extra
6432 Type [] parameter since it is completely unnecessary. Instead
6433 pass in the method's attributes so that we can extract
6434 the "return" attribute.
6436 2002-12-17 Miguel de Icaza <miguel@ximian.com>
6438 * cs-parser.jay (parse): Use Report.Error to flag errors instead
6439 of ignoring it and letting the compile continue.
6441 * typemanager.cs (ChangeType): use an extra argument to return an
6442 error condition instead of throwing an exception.
6444 2002-12-15 Miguel de Icaza <miguel@ximian.com>
6446 * expression.cs (Unary.TryReduce): mimic the code for the regular
6447 code path. Perform an implicit cast in the cases where we can
6448 implicitly convert to one of the integral types, and then reduce
6449 based on that constant. This fixes bug #35483.
6451 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6453 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
6455 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6457 * namespace.cs: fixed bug #35489.
6459 2002-12-12 Miguel de Icaza <miguel@ximian.com>
6461 * class.cs: Remove some dead code.
6463 * cs-parser.jay: Estimate the number of methods needed
6464 (RootContext.MethodCount);
6466 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
6467 numbers instead of StringBuilders.
6469 * support.cs (PtrHashtable): Add constructor with initial size;
6470 We can now reduce reallocations of the method table.
6472 2002-12-10 Ravi Pratap <ravi@ximian.com>
6474 * attribute.cs (ApplyAttributes): Keep track of the emitted
6475 attributes on a per-target basis. This fixes bug #35413.
6477 2002-12-10 Miguel de Icaza <miguel@ximian.com>
6479 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
6480 default to the Windows 1252 encoding.
6482 (UnixParseOption): Support version, thanks to Alp for the missing
6485 * AssemblyInfo.cs: Add nice assembly information.
6487 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
6490 * cs-parser.jay: Allow a trailing comma before the close bracked
6491 in the attribute_section production.
6493 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
6494 address of the instance was being taken, I will take this out,
6495 because we take the address of the object immediately here.
6497 2002-12-09 Ravi Pratap <ravi@ximian.com>
6499 * typemanager.cs (AreMultipleAllowed): Take care of the most
6500 obvious case where attribute type is not in the current assembly -
6503 2002-12-08 Miguel de Icaza <miguel@ximian.com>
6505 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
6506 definitions, instead of doing that afterwards.
6508 Also we use a nice little hack, depending on the constructor, we
6509 know if we are a "composed" name or a simple name. Hence, we
6510 avoid the IndexOf test, and we avoid
6512 * codegen.cs: Add code to assist in a bug reporter to track down
6513 the source of a compiler crash.
6515 2002-12-07 Ravi Pratap <ravi@ximian.com>
6517 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
6518 types have been emitted for a given element and flag an error
6519 if something which does not have AllowMultiple set is used more
6522 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
6523 attribute types and their corresponding AllowMultiple properties
6525 (AreMultipleAllowed): Check the property for a given type.
6527 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
6528 property in the case we have a TypeContainer.
6530 (Attributes.AddAttribute): Detect duplicates and just skip on
6531 adding them. This trivial fix catches a pretty gross error in our
6532 attribute emission - global attributes were being emitted twice!
6534 Bugzilla bug #33187 is now fixed.
6536 2002-12-06 Miguel de Icaza <miguel@ximian.com>
6538 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
6541 * expression.cs (Binary.ResolveOperator): I can only use the
6542 Concat (string, string, string) and Concat (string, string,
6543 string, string) if the child is actually a concatenation of
6546 2002-12-04 Miguel de Icaza <miguel@ximian.com>
6548 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
6549 context where we need a 2-character lookahead.
6551 * pending.cs (PendingImplementation): Rework so we can keep track
6552 of interface types all the time, and flag those which were
6553 implemented by parents as optional.
6555 2002-12-03 Miguel de Icaza <miguel@ximian.com>
6557 * expression.cs (Binary.ResolveOperator): Use
6558 String.Concat(string,string,string) or
6559 String.Concat(string,string,string,string) when possible.
6561 * typemanager: More helper methods.
6564 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
6566 * pending.cs: remove the bogus return from GetMissingInterfaces()
6567 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
6569 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6571 * namespace.cs: avoid duplicated 'using xxx' being added to
6572 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
6573 when we get more than one 'using' statement for the same namespace.
6574 Report a CS0105 warning for it.
6576 2002-11-30 Miguel de Icaza <miguel@ximian.com>
6578 * cs-tokenizer.cs (consume_identifier): use read directly, instead
6579 of calling getChar/putback, uses internal knowledge of it.
6581 (xtoken): Reorder tokenizer so most common patterns are checked
6582 first. This reduces the compilation time in another 5% (from 8.11s
6583 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
6585 The parsing time is 22% of the compilation in mcs, and from that
6586 64% is spent on the tokenization process.
6588 I tried using a binary search for keywords, but this is slower
6589 than the hashtable. Another option would be to do a couple of
6592 * Not use a StringBuilder, instead use an array of chars,
6593 with a set value. Notice that this way we could catch
6594 the 645 error without having to do it *afterwards*.
6596 * We could write a hand-parser to avoid the hashtable
6597 compares altogether.
6599 The identifier consumption process takes 37% of the tokenization
6600 time. Another 15% is spent on is_number. 56% of the time spent
6601 on is_number is spent on Int64.Parse:
6603 * We could probably choose based on the string length to
6604 use Int32.Parse or Int64.Parse and avoid all the 64-bit
6607 Another 3% is spend on wrapping `xtoken' in the `token' function.
6609 Handle 0xa0 as whitespace (#34752)
6611 2002-11-26 Miguel de Icaza <miguel@ximian.com>
6613 * typemanager.cs (IsCLRType): New routine to tell whether a type
6614 is one of the builtin types.
6616 Maybe it needs to use TypeCodes to be faster. Maybe we could use
6617 typecode in more places instead of doing pointer comparissions.
6618 We could leverage some knowledge about the way the typecodes are
6621 New code to cache namespaces in assemblies, it is currently not
6622 invoked, to be used soon.
6624 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
6626 * expression.cs (Binary.ResolveOperator): specially handle
6627 strings, and do not perform user-defined operator overloading for
6630 2002-11-24 Miguel de Icaza <miguel@ximian.com>
6632 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
6633 internalcall as it is a pretty simple operation; Avoid whenever
6634 possible to call Char.IsLetter.
6636 (consume_identifier): Cut by half the number of
6637 hashtable calls by merging the is_keyword and GetKeyword behavior.
6639 Do not short-circuit, because if we do, we
6640 report errors (ie, #if false && true would produce an invalid
6644 2002-11-24 Martin Baulig <martin@ximian.com>
6646 * expression.cs (Cast.TryReduce): If we're in checked syntax,
6647 check constant ranges and report a CS0221. Fixes #33186.
6649 2002-11-24 Martin Baulig <martin@ximian.com>
6651 * cs-parser.jay: Make this work for uninitialized variable
6652 declarations in the `for' initializer. Fixes #32416.
6654 2002-11-24 Martin Baulig <martin@ximian.com>
6656 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
6657 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
6659 2002-11-24 Martin Baulig <martin@ximian.com>
6661 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
6662 argument; if true, we also check for user-defined conversions.
6663 This is only needed if both arguments are of a user-defined type.
6664 Fixes #30443, added test-175.cs.
6665 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
6667 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
6669 2002-11-24 Martin Baulig <martin@ximian.com>
6671 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
6672 function to get the store opcode.
6673 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
6674 only emit the Ldelema if the store opcode is Stobj. You must run
6675 both test-34 and test-167 to test this. Fixes #34529.
6677 2002-11-23 Martin Baulig <martin@ximian.com>
6679 * ecore.cs (Expression.MemberLookup): Added additional
6680 `qualifier_type' argument which is used when we're being called
6681 from MemberAccess.DoResolve() and null if we're called from a
6683 (Expression.MemberLookupFailed): New method to report errors; this
6684 does the CS1540 check and reports the correct error message.
6686 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
6687 argument for the CS1540 check and redone the way how we're dealing
6688 with private members. See the comment in the source code for details.
6689 (FilterWithClosure): Reverted this back to revision 1.197; renamed
6690 `closure_start_type' to `closure_qualifier_type' and check whether
6691 it's not null. It was not this filter being broken, it was just
6692 being called with the wrong arguments.
6694 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
6695 and pass it the correct `qualifier_type'; this also does the error
6698 2002-11-22 Miguel de Icaza <miguel@ximian.com>
6700 * expression.cs (Invocation.EmitParams): If the we are dealing
6701 with a non-built-in value type, load its address as well.
6703 (ArrayCreation): Use a a pretty constant instead
6704 of the hardcoded value 2. Use 6 instead of 2 for the number of
6705 static initializers.
6707 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
6708 because they are not really value types, just glorified integers.
6710 * driver.cs: Do not append .exe, the CSC compiler does not do it.
6712 * ecore.cs: Remove redundant code for enumerations, make them use
6713 the same code path as everything else, fixes the casting issue
6714 with enumerations in Windows.Forms.
6716 * attribute.cs: Do only cast to string if it is a string, the
6717 validation happens later.
6719 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
6720 people upgrade their corlibs.
6722 * ecore.cs: Oops, enumerations were not following the entire code path
6724 2002-11-21 Miguel de Icaza <miguel@ximian.com>
6726 * typemanager.cs (FilterWithClosure): Commented out the test for
6727 1540 in typemanager.cs, as it has problems when accessing
6728 protected methods from a parent class (see test-174.cs).
6730 * attribute.cs (Attribute.ValidateGuid): new method.
6731 (Attribute.Resolve): Use above.
6733 2002-11-19 Miguel de Icaza <miguel@ximian.com>
6735 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
6737 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
6738 handling for enumerations, as we only needed the TypeContainer
6739 functionality to begin with (this is required for the fix below to
6740 work for enums that reference constants in a container class for
6743 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
6745 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
6746 a valid TypeBuilder to perform lookups on.o
6748 * class.cs (InheritableMemberSignatureCompare): Use true in the
6749 call to GetGetMethod and GetSetMethod, because we are comparing
6750 the signature, and we need to get the methods *even* if they are
6753 (PropertyBase.CheckBase): ditto.
6755 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
6756 GotoCase.Resolve): Use Peel on EmpytCasts.
6758 * ecore.cs (EmptyCast): drop child, add Peel method.
6760 2002-11-17 Martin Baulig <martin@ximian.com>
6762 * ecore.cs (EmptyCast.Child): New public property.
6764 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
6765 label resolved to an EmptyCast. Fixes #34162.
6766 (GotoCase.Resolve): Likewise.
6767 (Block.EmitMeta): Likewise.
6769 2002-11-17 Martin Baulig <martin@ximian.com>
6771 * expression.cs (Invocation.BetterConversion): Prefer int over
6772 uint; short over ushort; long over ulong for integer literals.
6773 Use ImplicitConversionExists instead of StandardConversionExists
6774 since we also need to check for user-defined implicit conversions.
6775 Fixes #34165. Added test-173.cs.
6777 2002-11-16 Martin Baulig <martin@ximian.com>
6779 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
6780 with the `true' and `false' literals. Fixes #33151.
6782 2002-11-16 Martin Baulig <martin@ximian.com>
6784 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
6785 October 22nd; don't do the cs1540 check for static members.
6787 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
6788 now using our own filter here and doing the cs1540 check again.
6790 2002-11-16 Martin Baulig <martin@ximian.com>
6792 * support.cs (InternalParameters): Don't crash if we don't have
6793 any fixed parameters. Fixes #33532.
6795 2002-11-16 Martin Baulig <martin@ximian.com>
6797 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
6798 when looking up static methods to make this work on Windows.
6801 2002-11-16 Martin Baulig <martin@ximian.com>
6803 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
6804 a setter rather than using PropertyInfo.CanWrite.
6806 2002-11-15 Nick Drochak <ndrochak@gol.com>
6808 * class.cs: Allow acces to block member by subclasses. Fixes build
6811 2002-11-14 Martin Baulig <martin@ximian.com>
6813 * class.cs (Constructor.Emit): Added the extern/block check.
6816 2002-11-14 Martin Baulig <martin@ximian.com>
6818 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
6819 iteration while looking for indexers, this is needed because the
6820 indexer may have a different name in our base classes. Fixed the
6821 error reporting (no indexers at all, not get accessor, no
6822 overloaded match). Fixes bug #33089.
6823 (IndexerAccess.DoResolveLValue): Likewise.
6825 2002-11-14 Martin Baulig <martin@ximian.com>
6827 * class.cs (PropertyBase.CheckBase): Make this work for multiple
6828 indexers. Fixes the first part of bug #33089.
6829 (MethodSignature.InheritableMemberSignatureCompare): Added support
6832 2002-11-13 Ravi Pratap <ravi@ximian.com>
6834 * attribute.cs (Attribute.Resolve): Catch the
6835 NullReferenceException and report it since it isn't supposed to
6838 2002-11-12 Miguel de Icaza <miguel@ximian.com>
6840 * expression.cs (Binary.EmitBranchable): Also handle the cases for
6841 LogicalOr and LogicalAnd that can benefit from recursively
6842 handling EmitBranchable. The code now should be nice for Paolo.
6844 2002-11-08 Miguel de Icaza <miguel@ximian.com>
6846 * typemanager.cs (LookupType): Added a negative-hit hashtable for
6847 the Type lookups, as we perform quite a number of lookups on
6848 non-Types. This can be removed once we can deterministically tell
6849 whether we have a type or a namespace in advance.
6851 But this might require special hacks from our corlib.
6855 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
6856 and double which avoids a conversion from an integer to a double.
6858 * expression.cs: tiny optimization, avoid calling IsConstant,
6859 because it effectively performs the lookup twice.
6861 2002-11-06 Miguel de Icaza <miguel@ximian.com>
6863 But a bogus return here to keep the semantics of the old code
6864 until the Mono runtime is fixed.
6866 * pending.cs (GetMissingInterfaces): New method used to remove all
6867 the interfaces that are already implemented by our parent
6868 classes from the list of pending methods.
6870 * interface.cs: Add checks for calls after ResolveTypeExpr.
6872 2002-11-05 Miguel de Icaza <miguel@ximian.com>
6874 * class.cs (Class.Emit): Report warning 67: event not used if the
6875 warning level is beyond 3.
6877 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
6878 being a NullLiteral.
6880 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
6883 * class.cs (TypeContainer.GetClassBases): Cover a missing code
6884 path that might fail if a type can not be resolved.
6886 * expression.cs (Binary.Emit): Emit unsigned versions of the
6889 * driver.cs: use error 5.
6891 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
6893 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
6895 2002-11-01 Miguel de Icaza <miguel@ximian.com>
6897 * cs-parser.jay (switch_section): A beautiful patch from Martin
6898 Baulig that fixed 33094.
6900 2002-10-31 Miguel de Icaza <miguel@ximian.com>
6902 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
6903 Check whether the base is abstract and report an error if so.
6905 * expression.cs (IndexerAccess.DoResolveLValue,
6906 IndexerAccess.DoResolve): ditto.
6908 (Invocation.DoResolve): ditto.
6910 (Invocation.FullMethodDesc): Improve the report string.
6912 * statement.cs (Block): Eliminate IsVariableDefined as it is
6913 basically just a wrapper for GetVariableInfo.
6915 * ecore.cs (SimpleName): Use new
6917 * support.cs (ReflectionParamter.ParameterType): We unwrap the
6918 type, as we return the actual parameter ref/unref state on a
6921 2002-10-30 Miguel de Icaza <miguel@ximian.com>
6923 * support.cs: Return proper flags REF/OUT fixing the previous
6926 * expression.cs: Reverted last patch, that was wrong. Is_ref is
6927 not used to mean `ref' but `ref or out' in ParameterReference
6929 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
6930 full type signature instead of calling TypeManger.CSharpName
6933 * support.cs (InternalParameters.ParameterDesc): Do not compare
6934 directly to the modflags, because REF/OUT will actually be bitsets
6937 * delegate.cs (VerifyMethod): Check also the modifiers.
6939 * cs-tokenizer.cs: Fix bug where floating point values with an
6940 exponent where a sign was missing was ignored.
6942 * driver.cs: Allow multiple assemblies to be specified in a single
6945 2002-10-28 Miguel de Icaza <miguel@ximian.com>
6947 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
6948 because identifiers after a parenthesis would end up in this kind
6949 of production, and we needed to desamiguate it for having casts
6952 (UserDefinedType *) xxx
6954 2002-10-24 Miguel de Icaza <miguel@ximian.com>
6956 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
6957 we should set on the Bindingflags.NonPublic, but not turn on
6958 private_ok. private_ok controls whether a Private member is
6959 returned (this is chekced on the filter routine), while the
6960 BindingFlags.NonPublic just controls whether private/protected
6961 will be allowed. This fixes the problem part of the problem of
6962 private properties being allowed to be used in derived classes.
6964 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
6965 so we can call the children DoResolveLValue method (this will
6966 properly signal errors on lvalue assignments to base properties)
6968 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
6969 getter are null, and we have a property info, we know that this
6970 happened because the lookup failed, so we report an error 122 for
6971 protection level violation.
6973 We also silently return if setter and getter are null in the
6974 resolve functions, this condition only happens if we have flagged
6975 the error before. This is the other half of the problem.
6977 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
6978 not have accessibility information, that is why we were returning
6979 true in the filter function in typemanager.cs.
6981 To properly report 122 (property is inaccessible because of its
6982 protection level) correctly, we report this error in ResolveAccess
6983 by failing if both the setter and the getter are lacking (ie, the
6986 DoResolve and DoLResolve have been modified to check for both
6987 setter/getter being null and returning silently, the reason being
6988 that I did not want to put the knowledge about this error in upper
6991 int old = Report.Errors;
6992 x = new PropertyExpr (...);
6993 if (old != Report.Errors)
6998 So the property expr is returned, but it is invalid, so the error
6999 will be flagged during the resolve process.
7001 * class.cs: Remove InheritablePropertySignatureCompare from the
7002 class, as we no longer depend on the property signature to compute
7003 whether it is possible to implement a method or not.
7005 The reason is that calling PropertyInfo.GetGetMethod will return
7006 null (in .NET, in Mono it works, and we should change this), in
7007 cases where the Get Method does not exist in that particular
7012 class X { public virtual int A { get { return 1; } } }
7014 class Z : Y { public override int A { get { return 2; } } }
7016 Would fail in Z because the parent (Y) would not have the property
7017 defined. So we avoid this completely now (because the alternative
7018 fix was ugly and slow), and we now depend exclusively on the
7021 (PropertyBase.CheckBase): Use a method-base mechanism to find our
7022 reference method, instead of using the property.
7024 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
7025 routines are gone now.
7027 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
7028 names, they were incorrectly named.
7030 * cs-tokenizer.cs: Return are more gentle token on failure.
7032 * pending.cs (PendingImplementation.InterfaceMethod): This routine
7033 had an out-of-sync index variable, which caused it to remove from
7034 the list of pending methods the wrong method sometimes.
7036 2002-10-22 Miguel de Icaza <miguel@ximian.com>
7038 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
7039 CanWrite, because those refer to this particular instance of the
7040 property, and do not take into account the fact that we can
7041 override single members of a property.
7043 Constructor requires an EmitContext. The resolution process does
7044 not happen here, but we need to compute the accessors before,
7045 because the resolution does not always happen for properties.
7047 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
7048 subclass, before we did not update this flag, but we did update
7051 (GetAccessors): Drop this routine, as it did not work in the
7052 presence of partially overwritten set/get methods.
7054 Notice that this broke the cs1540 detection, but that will require
7057 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7061 * driver.cs: issue a warning instead of an error if we don't support
7062 debugging for the platform. Also ignore a couple of errors that may
7063 arise when trying to write the symbols. Undo my previous patch.
7065 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7067 * driver.cs: ignore /debug switch except for Unix platforms.
7069 2002-10-23 Nick Drochak <ndrochak@gol.com>
7071 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
7073 2002-10-21 Miguel de Icaza <miguel@ximian.com>
7075 * driver.cs: Do not make mcs-debug conditional, so we do not break
7078 * statement.cs (UsageVector.MergeChildren): I would like Martin to
7079 review this patch. But basically after all the children variables
7080 have been merged, the value of "Breaks" was not being set to
7081 new_breaks for Switch blocks. I think that it should be set after
7082 it has executed. Currently I set this to the value of new_breaks,
7083 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
7084 conservative, but I do not understand this code very well.
7086 I did not break anything in the build, so that is good ;-)
7088 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
7090 2002-10-20 Mark Crichton <crichton@gimp.org>
7092 * cfold.cs: Fixed compile blocker. Really fixed it this time.
7094 2002-10-20 Nick Drochak <ndrochak@gol.com>
7096 * cfold.cs: Fixed compile blocker.
7098 2002-10-20 Miguel de Icaza <miguel@ximian.com>
7100 * driver.cs: I was chekcing the key, not the file.
7102 2002-10-19 Ravi Pratap <ravi@ximian.com>
7104 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
7105 message that we were generating - we just need to silently return
7108 2002-10-19 Miguel de Icaza <miguel@ximian.com>
7110 * class.cs (Event.Define): Change my previous commit, as this
7111 breaks the debugger. This is a temporary hack, as it seems like
7112 the compiler is generating events incorrectly to begin with.
7114 * expression.cs (Binary.ResolveOperator): Added support for
7115 "U operator - (E x, E y)"
7117 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
7120 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
7121 init-only variables, but this path did not take into account that
7122 there might be also instance readonly variables. Correct this
7125 This fixes bug 32253
7127 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
7130 * driver.cs: Change the extension for modules to `netmodule'
7132 * cs-parser.jay: Improved slightly the location tracking for
7133 the debugger symbols.
7135 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
7136 modifiers that were specified instead of the hardcoded value
7137 (FamAndAssem). This was basically ignoring the static modifier,
7138 and others. Fixes 32429.
7140 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
7141 fixed a bug in the process (32476)
7143 * expression.cs (ArrayAccess.EmitAssign): Patch from
7144 hwang_rob@yahoo.ca that fixes bug 31834.3
7146 2002-10-18 Miguel de Icaza <miguel@ximian.com>
7148 * driver.cs: Make the module extension .netmodule.
7150 2002-10-16 Miguel de Icaza <miguel@ximian.com>
7152 * driver.cs: Report an error if the resource file is not found
7153 instead of crashing.
7155 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
7156 false, like Emit does.
7158 2002-10-16 Nick Drochak <ndrochak@gol.com>
7160 * typemanager.cs: Remove unused private member. Also reported mcs
7161 bug to report this as a warning like csc.
7163 2002-10-15 Martin Baulig <martin@gnome.org>
7165 * statement.cs (Statement.Emit): Made this a virtual method; emits
7166 the line number info and calls DoEmit().
7167 (Statement.DoEmit): New protected abstract method, formerly knows
7168 as Statement.Emit().
7170 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
7172 2002-10-11 Miguel de Icaza <miguel@ximian.com>
7174 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
7175 have fixed a remaining problem: not every AddXXXX was adding a
7176 fully qualified name.
7178 Now everyone registers a fully qualified name in the DeclSpace as
7179 being defined instead of the partial name.
7181 Downsides: we are slower than we need to be due to the excess
7182 copies and the names being registered this way.
7184 The reason for this is that we currently depend (on the corlib
7185 bootstrap for instance) that types are fully qualified, because
7186 we dump all the types in the namespace, and we should really have
7187 types inserted into the proper namespace, so we can only store the
7188 basenames in the defined_names array.
7190 2002-10-10 Martin Baulig <martin@gnome.org>
7192 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
7193 from bug #31834, see the bug report for a testcase which is
7196 2002-10-10 Martin Baulig <martin@gnome.org>
7198 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
7199 flow analysis code for this.
7201 * statement.cs (Do, While, For): Tell the flow analysis code about
7203 (FlowBranching.UsageVector): Added support for infinite loops.
7204 (Block.Resolve): Moved the dead code elimination here and use flow
7207 2002-10-09 Miguel de Icaza <miguel@ximian.com>
7209 * class.cs (Field.Define): Catch cycles on struct type
7212 * typemanager.cs (IsUnmanagedtype): Do not recursively check
7213 fields if the fields are static. We only need to check instance
7216 * expression.cs (As.DoResolve): Test for reference type.
7218 * statement.cs (Using.ResolveExpression): Use
7219 ConvertImplicitRequired, not ConvertImplicit which reports an
7221 (Using.ResolveLocalVariableDecls): ditto.
7223 * expression.cs (Binary.ResolveOperator): Report errors in a few
7224 places where we had to.
7226 * typemanager.cs (IsUnmanagedtype): Finish implementation.
7228 2002-10-08 Miguel de Icaza <miguel@ximian.com>
7230 * expression.cs: Use StoreFromPtr instead of extracting the type
7231 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
7233 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
7234 an enumeration value to a System.Enum, but System.Enum is not a
7235 value type, but an class type, so we need to box.
7237 (Expression.ConvertExplicit): One codepath could return
7238 errors but not flag them. Fix this. Fixes #31853
7240 * parameter.cs (Resolve): Do not allow void as a parameter type.
7242 2002-10-06 Martin Baulig <martin@gnome.org>
7244 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
7245 if it's a class type and not a struct. Fixes #31815.
7247 2002-10-06 Martin Baulig <martin@gnome.org>
7249 * statement.cs: Reworked the flow analysis code a bit to make it
7250 usable for dead code elimination.
7252 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7254 * cs-parser.jay: allow empty source files. Fixes bug #31781.
7256 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7258 * expression.cs (ComposedCast.DoResolveType): A quick workaround
7259 to fix the test 165, will investigate deeper.
7261 2002-10-04 Martin Baulig <martin@gnome.org>
7263 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
7264 finally blocks actually work.
7265 (Try.Resolve): We don't need to create a sibling for `finally' if
7266 there is no finally block.
7268 2002-10-04 Martin Baulig <martin@gnome.org>
7270 * class.cs (Constructor.Define): The default accessibility for a
7271 non-default constructor is private, not public.
7273 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7275 * class.cs (Constructor): Make AllowedModifiers public, add
7278 * cs-parser.jay: Perform the modifiers test here, as the
7279 constructor for the Constructor class usually receives a zero
7280 because of the way we create it (first we create, later we
7281 customize, and we were never checking the modifiers).
7283 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
7284 is a version of LookupTypeReflection that includes the type-name
7285 cache. This can be used as a fast path for functions that know
7286 the fully qualified name and are only calling into *.GetType() to
7287 obtain a composed type.
7289 This is also used by TypeManager.LookupType during its type
7292 (LookupType): We now also track the real type name, as sometimes
7293 we can get a quey for the real type name from things like
7294 ComposedCast. This fixes bug 31422.
7296 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
7297 complete type fullname, it does not have to go through the type
7298 resolution system to obtain the composed version of the type (for
7299 obtaining arrays or pointers).
7301 (Conditional.Emit): Use the EmitBoolExpression to
7302 generate nicer code, as requested by Paolo.
7304 (ArrayCreation.CheckIndices): Use the patch from
7305 hwang_rob@yahoo.ca to validate the array initializers.
7307 2002-10-03 Miguel de Icaza <miguel@ximian.com>
7309 * class.cs (ConstructorInitializer.Emit): simplify code by using
7310 Invocation.EmitCall, and at the same time, fix the bugs in calling
7311 parent constructors that took variable arguments.
7313 * ecore.cs (Expression.ConvertNumericExplicit,
7314 Expression.ImplicitNumericConversion): Remove the code that
7315 manually wrapped decimal (InternalTypeConstructor call is now gone
7318 * expression.cs (Cast.TryReduce): Also handle decimal types when
7319 trying to perform a constant fold on the type.
7321 * typemanager.cs (IsUnmanagedtype): Partially implemented.
7323 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
7324 that only turned off an error report, and did nothing else.
7326 2002-10-02 Miguel de Icaza <miguel@ximian.com>
7328 * driver.cs: Handle and ignore /fullpaths
7330 2002-10-01 Miguel de Icaza <miguel@ximian.com>
7332 * expression.cs (Binary.ResolveOperator): Catch the case where
7333 DoNumericPromotions returns true,
7335 (Binary.DoNumericPromotions): Simplify the code, and the tests.
7337 2002-09-27 Miguel de Icaza <miguel@ximian.com>
7339 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
7342 2002-09-26 Miguel de Icaza <miguel@ximian.com>
7344 * ecore.cs (ConvertNumericExplicit): It is not enough that the
7345 conversion exists, but it is also required that the conversion be
7346 performed. This manifested in "(Type64Enum) 2".
7348 * class.cs (TypeManager.AddMethod): The fix is not to change
7349 AddEnum, because that one was using a fully qualified name (every
7350 DeclSpace derivative does), but to change the AddMethod routine
7351 that was using an un-namespaced name. This now correctly reports
7352 the duplicated name.
7354 Revert patch until I can properly fix it. The issue
7355 is that we have a shared Type space across all namespaces
7356 currently, which is wrong.
7358 Options include making the Namespace a DeclSpace, and merge
7359 current_namespace/current_container in the parser.
7361 2002-09-25 Miguel de Icaza <miguel@ximian.com>
7363 * cs-parser.jay: Improve error reporting when we get a different
7364 kind of expression in local_variable_type and
7365 local_variable_pointer_type.
7367 Propagate this to avoid missleading errors being reported.
7369 * ecore.cs (ImplicitReferenceConversion): treat
7370 TypeManager.value_type as a target just like object_type. As
7375 Is valid, and needs to result in the int 1 being boxed before it
7376 is assigned to the value type v.
7378 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
7379 to validate the enumeration name.
7381 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
7382 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
7383 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
7385 * ecore.cs (TryImplicitIntConversion): When doing an
7386 implicit-enumeration-conversion, check if the type is 64-bits and
7387 perform a conversion before passing to EnumConstant.
7389 2002-09-23 Miguel de Icaza <miguel@ximian.com>
7391 * decl.cs (Error_AmbiguousTypeReference); New routine used to
7392 report ambiguous type references. Unlike the MS version, we
7393 report what the ambiguity is. Innovation at work ;-)
7395 (DeclSpace.FindType): Require a location argument to
7396 display when we display an ambiguous error.
7398 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
7400 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
7402 * expression.cs (EmitDynamicInitializers): Apply patch from
7403 hwang_rob@yahoo.ca that fixes the order in which we emit our
7406 2002-09-21 Martin Baulig <martin@gnome.org>
7408 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
7409 delegate takes no arguments.
7411 2002-09-20 Miguel de Icaza <miguel@ximian.com>
7413 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
7416 * expression.cs: Extract the underlying type.
7418 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
7420 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
7422 2002-09-19 Miguel de Icaza <miguel@ximian.com>
7424 * class.cs (TypeContainer.DefineType): We can not use the nice
7425 PackingSize with the size set to 1 DefineType method, because it
7426 will not allow us to define the interfaces that the struct
7429 This completes the fixing of bug 27287
7431 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
7432 means also structs. This fixes part of the problem.
7433 (Expresion.ImplicitReferenceConversionExists): ditto.
7435 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
7436 error if there were no errors reported during the type lookup
7437 process, to avoid duplicates or redundant errors. Without this
7438 you would get an ambiguous errors plus a type not found. We have
7439 beaten the user enough with the first error.
7441 (DeclSparce.FindType): Emit a warning if we have an ambiguous
7444 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
7445 during the resolution process, stop the lookup, this avoids
7446 repeated error reports (same error twice).
7448 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
7450 * typemanager.cs (LookupType): Redo the type lookup code to match
7451 the needs of System.Reflection.
7453 The issue is that System.Reflection requires references to nested
7454 types to begin with a "+" sign instead of a dot. So toplevel
7455 types look like: "NameSpace.TopLevelClass", and nested ones look
7456 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
7459 2002-09-19 Martin Baulig <martin@gnome.org>
7461 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
7462 says that a method always returns or always throws an exception,
7463 don't report the CS0161.
7465 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
7466 set `Returns = new_returns'.
7468 2002-09-19 Martin Baulig <martin@gnome.org>
7470 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
7471 to an enum constant, check for a CS0176.
7473 2002-09-18 Miguel de Icaza <miguel@ximian.com>
7475 * class.cs (TypeContainer.CheckPairedOperators): Now we check
7476 for operators that must be in pairs and report errors.
7478 * ecore.cs (SimpleName.DoResolveType): During the initial type
7479 resolution process, when we define types recursively, we must
7480 check first for types in our current scope before we perform
7481 lookups in the enclosing scopes.
7483 * expression.cs (MakeByteBlob): Handle Decimal blobs.
7485 (Invocation.VerifyArgumentsCompat): Call
7486 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
7487 I thought we were supposed to always call this, but there are a
7488 few places in the code where we dont do it.
7490 2002-09-17 Miguel de Icaza <miguel@ximian.com>
7492 * driver.cs: Add support in -linkres and -resource to specify the
7493 name of the identifier.
7495 2002-09-16 Miguel de Icaza <miguel@ximian.com>
7497 * ecore.cs (StandardConversionExists): Sync with the conversion
7498 code: allow anything-* to void* conversions.
7500 (FindMostSpecificSource): Use an Expression argument
7501 instead of a Type, because we might be handed over a Literal which
7502 gets a few more implicit conversions that plain types do not. So
7503 this information was being lost.
7505 Also, we drop the temporary type-holder expression when not
7508 2002-09-17 Martin Baulig <martin@gnome.org>
7510 * class.cs (PropertyBase.CheckBase): Don't check the base class if
7511 this is an explicit interface implementation.
7513 2002-09-17 Martin Baulig <martin@gnome.org>
7515 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
7516 different `IndexerName' attributes.
7518 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
7519 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
7520 virtual CommonResolve().
7522 2002-09-16 Miguel de Icaza <miguel@ximian.com>
7524 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
7525 and convert that to the UnderlyingType.
7527 * statement.cs (Foreach.Resolve): Indexers are just like variables
7528 or PropertyAccesses.
7530 * cs-tokenizer.cs (consume_string): Track line numbers and columns
7531 inside quoted strings, we were not doing this before.
7533 2002-09-16 Martin Baulig <martin@gnome.org>
7535 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
7536 resolve it. This is needed for the definite assignment check of the
7537 instance expression, fixes bug #29846.
7538 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
7540 2002-09-16 Nick Drochak <ndrochak@gol.com>
7542 * parameter.cs: Fix compile error. Cannot reference static member
7543 from an instance object. Is this an mcs bug?
7545 2002-09-14 Martin Baulig <martin@gnome.org>
7547 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
7548 multiple times. Fixes bug #30295, added test-166.cs.
7550 2002-09-14 Martin Baulig <martin@gnome.org>
7552 * statement.cs (Block.Emit): Don't emit unreachable code.
7553 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
7555 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
7557 2002-09-14 Martin Baulig <martin@gnome.org>
7559 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
7562 2002-09-14 Martin Baulig <martin@gnome.org>
7564 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
7565 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
7566 be false on the ms runtime.
7568 2002-09-13 Martin Baulig <martin@gnome.org>
7570 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
7571 the CS0038 error message.
7573 2002-09-12 Miguel de Icaza <miguel@ximian.com>
7575 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
7576 constant inside, return it.
7578 2002-09-12 Martin Baulig <martin@gnome.org>
7580 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
7581 implicit conversion can be done between enum types.
7583 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
7584 check whether an implicit conversion to the current enum's UnderlyingType
7585 exists and report an error if not.
7587 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
7588 without debugging support.
7590 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
7591 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
7593 2002-09-12 Martin Baulig <martin@gnome.org>
7595 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
7597 * ecore.cs (IMemberExpr.DeclaringType): New property.
7598 (SimpleName.SimpleNameResolve): Check whether we're accessing a
7599 nonstatic member of an outer type (CS0038).
7601 2002-09-11 Miguel de Icaza <miguel@ximian.com>
7603 * driver.cs: Activate the using-error detector at warning level
7604 4 (at least for MS-compatible APIs).
7606 * namespace.cs (VerifyUsing): Small buglett fix.
7608 * pending.cs (PendingImplementation): pass the container pointer.
7610 * interface.cs (GetMethods): Allow for recursive definition. Long
7611 term, I would like to move every type to support recursive
7612 definitions, not the current ordering mechanism that we have right
7615 The situation is this: Attributes are handled before interfaces,
7616 so we can apply attributes to interfaces. But some attributes
7617 implement interfaces, we will now handle the simple cases
7618 (recursive definitions will just get an error).
7620 * parameter.cs: Only invalidate types at the end if we fail to
7623 2002-09-09 Martin Baulig <martin@gnome.org>
7625 * ecore.cs (PropertyExpr.Emit): Also check for
7626 TypeManager.system_int_array_get_length so this'll also work when
7627 compiling corlib. Fixes #30003.
7629 2002-09-09 Martin Baulig <martin@gnome.org>
7631 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
7632 and throw an exception if we can't get the type's size. Fixed #30040,
7635 2002-09-09 Martin Baulig <martin@gnome.org>
7637 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
7639 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
7640 context. Fixes bug #30027.
7642 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
7643 virtual functions. Fixes bug #30043, added test-164.cs.
7645 2002-09-08 Ravi Pratap <ravi@ximian.com>
7647 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
7649 2002-09-08 Nick Drochak <ndrochak@gol.com>
7651 * driver.cs: Use an object to get the windows codepage since it's not a
7654 2002-09-08 Miguel de Icaza <miguel@ximian.com>
7656 * statement.cs (For.Emit): for infinite loops (test == null)
7657 return whether there is a break inside, not always "true".
7659 * namespace.cs (UsingEntry): New struct to hold the name of the
7660 using definition, the location where it is defined, and whether it
7661 has been used in a successful type lookup.
7663 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
7668 2002-09-06 Ravi Pratap <ravi@ximian.com>
7670 * attribute.cs : Fix incorrect code which relied on catching
7671 a NullReferenceException to detect a null being passed in
7672 where an object was expected.
7674 2002-09-06 Miguel de Icaza <miguel@ximian.com>
7676 * statement.cs (Try): flag the catch variable as assigned
7678 * expression.cs (Cast): Simplified by using ResolveType instead of
7681 * statement.cs (Catch): Fix bug by using ResolveType.
7683 2002-09-06 Ravi Pratap <ravi@ximian.com>
7685 * expression.cs (BetterConversion): Special case for when we have
7686 a NullLiteral as the argument and we have to choose between string
7687 and object types - we choose string the way csc does.
7689 * attribute.cs (Attribute.Resolve): Catch the
7690 NullReferenceException and report error #182 since the Mono
7691 runtime no more has the bug and having this exception raised means
7692 we tried to select a constructor which takes an object and is
7695 2002-09-05 Ravi Pratap <ravi@ximian.com>
7697 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
7698 message (1502, 1503) when we can't locate a method after overload
7699 resolution. This is much more informative and closes the bug
7702 * interface.cs (PopulateMethod): Return if there are no argument
7703 types. Fixes a NullReferenceException bug.
7705 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
7706 expressions too. Previously we were checking only in one place for
7707 positional arguments leaving out named arguments.
7709 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
7710 type to the enum type is not allowed. Remove code corresponding to
7713 (ConvertNumericExplicit): Allow explicit conversions from
7714 the underlying type to enum type. This precisely follows the spec
7715 and closes a bug filed by Gonzalo.
7717 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7720 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
7722 2002-09-03 Miguel de Icaza <miguel@ximian.com>
7724 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
7725 it was important that we stored the right value after the
7726 reduction in `converted'.
7728 2002-09-04 Martin Baulig <martin@gnome.org>
7730 * location.cs (Location.SymbolDocument): Use full pathnames for the
7733 2002-08-30 Miguel de Icaza <miguel@ximian.com>
7735 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
7736 of the expression resolve mechanism, because that will catch the
7737 SimpleName error failures.
7739 (Conditional): If we can not resolve the
7740 expression, return, do not crash.
7742 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7745 (location): display token name instead of its number.
7747 2002-08-28 Martin Baulig <martin@gnome.org>
7749 * expression.cs (Binary.ResolveOperator): Don't silently return
7750 but return an error if an operator cannot be applied between two
7753 2002-08-28 Martin Baulig <martin@gnome.org>
7755 * class.cs (Constructor.Define): Set the permission attributes
7756 correctly instead of making all constructors public.
7758 2002-08-28 Martin Baulig <martin@gnome.org>
7760 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
7761 for private members before reporting a CS0103; if we find anything,
7764 2002-08-28 Martin Baulig <martin@gnome.org>
7766 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
7767 to check whether `closure_start_type == closure_invocation_type',
7768 we also need to check whether `m.DeclaringType == closure_invocation_type'
7769 before bypassing the permission checks. We might be accessing
7770 protected/private members from the base class.
7771 (TypeManager.RealMemberLookup): Only set private_ok if private
7772 members were requested via BindingFlags.NonPublic.
7774 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
7776 * expression.cs (MemberAccess.ResolveMemberAccess): Set
7777 MethodGroupExpr.IsExplicitImpl if appropriate.
7778 (Invocation.DoResolve): Don't report the CS0120 for explicit
7779 interface implementations.
7781 2002-08-27 Martin Baulig <martin@gnome.org>
7783 * expression.cs (Invocation.DoResolve): If this is a static
7784 method and we don't have an InstanceExpression, we must report
7787 2002-08-25 Martin Baulig <martin@gnome.org>
7789 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
7790 `==' between a valuetype and an object.
7792 2002-08-25 Miguel de Icaza <miguel@ximian.com>
7794 * ecore.cs (TypeExpr): Provide a ToString method.
7796 2002-08-24 Martin Baulig <martin@gnome.org>
7798 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
7799 now called proggie.dbg and it's a binary file.
7801 2002-08-23 Martin Baulig <martin@gnome.org>
7803 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
7805 2002-08-23 Martin Baulig <martin@gnome.org>
7807 * struct.cs (MyStructInfo.ctor): Make this work with empty
7808 structs; it's not allowed to use foreach() on null.
7810 2002-08-23 Martin Baulig <martin@gnome.org>
7812 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
7813 writer the full pathname of the generated assembly.
7815 2002-08-23 Martin Baulig <martin@gnome.org>
7817 * statements.cs (FlowBranching.UsageVector.MergeChildren):
7818 A `finally' block never returns or breaks; improved handling of
7821 2002-08-23 Martin Baulig <martin@gnome.org>
7823 * statement.cs (Throw.Resolve): Allow `throw null'.
7825 2002-08-23 Martin Baulig <martin@gnome.org>
7827 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
7828 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
7829 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
7830 MemberLookup would return a wrong event if this is an explicit
7831 interface implementation and the class has an event with the same
7834 2002-08-23 Martin Baulig <martin@gnome.org>
7836 * statement.cs (Block.AddChildVariableNames): New public method.
7837 (Block.AddChildVariableName): Likewise.
7838 (Block.IsVariableNameUsedInChildBlock): Likewise.
7839 (Block.AddVariable): Check whether a variable name has already
7840 been used in a child block.
7842 * cs-parser.jay (declare_local_variables): Mark all variable names
7843 from the current block as being used in a child block in the
7846 2002-08-23 Martin Baulig <martin@gnome.org>
7848 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
7849 find the symbol writer.
7851 * driver.cs: csc also allows the arguments to /define being
7852 separated by commas, not only by semicolons.
7854 2002-08-23 Martin Baulig <martin@gnome.org>
7856 * interface.cs (Interface.GetMembers): Added static check for events.
7858 2002-08-15 Martin Baulig <martin@gnome.org>
7860 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
7861 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
7863 * ecore.cs (Expression.MemberLookup): Added documentation and explained
7864 why the MethodData.EmitDestructor() change was necessary.
7866 2002-08-20 Martin Baulig <martin@gnome.org>
7868 * class.cs (TypeContainer.FindMembers): Added static check for events.
7870 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
7872 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
7873 use Type.GetEvents(), not Type.FindMembers().
7875 2002-08-20 Martin Baulig <martin@gnome.org>
7877 * decl.cs (MemberCache): Added a special method cache which will
7878 be used for method-only searched. This ensures that a method
7879 search will return a MethodInfo with the correct ReflectedType for
7882 2002-08-20 Martin Baulig <martin@gnome.org>
7884 * decl.cs (DeclSpace.FindMembers): Made this public.
7886 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7888 * delegate.cs: fixed build on windows.
7889 [FIXME: Filed as bug #29150: MCS must report these errors.]
7891 2002-08-19 Ravi Pratap <ravi@ximian.com>
7893 * ecore.cs (StandardConversionExists): Return a false
7894 if we are trying to convert the void type to anything else
7895 since that is not allowed.
7897 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
7898 we flag error 70 in the event an event is trying to be accessed
7899 directly from outside the declaring type.
7901 2002-08-20 Martin Baulig <martin@gnome.org>
7903 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
7904 MemberCache from typemanager.cs to decl.cs.
7906 2002-08-19 Martin Baulig <martin@gnome.org>
7908 * class.cs (TypeContainer): Implement IMemberContainer.
7909 (TypeContainer.DefineMembers): Create the MemberCache.
7910 (TypeContainer.FindMembers): Do better BindingFlags checking; only
7911 return public members if BindingFlags.Public was given, check
7912 whether members are static.
7914 2002-08-16 Martin Baulig <martin@gnome.org>
7916 * decl.cs (DeclSpace.Define): Splitted this in Define and
7917 DefineMembers. DefineMembers is called first and initializes the
7920 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
7921 DefineMembers() on all our DeclSpaces.
7923 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
7924 but call DefineMembers() on all nested interfaces. We call their
7925 Define() in our new Define() function.
7927 * interface.cs (Interface): Implement IMemberContainer.
7928 (Interface.Define): Moved all code except the attribute stuf to
7930 (Interface.DefineMembers): Initialize the member cache.
7932 * typemanager.cs (IMemberFinder): Removed this interface, we don't
7933 need this anymore since we can use MemberCache.FindMembers directly.
7935 2002-08-19 Martin Baulig <martin@gnome.org>
7937 * typemanager.cs (MemberCache): When creating the cache for an
7938 interface type, add all inherited members.
7939 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
7940 to `out bool used_cache' and documented it.
7941 (TypeManager.MemberLookup): If we already used the cache in the first
7942 iteration, we don't need to do the interfaces check.
7944 2002-08-19 Martin Baulig <martin@gnome.org>
7946 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
7947 here from IMemberFinder and don't implement this interface anymore.
7948 (DeclSpace.MemberCache): Moved here from IMemberFinder.
7950 * typemanager.cs (IMemberFinder): This interface is now only used by
7951 classes which actually support the member cache.
7952 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
7953 since we only put DeclSpaces into this Hashtable.
7954 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
7955 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
7957 2002-08-16 Martin Baulig <martin@gnome.org>
7959 * typemanager.cs (ICachingMemberFinder): Removed.
7960 (IMemberFinder.MemberCache): New property.
7961 (TypeManager.FindMembers): Merged this with RealFindMembers().
7962 This function will never be called from TypeManager.MemberLookup()
7963 so we can't use the cache here, just the IMemberFinder.
7964 (TypeManager.MemberLookup_FindMembers): Check whether the
7965 IMemberFinder has a MemberCache and call the cache's FindMembers
7967 (MemberCache): Rewrote larger parts of this yet another time and
7968 cleaned it up a bit.
7970 2002-08-15 Miguel de Icaza <miguel@ximian.com>
7972 * driver.cs (LoadArgs): Support quoting.
7974 (Usage): Show the CSC-like command line arguments.
7976 Improved a few error messages.
7978 2002-08-15 Martin Baulig <martin@gnome.org>
7980 * typemanager.cs (IMemberContainer.Type): New property.
7981 (IMemberContainer.IsInterface): New property.
7983 The following changes are conditional to BROKEN_RUNTIME, which is
7984 defined at the top of the file.
7986 * typemanager.cs (MemberCache.MemberCache): Don't add the base
7987 class'es members, but add all members from TypeHandle.ObjectType
7988 if we're an interface.
7989 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
7990 is the current type.
7991 (MemberCache.CacheEntry.Container): Removed this field.
7992 (TypeHandle.GetMembers): Include inherited members.
7994 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7996 * typemanager.cs: fixed compilation and added a comment on a field that
7999 2002-08-15 Martin Baulig <martin@gnome.org>
8001 * class.cs (ConstructorInitializer.Resolve): In the
8002 Expression.MemberLookup call, use the queried_type as
8005 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
8006 declared' attribute, it's always true.
8007 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
8008 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
8009 temporary wrapper for FindMembers which tells MemberLookup whether
8010 members from the base classes are included in the return value.
8011 This will go away soon.
8012 (TypeManager.MemberLookup): Use this temporary hack here; once the
8013 new MemberCache is completed, we don't need to do the DeclaredOnly
8014 looping here anymore since the MemberCache will take care of this.
8015 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
8016 (MemberCache): When creating the MemberCache for a class, get
8017 members from the current class and all its base classes.
8018 (MemberCache.CacheEntry.Container): New field. This is a
8019 temporary hack until the Mono runtime is fixed to distinguish
8020 between ReflectedType and DeclaringType. It allows us to use MCS
8021 with both the MS runtime and the unfixed Mono runtime without
8022 problems and without accecting performance.
8023 (MemberCache.SearchMembers): The DeclaredOnly looping from
8024 TypeManager.MemberLookup is now done here.
8026 2002-08-14 Martin Baulig <martin@gnome.org>
8028 * statement.cs (MyStructInfo.MyStructInfo): Don't call
8029 Type.GetFields on dynamic types but get the fields from the
8030 corresponding TypeContainer.
8031 (MyStructInfo.GetStructInfo): Added check for enum types.
8033 * typemanager.cs (MemberList.IsSynchronized): Implemented.
8034 (MemberList.SyncRoot): Implemented.
8035 (TypeManager.FilterWithClosure): No need to check permissions if
8036 closure_start_type == closure_invocation_type, don't crash if
8037 closure_invocation_type is null.
8039 2002-08-13 Martin Baulig <martin@gnome.org>
8041 Rewrote TypeContainer.FindMembers to use a member cache. This
8042 gives us a speed increase of about 35% for the self-hosting MCS
8043 build and of about 15-20% for the class libs (both on GNU/Linux).
8045 * report.cs (Timer): New class to get enhanced profiling. This
8046 whole class is "TIMER" conditional since it remarkably slows down
8049 * class.cs (MemberList): New class. This is an IList wrapper
8050 which we're now using instead of passing MemberInfo[]'s around to
8051 avoid copying this array unnecessarily.
8052 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
8053 (ICachingMemberFinder, IMemberContainer): New interface.
8054 (TypeManager.FilterWithClosure): If `criteria' is null, the name
8055 has already been checked, otherwise use it for the name comparision.
8056 (TypeManager.FindMembers): Renamed to RealMemberFinder and
8057 provided wrapper which tries to use ICachingMemberFinder.FindMembers
8058 if possible. Returns a MemberList, not a MemberInfo [].
8059 (TypeHandle): New class, implements IMemberContainer. We create
8060 one instance of this class per type, it contains a MemberCache
8061 which is used to do the member lookups.
8062 (MemberCache): New class. Each instance of this class contains
8063 all members of a type and a name-based hash table.
8064 (MemberCache.FindMembers): This is our new member lookup
8065 function. First, it looks up all members of the requested name in
8066 the hash table. Then, it walks this list and sorts out all
8067 applicable members and returns them.
8069 2002-08-13 Martin Baulig <martin@gnome.org>
8071 In addition to a nice code cleanup, this gives us a performance
8072 increase of about 1.4% on GNU/Linux - not much, but it's already
8073 half a second for the self-hosting MCS compilation.
8075 * typemanager.cs (IMemberFinder): New interface. It is used by
8076 TypeManager.FindMembers to call FindMembers on a TypeContainer,
8077 Enum, Delegate or Interface.
8078 (TypeManager.finder_to_member_finder): New PtrHashtable.
8079 (TypeManager.finder_to_container): Removed.
8080 (TypeManager.finder_to_delegate): Removed.
8081 (TypeManager.finder_to_interface): Removed.
8082 (TypeManager.finder_to_enum): Removed.
8084 * interface.cs (Interface): Implement IMemberFinder.
8086 * delegate.cs (Delegate): Implement IMemberFinder.
8088 * enum.cs (Enum): Implement IMemberFinder.
8090 * class.cs (TypeContainer): Implement IMemberFinder.
8092 2002-08-12 Martin Baulig <martin@gnome.org>
8094 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
8096 2002-08-12 Martin Baulig <martin@gnome.org>
8098 * ecore.cs (ITypeExpression): New interface for expressions which
8100 (TypeExpression): Renamed to TypeLookupExpression.
8101 (Expression.DoResolve): If we're doing a types-only lookup, the
8102 expression must implement the ITypeExpression interface and we
8103 call DoResolveType() on it.
8104 (SimpleName): Implement the new ITypeExpression interface.
8105 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
8106 hack, the situation that we're only looking up types can't happen
8107 anymore when this method is called. Moved the type lookup code to
8108 DoResolveType() and call it.
8109 (SimpleName.DoResolveType): This ITypeExpression interface method
8110 is now doing the types-only lookup.
8111 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
8112 (ResolveFlags): Added MaskExprClass.
8114 * expression.cs (MemberAccess): Implement the ITypeExpression
8116 (MemberAccess.DoResolve): Added support for a types-only lookup
8117 when we're called via ITypeExpression.DoResolveType().
8118 (ComposedCast): Implement the ITypeExpression interface.
8120 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
8121 Expression.Resolve() with ResolveFlags.Type instead.
8123 2002-08-12 Martin Baulig <martin@gnome.org>
8125 * interface.cs (Interface.Define): Apply attributes.
8127 * attribute.cs (Attribute.ApplyAttributes): Added support for
8128 interface attributes.
8130 2002-08-11 Martin Baulig <martin@gnome.org>
8132 * statement.cs (Block.Emit): Only check the "this" variable if we
8133 do not always throw an exception.
8135 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
8136 whether the property has a set accessor.
8138 2002-08-11 Martin Baulig <martin@gnome.org>
8140 Added control flow analysis support for structs.
8142 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
8143 with control flow analysis turned off.
8144 (IVariable): New interface.
8145 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
8146 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
8147 (FieldExpr.DoResolve): Resolve the instance expression with flow
8148 analysis turned off and do the definite assignment check after the
8149 resolving when we know what the expression will resolve to.
8151 * expression.cs (LocalVariableReference, ParameterReference):
8152 Implement the new IVariable interface, only call the flow analysis
8153 code if ec.DoFlowAnalysis is true.
8154 (This): Added constructor which takes a Block argument. Implement
8155 the new IVariable interface.
8156 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
8157 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
8158 This does the definite assignment checks for struct members.
8160 * class.cs (Constructor.Emit): If this is a non-static `struct'
8161 constructor which doesn't have any initializer, call
8162 Block.AddThisVariable() to tell the flow analysis code that all
8163 struct elements must be initialized before control returns from
8166 * statement.cs (MyStructInfo): New public class.
8167 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
8168 argument to this indexer. If non-zero, check an individual struct
8169 member, not the whole struct.
8170 (FlowBranching.CheckOutParameters): Check struct members.
8171 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
8172 overloaded versions of these methods which take an additional
8173 `int field_idx' argument to check struct members.
8174 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
8175 overloaded versions of these methods which take an additional
8176 `string field_name' argument to check struct member.s
8177 (VariableInfo): Implement the IVariable interface.
8178 (VariableInfo.StructInfo): New public property. Returns the
8179 MyStructInfo instance of the variable if it's a struct or null.
8180 (Block.AddThisVariable): New public method. This is called from
8181 Constructor.Emit() for non-static `struct' constructor which do
8182 not have any initializer. It creates a special variable for the
8183 "this" instance variable which will be checked by the flow
8184 analysis code to ensure that all of the struct's fields are
8185 initialized before control returns from the constructor.
8186 (UsageVector): Added support for struct members. If a
8187 variable/parameter is a struct with N members, we reserve a slot
8188 in the usage vector for each member. A struct is considered fully
8189 initialized if either the struct itself (slot 0) or all its
8190 members are initialized.
8192 2002-08-08 Martin Baulig <martin@gnome.org>
8194 * driver.cs (Driver.MainDriver): Only report an error CS5001
8195 if there were no compilation errors.
8197 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
8198 `UnsafeContext' property to determine whether the parent is in
8199 unsafe context rather than checking the parent's ModFlags:
8200 classes nested in an unsafe class are unsafe as well.
8202 2002-08-08 Martin Baulig <martin@gnome.org>
8204 * statement.cs (UsageVector.MergeChildren): Distinguish between
8205 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
8206 we return. Added test17() and test18() to test-154.cs.
8208 2002-08-08 Martin Baulig <martin@gnome.org>
8210 * typemanager.cs (TypeManager.FilterWithClosure): If we have
8211 Family access, make sure the invoking type isn't a subclass of the
8212 queried type (that'd be a CS1540).
8214 * ecore.cs (Expression.MemberLookup): Added overloaded version of
8215 this method which takes an additional `Type invocation_type'.
8217 * expression.cs (BaseAccess.DoResolve): Use the base type as
8218 invocation and query type.
8219 (MemberAccess.DoResolve): If the lookup failed and we're about to
8220 report a CS0122, try a lookup with the ec.ContainerType - if this
8221 succeeds, we must report a CS1540.
8223 2002-08-08 Martin Baulig <martin@gnome.org>
8225 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
8226 (MethodGroupExpr): Implement the IMemberExpr interface.
8228 * expression (MemberAccess.ResolveMemberAccess): No need to have
8229 any special code for MethodGroupExprs anymore, they're now
8232 2002-08-08 Martin Baulig <martin@gnome.org>
8234 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
8235 Family, FamANDAssem and FamORAssem permissions.
8236 (TypeManager.IsSubclassOrNestedChildOf): New public method.
8238 2002-08-08 Martin Baulig <martin@gnome.org>
8240 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
8241 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
8244 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
8246 * driver.cs: implemented /resource option to embed managed resources.
8248 2002-08-07 Martin Baulig <martin@gnome.org>
8250 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
8251 (FieldBase.HasFieldInitializer): New public property.
8252 (FieldBase.GetInitializerExpression): New public method. Resolves and
8253 returns the field initializer and makes sure it is only resolved once.
8254 (TypeContainer.EmitFieldInitializers): Call
8255 FieldBase.GetInitializerExpression to get the initializer, this ensures
8256 that it isn't resolved multiple times.
8258 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
8259 the resolving process (SimpleName/MemberLookup) that we're currently
8260 emitting a field initializer (which must not access any instance members,
8261 this is an error CS0236).
8263 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
8264 argument, if the `IsFieldInitializer' flag is set, we must report and
8265 error CS0236 and not an error CS0120.
8267 2002-08-07 Martin Baulig <martin@gnome.org>
8269 * ecore.cs (IMemberExpr): New public interface.
8270 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
8271 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
8272 if the expression is an IMemberExpr.
8274 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
8275 to be null, implicitly default to `this' if we're non-static in
8276 this case. Simplified the code a lot by using the new IMemberExpr
8277 interface. Also fixed bug #28176 here.
8279 2002-08-06 Martin Baulig <martin@gnome.org>
8281 * cs-parser.jay (SimpleLookup): Removed. We need to create
8282 ParameterReferences during semantic analysis so that we can do a
8283 type-only search when resolving Cast, TypeOf and SizeOf.
8284 (block): Pass the `current_local_parameters' to the Block's
8287 * class.cs (ConstructorInitializer): Added `Parameters parameters'
8288 argument to the constructor.
8289 (ConstructorInitializer.Resolve): Create a temporary implicit
8290 block with the parameters.
8292 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
8293 references here if we aren't doing a type-only search.
8295 * statement.cs (Block): Added constructor which takes a
8296 `Parameters parameters' argument.
8297 (Block.Parameters): New public property.
8299 * support.cs (InternalParameters.Parameters): Renamed `parameters'
8300 to `Parameters' and made it public readonly.
8302 2002-08-06 Martin Baulig <martin@gnome.org>
8304 * ecore.cs (Expression.Warning): Made this public as well.
8306 * report.cs (Report.Debug): Print the contents of collections.
8308 2002-08-06 Martin Baulig <martin@gnome.org>
8310 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
8311 used to tell Resolve() which kinds of expressions it may return.
8312 (Expression.Resolve): Added overloaded version of this method which
8313 takes a `ResolveFlags flags' argument. This can be used to tell
8314 Resolve() which kinds of expressions it may return. Reports a
8316 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
8317 ResolveFlags.SimpleName.
8318 (Expression.Error118): Added overloaded version of this method which
8319 takes a `ResolveFlags flags' argument. It uses the flags to determine
8320 which kinds of expressions are allowed.
8322 * expression.cs (Argument.ResolveMethodGroup): New public method.
8323 Resolves an argument, but allows a MethodGroup to be returned.
8324 This is used when invoking a delegate.
8326 * TODO: Updated a bit.
8328 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8330 Fixed compilation with csc.
8332 * ecore.cs: Expression.Error made public. Is this correct? Should
8333 Warning be made public too?
8335 * expression.cs: use ea.Location instead of ea.loc.
8336 [FIXME: Filed as bug #28607: MCS must report these errors.]
8338 2002-08-06 Martin Baulig <martin@gnome.org>
8340 * ecore.cs (Expression.loc): Moved the location here instead of
8341 duplicating it in all derived classes.
8342 (Expression.Location): New public property.
8343 (Expression.Error, Expression.Warning): Made them non-static and
8344 removed the location argument.
8345 (Expression.Warning): Added overloaded version which takes an
8346 `int level' argument.
8347 (Expression.Error118): Make this non-static and removed the
8348 expression and location arguments.
8349 (TypeExpr): Added location argument to the constructor.
8351 * expression.cs (StaticCallExpr): Added location argument to
8353 (Indirection, PointerArithmetic): Likewise.
8354 (CheckedExpr, UnCheckedExpr): Likewise.
8355 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
8356 (StringPtr): Likewise.
8359 2002-08-05 Martin Baulig <martin@gnome.org>
8361 * expression.cs (BaseAccess.DoResolve): Actually report errors.
8363 * assign.cs (Assign.DoResolve): Check whether the source
8364 expression is a value or variable.
8366 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
8367 while resolving the corresponding blocks.
8369 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
8370 an error, don't silently return null.
8372 * statement.cs (Block.AddVariable): Do the error reporting here
8373 and distinguish between CS0128 and CS0136.
8374 (Block.DoResolve): Report all unused labels (warning CS0164).
8375 (LabeledStatement): Pass the location to the constructor.
8376 (LabeledStatement.HasBeenReferenced): New property.
8377 (LabeledStatement.Resolve): Set it to true here.
8379 * statement.cs (Return.Emit): Return success even after reporting
8380 a type mismatch error (CS0126 or CS0127), this is what csc does and
8381 it avoids confusing the users with any consecutive errors.
8383 2002-08-05 Martin Baulig <martin@gnome.org>
8385 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
8387 * const.cs (Const.LookupConstantValue): Catch circular definitions.
8389 * expression.cs (MemberAccess.DoResolve): Silently return if an
8390 error has already been reported.
8392 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
8393 error has already been reported.
8395 2002-08-05 Martin Baulig <martin@gnome.org>
8397 * statement.cs (UsageVector): Only initialize the `parameters'
8398 vector if we actually have any "out" parameters.
8400 2002-08-05 Martin Baulig <martin@gnome.org>
8402 * expression.cs (Binary.ResolveOperator): When combining delegates,
8403 they must have the same type.
8405 2002-08-05 Martin Baulig <martin@gnome.org>
8407 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
8408 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
8409 work with the ms runtime and we also don't need it: if we're a
8410 PropertyBuilder and not in the `indexer_arguments' hash, then we
8411 are a property and not an indexer.
8413 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
8414 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
8415 since the latter one doesn't work with the ms runtime.
8417 2002-08-03 Martin Baulig <martin@gnome.org>
8419 Fixed bugs #27998 and #22735.
8421 * class.cs (Method.IsOperator): New public field.
8422 (Method.CheckBase): Report CS0111 if there's already a method
8423 with the same parameters in the current class. Report CS0508 when
8424 attempting to change the return type of an inherited method.
8425 (MethodData.Emit): Report CS0179 if a method doesn't have a body
8426 and it's not marked abstract or extern.
8427 (PropertyBase): New abstract base class for Property and Indexer.
8428 (PropertyBase.CheckBase): Moved here from Property and made it work
8430 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
8431 the same so we can reuse it there.
8432 (Property, Indexer): Derive from PropertyBase.
8433 (MethodSignature.inheritable_property_signature_filter): New delegate
8434 to find properties and indexers.
8436 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
8437 argument and improved error reporting.
8439 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
8440 EmptyReadOnlyParameters and made it a property.
8442 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
8443 version of this method which takes a `PropertyInfo indexer'.
8444 (TypeManager.RegisterIndexer): New method.
8446 * class.cs: Added myself as author of this file :-)
8448 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8450 * class.cs: fixed compilation on windoze.
8452 2002-08-03 Martin Baulig <martin@gnome.org>
8454 * interface.cs (Interface.GetInterfaceBases): Check whether all
8455 base interfaces are at least as accessible than the current one.
8457 * class.cs (TypeContainer.GetClassBases): Check whether base types
8458 are at least as accessible than the current type.
8459 (TypeContainer.AsAccessible): Implemented and made non-static.
8460 (MemberBase.CheckParameters): Report errors if the accessibility
8463 * delegate.cs (Delegate.Delegate): The default visibility is
8464 internal for top-level types and private for nested types.
8465 (Delegate.Define): Report errors if the accessibility checks fail.
8467 * enum.cs (Enum.Enum): The default visibility is internal for
8468 top-level types and private for nested types.
8469 (Enum.DefineType): Compute the correct visibility.
8471 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
8472 function which takes a `bool is_toplevel' instead of a TypeContainer.
8474 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
8477 2002-08-02 Martin Baulig <martin@gnome.org>
8479 * expression.cs (LocalVariableReferenc): Added constructor which
8480 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
8481 (LocalVariableReference.IsReadOnly): New property.
8482 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
8483 variable is readonly, use our own readonly flag to do this; you can
8484 use the new constructor to get a writable reference to a read-only
8487 * cs-parser.jay (foreach_statement, using_statement): Get a writable
8488 reference to the local variable.
8490 2002-08-01 Miguel de Icaza <miguel@ximian.com>
8492 * rootcontext.cs (ResolveCore): Also include System.Exception
8494 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
8495 we reach an EmptyStatement.
8497 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
8500 * expression.cs (Binary.ResolveOperator): Check error result in
8503 use brtrue/brfalse directly and avoid compares to null.
8505 2002-08-02 Martin Baulig <martin@gnome.org>
8507 * class.cs (TypeContainer.Define): Define all nested interfaces here.
8508 Fixes bug #28407, added test-155.cs.
8510 2002-08-01 Martin Baulig <martin@gnome.org>
8512 * class.cs (Event.EmitDefaultMethod): Make this work with static
8513 events. Fixes #28311, added verify-3.cs.
8515 2002-08-01 Martin Baulig <martin@gnome.org>
8517 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
8518 `is_disposable' fields.
8519 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
8520 `hm.is_disposable' if we're using the collection pattern.
8521 (Foreach.EmitCollectionForeach): Use the correct type for the
8522 enumerator's local variable, only emit the try/finally block if
8523 necessary (fixes #27713).
8525 2002-08-01 Martin Baulig <martin@gnome.org>
8527 * ecore.cs (Expression.report118): Renamed to Error118 and made
8530 * statement.cs (Throw.Resolve): Check whether the expression is of
8531 the correct type (CS0118) and whether the type derives from
8532 System.Exception (CS0155).
8533 (Catch.Resolve): New method. Do the type lookup here and check
8534 whether it derives from System.Exception (CS0155).
8535 (Catch.CatchType, Catch.IsGeneral): New public properties.
8537 * typemanager.cs (TypeManager.exception_type): Added.
8539 2002-07-31 Miguel de Icaza <miguel@ximian.com>
8541 * driver.cs: Updated About function.
8543 2002-07-31 Martin Baulig <martin@gnome.org>
8545 Implemented Control Flow Analysis.
8547 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
8548 (EmitContext.CurrentBranching): Added.
8549 (EmitContext.StartFlowBranching): Added.
8550 (EmitContext.EndFlowBranching): Added.
8551 (EmitContext.KillFlowBranching): Added.
8552 (EmitContext.IsVariableAssigned): Added.
8553 (EmitContext.SetVariableAssigned): Added.
8554 (EmitContext.IsParameterAssigned): Added.
8555 (EmitContext.SetParameterAssigned): Added.
8556 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
8557 Added control flow analysis stuff here.
8559 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
8560 resolve the expression as lvalue.
8561 (LocalVariableReference.DoResolve): Check whether the variable has
8562 already been assigned.
8563 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
8564 the parameter as assigned here.
8565 (ParameterReference.DoResolve): Check whether the parameter has already
8567 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
8568 expression as lvalue.
8570 * statement.cs (FlowBranching): New class for the flow analysis code.
8571 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
8572 (LabeledStatement.IsDefined): New public property.
8573 (LabeledStatement.AddUsageVector): New public method to tell flow
8574 analyis that the label may be reached via a forward jump.
8575 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
8577 (VariableInfo.Number): New public field. This is used by flow analysis
8578 to number all locals of a block.
8579 (Block.CountVariables): New public property. This is the number of
8580 local variables in this block (including the locals from all parent
8582 (Block.EmitMeta): Number all the variables.
8584 * statement.cs: Added flow analysis support to all classes.
8586 2002-07-31 Martin Baulig <martin@gnome.org>
8588 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
8589 To get debugging messages, compile mcs with /define:MCS_DEBUG and
8590 then use this argument.
8592 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
8594 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
8595 use this to specify /define options.
8597 2002-07-29 Martin Baulig <martin@gnome.org>
8599 * statement.cs (Fixed): Moved all code that does variable lookups
8600 and resolvings from Emit to Resolve.
8602 * statement.cs (For): Moved all code that does variable lookups
8603 and resolvings from Emit to Resolve.
8605 * statement.cs (Using): Moved all code that does variable lookups
8606 and resolvings from Emit to Resolve.
8608 2002-07-29 Martin Baulig <martin@gnome.org>
8610 * attribute.cs (Attribute.Resolve): Explicitly catch a
8611 System.NullReferenceException when creating the
8612 CustromAttributeBuilder and report a different warning message.
8614 2002-07-29 Martin Baulig <martin@gnome.org>
8616 * support.cs (ParameterData.ParameterName): Added method to
8617 get the name of a parameter.
8619 * typemanager.cs (TypeManager.IsValueType): New public method.
8621 2002-07-29 Martin Baulig <martin@gnome.org>
8623 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
8624 is a flag which specifies that it's either ref or out.
8625 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
8626 the out parameter to `out Parameter.Modifier mod', also set the
8627 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
8629 * support.cs (InternalParameters.ParameterModifier): Distinguish
8630 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8631 Parameter.Modifier.ISBYREF flag if it's either ref or out.
8633 * expression.cs (Argument.GetParameterModifier): Distinguish
8634 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8635 Parameter.Modifier.ISBYREF flag if it's either ref or out.
8637 2002-07-29 Martin Baulig <martin@gnome.org>
8639 * expression.cs (ParameterReference.ParameterReference): Added
8640 `Location loc' argument to the constructor.
8642 * cs-parser.jay: Pass location to ParameterReference.
8644 2002-07-28 Miguel de Icaza <miguel@ximian.com>
8646 * statement.cs (Try): Initialize the location.
8648 * cs-parser.jay: pass location to Try.
8650 * expression.cs (Unary.Reduce): Change the prototype to return
8651 whether a constant fold could be performed or not. The result is
8652 returned in an out parameters. In the case of Indirection and
8653 AddressOf, we want to perform the full tests.
8655 2002-07-26 Miguel de Icaza <miguel@ximian.com>
8657 * statement.cs (Statement.Emit): Flag dead code.
8659 2002-07-27 Andrew Birkett <andy@nobugs.org>
8661 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
8663 2002-07-27 Martin Baulig <martin@gnome.org>
8665 * class.cs (MethodData.Define): Put back call to
8666 TypeManager.AddMethod(), accidentally commented this out.
8668 * report.cs (Debug): New public method to print debugging information,
8669 this is `[Conditional ("DEBUG")]'.
8671 2002-07-26 Martin Baulig <martin@gnome.org>
8673 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
8674 (switch_statement): Push the current_block to the switch_stack and
8675 pop it again when we're done with the switch.
8676 (switch_section): The new block is a child of the current_block.
8677 Fixes bug #24007, added test-152.cs.
8679 2002-07-27 Martin Baulig <martin@gnome.org>
8681 * expression.cs (Invocation.EmitArguments): When calling a varargs
8682 function with only its fixed arguments, we need to pass an empty
8685 2002-07-27 Martin Baulig <martin@gnome.org>
8687 Mono 0.13 has been released.
8689 2002-07-25 Miguel de Icaza <miguel@ximian.com>
8691 * driver.cs: Rename --resource to --linkres, because that is what
8692 we do currently, we dont support --resource yet.
8694 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
8696 2002-07-25 Martin Baulig <martin@gnome.org>
8698 * class.cs (MethodData): New public class. This is a `method builder'
8699 class for a method or one accessor of a Property/Indexer/Event.
8700 (MethodData.GetMethodFlags): Moved here from MemberBase.
8701 (MethodData.ApplyAttributes): Likewise.
8702 (MethodData.ApplyObsoleteAttribute): Likewise.
8703 (MethodData.ApplyConditionalAttribute): Likewise.
8704 (MethodData.ApplyDllImportAttribute): Likewise.
8705 (MethodData.CheckAbstractAndExternal): Likewise.
8706 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
8707 (MethodData.Emit): Formerly known as Method.Emit().
8708 (MemberBase): Moved everything which was specific to a single
8709 accessor/method to MethodData.
8710 (Method): Create a new MethodData and call Define() and Emit() on it.
8711 (Property, Indexer, Event): Create a new MethodData objects for each
8712 accessor and call Define() and Emit() on them.
8714 2002-07-25 Martin Baulig <martin@gnome.org>
8716 Made MethodCore derive from MemberBase to reuse the code from there.
8717 MemberBase now also checks for attributes.
8719 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
8720 (MemberBase.GetMethodFlags): Moved here from class Method and marked
8722 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
8723 `CallingConventions cc' and `Attributes opt_attrs' arguments.
8724 (MemberBase.ApplyAttributes): New virtual method; applies the
8725 attributes to a method or accessor.
8726 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
8727 (MemberBase.ApplyConditionalAttribute): Likewise.
8728 (MemberBase.ApplyDllImportAttribute): Likewise.
8729 (MemberBase.CheckAbstractAndExternal): Likewise.
8730 (MethodCore.ParameterTypes): This is now a property instead of a
8731 method, it's initialized from DoDefineParameters().
8732 (MethodCore.ParameterInfo): Removed the set accessor.
8733 (MethodCore.DoDefineParameters): New protected virtual method to
8734 initialize ParameterTypes and ParameterInfo.
8735 (Method.GetReturnType): We can now simply return the MemberType.
8736 (Method.GetMethodFlags): Override the MemberBase version and add
8737 the conditional flags.
8738 (Method.CheckBase): Moved some code from Define() here, call
8739 DoDefineParameters() here.
8740 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
8741 here to avoid some larger code duplication.
8742 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
8743 ensure that abstract and external accessors don't declare a body.
8745 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
8746 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
8747 lookup in the attribute's parent classes, so we need to abort as soon
8748 as we found the first match.
8749 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
8750 the attribute has no arguments.
8752 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
8755 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8757 * cs-parser.jay: reverted previous patch.
8759 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8761 * cs-parser.jay: fixed bug #22119.
8763 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8765 * attribute.cs: fixed compilation. The error was:
8766 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
8767 be assigned to before control leaves the current method."
8768 [FIXME: Filed as bug #28186: MCS must report this error.]
8770 2002-07-25 Martin Baulig <martin@gnome.org>
8772 * attribute.cs (Attribute.Conditional_GetConditionName): New static
8773 method to pull the condition name ouf of a Conditional attribute.
8774 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
8775 the obsolete message and error flag out of an Obsolete attribute.
8777 * class.cs (Method.GetMethodFlags): New public method to get the
8778 TypeManager.MethodFlags for this method.
8779 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
8781 (Method.Define): Get and apply the Obsolete and Conditional attributes;
8782 if we're overriding a virtual function, set the new private variable
8783 `parent_method'; call the new TypeManager.AddMethod().
8785 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
8786 the MethodBuilder and the Method in a PtrHashtable.
8787 (TypeManager.builder_to_method): Added for this purpose.
8788 (TypeManager.MethodFlags): Added IsObsoleteError.
8789 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
8790 Obsolete and Conditional arguments in MethodBuilders. If we discover
8791 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
8792 the message from the attribute.
8794 2002-07-24 Martin Baulig <martin@gnome.org>
8796 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
8797 preprocessor directives, ensure that the argument to #define/#undef is
8798 exactly one identifier and that it's actually an identifier.
8800 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
8803 2002-07-24 Martin Baulig <martin@gnome.org>
8805 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
8806 initialize it to TypeManager.object_type in the constructor.
8807 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
8808 of the `hm.get_current' method if we're using the collection pattern.
8809 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
8810 for the explicit conversion to make it work when we're using the collection
8811 pattern and the `Current' property has a different return type than `object'.
8814 2002-07-24 Martin Baulig <martin@gnome.org>
8816 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
8817 does not match, but don't report any errors. This method is called in
8818 order for all methods in a MethodGroupExpr until a matching method is
8819 found, so we don't want to bail out if the first method doesn't match.
8820 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
8821 matches, report the 123. Fixes #28070.
8823 2002-07-24 Martin Baulig <martin@gnome.org>
8825 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
8826 TypeManager.TypeToCoreType() to the top of the method so the
8827 following equality checks will work. Fixes #28107.
8829 2002-07-24 Martin Baulig <martin@gnome.org>
8831 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
8832 operand is of type uint, and the other operand is of type sbyte,
8833 short or int, the operands are converted to type long." -
8834 Actually do what this comment already told us. Fixes bug #28106,
8837 2002-07-24 Martin Baulig <martin@gnome.org>
8839 * class.cs (MethodBase): New abstract class. This is now a base
8840 class for Property, Indexer and Event to avoid some code duplication
8841 in their Define() and DefineMethods() methods.
8842 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
8843 generic methods for Define() and DefineMethods().
8844 (FieldBase): Derive from MemberBase, not MemberCore.
8845 (Property): Derive from MemberBase, not MemberCore.
8846 (Property.DefineMethod): Moved all the code from this method to the
8847 new MethodBase.DefineAccessor(), just call it with appropriate
8849 (Property.Define): Call the new Property.DoDefine(), this does some
8850 sanity checks and we don't need to duplicate the code everywhere.
8851 (Event): Derive from MemberBase, not MemberCore.
8852 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
8853 accessors, this will also make them work with interface events.
8854 (Indexer): Derive from MemberBase, not MemberCore.
8855 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
8856 (Indexer.Define): Use the new MethodBase functions.
8858 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
8859 argument to the constructor.
8860 (Interface.FindMembers): Added support for interface events.
8861 (Interface.PopluateEvent): Implemented.
8863 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
8865 2002-07-22 Miguel de Icaza <miguel@ximian.com>
8867 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
8868 but this is required to check for a method name being the same as
8869 the containing class.
8873 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8875 * interface.cs: initialize variable.
8877 2002-07-23 Martin Baulig <martin@gnome.org>
8879 Implemented the IndexerName attribute in interfaces.
8881 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
8882 name if this is an explicit interface implementation.
8883 (Indexer.InterfaceIndexerName): New public variable. If we're
8884 implementing an interface indexer, this is the IndexerName in that
8885 interface. Otherwise, it's the IndexerName.
8886 (Indexer.DefineMethod): If we're implementing interface indexer,
8887 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
8888 and Pending.ImplementIndexer methods.
8889 (Indexer.Define): Also define the PropertyBuilder if we're
8890 implementing an interface indexer and this is neither an explicit
8891 interface implementation nor do the IndexerName match the one in
8894 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
8895 If a method is defined here, then we always need to create a proxy
8896 for it. This is used when implementing interface indexers.
8897 (Pending.IsInterfaceIndexer): New public method.
8898 (Pending.ImplementIndexer): New public method.
8899 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
8900 This is used when implementing interface indexers to define a proxy
8902 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
8903 define a proxy if necessary.
8905 * interface.cs (Interface.IndexerName): New public variable.
8906 (Interface.PopulateIndexer): Set the IndexerName.
8907 (Interface.DefineIndexers): New private method. Populate all the
8908 indexers and make sure their IndexerNames match.
8910 * typemanager.cs (IndexerPropertyName): Added support for interface
8913 2002-07-22 Martin Baulig <martin@gnome.org>
8915 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
8916 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
8917 ret if HasReturnLabel.
8918 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
8921 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
8922 and set the ec.LoopBeginTryCatchLevel.
8923 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
8924 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
8925 the current ec.TryCatchLevel, the branch goes out of an exception
8926 block. In this case, we need to use Leave and not Br.
8928 2002-07-22 Martin Baulig <martin@gnome.org>
8930 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
8931 block unless the block does not always return or it is contained in
8932 another try { ... } catch { ... } block. Fixes bug #26506.
8933 Added verify-1.cs to the test suite.
8935 2002-07-22 Martin Baulig <martin@gnome.org>
8937 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
8938 then we do not always return. Fixes bug #24985.
8940 2002-07-22 Martin Baulig <martin@gnome.org>
8942 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
8943 lookup on a per-class level; ie. walk up the class hierarchy until we
8944 found at least one applicable method, then choose the best among them.
8945 Fixes bug #24463 and test-29.cs.
8947 2002-07-22 Martin Baulig <martin@gnome.org>
8949 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
8950 return types of the methods. The return type is not part of the
8951 signature and we must not check it to make the `new' modifier work.
8952 Fixes bug #27999, also added test-147.cs.
8953 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
8955 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
8956 on the method's return type.
8958 2002-07-21 Martin Baulig <martin@gnome.org>
8960 * assign.cs: Make this work if the rightmost source is a constant and
8961 we need to do an implicit type conversion. Also adding a few more tests
8962 to test-38.cs which should have caught this.
8964 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
8965 target in the makefile for this. The makefile.gnu is primarily intended
8966 for end-users who don't want to debug the compiler.
8968 2002-07-21 Martin Baulig <martin@gnome.org>
8970 * assign.cs: Improved the Assign class so it can now handle embedded
8971 assignments (X = Y = Z = something). As a side-effect this'll now also
8972 consume less local variables. test-38.cs now passes with MCS, added
8973 a few new test cases to that test.
8975 2002-07-20 Martin Baulig <martin@gnome.org>
8977 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
8978 instructions. Fixes bug #27977, also added test-146.cs.
8980 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8982 * cs-tokenizer.cs: fixed getHex ().
8984 2002-07-19 Martin Baulig <martin@gnome.org>
8986 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
8987 not Type.GetType() to lookup the array type. This is needed when
8988 we're constructing an array of a user-defined type.
8989 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
8990 single-dimensional arrays, but also for single-dimensial arrays of
8993 2002-07-19 Martin Baulig <martin@gnome.org>
8995 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
8996 this function is called, it's not allowed to share LocalBuilders
8999 2002-07-19 Martin Baulig <martin@gnome.org>
9001 * expression.cs (Argument.Resolve): Report an error 118 when trying
9002 to pass a type as argument.
9004 2002-07-18 Martin Baulig <martin@gnome.org>
9006 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
9007 Conv_R_Un for the signed `long' type.
9009 2002-07-15 Miguel de Icaza <miguel@ximian.com>
9011 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
9012 `expr' for the temporary result, as that will fail if we do
9013 multiple resolves on the same expression.
9015 2002-07-05 Miguel de Icaza <miguel@ximian.com>
9017 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
9018 ec.TypeContainer for looking up aliases.
9020 * class.cs (TypeContainer): Remove LookupAlias from here.
9022 * decl.cs (DeclSpace); Move here.
9024 2002-07-01 Miguel de Icaza <miguel@ximian.com>
9026 * class.cs (FindMembers): Only call filter if the constructor
9027 bulider is not null.
9029 Also handle delegates in `NestedTypes' now. Now we will perform
9030 type lookups using the standard resolution process. This also
9033 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
9034 This uses Expressions (the limited kind that can be parsed by the
9035 tree) instead of strings.
9037 * expression.cs (ComposedCast.ToString): Implement, used to flag
9038 errors since now we have to render expressions.
9040 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
9043 * ecore.cs (SimpleName.ToString): ditto.
9045 * cs-parser.jay: Instead of using strings to assemble types, use
9046 Expressions to assemble the type (using SimpleName, ComposedCast,
9047 MemberAccess). This should fix the type lookups in declarations,
9048 because we were using a different code path for this.
9050 * statement.cs (Block.Resolve): Continue processing statements
9051 even when there is an error.
9053 2002-07-17 Miguel de Icaza <miguel@ximian.com>
9055 * class.cs (Event.Define): Also remove the `remove' method from
9056 the list of pending items.
9058 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
9059 generate more compact code.
9061 2002-07-17 Martin Baulig <martin@gnome.org>
9063 * const.cs (Const.LookupConstantValue): Add support for constant
9064 `unchecked' and `checked' expressions.
9065 Also adding test case test-140.cs for this.
9067 2002-07-17 Martin Baulig <martin@gnome.org>
9069 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
9070 check whether mi.ReturnType implements the IEnumerator interface; the
9071 `==' and the IsAssignableFrom() will fail in this situation.
9073 2002-07-16 Ravi Pratap <ravi@ximian.com>
9075 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
9078 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9080 * expression.cs: fixed bug #27811.
9082 2002-07-14 Miguel de Icaza <miguel@ximian.com>
9084 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
9085 Molaro: when we are a ref, the value already contains a pointer
9086 value, do not take the address of it.
9088 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9089 * removed mb-parser.jay and mb-tokenizer.cs
9091 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9093 * expression.cs: check against the building corlib void type.
9095 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
9097 * ecore.cs: fix for valuetype static readonly fields: when
9098 initializing them, we need their address, not the address of a copy.
9100 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
9102 * typemanager.cs: register also enum_type in corlib.
9104 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9106 * class.cs: allow calling this (but not base) initializers in structs.
9108 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
9110 * ecore.cs: make sure we compare against the building base types
9113 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
9115 * typemanager.cs: fix TypeToCoreType() to handle void and object
9116 (corlib gets no more typerefs after this change).
9118 2002-07-12 Miguel de Icaza <miguel@ximian.com>
9120 * expression.cs (ArrayCreation.EmitArrayArguments): use
9121 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
9123 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
9124 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
9125 array indexes, the runtime actually forbids them.
9127 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
9128 for array arguments here.
9130 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
9131 instead of the default for ValueTypes.
9133 (New.DoEmit): Use IsValueType instead of
9134 IsSubclassOf (value_type)
9135 (New.DoResolve): ditto.
9136 (Invocation.EmitCall): ditto.
9138 * assign.cs (Assign): ditto.
9140 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
9141 Statements *are* currently doing part of their resolution during
9144 Expressions do always resolve during resolve, but statements are
9145 only required to propagate resolution to their children.
9147 2002-07-11 Miguel de Icaza <miguel@ximian.com>
9149 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
9151 (LoadAssembly): Do not add the dll if it is already specified
9153 (MainDriver): Add the System directory to the link path at the end,
9154 after all the other -L arguments.
9156 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
9157 wrong opcode for loading bytes and bools (ldelem.i1 instead of
9158 ldelem.u1) and using the opposite for sbytes.
9160 This fixes Digger, and we can finally run it.
9162 * driver.cs (UnixParseOption): Move the option parsing here.
9163 (CSCParseOption): Implement CSC-like parsing of options.
9165 We now support both modes of operation, the old Unix way, and the
9166 new CSC-like way. This should help those who wanted to make cross
9169 The only thing broken is that /r:, /reference: and /lib: are not
9170 implemented, because I want to make those have the same semantics
9171 as the CSC compiler has, and kill once and for all the confussion
9172 around this. Will be doing this tomorrow.
9174 * statement.cs (Unsafe.Resolve): The state is checked during
9175 resolve, not emit, so we have to set the flags for IsUnsfe here.
9177 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9179 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
9180 not catch the Error_ObjectRefRequired in SimpleName (as it is
9181 possible to have a class/instance variable name that later gets
9182 deambiguated), we have to check this here.
9184 2002-07-10 Ravi Pratap <ravi@ximian.com>
9186 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
9187 make static and put into Expression.
9189 (Event.Define): Register the private field of the event with the
9190 TypeManager so that GetFieldFromEvent can get at it.
9192 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
9193 keep track of the private field associated with an event which
9196 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
9199 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
9201 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9203 * expression.cs (Binary.EmitBranchable): this routine emits the
9204 Binary expression in a branchable context. This basically means:
9205 we need to branch somewhere, not just get the value on the stack.
9207 This works together with Statement.EmitBoolExpression.
9209 * statement.cs (Statement.EmitBoolExpression): Use
9212 2002-07-09 Miguel de Icaza <miguel@ximian.com>
9214 * statement.cs (For): Reduce the number of jumps in loops.
9216 (For): Implement loop inversion for the For statement.
9218 (Break): We can be breaking out of a Try/Catch controlled section
9219 (foreach might have an implicit try/catch clause), so we need to
9220 use Leave instead of Br.
9222 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
9223 now). If the instace expression supports IMemoryLocation, we use
9224 the AddressOf method from the IMemoryLocation to extract the
9225 address instead of emitting the instance.
9227 This showed up with `This', as we were emitting the instance
9228 always (Emit) instead of the Address of This. Particularly
9229 interesting when This is a value type, as we dont want the Emit
9230 effect (which was to load the object).
9232 2002-07-08 Miguel de Icaza <miguel@ximian.com>
9234 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
9236 * statement.cs (Checked): Set the CheckedState during the resolve
9237 process too, as the ConvCast operations track the checked state on
9238 the resolve process, and not emit.
9240 * cs-parser.jay (namespace_member_declaration): Flag that we have
9241 found a declaration when we do. This is used to flag error 1529
9243 * driver.cs: Report ok when we display the help only.
9245 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
9247 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
9249 2002-07-04 Miguel de Icaza <miguel@ximian.com>
9251 * cs-tokenizer.cs (define): We also have to track locally the
9252 defines. AllDefines is just used for the Conditional Attribute,
9253 but we also need the local defines for the current source code.
9255 2002-07-03 Miguel de Icaza <miguel@ximian.com>
9257 * statement.cs (While, For, Do): These loops can exit through a
9258 Break statement, use this information to tell whether the
9259 statement is the last piece of code.
9261 (Break): Flag that we break.
9263 * codegen.cs (EmitContexts): New `Breaks' state variable.
9265 2002-07-03 Martin Baulig <martin@gnome.org>
9267 * class.cs (TypeContainer.MethodModifiersValid): Allow override
9268 modifiers in method declarations in structs. Otherwise, you won't
9269 be able to override things like Object.Equals().
9271 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9273 * class.cs (Method, Property, Indexer): Do not allow the public
9274 modifier to be used in explicit interface implementations.
9276 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
9277 override modifiers in method declarations in structs
9279 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
9281 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
9282 integer or real overflow, report an error
9284 2002-07-02 Martin Baulig <martin@gnome.org>
9286 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
9287 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
9288 to tell the runtime about our newly created System.Object and
9289 System.ValueType types.
9291 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9293 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
9294 struct instead of Ldarg/Starg.
9296 2002-07-02 Martin Baulig <martin@gnome.org>
9298 * expression.cs (Indirection.Indirection): Call
9299 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
9301 2002-07-02 Martin Baulig <martin@gnome.org>
9303 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
9304 ValueType, call TypeManager.TypeToCoreType() on it.
9305 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
9306 the OpCodes.Newarr argument.
9308 2002-07-02 Martin Baulig <martin@gnome.org>
9310 * expression.cs (Invocation.EmitCall): When compiling corlib,
9311 replace all calls to the system's System.Array type to calls to
9312 the newly created one.
9314 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
9315 System.Array methods.
9316 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
9317 from the system's System.Array type which must be replaced.
9319 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
9321 * typemanager.cs: load unverifiable_code_ctor so we can build
9322 corlib using the correct type. Avoid using GetTypeCode() with
9324 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
9325 TypeManager.object_type to allow building corlib.
9327 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
9329 * ecore.cs: handle System.Enum separately in LoadFromPtr().
9331 2002-07-01 Martin Baulig <martin@gnome.org>
9333 * class.cs: Make the last change actually work, we need to check
9334 whether `ifaces != null' to avoid a crash.
9336 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9338 * class.cs: when we build structs without fields that implement
9339 interfaces, we need to add the interfaces separately, since there is
9340 no API to both set the size and add the interfaces at type creation
9343 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9345 * expression.cs: the dimension arguments to the array constructors
9346 need to be converted if they are a long.
9348 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
9350 * class.cs: don't emit ldarg.0 if there is no parent constructor
9351 (fixes showstopper for corlib).
9353 2002-06-29 Martin Baulig <martin@gnome.org>
9355 MCS now compiles corlib on GNU/Linux :-)
9357 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
9358 ie. check for MethodImplOptions.InternalCall.
9360 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
9361 and TypeManager.attribute_type are null, so we must explicitly check
9362 whether parent is not null to find out whether it's an attribute type.
9363 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
9364 and SetBuilder, not only if the property is neither abstract nor external.
9365 This is necessary to set the MethodImplOptions on the accessor methods.
9366 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
9367 SetBuilder, see Property.Emit().
9369 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
9370 populate "System.Object", "System.ValueType" and "System.Attribute" since
9371 they've already been populated from BootCorlib_PopulateCoreTypes().
9373 2002-06-29 Martin Baulig <martin@gnome.org>
9375 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
9376 is the NullLiteral, we also need to make sure that target_type is not
9379 2002-06-29 Martin Baulig <martin@gnome.org>
9381 * rootcontext.cs (RootContext.ResolveCore): We must initialize
9382 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
9383 before calling BootstrapCorlib_ResolveDelegate ().
9385 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9387 * statement.cs: fixed build-breaker. All tests passed ok.
9389 2002-06-27 Martin Baulig <martin@gnome.org>
9391 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
9392 for System.Decimal when compiling corlib.
9394 2002-06-27 Martin Baulig <martin@gnome.org>
9396 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
9397 switch blocks which contain nothing but a default clause.
9399 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
9401 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
9403 2002-06-27 Martin Baulig <martin@gnome.org>
9405 * ecore.cs (PropertyExpr.PropertyExpr): Call
9406 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
9408 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
9409 is already a TypeBuilder.
9411 2002-06-27 Martin Baulig <martin@gnome.org>
9413 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
9414 `target_type == TypeManager.array_type', not IsAssignableFrom() in
9415 the "from an array-type to System.Array" case. This makes it work
9416 when compiling corlib.
9418 2002-06-27 Martin Baulig <martin@gnome.org>
9420 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
9421 non-static PropertyExpr, set its InstanceExpression. This makes
9422 the `ICollection.Count' property work in System/Array.cs.
9424 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
9426 * driver.cs: Made error handling more consistent. Errors now
9427 tracked by Report class, so many methods which used to return int
9428 now return void. Main() now prints success/failure and
9429 errors/warnings message.
9431 Renamed '--probe' compiler argument to '--expect-error'. Removed
9432 the magic number return values (123 and 124). Now, if the
9433 expected error occurs, the compiler exits with success (exit value
9434 0). If the compilation completes without seeing that particular
9435 error, the compiler exits with failure (exit value 1). The
9436 makefile in mcs/errors has been changed to handle the new behaviour.
9438 * report.cs: Made 'expected error' number a property and renamed
9439 it from 'Probe' to 'ExpectedError'.
9441 * genericparser.cs: Removed error handling support, since it is
9442 now all done by Report class.
9444 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
9445 class, so parse() no longer returns an int.
9447 * namespace.cs: Use Report.Error instead of GenericParser.error
9449 2002-06-22 Miguel de Icaza <miguel@ximian.com>
9451 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
9452 TypeContainer.AddOperator): At the front of the list put the
9453 explicit implementations, so they get resolved/defined first.
9455 2002-06-21 Miguel de Icaza <miguel@ximian.com>
9457 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
9458 interface type is implemented by this TypeContainer. Used during
9459 explicit interface implementation.
9461 (Property.Define, Indexer.Define, Method.Define): Validate that
9462 the given interface in the explicit implementation is one of the
9463 base classes for the containing type.
9465 Also if we are explicitly implementing an interface, but there is
9466 no match in the pending implementation table, report an error.
9468 (Property.Define): Only define the property if we are
9469 not explicitly implementing a property from an interface. Use the
9470 correct name also for those properties (the same CSC uses,
9471 although that is really not needed).
9473 (Property.Emit): Do not emit attributes for explicitly implemented
9474 properties, as there is no TypeBuilder.
9476 (Indexer.Emit): ditto.
9478 Hiding then means that we do not really *implement* a pending
9479 implementation, which makes code fail.
9481 2002-06-22 Martin Baulig <martin@gnome.org>
9483 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
9484 the return value of Object.GetType(). [FIXME: we need to do this whenever
9485 we get a type back from the reflection library].
9487 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
9489 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
9491 2002-06-20 Miguel de Icaza <miguel@ximian.com>
9493 * attribute.cs: Return null if we can not look up the type.
9495 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
9496 the interface types found.
9498 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
9499 interface types found.
9501 * typemanager.cs (GetInterfaces): Make this routine returns alll
9502 the interfaces and work around the lame differences between
9503 System.Type and System.Reflection.Emit.TypeBuilder in the results
9504 result for GetInterfaces.
9506 (ExpandInterfaces): Given an array of interface types, expand and
9507 eliminate repeated ocurrences of an interface. This expands in
9508 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
9511 2002-06-21 Martin Baulig <martin@gnome.org>
9513 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
9516 2002-06-21 Martin Baulig <martin@gnome.org>
9518 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
9519 and called with one of the core types, return the corresponding typebuilder for
9522 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
9525 2002-06-21 Martin Baulig <martin@gnome.org>
9527 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
9528 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
9529 (Expression.ConvertReferenceExplicit): Likewise.
9531 * expression.cs (ElementAccess.DoResolve): Likewise.
9532 (ElementAccess.DoResolveLValue): Likewise.
9534 2002-06-10 Martin Baulig <martin@gnome.org>
9536 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
9537 add the "value" parameter to the parameter list.
9539 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
9542 2002-06-19 Miguel de Icaza <miguel@ximian.com>
9544 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
9545 the argument to an int, uint, long or ulong, per the spec. Also
9546 catch negative constants in array creation.
9548 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
9550 * class.cs: do not allow the same interface to appear twice in
9551 the definition list.
9553 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
9555 * ecore.cs: don't use ldlen with System.Array.
9557 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
9559 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
9561 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
9563 * modifiers.cs: produce correct field attributes for protected
9564 internal. Easy fix so miguel can work on ther harder stuff:-)
9566 2002-06-18 Miguel de Icaza <miguel@ximian.com>
9568 * pending.cs: New file. Move the code from class.cs here.
9569 Support clearning the pending flag for all methods (when not doing
9570 explicit interface implementation).
9572 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
9574 * rootcontext.cs: added a couple more types needed to bootstrap.
9576 2002-06-17 Miguel de Icaza <miguel@ximian.com>
9578 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
9579 constructor in the type, instead of any constructor in the type
9580 hierarchy. Thanks to Paolo for finding this bug (it showed up as
9581 a bug in the Mono runtime when applying the params attribute).
9583 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9584 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
9586 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
9588 * expression.cs (Unary.ResolveOperator): Use TypeManager
9589 to resolve the type.
9591 2002-06-13 Ravi Pratap <ravi@ximian.com>
9593 * cs-parser.jay (enum_member_declaration): Pass in the attributes
9596 * enum.cs (AddEnumMember): Add support to store the attributes associated
9597 with each member too.
9599 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
9600 field builders too - this takes care of the enum member case.
9602 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
9604 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
9605 address-of operator on both value types and pointers.
9607 2002-06-10 Martin Baulig <martin@gnome.org>
9609 * interface.cs (Interface.PopulateIndexer): Add the indexer's
9610 PropertyBuilder to the `property_builders' list.
9612 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
9613 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
9614 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
9615 find any indexers which are inherited from an interface.
9617 2002-06-09 Martin Baulig <martin@gnome.org>
9619 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
9620 the same type as the constant if necessary. There's also a test-130.cs
9623 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
9625 * typemanager.cs (TypeManager.ChangeType): Previously known as
9626 Enum.ChangeEnumType().
9628 2002-06-09 Martin Baulig <martin@gnome.org>
9630 * expression.cs (Cast.TryReduce): Added support for consts.
9632 2002-06-08 Ravi Pratap <ravi@ximian.com>
9634 * class.cs (Accessor): Hold attributes information so we can pass
9637 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
9638 Modify to pass in attributes attached to the methods.
9640 (add_accessor_declaration, remove_accessor_declaration): Ditto.
9642 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
9643 to handle the Accessor kind :-)
9645 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
9647 2002-06-08 Martin Baulig <martin@gnome.org>
9649 * expression.cs (Unary.TryReduceNegative): Added support for
9652 2002-06-08 Martin Baulig <martin@gnome.org>
9654 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
9655 name can't be found in the `defined_names' - the caller will do a
9656 MemberLookup in this case and thus find methods in System.Enum
9657 such as Enum.IsDefined().
9659 2002-06-08 Martin Baulig <martin@gnome.org>
9661 * enum.cs (Enum.ChangeEnumType): This is a custom version of
9662 Convert.ChangeType() which works with TypeBuilder created types.
9663 (Enum.LookupEnumValue, Enum.Define): Use it here.
9665 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
9666 `TypeBuilder.BaseType != null' check.
9667 (TypeContainer.FindMembers): Only lookup parent members if we
9668 actually have a parent.
9669 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
9670 (ConstructorInitializer.Resolve): Likewise.
9672 * interface.cs (Interface.FindMembers): Added
9673 `TypeBuilder.BaseType != null' check.
9675 * rootcontext.cs (RootContext.ResolveCore): Added
9676 "System.Runtime.CompilerServices.IndexerNameAttribute" to
9677 classes_second_stage.
9679 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
9680 debug_type and trace_type when compiling with --nostdlib.
9682 2002-06-07 Martin Baulig <martin@gnome.org>
9684 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
9685 (AddField): Set it to true when adding a non-static field.
9686 (DefineType): Use `have_nonstatic_fields' to find out whether we
9687 have non-static fields, not `Fields != null'.
9689 2002-06-02 Miguel de Icaza <miguel@ximian.com>
9691 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
9692 dereferencing a null on the static-field code path)
9694 2002-05-30 Martin Baulig <martin@gnome.org>
9696 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
9697 to take command line arguments. Use reflection to call the new
9698 custom `Initialize' function on the symbol writer and pass it the
9699 command line arguments.
9701 * driver.cs (--debug-args): New command line argument to pass command
9702 line arguments to the symbol writer.
9704 2002-05-28 Miguel de Icaza <miguel@ximian.com>
9706 * assign.cs (DoResolve): Forgot to do the implicit conversion to
9707 the target type for indexers and properties. Thanks to Joe for
9710 2002-05-27 Miguel de Icaza <miguel@ximian.com>
9712 * typemanager.cs (MethodFlags): returns the method flags
9713 (Obsolete/ShouldIgnore) that control warning emission and whether
9714 the invocation should be made, or ignored.
9716 * expression.cs (Invocation.Emit): Remove previous hack, we should
9717 not do this on matching a base type, we should do this based on an attribute
9719 Only emit calls to System.Diagnostics.Debug and
9720 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
9721 on the command line.
9723 * rootcontext.cs: Global settings for tracing and debugging.
9725 * cs-tokenizer.cs (define): New utility function to track
9726 defines. Set the global settings for TRACE and DEBUG if found.
9728 2002-05-25 Ravi Pratap <ravi@ximian.com>
9730 * interface.cs (Populate*): Pass in the TypeContainer as well as
9731 the DeclSpace as parameters so that we can create EmitContexts and
9732 then use that to apply attributes etc.
9734 (PopulateMethod, PopulateEvent, PopulateProperty)
9735 (PopulateIndexer): Apply attributes everywhere.
9737 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
9740 (ApplyAttributes): Update accordingly.
9742 We now apply interface attributes for all members too.
9744 2002-05-26 Miguel de Icaza <miguel@ximian.com>
9746 * class.cs (Indexer.Define); Correctly check if we are explicit
9747 implementation (instead of checking the Name for a ".", we
9748 directly look up if the InterfaceType was specified).
9750 Delay the creation of the PropertyBuilder.
9752 Only create the PropertyBuilder if we are not an explicit
9753 interface implementation. This means that explicit interface
9754 implementation members do not participate in regular function
9755 lookups, and hence fixes another major ambiguity problem in
9756 overload resolution (that was the visible effect).
9758 (DefineMethod): Return whether we are doing an interface
9761 * typemanager.cs: Temporary hack until we get attributes in
9762 interfaces (Ravi is working on that) and we get IndexerName
9763 support in interfaces.
9765 * interface.cs: Register the indexers as properties.
9767 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
9768 warning, I have verified that this is a bug in the .NET runtime
9769 (JavaScript suffers of the same problem).
9771 * typemanager.cs (MemberLookup): When looking up members for
9772 interfaces, the parent of an interface is the implicit
9773 System.Object (so we succeed in searches of Object methods in an
9774 interface method invocation. Example: IEnumerable x; x.ToString
9777 2002-05-25 Miguel de Icaza <miguel@ximian.com>
9779 * class.cs (Event): Events should also register if they do
9780 implement the methods that an interface requires.
9782 * typemanager.cs (MemberLookup); use the new GetInterfaces
9785 (GetInterfaces): The code used to lookup interfaces for a type is
9786 used in more than one place, factor it here.
9788 * driver.cs: Track the errors at the bottom of the file, we kept
9791 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
9792 instance if the method we are calling is static!
9794 2002-05-24 Miguel de Icaza <miguel@ximian.com>
9796 * attribute.cs (ApplyAttributes): Make this function filter out
9797 the IndexerName attribute (as that attribute in reality is never
9798 applied) and return the string constant for the IndexerName
9801 * class.cs (TypeContainer.Emit): Validate that all the indexers
9802 have the same IndexerName attribute, and if so, set the
9803 DefaultName attribute on the class.
9805 * typemanager.cs: The return value might contain other stuff (not
9806 only methods). For instance, consider a method with an "Item"
9807 property and an Item method.
9809 * class.cs: If there is a problem with the parameter types,
9812 2002-05-24 Ravi Pratap <ravi@ximian.com>
9814 * ecore.cs (ImplicitConversionExists): Wrapper function which also
9815 looks at user defined conversion after making a call to
9816 StandardConversionExists - we need this for overload resolution.
9818 * expression.cs : Update accordingly the various method calls.
9820 This fixes 2 bugs filed against implicit user defined conversions
9822 2002-05-22 Miguel de Icaza <miguel@ximian.com>
9824 * statement.cs: Track the result of the assignment.
9826 2002-05-21 Miguel de Icaza <miguel@ximian.com>
9828 * expression.cs (MemberAccess): Improved error reporting for
9829 inaccessible members.
9831 2002-05-22 Martin Baulig <martin@gnome.org>
9833 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
9834 itself with debugging support.
9836 2002-05-22 Martin Baulig <martin@gnome.org>
9838 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
9839 Removed, this isn't needed anymore.
9841 2002-05-20 Martin Baulig <martin@gnome.org>
9843 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
9844 be underlying type for an enum.
9846 2002-05-20 Miguel de Icaza <miguel@ximian.com>
9848 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
9849 that splits out the loading of just the core types.
9851 * rootcontext.cs (ResolveCore): Split the struct resolution in
9852 two, so we can load the enumeration underlying types before any
9855 * expression.cs (Is): Bandaid until we fix properly Switch (see
9856 bug #24985 for details).
9858 * typemanager.cs (ImplementsInterface): The hashtable will contain
9859 a null if there are no interfaces implemented.
9861 2002-05-18 Miguel de Icaza <miguel@ximian.com>
9863 * cs-parser.jay (indexer_declarator): It is fine to have array
9866 2002-05-17 Miguel de Icaza <miguel@ximian.com>
9868 * typemanager.cs: (RegisterBuilder): New function used to register
9869 TypeBuilders that implement interfaces. Since
9870 TypeBuilder.GetInterfaces (as usual) does not work with lame
9872 (AddUserType): register interfaces.
9874 (ImplementsInterface): Use the builder_to_ifaces hash if we are
9875 dealing with TypeBuilder. Also, arrays are showing up as
9876 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
9877 methods can not be invoked on them!
9879 * ecore.cs (ExplicitReferenceConversionExists): Made public.
9880 (ImplicitReferenceConversionExists): Split out from
9881 StandardConversionExists.
9883 * expression.cs (As): We were only implementing one of the three
9884 cases for the as operator. We now implement them all.
9885 (Is): Implement the various other cases for Is as well.
9887 * typemanager.cs (CACHE): New define used to control if we want or
9888 not the FindMembers cache. Seems to have a negative impact on
9889 performance currently
9891 (MemberLookup): Nested types have full acess to
9892 enclosing type members
9894 Remove code that coped with instance/static returns for events, we
9895 now catch this in RealFindMembers.
9897 (RealFindMembers): only perform static lookup if the instance
9898 lookup did not return a type or an event.
9900 2002-05-17 Miguel de Icaza <miguel@ximian.com>
9902 * assign.cs (CompoundAssign): We pass more semantic information
9903 now to Compound Assignments than we did before: now we have all
9904 the information at hand, and now we resolve the target *before* we
9905 do the expression expansion, which allows the "CacheValue" method
9906 to have the effect we intended (before, a [x] += 1 would generate
9907 two differen ArrayAccess expressions from the ElementAccess,
9908 during the resolution process).
9910 (CompoundAssign.DoResolve): Resolve target and original_source here.
9912 2002-05-16 Miguel de Icaza <miguel@ximian.com>
9914 * expression.cs (ArrayAccess): dropped debugging information.
9916 * typemanager.cs: Small bug fix: I was always returning i_members,
9917 instead of one of i_members or s_members (depending on which had
9920 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
9921 method is invoked before any code generation takes place, and it
9922 is a mechanism to inform that the expression will be invoked more
9923 than once, and that the method should use temporary values to
9924 avoid having side effects
9926 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
9928 * ecore.cs (Expression.CacheTemporaries): Provide empty default
9931 * expression.cs (Indirection, ArrayAccess): Add support for
9932 CacheTemporaries in these two bad boys.
9934 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
9936 (StoreFromPtr): Handle stobj as well.
9938 * expression.cs (UnaryMutator): Share more code.
9940 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
9941 down: I was not tracking the Filter function as well, which
9942 was affecting the results of the cache.
9944 2002-05-15 Miguel de Icaza <miguel@ximian.com>
9946 * attribute.cs: Remove the hack to handle the CharSet property on
9949 2002-05-14 Miguel de Icaza <miguel@ximian.com>
9951 * attribute.cs (DoResolve): More uglyness, we now only try to
9952 resolve the attribute partially, to extract the CharSet
9953 information (only if we are a StructLayout attribute). Otherwise
9955 (GetExtraTypeInfo): Add some code to conditionally kill in the
9956 future this. I am more and more convinced that the .NET
9957 framework has special code to handle the attribute setting on
9960 * expression.cs (IsParamsMethodApplicable): Revert my previous
9961 foreach change here, it was wrong.
9963 2002-05-13 Miguel de Icaza <miguel@ximian.com>
9965 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
9966 (pp_expr): do not abort on unknown input, just return.
9967 (eval): abort if there are pending chars.
9969 * attribute.cs (Attribute.Resolve): Positional parameters are
9970 optional. Deal with that case.
9972 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
9973 the Ansi/Unicode/Auto information for the type.
9975 (TypeContainer.DefineType): instantiate the EmitContext here, as
9976 we will be using it during the type definition (to resolve
9977 attributes) and during the emit phase.
9979 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
9980 to pull type information out of the attributes
9982 (Attribute.Resolve): track the constructor builder, and allow for
9983 multiple invocations (structs and classes will use this).
9985 * ecore.cs (MemberLookupFinal): new version with all the
9986 parameters customizable.
9988 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
9989 constructors. Return if the result value is null (as the error
9990 would have been flagged already by MemberLookupFinal)
9992 Do not allow instances of abstract classes or interfaces to be
9995 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
9996 We have to compare the assembly property here when dealing with
9997 FamANDAssem and Assembly access modifiers, because we might be
9998 creating an assembly from *modules* (that means that we are not
9999 getting TypeBuilders for types defined in other modules that are
10000 part of this assembly).
10002 (Method.Emit): If the method is marked abstract and has a body,
10005 (TypeContainer.DefineMembers): If both the defined member and the
10006 parent name match are methods, then do not emit any warnings: let
10007 the Method.Define routine take care of flagging warnings. But if
10008 there is a mismatch (method overrides something else, or method is
10009 overriwritten by something, then emit warning).
10011 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
10012 set to null, this means `do not check for the return type on the
10015 (Method.Define): set the return type for the method signature to
10016 null, so that we get methods with the same name and parameters and
10017 different return types. This is used to flag warning 114 (you are
10018 hiding a method, and you probably want to use the new/override
10021 * typemanager.cs (MemberLookup): Implemented proper access
10022 control, closing a long standing set of bug reports. The problem
10023 was that the Framework only has two bits: Public and NonPublic,
10024 and NonPublic includes private and protected methods, but we need
10025 to enforce the FamANDAssem, FamOrAssem and Family.
10027 2002-05-11 Miguel de Icaza <miguel@ximian.com>
10029 * statement.cs (GotoCase): Return true: Ammounts to giving up
10030 knowledge on whether we return or not, and letting the other case
10031 be responsible for it.
10033 2002-05-10 Miguel de Icaza <miguel@ximian.com>
10035 * driver.cs: Do not load directories for each file processed, only
10036 do it if there is a pattern.
10038 * ecore.cs: Report readonly assigns here as well, as we might have
10039 been resolved only by MemberAccess.
10041 (SimpleName.SimpleNameResolve): Also be useful for LValue
10042 resolution. We need this to propagate assign to local readonly variables
10044 * typemanager.cs: Use a ptrhashtable for the criteria, because we
10045 do not want to reuse potential criteria memory.
10047 * class.cs (MyEventBuilder): Set reflected_type;
10049 * ecore.cs (Constantify): Added support for constifying bools.
10051 (RootContext.LookupType): Added a cache for values looked up in
10052 the declaration space.
10054 * typemanager.cs (FindMembers): Now is a front-end to
10055 RealFindMembers, and provides a two-level hashtable-based cache to
10058 15% performance improvement: from 22.5 to 19.2 seconds.
10060 * expression.cs (IsParamsMethodApplicable): use foreach.
10061 (Invocation.DoResolve): ditto.
10062 (New.DoResolve): ditto.
10063 (ArrayCreation.DoResolve): ditto.
10065 * ecore.cs (FindMostEncompassingType): use foreach.
10067 * delegate.cs (NewDelegate.DoResolve): Use foreach
10069 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
10070 (RemoveMethods): use foreach.
10072 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
10073 nested foreach statements instead of for, and also break out of
10074 the inner loop once a match is found.
10076 (Invocation.OverloadResolve): Use foreach, simplify the code.
10078 2002-05-08 Miguel de Icaza <miguel@ximian.com>
10080 * cfold.cs (BinaryFold): During an enumeration evaluation context,
10081 we actually unwrap the expression to allow for extra information
10084 * expression.cs: Use Shr_Un on unsigned operations.
10086 2002-05-08 Ravi Pratap <ravi@ximian.com>
10088 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
10089 applicable operators was not being considered correctly. This closes
10090 the bug Miguel reported.
10092 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
10094 * attribute.cs: check that the type derives from System.Attribute
10095 and report the correct error in that case (moved the duplicate code to
10096 its own method, too).
10098 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
10100 * attribute.cs: lookup attribute type name as the spec says: first the
10101 bare attribute name and then name + "Attribute" (nant compiles with
10102 mcs after this fix).
10104 2002-05-07 Miguel de Icaza <miguel@ximian.com>
10106 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
10107 Because of the way we parse things, we should try to see if a
10108 UIntConstant can fit in an integer.
10110 2002-05-07 Ravi Pratap <ravi@ximian.com>
10112 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
10113 when we are in an explicit context.
10115 (ConvertReferenceExplicit): When converting from Iface type S to Class
10116 T make sure the rules are implemented as an OR.
10118 * parameter.cs (ParameterType): Make it a property for now although the
10119 purpose really isn't anything immediate.
10121 * expression.cs (Is*Applicable): Do better checking on the parameter type
10122 of a ref/out parameter. The ones from the system assemblies are already
10123 marked with the correct type so we don't need to do any correction.
10125 * ecore.cs (StandardConversionExists): Conversion from Interface types to
10126 the object type is standard too so include that.
10128 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10130 * ecore.cs (StandardConversionExists): Augment with missing code:
10131 deal with IntConstant, LongConstants and Enumerations.
10133 * assign.cs: Report the error, instead of failing silently
10135 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
10136 typecontainer that they are declared, because the
10137 typecontainer/namespace will have the list of using clauses that
10138 need to be applied.
10140 Assembly Attributes were escaping the normal registration
10143 (EmitCode): Apply attributes within an EmitContext that represents
10144 the container they were declared on.
10146 * cs-parser.jay: Track bases for structs. How did I get this wrong?
10148 2002-05-06 Ravi Pratap <ravi@ximian.com>
10150 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
10151 Revamp completely - make much cleaner as we now operate only
10154 (FindMostSpecificSource, FindMostSpecificTarget): New methods
10155 to implement the logic detailed in the spec more correctly.
10157 (UserDefinedConversion): Update accordingly.
10159 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10161 * statement.cs: Return flow analysis information up.
10163 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
10166 (token): Do not consume an extra character before calling
10169 2002-05-06 Piers Haken <piersh@friskit.com>
10171 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
10173 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10175 * class.cs (Constructor.Emit): Set the IsStatic flag in the
10176 EmitContext during the instance constructor initializer
10177 resolution, to stop access to instance variables.
10179 This is mandated by the spec, last paragraph of the `constructor
10180 initializers' section.
10182 2002-05-05 Miguel de Icaza <miguel@ximian.com>
10184 * cs-parser.jay, class.cs (Accessor): new class used to represent
10185 an accessor (get or set). In the past we used `null' to represent
10186 a missing accessor. But this is ambiguous because there was no
10187 way to tell in abstract indexers/properties if one of them was
10190 Now there is a way of addressing that.
10192 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
10193 instead of FindMembers.
10195 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
10196 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
10198 * attribute.cs: Treat indexers and properties as the same in terms
10199 of applying attributes
10201 * ecore.cs (FindMostEncompassedType): Use statically initialized
10202 EmptyExpressions()s like we do elsewhere to avoid creating useless
10203 objects (and we take this out of the tight loop).
10205 (GetConversionOperators): Move the code to extract the actual
10206 operators to a separate routine to clean things up.
10208 2002-05-04 Miguel de Icaza <miguel@ximian.com>
10210 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
10211 events are always registered FieldBuilders.
10213 * class.cs (FieldBase): New class shared by Fields
10215 * delegate.cs: If we are a toplevel delegate, use our full name.
10216 If we are a nested delegate, then only use our tail name.
10218 2002-05-02 Ravi Pratap <ravi@ximian.com>
10220 * expression.cs (IsApplicable): Ensure that we add the "&" to
10221 ref/out types before comparing it with the type of the argument.
10223 (IsParamsMethodApplicable): Ditto.
10225 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
10228 * delegate.cs : Handle the case when we have more than one applicable
10229 method. Flag an error only when we finish checking all.
10231 2002-05-02 Miguel de Icaza <miguel@ximian.com>
10233 * expression.cs: Add support for boolean static initializers.
10235 2002-05-01 Miguel de Icaza <miguel@ximian.com>
10237 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
10239 * parameter.cs (ComputeParameterTypes,
10240 ComputeAndDefineParameterTypes): Better error handling: now we
10241 clear the `types' cache if we fail during any of the type lookups.
10242 We also return the status code correctly to our caller
10244 * delegate.cs: If we fail to define a delegate, abort the extra
10247 * expression.cs (Binary.ResolveOperator): for
10248 operator==(object,object) and operator !=(object, object) we also
10249 have to verify that there is an implicit conversion from one to
10252 (ArrayAccess.DoResolve): Array Access can operate on
10255 2002-04-30 Miguel de Icaza <miguel@ximian.com>
10257 * assign.cs (CompoundAssign): A new class used as a "flag" that
10258 the assignment actually is happening as part of a compound
10259 assignment operator.
10261 During compound assignment, a few new rules exist to enable things
10268 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
10269 to the type of x) if y is implicitly convertible to the type of x,
10270 and the operator is a builtin operator and the return type of the
10271 operator is explicitly convertible to the type of x.
10273 * rootcontext.cs: Reset warning level to 2. 4 catches various
10274 "interesting" features in mcs, we must clean this up at some
10275 point, but currently am trying to kill other bugs ;-)
10277 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
10278 in container classes as well.
10280 * expression.cs (Binary.ResolveOperator): Handle string case
10281 before anything else (as operator overloading does emit an error
10282 before doing anything else).
10284 This code could go away when we move to a table driven model, but
10285 i could not come up with a good plan last night.
10287 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
10289 * typemanager.cs (CSharpName): reimplementation using regex.
10290 * class.cs: added null check for fields in Emit
10291 * rootcontext.cs: set warninglevel to 4
10293 2002-04-29 Miguel de Icaza <miguel@ximian.com>
10295 * typemanager.cs (CSharpName): reimplemented with Lupus
10298 2002-04-28 Miguel de Icaza <miguel@ximian.com>
10300 * statement.cs (If): correclty implement Resolve, because we were
10301 not catching sem errors in there. The same process is needed
10303 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
10306 (Statement.Warning_DeadCodeFound): Factorize code.
10307 (While): Report dead code here too.
10309 (Statement): Added Resolve virtual method to allow
10310 for resolution split from the emit code.
10312 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10314 * statement.cs (EmitBoolExpression): No longer try to resolve the
10316 (MakeBoolean): New utility function that resolve, implicitly
10317 converts to boolean and tags the expression.
10320 (If, Do): Implement dead code elimination.
10321 (While): Implement loop inversion
10323 (Do, While, For, If): Resolve the expression prior to calling our
10326 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
10329 - added method Report28 (warning: program has more than one entry point)
10330 - added method IsEntryPoint, implements paragraph 10.1 of the spec
10331 - modified method Method.Define, the part at the end of the method
10333 * rootcontext.cs: added static public Location EntryPointLocation;
10335 * ../errors/cs0028.cs : Add test case for the above warning.
10338 - modified method CSharpName to allow arrays of primitive type to
10339 be printed nicely (e.g. instead of System.Int32[][] it now prints
10341 - added method CSharpSignature: returns the signature of a method
10342 in string format to be used in reporting errors, warnings, etc.
10344 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
10347 2002-04-26 Ravi Pratap <ravi@ximian.com>
10349 * delegate.cs (Define): Fix extremely silly bug where I was
10350 setting the type of the 'object' parameter of the BeginInvoke
10351 method to System.IAsyncResult instead of System.Object ;-)
10353 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10355 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
10358 (Constructor.Emit): return if we fail to initialize the
10359 constructor. Another door closed!
10361 * expression.cs (New.DoResolve): Improve error message (from -6 to
10362 1501). Use DeclaredOnly lookup to find the exact constructor.
10364 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
10365 loop. This is useful.
10367 * cs-parser.jay: Adjust the default parameters so that destructors
10368 have the proper signature.
10370 2002-04-26 Martin Baulig <martin@gnome.org>
10372 * driver.cs (LoadAssembly): If `assembly' contains any characters
10373 which are only valid in path names and not in assembly names
10374 (currently slash, backslash and point), use Assembly.LoadFrom ()
10375 instead of Assembly.Load () on the `assembly' (before iteration
10376 over the link_paths).
10378 2002-04-26 Martin Baulig <martin@gnome.org>
10380 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
10382 2002-04-25 Miguel de Icaza <miguel@ximian.com>
10384 * class.cs (Property): use the new typemanager.MemberLookup
10386 (TypeContainer.MemberLookup): Implement using the
10387 TypeManager.MemberLookup now.
10389 * typemanager.cs: Make MemberLookup a function of the TypeManager,
10390 and return MemberInfos, so that these can be used without an
10391 EmitContext (what we had before).
10393 2002-04-24 Miguel de Icaza <miguel@ximian.com>
10395 * expression.cs: Fix the case where the argument to params if the
10396 type of the params. I omitted handling this before. Fixed
10398 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10400 * driver.cs: Call BootCorlib_PopulateCoreType
10402 * class.cs (Property.CheckBase): Check for properties only, not
10405 * interface.cs: Temporary hack: try/catch around the
10406 CustomAttributeBuilder, because I am getting an exception that I
10409 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
10410 types whose definitions are required to be there (attributes are
10411 defined before standard types).
10413 Compute definitions as we boot the various types, as they are used
10414 immediately (value_type class will need object_type, but if we do
10415 not initialize object_type, we will pass a null, which will let
10416 the runtime pick the System.Object from the existing corlib, which
10417 is not what we want).
10419 2002-04-22 Patrik Torstensson <totte@labs2.com>
10421 * cs-tokenizer.cs: fixed a number of trim() issues.
10423 2002-04-22 Ravi Pratap <ravi@ximian.com>
10425 * expression.cs (Argument.Type): Ensure that we return the correct
10426 type when we have out or ref parameters [in which case we
10429 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10431 * class.cs (Property, Indexer): Allow extern modifier in there.
10433 * typemanager.cs (InitBaseTypes): Initializes object_type and
10434 value_type, since those will be used early on during the bootstrap
10435 process to compile corlib.
10437 (InitCoreTypes): Move code from here to InitBaseTypes.
10439 2002-04-21 Miguel de Icaza <miguel@ximian.com>
10441 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
10442 single-dimension arrays as using the ldlen opcode.
10444 Daniel Lewis discovered this optimization.
10446 * typemanager.cs: Add signature for System.Array::get_Length
10448 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10450 * statement.cs: report the error when the foreach does not apply to an
10451 array nor a collection.
10453 2002-04-19 Miguel de Icaza <miguel@ximian.com>
10455 * expression.cs: Add implicit conversions to the operator ~.
10457 * constant.cs (DecimalConstant.Emit): Emit decimal value.
10459 * typemanager.cs: Locate the decimal constructor.
10461 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10463 * attribute.cs: use the new property of TypeOf.
10464 * expression.cs: added 'get' property around typearg.
10466 These changes fix a build breaker reported by NickD. Is this the
10467 correct way to fix? If not, please, revert my changes and make it
10470 2002-04-17 Miguel de Icaza <miguel@ximian.com>
10472 * attribute.cs: Add support for typeof in attribute invocations.
10473 I am not sure that this is right though.
10475 2002-04-14 Duncan Mak <duncan@ximian.com>
10477 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
10478 Binary.Operator.Division case.
10480 2002-04-13 Ravi Pratap <ravi@ximian.com>
10482 * class.cs (DefineType): Ensure that we do a proper check on
10483 attribute types and also register it with the TypeManager.
10485 (TypeContainer.Targets): The default for attribute types is
10486 AttributeTargets.All.
10488 * attribute.cs (ApplyAttributes): Registering the attribute type
10489 is done elsewhere, not when we discover we have a Usage attribute.
10491 2002-04-12 Ravi Pratap <ravi@ximian.com>
10493 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
10494 and get rid of is_delegate parameter.
10496 * everywhere : update.
10498 2002-04-12 Ravi Pratap <ravi@ximian.com>
10500 * cs-parser.jay (compilation_unit): Revamp completely to use
10501 some new ideas that I got from Rhys' grammar to solve the problems
10502 with assembly level attributes.
10504 (outer_declaration): New grammar production.
10506 (attribute_sections): Add.
10508 (opt_attributes): Base on attribute_sections
10510 (namespace_declaration): Allow opt_attributes to tackle the case
10511 when we have assembly level attributes - we are clever in this
10514 * attribute.cs (ApplyAttributes): Do not worry about assembly
10515 attributes in the non-global context.
10517 * rootcontext.cs (AddGlobalAttributes): Go back to using this
10518 instead of SetGlobalAttributes.
10520 * class.cs, rootcontext.cs : Ensure we define and generate
10521 attribute types before anything else.
10523 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
10524 and flag the new error -20 for the case when the attribute type
10525 does not have valid targets specified. csc does not catch this.
10527 * ../errors/errors.txt : update for error # -20
10529 2002-04-11 Ravi Pratap <ravi@ximian.com>
10531 * support.cs (InternalParameters.ParameterModifier): Do some null
10532 checking and return sane values.
10534 * class.cs (Method.Define): If we are a PInvoke method, ensure
10535 that we are static and extern. Report error # 601
10537 * ../errors/cs0601.cs : Add test case for the above error.
10539 2002-04-07 Ravi Pratap <ravi@ximian.com>
10541 * rootcontext.cs (attribute_types): We need to keep type of
10542 all attribute types separately and emit code for them first.
10544 (RegisterAttribute) : Implement.
10546 * class.cs (DefineType): Check if the current Type is a custom
10547 attribute type and register it accordingly.
10549 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
10550 adding the first attribute twice and rename to
10552 (SetGlobalAttributes): this.
10554 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
10557 * attribute.cs (ApplyAttributes): Take an additional argument telling us
10558 if we are processing global arguments. Hmm, I am unsure of this.
10560 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10562 * expression.cs: added static array of strings to avoid calling
10563 Enum.ToString () for Operator in Binary. Significant recover of
10566 2002-04-10 Miguel de Icaza <miguel@ximian.com>
10568 * class.cs (FindMembers): Allow the Builders of the various
10569 members to be null. If they are skip them. This only happens
10570 during the PInvoke declaration.
10572 2002-04-09 Miguel de Icaza <miguel@ximian.com>
10574 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
10575 failure, so we do not keep going afterwards.
10577 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
10578 wanted to pass `false' as the `is_delegate' argument. If this is
10579 the case, why not use delegate_type == null to mean `is_delegate =
10580 false' and anything else as is_delegate = true.
10582 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
10584 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
10585 code for the section, not the beginning of the tests.
10587 2002-04-08 Miguel de Icaza <miguel@ximian.com>
10589 * cfold.cs: Handle operator + (Enum x, Underlying x)
10591 * expression.cs (Binary): same. Warn about errors where we have
10592 Enum/Enum in operator + as well.
10594 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
10597 - added support for switch(bool)
10598 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
10599 - add TableSwitchEmit() to handle table-based switch statements
10601 2002-04-05 Ravi Pratap <ravi@ximian.com>
10603 * expression.cs (Invocation.OverloadResolve): Factor out code which
10604 does parameter compatibility checking with arguments so that we can
10605 re-use the code even from Delegate.VerifyApplicability
10607 (VerifyArgumentsCompat): Move above code here.
10609 * delegate.cs (VerifyApplicability): Get rid of duplicate code
10610 and instead make a call to the above method.
10612 2002-03-31 Ravi Pratap <ravi@ximian.com>
10614 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
10615 We use it to keep track of classes which are attribute types.
10617 2002-04-02 Miguel de Icaza <miguel@ximian.com>
10619 * delegate.cs (Delegate.Define): Correctly define the types in the
10620 presence of fixed and array parameters.
10622 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
10625 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
10626 include NonPublic after the first iteration.
10628 * class.cs (Indexer.CheckBase): Only check if both parents are
10631 * cs-parser.jay (accessor_body): If empty, set to null.
10633 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
10634 same code path here to resolve constants names that we did have in
10635 MemberAccess.DoResolve. There is too much code duplicated here.
10637 2002-04-01 Miguel de Icaza <miguel@ximian.com>
10639 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
10641 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
10644 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
10645 tokens, numbers and strings.
10647 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
10650 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
10651 asyncronous parameters and the regular parameters.
10653 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
10654 specify the target directory.
10656 * expression.cs: (This.DoResolve): Simplify
10657 (As.Emit): Optimize, do not generate IsInst if the expression is
10658 always of the given type.
10660 (Is.DoResolve): Bug fix, we were reporting both always/never for
10663 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
10664 creating too many unnecessary arrays.
10666 2002-03-31 Miguel de Icaza <miguel@ximian.com>
10668 * class.cs (EmitFieldInitializer): Use Assign expression to assign
10669 fields instead of rolling our own initializer. Takes care of all
10670 implicit conversions, and drops unnecessary static checks/argument.
10672 2002-03-31 Dick Porter <dick@ximian.com>
10674 * driver.cs: use the GetDirectories() return values properly, and
10675 use "/" as path separator.
10677 2002-03-30 Miguel de Icaza <miguel@ximian.com>
10679 * expression.cs (Unary): Optimize - - expr into expr.
10680 (Binary): Optimize a + (-b) into a -b.
10682 * codegen.cs (CodeGen): Made all methods static.
10684 2002-03-29 Miguel de Icaza <miguel@ximian.com>
10688 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
10689 TypeBuilder property.
10691 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
10694 * tree.cs: Removed the various RecordXXXX, and replaced with a
10695 single RecordDecl. Removed all the accessor methods, and just
10696 left a single access point Type
10698 * enum.cs: Rename DefineEnum to DefineType.
10700 * decl.cs: New abstract method `DefineType' used to unify the
10701 Defines for Enumerations, Interfaces, TypeContainers and
10704 (FindType): Moved LookupInterfaceOrClass here. Moved the
10705 LookupBaseClasses method that used to live in class.cs and
10706 interface.cs here, and renamed to FindType.
10708 * delegate.cs: Implement DefineType. Take advantage of the
10709 refactored pattern for locating the parent builder without taking
10710 the parent_builder argument (which we know does not work if we are
10711 nested, and triggering a toplevel definition).
10713 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10715 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
10716 accessibility of a member has changed during override and report
10719 * class.cs (Method.Define, Property.Define): Only complain on
10720 overrides if the method is private, any other accessibility is
10721 fine (and since we just checked the permission is the same, we are
10724 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
10725 and elif are processed always. The other pre-processing
10726 directives are only processed if we are "taking" the path
10728 2002-03-29 Martin Baulig <martin@gnome.org>
10730 * class.cs (Method.Emit): Only emit symbolic debugging info if the
10731 current location is not Null.
10733 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
10734 a separate method so we can profile it.
10736 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
10737 `span.Seconds' are just seconds, but no minutes or hours.
10738 (MainDriver): Profile the CodeGen.SaveSymbols calls.
10740 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10742 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
10743 Remove the gratuitous set of Final:
10745 // If an interface implementation, then we can set Final.
10746 if (((flags & MethodAttributes.Abstract) == 0) &&
10747 implementing.DeclaringType.IsInterface)
10748 flags |= MethodAttributes.Final;
10750 I do not know what I was smoking when I used that.
10753 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
10754 step into fixing the name resolution issues for delegates and
10755 unifying the toplevel name resolution.
10757 2002-03-28 Martin Baulig <martin@gnome.org>
10759 * class.cs (Method.Emit): If we have a symbol writer, call its
10760 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
10761 tell it about the current method.
10763 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
10764 writer that we're going to emit the first byte of IL code for a new
10765 statement (a new source line).
10766 (EmitContext.EmitTopBlock): If we have a symbol writer, call
10767 EmitContext.Mark() before emitting any code.
10769 * location.cs (SymbolDocument): Return null when we're Null.
10771 * statement.cs (Statement): Moved the `Location loc' variable here.
10772 (Statement.EmitBoolExpression): If we have a symbol writer, call
10773 ec.Mark() before emitting any code to tell it that we're at the
10774 beginning of a new statement.
10775 (StatementExpression): Added `Location' argument to the constructor.
10776 (Block): Added public readonly variable `StartLocation' and public
10777 variable `EndLocation'. The latter is to be set using SetEndLocation().
10778 (Block): Added constructor which takes a start and end location.
10779 (Block.SetEndLocation): New method. This sets the end location.
10780 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
10781 local variables we create.
10782 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
10783 each statement and do also mark the begin and end of the block.
10785 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
10786 tell it the current lexer.Location, use Location.Null for the end of the
10788 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
10789 current block, set its end location using SetEndLocation().
10790 (statement_expression): StatementExpression constructor now takes the
10791 lexer.Location as additional argument.
10792 (for_statement, declare_local_variables): Likewise.
10793 (declare_local_variables): When creating a new implicit block, use the
10794 new Block constructor and pass it the lexer.Location.
10796 2002-03-28 Miguel de Icaza <miguel@ximian.com>
10798 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
10799 members also on the parent interfaces recursively.
10801 2002-03-27 Miguel de Icaza <miguel@ximian.com>
10803 * report.cs: Use new formats, since Gonzalo finished the missing
10806 * expression.cs (Binary.ResolveOperator): added missing operator|
10807 operator& and operator^ for bool/bool.
10809 * cs-parser.jay: CheckDef now takes a Location argument that is
10810 used to report errors more precisly (instead of reporting the end
10811 of a definition, we try to track something which is a lot closer
10812 to the source of the problem).
10814 * cs-tokenizer.cs: Track global token use, so we can properly flag
10815 the use of #define/#undef after the first token has been seen.
10817 Also, rename the reportXXXX to Error_DescriptiveName
10819 * decl.cs (DeclSpace.IsTopLevel): Move property here from
10820 TypeContainer, so that Enum and Interface can use this too.
10822 * class.cs (TypeContainer.LookupInterfaceOrClass,
10823 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
10824 `builder' argument. Typically this was used to pass the parent
10825 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
10828 The problem is that a nested class could trigger the definition of
10829 a toplevel class, and the builder would be obviously wrong in that
10832 So we drop this argument, and we compute dynamically the
10833 TypeBuilder/ModuleBuilder (the correct information was available
10834 to us anyways from DeclSpace.Parent)
10836 * interface.cs (Interface.DefineInterface): Drop builder
10837 parameter cleanup like class.cs
10839 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
10842 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
10845 (Try.Emit): Propagate the returns value from the statement.
10847 (Return.Emit): Even if we are leavning
10849 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
10851 * modifiers.cs: Fix the computation of MethodAttributes flags.
10853 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
10855 * driver.cs: allow compilation of files that start with '/'.
10856 Add a default case when checking the argument of --target.
10858 2002-03-25 Miguel de Icaza <miguel@ximian.com>
10860 * interface.cs: Implement the same search algorithm for types in
10861 the interface code.
10863 * delegate.cs: Do not allow multiple definition.
10865 * Recovered ChangeLog that got accidentally amputated
10867 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
10869 * rootcontext.cs: Load manually enum to allow core classes to
10870 contain enumerations.
10872 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
10873 Update to new static methods in TypeManager.
10875 * typemanager.cs (GetMethod, GetConstructor): Use our
10876 implementation of FindMembers to find the members, since during
10877 corlib compilation, the types are TypeBuilders and GetMethod and
10878 GetConstructor do not work.
10880 Make all methods in TypeManager static.
10882 (InitCodeHelpers): Split the functionality from
10883 the InitCodeTypes function.
10885 * driver.cs: Call InitCodeHelpers after we have populated the
10888 * cs-parser.jay (delegate_declaration): we did not used to compute
10889 the delegate name correctly for void delegates.
10891 2002-03-24 Miguel de Icaza <miguel@ximian.com>
10893 * rootcontext.cs (RootContext): Init the interface_resolve_order
10894 and type_container_resolve_order always.
10896 (ResolveCore, BootstrapCorlib_ResolveClass,
10897 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
10898 compiler when compiling with --nostdlib
10900 * class.cs (TypeContainer.DefineType): Check that our parent is
10901 not null. This test is most important when we are bootstraping
10904 * codegen.cs: Split out the symbol writing code.
10906 2002-03-25 Martin Baulig <martin@gnome.org>
10908 * driver.cs (-g): Made -g an alias for --debug.
10910 2002-03-24 Martin Baulig <martin@gnome.org>
10912 * codegen.cs (SymbolWriter): New public variable. Returns the
10913 current symbol writer.
10914 (CodeGen): Added `bool want_debugging_support' argument to the
10915 constructor. If true, tell the ModuleBuild that we want debugging
10916 support and ask it for the ISymbolWriter.
10917 (Save): If we have a symbol writer, call it's Close() method after
10918 saving the assembly.
10920 * driver.c (--debug): New command line argument to create a
10921 debugger information file.
10923 * location.cs (SymbolDocument): New public property. Returns an
10924 ISymbolDocumentWriter object for the current source file or null
10925 if we don't have a symbol writer.
10927 2002-03-21 Miguel de Icaza <miguel@ximian.com>
10929 * driver.cs (LoadAssembly): Correctly return when all the paths
10930 have been tried and not before.
10932 * statement.cs (Switch.Emit): return the actual coverage for this
10933 statement (returns/not-returns)
10935 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
10936 switch of the statement if we are the last switch section. That
10937 kills two problems: try/catch problems (we used to emit an empty
10938 nop at the end) and switch statements where all branches would
10941 2002-03-19 Miguel de Icaza <miguel@ximian.com>
10943 * driver.cs: Add default assemblies (the equivalent to the
10944 Microsoft CSC.RSP file)
10946 * cs-tokenizer.cs: When updating `cols and setting it to zero,
10947 also update tokens_seen and set it to false.
10949 * driver.cs: Implement --recurse for Mike.
10951 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
10952 correctly splitting out the paths.
10954 2002-03-18 Miguel de Icaza <miguel@ximian.com>
10956 * interface.cs (Interface.PopulateProperty): Instead of using
10957 `parent' as the declaration space for the set parameters, use
10960 * support.cs (InternalParameters): InternalParameters constructor
10961 takes a DeclSpace instead of a TypeContainer.
10963 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
10964 types are being initialized, load the address of it before calling
10967 (New): Provide a mechanism to disable the generation of local
10968 value type temporaries when the caller will be providing us with
10969 an address to store it.
10971 (ArrayCreation.EmitDynamicInitializers): Use it.
10973 2002-03-17 Miguel de Icaza <miguel@ximian.com>
10975 * expression.cs (Invocation.EmitArguments): Only probe for array
10976 property if there is more than one argument. Sorry about that.
10978 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
10979 empty param arrays.
10981 * class.cs (Method.LabelParameters): Fix incorrect code path that
10982 prevented the `ParamArrayAttribute' from being applied to the
10985 2002-03-16 Miguel de Icaza <miguel@ximian.com>
10987 * support.cs (ReflectionParameters): Correctly compute whether the
10988 last argument is a params array. Fixes the problem with
10991 * typemanager.cs: Make the assemblies array always be non-null
10992 (empty, but non-null)
10994 * tree.cs (RecordDecl): New function that abstracts the recording
10995 of names. This reports error 101, and provides a pointer to the
10996 previous declaration. Fixes a crash in the compiler.
10998 * cs-parser.jay (constructor_declaration): Update to new grammar,
10999 and provide a constructor_body that can be empty.
11001 2002-03-15 Miguel de Icaza <miguel@ximian.com>
11003 * driver.cs: Add support for --resources.
11005 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
11006 Make all types for the various array helper methods be integer.
11008 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
11009 CheckState to ConvCast.
11011 (ConvCast): Now it takes a `checked' state argument, to avoid
11012 depending on the emit context for the conversion, and just using
11013 the resolve time setting.
11015 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
11016 instead of Invocation.EmitArguments. We do not emit the original
11017 arguments, instead we emit those which have been converted to
11018 unsigned int expressions.
11020 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
11022 * codegen.cs: ditto.
11024 * expression.cs (LocalVariableReference): Drop the use of the
11025 Store function that depended on the variable index.
11027 * statement.cs (VariableInfo): Drop the `Idx' property from this
11028 class, as this is not taking into account the indexes for
11029 temporaries tat we generate during the execution, getting the
11032 * class.cs: First emit class initializers, then call the parent
11035 * expression.cs (Binary): Fix opcode emision.
11036 (UnaryMutator.EmitCode): Support checked code generation
11038 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
11039 matches for events for both the Static and Instance scans,
11040 pointing to the same element. Fix that.
11042 2002-03-14 Miguel de Icaza <miguel@ximian.com>
11044 * rootcontext.cs (ResolveTree): Always set the
11045 interface_resolve_order, because nested interfaces will be calling
11048 * class.cs (GetInterfaceOrClass): Track the same resolution
11049 process used by TypeManager.LookupType. This fixes the nested
11050 type lookups in class declarations (separate path from
11053 (TypeContainer.DefineType): Also define nested interfaces.
11054 (TypeContainer.RegisterOrder): New public function used to
11055 register the order in which child interfaces need to be closed.
11057 Nested interfaces need to be closed after their parents have been
11060 * interface.cs (InterfaceAttr): Put all the logic for computing
11061 the interface attribute here.
11063 (DefineInterface): Register our interface order with the
11064 RootContext or with the TypeContainer depending on the case.
11066 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11068 * cs-parser.jay: rework foreach statement to work with the new
11069 changes to the policy on SimpleNames.
11071 * report.cs: support Stacktrace on warnings as well.
11073 * makefile: drop --unsafe and /unsafe from the compile.
11075 2002-03-13 Ravi Pratap <ravi@ximian.com>
11077 * ecore.cs (StandardConversionExists): Modify to take an Expression
11078 as the first parameter. Ensure we do null -> reference type conversion
11081 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
11082 temporary Expression objects.
11084 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
11086 * interface.cs: workaround bug in method overloading resolution
11087 (there is already a bugzilla bug for it).
11089 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11091 We could also solve this problem by having a separate path for
11092 performing type lookups, instead of DoResolve, we could have a
11093 ResolveType entry point, and only participating pieces of the
11094 production (simplename, deref, array) would implement this.
11096 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
11097 signal SimpleName to only resolve type names and not attempt to
11098 resolve anything else.
11100 * expression.cs (Cast): Set the flag.
11102 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
11104 * class.cs: Only report 108 if there is no `new' modifier.
11106 * cs-parser.jay: rework foreach statement to work with the new
11107 changes to the policy on SimpleNames.
11109 * report.cs: support Stacktrace on warnings as well.
11111 * makefile: drop --unsafe and /unsafe from the compile.
11113 2002-03-11 Miguel de Icaza <miguel@ximian.com>
11115 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11116 lookups here, instead of doing that at parse time. This means
11117 that our grammar will not introduce `LocalVariableReferences' as
11118 expressions at this point. That solves the problem of code like
11122 static void Main ()
11126 This is only half the fix. The full fix requires parameters to
11127 also be handled in this way.
11129 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
11130 makes the use more obvious of the DeclSpace. The
11131 ec.TypeContainer.TypeBuilder is now only used to pull the
11132 TypeBuilder for it.
11134 My theory is that I can get rid of the TypeBuilder completely from
11135 the EmitContext, and have typecasts where it is used (from
11136 DeclSpace to where it matters).
11138 The only pending problem is that the code that implements Aliases
11139 is on TypeContainer, and probably should go in DeclSpace.
11141 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11142 lookups here, instead of doing that at parse time. This means
11143 that our grammar will not introduce `LocalVariableReferences' as
11144 expressions at this point. That solves the problem of code like
11148 static void Main ()
11152 This is only half the fix. The full fix requires parameters to
11153 also be handled in this way.
11155 * class.cs (Property.DefineMethod): When implementing an interface
11156 method, set newslot, when implementing an abstract method, do not
11157 set the flag (before we tried never setting it, or always setting
11158 it, which is the difference).
11159 (Indexer.DefineMethod): same.
11160 (Method.DefineMethod): same.
11162 * ecore.cs: Only set the status used flag if we get back a Field.
11164 * attribute.cs: Temporary hack, so Paolo can keep working.
11166 2002-03-08 Ravi Pratap <ravi@ximian.com>
11168 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
11169 the unmanaged type in the case we have a MarshalAs attribute.
11171 (Resolve): Handle the case when we are parsing the special MarshalAs
11172 attribute [we need to store the unmanaged type to use later]
11174 * typemanager.cs (marshal_as_attr_type): Built in type for the
11175 MarshalAs Attribute.
11177 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
11178 on parameters and accordingly set the marshalling info.
11180 2002-03-09 Miguel de Icaza <miguel@ximian.com>
11182 * class.cs: Optimizing slightly by removing redundant code after
11183 we switched to the `NoTypes' return value.
11184 (Property.DefineMethod): use NoTypes here too.
11186 This fixes the bug I introduced in my last batch of changes.
11188 2002-03-05 Ravi Pratap <ravi@ximian.com>
11190 * tree.cs (RecordEnum): Add. We now keep track of enums too.
11192 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
11193 Enums since those are types too.
11195 * cs-parser.jay (enum_declaration): Record enums as we parse them.
11197 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
11198 thanks to a call during the lookup process.
11200 2002-03-07 Miguel de Icaza <miguel@ximian.com>
11202 * statement.cs (Foreach): Lots of work to accomodate a particular
11203 kind of foreach statement that I had not kept in mind. It is
11204 possible to have foreachs on classes that provide a GetEnumerator
11205 method that return objects that implement the "pattern" for using
11206 a foreach, there is no need to support GetEnumerator
11209 This is needed to compile nant.
11211 * decl.cs: Only report 114 if the member is not `Finalize' and if
11212 the warning level is at least 2.
11214 * class.cs: Moved the compare function from Method to
11217 (MethodSignature.InheritableMemberSignatureCompare): Add new
11218 filter function that is used to extract inheritable methods from a
11221 (Method.Define): Use the new `inheritable_method_signature_filter'
11224 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
11227 2002-03-06 Miguel de Icaza <miguel@ximian.com>
11229 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
11231 * cs-parser.jay: Add opt_semicolon to the interface declaration.
11233 * expression.cs: Pass location information to
11234 ConvertImplicitStandard.
11236 * class.cs: Added debugging code to track return values from
11239 2002-03-05 Miguel de Icaza <miguel@ximian.com>
11241 * expression.cs (Is.DoResolve): If either side of the `is' is an
11242 interface, do not flag the warning.
11244 * ecore.cs (ImplicitReferenceConversion): We need a separate test
11247 * report.cs: Allow for --fatal to be used with --probe.
11249 * typemanager.cs (NoTypes): Move the definition for the empty Type
11252 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
11254 (TypeContainer.DefineProxy): New function used to proxy to parent
11255 implementations when implementing interfaces.
11256 (TypeContainer.ParentImplements): used to lookup if our parent
11257 implements a public function that is required by an interface.
11258 (TypeContainer.VerifyPendingMethods): Hook this up.
11260 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
11261 `modules' and `assemblies' arraylists into arrays. We only grow
11262 these are the very early start up of the program, so this improves
11263 the speedof LookupType (nicely measured).
11265 * expression.cs (MakeByteBlob): Replaced unsafe code with
11266 BitConverter, as suggested by Paolo.
11268 * cfold.cs (ConstantFold.Binary): Special case: perform constant
11269 folding of string concatenation, but if either side is a string,
11270 and the other is not, then return null, and let the runtime use
11271 the concatenation on the string plus the object (using
11272 `Object.ToString').
11274 2002-03-04 Miguel de Icaza <miguel@ximian.com>
11276 Constant Folding has been implemented now.
11278 * expression.cs (Unary.Reduce): Do not throw an exception, catch
11279 the error instead on types that are not supported in one's
11282 * constant.cs (Constant and all children): New set of functions to
11283 perform implict and explicit conversions.
11285 * ecore.cs (EnumConstant): Implement the new functions to perform
11286 conversion by proxying to the child expression.
11288 * codegen.cs: (ConstantCheckState): Constant evaluation has its
11289 own separate setting that can not be turned off from the command
11290 line using --unchecked or --checked and is only controlled using
11291 the checked/unchecked statements and expressions. This setting is
11292 used by the constant folder to flag errors.
11294 * expression.cs (CheckedExpr, UncheckedExpr): Set the
11295 ConstantCheckState as well.
11297 During Resolve, they also have to flag the state, because the
11298 constant folder runs completely in the Resolve phase.
11300 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
11303 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11305 * cfold.cs: New file, this file contains the constant folder.
11307 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
11308 argument to track whether we are using the resulting address to
11309 load or store a value and provide better error messages.
11311 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
11312 new AddressOf arguments.
11314 * statement.cs (Foreach.EmitCollectionForeach): Update
11316 * expression.cs (Argument.Emit): Call AddressOf with proper
11317 arguments to track usage.
11319 (New.DoEmit): Call AddressOf with new arguments.
11321 (Unary.Emit): Adjust AddressOf call.
11323 2002-03-01 Ravi Pratap <ravi@ximian.com>
11325 * cs-parser.jay (member_access): Change the case for pre-defined types
11326 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
11329 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
11332 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
11333 essentially like methods and apply attributes like MethodImplOptions to them too.
11335 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
11338 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
11339 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
11342 * Update code everywhere accordingly.
11344 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
11346 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
11348 2002-02-28 Ravi Pratap <ravi@ximian.com>
11350 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
11351 try performing lookups against those instead of jumping straight into using
11352 the 'using' clauses.
11354 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
11356 (LookupType): Perform lookups in implicit parents too.
11358 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
11359 sequence as RootContext.LookupType.
11361 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
11362 the various cases of namespace lookups into this method.
11364 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11366 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
11367 in positional arguments)
11369 * class.cs (Operator): Update the AllowedModifiers to contain
11372 * cs-parser.jay: Update operator declaration to allow for the
11373 operator body to be empty.
11375 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
11378 2002-02-27 Miguel de Icaza <miguel@ximian.com>
11380 * class.cs (Method.Emit): Label parameters.
11382 * driver.cs: Return 1 or 0 as the program exit code.
11384 2002-02-26 Miguel de Icaza <miguel@ximian.com>
11386 * expression.cs: Special case the `null' object when trying to
11387 auto-compute the type, as anything can be explicitly converted to
11390 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
11391 spotting this Paolo.
11393 (Expression.ImplicitNumericConversion): Perform comparissions of
11394 the type using the underlying type in the case of an enumeration
11395 rather than using the enumeration type for the compare.
11397 Cope with the underlying == type case, which is not possible to
11400 (Expression.ConvertNumericExplicit): Perform comparissions of
11401 the type using the underlying type in the case of an enumeration
11402 rather than using the enumeration type for the compare.
11404 * driver.cs: If the user does not supply an extension, assume .exe
11406 * cs-parser.jay (if_statement): Rewrote so that we can track the
11407 location for the if statement.
11409 * expression.cs (Binary.ConstantFold): Only concat strings when
11410 the operation is "+", not everything ;-)
11412 * statement.cs (Statement.EmitBoolExpression): Take a location
11414 (If, While, Do): Track location.
11416 * expression.cs (Binary.ResolveOperator): In the object + string
11417 case, I was missing a call to ConvertImplicit
11419 2002-02-25 Ravi Pratap <ravi@ximian.com>
11421 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
11422 Location arguments. Ensure we use RootContext.LookupType to do our work
11423 and not try to do a direct Type.GetType and ModuleBuilder.GetType
11425 * interface.cs (PopulateMethod): Handle the type of the parameter being
11428 * expression.cs (Invocation.BetterFunction): Handle the case when we
11429 have a params method with no fixed arguments and a call is made with no
11432 2002-02-25 Miguel de Icaza <miguel@ximian.com>
11434 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
11435 the verbatim-string-literal
11437 * support.cs (InternalParameters.ParameterModifier): handle null
11439 (InternalParameters.ParameterType): ditto.
11441 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
11442 duplicating the name of the variable parameter.
11443 (GetParameterByName): Fix bug where we were not looking up array
11444 paramters if they were the only present (thanks Paolo!).
11445 (GetParameterInfo): We only have an empty set of types if both
11446 fixed and array are set to null.
11447 (GetParameterInfo-idx): Handle FixedParameter == null
11449 * cs-parser.jay: Handle the case where there is no catch
11450 statements (missing null test).
11452 2002-02-22 Miguel de Icaza <miguel@ximian.com>
11454 * driver.cs (MainDriver): Be conservative on our command line
11457 Catch DirectoryNotFoundException when calling GetFiles.
11459 (SplitPathAndPattern): Used to split the input specification into
11460 a path and a pattern that we can feed to Directory.GetFiles.
11462 2002-02-21 Miguel de Icaza <miguel@ximian.com>
11464 * statement.cs (Fixed): Implement the last case of the Fixed
11465 statement (string handling).
11467 * expression.cs (StringPtr): New class used to return a char * to
11468 a string; Used by the Fixed statement.
11470 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
11472 * expression.cs (Binary.ResolveOperator): Remove redundant
11473 MemberLookup pn parent type.
11474 Optimize union call, we do not need a union if the types are the same.
11475 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
11478 Specialize the use of MemberLookup everywhere, instead of using
11479 the default settings.
11481 (StackAlloc): Implement stackalloc keyword.
11483 * cs-parser.jay: Add rule to parse stackalloc.
11485 * driver.cs: Handle /h, /help, /?
11487 * expression.cs (MakeByteBlob): Removed the hacks we had in place
11488 before we supported unsafe code.
11490 * makefile: add --unsafe to the self compilation of mcs.
11492 2002-02-20 Miguel de Icaza <miguel@ximian.com>
11494 * expression.cs (PointerArithmetic): New class that is used to
11495 perform pointer arithmetic.
11496 (Binary.Resolve): Handle pointer arithmetic
11497 Handle pointer comparission.
11498 (ArrayPtr): Utility expression class that is used to take the
11499 address of an array.
11501 (ElementAccess): Implement array access for pointers
11503 * statement.cs (Fixed): Implement fixed statement for arrays, we
11504 are missing one more case before we are done.
11506 * expression.cs (Indirection): Implement EmitAssign and set the
11507 ExprClass to Variable. This allows pointer dereferences to be
11508 treated as variables, and to have values assigned to them.
11510 * ecore.cs (Expression.StoreFromPtr): New utility function to
11511 store values dereferencing.
11513 2002-02-20 Ravi Pratap <ravi@ximian.com>
11515 * expression.cs (Binary.ResolveOperator): Ensure that we are
11516 not trying to operate on a void type - this fixes the reported
11519 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
11520 the parent implementation is sealed.
11522 * ../errors/cs0239.cs : Add.
11524 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
11526 * typemanager.cs (unverifiable_code_type): Corresponds to
11527 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
11528 which have unsafe code in them.
11530 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
11533 2002-02-19 Miguel de Icaza <miguel@ximian.com>
11535 * cs-tokenizer.cs: Add support for @"litreal strings"
11537 Make tokenizer accept pre-processor directives
11538 on any column (remove the old C-like limitation).
11540 * rootcontext.cs (EmitCode): Emit any global attributes.
11541 (AddGlobalAttributes): Used to keep track of assembly attributes.
11543 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
11545 * cs-parser.jay: Add support for global attributes.
11547 2002-02-17 Miguel de Icaza <miguel@ximian.com>
11549 * expression.cs (Indirection): New helper class. Unary will
11550 create Indirection classes to be able to implement the
11551 IMemoryLocation interface on it.
11553 2002-02-16 Miguel de Icaza <miguel@ximian.com>
11555 * cs-parser.jay (fixed_statement): reference the right statement.
11557 * statement.cs (Fixed.Emit): Finish implementing the fixed
11558 statement for the &x case.
11560 2002-02-14 Miguel de Icaza <miguel@ximian.com>
11562 * class.cs (Property.Define, Method.Define): Remove newslot when
11565 * modifiers.cs: My use of NewSlot when `Abstract' was set was
11566 wrong. NewSlot should only be used if the `new' keyword is present.
11568 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
11569 locating our system dir. Sorry about this.
11571 2002-02-13 Miguel de Icaza <miguel@ximian.com>
11573 * driver.cs (GetSystemDir): Compute correctly the location of our
11574 system assemblies. I was using the compiler directory instead of
11575 the library directory.
11577 2002-02-13 Ravi Pratap <ravi@ximian.com>
11579 * expression.cs (BetterFunction): Put back in what Miguel commented out
11580 since it is the correct fix. The problem is elsewhere ;-)
11582 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
11583 parameters of the parms method are themselves compatible or not !
11585 (StandardConversionExists): Fix very dangerous bug where we were forgetting
11586 to check that a class implements an interface before saying that an implicit
11587 conversion was allowed. Use ImplementsInterface to do the checking.
11589 2002-02-13 Miguel de Icaza <miguel@ximian.com>
11591 * class.cs (Method.Define): Track whether we are an explicit
11592 implementation or not. And only call DefineMethodOverride if we
11593 are an explicit implementation.
11595 (Property.DefineMethod): Ditto.
11597 2002-02-11 Ravi Pratap <ravi@ximian.com>
11599 * expression.cs (BetterFunction): Catch hideous bug which was
11600 preventing us from detecting ambiguous calls due to implicit casts i.e
11603 2002-01-29 Miguel de Icaza <miguel@ximian.com>
11605 * support.cs (Pair): Remove un-needed method. I figured why I was
11606 getting the error in cs-parser.jay, the variable in a foreach loop
11607 is readonly, and the compiler does not really treat this as a variable.
11609 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
11610 instead of EQUALS in grammar.
11612 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
11614 * expression.cs (Unary.DoResolve): Check whether the argument is
11617 2002-01-28 Miguel de Icaza <miguel@ximian.com>
11619 * support.cs: Api for Pair to set a value. Despite the fact that
11620 the variables are public the MS C# compiler refuses to compile
11621 code that accesses the field if the variable is part of a foreach
11624 * statement.cs (Fixed): Begin implementation of the fixed
11627 (Block.AddVariable): Return the VariableInfo on success and null
11628 on failure instead of true/false.
11630 * cs-parser.jay (foreach): Catch errors on variables already
11631 defined (we were ignoring this value before) and properly unwind
11632 the block hierarchy
11634 (fixed_statement): grammar for the fixed statement.
11636 2002-01-25 Miguel de Icaza <miguel@ximian.com>
11638 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
11639 pointer types to be incretemented.
11641 (SizeOf): Implement.
11643 * cs-parser.jay (pointer_member_access): Implement
11644 expr->IDENTIFIER production.
11646 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
11647 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
11650 (Unary): Implement indirection.
11652 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
11653 use in non-unsafe context).
11655 (SimpleName.DoResolve): Check for pointers in field access on safe
11658 (Expression.LoadFromPtr): Factor the load-indirect code in this
11659 function. This was duplicated in UnboxCast and ParameterReference
11661 2002-01-24 Miguel de Icaza <miguel@ximian.com>
11663 * expression.cs (ComposedCast): report an error if a pointer cast
11664 is used in a safe region.
11666 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
11667 pointer type casts in unsafe context.
11669 * codegen.cs (EmitContext): Set up IsUnsafe.
11671 * cs-parser.jay (non_expression_type): Add productions for pointer
11674 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
11675 code. We should not use force into static mode if the method is
11676 not virtual. Fixes bug in MIS
11678 * statement.cs (Do.Emit, While.Emit, For.Emit,
11679 Statement.EmitBoolExpression): Add support to Do and While to
11680 propagate infinite loop as `I do return' semantics.
11682 Improve the For case to also test for boolean constants.
11684 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
11685 to the list of attributes we can add.
11687 Remove `EmitContext' argument.
11689 * class.cs (Method.Define): Apply parameter attributes.
11690 (Constructor.Define): Apply parameter attributes.
11691 (MethodCore.LabelParameters): Move here the core of labeling
11694 * support.cs (ReflectionParameters.ParameterModifier,
11695 InternalParameters.ParameterModifier): Use IsByRef on the type and
11696 only return the OUT bit for these parameters instead of in/out/ref
11699 This is because I miss-understood things. The ParameterInfo.IsIn
11700 and IsOut represent whether the parameter has the [In] and [Out]
11703 2002-01-22 Miguel de Icaza <miguel@ximian.com>
11705 * ecore.cs (FieldExpr.Emit): Release temporaries.
11707 * assign.cs (LocalTemporary.Release): new function.
11709 * codegen.cs (EmitContext.GetTemporaryStorage,
11710 EmitContext.FreeTemporaryStorage): Rework the way we deal with
11711 temporary storage. Now we can "put back" localbuilders when we
11714 2002-01-21 Miguel de Icaza <miguel@ximian.com>
11716 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
11717 need to make a copy of the variable to generate verifiable code.
11719 2002-01-19 Miguel de Icaza <miguel@ximian.com>
11721 * driver.cs: Compute dynamically the system directory.
11723 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
11724 Slower, but more generally useful. Used by the abstract
11725 registering implementation.
11727 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
11728 the rules for the special rule on Type/instances. First check if
11729 we have the same name, and if so, try that special static path
11730 rather than the instance path.
11732 2002-01-18 Miguel de Icaza <miguel@ximian.com>
11734 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
11737 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
11738 Enum, ValueType, Delegate or Array for non-corlib compiles.
11740 * cs-tokenizer.cs: Catch long identifiers (645)
11742 * typemanager.cs (IndexerPropetyName): Ravi never tested this
11745 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
11746 fix, we were returning too early, so we were not registering
11747 pending methods from abstract classes.
11749 Do not register pending methods if the class is abstract.
11751 * expression.cs (Conditional.DoResolve): Report circular implicit
11752 conversions when we neecd to compute it for conditional
11755 (Is.DoResolve): If the expression is always of the provided type,
11756 flag warning 183. If the expression can not ever be of the
11757 provided type flag warning 184.
11759 * class.cs: Catch 169 as well.
11761 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
11764 2002-01-18 Nick Drochak <ndrochak@gol.com>
11766 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
11768 2002-01-17 Miguel de Icaza <miguel@ximian.com>
11770 * interface.cs: (PopulateMethod): Check for pointers being defined
11771 only if the unsafe context is active.
11772 (PopulateProperty): ditto.
11773 (PopulateIndexer): ditto.
11775 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
11776 specified. If pointers are present, make sure that they are
11777 present in an unsafe context.
11778 (Constructor, Constructor.Define): ditto.
11779 (Field, Field.Define): ditto.
11780 (Property, Property.Define): ditto.
11781 (Event, Event.Define): ditto.
11783 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
11784 hashtable if there are classes or structs defined.
11786 * expression.cs (LocalVariableReference.DoResolve): Simplify this
11787 code, as the constant resolution moved.
11789 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
11790 the metadata, so we can flag error 133.
11792 * decl.cs (MemberCore.UnsafeOK): New function to test that a
11793 pointer is being declared in an unsafe context.
11795 2002-01-16 Miguel de Icaza <miguel@ximian.com>
11797 * modifiers.cs (Modifiers.Check): Require a Location argument.
11798 Report error 227 for Unsafe use.
11800 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
11802 * statement.cs (For.Emit): If the test is null, then report that
11803 we do `return', as we wont reach anything afterwards.
11805 (Switch.SwitchGoverningType): Track the expression that matched
11808 * driver.cs: Allow negative numbers as an error code to flag.
11810 * cs-parser.jay: Handle 1551.
11812 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
11814 2002-01-15 Miguel de Icaza <miguel@ximian.com>
11816 * cs-parser.jay: Report 1518 (type declaration can only contain
11817 class, struct, interface, enum or delegate)
11819 (switch_label): Report 1523 (keywords `case' or `default' must
11822 (opt_switch_sections): Report 1522 (empty switch)
11824 * driver.cs: Report 1515 (response file specified multiple times)
11825 Report 1516 (Source file specified multiple times).
11827 * expression.cs (Argument.Resolve): Signal 1510
11829 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
11830 access not allowed in static code)
11832 2002-01-11 Ravi Pratap <ravi@ximian.com>
11834 * typemanager.cs (IsPointerType): Utility method which we are going
11837 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
11838 the object type, so we take care of that.
11840 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
11842 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
11843 added to non-params parameters :-)
11845 * typemanager.cs (CSharpName): Include 'void' type too.
11847 (void_ptr_type): Include in the set of core types.
11849 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
11852 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
11855 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
11856 completely forgotten about it.
11858 2002-01-10 Ravi Pratap <ravi@ximian.com>
11860 * cs-parser.jay (pointer_type): Add. This begins our implementation
11861 of parsing rules for unsafe code.
11863 (unsafe_statement): Implement.
11865 (embedded_statement): Modify to include the above.
11867 * statement.cs (Unsafe): Implement new class for unsafe blocks.
11869 * codegen.cs (EmitContext.InUnsafe): Add. This determines
11870 if the current context is an unsafe one.
11872 * cs-parser.jay (local_variable_pointer_type): Since local variable types
11873 are handled differently, we need separate rules for them.
11875 (local_variable_declaration): Update to use local_variable_pointer_type
11876 to allow variable declarations of unmanaged pointer types.
11878 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
11879 in unsafe contexts.
11881 * ../errors/cs0214.cs : Add.
11883 2002-01-16 Nick Drochak <ndrochak@gol.com>
11885 * makefile: remove 'response' file when cleaning.
11887 2002-01-15 Miguel de Icaza <miguel@ximian.com>
11889 * cs-parser.jay: Report 1524.
11891 2002-01-14 Miguel de Icaza <miguel@ximian.com>
11893 * typemanager.cs (RegisterMethod): drop checking if we have
11894 registered this from here
11896 2002-01-12 Miguel de Icaza <miguel@ximian.com>
11898 * class.cs (Method.EmitDestructor): Implement calling our base
11901 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
11902 value of InFinally.
11904 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
11905 this routine and will wrap the call in a try/catch block. Deal
11908 2002-01-11 Miguel de Icaza <miguel@ximian.com>
11910 * ecore.cs (Expression.MemberLookup): instead of taking a
11911 parameter `same_type' that was used to tell whether we could
11912 access private members we compute our containing type from the
11915 (FieldExpr): Added partial support for volatile fields. This does
11916 not work for volatile fields exposed from assemblies, as I can not
11917 figure out how to extract the modreq from it.
11919 Updated all the source files to use this.
11921 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
11922 because it is referenced by MemberLookup very often.
11924 2002-01-09 Ravi Pratap <ravi@ximian.com>
11926 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
11927 TypeBuilder.GetCustomAttributes to retrieve what we need.
11929 Get rid of redundant default_member_attr_type as this is the same as
11930 default_member_type which already exists.
11932 * interface.cs, attribute.cs : Update accordingly.
11934 2002-01-08 Miguel de Icaza <miguel@ximian.com>
11936 * typemanager.cs: Enable IndexerPropertyName again. It does not
11937 work for TYpeBuilders though. Ravi, can you please fix this?
11939 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
11941 * expression.cs (Argument.Emit): Handle the case of ref objects
11942 being passed to ref functions;
11944 (ParameterReference.EmitLoad): Loads the content of the pointer
11945 without dereferencing.
11947 2002-01-07 Miguel de Icaza <miguel@ximian.com>
11949 * cs-tokenizer.cs: Implemented the pre-processing expressions.
11951 2002-01-08 Ravi Pratap <ravi@ximian.com>
11953 * class.cs (Indexer.DefineMethod): Incorporate the interface
11954 type in the name of the method if we are doing explicit interface
11957 * expression.cs (ConversionExists): Remove as it is completely obsolete.
11959 (BetterConversion): Fix extremely trivial bug where we were referring to
11960 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
11963 * ../errors/bug16.cs : Add although we have fixed it.
11965 2002-01-07 Miguel de Icaza <miguel@ximian.com>
11967 * expression.cs (BaseIndexer): Begin implementation.
11969 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
11971 * cs-parser.jay (indexer_declarator): Use qualified_identifier
11972 production directly to remove a shift/reduce, and implement
11973 explicit interface implementation.
11975 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
11976 after a floating point suffix.
11978 * expression.cs (DoNumericPromotions): Improved the conversion for
11979 uint/uint. If we have a constant, we avoid doing a typecast to a
11982 * class.cs (Indexer): Implement explicit interface implementation
11985 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
11987 * class.cs: make the default instance constructor public and hidebysig.
11989 2001-01-03 Ravi Pratap <ravi@ximian.com>
11991 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
11992 so we can call it from elsewhere.
11994 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
11995 we emit it internally if the class has a defined indexer; otherwise the user
11996 emits it by decorating the class definition with the DefaultMemberAttribute.
11998 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
11999 attribute is not used on a type which defines an indexer.
12001 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
12002 character when we skip whitespace.
12004 * ../errors/cs0646.cs : Add.
12006 2002-01-03 Miguel de Icaza <miguel@ximian.com>
12008 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
12011 * makefile: Add practical target `mcs3.exe' which builds the third
12012 generation compiler.
12014 * expression.cs (New): Fix structures constructor calling.
12016 * class.cs (Property, Method, Indexer): Emit Final flag on the
12017 method if we are an interface implementation and we are not
12020 * ecore.cs (PropertyExpr): New public field `IsBase', tells
12021 whether this property is referencing a `base' method.
12023 * expression.cs (Invocation.EmitCall): take an extra argument:
12024 is_base, this is used to determine whether the `call' or
12025 `callvirt' opcode should be used.
12028 * delegate.cs: update EmitCall.
12030 * class.cs (Method.Define): Set NewSlot for the cases where we are
12031 not implementing an interface method.
12033 (Property.Define): ditto.
12035 2002-01-02 Miguel de Icaza <miguel@ximian.com>
12037 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
12038 'r'. Allows mcs to parse itself fully.
12040 2002-01-02 Ravi Pratap <ravi@ximian.com>
12042 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
12043 of the number of initializers that require the InitializeArray method.
12045 (CheckIndices): Store the Expression in all cases - not the plain value. Also
12046 update the above field where necessary.
12048 (MakeByteBlob): Update accordingly.
12050 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
12053 (EmitDynamicInitializers): Update in accordance with the new optimization.
12055 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
12056 same OpCode applies.
12058 * cs-parser.jay : Fix some glaring errors I introduced.
12060 2002-01-01 Ravi Pratap <ravi@ximian.com>
12062 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
12063 so that we can check for name clashes there too.
12065 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
12066 for interface indexers.
12068 * interfaces.cs (Define): Emit the default member attribute.
12070 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
12071 variable was being referred to while setting the value ;-)
12073 2002-01-01 Miguel de Icaza <miguel@ximian.com>
12075 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
12076 byte-by-byte information when we know the data is zero.
12078 Make the block always a multiple of 4, because
12079 DefineInitializedData has a bug.
12081 * assign.cs: Fix, we should assign from the temporary, not from
12084 * expression.cs (MakeByteBlob): Fix my incorrect code.
12086 2001-12-31 Miguel de Icaza <miguel@ximian.com>
12088 * typemanager.cs (EnumToUnderlying): This function is used to get
12089 the underlying type from an enumeration, because it does not
12092 * constant.cs: Use the I4_S form for values between -128 and 127.
12094 * statement.cs (Block.LookupLabel): Looks up a label.
12095 (Block): Drop support for labeled blocks.
12097 (LabeledStatement): New kind of statement that represents a label
12100 (Goto): Finally implement this bad boy.
12102 * cs-parser.jay: Update to reflect new mechanism to implement
12105 2001-12-30 Miguel de Icaza <miguel@ximian.com>
12107 * codegen.cs (EmitContext.This): a codegen property that keeps the
12108 a single instance of this instead of creating many different this
12111 * delegate.cs (Delegate.DoResolve): Update to use the property;
12113 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
12115 * expression.cs (BaseAccess.DoResolve): Ditto.
12117 2001-12-29 Ravi Pratap <ravi@ximian.com>
12119 * typemanager.cs (methodimpl_attr_type): Add to hold the type
12120 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
12122 (InitCoreTypes): Update accordingly.
12124 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
12125 so we can quickly store the state.
12127 (ApplyAttributes): Set the correct implementation flags
12128 for InternalCall methods.
12130 2001-12-29 Miguel de Icaza <miguel@ximian.com>
12132 * expression.cs (EmitCall): if a method is not virtual, then do
12133 not use callvirt on it.
12135 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
12136 user defined stuff) requires the use of stobj, which takes an
12137 address on the stack instead of an array and an index. So emit
12138 the Ldelema operation for it.
12140 (EmitStoreOpcode): Use stobj for valuetypes.
12142 (UnaryMutator.EmitCode): Use the right 1 value depending on
12143 whether we are dealing with int64/uint64, float or doubles.
12145 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
12146 constructors that I implemented last night.
12148 (Constructor.IsDefault): Fix to work properly for static
12151 * cs-parser.jay (CheckDef): report method signature errors.
12152 Update error number 103 to be 132.
12154 * decl.cs: New AdditionResult enumeration value: MethodExists.
12155 Although we do this check for methods later on in the semantic
12156 analysis, catching repeated default constructors is so easy that
12157 we catch these here.
12159 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
12162 (ParameterReference.EmitAssign, Emit): handle
12165 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
12166 (ArrayAccess.EmitStoreOpcode): ditto.
12168 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
12170 * expression.cs (MakeByteBlob): Complete all the missing types
12171 (uint, short, ushort, byte, sbyte)
12173 * class.cs: Only init instance field initializers on instance
12176 Rename `constructors' to instance_constructors.
12178 (TypeContainer.AddConstructor): Only add constructors to the list
12179 if it is not static.
12181 Make sure that we handle default_static_constructor independently
12182 everywhere where we handle instance_constructors
12184 2001-12-28 Miguel de Icaza <miguel@ximian.com>
12186 * class.cs: Do not lookup or create a base initializer for a
12187 static constructor.
12189 (ConstructorInitializer.Resolve): use the proper type to lookup
12192 * cs-parser.jay: Report error 1585 (modifiers between type and name).
12194 * enum.cs, interface.cs: Remove CloseType, this is taken care by
12197 * decl.cs: CloseType is now an virtual method, the default
12198 implementation just closes this type.
12200 2001-12-28 Ravi Pratap <ravi@ximian.com>
12202 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
12203 to PreserveSig by default. Also emit HideBySig on such methods.
12205 Basically, set the defaults to standard values.
12207 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
12208 argument, if candidate is better, it can't be worse than the best !
12210 (Invocation): Re-write bits to differentiate between methods being
12211 applicable in their expanded form and their normal form - for params
12214 Get rid of use_standard everywhere as only standard conversions are allowed
12215 in overload resolution.
12217 More spec conformance.
12219 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12221 * driver.cs: Add --timestamp, to see where the compiler spends
12224 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
12225 `this' in static code.
12227 (SimpleName.DoResolve): Implement in terms of a helper function
12228 that allows static-references to be passed upstream to
12231 (Expression.ResolveWithSimpleName): Resolve specially simple
12232 names when called by MemberAccess to implement the special
12235 (Expression.ImplicitReferenceConversion): Handle conversions from
12236 Null to reference types before others, as Null's type is
12239 * expression.cs (Invocation.EmitCall): Handle the special case of
12240 calling methods declared on a reference type from a ValueType
12241 (Base classes System.Object and System.Enum)
12243 (MemberAccess.Resolve): Only perform lookups on Enumerations if
12244 the left hand side is a TypeExpr, not on every enumeration.
12246 (Binary.Resolve): If types are reference types, then do a cast to
12247 object on operators != and == of both arguments.
12249 * typemanager.cs (FindMembers): Extract instance and static
12250 members if requested.
12252 * interface.cs (PopulateProperty): Use void_type instead of null
12253 as the return type for the setter method.
12255 (PopulateIndexer): ditto.
12257 2001-12-27 Ravi Pratap <ravi@ximian.com>
12259 * support.cs (ReflectionParameters): Fix minor bug where we
12260 were examining the wrong parameter for the ParamArray attribute.
12262 Cope with requests for the type of the parameter at position
12263 greater than the params parameter's. We now return the element
12264 type of the params array as that makes more sense.
12266 * expression.cs (Invocation.IsParamsMethodApplicable): Update
12267 accordingly as we no longer have to extract the element type
12270 (Invocation.OverloadResolve): Update.
12272 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12274 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
12275 against IEnumerator, test whether the return value is a descendant
12276 of the IEnumerator interface.
12278 * class.cs (Indexer.Define): Use an auxiliary method to implement
12279 the other bits of the method definition. Begin support for
12280 explicit interface implementation.
12282 (Property.DefineMethod): Use TypeManager.void_type instead of null
12283 for an empty return value.
12285 2001-12-26 Miguel de Icaza <miguel@ximian.com>
12287 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
12288 dealing with a FieldExpr which is composed of a FieldBuilder, in
12289 the code path we did extract the constant, but we should have
12290 obtained the underlying value to be able to cast it (otherwise we
12291 end up in an infinite loop, this is what Ravi was running into).
12293 (ArrayCreation.UpdateIndices): Arrays might be empty.
12295 (MemberAccess.ResolveMemberAccess): Add support for section
12296 14.5.4.1 that deals with the special case of E.I when E is a type
12297 and something else, that I can be a reference to a static member.
12299 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
12300 handle a particular array type to create byte blobs, it is just
12301 something we dont generate byteblobs for.
12303 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
12306 * location.cs (Push): remove the key from the hashtable that we
12307 are about to add. This happens for empty files.
12309 * driver.cs: Dispose files after we have parsed them.
12311 (tokenize): new function that only runs the tokenizer on its
12312 input, for speed testing.
12314 2001-12-26 Ravi Pratap <ravi@ximian.com>
12316 * class.cs (Event.Define): Define the private field only if there
12317 are no accessors defined.
12319 * expression.cs (ResolveMemberAccess): If there is no associated
12320 field with the event, that means we have an event defined with its
12321 own accessors and we should flag error cs0070 since transforming
12322 ourselves into a field is not valid in that case.
12324 * ecore.cs (SimpleName.DoResolve): Same as above.
12326 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
12327 and charset to sane values.
12329 2001-12-25 Ravi Pratap <ravi@ximian.com>
12331 * assign.cs (DoResolve): Perform check on events only if they
12332 are being accessed outside the declaring type.
12334 * cs-parser.jay (event_declarations): Update rules to correctly
12335 set the type of the implicit parameter etc.
12337 (add_accessor, remove_accessor): Set current local parameters.
12339 * expression.cs (Binary): For delegate addition and subtraction,
12340 cast the return value from the method into the appropriate delegate
12343 2001-12-24 Ravi Pratap <ravi@ximian.com>
12345 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
12346 of these as the workaround is unnecessary.
12348 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
12349 delegate data - none of that is needed at all.
12351 Re-write bits to extract the instance expression and the delegate method
12354 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
12357 * attribute.cs (ApplyAttributes): New method to take care of common tasks
12358 of attaching attributes instead of duplicating code everywhere.
12360 * everywhere : Update code to do attribute emission using the above method.
12362 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12364 * expression.cs (IsParamsMethodApplicable): if there are not
12365 parameters, return immediately.
12367 * ecore.cs: The 0 literal can be implicity converted to an enum
12370 (SimpleName.DoResolve): First lookup the type, then lookup the
12373 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
12374 want to get its address. If the InstanceExpression is not
12375 addressable, store the result in a temporary variable, then get
12378 * codegen.cs: Only display 219 errors on warning level or above.
12380 * expression.cs (ArrayAccess): Make it implement the
12381 IMemoryLocation interface.
12383 (Binary.DoResolve): handle the operator == (object a, object b)
12384 and operator != (object a, object b) without incurring into a
12385 BoxedCast (because 5 != o should never be performed).
12387 Handle binary enumerator operators.
12389 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
12390 value type, otherwise use Ldelem_ref.
12392 Use precomputed names;
12394 (AddressOf): Implement address of
12396 * cs-parser.jay (labeled_statement): Fix recursive block
12397 addition by reworking the production.
12399 * expression.cs (New.DoEmit): New has a special case:
12401 If we are dealing with a ValueType, we have a few
12402 situations to deal with:
12404 * The target of New is a ValueType variable, that is
12405 easy, we just pass this as the variable reference
12407 * The target of New is being passed as an argument,
12408 to a boxing operation or a function that takes a
12411 In this case, we need to create a temporary variable
12412 that is the argument of New.
12415 2001-12-23 Ravi Pratap <ravi@ximian.com>
12417 * rootcontext.cs (LookupType): Check that current_type is not null before
12418 going about looking at nested types.
12420 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
12421 not implement the IAssignMethod interface any more.
12423 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
12424 where we tranform them into FieldExprs if they are being resolved from within
12425 the declaring type.
12427 * ecore.cs (SimpleName.DoResolve): Do the same here.
12429 * assign.cs (DoResolve, Emit): Clean up code considerably.
12431 * ../errors/bug10.cs : Add.
12433 * ../errors/cs0070.cs : Add.
12435 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
12437 * assign.cs : Get rid of EventIsLocal everywhere.
12439 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12441 * ecore.cs (ConvertIntLiteral): finished the implementation.
12443 * statement.cs (SwitchLabel): Convert the value we are using as a
12444 key before looking up the table.
12446 2001-12-22 Miguel de Icaza <miguel@ximian.com>
12448 * codegen.cs (EmitTopBlock): Require a Location argument now.
12450 * cs-parser.jay (constructor_declarator): We need to setup
12451 current_local_parameters before we parse the
12452 opt_constructor_initializer, to allow the variables to be bound
12453 to the constructor arguments.
12455 * rootcontext.cs (LookupType): First lookup nested classes in our
12456 class and our parents before we go looking outside our class.
12458 * expression.cs (ConstantFold): Extract/debox the values at the
12461 * rootcontext.cs (EmitCode): Resolve the constants first before we
12462 resolve the types. This is not really needed, but it helps debugging.
12464 * statement.cs: report location.
12466 * cs-parser.jay: pass location to throw statement.
12468 * driver.cs: Small bug fix.
12470 * report.cs: Updated format to be 4-zero filled digits.
12472 2001-12-22 Ravi Pratap <ravi@ximian.com>
12474 * expression.cs (CheckIndices): Fix minor bug where the wrong
12475 variable was being referred to ;-)
12477 (DoEmit): Do not call EmitStaticInitializers when the
12478 underlying type is System.Object.
12480 2001-12-21 Ravi Pratap <ravi@ximian.com>
12482 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
12483 and do the usual workaround for SRE.
12485 * class.cs (MyEventBuilder.EventType): New member to get at the type
12486 of the event, quickly.
12488 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
12490 * assign.cs (Assign.DoResolve): Handle the case when the target
12491 is an EventExpr and perform the necessary checks.
12493 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
12496 (SimpleName.MemberStaticCheck): Include check for EventExpr.
12498 (EventExpr): Set the type in the constructor itself since we
12499 are meant to be born fully resolved.
12501 (EventExpr.Define): Revert code I wrote earlier.
12503 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
12504 instance expression is null. The instance expression is a This in that case
12505 or a null, depending on whether it is a static method or not.
12507 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
12508 refers to more than one method.
12510 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
12511 and accordingly flag errors.
12513 2001-12-21 Miguel de Icaza <miguel@ximian.com>
12515 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
12517 2001-12-22 Miguel de Icaza <miguel@ximian.com>
12519 * location.cs (ToString): Provide useful rutine.
12521 2001-12-21 Miguel de Icaza <miguel@ximian.com>
12523 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
12524 objects, return the actual integral boxed.
12526 * statement.cs (SwitchLabel): define an ILLabel for each
12529 (Switch.CheckSwitch): If the value is a Literal, extract
12530 the underlying literal.
12532 Also in the unused hashtable we had, add the SwitchLabel so we can
12533 quickly look this value up.
12535 * constant.cs: Implement a bunch of new constants. Rewrite
12536 Literal based on this. Made changes everywhere to adapt to this.
12538 * expression.cs (Expression.MakeByteBlob): Optimize routine by
12539 dereferencing array only once, and also copes with enumrations.
12541 bytes are two bytes wide, not one.
12543 (Cast): Perform constant conversions.
12545 * ecore.cs (TryImplicitIntConversion): Return literals instead of
12546 wrappers to the literals here.
12548 * expression.cs (DoNumericPromotions): long literals can converted
12549 to ulong implicity (this is taken care of elsewhere, but I was
12550 missing this spot).
12552 * ecore.cs (Expression.Literalize): Make the return type Literal,
12553 to improve type checking.
12555 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
12557 2001-12-20 Miguel de Icaza <miguel@ximian.com>
12559 * literal.cs: Revert code from ravi that checked the bounds. The
12560 bounds are sane by the definition of the type itself.
12562 * typemanager.cs: Fix implementation of ImplementsInterface. We
12563 need to actually look up in our parent hierarchy for interfaces
12566 * const.cs: Use the underlying type for enumerations
12568 * delegate.cs: Compute the basename for the delegate creation,
12569 that should fix the delegate test case, and restore the correct
12570 Type Lookup semantics in rootcontext
12572 * rootcontext.cs: Revert Ravi's last patch. The correct way of
12573 referencing a nested type with the Reflection API is using the "+"
12576 * cs-parser.jay: Do not require EOF token at the end.
12578 2001-12-20 Ravi Pratap <ravi@ximian.com>
12580 * rootcontext.cs (LookupType): Concatenate type names with
12581 a '.' instead of a '+' The test suite passes again.
12583 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
12584 field of the enumeration.
12586 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
12587 the case when the member is an EventExpr.
12589 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
12590 static has an associated instance expression.
12592 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
12594 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
12596 * class.cs (Event.Define): Register event and perform appropriate checks
12599 We define the Add and Remove methods even if the use provides none because
12600 in that case, we provide default implementations ourselves.
12602 Define a private field of the type of the event. This is done by the CSC compiler
12603 and we should be doing it too ;-)
12605 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
12606 More methods we use in code we generate.
12608 (multicast_delegate_type, delegate_type): Two separate types since the distinction
12611 (InitCoreTypes): Update accordingly for the above.
12613 * class.cs (Event.Emit): Generate code for default accessors that we provide
12615 (EmitDefaultMethod): Do the job in the above.
12617 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
12620 2001-12-20 Miguel de Icaza <miguel@ximian.com>
12622 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
12623 builders even if we were missing one.
12625 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
12626 pass the Basename as our class name instead of the Name. The
12627 basename will be correctly composed for us.
12629 * parameter.cs (Paramters): Now takes a Location argument.
12631 * decl.cs (DeclSpace.LookupType): Removed convenience function and
12632 make all the code call directly LookupType in RootContext and take
12633 this chance to pass the Location information everywhere.
12635 * Everywhere: pass Location information.
12637 2001-12-19 Miguel de Icaza <miguel@ximian.com>
12639 * class.cs (Constructor.Define): Updated way of detecting the
12640 length of the parameters.
12642 (TypeContainer.DefineType): Use basename as the type name for
12645 (TypeContainer.Define): Do not recursively define types here, as
12646 definition is taken care in order by the RootContext.
12648 * tree.cs: Keep track of namespaces in a per-file basis.
12650 * parameter.cs (Parameter.ComputeSignature): Update to use
12653 (Parameters.GetSignature): ditto.
12655 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
12656 instead of a TypeContainer.
12658 (Interface.SemanticAnalysis): Use `this' instead of our parent to
12659 resolve names. Because we need to be resolve in our context, not
12662 * driver.cs: Implement response files.
12664 * class.cs (TypeContainer.DefineType): If we are defined, do not
12665 redefine ourselves.
12667 (Event.Emit): Emit the code for add/remove handlers.
12668 (Event.Define): Save the MethodBuilders for add/remove.
12670 * typemanager.cs: Use pair here too.
12672 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
12673 DictionaryEntry requires the first argument to be non-null.
12675 (enum_declaration): Compute full name for registering the
12678 (delegate_declaration): Instead of using
12679 formal_parameter_list, use opt_formal_parameter_list as the list
12682 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
12683 (EventParsing): New property that controls whether `add' and
12684 `remove' are returned as tokens or identifiers (for events);
12686 2001-12-19 Ravi Pratap <ravi@ximian.com>
12688 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
12689 use MyEventBuilder only and let it wrap the real builder for us.
12691 (MyEventBuilder): Revamp constructor etc.
12693 Implement all operations that we perform on EventBuilder in precisely the same
12696 (FindMembers): Update to use the EventBuilder member.
12698 (Event.Emit): Update accordingly.
12700 2001-12-18 Ravi Pratap <ravi@ximian.com>
12702 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
12703 by calling the appropriate methods.
12705 (GetCustomAttributes): Make stubs as they cannot possibly do anything
12708 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
12710 2001-12-17 Ravi Pratap <ravi@ximian.com>
12712 * delegate.cs (Delegate.Populate): Check that the return type
12713 and various parameters types are indeed accessible.
12715 * class.cs (Constructor.Define): Same here.
12717 (Field.Define): Ditto.
12719 (Event.Define): Ditto.
12721 (Operator.Define): Check that the underlying Method defined itself
12722 correctly - so it's MethodBuilder should not be null.
12724 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
12725 expression happens to be null.
12727 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
12728 members but as of now we don't seem to be able to do anything really useful with it.
12730 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
12731 not the EventBuilder.
12733 2001-12-18 Miguel de Icaza <miguel@ximian.com>
12735 * cs-tokenizer.cs: Add support for defines.
12736 Add support for #if, #elif, #else, #endif
12738 (eval_var): evaluates a variable.
12739 (eval): stubbed for evaluating functions.
12741 * cs-parser.jay: Pass the defines information
12743 * driver.cs: Add --define command line option.
12745 * decl.cs: Move MemberCore here.
12747 Make it the base class for DeclSpace. This allows us to catch and
12748 report 108 and 109 for everything now.
12750 * class.cs (TypeContainer.Define): Extract all the members
12751 before populating and emit the warning 108 (new keyword required
12752 to override) instead of having each member implement this.
12754 (MemberCore.Define): New abstract method, we will be using this in
12755 the warning reporting engine in Populate.
12757 (Operator.Define): Adjust to new MemberCore protocol.
12759 * const.cs (Const): This does not derive from Expression, it is a
12760 temporary object we use to create fields, it is a MemberCore.
12762 * class.cs (Method.Define): Allow the entry point to be in a
12765 * driver.cs: Rewrite the argument handler to clean it up a bit.
12767 * rootcontext.cs: Made it just an auxiliary namespace feature by
12768 making everything static.
12770 * driver.cs: Adapt code to use RootContext type name instead of
12773 * delegate.cs: Remove RootContext argument.
12775 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
12778 * class.cs (Event.Define): The lookup can fail.
12780 * cs-tokenizer.cs: Begin implementation of pre-procesor.
12782 * expression.cs: Resolve the this instance before invoking the code.
12784 2001-12-17 Miguel de Icaza <miguel@ximian.com>
12786 * cs-parser.jay: Add a production in element_access that allows
12787 the thing to become a "type" reference. This way we can parse
12788 things like "(string [])" as a type.
12790 Note that this still does not handle the more complex rules of
12794 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
12796 * ecore.cs: (CopyNewMethods): new utility function used to
12797 assemble the list of methods from running FindMembers.
12799 (MemberLookup): Rework FindMembers so that
12801 2001-12-16 Miguel de Icaza <miguel@ximian.com>
12803 * class.cs (TypeContainer): Remove Delegates who fail to be
12806 * delegate.cs (Populate): Verify that we dont get null return
12807 values. TODO: Check for AsAccessible.
12809 * cs-parser.jay: Use basename to emit error 574 (destructor should
12810 have the same name as container class), not the full name.
12812 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
12813 possible representation.
12815 Also implements integer type suffixes U and L.
12817 2001-12-15 Miguel de Icaza <miguel@ximian.com>
12819 * expression.cs (ArrayCreation.DoResolve): We need to do the
12820 argument resolution *always*.
12822 * decl.cs: Make this hold the namespace. Hold the root context as
12824 (LookupType): Move here.
12826 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
12828 * location.cs (Row, Name): Fixed the code, it was always returning
12829 references to the first file.
12831 * interface.cs: Register properties defined through interfaces.
12833 * driver.cs: Add support for globbing on the command line
12835 * class.cs (Field): Make it derive from MemberCore as well.
12838 2001-12-15 Ravi Pratap <ravi@ximian.com>
12840 * class.cs (Event::Define): Check that the type of the event is a delegate
12841 type else flag error #66.
12843 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
12846 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
12847 values of EntryPoint, CharSet etc etc.
12849 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
12851 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
12852 be null and we should ignore this. I am not sure if this is really clean. Apparently,
12853 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
12854 which needs this to do its work.
12856 * ../errors/cs0066.cs : Add.
12858 2001-12-14 Miguel de Icaza <miguel@ximian.com>
12860 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
12863 * class.cs: (MethodSignature.MethodSignature): Removed hack that
12864 clears out the parameters field.
12865 (MemberSignatureCompare): Cleanup
12867 (MemberCore): New base class used to share code between MethodCore
12870 (RegisterRequiredImplementations) BindingFlags.Public requires
12871 either BindingFlags.Instace or Static. Use instance here.
12873 (Property): Refactored code to cope better with the full spec.
12875 * parameter.cs (GetParameterInfo): Return an empty array instead
12878 * class.cs (Property): Abstract or extern properties have no bodies.
12880 * parameter.cs (GetParameterInfo): return a zero-sized array.
12882 * class.cs (TypeContainer.MethodModifiersValid): Move all the
12883 method modifier validation to the typecontainer so we can reuse
12884 this on properties.
12886 (MethodCore.ParameterTypes): return an empty sized array of types.
12888 (Property.Define): Test property modifier validity.
12890 Add tests for sealed/override too.
12892 (Method.Emit): abstract or extern methods have no bodies.
12894 2001-12-14 Ravi Pratap <ravi@ximian.com>
12896 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
12899 (Method::Define, ::Emit): Modify accordingly.
12901 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
12903 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
12905 * makefile: Pass in /unsafe.
12907 2001-12-13 Miguel de Icaza <miguel@ximian.com>
12909 * class.cs (MakeKey): Kill routine.
12911 * class.cs (TypeContainer.Define): Correctly define explicit
12912 method implementations (they require the full interface name plus
12915 * typemanager.cs: Deply the PtrHashtable here and stop using the
12916 lame keys. Things work so much better.
12918 This of course broke everyone who depended on `RegisterMethod' to
12919 do the `test for existance' test. This has to be done elsewhere.
12921 * support.cs (PtrHashtable): A hashtable that avoid comparing with
12922 the object stupid Equals method (because, that like fails all over
12923 the place). We still do not use it.
12925 * class.cs (TypeContainer.SetRequiredInterface,
12926 TypeContainer.RequireMethods): Killed these two routines and moved
12927 all the functionality to RegisterRequiredImplementations.
12929 (TypeContainer.RegisterRequiredImplementations): This routine now
12930 registers all the implementations required in an array for the
12931 interfaces and abstract methods. We use an array of structures
12932 which can be computed ahead of time to reduce memory usage and we
12933 also assume that lookups are cheap as most classes will not
12934 implement too many interfaces.
12936 We also avoid creating too many MethodSignatures.
12938 (TypeContainer.IsInterfaceMethod): Update and optionally does not
12939 clear the "pending" bit if we find that there are problems with
12942 (TypeContainer.VerifyPendingMethods): Update to report errors of
12943 methods that look like implementations but are not.
12945 (TypeContainer.Define): Add support for explicit interface method
12948 2001-12-12 Miguel de Icaza <miguel@ximian.com>
12950 * typemanager.cs: Keep track of the parameters here instead of
12951 being a feature of the TypeContainer.
12953 * class.cs: Drop the registration of parameters here, as
12954 InterfaceMethods are also interface declarations.
12956 * delegate.cs: Register methods with the TypeManager not only with
12957 the TypeContainer. This code was buggy.
12959 * interface.cs: Full registation here.
12961 2001-12-11 Miguel de Icaza <miguel@ximian.com>
12963 * expression.cs: Remove reducer for binary expressions, it can not
12966 * const.cs: Put here the code that used to go into constant.cs
12968 * constant.cs: Put here the code for constants, this is a new base
12969 class for Literals.
12971 * literal.cs: Make Literal derive from Constant.
12973 2001-12-09 Miguel de Icaza <miguel@ximian.com>
12975 * statement.cs (Return.Emit): Report error 157 if the user
12976 attempts to return from a finally block.
12978 (Return.Emit): Instead of emitting a return, jump to the end of
12981 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
12982 LocalBuilder to store the result of the function. ReturnLabel is
12983 the target where we jump.
12986 2001-12-09 Radek Doulik <rodo@ximian.com>
12988 * cs-parser.jay: remember alias in current namespace
12990 * ecore.cs (SimpleName::DoResolve): use aliases for types or
12993 * class.cs (LookupAlias): lookup alias in my_namespace
12995 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
12997 (LookupAlias): lookup alias in this and if needed in parent
13000 2001-12-08 Miguel de Icaza <miguel@ximian.com>
13004 * rootcontext.cs: (ModuleBuilder) Made static, first step into
13005 making things static. I need this to avoid passing the
13006 TypeContainer when calling ParameterType.
13008 * support.cs (InternalParameters.ParameterType): Remove ugly hack
13009 that did string manipulation to compute the type and then call
13010 GetType. Use Parameter.ParameterType instead.
13012 * cs-tokenizer.cs: Consume the suffix for floating values.
13014 * expression.cs (ParameterReference): figure out whether this is a
13015 reference parameter or not. Kill an extra variable by computing
13016 the arg_idx during emission.
13018 * parameter.cs (Parameters.GetParameterInfo): New overloaded
13019 function that returns whether a parameter is an out/ref value or not.
13021 (Parameter.ParameterType): The type of the parameter (base,
13022 without ref/out applied).
13024 (Parameter.Resolve): Perform resolution here.
13025 (Parameter.ExternalType): The full type (with ref/out applied).
13027 * statement.cs (Using.Emit, Using.EmitExpression): Implement
13028 support for expressions on the using statement.
13030 2001-12-07 Miguel de Icaza <miguel@ximian.com>
13032 * statement.cs (Using.EmitLocalVariableDecls): Split the
13033 localvariable handling of the using statement.
13035 (Block.EmitMeta): Keep track of variable count across blocks. We
13036 were reusing slots on separate branches of blocks.
13038 (Try.Emit): Emit the general code block, we were not emitting it.
13040 Check the type of the declaration to be an IDisposable or
13041 something that can be implicity converted to it.
13043 Emit conversions if required.
13045 * ecore.cs (EmptyExpression): New utility class.
13046 (Expression.ImplicitConversionExists): New utility function.
13048 2001-12-06 Miguel de Icaza <miguel@ximian.com>
13050 * statement.cs (Using): Implement.
13052 * expression.cs (LocalVariableReference): Support read only variables.
13054 * statement.cs: Remove the explicit emit for the Leave opcode.
13055 (VariableInfo): Add a readonly field.
13057 2001-12-05 Miguel de Icaza <miguel@ximian.com>
13059 * ecore.cs (ConvCast): new class used to encapsulate the various
13060 explicit integer conversions that works in both checked and
13061 unchecked contexts.
13063 (Expression.ConvertNumericExplicit): Use new ConvCast class to
13064 properly generate the overflow opcodes.
13066 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13068 * statement.cs: The correct type for the EmptyExpression is the
13069 element_type, not the variable type. Ravi pointed this out.
13071 2001-12-04 Ravi Pratap <ravi@ximian.com>
13073 * class.cs (Method::Define): Handle PInvoke methods specially
13074 by using DefinePInvokeMethod instead of the usual one.
13076 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
13077 above to do the task of extracting information and defining the method.
13079 2001-12-04 Ravi Pratap <ravi@ximian.com>
13081 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
13082 of the condition for string type.
13084 (Emit): Move that here.
13086 (ArrayCreation::CheckIndices): Keep string literals in their expression
13089 (EmitDynamicInitializers): Handle strings appropriately.
13091 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13093 * codegen.cs (EmitContext): Replace multiple variables with a
13094 single pointer to the current Switch statement.
13096 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
13099 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13103 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
13106 (Foreach.Emit): Foreach on arrays was not setting
13107 up the loop variables (for break/continue).
13109 (GotoCase): Semi-implented.
13111 2001-12-03 Ravi Pratap <ravi@ximian.com>
13113 * attribute.cs (CheckAttribute): Handle system attributes by using
13114 Attribute.GetAttributes to examine information we need.
13116 (GetValidPlaces): Same here.
13118 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
13120 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
13122 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
13124 (Method::Define): Set appropriate flags if we have a DllImport attribute.
13126 (Method::Emit): Handle the case when we are a PInvoke method.
13128 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13130 * expression.cs: Use ResolveWithSimpleName on compound names.
13132 2001-12-02 Ravi Pratap <ravi@ximian.com>
13134 * constant.cs (EmitConstant): Make sure we resolve the associated expression
13135 before trying to reduce it.
13137 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
13139 * constant.cs (LookupConstantValue): Implement.
13141 (EmitConstant): Use the above in emitting the constant.
13143 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
13144 that are user-defined by doing a LookupConstantValue on them.
13146 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
13149 2001-11-29 Miguel de Icaza <miguel@ximian.com>
13151 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
13153 (BaseAccess.DoResolve): Implement.
13155 (MemberAccess.DoResolve): Split this routine into a
13156 ResolveMemberAccess routine that can be used independently
13158 2001-11-28 Miguel de Icaza <miguel@ximian.com>
13160 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
13161 As that share bits of the implementation. Is returns a boolean,
13162 while As returns the Type that is being probed.
13164 2001-12-01 Ravi Pratap <ravi@ximian.com>
13166 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
13167 instead of a Literal - much easier.
13169 (EnumInTransit): Remove - utterly useless :-)
13171 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
13173 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
13175 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
13176 chain when we have no associated expression.
13178 2001-11-30 Ravi Pratap <ravi@ximian.com>
13180 * constant.cs (Define): Use Location while reporting the errror.
13182 Also emit a warning when 'new' is used and there is no inherited
13185 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
13188 (LookupEnumValue): Implement to lookup an enum member's value and define it
13191 (Populate): Re-write accordingly to use the above routine.
13193 2001-11-27 Miguel de Icaza <miguel@ximian.com>
13195 * expression.cs (This): Fix prototype for DoResolveLValue to
13196 override the base class DoResolveLValue.
13198 * cs-parser.cs: Report errors cs574 and cs575 (destructor
13201 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
13202 (we need to load the address of the field here). This fixes
13205 (FieldExpr.DoResolveLValue): Call the DoResolve
13206 function to initialize the Instance expression.
13208 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
13209 correctly the GetEnumerator operation on a value type.
13211 * cs-parser.jay: Add more simple parsing error catches.
13213 * statement.cs (Switch): Add support for string switches.
13214 Handle null specially.
13216 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
13218 2001-11-28 Ravi Pratap <ravi@ximian.com>
13220 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
13222 (declare_local_constant): New helper function.
13224 * statement.cs (AddConstant): Keep a separate record of constants
13226 (IsConstant): Implement to determine if a variable is a constant.
13228 (GetConstantExpression): Implement.
13230 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
13232 * statement.cs (IsVariableDefined): Re-write.
13234 2001-11-27 Ravi Pratap <ravi@ximian.com>
13236 * class.cs (TypeContainer::FindMembers): Look for constants
13237 in the case when we are looking for MemberTypes.Field
13239 * expression.cs (MemberAccess::DoResolve): Check that in the
13240 case we are a FieldExpr and a Literal, we are not being accessed
13241 by an instance reference.
13243 * cs-parser.jay (local_constant_declaration): Implement.
13245 (declaration_statement): Implement for constant declarations.
13247 2001-11-26 Miguel de Icaza <miguel@ximian.com>
13249 * statement.cs (Switch): Catch double defaults.
13251 (Switch): More work on the switch() statement
13252 implementation. It works for integral values now, need to finish
13256 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13258 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
13259 integer literals into other integer literals. To be used by
13262 2001-11-24 Ravi Pratap <ravi@ximian.com>
13264 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
13267 (EmitDynamicInitializers): Cope with the above since we extract data
13268 directly from ArrayData now.
13270 (ExpectInitializers): Keep track of whether initializers are mandatory
13273 (Bounds): Make it a hashtable to prevent the same dimension being
13274 recorded for every element in that dimension.
13276 (EmitDynamicInitializers): Fix bug which prevented the Set array method
13279 Also fix bug which was causing the indices to be emitted in the reverse
13282 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13284 * expression.cs (ArrayCreation): Implement the bits that Ravi left
13285 unfinished. They do not work, because the underlying code is
13288 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13290 * cs-parser.jay: Remove bogus fixme.
13292 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
13293 on Switch statement.
13295 2001-11-23 Ravi Pratap <ravi@ximian.com>
13297 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
13300 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
13301 parameter. Apparently, any expression is allowed.
13303 (ValidateInitializers): Update accordingly.
13305 (CheckIndices): Fix some tricky bugs thanks to recursion.
13307 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
13308 I was being completely brain-dead.
13310 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
13311 and re-write acordingly.
13313 (DelegateInvocation): Re-write accordingly.
13315 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
13317 (MakeByteBlob): Handle types more correctly.
13319 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
13320 initialization from expressions but it is incomplete because I am a complete
13323 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13325 * statement.cs (If.Emit): Fix a bug that generated incorrect code
13326 on If. Basically, we have to return `true' (ie, we do return to
13327 our caller) only if both branches of the if return.
13329 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
13330 short-circuit operators, handle them as short circuit operators.
13332 (Cast.DoResolve): Resolve type.
13333 (Cast.Cast): Take an expression as the target type.
13335 * cs-parser.jay (cast_expression): Remove old hack that only
13336 allowed a limited set of types to be handled. Now we take a
13337 unary_expression and we resolve to a type during semantic
13340 Use the grammar productions from Rhys to handle casts (this is
13341 not complete like Rhys syntax yet, we fail to handle that corner
13342 case that C# has regarding (-x), but we will get there.
13344 2001-11-22 Ravi Pratap <ravi@ximian.com>
13346 * class.cs (EmitFieldInitializer): Take care of the case when we have a
13347 field which is an array type.
13349 * cs-parser.jay (declare_local_variables): Support array initialization too.
13351 * typemanager.cs (MakeKey): Implement.
13353 (everywhere): Use the above appropriately.
13355 * cs-parser.jay (for_statement): Update for array initialization while
13356 declaring variables.
13358 * ecore.cs : The error message was correct, it's the variable's names that
13359 were misleading ;-) Make the code more readable.
13361 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
13362 the correct type etc.
13364 (ConvertExplicit): Handle Enum types by examining the underlying type.
13366 2001-11-21 Ravi Pratap <ravi@ximian.com>
13368 * parameter.cs (GetCallingConvention): Always return
13369 CallingConventions.Standard for now.
13371 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13373 * expression.cs (Binary.ResolveOperator): Update the values of `l'
13374 and `r' after calling DoNumericPromotions.
13376 * ecore.cs: Fix error message (the types were in the wrong order).
13378 * statement.cs (Foreach.ProbeCollectionType): Need to pass
13379 BindingFlags.Instance as well
13381 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
13382 implicit int literal conversion in an empty cast so that we
13383 propagate the right type upstream.
13385 (UnboxCast): new class used to unbox value types.
13386 (Expression.ConvertExplicit): Add explicit type conversions done
13389 (Expression.ImplicitNumericConversion): Oops, forgot to test for
13390 the target type before applying the implicit LongLiterals to ULong
13393 2001-11-21 Miguel de Icaza <miguel@ximian.com>
13395 * cs-parser.jay (for_statement): Reworked the way For works: now
13396 we declare manually any variables that are introduced in
13397 for_initializer to solve the problem of having out-of-band code
13398 emition (that is what got for broken).
13400 (declaration_statement): Perform the actual variable declaration
13401 that used to be done in local_variable_declaration here.
13403 (local_variable_declaration): Do not declare anything, just pass
13404 the information on a DictionaryEntry
13406 2001-11-20 Ravi Pratap <ravi@ximian.com>
13408 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
13409 re-write of the logic to now make it recursive.
13411 (UpdateIndices): Re-write accordingly.
13413 Store element data in a separate ArrayData list in the above methods.
13415 (MakeByteBlob): Implement to dump the array data into a byte array.
13417 2001-11-19 Ravi Pratap <ravi@ximian.com>
13419 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
13422 * constant.cs (Define): Implement.
13424 (EmitConstant): Re-write fully.
13426 Pass in location info.
13428 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
13431 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
13432 DictionaryEntry since we need location info too.
13434 (constant_declaration): Update accordingly.
13436 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
13437 code into another method : UpdateIndices.
13439 2001-11-18 Ravi Pratap <ravi@ximian.com>
13441 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
13442 some type checking etc.
13444 2001-11-17 Ravi Pratap <ravi@ximian.com>
13446 * expression.cs (ArrayCreation::ValidateInitializers): Implement
13447 bits to provide dimension info if the user skips doing that.
13449 Update second constructor to store the rank correctly.
13451 2001-11-16 Ravi Pratap <ravi@ximian.com>
13453 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
13454 and try to implement.
13456 * ../errors/cs0150.cs : Add.
13458 * ../errors/cs0178.cs : Add.
13460 2001-11-16 Miguel de Icaza <miguel@ximian.com>
13462 * statement.cs: Implement foreach on multi-dimensional arrays.
13464 * parameter.cs (Parameters.GetParameterByName): Also lookup the
13465 name of the params argument.
13467 * expression.cs: Use EmitStoreOpcode to get the right opcode while
13468 initializing the array.
13470 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
13471 we can use this elsewhere.
13473 * statement.cs: Finish implementation of foreach for single
13476 * cs-parser.jay: Use an out-of-band stack to pass information
13477 around, I wonder why I need this.
13479 foreach_block: Make the new foreach_block the current_block.
13481 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
13482 function used to return a static Parameters structure. Used for
13483 empty parameters, as those are created very frequently.
13485 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
13487 2001-11-15 Ravi Pratap <ravi@ximian.com>
13489 * interface.cs : Default modifier is private, not public. The
13490 make verify test passes again.
13492 2001-11-15 Ravi Pratap <ravi@ximian.com>
13494 * support.cs (ReflectionParameters): Fix logic to determine
13495 whether the last parameter is a params one. Test 9 passes again.
13497 * delegate.cs (Populate): Register the builders we define with
13498 RegisterParameterForBuilder. Test 19 passes again.
13500 * cs-parser.jay (property_declaration): Reference $6 instead
13501 of $$ to get at the location.
13503 (indexer_declaration): Similar stuff.
13505 (attribute): Ditto.
13507 * class.cs (Property): Register parameters for the Get and Set methods
13508 if they exist. Test 23 passes again.
13510 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
13511 call to EmitArguments as we are sure there aren't any params arguments.
13512 Test 32 passes again.
13514 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
13515 IndexOutOfRangeException.
13517 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
13518 Test 33 now passes again.
13520 2001-11-15 Miguel de Icaza <miguel@ximian.com>
13522 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
13523 broke a bunch of things. Will have to come up with a better way
13524 of tracking locations.
13526 * statement.cs: Implemented foreach for single dimension arrays.
13528 2001-11-09 Miguel de Icaza <miguel@ximian.com>
13530 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
13531 an error. This removes the lookup from the critical path.
13533 * cs-parser.jay: Removed use of temporary_loc, which is completely
13536 2001-11-14 Miguel de Icaza <miguel@ximian.com>
13538 * support.cs (ReflectionParameters.ParameterModifier): Report
13539 whether the argument is a PARAMS argument or not.
13541 * class.cs: Set the attribute `ParamArrayAttribute' on the
13542 parameter argument.
13544 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
13545 and cons_param_array_attribute (ConstructorInfo for
13546 ParamArrayAttribute).,
13548 * codegen.cs: Emit the return using the `Return' statement, that
13549 way we can report the error correctly for missing return values.
13551 * class.cs (Method.Emit): Clean up.
13553 * expression.cs (Argument.Resolve): Take another argument: the
13554 location where this argument is used. Notice that this is not
13555 part of the "Argument" class as to reduce the size of the
13556 structure (we know the approximate location anyways).
13558 Test if the argument is a variable-reference, if not, then
13559 complain with a 206.
13561 (Argument.Emit): Emit addresses of variables.
13563 (Argument.FullDesc): Simplify.
13565 (Invocation.DoResolve): Update for Argument.Resolve.
13567 (ElementAccess.DoResolve): ditto.
13569 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
13570 method should be virtual, as this method is always virtual.
13572 (NewDelegate.DoResolve): Update for Argument.Resolve.
13574 * class.cs (ConstructorInitializer.DoResolve): ditto.
13576 * attribute.cs (Attribute.Resolve): ditto.
13578 2001-11-13 Miguel de Icaza <miguel@ximian.com>
13580 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
13582 * expression.cs (ParameterReference): Drop IStackStorage and implement
13583 IAssignMethod instead.
13585 (LocalVariableReference): ditto.
13587 * ecore.cs (FieldExpr): Drop IStackStorage and implement
13588 IAssignMethod instead.
13590 2001-11-13 Miguel de Icaza <miguel@ximian.com>
13592 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
13593 enumerations that are used in heavily used structures derive from
13594 byte in a laughable and pathetic attempt to reduce memory usage.
13595 This is the kind of pre-optimzations that you should not do at
13596 home without adult supervision.
13598 * expression.cs (UnaryMutator): New class, used to handle ++ and
13599 -- separatedly from the other unary operators. Cleans up the
13600 code, and kills the ExpressionStatement dependency in Unary.
13602 (Unary): Removed `method' and `Arguments' from this class, making
13603 it smaller, and moving it all to SimpleCall, so I can reuse this
13604 code in other locations and avoid creating a lot of transient data
13605 strucutres when not required.
13607 * cs-parser.jay: Adjust for new changes.
13609 2001-11-11 Miguel de Icaza <miguel@ximian.com>
13611 * enum.cs (Enum.Populate): If there is a failure during
13614 * cs-parser.jay (opt_enum_base): we used to catch type errors
13615 here, but this is really incorrect. The type error should be
13616 catched during semantic analysis.
13618 2001-12-11 Ravi Pratap <ravi@ximian.com>
13620 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
13621 current_local_parameters as expected since I, in my stupidity, had forgotten
13624 * attribute.cs (GetValidPlaces): Fix stupid bug.
13626 * class.cs (Method::Emit): Perform check on applicability of attributes.
13628 (Constructor::Emit): Ditto.
13630 (Field::Emit): Ditto.
13632 (Field.Location): Store location information.
13634 (Property, Event, Indexer, Operator): Ditto.
13636 * cs-parser.jay (field_declaration): Pass in location for each field.
13638 * ../errors/cs0592.cs : Add.
13640 2001-11-12 Ravi Pratap <ravi@ximian.com>
13642 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
13644 (InitCoreTypes): Update accordingly.
13646 (RegisterAttrType, LookupAttr): Implement.
13648 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
13649 info about the same.
13651 (Resolve): Update to populate the above as necessary.
13653 (Error592): Helper.
13655 (GetValidPlaces): Helper to the above.
13657 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
13659 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
13661 2001-11-12 Ravi Pratap <ravi@ximian.com>
13663 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
13665 * ../errors/cs0617.cs : Add.
13667 2001-11-11 Ravi Pratap <ravi@ximian.com>
13669 * enum.cs (Emit): Rename to Populate to be more consistent with what
13670 we expect it to do and when exactly it is called.
13672 * class.cs, rootcontext.cs : Update accordingly.
13674 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
13675 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
13677 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
13679 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
13680 of a fieldinfo using the above, when dealing with a FieldBuilder.
13682 2001-11-10 Ravi Pratap <ravi@ximian.com>
13684 * ../errors/cs0031.cs : Add.
13686 * ../errors/cs1008.cs : Add.
13688 * ../errrors/cs0543.cs : Add.
13690 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
13693 (FindMembers): Implement.
13695 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
13696 enums and delegates too.
13698 (enum_types): Rename to builder_to_enum.
13700 (delegate_types): Rename to builder_to_delegate.
13702 * delegate.cs (FindMembers): Implement.
13704 2001-11-09 Ravi Pratap <ravi@ximian.com>
13706 * typemanager.cs (IsEnumType): Implement.
13708 * enum.cs (Emit): Re-write parts to account for the underlying type
13709 better and perform checking etc.
13711 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
13712 of the underlying type.
13714 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
13717 * enum.cs (error31): Helper to report error #31.
13719 * cs-parser.jay (enum_declaration): Store location of each member too.
13721 * enum.cs (member_to_location): New hashtable.
13723 (AddEnumMember): Update location hashtable.
13725 (Emit): Use the location of each member while reporting errors.
13727 2001-11-09 Miguel de Icaza <miguel@ximian.com>
13729 * cs-parser.jay: A for_initializer if is a
13730 local_variable_declaration really ammount to have an implicit
13731 block with the variable declaration and no initializer for for.
13733 * statement.cs (For.Emit): Cope with null initializers.
13735 This fixes the infinite loop on for initializers.
13737 2001-11-08 Miguel de Icaza <miguel@ximian.com>
13739 * enum.cs: More cleanup.
13741 * ecore.cs: Remove dead code.
13743 * class.cs (Property.Emit): More simplification.
13744 (Event.Emit): ditto.
13746 Reworked to have less levels of indentation.
13748 2001-11-08 Ravi Pratap <ravi@ximian.com>
13750 * class.cs (Property): Emit attributes.
13760 * enum.cs (Emit): Ditto.
13762 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
13765 * class.cs (Field, Event, etc.): Move attribute generation into the
13766 Emit method everywhere.
13768 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
13769 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
13770 as we had no way of defining nested enums !
13772 * rootcontext.cs : Adjust code accordingly.
13774 * typemanager.cs (AddEnumType): To keep track of enum types separately.
13776 2001-11-07 Ravi Pratap <ravi@ximian.com>
13778 * expression.cs (EvalConstantExpression): Move into ecore.cs
13780 * enum.cs (Enum): Rename some members and make them public and readonly
13781 according to our convention.
13783 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
13786 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
13788 (Enum::Emit): Write a simple version for now which doesn't try to compute
13789 expressions. I shall modify this to be more robust in just a while.
13791 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
13793 (TypeContainer::CloseType): Create the Enum types too.
13795 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
13797 * expression.cs (EvalConstantExpression): Get rid of completely.
13799 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
13800 user-defined values and other cases.
13802 (IsValidEnumLiteral): Helper function.
13804 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
13805 out there in the case we had a literal FieldExpr.
13807 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
13809 (Literalize): Revamp a bit to take two arguments.
13811 (EnumLiteral): New class which derives from Literal to wrap enum literals.
13813 2001-11-06 Ravi Pratap <ravi@ximian.com>
13815 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
13817 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
13819 (Resolve): Use the above to ensure we have proper initializers.
13821 2001-11-05 Ravi Pratap <ravi@ximian.com>
13823 * expression.cs (Expression::EvalConstantExpression): New method to
13824 evaluate constant expressions.
13826 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
13828 2001-11-07 Miguel de Icaza <miguel@ximian.com>
13830 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
13833 (Binary.ResolveOperator): Handle operator != (object a, object b)
13834 and operator == (object a, object b);
13836 (Binary.DoNumericPromotions): Indicate whether the numeric
13837 promotion was possible.
13839 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
13842 Made the ArrayAccess implement interface IAssignMethod instead of
13843 IStackStore as the order in which arguments are passed reflects
13846 * assign.cs: Instead of using expr.ExprClass to select the way of
13847 assinging, probe for the IStackStore/IAssignMethod interfaces.
13849 * typemanager.cs: Load InitializeArray definition.
13851 * rootcontext.cs (RootContext.MakeStaticData): Used to define
13852 static data that can be used to initialize arrays.
13854 2001-11-05 Miguel de Icaza <miguel@ximian.com>
13856 * expression.cs: Handle operator== and operator!= for booleans.
13858 (Conditioal.Reduce): Implement reducer for the ?: operator.
13860 (Conditional.Resolve): Implement dead code elimination.
13862 (Binary.Resolve): Catch string literals and return a new
13863 concatenated string.
13865 (Unary.Reduce): Implement reduction of unary expressions.
13867 * ecore.cs: Split out the expression core handling here.
13869 (Expression.Reduce): New method used to perform constant folding
13870 and CSE. This is needed to support constant-expressions.
13872 * statement.cs (Statement.EmitBoolExpression): Pass true and false
13873 targets, and optimize for !x.
13875 2001-11-04 Ravi Pratap <ravi@ximian.com>
13877 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
13878 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
13879 set custom atttributes.
13881 * literal.cs (Literal::GetValue): New abstract method to return the actual
13882 value of the literal, cast as an object.
13884 (*Literal): Implement GetValue method.
13886 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
13887 expressions to the arraylist but objects of type Argument.
13889 * class.cs (TypeContainer::Emit): Emit our attributes too.
13891 (Method::Emit, Constructor::Emit): Ditto.
13893 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
13894 to be ignoring earlier.
13896 2001-11-03 Ravi Pratap <ravi@ximian.com>
13898 * attribute.cs (AttributeSection::Define): Implement to do the business
13899 of constructing a CustomAttributeBuilder.
13901 (Attribute): New trivial class. Increases readability of code.
13903 * cs-parser.jay : Update accordingly.
13905 (positional_argument_list, named_argument_list, named_argument): New rules
13907 (attribute_arguments): Use the above so that we are more correct.
13909 2001-11-02 Ravi Pratap <ravi@ximian.com>
13911 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
13912 to perform all checks for a method with a params parameter.
13914 (Invocation::OverloadResolve): Update to use the above method and therefore
13915 cope correctly with params method invocations.
13917 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
13920 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
13921 constructors in our parent too because we can't afford to miss out on
13924 * attribute.cs (AttributeSection): New name for the class Attribute
13926 Other trivial changes to improve readability.
13928 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
13929 use the new class names.
13931 2001-11-01 Ravi Pratap <ravi@ximian.com>
13933 * class.cs (Method::Define): Complete definition for params types too
13935 (Indexer::Define): Ditto.
13937 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
13938 Cope everywhere with a request for info about the array parameter.
13940 2001-11-01 Ravi Pratap <ravi@ximian.com>
13942 * tree.cs (RecordNamespace): Fix up to check for the correct key.
13944 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
13945 local_variable_type to extract the string corresponding to the type.
13947 (local_variable_type): Fixup the action to use the new helper method.
13949 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
13952 * expression.cs : Clean out code which uses the above.
13954 2001-10-31 Ravi Pratap <ravi@ximian.com>
13956 * typemanager.cs (RegisterMethod): Check if we already have an existing key
13957 and bale out if necessary by returning a false.
13959 (RegisterProperty): Ditto.
13961 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
13962 and print out appropriate error messages.
13964 * interface.cs (everywhere): Ditto.
13966 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
13967 location to constructor.
13969 * class.cs (Property, Event, Indexer): Update accordingly.
13971 * ../errors/cs111.cs : Added.
13973 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
13974 of a method, as laid down by the spec.
13976 (Invocation::OverloadResolve): Use the above method.
13978 2001-10-31 Ravi Pratap <ravi@ximian.com>
13980 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
13981 now take a TypeContainer and a Parameters object.
13983 (ParameterData): Modify return type of ParameterModifier method to be
13984 Parameter.Modifier and not a string.
13986 (ReflectionParameters, InternalParameters): Update accordingly.
13988 * expression.cs (Argument::GetParameterModifier): Same here.
13990 * support.cs (InternalParameters::ParameterType): Find a better way of determining
13991 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
13992 symbol in it at all so maybe this is only for now.
13994 2001-10-30 Ravi Pratap <ravi@ximian.com>
13996 * support.cs (InternalParameters): Constructor now takes an extra argument
13997 which is the actual Parameters class.
13999 (ParameterDesc): Update to provide info on ref/out modifiers.
14001 * class.cs (everywhere): Update call to InternalParameters to pass in
14002 the second argument too.
14004 * support.cs (ParameterData): Add ParameterModifier, which is a method
14005 to return the modifier info [ref/out etc]
14007 (InternalParameters, ReflectionParameters): Implement the above.
14009 * expression.cs (Argument::ParameterModifier): Similar function to return
14010 info about the argument's modifiers.
14012 (Invocation::OverloadResolve): Update to take into account matching modifiers
14015 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
14016 a new SetFormalParameters object which we pass to InternalParameters.
14018 2001-10-30 Ravi Pratap <ravi@ximian.com>
14020 * expression.cs (NewArray): Merge into the ArrayCreation class.
14022 2001-10-29 Ravi Pratap <ravi@ximian.com>
14024 * expression.cs (NewArray): Merge classes NewBuiltinArray and
14025 NewUserdefinedArray into one as there wasn't much of a use in having
14028 * expression.cs (Argument): Change field's name to ArgType from Type.
14030 (Type): New readonly property which returns the proper type, taking into
14031 account ref/out modifiers.
14033 (everywhere): Adjust code accordingly for the above.
14035 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
14036 whether we are emitting for a ref or out parameter.
14038 * expression.cs (Argument::Emit): Use the above field to set the state.
14040 (LocalVariableReference::Emit): Update to honour the flag and emit the
14043 * parameter.cs (Attributes): Set the correct flags for ref parameters.
14045 * expression.cs (Argument::FullDesc): New function to provide a full desc.
14047 * support.cs (ParameterData): Add method ParameterDesc to the interface.
14049 (ReflectionParameters, InternalParameters): Implement the above method.
14051 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
14054 (Invocation::FullMethodDesc): Ditto.
14056 2001-10-29 Miguel de Icaza <miguel@ximian.com>
14058 * cs-parser.jay: Add extra production for the second form of array
14061 * expression.cs (ArrayCreation): Update to reflect the above
14064 * Small changes to prepare for Array initialization.
14066 2001-10-28 Miguel de Icaza <miguel@ximian.com>
14068 * typemanager.cs (ImplementsInterface): interface might be null;
14069 Deal with this problem;
14071 Also, we do store negative hits on the cache (null values), so use
14072 this instead of calling t.GetInterfaces on the type everytime.
14074 2001-10-28 Ravi Pratap <ravi@ximian.com>
14076 * typemanager.cs (IsBuiltinType): New method to help determine the same.
14078 * expression.cs (New::DoResolve): Get rid of array creation code and instead
14079 split functionality out into different classes.
14081 (New::FormArrayType): Move into NewBuiltinArray.
14083 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
14086 (NewBuiltinArray): New class to handle creation of built-in arrays.
14088 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
14089 account creation of one-dimensional arrays.
14091 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
14093 (NewUserdefinedArray::DoResolve): Implement.
14095 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
14097 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
14098 we maintain inside the TypeManager. This is necessary to perform lookups on the
14101 (LookupType): Update to perform GetType on the module builders too.
14103 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
14105 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
14107 2001-10-23 Ravi Pratap <ravi@ximian.com>
14109 * expression.cs (New::DoResolve): Implement guts of array creation.
14111 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
14113 2001-10-27 Miguel de Icaza <miguel@ximian.com>
14115 * expression.cs: Fix bug I introduced lsat night that broke
14118 (Expression.Resolve): Report a 246 error (can not resolve name)
14119 if we find a SimpleName in the stream.
14121 (Expression.ResolveLValue): Ditto.
14123 (Expression.ResolveWithSimpleName): This function is a variant of
14124 ResolveName, this one allows SimpleNames to be returned without a
14125 warning. The only consumer of SimpleNames is MemberAccess
14127 2001-10-26 Miguel de Icaza <miguel@ximian.com>
14129 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
14130 might arrive here. I have my doubts that this is correct.
14132 * statement.cs (Lock): Implement lock statement.
14134 * cs-parser.jay: Small fixes to support `lock' and `using'
14136 * cs-tokenizer.cs: Remove extra space
14138 * driver.cs: New flag --checked, allows to turn on integer math
14141 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
14142 Threading.Monitor.Exit
14144 2001-10-23 Miguel de Icaza <miguel@ximian.com>
14146 * expression.cs (IndexerAccess::DoResolveLValue): Set the
14147 Expression Class to be IndexerAccess.
14149 Notice that Indexer::DoResolve sets the eclass to Value.
14151 2001-10-22 Miguel de Icaza <miguel@ximian.com>
14153 * class.cs (TypeContainer::Emit): Emit code for indexers.
14155 * assign.cs (IAssignMethod): New interface implemented by Indexers
14156 and Properties for handling assignment.
14158 (Assign::Emit): Simplify and reuse code.
14160 * expression.cs (IndexerAccess, PropertyExpr): Implement
14161 IAssignMethod, clean up old code.
14163 2001-10-22 Ravi Pratap <ravi@ximian.com>
14165 * typemanager.cs (ImplementsInterface): New method to determine if a type
14166 implements a given interface. Provides a nice cache too.
14168 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
14171 (ConvertReferenceExplicit): Ditto.
14173 * delegate.cs (Delegate::Populate): Update to define the parameters on the
14174 various methods, with correct names etc.
14176 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
14177 Operator.UnaryNegation.
14179 * cs-parser.jay (operator_declarator): Be a little clever in the case where
14180 we have a unary plus or minus operator.
14182 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
14185 * everywhere : update accordingly.
14187 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
14190 * class.cs (Method::Define): For the case where we are implementing a method
14191 inherited from an interface, we need to set the MethodAttributes.Final flag too.
14192 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
14194 2001-10-21 Ravi Pratap <ravi@ximian.com>
14196 * interface.cs (FindMembers): Implement to work around S.R.E
14199 * typemanager.cs (IsInterfaceType): Implement.
14201 (FindMembers): Update to handle interface types too.
14203 * expression.cs (ImplicitReferenceConversion): Re-write bits which
14204 use IsAssignableFrom as that is not correct - it doesn't work.
14206 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
14207 and accordingly override EmitStatement.
14209 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
14210 using the correct logic :-)
14212 2001-10-19 Ravi Pratap <ravi@ximian.com>
14214 * ../errors/cs-11.cs : Add to demonstrate error -11
14216 2001-10-17 Miguel de Icaza <miguel@ximian.com>
14218 * assign.cs (Assign::Resolve): Resolve right hand side first, and
14219 then pass this as a hint to ResolveLValue.
14221 * expression.cs (FieldExpr): Add Location information
14223 (FieldExpr::LValueResolve): Report assignment to readonly
14226 (Expression::ExprClassFromMemberInfo): Pass location information.
14228 (Expression::ResolveLValue): Add new method that resolves an
14231 (Expression::DoResolveLValue): Default invocation calls
14234 (Indexers): New class used to keep track of indexers in a given
14237 (IStackStore): Renamed from LValue, as it did not really describe
14238 what this did. Also ResolveLValue is gone from this interface and
14239 now is part of Expression.
14241 (ElementAccess): Depending on the element access type
14243 * typemanager.cs: Add `indexer_name_type' as a Core type
14244 (System.Runtime.CompilerServices.IndexerNameAttribute)
14246 * statement.cs (Goto): Take a location.
14248 2001-10-18 Ravi Pratap <ravi@ximian.com>
14250 * delegate.cs (Delegate::VerifyDelegate): New method to verify
14251 if two delegates are compatible.
14253 (NewDelegate::DoResolve): Update to take care of the case when
14254 we instantiate a delegate from another delegate.
14256 * typemanager.cs (FindMembers): Don't even try to look up members
14257 of Delegate types for now.
14259 2001-10-18 Ravi Pratap <ravi@ximian.com>
14261 * delegate.cs (NewDelegate): New class to take care of delegate
14264 * expression.cs (New): Split the delegate related code out into
14265 the NewDelegate class.
14267 * delegate.cs (DelegateInvocation): New class to handle delegate
14270 * expression.cs (Invocation): Split out delegate related code into
14271 the DelegateInvocation class.
14273 2001-10-17 Ravi Pratap <ravi@ximian.com>
14275 * expression.cs (New::DoResolve): Implement delegate creation fully
14276 and according to the spec.
14278 (New::DoEmit): Update to handle delegates differently.
14280 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
14281 because of which we were printing out arguments in reverse order !
14283 * delegate.cs (VerifyMethod): Implement to check if the given method
14284 matches the delegate.
14286 (FullDelegateDesc): Implement.
14288 (VerifyApplicability): Implement.
14290 * expression.cs (Invocation::DoResolve): Update to accordingly handle
14291 delegate invocations too.
14293 (Invocation::Emit): Ditto.
14295 * ../errors/cs1593.cs : Added.
14297 * ../errors/cs1594.cs : Added.
14299 * delegate.cs (InstanceExpression, TargetMethod): New properties.
14301 2001-10-16 Ravi Pratap <ravi@ximian.com>
14303 * typemanager.cs (intptr_type): Core type for System.IntPtr
14305 (InitCoreTypes): Update for the same.
14307 (iasyncresult_type, asynccallback_type): Ditto.
14309 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
14312 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
14315 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
14316 the builders for the 4 members of a delegate type :-)
14318 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
14321 * expression.cs (New::DoResolve): Implement guts for delegate creation.
14323 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
14325 2001-10-15 Miguel de Icaza <miguel@ximian.com>
14327 * statement.cs (Break::Emit): Implement.
14328 (Continue::Emit): Implement.
14330 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
14331 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
14332 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
14333 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
14336 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
14337 properties that track the label for the current loop (begin of the
14338 loop and end of the loop).
14340 2001-10-15 Ravi Pratap <ravi@ximian.com>
14342 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
14343 use of emitting anything at all.
14345 * class.cs, rootcontext.cs : Get rid of calls to the same.
14347 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
14349 (Populate): Define the constructor correctly and set the implementation
14352 * typemanager.cs (delegate_types): New hashtable to hold delegates that
14355 (AddDelegateType): Implement.
14357 (IsDelegateType): Implement helper method.
14359 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
14361 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
14362 and accordingly handle it.
14364 * delegate.cs (Populate): Take TypeContainer argument.
14365 Implement bits to define the Invoke method. However, I still haven't figured out
14366 how to take care of the native int bit :-(
14368 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
14369 Qualify the name of the delegate, not its return type !
14371 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
14374 (StandardConversionExists): Checking for array types turns out to be recursive.
14376 (ConvertReferenceExplicit): Implement array conversion.
14378 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
14380 2001-10-12 Ravi Pratap <ravi@ximian.com>
14382 * cs-parser.jay (delegate_declaration): Store the fully qualified
14383 name as it is a type declaration.
14385 * delegate.cs (ReturnType, Name): Rename members to these. Make them
14388 (DefineDelegate): Renamed from Define. Does the same thing essentially,
14389 as TypeContainer::DefineType.
14391 (Populate): Method in which all the definition of the various methods (Invoke)
14394 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
14397 (CloseDelegate): Finally creates the delegate.
14399 * class.cs (TypeContainer::DefineType): Update to define delegates.
14400 (Populate, Emit and CloseType): Do the same thing here too.
14402 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
14403 delegates in all these operations.
14405 2001-10-14 Miguel de Icaza <miguel@ximian.com>
14407 * expression.cs: LocalTemporary: a new expression used to
14408 reference a temporary that has been created.
14410 * assign.cs: Handle PropertyAccess back here, so that we can
14411 provide the proper semantic access to properties.
14413 * expression.cs (Expression::ConvertReferenceExplicit): Implement
14414 a few more explicit conversions.
14416 * modifiers.cs: `NEW' modifier maps to HideBySig.
14418 * expression.cs (PropertyExpr): Make this into an
14419 ExpressionStatement, and support the EmitStatement code path.
14421 Perform get/set error checking, clean up the interface.
14423 * assign.cs: recognize PropertyExprs as targets, and if so, turn
14424 them into toplevel access objects.
14426 2001-10-12 Miguel de Icaza <miguel@ximian.com>
14428 * expression.cs: PropertyExpr::PropertyExpr: use work around the
14431 * typemanager.cs: Keep track here of our PropertyBuilders again to
14432 work around lameness in SRE.
14434 2001-10-11 Miguel de Icaza <miguel@ximian.com>
14436 * expression.cs (LValue::LValueResolve): New method in the
14437 interface, used to perform a second resolution pass for LValues.
14439 (This::DoResolve): Catch the use of this in static methods.
14441 (This::LValueResolve): Implement.
14443 (This::Store): Remove warning, assigning to `this' in structures
14446 (Invocation::Emit): Deal with invocation of
14447 methods on value types. We need to pass the address to structure
14448 methods rather than the object itself. (The equivalent code to
14449 emit "this" for structures leaves the entire structure on the
14450 stack instead of a pointer to it).
14452 (ParameterReference::DoResolve): Compute the real index for the
14453 argument based on whether the method takes or not a `this' pointer
14454 (ie, the method is static).
14456 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
14457 value types returned from functions when we need to invoke a
14458 method on the sturcture.
14461 2001-10-11 Ravi Pratap <ravi@ximian.com>
14463 * class.cs (TypeContainer::DefineType): Method to actually do the business of
14464 defining the type in the Modulebuilder or Typebuilder. This is to take
14465 care of nested types which need to be defined on the TypeBuilder using
14466 DefineNestedMethod.
14468 (TypeContainer::GetClassBases): Implement. Essentially the code from the
14469 methods in RootContext, only ported to be part of TypeContainer.
14471 (TypeContainer::GetInterfaceOrClass): Ditto.
14473 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
14475 * interface.cs (Interface::DefineInterface): New method. Does exactly
14476 what RootContext.CreateInterface did earlier, only it takes care of nested types
14479 (Interface::GetInterfaces): Move from RootContext here and port.
14481 (Interface::GetInterfaceByName): Same here.
14483 * rootcontext.cs (ResolveTree): Re-write.
14485 (PopulateTypes): Re-write.
14487 * class.cs (TypeContainer::Populate): Populate nested types too.
14488 (TypeContainer::Emit): Emit nested members too.
14490 * typemanager.cs (AddUserType): Do not make use of the FullName property,
14491 instead just use the name argument passed in as it is already fully
14494 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
14495 to TypeContainer mapping to see if a type is user-defined.
14497 * class.cs (TypeContainer::CloseType): Implement.
14499 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
14500 the default constructor.
14502 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
14505 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
14507 * interface.cs (CloseType): Create the type here.
14509 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
14512 Remove all the methods which are now in TypeContainer.
14514 2001-10-10 Ravi Pratap <ravi@ximian.com>
14516 * delegate.cs (Define): Re-write bits to define the delegate
14519 2001-10-10 Miguel de Icaza <miguel@ximian.com>
14521 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
14523 * expression.cs (ImplicitReferenceConversion): handle null as well
14524 as a source to convert to any reference type.
14526 * statement.cs (Return): Perform any implicit conversions to
14527 expected return type.
14529 Validate use of return statement.
14531 * codegen.cs (EmitContext): Pass the expected return type here.
14533 * class.cs (Method, Constructor, Property): Pass expected return
14534 type to EmitContext.
14536 2001-10-09 Miguel de Icaza <miguel@ximian.com>
14538 * expression.cs: Make DoResolve take an EmitContext instead of a
14541 Replaced `l' and `location' for `loc', for consistency.
14543 (Error, Warning): Remove unneeded Tc argument.
14545 * assign.cs, literal.cs, constant.cs: Update to new calling
14548 * codegen.cs: EmitContext now contains a flag indicating whether
14549 code is being generated in a static method or not.
14551 * cs-parser.jay: DecomposeQI, new function that replaces the old
14552 QualifiedIdentifier. Now we always decompose the assembled
14553 strings from qualified_identifier productions into a group of
14556 2001-10-08 Miguel de Icaza <miguel@ximian.com>
14558 * rootcontext.cs: Deal with field-less struct types correctly now
14559 by passing the size option to Define Type.
14561 * class.cs: Removed hack that created one static field.
14563 2001-10-07 Miguel de Icaza <miguel@ximian.com>
14565 * statement.cs: Moved most of the code generation here.
14567 2001-10-09 Ravi Pratap <ravi@ximian.com>
14569 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
14572 (ElementAccess): Remove useless bits for now - keep checks as the spec
14575 2001-10-08 Ravi Pratap <ravi@ximian.com>
14577 * expression.cs (ElementAccess::DoResolve): Remove my crap code
14578 and start performing checks according to the spec.
14580 2001-10-07 Ravi Pratap <ravi@ximian.com>
14582 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
14583 rank_specifiers instead.
14585 (rank_specifiers): Change the order in which the rank specifiers are stored
14587 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
14589 * expression.cs (ElementAccess): Implement the LValue interface too.
14591 2001-10-06 Ravi Pratap <ravi@ximian.com>
14593 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
14594 except that user defined conversions are not included.
14596 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
14597 perform the conversion of the return type, if necessary.
14599 (New::DoResolve): Check whether we are creating an array or an object
14600 and accordingly do the needful.
14602 (New::Emit): Same here.
14604 (New::DoResolve): Implement guts of array creation.
14606 (New::FormLookupType): Helper function.
14608 2001-10-07 Miguel de Icaza <miguel@ximian.com>
14610 * codegen.cs: Removed most of the code generation here, and move the
14611 corresponding code generation bits to the statement classes.
14613 Added support for try/catch/finalize and throw.
14615 * cs-parser.jay: Added support for try/catch/finalize.
14617 * class.cs: Catch static methods having the flags override,
14618 virtual or abstract.
14620 * expression.cs (UserCast): This user cast was not really doing
14621 what it was supposed to do. Which is to be born in fully resolved
14622 state. Parts of the resolution were being performed at Emit time!
14626 2001-10-05 Miguel de Icaza <miguel@ximian.com>
14628 * expression.cs: Implicity convert the result from UserCast.
14630 2001-10-05 Ravi Pratap <ravi@ximian.com>
14632 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
14633 prevented it from working correctly.
14635 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
14636 merely ConvertImplicit.
14638 2001-10-05 Miguel de Icaza <miguel@ximian.com>
14640 * typemanager.cs: Make the LookupTypeContainer function static,
14641 and not per-instance.
14643 * class.cs: Make static FindMembers (the one that takes a Type
14646 * codegen.cs: Add EmitForeach here.
14648 * cs-parser.jay: Make foreach a toplevel object instead of the
14649 inline expansion, as we need to perform semantic analysis on it.
14651 2001-10-05 Ravi Pratap <ravi@ximian.com>
14653 * expression.cs (Expression::ImplicitUserConversion): Rename to
14654 UserDefinedConversion.
14656 (Expression::UserDefinedConversion): Take an extra argument specifying
14657 whether we look for explicit user conversions too.
14659 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
14661 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
14663 (ExplicitUserConversion): Make it a call to UserDefinedConversion
14664 with the appropriate arguments.
14666 * cs-parser.jay (cast_expression): Record location too.
14668 * expression.cs (Cast): Record location info.
14670 (Expression::ConvertExplicit): Take location argument.
14672 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
14673 to determine if we are doing explicit conversions.
14675 (UserCast::Emit): Update accordingly.
14677 (Expression::ConvertExplicit): Report an error if everything fails.
14679 * ../errors/cs0030.cs : Add.
14681 2001-10-04 Miguel de Icaza <miguel@ximian.com>
14683 * modifiers.cs: If the ABSTRACT keyword is present, also set the
14684 virtual and newslot bits.
14686 * class.cs (TypeContainer::RegisterRequiredImplementations):
14687 Record methods we need.
14689 (TypeContainer::MakeKey): Helper function to make keys for
14690 MethodBases, since the Methodbase key is useless.
14692 (TypeContainer::Populate): Call RegisterRequiredImplementations
14693 before defining the methods.
14695 Create a mapping for method_builders_to_methods ahead of time
14696 instead of inside a tight loop.
14698 (::RequireMethods): Accept an object as the data to set into the
14699 hashtable so we can report interface vs abstract method mismatch.
14701 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14703 * report.cs: Make all of it static.
14705 * rootcontext.cs: Drop object_type and value_type computations, as
14706 we have those in the TypeManager anyways.
14708 Drop report instance variable too, now it is a global.
14710 * driver.cs: Use try/catch on command line handling.
14712 Add --probe option to debug the error reporting system with a test
14715 * report.cs: Add support for exiting program when a probe
14716 condition is reached.
14718 2001-10-03 Ravi Pratap <ravi@ximian.com>
14720 * expression.cs (Binary::DoNumericPromotions): Fix the case when
14721 we do a forcible conversion regardless of type, to check if
14722 ForceConversion returns a null.
14724 (Binary::error19): Use location to report error.
14726 (Unary::error23): Use location here too.
14728 * ../errors/cs0019.cs : Check in.
14730 * ../errors/cs0023.cs : Check in.
14732 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
14733 case of a non-null MethodInfo object with a length of 0 !
14735 (Binary::ResolveOperator): Flag error if overload resolution fails to find
14736 an applicable member - according to the spec :-)
14737 Also fix logic to find members in base types.
14739 (Unary::ResolveOperator): Same here.
14741 (Unary::report23): Change name to error23 and make first argument a TypeContainer
14742 as I was getting thoroughly confused between this and error19 :-)
14744 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
14745 (::FindMostEncompassedType): Implement.
14746 (::FindMostEncompassingType): Implement.
14747 (::StandardConversionExists): Implement.
14749 (UserImplicitCast): Re-vamp. We now need info about most specific
14750 source and target types so that we can do the necessary conversions.
14752 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
14753 mathematical union with no duplicates.
14755 2001-10-03 Miguel de Icaza <miguel@ximian.com>
14757 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
14758 in order from base classes to child classes, so that we can in
14759 child classes look up in our parent for method names and
14760 attributes (required for handling abstract, virtual, new, override
14761 constructs: we need to instrospect our base class, and if we dont
14762 populate the classes in order, the introspection might be
14763 incorrect. For example, a method could query its parent before
14764 the parent has any methods and would determine that the parent has
14765 no abstract methods (while it could have had them)).
14767 (RootContext::CreateType): Record the order in which we define the
14770 2001-10-02 Miguel de Icaza <miguel@ximian.com>
14772 * class.cs (TypeContainer::Populate): Also method definitions can
14773 fail now, keep track of this.
14775 (TypeContainer::FindMembers): Implement support for
14776 DeclaredOnly/noDeclaredOnly flag.
14778 (Constructor::Emit) Return the ConstructorBuilder.
14780 (Method::Emit) Return the MethodBuilder.
14781 Check for abstract or virtual methods to be public.
14783 * rootcontext.cs (RootContext::CreateType): Register all the
14784 abstract methods required for the class to be complete and the
14785 interface methods that must be implemented.
14787 * cs-parser.jay: Report error 501 (method requires body if it is
14788 not marked abstract or extern).
14790 * expression.cs (TypeOf::Emit): Implement.
14792 * typemanager.cs: runtime_handle_type, new global type.
14794 * class.cs (Property::Emit): Generate code for properties.
14796 2001-10-02 Ravi Pratap <ravi@ximian.com>
14798 * expression.cs (Unary::ResolveOperator): Find operators on base type
14799 too - we now conform exactly to the spec.
14801 (Binary::ResolveOperator): Same here.
14803 * class.cs (Operator::Define): Fix minor quirk in the tests.
14805 * ../errors/cs0215.cs : Added.
14807 * ../errors/cs0556.cs : Added.
14809 * ../errors/cs0555.cs : Added.
14811 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14813 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
14814 single integer which is really efficient
14816 2001-10-01 Ravi Pratap <ravi@ximian.com>
14818 * expression.cs (Expression::ImplicitUserConversion): Use location
14819 even in the case when we are examining True operators.
14821 * class.cs (Operator::Define): Perform extensive checks to conform
14822 with the rules for operator overloading in the spec.
14824 * expression.cs (Expression::ImplicitReferenceConversion): Implement
14825 some of the other conversions mentioned in the spec.
14827 * typemanager.cs (array_type): New static member for the System.Array built-in
14830 (cloneable_interface): For System.ICloneable interface.
14832 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
14833 we start resolving the tree and populating types.
14835 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
14837 2001-10-01 Miguel de Icaza <miguel@ximian.com>
14839 * expression.cs (Expression::ExprClassFromMemberInfo,
14840 Expression::Literalize): Create literal expressions from
14841 FieldInfos which are literals.
14843 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
14844 type casts, because they were wrong. The test suite in tests
14847 (ImplicitNumericConversion): ushort to ulong requires a widening
14850 Int32 constant to long requires widening cast as well.
14852 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
14853 for integers because the type on the stack is not i4.
14855 2001-09-30 Miguel de Icaza <miguel@ximian.com>
14857 * expression.cs (report118): require location argument.
14859 * parameter.cs: Do not dereference potential null value.
14861 * class.cs: Catch methods that lack the `new' keyword when
14862 overriding a name. Report warnings when `new' is used without
14863 anything being there to override.
14865 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
14867 * class.cs: Only add constructor to hashtable if it is non-null
14868 (as now constructors can fail on define).
14870 (TypeManager, Class, Struct): Take location arguments.
14872 Catch field instance initialization in structs as errors.
14874 accepting_filter: a new filter for FindMembers that is static so
14875 that we dont create an instance per invocation.
14877 (Constructor::Define): Catch errors where a struct constructor is
14880 * cs-parser.jay: Pass location information for various new
14883 * delegate.cs (Delegate): take a location argument.
14885 * driver.cs: Do not call EmitCode if there were problesm in the
14886 Definition of the types, as many Builders wont be there.
14888 * decl.cs (Decl::Decl): Require a location argument.
14890 * cs-tokenizer.cs: Handle properly hex constants that can not fit
14891 into integers, and find the most appropiate integer for it.
14893 * literal.cs: Implement ULongLiteral.
14895 * rootcontext.cs: Provide better information about the location of
14896 failure when CreateType fails.
14898 2001-09-29 Miguel de Icaza <miguel@ximian.com>
14900 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
14903 * expression.cs (Binary::CheckShiftArguments): Add missing type
14905 (Binary::ResolveOperator): Add type to the logical and and logical
14906 or, Bitwise And/Or and Exclusive Or code paths, it was missing
14909 (Binary::DoNumericPromotions): In the case where either argument
14910 is ulong (and most signed types combined with ulong cause an
14911 error) perform implicit integer constant conversions as well.
14913 2001-09-28 Miguel de Icaza <miguel@ximian.com>
14915 * expression.cs (UserImplicitCast): Method should always be
14917 (Invocation::BetterConversion): Simplified test for IntLiteral.
14919 (Expression::ImplicitNumericConversion): Split this routine out.
14920 Put the code that performs implicit constant integer conversions
14923 (Expression::Resolve): Become a wrapper around DoResolve so we can
14924 check eclass and type being set after resolve.
14926 (Invocation::Badness): Remove this dead function
14928 (Binary::ResolveOperator): Do not compute the expensive argumnets
14929 unless we have a union for it.
14931 (Probe::Emit): Is needs to do an isinst and then
14932 compare against null.
14934 (::CanConvert): Added Location argument. If the Location argument
14935 is null (Location.Null), then we do not report errors. This is
14936 used by the `probe' mechanism of the Explicit conversion. We do
14937 not want to generate an error for something that the user
14938 explicitly requested to be casted. But the pipeline for an
14939 explicit cast first tests for potential implicit casts.
14941 So for now, if the Location is null, it means `Probe only' to
14942 avoid adding another argument. Might have to revise this
14945 (ClassCast): New class used to type cast objects into arbitrary
14946 classes (used in Explicit Reference Conversions).
14948 Implement `as' as well.
14950 Reverted all the patches from Ravi below: they were broken:
14952 * The use of `level' as a mechanism to stop recursive
14953 invocations is wrong. That was there just to catch the
14954 bug with a strack trace but not as a way of addressing
14957 To fix the problem we have to *understand* what is going
14958 on and the interactions and come up with a plan, not
14959 just get things going.
14961 * The use of the type conversion cache that I proposed
14962 last night had an open topic: How does this work across
14963 protection domains. A user defined conversion might not
14964 be public in the location where we are applying the
14965 conversion, a different conversion might be selected
14966 (ie, private A->B (better) but public B->A (worse),
14967 inside A, A->B applies, but outside it, B->A will
14970 * On top of that (ie, even if the above is solved),
14971 conversions in a cache need to be abstract. Ie, `To
14972 convert from an Int to a Short use an OpcodeCast', not
14973 `To convert from an Int to a Short use the OpcodeCast on
14974 the variable 5' (which is what this patch was doing).
14976 2001-09-28 Ravi Pratap <ravi@ximian.com>
14978 * expression.cs (Invocation::ConversionExists): Re-write to use
14979 the conversion cache
14981 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
14982 cache all conversions done, not just user-defined ones.
14984 (Invocation::BetterConversion): The real culprit. Use ConversionExists
14985 to determine if a conversion exists instead of acutually trying to
14986 perform the conversion. It's faster too.
14988 (Expression::ConvertExplicit): Modify to use ConversionExists to check
14989 and only then attempt the implicit conversion.
14991 2001-09-28 Ravi Pratap <ravi@ximian.com>
14993 * expression.cs (ConvertImplicit): Use a cache for conversions
14994 already found. Check level of recursion and bail out if necessary.
14996 2001-09-28 Miguel de Icaza <miguel@ximian.com>
14998 * typemanager.cs (string_concat_string_string, string_concat_object_object):
14999 Export standard methods that we expect for string operations.
15001 * statement.cs (Block::UsageWarning): Track usage of variables and
15002 report the errors for not used variables.
15004 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
15007 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15009 * codegen.cs: remove unnneded code
15011 * expression.cs: Removed BuiltinTypeAccess class
15013 Fix the order in which implicit conversions are
15016 The previous fixed dropped support for boxed conversions (adding a
15017 test to the test suite now)
15019 (UserImplicitCast::CanConvert): Remove test for source being null,
15020 that code is broken. We should not feed a null to begin with, if
15021 we do, then we should track the bug where the problem originates
15022 and not try to cover it up here.
15024 Return a resolved expression of type UserImplicitCast on success
15025 rather than true/false. Ravi: this is what I was talking about,
15026 the pattern is to use a static method as a "constructor" for
15029 Also, do not create arguments until the very last minute,
15030 otherwise we always create the arguments even for lookups that
15031 will never be performed.
15033 (UserImplicitCast::Resolve): Eliminate, objects of type
15034 UserImplicitCast are born in a fully resolved state.
15036 * typemanager.cs (InitCoreTypes): Init also value_type
15037 (System.ValueType).
15039 * expression.cs (Cast::Resolve): First resolve the child expression.
15041 (LValue): Add new method AddressOf to be used by
15044 Change the argument of Store to take an EmitContext instead of an
15045 ILGenerator, because things like FieldExpr need to be able to call
15046 their children expression to generate the instance code.
15048 (Expression::Error, Expression::Warning): Sugar functions for
15051 (Expression::MemberLookup): Accept a TypeContainer instead of a
15052 Report as the first argument.
15054 (Expression::ResolvePrimary): Killed. I still want to improve
15055 this as currently the code is just not right.
15057 (Expression::ResolveMemberAccess): Simplify, but it is still
15060 (Unary::Resolve): Catch errors in AddressOf operators.
15062 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
15063 index to a byte for the short-version, or the compiler will choose
15064 the wrong Emit call, which generates the wrong data.
15066 (ParameterReference::Emit, ::Store): same.
15068 (FieldExpr::AddressOf): Implement.
15070 * typemanager.cs: TypeManager: made public variable instead of
15073 * driver.cs: document --fatal.
15075 * report.cs (ErrorMessage, WarningMessage): new names for the old
15076 Error and Warning classes.
15078 * cs-parser.jay (member_access): Turn built-in access to types
15079 into a normal simplename
15081 2001-09-27 Ravi Pratap <ravi@ximian.com>
15083 * expression.cs (Invocation::BetterConversion): Fix to cope
15084 with q being null, since this was introducing a bug.
15086 * expression.cs (ConvertImplicit): Do built-in conversions first.
15088 2001-09-27 Ravi Pratap <ravi@ximian.com>
15090 * expression.cs (UserImplicitCast::Resolve): Fix bug.
15092 2001-09-27 Ravi Pratap <ravi@ximian.com>
15094 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15095 I had introduced long ago (what's new ?).
15097 * expression.cs (UserImplicitCast::CanConvert): Static method to do
15098 the work of all the checking.
15099 (ConvertImplicit): Call CanConvert and only then create object if necessary.
15100 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
15102 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
15103 that is the right way.
15105 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
15106 overloading resolution. Use everywhere instead of cutting and pasting code.
15108 (Binary::ResolveOperator): Use MakeUnionSet.
15110 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
15111 we have to convert to bool types. Not complete yet.
15113 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15115 * typemanager.cs (TypeManager::CSharpName): support ushort.
15117 * expression.cs (Expression::TryImplicitIntConversion): Attempts
15118 to provide an expression that performsn an implicit constant int
15119 conversion (section 6.1.6).
15120 (Expression::ConvertImplicitRequired): Reworked to include
15121 implicit constant expression conversions.
15123 (Expression::ConvertNumericExplicit): Finished.
15125 (Invocation::Emit): If InstanceExpression is null, then it means
15126 that we perform a call on this.
15128 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15130 * expression.cs (Unary::Emit): Remove some dead code.
15131 (Probe): Implement Resolve and Emit for `is'.
15132 (Expression::ConvertImplicitRequired): Attempt to do constant
15133 expression conversions here. Maybe should be moved to
15134 ConvertImplicit, but I am not sure.
15135 (Expression::ImplicitLongConstantConversionPossible,
15136 Expression::ImplicitIntConstantConversionPossible): New functions
15137 that tell whether is it possible to apply an implicit constant
15138 expression conversion.
15140 (ConvertNumericExplicit): Started work on explicit numeric
15143 * cs-parser.jay: Update operator constants.
15145 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
15146 (Parameters::GetSignature): Hook up VerifyArgs here.
15147 (Parameters::VerifyArgs): Verifies that no two arguments have the
15150 * class.cs (Operator): Update the operator names to reflect the
15151 ones that the spec expects (as we are just stringizing the
15154 * expression.cs (Unary::ResolveOperator): Fix bug: Use
15155 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
15156 previous usage did only work for our methods.
15157 (Expression::ConvertImplicit): Handle decimal implicit numeric
15158 conversions as well.
15159 (Expression::InternalTypeConstructor): Used to invoke constructors
15160 on internal types for default promotions.
15162 (Unary::Emit): Implement special handling for the pre/post
15163 increment/decrement for overloaded operators, as they need to have
15164 the same semantics as the other operators.
15166 (Binary::ResolveOperator): ditto.
15167 (Invocation::ConversionExists): ditto.
15168 (UserImplicitCast::Resolve): ditto.
15170 2001-09-26 Ravi Pratap <ravi@ximian.com>
15172 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
15173 operator, return after emitting body. Regression tests pass again !
15175 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
15176 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
15177 (Invocation::OverloadResolve): Ditto.
15178 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
15180 * everywhere : update calls to the above methods accordingly.
15182 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15184 * assign.cs (Assign): Make it inherit from ExpressionStatement.
15186 * expression.cs (ExpressionStatement): New base class used for
15187 expressions that can appear in statements, so that we can provide
15188 an alternate path to generate expression that do not leave a value
15191 (Expression::Emit, and all the derivatives): We no longer return
15192 whether a value is left on the stack or not. Every expression
15193 after being emitted leaves a single value on the stack.
15195 * codegen.cs (EmitContext::EmitStatementExpression): Use the
15196 facilties of ExpressionStatement if possible.
15198 * cs-parser.jay: Update statement_expression.
15200 2001-09-25 Miguel de Icaza <miguel@ximian.com>
15202 * driver.cs: Change the wording of message
15204 2001-09-25 Ravi Pratap <ravi@ximian.com>
15206 * expression.cs (Binary::ResolveOperator): Had forgottten to set
15207 the type of the expression to the return type of the method if
15208 we have an overloaded operator match ! The regression tests pass again !
15209 (Unary::ResolveOperator): Ditto.
15211 * expression.cs (Invocation::ConversionExists): Correct the member lookup
15212 to find "op_Implicit", not "implicit" ;-)
15213 (UserImplicitCast): New class to take care of user-defined implicit conversions.
15214 (ConvertImplicit, ForceConversion): Take TypeContainer argument
15216 * everywhere : Correct calls to the above accordingly.
15218 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
15219 (ConvertImplicit): Do user-defined conversion if it exists.
15221 2001-09-24 Miguel de Icaza <miguel@ximian.com>
15223 * assign.cs: track location.
15224 (Resolve): Use implicit conversions on assignment.
15226 * literal.cs: Oops. Not good, Emit of short access values should
15227 pass (Bytes) or the wrong argument will be selected.
15229 * expression.cs (Unary::Emit): Emit code for -expr.
15231 (Unary::ResolveOperator): Handle `Substract' for non-constants
15232 (substract from zero from the non-constants).
15233 Deal with Doubles as well.
15235 (Expression::ConvertImplicitRequired): New routine that reports an
15236 error if no implicit conversion exists.
15238 (Invocation::OverloadResolve): Store the converted implicit
15239 expressions if we make them
15241 2001-09-24 Ravi Pratap <ravi@ximian.com>
15243 * class.cs (ConstructorInitializer): Take a Location argument.
15244 (ConstructorBaseInitializer): Same here.
15245 (ConstructorThisInitializer): Same here.
15247 * cs-parser.jay : Update all calls accordingly.
15249 * expression.cs (Unary, Binary, New): Take location argument.
15250 Update accordingly everywhere.
15252 * cs-parser.jay : Update all calls to the above to take a location
15255 * class.cs : Ditto.
15257 2001-09-24 Ravi Pratap <ravi@ximian.com>
15259 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
15260 (Invocation::BetterConversion): Same here
15261 (Invocation::ConversionExists): Ditto.
15263 (Invocation::ConversionExists): Implement.
15265 2001-09-22 Ravi Pratap <ravi@ximian.com>
15267 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
15268 Also take an additional TypeContainer argument.
15270 * All over : Pass in TypeContainer as argument to OverloadResolve.
15272 * typemanager.cs (CSharpName): Update to check for the string type and return
15275 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
15278 2001-09-21 Ravi Pratap <ravi@ximian.com>
15280 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
15281 (Invocation::BetterFunction): Implement.
15282 (Invocation::BetterConversion): Implement.
15283 (Invocation::ConversionExists): Skeleton, no implementation yet.
15285 Okay, things work fine !
15287 2001-09-21 Miguel de Icaza <miguel@ximian.com>
15289 * typemanager.cs: declare and load enum_type, delegate_type and
15292 * expression.cs (Expression::Emit): Now emit returns a value that
15293 tells whether a value is left on the stack or not. This strategy
15294 might be reveted tomorrow with a mechanism that would address
15295 multiple assignments.
15296 (Expression::report118): Utility routine to report mismatches on
15299 (Unary::Report23): Report impossible type/operator combination
15302 (Unary::IsIncrementableNumber): Whether the type can be
15303 incremented or decremented with add.
15304 (Unary::ResolveOperator): Also allow enumerations to be bitwise
15306 (Unary::ResolveOperator): Implement ++, !, ~,
15308 (Invocation::Emit): Deal with new Emit convetion.
15310 * All Expression derivatives: Updated their Emit method to return
15311 whether they leave values on the stack or not.
15313 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
15314 stack for expressions that are statements.
15316 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15318 * expression.cs (LValue): New interface. Must be implemented by
15320 (LocalVariableReference, ParameterReference, FieldExpr): Implement
15323 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
15324 interface for generating code, simplifies the code.
15326 2001-09-20 Ravi Pratap <ravi@ximian.com>
15328 * expression.cs (everywhere): Comment out return statements in ::Resolve
15329 methods to avoid the warnings.
15331 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15333 * driver.cs (parse): Report error 2001 if we can not open the
15336 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
15339 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
15342 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
15343 otherwise nested blocks end up with the same index.
15345 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
15347 * expression.cs: Instead of having FIXMEs in the Resolve
15348 functions, throw exceptions so it is obvious that we are facing a
15351 * cs-parser.jay (invocation_expression): Pass Location information.
15353 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
15354 Use a basename for those routines because .NET does not like paths
15357 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
15360 2001-09-19 Miguel de Icaza <miguel@ximian.com>
15362 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
15363 are loading the correct data types (throws an exception if not).
15364 (TypeManager::InitCoreTypes): Use CoreLookupType
15366 * expression.cs (Unary::ResolveOperator): return the child
15367 expression for expressions which are just +expr.
15368 (Unary::ResolveOperator): Return negative literals for -LITERAL
15369 expressions (otherwise they are Unary {Literal}).
15370 (Invocation::Badness): Take into account `Implicit constant
15371 expression conversions'.
15373 * literal.cs (LongLiteral): Implement long literal class.
15374 (IntLiteral): export the `Value' of the intliteral.
15376 2001-09-19 Ravi Pratap <ravi@ximian.com>
15378 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
15380 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
15381 instead of 'Operator'
15383 * expression.cs (Binary::ResolveOperator): Update accordingly.
15384 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
15387 * cs-parser.jay (unary_expression): Update to use the new names.
15389 * gen-treedump.cs (GetUnary): Same here.
15391 * expression.cs (Unary::Resolve): Implement.
15392 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
15393 operators are found instead of making noise ;-)
15394 (Unary::ResolveOperator): New method to do precisely the same thing which
15395 Binary::ResolveOperator does for Binary expressions.
15396 (Unary.method, .Arguments): Add.
15397 (Unary::OperName): Implement.
15398 (Unary::ForceConversion): Copy and Paste !
15400 * class.cs (Operator::Define): Fix a small bug for the case when we have
15403 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
15404 for the inbuilt operators. Only overloading works for now ;-)
15406 2001-09-18 Miguel de Icaza <miguel@ximian.com>
15408 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
15409 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
15411 * expression.cs (This::Emit): Implement.
15412 (This::Resolve): Implement.
15413 (TypeOf:Resolve): Implement.
15414 (Expression::ResolveSimpleName): Add an implicit this to instance
15416 (MemberAccess::Resolve): Deal with Parameters and Fields.
15417 Bind instance variable to Field expressions.
15418 (FieldExpr::Instance): New field used to track the expression that
15419 represents the object instance.
15420 (FieldExpr::Resolve): Track potential errors from MemberLookup not
15422 (FieldExpr::Emit): Implement.
15424 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
15425 the last instruction contains a return opcode to avoid generating
15426 the last `ret' instruction (this generates correct code, and it is
15427 nice to pass the peverify output).
15429 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
15430 initializer for static and instance variables.
15431 (Constructor::Emit): Allow initializer to be null in the case of
15432 static constructors. Only emit initializer for instance
15435 (TypeContainer::FindMembers): Return a null array if there are no
15438 Also fix the code for the MemberTypes.Method branch, as it was not
15439 scanning that for operators (or tried to access null variables before).
15441 * assign.cs (Assign::Emit): Handle instance and static fields.
15445 * driver.cs: Stop compilation if there are parse errors.
15447 * cs-parser.jay (constructor_declaration): Provide default base
15448 initializer for non-static constructors.
15449 (constructor_declarator): Do not provide a default base
15450 initializers if none was specified.
15451 Catch the fact that constructors should not have parameters.
15453 * class.cs: Do not emit parent class initializers for static
15454 constructors, that should be flagged as an error.
15456 2001-09-18 Ravi Pratap <ravi@ximian.com>
15458 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
15459 Move back code into TypeContainer::Populate.
15461 2001-09-18 Ravi Pratap <ravi@ximian.com>
15463 * class.cs (TypeContainer::AddConstructor): Fix the check to
15464 compare against Name, not Basename.
15465 (Operator::OpType): Change Plus and Minus to Add and Subtract.
15467 * cs-parser.jay : Update accordingly.
15469 * class.cs (TypeContainer::FindMembers): For the case where we are searching
15470 for methods, don't forget to look into the operators too.
15471 (RegisterMethodBuilder): Helper method to take care of this for
15472 methods, constructors and operators.
15473 (Operator::Define): Completely revamp.
15474 (Operator.OperatorMethod, MethodName): New fields.
15475 (TypeContainer::Populate): Move the registering of builders into
15476 RegisterMethodBuilder.
15477 (Operator::Emit): Re-write.
15479 * expression.cs (Binary::Emit): Comment out code path to emit method
15480 invocation stuff for the case when we have a user defined operator. I am
15481 just not able to get it right !
15483 2001-09-17 Miguel de Icaza <miguel@ximian.com>
15485 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
15488 (Expression::MemberLookup): Provide a version that allows to
15489 specify the MemberTypes and BindingFlags.
15491 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
15492 so it was not fetching variable information from outer blocks.
15494 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
15495 Beforefieldinit as it was buggy.
15497 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
15498 that Ravi put here.
15500 * class.cs (Constructor::Emit): Only emit if block is not null.
15501 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
15502 deal with this by semantically definining it as if the user had
15505 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
15506 constructors as we now "emit" them at a higher level.
15508 (TypeContainer::DefineDefaultConstructor): Used to define the
15509 default constructors if none was provided.
15511 (ConstructorInitializer): Add methods Resolve and Emit.
15513 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
15515 2001-09-17 Ravi Pratap <ravi@ximian.com>
15517 * class.cs (TypeContainer::EmitDefaultConstructor): Register
15518 the default constructor builder with our hashtable for methodbuilders
15521 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
15522 and argument_count is 0 in which case we have a match.
15523 (Binary::ResolveOperator): More null checking and miscellaneous coding
15526 2001-09-17 Ravi Pratap <ravi@ximian.com>
15528 * rootcontext.cs (IsNameSpace): Compare against null.
15530 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
15532 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
15533 and Unary::Operator.
15535 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
15538 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
15539 we have overloaded operators.
15540 (Binary::ResolveOperator): Implement the part which does the operator overload
15543 * class.cs (Operator::Emit): Implement.
15544 (TypeContainer::Emit): Emit the operators we have too.
15546 * expression.cs (Binary::Emit): Update to emit the appropriate code for
15547 the case when we have a user-defined operator.
15549 2001-09-17 Miguel de Icaza <miguel@ximian.com>
15551 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
15553 2001-09-16 Ravi Pratap <ravi@ximian.com>
15555 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
15556 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
15557 (Constructor::Emit): Implement.
15558 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
15559 if we have no work to do.
15560 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
15563 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
15564 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
15566 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
15569 2001-09-15 Ravi Pratap <ravi@ximian.com>
15571 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
15573 (Tree::RecordNamespace): Method to do what the name says ;-)
15574 (Tree::Namespaces): Property to get at the namespaces hashtable.
15576 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
15579 * rootcontext.cs (IsNamespace): Fixed it :-)
15581 2001-09-14 Miguel de Icaza <miguel@ximian.com>
15583 * class.cs (TypeContainer::FindMembers): Add support for
15585 (MethodCore): New class that encapsulates both the shared aspects
15586 of a Constructor and a Method.
15587 (Method, Constructor): Factored pieces into MethodCore.
15589 * driver.cs: Added --fatal which makes errors throw exceptions.
15590 Load System assembly as well as part of the standard library.
15592 * report.cs: Allow throwing exceptions on errors for debugging.
15594 * modifiers.cs: Do not use `parent', instead use the real type
15595 container to evaluate permission settings.
15597 * class.cs: Put Ravi's patch back in. He is right, and we will
15598 have to cope with the
15600 2001-09-14 Ravi Pratap <ravi@ximian.com>
15602 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
15603 FamORAssem, not FamANDAssem.
15605 2001-09-14 Miguel de Icaza <miguel@ximian.com>
15607 * driver.cs: Added --parse option that only parses its input files
15610 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
15611 incorrect. IsTopLevel is not used to tell whether an object is
15612 root_types or not (that can be achieved by testing this ==
15613 root_types). But to see if this is a top-level *class* (not
15614 necessarly our "toplevel" container).
15616 2001-09-14 Ravi Pratap <ravi@ximian.com>
15618 * enum.cs (Enum::Define): Modify to call the Lookup method on the
15619 parent instead of a direct call to GetType.
15621 2001-09-14 Ravi Pratap <ravi@ximian.com>
15623 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
15624 Modifiers.TypeAttr. This should just be a call to that method.
15626 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
15627 object so that we can determine if we are top-level or not.
15629 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
15632 * enum.cs (Enum::Define): Ditto.
15634 * modifiers.cs (FieldAttr): Re-write.
15636 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
15637 (TypeContainer::HaveStaticConstructor): New property to provide access
15638 to precisely that info.
15640 * modifiers.cs (MethodAttr): Re-write.
15641 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
15643 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
15644 of top-level types as claimed.
15646 2001-09-13 Miguel de Icaza <miguel@ximian.com>
15648 * expression.cs (MemberLookup): Fruitless attempt to lookup
15649 constructors. Maybe I need to emit default constructors? That
15650 might be it (currently .NET emits this for me automatically).
15651 (Invocation::OverloadResolve): Cope with Arguments == null.
15652 (Invocation::EmitArguments): new function, shared by the new
15653 constructor and us.
15654 (Invocation::Emit): Handle static and instance methods. Emit
15655 proper call instruction for virtual or non-virtual invocations.
15656 (New::Emit): Implement.
15657 (New::Resolve): Implement.
15658 (MemberAccess:Resolve): Implement.
15659 (MethodGroupExpr::InstanceExpression): used conforming to the spec
15660 to track instances.
15661 (FieldExpr::Resolve): Set type.
15663 * support.cs: Handle empty arguments.
15665 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
15666 SimpleLookup): Auxiliary routines to help parse a qualifier
15669 Update qualifier_identifier rule.
15671 * codegen.cs: Removed debugging messages.
15673 * class.cs: Make this a global thing, this acts just as a "key" to
15674 objects that we might have around.
15676 (Populate): Only initialize method_builders_to_methods once.
15678 * expression.cs (PropertyExpr): Initialize type from the
15681 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
15682 Resolve pattern. Attempt to implicitly convert value to boolean.
15685 * expression.cs: Set the type for the int32/int32 argument case.
15686 (Binary::ResolveOperator): Set the return type to boolean for
15687 comparission operators
15689 * typemanager.cs: Remove debugging print code.
15691 (Invocation::Resolve): resolve type.
15693 * class.cs: Allocate a MemberInfo of the correct size, as the code
15694 elsewhere depends on the test to reflect the correct contents.
15696 (Method::) Keep track of parameters, due to System.Reflection holes
15698 (TypeContainer::Populate): Keep track of MethodBuilders to Method
15701 (TypeContainer::FindMembers): Use ArrayList and then copy an array
15702 of the exact size and return that.
15704 (Class::LookupMethodByBuilder): New function that maps
15705 MethodBuilders to its methods. Required to locate the information
15706 on methods because System.Reflection bit us again.
15708 * support.cs: New file, contains an interface ParameterData and
15709 two implementations: ReflectionParameters and InternalParameters
15710 used to access Parameter information. We will need to grow this
15713 * expression.cs (Invocation::GetParameterData): implement a cache
15714 and a wrapper around the ParameterData creation for methods.
15715 (Invocation::OverloadResolve): Use new code.
15717 2001-09-13 Ravi Pratap <ravi@ximian.com>
15719 * class.cs (TypeContainer::EmitField): Remove and move into
15720 (Field::Define): here and modify accordingly.
15721 (Field.FieldBuilder): New member.
15722 (TypeContainer::Populate): Update accordingly.
15723 (TypeContainer::FindMembers): Implement.
15725 2001-09-13 Miguel de Icaza <miguel@ximian.com>
15727 * statement.cs: (VariableInfo::VariableType): New field to be
15728 initialized with the full type once it is resolved.
15730 2001-09-12 Miguel de Icaza <miguel@ximian.com>
15732 * parameter.cs (GetParameterInfo): Use a type cache to compute
15733 things only once, and to reuse this information
15735 * expression.cs (LocalVariableReference::Emit): Implement.
15736 (OpcodeCast::Emit): fix.
15738 (ParameterReference::Resolve): Implement.
15739 (ParameterReference::Emit): Implement.
15741 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
15742 that are expressions need to stay as Expressions.
15744 * typemanager.cs (CSharpName): Returns the C# name of a type if
15747 * expression.cs (Expression::ConvertImplicit): New function that
15748 implements implicit type conversions.
15750 (Expression::ImplicitReferenceConversion): Implements implicit
15751 reference conversions.
15753 (EmptyCast): New type for transparent casts.
15755 (OpcodeCast): New type for casts of types that are performed with
15756 a sequence of bytecodes.
15758 (BoxedCast): New type used for casting value types into reference
15759 types. Emits a box opcode.
15761 (Binary::DoNumericPromotions): Implements numeric promotions of
15762 and computation of the Binary::Type.
15764 (Binary::EmitBranchable): Optimization.
15766 (Binary::Emit): Implement code emission for expressions.
15768 * typemanager.cs (TypeManager): Added two new core types: sbyte
15771 2001-09-12 Ravi Pratap <ravi@ximian.com>
15773 * class.cs (TypeContainer::FindMembers): Method which does exactly
15774 what Type.FindMembers does, only we don't have to use reflection. No
15775 implementation yet.
15777 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
15778 typecontainer objects as we need to get at them.
15779 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
15781 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
15782 typecontainer object.
15784 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
15785 of just a Report object.
15787 2001-09-11 Ravi Pratap <ravi@ximian.com>
15789 * class.cs (Event::Define): Go back to using the prefixes "add_" and
15791 (TypeContainer::Populate): Now define the delegates of the type too.
15792 (TypeContainer.Delegates): Property to access the list of delegates defined
15795 * delegates.cs (Delegate::Define): Implement partially.
15797 * modifiers.cs (TypeAttr): Handle more flags.
15799 2001-09-11 Ravi Pratap <ravi@ximian.com>
15801 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
15803 (Operator::Define): Re-write logic to get types by using the LookupType method
15804 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
15805 (Indexer::Define): Ditto.
15806 (Event::Define): Ditto.
15807 (Property::Define): Ditto.
15809 2001-09-10 Ravi Pratap <ravi@ximian.com>
15811 * class.cs (TypeContainer::Populate): Now define operators too.
15812 (TypeContainer.Operators): New property to access the list of operators
15814 (Operator.OperatorMethodBuilder): New member to hold the method builder
15815 for the operator we are defining.
15816 (Operator::Define): Implement.
15818 2001-09-10 Ravi Pratap <ravi@ximian.com>
15820 * class.cs (Event::Define): Make the prefixes of the accessor methods
15821 addOn_ and removeOn_
15823 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
15824 of the location being passed in too. Ideally, this should go later since all
15825 error reporting should be done through the Report object.
15827 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
15828 (Populate): Iterate thru the indexers we have and define them too.
15829 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
15830 for the get and set accessors.
15831 (Indexer::Define): Implement.
15833 2001-09-09 Miguel de Icaza <miguel@ximian.com>
15835 * expression.cs (Binary::Resolve): Beginning of it. I scratched
15836 my previous implementation, did not work.
15838 * typemanager.cs: Add a couple of missing types (the longs).
15840 * literal.cs: Use TypeManager.bool_type instead of getting it.
15842 * expression.cs (EventExpr): New kind of expressions.
15843 (Expressio::ExprClassFromMemberInfo): finish
15845 2001-09-08 Miguel de Icaza <miguel@ximian.com>
15847 * assign.cs: Emit stores to static fields differently.
15849 2001-09-08 Ravi Pratap <ravi@ximian.com>
15851 * Merge in changes and adjust code to tackle conflicts. Backed out my
15852 code in Assign::Resolve ;-)
15854 2001-09-08 Ravi Pratap <ravi@ximian.com>
15856 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
15857 instead Report.Error and also pass in the location.
15858 (CSharpParser::Lexer): New readonly property to return the reference
15859 to the Tokenizer object.
15860 (declare_local_variables): Use Report.Error with location instead of plain
15864 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
15865 (Operator.CheckBinaryOperator): Ditto.
15867 * cs-parser.jay (operator_declarator): Update accordingly.
15869 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
15870 (CheckBinaryOperator): Same here.
15872 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
15873 on the name without any prefixes of namespace names etc. This is because we
15874 already might have something already fully qualified like
15875 'System.Console.WriteLine'
15877 * assign.cs (Resolve): Begin implementation. Stuck ;-)
15879 2001-09-07 Ravi Pratap <ravi@ximian.com>
15881 * cs-tokenizer.cs (location): Return a string which also contains
15884 * expression.cs (ElementAccess): New class for expressions of the
15885 type 'element access.'
15886 (BaseAccess): New class for expressions of the type 'base access.'
15887 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
15890 * cs-parser.jay (element_access): Implement action.
15891 (base_access): Implement actions.
15892 (checked_expression, unchecked_expression): Implement.
15894 * cs-parser.jay (local_variable_type): Correct and implement.
15895 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
15897 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
15899 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
15900 name and the specifiers.
15902 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
15904 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
15905 making them all public ;-)
15907 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
15910 2001-09-07 Miguel de Icaza <miguel@ximian.com>
15912 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
15914 (FieldExpr, PropertyExprs): New resolved expressions.
15915 (SimpleName::MemberStaticCheck): Perform static checks for access
15916 to non-static fields on static methods. Maybe this should be
15917 generalized for MemberAccesses.
15918 (SimpleName::ResolveSimpleName): More work on simple name
15921 * cs-parser.jay (primary_expression/qualified_identifier): track
15922 the parameter index.
15924 * codegen.cs (CodeGen::Save): Catch save exception, report error.
15925 (EmitContext::EmitBoolExpression): Chain to expression generation
15926 instead of temporary hack.
15927 (::EmitStatementExpression): Put generic expression code generation.
15929 * assign.cs (Assign::Emit): Implement variable assignments to
15930 local variables, parameters and fields.
15932 2001-09-06 Miguel de Icaza <miguel@ximian.com>
15934 * statement.cs (Block::GetVariableInfo): New method, returns the
15935 VariableInfo for a variable name in a block.
15936 (Block::GetVariableType): Implement in terms of GetVariableInfo
15938 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
15939 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
15941 2001-09-06 Ravi Pratap <ravi@ximian.com>
15943 * cs-parser.jay (operator_declaration): Continue on my quest : update
15944 to take attributes argument.
15945 (event_declaration): Ditto.
15946 (enum_declaration): Ditto.
15947 (indexer_declaration): Ditto.
15949 * class.cs (Operator::Operator): Update constructor accordingly.
15950 (Event::Event): Ditto.
15952 * delegate.cs (Delegate::Delegate): Same here.
15954 * enum.cs (Enum::Enum): Same here.
15956 2001-09-05 Ravi Pratap <ravi@ximian.com>
15958 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
15960 * ../tests/cs0658.cs : New file to demonstrate error 0658.
15962 * attribute.cs (Attributes): New class to encapsulate all attributes which were
15963 being passed around as an arraylist.
15964 (Attributes::AddAttribute): Method to add attribute sections.
15966 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
15967 (struct_declaration): Update accordingly.
15968 (constant_declaration): Update.
15969 (field_declaration): Update.
15970 (method_header): Update.
15971 (fixed_parameter): Update.
15972 (parameter_array): Ditto.
15973 (property_declaration): Ditto.
15974 (destructor_declaration): Ditto.
15976 * class.cs (Struct::Struct): Update constructors accordingly.
15977 (Class::Class): Ditto.
15978 (Field::Field): Ditto.
15979 (Method::Method): Ditto.
15980 (Property::Property): Ditto.
15981 (TypeContainer::OptAttribute): update property's return type.
15983 * interface.cs (Interface.opt_attributes): New member.
15984 (Interface::Interface): Update to take the extra Attributes argument.
15986 * parameter.cs (Parameter::Parameter): Ditto.
15988 * constant.cs (Constant::Constant): Ditto.
15990 * interface.cs (InterfaceMemberBase): New OptAttributes field.
15991 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
15992 the attributes as a parameter.
15993 (InterfaceProperty): Update constructor call.
15994 (InterfaceEvent): Ditto.
15995 (InterfaceMethod): Ditto.
15996 (InterfaceIndexer): Ditto.
15998 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
15999 pass the attributes too.
16000 (interface_event_declaration): Ditto.
16001 (interface_property_declaration): Ditto.
16002 (interface_method_declaration): Ditto.
16003 (interface_declaration): Ditto.
16005 2001-09-05 Miguel de Icaza <miguel@ximian.com>
16007 * class.cs (Method::Define): Track the "static Main" definition to
16008 create an entry point.
16010 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
16011 EntryPoint if we find it.
16013 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
16014 (EmitContext::ig): Make this variable public.
16016 * driver.cs: Make the default output file be the first file name
16017 with the .exe extension.
16019 Detect empty compilations
16021 Handle various kinds of output targets. Handle --target and
16022 rename -t to --dumper.
16024 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
16025 methods inherited from Expression return now an Expression. This
16026 will is used during the tree rewriting as we resolve them during
16029 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
16030 the spec. Missing entirely is the information about
16031 accessability of elements of it.
16033 (Expression::ExprClassFromMemberInfo): New constructor for
16034 Expressions that creates a fully initialized Expression based on
16035 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
16038 (Invocation::Resolve): Begin implementing resolution of invocations.
16040 * literal.cs (StringLiteral): Implement Emit.
16042 2001-09-05 Ravi Pratap <ravi@ximian.com>
16044 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
16047 2001-09-04 Ravi Pratap <ravi@ximian.com>
16049 * cs-parser.jay (attribute_arguments): Implement actions.
16050 (attribute): Fix bug in production. Implement action.
16051 (attribute_list): Implement.
16052 (attribute_target): Implement.
16053 (attribute_target_specifier, opt_target_specifier): Implement
16054 (CheckAttributeTarget): New method to check if the attribute target
16056 (attribute_section): Implement.
16057 (opt_attributes): Implement.
16059 * attribute.cs : New file to handle attributes.
16060 (Attribute): Class to hold attribute info.
16062 * cs-parser.jay (opt_attribute_target_specifier): Remove production
16063 (attribute_section): Modify production to use 2 different rules to
16064 achieve the same thing. 1 s/r conflict down !
16065 Clean out commented, useless, non-reducing dimension_separator rules.
16067 * class.cs (TypeContainer.attributes): New member to hold list
16068 of attributes for a type.
16069 (Struct::Struct): Modify to take one more argument, the attribute list.
16070 (Class::Class): Ditto.
16071 (Field::Field): Ditto.
16072 (Method::Method): Ditto.
16073 (Property::Property): Ditto.
16075 * cs-parser.jay (struct_declaration): Update constructor call to
16076 pass in the attributes too.
16077 (class_declaration): Ditto.
16078 (constant_declaration): Ditto.
16079 (field_declaration): Ditto.
16080 (method_header): Ditto.
16081 (fixed_parameter): Ditto.
16082 (parameter_array): Ditto.
16083 (property_declaration): Ditto.
16085 * constant.cs (Constant::Constant): Update constructor similarly.
16086 Use System.Collections.
16088 * parameter.cs (Parameter::Parameter): Update as above.
16090 2001-09-02 Ravi Pratap <ravi@ximian.com>
16092 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
16093 (TypeContainer.delegates): New member to hold list of delegates.
16095 * cs-parser.jay (delegate_declaration): Implement the action correctly
16096 this time as I seem to be on crack ;-)
16098 2001-09-02 Miguel de Icaza <miguel@ximian.com>
16100 * rootcontext.cs (RootContext::IsNamespace): new function, used to
16101 tell whether an identifier represents a namespace.
16103 * expression.cs (NamespaceExpr): A namespace expression, used only
16104 temporarly during expression resolution.
16105 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
16106 utility functions to resolve names on expressions.
16108 2001-09-01 Miguel de Icaza <miguel@ximian.com>
16110 * codegen.cs: Add hook for StatementExpressions.
16112 * class.cs: Fix inverted test for static flag in methods.
16114 2001-09-02 Ravi Pratap <ravi@ximian.com>
16116 * class.cs (Operator::CheckUnaryOperator): Correct error number used
16117 to make it coincide with MS' number.
16118 (Operator::CheckBinaryOperator): Ditto.
16120 * ../errors/errors.txt : Remove error numbers added earlier.
16122 * ../errors/cs1019.cs : Test case for error # 1019
16124 * ../errros/cs1020.cs : Test case for error # 1020
16126 * cs-parser.jay : Clean out commented cruft.
16127 (dimension_separators, dimension_separator): Comment out. Ostensibly not
16128 used anywhere - non-reducing rule.
16129 (namespace_declarations): Non-reducing rule - comment out.
16131 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
16132 with TypeContainer::AddEnum.
16134 * delegate.cs : New file for delegate handling classes.
16135 (Delegate): Class for declaring delegates.
16137 * makefile : Update.
16139 * cs-parser.jay (delegate_declaration): Implement.
16141 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
16143 * class.cs (Event::Define): Implement.
16144 (Event.EventBuilder): New member.
16146 * class.cs (TypeContainer::Populate): Update to define all enums and events
16148 (Events): New property for the events arraylist we hold. Shouldn't we move to using
16149 readonly fields for all these cases ?
16151 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16153 * class.cs (Property): Revamp to use the convention of making fields readonly.
16154 Accordingly modify code elsewhere.
16156 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
16157 the Define method of the Property class.
16159 * class.cs : Clean up applied patch and update references to variables etc. Fix
16161 (TypeContainer::Populate): Update to define all the properties we have. Also
16162 define all enumerations.
16164 * enum.cs (Define): Implement.
16166 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16168 * cs-parser.jay (overloadable_operator): The semantic value is an
16169 enum of the Operator class.
16170 (operator_declarator): Implement actions.
16171 (operator_declaration): Implement.
16173 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
16174 validity of definitions.
16175 (Operator::CheckBinaryOperator): Static method to check for binary operators
16176 (TypeContainer::AddOperator): New method to add an operator to a type.
16178 * cs-parser.jay (indexer_declaration): Added line to actually call the
16179 AddIndexer method so it gets added ;-)
16181 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
16182 already taken care of by the MS compiler ?
16184 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16186 * class.cs (Operator): New class for operator declarations.
16187 (Operator::OpType): Enum for the various operators.
16189 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16191 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
16192 ostensibly handle this in semantic analysis.
16194 * cs-parser.jay (general_catch_clause): Comment out
16195 (specific_catch_clauses, specific_catch_clause): Ditto.
16196 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
16197 (catch_args, opt_catch_args): New productions.
16198 (catch_clause): Rewrite to use the new productions above
16199 (catch_clauses): Modify accordingly.
16200 (opt_catch_clauses): New production to use in try_statement
16201 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
16202 and re-write the code in the actions to extract the specific and
16203 general catch clauses by being a little smart ;-)
16205 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
16206 Hooray, try and catch statements parse fine !
16208 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16210 * statement.cs (Block::GetVariableType): Fix logic to extract the type
16211 string from the hashtable of variables.
16213 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
16214 I end up making that mistake ;-)
16215 (catch_clauses): Fixed gross error which made Key and Value of the
16216 DictionaryEntry the same : $1 !!
16218 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16220 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
16222 * cs-parser.jay (event_declaration): Correct to remove the semicolon
16223 when the add and remove accessors are specified.
16225 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16227 * cs-parser.jay (IndexerDeclaration): New helper class to hold
16228 information about indexer_declarator.
16229 (indexer_declarator): Implement actions.
16230 (parsing_indexer): New local boolean used to keep track of whether
16231 we are parsing indexers or properties. This is necessary because
16232 implicit_parameters come into picture even for the get accessor in the
16233 case of an indexer.
16234 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
16236 * class.cs (Indexer): New class for indexer declarations.
16237 (TypeContainer::AddIndexer): New method to add an indexer to a type.
16238 (TypeContainer::indexers): New member to hold list of indexers for the
16241 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16243 * cs-parser.jay (add_accessor_declaration): Implement action.
16244 (remove_accessor_declaration): Implement action.
16245 (event_accessors_declaration): Implement
16246 (variable_declarators): swap statements for first rule - trivial.
16248 * class.cs (Event): New class to hold information about event
16250 (TypeContainer::AddEvent): New method to add an event to a type
16251 (TypeContainer::events): New member to hold list of events.
16253 * cs-parser.jay (event_declaration): Implement actions.
16255 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16257 * cs-parser.jay (dim_separators): Implement. Make it a string
16258 concatenating all the commas together, just as they appear.
16259 (opt_dim_separators): Modify accordingly
16260 (rank_specifiers): Update accordingly. Basically do the same
16261 thing - instead, collect the brackets here.
16262 (opt_rank_sepcifiers): Modify accordingly.
16263 (array_type): Modify to actually return the complete type string
16264 instead of ignoring the rank_specifiers.
16265 (expression_list): Implement to collect the expressions
16266 (variable_initializer): Implement. We make it a list of expressions
16267 essentially so that we can handle the array_initializer case neatly too.
16268 (variable_initializer_list): Implement.
16269 (array_initializer): Make it a list of variable_initializers
16270 (opt_array_initializer): Modify accordingly.
16272 * expression.cs (New::NType): Add enumeration to help us
16273 keep track of whether we have an object/delegate creation
16274 or an array creation.
16275 (New:NewType, New::Rank, New::Indices, New::Initializers): New
16276 members to hold data about array creation.
16277 (New:New): Modify to update NewType
16278 (New:New): New Overloaded contructor for the array creation
16281 * cs-parser.jay (array_creation_expression): Implement to call
16282 the overloaded New constructor.
16284 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
16286 * class.cs (TypeContainer::Constructors): Return member
16287 constructors instead of returning null.
16289 2001-08-26 Miguel de Icaza <miguel@ximian.com>
16291 * typemanager.cs (InitCoreTypes): Initialize the various core
16292 types after we have populated the type manager with the user
16293 defined types (this distinction will be important later while
16294 compiling corlib.dll)
16296 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
16297 on Expression Classification. Now all expressions have a method
16298 `Resolve' and a method `Emit'.
16300 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
16301 generation from working. Also add some temporary debugging
16304 2001-08-24 Miguel de Icaza <miguel@ximian.com>
16306 * codegen.cs: Lots of code generation pieces. This is only the
16307 beginning, will continue tomorrow with more touches of polish. We
16308 handle the fundamentals of if, while, do, for, return. Others are
16309 trickier and I need to start working on invocations soon.
16311 * gen-treedump.cs: Bug fix, use s.Increment here instead of
16314 * codegen.cs (EmitContext): New struct, used during code
16315 emission to keep a context. Most of the code generation will be
16318 * cs-parser.jay: Add embedded blocks to the list of statements of
16319 this block. So code generation proceeds in a top down fashion.
16321 2001-08-23 Miguel de Icaza <miguel@ximian.com>
16323 * statement.cs: Add support for multiple child blocks.
16325 2001-08-22 Miguel de Icaza <miguel@ximian.com>
16327 * codegen.cs (EmitCode): New function, will emit the code for a
16328 Block of code given a TypeContainer and its ILGenerator.
16330 * statement.cs (Block): Standard public readonly optimization.
16331 (Block::Block constructors): Link children.
16332 (Block::Child): Child Linker.
16333 (Block::EmitVariables): Emits IL variable declarations.
16335 * class.cs: Drop support for MethodGroups here, delay until
16337 (Method::): Applied the same simplification that I did before, and
16338 move from Properties to public readonly fields.
16339 (Method::ParameterTypes): Returns the parameter types for the
16340 function, and implements a cache that will be useful later when I
16341 do error checking and the semantic analysis on the methods is
16343 (Constructor::GetCallingConvention): Renamed from CallingConvetion
16344 and made a method, optional argument tells whether this is a class
16345 or a structure to apply the `has-this' bit.
16346 (Method::GetCallingConvention): Implement, returns the calling
16348 (Method::Define): Defines the type, a second pass is performed
16349 later to populate the methods.
16351 (Constructor::ParameterTypes): implement a cache similar to the
16352 one on Method::ParameterTypes, useful later when we do semantic
16355 (TypeContainer::EmitMethod): New method. Emits methods.
16357 * expression.cs: Removed MethodGroup class from here.
16359 * parameter.cs (Parameters::GetCallingConvention): new method.
16361 2001-08-21 Miguel de Icaza <miguel@ximian.com>
16363 * class.cs (TypeContainer::Populate): Drop RootContext from the
16366 (Constructor::CallingConvention): Returns the calling convention.
16367 (Constructor::ParameterTypes): Returns the constructor parameter
16370 (TypeContainer::AddConstructor): Keep track of default constructor
16371 and the default static constructor.
16373 (Constructor::) Another class that starts using `public readonly'
16374 instead of properties.
16376 (Constructor::IsDefault): Whether this is a default constructor.
16378 (Field::) use readonly public fields instead of properties also.
16380 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
16381 track of static constructors; If none is used, turn on
16382 BeforeFieldInit in the TypeAttributes.
16384 * cs-parser.jay (opt_argument_list): now the return can be null
16385 for the cases where there are no arguments.
16387 (constructor_declarator): If there is no implicit `base' or
16388 `this', then invoke the default parent constructor.
16390 * modifiers.cs (MethodAttr): New static function maps a set of
16391 modifiers flags into a MethodAttributes enum
16392 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
16393 MethodAttr, TypeAttr to represent the various mappings where the
16394 modifiers are used.
16395 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
16397 2001-08-19 Miguel de Icaza <miguel@ximian.com>
16399 * parameter.cs (GetParameterInfo): Fix bug where there would be no
16402 * interface.cs (PopulateIndexer): Implemented the code generator
16403 for interface indexers.
16405 2001-08-17 Miguel de Icaza <miguel@ximian.com>
16407 * interface.cs (InterfaceMemberBase): Now we track the new status
16410 (PopulateProperty): Implement property population. Woohoo! Got
16411 Methods and Properties going today.
16413 Removed all the properties for interfaces, and replaced them with
16414 `public readonly' fields.
16416 2001-08-16 Miguel de Icaza <miguel@ximian.com>
16418 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
16419 initialize their hashtables/arraylists only when they are needed
16420 instead of doing this always.
16422 * parameter.cs: Handle refs and out parameters.
16424 * cs-parser.jay: Use an ArrayList to construct the arguments
16425 instead of the ParameterCollection, and then cast that to a
16428 * parameter.cs: Drop the use of ParameterCollection and use
16429 instead arrays of Parameters.
16431 (GetParameterInfo): Use the Type, not the Name when resolving
16434 2001-08-13 Miguel de Icaza <miguel@ximian.com>
16436 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
16437 and instead use public readonly fields.
16439 * class.cs: Put back walking code for type containers.
16441 2001-08-11 Miguel de Icaza <miguel@ximian.com>
16443 * class.cs (MakeConstant): Code to define constants.
16445 * rootcontext.cs (LookupType): New function. Used to locate types
16448 2001-08-08 Miguel de Icaza <miguel@ximian.com>
16450 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
16451 this System.Reflection code is. Kudos to Microsoft
16453 * typemanager.cs: Implement a type cache and avoid loading all
16454 types at boot time. Wrap in LookupType the internals. This made
16455 the compiler so much faster. Wow. I rule!
16457 * driver.cs: Make sure we always load mscorlib first (for
16458 debugging purposes, nothing really important).
16460 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
16461 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
16463 * rootcontext.cs: Lookup types on their namespace; Lookup types
16464 on namespaces that have been imported using the `using' keyword.
16466 * class.cs (TypeContainer::TypeAttr): Virtualize.
16467 (Class::TypeAttr): Return attributes suitable for this bad boy.
16468 (Struct::TypeAttr): ditto.
16469 Handle nested classes.
16470 (TypeContainer::) Remove all the type visiting code, it is now
16471 replaced with the rootcontext.cs code
16473 * rootcontext.cs (GetClassBases): Added support for structs.
16475 2001-08-06 Miguel de Icaza <miguel@ximian.com>
16477 * interface.cs, statement.cs, class.cs, parameter.cs,
16478 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
16479 Drop use of TypeRefs, and use strings instead.
16481 2001-08-04 Miguel de Icaza <miguel@ximian.com>
16485 * class.cs (Struct::Struct): set the SEALED flags after
16486 checking the modifiers.
16487 (TypeContainer::TypeAttr): new property, returns the
16488 TypeAttributes for a class.
16490 * cs-parser.jay (type_list): Oops, list production was creating a
16491 new list of base types.
16493 * rootcontext.cs (StdLib): New property.
16494 (GetInterfaceTypeByName): returns an interface by type name, and
16495 encapsulates error handling here.
16496 (GetInterfaces): simplified.
16497 (ResolveTree): Encapsulated all the tree resolution here.
16498 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
16501 * driver.cs: Add support for --nostdlib, to avoid loading the
16502 default assemblies.
16503 (Main): Do not put tree resolution here.
16505 * rootcontext.cs: Beginning of the class resolution.
16507 2001-08-03 Miguel de Icaza <miguel@ximian.com>
16509 * rootcontext.cs: Provide better error reporting.
16511 * cs-parser.jay (interface_base): set our $$ to be interfaces.
16513 * rootcontext.cs (CreateInterface): Handle the case where there
16514 are no parent interfaces.
16516 (CloseTypes): Routine to flush types at the end.
16517 (CreateInterface): Track types.
16518 (GetInterfaces): Returns an array of Types from the list of
16519 defined interfaces.
16521 * typemanager.c (AddUserType): Mechanism to track user types (puts
16522 the type on the global type hash, and allows us to close it at the
16525 2001-08-02 Miguel de Icaza <miguel@ximian.com>
16527 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
16528 RecordInterface instead.
16530 * cs-parser.jay: Updated to reflect changes above.
16532 * decl.cs (Definition): Keep track of the TypeBuilder type that
16533 represents this type here. Not sure we will use it in the long
16534 run, but wont hurt for now.
16536 * driver.cs: Smaller changes to accomodate the new code.
16538 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
16541 * rootcontext.cs (CreateInterface): New method, used to create
16542 the System.TypeBuilder type for interfaces.
16543 (ResolveInterfaces): new entry point to resolve the interface
16545 (CodeGen): Property, used to keep track of the code generator.
16547 2001-07-26 Miguel de Icaza <miguel@ximian.com>
16549 * cs-parser.jay: Add a second production for delegate_declaration
16552 (enum_body): Put an opt_comma here instead of putting it on
16553 enum_body or enum_member_declarations so we can handle trailing
16554 commas on enumeration members. Gets rid of a shift/reduce.
16556 (type_list): Need a COMMA in the middle.
16558 (indexer_declaration): Tell tokenizer to recognize get/set
16560 * Remove old targets.
16562 * Re-add the parser target.
16564 2001-07-13 Simon Cozens <simon@simon-cozens.org>
16566 * cs-parser.jay: Add precendence rules for a number of operators
16567 ot reduce the number of shift/reduce conflicts in the grammar.
16569 2001-07-17 Miguel de Icaza <miguel@ximian.com>
16571 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
16574 Get rid of old crufty code.
16576 * rootcontext.cs: Use this to keep track of the parsed
16577 representation and the defined types available to the program.
16579 * gen-treedump.cs: adjust for new convention.
16581 * type.cs: Split out the type manager, and the assembly builder
16584 * typemanager.cs: the type manager will live here now.
16586 * cil-codegen.cs: And the code generator here.
16588 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
16590 * makefile: Fixed up for easy making.
16592 2001-07-13 Simon Cozens <simon@simon-cozens.org>
16594 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
16597 (unary_expression): Expand pre_increment_expression and
16598 post_decrement_expression to reduce a shift/reduce.
16600 2001-07-11 Simon Cozens
16602 * cs-tokenizer.cs: Hex numbers should begin with a 0.
16604 Improve allow_keyword_as_indent name.
16606 2001-06-19 Miguel de Icaza <miguel@ximian.com>
16608 * Adjustments for Beta2.
16610 2001-06-13 Miguel de Icaza <miguel@ximian.com>
16612 * decl.cs: Added `Define' abstract method.
16613 (InTransit): new property, used to catch recursive definitions.
16615 * interface.cs: Implement `Define'.
16617 * modifiers.cs: Map Modifiers.constants to
16618 System.Reflection.TypeAttribute flags.
16620 * class.cs: Keep track of types and user-defined types.
16621 (BuilderInit): New method for creating an assembly
16622 (ResolveType): New function to launch the resolution process, only
16623 used by interfaces for now.
16625 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
16626 that are inserted into the name space.
16628 2001-06-08 Miguel de Icaza <miguel@ximian.com>
16630 * ARGH. I have screwed up my tree so many times due to the use of
16631 rsync rather than using CVS. Going to fix this at once.
16633 * driver.cs: Objetify driver. Load assemblies, use assemblies to
16636 2001-06-07 Miguel de Icaza <miguel@ximian.com>
16638 * Experiment successful: Use System.Type rather that our own
16641 2001-05-25 Miguel de Icaza <miguel@ximian.com>
16643 * cs-parser.jay: Removed nsAliases from here.
16645 Use new namespaces, handle `using XXX;'
16647 * namespace.cs: Reimplemented namespace handling, use a recursive
16648 definition of the class. Now we can keep track of using clauses
16649 and catch invalid using clauses.
16651 2001-05-24 Miguel de Icaza <miguel@ximian.com>
16653 * gen-treedump.cs: Adapted for all the renaming.
16655 * expression.cs (Expression): this class now has a Type property
16656 which returns an expression Type.
16658 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
16659 `Type', as this has a different meaning now in the base
16661 2001-05-22 Miguel de Icaza <miguel@ximian.com>
16663 * interface.cs, class.cs: Removed from all the sources the
16664 references to signature computation, as we can not do method
16665 signature computation during the parsing time, as we are not
16666 trying to solve at that point distinguishing:
16670 void a (NS.Blah x) {}
16673 Which depending on the context might be valid or not, as we do not
16674 know if Blah is the same thing as NS.Blah at that point.
16676 * Redid everything so the code uses TypeRefs now instead of
16677 Types. TypeRefs are just temporary type placeholders, that need
16678 to be resolved. They initially have a pointer to a string and the
16679 current scope in which they are used. This is used later by the
16680 compiler to resolve the reference to an actual Type.
16682 * DeclSpace is no longer a CIR.Type, and neither are
16683 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
16684 are all DeclSpaces, but no Types.
16686 * type.cs (TypeRefManager): This implements the TypeRef manager,
16687 which keeps track of all the types that need to be resolved after
16688 the parsing has finished.
16690 2001-05-13 Miguel de Icaza <miguel@ximian.com>
16692 * ARGH. We are going to have to store `foreach' as a class rather
16693 than resolving it, as we need to verify error 1579 after name
16694 resolution. *OR* we could keep a flag that says `This request to
16695 IEnumerator comes from a foreach statement' which we can then use
16696 to generate the error.
16698 2001-05-10 Miguel de Icaza <miguel@ximian.com>
16700 * class.cs (TypeContainer.AddMethod): we now add methods to the
16701 MethodGroup instead of the method hashtable.
16703 * expression.cs: Add MethodGroup abstraction, which gets us one
16704 step closer to the specification in the way we handle method
16707 * cs-parser.jay (primary_expression): qualified_identifier now
16708 tried to match up an identifier to a local variable reference or
16709 to a parameter reference.
16711 current_local_parameters is now a parser global variable that
16712 points to the current parameters for the block, used during name
16715 (property_declaration): Now creates an implicit `value' argument to
16718 2001-05-09 Miguel de Icaza <miguel@ximian.com>
16720 * parameter.cs: Do not use `param' arguments as part of the
16721 signature, per the spec.
16723 2001-05-08 Miguel de Icaza <miguel@ximian.com>
16725 * decl.cs: Base class for classes, structs and interfaces. This
16726 is the "Declaration Space"
16728 * cs-parser.jay: Use CheckDef for checking declaration errors
16729 instead of having one on each function.
16731 * class.cs: Factor out some code for handling error handling in
16732 accordance to the "Declarations" section in the "Basic Concepts"
16733 chapter in the ECMA C# spec.
16735 * interface.cs: Make all interface member classes derive from
16736 InterfaceMemberBase.
16738 2001-05-07 Miguel de Icaza <miguel@ximian.com>
16740 * Many things: all interfaces are parsed and generated in
16741 gen-treedump. Support for member variables, constructors,
16742 destructors, properties, constants is there.
16744 Beginning of the IL backend, but very little done, just there for
16747 2001-04-29 Miguel de Icaza <miguel@ximian.com>
16749 * cs-parser.jay: Fix labeled statement.
16751 * cs-tokenizer.cs (escape): Escape " and ' always.
16752 ref_line, ref_name: keep track of the line/filename as instructed
16753 by #line by the compiler.
16756 2001-04-27 Miguel de Icaza <miguel@ximian.com>
16758 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
16759 to match the values in System.CodeDOM.
16761 Divid renamed to Divide.
16763 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
16765 (Statements.set): remove.
16767 * System.CodeDOM/CodeCatchClause.cs: always have a valid
16770 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
16771 falseStatements always have valid values.
16773 * cs-parser.jay: Use System.CodeDOM now.