1 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
3 * driver.cs, support.cs : merged r48826.
5 > could you integrate your mcs changes to gmcs otherwise
6 > gmcs cannot compile some files.
8 2005-08-20 Martin Baulig <martin@ximian.com>
10 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
11 scope if we don't already have it.
13 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
14 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
17 2005-07-31 Miguel de Icaza <miguel@novell.com>
19 * statement.cs: Copy the local exception into the exception
20 captured local. Fixes 75674
22 2005-07-15 Marek Safar <marek.safar@seznam.cz>
24 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
27 2005-08-12 Martin Baulig <martin@ximian.com>
29 * expression.cs (MemberAccess.ResolveNamespaceOrType): Only search
30 for nested types here to avoid hitting the cache too early.
32 2005-08-09 Miguel de Icaza <miguel@novell.com>
34 * enum.cs: On the new compiler CLS error 3005 is now a warning not
37 2005-08-03 Martin Baulig <martin@ximian.com>
39 Make iterators in generic methods work; see gtest-191.cs.
42 (Constraints.Resolve): Protect against being called twice.
45 (TypeContainer.GetClassBases): Make this `protected virtual'.
47 * iterator.cs (Iterator.ctor): Added `GenericMethod' argument.
48 (Iterator.GetClassBases): Override this and compute the base
50 (Iterator.DefineNestedTypes): If we're a generic method, all our
51 method type parameters become class type parameters on the proxy
55 (ToplevelBlock.Parameters): Make this a property, not a field.
56 (ToplevelBlock.ResolveMeta): Update the `parameters' from the `ip'.
58 2005-08-03 Martin Baulig <martin@ximian.com>
60 * typemanager.cs (TypeManager.IsSubclassOf): Use
61 `TypeManager.IsEqual' instead of `Type.Equals'; fixes gtest-190.cs.
62 (TypeManager.GetFullName_recursed): Improved.
64 2005-07-27 Carlos Alberto Cortez <calberto.cortez@gmail.com>
67 * ecore.cs (Expression.IsAccessorAccessible): Change the check for
68 Private accessor case, using TypeManager.IsPrivateAccessible instead of
69 invocation_type == mi.DeclaringType, since the first one also checks
70 other condition used by generic instances.
72 2005-07-27 Martin Baulig <martin@ximian.com>
74 * anonymous.cs (CaptureContext.AddField): Added
75 `AnonymousContainer am' argument; compute its toplevel scope if
76 it's not already computed. Fixes #75649.
78 2005-07-14 Marek Safar <marek.safar@seznam.cz>
80 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
81 CheckAttributeType and refactored.
82 (Attribute.ResolvePossibleAttributeType): Changed to reuse
83 ResolveAsTypeTerminal error handling.
84 (ResolveAsTypeTerminal): Introduced because of global attributes extra
86 (GetSignatureForError): Print errors in same way.
89 * codegen.cs: Reflect attribute GetSignatureForError change.
92 * expression.cs: Add silent parameter to ResolveAsTypeStep.
94 * namespace.cs (UsingEntry): Refactored to make fields private.
97 statement.cs: Error_UnexpectedKind has extra parameter.
99 2005-07-14 Raja R Harinath <rharinath@novell.com>
101 * ecore.cs (IAlias): Remove.
102 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
103 that implement the interface.
104 * namespace.cs (Namespace): Likewise.
105 (Namespace.declspaces): Renamed from 'defined_names'.
106 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
107 DeclSpace instead of an IAlias.
108 * tree.cs (Tree.AddDecl): Update.
110 2005-07-12 Raja R Harinath <rharinath@novell.com>
112 * statement.cs (Block.Flags); Remove HasVarargs.
113 (Block.HasVarargs): Move to ToplevelBlock.
114 (Block.ThisVariable, Block.AddThisVariable): Likewise.
115 (Block.Variables): Make protected. Initialize variable hashtable
117 (Block.AddVariable): Update.
118 (Block.Resolve): Update to changes.
119 (ToplevelBlock.HasVarargs): New boolean.
120 (ToplevelBlock.ThisVariable): Move here from Block.
121 (ToplevelBlock.AddThisVariable): Likewise.
122 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
123 * expression.cs (This.ResolveBase): Update to changes.
124 (ArglistAccess.DoResolve): Likewise.
126 2005-07-11 Marek Safar <marek.safar@seznam.cz>
129 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
131 * class.cs (TypeContainer.VerifyMembers): Distinguish between
132 not used and not used & assigned.
133 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
135 2005-07-11 Marek Safar <marek.safar@seznam.cz>
138 * expression.cs (Is.DoResolve): null is never provided type.
140 2005-07-08 Marek Safar <marek.safar@seznam.cz>
143 * cs-parser.jay: Less strict event error rule to catch more errors.
145 2005-07-11 Martin Baulig <martin@ximian.com>
147 * generic.cs (ConstructedType.CheckConstraints): Improve the check
148 for the constructor constraint: we do not only have to check
149 whether the class has a public constructor, but also ensure that
150 it's parameterless. Fixes #75492.
152 2005-07-11 Martin Baulig <martin@ximian.com>
154 * expression.cs (Binary.ResolveOperator): Only allow `==' and `!='
155 between type parameters if they either have the reference type
156 constraint or the class constraint.
158 2005-07-10 Kamil Skalski <nazgul@nemerle.org>
160 * generic.cs: Use MakeGenericType instead of BindGenericParameters.
162 2005-07-07 Marek Safar <marek.safar@seznam.cz>
165 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
166 (ExtractSecurityPermissionSet): Cope with self referencing security
169 * driver.cs (SetOutputFile): Made public property OutputFile.
171 2005-07-07 Raja R Harinath <rharinath@novell.com>
174 * class.cs (TypeContainer.first_nonstatic_field): Rename from
175 has_nonstatic_fields. Make into a FieldBase pointer.
176 (TypeContainer.AddField): Add CS0282 check.
177 (TypeContainer.EmitType): Update.
179 2005-07-06 Miguel de Icaza <miguel@novell.com>
181 * cs-tokenizer.cs (consume_identifier): Do not create strings to
182 compare if they start with __.
184 2005-07-06 Raja R Harinath <rharinath@novell.com>
186 * statement.cs (Switch.SwitchGoverningType): Only look at
187 UserCasts that don't need implicit standard conversions to one of
188 the allowed switch types (Fixes test-322.cs).
189 (LocalInfo.Resolve): Re-enable sanity-test.
191 2005-07-06 Marek Safar <marek.safar@seznam.cz>
193 * cs-tokenizer.cs (consume_identifier): Detect double undescores
195 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
197 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
199 2005-07-06 Raja R Harinath <rharinath@novell.com>
202 * ecore.cs (SimpleName.GetSignatureForError): Add.
203 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
204 (MemberAccess.GetSignatureForError): Add.
206 2005-07-05 Marek Safar <marek.safar@seznam.cz>
208 The big error and warning messages review.
238 * typemanager.cs: Updated.
240 * class.cs: (MethodCore.SetYields): Moved here to share.
241 (PropertyMethod.Define): Moved iterator setup here.
243 * iterators.cs: Add orig_method to have full access to parent
246 2005-07-05 Raja R Harinath <rharinath@novell.com>
248 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
249 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
250 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
251 variable of struct type.
252 * expression.cs (Unary.ResolveOperator): Update to change.
253 (Indirection.VerifyFixed): Likewise.
254 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
255 (ParameterReference.VerifyFixed): Value parameters are fixed.
256 (This.VerifyFixed): Treat 'this' as a value parameter.
257 * statement.cs (LocalInfo.IsFixed): Remove.
259 2005-07-01 Martin Baulig <martin@ximian.com>
261 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
262 `ec.EmitThis ()' to get the correct scope.
264 2005-07-01 Martin Baulig <martin@ximian.com>
266 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
267 instance is a ParameterReference; fixes #75299.
269 2005-06-30 Raja R Harinath <rharinath@novell.com>
272 * expression.cs (Indexers.map): Remove.
273 (Indexers.Append): Filter out inaccessible setters and getters.
274 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
277 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
279 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
280 (FieldExpr.Emit, PropertyExpr.Emit): Update.
281 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
282 * expression.cs (Invocation.EmitCall): Add CS0120 check.
284 2005-06-30 Marek Safar <marek.safar@seznam.cz>
287 * class.cs (FieldBase.GetInitializerExpression): One more field
290 2005-06-28 Miguel de Icaza <miguel@novell.com>
292 * pending.cs: Do not define a proxy if the base method is virtual,
293 it will be picked up by the runtime (bug 75270).
295 2005-07-08 Martin Baulig <martin@ximian.com>
297 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
298 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
300 2005-07-07 Martin Baulig <martin@ximian.com>
302 * generic.cs (ConstructedType.CheckConstraint): Use
303 ResolveAsTypeStep(), not ResolveAsTypeTerminal() so we're not
304 called recursively; fixes #75329.
306 2005-07-06 Martin Baulig <martin@ximian.com>
308 * generic.cs (TypeManager.InferTypeArguments): Added support for
309 anonymous methods; fixes #75461.
311 2005-07-01 Martin Baulig <martin@ximian.com>
313 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
314 `ec.EmitThis ()' to get the correct scope.
316 2005-07-01 Martin Baulig <martin@ximian.com>
318 * ecore.cs (FieldExpr.DoResolve): Only capture the field if it's
319 instance is `This'; fixes #75299.
321 2005-06-30 Martin Baulig <martin@ximian.com>
323 * class.cs (Indexer): Implement IIteratorContainer; added support
324 for iterators in indexers.
327 (EmitContext.CurrentIterator): Make this a property, not a field.
329 * anonymous.cs (AnonymousContainer.Iterator): New public property.
331 2005-06-28 Miguel de Icaza <miguel@novell.com>
333 * pending.cs: Do not define a proxy if the base method is virtual,
334 it will be picked up by the runtime (bug 75270).
336 2005-06-28 Martin Baulig <martin@ximian.com>
338 * cs-parser.jay (interface_method_declaration): Avoid a
339 reduce/reduce conflict by moving some of the code into a separate
340 `interface_method_declaration_body' rule; fixes #75368.
342 2005-06-28 Martin Baulig <martin@ximian.com>
344 * typemanager.cs (TypeManager.MemberLookup_FindMembers): Move the
345 array check after the check for TypeBuilder's.
347 2005-06-21 Raja R Harinath <rharinath@novell.com>
349 * convert.cs (FindMostEncompassedType): Add two trivial special
350 cases (number_of_types == 0 || number_of_types == 1).
351 (FindMostEncompasingType): Likewise.
353 2005-06-17 Raja R Harinath <rharinath@novell.com>
355 Some cleanups preparing for the fix of #75283.
356 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
358 (EventExpr.InstanceResolve): Likewise.
359 (EventExpr.DoResolve): Remove redundant checks.
361 2005-06-08 Miguel de Icaza <miguel@novell.com>
363 * class.cs: Small fix.
365 2005-06-08 Raja R Harinath <rharinath@novell.com>
368 * class.cs (GetPartialBases): Fix return value check of
371 2005-06-07 Raja R Harinath <rharinath@novell.com>
373 Ensure that partial classes are registered in their enclosing
374 namespace. Initial part of fix of #75160.
375 * tree.cs (Tree.RecordDecl): Add new namespace argument.
376 Register declspace with namespace here, not in
377 DeclSpace.RecordDecl.
378 * cs-parser.jay: Pass namespace to RecordDecl.
379 * class.cs (PartialContainer.Create): Likewise.
380 (ClassPart.DefineType): New sanity-check. Throws an exception if
382 * decl.cs (Declspace.RecordDecl): Remove.
383 * namespace.cs (NamespaceEntry.DefineName): Remove.
385 2005-06-06 Marek Safar <marek.safar@seznam.cz>
387 * rootcontext.cs: Reset TargetExt as well.
389 2005-06-03 Raja R Harinath <rharinath@novell.com>
391 * ecore.cs (Expression.Resolve): Emit CS0654 error when
394 2005-06-02 Raja R Harinath <rharinath@novell.com>
396 Fix #75080, cs0119.cs.
397 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
399 (Expression.Resolve): ... this. Use it. Remove bogus code
400 allowing ExprClass.Type and ExprClass.Namespace for
401 ResolveFlags.VariableOrValue.
402 (Expression.Resolve) [1-argument variant]: Change default resolve
403 flags based on language version.
404 (Expression.Error_UnexpectedKind): Use a simple string array
405 rather than an ArrayList.
406 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
408 (TypeOfVoid.DoResolve): Likewise.
409 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
410 flags argument -- it always has the same value.
412 2005-05-31 Raja R Harinath <rharinath@novell.com>
415 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
416 Use it in the error message.
417 * assign.cs, expression.cs, statement.cs: Update.
419 2005-05-30 Raja R Harinath <rharinath@novell.com>
422 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
423 the "almostMatchedMember" case too.
424 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
425 that failed the accessibility checks to 'almost_match'.
427 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
429 * attribute.cs: Use internal MethodBuilder methods to set
430 ExactSpelling and SetLastError on PInvoke methods, instead
431 of passing them via charset. Fixes #75060.
433 2005-05-27 Raja R Harinath <rharinath@novell.com>
435 * parameter.cs (Parameter): Remove TODO comment.
436 (Parameter.DefineParameter): Remove Location parameter.
437 (Parameters.LabelParameters): Likewise.
438 * class.cs (Constructor.Emit): Update to change.
439 (MethodData.Emit): Likewise.
440 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
441 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
443 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
446 Removed Parameters.Location and added Parameter.Location instead.
447 Removed Location parameter from Emit() and GetSignature().
454 Modified all related calls.
456 2005-06-21 Martin Baulig <martin@ximian.com>
458 * generic.cs (NullCoalescingOperator.Emit): Make this work if the
459 left-hand side is not a nullable type; fixes #75328.
461 2005-06-21 Martin Baulig <martin@ximian.com>
464 (TypeManager.CSharpName): Use GetFullName() instead of `t.FullName'.
465 (TypeManager.GetFullNameSignature): Likewise.
467 * convert.cs (Convert.Error_CannotImplicitConversion): Compare
468 `source.FullName' and `target.FullName' to check whether there are
469 two conflicting definitions.
471 2005-06-21 Martin Baulig <martin@ximian.com>
473 * convert.cs (Convert.ImplicitTypeParameterConversion): Always use
474 a BoxedCast - also for reference types - to be compatible with csc.
476 2005-06-21 Martin Baulig <martin@ximian.com>
478 * expression.cs (MemberAccess.DoResolve): Add support for nested
479 types in a generic instance; fixes #75320.
481 2005-06-20 Martin Baulig <martin@ximian.com>
483 * generic.cs (TypeManager.InferType): Also walk the class
484 hierarchy for generic instances; fixes #75261.
486 2005-06-17 Martin Baulig <martin@ximian.com>
488 * typemanager.cs (TypeManager.IsBuiltinType): Use TypeToCoreType()
489 to make things work for corlib.
491 2005-06-15 Martin Baulig <martin@ximian.com>
493 * attribute.cs (Attribute.CheckSecurityActionValidity): Remove the
494 obsolete `SecurityAction' values.
496 2005-06-06 Marek Safar <marek.safar@seznam.cz>
498 * rootcontext.cs: Reset TargetExt as well.
500 2005-06-09 Martin Baulig <martin@ximian.com>
502 * delegate.cs (Delegate.VerifyMethod): Added
503 `MethodGroupExpr old_mg' argument; inherit its
504 `HasTypeParameters'; fix #75085.
506 2005-06-09 Martin Baulig <martin@ximian.com>
508 * expression.cs (Invocation.OverloadResolve): Correctly handle
509 generic methods for the SetMemberIsUsed(); fix #75064.
511 2005-06-09 Martin Baulig <martin@ximian.com>
513 * statement.cs (Throw.Resolve): Use TypeManager.IsSubclassOf();
516 2005-06-08 Martin Baulig <martin@ximian.com>
518 * cs-parser.jay (nullable_type_or_conditional): If we put the
519 nullable back and our `type' is a `ComposedCast', remove the
520 nullable from it. Fixes #75156.
522 * expression.cs (ComposedCast.RemoveNullable): New public method.
524 2005-06-08 Martin Baulig <martin@ximian.com>
526 The big Iterators rewrite :-)
528 * iterators.cs: Rewrite this to use the anonymous methods framework.
530 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
531 before the TypeContainers; see 2test-21.cs.
534 (TypeContainer.DefineType): Don't create a new EmitContext if we
535 already have one (this only happens if we're an Iterator).
536 (TypeContainer.Define): Also call Define() on all our iterators.
537 (Method.CreateEmitContext): Added support for iterators.
540 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
541 (AnonymousContainer.CreateMethodHost): Moved here from
542 AnonymousMethod and made abstract.
543 (AnonymousContainer.CreateScopeType): New abstract method.
544 (AnonymousContainer.IsIterator): New public property.
545 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
546 get the ScopeTypeBuilder rather than manually defining it here.
547 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
550 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
551 before RootContext.DefineTypes().
553 * codegen.cs (EmitContext.RemapToProxy): Removed.
554 (EmitContext.CurrentAnonymousMethod): Changed type from
555 AnonymousMethod -> AnonymousContainer.
556 (EmitContext.ResolveTopBlock): Protect from being called twice.
557 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
558 (EmitContext.EmitThis): Removed the iterators hacks; use the
559 anonymous methods framework for that.
562 (ToplevelBlock.Container): Make this a property, not a field.
563 (ToplevelBlock.ReParent): New public method; move the
564 ToplevelBlock into a new container.
565 (Foreach.TemporaryVariable): Simplify.
567 2005-06-05 Martin Baulig <martin@ximian.com>
569 * statement.cs (LocalInfo.CompilerGenerated): New flag.
570 (Block.AddTemporaryVariable): New public method; creates a new
571 `LocalInfo' for a temporary variable.
572 (Block.EmitMeta): Create the LocalBuilders for all the temporary
574 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
575 non-iterator variables.
577 2005-06-05 Martin Baulig <martin@ximian.com>
579 * statement.cs (Foreach.TemporaryVariable): Create the
580 LocalBuilder in the Emit phase and not in Resolve since in some
581 situations, we don't have an ILGenerator during Resolve; see
582 2test-19.cs for an example.
584 2005-06-04 Martin Baulig <martin@ximian.com>
586 The big Foreach rewrite - Part II.
588 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
589 with `PropertyInfo ienumerator_getcurrent'.
591 * codegen.cs (VariableStorage): Removed.
594 (Foreach): Derive from Statement, not ExceptionStatement.
595 (Foreach.CollectionForeach): New nested class. Moved all the code
596 dealing with collection foreach here.
597 (Foreach.ForeachHelperMethods): Removed.
598 (Foreach.TemporaryVariable): Implement IMemoryLocation.
600 2005-05-23 Martin Baulig <martin@ximian.com>
602 * statement.cs (Try.DoResolve): Don't create a `finally' if we
603 don't need to. Fix #75014.
605 2005-05-26 Raja R Harinath <rharinath@novell.com>
607 Improve user-defined conversion handling.
608 * convert.cs (GetConversionOperators): Rewrite. Return only the
609 applicable operators.
610 (AddConversionOperators): New. Helper for GetConversionOperators.
611 (FindMostEncompassedType, FindMostEncompassingType): Verify that
612 there is only one most encompassed/encompassing type.
613 (FindMostSpecificSource, FindMostSpecificTarget): Remove
614 "applicable operator" handling.
615 (UserConversion): Move cache here from GetConversionOperators.
616 Directly cache the chosen operator, rather than the whole
618 (ExplicitNumericConversion): Fix buggy implementation of Decimal
619 case. Allow conversion of decimal to sbyte and byte too.
620 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
621 New static methods. Used to avoid allocating EmptyExpressions in
624 2005-05-24 Duncan Mak <duncan@novell.com>
626 * ecore.cs (CastFromDecimal): New class for casting a decimal to
627 another class, used in Convert.ExplicitNumericConversion.
628 (CastToDecimal): New class, similar to above, but casts to
629 System.Decimal, used in Convert.ImplicitNumericConversion and also
630 in explicit convesion from double/float to decimal.
632 * convert.cs (ImplicitNumericConversion): Handle implicit
633 conversions to System.Decimal.
634 (ExplicitNumericConversion): handle explicit conversions to
639 2005-05-20 Miguel de Icaza <miguel@novell.com>
641 * typemanager.cs: Do not throw an exception in the TypeBuilder
642 case, we take care of it on the TypeCode.
644 2005-05-17 Marek Safar <marek.safar@seznam.cz>
646 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
649 * cs-parser.jay: Catch more lexical errors.
651 * report.cs: Add one more Error method.
654 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
656 2005-05-20 Martin Baulig <martin@ximian.com>
658 * class.cs (TypeContainer.CircularDepException): Removed.
659 (TypeContainer.DefineType): Removed the `InTransit' stuff.
660 (TypeContainer.CheckRecursiveDefinition): Check for circular class
661 (CS0146) and interface (CS0529) dependencies here.
663 2005-05-20 Martin Baulig <martin@ximian.com>
665 * expression.cs (New.DoResolve): Move the CS0712 check above the
666 CS0144 check; otherwise it can never be reached.
668 2005-05-20 Martin Baulig <martin@ximian.com>
670 * cs-parser.jay: Fix CS0080 check; add CS0231 and CS0257 from MCS.
672 2005-05-20 Martin Baulig <martin@ximian.com>
674 * class.cs (TypeContainer.DefineType): Fix CS0698 check.
676 * typemanager.cs (TypeManager.IsAttributeType): New public method.
678 2005-05-19 Martin Baulig <martin@ximian.com>
681 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
682 to disable error reporting.
684 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
685 here since we don't want to report an error; see the new test-336.cs.
687 2005-05-19 Raja R Harinath <rharinath@novell.com>
689 * statement.cs (ToplevelBlock.GetParameterReference)
690 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
691 Move here from class Block.
692 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
693 * expression.cs (ParameterReference.DoResolveBase): Likewise.
695 2005-05-18 Martin Baulig <martin@ximian.com>
700 (FlowBranching.Reachability): Add non-static public And() and Or()
702 (FlowBranchingSwitch): New class; do the `break_origins' thing
703 like in FlowBranchingLoop.
704 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
705 reachability, not just locals and parameters.
706 (FlowBranching.MergeChild): Remove some of the hacks for loop and
707 switch; MergeBreakOrigins() now takes care of that.
709 2005-05-18 Martin Baulig <martin@ximian.com>
711 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
712 a loop and may leave it, reset the barrier; fixes #74974.
714 2005-05-16 Raja R Harinath <rharinath@novell.com>
716 Fix test-382.cs. Emit values of decimal constants.
717 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
719 (TypeContainer.AddField): ... this.
720 (TypeContainer.EmitFieldInitializers): Allow the list of fields
721 with initializers to include 'Const's.
722 (ClassPart.RegisterFieldForInitialization): Forward to
724 * const.cs (Const.Const): Pass initializer to base class.
725 (Const.Define): In case of decimal constants, register them for
726 initialization in a static constructor.
728 2005-05-14 Martin Baulig <martin@ximian.com>
730 * statement.cs (Block.Resolve): Correctly handle unreachable code;
731 do not call ResolveUnreachable() on unreachable statements in
732 here, see the comment in the source code.
734 2005-05-13 Raja R Harinath <rharinath@novell.com>
737 * expression.cs (BinaryResolveOperator): If one of the operands of
738 an equality comparison is 'null' and the other is a pointer type,
739 convert the null to a NullPointer.
740 * convert.cs (ImplicitReferenceConversion): If the expression is a
741 NullLiteral and the target type is a pointer type, return a
743 (ImplicitConversionStandard): Likewise.
745 2005-05-13 Marek Safar <marek.safar@seznam.cz>
747 * cs-parser.jay: Set readonly context based on special constructs.
749 * expression.cs (LocalVariableReference.DoResolveBase): Improved
750 readonly variable error handling.
752 * rootcontext.cs (EmitCode): Don't verify members when error
755 * statement.cs (LocalInfo): Add reaodnly context information.
756 (SetReadOnlyContext, GetReadOnlyContext): New methods.
758 2005-05-17 Martin Baulig <martin@ximian.com>
760 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
763 2005-05-13 Martin Baulig <martin@ximian.com>
765 * statement.cs (Block.Resolve, ResolveUnreachable): Correctly
766 handle unreachable blocks.
768 2005-05-13 Martin Baulig <martin@ximian.com>
771 (ConstructorInitializer.GetOverloadedConstructor): Don't crash.
772 (MethodCore.CheckCore): Use TypeManager.IsEqual(); fix #74904 and
775 2005-05-13 Martin Baulig <martin@ximian.com>
777 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
778 instance variable, not a local. Fix #74873.
779 (Block.ResolveUnreachable): Set it to true here.
781 2005-05-12 Martin Baulig <martin@ximian.com>
783 * cs-parser.jay (property_declaration): Pass the `current_class',
784 not the `current_container' to Property's .ctor. Fixes #74912.
786 2005-05-11 Martin Baulig <martin@ximian.com>
788 * typemanager.cs (Closure): Copy this from MCS and merge all the
789 GMCS-specific changes into it.
791 2005-05-12 Raja R Harinath <harinath@gmail.com>
794 * typemanager.cs (unmanaged_enclosing_types): New.
795 (IsUnmanagedType): Avoid infloops by using
796 'unmanaged_enclosing_types' to talk with recursive invocations.
798 2005-05-11 Duncan Mak <duncan@novell.com>
800 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
801 continuing to process for 'arg'.
802 (handle_preprocessing_directive): Check the argument of the #endif
803 directive and report error CS1025 if there are any trailing
806 According to the C# spec, having even whitespace after the #endif
807 directive is illegal; however, because we call arg.TrimEnd ()
808 beforehand, we have the same behavior as csc, allowing whitespace
813 2005-05-11 Marek Safar <marek.safar@seznam.cz>
817 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
818 (Constructor.GetObsoleteAttribute): Implemented correctly.
820 2005-05-10 Martin Baulig <martin@ximian.com>
822 * generic.cs (Constraints.Resolve): Report CS0246 if we cannot
823 resolve the type; fixes #74864.
824 (DefaultValueExpression): Create the LocalTemporary in Emit(), not
825 in DoResolve(); fixes #74862.
827 2005-05-10 Martin Baulig <martin@ximian.com>
829 * support.cs (ReflectionParameters.ParameterModifier): Use
830 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
831 and `ParameterAttributes.In'. Fixes #74884.
833 2005-05-10 Martin Baulig <martin@ximian.com>
835 * typemanager.cs (TypeManager.MemberLookup_FindMembers): Don't use
836 the cache if we're just looking for `MemberTypes.NestedType' in a
839 * ecore.cs (Expression.ResolveAsTypeTerminal): Don't check the
840 constraints if we're still resolving the type tree.
841 (Expression.MemberLookup): If we're resolving the type tree, only
842 look for `MemberTypes.NestedType' since we're only interested in
845 * class.cs (TypeContainer.DefineType): Don't resolve the type
846 parameters here; do this later in ResolveType() after the type
847 tree has been resolved.
848 (TypeContainer.ResolveType): New public method; this is called
849 after the type tree is resolved and before the types are being
850 populated. We resolve the generic constraints here.
851 (TypeContainer.DoDefineMember): Check the constraints on our base
852 class and interfaces.
854 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Make this protected;
855 set the `ResolvingTypeTree' flag on the EmitContext.
857 * codegen.cs (EmitContext.ResolvingTypeTree): New public field.
859 2005-05-10 Marek Safar <marek.safar@seznam.cz>
861 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
863 * expression.cs (Argument.GetParameterModifier): Turned to property.
864 (Invocation.Error_InvalidArguments): Add more descriptive errors.
866 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
869 2005-05-09 Raja R Harinath <rharinath@novell.com>
872 * decl.cs (MemberCache.AddMethods): Register override methods,
873 rather than non-override methods.
874 * typemanager.cs (RegisterOverride): New.
875 (IsOverride): Update.
877 2005-05-09 Marek Safar <marek.safar@seznam.cz>
879 * typemanager.cs (TypeManager): Moved InitGenerics to Reset method.
881 2005-05-06 Martin Baulig <martin@ximian.com>
884 (Attributable.IsClsComplianceRequired): Fix typo in the method name.
885 (AttributeTester.AnalyzeTypeCompliance): Add generics support.
887 2005-05-09 Marek Safar <marek.safar@seznam.cz>
891 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
892 recursive declaration.
894 * statement.cs (Block.ResolveMeta): Report any error in resolving.
896 2005-05-06 Marek Safar <marek.safar@seznam.cz>
898 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
900 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
902 2005-05-05 Raja R Harinath <rharinath@novell.com>
905 * decl.cs (DeclSpace.FamilyAccessible):
906 Use TypeManager.IsNestedFamilyAccessible.
909 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
912 2005-05-04 Raja R Harinath <rharinath@novell.com>
913 Abin Thomas <projectmonokochi@rediffmail.com>
914 Anoob V E <projectmonokochi@rediffmail.com>
915 Harilal P R <projectmonokochi@rediffmail.com>
918 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
919 allow access to all static members.
921 2005-05-04 Martin Baulig <martin@ximian.com>
923 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
925 2005-05-04 Martin Baulig <martin@ximian.com>
929 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
930 section at the end; make things work if `default' is not the last
933 2005-05-04 Martin Baulig <martin@ximian.com>
937 * statement.cs (Switch): Replaced the `got_default' field with a
938 `default_section' one.
939 (Switch.CheckSwitch): Set `default_section' here.
940 (Switch.Resolve): If we're a constant switch and the constant is
941 not found, use the default section.
943 2005-05-03 Martin Baulig <martin@ximian.com>
945 * expression.cs (ArrayAccess.EmitGetLength): New public method.
947 * statement.cs (Foreach.ArrayForeach): New nested class.
948 (Foreach.TemporaryVariable): New nested class.
949 (Foreach.EmitArrayForeach): Removed; this is now in the new
952 2005-05-03 Raja R Harinath <rharinath@novell.com>
954 * pending.cs (BaseImplements): Move the #74773 fix here. This is
956 (VerifyPendingMethods): Revert change below.
958 * typemanager.cs (IsOverride, RegisterNonOverride): New.
959 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
960 that used to trigger warning -28. Remove warning -28.
961 * expression.cs (Invocation.OverloadResolve): Use
962 TypeManager.IsOverride to distinguish override methods.
965 * pending.cs (VerifyPendingMethods): If a base type implements the
966 requested interface, don't bother checking individual methods of
967 the base type. As a side-effect, this prevents the creation of
970 2005-05-02 Martin Baulig <martin@ximian.com>
974 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
975 Also `And' the locals if the old vector is null.
976 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
977 null; in this case we basically reset all the variables.
979 2005-05-02 Martin Baulig <martin@ximian.com>
983 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
984 Added `FlowBranching branching' argument; always `and' the
985 variables instead of `or'ing them unless we're an infinite loop.
987 * statement.cs (While.Resolve): Create a new sibling unless we're
990 2005-05-02 Martin Baulig <martin@ximian.com>
994 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
995 arguments; use it instead of creating a new TopLevelBlock.
996 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
997 our ConstructorInitializer.
1000 (TopLevelBlock.TopLevelBranching): New public property.
1001 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
1002 and create our `TopLevelBranching'.
1004 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
1005 anonymous method host, use `block.TopLevelBranching' rather than
1006 creating a new branching.
1008 2005-04-20 Miguel de Icaza <miguel@novell.com>
1010 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
1011 a ScopeInfo, if any of the current children is a child of the new
1012 entry, move those children there.
1014 2005-04-30 Martin Baulig <martin@ximian.com>
1016 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
1017 at the beginning of a SwitchSection. Fix #73335.
1019 2005-04-27 Marek Safar <marek.safar@seznam.cz>
1022 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
1024 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
1025 (FieldExpr.DoResolve): Obsolete members are ignored for field
1028 2005-04-26 Marek Safar <marek.safar@seznam.cz>
1030 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
1031 of arrays detection.
1033 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
1035 (Field.VerifyClsCompliance): Volatile fields are not compliant.
1037 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
1040 2005-04-25 Ben Maurer <bmaurer@ximian.com>
1042 * cs-parser.jay: Use the prefered version of -unsafe in error
1045 2005-04-22 Marek Safar <marek.safar@seznam.cz>
1047 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
1050 2005-04-20 John Luke <john.luke@gmail.com>
1052 * driver.cs: fix typo in error message, --outout to --output
1054 2005-04-30 Martin Baulig <martin@ximian.com>
1056 * attribute.cs (Attribute.CheckSecurityActionValidity): Correctly
1057 handle the .NET 2.x security attributes.
1059 2005-04-30 Martin Baulig <martin@ximian.com>
1062 (TypeManager.ExpandInterfaces): Don't add things twice.
1065 (TypeContainer.VerifyClsCompliance): Allow generic instances.
1067 2005-04-29 Martin Baulig <martin@ximian.com>
1069 * generic.cs (Constraints.ResolveTypes): Expand interfaces.
1071 * anonymous.cs: Added support for anonymous generic methods.
1073 2005-04-29 Martin Baulig <martin@ximian.com>
1075 * typemanager.cs (TypeManager.GetInterfaces): Correctly handle
1078 2005-04-29 Martin Baulig <martin@ximian.com>
1080 * generic.cs (TypeManager.HasConstructorConstraint): Removed.
1082 * expression.cs (New.DoResolve): Fix the CS0304 check.
1084 2005-04-29 Martin Baulig <martin@ximian.com>
1086 * typemanager.cs (TypeManager.GetFullName): Updated to the new
1089 * class.cs (MethodCore.IsDuplicateImplementation): If we're an
1090 explicit interface implementation, compare the interface types.
1091 (MethodData.Define): Use the new naming scheme from the latest
1093 (MemberBase.DoDefineBase): Resolve `InterfaceType' here.
1095 * decl.cs (MemberName.GetMemberName): Removed.
1096 (MemberName.MethodName, FullName): New properties.
1098 2005-04-25 Raja R Harinath <rharinath@novell.com>
1100 * gmcs.exe.config: Update v2.0.40607 -> v2.0.50215.
1102 2005-04-22 Martin Baulig <martin@ximian.com>
1104 * generic.cs (GenericMethod): Create the EmitContext in the
1105 `Define()'; in `Define(MethodBuilder)', create the type parameters
1106 before calling `Define()'. Fixes #73933.
1108 2005-04-22 Martin Baulig <martin@ximian.com>
1111 (Constraints.Resolve): Make things work wrt. the new type lookup system.
1112 (ConstructedType.ResolveAsTypeTerminal): Don't override this.
1114 * ecore.cs (Expression.ResolveAsTypeTerminal): If `te' is a
1115 ConstructedType, check its constraints.
1117 2005-04-20 Marek Safar <marek.safar@seznam.cz>
1119 * codegen.cs (InRefOutArgumentResolving): New field.
1121 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
1122 fields outside contructor.
1124 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
1126 2005-04-19 Miguel de Icaza <miguel@novell.com>
1128 * anonymous.cs (CaptureContext.EmitParameterInstance): The
1129 parameter code was not completed ever, so it was not as up-to-date
1130 as local variables. Must finish it.
1132 The bug fix was to compare the Toplevel of the block, not the
1133 current block. Thanks for Ben for pointing this out.
1135 2005-04-19 Raja R Harinath <rharinath@novell.com>
1137 * decl.cs (AddMethods): Use the declaring type of the problem
1138 method to determine if we want to squash a warning.
1140 2005-04-19 Marek Safar <marek.safar@seznam.cz>
1142 * attribute.cs: Removed debug output.
1144 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
1146 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
1149 2005-04-18 Raja R Harinath <rharinath@novell.com>
1152 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
1153 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
1154 all null comparisons against reference types.
1156 2005-04-18 Marek Safar <marek.safar@seznam.cz>
1159 * class.cs (TypeContainer.CircularDepException) New nested
1161 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
1162 (TypeContainer.DefineType): Removed error, reset InTransit before
1164 (Class.DefineType): Throw exception when is in Transit.
1165 Catch exception and report error.
1166 (Struct.DefineType): Throw exception when is in Transit.
1167 Catch exception and report error.
1168 (Interface.DefineType): Throw exception when is in Transit.
1169 Catch exception and report error.
1171 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
1172 handle nested exception handlers.
1174 * flowanalysis.cs (InTryWithCatch): New method, search for try with
1177 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
1178 InFinally and InCatch storage.
1180 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
1181 (Catch.Resolve): Set and Restore ec.InCatch.
1182 (Try.Resolve): Set and Restore ec.InFinally.
1183 (Try.HasCatch): True when try has catch.
1185 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
1187 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
1188 for the same event member, so exclude such cases from warning 419.
1191 2005-04-16 Miguel de Icaza <miguel@novell.com>
1193 * expression.cs (Binary.ResolveOperator): Apply patch from John
1194 Luke to fix bug 59864: operators &, | and ^ on enumerations
1195 require that the same enum type on both sides.
1197 * driver.cs: Add warnings to old flag usage, this is to assist
1198 people who produce Makefiles and hope that the Makefiles will be
1201 * class.cs (TypeContainer.EmitType): Moved the definition of the
1202 special $PRIVATE$ field from the resolve phase to the Emit phase.
1203 During resolve we do not know if we are a struct with
1204 HasExplicitLayout, we know this only after the attributes for the
1207 Set the FieldOffset to zero on the dummy field that we create for
1208 the class. Fixes 74590.
1210 2005-04-16 Raja R Harinath <rharinath@novell.com>
1213 * ecore.cs (PropertyExpr.resolved): New.
1214 (DoResolve): Use it to handle a case of double resolution here.
1215 Handle a case of identical-name-and-type-name.
1216 * expression.cs (ArrayCreation.CheckIndices): Avoid double
1217 resolution by storing the results of expression resolution back
1218 into the "probes" array.
1220 2005-04-15 Raja R Harinath <rharinath@novell.com>
1222 Fix cs0208-7.cs and cs0208-8.cs.
1223 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
1224 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
1225 error reporting to point out the reason a struct is not unmanaged.
1227 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1229 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
1230 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
1232 2005-04-13 Raja R Harinath <rharinath@novell.com>
1235 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
1236 IdenticalNameAndTypeName here.
1237 (EventExpr.InstanceResolve): Likewise.
1239 2005-04-13 Marek Safar <marek.safar@seznam.cz>
1241 C# 2.0 DefaultCharSetAttribute implementation
1243 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
1244 which allows us to set GlobalNamespace for every resolve.
1245 (Attribute.ResolveArguments): Cut from Resolve.
1246 (Attribute.GetCharSetValue): Returns CharSet named argument.
1247 (Attribute.DefinePInvokeMethod): Gets default charset from
1249 (GlobalAttribute.ResolveAsTypeStep): Override.
1250 (GlobalAttribute.ResolveArguments): Override.
1252 * class.cs (TypeAttr): Is protected.
1254 * codegen.cs (ModuleClass.DefaultCharSet): New member.
1255 (ModuleClass.DefaultCharSetType): New memeber.
1256 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
1258 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
1259 charset from module.
1261 * delegate.cs (TypeAttr): Override.
1262 (Delegate.DefineType): Use this TypeAttr.
1264 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
1265 at very early stage (before types are defined) to resolve model
1266 module attributes. It will probably not work with corlib but it
1269 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
1270 charset from module.
1272 * typemanager.cs (default_charset_type): New type.
1274 2005-04-13 Raja R Harinath <rharinath@novell.com>
1276 * decl.cs (MemberCache.AddMethods): Don't warn if
1277 System.Object.Finalize has buggy MethodAttributes.
1279 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
1282 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1284 * doc.cs : detect ambiguous reference to overloaded members.
1285 Fixed bug #71603. MS 1.1 csc does not detect it.
1287 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1289 * doc.cs : delegates must not be referenced with parameters.
1292 2005-04-12 Miguel de Icaza <miguel@novell.com>
1294 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
1296 2005-04-10 Miguel de Icaza <miguel@novell.com>
1298 * driver.cs (MainDriver): Stop processing if the CLS stage found
1301 (CompilerCallableEntryPoint.InvokeCompiler): Always
1302 reset after execution; Take a TextWriter argument for the
1305 * report.cs: Use the error stream instead of hardcoding stderr.
1307 2005-04-09 Miguel de Icaza <miguel@novell.com>
1309 * class.cs: Reduce code paths to test, too small of an
1310 optimization to make it worth the extra testing. Always perform
1313 2005-04-08 Raja R Harinath <rharinath@novell.com>
1316 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
1317 operators that had errors reported on them.
1319 2005-04-08 Marek Safar <marek.safar@seznam.cz>
1321 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
1323 (Attribute.Resolve): Add named argument type checking.
1325 * class.cs (FixedField.Define): Use IsPrimitiveType
1327 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
1329 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
1330 unsafe parameter types.
1332 * statement.cs (Using.ResolveExpression): Add better error description.
1334 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
1336 2005-04-08 Raja R Harinath <rharinath@novell.com>
1339 * attribute.cs (Attribute.GetAttributeUsage): Resolve
1340 AttributeUsageAttribute in the emitcontext of the attribute class,
1341 not in the emitcontext of the attributable entity it was attached to.
1342 * cs-parser.jay: Use 'current_class', not 'current_container',
1343 when creating a GlobalAttribute.
1345 2005-04-08 Alp Toker <alp@atoker.com>
1347 * pending.cs: The fix to #58413 failed to compile methods implementing
1348 interfaces with/without params modifiers and vice versa, even though
1349 params modifiers aren't part of the signature. Make the modifier check
1350 less strict as in csc.
1352 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
1353 Anoob V E <projectmonokochi@rediffmail.com>
1354 Harilal P R <projectmonokochi@rediffmail.com>
1357 * pending.cs (TypeAndMethods.mods): New. Store the parameter
1358 modifiers of pending methods.
1359 (PendingImplementation.PendingImplementation): Initialize it.
1360 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
1361 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
1362 with ParameterData. Add check for modifiers.
1363 * class.cs (MethodData.Define): Update to changes.
1365 2005-04-07 Raja R Harinath <rharinath@novell.com>
1367 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
1369 2005-04-07 Marek Safar <marek.safar@seznam.cz>
1371 * class.cs (PropertyMethod.Define): Check private accessor in abstract
1374 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
1377 * typemanager.cs: Registered RequiredAttributeAttribute.
1379 2005-04-06 Marek Safar <marek.safar@seznam.cz>
1381 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
1382 Warning CS0169 is back at level 3.
1383 (IMethodData.SetMemberIsUsed): New method.
1385 * decl.cs (IsUsed): New value; moved from FieldBase.Status
1386 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
1388 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
1390 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
1392 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
1395 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
1398 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
1399 to avoid the problems with nested types.
1401 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
1402 Anoob V.E <projectmonokochi@rediffmail.com>
1403 Harilal P.R <projectmonokochi@rediffmail.com>
1404 Raja R Harinath <rharinath@novell.com>
1407 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
1409 * typemanager (GetConstructor): Make public.
1411 2005-04-05 John Luke <john.luke@gmail.com>
1412 Raja R Harinath <rharinath@novell.com>
1415 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
1416 struct too. Return false quicker in a few cases.
1417 (VerifyUnManaged): Use it.
1419 2005-04-05 Raja R Harinath <rharinath@novell.com>
1422 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
1423 not 'unreachable_seen'.
1425 2005-04-04 Marek Safar <marek.safar@seznam.cz>
1427 * attribute.cs (Attribute.GetValue): Removed unused.
1429 * codegen.cs (CodeGen.TrimExt): Removed unused.
1431 * cs-parser.jay (output): Removed unused.
1433 * cs-tokenizer.cs (hex_digits): Removed unused.
1435 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
1437 * expression.cs (Indirection.LoadExprValue): Removed unused.
1438 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
1440 * iterators.cs (Iterator.param_types): Removed unused.
1442 * statement.cs (Goto.block): Removed unused.
1443 (ToplevelBlock.did): Removed unused.
1444 (Switch.ResolveConstantSwitch): Removed unused.
1446 2005-04-01 Ben Maurer <bmaurer@ximian.com>
1448 * rootcontext.cs: Allow mcs to bootstrap with the compilation
1451 2005-04-19 Martin Baulig <martin@ximian.com>
1453 Merged r42462 from MCS and made it work for GMCS.
1455 * class.cs (MethodCore.ds): Moved this field to `MemberBase'.
1457 * generic.cs (GenericMethod.Define): Removed `return_type' argument.
1459 2005-04-01 Raja R Harinath <rharinath@novell.com>
1461 Fix #74232 and cs0208-3.cs.
1462 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
1463 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
1464 unmanaged type. Don't use FieldBuilders when 't' is a
1465 TypeBuilder. Use ModFlags and MemberType fields.
1466 * class.cs (MemberBase.member_type): Rename from MemberType.
1467 (MemberBase.MemberType): New property. Determines member_type on
1469 (MemberBase.DoDefine): Don't initialize MemberType here.
1470 (FieldMember.Define): Likewise.
1472 2005-04-01 Marek Safar <marek.safar@seznam.cz>
1475 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
1476 Attributes are emitted there.
1478 2005-04-01 Raja R Harinath <rharinath@novell.com>
1480 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
1481 keyword in 'partial enum' too.
1482 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
1484 Report from Kamil Skalski <nazgul@omega.pl>.
1487 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
1488 have partial containers too.
1490 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
1491 in block' checks to Block.CheckInvariantMeaningInBlock.
1492 * statement.cs (Block.GetKnownVariableInfo): Make private.
1493 (Block.IsVariableUsedInChildBlock): Remove.
1494 (Block.IsVariableUsedInBlock): Likewise.
1495 (Block.CheckInvariantMeaningInBlock): New. Show location of
1496 conflicting declaration.
1497 (Block.AddVariable): Make error messages less long-winded and more
1498 specific. Show location of conflicting declaration.
1499 * parameter.cs (Parameters.Location): New readonly property.
1501 2005-03-31 Raja R Harinath <rharinath@novell.com>
1503 Clean up semantics of invoking ResolveMemberAccess.
1504 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
1505 can have an instance, ensure that we pass in a non-TypeExpression
1506 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
1507 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
1508 argument. Update to changes and simplify.
1509 (FieldExpr.Emitinstance): Remove CS0120 check.
1510 (PropertyExpr.EmitInstance): Likewise.
1511 * expression.cs (Argument.Resolve): Likewise.
1512 (Invocation.DoResolve): Update to changes in semantics of
1515 2005-03-31 Marek Safar <marek.safar@seznam.cz>
1518 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
1521 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
1523 2005-03-31 Raja R Harinath <rharinath@novell.com>
1525 Fix difference in behaviour with commandline invocation.
1526 * driver.cs (Driver.Reset): New.
1527 (CompilerCallableEntryPoint): Call it.
1529 * statement.cs (If.Resolve): Avoid spurious "uninitialized
1530 variable" warnings if the boolean expression failed to resolve.
1532 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
1534 * attribute.cs: Fix the union of several permissions when some of them
1535 are unrestricted (so the result isn't an unrestricted permission set).
1538 2005-03-30 Raja R Harinath <rharinath@novell.com>
1540 * ecore.cs (MemberExpr): New class. Convert from interface
1542 (MemberExpr.ResolveMemberAccess): Refactor and move here from
1543 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
1545 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
1546 (MethodGroupExpr.IsExplicitImpl): Remove.
1547 (Expression.GetFieldFromEvent): Remove.
1548 (SimpleName.MemberStaticCheck): Remove.
1549 (SimpleName.DoSimpleNameResolve): Update to changes.
1550 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
1551 (MemberAccess.IdenticalNameAndTypeName): Remove.
1552 (MemberAccess.error176): Move to MemberExpr.
1553 (MemberAccess.DoResolve): Update to changes.
1554 (BaseAccess.DoResolve): Likewise.
1556 2005-03-30 Marek Safar <marek.safar@seznam.cz>
1558 C# 2.0 Conditional attribute class implementation
1560 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
1561 Analyzes class whether it has attribute which has ConditionalAttribute
1562 and its condition is not defined.
1564 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
1565 (Class.IsExcluded): New method. Search for at least one defined
1566 condition in ConditionalAttribute of attribute class.
1568 2005-03-30 Raja R Harinath <rharinath@novell.com>
1570 * ecore.cs (PropertyExpr): Derive from Expression, not
1571 ExpressionStatement.
1572 (PropertyExpr.EmitStatement): Remove.
1574 2005-03-29 Raja R Harinath <rharinath@novell.com>
1577 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
1578 internal field "value__" of an enum be private. The examples for
1579 "value__" that I found on MSDN all used FieldAttributes.Private.
1581 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
1582 Don't mention IL method attribute names.
1584 Fix #47991. Remove a TODO.
1585 * statement.cs (Block.Toplevel): Make into a field.
1586 (Block.Parameters): Move into ToplevelBlock.
1587 (Block.known_variables): Rename from child_variable_names.
1588 (Block.Block): Remove variants that take Parameters. Initialize
1589 'Toplevel' with the immediately surrounding toplevel block.
1590 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
1591 LocalInfo parameter.
1592 (Block.GetKnownVariableInfo): New.
1593 (Block.IsVariableNameUsedInChildBlock): Update.
1594 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
1595 the block, even though it may not be in scope.
1596 (Block.AddVariable): Remove Parameters parameter. Use
1597 Toplevel.Parameters instead.
1598 (Block.AddConstant): Remove Parameters parameter.
1599 (Block.GetParameterReference): Update to use Toplevel.Parameters.
1600 (Block.IsParamaterReference): Likewise.
1601 (Block.IsLocalParameter): Likewise. Simplify a lot.
1602 (ToplevelBlock.Parameters): New. Moved from Block.
1603 (ToplevelBlock.ToplevelBlock): Update to changes. Always
1604 initialize Parameters to a non-null value.
1605 * cs-parser.jay: Update to changes.
1606 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
1607 simple names that mean different things in the same block. Use
1608 Block.IsVariableNameUsedInBlock.
1610 2005-03-28 Raja R Harinath <rharinath@novell.com>
1612 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
1614 2005-03-26 Raja R Harinath <harinath@acm.org>
1617 * assign.cs (Assign.DoResolve): When the RHS of an assignment
1618 fails to resolve, ensure that the LHS is still resolved as an
1621 2005-03-25 Raja R Harinath <harinath@acm.org>
1623 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
1625 (Enum.current_ec): Remove.
1626 (Enum.LookupEnumValue): Remove EmitContext argument.
1627 Just uses the one created during DefineType.
1628 (Enum.FindMembers): Update.
1629 * expression.cs (MemberAccess.DoResolve): Update.
1631 2005-03-22 Marek Safar <marek.safar@seznam.cz>
1633 * assign.cs (Assign.DoResolve): Check for CS1717 when
1634 source and target are same (uses Equals).
1636 * expression.cs (LocalVariableReference, ParameterReference,
1637 This): Implemented Equals, GetHashCode.
1639 * statement.cs (Block.GetParameterReference): Removed useless
1642 2005-03-22 Raja R Harinath <rharinath@novell.com>
1645 * statement.cs (Block.AddVariable): Ensure that we skip implicit
1646 blocks before deciding whether the error is cs0136 or cs0128.
1648 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
1649 (using_alias_directive, using_namespace_directive): Pass
1650 MemberName, not an expression to Namespace.UsingAlias and
1652 (MakeName): Use the MemberName of the namespace.
1653 * namespace.cs (Namespace.MemberName): New.
1654 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
1655 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
1657 * decl.cs (MemberName.Name): Make readonly.
1658 (MemberName.FromDotted): New "constructor".
1659 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
1660 (MemberCore.Name): Compute from MemberName on demand.
1661 (MemberCore.SetMemberName): Provide a way to change the
1663 (MemberCore.AddToContainer): Don't take a fullname parameter.
1664 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
1665 fully qualified name of the container to the member name.
1666 (TypeContainer.AddToTypeContainer): Use a fully qualified name
1667 only if the type is a member of the root container.
1668 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
1669 MemberName.Left rather than searching for an embedded ".".
1670 (PartialContainer.CreatePart): Update to changes in RootContext.
1671 (MemberBase.ShortName): Turn into a property. Use
1672 MemberCore.SetMemberName.
1673 (MemberBase.ExplicitInterfaceName): Remove.
1674 (MemberBase.UpdateMemberName): Remove.
1675 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
1676 (PropertyBase.SetMemberName): New override.
1677 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
1678 (Tree.GetDecl): New.
1679 (Tree.AllDecls): Rename from Decls.
1680 * attribute.cs, enum.cs, report.cs: Update to changes.
1681 * driver.cs (MainDriver): Use MemberName.FromDotted on
1682 RootContext.MainClass.
1684 2005-03-21 Marek Safar <marek.safar@seznam.cz>
1686 * class.cs (FixedField.Define): Check for CS1664 and more sanity
1689 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
1691 2005-03-18 Marek Safar <marek.safar@seznam.cz>
1693 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
1694 property accessor modifiers.
1696 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
1697 fixed buffer attribute (CS1716).
1698 (PropertyMethod.HasCustomAccessModifier): When property accessor
1699 has custom modifier.
1701 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
1703 (PropertyExpr.DoResolveLValue): Add CS0272.
1705 2005-03-17 Miguel de Icaza <miguel@novell.com>
1707 * convert.cs: When converting to a pointer, use the proper Conv.U
1708 or Conv.I depending on the source data type.
1710 * cs-tokenizer.cs: Make the size for large decimal constants,
1713 2005-03-17 Martin Baulig <martin@ximian.com>
1715 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
1716 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
1718 2005-03-17 Martin Baulig <martin@ximian.com>
1720 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
1721 to bool so we can return an error condition.
1722 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
1725 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
1727 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
1730 2005-03-16 Raja R Harinath <rharinath@novell.com>
1732 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
1733 Refactor to avoid traversing the list of assemblies, and to avoid
1734 string concatenation.
1735 * typemanager.cs (guid_attr_type): Remove.
1736 (negative_hits, pointers, references): Remove hashes.
1738 (GetConstructedType): New. Uses type_hash to handle constructed
1739 types (arrays, references, pointers).
1740 (GetReferenceType, GetPointerType): Use it.
1741 (GetNestedType): New. Uses type_hash to handle nested types of
1743 (LookupType, LookupTypeDirect): Remove.
1744 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
1745 'types' hash and LookupTypeReflection directly.
1746 (params_string, params_object): Use GetConstructedType.
1747 * namespace.cs (Namespace.cached_types): New. Cache of reflected
1749 (Namespace.Lookup): Use cached_types.
1750 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
1751 provided by old TypeManager.LookupType.
1752 * rootcontext.cs (MakeFQN): Remove.
1753 * decl.cs (DeclSpace.MakeFQN): Likewise.
1754 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
1755 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
1756 TypeManager.GetConstructedType.
1757 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
1759 2005-04-16 Zoltan Varga <vargaz@freemail.hu>
1761 * cs-parser.jay: Fix build.
1763 2005-03-15 Marek Safar <marek.safar@seznam.cz>
1765 * class.cs (TypeContainer.CircularDepException) New nested
1766 (MethodCore.CheckBase): Report CS1715 for properties and indexers.
1768 * cs-parser.jay: Reports CS1527 for any namespace element.
1770 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
1773 * expression.cs (ParameterReference.IsAssigned): Changed error to
1775 (Error_WrongNumArguments): Moved CS0245 detection here.
1777 * statement.cs (Return.Resolve): Add CS1622 report.
1779 2005-03-11 Marek Safar <marek.safar@seznam.cz>
1781 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
1783 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
1785 * attribute.cs expression.cs: Get rid of some allocations.
1787 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
1789 * doc.cs : just eliminate the latest change.
1791 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1793 * doc.cs : commented out the latest change. It breaks xml-030.cs
1795 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1797 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
1798 fail. So invoke CreateType() in FindDocumentedType().
1800 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1802 * cs-tokenizer.cs : added IsKeyword().
1803 * doc.cs : Detect keyword incorrectly used as identifier.
1804 Allow identifiers prefixed by @.
1806 2005-03-10 Marek Safar <marek.safar@seznam.cz>
1808 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
1809 It caused exception in namespace resolving (again!).
1811 * class.cs (Class.ctor): Removed exit.
1812 (PropertyMethod.ctor): ditto.
1814 * codegen.cs (Codegen.Reset): Reset static data.
1815 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
1817 * cs-tokenizer.cs (Cleanup): Removed.
1819 * driver.cs (GetSystemDir): Rewrote to one line command.
1820 It caused problem with unloaded dynamic modules.
1821 (UnixParseOption): Removed Exit.
1822 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
1823 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
1824 Now can be mcs used as library.
1826 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
1829 * location.cs (Reset): Reset static data.
1831 * namespace.cs (Reset): Reset static data.
1833 * report.cs (Report.Reset): Reset static data.
1835 * rootcontext.cs (RootContext.Reset): Reset static data.
1837 * tree.cs (RootTypes.ctor): Use Location.Null
1839 * typemanager.cs (TypeManager.Reset): Reset static data.
1840 (CoreLookupType): Removed Exit.
1841 (TypeHandle.Reset): Reset static data.
1843 2005-03-10 Raja R Harinath <rharinath@novell.com>
1846 * typemanager.cs (ComputeNamespaces): Import namespaces from
1847 referenced modules too.
1849 2005-03-09 Raja R Harinath <rharinath@novell.com>
1851 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
1854 2005-03-09 Raja R Harinath <rharinath@novell.com>
1856 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
1857 enclosing DeclSpace. This ensures that a name-lookup populates
1858 more caches and there are fewer 'TypeExpression's. Carve out
1859 nested type lookup into ...
1860 (LookupNestedTypeInHierarchy): ... this.
1862 2005-04-15 Martin Baulig <martin@ximian.com>
1864 Merged r41590 from MCS and make it work in the generics land.
1866 * generic.cs (TypeParameter.UpdateConstraints): Removed the
1869 * class.cs (PartialContainer.UpdateConstraints): Removed.
1870 (PartialContainer.CheckConstraints): Removed.
1871 (PartialContainer.SetParameterInfo): Store the constraints here.
1872 (PartialContainer.DefineTypeParameters): New public method;
1873 resolve the type parameter's constraints here. Note that the
1874 PartialContainer doesn't have an EmitContext anymore, so we must
1875 do this in the ClassPart.
1877 2005-03-09 Raja R Harinath <rharinath@novell.com>
1879 Clean up a few partial-class semantics.
1880 Fixes test-357.cs and cs1618-2.cs.
1881 * cs-parser.jay (struct_declaration): Use 'current_class' as
1882 parent of newly-created struct. Remove call to Register ().
1883 Use 'pop_current_class' to complete handing the current struct.
1884 (interface_declaration): Likewise.
1885 (class_declaration): Likewise.
1886 (enum_declaration): Use 'current_class' as parent of newly created
1888 (delegate_declaration): Likewise.
1889 (pop_current_class): New function. This is used to handle closing
1890 up the 'current_class' and 'current_container', and pointing them
1891 to the enclosing class/container.
1892 (CSharpParser): Initialize 'current_class' too.
1893 * decl.cs (MemberCore): Add check for invariant: a partial
1894 container is not a parsed entity, and thus does not enclose any
1896 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
1897 (DeclSpace.BaseTypeExpr): Use it.
1898 (DeclSpace.LookupType): Add check for invariant.
1899 * class.cs (TypeContainer): Add check for invariant: a nested
1900 class should have the same NamespaceEntry as its enclosing class.
1901 (TypeContainer.EmitFieldInitializers): Make virtual.
1902 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
1904 (TypeContainer.Register): Remove.
1905 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
1906 null. Use TypeResolveEmitContext for resolving base types and
1907 interfaces. Move initialization of Parts.TypeBuilder here from
1909 (TypeContainer.DefineNestedTypes): ... here.
1910 (PartialContainer): Take a Namespace not a NamespaceEntry.
1911 (PartialContainer.Create): Don't use Register. Call the
1912 appropriate Add... function directly.
1913 (ClassPart): Take both the PartialContainer and the enclosing
1914 class as constructor arguments.
1915 (ClassPart.EmitFieldInitializers): Override.
1916 (ClassPart.PartFindNestedTypes): Remove.
1917 (FieldBase.GetInitializerExpression): Resolve the initializer
1918 expression in the emit context of the enclosing class.
1919 * tree.cs (RootTypes): Remove Register ().
1921 2005-03-08 Marek Safar <marek.safar@seznam.cz>
1923 * cs-parser.jay: Removed CS0134.
1925 * driver.cs: Removed CS1901.
1927 * expression.cs (SizeOf.DoResolve): Don't report CS0233
1928 for predefined types.
1930 2005-03-07 Duncan Mak <duncan@novell.com>
1932 * codegen.cs (Save): Catch UnauthorizedAccessException as
1933 well. Fixes bug #73454.
1935 2005-03-07 Marek Safar <marek.safar@seznam.cz>
1937 * cs-tokenizer.cs (xtoken): Add CS1035.
1939 * class.cs (MethodData.Define): Add CS0683.
1940 (FieldMember.ctor): Add CS0681.
1942 2005-03-07 Raja R Harinath <rharinath@novell.com>
1944 * ecore.cs (SimpleName.DoResolve): Rename from
1945 SimpleName.DoResolveAllowStatic.
1946 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
1947 Pass 'intermediate' flag to MemberStaticCheck.
1948 (SimpleName.MemberStaticCheck): Skip "static check" only in case
1949 of "intermediate" lookups via MemberAccess.
1950 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
1951 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
1953 2005-03-07 Raja R Harinath <rharinath@novell.com>
1956 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
1957 slipped in because of variable names that are identical to a
1958 builtin type's BCL equivalent ('string String;', 'int Int32;').
1959 (PropertyExpr.EmitInstance): Likewise.
1961 2005-03-04 Marek Safar <marek.safar@seznam.cz>
1963 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
1965 * report.cs (warning_ignore_table): Made public.
1967 2005-03-04 Raja R Harinath <rharinath@novell.com>
1970 * class.cs (MethodData.Emit): Pass 'container' to
1971 container.GetObsoleteAttribute instead of 'container.Parent'.
1973 2005-03-03 Marek Safar <marek.safar@seznam.cz>
1975 * cs-parser.jay: Add 1534 error test.
1977 * iterators.cs (Yield.CheckContext): Add error 1629.
1978 (Iterator.ctor): Save unsafe modifier.
1979 (MoveNextMethod.DoEmit): Restore unsafe context.
1981 * namespace.cs (UsingAlias): Better error message.
1983 2005-03-03 Dan Winship <danw@novell.com>
1985 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
1986 the warning message [#73219]
1988 2005-03-03 Raja R Harinath <rharinath@novell.com>
1990 Fix compile with MCS 1.0.0.0.
1991 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
1992 w_restore to not depend on string constant folding.
1994 2005-03-03 Raja R Harinath <rharinath@novell.com>
1996 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
1997 CS0246 check to users who passed 'silent = false'.
1998 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
2000 (SimpleName.SimpleNameResolve): Update.
2001 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
2002 (MemberAccess.IdenticalNameAndTypeName): Update.
2003 * doc.cs (FindDocumentedTypeNonArray): Update.
2005 2005-03-03 Raja R Harinath <rharinath@novell.com>
2007 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
2008 * parameters.cs (ComputeAndDefineParameters): Remove.
2009 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
2010 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
2011 Use GetParameterInfo.
2013 2005-03-02 Marek Safar <marek.safar@seznam.cz>
2015 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
2017 2005-03-02 Raja R Harinath <rharinath@novell.com>
2019 Unify DeclSpace.LookupType and DeclSpace.FindType.
2020 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
2021 is in charge of defining nested types on demand.
2022 (DeclSpace.LookupType): Use it when the current_type is a
2023 TypeBuilder. Use LookupTypeDirect for reflected types.
2024 (DeclSpace.FindType): Remove.
2025 (DeclSpace.LookupInterfaceOrClass): Likewise.
2026 (DeclSpace.DefineTypeAndParents): Likewise.
2027 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
2028 DeclSpace.LookupType.
2029 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
2030 * typemanager.cs (LookupType): Simplify.
2031 (AddUserType): Remove type from negative_hits.
2032 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
2033 * class.cs (TypeContainer.FindMembers): Move handling of nested
2035 (TypeContainer.FindMembers_NestedTypes): ... here.
2036 (TypeContainer.FindNestedType): Implement override.
2037 (ClassPart.FindNestedType): Delegate to PartialContainer.
2038 (ClassPart.PartFindNestedType): Looks up the nested types of the
2041 2005-04-14 Martin Baulig <martin@ximian.com>
2043 * generic.cs (ConstructedType): Moved all the type lookup and
2044 nested class logic into SimpleName.
2045 (ConstructedType.ResolveConstructedType): Our underlying type is
2046 already fully resolved; all the type lookup stuff is in
2049 * ecore.cs (SimpleName.ResolveAsTypeStep): Resolve nested
2050 constructed types here instead of in ConstructedType.
2052 * decl.cs (MemberName.GetTypeExpression): Always create a
2053 SimpleName, not a ConstructedType.
2054 (DeclSpace.ResolveNestedType): Removed; this is now in SimpleName.
2056 2005-03-02 Martin Baulig <martin@ximian.com>
2058 * class.cs (TypeContainer.DoDefineMembers): We also need a default
2059 static constructor in static classes.
2061 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
2063 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
2064 sizeParamIndex is not specified.
2066 2005-03-01 Marek Safar <marek.safar@seznam.cz>
2069 * report.cs (WarningMessage.IsEnabled): Missing null check.
2071 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2073 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
2074 in the fields and not in the properties.
2076 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
2078 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
2081 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2083 * attribute.cs: Small refactoring (improved robustness).
2084 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
2085 (ValidateGuid): Removed.
2086 (Resolve): Removed referenced to above mentioned.
2087 (GetAttributeUsage): Made private and changed to work without
2089 (GetIndexerAttributeValue): Don't crash.
2090 (GetConditionalAttributeValue): Ditto.
2091 (GetClsCompliantAttributeValue): Ditto.
2092 (ExtractSecurityPermissionSet): All attributes exceptions are
2094 (GetPropertyValue): New helper.
2095 (GetMethodImplOptions): New method.
2096 (DefinePInvokeMethod): Reuse common code. Implemented handling of
2097 some missing properties.
2099 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
2100 (Method.ApplyAttributeBuilder): Updated.
2102 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
2105 2005-02-28 Raja R Harinath <rharinath@novell.com>
2108 * report.cs (Report.SymbolRelatedToPreviousError): Handle
2109 non-simple types (array, pointer, reference).
2111 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2113 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
2115 * class.cs (MethodCore.IsDuplicateImplementation): Special error
2117 (Method.CheckBase): Catch wrong destructor here.
2118 (MethodData.Define): Add errors 550, 668.
2120 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
2122 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
2124 * pending.cs (VerifyPendingMethods): Add error 551.
2126 * typemanager.cs (CSharpName): Next error report helper.
2128 2005-02-25 Marek Safar <marek.safar@seznam.cz>
2130 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
2131 attributes. Removed useless attribute double check.
2132 It saves almost 2MBs for corlib.
2134 2005-02-25 Raja R Harinath <rharinath@novell.com>
2137 * statement.cs (ExpressionStatement.Resolve): Make robust to being
2138 called twice in case of error.
2140 2005-02-23 Chris Toshok <toshok@ximian.com>
2142 Fix compiler portions of #72827.
2143 * statement.cs (Block.Emit): call Begin/EndScope on the
2144 EmitContext instead of the ILGenerator.
2146 * codegen.cs (EmitContext.BeginScope): new method, call
2147 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
2149 (EmitContext.BeginScope): same, but EndScope and CloseScope
2151 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
2152 offset and call the superclass's OpenScope(int) with it.
2153 (SymbolWriter.CloseScope): get the current il
2154 offset and call superclass's CloseScope(int) with it.
2156 2005-02-23 Marek Safar <marek.safar@seznam.cz>
2158 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
2159 CS1677 for out and ref as well.
2161 * class.cs (Method.Define): Add error CS1599 detection.
2163 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
2165 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
2167 * delegate.cs (Delegate.Define): Add error CS1599 detection.
2169 * support.cs.cs (ModifierDesc): New helper method.
2171 2005-02-23 Raja R Harinath <rharinath@novell.com>
2172 Abin Thomas <projectmonokochi@rediffmail.com>
2173 Anoob V E <projectmonokochi@rediffmail.com>
2174 Harilal P R <projectmonokochi@rediffmail.com>
2177 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
2178 MemberLookup (used for error reporting) actually returns a result.
2179 Fix error report number (122, not 112).
2181 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
2182 Anoob V E <projectmonokochi@rediffmail.com>
2183 Harilal P R <projectmonokochi@rediffmail.com>
2186 * pending.cs (PendingImplementation.GetAbstractMethods):
2187 Find NonPublic members too.
2189 2005-02-22 Marek Safar <marek.safar@seznam.cz>
2191 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
2194 * class.cs (MethodCore.CheckMethodAgainstBase):
2195 Add error 239 report.
2197 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2199 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
2201 * class.cs (Operator.Define): Add error 217 report.
2203 2005-02-21 Raja R Harinath <rharinath@novell.com>
2206 * expression.cs (Invocation.IsApplicable): Make public.
2207 (Invocation.IsParamsMethodApplicable): Likewise.
2208 * delegate.cs (Delegate.VerifyApplicability): Don't use
2209 Invocation.VerifyArgumentCompat for parameter applicability
2210 testing. Use Invocation.IsApplicable and
2211 Invocation.IsParamsMethodApplicable.
2213 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2215 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
2217 * class.cs (Operator.Define): Add error 217 report.
2219 2005-02-21 Raja R Harinath <rharinath@novell.com>
2221 * namespace.cs (UsingEntry.Resolve): Undo change below.
2223 2005-02-21 Raja R Harinath <rharinath@novell.com>
2226 * ecore.cs (Expression.MemberLookupFailed): Add argument to
2227 disable the error message when the extended MemberLookup also
2229 (Expression.MemberLookupFinal): Update.
2230 (SimpleName.DoSimpleNameResolve): Update.
2231 * expression.cs (MemberAccess.ResolveNamespaceOrType):
2232 Don't use MemberLookupFinal.
2233 (New.DoResolve): Update.
2234 (BaseAccess.CommonResolve): Update.
2236 2005-02-21 Raja R Harinath <rharinath@novell.com>
2239 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
2240 occured previously, don't resolve again.
2242 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2245 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
2246 argument. Call ResolveAttributeUsage for unresolved.
2247 when types doesn't match ctor arguments.
2249 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
2250 for nested attribute classes.
2251 (Class.attribute_usage): Removed.
2252 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
2253 for attribute class.
2255 * ecore.cs (IsAttribute): Removed.
2257 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
2259 * rootcontext.cs (RegisterAttribute): Removed, attributes are
2261 (attribute_types): Removed.
2262 (EmitCode): Global attributes are emited as the latest.
2264 2005-02-18 Marek Safar <marek.safar@seznam.cz>
2266 * class.cs (EmitFieldInitializers): Don't emit field initializer
2267 for default values when optimilization is on.
2269 * constant.cs (Constant.IsDefaultValue): New property.
2271 * driver.cs: Add /optimize handling.
2275 * literal.cs: Implement new IsDefaultValue property.
2277 * rootcontext.cs (Optimize): New field, holds /optimize option.
2279 2005-02-18 Raja R Harinath <rharinath@novell.com>
2281 Fix crasher in re-opened #72347.
2282 * namespace.cs (Namespace.Lookup): Return null if
2283 DeclSpace.DefineType returns null.
2286 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
2288 2005-02-18 Raja R Harinath <rharinath@novell.com>
2290 Fix remainder of #63202. Change semantics of DoResolveLValue: it
2291 now returns null if it cannot resolve to an lvalue.
2292 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
2293 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
2294 returned null. Remove check for SimpleName.
2295 (EventExpr.DoResolveLValue): New.
2296 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
2297 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
2299 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
2301 (Unary.ResolveOperator): Move CS0211 check ...
2302 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
2304 (Unary.DoResolveLValue): Simplify.
2305 (AddressOf.DoResolveLValue): New.
2306 (ArrayAccess.DoResolveLValue): New.
2308 2005-02-16 Marek Safar <marek.safar@seznam.cz>
2310 * attribute.cs (Attribute.Resolve): Add arguments casting for
2311 when types doesn't match ctor arguments.
2313 2005-02-16 Raja R Harinath <rharinath@novell.com>
2315 Fix parts of #63202.
2316 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
2317 lookup of operator in base type. Ensure that all checks happen
2318 when the operator resolves to an "op_..." method.
2320 2005-02-15 Raja R Harinath <rharinath@novell.com>
2323 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
2324 'ignore_cs0104' parameter. Pass it to ...
2325 (NamespaceEntry.Lookup): ... this.
2326 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
2327 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
2328 (TypeLookupExpression.DoResolveAsTypeStep): Update.
2329 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
2330 Update. Request that cs0104 errors be ignored.
2331 (ComposedCast.ResolveAsTypeStep): Update.
2333 2005-02-14 Raja R Harinath <rharinath@novell.com>
2336 * expression.cs (Invocation.BetterFunction): Remove support for
2337 comparing virtual functions and their overrides.
2338 (Invocation.IsOverride): New.
2339 (Invocation.OverloadResolve): Don't consider 'override' functions
2340 during candidate selection. Store them in a lookaside list.
2341 If the selected method is a 'virtual' function, use the list to
2342 find any overrides that are closer to the LHS type.
2344 2005-02-14 Marek Safar <marek.safar@seznam.cz>
2346 * expression.cs (New.DoResolve): Add complex core type reduction.
2347 (New.Constantify): Converts complex core type syntax like 'new int ()'
2350 2005-02-14 Raja R Harinath <rharinath@novell.com>
2352 * decl.cs (EntryType.EntryType): New constructor to create an
2353 updated copy of a cache entry.
2354 (MemberCache.AddMethods): Use it.
2355 (MemberCache.ClearDeclaredOnly): Remove.
2356 (MemberCache.MemberCache): Update.
2358 2005-02-11 Miguel de Icaza <miguel@novell.com>
2360 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
2361 variable. This one is represents the actual low-level declaration
2362 of the method, as opposed to the semantic level `IsStatic'.
2364 An anonymous method which is hosted into a static method might be
2365 actually an instance method. IsStatic would reflect the
2366 container, while MethodIsStatic represents the actual code
2369 * expression.cs (ParameterReference): Use the new MethodIsStatic
2370 instead of IsStatic.
2372 * anonymous.cs (AnonymousMethod.Compatible): Pass the
2373 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
2374 set on the current EmitContext.
2376 * expression.cs (Cast): Overload DoResolveLValue so we can pass
2377 resolve our casted expression as an LValue. This triggers the
2378 proper LValue processing that is later required by Assign.
2382 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
2384 2005-02-11 Marek Safar <marek.safar@seznam.cz>
2386 C# 2.0 Fixed buffer implementation
2388 * anonymous.cs: Update after RegisterHelperClass renaming.
2390 * attribute.cs (AttributeTester.fixed_buffer_cache):
2391 Cache of external fixed buffers.
2392 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
2393 implementation if field is fixed buffer else null.
2396 (TypeContainer.AddField): Accept FieldMember instead of Field.
2397 (FieldBase.IsFieldClsCompliant): Extracted code from
2398 VerifyClsCompliance descendant customization.
2399 (FixedField): New class handles fixed buffer fields.
2400 (FixedFieldExternal): Keeps information about imported fixed
2402 (IFixedField): Make access to internal or external fixed buffer
2405 * cs-parser.jay: Add fixed buffer parsing.
2407 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
2410 * expression.cs (Indirection): Extended implementation to accept
2412 (PointerArithmetic.Emit): Get element from fixed buffer as well.
2413 (ElementAccess.MakePointerAccess): Get type as parameter.
2414 (DoResolve): Add fixed buffer field expression conversion.
2415 (DoResolveLValue): Ditto.
2416 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
2417 (ArrayPtr): Derives from FixedBufferPtr.
2418 (ArrayPtr.Emit): Add extra emit for array elements.
2420 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
2422 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
2423 for compiler generated types.
2424 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
2426 * statement.cs (Fixed): Refactored to be easier add fixed buffer
2427 and consume less memory.
2428 (Fixed.Resolve): Add fixed buffer case.
2430 * typemanager.cs (compiler_generated_attr_ctor,
2431 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
2432 (HasElementType): Add our own implementation to work on every
2435 2005-02-11 Miguel de Icaza <miguel@novell.com>
2437 * anonymous.cs (CaptureContext): Track whether `this' has been
2440 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
2441 only captured `this' if it was implicitly done (instance
2442 methods/variables were used).
2444 * codegen.cs (EmitContext.CaptureThis): New method to flag that
2445 `this' must be captured.
2447 2005-01-30 Miguel de Icaza <miguel@novell.com>
2449 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
2450 is null it means that there has been no need to capture anything,
2451 so we just create a sibling.
2453 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
2455 Just a partial fix. The other half is fairly elusive.
2457 2005-02-10 Raja R Harinath <rharinath@novell.com>
2459 Fix #52586, cs0121-4.cs.
2460 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
2461 and return a hashtable.
2462 (MemberCache.ClearDeclaredOnly): New.
2463 (MemberCache.MemberCache): Update to change. Make a deep copy of
2464 the method_hash of a base type too.
2465 (MemberCache.AddMethods): Adapt to having a deep copy of the base
2466 type methods. Overwrite entries with the same MethodHandle so
2467 that the ReflectedType is correct. The process leaves in base
2468 virtual functions and their overrides as distinct entries.
2469 (CacheEntry): Now a class instead of a struct. It shouldn't alter
2470 matters since it was boxed in a ArrayList before.
2471 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
2473 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
2474 case of a virtual function and its override (choose the overload
2476 (Invocation.OverloadResolve): Avoid 'override' members during
2477 'applicable_type' calculation.
2479 2005-03-28 Raja R Harinath <rharinath@novell.com>
2481 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
2482 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
2483 GetTypeHandle. It is possible for a reflected type to derive from
2484 a TypeBuilder (e.g., int[] derives from the TypeBuilder
2485 System.Array during mscorlib compilation).
2486 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
2487 contain a method_hash, don't create one either. Don't create a
2488 deep copy of the base cache's method_hash.
2489 (MemberCache.SetupCache): Rename back from DeepCopy.
2490 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
2491 already initialized. If we see an override function, add its
2492 underlying base virtual function to the member_hash too.
2494 2005-02-09 Raja R Harinath <rharinath@novell.com>
2496 Combine two near-redundant caches.
2497 * typemanager.cs (method_params): Rename from method_internal_params.
2498 (TypeManager.GetParameterData): New. Replace
2499 Invocation.GetParameterData.
2500 (TypeManager.LookupParametersByBuilder): Remove.
2501 * expression.cs (Invocation.method_parameter_cache): Remove.
2502 (Invocation.GetParameterData): Remove.
2504 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
2507 2005-02-08 Raja R Harinath <rharinath@novell.com>
2510 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
2511 TypeManager.multicast_delegate_type is null, resolve it by looking
2512 up "System.MulticastDelegate".
2513 * rootcontext.cs (RootContext.ResolveCore): Simplify.
2515 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
2516 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
2517 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
2520 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
2521 (LabeledStatement.AddReference): New. Set 'referenced'.
2522 (Goto.Resolve): Use it.
2524 2005-02-05 John Luke <john.luke@gmail.com>
2526 * driver.cs: remove duplicate -doc line in Usage ()
2528 2005-02-04 Raja R Harinath <rharinath@novell.com>
2530 * location.cs (Location.AddFile): Fix CS2002 error report.
2532 2005-02-02 Martin Baulig <martin@ximian.com>
2534 * delegate.cs (Delegate.DefineType): Report an internal error if
2535 TypeManager.multicast_delegate_type is null. See bug #72015 for
2538 2005-02-02 Raja R Harinath <rharinath@novell.com>
2540 Fix a crasher in a variant of #31984.
2541 * const.cs (Constant.CheckBase): New override that defers the
2542 new-or-override check in case the base type hasn't been populated
2544 (Constant.Define): Ensure the new-or-override check is performed.
2546 2005-02-01 Duncan Mak <duncan@ximian.com>
2548 * const.cs (LookupConstantValue): Check that `ce' is not null
2549 before calling GetValue ().
2551 2005-02-01 Raja R Harinath <rharinath@novell.com>
2553 Fix test-334.cs (#69519).
2554 * cs-parser.jay (using_alias_directive): Pass in an expression to
2555 NamespaceEntry.UsingAlias.
2556 (using_namespace_directive): Pass in an expression to
2557 NamespaceEntry.Using.
2558 (namespace_name): Don't flatten to a string.
2559 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
2560 (NamespaceEntry.AliasEntry.Resolve): Lookup using
2562 (NamespaceEntry.UsingEntry): Likewise.
2563 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
2565 (NamespaceEntry.LookupForUsing): Remove.
2566 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
2568 (NamespaceEntry.Lookup): Remove support for dotted names.
2570 2005-02-01 Raja R Harinath <rharinath@novell.com>
2572 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
2574 (NamespaceEntry.ImplicitParent): Compute on demand.
2575 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
2576 parallels the current.
2577 (NamespaceEntry.LookupForUsing): Use it.
2578 (NamespaceEntry.Lookup): If the current namespace-entry is
2579 implicit, don't search aliases and using tables.
2581 2005-02-01 Raja R Harinath <rharinath@novell.com>
2584 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
2586 (TypeContainer.BaseCache): Compute on demand.
2587 (TypeContainer.FindMembers): Define constants and types if they're
2588 not already created.
2589 (FieldMember.Define): Move resetting of ec.InUnsafe before error
2591 * const.cs (Constant.Define): Make idempotent.
2593 2005-01-29 Miguel de Icaza <miguel@novell.com>
2595 * pending.cs: Produce better code (no nops produced by using Ldarg
2598 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
2599 i - 1' it should be arg + 1.
2603 2005-01-28 Raja R Harinath <rharinath@novell.com>
2605 * attribute.cs (Attribute.CheckAttributeType): Make private
2607 (Attribute.ResolveType): Make virtual.
2608 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
2609 handling of RootContext.Tree.Types.
2611 2005-01-27 Raja R Harinath <rharinath@novell.com>
2613 Update attribute-handling to use the SimpleName/MemberAccess
2615 * cs-parser.jay (attribute): Pass in an expression to the
2616 constructors of Attribute and GlobalAttribute.
2617 * attribute.cs (Attribute): Take an expression for the name.
2618 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
2619 passed in attribute name expression.
2620 (Attribute.CheckAttributeType): Use it.
2621 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
2622 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
2623 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
2624 argument to prevent error messages if the lookup fails.
2626 2005-01-27 Marek Safar <marek.safar@seznam.cz>
2628 * expression.cs (Indirection): Implemented IVariable interface
2629 to support indirection in AddressOf operator.
2630 (PointerArithmetic.Emit): Add optimalization for case where
2631 result can be precomputed.
2633 2005-01-26 Martin Baulig <martin@ximian.com>
2635 * class.cs (TypeContainer.AttributeTargets): Return the correct
2636 AttributeTargets depending on our `Kind' instead of throwing an
2637 exception; fixes #71632.
2639 2005-01-26 Marek Safar <marek.safar@seznam.cz>
2642 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
2645 2005-03-17 Martin Baulig <martin@ximian.com>
2647 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2648 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2650 2005-03-17 Martin Baulig <martin@ximian.com>
2652 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2653 to bool so we can return an error condition.
2654 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2657 2005-03-17 Martin Baulig <martin@ximian.com>
2659 * generic.cs (TypeMananager.IsIEnumerable): New public method.
2661 * convert.cs (Convert.ImplicitReferenceConversion(Exists)): Allow
2662 converting from an array-type of T to `IEnumerable<T>'.
2664 2005-03-16 Martin Baulig <martin@ximian.com>
2666 * generic.cs (Nullable.Unwrap): Implement IAssignMethod.
2667 (Nullable.LiftedUnaryMutator): New public class.
2669 * expression.cs (UnaryMutator.DoResolve): Added support for
2672 2005-03-14 Martin Baulig <martin@ximian.com>
2674 * generic.cs (Nullable.NullCoalescingOperator): Implemented.
2676 2005-03-14 Martin Baulig <martin@ximian.com>
2678 * generic.cs (Nullable.LiftedBinaryOperator): Added support for
2679 the comparision operators `<', `>', `<=' and `>='.
2681 2005-03-13 Martin Baulig <martin@ximian.com>
2684 (Nullable.NullLiteral): Renamed to `Nullable.NullableLiteral' to
2685 avoid confusion with the `NullLiteral'.
2686 (Nullable.LiftedBinaryOperator): Correctly implement `==' and '!='.
2688 2005-03-13 Martin Baulig <martin@ximian.com>
2690 * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
2691 comparing arbitrary types with the null literal.
2693 2005-03-13 Martin Baulig <martin@ximian.com>
2695 * generic.cs (Nullable.LiftedBinaryOperator): Add support for the
2696 boolean operators '&&', '||', '&' and '|'.
2697 (Nullable.OperatorTrueOrFalse): New public class.
2699 * ecore.cs (Expression.GetOperatorTrue/False): Return an `Expression'
2700 instead of a `StaticCallExpr'; added support for nullables.
2702 2005-03-10 Martin Baulig <martin@ximian.com>
2705 (ArrayAccess.EmitDynamicInitializers): Use `etype.IsValueType'
2706 rather than `etype.IsSubclassOf (TypeManager.value_type)'.
2708 2005-03-07 Martin Baulig <martin@ximian.com>
2710 * generic.cs (Nullable.Unwrap): Implement IMemoryLocation and make
2711 it work if `expr' is not an IMemoryLocation.
2712 (Nullable.Lifted): Implement IMemoryLocation.
2713 (Nullable.LiftedConversion.ResolveUnderlying): Use the correct
2716 2005-03-05 Martin Baulig <martin@ximian.com>
2718 * generic.cs (Nullable.Unwrap, Wrap): New protected classes.
2719 (Nullable.Lifted): New abstract class; rewrote the lifted conversions.
2720 (Nullable): Added support for lifted unary and binary operators.
2722 * expression.cs (Unary.DoResolve): Added support for nullable types.
2723 (Binary.DoResolve): Likewise.
2724 (Conditional.DoResolve): Likewise.
2726 2005-03-02 Martin Baulig <martin@ximian.com>
2728 * decl.cs (DeclSpace.SetParameterInfo): Make this virtual.
2730 * class.cs (ClassPart.SetParameterInfo): Override this.
2731 (PartialContainer.SetParameterInfo): Override this.
2732 (TypeContainer.CheckConstraints): New protected method.
2733 (PartialContainer.CheckConstraints): Override this and check
2734 whether the same contraints were specified in all parts of a
2735 partial generic type definition.
2736 (PartialContainer.UpdateConstraints): New public method.
2738 * generic.cs (TypeParameter.UpdateConstraints): New public method.
2740 2005-03-02 Martin Baulig <martin@ximian.com>
2742 Committing a patch from Carlos Alberto Cortez to fix #72887.
2744 * convert.cs (Convert.ExplicitReferenceConversionExists): Allow
2745 casts from `T []' to `int []'.
2747 2005-03-02 Martin Baulig <martin@ximian.com>
2749 * generic.cs (TypeManager.IsEqual): Make this symmetric.
2751 * expression.cs (Binary.ResolveOperator): When resolving a
2752 BinaryDelegate, use `TypeManager.IsEqual (l, r)' rather than just
2753 `=='. Fixes #71866. See gen-127.cs.
2755 2005-03-02 Martin Baulig <martin@ximian.com>
2757 * class.cs (TypeContainer.DoDefineMembers): We also need a default
2758 static constructor in static classes.
2760 2005-03-02 Martin Baulig <martin@ximian.com>
2763 (NullableType.Name, NullableType.FullName): Add a "?" to the name.
2764 (Nullable.LiftedConversion): Added support for user-defined
2767 * cs-tokenizer.cs (Tokenizer.PutbackCloseParens): New public method.
2769 * cs-parser.jay: Use ComposedCast everywhere instead of
2770 NullableType, so we don't need to check for NullableType
2772 (conditional_expression): Added `INTERR CLOSE_PARENS' rule for the
2773 case where we'll be resolved into a `parenthesized_expression_0'
2777 (Convert.UserDefinedConversion): Added nullable conversions.
2779 2005-02-28 Martin Baulig <martin@ximian.com>
2781 * generic.cs (TypeManager.IsNullableType): New static method.
2782 (Nullable): New abstract class.
2783 (Nullable.NullLiteral): New public class.
2784 (Nullable.LiftedConversion): New public class.
2786 * cs-parser.jay (non_expression_type): Changed `builtin_types' to
2787 `builtin_types opt_nullable'.
2790 (Convert.ImplicitConversionStandard): Added nullable conversions.
2791 (Convert.ExplicitConversionStandard): Likewise.
2792 (Convert.ExplicitConversion): Likewise.
2794 2005-02-26 Martin Baulig <martin@ximian.com>
2796 * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
2797 begin with a "?", for instance "?[]". Don't do a type lookup if
2800 2005-02-25 Martin Baulig <martin@ximian.com>
2802 The first part of Nullable Types :-)
2804 * generic.cs (NullableType): New public class.
2805 (NullCoalescingOperator): New public class.
2806 (TypeArguments.Resolve): Add a CS0306 check.
2808 * cs-parser.jay (opt_error_modifier): Removed, this was unused.
2809 (opt_nullable): New rule.
2810 (type): Added `opt_nullable' to `namespace_or_type_name',
2811 `builtin_types' and `pointer_type'.
2812 (array_type): Added `opt_nullable'.
2813 (opt_rank_specifier_or_nullable): New rule; this is the
2814 combination of `opt_rank_specifier' and `opt_nullable'.
2815 (opt_error): New rule; catch errors here.
2816 (nullable_type_or_conditional): New rule; we use this to check for
2817 nullable and still detect the conditional operator.
2818 (local_variable_type): Use `opt_rank_specifier_or_nullable'
2819 instead `opt_rank_specifier'.
2821 * expression.cs (ComposedCast.DoResolveAsTypeStep): Added support
2824 2005-02-24 Martin Baulig <martin@ximian.com>
2826 * README, README.Changes: Removed; they're old and obsolete.
2828 2005-02-22 Martin Baulig <martin@ximian.com>
2830 * generic.cs (TypeParameter.Resolve): If resolving the constraints
2831 returned an error, set `constraints' to null to avoid a crash
2833 (TypeParameter.ResolveType): Likewise.
2835 2005-02-22 Martin Baulig <martin@ximian.com>
2838 (Constraints.ResolveTypes): Protect against being called twice.
2839 (Constraints.CheckInterfaceMethod): Don't call ResolveTypes().
2840 (TypeParameter.ResolveType): New public method; calls
2841 constraints.ResolveTypes().
2842 (TypeParameter.DefineType): Moved constraints.ResolveType() out
2843 into the new ResolveType().
2844 (GenericMethod.Define): Call ResolveType() on all our
2847 2005-02-21 Martin Baulig <martin@ximian.com>
2850 (TypeManager.generic_nullable_type): New static public field.
2851 (TypeManager.InitGenericCoreType): Lookup "System.Nullable`1".
2854 (RootContext.ResolveCore): Resolve "System.Nullable`1".
2856 2005-02-15 Martin Baulig <martin@ximian.com>
2858 * generic.cs (ConstructedType.Constraints): Correctly check
2859 constraints if the argument type is a type parameter; fixes
2862 2005-02-02 Martin Baulig <martin@ximian.com>
2864 * delegate.cs (Delegate.DefineType): Report an internal error if
2865 TypeManager.multicast_delegate_type is null. See bug #72015 for
2868 2005-01-29 Miguel de Icaza <miguel@novell.com>
2870 * pending.cs: Produce better code (no nops produced by using Ldarg
2873 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
2874 i - 1' it should be arg + 1.
2878 2005-01-26 Martin Baulig <martin@ximian.com>
2880 * cs-parser.jay (indexer_declarator): Don't report an error if we
2881 have type parameters since we can be an explicit interface
2882 implementation; fixes #71449.
2884 2005-01-26 Martin Baulig <martin@ximian.com>
2886 * class.cs (TypeContainer.AttributeTargets): Return the correct
2887 AttributeTargets depending on our `Kind' instead of throwing an
2888 exception; fixes #71632.
2890 2005-01-26 Martin Baulig <martin@ximian.com>
2892 * delegate.cs (Delegate.DefineType): Correctly define our type
2893 parameters. Fixes #71483.
2895 2005-01-25 Raja R Harinath <rharinath@novell.com>
2898 * expression.cs (MemberAccess.DoResolve): Don't complain with
2899 cs0572 when the LHS of a member access has identical name and type
2902 2005-01-25 Marek Safar <marek.safar@seznam.cz>
2905 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
2907 Create custom PermissionSet only for PermissionSetAttribute.
2909 2005-01-24 Marek Safar <marek.safar@seznam.cz>
2912 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
2913 delegates in static class.
2915 2005-01-24 Martin Baulig <martin@ximian.com>
2917 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2918 merging an implicit block, just use its reachability.
2920 * statement.cs (Block.Resolve): Make the unreachable code check
2921 work wrt. implicit blocks; see test-337 from #63842.
2923 2005-01-21 Alp Toker <alp@atoker.com>
2925 * cs-parser.jay: destructor_declaration's container is PartialContainer
2926 not Class when partial types are used, so use Kind prop instead of
2929 2005-01-22 Miguel de Icaza <miguel@ximian.com>
2931 * cs-parser.jay: Improve error reporting when an interface
2934 2005-01-20 Dick Porter <dick@ximian.com>
2936 * support.cs: SeekableStreamReader fix from Sandor Dobos
2937 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
2938 chars are read. Fixes bug 70369.
2940 2005-01-20 Raja R Harinath <rharinath@novell.com>
2942 * cs-parser.jay (catch_clause): Simplify current_block handling
2945 2005-01-17 Miguel de Icaza <miguel@ximian.com>
2947 * convert.cs (ImplicitStandardConversionExists): Synchronize the
2948 code with ImplicitStandardConversion to handle the implicit
2949 conversion of method groups into valid delegate invocations.
2951 The problem is that in parameter handling we were using this code
2952 path. Fixes bug #64698
2954 2005-01-19 Raja R Harinath <rharinath@novell.com>
2956 * cs-parser.jay: Fix several infelicities.
2957 - Avoid assigning to the parser value stack. Code like
2958 '$3 = null' is unclean. Synthesize a value for the code block
2960 - Avoid using oob_stack for storing location information. Use ...
2961 (_mark_): ... this. New (empty) rule. Saves the current location
2963 (foreach_statement): Avoid using oob_stack for current_block
2964 handling. Use technique used in for_statement and
2965 using_statement. Synthesize a value for the code block to store
2966 additional intermediate information.
2968 2005-01-13 Miguel de Icaza <miguel@ximian.com>
2970 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
2971 of a different type is only allowed to private fields of a
2972 containing type, not on fields of a base class.
2974 See test-174.cs and error cs0122-9.cs
2976 2005-01-13 Raja R Harinath <rharinath@novell.com>
2978 Fix test-335.cs (bug #58126).
2979 * cs-parser.jay (argument): Split out non-expression parts of the
2980 rule into 'non_simple_argument'.
2981 (invocation_expression): Support parenthesized invocations with
2982 multiple arguments, and with single non-simple arguments.
2984 2005-01-13 Raja R Harinath <rharinath@novell.com>
2986 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
2989 2005-01-12 Raja R Harinath <rharinath@novell.com>
2991 Fix cs0038-1.cs, cs1640-6.cs.
2992 * ecore.cs (Expression.Resolve): Remove special-case for
2993 SimpleName in error-handling.
2994 (Expression.almostMatchedMembers): Relax access permission to
2996 (Expression.MemberLookupFailed): Handle duplicates in
2997 almostMatchedMembers list.
2998 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
2999 * expression.cs (New.DoResolve): Report CS1540 for more cases.
3000 * typemanager.cs (GetFullNameSignature): Use the MethodBase
3001 overload if the passed in MemberInfo is a MethodBase.
3003 2005-01-25 Martin Baulig <martin@ximian.com>
3006 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
3008 2005-01-12 Marek Safar <marek.safar@seznam.cz>
3011 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
3012 for non-CAS & merge permission sets properly.
3014 2005-01-11 Raja R Harinath <rharinath@novell.com>
3016 Improve standard-compliance of simple name and member access
3017 resolution. Fixes bugs #52697, #57200, #67520, #69519.
3018 * ecore.cs (FullNamedExpression): New abstract base class
3019 for Namespaces and TypeExpressions.
3020 (ResolveFlags.SimpleName): Remove.
3021 (SimpleName): Remove support for dotted names.
3022 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
3023 DeclSpace.FindType and DeclSpace.LookupType.
3024 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
3025 (Expression.ExprClassName): Make member function.
3026 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
3027 a namespace. Remove creation of dotted "SimpleName"s.
3028 (MemberAccess.DoResolve): Likewise.
3029 * decl.cs (DeclSpace.Cache): Make private.
3030 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
3031 (DeclSpace.FindType): Update.
3032 (DeclSpace.LookupType): Move here from RootContext. Return a
3033 FullNamedExpression.
3034 * namespace.cs (Namespace): Derive from FullNamedExpression
3035 so that it can be part of expression resolution.
3036 (Namespace.Lookup): Return an FullNamedExpression.
3037 (NamespaceEntry.LookupAlias): Lookup aliases only in current
3039 * rootcontext.cs (NamespaceLookup): Remove.
3040 (LookupType): Move to DeclSpace.
3041 * attribute.cs (CheckAttributeType): Update.
3042 * doc.cs (FindDocumentedType): Remove allowAlias argument.
3043 (FindDocumentedTypeNonArray): Likewise.
3045 2005-01-11 Raja R Harinath <rharinath@novell.com>
3047 Fix cs0509.cs, cs1632.cs.
3048 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
3049 is the same as IsInterface.
3050 (TypeContainer.GetClassBases): Likewise.
3051 * statement.cs (LabeledStatement.ig): New field.
3052 (LabeledStatement.LabelTarget): Save ILGenerator which created the
3054 (LabeledStatement.DoEmit): Check that the label was created with
3055 the same ILGenerator.
3057 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3060 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
3061 accessors to its properties.
3063 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
3064 from accessors to property.
3066 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3069 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
3072 2005-01-08 Miguel de Icaza <miguel@ximian.com>
3074 * attribute.cs: Check for null and empty strings.
3076 I have lost another battle to Paolo.
3078 2005-01-07 Marek Safar <marek.safar@seznam.cz>
3081 * class.cs (PropertyMethod): Set Parent field in ctors.
3082 (SetMethod.InternalParameters): Add unsafe switch hack.
3083 Override MarkForDuplicationCheck where it is appropriate.
3085 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
3086 It says whether container allows members with the same name.
3088 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
3089 Removed is_method parameter.
3091 2005-01-06 Duncan Mak <duncan@ximian.com>
3093 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
3094 because the previous change led to incorrect reporting of CS1032
3095 ("Cannot define/undefine preprocessor symbols after first token in
3096 file"). Instead of using `tokens_seen' as the only flag that
3097 triggers CS1040, introduce `comments_seen'. This new flag is used
3098 to signify having seen comments on the current line, so it is
3099 unset after a newline.
3101 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3103 * doc.cs : When searching for a type, find nested type too.
3104 This fixes bug #71040.
3106 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3109 - Warn missing member comment on those classes which also does not
3110 have doc comments. Fixed bug #71041.
3111 - Don't warn missing doc comment on default constructor.
3114 2005-01-06 Duncan Mak <duncan@ximian.com>
3116 * cs-tokenizer.cs (xtoken): After handling traditional C-style
3117 comments, set `tokens_seen' to true. This allows us to detect
3118 misplaced preprocessor directives (i.e. not at the beginning of
3119 the a line, nor after whitespaces). In that case, report error
3120 CS1040. This fixes bug #56460.
3122 * cs-parser.jay (interface_member_declaration): Add checks for
3123 IsExplicitImpl, and report CS0541 error if an interface member is
3124 defined as an explicit interface declaration.
3126 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3129 * class.cs (PropertyMethod): Set Parent field in ctors.
3130 (SetMethod.InternalParameters): Add unsafe switch hack.
3132 * decl.cs (MemberCore.Parent): Cannot be readonly.
3134 2005-01-06 Raja R Harinath <rharinath@novell.com>
3136 * decl.cs (DeclSpace.ResolveType): Remove.
3137 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3138 Merge in code from ...
3139 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3140 * class.cs, enum.cs: Update to changes.
3142 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3144 * anonymous.cs: Ensure that we init the scope of our parent if it
3145 has not been initialized yet.
3147 2004-12-30 Duncan Mak <duncan@ximian.com>
3149 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3150 if field.FieldBuilder is null. Fixes #70758.
3152 * convert.cs: Fixed some typos and updated some of the comments.
3153 (ImplicitStandardConversionExists):
3154 (TryImplicitIntConversion): If `target_type' is an interface and
3155 the type of `ic' implements this interface, return true or a new
3156 BoxedCast instead of null. This fixes #70468.
3158 2004-12-29 Duncan Mak <duncan@ximian.com>
3160 * expression.cs (Argument.Emit): Check that Expr is
3161 IMemoryLocation before casting to it, and report CS1510 otherwise.
3165 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3167 * statement.cs (Block.ThisVariable): remove the recursion here, to
3168 make the --profile more sane.
3170 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3172 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3173 assembly, by JB Evain.
3175 2004-12-17 Raja R Harinath <rharinath@novell.com>
3177 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
3178 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
3179 "parent" refers to enclosing type/class. "base" refers to superclass.
3181 2004-12-17 Raja R Harinath <rharinath@novell.com>
3183 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3184 Ensure that we only have GlobalAttributes.
3185 * attribute.cs (Attribute.Emit): Make non-virtual.
3186 (GlobalAttribute.Emit): Remove.
3187 (Attribute.Resolve): Make virtual.
3188 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
3189 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
3190 the argument. Don't create one.
3191 (Attribute.GetObsoleteAttribute): Likewise.
3192 (Attribute.GetClsCompliantAttributeValue): Likewise.
3193 * class.cs, decl.cs: Update to changes.
3195 2004-12-17 Marek Safar <marek.safar@seznam.cz>
3197 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
3199 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
3201 * statement.cs (Foreach.Resolve): Add error 186 report.
3203 2004-12-16 Marek Safar <marek.safar@seznam.cz>
3205 * expression.cs (Conditional.DoResolve): Add warning 429.
3207 * statement.cs (If.Resolve): Add warning 665.
3209 2004-12-16 Raja R Harinath <rharinath@novell.com>
3211 New invariant: RootContext.Tree.Types.NamespaceEntry == null
3212 except when in the parser, and in GlobalAttribute.
3213 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
3214 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
3215 RootContext.Tree.Types.NamespaceEntry once work is done.
3216 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
3217 and resets RootContext.Tree.Types.NamespaceEntry.
3219 2004-12-15 Marek Safar <marek.safar@seznam.cz>
3221 * cs-parser.jay: Don't create a block for every variable.
3223 2004-12-14 Miguel de Icaza <miguel@ximian.com>
3225 * location.cs: Provide extra information.
3227 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
3228 variables from the captured environment, it is the ldarg_0.
3230 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3232 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
3235 * class.cs: Changed warning level for 169 to avoid developer
3236 displeasure from warning flooding. It will be changed back when they
3237 fix most of current BCL warnings.
3239 * RootContext.cs: Pushed default WarningLevel to 3.
3241 * statement.cs: Removed unused variable.
3243 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3245 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
3246 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
3247 Add error 502 report.
3248 (StaticClass.DefineType): Add error 441 report.
3249 (Class.AllowedModifiersProp): New virtual property as temporary
3250 extension to AllowedModifiers.
3251 (Class.DefineType): Add error 418 report. Moved ModFlags check here
3252 to share implementation with StaticClass and don't call virtual
3255 * driver.cs (MainDriver): Add error 1558 test.
3257 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
3258 report. Moved error 36 test here.
3260 * statement.cs (Throw.Resolve): Add error 724 report.
3262 * typemanager.cs: Add out_attribute_type core type.
3264 2004-12-13 Marek Safar <marek.safar@seznam.cz>
3266 * class.cs (TypeContainer.VerifyClsCompliance): Add error
3268 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
3270 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
3273 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
3275 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
3276 Add error 3023 report.
3277 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
3279 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
3282 2004-12-12 John Luke <john.luke@gmail.com>
3284 * driver.cs (AddArgs): take -- into account when
3285 adding arguments, fixes bug 65710
3287 2004-12-12 Martin Baulig <martin@ximian.com>
3289 * expression.cs (Unary.TryReduceNegative): Added support for
3290 SByteConstant and ByteConstant.
3291 (Unary.Reduce): Check error values from TryReduceNegative().
3293 2004-12-10 Marek Safar <marek.safar@seznam.cz>
3295 * attributes.cs (Attribute.Resolve): Avoid multiple error report
3296 and report exception as error 182.
3298 2004-12-10 Raja R Harinath <rharinath@novell.com>
3300 * driver.cs (Main): Fix message when there are warnings.
3302 2004-12-09 Miguel de Icaza <miguel@ximian.com>
3304 * delegate.cs: Fixed my fix from yesterday, sorry about that.
3306 2004-12-09 Marek Safar <marek.safar@seznam.cz>
3308 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
3309 Reduced number of warnings.
3311 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
3313 2004-12-08 Miguel de Icaza <miguel@ximian.com>
3315 * driver.cs: Removed message.
3317 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
3319 2004-12-08 <vargaz@freemail.hu>
3321 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
3323 2004-12-08 Martin Baulig <martin@ximian.com>
3325 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
3326 instead of a CS3002 for properties and indexer.
3328 2004-12-08 Martin Baulig <martin@ximian.com>
3330 * decl.cs (MemberName.ToString): Make this work again.
3332 2004-12-08 Marek Safar <marek.safar@seznam.cz>
3334 * attribute.cs (Resolve): Add error 591 detection.
3336 * class.cs (FieldMember.Define): Add error 1547 detection.
3337 (Indexer.Define): Add error 620 detection.
3338 (Operator.Define): Add error 590 detection.
3340 * ecore.cs: Missing argument for error 79.
3342 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
3345 2004-12-07 Marek Safar <marek.safar@seznam.cz>
3348 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
3351 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
3353 * cs-parser.jay : handle doc comments on implicit/explicit operators.
3354 Some operator comments were suppressed.
3355 * doc.cs : Implicit/explicit operator name in doc comments are like
3356 "op_Explicit(type)~returnType", so added suffix handling.
3358 2005-01-21 Alp Toker <alp@atoker.com>
3360 * cs-parser.jay: destructor_declaration's container is PartialContainer
3361 not Class when partial types are used, so use Kind prop instead of 'is'.
3363 2004-12-12 Martin Baulig <martin@ximian.com>
3365 * expression.cs (Unary.TryReduceNegative): Added support for
3366 SByteConstant and ByteConstant.
3367 (Unary.Reduce): Check error values from TryReduceNegative().
3369 2004-12-11 Martin Baulig <martin@ximian.com>
3371 * support.cs (ReflectionParameters.ParameterName): If we have a
3372 `gpd', call `ParameterName' on it.
3374 * parameter.cs (Parameter.GetParameterAttributes): New static method.
3376 * pending.cs (PendingImplementation.DefineProxy): Call
3377 DefineParameter() for all of the MethodBuilder's arguments.
3379 2004-12-09 Martin Baulig <martin@ximian.com>
3381 * doc.cs (DocUtil): Make this a static class.
3383 2004-12-09 Martin Baulig <martin@ximian.com>
3385 * expression.cs (Invocation.InferType): Moved the type inference
3386 implementation into TypeManager.
3388 * generics.cs (TypeManager): Moved the type inference
3389 implementation here.
3391 2004-12-09 Martin Baulig <martin@ximian.com>
3393 * typemanager.cs (TypeManager): Make this a partial class.
3396 (TypeManager): Move the generics part of `TypeManager' here.
3398 2004-12-08 Martin Baulig <martin@ximian.com>
3400 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
3401 instead of a CS3002 for properties and indexer. Added CS3024
3402 check for generic interfaces.
3404 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
3405 instances are not CLS-compliant.
3407 2004-12-08 Martin Baulig <martin@ximian.com>
3410 (void_pointer_expression): New rule for `void*', `void**' etc.
3411 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
3413 2004-12-08 Martin Baulig <martin@ximian.com>
3415 * expression.cs (Invocation.InferType): Removed the hack for
3416 MethodCore.MayUnify().
3418 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
3421 * class.cs (MethodCore.MayUnify): Use
3422 TypeManager.MayBecomeEqualGenericTypes().
3424 2004-12-08 Martin Baulig <martin@ximian.com>
3426 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
3427 parameter, box it. Fixes #69233.
3429 2004-12-08 Martin Baulig <martin@ximian.com>
3431 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
3432 have the ctor constraint. Fixes #68326.
3434 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
3436 * cs-parser.jay : interface comment was not consumed because of
3437 extra opt_semicolon before doc handling.
3439 2004-12-03 Raja R Harinath <rharinath@novell.com>
3441 Fix test-327.cs, test-328.cs, and put in early infrastructure
3442 for eventually fixing #52697.
3443 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
3444 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
3446 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
3447 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
3448 (VerifyUsing, error246): Update.
3449 * rootcontext.cs (RootContext.NamespaceLookup): Just use
3450 'NamespaceEntry.LookupNamespaceOrType'.
3452 2004-12-07 Martin Baulig <martin@ximian.com>
3454 * driver.cs: Call it "BETA SOFTWARE" :-)
3456 2004-12-06 Raja R Harinath <rharinath@novell.com>
3458 Fix crash on cs0657-17.cs.
3459 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3460 Use RootContext.Tree.Types, not 'new RootTypes ()'.
3461 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
3462 the case where the NamespaceEntry gets overwritten.
3464 2004-12-06 Marek Safar <marek.safar@seznam.cz>
3466 Fixed #69195, #56821
3467 * ecore.cs (ResolveBoolean): Tiny refactoring.
3469 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
3470 of right expression resolving when left is false constant and
3471 operator is LogicalAnd OR true constant and operator is LogicalOr.
3473 * statement.cs (ResolveUnreachable): Always reports warning.
3475 2004-12-05 Miguel de Icaza <miguel@ximian.com>
3477 * class.cs: Distinguish between 1721 and 1722 (just a little help
3478 for the programmer).
3480 2004-12-03 Miguel de Icaza <miguel@ximian.com>
3482 * delegate.cs: Only allow this on new versions of the language.
3484 2004-12-02 Duncan Mak <duncan@ximian.com>
3486 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
3488 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
3489 here as a static method. Take an additional bool out parameter
3490 `must_do_cs1540_check' for signaling to InstanceResolve.
3491 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
3492 member field from PropertyExpr class and made it an argument of
3494 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
3495 check for MarshalByRefObject, and report CS0122 instead of CS1540.
3496 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
3497 and `remove_accessor' as well as InstanceResolve: report CS0122
3502 2004-12-07 Martin Baulig <martin@ximian.com>
3504 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
3505 and CS0692 where appropriate.
3507 2004-12-06 Martin Baulig <martin@ximian.com>
3509 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
3510 IsDuplicateImplementation() and improved it.
3512 * expression.cs (Invocation.InferTypeArguments): Added
3513 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
3514 and removed the "ref" modifier from `infered_types'.
3516 * decl.cs (MemberName.ToString): Removed the exception.
3518 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
3520 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
3521 comments are allowed.
3523 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3525 * delegate.cs: Add checks for subtypes in paramaters and return values
3526 in VerifyMethod () to add support for Covariance/Contravariance
3529 2004-12-02 Miguel de Icaza <miguel@ximian.com>
3531 * report.cs: Remove extra closing parenthesis.
3533 * convert.cs (Error_CannotImplicitConversion): If the name of the
3534 types are the same, provide some extra information.
3536 2004-12-02 Marek Safar <marek.safar@seznam.cz>
3539 * attribute.cs (Resolve): Improved implementation of params
3540 attribute arguments.
3542 * support.cs (ParameterData): Add HasParams to be faster.
3544 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
3546 all things are for /doc support:
3548 * doc.cs: new file that supports XML documentation generation.
3549 * mcs.exe.sources: added doc.cs.
3551 Handle /doc command line option.
3552 Report error 2006 instead of 5 for missing file name for /doc.
3553 Generate XML documentation when required, after type resolution.
3555 Added support for picking up documentation (/// and /** ... */),
3556 including a new XmlCommentState enumeration.
3558 Added lines to fill Documentation element for field, constant,
3559 property, indexer, method, constructor, destructor, operator, event
3560 and class, struct, interface, delegate, enum.
3561 Added lines to warn incorrect comment.
3563 Added Documentation field (passed only when /doc was specified).
3565 Added DocComment, DocCommentHeader, GenerateDocComment() and
3566 OnGenerateDocComment() and some supporting private members for
3567 /doc feature to MemberCore.
3569 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
3571 Added overriden DocCommentHeader.
3573 Added overriden DocCommentHeader and GenerateDocComment().
3575 2004-12-01 Miguel de Icaza <miguel@ximian.com>
3577 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
3578 unwrapping the enumeration values, chain to
3579 DoConstantNumericPromotions again, so we can promote things to the
3580 fundamental types (takes care of enums that are bytes, sbytes).
3584 2004-12-01 Raja R Harinath <rharinath@novell.com>
3586 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
3587 Fix long-standing bug in type-lookup. Use FindType instead of
3588 LookupType when ec.ResolvingTypeTree.
3589 (Attribute.ResolveType, Attribute.Resolve)
3590 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
3592 (Attributes.Search): Remove internal version. Update.
3593 (Attributes.SearchMulti): Update.
3594 (Attributes.GetClsCompliantAttribute): Remove.
3595 (Attributes.GetIndexerNameAttribute): Remove.
3596 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
3597 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
3598 * class.cs (Indexer.Define): Likewise.
3600 2004-12-01 Marek Safar <marek.safar@seznam.cz>
3603 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
3604 MarshallByReference members access.
3606 * expression.cs: Use CheckMarshallByRefAccess;
3607 Better error CS0197 message.
3609 * report.cs: Print whole related error message.
3611 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3613 * class (GetClassBases): Better error 60 report.
3614 (EventProperty): Disabled warning 67 detection.
3616 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3619 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
3621 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
3624 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3627 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
3629 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
3631 2004-11-26 Miguel de Icaza <miguel@ximian.com>
3633 * attribute.cs (Attribute.Resolve): Refine error reporting and
3634 report a cs0117 if the identifier does not exist, to distinguish
3635 from 0617 which is a miss-use of the actual identifier.
3637 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
3638 between cs0070 and cs0079.
3640 * class.cs (MemberBase.DoDefine): When reporting a wrong
3641 accessibility level, we use MethodCore to compare instead of
3642 Method (this was a regression in some refactoring effort).
3644 So now we correctly report cs0056 again.
3646 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
3647 testing the target_type (which was known to be object_type) and
3648 not the source type (which is anonymous_method).
3650 Fixed reporting of error cs1660.
3652 * expression.cs (UserCast.Source): Expose the underlying cast.
3654 * statement.cs (Switch.SwitchGoverningType): Sort the list of
3655 allowed types to find a match to int32 first (most common).
3657 In addition, it ignores any ImplicitUserConversions that did an
3658 internal implicit conversion (as the switch statement allows only
3659 one integral conversion to exist).
3661 * class.cs (PartialContainer.Create): rename `name' to
3662 `member_name' for clarity. Then replace the string calls with a
3663 call to MemberName.GetPartialName, as now using
3664 MemberName.ToString is an error (this is due to the side effects
3665 it had, that were fixed in the past).
3667 This will restore the error reporting on a number of partial class
3668 errors that were missusing this (and getting an exception as a
3669 results, which is now just a plain textual warning, because
3670 yyparse debug output would crash otherwise).
3672 2004-11-26 Raja R Harinath <rharinath@novell.com>
3674 * Makefile (PROGRAM_INSTALL_DIR): Remove.
3676 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3678 * rootcontext.cs (LookupType): Make sure to cache lookups that
3679 don't give us a negative result. This saves about 5% of corlib
3682 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3684 * report.cs (AbstractMessage.Print): messages are sent to stderr
3686 * class.cs (TypeContainer.GetClassBases): It is an error to have a
3687 non-interface in the list of interfaces (at this point, either
3688 parent was properly set, or a base class is being listed in the
3689 interfaces section).
3691 This flags error 1722, and resolves the crash from bug 69259.
3693 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3695 * statement.cs (Using.EmitExpressionFinally): make this work right
3696 for valuetypes. Fixes 69926.
3698 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3700 * const.cs (Const.ChangeType): Cope with the "0 literal can be
3701 converted to an enum" here, before we try to change the underlying
3702 type. This code exists, but it is a different code path than the
3703 one used while encoding constants.
3705 (ImplicitReferenceConversionExists): In addition, resynchronized
3706 the code here, so it matches the same code in
3707 ImplicitReferenceConversionExists for the `from any class-type S
3708 to any interface-type T'.
3710 2004-11-25 Marek Safar <marek.safar@seznam.cz>
3712 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
3714 2004-11-24 Miguel de Icaza <miguel@ximian.com>
3716 * cs-parser.jay: Use verbosity accordingly.
3718 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3720 * expression.cs (Unary.ResolveOperator): Do not report warning;
3721 AddressOf reads from variable.
3723 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
3725 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3729 * attribute.cs (Attributable): Removed CheckTargets.
3730 (Attributes.Emit): Explicit attribute targets are tested here.
3732 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
3733 not enabled for interfaces.
3735 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
3736 (GetAssemblyName): Ouch next bug there.
3738 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3740 * expression.cs: Error 275 added.
3742 2004-11-23 Marek Safar <marek.safar@seznam.cz>
3744 Fix bug #69177 (Implemented decimal constant support)
3746 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
3747 (BinaryFold): Add DecimalConstant.
3749 * const.cs (Define): Decimal constant
3751 (ChangeType): Add decimal type handling.
3752 (LookupConstantValue): Don't set value for decimal type but
3753 emit DecimalConstantAttribute. Needed for constant optimization.
3755 * constant.cs (ToDecimal): New method.
3756 (ConvertToDecimal): New method.
3757 (IntConstant): Implemented ConvertToDecimal.
3758 (DecimalConstant.Emit): Emit optimized version for decimals in
3761 * expression.cs (ResolveOperator): Changed order of constant
3762 reduction to work correctly with native types which have
3763 overloaded operators.
3764 (ResolveMemberAccess): Extract constant value from attribute
3767 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
3769 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
3770 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
3771 (ChangeType): Decimal is special.
3772 (TypeToCoreType): Add decimal type.
3774 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3776 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
3779 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3781 * class.cs (EventField.ApplyAttributeBuilder): Fix error
3784 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3786 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
3788 * pending.cs (PendingImplementation): Grab only interfaces.
3790 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3792 * statement.cs (ForeachHelperMethods): Add location member and
3793 error 202 detection.
3795 2004-11-18 Marek Safar <marek.safar@seznam.cz>
3797 * expression.cs (DoResolveBase): Fixed wrong warning for out
3800 2004-12-04 Martin Baulig <martin@ximian.com>
3802 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
3803 to check whether the conversion is ok.
3805 * typemanager.cs (TypeManager.GetTypeArguments): Just return
3806 `Type.EmptyTypes' if we're not a generic TypeContainer.
3808 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3810 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
3811 old bug: when converting from the null literal to a pointer,
3812 return an EmptyCast, not the NullLiteral.
3814 This fixes #69921, the recent null_type changes probably made this
3817 2004-12-03 Martin Baulig <martin@ximian.com>
3819 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3820 method as our child, call AnonymousMethod.Compatible() on it.
3822 2004-12-02 Miguel de Icaza <miguel@ximian.com>
3824 * class.cs (FieldBase): Use an unused bit field from the field to
3825 encode the `has_offset' property from the FieldMember. This saves
3826 a couple of Ks on bootstrap compilation.
3828 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3829 method as our child, return the AnonymousMethod resolved
3832 * expression.cs (New.DoResolve): Allow return values from
3833 NewDelegate to also include AnonymousMethods.
3837 2004-11-29 Raja R Harinath <rharinath@novell.com>
3839 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
3841 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
3842 System.Runtime.InteropServices._Exception, since it's a base
3843 interface of the core type System.Exception in the net_2_0 profile.
3845 2004-11-27 Martin Baulig <martin@ximian.com>
3847 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
3849 2004-11-26 Raja R Harinath <rharinath@novell.com>
3851 * Makefile: Convert to use executable.make.
3852 * gmcs.exe.sources: New.
3854 2004-11-25 Martin Baulig <martin@ximian.com>
3856 * expression.cs (Invocation.InferType): Added support for byref types.
3858 2004-11-25 Martin Baulig <martin@ximian.com>
3860 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
3861 in TypeManager.TypeToCoreType().
3863 2004-11-25 Martin Baulig <martin@ximian.com>
3865 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
3866 "Dispose" method from the `current_type'.
3867 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
3868 DoDefineMembers() instead of using the MethodBuilder; this is
3869 required for generic iterators.
3871 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
3873 2004-11-24 Martin Baulig <martin@ximian.com>
3875 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
3877 2004-11-20 Martin Baulig <martin@ximian.com>
3879 * expression.cs (Invocation.InferType): Correctly infer generic
3880 instances; see gen-103.cs.
3881 (Invocation.InferTypeArguments): If a generic method doesn't have
3882 any unbound type parameters, we don't need to infer anything.
3884 2004-11-19 Raja R Harinath <rharinath@novell.com>
3886 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
3888 2004-11-17 Raja R Harinath <rharinath@novell.com>
3890 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
3891 (TypeHandle.GetMemberCache): New.
3892 (TypeHandle.TypeHandle): Update.
3893 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
3894 (TypeManager.LookupParentInterfacesCache):
3895 Rename from LookupInterfaceCache. Optimize slightly.
3896 (TypeManager.MemberLookup_FindMembers): Update.
3897 * decl.cs (MemberCache.MemberCache): Set Container to null in the
3899 (AddCacheContents): Rename from AddHashtable.
3900 * class.cs (TypeContainer.parent_container): Remove.
3901 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
3902 (TypeContainer.DoDefineMembers): Don't initialize it.
3903 Update to name changes.
3905 2004-11-17 Miguel de Icaza <miguel@ximian.com>
3907 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
3908 that factors the code to check access modifiers on override.
3910 (PropertyBase): Use the code here.
3912 Patch from Lluis S'anchez, fixes bug #69361.
3914 2004-11-15 Miguel de Icaza <miguel@ximian.com>
3916 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
3917 routine that is used to report the use of a captured variable
3918 whose address has been taken.
3920 There are two checks: one when variables are being captured and
3921 the other check is when the address of a variable is taken.
3923 (because an anonymous methods might be resolved before *or* after
3924 the address has been taken) and
3926 * expression.cs (Conditional.DoResolve): Remove the special
3927 casing that Martin added to trueExpr and falseExpr being both
3928 NullLiteral. We get the right behavior now just by introducing
3929 the null_type into the compiler.
3931 * convert.cs (ExplicitConversion): Change the code to use
3932 null_type instead of testing `expr is NullLiteral'.
3933 (ImplicitConversionStandard): use null_type too.
3934 (ImplicitReferenceConversionExists): use null_type too.
3935 (ImplicitReferenceConversion): use null_type too.
3937 * literal.cs: The type of `NullLiteral' is now null_type instead
3939 (Resolve): Set the type here.
3941 * typemanager.cs: Introduce null_type.
3943 2004-11-18 Martin Baulig <martin@ximian.com>
3946 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
3948 2004-11-18 Martin Baulig <martin@ximian.com>
3950 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
3952 2004-11-18 Martin Baulig <martin@ximian.com>
3954 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
3955 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
3956 call ResolveConstructedType() on it to resolve it without checking
3958 (Constraints.ResolveTypes): Check them here.
3959 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
3960 but don't check constraints.
3961 (ConstructedType.ResolveAsTypeTerminal): Override this and also
3962 check constraints here.
3963 (ConstructedType.ResolveConstructedType): New public method. This
3964 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
3965 resolve ourselves without checking constraints.
3967 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
3969 2004-11-18 Martin Baulig <martin@ximian.com>
3972 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
3974 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
3976 2004-11-18 Martin Baulig <martin@ximian.com>
3978 * ecore.cs (TypeExpr.ResolveType): Removed.
3979 (Expression.ResolveAsTypeTerminal): We always return a fully
3980 resolved `TypeExpr', so we can just access its `Type'.
3982 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
3984 2004-11-17 Martin Baulig <martin@ximian.com>
3986 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
3987 sure we don't return any unresolved TypeExpr's.
3988 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
3990 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
3992 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
3993 unresolved `ConstructedType's.
3995 2004-11-17 Martin Baulig <martin@ximian.com>
3997 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
3999 2004-11-17 Martin Baulig <martin@ximian.com>
4002 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
4004 * decl.cs (DeclSpace.ResolveType): Removed.
4005 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
4007 2004-11-17 Martin Baulig <martin@ximian.com>
4009 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
4010 direction, like FindMembers() does. Fixes #69546, testcase is in
4013 2004-11-16 Martin Baulig <martin@ximian.com>
4015 This is based on a patch from Marek Safar, see bug #69082.
4016 Fixes bugs #63705 and #67130.
4018 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
4019 method; create a MemberCache for an interface type and cache the
4022 * decl.cs (IMemberContainer.ParentContainer): Removed.
4023 (IMemberContainer.ParentCache): New property.
4024 (MemberCache.SetupCacheForInterface): Removed.
4025 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
4026 to create a cache for an interface's "parent".
4028 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
4031 2004-11-14 Ben Maurer <bmaurer@ximian.com>
4033 * statement.cs: Avoid adding bools to a hashtable.
4035 2004-11-15 Martin Baulig <martin@ximian.com>
4037 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
4039 2004-11-11 Martin Baulig <martin@ximian.com>
4041 * typemanager.cs (TypeManager.GetMethodName): New method.
4043 * class.cs (MethodData.Define): Include the generic arity in the
4044 name of an explicit interface; also add it to the method name.
4046 * pending.cs (PendingImplementation.InterfaceMethod): The method
4047 name now includes the generic arity.
4049 2004-11-07 Miguel de Icaza <miguel@ximian.com>
4051 * expression.cs (Invocation.OverloadResolve): Flag error if we are
4052 calling an unsafe method from a safe location.
4054 2004-11-06 Marek Safar <marek.safar@seznam.cz>
4057 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
4059 2004-11-06 Miguel de Icaza <miguel@ximian.com>
4061 * namespace.cs (VerifyUsing): use GetPartialName instead of
4064 2004-11-05 Miguel de Icaza <miguel@ximian.com>
4066 * statement.cs (Return.Resolve): Fix regression in typo: if
4067 `in_exc', we have to request a NeedReturnLabel, this was a typo
4068 introduced in the anonymous method check-in. Fixes #69131.
4070 * Indexers were using the ShortName when defining themselves,
4071 causing a regression in the compiler bootstrap when applying the
4072 patch from 2004-11-02 (first part), now they use their full name
4073 and the bug is gone.
4075 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
4077 * driver.cs: Strip the path from the names of embedded resources. Fixes
4080 2004-11-04 Raja R Harinath <rharinath@novell.com>
4082 Fix error message regression: cs0104-2.cs.
4083 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
4084 (AliasEntry.Resolve): Update.
4085 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
4087 (RootContext.LookupType): Update.
4089 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
4091 * cs-parser.jay: Add support for handling accessor modifiers
4092 * class: Add support port accessor modifiers and error checking,
4093 define PropertyMethod.Define as virtual (not abstract anymore)
4094 * ecore.cs: Add checking for proeprties access with access modifiers
4095 * iterators.cs: Modify Accessor constructor call based in the modified
4097 2004-11-02 Ben Maurer <bmaurer@ximian.com>
4099 * expression.cs (StringConcat): Handle being called twice,
4100 as when we have a concat in a field init with more than two
4103 2004-11-02 Miguel de Icaza <miguel@ximian.com>
4105 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
4106 special case explicit implementations, we should always produce
4107 the .property or .event declaration.
4109 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
4110 since it will not return correct data if people use this
4111 unresolved in the presence of using statements (see test-313).
4113 * class.cs (MethodData.Define): If we are an explicit interface
4114 implementation, set the method name to the full name of the
4115 interface plus the name of the method.
4117 Notice that using the method.MethodName.GetFullName() does not
4118 work, as it will only contain the name as declared on the source
4119 file (it can be a shorthand in the presence of using statements)
4120 and not the fully qualifed type name, for example:
4124 class D : ICloneable {
4125 object ICloneable.Clone () {
4129 Would produce a method called `ICloneable.Clone' instead of
4130 `System.ICloneable.Clone'.
4132 * namespace.cs (Alias.Resolve): Use GetPartialName.
4134 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4136 * cs-parser.jay: Add error 1055 report.
4138 2004-11-01 Miguel de Icaza <miguel@ximian.com>
4140 * assign.cs (Assign.DoResolve): Only do the transform of
4141 assignment into a New if the types are compatible, if not, fall
4142 through and let the implicit code deal with the errors and with
4143 the necessary conversions.
4145 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4147 * cs-parser.jay: Add error 1031 report.
4149 * cs-tokenizer.cs: Add location for error 1038.
4151 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4153 * cs-parser.jay: Add error 1016 report.
4155 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4157 * cs-parser.jay: Add errors 1575,1611 report.
4159 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4161 * cs-parser.jay: Add error 1001 report.
4163 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4166 * attribute.cs (GetMarshal): Add method argument for
4167 caller identification.
4169 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
4170 agument for GetMarshal and RuntimeMissingSupport.
4172 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4174 * attribute.cs (ExtractSecurityPermissionSet): Removed
4175 TypeManager.code_access_permission_type.
4177 * typemanager.cs: Removed TypeManager.code_access_permission_type.
4179 2004-10-27 Miguel de Icaza <miguel@ximian.com>
4181 * expression.cs (LocalVariableReference.DoResolveLValue): Check
4182 for obsolete use of a variable here. Fixes regression on errors
4183 cs0619-25 and cs0619-26.
4185 2004-10-27 Marek Safar <marek.safar@seznam.cz>
4187 Fix #62358, implemented security attribute encoding.
4189 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
4190 Tests permitted SecurityAction for assembly or other types.
4191 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
4192 data from SecurityPermissionAttribute to PermisionSet class.
4194 * class.cs (ApplyAttributeBuilder): Added special handling
4195 for System.Security.Permissions.SecurityAttribute based types.
4197 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
4198 special handling for System.Security.Permissions.SecurityAttribute
4201 * enum.cs (ApplyAttributeBuilder): Added special handling
4202 for System.Security.Permissions.SecurityAttribute based types.
4204 * parameter.cs (ApplyAttributeBuilder): Added special handling
4205 for System.Security.Permissions.SecurityAttribute based types.
4207 * rootcontext.cs: Next 2 core types.
4209 * typemanager.cs (TypeManager.security_permission_attr_type):
4210 Built in type for the SecurityPermission Attribute.
4211 (code_access_permission_type): Build in type.
4213 2004-10-17 Miguel de Icaza <miguel@ximian.com>
4215 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
4216 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
4217 all of this information into
4218 EmitContext.EmitCapturedVariableInstance.
4220 * codegen.cs (EmitCapturedVariableInstance): move here the
4221 funcionality of emitting an ldarg.0 in the presence of a
4222 remapping. This centralizes the instance emit code.
4224 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
4225 then emit a load of this: it means that we have reached the
4226 topmost ScopeInfo: the one that contains the pointer to the
4227 instance of the class hosting the anonymous method.
4229 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
4230 captures to the topmost CaptureContext.
4232 2004-10-12 Miguel de Icaza <miguel@ximian.com>
4234 * expression.cs (LocalVariableReference): Move the knowledge about
4235 the iterators into codegen's EmitCapturedVariableInstance.
4237 2004-10-11 Miguel de Icaza <miguel@ximian.com>
4239 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
4240 all code paths return a value from an anonymous method (it is the
4241 same as the 161 error, but for anonymous methods).
4243 2004-10-08 Miguel de Icaza <miguel@ximian.com>
4245 The introduction of anonymous methods in the compiler changed
4246 various ways of doing things in the compiler. The most
4247 significant one is the hard split between the resolution phase
4248 and the emission phases of the compiler.
4250 For instance, routines that referenced local variables no
4251 longer can safely create temporary variables during the
4252 resolution phase: they must do so from the emission phase,
4253 since the variable might have been "captured", hence access to
4254 it can not be done with the local-variable operations from the runtime.
4258 (Block.Flags): New flag `IsTopLevel' to indicate that this block
4259 is a toplevel block.
4261 (ToplevelBlock): A new kind of Block, these are the blocks that
4262 are created by the parser for all toplevel method bodies. These
4263 include methods, accessors and anonymous methods.
4265 These contain some extra information not found in regular blocks:
4266 A pointer to an optional CaptureContext (for tracking captured
4267 local variables and parameters). A pointer to the parent
4270 (Return.Resolve): Catch missmatches when returning a value from an
4271 anonymous method (error 1662).
4272 Invoke NeedReturnLabel from the Resolve phase instead of the emit
4275 (Break.Resolve): ditto.
4277 (SwitchLabel): instead of defining the labels during the
4278 resolution phase, we now turned the public ILLabel and ILLabelCode
4279 labels into methods called GetILLabelCode() and GetILLabel() that
4280 only define the label during the Emit phase.
4282 (GotoCase): Track the SwitchLabel instead of the computed label
4283 (its contained therein). Emit the code by using
4284 SwitchLabel.GetILLabelCode ().
4286 (LocalInfo.Flags.Captured): A new flag has been introduce to track
4287 whether the Local has been captured or not.
4289 (LocalInfo.IsCaptured): New property, used to tell whether the
4290 local has been captured.
4292 * anonymous.cs: Vastly updated to contain the anonymous method
4295 The main classes here are: CaptureContext which tracks any
4296 captured information for a toplevel block and ScopeInfo used to
4297 track the activation frames for various local variables.
4299 Each toplevel block has an optional capture context associated
4300 with it. When a method contains an anonymous method both the
4301 toplevel method and the anonymous method will create a capture
4302 context. When variables or parameters are captured, they are
4303 recorded on the CaptureContext that owns them, for example:
4307 MyDelegate d = delegate {
4312 Here `a' will be recorded as captured on the toplevel
4313 CapturedContext, the inner captured context will not have anything
4314 (it will only have data if local variables or parameters from it
4315 are captured in a nested anonymous method.
4317 The ScopeInfo is used to track the activation frames for local
4318 variables, for example:
4320 for (int i = 0; i < 10; i++)
4321 for (int j = 0; j < 10; j++){
4322 MyDelegate d = delegate {
4327 At runtime this captures a single captured variable `i', but it
4328 captures 10 different versions of the variable `j'. The variable
4329 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4330 recorded on a child.
4332 The toplevel ScopeInfo will also track information like the `this'
4333 pointer if instance variables were referenced (this is necessary
4334 as the anonymous method lives inside a nested class in the host
4335 type of the method).
4337 (AnonymousMethod): Expanded to track the Toplevel, implement
4338 `AnonymousMethod.Compatible' to tell whether an anonymous method
4339 can be converted to a target delegate type.
4341 The routine now also produces the anonymous method content
4343 (AnonymousDelegate): A helper class that derives from
4344 DelegateCreation, this is used to generate the code necessary to
4345 produce the delegate for the anonymous method that was created.
4347 * assign.cs: API adjustments for new changes in
4348 Convert.ImplicitStandardConversionExists.
4350 * class.cs: Adjustments to cope with the fact that now toplevel
4351 blocks are of type `ToplevelBlock'.
4353 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
4354 insteda of standard blocks.
4356 Flag errors if params arguments are passed to anonymous methods.
4358 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
4359 `CurrentAnonymousMethod' which points to the current Anonymous
4360 Method. The variable points to the AnonymousMethod class that
4361 holds the code being compiled. It is set in the new EmitContext
4362 created for the anonymous method.
4364 (EmitContext.Phase): Introduce a variable and an enumeration to
4365 assist in enforcing some rules about when and where we are allowed
4366 to invoke certain methods (EmitContext.NeedsReturnLabel is the
4367 only one that enfonces this right now).
4369 (EmitContext.HaveCaptureInfo): new helper method that returns
4370 whether we have a CapturedContext initialized.
4372 (EmitContext.CaptureVariable): New method used to register that a
4373 LocalInfo must be flagged for capturing.
4375 (EmitContext.CapturedParameter): New method used to register that a
4376 parameters must be flagged for capturing.
4378 (EmitContext.CapturedField): New method used to register that a
4379 field must be flagged for capturing.
4381 (EmitContext.HaveCapturedVariables,
4382 EmitContext.HaveCapturedFields): Return whether there are captured
4383 variables or fields.
4385 (EmitContext.EmitMethodHostInstance): This is used to emit the
4386 instance for the anonymous method. The instance might be null
4387 (static methods), this (for anonymous methods that capture nothing
4388 and happen to live side-by-side with the current method body) or a
4389 more complicated expression if the method has a CaptureContext.
4391 (EmitContext.EmitTopBlock): Routine that drives the emission of
4392 code: it will first resolve the top block, then emit any metadata
4393 and then emit the code. The split is done so that we can extract
4394 any anonymous methods and flag any captured variables/parameters.
4396 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
4397 during this phase, the ILGenerator should not be used as labels
4398 and local variables declared here might not be accessible to any
4399 code that is part of an anonymous method.
4401 Exceptions to this include the temporary variables that are
4402 created by some statements internally for holding temporary
4405 (EmitContext.EmitMeta): New routine, in charge of emitting all the
4408 (EmitContext.TemporaryReturn): This method is typically called
4409 from the Emit phase, and its the only place where we allow the
4410 ReturnLabel to be defined other than the EmitMeta. The reason is
4411 that otherwise we would have to duplicate a lot of logic in the
4412 Resolve phases of various methods that today is on the Emit
4415 (EmitContext.NeedReturnLabel): This no longer creates the label,
4416 as the ILGenerator is not valid during the resolve phase.
4418 (EmitContext.EmitThis): Extended the knowledge in this class to
4419 work in anonymous methods in addition to iterators.
4421 (EmitContext.EmitCapturedVariableInstance): This emits whatever
4422 code is necessary on the stack to access the instance to a local
4423 variable (the variable will be accessed as a field).
4425 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
4426 EmitContext.EmitAddressOfParameter): Routines to support
4427 parameters (not completed at this point).
4429 Removals: Removed RemapLocal and RemapLocalLValue. We probably
4430 will also remove the parameters.
4432 * convert.cs (Convert): Define a `ConstantEC' which points to a
4433 null. This is just to prefity some code that uses
4434 ImplicitStandardConversion code and do not have an EmitContext
4437 The idea is to flag explicitly that at that point in time, it is
4438 known that the conversion will not trigger the delegate checking
4439 code in implicit conversions (which requires a valid
4442 Everywhere: pass new EmitContext parameter since
4443 ImplicitStandardConversionExists now requires it to check for
4444 anonymous method conversions.
4446 (Convert.ImplicitStandardConversionExists): If the type of an
4447 expression is the anonymous_method_type, and the type is a
4448 delegate, we invoke the AnonymousMethod.Compatible method to check
4449 whether an implicit conversion is possible.
4451 (Convert.ImplicitConversionStandard): Only do implicit method
4452 group conversions if the language level is not ISO_1.
4454 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
4455 MethodInfo for the Invoke method. used by Delegate and
4458 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
4459 method conversions if the target type is a delegate.
4461 Removed extra debugging nops.
4463 (LocalVariableReference): Turn the `local_info' into a public
4466 Add `prepared' field, the same hack used for FieldExprs to cope
4467 with composed assignments, as Local variables do not necessarily
4468 operate purely on the stack as they used to: they can be captured
4471 Add `temp' for a temporary result, like fields.
4473 Refactor DoResolve and DoResolveLValue into DoResolveBase.
4475 It now copes with Local variables that are captured and emits the
4476 proper instance variable to load it from a field in the captured
4479 (ParameterReference.DoResolveBase): During the resolve phase,
4480 capture parameters if we are in an anonymous method.
4482 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
4483 anonymous method, use the EmitContext helper routines to emit the
4484 parameter reference.
4486 * iterators.cs: Set RemapToProxy to true/false during the
4489 * parameters.cs (GetParameterByName): New helper method.
4491 * typemanager.cs (anonymous_method_type) a new type that
4492 represents an anonyous method. This is always an internal type,
4493 used as a fencepost to test against the anonymous-methodness of an
4496 2004-10-20 Marek Safar <marek.safar@seznam.cz>
4498 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
4500 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
4502 2004-11-10 Martin Baulig <martin@ximian.com>
4504 * expression.cs (Invocation.BetterFunction): If two methods have
4505 equal parameter types, but only one of them is generic, the
4506 non-generic one wins.
4507 (New.DoResolve): Don't set `is_struct' to false if we're a generic
4508 instance; just use `Type.IsValueType' to determine whether
4509 something is a struct or not.
4510 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
4511 so we can be called multiple times.
4513 2004-11-10 Martin Baulig <martin@ximian.com>
4515 * generic.cs (TypeParameter.DefineConstraints): New public method.
4516 (TypeParameter.CheckAccessLevel): Override this and return true.
4517 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
4518 override ResolveType() anymore.
4519 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
4521 2004-11-10 Martin Baulig <martin@ximian.com>
4523 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
4524 call DeclSpace.ResolveNestedType() on it.
4526 2004-11-10 Martin Baulig <martin@ximian.com>
4528 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
4529 non-null, call ParameterModifier() on it.
4531 2004-11-10 Martin Baulig <martin@ximian.com>
4534 (Iterators): Added `current_type' and `this_type' fields.
4535 (Iterators.DefineIterator): Create a new EmitContext and store it
4536 in `ec'; compute `this_type'.
4538 2004-11-10 Martin Baulig <martin@ximian.com>
4541 (TypeManager.IsPrivateAccessible): New public method.
4542 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
4544 2004-11-10 Martin Baulig <martin@ximian.com>
4546 * class.cs (TypeContainer.DefineType): Call
4547 TypeBuilder.DefineGenericParameters() before resolving the type
4549 (MethodData.parent_method): New protected field.
4550 (MethodData..ctor): Added `MethodInfo parent_method' argument.
4551 (MethodData.Define): Compute `parent_method'.
4554 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
4555 (MemberCore.GetClsCompliantAttributeValue): Likewise.
4556 (DeclSpace.ec): New protected field; store the EmitContext here.
4557 (DeclSpace.EmitContext): New public property.
4558 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
4559 (DeclSpace.ResolveNestedType): New public method.
4560 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
4561 (DeclSpace.NestedAccessible): Added `Type tb' argument.
4562 (DeclSpace.FamilyAccessible): Likewise.
4563 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
4564 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
4567 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
4570 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
4571 (Enum.Emit): Don't create a new EmitContext.
4573 2004-10-18 Martin Baulig <martin@ximian.com>
4575 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
4576 `Type' directly, but call ResolveType() on it.
4577 (Catch.Resolve): Likewise.
4578 (Foreach.Resolve): Likewise.
4580 2004-10-18 Martin Baulig <martin@ximian.com>
4582 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
4583 `Type' directly, but call ResolveType() on it.
4584 (Probe.DoResolve): Likewise.
4585 (ArrayCreation.LookupType): Likewise.
4586 (TypeOf.DoResolve): Likewise.
4587 (SizeOf.DoResolve): Likewise.
4589 2004-10-18 Raja R Harinath <rharinath@novell.com>
4591 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
4594 2004-10-17 John Luke <john.luke@gmail.com>
4596 * class.cs (Operator.GetSignatureForError): use CSharpName
4598 * parameter.cs (Parameter.GetSignatureForError): Returns
4599 correct name even if was not defined.
4601 2004-10-13 Raja R Harinath <rharinath@novell.com>
4604 * class.cs (TypeContainer.EmitContext): New property.
4605 (DefineNestedTypes): Create an emitcontext for each part.
4606 (MethodCore.DoDefineParameters): Use container's emitcontext.
4607 Pass type array to InternalParameters.
4608 (MemberBase.DoDefine): Use container's emitcontext.
4609 (FieldMember.Define): Likewise.
4610 (Event.Define): Likewise.
4611 (SetMethod.GetParameterInfo): Change argument to EmitContext.
4612 Pass type array to InternalParameters.
4613 (SetIndexerMethod.GetParameterInfo): Likewise.
4614 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
4615 * delegate.cs (Define): Pass emitcontext to
4616 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
4617 array to InternalParameters.
4618 * expression.cs (ParameterReference.DoResolveBase): Pass
4619 emitcontext to GetParameterInfo.
4620 (ComposedCast.DoResolveAsTypeStep): Remove check on
4621 ec.ResolvingTypeTree.
4622 * parameter.cs (Parameter.Resolve): Change argument to
4623 EmitContext. Use ResolveAsTypeTerminal.
4624 (Parameter.GetSignature): Change argument to EmitContext.
4625 (Parameters.ComputeSignature): Likewise.
4626 (Parameters.ComputeParameterTypes): Likewise.
4627 (Parameters.GetParameterInfo): Likewise.
4628 (Parameters.ComputeAndDefineParameterTypes): Likewise.
4629 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
4630 * support.cs (InternalParameters..ctor): Remove variant that takes
4632 * typemanager.cs (system_intptr_expr): New.
4633 (InitExpressionTypes): Initialize it.
4635 2004-10-12 Chris Toshok <toshok@ximian.com>
4637 * cs-parser.jay: fix location for try_statement and catch_clause.
4639 2004-10-18 Martin Baulig <martin@ximian.com>
4641 * class.cs (FieldMember.Define): Don't access the TypeExpr's
4642 `Type' directly, but call ResolveType() on it.
4643 (MemberBase.DoDefine): Likewise.
4645 * expression.cs (New.DoResolve): Don't access the TypeExpr's
4646 `Type' directly, but call ResolveType() on it.
4647 (ComposedCast.DoResolveAsTypeStep): Likewise.
4649 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
4650 `Type' directly, but call ResolveType() on it.
4652 2004-10-17 John Luke <john.luke@gmail.com>
4654 * class.cs (Operator.GetSignatureForError): use CSharpName
4656 * parameter.cs (Parameter.GetSignatureForError): Returns
4657 correct name even if was not defined.
4659 2004-10-13 Raja R Harinath <rharinath@novell.com>
4662 * class.cs (TypeContainer.EmitContext): New property.
4663 (DefineNestedTypes): Create an emitcontext for each part.
4664 (MethodCore.DoDefineParameters): Use container's emitcontext.
4665 Pass type array to InternalParameters.
4666 (MemberBase.DoDefine): Use container's emitcontext.
4667 (FieldMember.Define): Likewise.
4668 (Event.Define): Likewise.
4669 (SetMethod.GetParameterInfo): Change argument to EmitContext.
4670 Pass type array to InternalParameters.
4671 (SetIndexerMethod.GetParameterInfo): Likewise.
4672 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
4673 * delegate.cs (Define): Pass emitcontext to
4674 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
4675 array to InternalParameters.
4676 * expression.cs (ParameterReference.DoResolveBase): Pass
4677 emitcontext to GetParameterInfo.
4678 (ComposedCast.DoResolveAsTypeStep): Remove check on
4679 ec.ResolvingTypeTree.
4680 * parameter.cs (Parameter.Resolve): Change argument to
4681 EmitContext. Use ResolveAsTypeTerminal.
4682 (Parameter.GetSignature): Change argument to EmitContext.
4683 (Parameters.ComputeSignature): Likewise.
4684 (Parameters.ComputeParameterTypes): Likewise.
4685 (Parameters.GetParameterInfo): Likewise.
4686 (Parameters.ComputeAndDefineParameterTypes): Likewise.
4687 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
4688 * support.cs (InternalParameters..ctor): Remove variant that takes
4690 * typemanager.cs (system_intptr_expr): New.
4691 (InitExpressionTypes): Initialize it.
4693 2004-10-12 Chris Toshok <toshok@ximian.com>
4695 * cs-parser.jay: fix location for try_statement and catch_clause.
4697 2004-10-07 Raja R Harinath <rharinath@novell.com>
4699 More DeclSpace.ResolveType avoidance.
4700 * decl.cs (MemberCore.InUnsafe): New property.
4701 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
4702 with newly created EmitContext.
4703 (FieldMember.Define): Likewise.
4704 * delegate.cs (Delegate.Define): Likewise.
4705 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
4706 only if normal name-lookup fails.
4707 (TypeExpr.DoResolve): Enable error-checking.
4708 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
4709 (SizeOf.DoResolve): Likewise.
4710 (ComposedCast.DoResolveAsTypeStep): Likewise.
4711 (StackAlloc.DoResolve): Likewise.
4712 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
4713 (Block.Unsafe): New property.
4714 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
4715 (Unsafe): Set 'unsafe' flag of contained block.
4716 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
4717 (Fixed.Resolve): Likewise.
4718 (Catch.Resolve): Likewise.
4719 (Using.ResolveLocalVariableDecls): Likewise.
4720 (Foreach.Resolve): Likewise.
4722 2004-10-05 John Luke <john.luke@gmail.com>
4724 * cs-parser.jay: add location to error CS0175
4726 2004-10-04 Miguel de Icaza <miguel@ximian.com>
4728 * ecore.cs (Expression.Constantity): Add support for turning null
4731 * const.cs (Const.Define): Allow constants to be reference types
4732 as long as the value is Null.
4734 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
4736 * namespace.cs (NamespaceEntry.Using): No matter which warning
4737 level is set, check if this namespace name has already been added.
4739 2004-10-03 Ben Maurer <bmaurer@ximian.com>
4741 * expression.cs: reftype [!=]= null should always use br[true,false].
4744 2004-10-03 Marek Safar <marek.safar@seznam.cz>
4747 * attribute.cs: Enum conversion moved to
4748 GetAttributeArgumentExpression to be applied to the all
4751 2004-10-01 Raja R Harinath <rharinath@novell.com>
4753 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
4754 * class.c (TypeContainer.DefineType): Flag error if
4755 base types aren't accessible due to access permissions.
4756 * decl.cs (DeclSpace.ResolveType): Move logic to
4757 Expression.ResolveAsTypeTerminal.
4758 (DeclSpace.ResolveTypeExpr): Thin layer over
4759 Expression.ResolveAsTypeTerminal.
4760 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
4761 Refactor code into NestedAccess. Use it.
4762 (DeclSpace.NestedAccess): New.
4763 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
4764 argument to silence errors. Check access permissions.
4765 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
4766 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
4767 (Cast.DoResolve): Likewise.
4768 (New.DoResolve): Likewise.
4769 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
4770 (TypeOf.DoResolve): Likewise.
4772 * expression.cs (Invocation.BetterConversion): Return the Type of
4773 the better conversion. Implement section 14.4.2.3 more faithfully.
4774 (Invocation.BetterFunction): Make boolean. Make correspondence to
4775 section 14.4.2.2 explicit.
4776 (Invocation.OverloadResolve): Update.
4777 (Invocation): Remove is_base field.
4778 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
4779 (Invocation.Emit): Likewise.
4781 2004-09-24 Marek Safar <marek.safar@seznam.cz>
4783 * cs-parser.jay: Reverted 642 warning fix.
4785 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4788 * decl.cs (FindMemberWithSameName): Indexer can have more than
4791 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4793 * expression.cs (LocalVariableReference.DoResolveLValue):
4794 Do not report warning 219 for out values.
4795 (EmptyExpression.Null): New member to avoid extra allocations.
4797 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4799 * cs-parser.jay: Fix wrong warning 642 report.
4801 * cs-tokenizer.cs (CheckNextToken): New helper;
4802 Inspect next character if is same as expected.
4804 2004-09-23 Martin Baulig <martin@ximian.com>
4806 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
4807 (Convert.ImplicitReferenceConversionExists): Likewise.
4809 2004-11-09 Raja R Harinath <rharinath@novell.com>
4811 * Makefile (DISTFILES): Comment out a few missing files.
4813 2004-10-29 Raja R Harinath <rharinath@novell.com>
4815 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
4816 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
4817 (gmcs.exe): Invoke bootstrap-libs.
4818 (clean-local): Clean the net_2_0_bootstrap profile too.
4819 (PROGRAM_INSTALL_DIR): New.
4820 (install-local): Use it.
4822 2004-10-13 Martin Baulig <martin@ximian.com>
4824 * generic.cs (TypeManager.InflatedConstraints): New nested class.
4825 (TypeParameter.DefineType): If we're a method type parameter and
4826 that method is overriding something, "inflate" its constraints.
4828 2004-10-12 Martin Baulig <martin@ximian.com>
4830 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
4831 and have type arguments, create and resolve a ConstructedType.
4833 2004-10-12 Martin Baulig <martin@ximian.com>
4835 * decl.cs (MemberCache.FindMemberToOverride): Use
4836 TypeManager.IsEqual() to compare the parameters and Type.Equals()
4837 to compare the invocationType.
4839 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
4840 When comparing two type parameters, only do the signature-only
4841 comparision for method type parameters.
4843 2004-10-11 Martin Baulig <martin@ximian.com>
4845 * report.cs: Don't make --fatal abort on warnings, we have
4846 -warnaserror for that.
4848 2004-10-11 Martin Baulig <martin@ximian.com>
4851 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
4852 (TypeManager.IsEqual): Call ourself recursively instead of using
4855 2004-10-11 Martin Baulig <martin@ximian.com>
4857 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
4858 on our own type parameters, not on the ones we inherit from a containing
4861 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
4864 * generic.cs (TypeParameter.Define): We may only be called once.
4866 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
4867 instead of TypeManager.IsEqual().
4869 2004-09-28 Martin Baulig <martin@ximian.com>
4872 (GenericConstraints.EffectiveBaseClass): New public property.
4873 (TypeParameter.GenericConstraints): New public property.
4874 (ConstructedType.CheckConstraints): Improved.
4876 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
4877 (Convert.TypeParameterConversion): New private method; use this in
4878 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
4879 for all conversions related to type parameters.
4881 2004-09-24 Martin Baulig <martin@ximian.com>
4883 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
4884 type parameter conversions for type parameters which are known to
4887 2004-09-24 Martin Baulig <martin@ximian.com>
4889 * generic.cs (GenericConstraints): Added `IsReferenceType' and
4890 `IsValueType' properties.
4892 * support.cs (ReflectionConstraints): Use
4893 Type.GetGenericParameterConstraints() instead of the old hack.
4895 2004-09-24 Martin Baulig <martin@ximian.com>
4897 * generic.cs (GenericConstraints): Moved here and made it an
4900 * support.cs (GenericConstraints): Moved to generic.cs.
4902 2004-09-24 Martin Baulig <martin@ximian.com>
4905 (ReflectionConstraints): Un-nested this class and made it public.
4908 (TypeManager.GetTypeParameterConstraints): New public method.
4909 (TypeManager.HasConstructorConstraint): Use the attributes.
4911 2004-09-24 Martin Baulig <martin@ximian.com>
4913 * support.cs (GenericConstraints): Replaced `HasConstructor',
4914 `IsReferenceType' and `IsValueType' with `Attributes'.
4915 (ReflectionParameters.ReflectionConstraints): Removed the Create()
4916 method and made the .ctor public.
4918 * generic.cs (Constraints.Attributes): New public property.
4919 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
4920 `IsReferenceType' -> `HasReferenceTypeConstraint' and
4921 `IsValueType' -> `HasValueTypeConstraint'.
4923 2004-09-23 Martin Baulig <martin@ximian.com>
4925 * generic.cs (Constraints): Reflect latest runtime changes.
4927 2004-09-23 Martin Baulig <martin@ximian.com>
4929 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
4930 (Convert.ImplicitReferenceConversionExists): Likewise.
4932 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4934 * class.cs (Operator.Define): Add error 448 and 559 report.
4936 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4938 * class.cs (MemberBase.IsTypePermitted): New protected
4939 method for checking error CS0610.
4941 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4943 * class.cs (TypeContainer.HasExplicitLayout): New property
4944 Returns whether container has StructLayout attribute set Explicit.
4945 (FieldMember): New abstract class for consts and fields.
4946 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
4947 (Field): Reuse FieldMember.
4949 * const.cs (Const): Reuse FieldMember.
4951 * rootcontext.cs: EmitConstants call moved to class.
4953 2004-09-22 Martin Baulig <martin@ximian.com>
4955 Marek and me just fixed one of our oldest bugs: #28562 :-)
4957 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
4959 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
4960 we're an EnumConstant, just return that.
4961 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
4962 an EnumConstant. In this case, we need to use GetValueAsEnumType()
4963 to get the value which'll actually be written into the attribute.
4964 However, we have to use GetValue() to access the attribute's value
4967 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4969 * constant.cs (Constant.IsNegative): New abstract property
4972 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
4973 (StackAlloc.DoResolve): Reused IsNegative.
4975 2004-09-22 Martin Baulig <martin@ximian.com>
4977 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
4978 public method; like LookupTypeContainer, but also works for
4981 * report.cs (Report.SymbolRelatedToPreviousError): Use
4982 TypeManager.LookupGenericTypeContainer().
4984 2004-09-22 Martin Baulig <martin@ximian.com>
4986 Thanks to Peter Sestoft for this bug report.
4988 * expression.cs (Conditional): If both the `trueExpr' and the
4989 `falseExpr' is a NullLiteral, return a NullLiteral.
4991 2004-09-22 Martin Baulig <martin@ximian.com>
4993 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
4994 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
4995 for the "get_Current" call.
4997 2004-09-21 Martin Baulig <martin@ximian.com>
4999 * convert.cs (Convert.ImplicitReferenceConversion): When
5000 converting to an interface type, first check whether we're
5001 converting from a reference type.
5003 2004-09-14 Martin Baulig <martin@ximian.com>
5005 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
5007 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5010 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
5011 called and is obsolete then this member suppress message
5012 when call is inside next [Obsolete] method or type.
5014 * expression.cs: Use TestObsoleteMethodUsage member.
5016 2004-09-14 Martin Baulig <martin@ximian.com>
5018 * genericparser.cs: Removed.
5020 2004-09-13 Marek Safar <marek.safar@seznam.cz>
5022 * class.cs (MethodCore.CheckBase): Fix bug #65757.
5024 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5026 * attribute.cs (Attribute.Resolve): Add error 653 report.
5028 * class.cs (Class.ApplyAttributeBuilder): Add error 641
5030 (Method.ApplyAttributeBuilder): Add error 685 report.
5031 (Operator.Define): Add error 564 report.
5033 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
5035 * expression.cs (Invocation.DoResolve): Add error
5038 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
5041 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5043 * class.cs (ConstructorInitializer.Resolve):
5044 Wrong error number (515->516).
5046 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5048 * class.cs (Indexer.Define): Add error 631 report.
5050 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5052 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
5054 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5056 * expression.cs (Probe.DoResolve): Add error CS0241 report.
5058 2004-09-10 Marek Safar <marek.safar@seznam.cz>
5060 * cs-parser.jay: Added error CS0241 report.
5062 2004-09-10 Raja R Harinath <rharinath@novell.com>
5064 * cs-parser.jay (fixed_statement): Introduce a scope for the
5065 declaration in the 'fixed' statement.
5067 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5069 * cs-parser.jay: Added CS0230 error report.
5071 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5073 * cs-parser.jay: Added errors CS0231 and CS0257 report.
5075 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5077 * expression.cs (Argument.Resolve): Added error CS0192 and
5080 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5082 C# 2.0 #pragma warning feature
5084 * cs-tokenizer.cs (PreProcessPragma): New method;
5085 Handles #pragma directive.
5087 * report.cs (WarningRegions): New class; Support
5088 class for #pragma warning directive. It tests whether
5089 warning is enabled for a given line.
5091 2004-09-08 Miguel de Icaza <miguel@ximian.com>
5093 * const.cs: Add more descriptive error report, tahnks to
5096 2004-09-08 Marek Safar <marek.safar@seznam.cz>
5098 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
5100 2004-09-07 Miguel de Icaza <miguel@ximian.com>
5102 * expression.cs: Apply patch from Ben: Remove dead code from
5103 ArrayCreation, and remove the TurnintoConstant call in const.cs,
5104 as that code just threw an exception anwyays.
5106 * const.cs: Remove the call to the turnintoconstant, for details
5109 * literal.cs: The type of the null-literal is the null type; So
5110 we use a placeholder type (literal.cs:System.Null, defined here)
5113 * expression.cs (Conditional.DoResolve): Remove some old code that
5114 is no longer needed, conversions have been fixed.
5116 (ArrayCreationExpression.DoResolve): Return false if we fail to
5117 resolve the inner expression.
5119 2004-09-07 Raja R Harinath <rharinath@novell.com>
5122 * cs-parser.jay (delegate_declaration): Record a delegate
5123 declaration as a type declaration.
5124 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
5126 2004-09-06 Miguel de Icaza <miguel@ximian.com>
5128 * parameter.cs: Do not crash if the type can not be resolved.
5130 * expression.cs: Report errors with unsafe pointers, fixes #64896
5132 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
5134 * expression.cs: Pointer arith always needs to do a conv.i
5135 if the operand is a long. fix 65320
5137 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5139 Fixed cs0619-37.cs, cs0619-38.cs
5141 * enum.cs (GetObsoleteAttribute): Removed.
5143 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
5144 on Enum member is double staged. The first is tested member
5147 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5149 Fixed #56986, #63631, #65231
5151 * class.cs: (TypeContainer.AddToMemberContainer): New method,
5152 adds member to name container.
5153 (TypeContainer.AddToTypeContainer): New method, adds type to
5155 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
5156 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
5157 AddOperator): Simplified by reusing AddToMemberContainer.
5158 (TypeContainer.UserDefinedStaticConstructor): Changed to property
5160 (Method.CheckForDuplications): Fixed implementation to test all
5162 (MemberBase): Detection whether member is explicit interface
5163 implementation is now in constructor.
5164 (MemberBase.UpdateMemberName): Handles IndexerName.
5165 (Accessor): Changed to keep also location information.
5166 (AbstractPropertyEventMethod): Is derived from MemberCore.
5167 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
5168 will be emited or not.
5169 (PropertyBase.AreAccessorsDuplicateImplementation):
5170 Tests whether accessors are not in collision with some method.
5171 (Operator): Is derived from MethodCore to simplify common
5174 * decl.cs (Flags.TestMethodDuplication): Test for duplication
5176 (DeclSpace.AddToContainer): Adds the member to defined_names
5177 table. It tests for duplications and enclosing name conflicts.
5179 * enum.cs (EnumMember): Clean up to reuse the base structures
5181 2004-09-03 Martin Baulig <martin@ximian.com>
5183 Merged latest changes into gmcs. Please keep this comment in
5184 here, it makes it easier for me to see what changed in MCS since
5185 the last time I merged.
5187 2004-09-03 Martin Baulig <martin@ximian.com>
5189 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
5190 into TypeContainer, to make partial classes work again.
5192 2004-09-03 Martin Baulig <martin@ximian.com>
5194 * rootcontext.cs (RootContext.V2): Removed.
5196 2004-03-23 Martin Baulig <martin@ximian.com>
5198 * expression.cs (Invocation.OverloadResolve): Added `bool
5199 may_fail' argument and use it instead of the Location.IsNull() hack.
5201 2004-09-09 Martin Baulig <martin@ximian.com>
5203 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
5205 2004-09-09 Martin Baulig <martin@ximian.com>
5207 * generic.cs (TypeParameter.DefineType): Added support for
5208 explicit interface methods.
5210 2004-09-09 Martin Baulig <martin@ximian.com>
5212 * README.Changes: New document. Started to list important changes
5213 between MCS and GMCS here.
5215 2004-09-08 Martin Baulig <martin@ximian.com>
5218 (TypeContainer.CheckRecursiveDefinition): New protected method.
5219 (TypeContainer.DefineType): Move the CS0146 check into
5220 CheckRecursiveDefinition().
5222 2004-09-06 Martin Baulig <martin@ximian.com>
5224 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
5225 types for the constructor constraint.
5227 2004-09-03 Martin Baulig <martin@ximian.com>
5229 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
5230 into TypeContainer, to make partial classes work again.
5232 2004-09-03 Martin Baulig <martin@ximian.com>
5234 * rootcontext.cs (RootContext.V2): Removed.
5236 2004-03-23 Martin Baulig <martin@ximian.com>
5238 * expression.cs (Invocation.OverloadResolve): Added `bool
5239 may_fail' argument and use it instead of the Location.IsNull() hack.
5241 2004-09-03 Martin Baulig <martin@ximian.com>
5243 Merged latest changes into gmcs. Please keep this comment in
5244 here, it makes it easier for me to see what changed in MCS since
5245 the last time I merged.
5247 2004-09-03 Raja R Harinath <rharinath@novell.com>
5250 * expression.cs (BetterConversion): Don't allow either conversion
5251 to be null. Remove redundant implicit conversion test when 'q ==
5252 null' -- when this function is invoked, we already know that the
5253 implicit conversion exists.
5254 (BetterFunction): Assume that 'best' is non-null. Remove
5255 redundant reimplementation of IsApplicable when 'best' is null.
5256 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
5257 number of arguments.
5258 (IsAncestralType): Extract from OverloadResolve.
5259 (OverloadResolve): Make robust to the MethodGroupExpr being
5260 unsorted. Implement all the logic of Section 14.5.5.1, and
5261 support overloading of methods from multiple applicable types.
5262 Clean up logic somewhat. Don't pass null methods to BetterFunction.
5264 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
5265 (RealError, Warning): Append type of report to related symbol.
5267 2004-09-03 Marek Safar <marek.safar@seznam.cz>
5269 * enum.cs: Fixed CLS-Compliance checks for enum members.
5270 Error tests cs3008-8.cs, cs3014-8.cs
5272 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5274 Fixed bug #62342, #63102
5275 * class.cs: ImplementIndexer uses member.IsExplicitImpl
5276 like ImplementMethod.
5278 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5280 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5283 2004-09-02 Martin Baulig <martin@ximian.com>
5285 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5286 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5289 2004-09-01 Marek Safar <marek.safar@seznam.cz>
5291 C# 2.0 Static classes implemented
5293 * class.cs (TypeContainer): instance_constructors,
5294 initialized_fields, initialized_static_fields,
5295 default_constructor, base_inteface_types are protected to be
5296 accessible from StaticClass.
5297 (TypeContainer.DefineDefaultConstructor): New virtual method
5298 for custom default constructor generating
5299 (StaticClass): New class to handle "Static classes" feature.
5301 * cs-parser.jay: Handle static keyword on class like instance
5304 * driver.cs: Added "/langversion" command line switch with two
5305 options (iso-1, default).
5307 2004-08-31 Marek Safar <marek.safar@seznam.cz>
5309 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
5311 2004-08-31 Miguel de Icaza <miguel@ximian.com>
5313 * delegate.cs: Style.
5315 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
5317 * delegate.cs: Add seperate instance expr field for miguel.
5319 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5321 * PointerArithmetic (Resolve): make sure we are not doing
5322 pointer arith on void*. Also, make sure we are resolved
5323 by not setting eclass until resolve.
5325 All callers: Make sure that PointerArithmetic gets resolved.
5327 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5329 * ArrayCreation (LookupType): If the type does not resolve
5330 to an array, give an error.
5332 2004-08-27 Marek Safar <marek.safar@seznam.cz>
5334 * statement.cs (Try.Resolve): Fixed bug #64222
5336 2004-08-27 Martin Baulig <martin@ximian.com>
5339 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5342 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5344 * ecore.cs (Constantify): Get underlying type via
5345 System.Enum.GetUnderlyingType to avoid StackOverflow on the
5346 Windows in special cases.
5348 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5350 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
5351 for obtaining also private methods.
5352 (GetRemoveMethod): Used GetRemoveMethod (true)
5353 for obtaining also private methods.
5355 2004-09-02 Martin Baulig <martin@ximian.com>
5357 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5358 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5361 2004-08-27 Martin Baulig <martin@ximian.com>
5364 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5367 2004-08-25 Martin Baulig <martin@ximian.com>
5369 * support.cs (ReflectionParameters..ctor): If this is a generic
5370 method, retrieve and store its type parameters.
5371 (InternalParameters..ctor): Added `TypeParameter[]' argument.
5372 (ReflectionParameters.GenericConstraints): The argument specifies
5373 the type parameter, not the method parameter.
5374 (InternalParameters.GenericConstraints): Likewise.
5376 * generic.cs (TypeParameter.DefineType): Correctly handle
5377 constraints wrt. generic methods in interfaces and their
5380 2004-08-24 Martin Baulig <martin@ximian.com>
5382 * generic.cs (TypeParameter.IsSubclassOf): New public method.
5383 (Constraints.IsSubclassOf): New internal method.
5385 * typemanager.cs (TypeManager.FindMembers): Added special support
5386 for GenericTypeParameterBuilder's.
5387 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
5390 2004-08-24 Martin Baulig <martin@ximian.com>
5393 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
5394 this for accessibility checks.
5395 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
5396 IsNestedFamilyAccessible.
5397 (TypeManager.IsSubclassOf): New method, do what the name actually
5400 2004-08-24 Martin Baulig <martin@ximian.com>
5402 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
5403 as a SimpleName, include the generic arity.
5405 2004-08-24 Martin Baulig <martin@ximian.com>
5407 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5408 MethodAttributes.HideBySig for operators.
5410 2004-08-23 Martin Baulig <martin@ximian.com>
5412 Back to the old error reporting system :-)
5414 * report.cs (Message): Removed.
5415 (Report.MessageData, ErrorData, WarningData): Removed.
5416 (Report.Error, Warning): Back to the old system.
5418 2004-08-23 Martin Baulig <martin@ximian.com>
5420 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5422 * class.cs (TypeContainer.ParentContainer): New public virtual
5423 method; replaces the explicit interface implementation.
5424 (ClassPart.ParentContainer): Override.
5426 2004-08-23 Martin Baulig <martin@ximian.com>
5428 * statement.cs (Switch): Added support for constant switches; see
5429 #59428 or test-285.cs.
5431 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5434 * statement.cs (GetEnumeratorFilter): Removed useless
5435 logic because C# specs is strict. GetEnumerator must be
5438 2004-08-22 Martin Baulig <martin@ximian.com>
5440 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5441 a switch and may break, reset the barrier. Fixes #59867.
5443 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5445 CLS-Compliance speed up (~5% for corlib)
5447 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5448 New method. Tests container for CLS-Compliant names
5450 * class.cs (TypeContainer.VerifyClsName): New method.
5451 Checks whether container name is CLS Compliant.
5452 (Constructor): Implements IMethodData.
5454 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5455 low-case table for CLS Compliance test.
5456 (MemberCache.VerifyClsParameterConflict): New method.
5457 Checks method parameters for CS3006 error.
5459 * enum.cs (EnumMember): Is derived from MemberCore.
5460 (Enum.VerifyClsName): Optimized for better performance.
5462 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5464 * report.cs: Renamed Error_T to Error and changed all
5467 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5469 * class.cs (TypeContainer.IndexerArrayList): New inner class
5470 container for indexers.
5471 (TypeContainer.DefaultIndexerName): New constant for default
5472 indexer name. Replaced all "Item" with this constant.
5473 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5475 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5476 DefaultMemberAttribute constructor.
5478 2004-08-05 Martin Baulig <martin@ximian.com>
5480 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5483 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5485 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5486 multi platforms problem.
5488 * compiler.csproj: Included shared files.
5490 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5492 Fix bug 60333, 55971 in the more general way
5493 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5494 Added arg_type argument for constant conversion.
5495 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5497 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5500 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5501 OperatorArrayList, MethodCoreArrayList for typecontainer
5502 containers. Changed class member types to these new types.
5503 (MethodArrayList.DefineMembers): Added test for CS0659.
5505 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5507 * cfold.cs: Synchronize the folding with the code in expression.cs
5508 Binary.DoNumericPromotions for uint operands.
5510 * attribute.cs: Revert patch from Raja, it introduced a regression
5511 while building Blam-1.2.1 (hard to isolate a test case).
5513 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5517 (TypeContainer.Define): Renamed to DefineContainerMembers because of
5519 (MethodCore.parent_method): New member. The method we're overriding
5520 if this is an override method.
5521 (MethodCore.CheckBase): Moved from Method class and made common.
5522 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
5524 (MethodCore.CheckForDuplications): New abstract method. For custom
5525 member duplication search in a container
5526 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
5527 method and its return type.
5528 (Event.conflict_symbol): New member. Symbol with same name in the
5532 (MemberCache.FindMemberWithSameName): New method. The method
5533 is looking for conflict with inherited symbols.
5535 2004-08-04 Martin Baulig <martin@ximian.com>
5537 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5539 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5541 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5543 * report.cs (Message): New enum for better error, warning reference in
5545 (MessageData): New inner abstract class. It generally handles printing of
5546 error and warning messages.
5547 Removed unused Error, Warning, Message methods.
5549 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5551 Fix for cs0592-8.cs test
5553 (Attributable.ValidAttributeTargets): Made public.
5554 (Attribute.ExplicitTarget): New member for explicit target value.
5555 (Attribute.CheckTargets): Now we translate explicit attribute
5556 target to Target here.
5558 2004-08-03 Ben Maurer <bmaurer@ximian.com>
5560 * ecore.cs (MethodGroupExpr): new IsBase property.
5562 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
5564 * delegate.cs (DelegateCreation): store a MethodGroupExpr
5565 rather than an instance expr.
5567 (DelegateCreation.Emit): Use the method group rather than
5568 the instance expression. Also, if you have base.Foo as the
5569 method for a delegate, make sure to emit ldftn, not ldftnvirt.
5571 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
5573 (NewDelegate.DoResolve): Only check for the existance of Invoke
5574 if the method is going to be needed. Use MethodGroupExpr.
5576 (NewDelegate.Emit): Remove, DelegateCreation implements this.
5578 * expression.cs: For pointer arith., make sure to use
5579 the size of the type, not the size of the pointer to
5582 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5585 * class.cs (Class): Added error CS0502 test.
5587 2004-08-03 John Luke <jluke@cfl.rr.com>
5588 Raja R Harinath <rharinath@novell.com>
5591 * attribute.cs (Attribute.complained_before): New flag.
5592 (Attribute.ResolveType, Attribute.Resolve),
5593 (Attribute.DefinePInvokeMethod): Set it.
5594 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
5596 2004-08-03 Martin Baulig <martin@ximian.com>
5598 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5599 use a user-defined operator; we still need to do numeric
5600 promotions in case one argument is a builtin type and the other
5601 one has an implicit conversion to that type. Fixes #62322.
5603 2004-08-18 Martin Baulig <martin@ximian.com>
5605 * class.cs (Method.Define): Use the correct method name when
5606 creating the MethodBuilder for a generic method.
5608 2004-08-17 Martin Baulig <martin@ximian.com>
5610 * generic.cs (Constraints): Support type parameter constraints.
5612 2004-08-16 Martin Baulig <martin@ximian.com>
5614 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
5615 (Token.GENERIC_DIMENSION): New token; this is returned if we
5616 encounter an unbound generic type in a typeof() expression.
5618 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
5619 this token is only generated while parsing a typeof() expression.
5620 (typeof_expression): Removed the old unbound_type hack.
5622 * generic.cs (TypeArguments.IsUnbound): New public property.
5624 * decl.cs (MemberName): Added support for unbound types.
5626 2004-08-14 Martin Baulig <martin@ximian.com>
5629 (TypeManager.IsEqualGenericInstance): New static method.
5630 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
5631 just used to check accessibility, so follow the rules of 26.1.6.
5633 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
5634 ConstructedType instead of a TypeExpression if we have type arguments.
5636 * cs-parser.jay (typeof_expression): Support unbound generic types.
5638 * ecore.cs (UnboundTypeExpression): New public class.
5640 2004-08-12 Martin Baulig <martin@ximian.com>
5642 * typemanager.cs (TypeManager.IsNestedChildOf): Use
5643 TypeManager.IsEqual() rather than `=='.
5645 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
5646 generic instances as well.
5648 2004-08-12 Martin Baulig <martin@ximian.com>
5650 * expression.cs (Invocation.InferType): We can only infer method
5651 type parameters. Fixes #62647.
5653 2004-08-11 Martin Baulig <martin@ximian.com>
5655 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
5656 before resolving the base classes.
5658 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5660 * Makefile: install .mdb file too.
5662 2004-08-05 Martin Baulig <martin@ximian.com>
5664 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
5665 initializer, the current type is just the TypeBuilder, not the
5666 instantiated generic type.
5667 (FieldExpr.IsFieldInitializer): New public property.
5669 2004-08-04 Martin Baulig <martin@ximian.com>
5671 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5673 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5675 2004-08-03 Martin Baulig <martin@ximian.com>
5677 * class.cs (MethodData.Define): If we're an explicit
5678 implementation, remove the generic arity from the type name.
5680 2004-08-03 Martin Baulig <martin@ximian.com>
5682 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5683 use a user-defined operator; we still need to do numeric
5684 promotions in case one argument is a builtin type and the other
5685 one has an implicit conversion to that type. Fixes #62322.
5687 2004-08-02 Martin Baulig <martin@ximian.com>
5689 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
5691 (TypeContainer.GetClassBases): Return the unexpanded list of
5692 interfaces; we expand them later.
5693 (TypeContainer.DefineType): After creating the TypeBuilder, call
5694 TypeManager.ExpandInterfaces() to get an expanded and resolved
5697 * ecore.cs (TypeExpr.GetInterfaces): Removed
5699 * generics.cs (Constraints.InterfaceConstraints): Remove.
5700 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
5701 register the interface constraints.
5704 (TypeManager.AddUserType): Removed the `ifaces' argument.
5705 (TypeManager.AddTypeParameter): Likewise.
5706 (TypeManager.AddUserInterface): Removed, was unused.
5707 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
5708 `TypeExpr[]' array for the interfaces.
5709 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
5710 has been defined, returns a list of the resolved interfaces types.
5711 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
5712 (TypeManager.GetExplicitInterfaces): Likewise.
5714 2004-08-02 Martin Baulig <martin@ximian.com>
5716 * expression.cs (Invocation.EmitCall): If we're invoking a method
5717 on a type parameter, use the new `Constrained' prefix opcode.
5719 2004-08-02 Martin Baulig <martin@ximian.com>
5721 * statement.cs (LocalInfo.Flags): Added `IsThis'.
5722 (LocalInfo.IsThis): New public property.
5723 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
5725 2004-08-01 Martin Baulig <martin@ximian.com>
5727 * class.cs (TypeContainer.GetClassBases): Don't set the default
5728 here since we may get called from GetPartialBases().
5729 (TypeContainer.DefineType): If GetClassBases() didn't return a
5730 parent, use the default one.
5732 2004-07-30 Martin Baulig <martin@ximian.com>
5734 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
5736 * class.cs (SourceMethod): New public class, derive from the
5737 symbol writer's ISourceMethod.
5738 (Method): Use the new symbol writer API.
5740 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
5741 as argument and use the new symbol writer.
5744 (SourceFile): Implement the symbol writer's ISourceFile.
5745 (Location.SymbolDocument): Removed.
5746 (Location.SourceFile): New public property.
5748 * symbolwriter.cs: Use the new symbol writer API.
5750 2004-07-30 Raja R Harinath <rharinath@novell.com>
5752 * Makefile (install-local): Remove. Functionality moved to
5755 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
5757 * Makefile: Install mcs.exe.config file together with mcs.exe.
5758 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
5759 correct runtime version.
5761 2004-07-25 Martin Baulig <martin@ximian.com>
5764 (TypeContainer.RegisterOrder): Removed, this was unused.
5765 (TypeContainer, interface_order): Removed.
5766 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
5767 TypeContainer as argument since we can also be called with a
5768 `PartialContainer' for a partial class/struct/interface.
5769 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
5770 of checking whether we're an `Interface' - we could be a
5772 (PartialContainer.Register): Override; call
5773 AddClass()/AddStruct()/AddInterface() on our parent.
5775 * cs-parser.jay (interface_member_declaration): Add things to the
5776 `current_container', not the `current_class'.
5778 * rootcontext.cs (RegisterOrder): The overloaded version which
5779 takes an `Interface' was unused, removed.
5781 * typemanager.cs (TypeManager.LookupInterface): Return a
5782 `TypeContainer', not an `Interface'.
5783 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
5784 contain a `PartialContainer' for an interface, so check it's
5785 `Kind' to figure out what it is.
5787 2004-07-25 Martin Baulig <martin@ximian.com>
5789 * class.cs (Class.DefaultTypeAttributes): New public constant.
5790 (Struct.DefaultTypeAttributes): Likewise.
5791 (Interface.DefaultTypeAttributes): Likewise.
5792 (PartialContainer.TypeAttr): Override this and add the
5793 DefaultTypeAttributes.
5795 2004-07-25 Martin Baulig <martin@ximian.com>
5797 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
5798 we can just use the `Parent' field instead.
5800 2004-07-25 Martin Baulig <martin@ximian.com>
5802 * class.cs (TypeContainer.Emit): Renamed to EmitType().
5804 2004-07-25 Martin Baulig <martin@ximian.com>
5806 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
5807 our parts before defining any methods.
5808 (TypeContainer.VerifyImplements): Make this virtual.
5809 (ClassPart.VerifyImplements): Override and call VerifyImplements()
5810 on our PartialContainer.
5812 2004-07-25 Martin Baulig <martin@ximian.com>
5814 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
5816 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
5817 argument, we can just use the `Parent' field instead.
5820 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
5821 (MemberBase.DoDefine): Likewise.
5823 2004-07-24 Martin Baulig <martin@ximian.com>
5825 * decl.cs (MemberCore.Parent): New public field.
5826 (DeclSpace.Parent): Moved to MemberCore.
5828 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
5829 (MemberBase.ctor): Added TypeContainer argument, pass it to our
5831 (FieldBase, Field, Operator): Likewise.
5832 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
5833 (EventField, Event): Likewise.
5835 2004-07-23 Martin Baulig <martin@ximian.com>
5837 * class.cs (PartialContainer): New public class.
5838 (ClassPart): New public class.
5839 (TypeContainer): Added support for partial classes.
5840 (TypeContainer.GetClassBases): Splitted some of the functionality
5841 out into GetNormalBases() and GetPartialBases().
5843 * cs-tokenizer.cs (Token.PARTIAL): New token.
5844 (Tokenizer.consume_identifier): Added some hacks to recognize
5845 `partial', but only if it's immediately followed by `class',
5846 `struct' or `interface'.
5848 * cs-parser.jay: Added support for partial clases.
5850 2004-07-23 Martin Baulig <martin@ximian.com>
5852 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
5853 a `DeclSpace' and also made it readonly.
5854 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
5855 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
5856 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
5858 * cs-parser.jay: Pass the `current_class', not the
5859 `current_container' (at the moment, this is still the same thing)
5860 to a new Method, Property, Event, Indexer or Constructor.
5862 2004-07-23 Martin Baulig <martin@ximian.com>
5864 * cs-parser.jay (CSharpParser): Added a new `current_class' field
5865 and removed the `current_interface' one.
5866 (struct_declaration, class_declaration, interface_declaration):
5867 Set `current_class' to the newly created class/struct/interface;
5868 set their `Bases' and call Register() before parsing their body.
5870 2004-07-23 Martin Baulig <martin@ximian.com>
5872 * class.cs (Kind): New public enum.
5873 (TypeContainer): Made this class abstract.
5874 (TypeContainer.Kind): New public readonly field.
5875 (TypeContainer.CheckDef): New public method; moved here from
5877 (TypeContainer.Register): New public abstract method.
5878 (TypeContainer.GetPendingImplementations): New public abstract
5880 (TypeContainer.GetClassBases): Removed the `is_class' and
5881 `is_iface' parameters.
5882 (TypeContainer.DefineNestedTypes): Formerly known as
5884 (ClassOrStruct): Made this class abstract.
5886 * tree.cs (RootTypes): New public type.
5888 2004-07-20 Martin Baulig <martin@ximian.com>
5890 * tree.cs (Tree.RecordNamespace): Removed.
5891 (Tree.Namespaces): Removed.
5893 * rootcontext.cs (RootContext.IsNamespace): Removed.
5895 * cs-parser.jay (namespace_declaration): Just create a new
5896 NamespaceEntry here.
5898 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
5900 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
5901 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
5902 entry to make sure it runs in the correct runtime version.
5904 2004-07-18 Martin Baulig <martin@ximian.com>
5906 * generic.cs (ConstructedType.CheckConstraints): Improved
5907 constraints checking.
5909 2004-07-18 Martin Baulig <martin@ximian.com>
5911 * expression.cs (Invocation.BetterMethod): Call
5912 TypeManager.TypeToCoreType() on all types and removed my previous
5913 hack; we're already doig the right thing here.
5915 2004-07-17 Martin Baulig <martin@ximian.com>
5917 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
5919 2004-07-16 Martin Baulig <martin@ximian.com>
5921 * iterators.cs: Added generics support.
5923 2004-07-16 Martin Baulig <martin@ximian.com>
5925 * iterators.cs: Rewrote this. We're now using one single Proxy
5926 class for both the IEnumerable and the IEnumerator interface and
5927 `Iterator' derives from Class so we can use the high-level API.
5929 * class.cs (TypeContainer.AddIterator): New method.
5930 (TypeContainer.DoDefineType): New protected virtual method, which
5931 is called from DefineType().
5932 (TypeContainer.DoDefineMembers): Call DefineType() and
5933 DefineMembers() on all our iterators.
5934 (TypeContainer.Emit): Call Emit() on all our iterators.
5935 (TypeContainer.CloseType): Call CloseType() on all our iterators.
5937 * codegen.cs (EmitContext.CurrentIterator): New public field.
5939 2004-07-15 Martin Baulig <martin@ximian.com>
5942 (TypeManager.not_supported_exception_type): New type.
5944 2004-07-14 Martin Baulig <martin@ximian.com>
5947 (TypeManager.generic_ienumerable_type): New type.
5948 (TypeManager.generic_ienumerator_type): New type.
5951 (RootContext.interfaces_first_stage): Added
5952 "System.Collections.Generic.IEnumerator`1" and
5953 "System.Collections.Generic.IEnumerable`1".
5955 2004-07-14 Martin Baulig <martin@ximian.com>
5957 * iterators.cs: Use real error numbers.
5959 2004-07-14 Martin Baulig <martin@ximian.com>
5961 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
5962 requires this to be a System.Collection.IEnumerable and not a
5963 class implementing that interface.
5964 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
5966 2004-07-13 Marek Safar <marek.safar@seznam.cz>
5968 * class.cs: Fixed previous fix, it broke some error tests.
5970 2004-07-12 Martin Baulig <martin@ximian.com>
5972 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
5975 2004-07-14 Martin Baulig <martin@ximian.com>
5977 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
5978 an exclamation mark (!) for the generic arity to reflect the
5979 latest spec changes; ie. use "System.Collections.Generic.IList`1".
5981 2004-07-13 Martin Baulig <martin@ximian.com>
5983 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
5984 specifiers being part of a type argument.
5986 2004-07-13 Martin Baulig <martin@ximian.com>
5988 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
5989 name for generic types.
5991 2004-07-13 Martin Baulig <martin@ximian.com>
5993 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
5996 2004-07-09 Miguel de Icaza <miguel@ximian.com>
5998 * assign.cs (LocalTemporary): Add new argument: is_address,If
5999 `is_address' is true, then the value that we store is the address
6000 to the real value, and not the value itself.
6002 * ecore.cs (PropertyExpr): use the new local temporary
6003 stuff to allow us to handle X.Y += z (where X is a struct)
6005 2004-07-08 Martin Baulig <martin@ximian.com>
6007 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
6008 not always return, just like we're doing in Using.Resolve().
6010 2004-07-07 Miguel de Icaza <miguel@ximian.com>
6012 * cs-parser.jay (fixed_statement): flag this as Pinned.
6014 2004-07-06 Miguel de Icaza <miguel@ximian.com>
6016 * typemanager.cs (TypeManager): Removed MakePinned method, this
6017 mechanism is replaced with the .NET 2.x compatible mechanism of
6018 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
6020 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
6021 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
6022 `IsFixed' property which has a different meaning.
6024 2004-07-02 Raja R Harinath <rharinath@novell.com>
6026 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
6027 visible from inside a nested class, not just the names of the
6028 immediately enclosing class.
6031 2004-06-24 Raja R Harinath <rharinath@novell.com>
6033 * expression.cs (BetterConversion): Remove buggy special-case
6034 handling of "implicit constant expression conversions". At this
6035 point, we already know that the conversion is possible -- we're
6036 only checking to see which is better.
6038 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6040 * cs-parser.jay: Added error CS0210 test.
6042 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6044 * cs-parser.jay: Added error CS0134 test.
6046 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6049 * cs-parser.jay: Added error CS0145 test.
6051 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6053 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
6055 2004-06-23 Ben Maurer <bmaurer@ximian.com>
6057 * expression.cs (StackAlloc.Resolve): The argument may not
6058 be a constant; deal with this case.
6060 2004-06-23 Marek Safar <marek.safar@seznam.cz>
6062 * attribute.cs (IndexerName_GetIndexerName): Renamed to
6063 GetIndexerAttributeValue.
6064 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
6066 * class.cs (Indexer.Define): Added error tests for CS0415,
6069 2004-06-23 Miguel de Icaza <miguel@ximian.com>
6071 * attribute.cs (Attribute.Resolve): Keep field code in sync with
6074 2004-06-23 Martin Baulig <martin@ximian.com>
6076 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
6077 neither return nor throw, reset the barrier as well. Fixes #60457.
6079 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
6081 * class.cs : EventAttributes is now set to None by default.
6082 This fixes bug #60459.
6084 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6087 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6088 Don't throw exception but return null (it's sufficient now).
6090 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6092 * typemanager.cs (GetArgumentTypes): Faster implementation.
6094 2004-06-18 Martin Baulig <martin@ximian.com>
6096 * attribute.cs (Attribute.Resolve): Check whether we're an
6097 EmptyCast which a Constant child. Fixes #60333.
6099 2004-06-17 Ben Maurer <bmaurer@ximian.com>
6101 * statement.cs (EmitCollectionForeach): Account for the fact that
6102 not all valuetypes are in areas which we can take the address of.
6103 For these variables, we store to a temporary variable. Also, make
6104 sure that we dont emit a `callvirt' on a valuetype method.
6106 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6108 * expression.cs (StackAlloc.DoReSolve): Added test for
6109 negative parameter (CS0247).
6111 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6114 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
6116 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6119 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
6122 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6124 Fix bug #58254 & cs1555.cs, cs1556.cs
6125 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
6127 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6129 * cs-parser.jay: Added error CS1669 test for indexers.
6131 2004-06-18 Martin Baulig <martin@ximian.com>
6133 * generics.cs (GenericMethod.ctor): Don't take an Attributes
6134 argument. Fixes #60441.
6136 2004-06-16 Ben Maurer <bmaurer@ximian.com>
6137 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
6138 The name needs to have the actual name of the method in order
6139 for other tests (such as the one in OverloadResolve for Invoke
6140 on a delegate) to work. As well, it does not really help
6141 error reporting because the method group had multiple methods.
6142 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
6143 Make profiling work.
6145 2004-06-13 Martin Baulig <martin@ximian.com>
6147 * cs-parser.jay: Don't allow generic attributes.
6149 2004-06-13 Martin Baulig <martin@ximian.com>
6151 * class.cs (MemberBase.DoDefineBase): New protected method.
6152 (MemberBase.DoDefine): Compute the `flags' in the new
6153 DoDefineBase() which must be called first.
6154 (Method.Define): Call DoDefineBase() first so we have the flags
6155 when defining the generic method.
6157 * cs-parser.jay (interface_method_declaration): Support generic methods.
6159 2004-06-13 Martin Baulig <martin@ximian.com>
6161 * decl.cs (TypeName): Removed.
6162 (MemberName): Removed TypeName and MemberNow; now we just have
6165 * cs-parser.jay: Don't distinguish between type arguments and type
6166 parameters in the grammar and simplified the rules a bit. The
6167 reduce/reduce conflicts are now gone (except the one we inherited
6170 2004-06-11 Martin Baulig <martin@ximian.com>
6172 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
6173 call this twice: for params and varargs methods.
6175 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6178 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
6180 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6182 * attribute.cs (Attribute.GetValidTargets): Made public.
6185 (AbstractPropertyEventMethod): New class for better code sharing.
6186 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
6188 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
6190 2004-06-09 Martin Baulig <martin@ximian.com>
6192 * cs-parser.jay: Removed a reduce/reduce conflict.
6194 2004-06-03 Martin Baulig <martin@ximian.com>
6196 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
6197 GetSimpleName() and return a SimpleName.
6199 * ecore.cs (SimpleName.Arguments): New public field.
6200 (SimpleName): Added overloaded ctor which takes an additional
6201 TypeArguments argument.
6202 (SimpleName.SimpleNameResolve): Added support for generic methods.
6203 (MethodGroupExpr.ResolveGeneric): New public method. The code was
6204 formerly in MemberAccess.DoResolve(), but we also need it in
6205 SimpleNameResolve().
6207 * expression.cs (MemberAccess.DoResolve): Use the new
6208 MethodGroupExpr.ResolveGeneric().
6210 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6212 * decl.cs: If possible, use lookuptypedirect here. We can only do
6213 this if there is no `.' after the namespace. Avoids using
6214 LookupType, which does lots of slow processing.
6215 (FindNestedType) New method, does what it says :-).
6216 * namespace.cs: use LookupTypeDirect.
6217 * rootcontext.cs: use membercache, if possible.
6218 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6220 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6223 According to the spec,
6225 In a member access of the form E.I, if E is a single identifier,
6226 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6227 field, property, localvariable, or parameter with the same type as
6228 the meaning of E as a type-name (§3.8), then both possible
6229 meanings of E are permitted.
6231 We did not check that E as a simple-name had the same type as E as
6234 This trivial check gives us 5-7% on bootstrap time.
6236 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6238 * expression.cs (Invocation.OverloadResolve): Avoid the
6239 use of hashtables and boxing here by allocating on demand.
6241 2004-05-30 Martin Baulig <martin@ximian.com>
6243 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6244 we're doing a silent lookup. Don't try to lookup nested types in
6245 TypeManager.object_type (thanks to Ben Maurer).
6247 2004-05-30 Martin Baulig <martin@ximian.com>
6249 Committing a patch from Ben Maurer.
6251 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6253 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6255 * convert.cs: add a trivial cache for overload operator resolution.
6257 2004-05-31 Marek Safar <marek.safar@seznam.cz>
6260 (AttributeTester.GetObsoleteAttribute): Returns instance of
6261 ObsoleteAttribute when type is obsolete.
6264 (TypeContainer.VerifyObsoleteAttribute): Override.
6265 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
6266 (MethodCode.VerifyObsoleteAttribute): Override.
6267 (MemberBase.VerifyObsoleteAttribute): Override.
6270 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
6271 and report proper error.
6274 (Delegate.VerifyObsoleteAttribute): Override.
6277 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
6278 and report proper error.
6279 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
6282 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
6286 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
6287 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
6288 Added test for ObsoleteAttribute.
6291 (Catch): Derived from Statement.
6293 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6295 * decl.cs: If possible, use lookuptypedirect here. We can only do
6296 this if there is no `.' after the namespace. Avoids using
6297 LookupType, which does lots of slow processing.
6298 (FindNestedType) New method, does what it says :-).
6299 * namespace.cs: use LookupTypeDirect.
6300 * rootcontext.cs: use membercache, if possible.
6301 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6303 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6306 According to the spec,
6308 In a member access of the form E.I, if E is a single identifier,
6309 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6310 field, property, localvariable, or parameter with the same type as
6311 the meaning of E as a type-name (§3.8), then both possible
6312 meanings of E are permitted.
6314 We did not check that E as a simple-name had the same type as E as
6317 This trivial check gives us 5-7% on bootstrap time.
6319 2004-05-30 Marek Safar <marek.safar@seznam.cz>
6321 Fixed bug #59071 & cs0160.cs
6322 * statement.cs (Try.Resolve): Check here whether order of catch
6323 clauses matches their dependencies.
6325 2004-05-30 Marek Safar <marek.safar@seznam.cz>
6328 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
6331 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6333 * expression.cs (Invocation.OverloadResolve): Avoid the
6334 use of hashtables and boxing here by allocating on demand.
6336 2004-05-30 Martin Baulig <martin@ximian.com>
6338 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6339 we're doing a silent lookup. Don't try to lookup nested types in
6340 TypeManager.object_type (thanks to Ben Maurer).
6342 2004-05-30 Martin Baulig <martin@ximian.com>
6344 Committing a patch from Ben Maurer.
6346 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6348 2004-05-29 Martin Baulig <martin@ximian.com>
6350 * class.cs (IMethodData.ShouldIgnore): New method.
6352 * typemanager.cs (TypeManager.MethodFlags): Don't take a
6353 `Location' argument, we don't need it anywhere. Use
6354 `IMethodData.ShouldIgnore ()' instead of
6355 `MethodData.GetMethodFlags ()'.
6356 (TypeManager.AddMethod): Removed.
6357 (TypeManager.AddMethod2): Renamed to AddMethod.
6359 2004-05-29 Martin Baulig <martin@ximian.com>
6361 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
6363 * convert.cs (Convert.ImplicitReferenceConversion): If we're
6364 converting from a class type S to an interface type and we already
6365 have an object on the stack, don't box it again. Fixes #52578.
6367 2004-05-29 Martin Baulig <martin@ximian.com>
6369 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6370 Added support for `params' parameters. Fixes #59267.
6372 2004-05-29 Martin Baulig <martin@ximian.com>
6374 * literal.cs (NullPointer): Provide a private .ctor which sets
6375 `type' to TypeManager.object_type. Fixes #59048.
6377 2004-05-29 Martin Baulig <martin@ximian.com>
6379 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
6380 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
6382 * ecore.cs (EventExpr.instance_expr): Make the field private.
6384 2004-05-26 Marek Safar <marek.safar@seznam.cz>
6386 Fixed bug #50080 & cs0214-2.cs
6387 * expression.cs (Cast.DoResolve): Check unsafe context here.
6389 * statement.cs (Resolve.DoResolve): Likewise.
6391 2004-05-26 Martin Baulig <martin@ximian.com>
6393 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6395 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6396 (RootContext.LookupType): Pass down the `silent' flag.
6398 2004-05-25 Martin Baulig <martin@ximian.com>
6401 (MethodGroupExpr.IdenticalTypeName): New public property.
6402 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6403 expression actually refers to a type.
6405 2004-05-25 Martin Baulig <martin@ximian.com>
6407 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6408 for #56176 and made it actually work.
6410 2004-05-25 Martin Baulig <martin@ximian.com>
6412 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6413 (FieldExpr, PropertyExpr): Override and implement
6414 CacheTemporaries. Fixes #52279.
6416 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6418 * location.cs: In the new compiler listing a file twice is a
6419 warning, not an error.
6421 2004-05-24 Martin Baulig <martin@ximian.com>
6423 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6424 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6426 2004-05-24 Martin Baulig <martin@ximian.com>
6428 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6429 walking the `using' list. Fixes #53921.
6431 2004-05-24 Martin Baulig <martin@ximian.com>
6433 * const.cs (Const.LookupConstantValue): Added support for
6434 EmptyCast's; fixes #55251.
6436 2004-05-24 Martin Baulig <martin@ximian.com>
6438 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6439 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6440 which does the CS0135 check. The reason is that we first need to
6441 check whether the variable actually exists.
6443 2004-05-24 Martin Baulig <martin@ximian.com>
6445 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6446 than RootContext.LookupType() to find the explicit interface
6449 2004-05-24 Raja R Harinath <rharinath@novell.com>
6451 * Makefile: Simplify. Use executable.make.
6452 * mcs.exe.sources: New file. List of sources of mcs.exe.
6454 2004-05-24 Anders Carlsson <andersca@gnome.org>
6458 Use the invariant culture when doing String.Compare for CLS case
6461 2004-05-23 Martin Baulig <martin@ximian.com>
6463 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6464 don't have any dots. Fixes #52622, added cs0246-8.cs.
6466 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6468 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6470 * class.cs (MemberBase.Define): Reuse MemberType member for
6471 resolved type. Other methods can use it too.
6473 2004-05-23 Martin Baulig <martin@ximian.com>
6475 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6476 the variable also exists in the current block (otherwise, we need
6477 to report a CS0103). Fixes #58670.
6479 2004-05-23 Martin Baulig <martin@ximian.com>
6481 * flowanalysis.cs (Reachability.Reachable): Compute this
6482 on-the-fly rather than storing it as a field.
6484 2004-05-23 Martin Baulig <martin@ximian.com>
6486 * flowanalysis.cs (Reachability.And): Manually compute the
6487 resulting `barrier' from the reachability.
6489 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6492 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6493 instance of ObsoleteAttribute when symbol is obsolete.
6496 (IMethodData): Extended interface for ObsoleteAttribute support.
6498 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6500 * attribute.cs: Fix bug #55970
6502 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6506 (GetObsoleteAttribute): New method. Creates the instance of
6508 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6509 ObsoleteAttribute when member is obsolete.
6510 (AttributeTester.Report_ObsoleteMessage): Common method for
6511 Obsolete error/warning reporting.
6514 (TypeContainer.base_classs_type): New member for storing parent type.
6517 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6518 for this MemberCore.
6520 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6522 * attribute.cs, const.cs: Fix bug #58590
6524 2004-05-21 Martin Baulig <martin@ximian.com>
6526 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
6527 out parameters if the end of the method is unreachable. Fixes
6530 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6532 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
6533 Hari was right, why extra method.
6535 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6537 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
6539 2004-05-20 Martin Baulig <martin@ximian.com>
6541 * delegate.cs: Convert this file to Unix mode - like the original
6544 2004-05-20 Martin Baulig <martin@ximian.com>
6546 * attribute.cs: Convert this file to Unix mode - like the original
6549 2004-05-19 Marek Safar <marek.safar@seznam.cz>
6551 Fix bug #58688 (MCS does not report error when the same attribute
6554 * attribute.cs (Attribute.Emit): Distinction between null and default.
6556 2004-05-19 Raja R Harinath <rharinath@novell.com>
6558 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
6559 of a top-level attribute without an attribute target.
6560 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
6562 (Attribute.Conditional_GetConditionName),
6563 (Attribute.Obsolete_GetObsoleteMessage): Update.
6564 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
6565 part of ScanForIndexerName.
6566 (Attribute.CanIgnoreInvalidAttribute): New function.
6567 (Attribute.ScanForIndexerName): Move to ...
6568 (Attributes.ScanForIndexerName): ... here.
6569 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
6570 (Attributes.Search): New internal variant that can choose not to
6571 complain if types aren't resolved. The original signature now
6573 (Attributes.GetClsCompliantAttribute): Use internal variant, with
6574 complaints suppressed.
6575 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
6576 only if it not useful.
6577 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
6578 top-level for attributes that are shared between the assembly
6579 and a top-level class.
6580 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
6581 * class.cs: Update to reflect changes.
6582 (DefineIndexers): Fuse loops.
6583 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
6584 a couple more variants of attribute names.
6586 2004-05-18 Marek Safar <marek.safar@seznam.cz>
6588 Fix bug #52585 (Implemented explicit attribute declaration)
6591 (Attributable.ValidAttributeTargets): New abstract method. It gets
6592 list of valid attribute targets for explicit target declaration.
6593 (Attribute.Target): It holds target itself.
6594 (AttributeSection): Removed.
6595 (Attribute.CheckTargets): New method. It checks whether attribute
6596 target is valid for the current element.
6599 (EventProperty): New class. For events that are declared like
6600 property (with add and remove accessors).
6601 (EventField): New class. For events that are declared like field.
6604 * cs-parser.jay: Implemented explicit attribute target declaration.
6606 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
6607 Override ValidAttributeTargets.
6610 (ReturnParameter): Class for applying custom attributes on
6612 (ParameterAtribute): New class. Class for applying custom
6613 attributes on the parameter type.
6615 2004-05-17 Miguel de Icaza <miguel@ximian.com>
6617 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
6620 (Method): Allow UNSAFE here.
6622 * modifiers.cs: Support unsafe reporting.
6624 2004-05-17 Marek Safar <marek.safar@seznam.cz>
6626 * decl.cs: Fix bug #58478.
6628 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6630 * statement.cs: When checking for unreachable code on an EmptyStatement,
6631 set the location. Fixes bug #58488.
6633 2004-05-13 Miguel de Icaza <miguel@ximian.com>
6635 * driver.cs: Add -pkg handling.
6637 From Gonzalo: UseShelLExecute=false
6639 2004-05-12 Marek Safar <marek.safar@seznam.cz>
6642 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
6644 (Attribute.IsClsCompliaceRequired): Moved to base for better
6646 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
6647 when attribute is AttributeUsageAttribute.
6648 (Attribute.GetValidTargets): Simplified.
6649 (Attribute.GetAttributeUsage): New method returns AttributeUsage
6650 attribute for this type.
6651 (Attribute.ApplyAttributes): Method renamed to Emit and make
6653 (GlobalAttributeSection): New class for special handling of global
6654 attributes (assembly, module).
6655 (AttributeSection.Emit): New method.
6657 * class.cs: Implemented Attributable abstract methods.
6658 (MethodCore.LabelParameters): Moved to Parameter class.
6659 (Accessor): Is back simple class.
6660 (PropertyMethod): Implemented Attributable abstract class.
6661 (DelegateMethod): Implemented Attributable abstract class.
6662 (Event): New constructor for disctintion between normal Event
6663 and Event with accessors.
6665 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
6667 * codegen.cs, const.cs, decl.cs, delegate.cs:
6668 (CommonAssemblyModulClass): Implemented Attributable abstract class
6671 * enum.cs: Implement IAttributeSupport interface.
6672 (EnumMember): New class for emum members. Implemented Attributable
6676 (ParameterBase): Is abstract.
6677 (ReturnParameter): New class for easier [return:] attribute handling.
6679 * typemanager.cs: Removed builder_to_attr.
6681 2004-05-11 Raja R Harinath <rharinath@novell.com>
6684 * attribute.cs (Attribute.GetPositionalValue): New function.
6685 * class.cs (TypeContainer.VerifyMembers): New function.
6686 (TypeContainer.Emit): Use it.
6687 (ClassOrStruct): New base class for Class and Struct.
6688 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
6689 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
6691 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
6692 then each non-static field should have a FieldOffset attribute.
6693 Otherwise, none of the fields should have a FieldOffset attribute.
6694 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
6695 and FieldOffset attributes.
6696 * typemanager.cs (TypeManager.struct_layout_attribute_type)
6697 (TypeManager.field_offset_attribute_type): New core types.
6698 (TypeManager.InitCoreTypes): Initialize them.
6700 2004-05-11 Michal Moskal <malekith@pld-linux.org>
6702 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
6703 Return correct type.
6706 2004-05-09 Miguel de Icaza <miguel@ximian.com>
6708 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
6709 be implicitly converted to ulong.
6711 * expression.cs: The logic for allowing operator &, | and ^ worked
6712 was wrong, it worked before because we did not report an error in
6713 an else branch. Fixes 57895.
6715 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
6716 allow volatile fields to be reference types.
6718 2004-05-07 Miguel de Icaza <miguel@ximian.com>
6720 * driver.cs: Add support for /debug-
6722 2004-05-07 Raja R Harinath <rharinath@novell.com>
6724 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
6725 Add a 'complain' parameter to silence errors.
6726 (Attribute.Resolve): Update to changes. Put in sanity check to catch
6727 silently overlooked type-resolutions.
6728 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
6730 (Attributes.Search): New function.
6731 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
6732 (Attributes.GetAttributeFullName): Remove hack.
6733 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
6734 Update to reflect changes.
6735 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
6736 Use Attributes.Search instead of nested loops.
6738 2004-05-07 Marek Safar <marek.safar@seznam.cz>
6741 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
6742 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
6743 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
6745 * report.cs: (Report.Warning): Renamed to Warning_T because of
6746 parameter collision.
6748 2004-05-05 Raja R Harinath <rharinath@novell.com>
6750 * expression.cs (MemberAccess.ResolveMemberAccess):
6751 Exit with non-zero status after Report.Error.
6752 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
6754 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
6756 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6758 * support.cs: Don't hang when the file is empty.
6760 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6762 * support.cs: In SeekableStreamReader, compute the preamble size of the
6763 underlying stream. Position changes should take into account that initial
6766 2004-05-03 Todd Berman <tberman@sevenl.net>
6768 * driver.cs: remove unused GetSysVersion function.
6770 2004-05-03 Todd Berman <tberman@sevenl.net>
6772 * driver.cs: Remove the hack from saturday, as well as the hack
6773 from jackson (LoadAssemblyFromGac), also adds the CWD to the
6774 link_paths to get that bit proper.
6776 2004-05-01 Todd Berman <tberman@sevenl.net>
6778 * driver.cs: Try a LoadFrom before a Load, this checks the current
6779 path. This is currently a bug in mono that is be fixed, however, this
6780 provides a workaround for now. This will be removed when the bug
6783 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
6785 * CryptoConvert.cs: Updated to latest version. Fix issue with
6786 incomplete key pairs (#57941).
6788 2004-05-01 Todd Berman <tberman@sevenl.net>
6790 * driver.cs: Remove '.' from path_chars, now System.* loads properly
6793 2004-04-30 Jackson Harper <jackson@ximian.com>
6795 * codegen.cs: Open keys readonly.
6797 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6799 * typemanager.cs: don't report cyclic struct layout when a struct
6800 contains 2 or more fields of the same type. Failed for Pango.AttrShape
6801 which has 2 Pango.Rectangle fields.
6803 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
6805 * expression.cs: Handle IntPtr comparisons with IL code
6806 rather than a method call.
6808 2004-04-29 Martin Baulig <martin@ximian.com>
6810 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
6811 the list of PropertyInfo's in class hierarchy and find the
6812 accessor. Fixes #56013.
6814 2004-04-29 Martin Baulig <martin@ximian.com>
6816 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
6818 2004-04-29 Martin Baulig <martin@ximian.com>
6820 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6822 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
6824 2004-04-29 Martin Baulig <martin@ximian.com>
6826 * class.cs (ConstructorInitializer.Resolve): Check whether the
6827 parent .ctor is accessible. Fixes #52146.
6829 2004-04-29 Martin Baulig <martin@ximian.com>
6831 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6833 * statement.cs (Using.EmitLocalVariableDecls): Use
6834 TypeManager.idisposable_type, not typeof (IDisposable).
6835 (Foreach.EmitCollectionForeach): Added support for valuetypes.
6837 2004-04-29 Martin Baulig <martin@ximian.com>
6839 * class.cs (Event.Define): Don't emit the field and don't set
6840 RTSpecialName and SpecialName for events on interfaces. Fixes
6843 2004-04-29 Raja R Harinath <rharinath@novell.com>
6845 Refactor Attribute.ApplyAttributes.
6846 * attribute.cs (Attributable): New base class for objects that can
6847 have Attributes applied on them.
6848 (Attribute): Make AttributeUsage fields public.
6849 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
6850 (Attribute.IsInternalCall): New property.
6851 (Attribute.UsageAttr): Convert to a public read-only property.
6852 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
6853 (Attribute.ResolveType, Attribute.Resolve)
6854 (Attribute.ScanForIndexerName): Update to reflect changes.
6855 (Attribute.CheckAttributeTarget): Re-format.
6856 (Attribute.ApplyAttributes): Refactor, to various
6857 Attributable.ApplyAttributeBuilder methods.
6858 * decl.cs (MemberCore): Make Attributable.
6859 * class.cs (Accessor): Make Attributable.
6860 (MethodData.ApplyAttributes): Use proper attribute types, not
6862 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
6863 (TypeContainer.ApplyAttributeBuilder)
6864 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
6865 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
6866 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
6867 (Operator.ApplyAttributeBuilder): New factored-out methods.
6868 * const.cs (Const.ApplyAttributeBuilder): Likewise.
6869 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
6870 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
6871 * parameter.cs (ParameterBase): New Attributable base class
6872 that can also represent Return types.
6873 (Parameter): Update to the changes.
6875 2004-04-29 Jackson Harper <jackson@ximian.com>
6877 * driver.cs: Prefer the corlib system version when looking for
6878 assemblies in the GAC. This is still a hack, but its a better hack
6881 2004-04-29 Marek Safar <marek.safar@seznam.cz>
6883 * decl.cs, enum.cs: Improved error 3005 reporting.
6885 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
6886 (related_symbols): New private member for list of symbols
6887 related to reported error/warning.
6889 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
6891 2004-04-29 Martin Baulig <martin@ximian.com>
6893 * ecore.cs (Expression.Constantify): If we're an enum and
6894 TypeManager.TypeToCoreType() doesn't give us another type, use
6895 t.UnderlyingSystemType. Fixes #56178.
6897 2004-04-29 Martin Baulig <martin@ximian.com>
6899 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
6900 interfaces and for each interface, only add members directly
6901 declared in that interface. Fixes #53255.
6903 2004-04-28 Martin Baulig <martin@ximian.com>
6905 * expression.cs (ConditionalLogicalOperator): Use a temporary
6906 variable for `left' to avoid that we evaluate it more than once;
6909 2004-04-28 Martin Baulig <martin@ximian.com>
6911 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
6914 2004-04-28 Martin Baulig <martin@ximian.com>
6916 * statement.cs (LocalInfo.Resolve): Check whether the type is not
6919 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
6920 whether the type is not void (CS1547).
6922 2004-04-28 Martin Baulig <martin@ximian.com>
6924 * expression.cs (Unary.DoResolveLValue): Override this and report
6925 CS0131 for anything but Operator.Indirection.
6927 2004-04-28 Martin Baulig <martin@ximian.com>
6929 Committing a patch from Ben Maurer; see bug #50820.
6931 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6934 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6937 2004-04-28 Martin Baulig <martin@ximian.com>
6939 Committing a patch from Ben Maurer; see bug #50820.
6941 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6944 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6947 2004-04-28 Martin Baulig <martin@ximian.com>
6949 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
6950 (Block.AddLabel): Call DoLookupLabel() to only search in the
6953 2004-04-28 Martin Baulig <martin@ximian.com>
6955 * cfold.cs (ConstantFold.BinaryFold): Added special support for
6956 comparing StringConstants and NullLiterals in Equality and Inequality.
6958 2004-04-28 Jackson Harper <jackson@ximian.com>
6960 * driver.cs: Attempt to load referenced assemblies from the
6961 GAC. This is the quick and dirty version of this method that
6962 doesnt take into account versions and just takes the first
6963 canidate found. Will be good enough for now as we will not have more
6964 then one version installed into the GAC until I update this method.
6966 2004-04-28 Martin Baulig <martin@ximian.com>
6968 * typemanager.cs (TypeManager.CheckStructCycles): New public
6969 static method to check for cycles in the struct layout.
6971 * rootcontext.cs (RootContext.PopulateTypes): Call
6972 TypeManager.CheckStructCycles() for each TypeContainer.
6973 [Note: We only need to visit each type once.]
6975 2004-04-28 Martin Baulig <martin@ximian.com>
6977 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
6979 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
6980 success and added `out object value'. Use a `bool resolved' field
6981 to check whether we've already been called rather than
6982 `ConstantValue != null' since this breaks for NullLiterals.
6984 2004-04-28 Raja R Harinath <rharinath@novell.com>
6986 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
6987 setting of this flag, since the 'set' method may be non-public.
6989 2004-04-28 Raja R Harinath <rharinath@novell.com>
6991 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
6992 check on current_vector.Block.
6994 2004-04-27 Martin Baulig <martin@ximian.com>
6996 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
6997 a field initializer. Fixes #56459.
6999 2004-04-27 Martin Baulig <martin@ximian.com>
7001 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
7002 we're not attempting to use an indexer. Fixes #52154.
7004 2004-04-27 Martin Baulig <martin@ximian.com>
7006 * statement.cs (Return): Don't create a return label if we don't
7007 need it; reverts my change from January 20th. Thanks to Ben
7010 2004-04-27 Martin Baulig <martin@ximian.com>
7012 According to the spec, `goto' can only leave a nested scope, but
7015 * statement.cs (Block.LookupLabel): Only lookup in the current
7016 block, don't recurse into parent or child blocks.
7017 (Block.AddLabel): Check in parent and child blocks, report
7018 CS0140/CS0158 if we find a duplicate.
7019 (Block): Removed this indexer for label lookups.
7020 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
7021 this already does the error reporting for us.
7024 (FlowBranching.UsageVector.Block): New public variable; may be null.
7025 (FlowBranching.CreateSibling): Added `Block' argument.
7026 (FlowBranching.LookupLabel): New public virtual method. Lookup a
7027 label for the target of a `goto' and check whether we're not
7028 leaving a `finally'.
7030 2004-04-27 Martin Baulig <martin@ximian.com>
7032 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
7033 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
7036 2004-04-27 Martin Baulig <martin@ximian.com>
7038 * statement.cs (Block.AddLabel): Also check for implicit blocks
7039 and added a CS0158 check.
7041 2004-04-27 Martin Baulig <martin@ximian.com>
7043 * flowanalysis.cs (FlowBranchingLoop): New class.
7044 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
7045 UsageVector's instead of an ArrayList.
7046 (FlowBranching.Label): Likewise.
7047 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
7048 (FlowBranching.AddBreakVector): New method.
7050 2004-04-27 Miguel de Icaza <miguel@ximian.com>
7052 * attribute.cs: Small regression fix: only convert the type if we
7053 the type is different, fixes System.Drawing build.
7055 2004-04-27 Martin Baulig <martin@ximian.com>
7057 * attribute.cs (Attribute.Resolve): If we have a constant value
7058 for a named field or property, implicity convert it to the correct
7061 2004-04-27 Raja R Harinath <rharinath@novell.com>
7063 * statement.cs (Block.Block): Implicit blocks share
7064 'child_variable_names' fields with parent blocks.
7065 (Block.AddChildVariableNames): Remove.
7066 (Block.AddVariable): Mark variable as "used by a child block" in
7067 every surrounding block.
7068 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
7069 been used in a child block, complain about violation of "Invariant
7070 meaning in blocks" rule.
7071 * cs-parser.jay (declare_local_variables): Don't use
7072 AddChildVariableNames.
7073 (foreach_statement): Don't create an implicit block: 'foreach'
7076 2004-04-23 Miguel de Icaza <miguel@ximian.com>
7078 * convert.cs (ImplicitNumericConversion): 0 is also positive when
7079 converting from 0L to ulong. Fixes 57522.
7081 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7083 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
7084 derived class hides via 'new' keyword field from base class (test-242.cs).
7085 TODO: Handle this in the more general way.
7087 * class.cs (CheckBase): Ditto.
7089 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7091 * decl.cs (caching_flags): New member for storing cached values
7093 (MemberCore.Flags): New enum where bit flags for caching_flags
7095 (MemberCore.cls_compliance): Moved to caching_flags.
7096 (DeclSpace.Created): Moved to caching_flags.
7098 * class.cs: Use caching_flags instead of DeclSpace.Created
7100 2004-04-21 Miguel de Icaza <miguel@ximian.com>
7102 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
7103 if we are only a derived class, not a nested class.
7105 * typemanager.cs: Same as above, but do this at the MemberLookup
7106 level (used by field and methods, properties are handled in
7107 PropertyExpr). Allow for the qualified access if we are a nested
7110 2004-04-21 Marek Safar <marek.safar@seznam.cz>
7112 * class.cs: Refactoring.
7113 (IMethodData): New inteface; Holds links to parent members
7114 to avoid member duplication (reduced memory allocation).
7115 (Method): Implemented IMethodData interface.
7116 (PropertyBase): New inner classes for get/set methods.
7117 (PropertyBase.PropertyMethod): Implemented IMethodData interface
7118 (Event): New inner classes for add/remove methods.
7119 (Event.DelegateMethod): Implemented IMethodData interface.
7121 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
7122 EmitContext (related to class.cs refactoring).
7124 2004-04-21 Raja R Harinath <rharinath@novell.com>
7126 * delegate.cs (Delegate.VerifyApplicability): If the number of
7127 arguments are the same as the number of parameters, first try to
7128 verify applicability ignoring any 'params' modifier on the last
7132 2004-04-08 Martin Baulig <martin@ximian.com>
7134 Merged latest changes into gmcs. Please keep this comment in
7135 here, it makes it easier for me to see what changed in MCS since
7136 the last time I merged.
7138 2004-04-16 Raja R Harinath <rharinath@novell.com>
7140 * class.cs (TypeContainer.AddIndexer): Use
7141 'ExplicitInterfaceName' to determine if interface name was
7142 explicitly specified. 'InterfaceType' is not initialized at this time.
7143 (TypeContainer.DefineIndexers): Remove use of temporary list. The
7144 Indexers array is already in the required order. Initialize
7145 'IndexerName' only if there are normal indexers.
7146 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
7147 (TypeContainer.Emit): Emit DefaultMember attribute only if
7148 IndexerName is initialized.
7151 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
7153 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
7156 2004-04-15 Raja R Harinath <rharinath@novell.com>
7158 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
7162 * attribute.cs (Attribute.Resolve): Check for duplicate named
7166 2004-04-15 Miguel de Icaza <miguel@ximian.com>
7168 * iterators.cs (MarkYield): track whether we are in an exception,
7169 and generate code accordingly. Use a temporary value to store the
7170 result for our state.
7172 I had ignored a bit the interaction of try/catch with iterators
7173 since their behavior was not entirely obvious, but now it is
7174 possible to verify that our behavior is the same as MS .NET 2.0
7178 2004-04-14 Miguel de Icaza <miguel@ximian.com>
7180 * iterators.cs: Avoid creating temporaries if there is no work to
7183 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
7184 Enumerations, use TypeManager.EnumToUnderlying and call
7187 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
7190 (This.Emit): Use EmitContext.EmitThis to emit our
7193 (This.EmitAssign): Ditto.
7195 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
7196 codepaths, we will move all the functionality into
7199 (FieldExpr.EmitAssign): Ditto.
7201 This fixes several hidden bugs that I uncovered while doing a code
7202 review of this today.
7204 * codegen.cs (EmitThis): reworked so the semantics are more clear
7205 and also support value types "this" instances.
7207 * iterators.cs: Changed so that for iterators in value types, we
7208 do not pass the value type as a parameter.
7210 Initialization of the enumerator helpers is now done in the caller
7211 instead of passing the parameters to the constructors and having
7212 the constructor set the fields.
7214 The fields have now `assembly' visibility instead of private.
7216 2004-04-11 Miguel de Icaza <miguel@ximian.com>
7218 * expression.cs (Argument.Resolve): Check if fields passed as ref
7219 or out are contained in a MarshalByRefObject.
7221 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
7222 another compiler type.
7224 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
7226 * class.cs (Indexer.Define): use the new name checking method.
7227 Also, return false on an error.
7228 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
7229 (is_identifier_[start/part]_character): make static.
7231 2004-04-10 Miguel de Icaza <miguel@ximian.com>
7233 * expression.cs (Binary.ResolveOperator): Do no append strings
7234 twice: since we can be invoked more than once (array evaluation)
7235 on the same concatenation, take care of this here. Based on a fix
7236 from Ben (bug #56454)
7238 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
7240 * codegen.cs: Fix another case where CS1548 must be reported (when
7241 delay-sign isn't specified and no private is available #56564). Fix
7242 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
7243 error when MCS is used on the MS runtime and we need to delay-sign
7244 (which seems unsupported by AssemblyBuilder - see #56621).
7246 2004-04-08 Marek Safar <marek.safar@seznam.cz>
7248 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
7249 (TypeManager.ComputeNamespaces): Faster implementation for
7252 * compiler.csproj: Updated AssemblyName to mcs.
7254 2004-05-11 Jackson Harper <jackson@ximian.com>
7256 * Makefile: Preserve MONO_PATH
7258 2004-05-11 Jackson Harper <jackson@ximian.com>
7260 * Makefile: Use mono and mcs to build gmcs
7262 2004-05-03 Miguel de Icaza <miguel@ximian.com>
7264 * codegen.cs: Add patch from Robert Shade
7265 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
7268 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
7270 * CryptoConvert.cs: Updated to latest version. Fix issue with
7271 incomplete key pairs (#57941).
7273 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
7275 * codegen.cs: Fix another case where CS1548 must be reported (when
7276 delay-sign isn't specified and no private is available #56564). Fix
7277 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
7278 error when MCS is used on the MS runtime and we need to delay-sign
7279 (which seems unsupported by AssemblyBuilder - see #56621).
7281 2004-04-29 Jackson Harper <jackson@ximian.com>
7283 * Makefile: Set MONO_PATH to use the bootstrap corlib
7284 * driver.cs: Check the GAC for referenced assemblies.
7286 2004-04-29 Martin Baulig <martin@ximian.com>
7288 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
7290 2004-04-07 Martin Baulig <martin@ximian.com>
7292 * expression.cs (Binary.ResolveOperator): Added special case for
7293 Equality/Inequality between a type parameter and a null literal.
7295 2004-04-07 Martin Baulig <martin@ximian.com>
7297 * convert.cs: Check null literal -> type parameter conversions.
7299 2004-04-07 Martin Baulig <martin@ximian.com>
7301 * generic.cs (ConstructedType.CheckConstraints): Enforce the
7302 `class' and `struct' constraints.
7304 2004-04-07 Martin Baulig <martin@ximian.com>
7306 * generic.cs (SpecialConstraint): New public enum.
7307 (Constraints.Resolve): Added support for the `class' and `struct'
7310 * cs-parser.jay (type_parameter_constraint): Added support for the
7311 `class' and `struct' constraints.
7313 2004-04-07 Martin Baulig <martin@ximian.com>
7315 * support.cs (GenericConstraints): Replaced `Types' by
7316 `ClassConstraint' and `InterfaceConstraints'; added
7317 `HasClassConstraint'.
7319 2004-04-07 Martin Baulig <martin@ximian.com>
7322 (Constraints.InterfaceConstraints): New public property.
7323 (Constraints.Types): Make this property public
7324 (TypeParameter): Implement IMemberContainer.
7325 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
7326 instead of a TypeBuilder/MethodBuilder; pass the interface
7327 constraints to TypeManager.AddTypeParameter().
7328 (TypeParameter.DefineType): Just take an EmitContext and no
7329 TypeBuilder/MethodBuilder. Use the new public API.
7331 * typemanager.cs (TypeManager.AddTypeParameter): Added
7332 `TypeExpr[]' argument; add the interfaces to the
7333 `builder_to_ifaces' hash.
7334 (TypeManager.LookupMemberContainer): For
7335 GenericTypeParameterBuilders, get the TypeParameter from the
7336 `builder_to_type_param'.
7337 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
7338 the TypeParameter and call FindMembers on it.
7340 2004-04-07 Martin Baulig <martin@ximian.com>
7343 (MethodCore.GenericMethod): Moved this field here from Method.
7344 (MethodCore.IsDuplicateImplementation): Take the number of type
7345 parameters into account if we're a generic method.
7347 * expression.cs (Invocation.InferTypeArguments): Don't return true
7348 if `arguments' is null; we still need to check whether we actually
7349 don't need to infer anything in this case.
7350 (MemberAccess): Merged the functionality from GenericMemberAccess
7353 * generic.cs (GenericMemberAccess): Removed.
7355 2004-04-05 Martin Baulig <martin@ximian.com>
7357 * decl.cs (MemberCore): For generic classes, interfaces and
7358 structs, `Name' now includes the number of type parameters
7360 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
7361 encode the number of type arguments in the type name.
7363 * expression.cs (Expression.MemberLookup): Removed the
7364 `num_type_args' argument; we now encode the number of type
7365 arguments in the type name.
7367 * ecore.cs (SimpleName): Encode the number of type arguments in
7368 the type name itself.
7370 * generic.cs (ConstructedType): Likewise.
7372 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
7373 `MemberName'; we now include the number of type parameters in the
7376 * typemanager.cs (TypeManager.CheckGeneric): Removed.
7377 (TypeManager.MemberLookup): Removed the
7378 `num_type_args' argument; we now encode the number of type
7379 arguments in the type name.
7381 2004-04-03 Martin Baulig <martin@ximian.com>
7383 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
7384 (MemberCore.MemberName): Moved here from MemberBase.
7385 (DeclSpace.SetParameterInfo): Just take the constraints as an
7386 ArrayList; we already have the type parameters in our
7387 `MemberName'; also do the CS0080 reporting here.
7389 * cs-parser.jay (struct_declaration): Use `member_name' instead of
7390 `IDENTIFIER opt_type_parameter_list'; when constructing our
7391 `MemberName', it'll already include our type parameters.
7392 (class_declaration, interface_declaration): Likewise.
7393 (delegate_declaration): Likewise.
7394 (MakeName): Take a MemberName and return a MemberName.
7395 The following two changes are required to avoid shift/reduce conflicts:
7396 (member_name): Don't include a TypeName anymore; ie. this is now
7397 just 'IDENTIFIER opt_type_parameter_list'.
7398 (property_declaration, event_declaration): Use a
7399 `namespace_or_type_name' instead of a `member_name'.
7401 2004-04-03 Martin Baulig <martin@ximian.com>
7403 * decl.cs (MemberName): Renamed to `TypeName' and created a new
7405 (TypeName): Formerly known as MemberName.
7407 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
7408 instead of a `MemberName'.
7410 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
7411 (member_name): New rule; create a MemberName.
7413 2004-04-02 Martin Baulig <martin@ximian.com>
7415 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
7416 (CS0305 and CS0308).
7418 2004-04-02 Martin Baulig <martin@ximian.com>
7420 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
7421 support for nested types.
7423 2004-04-02 Martin Baulig <martin@ximian.com>
7425 * ecore.cs (IAlias): New public interface.
7426 (TypeExpr, TypeExpression): Implement IAlias.
7427 (TypeAliasExpression): New public class.
7429 * namespace.cs (Namespace): Implement IAlias.
7430 (Namespace.Lookup): Return an IAlias instead on an object.
7431 (Namespace.DefineName): Take an IAlias instead of an object.
7432 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
7434 (NamespaceEntry.UsingAlias): Take a Membername instead of an
7436 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
7438 (NamespaceEntry.Lookup): Likewise.
7440 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
7443 * decl.cs (DeclSpace): Implement IAlias.
7444 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
7446 * generic.cs (ConstructedType): Improved error checking.
7448 2004-04-02 Martin Baulig <martin@ximian.com>
7450 * convert.cs: Added type parameter conversions.
7453 (UnboxCast.Emit): Emit an `unbox.any' for type params.
7454 (ClassCast.Emit): If the source type is a type parameter, box it.
7455 If the target type is a type parameter, emit an `unbox.any'
7456 instead of a `classcast'.1
7458 2004-04-01 Martin Baulig <martin@ximian.com>
7460 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
7462 2004-04-01 Martin Baulig <martin@ximian.com>
7464 * generic.cs (ConstructedType.CheckConstraints): Use
7465 Convert.ImplicitStandardConversionExists(); user-defined implicit
7466 conversions are not allowed according to the spec.
7468 2004-03-30 Martin Baulig <martin@ximian.com>
7470 * expression.cs (New): Added support for type parameters.
7473 (TypeManager.activator_type): New public static field.
7474 (TypeManager.activator_create_instance): Likewise.
7476 2004-03-30 Martin Baulig <martin@ximian.com>
7478 * typemanager.cs (TypeManager.HasConstructorConstraint): New
7481 2004-03-30 Martin Baulig <martin@ximian.com>
7483 * generic.cs (ConstructedType.CheckConstraints): Actually follow
7484 the spec here: the argument type must be convertible to the
7487 2004-03-30 Martin Baulig <martin@ximian.com>
7490 (TypeParameter.Define, TypeParameter.DefineMethod): Call
7491 TypeManager.AddTypeParameter().
7492 (ConstructedType.CheckConstraints): Re-enable this and actually
7493 check whether we have a constructor constraint.
7496 (TypeManager.builder_to_type_param): New static field.
7497 (TypeManager.AddTypeParameter): New static method.
7498 (TypeManager.LookupTypeParameter): New public method.
7500 2004-03-30 Martin Baulig <martin@ximian.com>
7502 * generic.cs (TypeParameter.DefineType): Return a boolean and use
7503 the new API to actually define the constructor constraint.
7506 (TypeManager.new_constraint_attr_type): New static field.
7507 (TypeManager.InitCoreTypes): Initialize it.
7509 2004-03-30 Martin Baulig <martin@ximian.com>
7511 * generic.cs (Constraints): Completed error checking, use correct
7514 2004-03-29 Martin Baulig <martin@ximian.com>
7516 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
7518 * expression.cs (Invocation.InferTypeArguments): Added overloaded
7519 public version which takes a `ParameterData pd' instead of an
7522 2004-03-29 Martin Baulig <martin@ximian.com>
7524 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
7527 2004-03-29 Martin Baulig <martin@ximian.com>
7529 * expression.cs (Argument.ResolveMethodGroup): If we're a
7530 ConstructedType, call GetMemberAccess() on it.
7532 2004-03-29 Martin Baulig <martin@ximian.com>
7534 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
7535 (MethodCore.CheckGenericOverride): When overriding a generic
7536 method, check whether the constraints match.
7538 * support.cs (GenericConstraints): New public interface.
7539 (ParameterData.GenericConstraints): New public method.
7541 * parameter.cs (Parameter.Resolve): Check whether we're a generic
7542 method parameter and compute our constraints if appropriate.
7543 (Parameter.GenericConstraints): New public property.
7545 * generic.cs (Constraints): Implement GenericConstraints.
7547 2004-03-29 Martin Baulig <martin@ximian.com>
7549 * decl.cs (MemberCache.FindMemberToOverride): Use
7550 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
7552 2004-03-29 Martin Baulig <martin@ximian.com>
7554 * generic.cs (GenericMethod.Define): Resolve our type parameters.
7556 2004-03-29 Martin Baulig <martin@ximian.com>
7558 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
7559 not allowed on non-generic declarations").
7561 2004-03-29 Martin Baulig <martin@ximian.com>
7563 * expression.cs (Invocation.InferTypeArguments): Added overloaded
7564 public version of this method.
7566 * class.cs (MethodCore.IsDuplicateImplementation): Use
7567 Invocation.InferTypeArguments() to check this.
7569 2004-03-29 Martin Baulig <martin@ximian.com>
7571 * convert.cs: Use TypeManager.IsDelegateType() instead of
7572 comparing types correctly.
7574 2004-03-29 Martin Baulig <martin@ximian.com>
7576 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
7577 types directly to make it work for generic instances.
7579 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
7581 2004-03-29 Martin Baulig <martin@ximian.com>
7583 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
7586 2004-03-24 Martin Baulig <martin@ximian.com>
7588 * decl.cs (DeclSpace.FindType): Also use
7589 TypeManager.CheckGeneric() for types from the using clauses.
7591 2004-03-23 Martin Baulig <martin@ximian.com>
7593 * expression.cs (Invocation.OverloadResolve): Added `bool
7594 may_fail' argument and use it instead of the Location.IsNull() hack.
7596 2004-03-23 Martin Baulig <martin@ximian.com>
7598 * expression.cs (Invocation.InferType): Use correct type inference
7601 2004-03-23 Martin Baulig <martin@ximian.com>
7603 * ecore.cs (MethodGroupExpr.Name): Use
7604 TypeManager.CSharpSignature() instead of just the name.
7606 * expression.cs (Invocation.OverloadResolve): Provide better error
7608 (Invocation.DoResolve): OverloadResolve() never returns null
7609 without reporting an error, so removed the error -6 reporting here.
7611 2004-03-23 Martin Baulig <martin@ximian.com>
7613 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
7616 * cs-parser.jay (delegate_declaration): Support generic delegates.
7618 * delegate.cs: Support generic delegates.
7620 2004-03-22 Martin Baulig <martin@ximian.com>
7622 * expression.cs (Invocation.InferParamsTypeArguments): New static
7623 method; does type inference for params arguments.
7625 2004-03-21 Martin Baulig <martin@ximian.com>
7627 * typemanager.cs (TypeManager.IsGenericMethod): New public static
7628 method; checks whether a method is a generic method.
7630 * expression.cs (Invocation.InferTypeArguments): New static method;
7631 infer type arguments for generic method invocation.
7633 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
7634 property; we set this to true if we're resolving a generic method
7635 invocation and the user specified type arguments, ie. we're not
7636 doing type inference.
7638 2004-03-20 Martin Baulig <martin@ximian.com>
7640 * class.cs (MethodData.DeclaringType): New public property.
7641 (MethodData.Define): Set DeclaringType here.
7642 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
7643 instead of OperatorMethodBuilder.DeclaringType.
7645 2004-03-20 Martin Baulig <martin@ximian.com>
7647 * cs-tokenizer.cs (xtoken): Return a special
7648 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
7650 * cs-parser.jay (default_value_expression): Switch to the new
7653 2004-03-19 Martin Baulig <martin@ximian.com>
7655 * decl.cs (MemberName): New class. We use this to "construct"
7656 namespace_or_type_name's.
7658 * generics.cs (TypeArguments.GetDeclarations): New public method;
7659 returns the type arguments as a string[] and reports a CS0081 if
7660 one of them is not an identifier.
7662 * class.cs (MemberBase): The .ctor now takes the name as a
7663 MemberName instead of a string.
7664 (MemberBase.ExplicitInterfaceName): Changed type from string to
7666 (MemberBase.DoDefine): If we're an explicit implementation, the
7667 InterfaceType may be a generic instance.
7669 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
7670 (namespace_name): Call MemberName.GetName () to transform the
7671 MemberName into a string and ensure we don't have any type
7673 (type_name): Call MemberName.GetTypeExpression() to transfrom the
7674 MemberName into an expression.
7675 (method_header): Use namespace_or_type_name instead of member_name.
7677 2004-04-07 Miguel de Icaza <miguel@ximian.com>
7679 * rootcontext.cs: Add new types to the boot resolution.
7681 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
7682 MulticastDelegate is not allowed.
7684 * typemanager.cs: Add new types to lookup: System.TypedReference
7687 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
7688 check for TypedReference or ArgIterator, they are not allowed.
7690 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
7691 makes us properly catch 1510 in some conditions (see bug 56016 for
7694 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
7696 * CryptoConvert.cs: update from corlib version
7699 2004-04-05 Miguel de Icaza <miguel@ximian.com>
7701 * class.cs (Indexer.Define): Check indexername declaration
7703 2004-04-05 Marek Safar <marek.safar@seznam.cz>
7705 * attribute.cs (IsClsCompliant): Fixed problem with handling
7706 all three states (compliant, not-compliant, undetected).
7708 2004-03-30 Marek Safar <marek.safar@seznam.cz>
7710 * attribute.cs (Attribute): Location is now public.
7711 (Resolve): Store resolved arguments (pos_values) in attribute class.
7712 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
7713 (GetClsCompliantAttributeValue): New method that gets
7714 CLSCompliantAttribute value.
7715 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
7716 if exists else null.
7717 (AttributeTester): New class for CLS-Compliant verification routines.
7719 * class.cs (Emit): Add CLS-Compliant verification.
7720 (Method.GetSignatureForError): Implemented.
7721 (Constructor.GetSignatureForError): Implemented
7722 (Constructor.HasCompliantArgs): Returns if constructor has
7723 CLS-Compliant arguments.
7724 (Constructor.Emit): Override.
7725 (Construcor.IsIdentifierClsCompliant): New method; For constructors
7726 is needed to test only parameters.
7727 (FieldBase.GetSignatureForError): Implemented.
7728 (TypeContainer): New member for storing base interfaces.
7729 (TypeContainer.FindMembers): Search in base interfaces too.
7731 * codegen.cs (GetClsComplianceAttribute): New method that gets
7732 assembly or module CLSCompliantAttribute value.
7733 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7735 (ModuleClass.Emit): Add error 3012 test.
7737 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7739 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7740 state for all decl types.
7741 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7742 if CLS-Compliant tests are required.
7743 (IsClsCompliaceRequired): New method. Analyze whether code
7744 must be CLS-Compliant.
7745 (IsExposedFromAssembly): New method. Returns true when MemberCore
7746 is exposed from assembly.
7747 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7748 value or gets cached value.
7749 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7750 is explicitly marked with CLSCompliantAttribute.
7751 (IsIdentifierClsCompliant): New abstract method. This method is
7752 used to testing error 3005.
7753 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7754 for identifier and parameters CLS-Compliant testing.
7755 (VerifyClsCompliance): New method. The main virtual method for
7756 CLS-Compliant verifications.
7757 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7758 null. I don't know why is null (too many public members !).
7759 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7760 and get value of first CLSCompliantAttribute that found.
7762 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7763 (VerifyClsCompliance): Override and add extra tests.
7765 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7766 clscheck- disable CLS-Compliant verification event if assembly is has
7767 CLSCompliantAttribute(true).
7769 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7770 ApllyAttribute is now called in emit section as in the other cases.
7771 Possible future Emit integration.
7772 (IsIdentifierClsCompliant): New override.
7773 (VerifyClsCompliance): New override.
7774 (GetEnumeratorName): Returns full enum name.
7776 * parameter.cs (GetSignatureForError): Implemented.
7778 * report.cs (WarningData): New struct for Warning message information.
7779 (LocationOfPreviousError): New method.
7780 (Warning): New method. Reports warning based on the warning table.
7781 (Error_T): New method. Reports error based on the error table.
7783 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7784 verifications are done here.
7786 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7788 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7789 CLSCompliantAttribute.
7790 (all_imported_types): New member holds all imported types from other
7792 (LoadAllImportedTypes): New method fills static table with exported types
7793 from all referenced assemblies.
7794 (Modules): New property returns all assembly modules.
7796 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7798 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7799 throwing a parser error.
7801 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7802 which removes the hardcoded get_/set_ prefixes for properties, as
7803 IL allows for the properties to be named something else.
7807 * expression.cs: Do not override operand before we know if it is
7810 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7812 * typemanager.cs: support for pinned variables.
7814 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7816 * decl.cs, typemanager.cs: Avoid using an arraylist
7817 as a buffer if there is only one result set.
7819 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7821 * expression.cs: Make sure you cant call a static method
7822 with an instance expression, bug #56174.
7824 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7826 * class.cs (IsDuplicateImplementation): Improve error reporting to
7827 flag 663 (method only differs in parameter modifier).
7829 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7830 in preprocessor directives.
7832 * location.cs (LookupFile): Allow for the empty path.
7834 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7835 better approach for some of that patch, but its failing with the
7836 CharSet enumeration. For now try/catch will do.
7838 * typemanager.cs: Do not crash if a struct does not have fields.
7841 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7843 * expression.cs: cs0213, cant fix a fixed expression.
7846 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7848 * cs-parser.jay: detect invalid embeded statements gracefully.
7851 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7853 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7856 the invocation type may not be a subclass of the tye of the item/
7857 The type of the item must be a subclass of the invocation item.
7862 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7864 * attribute.cs: Added methods to get a string and a bool from an
7865 attribute. Required to information from AssemblyKeyFileAttribute,
7866 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7867 * codegen.cs: Modified AssemblyName creation to include support for
7868 strongnames. Catch additional exceptions to report them as CS1548.
7869 * compiler.csproj: Updated include CryptoConvert.cs.
7870 * compiler.csproj.user: Removed file - user specific configuration.
7871 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7872 Mono.Security assembly. The original class is maintained and tested in
7873 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7874 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7875 like CSC 8.0 (C# v2) supports.
7876 * Makefile: Added CryptoConvert.cs to mcs sources.
7877 * rootcontext.cs: Added new options for strongnames.
7879 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7881 * driver.cs: For --expect-error, report error code `2'
7882 if the program compiled with no errors, error code `1' if
7883 it compiled with an error other than the one expected.
7885 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7887 * compiler.csproj: Updated for Visual Studio .NET 2003.
7888 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7889 * compiler.sln: Updated for Visual Studio .NET 2003.
7891 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7893 * expression.cs: Fix bug #47234. We basically need to apply the
7894 rule that we prefer the conversion of null to a reference type
7895 when faced with a conversion to 'object' (csc behaviour).
7897 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7899 * statement.cs: Shorter form for foreach, eliminates
7900 a local variable. r=Martin.
7902 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7904 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7905 checks if we can use brtrue/brfalse to test for 0.
7906 * expression.cs: use the above in the test for using brtrue/brfalse.
7909 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7911 * expression.cs: Rewrite string concat stuff. Benefits:
7913 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7914 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7915 rather than a concat chain.
7917 * typemanager.cs: Add lookups for more concat overloads.
7919 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7921 * expression.cs: Emit shorter il code for array init.
7938 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7940 * statement.cs: Before, two switch blocks would be merged if the
7941 total size of the blocks (end_item - begin_item + 1) was less than
7942 two times the combined sizes of the blocks.
7944 Now, it will only merge if after the merge at least half of the
7949 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7951 * class.cs : csc build fix for GetMethods(). See bug #52503.
7953 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7955 * expression.cs: Make sure fp comparisons work with NaN.
7956 This fixes bug #54303. Mig approved this patch a long
7957 time ago, but we were not able to test b/c the runtime
7960 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7962 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7964 2004-03-19 Martin Baulig <martin@ximian.com>
7966 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
7967 two overloads may unify for some type parameter substitutions and
7968 report a CS0408 if appropriate.
7970 2004-03-19 Martin Baulig <martin@ximian.com>
7972 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7973 error here and not in our caller.
7975 2004-03-19 Martin Baulig <martin@ximian.com>
7977 * interface.cs: Completely killed this file.
7978 (Interface): We're now a TypeContainer and live in class.cs.
7980 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7981 argument; we're now also called for interfaces.
7982 (TypeContainer.DefineMembers): Allow this method being called
7984 (TypeContainer.GetMethods): New public method; formerly known as
7985 Interface.GetMethod(). This is used by PendingImplementation.
7986 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7987 it's now private and non-static.
7988 (Interface): Moved this here; it's now implemented similar to
7990 (Method, Property, Event, Indexer): Added `bool is_interface'
7991 argument to their .ctor's.
7992 (MemberBase.IsInterface): New public field.
7994 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7995 instances instead of InterfaceMethod, InterfaceProperty, etc.
7996 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7997 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
7999 2004-03-19 Martin Baulig <martin@ximian.com>
8001 * class.cs (MethodCore.IsDuplicateImplementation): New private
8002 method which does the CS0111 checking.
8003 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
8004 Use IsDuplicateImplementation().
8006 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
8008 * decl.cs (FindMemberToOverride): New method to find the correct
8009 method or property to override in the base class.
8011 - Make Method/Property use the above method to find the
8012 version in the base class.
8013 - Remove the InheritableMemberSignatureCompare as it is now
8016 This patch makes large code bases much faster to compile, as it is
8017 O(n) rather than O(n^2) to do this validation.
8019 Also, it fixes bug 52458 which is that nested classes are not
8020 taken into account when finding the base class member.
8022 Reviewed/Approved by Martin.
8024 2004-03-17 Martin Baulig <martin@ximian.com>
8026 * expression.cs (MemberAccess.DoResolve): Take the parent's number
8027 of type arguments into account; use the `real_num_type_args'
8028 approach like in DoResolveAsTypeStep().
8030 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
8033 2004-03-17 Marek Safar <marek.safar@seznam.cz>
8035 * interface.cs: In all interface classes removed redundant
8036 member initialization.
8038 2004-03-16 Martin Baulig <martin@ximian.com>
8040 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
8042 2004-03-15 Miguel de Icaza <miguel@ximian.com>
8044 * decl.cs (DefineTypeAndParents): New helper method to define a
8045 type's containers before the type itself is defined; This is a
8046 bug exposed by the recent changes to Windows.Forms when an
8047 implemented interface was defined inside a class that had not been
8050 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
8052 (Check): Loop correctly to report errors modifiers
8053 (UNSAFE was not in the loop, since it was the same as TOP).
8055 * interface.cs: Every interface member now takes a ModFlags,
8056 instead of a "is_new" bool, which we set on the base MemberCore.
8058 Every place where we called "UnsafeOk" in the interface, now we
8059 call the proper member (InterfaceMethod.UnsafeOK) instead to get
8060 the unsafe settings from the member declaration instead of the
8061 container interface.
8063 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
8065 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
8066 `set_indexer_name' to the pending bits (one per type).
8068 We fixed a bug today that was picking the wrong method to
8069 override, since for properties the existing InterfaceMethod code
8070 basically ignored the method name. Now we make sure that the
8071 method name is one of the valid indexer names.
8073 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
8075 * support.cs (SeekableStreamReader): Keep track of stream byte
8076 positions and don't mix them with character offsets to the buffer.
8078 Patch from Gustavo Giráldez
8080 2004-03-15 Marek Safar <marek.safar@seznam.cz>
8082 * interface.cs (InterfaceSetGetBase): Removed double member
8083 initialization, base class does it as well.
8085 2004-03-13 Martin Baulig <martin@ximian.com>
8087 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
8088 when compiling corlib.
8090 2004-03-13 Miguel de Icaza <miguel@ximian.com>
8092 * convert.cs (ExplicitConversion): We were reporting an error on
8093 certain conversions (object_type source to a value type, when the
8094 expression was `null') before we had a chance to pass it through
8095 the user defined conversions.
8097 * driver.cs: Replace / and \ in resource specifications to dots.
8100 * class.cs: Add check for duplicate operators. Fixes 52477
8102 2004-03-11 Miguel de Icaza <miguel@ximian.com>
8104 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
8105 that are in the middle of the statements, not only at the end.
8108 * class.cs (TypeContainer.AddField): No longer set the
8109 `HaveStaticConstructor' flag, now we call it
8110 `UserDefineStaticConstructor' to diferentiate the slightly
8111 semantic difference.
8113 The situation is that we were not adding BeforeFieldInit (from
8114 Modifiers.TypeAttr) to classes that could have it.
8115 BeforeFieldInit should be set to classes that have no static
8120 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
8122 And most importantly Zoltan's comment:
8124 http://bugzilla.ximian.com/show_bug.cgi?id=44229
8126 "I think beforefieldinit means 'it's ok to initialize the type sometime
8127 before its static fields are used', i.e. initialization does not need
8128 to be triggered by the first access to the type. Setting this flag
8129 helps the JIT to compile better code, since it can run the static
8130 constructor at JIT time, and does not need to generate code to call it
8131 (possibly lots of times) at runtime. Unfortunately, mcs does not set
8132 this flag for lots of classes like String.
8134 csc sets this flag if the type does not have an explicit static
8135 constructor. The reasoning seems to be that if there are only static
8136 initalizers for a type, and no static constructor, then the programmer
8137 does not care when this initialization happens, so beforefieldinit
8140 This bug prevents the AOT compiler from being usable, since it
8141 generates so many calls to mono_runtime_class_init that the AOT code
8142 is much slower than the JITted code. The JITted code is faster,
8143 because it does not generate these calls if the vtable is type is
8144 already initialized, which is true in the majority of cases. But the
8145 AOT compiler can't do this."
8147 2004-03-10 Miguel de Icaza <miguel@ximian.com>
8149 * class.cs (MethodData.Emit): Refactor the code so symbolic
8150 information is generated for destructors; For some reasons we
8151 were taking a code path that did not generate symbolic information
8154 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
8156 * class.cs: Create a Constructor.CheckBase method that
8157 takes care of all validation type code. The method
8158 contains some code that was moved from Define.
8160 It also includes new code that checks for duplicate ctors.
8161 This fixes bug #55148.
8163 2004-03-09 Joshua Tauberer <tauberer@for.net>
8165 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
8166 a { ... }-style array creation invokes EmitStaticInitializers
8167 which is not good for reference-type arrays. String, decimal
8168 and now null constants (NullCast) are not counted toward
8169 static initializers.
8171 2004-03-05 Martin Baulig <martin@ximian.com>
8173 * location.cs (SourceFile.HasLineDirective): New public field;
8174 specifies whether the file contains or is referenced by a "#line"
8176 (Location.DefineSymbolDocuments): Ignore source files which
8177 either contain or are referenced by a "#line" directive.
8179 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
8181 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
8182 direct access to our parent, so check the method inline there.
8184 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
8186 * expression.cs (Invocation.EmitCall): Miguel's last commit
8187 caused a regression. If you had:
8192 In Foo the implict this would be null.
8194 2004-02-27 Miguel de Icaza <miguel@ximian.com>
8196 * expression.cs (Invocation.EmitCall): If the method is not
8197 virtual, do not emit a CallVirt to it, use Call.
8199 * typemanager.cs (GetFullNameSignature): Improve the method to
8200 cope with ".ctor" and replace it with the type name.
8202 * class.cs (ConstructorInitializer.Resolve): Now the method takes
8203 as an argument the ConstructorBuilder where it is being defined,
8204 to catch the recursive constructor invocations.
8206 2004-03-16 Martin Baulig <martin@ximian.com>
8208 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
8209 ConstructedType, call ResolveType() on it to get the type rather
8210 than just using `expr.Type'.
8212 2004-03-16 Martin Baulig <martin@ximian.com>
8214 * generics.cs (ConstructedType.GetMemberAccess): Take the
8215 EmitContext instead on the TypeExpr and use
8216 ec.TypeContainer.CurrentType/ec.ContainerType.
8218 2004-03-16 Martin Baulig <martin@ximian.com>
8220 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
8221 parameters before aliases.
8223 2004-03-16 Martin Baulig <martin@ximian.com>
8225 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
8226 New oublic function; checks whether two generic instances may become
8227 equal under some instantiations (26.3.1).
8229 * class.cs (TypeContainer.Define): Call
8230 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
8233 2004-03-16 Martin Baulig <martin@ximian.com>
8235 * class.cs (TypeContainer.GetClassBases): Moved
8236 Error_TypeParameterAsBase() here and also check whether the base
8237 class is not an attribute.
8239 2004-03-16 Martin Baulig <martin@ximian.com>
8241 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
8243 2004-03-16 Martin Baulig <martin@ximian.com>
8245 * class.cs (Error_TypeParameterAsBase): Use correct error number
8248 2004-03-16 Martin Baulig <martin@ximian.com>
8250 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
8253 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
8256 2004-03-15 Martin Baulig <martin@ximian.com>
8258 * typemanager.cs (TypeManager.GetFullName): New public method.
8259 (TypeManager.MemberLookup): Added `int_num_type_arguments'
8260 argument; only return members with the correct number of type
8262 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
8263 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
8264 whether the number of type arguments matches.
8266 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
8267 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
8269 * expression.cs (MemberAccess): Added public `NumTypeArguments'
8270 field; it's set by the protected .ctor when we're actually a
8271 GenericMemberAccess.
8272 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
8273 arguments and pass it to MemberLookupFinal ().
8275 * ecore.cs (Expression.MemberLookup): Added `int
8276 num_type_arguments' argument; only return members with the correct
8277 number of type arguments.
8278 (Expression.MemberLookupFailed): Check whether the MemberLookup
8279 failed because we did not have the correct number of type
8280 arguments; report CS0305 in this case.
8282 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
8283 `e.ResolveAsTypeTerminal()' already did so.
8285 2004-03-15 Martin Baulig <martin@ximian.com>
8287 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
8288 we're a ConstructedType; in this case, the caller must report an
8289 error (for instance CS0131).
8291 * generic.cs (TypeArguments): Added Location argument to the .ctor.
8292 (TypeArguments.Resolve): Actually report errors here.
8294 2004-03-15 Miguel de Icaza <miguel@ximian.com>
8296 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
8297 `set_indexer_name' to the pending bits (one per type).
8299 We fixed a bug today that was picking the wrong method to
8300 override, since for properties the existing InterfaceMethod code
8301 basically ignored the method name. Now we make sure that the
8302 method name is one of the valid indexer names.
8304 2004-03-15 Martin Baulig <martin@ximian.com>
8306 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
8307 for generic instances.
8309 2004-03-13 Martin Baulig <martin@ximian.com>
8311 * class.cs (TypeContainer.DefineType): Call
8312 TypeManager.AddUserType() immediately after creating the
8313 TypeBuilder; pass all type parameters when creating the
8316 * decl.cs (DeclSpace.FindNestedType): New public method.
8317 (DeclSpace.FindType): Added `int num_type_args' argument; only
8318 return types with the correct number of type parameters.
8319 (DeclSpace.CountTypeParams): New public property.
8321 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
8322 the number of type parameters; defaults to zero.
8324 * generic.cs (TypeArguments.Count): New public property.
8325 (ConstructedType.DoResolveAsTypeStep): First call
8326 ds.FindNestedType() to find out whether we're nested in the
8327 current generic type; in this case, we inherit all type parameters
8328 from the current class.
8330 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
8331 num_type_args' argument.
8332 (RootContext.LookupType): Added overloaded version which takes the
8333 number of type arguments; only return types with the correct
8334 number of type arguments.
8336 * typemanager.cs (TypeManager.CheckGeneric): New public function;
8337 checks whether `Type t' has `int num_type_args'.
8339 2004-03-13 Martin Baulig <martin@ximian.com>
8341 * generic.cs (GenericMethod.DefineType): New method; calls
8342 DefineType() on all the type parameters.
8344 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
8345 (MethodData.Define): If we're a generic method, call
8346 GenericMethod.DefineType() to define the type parameters.
8348 2004-03-10 Martin Baulig <martin@ximian.com>
8350 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
8351 instead of IsAssignableFrom.
8353 2004-03-10 Martin Baulig <martin@ximian.com>
8355 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
8357 * support.cs (ParameterData.HasArrayParameter): New property.
8358 (ReflectionParameters.ctor): Take a MethodBase instead of a
8359 ParameterInfo[]. If we have any type parameters, get the generic
8360 method definition and ask it whether we have variable arguments.
8362 2004-02-26 Miguel de Icaza <miguel@ximian.com>
8364 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
8365 routines to check if a type is an enumerable/enumerator allow
8366 classes that implement the IEnumerable or IEnumerator interfaces.
8368 * class.cs (Property, Operator): Implement IIteratorContainer, and
8369 implement SetYields.
8371 (Property.Define): Do the block swapping for get_methods in the
8372 context of iterators. We need to check if Properties also
8373 include indexers or not.
8375 (Operator): Assign the Block before invoking the
8376 OperatorMethod.Define, so we can trigger the Iterator code
8379 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
8380 Property and Operator classes are not created when we parse the
8381 declarator but until we have the block completed, so we use a
8382 singleton SimpleIteratorContainer.Simple to flag whether the
8383 SetYields has been invoked.
8385 We propagate this setting then to the Property or the Operator to
8386 allow the `yield' to function.
8388 2004-02-25 Marek Safar <marek.safar@seznam.cz>
8390 * codegen.cs: Implemented attribute support for modules.
8391 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
8392 Assembly/Module functionality.
8394 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
8395 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
8396 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
8398 2004-02-16 Marek Safar <marek.safar@seznam.cz>
8400 * interface.cs (FindMembers): The operation is performed on all base
8401 interfaces and not only on the first. It is required for future CLS Compliance patch.
8403 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
8405 * statement.cs, codegen.cs:
8406 This patch deals with patterns such as:
8408 public class List : IEnumerable {
8410 public MyEnumerator GetEnumerator () {
8411 return new MyEnumerator(this);
8414 IEnumerator IEnumerable.GetEnumerator () {
8418 public struct MyEnumerator : IEnumerator {
8423 Before, there were a few things we did wrong:
8424 1) we would emit callvirt on a struct, which is illegal
8425 2) we emited ldarg when we needed to emit ldarga
8426 3) we would mistakenly call the interface methods on an enumerator
8427 type that derived from IEnumerator and was in another assembly. For example:
8429 public class MyEnumerator : IEnumerator
8431 Would have the interface methods called, even if there were public impls of the
8432 method. In a struct, this lead to invalid IL code.
8434 2004-02-11 Marek Safar <marek.safar@seznam.cz>
8436 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
8439 * delegate.cs (Define): Fixed crash when delegate type is undefined.
8441 2004-02-11 Miguel de Icaza <miguel@ximian.com>
8443 * cs-parser.jay: Fix small regression: we were not testing V2
8444 compiler features correctly.
8446 * interface.cs: If the emit context is null, then create one
8448 2004-02-09 Marek Safar <marek.safar@seznam.cz>
8450 * decl.cs (GetSignatureForError): New virtual method to get full name
8453 * attribute.cs (IAttributeSupport): New interface for attribute setting.
8454 Now it is possible to rewrite ApplyAttributes method to be less if/else.
8456 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
8457 Duplicated members and code in these classes has been removed.
8458 Better encapsulation in these classes.
8460 2004-02-07 Miguel de Icaza <miguel@ximian.com>
8462 * assign.cs (Assign.DoResolve): When dealing with compound
8463 assignments, there is a new rule in ECMA C# 2.4 (might have been
8464 there before, but it is documented here) that states that in:
8468 If b is of type int, and the `op' is a shift-operator, then the
8469 above is evaluated as:
8473 * expression.cs (Binary.ResolveOperator): Instead of testing for
8474 int/uint/long/ulong, try to implicitly convert to any of those
8475 types and use that in pointer arithmetic.
8477 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
8478 method to print information for from the type, not from the
8479 null-method we were given.
8481 2004-02-01 Duncan Mak <duncan@ximian.com>
8483 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
8484 parsing for cmd, fixes bug #53694.
8486 2004-02-04 Marek Safar <marek.safar@seznam.cz>
8488 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
8489 in the member name duplication tests. Property and operator name duplication
8490 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
8492 2004-02-03 Marek Safar <marek.safar@seznam.cz>
8494 * interface.cs (PopulateMethod): Fixed crash when interface method
8495 returns not existing type (error test cs0246-3.cs).
8497 2004-02-02 Ravi Pratap M <ravi@ximian.com>
8499 * cs-parser.jay (interface_accessors): Re-write actions to also
8500 store attributes attached to get and set methods. Fix spelling
8503 (inteface_property_declaration): Modify accordingly.
8505 (InterfaceAccessorInfo): New helper class to store information to pass
8506 around between rules that use interface_accessors.
8508 * interface.cs (Emit): Apply attributes on the get and set
8509 accessors of properties and indexers too.
8511 * attribute.cs (ApplyAttributes): Modify accordingly to use the
8512 right MethodBuilder when applying attributes to the get and set accessors.
8514 2004-01-31 Miguel de Icaza <miguel@ximian.com>
8516 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
8518 2004-01-26 Miguel de Icaza <miguel@ximian.com>
8520 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
8522 2004-01-25 Miguel de Icaza <miguel@ximian.com>
8524 * cs-parser.jay: Remove YIELD token, instead use the new grammar
8525 changes that treat `yield' specially when present before `break'
8528 * cs-tokenizer.cs: yield is no longer a keyword.
8530 2004-01-23 Marek Safar <marek.safar@seznam.cz>
8532 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
8533 setting for default constructors.
8534 For default constructors are almost every time set wrong Modifier. The
8535 generated IL code has been alright. But inside mcs this values was
8536 wrong and this was reason why several of my CLS Compliance tests
8539 2004-02-27 Martin Baulig <martin@ximian.com>
8541 * generics.cs (ConstructedType.ResolveType): Make the nested type
8542 stuff actually work.
8544 2004-02-25 Martin Baulig <martin@ximian.com>
8546 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
8547 property; returns the type parameters just from the current type,
8548 ie. with the ones from outer classes.
8549 (DeclSpace.LookupGeneric): First search in the current class, then
8551 (DeclSpace.initialize_type_params): When hiding a type parameter
8552 from an outer class, put it into the `type_param_list' anyways.
8554 * expression.cs (MemberAccess.expr): Made this field protected.
8556 * class.cs (TypeContainer.Define): The `CurrentType' just contains
8557 the type parameters from the current class.
8559 * generic.cs (ConstructedType.ResolveType): Support nested generic
8560 types by taking the type parameters which we inherit from outer
8561 classes into account.
8562 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
8563 support for nested generic types.
8565 2004-02-23 Martin Baulig <martin@ximian.com>
8567 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
8568 field and check whether we're nested inside a generic type.
8569 (DeclSpace.ResolveType): If we're resolving to a generic type
8570 definition, create a ConstructedType and return its resolved type.
8571 (DeclSpace.initialize_type_params): New private method;
8572 initializes the `type_param_list' field from the type parameters
8573 from this and all enclosing classes.
8574 (DeclSpace.TypeParameters): Call initialize_type_params() unless
8575 we're already initialized.
8577 2004-02-23 Martin Baulig <martin@ximian.com>
8579 * class.cs (Method.Define): Create the generic method before
8581 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
8582 the TypeContainer one); we use this for generic methods.
8584 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
8585 parent's TypeBuilder.
8587 2004-02-18 Martin Baulig <martin@ximian.com>
8589 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
8590 to check for equality.
8592 2004-02-05 Martin Baulig <martin@ximian.com>
8594 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
8595 `ec.TypeContainer.CurrentType', use it instead of
8596 `ec.ContainerType' to check whether we're in the type's ctor.
8598 2004-01-29 Martin Baulig <martin@ximian.com>
8600 * expression.cs (Invocation.DoResolve): If we're a
8601 `ConstructedType', then we're actually a generic method, so
8602 rewrite the expr as a GenericMemberAccess.
8604 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
8605 here; manually parse it into a string.
8607 2004-01-28 Martin Baulig <martin@ximian.com>
8609 * typemanager.cs (TypeManager.IsEqual): New static method.
8610 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
8611 check for equality instead of using `=='.
8613 2004-01-26 Martin Baulig <martin@ximian.com>
8615 * decl.cs (DeclSpace.CurrentType): New public field.
8617 * expression.cs (This.ResolveBase): If we have an
8618 `ec.TypeContainer.CurrentType', use it instead of
8621 * class.cs (TypeContainer.DefineType): If we're a generic type,
8622 create the `CurrentType' (unresolved).
8623 (TypeContainer.GenericType): New private field.
8624 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
8625 it and store it in `GenericType' before creating the MemberCache.
8626 (TypeContainer.GetMembers): If we have a `GenericType', call
8627 TypeManager.FindMembers() on it.
8629 * interface.cs (Interface.GenericType): New private field.
8630 (Interface.DefineType): If we're a generic type, create the
8631 `CurrentType' (unresolved).
8632 (Interface.DefineMembers): If we have a `CurrentType', resolve it
8633 and store it in `GenericType' before creating the MemberCache.
8634 (Interface.GetMembers): If we have a `GenericType', call
8635 TypeManager.FindMembers() on it.
8637 2004-01-22 Martin Baulig <martin@ximian.com>
8639 * cs-parser.jay (namespace_or_type_name): Return an Expression,
8640 not a QualifiedIdentifier. This is what `type_name_expression'
8641 was previously doing.
8642 (type_name_expression): Removed; the code is now in
8643 `namespace_or_type_name'.
8644 (qualified_identifier): Removed, use `namespace_or_type_name'
8646 (QualifiedIdentifier): Removed this class.
8648 2004-01-22 Martin Baulig <martin@ximian.com>
8650 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
8651 not a string as alias name.
8653 2004-01-21 Miguel de Icaza <miguel@ximian.com>
8655 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
8656 #52730 bug, and instead compute correctly the need to use a
8657 temporary variable when requesting an address based on the
8658 static/instace modified of the field and the constructor.
8660 2004-01-21 Martin Baulig <martin@ximian.com>
8662 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
8663 class and namespace before looking up aliases. Fixes #52517.
8665 2004-01-21 Martin Baulig <martin@ximian.com>
8667 * flowanalysis.cs (UsageVector.Merge): Allow variables being
8668 assinged in a 'try'; fixes exception4.cs.
8670 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8671 * class.cs : Implemented parameter-less constructor for TypeContainer
8673 * decl.cs: Attributes are now stored here. New property OptAttributes
8675 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
8677 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
8679 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8681 * typemanager.cs (CSharpSignature): Now reports also inner class name.
8682 (CSharpSignature): New method for indexer and property signature.
8684 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8686 * pending.cs (IsVirtualFilter): Faster implementation.
8688 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8690 * typemanager.cs: Avoid inclusion of same assembly more than once.
8692 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8694 * cs-parser.jay: Fixed problem where the last assembly attribute
8695 has been applied also to following declaration (class, struct, etc.)
8697 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8699 * class.cs: Added error CS0538, CS0539 reporting.
8700 Fixed crash on Microsoft runtime when field type is void.
8702 * cs-parser.jay: Added error CS0537 reporting.
8704 * pending.cs: Added error CS0535 reporting.
8705 Improved error report for errors CS0536, CS0534.
8707 2004-01-20 Miguel de Icaza <miguel@ximian.com>
8709 Merge a few bits from the Anonymous Method MCS tree.
8711 * statement.cs (ToplevelBlock): New class for toplevel methods,
8712 will hold anonymous methods, lifted variables.
8714 * cs-parser.jay: Create toplevel blocks for delegates and for
8715 regular blocks of code.
8717 2004-01-20 Martin Baulig <martin@ximian.com>
8719 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
8720 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
8721 and `NeedExplicitReturn'; added `IsLastStatement'.
8722 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
8723 have a `ReturnLabel' or we're not unreachable.
8725 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
8726 child's reachability; don't just override ours with it. Fixes
8727 #58058 (lluis's example).
8728 (FlowBranching): Added public InTryOrCatch(), InCatch(),
8729 InFinally(), InLoop(), InSwitch() and
8730 BreakCrossesTryCatchBoundary() methods.
8732 * statement.cs (Return): Do all error checking in Resolve().
8733 Unless we are the last statement in a top-level block, always
8734 create a return label and jump to it.
8735 (Break, Continue): Do all error checking in Resolve(); also make
8736 sure we aren't leaving a `finally'.
8737 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
8738 statement in a top-level block.
8739 (Block.Flags): Added `IsDestructor'.
8740 (Block.IsDestructor): New public property.
8742 2004-01-20 Martin Baulig <martin@ximian.com>
8744 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
8746 2004-01-20 Martin Baulig <martin@ximian.com>
8748 * statement.cs (Statement.ResolveUnreachable): New public method.
8749 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
8750 (Block.Resolve): Resolve unreachable statements.
8752 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8754 * expression.cs: We need to fix the case where we do
8755 not have a temp variable here.
8757 * assign.cs: Only expression compound assignments need
8758 temporary variables.
8760 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8762 * flowanalysis.cs: Reduce memory allocation in a few ways:
8763 - A block with no variables should not allocate a bit
8765 - A method with no out parameters does not need any tracking
8766 for assignment of the parameters, so we need not allocate
8769 public readonly Type[] VariableTypes;
8770 public readonly string[] VariableNames;
8771 Are redundant. The data is already stored in the variable
8772 map, so we need not allocate another array for it.
8773 - We need to add alot of checks for if (params | locals) == null
8774 due to the first two changes.
8776 2004-01-18 Miguel de Icaza <miguel@ximian.com>
8778 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
8779 implement IMemoryLocation, we store a copy on a local variable and
8780 take the address of it. Patch from Benjamin Jemlich
8782 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
8783 to use a special "type_name_expression" rule which reduces the
8784 number of "QualifiedIdentifier" classes created, and instead
8785 directly creates MemberAccess expressions.
8787 2004-01-17 Miguel de Icaza <miguel@ximian.com>
8789 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
8790 that fixes #52853. Null literal assignment to ValueType
8792 * class.cs (MethodData.Emit): Instead of checking the name of the
8793 method to determine if its a destructor, create a new derived
8794 class from Method called Destructor, and test for that.
8796 * cs-parser.jay: Create a Destructor object instead of a Method.
8798 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
8802 2004-01-16 Miguel de Icaza <miguel@ximian.com>
8804 * expression.cs (Binary.ResolveOperator): Perform an implicit
8805 conversion from MethodGroups to their delegate types on the
8808 * delegate.cs: Introduce a new class DelegateCreation that is the
8809 base class for `NewDelegate' and `ImplicitDelegateCreation',
8810 factor some code in here.
8812 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
8813 conversion from MethodGroups to compatible delegate types.
8815 * ecore.cs (Expression.Resolve): Do not flag error 654
8816 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
8817 we allow conversions from MethodGroups to delegate types now.
8819 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
8820 assignments in v2 either.
8822 2004-01-10 Miguel de Icaza <miguel@ximian.com>
8824 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
8825 static read-only fields in ctors.
8827 Applied patch from Benjamin Jemlich
8829 * expression.cs (UnaryMutator): Avoid leaking local variables.
8831 2004-01-09 Miguel de Icaza <miguel@ximian.com>
8833 * cs-tokenizer.cs (IsCastToken): Allow the various native types
8834 here to return true, as they can be used like this:
8838 Fixed 49836 and all the other dups
8840 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
8842 * driver.cs: Implement /win32res and /win32icon.
8844 2004-01-08 Miguel de Icaza <miguel@ximian.com>
8846 * cs-parser.jay: Add a rule to improve error handling for the
8847 common mistake of placing modifiers after the type.
8849 2004-01-07 Miguel de Icaza <miguel@ximian.com>
8851 * cs-parser.jay (interface_event_declaration): Catch
8852 initialization of events on interfaces, and report cs0068
8854 * cs-parser.jay (interface_event_declaration): Catch
8855 initialization of events.
8857 * ecore.cs: Better report missing constructors.
8859 * expression.cs (Binary.ResolveOperator): My previous bug fix had
8860 the error reporting done in the wrong place. Fix.
8862 * expression.cs (Binary.ResolveOperator): Catch the
8863 operator + (E x, E y) error earlier, and later allow for implicit
8864 conversions in operator +/- (E e, U x) from U to the underlying
8867 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
8868 52596, if the container class is abstract, the default constructor
8869 is protected otherwise its public (before, we were always public).
8871 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
8874 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
8875 Jemlich that fixes bug #52597, MCS was generating invalid code for
8876 idisposable structs. Thanks to Ben for following up with this
8879 2004-01-06 Miguel de Icaza <miguel@ximian.com>
8881 * driver.cs: Allow assemblies without code to be generated, fixes
8884 2004-01-07 Nick Drochak <ndrochak@gol.com>
8886 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
8888 2004-01-05 Miguel de Icaza <miguel@ximian.com>
8890 * cs-parser.jay: Add rules to improve error reporting if fields or
8891 methods are declared at the namespace level (error 116)
8893 * Add rules to catch event add/remove
8895 2004-01-04 David Sheldon <dave-mono@earth.li>
8897 * expression.cs: Added matching ")" to error message for
8900 2004-01-03 Todd Berman <tberman@gentoo.org>
8902 * ecore.cs, attribute.cs:
8903 Applying fix from #52429.
8905 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8907 * ecore.cs, expression.cs, statement.cs:
8908 Total rewrite of how we handle branching. We
8909 now handle complex boolean expressions with fewer
8910 jumps. As well if (x == 0) no longer emits a ceq.
8912 if (x is Foo) is much faster now, because we generate
8915 Overall, we get a pretty big improvement on our benchmark
8916 tests. The code we generate is smaller and more readable.
8918 I did a full two-stage bootstrap. The patch was reviewed
8919 by Martin and Miguel.
8921 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8923 * cs-parser.jay: Make primary_expression not take a QI.
8924 we dont need this because the member_access rule covers
8925 us here. So we replace the rule with just IDENTIFIER.
8927 This has two good effects. First, we remove a s/r conflict.
8928 Second, we allocate many fewer QualifiedIdentifier objects.
8930 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8932 * attribute.cs: Handle MarshalAs attributes as pseudo, and
8933 set the correct information via SRE. This prevents
8934 hanging on the MS runtime. Fixes #29374.
8936 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8938 * convert.cs: correctly handle conversions to value types
8939 from Enum and ValueType as unboxing conversions.
8941 Fixes bug #52569. Patch by Benjamin Jemlich.
8943 2004-01-02 Ravi Pratap <ravi@ximian.com>
8945 * expression.cs (BetterConversion): Prefer int -> uint
8946 over int -> ulong (csc's behaviour). This fixed bug #52046.
8948 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8950 * decl.cs (MemberCache.FindMembers): now returns a
8953 * typemanager.cs: In general, go with with ^^.
8954 (CopyNewMethods): take an IList.
8955 (RealMemberLookup): Only allocate an arraylist
8956 if we copy from two sets of methods.
8958 This change basically does two things:
8959 1) Fewer array lists allocated due to CopyNewMethods.
8960 2) the explicit cast in MemberList costed ALOT.
8962 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8964 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8965 a hashtable to avoid needless string allocations when an identifier is
8966 used more than once (the common case).
8968 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8970 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8971 is broken, it will not return anything. So, we
8972 have to use the information we have in mcs to
8975 * typemanager.cs: Add a cache for GetInterfaces,
8976 since this will now be used more often (due to ^^)
8978 (GetExplicitInterfaces) New method that gets the
8979 declared, not effective, interfaces on a type
8980 builder (eg, if you have interface IFoo, interface
8981 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8984 This patch makes MCS able to bootstrap itself on
8987 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8989 * expression.cs: Remove the Nop's that Miguel put
8992 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8994 * report.cs, codegen.cs: Give the real stack trace to
8995 the error when an exception is thrown.
8997 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8999 * decl.cs: only allocate hashtables for ifaces if
9002 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
9004 * expression.cs: fix the error from cs0121-2.cs
9005 (a parent interface has two child interfaces that
9006 have a function with the same name and 0 params
9007 and the function is called through the parent).
9009 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
9011 * class.cs, rootcontext.cs, typmanager.cs: do not
9014 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
9016 * codegen.cs: remove stack for the ec flow branching.
9017 It is already a linked list, so no need.
9019 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
9021 * Makefile: Allow custom profiler here.
9023 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
9025 * typemanager.cs (LookupType):
9026 - Use a static char [], because split takes
9027 a param array for args, so it was allocating
9029 - Do not store true in a hashtable, it boxes.
9031 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
9033 * flowanalysis.cs: bytify common enums.
9035 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
9037 * modifiers.cs: Add a new set of flags for the
9038 flags allowed on explicit interface impls.
9039 * cs-parser.jay: catch the use of modifiers in
9040 interfaces correctly.
9041 * class.cs: catch private void IFoo.Blah ().
9043 All related to bug #50572.
9045 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
9047 * decl.cs: Rewrite the consistant accessability checking.
9048 Accessability is not linear, it must be implemented in
9049 a tableish way. Fixes #49704.
9051 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
9053 * expression.cs: Handle negation in a checked context.
9054 We must use subtraction from zero. Fixes #38674.
9056 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
9058 * class.cs: Ignore static void main in DLLs.
9059 * rootcontext.cs: Handle the target type here,
9060 since we are have to access it from class.cs
9061 * driver.cs: account for the above.
9063 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
9065 * report.cs: Give line numbers and files if available.
9067 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
9069 * driver.cs: Implement /addmodule.
9071 * typemanager.cs: Change 'modules' field so it now contains Modules not
9074 2003-12-20 Martin Baulig <martin@ximian.com>
9076 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
9077 (FieldBase.IsAssigned): Removed this field.
9078 (FieldBase.SetAssigned): New public method.
9079 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
9081 2003-12-20 Martin Baulig <martin@ximian.com>
9083 * expression.cs (LocalVariableReference.DoResolve): Don't set
9084 `vi.Used' if we're called from DoResolveLValue().
9086 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
9087 returns the usage vector it just merged into the current one -
9088 pass this one to UsageWarning().
9089 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
9090 of the `EmitContext', don't call this recursively on our children.
9092 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
9094 * driver.cs: Implement /target:module.
9096 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
9098 * support.cs (CharArrayHashtable): New helper class.
9100 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
9101 char arrays, not strings, so we can avoid creating a string in
9102 consume_identifier if the identifier is a keyword.
9104 2003-12-16 Martin Baulig <martin@ximian.com>
9106 * statement.cs (LocalInfo.Assigned): Removed this property.
9107 (LocalInfo.Flags): Removed `Assigned'.
9108 (LocalInfo.IsAssigned): New public method; takes the EmitContext
9109 and uses flow analysis.
9110 (Block.UsageWarning): Made this method private.
9111 (Block.Resolve): Call UsageWarning() if appropriate.
9113 * expression.cs (LocalVariableReference.DoResolve): Always set
9114 LocalInfo.Used here.
9116 2003-12-13 Martin Baulig <martin@ximian.com>
9118 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
9119 any value here; we're now using flow analysis to figure out
9120 whether a statement/block returns a value.
9122 2003-12-13 Martin Baulig <martin@ximian.com>
9124 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
9126 (FlowBranching.MergeFinally): Don't call
9127 `branching.CheckOutParameters()' here, this is called in
9129 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
9130 when adding the `finally' vector.
9132 2003-12-13 Martin Baulig <martin@ximian.com>
9135 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
9136 actually work and also fix #48962.
9138 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
9140 * decl.cs: Do not check System.Object for nested types,
9141 since we know it does not have any. Big bang for buck:
9146 corlib: 17.99 seconds
9150 corlib: 17.39 seconds
9152 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
9154 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
9155 time we are returning 0 members, so we save alot here.
9157 2003-12-11 Martin Baulig <martin@ximian.com>
9159 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
9160 `MergeChild()', also just take the `FlowBranching' as argument;
9161 call Merge() on it and return the result.
9162 (FlowBranching.Merge): We don't need to do anything if we just
9165 2003-12-11 Martin Baulig <martin@ximian.com>
9167 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
9168 them in an `ArrayList' to reduce memory usage. Thanks to Ben
9169 Maurer for this idea.
9171 2003-12-11 Martin Baulig <martin@ximian.com>
9173 * flowanalysis.cs (MergeResult): This class is now gone; we now
9174 use the `UsageVector' for this. The reason for this is that if a
9175 branching just has one sibling, we don't need to "merge" them at
9176 all - that's the next step to do.
9177 (FlowBranching.Merge): We now return a `UsageVector' instead of a
9180 2003-12-11 Martin Baulig <martin@ximian.com>
9182 Reworked flow analyis and made it more precise and bug-free. The
9183 most important change is that we're now using a special `Reachability'
9184 class instead of having "magic" meanings of `FlowReturns'. I'll
9185 do some more cleanups and optimizations and also add some more
9186 documentation this week.
9188 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
9189 largely reworked this class.
9190 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
9191 the new `Reachability' class instead of having "magic" values here.
9192 (FlowBranching): We're now using an instance of `Reachability'
9193 instead of having separate `Returns', `Breaks' etc. fields.
9195 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
9196 based on flow analysis; ignore the return value of block.Emit ().
9198 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
9200 * driver.cs typemanager.cs: Find the mono extensions to corlib even
9201 if they are private.
9203 2003-12-09 Martin Baulig <martin@ximian.com>
9205 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
9206 call them directly on the UsageVector.
9208 2003-12-09 Martin Baulig <martin@ximian.com>
9210 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
9211 Changed return type from `FlowReturns' to `Reachability'.
9213 2003-12-09 Martin Baulig <martin@ximian.com>
9215 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
9216 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
9217 `Reachable' fields with a single `Reachability' one.
9219 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9221 * class.cs (FindMembers): Remove foreach's.
9234 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9239 This patch does a few things:
9240 1. EmptyStatement is now a singleton, so it is never reallocated.
9241 2. All blah is EmptyStatement constructs have been changed to
9242 blah == EmptyStatement.Value, which is much faster and valid
9243 now that EmptyStatement is a singleton.
9244 3. When resolving a block, rather than allocating a new array for
9245 the non-empty statements, empty statements are replaced with
9246 EmptyStatement.Value
9247 4. Some recursive functions have been made non-recursive.
9248 Mainly the performance impact is from (3), however (1) and (2) are needed for
9249 this to work. (4) does not make a big difference in normal situations, however
9250 it makes the profile look saner.
9255 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
9256 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
9257 Total memory allocated: 56397 KB
9260 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
9261 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
9262 Total memory allocated: 55666 KB
9264 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9266 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
9267 than the hashtable in a hashtable version
9269 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
9270 we always end up concating a string. This results in a huge perf
9271 loss, because many strings have to be tracked by the GC. In this
9272 patch, we first use a hashtable that works with two keys, so that
9273 the strings do not need to be concat'ed.
9284 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9286 * Makefile: Add a new target `do-time' that does a quick and simple
9287 profile, leaving easy to parse output.
9289 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
9291 * codegen.cs (Init): Create the dynamic assembly with
9292 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
9294 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
9296 * support.cs: Make the PtrHashtable use only one
9297 instance of its comparer.
9299 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
9301 * typemanager.cs: Fix lookup of GetNamespaces.
9303 2003-11-29 Miguel de Icaza <miguel@ximian.com>
9305 * expression.cs: Removed redundant line.
9307 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
9308 ArrayLists, use for loops with bounds.
9310 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
9313 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
9314 arraylists, use for loop with bounds.
9316 The above three changes give us a 0.071 second performance
9317 improvement out of 3.294 seconds down to 3.223. On my machine
9318 the above changes reduced the memory usage by 1,387 KB during
9321 * cs-parser.jay (QualifiedIdentifier): New class used to represent
9322 QualifiedIdentifiers. Before we created a new string through
9323 concatenation, and mostly later on, the result would be
9324 manipulated by DecomposeQI through string manipulation.
9326 This reduced the compiler memory usage for bootstrapping from
9327 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
9328 compile times in 0.05 seconds.
9330 2003-11-28 Dick Porter <dick@ximian.com>
9332 * support.cs: Do string compares with the Invariant culture.
9340 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
9341 the comparison is done with the Invariant culture.
9343 2003-11-27 Miguel de Icaza <miguel@ximian.com>
9345 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
9346 GetEnumerator method.
9348 (ProbeCollectionType): Iterate starting at the most specific type
9349 upwards looking for a GetEnumerator
9351 * expression.cs: Shift count can be up to 31 for int/uint and 63
9354 2003-11-26 Miguel de Icaza <miguel@ximian.com>
9356 * statement.cs (Block.LookupLabel): Also look for the label on the
9357 children blocks. Use a hash table to keep track of visited
9360 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
9361 we actually did transform the other operand, otherwise fall back
9362 to the common codepath that casts to long.
9364 * cs-tokenizer.cs: Use the same code pattern as the int case.
9365 Maybe I should do the parsing myself, and avoid depending on the
9366 Parse routines to get this done.
9368 2003-11-25 Miguel de Icaza <miguel@ximian.com>
9370 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9371 which fixes bug 51347. This time test it.
9373 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
9374 attributes for example can not tell the difference between these.
9375 The difference was only a syntax feature of the language.
9377 * attribute.cs: Apply attributes to delegates.
9379 * delegate.cs: Call the apply attributes method.
9381 2003-11-24 Miguel de Icaza <miguel@ximian.com>
9383 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
9384 comparing 0 vs Byte.MinValue, not the value
9386 (ImplicitConversionRequired): When reporting a conversion error,
9387 use error 31 to print out the constant error instead of the
9390 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9391 which fixes bug 51347.
9393 2003-11-22 Miguel de Icaza <miguel@ximian.com>
9395 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
9396 which fixes the -warnaserror command line option.
9398 2003-11-21 Miguel de Icaza <miguel@ximian.com>
9400 * cfold.cs (DoNumericPromotions): During constant folding of
9401 additions on UIntConstant, special case intconstants with
9402 IntConstants like we do on the expression binary operator.
9404 2003-11-12 Miguel de Icaza <miguel@ximian.com>
9406 * convert.cs (ImplicitReferenceConversion): We were missing a case
9407 (System.Enum are not value types or class types, so we need to
9408 classify them separatedly).
9410 * driver.cs: We do not support error 2007.
9412 2003-11-12 Jackson Harper <jackson@ximian.com>
9414 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
9415 system directory. Also use the full file name so users can
9416 libraries names mscorlib-o-tron.dll in a non system dir.
9418 2004-01-04 David Sheldon <dave-mono@earth.li>
9420 * expression.cs: Added matching ")" to error message for CS0077.
9422 2003-12-19 Martin Baulig <martin@ximian.com>
9424 * typemanager.cs (TypeManager.IsEqualGenericType): New public
9425 static method; see documentation in the method.
9426 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
9428 * convert.cs (Convert.ImplicitReferenceConversion,
9429 Convert.ImplicitReferenceConversionExists): Add support for
9430 generic type declarations; see gen-36.cs.
9432 2003-12-19 Martin Baulig <martin@ximian.com>
9434 * pending.cs (Pending.InterfaceMethod): Use
9435 `Type.IsAssignableFrom()' instead of `=='.
9437 2003-12-18 Martin Baulig <martin@ximian.com>
9439 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
9442 * convert.cs (Convert.ImplicitStandardConversionExists): Use
9443 `expr_type.Equals (target_type)' instead of `=='.
9445 2003-12-08 Martin Baulig <martin@ximian.com>
9447 * generics.cs (Constraints.Types): Removed.
9448 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
9450 (Constraints.ResolveTypes): New public method; resolves the
9451 TypeExpr's to Type's.
9452 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
9453 longer takes the constraints.
9454 (TypeParameter.DefineMethod): Likewise.
9455 (TypeParameter.DefineType): New public method. Calls
9456 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
9459 2003-12-08 Martin Baulig <martin@ximian.com>
9461 * convert.cs (Convert.ImplicitConversionStandard): Use
9462 `expr_type.Equals (target_type)' instead of `=='.
9464 2003-12-08 Martin Baulig <martin@ximian.com>
9466 * typemanager.cs (TypeManager.GetReferenceType): Call
9467 `Type.MakeByRefType ()'.
9469 2003-12-08 Martin Baulig <martin@ximian.com>
9471 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
9472 just has some special meaning in some situations. For instance,
9473 it is allowed to use `where' as the name of a variable etc.
9475 2003-12-04 Martin Baulig <martin@ximian.com>
9477 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
9478 `Type.MakeArrayType()' for array types.
9480 2003-11-18 Miguel de Icaza <miguel@ximian.com>
9482 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
9485 (SizeOf.DoResolve): assign the `type_queried' field. This gets
9488 2003-11-16 Martin Baulig <martin@ximian.com>
9490 * codegen.cs (EmitContext.IsGeneric): Removed.
9492 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
9493 ResolveGeneric() on the DeclSpace.
9495 2003-11-16 Martin Baulig <martin@ximian.com>
9497 * generic.cs (TypeArguments.Resolve):
9498 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
9499 `ResolveType()' on it to get the Type.
9501 2003-11-15 Martin Baulig <martin@ximian.com>
9503 * generic.cs (ConstructedType.GetInterfaces): Override this.
9505 2003-11-14 Martin Baulig <martin@ximian.com>
9507 * interface.cs (Interface.DefineType): Define all type parameters
9508 before adding the interfaces we inherit.
9510 2003-11-11 Martin Baulig <martin@ximian.com>
9512 * generic.cs (ConstructedType.ResolveType): Always call
9513 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
9515 2003-11-10 Martin Baulig <martin@ximian.com>
9517 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
9518 (TypeManager.InitCoreTypes): Initialize them here, but instead of
9519 calling `ResolveType()' on them, directly assign their `Type'.
9521 2003-11-08 Martin Baulig <martin@ximian.com>
9523 * generic.cs (ConstructedType): Override `IsClass' etc.
9525 2003-11-08 Martin Baulig <martin@ximian.com>
9527 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
9528 return value and the `out parent' parameter.
9529 (TypeContainer.DefineType): Moved the CS0644 check into
9530 GetClassBases(). Don't pass the interface types to the
9531 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
9532 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
9534 * ecore.cs (TypeExpr.IsAttribute): New property.
9535 (TypeExpr.GetInterfaces): New method.
9537 * interface.cs (Interface.GetInterfaceTypeByName): Return a
9538 TypeExpr instead of a Type.
9539 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
9540 (Interface.DefineType): Don't pass the interface types to the
9541 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
9542 them later and then call `TypeBulider.AddInterfaceImplementation()'.
9544 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
9545 instead of a `Type[]'.
9546 (TypeManager.RegisterBuilder): Likewise.
9547 (TypeManager.AddUserInterface): Likewise.
9548 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
9549 `Type[]' and also return a `TypeExpr[]'.
9550 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
9552 2003-11-08 Martin Baulig <martin@ximian.com>
9554 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
9557 2003-11-08 Martin Baulig <martin@ximian.com>
9559 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
9560 TypeManager.ResolveExpressionTypes().
9562 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
9563 instead of an Expression.
9564 (TypeExpr): This is now an abstract base class for `TypeExpression'.
9565 (TypeExpression): New public class; formerly known as `TypeExpr'.
9567 * expression.cs (ComposedCast): Derive from TypeExpr.
9569 * typemanager.cs (TypeManager.system_*_expr): These are now
9570 TypExpr's instead of Expression's.
9571 (TypeManager.ResolveExpressionTypes): New public static function;
9572 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
9575 2003-11-06 Miguel de Icaza <miguel@ximian.com>
9577 * expression.cs (New.DoResolve): Do not dereference value that
9578 might be a null return.
9580 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
9581 sure that the constant value has the right type. Fixes an
9582 unreported bug, similar to 50425.
9584 * const.cs (Const.LookupConstantValue): Call
9585 ImplicitStandardConversionExists before doing a conversion to
9586 avoid havng the TypeManager.ChangeType do conversions.
9588 Reduced the number of casts used
9590 (Const.ChangeType): New routine to enable reuse of the constant
9591 type changing code from statement.
9593 * typemanager.cs (ChangeType): Move common initialization to
9594 static global variables.
9598 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
9599 every value type to go through, even if it was void. Fix that.
9601 * cs-tokenizer.cs: Use is_identifier_start_character on the start
9602 character of the define, and the is_identifier_part_character for
9603 the rest of the string.
9605 2003-11-05 Miguel de Icaza <miguel@ximian.com>
9607 * expression.cs (UnaryMutator.EmitCode): When I updated
9608 LocalVariableReference.DoResolve, I overdid it, and dropped an
9609 optimization done on local variable references.
9611 2003-11-04 Miguel de Icaza <miguel@ximian.com>
9613 * ecore.cs: Convert the return from Ldlen into an int.
9615 2003-10-20 Miguel de Icaza <miguel@ximian.com>
9617 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
9618 the accessibility, this is a special case for toplevel non-public
9619 classes (internal for instance).
9621 2003-10-20 Nick Drochak <ndrochak@gol.com>
9623 * ecore.cs: Fix typo and build. Needed another right paren.
9625 2003-10-19 Miguel de Icaza <miguel@ximian.com>
9627 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
9628 `internal' case regular and protected, but not allowing protected
9629 to be evaluated later. Bug 49840
9631 2003-10-15 Miguel de Icaza <miguel@ximian.com>
9633 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
9634 to kb.Nlast, and not the kb.nFirst to isolate the switch
9637 Extract the underlying type, so enumerations of long/ulong are
9638 treated like long/ulong.
9640 2003-10-14 Miguel de Icaza <miguel@ximian.com>
9642 * expression.cs (New): Overload the meaning of RequestedType to
9643 track the possible creation of the NewDelegate type, since
9644 DoResolve is invoked more than once for new constructors on field
9647 See bugs: #48800 and #37014
9649 * cs-parser.jay (declare_local_constants): Take an arraylist
9650 instead of a single constant.
9652 (local_constant_declaration): It should take a
9653 constant_declarators, not a constant_declarator. Fixes 49487
9655 * convert.cs: Fix error report.
9657 2003-10-13 Jackson Harper <jackson@ximian.com>
9659 * typemanager.cs (TypeToCoreType): Add float and double this fixes
9662 2003-11-03 Martin Baulig <martin@ximian.com>
9664 * expression.cs (ArrayAccess.GetStoreOpcode): Added
9665 `out bool has_type_arg'; if set, we need to pass the type to
9667 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
9668 Stelem_Any/Ldelem_Any for generic parameters.
9670 2003-11-02 Martin Baulig <martin@ximian.com>
9672 * expression.cs (Invocation.EmitCall): Use
9673 `TypeManager.IsValueType()' to check whether it's a value type.
9674 Don't set `struct_call' when calling a method on a type parameter.
9676 2003-11-02 Martin Baulig <martin@ximian.com>
9678 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
9679 and removed the TypeBuilder argument.
9681 * typemanager.cs (TypeManager.IsValueType): Return
9682 `t.IsGenericParameter || t.IsValueType'.
9684 2003-10-25 Martin Baulig <martin@ximian.com>
9686 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
9687 call ConstructedType.Resolve() on it.
9689 * generic.cs (ConstructedType.Resolve): Set `type' on success.
9691 2003-10-25 Martin Baulig <martin@ximian.com>
9693 * class.cs (TypeContainer.GetClassBases): Changed
9694 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
9695 CS8214 reporting here.
9696 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
9697 instead of a `Type' for our parent. In case of a recursive
9698 declaration (see tests/gen-23.cs for an example), our parent is a
9699 ConstructedType and it doesn't have its type set. So, first
9700 create our own TypeBuilder, then call constructed.Resolve() to get
9701 the parent's type and finally TypeBuilder.SetParent() it.
9703 * ecore.cs (TypeExpr.Name): New public virtual property.
9706 (ConstructedType): We're now a TypeExpr and not just an Expression.
9707 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
9708 arguments here; this is done later.
9709 (ConstructedType.Resolve): New public method to resolve the type
9710 arguments and bind them.
9712 2003-10-21 Martin Baulig <martin@ximian.com>
9714 * convert.cs: Use `TypeManager.IsValueType' instead of
9715 'type.IsValueType' everywhere.
9717 * typemanager.cs (TypeManager.IsValueType): Return true for type
9718 parameters. The reason for this is that we need to box a type
9719 parameter when converting it to a reference type.
9721 * cs-parser.jay: Added support for default value expressions.
9723 * generics.cs (DefaultValueExpression): New public class.
9725 2003-10-17 Martin Baulig <martin@ximian.com>
9727 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
9728 TypeContainer so we can also use this for Interfaces.
9729 (TypeParameter.Resolve): Likewise.
9731 * interface.cs (Interface.DefineType): Added support for generic
9734 * cs-parser.jay: Added support for generic structs and interfaces.
9736 2003-10-17 Martin Baulig <martin@ximian.com>
9738 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
9739 call generic methods :-)
9741 2003-10-16 Martin Baulig <martin@ximian.com>
9743 * cs-parser.jay (namespace_or_type_name): Only create a
9744 GenericMemberAccess if we actually have type arguments.
9746 2003-10-13 Martin Baulig <martin@ximian.com>
9748 * class.cs (Method.Define): If we're a generic method, call
9749 TypeBuilder.DefineGenericMethod () before resolving
9751 (MethodData): Added .ctor which takes an additional MethodBuilder
9752 argument; this is used for generic methods.
9753 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
9754 we already have a MethodBuilder.
9756 2003-10-10 Martin Baulig <martin@ximian.com>
9758 * class.cs (Method): Added .ctor which takes a `GenericMethod'
9759 instead of a `DeclSpace'. This is used for generic methods.
9761 * cs-parser.jay (method_header): Added support for generic
9762 methods; create a `GenericMethod' instance and pass it to the
9763 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
9764 parameters and locals.
9766 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
9767 since we already have the location. Check whether we're a generic
9768 type declaration or a generic method and create the correct type
9771 * generic.cs (TypeParameter.DefineMethod): New public method.
9772 (GenericMethod): New public class; derives from DeclSpace and is
9773 used for generic methods.
9775 2003-10-09 Martin Baulig <martin@ximian.com>
9777 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
9779 (MethodCore.DoDefineParameters): Removed the TypeContainer
9780 argument; use the DeclSpace which was passed to the .ctor instead.
9781 (MethodCore.CheckParameter): Take a DeclSpace instead of a
9782 TypeContainer; we only need a DeclSpace here.
9784 2003-10-09 Martin Baulig <martin@ximian.com>
9786 * class.cs (MethodData): Added additional `DeclSpace ds' argument
9788 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
9789 EmitContext's .ctor.
9791 2003-10-09 Martin Baulig <martin@ximian.com>
9793 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
9794 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
9795 AsAccessible(), moved them as well.
9797 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
9799 2003-10-07 Miguel de Icaza <miguel@ximian.com>
9801 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
9802 generation for >=, as spotted by Paolo, bug 48679.
9803 Patch from David Waite.
9805 * cs-tokenizer.cs: Add handling for #pragma.
9807 * cs-parser.jay: Allow for both yield and yield return in the
9808 syntax. The anti-cobolization of C# fight will go on!
9810 * class.cs (TypeBuilder.DefineType): Catch error condition here
9811 (Parent.DefineType erroring out and returning null).
9813 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9814 coping with enumerations variables, we were mistakenly processing
9815 them as a regular value type instead of built-in types. Fixes the
9818 * typemanager.cs (IsBuiltinOrEnum): New method.
9820 2003-09-30 Miguel de Icaza <miguel@ximian.com>
9822 * cs-parser.jay: Upgrade: yield now needs the return clause.
9824 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
9826 * cs-parser.jay : Renamed yyName to yyNames related to jay.
9828 2003-09-29 Martin Baulig <martin@ximian.com>
9830 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
9831 inflated generic methods.
9833 * generics.cs (ConstructedType): Distinguish between open and
9834 closed constructed types; correctly resolve the arguments.
9836 2003-09-22 Martin Baulig <martin@ximian.com>
9838 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
9839 all type arguments meet their constraints.
9841 2003-09-19 Martin Baulig <martin@ximian.com>
9843 * decl.cs (MemberCache.SetupCacheForInterface): Take a
9844 `MemberCache parent' argument. Normally, an interface doesn't
9845 have a parent type except System.Object, but we use this in gmcs
9846 for generic type parameters.
9848 2003-09-18 Martin Baulig <martin@ximian.com>
9850 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
9851 on `type.IsInterface'; don't check whether the type has a parent
9852 to determine whether it's an interface.
9854 2003-09-17 Martin Baulig <martin@ximian.com>
9856 * generic.cs (ConstructedType.ToString): Always use `name' as the
9859 2003-09-15 Martin Baulig <martin@ximian.com>
9861 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
9863 * generic.cs (Constraints.Resolve): New public method; this is
9864 called to resolve the constraint types and to check whether all
9865 the constraints are correct.
9866 (Constraints.Types): New public property.
9867 (TypeParameter.Resolve): New public method; resolves all the
9870 * class.cs (TypeContainer.DefineType): Call
9871 TypeParameter.Resolve() before actually defining the type.
9873 2003-09-15 Martin Baulig <martin@ximian.com>
9875 * class.cs (TypeContainer.DefineType): Added an error flag to
9876 avoid reporting duplicate CS0146's ("class definition is
9879 * driver.cs (Driver.MainDriver): Abort if
9880 RootContext.ResolveTree() reported any errors.
9882 2003-09-07 Martin Baulig <martin@ximian.com>
9884 * report.cs (Error, Warning): Added overloaded versions which take
9885 a `params object[] args' and call String.Format().
9887 2003-09-07 Martin Baulig <martin@ximian.com>
9889 * decl.cs (DeclSpace..ctor): Don't call
9890 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
9891 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
9892 (DeclSpace.RecordDecl): New method.
9894 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
9896 2003-09-02 Ravi Pratap <ravi@ximian.com>
9898 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
9899 value attributes to be applied to ParameterBuilders.
9901 * class.cs (MethodCore.LabelParameters): Make static and more
9902 generic so that it can be used from other places - like interface
9903 methods, for instance.
9905 * interface.cs (Interface.Emit): Call LabelParameters before
9906 emitting attributes on the InterfaceMethod.
9908 2003-09-07 Martin Baulig <martin@ximian.com>
9910 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
9911 if the number of type parameters doesn't match.
9913 2003-09-04 Martin Baulig <martin@ximian.com>
9915 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
9916 for arrays of generic type params (ie. `!0[]').
9918 2003-09-04 Martin Baulig <martin@ximian.com>
9920 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
9923 2003-09-04 Martin Baulig <martin@ximian.com>
9925 * decl.cs (DeclSpace.LookupGeneric): New method.
9926 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
9929 * generic.cs (TypeParameterExpr): Take a TypeParameter as
9930 argument, not just a string.
9931 (TypeParameter.Define): New public method; this is called to
9932 actually define the generic parameter; after this, you can use the
9933 new `Type' property to get the type.
9935 2003-09-04 Martin Baulig <martin@ximian.com>
9937 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
9938 is now an ArrayList; initialize the result of the `TypeParameters'
9940 (DeclSpace.GetGenericData): Removed.
9941 (DeclSpace.LookupGeneric): Temporarily removed; we need to
9942 implement this in a different way.
9943 (DeclSpace.GetTypeParameters): Removed; there's now a
9944 `TypeParameters' property.
9945 (DeclSpace.TypeParameters): New public property.
9947 * generic.cs (Constraints): Make this class public.
9948 (TypeParameter): New public class.
9950 2003-09-04 Martin Baulig <martin@ximian.com>
9952 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
9955 * class.cs (TypeContainer.DefineType): Call
9956 TypeBuilder.DefineGenericParameter () on all generic parameters if
9957 this is a generic type.
9959 2003-08-28 Martin Baulig <martin@ximian.com>
9961 * sample-stack.il: Compile this with ilasm: "ilasm /dll
9964 * sample-hello.cs: Compile this with gmcs: "gmcs
9965 /r:sample-stack.dll sample-hello.cs".
9967 2003-08-28 Martin Baulig <martin@ximian.com>
9969 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
9970 the parameters to the generic type.
9972 2003-08-28 Martin Baulig <martin@ximian.com>
9974 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
9976 2003-08-28 Martin Baulig <martin@ximian.com>
9978 * cs-parser.jay (opt_type_argument_list): Use
9979 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
9980 (primary_expression): Replace `qualified_identifier' with `type_name'.
9981 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
9983 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
9984 parser to check whether it is syntactically a type parameter list;
9985 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
9988 2003-08-26 Martin Baulig <martin@ximian.com>
9990 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
9991 resolving aliases; fixes #47927.
9993 2003-08-26 Martin Baulig <martin@ximian.com>
9995 * statement.cs (Using.DoResolve): This is internally emitting a
9996 try/finally clause, so we need to set ec.NeedExplicitReturn if we
9997 do not always return. Fixes #47681.
9999 2003-08-26 Martin Baulig <martin@ximian.com>
10001 * decl.cs (MemberCore): Moved WarningNotHiding(),
10002 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
10004 (AdditionResult): Make this nested in DeclSpace.
10005 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
10006 argument; call NamespaceEntry.Define() unless we're nested in a
10009 * namespace.cs (Namespace.DefineName): New public function. This
10010 is called from DeclSpace's .ctor to add
10011 (Namespace.Lookup): Include DeclSpaces in the lookup.
10013 * class.cs (Operator): Derive from MemberBase, not MemberCore.
10015 * const.cs (Const): Derive from MemberBase, not MemberCore.
10017 2003-08-25 Martin Baulig <martin@ximian.com>
10019 * convert.cs (Convert.ExplicitReferenceConversion): When
10020 converting from an interface type to a class, unbox if the target
10021 type is a struct type. Fixes #47822.
10023 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10025 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
10028 2003-08-22 Martin Baulig <martin@ximian.com>
10030 * class.cs (TypeManager.DefineType): When defining a nested type,
10031 call DefineType() on our parent; fixes #47801.
10033 2003-08-22 Martin Baulig <martin@ximian.com>
10035 * class.cs (MethodData.Define): While checking if a method is an
10036 interface implementation, improve the test a bit more to fix #47654.
10038 2003-08-22 Martin Baulig <martin@ximian.com>
10040 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
10041 correctly; fixes #47722.
10043 2003-08-22 Martin Baulig <martin@ximian.com>
10045 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
10046 LocalVariableReference, ensure it's not read-only. Fixes #47536.
10048 * statement.cs (Fixed.DoResolve): Make all variables read-only.
10050 2003-08-22 Martin Baulig <martin@ximian.com>
10052 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
10053 can only be assigned in static constructors. Fixes #47161.
10055 2003-08-22 Martin Baulig <martin@ximian.com>
10057 Rewrote and improved the flow analysis code.
10059 * flowbranching.cs (FlowBranching): Make this class abstract.
10060 (FlowBranching.CreateBranching): New static function to create a
10061 new flow branching.
10062 (FlowBranchingBlock, FlowBranchingException): New classes.
10063 (FlowBranching.UsageVector.Type): New public readonly field.
10064 (FlowBranching.UsageVector.Breaks): Removed the setter.
10065 (FlowBranching.UsageVector.Returns): Removed the setter.
10066 (FlowBranching.UsageVector): Added Break(), Return(),
10067 NeverReachable() and Throw() methods to modify the reachability.
10068 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
10069 done by FlowBranching.Merge().
10070 (FlowBranching.UsageVector.MergeChild): New method; merges the
10071 merge result into the current vector.
10072 (FlowBranching.Merge): New abstract method to merge a branching.
10074 2003-08-12 Martin Baulig <martin@ximian.com>
10076 * expression.cs (Indirection.CacheTemporaries): Create the
10077 LocalTemporary with the pointer type, not its element type.
10079 2003-08-10 Miguel de Icaza <miguel@ximian.com>
10081 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
10082 token was a keyword or not.
10084 Add `error' options where an IDENTIFIER was expected; Provide
10085 CheckToken and CheckIdentifierToken convenience error reporting
10088 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
10090 * decl.cs: Rename `NamespaceEntry Namespace' public field into
10091 NameSpaceEntry NameSpaceEntry.
10093 (LookupInterfaceOrClass): Avoid creating a full qualified name
10094 from namespace and name: avoid doing lookups when we know the
10095 namespace is non-existant. Use new Tree.LookupByNamespace which
10096 looks up DeclSpaces based on their namespace, name pair.
10098 * driver.cs: Provide a new `parser verbose' to display the
10099 exception thrown during parsing. This is turned off by default
10100 now, so the output of a failure from mcs is more graceful.
10102 * namespace.cs: Track all the namespaces defined in a hashtable
10105 (IsNamespace): New method
10107 2003-08-09 Miguel de Icaza <miguel@ximian.com>
10109 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
10110 we know that we need to concatenate (full typename can never be
10115 * statement.cs: Use a bitfield; Do not initialize to null things
10116 which are done by the constructor by default.
10118 * cs-parser.jay: bug fix, parameter was 4, not 3.
10120 * expression.cs: Just use the property;
10122 * statement.cs: No need for GetVariableInfo method.
10124 2003-08-08 Martin Baulig <martin@ximian.com>
10126 * flowanalysis.cs (FlowReturns): This is now nested in the
10127 `FlowBranching' class.
10128 (MyBitVector): Moved this here from statement.cs.
10129 (FlowBranching.SiblingType): New enum type.
10130 (FlowBranching.CreateSibling): Added `SiblingType' argument.
10132 2003-08-07 Martin Baulig <martin@ximian.com>
10134 * flowanalysis.cs (FlowBranchingType): This is now nested in the
10135 `FlowBranching' class and called `BranchingType'.
10137 2003-08-07 Martin Baulig <martin@ximian.com>
10139 * flowanalysis.cs: Moved all the control flow analysis code into
10142 2003-08-07 Martin Baulig <martin@ximian.com>
10144 * assign.cs (Assign.DoResolve): `target' must either be an
10145 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
10148 2003-08-07 Miguel de Icaza <miguel@ximian.com>
10150 * expression.cs (BinaryMethod): This kind of expression is created by the
10151 Binary class if it determines that the operator has to be handled
10154 (BinaryDelegate): This kind of expression is created if we are
10155 dealing with a + or - operator on delegates.
10157 (Binary): remove method, argumetns, and DelegateOperator: when
10158 dealing with methods,
10160 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
10162 * statement.cs (Block): use bitfields for the three extra booleans
10163 we had in use. Remove unused topblock parameter.
10165 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
10167 * assign.cs: Drop extra unneeded tests.
10169 2003-08-06 Miguel de Icaza <miguel@ximian.com>
10171 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
10173 * statement.cs (Foreach): Use VariableStorage instead of
10176 * codegen.cs (VariableStorage): New class used by clients that
10177 require a variable stored: locals or fields for variables that
10178 need to live across yield.
10180 Maybe provide a convenience api for EmitThis+EmitLoad?
10182 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
10185 2003-08-05 Miguel de Icaza <miguel@ximian.com>
10187 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
10188 RemapParameterLValue): New methods that are used to turn a
10189 precomputed FieldInfo into an expression like this:
10193 The idea is to use this instead of making LocalVariableReference
10194 have more than one meaning.
10196 * cs-parser.jay: Add error production to BASE.
10198 * ecore.cs: Deal with TypeManager.GetField returning null, which
10199 is now a valid return value.
10201 (FieldExprNoAddress): New expression for Fields whose address can
10204 * expression.cs (LocalVariableReference): During the resolve
10205 phases, create new expressions if we are in a remapping context.
10206 Remove code that dealt with remapping here.
10208 (ParameterReference): same.
10210 (ProxyInstance): New expression, like the `This' expression, but
10211 it is born fully resolved. We know what we are doing, so remove
10212 the errors that are targeted to user-provided uses of `this'.
10214 * statement.cs (Foreach): our variable is now stored as an
10215 Expression; During resolution, follow the protocol, dont just
10216 assume it will return this.
10218 2003-08-06 Martin Baulig <martin@ximian.com>
10220 * support.cs (SeekableStreamReader.cs): New public class.
10222 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
10223 SeekableStreamReader instead of the normal StreamReader.
10225 2003-08-04 Martin Baulig <martin@ximian.com>
10227 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
10228 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
10229 deambiguate casts and delegate invocations.
10230 (parenthesized_expression): Use the new tokens to ensure this is
10231 not a cast of method invocation.
10233 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
10234 when reading a `)' and Deambiguate_CloseParens () was previously
10237 * expression.cs (ParenthesizedExpression): New class. This is
10238 just used for the CS0075 test.
10239 (Binary.DoResolve): Check for CS0075.
10241 2003-07-29 Ravi Pratap <ravi@ximian.com>
10243 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
10244 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
10245 reference comparison.
10247 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
10248 examine the ReturnType for equality - this is necessary in the
10249 cases of implicit and explicit operators whose signature also
10250 includes the return type.
10252 2003-07-26 Miguel de Icaza <miguel@ximian.com>
10254 * namespace.cs: Cache the result of the namespace computation,
10255 instead of computing it every time.
10257 2003-07-24 Miguel de Icaza <miguel@ximian.com>
10259 * decl.cs: Use a global arraylist that we reuse over invocations
10260 to avoid excesive memory consumption. Reduces memory usage on an
10261 mcs compile by one meg (45 average).
10263 * typemanager.cs (LookupTypeReflection): In .NET pointers are
10264 private, work around that.
10266 2003-07-23 Miguel de Icaza <miguel@ximian.com>
10268 * literal.cs (IntLiteral): Define Zero and One static literals.
10270 * cs-parser.jay (integer_literal): use static literals to reduce
10271 memory usage for the most used literals (0, 1 and -1). 211kb
10272 reduced in memory usage.
10274 Replace all calls to `new ArrayList' with `new
10275 ArrayList(4)' which is a good average number for most allocations,
10276 and also requires only 16 bytes of memory for its buffer by
10279 This reduced MCS memory usage in seven megabytes for the RSS after
10282 2003-07-28 Ravi Pratap <ravi@ximian.com>
10284 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
10285 handle params methods the correct way by forming only one
10286 applicable set with params and normal methods in them. Earlier we
10287 were looking at params methods only if we found no normal methods
10288 which was not the correct thing to do.
10290 (Invocation.BetterFunction): Take separate arguments indicating
10291 when candidate and the best method are params methods in their
10294 This fixes bugs #43367 and #46199.
10296 * attribute.cs: Documentation updates.
10298 (CheckAttribute): Rename to CheckAttributeTarget.
10299 (GetValidPlaces): Rename to GetValidTargets.
10301 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
10302 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
10306 2003-07-28 Miguel de Icaza <miguel@ximian.com>
10308 * codegen.cs: Compute IsGeneric correctly.
10310 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
10313 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
10314 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
10315 regressions, and I was chasing more bugs than I required.
10317 * interface.cs: Use expressions for base type names (like classes
10318 and structs have been doing for a while now), and resolve that.
10319 This patch should probably go into head as well.
10321 This makes it one less user of FindType.
10323 2003-07-24 Miguel de Icaza <miguel@ximian.com>
10325 This compiler can not self host currently. Need to fix that.
10327 * Makefile: compile to `gmcs.exe'
10329 * driver.cs: Turn on v2 by default on gmcs.
10331 * generic.cs (ConstructedType): Does no longer take a container
10332 type argument; That will be taken care of later.
10334 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
10335 Use SimpleName to resolve for now, so we can continue the work on
10336 the parser, until we get Type.GetType that understands generics.
10338 (ConstructedType.ToString): Implement
10340 (TypeArguments.Resolve): Resolve the child expressions as types.
10342 * cs-parser.jay: Rename interface_constraints to
10343 type_parameter_constraints
10345 (namespace_or_type_name): Only use constructed types for the basic
10346 construction, we will deal with identifier<...> later.
10348 (type/type_name): No longer call DecomposeQI, as
10349 namespace_or_type_name is always decoded now.
10351 2003-07-22 Ravi Pratap <ravi@ximian.com>
10353 * expression.cs (Invocation.OverloadResolve): Follow the spec more
10354 closely: we eliminate methods in base types when we have an
10355 applicable method in a top-level type.
10357 Please see section 14.5.5.1 for an exact description of what goes
10360 This fixes bug #45127 and a host of other related to corlib compilation.
10362 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
10363 array is the method corresponding to the top-level type (this is
10364 because of the changes made to icall.c) so we change this
10367 (MethodGroupExpr.Name): This too.
10369 * typemanager.cs (GetElementType): New method which does the right
10370 thing when compiling corlib.
10372 * everywhere: Make use of the above in the relevant places.
10374 2003-07-22 Martin Baulig <martin@ximian.com>
10376 * cs-parser.jay (invocation_expression): Moved
10377 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
10378 `cast_expression', but create a InvocationOrCast which later
10379 resolves to either an Invocation or a Cast.
10381 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
10382 method; call this before EmitStatement() to make sure that this
10383 expression can be used as a statement.
10385 * expression.cs (InvocationOrCast): New class; resolves to either
10386 an Invocation or a Cast.
10388 * statement.cs (StatementExpression): Call ResolveStatement() on
10389 the ExpressionStatement before emitting it.
10391 2003-07-21 Martin Baulig <martin@ximian.com>
10393 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
10394 `ref' and `out' attributes match; fixes #46220.
10395 (MemberAccess.ResolveMemberAccess): You can't reference a type
10396 through an expression; fixes #33180.
10397 (Indexers.GetIndexersForType): Don't return the indexers from
10398 interfaces the class implements; fixes #46502.
10400 2003-07-21 Martin Baulig <martin@ximian.com>
10402 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
10403 CS0661 checks; fixes bug #30442.
10405 2003-07-21 Martin Baulig <martin@ximian.com>
10407 * decl.cs (AdditionResult): Added `Error'.
10409 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
10411 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
10412 cs0031.cs actually work.
10414 2003-07-20 Miguel de Icaza <miguel@ximian.com>
10416 * cs-parser.jay (namespace_name): do not use
10417 namespace_or_type_name, use qualified_identifier, because
10418 namespace_or_type_name will soon return a composed expression
10419 instead of a string.
10421 (namespace_or_type_name): Instead of returning a string, now this
10422 production returns an expression.
10424 * codegen.cs (EmitContext): Setup IsGeneric property based on
10425 whether our DeclSpace is generic, our the method is generic.
10427 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
10428 the method is generic.
10430 * cs-parser.jay (type_arguments, opt_type_argument_list,
10431 type_parameters, type_parameter_list, opt_type_parameter_list,
10432 type_parameter,, opt_type_parameter_constraints_clauses,
10433 type_parameter_constraints_clauses,
10434 type_parameter_constraint_clause, type_parameter_constraint,
10435 interface_constraints): Add new production
10437 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
10438 DeclSpace is generic or not.
10440 (DeclSpace.SetParameterInfo): New routine, used to set the
10441 parameter info for a type.
10443 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
10444 returns a GenericTypeExpr
10446 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
10447 generic, lookup the generic argument.
10449 * attribute.cs: Do not allow TypeParameterExpressions in
10452 * class.cs: Do not allow the Main method to be defined in a
10455 * expression.cs (SizeOf): Do not allow generic types to be used as
10456 arguments to sizeof.
10458 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
10459 it: whether a type is generic or not. Only works for types we are
10460 currently building for now.
10462 2003-07-20 Martin Baulig <martin@ximian.com>
10464 * namespace.cs: Fixed that bug which caused a crash when compiling
10465 the debugger's GUI.
10467 2003-07-20 Miguel de Icaza <miguel@ximian.com>
10469 * typemanager.cs (LookupTypeReflection): Never expose types which
10470 are NotPublic, NestedPrivate, NestedAssembly, or
10471 NestedFamANDAssem. We used to return these, and later do a check
10472 that would report a meaningful error, but the problem is that we
10473 would not get the real match, if there was a name override.
10475 2003-07-18 Miguel de Icaza <miguel@ximian.com>
10477 * namespace.cs (Namespace, Name): Do not compute the namespace
10478 name dynamically, compute it in the constructor. This reduced
10479 memory usage by 1697 KB.
10481 * driver.cs: Use --pause to pause at the end.
10483 2003-07-17 Peter Williams <peter@newton.cx>
10485 * Makefile: Change the name of the test target so that it doesn't
10486 conflict with the recursive test target.
10488 2003-07-17 Miguel de Icaza <miguel@ximian.com>
10490 * expression.cs (LocalVariableReference.Emit, EmitAssign,
10491 AddressOf): Do not use EmitThis, that was wrong, use the actual
10494 2003-07-15 Miguel de Icaza <miguel@ximian.com>
10496 * class.cs (MethodData.Define): While checking if a method is an
10497 interface implementation, improve the test: If we are not public
10498 (use new test here: use the computed MethodAttributes directly,
10499 instead of the parsed modifier flags) check if the `implementing'
10500 method comes from an interface or not.
10502 * pending.cs (VerifyPendingMethods): Slightly better error
10505 * makefile: add test target that does the mcs bootstrap.
10507 2003-07-16 Ravi Pratap <ravi@ximian.com>
10509 * interface.cs (Define): Do nothing here since there are no
10510 members to populate etc. Move the attribute emission out of here
10511 since this was just totally the wrong place to put it. Attribute
10512 application happens during the 'Emit' phase, not in the 'Define'
10515 (Emit): Add this method and move the attribute emission here
10517 * rootcontext.cs (EmitCode): Call the Emit method on interface
10520 2003-07-14 Ravi Pratap M <ravi@ximian.com>
10522 * expression.cs (OverloadResolve): Report error only if Location
10523 is not 'Null' which means that there was a probe going on.
10525 2003-07-14 Martin Baulig <martin@ximian.com>
10527 * expression.cs (ConditionalLogicalOperator): New public class to
10528 implement user defined conditional logical operators.
10529 This is section 14.11.2 in the spec and bug #40505.
10531 2003-07-14 Martin Baulig <martin@ximian.com>
10533 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
10535 2003-07-14 Martin Baulig <martin@ximian.com>
10537 * codegen.cs (EmitContext.InFixedInitializer): New public field.
10539 * ecore.cs (IVariable.VerifyFixed): New interface method.
10541 * expression.cs (Unary.ResolveOperator): When resolving the `&'
10542 operator, check whether the variable is actually fixed. Fixes bug
10543 #36055. Set a variable definitely assigned when taking its
10544 address as required by the spec.
10546 * statement.cs (LocalInfo.IsFixed): New field.
10547 (LocalInfo.MakePinned): Set `IsFixed' to true.
10549 2003-07-14 Ravi Pratap M <ravi@ximian.com>
10551 * attribute.cs (Attribute.Resolve): While doing a Member lookup
10552 for .ctors, ensure that we only ask for members declared in the
10553 attribute type (BindingFlags.DeclaredOnly).
10557 * expression.cs (Error_WrongNumArguments): Report error 1501
10558 correctly the way CSC does.
10560 2003-07-13 Martin Baulig <martin@ximian.com>
10562 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
10563 lookup on the fully qualified name, to make things like "X.X" work
10564 where "X.X" is a fully qualified type name, but we also have a
10565 namespace "X" in the using list. Fixes #41975.
10567 2003-07-13 Martin Baulig <martin@ximian.com>
10569 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
10570 function. If we're a CompoundAssign, we need to create an embedded
10571 CompoundAssign, not an embedded Assign.
10572 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
10575 2003-07-13 Martin Baulig <martin@ximian.com>
10577 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
10578 work to fix bug #46088.
10580 2003-07-13 Ravi Pratap <ravi@ximian.com>
10582 * class.cs (Operator.Emit): Do not emit attributes here - it is
10583 taken care of by the Method class that we delegate too. This takes
10584 care of bug #45876.
10586 2003-07-10 Martin Baulig <martin@ximian.com>
10588 * expression.cs (TypeOfVoid): New class.
10589 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
10591 2003-07-10 Martin Baulig <martin@ximian.com>
10593 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
10596 2003-07-10 Martin Baulig <martin@ximian.com>
10598 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
10599 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
10601 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
10603 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
10605 2003-07-10 Martin Baulig <martin@ximian.com>
10607 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
10608 of decimal. Fixes #42850.
10610 NOTE: I also fixed the created byte blob, but this doesn't work on
10611 the MS runtime and csc never produces any byte blobs for decimal
10614 2003-07-10 Martin Baulig <martin@ximian.com>
10616 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
10617 structs; fixes #32068.
10618 (Block.AddChildVariableNames): Fixed #44302.
10620 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10622 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
10624 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10626 * attribute.cs: And this test is onger needed.
10628 2003-07-08 Martin Baulig <martin@ximian.com>
10630 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
10631 inaccessible types. Fixes #36313.
10633 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
10635 * namespace.cs (NamespaceEntry): Create implicit entries for all
10636 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
10637 implicit entries for N1.N2 and N1.
10639 2003-07-08 Martin Baulig <martin@ximian.com>
10641 Rewrote the handling of namespaces to fix a lot of the issues
10642 wrt. `using' aliases etc.
10644 * namespace.cs (Namespace): Splitted this class into a
10645 per-assembly `Namespace' and a per-file `NamespaceEntry'.
10647 * typemanager.cs (TypeManager.IsNamespace): Removed.
10648 (TypeManager.ComputeNamespaces): Only compute namespaces from
10649 loaded assemblies here, not the namespaces from the assembly we're
10650 currently compiling.
10652 2003-07-08 Martin Baulig <martin@ximian.com>
10654 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
10656 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10658 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
10661 I thought about the memory savings here, but LookupTypeReflection
10662 is used under already very constrained scenarios. Compiling
10663 corlib or mcs only exposes one hit, so it would not really reduce
10664 any memory consumption.
10666 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10668 * typemanager.cs: fixes bug #45889 by only adding public types from
10669 other assemblies to the list of known types.
10671 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10673 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
10674 on the type we resolved.
10676 2003-07-05 Martin Baulig <martin@ximian.com>
10678 * pending.cs (PendingImplementation.ParentImplements): Don't
10679 create the proxy if the parent is abstract.
10681 * class.cs (TypeContainer.DefineIndexers): Process explicit
10682 interface implementations first. Fixes #37714.
10684 2003-07-04 Miguel de Icaza <miguel@ximian.com>
10686 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
10687 defined recursively; but since we modify the input parameters
10688 (left is set to `this' temporarily), we reset this value if the
10689 left_is_explicit is false, which gives the original semantics to
10692 * literal.cs (NullPointer): new class used to represent a null
10693 literal in a pointer context.
10695 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
10696 type is a pointer, use a NullPointer object instead of a
10697 NullLiteral. Closes 43687
10699 (ExplicitConversion): Convert pointer values using
10700 the conv opcode to the proper type.
10702 * ecore.cs (New): change ValueTypeVariable property into a method,
10703 that returns whether the valuetype is suitable for being used.
10705 * expression.cs (Binary.DoNumericPromotions): Only return if we
10706 the int constant was a valid uint, and we can return both left and
10707 right as uints. If not, we continue processing, to trigger the
10708 type conversion. This fixes 39018.
10710 * statement.cs (Block.EmitMeta): During constant resolution, set
10711 the CurrentBlock property on the emitcontext, so that we resolve
10712 constants propertly.
10714 2003-07-02 Martin Baulig <martin@ximian.com>
10716 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
10717 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
10719 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
10720 than emitting it here.
10722 * statement.cs: Fixed some more flow analysis bugs.
10724 2003-07-02 Martin Baulig <martin@ximian.com>
10726 * class.cs (MethodData.Define): When implementing interface
10727 methods, set Final unless we're Virtual.
10729 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
10730 check work for interface methods.
10732 2003-07-01 Martin Baulig <martin@ximian.com>
10734 * ecore.cs (EmitContext.This): Replaced this property with a
10735 GetThis() method which takes a Location argument. This ensures
10736 that we get the correct error location for a CS0188.
10738 2003-07-01 Miguel de Icaza <miguel@ximian.com>
10740 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
10741 ImplicitStandardConversion.
10743 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
10745 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
10747 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
10750 2003-06-30 Miguel de Icaza <miguel@ximian.com>
10752 * class.cs (Constructor.Define): Turn off initlocals for unsafe
10755 (MethodData.Define): Turn off initlocals for unsafe methods.
10757 2003-06-29 Miguel de Icaza <miguel@ximian.com>
10759 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
10760 complete; Fixes #37521.
10762 * delegate.cs: Use Modifiers.TypeAttr to compute the
10763 TypeAttributes, instead of rolling our own. This makes the flags
10764 correct for the delegates.
10766 2003-06-28 Miguel de Icaza <miguel@ximian.com>
10768 * class.cs (Constructor.Define): Set the private flag for static
10769 constructors as well.
10771 * cs-parser.jay (statement_expression): Set the return value to
10772 null, to avoid a crash when we catch an error.
10774 2003-06-24 Miguel de Icaza <miguel@ximian.com>
10776 * cs-parser.jay: Applied patch from Jackson that adds support for
10777 extern and unsafe modifiers to destructor declarations.
10779 * expression.cs: Report error 21 if the user is trying to index a
10782 * driver.cs: Add an error message, suggested by the bug report.
10784 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
10785 if we do not have a ": this ()" constructor initializer. Fixes 45149
10787 2003-06-14 Miguel de Icaza <miguel@ximian.com>
10789 * namespace.cs: Add some information to reduce FAQs.
10791 2003-06-13 Miguel de Icaza <miguel@ximian.com>
10793 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
10794 underlying enumeration types. Fixes #43915.
10796 * expression.cs: Treat ushort/short as legal values to be used in
10797 bitwise operations.
10799 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
10801 * delegate.cs: transfer custom attributes for paramenters from
10802 the delegate declaration to Invoke and BeginInvoke.
10804 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
10806 * attribute.cs: handle custom marshalers and emit marshal info
10809 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
10811 * makefile.gnu: Added anonymous.cs to the compiler sources.
10813 2003-05-28 Miguel de Icaza <miguel@ximian.com>
10815 * iterators.cs: Change the name of the proxy class to include two
10818 * cs-parser.jay: Update grammar to include anonymous methods.
10820 * anonymous.cs: new file.
10822 2003-05-27 Miguel de Icaza <miguel@ximian.com>
10824 * class.cs (Field.Define): Add missing test for pointers and
10827 2003-05-27 Ravi Pratap <ravi@ximian.com>
10829 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
10830 we use the stobj opcode.
10832 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
10833 since it wasn't the correct fix.
10835 It still is puzzling that we are required to use stobj for IntPtr
10836 which seems to be a ValueType.
10838 2003-05-26 Miguel de Icaza <miguel@ximian.com>
10840 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
10841 during regular simple name resolution. Now, the trick is that
10842 instead of returning for processing the simplename, we do a
10843 TypeManager.LookupType (ie, a rooted lookup as opposed to a
10844 contextual lookup type). If a match is found, return that, if
10845 not, return for further composition.
10847 This fixes long-standing 30485.
10849 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
10850 using the address to initialize an object, do an Stobj instead of
10851 using the regular Stelem.
10853 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
10854 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
10855 Because if we are a BaseIndexerAccess that value will be true.
10858 * statement.cs (GotoCase.Resolve): Return after reporting an
10859 error, do not attempt to continue.
10861 * expression.cs (PointerArithmetic.Emit): If our operand is a
10862 long, convert our constants to match the operand before
10863 multiplying. Convert to I type before adding. Fixes 43670.
10865 2003-05-14 Ravi Pratap <ravi@ximian.com>
10867 * enum.cs (ImplicitConversionExists) : Rename to
10868 ImplicitEnumConversionExists to remove ambiguity.
10870 * ecore.cs (NullCast): New type of cast expression class which
10871 basically is very similar to EmptyCast with the difference being
10872 it still is a constant since it is used only to cast a null to
10874 (eg. (string) null)
10876 * convert.cs (ImplicitReferenceConversion): When casting a null
10877 literal, we return a NullCast.
10879 * literal.cs (NullLiteralTyped): Remove - I don't see why this
10880 should be around anymore.
10882 The renaming (reported was slightly wrong). Corrections:
10884 ConvertImplicitStandard -> ImplicitConversionStandard
10885 ConvertExplicitStandard -> ExplicitConversionStandard
10887 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
10888 before passing them in !
10890 * convert.cs (ImplicitConversionStandard): When comparing for
10891 equal expr and target types, ensure that expr is not a
10894 In general, we must not be checking (expr_type ==
10895 target_type) in the top level conversion methods
10896 (ImplicitConversion, ExplicitConversion etc). This checking is
10897 done in the methods that they delegate to.
10899 2003-05-20 Miguel de Icaza <miguel@ximian.com>
10901 * convert.cs: Move Error_CannotConvertType,
10902 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
10903 ImplicitNumericConversion, ImplicitConversionExists,
10904 ImplicitUserConversionExists, StandardConversionExists,
10905 FindMostEncompassedType, FindMostSpecificSource,
10906 FindMostSpecificTarget, ImplicitUserConversion,
10907 ExplicitUserConversion, GetConversionOperators,
10908 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
10909 TryImplicitIntConversion, Error_CannotConvertImplicit,
10910 ConvertImplicitRequired, ConvertNumericExplicit,
10911 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
10912 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
10915 Perform the following renames:
10917 StandardConversionExists -> ImplicitStandardConversionExists
10918 ConvertImplicit -> ImplicitConversion
10919 ConvertImplicitStandard -> ImplicitStandardConversion
10920 TryImplicitIntConversion -> ImplicitIntConversion
10921 ConvertImplicitRequired -> ImplicitConversionRequired
10922 ConvertNumericExplicit -> ExplicitNumericConversion
10923 ConvertReferenceExplicit -> ExplicitReferenceConversion
10924 ConvertExplicit -> ExplicitConversion
10925 ConvertExplicitStandard -> ExplicitStandardConversion
10927 2003-05-19 Martin Baulig <martin@ximian.com>
10929 * statement.cs (TypeInfo.StructInfo): Made this type protected.
10930 (TypeInfo): Added support for structs having structs as fields.
10932 * ecore.cs (FieldExpr): Implement IVariable.
10933 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
10934 VariableInfo for the field.
10936 2003-05-18 Martin Baulig <martin@ximian.com>
10938 * expression.cs (This.DoResolve): Report a CS0027 if we're
10939 emitting a field initializer.
10941 2003-05-18 Martin Baulig <martin@ximian.com>
10943 * expression.cs (This.ResolveBase): New public function.
10944 (This.DoResolve): Check for CS0188.
10946 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
10949 * ecore.cs (MethodGroupExpr.DoResolve): Set the
10950 `instance_expression' to null if we don't have any non-static
10953 2003-05-18 Martin Baulig <martin@ximian.com>
10955 Reworked the way how local variables and parameters are handled by
10956 the flow analysis code.
10958 * statement.cs (TypeInfo, VariableMap): New public classes.
10959 (VariableInfo): New public class. This is now responsible for
10960 checking whether a variable has been assigned. It is used for
10961 parameters and local variables.
10962 (Block.EmitMeta): Take the InternalParameters as argument; compute
10963 the layout of the flow vectors here.
10964 (Block.LocalMap, Block.ParameterMap): New public properties.
10965 (FlowBranching): The .ctor doesn't get the InternalParameters
10966 anymore since Block.EmitMeta() now computes the layout of the flow
10968 (MyStructInfo): This class is now known as `StructInfo' and nested
10969 in `TypeInfo'; we don't access this directly anymore.
10971 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
10972 property and removed IsAssigned(), IsFieldAssigned(),
10973 SetAssigned() and SetFieldAssigned(); we now call them on the
10974 VariableInfo so we don't need to duplicate this code everywhere.
10976 * expression.cs (ParameterReference): Added `Block block' argument
10978 (LocalVariableReference, ParameterReference, This): The new
10979 VariableInfo class is now responsible for all the definite
10982 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
10983 IsParameterAssigned, SetParameterAssigned): Removed.
10985 2003-05-18 Martin Baulig <martin@ximian.com>
10987 * typemanager.cs (InitCoreTypes): Try calling
10988 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
10989 the 3-args-version. Corlib now also needs our `void_type'.
10990 (GetMethod): Added overloaded version which takes an optional
10991 `bool report_errors' to allow lookups of optional methods.
10993 2003-05-12 Martin Baulig <martin@ximian.com>
10995 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
10996 only used for locals and not for parameters.
10998 2003-05-12 Miguel de Icaza <miguel@ximian.com>
11000 * support.cs (InternalParameters.ParameterType): Return the
11001 ExternalType of the parameter.
11003 * parameter.cs (Parameter.ExternalType): drop the two arguments,
11006 2003-05-11 Miguel de Icaza <miguel@ximian.com>
11008 * class.cs (MethodData.Define): Do not set the `newslot' on
11009 interface members, if they are also flagged as "override".
11011 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
11012 better code for ++i and i++. This only works for static fields
11013 and local variables.
11015 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
11016 want to pull the DeclSpace out of the builder_to_declspace instead
11017 of the TypeBuilder (like in TypeContainer.FindMembers).
11019 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
11020 instead of LookupTypeContainer. Fixes the crash on .NET for
11021 looking up interface members.
11023 * const.cs: Create our own emit context during the Definition
11024 stage, so that constants are evaluated in the proper context, when
11025 a recursive definition happens.
11027 2003-05-11 Martin Baulig <martin@ximian.com>
11029 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
11030 new block for a switch section.
11031 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
11032 the adding/lookup in the switch block. Fixes #39828.
11034 2003-05-09 Miguel de Icaza <miguel@ximian.com>
11036 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
11037 functionality: I needed to convert the data after I had performed
11038 the add/sub operation into the operands type size.
11040 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
11041 pass the type for the box operation, otherwise the resulting
11042 object would have been of type object.
11044 (BoxedCast): Add constructor to specify the type to box as.
11046 2003-05-07 Miguel de Icaza <miguel@ximian.com>
11048 * iterators.cs: I was reusing the `count' variable inadvertently,
11049 take steps to not allow this to happen.
11051 2003-05-06 Miguel de Icaza <miguel@ximian.com>
11053 * attribute.cs (Attribute.Resolve): Params attributes are encoded
11054 by creating an array at the point where the params starts and
11055 putting all those arguments there, then adjusting the size of the
11058 2003-05-05 Miguel de Icaza <miguel@ximian.com>
11060 * expression.cs (New.AddressOf): Implement interface
11061 IMemoryLocation. This is used when the `new' operator is used in
11062 the context of an invocation to a method on a value type.
11064 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
11067 * namespace.cs: Also check the using aliases here.
11069 * driver.cs: Move the test for using validity after the types have
11070 been entered, so we do a single pass that also includes the using
11073 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
11074 in the regular case. CreateSiblingForFinally is doing extra
11077 * attribute.cs (GetAttributeArgumentExpression): Store the result
11078 on an out value, and use the return value to indicate failure
11079 instead of using null (which is a valid return for Constant.GetValue).
11081 * statement.cs: Perform the analysis flow for the increment
11082 portion after the statement, because this will be the real flow of
11083 execution. Fixes #42385
11085 * codegen.cs (EmitContext.EmitArgument,
11086 EmitContext.EmitStoreArgument): New helper functions when the
11087 RemapToProxy flag is set.
11089 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
11092 Add support for remapping parameters.
11094 * iterators.cs: Propagate parameter values; Store parameter
11095 values in the proxy classes.
11097 2003-05-04 Miguel de Icaza <miguel@ximian.com>
11099 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
11100 need a proxy reference; I do not know what I was thinking
11102 * cs-parser.jay (constructor_initializer): catch another error,
11103 and display nice message.
11105 (field_declaration): catch void field declaration
11106 to flag a better error.
11108 * class.cs (MemberBase.CheckBase): Report an error instead of a
11109 warning if a new protected member is declared in a struct.
11110 (Field.Define): catch the error of readonly/volatile.
11112 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
11114 (FieldExpr.AddressOf): ditto. Catch error where the address of a
11115 volatile variable is taken
11117 2003-05-02 Miguel de Icaza <miguel@ximian.com>
11119 * statement.cs (Fixed.Resolve): Report an error if we are not in
11122 2003-05-01 Miguel de Icaza <miguel@ximian.com>
11124 * typemanager.cs: reuse the code that handles type clashes for
11125 delegates and enumerations.
11127 * class.cs (Report28): Always report.
11129 * expression.cs (EncodeAsAttribute): Allow nulls here.
11131 2003-04-28 Miguel de Icaza <miguel@ximian.com>
11133 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
11134 the functionality for testing whether an expression is valid for
11135 an attribute here. Also handle the case of arrays of elements
11138 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
11139 encoding a linear array into an array of objects that are suitable
11140 to be passed to an CustomAttributeBuilder.
11142 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
11144 * ecore.cs: (FieldExpr): Handle field remapping here.
11146 * iteratators.cs: Pass the instance variable (if the method is an
11147 instance method) to the constructors, so we can access the field
11148 variables on the class.
11150 TODO: Test this with structs. I think the THIS variable on
11151 structs might have to be a pointer, and not a refenrece
11153 2003-04-27 Miguel de Icaza <miguel@ximian.com>
11155 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
11156 local variables to fields in a proxy class.
11158 * iterators.cs (PopulateProxy): Rename our internal fields to
11160 Create a <THIS> field if we are an instance method, so we can
11161 reference our parent container variables.
11162 (MapVariable): Called back from the EmitContext code to enter a
11163 new variable to field mapping into the proxy class (we just create
11167 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
11168 for using the remapped locals to fields.
11170 I placed the code here, because that gives the same semantics to
11171 local variables, and only changes the Emit code.
11173 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
11174 statements inside iterators.
11175 (VariableInfo): Add a FieldBuilder for the cases when we are
11176 remapping local variables to fields in a proxy class
11178 * ecore.cs (SimpleNameResolve): Avoid testing two times for
11179 current_block != null.
11181 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
11182 not cope with strings, as it has been moved to the
11183 TableSwitchEmit. Fixed bug in switch generation.
11185 * expression.cs (New.DoResolve): Provide more context for the user
11186 when reporting an error.
11188 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
11191 * expression.cs (MemberAccess.DoResolve): When we get a type back,
11192 check the permissions for it. Note than in a type-resolution
11193 context the check was already present in DeclSpace.ResolveType,
11194 but was missing from the MemberAccess.
11196 (ArrayCreation.CheckIndices): warn if the user has
11197 more nested levels of expressions, but there are no more
11198 dimensions specified. Avoids crash on bug 41906.
11200 2003-04-26 Miguel de Icaza <miguel@ximian.com>
11202 * statement.cs (Block): replace Implicit bool, for a generic
11204 New flag: `Unchecked'. This is used during the EmitMeta phase
11205 (which is out-of-line with the regular Resolve/Emit process for a
11206 statement, as this is done ahead of time, but still gets a chance
11207 to call constant resolve).
11209 (Block.Flags): new enum for adding a new flag.
11211 (Block.EmitMeta): track the state of unchecked.
11213 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
11214 to enable constant resolution to work there as well.
11216 2003-04-22 Miguel de Icaza <miguel@ximian.com>
11218 * typemanager.cs (ienumerable_type): Also look up
11219 System.Collections.IEnumerable.
11221 2003-04-21 Miguel de Icaza <miguel@ximian.com>
11223 TODO: Test more than one conditional per method.
11225 * class.cs (Indexer.Define): Report the location where the user is
11226 referencing the unsupported feature.
11228 (MethodData): Overload the use of `conditionals' to
11229 minimize the creation of needless ArrayLists. This saves roughly
11230 212kb on my machine.
11232 (Method): Implement the new IIteratorContainer interface.
11233 (Method.SetYields): Implement the method by setting the ModFlags
11234 to contain METHOD_YIELDS.
11236 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
11237 which just got set to null.
11239 * iterators.cs: New file.
11241 (Yield, YieldBreak): New statements.
11243 * statement.cs (Return.Resolve): Flag an error if we are used in
11244 an iterator method.
11246 * codegen.cs (InIterator): New flag set if the code is being
11247 compiled in an iterator method.
11249 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
11250 internal modifier, and we just use it to avoid adding extra
11251 fields, as this is seldom used.
11253 * cs-parser.jay: Add yield_statement (yield and yield break).
11255 * driver.cs: New flag -v2 to turn on version 2 features.
11257 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
11258 hashtable when v2 is enabled.
11260 2003-04-20 Miguel de Icaza <miguel@ximian.com>
11262 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
11263 there is already a namespace defined with this name.
11265 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
11266 people upgraded their corlibs.
11268 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
11269 always use fully qualified types, no need to use the compiler
11272 (TypeManager.IsNamespace): Use binarysearch.
11274 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
11275 AddDelegate): I did not quite use the new IsValid API properly: I
11276 have to pass the short-name and the fullname. I was passing only
11277 the basename instead of the fullname sometimes.
11279 (TypeContainer.DefineType): call NamespaceClash.
11281 * interface.cs (Interface.DefineType): use NamespaceClash before
11284 * delegate.cs (Delegate.DefineType): use NamespaceClash before
11287 * enum.cs: (Enum.DefineType): use NamespaceClash before
11290 * typemanager.cs (: 3-line patch that gives us some tasty 11%
11291 speed increase. First, use the negative_hits cache when we get a
11292 negative. Second, add the type with its full original name
11293 instead of the new . and + encoded name (reflection uses + to
11294 separate type from a nested type). Use LookupTypeReflection
11295 directly which bypasses the type->name hashtable (that we already
11296 know does not contain the type.
11298 * decl.cs (DeclSpace.ResolveTypeExpr): track the
11299 location/container type.
11301 * driver.cs: When passing utf8, use directly the UTF8Encoding.
11303 2003-04-19 Miguel de Icaza <miguel@ximian.com>
11305 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
11307 * delegate.cs (NewDelegate.Resolve): Test whether an instance
11308 method is being referenced in the method group from a static
11309 context, and report error 120 if so.
11311 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
11314 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
11315 is created, we create the A namespace).
11317 * cs-parser.jay: A namespace also introduces a DeclarationFound.
11320 2003-04-18 Miguel de Icaza <miguel@ximian.com>
11322 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
11323 invocation to ModuleBuilder.GetType with the same values will
11324 return a new type instance, so we need to cache its return
11327 * expression.cs (Binary.ResolveOperator): Only allow the compare
11328 operators on enums if they are of the same type.
11330 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
11331 types of ValueType on their own case. Before we were giving them
11332 the same treatment as objects.
11334 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
11335 fullname. Short name is used to compare against container name.
11336 Fullname is used to check against defined namespace names.
11338 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
11339 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
11341 (Method.CheckBase): Call parent.
11342 (MemberBase.CheckBase): Check for protected members on sealed
11344 (PropertyBase.CheckBase): Call parent.
11345 (Field.Define): Call parent.
11347 * report.cs: Negative error codes are now mapped to 8000 - code,
11348 so that the display is render more nicely.
11350 * typemanager.cs: Do not use try/catch, instead report a regular
11353 (GetPointerType, GetReferenceType): These methods provide
11354 mechanisms to obtain the T* and T& from a T. We had the code
11355 previously scattered around the code base, and it also used
11356 TypeManager.LookupType that would go through plenty of caches.
11357 This one goes directly to the type source.
11359 In some places we did the Type.GetType followed by
11360 ModuleBuilder.GetType, but not in others, so this unifies the
11361 processing as well.
11363 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
11364 statements now that we have namespace information.
11366 * typemanager.cs (IsNamespace): New method, returns whether the
11367 string presented is a namespace or not.
11369 (ComputeNamespaces): New public entry point, computes the list of
11370 available namespaces, using the GetNamespaces API call in Mono, or
11371 the slower version in MS.NET.
11373 Now before we start the semantic analysis phase, we have a
11374 complete list of namespaces including everything that the user has
11377 Deleted old code to cache namespaces in .nsc files.
11379 2003-04-17 Miguel de Icaza <miguel@ximian.com>
11381 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
11382 class/struct location definition Location for the implicit
11383 constructor location.
11385 (Operator.Define): Use the location of the operator for the
11386 implicit Method definition.
11388 (Constructor.Emit): use the constructor location for the implicit
11389 base initializer constructor.
11391 * ecore.cs: Remove ITypeExpression. This interface is now gone,
11392 and the Expression class now contains two new methods:
11394 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
11395 isolate type lookup from the rest of the resolution process.
11397 Since we use Expressions to hold type definitions due to the way
11398 we parse the input we have historically overloaded Resolve to
11399 perform the Type lookups if a special flag is passed. Now this is
11400 eliminated and two methods take their place.
11402 The differences in the two methods between xStep and xTerminal is
11403 that xStep is involved in our current lookup system that uses
11404 SimpleNames to compose a name, while xTerminal is used just to
11405 catch the case where the simplename lookup failed.
11407 2003-04-16 Miguel de Icaza <miguel@ximian.com>
11409 * expression.cs (ResolveMemberAccess): Remove redundant code.
11410 TypeExpr expressions are always born fully resolved.
11412 * interface.cs (PopulateMethod): Do not lookup the types twice.
11413 We were doing it once during SemanticAnalysis and once during
11416 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
11417 in local variable type definitions, were being returned as a
11418 SimpleName (we decomposed everything into a string), that is
11419 because primary_expression was being used instead of a type in the
11420 grammar (reduce/reduce conflicts).
11422 The part that was wrong is that we converted the expression into a
11423 string (an oversimplification in one hand, compounded with primary
11424 expressions doing string concatenation).
11430 Would return "A.B.C[]" as a SimpleName. This stopped things like
11431 using clauses from working on this particular context. And a type
11432 was being matched directly against "A.B.C[]".
11434 We now use the correct approach, and allow for ComposedCast to be
11435 part of the unary expression. So the "A.B.C []" become a composed
11436 cast of "A.B.C" (as a nested group of MemberAccess with a
11437 SimpleName at the end) plus the rank composition "[]".
11441 2003-04-10 Miguel de Icaza <miguel@ximian.com>
11443 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
11444 for the access level checking.
11446 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
11447 `TypeContainer container', because I kept getting confused when I
11448 was debugging this code.
11450 * expression.cs (Indexers): Instead of tracking getters/setters,
11451 we now track them in parallel. We create one arraylist less, but
11452 most importantly it is possible now for the LValue code to find a
11453 matching get for a set.
11455 (IndexerAccess.DoResolveLValue): Update the code.
11456 GetIndexersForType has been modified already to extract all the
11457 indexers from a type. The code assumed it did not.
11459 Also make the code set the correct return type for the indexer.
11460 This was fixed a long time ago for properties, but was missing for
11461 indexers. It used to be void_type.
11463 (Binary.Emit): Test first for doubles instead of
11464 floats, as they are more common.
11466 (Binary.EmitBranchable): Use the .un version of the branch opcodes
11467 when dealing with floats and the <=, >= operators. This fixes bug
11470 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
11471 to load the array value by emitting a load on the foreach variable
11472 type. This was incorrect.
11474 We now emit the code to load an element using the the array
11475 variable type, and then we emit the conversion operator.
11479 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
11481 * attribute.cs: Avoid allocation of ArrayLists in the common case.
11483 2003-04-09 Miguel de Icaza <miguel@ximian.com>
11485 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
11486 test for protection before we test for signatures.
11488 (MethodSignature.ToString): implement.
11490 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
11491 to the case where we reduced into a LongConstant.
11493 * decl.cs (CheckAccessLevel): If the type is an array, we can not
11494 depend on whether the information is acurrate, because the
11495 Microsoft runtime will always claim that the array type is public,
11496 regardless of the real state.
11498 If the type is a pointer, another problem happens: the type is
11499 reported as non-public in Microsoft.
11501 In both cases we have to call CheckAccessLevel recursively with
11502 the underlying type as the argument to be tested.
11504 2003-04-08 Miguel de Icaza <miguel@ximian.com>
11506 * assign.cs (Assign.Emit): If we are dealing with a compound
11507 assignment expression, we should use the code path that stores the
11508 intermediate result in a temporary value. This fixes #40903.
11510 *expression.cs (Indirection.ToString): Provide ToString method for
11513 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
11515 * class.cs: Null out fields holding references to Block objects so
11516 they can be garbage collected.
11518 * expression.cs (OverloadResolve): Remove unused local.
11520 2003-04-07 Martin Baulig <martin@ximian.com>
11522 * codegen.cs (EmitContext.CurrentFile): New public field.
11523 (EmitContext.Mark): Use the CurrentFile to check whether the
11524 location is in the correct file.
11525 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
11527 2003-04-07 Martin Baulig <martin@ximian.com>
11529 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
11531 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
11532 location. [FIXME: The location argument which gets passed to this
11533 method is sometimes wrong!]
11535 2003-04-07 Nick Drochak <ndrochak@gol.com>
11537 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
11539 2003-04-07 Miguel de Icaza <miguel@ximian.com>
11541 * expression.cs (Indirection.EmitAssign): We were using the
11542 temporary, but returning immediately instead of continuing the
11545 2003-04-06 Martin Baulig <martin@ximian.com>
11547 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
11548 if it's a nested child, but also deriving from the outer class.
11551 * typemanager.cs (IsNestedChildOf): Make this work if it's a
11552 nested child, but also deriving from the outer class. See
11554 (FilterWithClosure): We may access private members of the outer
11555 class if we're a nested child and deriving from the outer class.
11556 (RealMemberLookup): Only set `closure_private_ok' if the
11557 `original_bf' contained BindingFlags.NonPublic.
11559 2003-04-05 Martin Baulig <martin@ximian.com>
11561 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
11562 probe if its a type parameter, and if so, flag an error.
11564 * decl.cs: Move here the SetParameterInfo code from class.cs.
11565 Handle IsGeneric here.
11567 Handle a variety of errors in the parameter info definition.
11569 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
11570 type parameters here.
11572 * cs-parser.jay (class_declaration): report errors for parameters
11575 2003-01-21 Miguel de Icaza <miguel@ximian.com>
11577 * generic.cs: New file, contains support code for generics.
11579 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
11580 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
11582 Update parser for the above removals.
11584 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
11585 now taken care of in the parser.
11587 2003-04-02 Miguel de Icaza <miguel@ximian.com>
11589 * class.cs (Event.Define): Do not allow abstract events to have
11592 2003-04-01 Miguel de Icaza <miguel@ximian.com>
11594 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
11595 block in event declarations.
11597 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
11598 value type, get its address.
11600 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
11601 leaving a class on the stack instead of a boolean value (int
11602 0/1). Change the code so we compare against null, and then the
11603 result against zero.
11605 * class.cs (TypeContainer.GetClassBases): We were checking for the
11606 parent class being sealed too late.
11608 * expression.cs (Binary.Emit): For <= and >= when dealing with
11609 floating point values, use cgt.un and clt.un instead of cgt and
11612 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
11614 * statement.cs: Apply the same optimization as MS: skip the
11615 GetEnumerator returning an IEnumerator, and use the one returning a
11616 CharEnumerator instead. This allows us to avoid the try-finally block
11619 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
11621 * cs-parser.jay: Attributes cannot be applied to
11622 namespaces. Fixes #40473
11624 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11627 (Add*): check if the name is valid using the full name for constants,
11628 fields, properties and events.
11630 2003-03-28 Miguel de Icaza <miguel@ximian.com>
11632 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
11633 char constants to be part of the enumeration.
11635 * expression.cs (Conditional.DoResolve): Add support for operator
11636 true. Implements the missing functionality from 14.12
11638 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
11639 operator true/false as required by the spec.
11641 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
11642 implicit conversion to boolean.
11644 * statement.cs (Statement.ResolveBoolean): A boolean expression is
11645 also one where the type implements `operator true'.
11647 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
11648 get an expression that will invoke operator true based on an
11651 (GetConversionOperators): Removed the hack that called op_True
11654 (Expression.ResolveBoolean): Move this from Statement.
11656 2003-03-17 Miguel de Icaza <miguel@ximian.com>
11658 * ecore.cs (FieldExpr): do not allow initialization of initonly
11659 fields on derived classes
11661 2003-03-13 Martin Baulig <martin@ximian.com>
11663 * statement.cs (Block.Emit): Call ig.BeginScope() and
11664 ig.EndScope() when compiling with debugging info; call
11665 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
11667 2003-03-08 Miguel de Icaza <miguel@ximian.com>
11669 * expression.cs (Indexers): Do not construct immediately, allow
11670 for new members to be appended as we go. Fixes 38143
11672 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11674 * expression.cs: save/restore context when resolving an unchecked
11677 2003-03-05 Miguel de Icaza <miguel@ximian.com>
11679 * cfold.cs: Catch division by zero in modulus operator during
11682 2003-03-03 Miguel de Icaza <miguel@ximian.com>
11684 * interface.cs (Interface.DefineMembers): Avoid defining members
11687 2003-02-27 Miguel de Icaza <miguel@ximian.com>
11689 * driver.cs: handle the +/- options for -noconfig
11691 * statement.cs (Unckeched.Resolve): Also track the state of
11692 unchecked in the Resolve phase.
11694 2003-02-27 Martin Baulig <martin@ximian.com>
11696 * ecore.cs (Expression.MemberLookup): Don't create a
11697 MethodGroupExpr for something which is not a method. Fixes #38291.
11699 2003-02-25 Miguel de Icaza <miguel@ximian.com>
11701 * class.cs (MemberBase.CheckParameters): Also check that the type
11702 is unmanaged if it is a pointer.
11704 * expression.cs (SizeOf.Resolve): Add location information.
11706 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
11707 a managed type is declared.
11709 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
11710 parameter modifiers as well. Fixes bug 38606
11712 * class.cs: Very sad. Am backing out the speed up changes
11713 introduced by the ArrayList -> Array in the TypeContainer, as they
11714 were not actually that much faster, and introduced a bug (no error
11715 reports on duplicated methods).
11717 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
11718 source first, this will guarantee that we have a valid expression
11719 before calling in lower levels functions that will require a
11720 resolved object. Then use this original_source in the
11721 target.ResolveLValue instead of the original source that was
11724 Another change. Use target.Resolve instead of LValueResolve.
11725 Although we are resolving for LValues, we will let the Assign code
11726 take care of that (it will be called again from Resolve). This
11727 basically allows code like this:
11729 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
11730 class Y { void A (X x) { x [0] += o; }
11732 The problem was that the indexer was trying to resolve for
11733 set_Item (idx, object o) and never finding one. The real set_Item
11734 was set_Item (idx, X). By delaying the process we get the right
11739 2003-02-23 Martin Baulig <martin@ximian.com>
11741 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
11742 while calling DoEmit ().
11744 * codegen.cs (EmitContext.Mark): Don't mark locations in other
11745 source files; if you use the #line directive inside a method, the
11746 compiler stops emitting line numbers for the debugger until it
11747 reaches the end of the method or another #line directive which
11748 restores the original file.
11750 2003-02-23 Martin Baulig <martin@ximian.com>
11752 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
11754 2003-02-23 Martin Baulig <martin@ximian.com>
11756 * statement.cs (Block.AddChildVariableNames): We need to call this
11757 recursively, not just for our immediate children.
11759 2003-02-23 Martin Baulig <martin@ximian.com>
11761 * class.cs (Event.Define): Always make the field private, like csc does.
11763 * typemanager.cs (TypeManager.RealMemberLookup): Make events
11764 actually work, fixes bug #37521.
11766 2003-02-23 Miguel de Icaza <miguel@ximian.com>
11768 * delegate.cs: When creating the various temporary "Parameters"
11769 classes, make sure that we call the ComputeAndDefineParameterTypes
11770 on those new parameters (just like we do with the formal ones), to
11771 allow them to be resolved in the context of the DeclSpace.
11773 This fixes the bug that Dick observed in Bugzilla #38530.
11775 2003-02-22 Miguel de Icaza <miguel@ximian.com>
11777 * expression.cs (ResolveMemberAccess): When resolving a constant,
11778 do not attempt to pull a constant if the value was not able to
11779 generate a valid constant.
11781 * const.cs (LookupConstantValue): Do not report more errors than required.
11783 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11785 * expression.cs: fixes bug #38328.
11787 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11789 * class.cs: Changed all the various members that can be part of a
11790 class from being an ArrayList to be an Array of the right type.
11791 During the DefineType type_list, interface_list, delegate_list and
11792 enum_list are turned into types, interfaces, delegates and enums
11795 And during the member population, indexer_list, event_list,
11796 constant_list, field_list, instance_constructor_list, method_list,
11797 operator_list and property_list are turned into their real arrays.
11799 Although we could probably perform this operation earlier, for
11800 good error reporting we need to keep the lists and remove the
11801 lists for longer than required.
11803 This optimization was triggered by Paolo profiling the compiler
11804 speed on the output of `gen-sample-program.pl' perl script.
11806 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
11807 not crash in methods like MemberLookupFailed that use this field.
11809 This problem arises when the compiler fails to resolve a type
11810 during interface type definition for example.
11812 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11814 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
11815 inherit from System.Object, so we have to stop at null, not only
11816 when reaching System.Object.
11818 2003-02-17 Miguel de Icaza <miguel@ximian.com>
11820 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
11821 DeclaredOnly because the parent indexer might have had a different
11822 name, but did not loop until the top of the hierarchy was reached.
11824 The problem this one fixes is 35492: when a class implemented an
11825 indexer from an interface, we were getting the interface method
11826 (which was abstract) and we were flagging an error (can not invoke
11829 This also keeps bug 33089 functioning, and test-148 functioning.
11831 * typemanager.cs (IsSpecialMethod): The correct way of figuring
11832 out if a method is special is to see if it is declared in a
11833 property or event, or whether it is one of the predefined operator
11834 names. This should fix correctly #36804.
11836 2003-02-15 Miguel de Icaza <miguel@ximian.com>
11838 The goal here is to remove the dependency on EmptyCast.Peel ().
11839 Killing it completely.
11841 The problem is that currently in a number of places where
11842 constants are expected, we have to "probe" for an EmptyCast, and
11843 Peel, which is not the correct thing to do, as this will be
11844 repetitive and will likely lead to errors.
11846 The idea is to remove any EmptyCasts that are used in casts that
11847 can be reduced to constants, so we only have to cope with
11850 This bug hunt was triggered by Bug 37363 and the desire to remove
11851 the duplicate pattern where we were "peeling" emptycasts to check
11852 whether they were constants. Now constants will always be
11855 * ecore.cs: Use an enumconstant here instead of wrapping with
11858 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
11859 throwing me off. By handling this we can get rid of a few hacks.
11861 * statement.cs (Switch): Removed Peel() code.
11863 2003-02-14 Miguel de Icaza <miguel@ximian.com>
11865 * class.cs: Location information for error 508
11867 * expression.cs (New.DoResolve): Add a guard against double
11868 resolution of an expression.
11870 The New DoResolve might be called twice when initializing field
11871 expressions (see EmitFieldInitializers, the call to
11872 GetInitializerExpression will perform a resolve on the expression,
11873 and later the assign will trigger another resolution
11875 This leads to bugs (#37014)
11877 * delegate.cs: The signature for EndInvoke should contain any ref
11878 or out parameters as well. We were not doing this in the past.
11880 * class.cs (Field.Define): Do not overwrite the type definition
11881 inside the `volatile' group. Turns out that volatile enumerations
11882 were changing the type here to perform a validity test, which
11885 2003-02-12 Miguel de Icaza <miguel@ximian.com>
11887 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
11888 and structs, we do not want to load the instance variable
11890 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
11891 enum_type has to be handled like an object reference (implicit
11892 conversions exists from this to object), but the regular IsClass
11893 and IsValueType tests will never return true for this one.
11895 Also we use TypeManager.IsValueType instead of type.IsValueType,
11896 just for consistency with the rest of the code (this is only
11897 needed if we ever use the construct exposed by test-180.cs inside
11898 corlib, which we dont today).
11900 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
11902 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
11905 2003-02-09 Martin Baulig <martin@ximian.com>
11907 * namespace.cs (Namespace..ctor): Added SourceFile argument.
11908 (Namespace.DefineNamespaces): New static public method; this is
11909 called when we're compiling with debugging to add all namespaces
11910 to the symbol file.
11912 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
11913 pass it to the Namespace's .ctor.
11915 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
11916 and MethodBase arguments; pass the namespace ID to the symwriter;
11917 pass the MethodBase instead of the token to the symwriter.
11918 (SymbolWriter.DefineNamespace): New method to add a namespace to
11921 2003-02-09 Martin Baulig <martin@ximian.com>
11923 * symbolwriter.cs: New file. This is a wrapper around
11924 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
11925 methods here in near future.
11927 2003-02-09 Martin Baulig <martin@ximian.com>
11929 * codegen.cs (EmitContext.Mark): Just pass the arguments to
11930 ILGenerator.MarkSequencePoint() which are actually used by the
11933 2003-02-09 Martin Baulig <martin@ximian.com>
11935 * location.cs (SourceFile): New public sealed class. This
11936 contains the name and an index which is used in the location's token.
11937 (Location): Reserve an appropriate number of bits in the token for
11938 the source file instead of walking over that list, this gives us a
11939 really huge performance improvement when compiling with debugging.
11941 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
11942 `SourceFile' argument instead of a string.
11943 (Driver.ProcessFile): Add all the files via Location.AddFile(),
11944 but don't parse/tokenize here, we need to generate the list of all
11945 source files before we do that.
11946 (Driver.ProcessFiles): New static function. Parses/tokenizes all
11949 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
11950 instead of a string.
11952 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
11955 2003-02-09 Martin Baulig <martin@ximian.com>
11957 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
11958 filename on `#line default'.
11960 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
11962 * statement.cs: don't clear the pinned var when the fixed statement
11963 returns from the method (fixes bug#37752).
11965 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
11967 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
11970 2003-02-07 Martin Baulig <martin@ximian.com>
11972 * driver.cs: Removed the `--debug-args' command line argument.
11974 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
11975 automatically by the AsssemblyBuilder.
11976 (CodeGen.InitializeSymbolWriter): We don't need to call any
11977 initialization function on the symbol writer anymore. This method
11978 doesn't take any arguments.
11980 2003-02-03 Miguel de Icaza <miguel@ximian.com>
11982 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
11983 from referenced assemblies as well.
11985 2003-02-02 Martin Baulig <martin@ximian.com>
11987 * class.cs (MethodData.Emit): Generate debugging info for external methods.
11989 2003-02-02 Martin Baulig <martin@ximian.com>
11991 * class.cs (Constructor.Emit): Open the symbol writer before
11992 emitting the constructor initializer.
11993 (ConstructorInitializer.Emit): Call ec.Mark() to allow
11994 single-stepping through constructor initializers.
11996 2003-01-30 Miguel de Icaza <miguel@ximian.com>
11998 * class.cs: Handle error 549: do not allow virtual methods in
12001 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
12003 * decl.cs: Check access levels when resolving types
12005 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
12007 * statement.cs: Add parameters and locals set in catch blocks that might
12008 return to set vector
12010 2003-01-29 Miguel de Icaza <miguel@ximian.com>
12012 * class.cs (Operator): Set the SpecialName flags for operators.
12014 * expression.cs (Invocation.DoResolve): Only block calls to
12015 accessors and operators on SpecialName methods.
12017 (Cast.TryReduce): Handle conversions from char constants.
12020 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
12022 * statement.cs: small memory and time optimization in FlowBranching.
12024 2003-01-28 Pedro Mart <yoros@wanadoo.es>
12026 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
12027 problem that the last fix but in the other sid (Set).
12029 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
12030 access when there is no indexer in the hierarchy.
12032 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
12034 * class.cs: Combine some if statements.
12036 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12038 * driver.cs: fixed bug #37187.
12040 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
12042 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
12043 any indexer, it's needed to build a list with all the indexers in the
12044 hierarchy (AllGetters), else we have problems. Fixes #35653.
12046 2003-01-23 Miguel de Icaza <miguel@ximian.com>
12048 * class.cs (MethodData.Define): It is wrong for an interface
12049 implementation to be static in both cases: explicit and implicit.
12050 We were only handling this in one case.
12052 Improve the if situation there to not have negations.
12054 * class.cs (Field.Define): Turns out that we do not need to check
12055 the unsafe bit on field definition, only on usage. Remove the test.
12057 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12059 * driver.cs: use assembly.Location instead of Codebase (the latest
12060 patch made mcs fail when using MS assemblies).
12062 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
12064 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
12065 get the path to *corlib.dll.
12067 2003-01-21 Nick Drochak <ndrochak@gol.com>
12071 * typemanager.cs: Remove compiler warnings
12073 2003-01-20 Duncan Mak <duncan@ximian.com>
12075 * AssemblyInfo.cs: Bump the version number to 0.19.
12077 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12079 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
12081 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
12083 * class.cs (Constructor::Emit): Emit debugging info for constructors.
12085 2003-01-17 Miguel de Icaza <miguel@ximian.com>
12087 * cs-parser.jay: Small fix: we were not comparing the constructor
12088 name correctly. Thanks to Zoltan for the initial pointer.
12090 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
12092 * cs-tokenizer.cs: Set file name when specified with #line
12094 2003-01-15 Miguel de Icaza <miguel@ximian.com>
12096 * cs-parser.jay: Only perform the constructor checks here if we
12097 are named like the class; This will help provider a better
12098 error. The constructor path is taken when a type definition is
12099 not found, but most likely the user forgot to add the type, so
12100 report that rather than the constructor error.
12102 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
12104 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
12107 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
12109 * cs-parser.jay: Add cleanup call.
12111 2003-01-13 Duncan Mak <duncan@ximian.com>
12113 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
12114 consistent with other methods.
12116 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
12118 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
12120 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
12122 * attribute.cs: only set GuidAttr to true when we have a
12125 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12129 * typemanager.cs: fixes to allow mcs compile corlib with the new
12130 Type.IsSubclassOf fix.
12132 2003-01-08 Miguel de Icaza <miguel@ximian.com>
12134 * expression.cs (LocalVariableReference.DoResolve): Classify a
12135 constant as a value, not as a variable. Also, set the type for
12138 * cs-parser.jay (fixed_statement): take a type instead of a
12139 pointer_type, so we can produce a better error message later.
12141 * statement.cs (Fixed.Resolve): Flag types that are not pointers
12144 (For.DoEmit): Make inifinite loops have a
12145 non-conditional branch back.
12147 (Fixed.DoEmit): First populate the pinned variables, then emit the
12148 statement, then clear the variables. Before I was emitting the
12149 code once for each fixed piece.
12152 2003-01-08 Martin Baulig <martin@ximian.com>
12154 * statement.cs (FlowBranching.MergeChild): A break in a
12155 SWITCH_SECTION does not leave a loop. Fixes #36155.
12157 2003-01-08 Martin Baulig <martin@ximian.com>
12159 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
12160 lives in the same number space than `param_map'. Fixes #36154.
12162 2003-01-07 Miguel de Icaza <miguel@ximian.com>
12164 * cs-parser.jay (constructor_declaration): Set the
12165 Constructor.ModFlags before probing for it. This makes the
12166 compiler report 514, 515 and 132 (the code was there, but got
12169 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
12170 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
12171 (GotoCase.Resolve): Set `Returns' to ALWAYS.
12173 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
12175 * enum.cs: create the enum static fields using the enum type.
12177 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
12179 * class.cs: don't try to create the ParamBuilder for the return
12180 type if it's not needed (and handle it breaking for the ms runtime
12183 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
12185 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
12187 2002-12-29 Miguel de Icaza <miguel@ximian.com>
12189 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
12190 the command. This showed up while compiling the JANET source
12191 code, which used \r as its only newline separator.
12193 2002-12-28 Miguel de Icaza <miguel@ximian.com>
12195 * class.cs (Method.Define): If we are an operator (because it
12196 reuses our code), then set the SpecialName and HideBySig. #36128
12198 2002-12-22 Miguel de Icaza <miguel@ximian.com>
12200 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
12201 exception, report error 120 `object reference required'.
12203 * driver.cs: Add --pause option, used during to measure the size
12204 of the process as it goes with --timestamp.
12206 * expression.cs (Invocation.DoResolve): Do not allow methods with
12207 SpecialName to be invoked.
12209 2002-12-21 Miguel de Icaza <miguel@ximian.com>
12211 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
12212 number before adding it.
12214 2002-12-21 Ravi Pratap <ravi@ximian.com>
12216 * ecore.cs (StandardImplicitConversion): When in an unsafe
12217 context, we allow conversion between void * to any other pointer
12218 type. This fixes bug #35973.
12220 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
12222 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
12223 is not thrown when extensionless outputs are used
12225 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12227 * rootcontext.cs: fixed compilation of corlib.
12229 2002-12-19 Miguel de Icaza <miguel@ximian.com>
12231 * attribute.cs (Attributes.Contains): Add new method.
12233 * class.cs (MethodCore.LabelParameters): if the parameter is an
12234 `out' parameter, check that no attribute `[In]' has been passed.
12236 * enum.cs: Handle the `value__' name in an enumeration.
12238 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
12240 * decl.cs: Added special case to allow overrides on "protected
12243 2002-12-18 Ravi Pratap <ravi@ximian.com>
12245 * attribute.cs (Attributes.AddAttributeSection): Rename to this
12246 since it makes much more sense.
12248 (Attributes.ctor): Don't require a Location parameter.
12250 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
12252 * attribute.cs (ApplyAttributes): Remove extra Location parameters
12253 since we already have that information per attribute.
12255 * everywhere : make appropriate changes.
12257 * class.cs (LabelParameters): Write the code which actually
12258 applies attributes to the return type. We can't do this on the MS
12259 .NET runtime so we flag a warning in the case an exception is
12262 2002-12-18 Miguel de Icaza <miguel@ximian.com>
12264 * const.cs: Handle implicit null conversions here too.
12266 2002-12-17 Ravi Pratap <ravi@ximian.com>
12268 * class.cs (MethodCore.LabelParameters): Remove the extra
12269 Type [] parameter since it is completely unnecessary. Instead
12270 pass in the method's attributes so that we can extract
12271 the "return" attribute.
12273 2002-12-17 Miguel de Icaza <miguel@ximian.com>
12275 * cs-parser.jay (parse): Use Report.Error to flag errors instead
12276 of ignoring it and letting the compile continue.
12278 * typemanager.cs (ChangeType): use an extra argument to return an
12279 error condition instead of throwing an exception.
12281 2002-12-15 Miguel de Icaza <miguel@ximian.com>
12283 * expression.cs (Unary.TryReduce): mimic the code for the regular
12284 code path. Perform an implicit cast in the cases where we can
12285 implicitly convert to one of the integral types, and then reduce
12286 based on that constant. This fixes bug #35483.
12288 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12290 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
12292 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12294 * namespace.cs: fixed bug #35489.
12296 2002-12-12 Miguel de Icaza <miguel@ximian.com>
12298 * class.cs: Remove some dead code.
12300 * cs-parser.jay: Estimate the number of methods needed
12301 (RootContext.MethodCount);
12303 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
12304 numbers instead of StringBuilders.
12306 * support.cs (PtrHashtable): Add constructor with initial size;
12307 We can now reduce reallocations of the method table.
12309 2002-12-10 Ravi Pratap <ravi@ximian.com>
12311 * attribute.cs (ApplyAttributes): Keep track of the emitted
12312 attributes on a per-target basis. This fixes bug #35413.
12314 2002-12-10 Miguel de Icaza <miguel@ximian.com>
12316 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
12317 default to the Windows 1252 encoding.
12319 (UnixParseOption): Support version, thanks to Alp for the missing
12322 * AssemblyInfo.cs: Add nice assembly information.
12324 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
12327 * cs-parser.jay: Allow a trailing comma before the close bracked
12328 in the attribute_section production.
12330 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
12331 address of the instance was being taken, I will take this out,
12332 because we take the address of the object immediately here.
12334 2002-12-09 Ravi Pratap <ravi@ximian.com>
12336 * typemanager.cs (AreMultipleAllowed): Take care of the most
12337 obvious case where attribute type is not in the current assembly -
12340 2002-12-08 Miguel de Icaza <miguel@ximian.com>
12342 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
12343 definitions, instead of doing that afterwards.
12345 Also we use a nice little hack, depending on the constructor, we
12346 know if we are a "composed" name or a simple name. Hence, we
12347 avoid the IndexOf test, and we avoid
12349 * codegen.cs: Add code to assist in a bug reporter to track down
12350 the source of a compiler crash.
12352 2002-12-07 Ravi Pratap <ravi@ximian.com>
12354 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
12355 types have been emitted for a given element and flag an error
12356 if something which does not have AllowMultiple set is used more
12359 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
12360 attribute types and their corresponding AllowMultiple properties
12362 (AreMultipleAllowed): Check the property for a given type.
12364 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
12365 property in the case we have a TypeContainer.
12367 (Attributes.AddAttribute): Detect duplicates and just skip on
12368 adding them. This trivial fix catches a pretty gross error in our
12369 attribute emission - global attributes were being emitted twice!
12371 Bugzilla bug #33187 is now fixed.
12373 2002-12-06 Miguel de Icaza <miguel@ximian.com>
12375 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
12376 instead of pp_and).
12378 * expression.cs (Binary.ResolveOperator): I can only use the
12379 Concat (string, string, string) and Concat (string, string,
12380 string, string) if the child is actually a concatenation of
12383 2002-12-04 Miguel de Icaza <miguel@ximian.com>
12385 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
12386 context where we need a 2-character lookahead.
12388 * pending.cs (PendingImplementation): Rework so we can keep track
12389 of interface types all the time, and flag those which were
12390 implemented by parents as optional.
12392 2002-12-03 Miguel de Icaza <miguel@ximian.com>
12394 * expression.cs (Binary.ResolveOperator): Use
12395 String.Concat(string,string,string) or
12396 String.Concat(string,string,string,string) when possible.
12398 * typemanager: More helper methods.
12401 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
12403 * pending.cs: remove the bogus return from GetMissingInterfaces()
12404 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
12406 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12408 * namespace.cs: avoid duplicated 'using xxx' being added to
12409 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
12410 when we get more than one 'using' statement for the same namespace.
12411 Report a CS0105 warning for it.
12413 2002-11-30 Miguel de Icaza <miguel@ximian.com>
12415 * cs-tokenizer.cs (consume_identifier): use read directly, instead
12416 of calling getChar/putback, uses internal knowledge of it.
12418 (xtoken): Reorder tokenizer so most common patterns are checked
12419 first. This reduces the compilation time in another 5% (from 8.11s
12420 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
12422 The parsing time is 22% of the compilation in mcs, and from that
12423 64% is spent on the tokenization process.
12425 I tried using a binary search for keywords, but this is slower
12426 than the hashtable. Another option would be to do a couple of
12429 * Not use a StringBuilder, instead use an array of chars,
12430 with a set value. Notice that this way we could catch
12431 the 645 error without having to do it *afterwards*.
12433 * We could write a hand-parser to avoid the hashtable
12434 compares altogether.
12436 The identifier consumption process takes 37% of the tokenization
12437 time. Another 15% is spent on is_number. 56% of the time spent
12438 on is_number is spent on Int64.Parse:
12440 * We could probably choose based on the string length to
12441 use Int32.Parse or Int64.Parse and avoid all the 64-bit
12444 Another 3% is spend on wrapping `xtoken' in the `token' function.
12446 Handle 0xa0 as whitespace (#34752)
12448 2002-11-26 Miguel de Icaza <miguel@ximian.com>
12450 * typemanager.cs (IsCLRType): New routine to tell whether a type
12451 is one of the builtin types.
12453 Maybe it needs to use TypeCodes to be faster. Maybe we could use
12454 typecode in more places instead of doing pointer comparissions.
12455 We could leverage some knowledge about the way the typecodes are
12458 New code to cache namespaces in assemblies, it is currently not
12459 invoked, to be used soon.
12461 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
12463 * expression.cs (Binary.ResolveOperator): specially handle
12464 strings, and do not perform user-defined operator overloading for
12467 2002-11-24 Miguel de Icaza <miguel@ximian.com>
12469 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
12470 internalcall as it is a pretty simple operation; Avoid whenever
12471 possible to call Char.IsLetter.
12473 (consume_identifier): Cut by half the number of
12474 hashtable calls by merging the is_keyword and GetKeyword behavior.
12476 Do not short-circuit, because if we do, we
12477 report errors (ie, #if false && true would produce an invalid
12481 2002-11-24 Martin Baulig <martin@ximian.com>
12483 * expression.cs (Cast.TryReduce): If we're in checked syntax,
12484 check constant ranges and report a CS0221. Fixes #33186.
12486 2002-11-24 Martin Baulig <martin@ximian.com>
12488 * cs-parser.jay: Make this work for uninitialized variable
12489 declarations in the `for' initializer. Fixes #32416.
12491 2002-11-24 Martin Baulig <martin@ximian.com>
12493 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
12494 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
12496 2002-11-24 Martin Baulig <martin@ximian.com>
12498 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
12499 argument; if true, we also check for user-defined conversions.
12500 This is only needed if both arguments are of a user-defined type.
12501 Fixes #30443, added test-175.cs.
12502 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
12504 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
12506 2002-11-24 Martin Baulig <martin@ximian.com>
12508 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
12509 function to get the store opcode.
12510 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
12511 only emit the Ldelema if the store opcode is Stobj. You must run
12512 both test-34 and test-167 to test this. Fixes #34529.
12514 2002-11-23 Martin Baulig <martin@ximian.com>
12516 * ecore.cs (Expression.MemberLookup): Added additional
12517 `qualifier_type' argument which is used when we're being called
12518 from MemberAccess.DoResolve() and null if we're called from a
12520 (Expression.MemberLookupFailed): New method to report errors; this
12521 does the CS1540 check and reports the correct error message.
12523 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
12524 argument for the CS1540 check and redone the way how we're dealing
12525 with private members. See the comment in the source code for details.
12526 (FilterWithClosure): Reverted this back to revision 1.197; renamed
12527 `closure_start_type' to `closure_qualifier_type' and check whether
12528 it's not null. It was not this filter being broken, it was just
12529 being called with the wrong arguments.
12531 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
12532 and pass it the correct `qualifier_type'; this also does the error
12535 2002-11-22 Miguel de Icaza <miguel@ximian.com>
12537 * expression.cs (Invocation.EmitParams): If the we are dealing
12538 with a non-built-in value type, load its address as well.
12540 (ArrayCreation): Use a a pretty constant instead
12541 of the hardcoded value 2. Use 6 instead of 2 for the number of
12542 static initializers.
12544 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
12545 because they are not really value types, just glorified integers.
12547 * driver.cs: Do not append .exe, the CSC compiler does not do it.
12549 * ecore.cs: Remove redundant code for enumerations, make them use
12550 the same code path as everything else, fixes the casting issue
12551 with enumerations in Windows.Forms.
12553 * attribute.cs: Do only cast to string if it is a string, the
12554 validation happens later.
12556 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
12557 people upgrade their corlibs.
12559 * ecore.cs: Oops, enumerations were not following the entire code path
12561 2002-11-21 Miguel de Icaza <miguel@ximian.com>
12563 * typemanager.cs (FilterWithClosure): Commented out the test for
12564 1540 in typemanager.cs, as it has problems when accessing
12565 protected methods from a parent class (see test-174.cs).
12567 * attribute.cs (Attribute.ValidateGuid): new method.
12568 (Attribute.Resolve): Use above.
12570 2002-11-19 Miguel de Icaza <miguel@ximian.com>
12572 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
12574 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
12575 handling for enumerations, as we only needed the TypeContainer
12576 functionality to begin with (this is required for the fix below to
12577 work for enums that reference constants in a container class for
12580 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
12582 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
12583 a valid TypeBuilder to perform lookups on.o
12585 * class.cs (InheritableMemberSignatureCompare): Use true in the
12586 call to GetGetMethod and GetSetMethod, because we are comparing
12587 the signature, and we need to get the methods *even* if they are
12590 (PropertyBase.CheckBase): ditto.
12592 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
12593 GotoCase.Resolve): Use Peel on EmpytCasts.
12595 * ecore.cs (EmptyCast): drop child, add Peel method.
12597 2002-11-17 Martin Baulig <martin@ximian.com>
12599 * ecore.cs (EmptyCast.Child): New public property.
12601 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
12602 label resolved to an EmptyCast. Fixes #34162.
12603 (GotoCase.Resolve): Likewise.
12604 (Block.EmitMeta): Likewise.
12606 2002-11-17 Martin Baulig <martin@ximian.com>
12608 * expression.cs (Invocation.BetterConversion): Prefer int over
12609 uint; short over ushort; long over ulong for integer literals.
12610 Use ImplicitConversionExists instead of StandardConversionExists
12611 since we also need to check for user-defined implicit conversions.
12612 Fixes #34165. Added test-173.cs.
12614 2002-11-16 Martin Baulig <martin@ximian.com>
12616 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
12617 with the `true' and `false' literals. Fixes #33151.
12619 2002-11-16 Martin Baulig <martin@ximian.com>
12621 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
12622 October 22nd; don't do the cs1540 check for static members.
12624 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
12625 now using our own filter here and doing the cs1540 check again.
12627 2002-11-16 Martin Baulig <martin@ximian.com>
12629 * support.cs (InternalParameters): Don't crash if we don't have
12630 any fixed parameters. Fixes #33532.
12632 2002-11-16 Martin Baulig <martin@ximian.com>
12634 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
12635 when looking up static methods to make this work on Windows.
12638 2002-11-16 Martin Baulig <martin@ximian.com>
12640 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
12641 a setter rather than using PropertyInfo.CanWrite.
12643 2002-11-15 Nick Drochak <ndrochak@gol.com>
12645 * class.cs: Allow acces to block member by subclasses. Fixes build
12648 2002-11-14 Martin Baulig <martin@ximian.com>
12650 * class.cs (Constructor.Emit): Added the extern/block check.
12653 2002-11-14 Martin Baulig <martin@ximian.com>
12655 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
12656 iteration while looking for indexers, this is needed because the
12657 indexer may have a different name in our base classes. Fixed the
12658 error reporting (no indexers at all, not get accessor, no
12659 overloaded match). Fixes bug #33089.
12660 (IndexerAccess.DoResolveLValue): Likewise.
12662 2002-11-14 Martin Baulig <martin@ximian.com>
12664 * class.cs (PropertyBase.CheckBase): Make this work for multiple
12665 indexers. Fixes the first part of bug #33089.
12666 (MethodSignature.InheritableMemberSignatureCompare): Added support
12669 2002-11-13 Ravi Pratap <ravi@ximian.com>
12671 * attribute.cs (Attribute.Resolve): Catch the
12672 NullReferenceException and report it since it isn't supposed to
12675 2002-11-12 Miguel de Icaza <miguel@ximian.com>
12677 * expression.cs (Binary.EmitBranchable): Also handle the cases for
12678 LogicalOr and LogicalAnd that can benefit from recursively
12679 handling EmitBranchable. The code now should be nice for Paolo.
12681 2002-11-08 Miguel de Icaza <miguel@ximian.com>
12683 * typemanager.cs (LookupType): Added a negative-hit hashtable for
12684 the Type lookups, as we perform quite a number of lookups on
12685 non-Types. This can be removed once we can deterministically tell
12686 whether we have a type or a namespace in advance.
12688 But this might require special hacks from our corlib.
12692 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
12693 and double which avoids a conversion from an integer to a double.
12695 * expression.cs: tiny optimization, avoid calling IsConstant,
12696 because it effectively performs the lookup twice.
12698 2002-11-06 Miguel de Icaza <miguel@ximian.com>
12700 But a bogus return here to keep the semantics of the old code
12701 until the Mono runtime is fixed.
12703 * pending.cs (GetMissingInterfaces): New method used to remove all
12704 the interfaces that are already implemented by our parent
12705 classes from the list of pending methods.
12707 * interface.cs: Add checks for calls after ResolveTypeExpr.
12709 2002-11-05 Miguel de Icaza <miguel@ximian.com>
12711 * class.cs (Class.Emit): Report warning 67: event not used if the
12712 warning level is beyond 3.
12714 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
12715 being a NullLiteral.
12717 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
12720 * class.cs (TypeContainer.GetClassBases): Cover a missing code
12721 path that might fail if a type can not be resolved.
12723 * expression.cs (Binary.Emit): Emit unsigned versions of the
12726 * driver.cs: use error 5.
12728 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
12730 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
12732 2002-11-01 Miguel de Icaza <miguel@ximian.com>
12734 * cs-parser.jay (switch_section): A beautiful patch from Martin
12735 Baulig that fixed 33094.
12737 2002-10-31 Miguel de Icaza <miguel@ximian.com>
12739 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
12740 Check whether the base is abstract and report an error if so.
12742 * expression.cs (IndexerAccess.DoResolveLValue,
12743 IndexerAccess.DoResolve): ditto.
12745 (Invocation.DoResolve): ditto.
12747 (Invocation.FullMethodDesc): Improve the report string.
12749 * statement.cs (Block): Eliminate IsVariableDefined as it is
12750 basically just a wrapper for GetVariableInfo.
12752 * ecore.cs (SimpleName): Use new
12754 * support.cs (ReflectionParamter.ParameterType): We unwrap the
12755 type, as we return the actual parameter ref/unref state on a
12758 2002-10-30 Miguel de Icaza <miguel@ximian.com>
12760 * support.cs: Return proper flags REF/OUT fixing the previous
12763 * expression.cs: Reverted last patch, that was wrong. Is_ref is
12764 not used to mean `ref' but `ref or out' in ParameterReference
12766 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
12767 full type signature instead of calling TypeManger.CSharpName
12770 * support.cs (InternalParameters.ParameterDesc): Do not compare
12771 directly to the modflags, because REF/OUT will actually be bitsets
12774 * delegate.cs (VerifyMethod): Check also the modifiers.
12776 * cs-tokenizer.cs: Fix bug where floating point values with an
12777 exponent where a sign was missing was ignored.
12779 * driver.cs: Allow multiple assemblies to be specified in a single
12782 2002-10-28 Miguel de Icaza <miguel@ximian.com>
12784 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
12785 because identifiers after a parenthesis would end up in this kind
12786 of production, and we needed to desamiguate it for having casts
12789 (UserDefinedType *) xxx
12791 2002-10-24 Miguel de Icaza <miguel@ximian.com>
12793 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
12794 we should set on the Bindingflags.NonPublic, but not turn on
12795 private_ok. private_ok controls whether a Private member is
12796 returned (this is chekced on the filter routine), while the
12797 BindingFlags.NonPublic just controls whether private/protected
12798 will be allowed. This fixes the problem part of the problem of
12799 private properties being allowed to be used in derived classes.
12801 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
12802 so we can call the children DoResolveLValue method (this will
12803 properly signal errors on lvalue assignments to base properties)
12805 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
12806 getter are null, and we have a property info, we know that this
12807 happened because the lookup failed, so we report an error 122 for
12808 protection level violation.
12810 We also silently return if setter and getter are null in the
12811 resolve functions, this condition only happens if we have flagged
12812 the error before. This is the other half of the problem.
12814 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
12815 not have accessibility information, that is why we were returning
12816 true in the filter function in typemanager.cs.
12818 To properly report 122 (property is inaccessible because of its
12819 protection level) correctly, we report this error in ResolveAccess
12820 by failing if both the setter and the getter are lacking (ie, the
12823 DoResolve and DoLResolve have been modified to check for both
12824 setter/getter being null and returning silently, the reason being
12825 that I did not want to put the knowledge about this error in upper
12828 int old = Report.Errors;
12829 x = new PropertyExpr (...);
12830 if (old != Report.Errors)
12835 So the property expr is returned, but it is invalid, so the error
12836 will be flagged during the resolve process.
12838 * class.cs: Remove InheritablePropertySignatureCompare from the
12839 class, as we no longer depend on the property signature to compute
12840 whether it is possible to implement a method or not.
12842 The reason is that calling PropertyInfo.GetGetMethod will return
12843 null (in .NET, in Mono it works, and we should change this), in
12844 cases where the Get Method does not exist in that particular
12849 class X { public virtual int A { get { return 1; } } }
12851 class Z : Y { public override int A { get { return 2; } } }
12853 Would fail in Z because the parent (Y) would not have the property
12854 defined. So we avoid this completely now (because the alternative
12855 fix was ugly and slow), and we now depend exclusively on the
12858 (PropertyBase.CheckBase): Use a method-base mechanism to find our
12859 reference method, instead of using the property.
12861 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
12862 routines are gone now.
12864 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
12865 names, they were incorrectly named.
12867 * cs-tokenizer.cs: Return are more gentle token on failure.
12869 * pending.cs (PendingImplementation.InterfaceMethod): This routine
12870 had an out-of-sync index variable, which caused it to remove from
12871 the list of pending methods the wrong method sometimes.
12873 2002-10-22 Miguel de Icaza <miguel@ximian.com>
12875 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
12876 CanWrite, because those refer to this particular instance of the
12877 property, and do not take into account the fact that we can
12878 override single members of a property.
12880 Constructor requires an EmitContext. The resolution process does
12881 not happen here, but we need to compute the accessors before,
12882 because the resolution does not always happen for properties.
12884 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
12885 subclass, before we did not update this flag, but we did update
12888 (GetAccessors): Drop this routine, as it did not work in the
12889 presence of partially overwritten set/get methods.
12891 Notice that this broke the cs1540 detection, but that will require
12894 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12898 * driver.cs: issue a warning instead of an error if we don't support
12899 debugging for the platform. Also ignore a couple of errors that may
12900 arise when trying to write the symbols. Undo my previous patch.
12902 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12904 * driver.cs: ignore /debug switch except for Unix platforms.
12906 2002-10-23 Nick Drochak <ndrochak@gol.com>
12908 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
12910 2002-10-21 Miguel de Icaza <miguel@ximian.com>
12912 * driver.cs: Do not make mcs-debug conditional, so we do not break
12913 builds that use it.
12915 * statement.cs (UsageVector.MergeChildren): I would like Martin to
12916 review this patch. But basically after all the children variables
12917 have been merged, the value of "Breaks" was not being set to
12918 new_breaks for Switch blocks. I think that it should be set after
12919 it has executed. Currently I set this to the value of new_breaks,
12920 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
12921 conservative, but I do not understand this code very well.
12923 I did not break anything in the build, so that is good ;-)
12925 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
12927 2002-10-20 Mark Crichton <crichton@gimp.org>
12929 * cfold.cs: Fixed compile blocker. Really fixed it this time.
12931 2002-10-20 Nick Drochak <ndrochak@gol.com>
12933 * cfold.cs: Fixed compile blocker.
12935 2002-10-20 Miguel de Icaza <miguel@ximian.com>
12937 * driver.cs: I was chekcing the key, not the file.
12939 2002-10-19 Ravi Pratap <ravi@ximian.com>
12941 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
12942 message that we were generating - we just need to silently return
12945 2002-10-19 Miguel de Icaza <miguel@ximian.com>
12947 * class.cs (Event.Define): Change my previous commit, as this
12948 breaks the debugger. This is a temporary hack, as it seems like
12949 the compiler is generating events incorrectly to begin with.
12951 * expression.cs (Binary.ResolveOperator): Added support for
12952 "U operator - (E x, E y)"
12954 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
12957 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
12958 init-only variables, but this path did not take into account that
12959 there might be also instance readonly variables. Correct this
12962 This fixes bug 32253
12964 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
12967 * driver.cs: Change the extension for modules to `netmodule'
12969 * cs-parser.jay: Improved slightly the location tracking for
12970 the debugger symbols.
12972 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
12973 modifiers that were specified instead of the hardcoded value
12974 (FamAndAssem). This was basically ignoring the static modifier,
12975 and others. Fixes 32429.
12977 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
12978 fixed a bug in the process (32476)
12980 * expression.cs (ArrayAccess.EmitAssign): Patch from
12981 hwang_rob@yahoo.ca that fixes bug 31834.3
12983 2002-10-18 Miguel de Icaza <miguel@ximian.com>
12985 * driver.cs: Make the module extension .netmodule.
12987 2002-10-16 Miguel de Icaza <miguel@ximian.com>
12989 * driver.cs: Report an error if the resource file is not found
12990 instead of crashing.
12992 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
12993 false, like Emit does.
12995 2002-10-16 Nick Drochak <ndrochak@gol.com>
12997 * typemanager.cs: Remove unused private member. Also reported mcs
12998 bug to report this as a warning like csc.
13000 2002-10-15 Martin Baulig <martin@gnome.org>
13002 * statement.cs (Statement.Emit): Made this a virtual method; emits
13003 the line number info and calls DoEmit().
13004 (Statement.DoEmit): New protected abstract method, formerly knows
13005 as Statement.Emit().
13007 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
13009 2002-10-11 Miguel de Icaza <miguel@ximian.com>
13011 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
13012 have fixed a remaining problem: not every AddXXXX was adding a
13013 fully qualified name.
13015 Now everyone registers a fully qualified name in the DeclSpace as
13016 being defined instead of the partial name.
13018 Downsides: we are slower than we need to be due to the excess
13019 copies and the names being registered this way.
13021 The reason for this is that we currently depend (on the corlib
13022 bootstrap for instance) that types are fully qualified, because
13023 we dump all the types in the namespace, and we should really have
13024 types inserted into the proper namespace, so we can only store the
13025 basenames in the defined_names array.
13027 2002-10-10 Martin Baulig <martin@gnome.org>
13029 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
13030 from bug #31834, see the bug report for a testcase which is
13033 2002-10-10 Martin Baulig <martin@gnome.org>
13035 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
13036 flow analysis code for this.
13038 * statement.cs (Do, While, For): Tell the flow analysis code about
13040 (FlowBranching.UsageVector): Added support for infinite loops.
13041 (Block.Resolve): Moved the dead code elimination here and use flow
13044 2002-10-09 Miguel de Icaza <miguel@ximian.com>
13046 * class.cs (Field.Define): Catch cycles on struct type
13049 * typemanager.cs (IsUnmanagedtype): Do not recursively check
13050 fields if the fields are static. We only need to check instance
13053 * expression.cs (As.DoResolve): Test for reference type.
13055 * statement.cs (Using.ResolveExpression): Use
13056 ConvertImplicitRequired, not ConvertImplicit which reports an
13058 (Using.ResolveLocalVariableDecls): ditto.
13060 * expression.cs (Binary.ResolveOperator): Report errors in a few
13061 places where we had to.
13063 * typemanager.cs (IsUnmanagedtype): Finish implementation.
13065 2002-10-08 Miguel de Icaza <miguel@ximian.com>
13067 * expression.cs: Use StoreFromPtr instead of extracting the type
13068 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
13070 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
13071 an enumeration value to a System.Enum, but System.Enum is not a
13072 value type, but an class type, so we need to box.
13074 (Expression.ConvertExplicit): One codepath could return
13075 errors but not flag them. Fix this. Fixes #31853
13077 * parameter.cs (Resolve): Do not allow void as a parameter type.
13079 2002-10-06 Martin Baulig <martin@gnome.org>
13081 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
13082 if it's a class type and not a struct. Fixes #31815.
13084 2002-10-06 Martin Baulig <martin@gnome.org>
13086 * statement.cs: Reworked the flow analysis code a bit to make it
13087 usable for dead code elimination.
13089 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13091 * cs-parser.jay: allow empty source files. Fixes bug #31781.
13093 2002-10-04 Miguel de Icaza <miguel@ximian.com>
13095 * expression.cs (ComposedCast.DoResolveType): A quick workaround
13096 to fix the test 165, will investigate deeper.
13098 2002-10-04 Martin Baulig <martin@gnome.org>
13100 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
13101 finally blocks actually work.
13102 (Try.Resolve): We don't need to create a sibling for `finally' if
13103 there is no finally block.
13105 2002-10-04 Martin Baulig <martin@gnome.org>
13107 * class.cs (Constructor.Define): The default accessibility for a
13108 non-default constructor is private, not public.
13110 2002-10-04 Miguel de Icaza <miguel@ximian.com>
13112 * class.cs (Constructor): Make AllowedModifiers public, add
13115 * cs-parser.jay: Perform the modifiers test here, as the
13116 constructor for the Constructor class usually receives a zero
13117 because of the way we create it (first we create, later we
13118 customize, and we were never checking the modifiers).
13120 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
13121 is a version of LookupTypeReflection that includes the type-name
13122 cache. This can be used as a fast path for functions that know
13123 the fully qualified name and are only calling into *.GetType() to
13124 obtain a composed type.
13126 This is also used by TypeManager.LookupType during its type
13129 (LookupType): We now also track the real type name, as sometimes
13130 we can get a quey for the real type name from things like
13131 ComposedCast. This fixes bug 31422.
13133 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
13134 complete type fullname, it does not have to go through the type
13135 resolution system to obtain the composed version of the type (for
13136 obtaining arrays or pointers).
13138 (Conditional.Emit): Use the EmitBoolExpression to
13139 generate nicer code, as requested by Paolo.
13141 (ArrayCreation.CheckIndices): Use the patch from
13142 hwang_rob@yahoo.ca to validate the array initializers.
13144 2002-10-03 Miguel de Icaza <miguel@ximian.com>
13146 * class.cs (ConstructorInitializer.Emit): simplify code by using
13147 Invocation.EmitCall, and at the same time, fix the bugs in calling
13148 parent constructors that took variable arguments.
13150 * ecore.cs (Expression.ConvertNumericExplicit,
13151 Expression.ImplicitNumericConversion): Remove the code that
13152 manually wrapped decimal (InternalTypeConstructor call is now gone
13155 * expression.cs (Cast.TryReduce): Also handle decimal types when
13156 trying to perform a constant fold on the type.
13158 * typemanager.cs (IsUnmanagedtype): Partially implemented.
13160 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
13161 that only turned off an error report, and did nothing else.
13163 2002-10-02 Miguel de Icaza <miguel@ximian.com>
13165 * driver.cs: Handle and ignore /fullpaths
13167 2002-10-01 Miguel de Icaza <miguel@ximian.com>
13169 * expression.cs (Binary.ResolveOperator): Catch the case where
13170 DoNumericPromotions returns true,
13172 (Binary.DoNumericPromotions): Simplify the code, and the tests.
13174 2002-09-27 Miguel de Icaza <miguel@ximian.com>
13176 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
13179 2002-09-26 Miguel de Icaza <miguel@ximian.com>
13181 * ecore.cs (ConvertNumericExplicit): It is not enough that the
13182 conversion exists, but it is also required that the conversion be
13183 performed. This manifested in "(Type64Enum) 2".
13185 * class.cs (TypeManager.AddMethod): The fix is not to change
13186 AddEnum, because that one was using a fully qualified name (every
13187 DeclSpace derivative does), but to change the AddMethod routine
13188 that was using an un-namespaced name. This now correctly reports
13189 the duplicated name.
13191 Revert patch until I can properly fix it. The issue
13192 is that we have a shared Type space across all namespaces
13193 currently, which is wrong.
13195 Options include making the Namespace a DeclSpace, and merge
13196 current_namespace/current_container in the parser.
13198 2002-09-25 Miguel de Icaza <miguel@ximian.com>
13200 * cs-parser.jay: Improve error reporting when we get a different
13201 kind of expression in local_variable_type and
13202 local_variable_pointer_type.
13204 Propagate this to avoid missleading errors being reported.
13206 * ecore.cs (ImplicitReferenceConversion): treat
13207 TypeManager.value_type as a target just like object_type. As
13212 Is valid, and needs to result in the int 1 being boxed before it
13213 is assigned to the value type v.
13215 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
13216 to validate the enumeration name.
13218 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
13219 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
13220 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
13222 * ecore.cs (TryImplicitIntConversion): When doing an
13223 implicit-enumeration-conversion, check if the type is 64-bits and
13224 perform a conversion before passing to EnumConstant.
13226 2002-09-23 Miguel de Icaza <miguel@ximian.com>
13228 * decl.cs (Error_AmbiguousTypeReference); New routine used to
13229 report ambiguous type references. Unlike the MS version, we
13230 report what the ambiguity is. Innovation at work ;-)
13232 (DeclSpace.FindType): Require a location argument to
13233 display when we display an ambiguous error.
13235 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
13237 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
13239 * expression.cs (EmitDynamicInitializers): Apply patch from
13240 hwang_rob@yahoo.ca that fixes the order in which we emit our
13243 2002-09-21 Martin Baulig <martin@gnome.org>
13245 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
13246 delegate takes no arguments.
13248 2002-09-20 Miguel de Icaza <miguel@ximian.com>
13250 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
13253 * expression.cs: Extract the underlying type.
13255 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
13257 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
13259 2002-09-19 Miguel de Icaza <miguel@ximian.com>
13261 * class.cs (TypeContainer.DefineType): We can not use the nice
13262 PackingSize with the size set to 1 DefineType method, because it
13263 will not allow us to define the interfaces that the struct
13266 This completes the fixing of bug 27287
13268 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
13269 means also structs. This fixes part of the problem.
13270 (Expresion.ImplicitReferenceConversionExists): ditto.
13272 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
13273 error if there were no errors reported during the type lookup
13274 process, to avoid duplicates or redundant errors. Without this
13275 you would get an ambiguous errors plus a type not found. We have
13276 beaten the user enough with the first error.
13278 (DeclSparce.FindType): Emit a warning if we have an ambiguous
13281 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
13282 during the resolution process, stop the lookup, this avoids
13283 repeated error reports (same error twice).
13285 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
13287 * typemanager.cs (LookupType): Redo the type lookup code to match
13288 the needs of System.Reflection.
13290 The issue is that System.Reflection requires references to nested
13291 types to begin with a "+" sign instead of a dot. So toplevel
13292 types look like: "NameSpace.TopLevelClass", and nested ones look
13293 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
13296 2002-09-19 Martin Baulig <martin@gnome.org>
13298 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
13299 says that a method always returns or always throws an exception,
13300 don't report the CS0161.
13302 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
13303 set `Returns = new_returns'.
13305 2002-09-19 Martin Baulig <martin@gnome.org>
13307 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
13308 to an enum constant, check for a CS0176.
13310 2002-09-18 Miguel de Icaza <miguel@ximian.com>
13312 * class.cs (TypeContainer.CheckPairedOperators): Now we check
13313 for operators that must be in pairs and report errors.
13315 * ecore.cs (SimpleName.DoResolveType): During the initial type
13316 resolution process, when we define types recursively, we must
13317 check first for types in our current scope before we perform
13318 lookups in the enclosing scopes.
13320 * expression.cs (MakeByteBlob): Handle Decimal blobs.
13322 (Invocation.VerifyArgumentsCompat): Call
13323 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
13324 I thought we were supposed to always call this, but there are a
13325 few places in the code where we dont do it.
13327 2002-09-17 Miguel de Icaza <miguel@ximian.com>
13329 * driver.cs: Add support in -linkres and -resource to specify the
13330 name of the identifier.
13332 2002-09-16 Miguel de Icaza <miguel@ximian.com>
13334 * ecore.cs (StandardConversionExists): Sync with the conversion
13335 code: allow anything-* to void* conversions.
13337 (FindMostSpecificSource): Use an Expression argument
13338 instead of a Type, because we might be handed over a Literal which
13339 gets a few more implicit conversions that plain types do not. So
13340 this information was being lost.
13342 Also, we drop the temporary type-holder expression when not
13345 2002-09-17 Martin Baulig <martin@gnome.org>
13347 * class.cs (PropertyBase.CheckBase): Don't check the base class if
13348 this is an explicit interface implementation.
13350 2002-09-17 Martin Baulig <martin@gnome.org>
13352 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
13353 different `IndexerName' attributes.
13355 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
13356 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
13357 virtual CommonResolve().
13359 2002-09-16 Miguel de Icaza <miguel@ximian.com>
13361 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
13362 and convert that to the UnderlyingType.
13364 * statement.cs (Foreach.Resolve): Indexers are just like variables
13365 or PropertyAccesses.
13367 * cs-tokenizer.cs (consume_string): Track line numbers and columns
13368 inside quoted strings, we were not doing this before.
13370 2002-09-16 Martin Baulig <martin@gnome.org>
13372 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
13373 resolve it. This is needed for the definite assignment check of the
13374 instance expression, fixes bug #29846.
13375 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
13377 2002-09-16 Nick Drochak <ndrochak@gol.com>
13379 * parameter.cs: Fix compile error. Cannot reference static member
13380 from an instance object. Is this an mcs bug?
13382 2002-09-14 Martin Baulig <martin@gnome.org>
13384 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
13385 multiple times. Fixes bug #30295, added test-166.cs.
13387 2002-09-14 Martin Baulig <martin@gnome.org>
13389 * statement.cs (Block.Emit): Don't emit unreachable code.
13390 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
13391 `break' statements.
13392 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
13394 2002-09-14 Martin Baulig <martin@gnome.org>
13396 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
13399 2002-09-14 Martin Baulig <martin@gnome.org>
13401 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
13402 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
13403 be false on the ms runtime.
13405 2002-09-13 Martin Baulig <martin@gnome.org>
13407 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
13408 the CS0038 error message.
13410 2002-09-12 Miguel de Icaza <miguel@ximian.com>
13412 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
13413 constant inside, return it.
13415 2002-09-12 Martin Baulig <martin@gnome.org>
13417 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
13418 implicit conversion can be done between enum types.
13420 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
13421 check whether an implicit conversion to the current enum's UnderlyingType
13422 exists and report an error if not.
13424 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
13425 without debugging support.
13427 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
13428 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
13430 2002-09-12 Martin Baulig <martin@gnome.org>
13432 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
13434 * ecore.cs (IMemberExpr.DeclaringType): New property.
13435 (SimpleName.SimpleNameResolve): Check whether we're accessing a
13436 nonstatic member of an outer type (CS0038).
13438 2002-09-11 Miguel de Icaza <miguel@ximian.com>
13440 * driver.cs: Activate the using-error detector at warning level
13441 4 (at least for MS-compatible APIs).
13443 * namespace.cs (VerifyUsing): Small buglett fix.
13445 * pending.cs (PendingImplementation): pass the container pointer.
13447 * interface.cs (GetMethods): Allow for recursive definition. Long
13448 term, I would like to move every type to support recursive
13449 definitions, not the current ordering mechanism that we have right
13452 The situation is this: Attributes are handled before interfaces,
13453 so we can apply attributes to interfaces. But some attributes
13454 implement interfaces, we will now handle the simple cases
13455 (recursive definitions will just get an error).
13457 * parameter.cs: Only invalidate types at the end if we fail to
13460 2002-09-09 Martin Baulig <martin@gnome.org>
13462 * ecore.cs (PropertyExpr.Emit): Also check for
13463 TypeManager.system_int_array_get_length so this'll also work when
13464 compiling corlib. Fixes #30003.
13466 2002-09-09 Martin Baulig <martin@gnome.org>
13468 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
13469 and throw an exception if we can't get the type's size. Fixed #30040,
13472 2002-09-09 Martin Baulig <martin@gnome.org>
13474 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
13476 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
13477 context. Fixes bug #30027.
13479 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
13480 virtual functions. Fixes bug #30043, added test-164.cs.
13482 2002-09-08 Ravi Pratap <ravi@ximian.com>
13484 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
13486 2002-09-08 Nick Drochak <ndrochak@gol.com>
13488 * driver.cs: Use an object to get the windows codepage since it's not a
13491 2002-09-08 Miguel de Icaza <miguel@ximian.com>
13493 * statement.cs (For.Emit): for infinite loops (test == null)
13494 return whether there is a break inside, not always "true".
13496 * namespace.cs (UsingEntry): New struct to hold the name of the
13497 using definition, the location where it is defined, and whether it
13498 has been used in a successful type lookup.
13500 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
13505 2002-09-06 Ravi Pratap <ravi@ximian.com>
13507 * attribute.cs : Fix incorrect code which relied on catching
13508 a NullReferenceException to detect a null being passed in
13509 where an object was expected.
13511 2002-09-06 Miguel de Icaza <miguel@ximian.com>
13513 * statement.cs (Try): flag the catch variable as assigned
13515 * expression.cs (Cast): Simplified by using ResolveType instead of
13516 manually resolving.
13518 * statement.cs (Catch): Fix bug by using ResolveType.
13520 2002-09-06 Ravi Pratap <ravi@ximian.com>
13522 * expression.cs (BetterConversion): Special case for when we have
13523 a NullLiteral as the argument and we have to choose between string
13524 and object types - we choose string the way csc does.
13526 * attribute.cs (Attribute.Resolve): Catch the
13527 NullReferenceException and report error #182 since the Mono
13528 runtime no more has the bug and having this exception raised means
13529 we tried to select a constructor which takes an object and is
13532 2002-09-05 Ravi Pratap <ravi@ximian.com>
13534 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
13535 message (1502, 1503) when we can't locate a method after overload
13536 resolution. This is much more informative and closes the bug
13539 * interface.cs (PopulateMethod): Return if there are no argument
13540 types. Fixes a NullReferenceException bug.
13542 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
13543 expressions too. Previously we were checking only in one place for
13544 positional arguments leaving out named arguments.
13546 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
13547 type to the enum type is not allowed. Remove code corresponding to
13550 (ConvertNumericExplicit): Allow explicit conversions from
13551 the underlying type to enum type. This precisely follows the spec
13552 and closes a bug filed by Gonzalo.
13554 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13557 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
13559 2002-09-03 Miguel de Icaza <miguel@ximian.com>
13561 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
13562 it was important that we stored the right value after the
13563 reduction in `converted'.
13565 2002-09-04 Martin Baulig <martin@gnome.org>
13567 * location.cs (Location.SymbolDocument): Use full pathnames for the
13570 2002-08-30 Miguel de Icaza <miguel@ximian.com>
13572 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
13573 of the expression resolve mechanism, because that will catch the
13574 SimpleName error failures.
13576 (Conditional): If we can not resolve the
13577 expression, return, do not crash.
13579 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13582 (location): display token name instead of its number.
13584 2002-08-28 Martin Baulig <martin@gnome.org>
13586 * expression.cs (Binary.ResolveOperator): Don't silently return
13587 but return an error if an operator cannot be applied between two
13590 2002-08-28 Martin Baulig <martin@gnome.org>
13592 * class.cs (Constructor.Define): Set the permission attributes
13593 correctly instead of making all constructors public.
13595 2002-08-28 Martin Baulig <martin@gnome.org>
13597 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
13598 for private members before reporting a CS0103; if we find anything,
13601 2002-08-28 Martin Baulig <martin@gnome.org>
13603 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
13604 to check whether `closure_start_type == closure_invocation_type',
13605 we also need to check whether `m.DeclaringType == closure_invocation_type'
13606 before bypassing the permission checks. We might be accessing
13607 protected/private members from the base class.
13608 (TypeManager.RealMemberLookup): Only set private_ok if private
13609 members were requested via BindingFlags.NonPublic.
13611 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
13613 * expression.cs (MemberAccess.ResolveMemberAccess): Set
13614 MethodGroupExpr.IsExplicitImpl if appropriate.
13615 (Invocation.DoResolve): Don't report the CS0120 for explicit
13616 interface implementations.
13618 2002-08-27 Martin Baulig <martin@gnome.org>
13620 * expression.cs (Invocation.DoResolve): If this is a static
13621 method and we don't have an InstanceExpression, we must report
13624 2002-08-25 Martin Baulig <martin@gnome.org>
13626 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
13627 `==' between a valuetype and an object.
13629 2002-08-25 Miguel de Icaza <miguel@ximian.com>
13631 * ecore.cs (TypeExpr): Provide a ToString method.
13633 2002-08-24 Martin Baulig <martin@gnome.org>
13635 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
13636 now called proggie.dbg and it's a binary file.
13638 2002-08-23 Martin Baulig <martin@gnome.org>
13640 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
13642 2002-08-23 Martin Baulig <martin@gnome.org>
13644 * struct.cs (MyStructInfo.ctor): Make this work with empty
13645 structs; it's not allowed to use foreach() on null.
13647 2002-08-23 Martin Baulig <martin@gnome.org>
13649 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
13650 writer the full pathname of the generated assembly.
13652 2002-08-23 Martin Baulig <martin@gnome.org>
13654 * statements.cs (FlowBranching.UsageVector.MergeChildren):
13655 A `finally' block never returns or breaks; improved handling of
13658 2002-08-23 Martin Baulig <martin@gnome.org>
13660 * statement.cs (Throw.Resolve): Allow `throw null'.
13662 2002-08-23 Martin Baulig <martin@gnome.org>
13664 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
13665 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
13666 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
13667 MemberLookup would return a wrong event if this is an explicit
13668 interface implementation and the class has an event with the same
13671 2002-08-23 Martin Baulig <martin@gnome.org>
13673 * statement.cs (Block.AddChildVariableNames): New public method.
13674 (Block.AddChildVariableName): Likewise.
13675 (Block.IsVariableNameUsedInChildBlock): Likewise.
13676 (Block.AddVariable): Check whether a variable name has already
13677 been used in a child block.
13679 * cs-parser.jay (declare_local_variables): Mark all variable names
13680 from the current block as being used in a child block in the
13683 2002-08-23 Martin Baulig <martin@gnome.org>
13685 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
13686 find the symbol writer.
13688 * driver.cs: csc also allows the arguments to /define being
13689 separated by commas, not only by semicolons.
13691 2002-08-23 Martin Baulig <martin@gnome.org>
13693 * interface.cs (Interface.GetMembers): Added static check for events.
13695 2002-08-15 Martin Baulig <martin@gnome.org>
13697 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
13698 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
13700 * ecore.cs (Expression.MemberLookup): Added documentation and explained
13701 why the MethodData.EmitDestructor() change was necessary.
13703 2002-08-20 Martin Baulig <martin@gnome.org>
13705 * class.cs (TypeContainer.FindMembers): Added static check for events.
13707 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
13709 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
13710 use Type.GetEvents(), not Type.FindMembers().
13712 2002-08-20 Martin Baulig <martin@gnome.org>
13714 * decl.cs (MemberCache): Added a special method cache which will
13715 be used for method-only searched. This ensures that a method
13716 search will return a MethodInfo with the correct ReflectedType for
13719 2002-08-20 Martin Baulig <martin@gnome.org>
13721 * decl.cs (DeclSpace.FindMembers): Made this public.
13723 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13725 * delegate.cs: fixed build on windows.
13726 [FIXME: Filed as bug #29150: MCS must report these errors.]
13728 2002-08-19 Ravi Pratap <ravi@ximian.com>
13730 * ecore.cs (StandardConversionExists): Return a false
13731 if we are trying to convert the void type to anything else
13732 since that is not allowed.
13734 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
13735 we flag error 70 in the event an event is trying to be accessed
13736 directly from outside the declaring type.
13738 2002-08-20 Martin Baulig <martin@gnome.org>
13740 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
13741 MemberCache from typemanager.cs to decl.cs.
13743 2002-08-19 Martin Baulig <martin@gnome.org>
13745 * class.cs (TypeContainer): Implement IMemberContainer.
13746 (TypeContainer.DefineMembers): Create the MemberCache.
13747 (TypeContainer.FindMembers): Do better BindingFlags checking; only
13748 return public members if BindingFlags.Public was given, check
13749 whether members are static.
13751 2002-08-16 Martin Baulig <martin@gnome.org>
13753 * decl.cs (DeclSpace.Define): Splitted this in Define and
13754 DefineMembers. DefineMembers is called first and initializes the
13757 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
13758 DefineMembers() on all our DeclSpaces.
13760 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
13761 but call DefineMembers() on all nested interfaces. We call their
13762 Define() in our new Define() function.
13764 * interface.cs (Interface): Implement IMemberContainer.
13765 (Interface.Define): Moved all code except the attribute stuf to
13767 (Interface.DefineMembers): Initialize the member cache.
13769 * typemanager.cs (IMemberFinder): Removed this interface, we don't
13770 need this anymore since we can use MemberCache.FindMembers directly.
13772 2002-08-19 Martin Baulig <martin@gnome.org>
13774 * typemanager.cs (MemberCache): When creating the cache for an
13775 interface type, add all inherited members.
13776 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
13777 to `out bool used_cache' and documented it.
13778 (TypeManager.MemberLookup): If we already used the cache in the first
13779 iteration, we don't need to do the interfaces check.
13781 2002-08-19 Martin Baulig <martin@gnome.org>
13783 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
13784 here from IMemberFinder and don't implement this interface anymore.
13785 (DeclSpace.MemberCache): Moved here from IMemberFinder.
13787 * typemanager.cs (IMemberFinder): This interface is now only used by
13788 classes which actually support the member cache.
13789 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
13790 since we only put DeclSpaces into this Hashtable.
13791 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
13792 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
13794 2002-08-16 Martin Baulig <martin@gnome.org>
13796 * typemanager.cs (ICachingMemberFinder): Removed.
13797 (IMemberFinder.MemberCache): New property.
13798 (TypeManager.FindMembers): Merged this with RealFindMembers().
13799 This function will never be called from TypeManager.MemberLookup()
13800 so we can't use the cache here, just the IMemberFinder.
13801 (TypeManager.MemberLookup_FindMembers): Check whether the
13802 IMemberFinder has a MemberCache and call the cache's FindMembers
13804 (MemberCache): Rewrote larger parts of this yet another time and
13805 cleaned it up a bit.
13807 2002-08-15 Miguel de Icaza <miguel@ximian.com>
13809 * driver.cs (LoadArgs): Support quoting.
13811 (Usage): Show the CSC-like command line arguments.
13813 Improved a few error messages.
13815 2002-08-15 Martin Baulig <martin@gnome.org>
13817 * typemanager.cs (IMemberContainer.Type): New property.
13818 (IMemberContainer.IsInterface): New property.
13820 The following changes are conditional to BROKEN_RUNTIME, which is
13821 defined at the top of the file.
13823 * typemanager.cs (MemberCache.MemberCache): Don't add the base
13824 class'es members, but add all members from TypeHandle.ObjectType
13825 if we're an interface.
13826 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
13827 is the current type.
13828 (MemberCache.CacheEntry.Container): Removed this field.
13829 (TypeHandle.GetMembers): Include inherited members.
13831 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13833 * typemanager.cs: fixed compilation and added a comment on a field that
13836 2002-08-15 Martin Baulig <martin@gnome.org>
13838 * class.cs (ConstructorInitializer.Resolve): In the
13839 Expression.MemberLookup call, use the queried_type as
13842 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
13843 declared' attribute, it's always true.
13844 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
13845 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
13846 temporary wrapper for FindMembers which tells MemberLookup whether
13847 members from the base classes are included in the return value.
13848 This will go away soon.
13849 (TypeManager.MemberLookup): Use this temporary hack here; once the
13850 new MemberCache is completed, we don't need to do the DeclaredOnly
13851 looping here anymore since the MemberCache will take care of this.
13852 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
13853 (MemberCache): When creating the MemberCache for a class, get
13854 members from the current class and all its base classes.
13855 (MemberCache.CacheEntry.Container): New field. This is a
13856 temporary hack until the Mono runtime is fixed to distinguish
13857 between ReflectedType and DeclaringType. It allows us to use MCS
13858 with both the MS runtime and the unfixed Mono runtime without
13859 problems and without accecting performance.
13860 (MemberCache.SearchMembers): The DeclaredOnly looping from
13861 TypeManager.MemberLookup is now done here.
13863 2002-08-14 Martin Baulig <martin@gnome.org>
13865 * statement.cs (MyStructInfo.MyStructInfo): Don't call
13866 Type.GetFields on dynamic types but get the fields from the
13867 corresponding TypeContainer.
13868 (MyStructInfo.GetStructInfo): Added check for enum types.
13870 * typemanager.cs (MemberList.IsSynchronized): Implemented.
13871 (MemberList.SyncRoot): Implemented.
13872 (TypeManager.FilterWithClosure): No need to check permissions if
13873 closure_start_type == closure_invocation_type, don't crash if
13874 closure_invocation_type is null.
13876 2002-08-13 Martin Baulig <martin@gnome.org>
13878 Rewrote TypeContainer.FindMembers to use a member cache. This
13879 gives us a speed increase of about 35% for the self-hosting MCS
13880 build and of about 15-20% for the class libs (both on GNU/Linux).
13882 * report.cs (Timer): New class to get enhanced profiling. This
13883 whole class is "TIMER" conditional since it remarkably slows down
13886 * class.cs (MemberList): New class. This is an IList wrapper
13887 which we're now using instead of passing MemberInfo[]'s around to
13888 avoid copying this array unnecessarily.
13889 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
13890 (ICachingMemberFinder, IMemberContainer): New interface.
13891 (TypeManager.FilterWithClosure): If `criteria' is null, the name
13892 has already been checked, otherwise use it for the name comparision.
13893 (TypeManager.FindMembers): Renamed to RealMemberFinder and
13894 provided wrapper which tries to use ICachingMemberFinder.FindMembers
13895 if possible. Returns a MemberList, not a MemberInfo [].
13896 (TypeHandle): New class, implements IMemberContainer. We create
13897 one instance of this class per type, it contains a MemberCache
13898 which is used to do the member lookups.
13899 (MemberCache): New class. Each instance of this class contains
13900 all members of a type and a name-based hash table.
13901 (MemberCache.FindMembers): This is our new member lookup
13902 function. First, it looks up all members of the requested name in
13903 the hash table. Then, it walks this list and sorts out all
13904 applicable members and returns them.
13906 2002-08-13 Martin Baulig <martin@gnome.org>
13908 In addition to a nice code cleanup, this gives us a performance
13909 increase of about 1.4% on GNU/Linux - not much, but it's already
13910 half a second for the self-hosting MCS compilation.
13912 * typemanager.cs (IMemberFinder): New interface. It is used by
13913 TypeManager.FindMembers to call FindMembers on a TypeContainer,
13914 Enum, Delegate or Interface.
13915 (TypeManager.finder_to_member_finder): New PtrHashtable.
13916 (TypeManager.finder_to_container): Removed.
13917 (TypeManager.finder_to_delegate): Removed.
13918 (TypeManager.finder_to_interface): Removed.
13919 (TypeManager.finder_to_enum): Removed.
13921 * interface.cs (Interface): Implement IMemberFinder.
13923 * delegate.cs (Delegate): Implement IMemberFinder.
13925 * enum.cs (Enum): Implement IMemberFinder.
13927 * class.cs (TypeContainer): Implement IMemberFinder.
13929 2002-08-12 Martin Baulig <martin@gnome.org>
13931 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
13933 2002-08-12 Martin Baulig <martin@gnome.org>
13935 * ecore.cs (ITypeExpression): New interface for expressions which
13937 (TypeExpression): Renamed to TypeLookupExpression.
13938 (Expression.DoResolve): If we're doing a types-only lookup, the
13939 expression must implement the ITypeExpression interface and we
13940 call DoResolveType() on it.
13941 (SimpleName): Implement the new ITypeExpression interface.
13942 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
13943 hack, the situation that we're only looking up types can't happen
13944 anymore when this method is called. Moved the type lookup code to
13945 DoResolveType() and call it.
13946 (SimpleName.DoResolveType): This ITypeExpression interface method
13947 is now doing the types-only lookup.
13948 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
13949 (ResolveFlags): Added MaskExprClass.
13951 * expression.cs (MemberAccess): Implement the ITypeExpression
13953 (MemberAccess.DoResolve): Added support for a types-only lookup
13954 when we're called via ITypeExpression.DoResolveType().
13955 (ComposedCast): Implement the ITypeExpression interface.
13957 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
13958 Expression.Resolve() with ResolveFlags.Type instead.
13960 2002-08-12 Martin Baulig <martin@gnome.org>
13962 * interface.cs (Interface.Define): Apply attributes.
13964 * attribute.cs (Attribute.ApplyAttributes): Added support for
13965 interface attributes.
13967 2002-08-11 Martin Baulig <martin@gnome.org>
13969 * statement.cs (Block.Emit): Only check the "this" variable if we
13970 do not always throw an exception.
13972 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
13973 whether the property has a set accessor.
13975 2002-08-11 Martin Baulig <martin@gnome.org>
13977 Added control flow analysis support for structs.
13979 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
13980 with control flow analysis turned off.
13981 (IVariable): New interface.
13982 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
13983 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
13984 (FieldExpr.DoResolve): Resolve the instance expression with flow
13985 analysis turned off and do the definite assignment check after the
13986 resolving when we know what the expression will resolve to.
13988 * expression.cs (LocalVariableReference, ParameterReference):
13989 Implement the new IVariable interface, only call the flow analysis
13990 code if ec.DoFlowAnalysis is true.
13991 (This): Added constructor which takes a Block argument. Implement
13992 the new IVariable interface.
13993 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
13994 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
13995 This does the definite assignment checks for struct members.
13997 * class.cs (Constructor.Emit): If this is a non-static `struct'
13998 constructor which doesn't have any initializer, call
13999 Block.AddThisVariable() to tell the flow analysis code that all
14000 struct elements must be initialized before control returns from
14003 * statement.cs (MyStructInfo): New public class.
14004 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
14005 argument to this indexer. If non-zero, check an individual struct
14006 member, not the whole struct.
14007 (FlowBranching.CheckOutParameters): Check struct members.
14008 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
14009 overloaded versions of these methods which take an additional
14010 `int field_idx' argument to check struct members.
14011 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
14012 overloaded versions of these methods which take an additional
14013 `string field_name' argument to check struct member.s
14014 (VariableInfo): Implement the IVariable interface.
14015 (VariableInfo.StructInfo): New public property. Returns the
14016 MyStructInfo instance of the variable if it's a struct or null.
14017 (Block.AddThisVariable): New public method. This is called from
14018 Constructor.Emit() for non-static `struct' constructor which do
14019 not have any initializer. It creates a special variable for the
14020 "this" instance variable which will be checked by the flow
14021 analysis code to ensure that all of the struct's fields are
14022 initialized before control returns from the constructor.
14023 (UsageVector): Added support for struct members. If a
14024 variable/parameter is a struct with N members, we reserve a slot
14025 in the usage vector for each member. A struct is considered fully
14026 initialized if either the struct itself (slot 0) or all its
14027 members are initialized.
14029 2002-08-08 Martin Baulig <martin@gnome.org>
14031 * driver.cs (Driver.MainDriver): Only report an error CS5001
14032 if there were no compilation errors.
14034 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
14035 `UnsafeContext' property to determine whether the parent is in
14036 unsafe context rather than checking the parent's ModFlags:
14037 classes nested in an unsafe class are unsafe as well.
14039 2002-08-08 Martin Baulig <martin@gnome.org>
14041 * statement.cs (UsageVector.MergeChildren): Distinguish between
14042 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
14043 we return. Added test17() and test18() to test-154.cs.
14045 2002-08-08 Martin Baulig <martin@gnome.org>
14047 * typemanager.cs (TypeManager.FilterWithClosure): If we have
14048 Family access, make sure the invoking type isn't a subclass of the
14049 queried type (that'd be a CS1540).
14051 * ecore.cs (Expression.MemberLookup): Added overloaded version of
14052 this method which takes an additional `Type invocation_type'.
14054 * expression.cs (BaseAccess.DoResolve): Use the base type as
14055 invocation and query type.
14056 (MemberAccess.DoResolve): If the lookup failed and we're about to
14057 report a CS0122, try a lookup with the ec.ContainerType - if this
14058 succeeds, we must report a CS1540.
14060 2002-08-08 Martin Baulig <martin@gnome.org>
14062 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
14063 (MethodGroupExpr): Implement the IMemberExpr interface.
14065 * expression (MemberAccess.ResolveMemberAccess): No need to have
14066 any special code for MethodGroupExprs anymore, they're now
14069 2002-08-08 Martin Baulig <martin@gnome.org>
14071 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
14072 Family, FamANDAssem and FamORAssem permissions.
14073 (TypeManager.IsSubclassOrNestedChildOf): New public method.
14075 2002-08-08 Martin Baulig <martin@gnome.org>
14077 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
14078 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
14081 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
14083 * driver.cs: implemented /resource option to embed managed resources.
14085 2002-08-07 Martin Baulig <martin@gnome.org>
14087 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
14088 (FieldBase.HasFieldInitializer): New public property.
14089 (FieldBase.GetInitializerExpression): New public method. Resolves and
14090 returns the field initializer and makes sure it is only resolved once.
14091 (TypeContainer.EmitFieldInitializers): Call
14092 FieldBase.GetInitializerExpression to get the initializer, this ensures
14093 that it isn't resolved multiple times.
14095 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
14096 the resolving process (SimpleName/MemberLookup) that we're currently
14097 emitting a field initializer (which must not access any instance members,
14098 this is an error CS0236).
14100 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
14101 argument, if the `IsFieldInitializer' flag is set, we must report and
14102 error CS0236 and not an error CS0120.
14104 2002-08-07 Martin Baulig <martin@gnome.org>
14106 * ecore.cs (IMemberExpr): New public interface.
14107 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
14108 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
14109 if the expression is an IMemberExpr.
14111 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
14112 to be null, implicitly default to `this' if we're non-static in
14113 this case. Simplified the code a lot by using the new IMemberExpr
14114 interface. Also fixed bug #28176 here.
14116 2002-08-06 Martin Baulig <martin@gnome.org>
14118 * cs-parser.jay (SimpleLookup): Removed. We need to create
14119 ParameterReferences during semantic analysis so that we can do a
14120 type-only search when resolving Cast, TypeOf and SizeOf.
14121 (block): Pass the `current_local_parameters' to the Block's
14124 * class.cs (ConstructorInitializer): Added `Parameters parameters'
14125 argument to the constructor.
14126 (ConstructorInitializer.Resolve): Create a temporary implicit
14127 block with the parameters.
14129 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
14130 references here if we aren't doing a type-only search.
14132 * statement.cs (Block): Added constructor which takes a
14133 `Parameters parameters' argument.
14134 (Block.Parameters): New public property.
14136 * support.cs (InternalParameters.Parameters): Renamed `parameters'
14137 to `Parameters' and made it public readonly.
14139 2002-08-06 Martin Baulig <martin@gnome.org>
14141 * ecore.cs (Expression.Warning): Made this public as well.
14143 * report.cs (Report.Debug): Print the contents of collections.
14145 2002-08-06 Martin Baulig <martin@gnome.org>
14147 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
14148 used to tell Resolve() which kinds of expressions it may return.
14149 (Expression.Resolve): Added overloaded version of this method which
14150 takes a `ResolveFlags flags' argument. This can be used to tell
14151 Resolve() which kinds of expressions it may return. Reports a
14153 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
14154 ResolveFlags.SimpleName.
14155 (Expression.Error118): Added overloaded version of this method which
14156 takes a `ResolveFlags flags' argument. It uses the flags to determine
14157 which kinds of expressions are allowed.
14159 * expression.cs (Argument.ResolveMethodGroup): New public method.
14160 Resolves an argument, but allows a MethodGroup to be returned.
14161 This is used when invoking a delegate.
14163 * TODO: Updated a bit.
14165 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14167 Fixed compilation with csc.
14169 * ecore.cs: Expression.Error made public. Is this correct? Should
14170 Warning be made public too?
14172 * expression.cs: use ea.Location instead of ea.loc.
14173 [FIXME: Filed as bug #28607: MCS must report these errors.]
14175 2002-08-06 Martin Baulig <martin@gnome.org>
14177 * ecore.cs (Expression.loc): Moved the location here instead of
14178 duplicating it in all derived classes.
14179 (Expression.Location): New public property.
14180 (Expression.Error, Expression.Warning): Made them non-static and
14181 removed the location argument.
14182 (Expression.Warning): Added overloaded version which takes an
14183 `int level' argument.
14184 (Expression.Error118): Make this non-static and removed the
14185 expression and location arguments.
14186 (TypeExpr): Added location argument to the constructor.
14188 * expression.cs (StaticCallExpr): Added location argument to
14190 (Indirection, PointerArithmetic): Likewise.
14191 (CheckedExpr, UnCheckedExpr): Likewise.
14192 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
14193 (StringPtr): Likewise.
14196 2002-08-05 Martin Baulig <martin@gnome.org>
14198 * expression.cs (BaseAccess.DoResolve): Actually report errors.
14200 * assign.cs (Assign.DoResolve): Check whether the source
14201 expression is a value or variable.
14203 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
14204 while resolving the corresponding blocks.
14206 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
14207 an error, don't silently return null.
14209 * statement.cs (Block.AddVariable): Do the error reporting here
14210 and distinguish between CS0128 and CS0136.
14211 (Block.DoResolve): Report all unused labels (warning CS0164).
14212 (LabeledStatement): Pass the location to the constructor.
14213 (LabeledStatement.HasBeenReferenced): New property.
14214 (LabeledStatement.Resolve): Set it to true here.
14216 * statement.cs (Return.Emit): Return success even after reporting
14217 a type mismatch error (CS0126 or CS0127), this is what csc does and
14218 it avoids confusing the users with any consecutive errors.
14220 2002-08-05 Martin Baulig <martin@gnome.org>
14222 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
14224 * const.cs (Const.LookupConstantValue): Catch circular definitions.
14226 * expression.cs (MemberAccess.DoResolve): Silently return if an
14227 error has already been reported.
14229 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
14230 error has already been reported.
14232 2002-08-05 Martin Baulig <martin@gnome.org>
14234 * statement.cs (UsageVector): Only initialize the `parameters'
14235 vector if we actually have any "out" parameters.
14237 2002-08-05 Martin Baulig <martin@gnome.org>
14239 * expression.cs (Binary.ResolveOperator): When combining delegates,
14240 they must have the same type.
14242 2002-08-05 Martin Baulig <martin@gnome.org>
14244 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
14245 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
14246 work with the ms runtime and we also don't need it: if we're a
14247 PropertyBuilder and not in the `indexer_arguments' hash, then we
14248 are a property and not an indexer.
14250 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
14251 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
14252 since the latter one doesn't work with the ms runtime.
14254 2002-08-03 Martin Baulig <martin@gnome.org>
14256 Fixed bugs #27998 and #22735.
14258 * class.cs (Method.IsOperator): New public field.
14259 (Method.CheckBase): Report CS0111 if there's already a method
14260 with the same parameters in the current class. Report CS0508 when
14261 attempting to change the return type of an inherited method.
14262 (MethodData.Emit): Report CS0179 if a method doesn't have a body
14263 and it's not marked abstract or extern.
14264 (PropertyBase): New abstract base class for Property and Indexer.
14265 (PropertyBase.CheckBase): Moved here from Property and made it work
14267 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
14268 the same so we can reuse it there.
14269 (Property, Indexer): Derive from PropertyBase.
14270 (MethodSignature.inheritable_property_signature_filter): New delegate
14271 to find properties and indexers.
14273 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
14274 argument and improved error reporting.
14276 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
14277 EmptyReadOnlyParameters and made it a property.
14279 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
14280 version of this method which takes a `PropertyInfo indexer'.
14281 (TypeManager.RegisterIndexer): New method.
14283 * class.cs: Added myself as author of this file :-)
14285 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14287 * class.cs: fixed compilation on windoze.
14289 2002-08-03 Martin Baulig <martin@gnome.org>
14291 * interface.cs (Interface.GetInterfaceBases): Check whether all
14292 base interfaces are at least as accessible than the current one.
14294 * class.cs (TypeContainer.GetClassBases): Check whether base types
14295 are at least as accessible than the current type.
14296 (TypeContainer.AsAccessible): Implemented and made non-static.
14297 (MemberBase.CheckParameters): Report errors if the accessibility
14300 * delegate.cs (Delegate.Delegate): The default visibility is
14301 internal for top-level types and private for nested types.
14302 (Delegate.Define): Report errors if the accessibility checks fail.
14304 * enum.cs (Enum.Enum): The default visibility is internal for
14305 top-level types and private for nested types.
14306 (Enum.DefineType): Compute the correct visibility.
14308 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
14309 function which takes a `bool is_toplevel' instead of a TypeContainer.
14311 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
14314 2002-08-02 Martin Baulig <martin@gnome.org>
14316 * expression.cs (LocalVariableReferenc): Added constructor which
14317 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
14318 (LocalVariableReference.IsReadOnly): New property.
14319 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
14320 variable is readonly, use our own readonly flag to do this; you can
14321 use the new constructor to get a writable reference to a read-only
14324 * cs-parser.jay (foreach_statement, using_statement): Get a writable
14325 reference to the local variable.
14327 2002-08-01 Miguel de Icaza <miguel@ximian.com>
14329 * rootcontext.cs (ResolveCore): Also include System.Exception
14331 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
14332 we reach an EmptyStatement.
14334 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
14337 * expression.cs (Binary.ResolveOperator): Check error result in
14340 use brtrue/brfalse directly and avoid compares to null.
14342 2002-08-02 Martin Baulig <martin@gnome.org>
14344 * class.cs (TypeContainer.Define): Define all nested interfaces here.
14345 Fixes bug #28407, added test-155.cs.
14347 2002-08-01 Martin Baulig <martin@gnome.org>
14349 * class.cs (Event.EmitDefaultMethod): Make this work with static
14350 events. Fixes #28311, added verify-3.cs.
14352 2002-08-01 Martin Baulig <martin@gnome.org>
14354 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
14355 `is_disposable' fields.
14356 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
14357 `hm.is_disposable' if we're using the collection pattern.
14358 (Foreach.EmitCollectionForeach): Use the correct type for the
14359 enumerator's local variable, only emit the try/finally block if
14360 necessary (fixes #27713).
14362 2002-08-01 Martin Baulig <martin@gnome.org>
14364 * ecore.cs (Expression.report118): Renamed to Error118 and made
14367 * statement.cs (Throw.Resolve): Check whether the expression is of
14368 the correct type (CS0118) and whether the type derives from
14369 System.Exception (CS0155).
14370 (Catch.Resolve): New method. Do the type lookup here and check
14371 whether it derives from System.Exception (CS0155).
14372 (Catch.CatchType, Catch.IsGeneral): New public properties.
14374 * typemanager.cs (TypeManager.exception_type): Added.
14376 2002-07-31 Miguel de Icaza <miguel@ximian.com>
14378 * driver.cs: Updated About function.
14380 2002-07-31 Martin Baulig <martin@gnome.org>
14382 Implemented Control Flow Analysis.
14384 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
14385 (EmitContext.CurrentBranching): Added.
14386 (EmitContext.StartFlowBranching): Added.
14387 (EmitContext.EndFlowBranching): Added.
14388 (EmitContext.KillFlowBranching): Added.
14389 (EmitContext.IsVariableAssigned): Added.
14390 (EmitContext.SetVariableAssigned): Added.
14391 (EmitContext.IsParameterAssigned): Added.
14392 (EmitContext.SetParameterAssigned): Added.
14393 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
14394 Added control flow analysis stuff here.
14396 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
14397 resolve the expression as lvalue.
14398 (LocalVariableReference.DoResolve): Check whether the variable has
14399 already been assigned.
14400 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
14401 the parameter as assigned here.
14402 (ParameterReference.DoResolve): Check whether the parameter has already
14404 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
14405 expression as lvalue.
14407 * statement.cs (FlowBranching): New class for the flow analysis code.
14408 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
14409 (LabeledStatement.IsDefined): New public property.
14410 (LabeledStatement.AddUsageVector): New public method to tell flow
14411 analyis that the label may be reached via a forward jump.
14412 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
14414 (VariableInfo.Number): New public field. This is used by flow analysis
14415 to number all locals of a block.
14416 (Block.CountVariables): New public property. This is the number of
14417 local variables in this block (including the locals from all parent
14419 (Block.EmitMeta): Number all the variables.
14421 * statement.cs: Added flow analysis support to all classes.
14423 2002-07-31 Martin Baulig <martin@gnome.org>
14425 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
14426 To get debugging messages, compile mcs with /define:MCS_DEBUG and
14427 then use this argument.
14429 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
14431 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
14432 use this to specify /define options.
14434 2002-07-29 Martin Baulig <martin@gnome.org>
14436 * statement.cs (Fixed): Moved all code that does variable lookups
14437 and resolvings from Emit to Resolve.
14439 * statement.cs (For): Moved all code that does variable lookups
14440 and resolvings from Emit to Resolve.
14442 * statement.cs (Using): Moved all code that does variable lookups
14443 and resolvings from Emit to Resolve.
14445 2002-07-29 Martin Baulig <martin@gnome.org>
14447 * attribute.cs (Attribute.Resolve): Explicitly catch a
14448 System.NullReferenceException when creating the
14449 CustromAttributeBuilder and report a different warning message.
14451 2002-07-29 Martin Baulig <martin@gnome.org>
14453 * support.cs (ParameterData.ParameterName): Added method to
14454 get the name of a parameter.
14456 * typemanager.cs (TypeManager.IsValueType): New public method.
14458 2002-07-29 Martin Baulig <martin@gnome.org>
14460 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
14461 is a flag which specifies that it's either ref or out.
14462 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
14463 the out parameter to `out Parameter.Modifier mod', also set the
14464 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
14466 * support.cs (InternalParameters.ParameterModifier): Distinguish
14467 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
14468 Parameter.Modifier.ISBYREF flag if it's either ref or out.
14470 * expression.cs (Argument.GetParameterModifier): Distinguish
14471 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
14472 Parameter.Modifier.ISBYREF flag if it's either ref or out.
14474 2002-07-29 Martin Baulig <martin@gnome.org>
14476 * expression.cs (ParameterReference.ParameterReference): Added
14477 `Location loc' argument to the constructor.
14479 * cs-parser.jay: Pass location to ParameterReference.
14481 2002-07-28 Miguel de Icaza <miguel@ximian.com>
14483 * statement.cs (Try): Initialize the location.
14485 * cs-parser.jay: pass location to Try.
14487 * expression.cs (Unary.Reduce): Change the prototype to return
14488 whether a constant fold could be performed or not. The result is
14489 returned in an out parameters. In the case of Indirection and
14490 AddressOf, we want to perform the full tests.
14492 2002-07-26 Miguel de Icaza <miguel@ximian.com>
14494 * statement.cs (Statement.Emit): Flag dead code.
14496 2002-07-27 Andrew Birkett <andy@nobugs.org>
14498 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
14500 2002-07-27 Martin Baulig <martin@gnome.org>
14502 * class.cs (MethodData.Define): Put back call to
14503 TypeManager.AddMethod(), accidentally commented this out.
14505 * report.cs (Debug): New public method to print debugging information,
14506 this is `[Conditional ("DEBUG")]'.
14508 2002-07-26 Martin Baulig <martin@gnome.org>
14510 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
14511 (switch_statement): Push the current_block to the switch_stack and
14512 pop it again when we're done with the switch.
14513 (switch_section): The new block is a child of the current_block.
14514 Fixes bug #24007, added test-152.cs.
14516 2002-07-27 Martin Baulig <martin@gnome.org>
14518 * expression.cs (Invocation.EmitArguments): When calling a varargs
14519 function with only its fixed arguments, we need to pass an empty
14522 2002-07-27 Martin Baulig <martin@gnome.org>
14524 Mono 0.13 has been released.
14526 2002-07-25 Miguel de Icaza <miguel@ximian.com>
14528 * driver.cs: Rename --resource to --linkres, because that is what
14529 we do currently, we dont support --resource yet.
14531 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
14533 2002-07-25 Martin Baulig <martin@gnome.org>
14535 * class.cs (MethodData): New public class. This is a `method builder'
14536 class for a method or one accessor of a Property/Indexer/Event.
14537 (MethodData.GetMethodFlags): Moved here from MemberBase.
14538 (MethodData.ApplyAttributes): Likewise.
14539 (MethodData.ApplyObsoleteAttribute): Likewise.
14540 (MethodData.ApplyConditionalAttribute): Likewise.
14541 (MethodData.ApplyDllImportAttribute): Likewise.
14542 (MethodData.CheckAbstractAndExternal): Likewise.
14543 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
14544 (MethodData.Emit): Formerly known as Method.Emit().
14545 (MemberBase): Moved everything which was specific to a single
14546 accessor/method to MethodData.
14547 (Method): Create a new MethodData and call Define() and Emit() on it.
14548 (Property, Indexer, Event): Create a new MethodData objects for each
14549 accessor and call Define() and Emit() on them.
14551 2002-07-25 Martin Baulig <martin@gnome.org>
14553 Made MethodCore derive from MemberBase to reuse the code from there.
14554 MemberBase now also checks for attributes.
14556 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
14557 (MemberBase.GetMethodFlags): Moved here from class Method and marked
14559 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
14560 `CallingConventions cc' and `Attributes opt_attrs' arguments.
14561 (MemberBase.ApplyAttributes): New virtual method; applies the
14562 attributes to a method or accessor.
14563 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
14564 (MemberBase.ApplyConditionalAttribute): Likewise.
14565 (MemberBase.ApplyDllImportAttribute): Likewise.
14566 (MemberBase.CheckAbstractAndExternal): Likewise.
14567 (MethodCore.ParameterTypes): This is now a property instead of a
14568 method, it's initialized from DoDefineParameters().
14569 (MethodCore.ParameterInfo): Removed the set accessor.
14570 (MethodCore.DoDefineParameters): New protected virtual method to
14571 initialize ParameterTypes and ParameterInfo.
14572 (Method.GetReturnType): We can now simply return the MemberType.
14573 (Method.GetMethodFlags): Override the MemberBase version and add
14574 the conditional flags.
14575 (Method.CheckBase): Moved some code from Define() here, call
14576 DoDefineParameters() here.
14577 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
14578 here to avoid some larger code duplication.
14579 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
14580 ensure that abstract and external accessors don't declare a body.
14582 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
14583 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
14584 lookup in the attribute's parent classes, so we need to abort as soon
14585 as we found the first match.
14586 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
14587 the attribute has no arguments.
14589 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
14592 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14594 * cs-parser.jay: reverted previous patch.
14596 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14598 * cs-parser.jay: fixed bug #22119.
14600 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14602 * attribute.cs: fixed compilation. The error was:
14603 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
14604 be assigned to before control leaves the current method."
14605 [FIXME: Filed as bug #28186: MCS must report this error.]
14607 2002-07-25 Martin Baulig <martin@gnome.org>
14609 * attribute.cs (Attribute.Conditional_GetConditionName): New static
14610 method to pull the condition name ouf of a Conditional attribute.
14611 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
14612 the obsolete message and error flag out of an Obsolete attribute.
14614 * class.cs (Method.GetMethodFlags): New public method to get the
14615 TypeManager.MethodFlags for this method.
14616 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
14618 (Method.Define): Get and apply the Obsolete and Conditional attributes;
14619 if we're overriding a virtual function, set the new private variable
14620 `parent_method'; call the new TypeManager.AddMethod().
14622 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
14623 the MethodBuilder and the Method in a PtrHashtable.
14624 (TypeManager.builder_to_method): Added for this purpose.
14625 (TypeManager.MethodFlags): Added IsObsoleteError.
14626 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
14627 Obsolete and Conditional arguments in MethodBuilders. If we discover
14628 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
14629 the message from the attribute.
14631 2002-07-24 Martin Baulig <martin@gnome.org>
14633 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
14634 preprocessor directives, ensure that the argument to #define/#undef is
14635 exactly one identifier and that it's actually an identifier.
14637 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
14640 2002-07-24 Martin Baulig <martin@gnome.org>
14642 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
14643 initialize it to TypeManager.object_type in the constructor.
14644 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
14645 of the `hm.get_current' method if we're using the collection pattern.
14646 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
14647 for the explicit conversion to make it work when we're using the collection
14648 pattern and the `Current' property has a different return type than `object'.
14651 2002-07-24 Martin Baulig <martin@gnome.org>
14653 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
14654 does not match, but don't report any errors. This method is called in
14655 order for all methods in a MethodGroupExpr until a matching method is
14656 found, so we don't want to bail out if the first method doesn't match.
14657 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
14658 matches, report the 123. Fixes #28070.
14660 2002-07-24 Martin Baulig <martin@gnome.org>
14662 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
14663 TypeManager.TypeToCoreType() to the top of the method so the
14664 following equality checks will work. Fixes #28107.
14666 2002-07-24 Martin Baulig <martin@gnome.org>
14668 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
14669 operand is of type uint, and the other operand is of type sbyte,
14670 short or int, the operands are converted to type long." -
14671 Actually do what this comment already told us. Fixes bug #28106,
14674 2002-07-24 Martin Baulig <martin@gnome.org>
14676 * class.cs (MethodBase): New abstract class. This is now a base
14677 class for Property, Indexer and Event to avoid some code duplication
14678 in their Define() and DefineMethods() methods.
14679 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
14680 generic methods for Define() and DefineMethods().
14681 (FieldBase): Derive from MemberBase, not MemberCore.
14682 (Property): Derive from MemberBase, not MemberCore.
14683 (Property.DefineMethod): Moved all the code from this method to the
14684 new MethodBase.DefineAccessor(), just call it with appropriate
14686 (Property.Define): Call the new Property.DoDefine(), this does some
14687 sanity checks and we don't need to duplicate the code everywhere.
14688 (Event): Derive from MemberBase, not MemberCore.
14689 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
14690 accessors, this will also make them work with interface events.
14691 (Indexer): Derive from MemberBase, not MemberCore.
14692 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
14693 (Indexer.Define): Use the new MethodBase functions.
14695 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
14696 argument to the constructor.
14697 (Interface.FindMembers): Added support for interface events.
14698 (Interface.PopluateEvent): Implemented.
14700 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
14702 2002-07-22 Miguel de Icaza <miguel@ximian.com>
14704 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
14705 but this is required to check for a method name being the same as
14706 the containing class.
14710 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14712 * interface.cs: initialize variable.
14714 2002-07-23 Martin Baulig <martin@gnome.org>
14716 Implemented the IndexerName attribute in interfaces.
14718 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
14719 name if this is an explicit interface implementation.
14720 (Indexer.InterfaceIndexerName): New public variable. If we're
14721 implementing an interface indexer, this is the IndexerName in that
14722 interface. Otherwise, it's the IndexerName.
14723 (Indexer.DefineMethod): If we're implementing interface indexer,
14724 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
14725 and Pending.ImplementIndexer methods.
14726 (Indexer.Define): Also define the PropertyBuilder if we're
14727 implementing an interface indexer and this is neither an explicit
14728 interface implementation nor do the IndexerName match the one in
14731 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
14732 If a method is defined here, then we always need to create a proxy
14733 for it. This is used when implementing interface indexers.
14734 (Pending.IsInterfaceIndexer): New public method.
14735 (Pending.ImplementIndexer): New public method.
14736 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
14737 This is used when implementing interface indexers to define a proxy
14739 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
14740 define a proxy if necessary.
14742 * interface.cs (Interface.IndexerName): New public variable.
14743 (Interface.PopulateIndexer): Set the IndexerName.
14744 (Interface.DefineIndexers): New private method. Populate all the
14745 indexers and make sure their IndexerNames match.
14747 * typemanager.cs (IndexerPropertyName): Added support for interface
14750 2002-07-22 Martin Baulig <martin@gnome.org>
14752 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
14753 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
14754 ret if HasReturnLabel.
14755 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
14758 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
14759 and set the ec.LoopBeginTryCatchLevel.
14760 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
14761 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
14762 the current ec.TryCatchLevel, the branch goes out of an exception
14763 block. In this case, we need to use Leave and not Br.
14765 2002-07-22 Martin Baulig <martin@gnome.org>
14767 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
14768 block unless the block does not always return or it is contained in
14769 another try { ... } catch { ... } block. Fixes bug #26506.
14770 Added verify-1.cs to the test suite.
14772 2002-07-22 Martin Baulig <martin@gnome.org>
14774 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
14775 then we do not always return. Fixes bug #24985.
14777 2002-07-22 Martin Baulig <martin@gnome.org>
14779 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
14780 lookup on a per-class level; ie. walk up the class hierarchy until we
14781 found at least one applicable method, then choose the best among them.
14782 Fixes bug #24463 and test-29.cs.
14784 2002-07-22 Martin Baulig <martin@gnome.org>
14786 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
14787 return types of the methods. The return type is not part of the
14788 signature and we must not check it to make the `new' modifier work.
14789 Fixes bug #27999, also added test-147.cs.
14790 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
14792 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
14793 on the method's return type.
14795 2002-07-21 Martin Baulig <martin@gnome.org>
14797 * assign.cs: Make this work if the rightmost source is a constant and
14798 we need to do an implicit type conversion. Also adding a few more tests
14799 to test-38.cs which should have caught this.
14801 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
14802 target in the makefile for this. The makefile.gnu is primarily intended
14803 for end-users who don't want to debug the compiler.
14805 2002-07-21 Martin Baulig <martin@gnome.org>
14807 * assign.cs: Improved the Assign class so it can now handle embedded
14808 assignments (X = Y = Z = something). As a side-effect this'll now also
14809 consume less local variables. test-38.cs now passes with MCS, added
14810 a few new test cases to that test.
14812 2002-07-20 Martin Baulig <martin@gnome.org>
14814 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
14815 instructions. Fixes bug #27977, also added test-146.cs.
14817 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14819 * cs-tokenizer.cs: fixed getHex ().
14821 2002-07-19 Martin Baulig <martin@gnome.org>
14823 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
14824 not Type.GetType() to lookup the array type. This is needed when
14825 we're constructing an array of a user-defined type.
14826 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
14827 single-dimensional arrays, but also for single-dimensial arrays of
14830 2002-07-19 Martin Baulig <martin@gnome.org>
14832 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
14833 this function is called, it's not allowed to share LocalBuilders
14834 among ILGenerators.
14836 2002-07-19 Martin Baulig <martin@gnome.org>
14838 * expression.cs (Argument.Resolve): Report an error 118 when trying
14839 to pass a type as argument.
14841 2002-07-18 Martin Baulig <martin@gnome.org>
14843 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
14844 Conv_R_Un for the signed `long' type.
14846 2002-07-15 Miguel de Icaza <miguel@ximian.com>
14848 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
14849 `expr' for the temporary result, as that will fail if we do
14850 multiple resolves on the same expression.
14852 2002-07-05 Miguel de Icaza <miguel@ximian.com>
14854 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
14855 ec.TypeContainer for looking up aliases.
14857 * class.cs (TypeContainer): Remove LookupAlias from here.
14859 * decl.cs (DeclSpace); Move here.
14861 2002-07-01 Miguel de Icaza <miguel@ximian.com>
14863 * class.cs (FindMembers): Only call filter if the constructor
14864 bulider is not null.
14866 Also handle delegates in `NestedTypes' now. Now we will perform
14867 type lookups using the standard resolution process. This also
14870 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
14871 This uses Expressions (the limited kind that can be parsed by the
14872 tree) instead of strings.
14874 * expression.cs (ComposedCast.ToString): Implement, used to flag
14875 errors since now we have to render expressions.
14877 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
14880 * ecore.cs (SimpleName.ToString): ditto.
14882 * cs-parser.jay: Instead of using strings to assemble types, use
14883 Expressions to assemble the type (using SimpleName, ComposedCast,
14884 MemberAccess). This should fix the type lookups in declarations,
14885 because we were using a different code path for this.
14887 * statement.cs (Block.Resolve): Continue processing statements
14888 even when there is an error.
14890 2002-07-17 Miguel de Icaza <miguel@ximian.com>
14892 * class.cs (Event.Define): Also remove the `remove' method from
14893 the list of pending items.
14895 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
14896 generate more compact code.
14898 2002-07-17 Martin Baulig <martin@gnome.org>
14900 * const.cs (Const.LookupConstantValue): Add support for constant
14901 `unchecked' and `checked' expressions.
14902 Also adding test case test-140.cs for this.
14904 2002-07-17 Martin Baulig <martin@gnome.org>
14906 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
14907 check whether mi.ReturnType implements the IEnumerator interface; the
14908 `==' and the IsAssignableFrom() will fail in this situation.
14910 2002-07-16 Ravi Pratap <ravi@ximian.com>
14912 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
14915 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14917 * expression.cs: fixed bug #27811.
14919 2002-07-14 Miguel de Icaza <miguel@ximian.com>
14921 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
14922 Molaro: when we are a ref, the value already contains a pointer
14923 value, do not take the address of it.
14925 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14926 * removed mb-parser.jay and mb-tokenizer.cs
14928 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14930 * expression.cs: check against the building corlib void type.
14932 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
14934 * ecore.cs: fix for valuetype static readonly fields: when
14935 initializing them, we need their address, not the address of a copy.
14937 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
14939 * typemanager.cs: register also enum_type in corlib.
14941 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14943 * class.cs: allow calling this (but not base) initializers in structs.
14945 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
14947 * ecore.cs: make sure we compare against the building base types
14950 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
14952 * typemanager.cs: fix TypeToCoreType() to handle void and object
14953 (corlib gets no more typerefs after this change).
14955 2002-07-12 Miguel de Icaza <miguel@ximian.com>
14957 * expression.cs (ArrayCreation.EmitArrayArguments): use
14958 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
14960 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
14961 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
14962 array indexes, the runtime actually forbids them.
14964 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
14965 for array arguments here.
14967 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
14968 instead of the default for ValueTypes.
14970 (New.DoEmit): Use IsValueType instead of
14971 IsSubclassOf (value_type)
14972 (New.DoResolve): ditto.
14973 (Invocation.EmitCall): ditto.
14975 * assign.cs (Assign): ditto.
14977 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
14978 Statements *are* currently doing part of their resolution during
14981 Expressions do always resolve during resolve, but statements are
14982 only required to propagate resolution to their children.
14984 2002-07-11 Miguel de Icaza <miguel@ximian.com>
14986 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
14988 (LoadAssembly): Do not add the dll if it is already specified
14990 (MainDriver): Add the System directory to the link path at the end,
14991 after all the other -L arguments.
14993 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
14994 wrong opcode for loading bytes and bools (ldelem.i1 instead of
14995 ldelem.u1) and using the opposite for sbytes.
14997 This fixes Digger, and we can finally run it.
14999 * driver.cs (UnixParseOption): Move the option parsing here.
15000 (CSCParseOption): Implement CSC-like parsing of options.
15002 We now support both modes of operation, the old Unix way, and the
15003 new CSC-like way. This should help those who wanted to make cross
15004 platform makefiles.
15006 The only thing broken is that /r:, /reference: and /lib: are not
15007 implemented, because I want to make those have the same semantics
15008 as the CSC compiler has, and kill once and for all the confussion
15009 around this. Will be doing this tomorrow.
15011 * statement.cs (Unsafe.Resolve): The state is checked during
15012 resolve, not emit, so we have to set the flags for IsUnsfe here.
15014 2002-07-10 Miguel de Icaza <miguel@ximian.com>
15016 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
15017 not catch the Error_ObjectRefRequired in SimpleName (as it is
15018 possible to have a class/instance variable name that later gets
15019 deambiguated), we have to check this here.
15021 2002-07-10 Ravi Pratap <ravi@ximian.com>
15023 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
15024 make static and put into Expression.
15026 (Event.Define): Register the private field of the event with the
15027 TypeManager so that GetFieldFromEvent can get at it.
15029 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
15030 keep track of the private field associated with an event which
15033 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
15036 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
15038 2002-07-10 Miguel de Icaza <miguel@ximian.com>
15040 * expression.cs (Binary.EmitBranchable): this routine emits the
15041 Binary expression in a branchable context. This basically means:
15042 we need to branch somewhere, not just get the value on the stack.
15044 This works together with Statement.EmitBoolExpression.
15046 * statement.cs (Statement.EmitBoolExpression): Use
15049 2002-07-09 Miguel de Icaza <miguel@ximian.com>
15051 * statement.cs (For): Reduce the number of jumps in loops.
15053 (For): Implement loop inversion for the For statement.
15055 (Break): We can be breaking out of a Try/Catch controlled section
15056 (foreach might have an implicit try/catch clause), so we need to
15057 use Leave instead of Br.
15059 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
15060 now). If the instace expression supports IMemoryLocation, we use
15061 the AddressOf method from the IMemoryLocation to extract the
15062 address instead of emitting the instance.
15064 This showed up with `This', as we were emitting the instance
15065 always (Emit) instead of the Address of This. Particularly
15066 interesting when This is a value type, as we dont want the Emit
15067 effect (which was to load the object).
15069 2002-07-08 Miguel de Icaza <miguel@ximian.com>
15071 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
15073 * statement.cs (Checked): Set the CheckedState during the resolve
15074 process too, as the ConvCast operations track the checked state on
15075 the resolve process, and not emit.
15077 * cs-parser.jay (namespace_member_declaration): Flag that we have
15078 found a declaration when we do. This is used to flag error 1529
15080 * driver.cs: Report ok when we display the help only.
15082 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
15084 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
15086 2002-07-04 Miguel de Icaza <miguel@ximian.com>
15088 * cs-tokenizer.cs (define): We also have to track locally the
15089 defines. AllDefines is just used for the Conditional Attribute,
15090 but we also need the local defines for the current source code.
15092 2002-07-03 Miguel de Icaza <miguel@ximian.com>
15094 * statement.cs (While, For, Do): These loops can exit through a
15095 Break statement, use this information to tell whether the
15096 statement is the last piece of code.
15098 (Break): Flag that we break.
15100 * codegen.cs (EmitContexts): New `Breaks' state variable.
15102 2002-07-03 Martin Baulig <martin@gnome.org>
15104 * class.cs (TypeContainer.MethodModifiersValid): Allow override
15105 modifiers in method declarations in structs. Otherwise, you won't
15106 be able to override things like Object.Equals().
15108 2002-07-02 Miguel de Icaza <miguel@ximian.com>
15110 * class.cs (Method, Property, Indexer): Do not allow the public
15111 modifier to be used in explicit interface implementations.
15113 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
15114 override modifiers in method declarations in structs
15116 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
15118 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
15119 integer or real overflow, report an error
15121 2002-07-02 Martin Baulig <martin@gnome.org>
15123 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
15124 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
15125 to tell the runtime about our newly created System.Object and
15126 System.ValueType types.
15128 2002-07-02 Miguel de Icaza <miguel@ximian.com>
15130 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
15131 struct instead of Ldarg/Starg.
15133 2002-07-02 Martin Baulig <martin@gnome.org>
15135 * expression.cs (Indirection.Indirection): Call
15136 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
15138 2002-07-02 Martin Baulig <martin@gnome.org>
15140 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
15141 ValueType, call TypeManager.TypeToCoreType() on it.
15142 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
15143 the OpCodes.Newarr argument.
15145 2002-07-02 Martin Baulig <martin@gnome.org>
15147 * expression.cs (Invocation.EmitCall): When compiling corlib,
15148 replace all calls to the system's System.Array type to calls to
15149 the newly created one.
15151 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
15152 System.Array methods.
15153 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
15154 from the system's System.Array type which must be replaced.
15156 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
15158 * typemanager.cs: load unverifiable_code_ctor so we can build
15159 corlib using the correct type. Avoid using GetTypeCode() with
15161 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
15162 TypeManager.object_type to allow building corlib.
15164 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
15166 * ecore.cs: handle System.Enum separately in LoadFromPtr().
15168 2002-07-01 Martin Baulig <martin@gnome.org>
15170 * class.cs: Make the last change actually work, we need to check
15171 whether `ifaces != null' to avoid a crash.
15173 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
15175 * class.cs: when we build structs without fields that implement
15176 interfaces, we need to add the interfaces separately, since there is
15177 no API to both set the size and add the interfaces at type creation
15180 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
15182 * expression.cs: the dimension arguments to the array constructors
15183 need to be converted if they are a long.
15185 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
15187 * class.cs: don't emit ldarg.0 if there is no parent constructor
15188 (fixes showstopper for corlib).
15190 2002-06-29 Martin Baulig <martin@gnome.org>
15192 MCS now compiles corlib on GNU/Linux :-)
15194 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
15195 ie. check for MethodImplOptions.InternalCall.
15197 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
15198 and TypeManager.attribute_type are null, so we must explicitly check
15199 whether parent is not null to find out whether it's an attribute type.
15200 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
15201 and SetBuilder, not only if the property is neither abstract nor external.
15202 This is necessary to set the MethodImplOptions on the accessor methods.
15203 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
15204 SetBuilder, see Property.Emit().
15206 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
15207 populate "System.Object", "System.ValueType" and "System.Attribute" since
15208 they've already been populated from BootCorlib_PopulateCoreTypes().
15210 2002-06-29 Martin Baulig <martin@gnome.org>
15212 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
15213 is the NullLiteral, we also need to make sure that target_type is not
15216 2002-06-29 Martin Baulig <martin@gnome.org>
15218 * rootcontext.cs (RootContext.ResolveCore): We must initialize
15219 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
15220 before calling BootstrapCorlib_ResolveDelegate ().
15222 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15224 * statement.cs: fixed build-breaker. All tests passed ok.
15226 2002-06-27 Martin Baulig <martin@gnome.org>
15228 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
15229 for System.Decimal when compiling corlib.
15231 2002-06-27 Martin Baulig <martin@gnome.org>
15233 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
15234 switch blocks which contain nothing but a default clause.
15236 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
15238 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
15240 2002-06-27 Martin Baulig <martin@gnome.org>
15242 * ecore.cs (PropertyExpr.PropertyExpr): Call
15243 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
15245 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
15246 is already a TypeBuilder.
15248 2002-06-27 Martin Baulig <martin@gnome.org>
15250 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
15251 `target_type == TypeManager.array_type', not IsAssignableFrom() in
15252 the "from an array-type to System.Array" case. This makes it work
15253 when compiling corlib.
15255 2002-06-27 Martin Baulig <martin@gnome.org>
15257 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
15258 non-static PropertyExpr, set its InstanceExpression. This makes
15259 the `ICollection.Count' property work in System/Array.cs.
15261 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
15263 * driver.cs: Made error handling more consistent. Errors now
15264 tracked by Report class, so many methods which used to return int
15265 now return void. Main() now prints success/failure and
15266 errors/warnings message.
15268 Renamed '--probe' compiler argument to '--expect-error'. Removed
15269 the magic number return values (123 and 124). Now, if the
15270 expected error occurs, the compiler exits with success (exit value
15271 0). If the compilation completes without seeing that particular
15272 error, the compiler exits with failure (exit value 1). The
15273 makefile in mcs/errors has been changed to handle the new behaviour.
15275 * report.cs: Made 'expected error' number a property and renamed
15276 it from 'Probe' to 'ExpectedError'.
15278 * genericparser.cs: Removed error handling support, since it is
15279 now all done by Report class.
15281 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
15282 class, so parse() no longer returns an int.
15284 * namespace.cs: Use Report.Error instead of GenericParser.error
15286 2002-06-22 Miguel de Icaza <miguel@ximian.com>
15288 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
15289 TypeContainer.AddOperator): At the front of the list put the
15290 explicit implementations, so they get resolved/defined first.
15292 2002-06-21 Miguel de Icaza <miguel@ximian.com>
15294 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
15295 interface type is implemented by this TypeContainer. Used during
15296 explicit interface implementation.
15298 (Property.Define, Indexer.Define, Method.Define): Validate that
15299 the given interface in the explicit implementation is one of the
15300 base classes for the containing type.
15302 Also if we are explicitly implementing an interface, but there is
15303 no match in the pending implementation table, report an error.
15305 (Property.Define): Only define the property if we are
15306 not explicitly implementing a property from an interface. Use the
15307 correct name also for those properties (the same CSC uses,
15308 although that is really not needed).
15310 (Property.Emit): Do not emit attributes for explicitly implemented
15311 properties, as there is no TypeBuilder.
15313 (Indexer.Emit): ditto.
15315 Hiding then means that we do not really *implement* a pending
15316 implementation, which makes code fail.
15318 2002-06-22 Martin Baulig <martin@gnome.org>
15320 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
15321 the return value of Object.GetType(). [FIXME: we need to do this whenever
15322 we get a type back from the reflection library].
15324 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
15326 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
15328 2002-06-20 Miguel de Icaza <miguel@ximian.com>
15330 * attribute.cs: Return null if we can not look up the type.
15332 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
15333 the interface types found.
15335 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
15336 interface types found.
15338 * typemanager.cs (GetInterfaces): Make this routine returns alll
15339 the interfaces and work around the lame differences between
15340 System.Type and System.Reflection.Emit.TypeBuilder in the results
15341 result for GetInterfaces.
15343 (ExpandInterfaces): Given an array of interface types, expand and
15344 eliminate repeated ocurrences of an interface. This expands in
15345 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
15348 2002-06-21 Martin Baulig <martin@gnome.org>
15350 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
15353 2002-06-21 Martin Baulig <martin@gnome.org>
15355 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
15356 and called with one of the core types, return the corresponding typebuilder for
15359 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
15362 2002-06-21 Martin Baulig <martin@gnome.org>
15364 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
15365 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
15366 (Expression.ConvertReferenceExplicit): Likewise.
15368 * expression.cs (ElementAccess.DoResolve): Likewise.
15369 (ElementAccess.DoResolveLValue): Likewise.
15371 2002-06-10 Martin Baulig <martin@gnome.org>
15373 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
15374 add the "value" parameter to the parameter list.
15376 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
15379 2002-06-19 Miguel de Icaza <miguel@ximian.com>
15381 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
15382 the argument to an int, uint, long or ulong, per the spec. Also
15383 catch negative constants in array creation.
15385 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
15387 * class.cs: do not allow the same interface to appear twice in
15388 the definition list.
15390 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
15392 * ecore.cs: don't use ldlen with System.Array.
15394 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
15396 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
15398 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
15400 * modifiers.cs: produce correct field attributes for protected
15401 internal. Easy fix so miguel can work on ther harder stuff:-)
15403 2002-06-18 Miguel de Icaza <miguel@ximian.com>
15405 * pending.cs: New file. Move the code from class.cs here.
15406 Support clearning the pending flag for all methods (when not doing
15407 explicit interface implementation).
15409 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
15411 * rootcontext.cs: added a couple more types needed to bootstrap.
15413 2002-06-17 Miguel de Icaza <miguel@ximian.com>
15415 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
15416 constructor in the type, instead of any constructor in the type
15417 hierarchy. Thanks to Paolo for finding this bug (it showed up as
15418 a bug in the Mono runtime when applying the params attribute).
15420 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
15421 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
15423 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
15425 * expression.cs (Unary.ResolveOperator): Use TypeManager
15426 to resolve the type.
15428 2002-06-13 Ravi Pratap <ravi@ximian.com>
15430 * cs-parser.jay (enum_member_declaration): Pass in the attributes
15433 * enum.cs (AddEnumMember): Add support to store the attributes associated
15434 with each member too.
15436 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
15437 field builders too - this takes care of the enum member case.
15439 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
15441 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
15442 address-of operator on both value types and pointers.
15444 2002-06-10 Martin Baulig <martin@gnome.org>
15446 * interface.cs (Interface.PopulateIndexer): Add the indexer's
15447 PropertyBuilder to the `property_builders' list.
15449 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
15450 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
15451 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
15452 find any indexers which are inherited from an interface.
15454 2002-06-09 Martin Baulig <martin@gnome.org>
15456 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
15457 the same type as the constant if necessary. There's also a test-130.cs
15460 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
15462 * typemanager.cs (TypeManager.ChangeType): Previously known as
15463 Enum.ChangeEnumType().
15465 2002-06-09 Martin Baulig <martin@gnome.org>
15467 * expression.cs (Cast.TryReduce): Added support for consts.
15469 2002-06-08 Ravi Pratap <ravi@ximian.com>
15471 * class.cs (Accessor): Hold attributes information so we can pass
15474 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
15475 Modify to pass in attributes attached to the methods.
15477 (add_accessor_declaration, remove_accessor_declaration): Ditto.
15479 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
15480 to handle the Accessor kind :-)
15482 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
15484 2002-06-08 Martin Baulig <martin@gnome.org>
15486 * expression.cs (Unary.TryReduceNegative): Added support for
15489 2002-06-08 Martin Baulig <martin@gnome.org>
15491 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
15492 name can't be found in the `defined_names' - the caller will do a
15493 MemberLookup in this case and thus find methods in System.Enum
15494 such as Enum.IsDefined().
15496 2002-06-08 Martin Baulig <martin@gnome.org>
15498 * enum.cs (Enum.ChangeEnumType): This is a custom version of
15499 Convert.ChangeType() which works with TypeBuilder created types.
15500 (Enum.LookupEnumValue, Enum.Define): Use it here.
15502 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
15503 `TypeBuilder.BaseType != null' check.
15504 (TypeContainer.FindMembers): Only lookup parent members if we
15505 actually have a parent.
15506 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
15507 (ConstructorInitializer.Resolve): Likewise.
15509 * interface.cs (Interface.FindMembers): Added
15510 `TypeBuilder.BaseType != null' check.
15512 * rootcontext.cs (RootContext.ResolveCore): Added
15513 "System.Runtime.CompilerServices.IndexerNameAttribute" to
15514 classes_second_stage.
15516 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
15517 debug_type and trace_type when compiling with --nostdlib.
15519 2002-06-07 Martin Baulig <martin@gnome.org>
15521 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
15522 (AddField): Set it to true when adding a non-static field.
15523 (DefineType): Use `have_nonstatic_fields' to find out whether we
15524 have non-static fields, not `Fields != null'.
15526 2002-06-02 Miguel de Icaza <miguel@ximian.com>
15528 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
15529 dereferencing a null on the static-field code path)
15531 2002-05-30 Martin Baulig <martin@gnome.org>
15533 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
15534 to take command line arguments. Use reflection to call the new
15535 custom `Initialize' function on the symbol writer and pass it the
15536 command line arguments.
15538 * driver.cs (--debug-args): New command line argument to pass command
15539 line arguments to the symbol writer.
15541 2002-05-28 Miguel de Icaza <miguel@ximian.com>
15543 * assign.cs (DoResolve): Forgot to do the implicit conversion to
15544 the target type for indexers and properties. Thanks to Joe for
15547 2002-05-27 Miguel de Icaza <miguel@ximian.com>
15549 * typemanager.cs (MethodFlags): returns the method flags
15550 (Obsolete/ShouldIgnore) that control warning emission and whether
15551 the invocation should be made, or ignored.
15553 * expression.cs (Invocation.Emit): Remove previous hack, we should
15554 not do this on matching a base type, we should do this based on an attribute
15556 Only emit calls to System.Diagnostics.Debug and
15557 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
15558 on the command line.
15560 * rootcontext.cs: Global settings for tracing and debugging.
15562 * cs-tokenizer.cs (define): New utility function to track
15563 defines. Set the global settings for TRACE and DEBUG if found.
15565 2002-05-25 Ravi Pratap <ravi@ximian.com>
15567 * interface.cs (Populate*): Pass in the TypeContainer as well as
15568 the DeclSpace as parameters so that we can create EmitContexts and
15569 then use that to apply attributes etc.
15571 (PopulateMethod, PopulateEvent, PopulateProperty)
15572 (PopulateIndexer): Apply attributes everywhere.
15574 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
15577 (ApplyAttributes): Update accordingly.
15579 We now apply interface attributes for all members too.
15581 2002-05-26 Miguel de Icaza <miguel@ximian.com>
15583 * class.cs (Indexer.Define); Correctly check if we are explicit
15584 implementation (instead of checking the Name for a ".", we
15585 directly look up if the InterfaceType was specified).
15587 Delay the creation of the PropertyBuilder.
15589 Only create the PropertyBuilder if we are not an explicit
15590 interface implementation. This means that explicit interface
15591 implementation members do not participate in regular function
15592 lookups, and hence fixes another major ambiguity problem in
15593 overload resolution (that was the visible effect).
15595 (DefineMethod): Return whether we are doing an interface
15598 * typemanager.cs: Temporary hack until we get attributes in
15599 interfaces (Ravi is working on that) and we get IndexerName
15600 support in interfaces.
15602 * interface.cs: Register the indexers as properties.
15604 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
15605 warning, I have verified that this is a bug in the .NET runtime
15606 (JavaScript suffers of the same problem).
15608 * typemanager.cs (MemberLookup): When looking up members for
15609 interfaces, the parent of an interface is the implicit
15610 System.Object (so we succeed in searches of Object methods in an
15611 interface method invocation. Example: IEnumerable x; x.ToString
15614 2002-05-25 Miguel de Icaza <miguel@ximian.com>
15616 * class.cs (Event): Events should also register if they do
15617 implement the methods that an interface requires.
15619 * typemanager.cs (MemberLookup); use the new GetInterfaces
15622 (GetInterfaces): The code used to lookup interfaces for a type is
15623 used in more than one place, factor it here.
15625 * driver.cs: Track the errors at the bottom of the file, we kept
15628 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
15629 instance if the method we are calling is static!
15631 2002-05-24 Miguel de Icaza <miguel@ximian.com>
15633 * attribute.cs (ApplyAttributes): Make this function filter out
15634 the IndexerName attribute (as that attribute in reality is never
15635 applied) and return the string constant for the IndexerName
15638 * class.cs (TypeContainer.Emit): Validate that all the indexers
15639 have the same IndexerName attribute, and if so, set the
15640 DefaultName attribute on the class.
15642 * typemanager.cs: The return value might contain other stuff (not
15643 only methods). For instance, consider a method with an "Item"
15644 property and an Item method.
15646 * class.cs: If there is a problem with the parameter types,
15649 2002-05-24 Ravi Pratap <ravi@ximian.com>
15651 * ecore.cs (ImplicitConversionExists): Wrapper function which also
15652 looks at user defined conversion after making a call to
15653 StandardConversionExists - we need this for overload resolution.
15655 * expression.cs : Update accordingly the various method calls.
15657 This fixes 2 bugs filed against implicit user defined conversions
15659 2002-05-22 Miguel de Icaza <miguel@ximian.com>
15661 * statement.cs: Track the result of the assignment.
15663 2002-05-21 Miguel de Icaza <miguel@ximian.com>
15665 * expression.cs (MemberAccess): Improved error reporting for
15666 inaccessible members.
15668 2002-05-22 Martin Baulig <martin@gnome.org>
15670 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
15671 itself with debugging support.
15673 2002-05-22 Martin Baulig <martin@gnome.org>
15675 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
15676 Removed, this isn't needed anymore.
15678 2002-05-20 Martin Baulig <martin@gnome.org>
15680 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
15681 be underlying type for an enum.
15683 2002-05-20 Miguel de Icaza <miguel@ximian.com>
15685 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
15686 that splits out the loading of just the core types.
15688 * rootcontext.cs (ResolveCore): Split the struct resolution in
15689 two, so we can load the enumeration underlying types before any
15692 * expression.cs (Is): Bandaid until we fix properly Switch (see
15693 bug #24985 for details).
15695 * typemanager.cs (ImplementsInterface): The hashtable will contain
15696 a null if there are no interfaces implemented.
15698 2002-05-18 Miguel de Icaza <miguel@ximian.com>
15700 * cs-parser.jay (indexer_declarator): It is fine to have array
15703 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15705 * typemanager.cs: (RegisterBuilder): New function used to register
15706 TypeBuilders that implement interfaces. Since
15707 TypeBuilder.GetInterfaces (as usual) does not work with lame
15709 (AddUserType): register interfaces.
15711 (ImplementsInterface): Use the builder_to_ifaces hash if we are
15712 dealing with TypeBuilder. Also, arrays are showing up as
15713 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
15714 methods can not be invoked on them!
15716 * ecore.cs (ExplicitReferenceConversionExists): Made public.
15717 (ImplicitReferenceConversionExists): Split out from
15718 StandardConversionExists.
15720 * expression.cs (As): We were only implementing one of the three
15721 cases for the as operator. We now implement them all.
15722 (Is): Implement the various other cases for Is as well.
15724 * typemanager.cs (CACHE): New define used to control if we want or
15725 not the FindMembers cache. Seems to have a negative impact on
15726 performance currently
15728 (MemberLookup): Nested types have full acess to
15729 enclosing type members
15731 Remove code that coped with instance/static returns for events, we
15732 now catch this in RealFindMembers.
15734 (RealFindMembers): only perform static lookup if the instance
15735 lookup did not return a type or an event.
15737 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15739 * assign.cs (CompoundAssign): We pass more semantic information
15740 now to Compound Assignments than we did before: now we have all
15741 the information at hand, and now we resolve the target *before* we
15742 do the expression expansion, which allows the "CacheValue" method
15743 to have the effect we intended (before, a [x] += 1 would generate
15744 two differen ArrayAccess expressions from the ElementAccess,
15745 during the resolution process).
15747 (CompoundAssign.DoResolve): Resolve target and original_source here.
15749 2002-05-16 Miguel de Icaza <miguel@ximian.com>
15751 * expression.cs (ArrayAccess): dropped debugging information.
15753 * typemanager.cs: Small bug fix: I was always returning i_members,
15754 instead of one of i_members or s_members (depending on which had
15757 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
15758 method is invoked before any code generation takes place, and it
15759 is a mechanism to inform that the expression will be invoked more
15760 than once, and that the method should use temporary values to
15761 avoid having side effects
15763 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
15765 * ecore.cs (Expression.CacheTemporaries): Provide empty default
15768 * expression.cs (Indirection, ArrayAccess): Add support for
15769 CacheTemporaries in these two bad boys.
15771 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
15772 ldobj or ldind_ref.
15773 (StoreFromPtr): Handle stobj as well.
15775 * expression.cs (UnaryMutator): Share more code.
15777 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
15778 down: I was not tracking the Filter function as well, which
15779 was affecting the results of the cache.
15781 2002-05-15 Miguel de Icaza <miguel@ximian.com>
15783 * attribute.cs: Remove the hack to handle the CharSet property on
15786 2002-05-14 Miguel de Icaza <miguel@ximian.com>
15788 * attribute.cs (DoResolve): More uglyness, we now only try to
15789 resolve the attribute partially, to extract the CharSet
15790 information (only if we are a StructLayout attribute). Otherwise
15792 (GetExtraTypeInfo): Add some code to conditionally kill in the
15793 future this. I am more and more convinced that the .NET
15794 framework has special code to handle the attribute setting on
15797 * expression.cs (IsParamsMethodApplicable): Revert my previous
15798 foreach change here, it was wrong.
15800 2002-05-13 Miguel de Icaza <miguel@ximian.com>
15802 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
15803 (pp_expr): do not abort on unknown input, just return.
15804 (eval): abort if there are pending chars.
15806 * attribute.cs (Attribute.Resolve): Positional parameters are
15807 optional. Deal with that case.
15809 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
15810 the Ansi/Unicode/Auto information for the type.
15812 (TypeContainer.DefineType): instantiate the EmitContext here, as
15813 we will be using it during the type definition (to resolve
15814 attributes) and during the emit phase.
15816 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
15817 to pull type information out of the attributes
15819 (Attribute.Resolve): track the constructor builder, and allow for
15820 multiple invocations (structs and classes will use this).
15822 * ecore.cs (MemberLookupFinal): new version with all the
15823 parameters customizable.
15825 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
15826 constructors. Return if the result value is null (as the error
15827 would have been flagged already by MemberLookupFinal)
15829 Do not allow instances of abstract classes or interfaces to be
15832 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
15833 We have to compare the assembly property here when dealing with
15834 FamANDAssem and Assembly access modifiers, because we might be
15835 creating an assembly from *modules* (that means that we are not
15836 getting TypeBuilders for types defined in other modules that are
15837 part of this assembly).
15839 (Method.Emit): If the method is marked abstract and has a body,
15842 (TypeContainer.DefineMembers): If both the defined member and the
15843 parent name match are methods, then do not emit any warnings: let
15844 the Method.Define routine take care of flagging warnings. But if
15845 there is a mismatch (method overrides something else, or method is
15846 overriwritten by something, then emit warning).
15848 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
15849 set to null, this means `do not check for the return type on the
15852 (Method.Define): set the return type for the method signature to
15853 null, so that we get methods with the same name and parameters and
15854 different return types. This is used to flag warning 114 (you are
15855 hiding a method, and you probably want to use the new/override
15858 * typemanager.cs (MemberLookup): Implemented proper access
15859 control, closing a long standing set of bug reports. The problem
15860 was that the Framework only has two bits: Public and NonPublic,
15861 and NonPublic includes private and protected methods, but we need
15862 to enforce the FamANDAssem, FamOrAssem and Family.
15864 2002-05-11 Miguel de Icaza <miguel@ximian.com>
15866 * statement.cs (GotoCase): Return true: Ammounts to giving up
15867 knowledge on whether we return or not, and letting the other case
15868 be responsible for it.
15870 2002-05-10 Miguel de Icaza <miguel@ximian.com>
15872 * driver.cs: Do not load directories for each file processed, only
15873 do it if there is a pattern.
15875 * ecore.cs: Report readonly assigns here as well, as we might have
15876 been resolved only by MemberAccess.
15878 (SimpleName.SimpleNameResolve): Also be useful for LValue
15879 resolution. We need this to propagate assign to local readonly variables
15881 * typemanager.cs: Use a ptrhashtable for the criteria, because we
15882 do not want to reuse potential criteria memory.
15884 * class.cs (MyEventBuilder): Set reflected_type;
15886 * ecore.cs (Constantify): Added support for constifying bools.
15888 (RootContext.LookupType): Added a cache for values looked up in
15889 the declaration space.
15891 * typemanager.cs (FindMembers): Now is a front-end to
15892 RealFindMembers, and provides a two-level hashtable-based cache to
15895 15% performance improvement: from 22.5 to 19.2 seconds.
15897 * expression.cs (IsParamsMethodApplicable): use foreach.
15898 (Invocation.DoResolve): ditto.
15899 (New.DoResolve): ditto.
15900 (ArrayCreation.DoResolve): ditto.
15902 * ecore.cs (FindMostEncompassingType): use foreach.
15904 * delegate.cs (NewDelegate.DoResolve): Use foreach
15906 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
15907 (RemoveMethods): use foreach.
15909 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
15910 nested foreach statements instead of for, and also break out of
15911 the inner loop once a match is found.
15913 (Invocation.OverloadResolve): Use foreach, simplify the code.
15915 2002-05-08 Miguel de Icaza <miguel@ximian.com>
15917 * cfold.cs (BinaryFold): During an enumeration evaluation context,
15918 we actually unwrap the expression to allow for extra information
15921 * expression.cs: Use Shr_Un on unsigned operations.
15923 2002-05-08 Ravi Pratap <ravi@ximian.com>
15925 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
15926 applicable operators was not being considered correctly. This closes
15927 the bug Miguel reported.
15929 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
15931 * attribute.cs: check that the type derives from System.Attribute
15932 and report the correct error in that case (moved the duplicate code to
15933 its own method, too).
15935 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
15937 * attribute.cs: lookup attribute type name as the spec says: first the
15938 bare attribute name and then name + "Attribute" (nant compiles with
15939 mcs after this fix).
15941 2002-05-07 Miguel de Icaza <miguel@ximian.com>
15943 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
15944 Because of the way we parse things, we should try to see if a
15945 UIntConstant can fit in an integer.
15947 2002-05-07 Ravi Pratap <ravi@ximian.com>
15949 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
15950 when we are in an explicit context.
15952 (ConvertReferenceExplicit): When converting from Iface type S to Class
15953 T make sure the rules are implemented as an OR.
15955 * parameter.cs (ParameterType): Make it a property for now although the
15956 purpose really isn't anything immediate.
15958 * expression.cs (Is*Applicable): Do better checking on the parameter type
15959 of a ref/out parameter. The ones from the system assemblies are already
15960 marked with the correct type so we don't need to do any correction.
15962 * ecore.cs (StandardConversionExists): Conversion from Interface types to
15963 the object type is standard too so include that.
15965 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15967 * ecore.cs (StandardConversionExists): Augment with missing code:
15968 deal with IntConstant, LongConstants and Enumerations.
15970 * assign.cs: Report the error, instead of failing silently
15972 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
15973 typecontainer that they are declared, because the
15974 typecontainer/namespace will have the list of using clauses that
15975 need to be applied.
15977 Assembly Attributes were escaping the normal registration
15980 (EmitCode): Apply attributes within an EmitContext that represents
15981 the container they were declared on.
15983 * cs-parser.jay: Track bases for structs. How did I get this wrong?
15985 2002-05-06 Ravi Pratap <ravi@ximian.com>
15987 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
15988 Revamp completely - make much cleaner as we now operate only
15991 (FindMostSpecificSource, FindMostSpecificTarget): New methods
15992 to implement the logic detailed in the spec more correctly.
15994 (UserDefinedConversion): Update accordingly.
15996 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15998 * statement.cs: Return flow analysis information up.
16000 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
16003 (token): Do not consume an extra character before calling
16006 2002-05-06 Piers Haken <piersh@friskit.com>
16008 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
16010 2002-05-06 Miguel de Icaza <miguel@ximian.com>
16012 * class.cs (Constructor.Emit): Set the IsStatic flag in the
16013 EmitContext during the instance constructor initializer
16014 resolution, to stop access to instance variables.
16016 This is mandated by the spec, last paragraph of the `constructor
16017 initializers' section.
16019 2002-05-05 Miguel de Icaza <miguel@ximian.com>
16021 * cs-parser.jay, class.cs (Accessor): new class used to represent
16022 an accessor (get or set). In the past we used `null' to represent
16023 a missing accessor. But this is ambiguous because there was no
16024 way to tell in abstract indexers/properties if one of them was
16027 Now there is a way of addressing that.
16029 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
16030 instead of FindMembers.
16032 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
16033 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
16035 * attribute.cs: Treat indexers and properties as the same in terms
16036 of applying attributes
16038 * ecore.cs (FindMostEncompassedType): Use statically initialized
16039 EmptyExpressions()s like we do elsewhere to avoid creating useless
16040 objects (and we take this out of the tight loop).
16042 (GetConversionOperators): Move the code to extract the actual
16043 operators to a separate routine to clean things up.
16045 2002-05-04 Miguel de Icaza <miguel@ximian.com>
16047 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
16048 events are always registered FieldBuilders.
16050 * class.cs (FieldBase): New class shared by Fields
16052 * delegate.cs: If we are a toplevel delegate, use our full name.
16053 If we are a nested delegate, then only use our tail name.
16055 2002-05-02 Ravi Pratap <ravi@ximian.com>
16057 * expression.cs (IsApplicable): Ensure that we add the "&" to
16058 ref/out types before comparing it with the type of the argument.
16060 (IsParamsMethodApplicable): Ditto.
16062 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
16065 * delegate.cs : Handle the case when we have more than one applicable
16066 method. Flag an error only when we finish checking all.
16068 2002-05-02 Miguel de Icaza <miguel@ximian.com>
16070 * expression.cs: Add support for boolean static initializers.
16072 2002-05-01 Miguel de Icaza <miguel@ximian.com>
16074 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
16076 * parameter.cs (ComputeParameterTypes,
16077 ComputeAndDefineParameterTypes): Better error handling: now we
16078 clear the `types' cache if we fail during any of the type lookups.
16079 We also return the status code correctly to our caller
16081 * delegate.cs: If we fail to define a delegate, abort the extra
16084 * expression.cs (Binary.ResolveOperator): for
16085 operator==(object,object) and operator !=(object, object) we also
16086 have to verify that there is an implicit conversion from one to
16089 (ArrayAccess.DoResolve): Array Access can operate on
16092 2002-04-30 Miguel de Icaza <miguel@ximian.com>
16094 * assign.cs (CompoundAssign): A new class used as a "flag" that
16095 the assignment actually is happening as part of a compound
16096 assignment operator.
16098 During compound assignment, a few new rules exist to enable things
16105 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
16106 to the type of x) if y is implicitly convertible to the type of x,
16107 and the operator is a builtin operator and the return type of the
16108 operator is explicitly convertible to the type of x.
16110 * rootcontext.cs: Reset warning level to 2. 4 catches various
16111 "interesting" features in mcs, we must clean this up at some
16112 point, but currently am trying to kill other bugs ;-)
16114 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
16115 in container classes as well.
16117 * expression.cs (Binary.ResolveOperator): Handle string case
16118 before anything else (as operator overloading does emit an error
16119 before doing anything else).
16121 This code could go away when we move to a table driven model, but
16122 i could not come up with a good plan last night.
16124 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
16126 * typemanager.cs (CSharpName): reimplementation using regex.
16127 * class.cs: added null check for fields in Emit
16128 * rootcontext.cs: set warninglevel to 4
16130 2002-04-29 Miguel de Icaza <miguel@ximian.com>
16132 * typemanager.cs (CSharpName): reimplemented with Lupus
16135 2002-04-28 Miguel de Icaza <miguel@ximian.com>
16137 * statement.cs (If): correclty implement Resolve, because we were
16138 not catching sem errors in there. The same process is needed
16140 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
16143 (Statement.Warning_DeadCodeFound): Factorize code.
16144 (While): Report dead code here too.
16146 (Statement): Added Resolve virtual method to allow
16147 for resolution split from the emit code.
16149 2002-04-26 Miguel de Icaza <miguel@ximian.com>
16151 * statement.cs (EmitBoolExpression): No longer try to resolve the
16153 (MakeBoolean): New utility function that resolve, implicitly
16154 converts to boolean and tags the expression.
16157 (If, Do): Implement dead code elimination.
16158 (While): Implement loop inversion
16160 (Do, While, For, If): Resolve the expression prior to calling our
16163 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
16166 - added method Report28 (warning: program has more than one entry point)
16167 - added method IsEntryPoint, implements paragraph 10.1 of the spec
16168 - modified method Method.Define, the part at the end of the method
16170 * rootcontext.cs: added static public Location EntryPointLocation;
16172 * ../errors/cs0028.cs : Add test case for the above warning.
16175 - modified method CSharpName to allow arrays of primitive type to
16176 be printed nicely (e.g. instead of System.Int32[][] it now prints
16178 - added method CSharpSignature: returns the signature of a method
16179 in string format to be used in reporting errors, warnings, etc.
16181 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
16184 2002-04-26 Ravi Pratap <ravi@ximian.com>
16186 * delegate.cs (Define): Fix extremely silly bug where I was
16187 setting the type of the 'object' parameter of the BeginInvoke
16188 method to System.IAsyncResult instead of System.Object ;-)
16190 2002-04-26 Miguel de Icaza <miguel@ximian.com>
16192 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
16195 (Constructor.Emit): return if we fail to initialize the
16196 constructor. Another door closed!
16198 * expression.cs (New.DoResolve): Improve error message (from -6 to
16199 1501). Use DeclaredOnly lookup to find the exact constructor.
16201 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
16202 loop. This is useful.
16204 * cs-parser.jay: Adjust the default parameters so that destructors
16205 have the proper signature.
16207 2002-04-26 Martin Baulig <martin@gnome.org>
16209 * driver.cs (LoadAssembly): If `assembly' contains any characters
16210 which are only valid in path names and not in assembly names
16211 (currently slash, backslash and point), use Assembly.LoadFrom ()
16212 instead of Assembly.Load () on the `assembly' (before iteration
16213 over the link_paths).
16215 2002-04-26 Martin Baulig <martin@gnome.org>
16217 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
16219 2002-04-25 Miguel de Icaza <miguel@ximian.com>
16221 * class.cs (Property): use the new typemanager.MemberLookup
16223 (TypeContainer.MemberLookup): Implement using the
16224 TypeManager.MemberLookup now.
16226 * typemanager.cs: Make MemberLookup a function of the TypeManager,
16227 and return MemberInfos, so that these can be used without an
16228 EmitContext (what we had before).
16230 2002-04-24 Miguel de Icaza <miguel@ximian.com>
16232 * expression.cs: Fix the case where the argument to params if the
16233 type of the params. I omitted handling this before. Fixed
16235 2002-04-22 Miguel de Icaza <miguel@ximian.com>
16237 * driver.cs: Call BootCorlib_PopulateCoreType
16239 * class.cs (Property.CheckBase): Check for properties only, not
16242 * interface.cs: Temporary hack: try/catch around the
16243 CustomAttributeBuilder, because I am getting an exception that I
16246 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
16247 types whose definitions are required to be there (attributes are
16248 defined before standard types).
16250 Compute definitions as we boot the various types, as they are used
16251 immediately (value_type class will need object_type, but if we do
16252 not initialize object_type, we will pass a null, which will let
16253 the runtime pick the System.Object from the existing corlib, which
16254 is not what we want).
16256 2002-04-22 Patrik Torstensson <totte@labs2.com>
16258 * cs-tokenizer.cs: fixed a number of trim() issues.
16260 2002-04-22 Ravi Pratap <ravi@ximian.com>
16262 * expression.cs (Argument.Type): Ensure that we return the correct
16263 type when we have out or ref parameters [in which case we
16266 2002-04-22 Miguel de Icaza <miguel@ximian.com>
16268 * class.cs (Property, Indexer): Allow extern modifier in there.
16270 * typemanager.cs (InitBaseTypes): Initializes object_type and
16271 value_type, since those will be used early on during the bootstrap
16272 process to compile corlib.
16274 (InitCoreTypes): Move code from here to InitBaseTypes.
16276 2002-04-21 Miguel de Icaza <miguel@ximian.com>
16278 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
16279 single-dimension arrays as using the ldlen opcode.
16281 Daniel Lewis discovered this optimization.
16283 * typemanager.cs: Add signature for System.Array::get_Length
16285 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16287 * statement.cs: report the error when the foreach does not apply to an
16288 array nor a collection.
16290 2002-04-19 Miguel de Icaza <miguel@ximian.com>
16292 * expression.cs: Add implicit conversions to the operator ~.
16294 * constant.cs (DecimalConstant.Emit): Emit decimal value.
16296 * typemanager.cs: Locate the decimal constructor.
16298 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16300 * attribute.cs: use the new property of TypeOf.
16301 * expression.cs: added 'get' property around typearg.
16303 These changes fix a build breaker reported by NickD. Is this the
16304 correct way to fix? If not, please, revert my changes and make it
16307 2002-04-17 Miguel de Icaza <miguel@ximian.com>
16309 * attribute.cs: Add support for typeof in attribute invocations.
16310 I am not sure that this is right though.
16312 2002-04-14 Duncan Mak <duncan@ximian.com>
16314 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
16315 Binary.Operator.Division case.
16317 2002-04-13 Ravi Pratap <ravi@ximian.com>
16319 * class.cs (DefineType): Ensure that we do a proper check on
16320 attribute types and also register it with the TypeManager.
16322 (TypeContainer.Targets): The default for attribute types is
16323 AttributeTargets.All.
16325 * attribute.cs (ApplyAttributes): Registering the attribute type
16326 is done elsewhere, not when we discover we have a Usage attribute.
16328 2002-04-12 Ravi Pratap <ravi@ximian.com>
16330 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
16331 and get rid of is_delegate parameter.
16333 * everywhere : update.
16335 2002-04-12 Ravi Pratap <ravi@ximian.com>
16337 * cs-parser.jay (compilation_unit): Revamp completely to use
16338 some new ideas that I got from Rhys' grammar to solve the problems
16339 with assembly level attributes.
16341 (outer_declaration): New grammar production.
16343 (attribute_sections): Add.
16345 (opt_attributes): Base on attribute_sections
16347 (namespace_declaration): Allow opt_attributes to tackle the case
16348 when we have assembly level attributes - we are clever in this
16351 * attribute.cs (ApplyAttributes): Do not worry about assembly
16352 attributes in the non-global context.
16354 * rootcontext.cs (AddGlobalAttributes): Go back to using this
16355 instead of SetGlobalAttributes.
16357 * class.cs, rootcontext.cs : Ensure we define and generate
16358 attribute types before anything else.
16360 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
16361 and flag the new error -20 for the case when the attribute type
16362 does not have valid targets specified. csc does not catch this.
16364 * ../errors/errors.txt : update for error # -20
16366 2002-04-11 Ravi Pratap <ravi@ximian.com>
16368 * support.cs (InternalParameters.ParameterModifier): Do some null
16369 checking and return sane values.
16371 * class.cs (Method.Define): If we are a PInvoke method, ensure
16372 that we are static and extern. Report error # 601
16374 * ../errors/cs0601.cs : Add test case for the above error.
16376 2002-04-07 Ravi Pratap <ravi@ximian.com>
16378 * rootcontext.cs (attribute_types): We need to keep type of
16379 all attribute types separately and emit code for them first.
16381 (RegisterAttribute) : Implement.
16383 * class.cs (DefineType): Check if the current Type is a custom
16384 attribute type and register it accordingly.
16386 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
16387 adding the first attribute twice and rename to
16389 (SetGlobalAttributes): this.
16391 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
16394 * attribute.cs (ApplyAttributes): Take an additional argument telling us
16395 if we are processing global arguments. Hmm, I am unsure of this.
16397 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16399 * expression.cs: added static array of strings to avoid calling
16400 Enum.ToString () for Operator in Binary. Significant recover of
16403 2002-04-10 Miguel de Icaza <miguel@ximian.com>
16405 * class.cs (FindMembers): Allow the Builders of the various
16406 members to be null. If they are skip them. This only happens
16407 during the PInvoke declaration.
16409 2002-04-09 Miguel de Icaza <miguel@ximian.com>
16411 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
16412 failure, so we do not keep going afterwards.
16414 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
16415 wanted to pass `false' as the `is_delegate' argument. If this is
16416 the case, why not use delegate_type == null to mean `is_delegate =
16417 false' and anything else as is_delegate = true.
16419 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
16421 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
16422 code for the section, not the beginning of the tests.
16424 2002-04-08 Miguel de Icaza <miguel@ximian.com>
16426 * cfold.cs: Handle operator + (Enum x, Underlying x)
16428 * expression.cs (Binary): same. Warn about errors where we have
16429 Enum/Enum in operator + as well.
16431 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
16434 - added support for switch(bool)
16435 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
16436 - add TableSwitchEmit() to handle table-based switch statements
16438 2002-04-05 Ravi Pratap <ravi@ximian.com>
16440 * expression.cs (Invocation.OverloadResolve): Factor out code which
16441 does parameter compatibility checking with arguments so that we can
16442 re-use the code even from Delegate.VerifyApplicability
16444 (VerifyArgumentsCompat): Move above code here.
16446 * delegate.cs (VerifyApplicability): Get rid of duplicate code
16447 and instead make a call to the above method.
16449 2002-03-31 Ravi Pratap <ravi@ximian.com>
16451 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
16452 We use it to keep track of classes which are attribute types.
16454 2002-04-02 Miguel de Icaza <miguel@ximian.com>
16456 * delegate.cs (Delegate.Define): Correctly define the types in the
16457 presence of fixed and array parameters.
16459 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
16462 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
16463 include NonPublic after the first iteration.
16465 * class.cs (Indexer.CheckBase): Only check if both parents are
16468 * cs-parser.jay (accessor_body): If empty, set to null.
16470 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
16471 same code path here to resolve constants names that we did have in
16472 MemberAccess.DoResolve. There is too much code duplicated here.
16474 2002-04-01 Miguel de Icaza <miguel@ximian.com>
16476 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
16478 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
16481 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
16482 tokens, numbers and strings.
16484 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
16487 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
16488 asyncronous parameters and the regular parameters.
16490 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
16491 specify the target directory.
16493 * expression.cs: (This.DoResolve): Simplify
16494 (As.Emit): Optimize, do not generate IsInst if the expression is
16495 always of the given type.
16497 (Is.DoResolve): Bug fix, we were reporting both always/never for
16500 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
16501 creating too many unnecessary arrays.
16503 2002-03-31 Miguel de Icaza <miguel@ximian.com>
16505 * class.cs (EmitFieldInitializer): Use Assign expression to assign
16506 fields instead of rolling our own initializer. Takes care of all
16507 implicit conversions, and drops unnecessary static checks/argument.
16509 2002-03-31 Dick Porter <dick@ximian.com>
16511 * driver.cs: use the GetDirectories() return values properly, and
16512 use "/" as path separator.
16514 2002-03-30 Miguel de Icaza <miguel@ximian.com>
16516 * expression.cs (Unary): Optimize - - expr into expr.
16517 (Binary): Optimize a + (-b) into a -b.
16519 * codegen.cs (CodeGen): Made all methods static.
16521 2002-03-29 Miguel de Icaza <miguel@ximian.com>
16525 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
16526 TypeBuilder property.
16528 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
16531 * tree.cs: Removed the various RecordXXXX, and replaced with a
16532 single RecordDecl. Removed all the accessor methods, and just
16533 left a single access point Type
16535 * enum.cs: Rename DefineEnum to DefineType.
16537 * decl.cs: New abstract method `DefineType' used to unify the
16538 Defines for Enumerations, Interfaces, TypeContainers and
16541 (FindType): Moved LookupInterfaceOrClass here. Moved the
16542 LookupBaseClasses method that used to live in class.cs and
16543 interface.cs here, and renamed to FindType.
16545 * delegate.cs: Implement DefineType. Take advantage of the
16546 refactored pattern for locating the parent builder without taking
16547 the parent_builder argument (which we know does not work if we are
16548 nested, and triggering a toplevel definition).
16550 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16552 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
16553 accessibility of a member has changed during override and report
16556 * class.cs (Method.Define, Property.Define): Only complain on
16557 overrides if the method is private, any other accessibility is
16558 fine (and since we just checked the permission is the same, we are
16561 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
16562 and elif are processed always. The other pre-processing
16563 directives are only processed if we are "taking" the path
16565 2002-03-29 Martin Baulig <martin@gnome.org>
16567 * class.cs (Method.Emit): Only emit symbolic debugging info if the
16568 current location is not Null.
16570 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
16571 a separate method so we can profile it.
16573 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
16574 `span.Seconds' are just seconds, but no minutes or hours.
16575 (MainDriver): Profile the CodeGen.SaveSymbols calls.
16577 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16579 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
16580 Remove the gratuitous set of Final:
16582 // If an interface implementation, then we can set Final.
16583 if (((flags & MethodAttributes.Abstract) == 0) &&
16584 implementing.DeclaringType.IsInterface)
16585 flags |= MethodAttributes.Final;
16587 I do not know what I was smoking when I used that.
16590 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
16591 step into fixing the name resolution issues for delegates and
16592 unifying the toplevel name resolution.
16594 2002-03-28 Martin Baulig <martin@gnome.org>
16596 * class.cs (Method.Emit): If we have a symbol writer, call its
16597 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
16598 tell it about the current method.
16600 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
16601 writer that we're going to emit the first byte of IL code for a new
16602 statement (a new source line).
16603 (EmitContext.EmitTopBlock): If we have a symbol writer, call
16604 EmitContext.Mark() before emitting any code.
16606 * location.cs (SymbolDocument): Return null when we're Null.
16608 * statement.cs (Statement): Moved the `Location loc' variable here.
16609 (Statement.EmitBoolExpression): If we have a symbol writer, call
16610 ec.Mark() before emitting any code to tell it that we're at the
16611 beginning of a new statement.
16612 (StatementExpression): Added `Location' argument to the constructor.
16613 (Block): Added public readonly variable `StartLocation' and public
16614 variable `EndLocation'. The latter is to be set using SetEndLocation().
16615 (Block): Added constructor which takes a start and end location.
16616 (Block.SetEndLocation): New method. This sets the end location.
16617 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
16618 local variables we create.
16619 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
16620 each statement and do also mark the begin and end of the block.
16622 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
16623 tell it the current lexer.Location, use Location.Null for the end of the
16625 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
16626 current block, set its end location using SetEndLocation().
16627 (statement_expression): StatementExpression constructor now takes the
16628 lexer.Location as additional argument.
16629 (for_statement, declare_local_variables): Likewise.
16630 (declare_local_variables): When creating a new implicit block, use the
16631 new Block constructor and pass it the lexer.Location.
16633 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16635 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
16636 members also on the parent interfaces recursively.
16638 2002-03-27 Miguel de Icaza <miguel@ximian.com>
16640 * report.cs: Use new formats, since Gonzalo finished the missing
16643 * expression.cs (Binary.ResolveOperator): added missing operator|
16644 operator& and operator^ for bool/bool.
16646 * cs-parser.jay: CheckDef now takes a Location argument that is
16647 used to report errors more precisly (instead of reporting the end
16648 of a definition, we try to track something which is a lot closer
16649 to the source of the problem).
16651 * cs-tokenizer.cs: Track global token use, so we can properly flag
16652 the use of #define/#undef after the first token has been seen.
16654 Also, rename the reportXXXX to Error_DescriptiveName
16656 * decl.cs (DeclSpace.IsTopLevel): Move property here from
16657 TypeContainer, so that Enum and Interface can use this too.
16659 * class.cs (TypeContainer.LookupInterfaceOrClass,
16660 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
16661 `builder' argument. Typically this was used to pass the parent
16662 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
16665 The problem is that a nested class could trigger the definition of
16666 a toplevel class, and the builder would be obviously wrong in that
16669 So we drop this argument, and we compute dynamically the
16670 TypeBuilder/ModuleBuilder (the correct information was available
16671 to us anyways from DeclSpace.Parent)
16673 * interface.cs (Interface.DefineInterface): Drop builder
16674 parameter cleanup like class.cs
16676 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
16679 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
16682 (Try.Emit): Propagate the returns value from the statement.
16684 (Return.Emit): Even if we are leavning
16686 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
16688 * modifiers.cs: Fix the computation of MethodAttributes flags.
16690 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
16692 * driver.cs: allow compilation of files that start with '/'.
16693 Add a default case when checking the argument of --target.
16695 2002-03-25 Miguel de Icaza <miguel@ximian.com>
16697 * interface.cs: Implement the same search algorithm for types in
16698 the interface code.
16700 * delegate.cs: Do not allow multiple definition.
16702 * Recovered ChangeLog that got accidentally amputated
16704 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
16706 * rootcontext.cs: Load manually enum to allow core classes to
16707 contain enumerations.
16709 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
16710 Update to new static methods in TypeManager.
16712 * typemanager.cs (GetMethod, GetConstructor): Use our
16713 implementation of FindMembers to find the members, since during
16714 corlib compilation, the types are TypeBuilders and GetMethod and
16715 GetConstructor do not work.
16717 Make all methods in TypeManager static.
16719 (InitCodeHelpers): Split the functionality from
16720 the InitCodeTypes function.
16722 * driver.cs: Call InitCodeHelpers after we have populated the
16725 * cs-parser.jay (delegate_declaration): we did not used to compute
16726 the delegate name correctly for void delegates.
16728 2002-03-24 Miguel de Icaza <miguel@ximian.com>
16730 * rootcontext.cs (RootContext): Init the interface_resolve_order
16731 and type_container_resolve_order always.
16733 (ResolveCore, BootstrapCorlib_ResolveClass,
16734 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
16735 compiler when compiling with --nostdlib
16737 * class.cs (TypeContainer.DefineType): Check that our parent is
16738 not null. This test is most important when we are bootstraping
16741 * codegen.cs: Split out the symbol writing code.
16743 2002-03-25 Martin Baulig <martin@gnome.org>
16745 * driver.cs (-g): Made -g an alias for --debug.
16747 2002-03-24 Martin Baulig <martin@gnome.org>
16749 * codegen.cs (SymbolWriter): New public variable. Returns the
16750 current symbol writer.
16751 (CodeGen): Added `bool want_debugging_support' argument to the
16752 constructor. If true, tell the ModuleBuild that we want debugging
16753 support and ask it for the ISymbolWriter.
16754 (Save): If we have a symbol writer, call it's Close() method after
16755 saving the assembly.
16757 * driver.c (--debug): New command line argument to create a
16758 debugger information file.
16760 * location.cs (SymbolDocument): New public property. Returns an
16761 ISymbolDocumentWriter object for the current source file or null
16762 if we don't have a symbol writer.
16764 2002-03-21 Miguel de Icaza <miguel@ximian.com>
16766 * driver.cs (LoadAssembly): Correctly return when all the paths
16767 have been tried and not before.
16769 * statement.cs (Switch.Emit): return the actual coverage for this
16770 statement (returns/not-returns)
16772 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
16773 switch of the statement if we are the last switch section. That
16774 kills two problems: try/catch problems (we used to emit an empty
16775 nop at the end) and switch statements where all branches would
16778 2002-03-19 Miguel de Icaza <miguel@ximian.com>
16780 * driver.cs: Add default assemblies (the equivalent to the
16781 Microsoft CSC.RSP file)
16783 * cs-tokenizer.cs: When updating `cols and setting it to zero,
16784 also update tokens_seen and set it to false.
16786 * driver.cs: Implement --recurse for Mike.
16788 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
16789 correctly splitting out the paths.
16791 2002-03-18 Miguel de Icaza <miguel@ximian.com>
16793 * interface.cs (Interface.PopulateProperty): Instead of using
16794 `parent' as the declaration space for the set parameters, use
16797 * support.cs (InternalParameters): InternalParameters constructor
16798 takes a DeclSpace instead of a TypeContainer.
16800 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
16801 types are being initialized, load the address of it before calling
16804 (New): Provide a mechanism to disable the generation of local
16805 value type temporaries when the caller will be providing us with
16806 an address to store it.
16808 (ArrayCreation.EmitDynamicInitializers): Use it.
16810 2002-03-17 Miguel de Icaza <miguel@ximian.com>
16812 * expression.cs (Invocation.EmitArguments): Only probe for array
16813 property if there is more than one argument. Sorry about that.
16815 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
16816 empty param arrays.
16818 * class.cs (Method.LabelParameters): Fix incorrect code path that
16819 prevented the `ParamArrayAttribute' from being applied to the
16822 2002-03-16 Miguel de Icaza <miguel@ximian.com>
16824 * support.cs (ReflectionParameters): Correctly compute whether the
16825 last argument is a params array. Fixes the problem with
16828 * typemanager.cs: Make the assemblies array always be non-null
16829 (empty, but non-null)
16831 * tree.cs (RecordDecl): New function that abstracts the recording
16832 of names. This reports error 101, and provides a pointer to the
16833 previous declaration. Fixes a crash in the compiler.
16835 * cs-parser.jay (constructor_declaration): Update to new grammar,
16836 and provide a constructor_body that can be empty.
16838 2002-03-15 Miguel de Icaza <miguel@ximian.com>
16840 * driver.cs: Add support for --resources.
16842 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
16843 Make all types for the various array helper methods be integer.
16845 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
16846 CheckState to ConvCast.
16848 (ConvCast): Now it takes a `checked' state argument, to avoid
16849 depending on the emit context for the conversion, and just using
16850 the resolve time setting.
16852 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
16853 instead of Invocation.EmitArguments. We do not emit the original
16854 arguments, instead we emit those which have been converted to
16855 unsigned int expressions.
16857 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
16859 * codegen.cs: ditto.
16861 * expression.cs (LocalVariableReference): Drop the use of the
16862 Store function that depended on the variable index.
16864 * statement.cs (VariableInfo): Drop the `Idx' property from this
16865 class, as this is not taking into account the indexes for
16866 temporaries tat we generate during the execution, getting the
16869 * class.cs: First emit class initializers, then call the parent
16872 * expression.cs (Binary): Fix opcode emision.
16873 (UnaryMutator.EmitCode): Support checked code generation
16875 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
16876 matches for events for both the Static and Instance scans,
16877 pointing to the same element. Fix that.
16879 2002-03-14 Miguel de Icaza <miguel@ximian.com>
16881 * rootcontext.cs (ResolveTree): Always set the
16882 interface_resolve_order, because nested interfaces will be calling
16885 * class.cs (GetInterfaceOrClass): Track the same resolution
16886 process used by TypeManager.LookupType. This fixes the nested
16887 type lookups in class declarations (separate path from
16890 (TypeContainer.DefineType): Also define nested interfaces.
16891 (TypeContainer.RegisterOrder): New public function used to
16892 register the order in which child interfaces need to be closed.
16894 Nested interfaces need to be closed after their parents have been
16897 * interface.cs (InterfaceAttr): Put all the logic for computing
16898 the interface attribute here.
16900 (DefineInterface): Register our interface order with the
16901 RootContext or with the TypeContainer depending on the case.
16903 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16905 * cs-parser.jay: rework foreach statement to work with the new
16906 changes to the policy on SimpleNames.
16908 * report.cs: support Stacktrace on warnings as well.
16910 * makefile: drop --unsafe and /unsafe from the compile.
16912 2002-03-13 Ravi Pratap <ravi@ximian.com>
16914 * ecore.cs (StandardConversionExists): Modify to take an Expression
16915 as the first parameter. Ensure we do null -> reference type conversion
16918 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
16919 temporary Expression objects.
16921 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
16923 * interface.cs: workaround bug in method overloading resolution
16924 (there is already a bugzilla bug for it).
16926 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16928 We could also solve this problem by having a separate path for
16929 performing type lookups, instead of DoResolve, we could have a
16930 ResolveType entry point, and only participating pieces of the
16931 production (simplename, deref, array) would implement this.
16933 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
16934 signal SimpleName to only resolve type names and not attempt to
16935 resolve anything else.
16937 * expression.cs (Cast): Set the flag.
16939 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
16941 * class.cs: Only report 108 if there is no `new' modifier.
16943 * cs-parser.jay: rework foreach statement to work with the new
16944 changes to the policy on SimpleNames.
16946 * report.cs: support Stacktrace on warnings as well.
16948 * makefile: drop --unsafe and /unsafe from the compile.
16950 2002-03-11 Miguel de Icaza <miguel@ximian.com>
16952 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16953 lookups here, instead of doing that at parse time. This means
16954 that our grammar will not introduce `LocalVariableReferences' as
16955 expressions at this point. That solves the problem of code like
16959 static void Main ()
16963 This is only half the fix. The full fix requires parameters to
16964 also be handled in this way.
16966 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
16967 makes the use more obvious of the DeclSpace. The
16968 ec.TypeContainer.TypeBuilder is now only used to pull the
16969 TypeBuilder for it.
16971 My theory is that I can get rid of the TypeBuilder completely from
16972 the EmitContext, and have typecasts where it is used (from
16973 DeclSpace to where it matters).
16975 The only pending problem is that the code that implements Aliases
16976 is on TypeContainer, and probably should go in DeclSpace.
16978 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16979 lookups here, instead of doing that at parse time. This means
16980 that our grammar will not introduce `LocalVariableReferences' as
16981 expressions at this point. That solves the problem of code like
16985 static void Main ()
16989 This is only half the fix. The full fix requires parameters to
16990 also be handled in this way.
16992 * class.cs (Property.DefineMethod): When implementing an interface
16993 method, set newslot, when implementing an abstract method, do not
16994 set the flag (before we tried never setting it, or always setting
16995 it, which is the difference).
16996 (Indexer.DefineMethod): same.
16997 (Method.DefineMethod): same.
16999 * ecore.cs: Only set the status used flag if we get back a Field.
17001 * attribute.cs: Temporary hack, so Paolo can keep working.
17003 2002-03-08 Ravi Pratap <ravi@ximian.com>
17005 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
17006 the unmanaged type in the case we have a MarshalAs attribute.
17008 (Resolve): Handle the case when we are parsing the special MarshalAs
17009 attribute [we need to store the unmanaged type to use later]
17011 * typemanager.cs (marshal_as_attr_type): Built in type for the
17012 MarshalAs Attribute.
17014 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
17015 on parameters and accordingly set the marshalling info.
17017 2002-03-09 Miguel de Icaza <miguel@ximian.com>
17019 * class.cs: Optimizing slightly by removing redundant code after
17020 we switched to the `NoTypes' return value.
17021 (Property.DefineMethod): use NoTypes here too.
17023 This fixes the bug I introduced in my last batch of changes.
17025 2002-03-05 Ravi Pratap <ravi@ximian.com>
17027 * tree.cs (RecordEnum): Add. We now keep track of enums too.
17029 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
17030 Enums since those are types too.
17032 * cs-parser.jay (enum_declaration): Record enums as we parse them.
17034 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
17035 thanks to a call during the lookup process.
17037 2002-03-07 Miguel de Icaza <miguel@ximian.com>
17039 * statement.cs (Foreach): Lots of work to accomodate a particular
17040 kind of foreach statement that I had not kept in mind. It is
17041 possible to have foreachs on classes that provide a GetEnumerator
17042 method that return objects that implement the "pattern" for using
17043 a foreach, there is no need to support GetEnumerator
17046 This is needed to compile nant.
17048 * decl.cs: Only report 114 if the member is not `Finalize' and if
17049 the warning level is at least 2.
17051 * class.cs: Moved the compare function from Method to
17054 (MethodSignature.InheritableMemberSignatureCompare): Add new
17055 filter function that is used to extract inheritable methods from a
17058 (Method.Define): Use the new `inheritable_method_signature_filter'
17061 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
17064 2002-03-06 Miguel de Icaza <miguel@ximian.com>
17066 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
17068 * cs-parser.jay: Add opt_semicolon to the interface declaration.
17070 * expression.cs: Pass location information to
17071 ConvertImplicitStandard.
17073 * class.cs: Added debugging code to track return values from
17076 2002-03-05 Miguel de Icaza <miguel@ximian.com>
17078 * expression.cs (Is.DoResolve): If either side of the `is' is an
17079 interface, do not flag the warning.
17081 * ecore.cs (ImplicitReferenceConversion): We need a separate test
17084 * report.cs: Allow for --fatal to be used with --probe.
17086 * typemanager.cs (NoTypes): Move the definition for the empty Type
17089 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
17091 (TypeContainer.DefineProxy): New function used to proxy to parent
17092 implementations when implementing interfaces.
17093 (TypeContainer.ParentImplements): used to lookup if our parent
17094 implements a public function that is required by an interface.
17095 (TypeContainer.VerifyPendingMethods): Hook this up.
17097 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
17098 `modules' and `assemblies' arraylists into arrays. We only grow
17099 these are the very early start up of the program, so this improves
17100 the speedof LookupType (nicely measured).
17102 * expression.cs (MakeByteBlob): Replaced unsafe code with
17103 BitConverter, as suggested by Paolo.
17105 * cfold.cs (ConstantFold.Binary): Special case: perform constant
17106 folding of string concatenation, but if either side is a string,
17107 and the other is not, then return null, and let the runtime use
17108 the concatenation on the string plus the object (using
17109 `Object.ToString').
17111 2002-03-04 Miguel de Icaza <miguel@ximian.com>
17113 Constant Folding has been implemented now.
17115 * expression.cs (Unary.Reduce): Do not throw an exception, catch
17116 the error instead on types that are not supported in one's
17119 * constant.cs (Constant and all children): New set of functions to
17120 perform implict and explicit conversions.
17122 * ecore.cs (EnumConstant): Implement the new functions to perform
17123 conversion by proxying to the child expression.
17125 * codegen.cs: (ConstantCheckState): Constant evaluation has its
17126 own separate setting that can not be turned off from the command
17127 line using --unchecked or --checked and is only controlled using
17128 the checked/unchecked statements and expressions. This setting is
17129 used by the constant folder to flag errors.
17131 * expression.cs (CheckedExpr, UncheckedExpr): Set the
17132 ConstantCheckState as well.
17134 During Resolve, they also have to flag the state, because the
17135 constant folder runs completely in the Resolve phase.
17137 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
17140 2002-03-01 Miguel de Icaza <miguel@ximian.com>
17142 * cfold.cs: New file, this file contains the constant folder.
17144 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
17145 argument to track whether we are using the resulting address to
17146 load or store a value and provide better error messages.
17148 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
17149 new AddressOf arguments.
17151 * statement.cs (Foreach.EmitCollectionForeach): Update
17153 * expression.cs (Argument.Emit): Call AddressOf with proper
17154 arguments to track usage.
17156 (New.DoEmit): Call AddressOf with new arguments.
17158 (Unary.Emit): Adjust AddressOf call.
17160 2002-03-01 Ravi Pratap <ravi@ximian.com>
17162 * cs-parser.jay (member_access): Change the case for pre-defined types
17163 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
17166 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
17169 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
17170 essentially like methods and apply attributes like MethodImplOptions to them too.
17172 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
17175 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
17176 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
17179 * Update code everywhere accordingly.
17181 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
17183 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
17185 2002-02-28 Ravi Pratap <ravi@ximian.com>
17187 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
17188 try performing lookups against those instead of jumping straight into using
17189 the 'using' clauses.
17191 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
17193 (LookupType): Perform lookups in implicit parents too.
17195 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
17196 sequence as RootContext.LookupType.
17198 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
17199 the various cases of namespace lookups into this method.
17201 2002-03-01 Miguel de Icaza <miguel@ximian.com>
17203 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
17204 in positional arguments)
17206 * class.cs (Operator): Update the AllowedModifiers to contain
17209 * cs-parser.jay: Update operator declaration to allow for the
17210 operator body to be empty.
17212 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
17215 2002-02-27 Miguel de Icaza <miguel@ximian.com>
17217 * class.cs (Method.Emit): Label parameters.
17219 * driver.cs: Return 1 or 0 as the program exit code.
17221 2002-02-26 Miguel de Icaza <miguel@ximian.com>
17223 * expression.cs: Special case the `null' object when trying to
17224 auto-compute the type, as anything can be explicitly converted to
17227 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
17228 spotting this Paolo.
17230 (Expression.ImplicitNumericConversion): Perform comparissions of
17231 the type using the underlying type in the case of an enumeration
17232 rather than using the enumeration type for the compare.
17234 Cope with the underlying == type case, which is not possible to
17237 (Expression.ConvertNumericExplicit): Perform comparissions of
17238 the type using the underlying type in the case of an enumeration
17239 rather than using the enumeration type for the compare.
17241 * driver.cs: If the user does not supply an extension, assume .exe
17243 * cs-parser.jay (if_statement): Rewrote so that we can track the
17244 location for the if statement.
17246 * expression.cs (Binary.ConstantFold): Only concat strings when
17247 the operation is "+", not everything ;-)
17249 * statement.cs (Statement.EmitBoolExpression): Take a location
17251 (If, While, Do): Track location.
17253 * expression.cs (Binary.ResolveOperator): In the object + string
17254 case, I was missing a call to ConvertImplicit
17256 2002-02-25 Ravi Pratap <ravi@ximian.com>
17258 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
17259 Location arguments. Ensure we use RootContext.LookupType to do our work
17260 and not try to do a direct Type.GetType and ModuleBuilder.GetType
17262 * interface.cs (PopulateMethod): Handle the type of the parameter being
17265 * expression.cs (Invocation.BetterFunction): Handle the case when we
17266 have a params method with no fixed arguments and a call is made with no
17269 2002-02-25 Miguel de Icaza <miguel@ximian.com>
17271 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
17272 the verbatim-string-literal
17274 * support.cs (InternalParameters.ParameterModifier): handle null
17276 (InternalParameters.ParameterType): ditto.
17278 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
17279 duplicating the name of the variable parameter.
17280 (GetParameterByName): Fix bug where we were not looking up array
17281 paramters if they were the only present (thanks Paolo!).
17282 (GetParameterInfo): We only have an empty set of types if both
17283 fixed and array are set to null.
17284 (GetParameterInfo-idx): Handle FixedParameter == null
17286 * cs-parser.jay: Handle the case where there is no catch
17287 statements (missing null test).
17289 2002-02-22 Miguel de Icaza <miguel@ximian.com>
17291 * driver.cs (MainDriver): Be conservative on our command line
17294 Catch DirectoryNotFoundException when calling GetFiles.
17296 (SplitPathAndPattern): Used to split the input specification into
17297 a path and a pattern that we can feed to Directory.GetFiles.
17299 2002-02-21 Miguel de Icaza <miguel@ximian.com>
17301 * statement.cs (Fixed): Implement the last case of the Fixed
17302 statement (string handling).
17304 * expression.cs (StringPtr): New class used to return a char * to
17305 a string; Used by the Fixed statement.
17307 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
17309 * expression.cs (Binary.ResolveOperator): Remove redundant
17310 MemberLookup pn parent type.
17311 Optimize union call, we do not need a union if the types are the same.
17312 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
17315 Specialize the use of MemberLookup everywhere, instead of using
17316 the default settings.
17318 (StackAlloc): Implement stackalloc keyword.
17320 * cs-parser.jay: Add rule to parse stackalloc.
17322 * driver.cs: Handle /h, /help, /?
17324 * expression.cs (MakeByteBlob): Removed the hacks we had in place
17325 before we supported unsafe code.
17327 * makefile: add --unsafe to the self compilation of mcs.
17329 2002-02-20 Miguel de Icaza <miguel@ximian.com>
17331 * expression.cs (PointerArithmetic): New class that is used to
17332 perform pointer arithmetic.
17333 (Binary.Resolve): Handle pointer arithmetic
17334 Handle pointer comparission.
17335 (ArrayPtr): Utility expression class that is used to take the
17336 address of an array.
17338 (ElementAccess): Implement array access for pointers
17340 * statement.cs (Fixed): Implement fixed statement for arrays, we
17341 are missing one more case before we are done.
17343 * expression.cs (Indirection): Implement EmitAssign and set the
17344 ExprClass to Variable. This allows pointer dereferences to be
17345 treated as variables, and to have values assigned to them.
17347 * ecore.cs (Expression.StoreFromPtr): New utility function to
17348 store values dereferencing.
17350 2002-02-20 Ravi Pratap <ravi@ximian.com>
17352 * expression.cs (Binary.ResolveOperator): Ensure that we are
17353 not trying to operate on a void type - this fixes the reported
17356 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
17357 the parent implementation is sealed.
17359 * ../errors/cs0239.cs : Add.
17361 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
17363 * typemanager.cs (unverifiable_code_type): Corresponds to
17364 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
17365 which have unsafe code in them.
17367 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
17370 2002-02-19 Miguel de Icaza <miguel@ximian.com>
17372 * cs-tokenizer.cs: Add support for @"litreal strings"
17374 Make tokenizer accept pre-processor directives
17375 on any column (remove the old C-like limitation).
17377 * rootcontext.cs (EmitCode): Emit any global attributes.
17378 (AddGlobalAttributes): Used to keep track of assembly attributes.
17380 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
17382 * cs-parser.jay: Add support for global attributes.
17384 2002-02-17 Miguel de Icaza <miguel@ximian.com>
17386 * expression.cs (Indirection): New helper class. Unary will
17387 create Indirection classes to be able to implement the
17388 IMemoryLocation interface on it.
17390 2002-02-16 Miguel de Icaza <miguel@ximian.com>
17392 * cs-parser.jay (fixed_statement): reference the right statement.
17394 * statement.cs (Fixed.Emit): Finish implementing the fixed
17395 statement for the &x case.
17397 2002-02-14 Miguel de Icaza <miguel@ximian.com>
17399 * class.cs (Property.Define, Method.Define): Remove newslot when
17402 * modifiers.cs: My use of NewSlot when `Abstract' was set was
17403 wrong. NewSlot should only be used if the `new' keyword is present.
17405 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
17406 locating our system dir. Sorry about this.
17408 2002-02-13 Miguel de Icaza <miguel@ximian.com>
17410 * driver.cs (GetSystemDir): Compute correctly the location of our
17411 system assemblies. I was using the compiler directory instead of
17412 the library directory.
17414 2002-02-13 Ravi Pratap <ravi@ximian.com>
17416 * expression.cs (BetterFunction): Put back in what Miguel commented out
17417 since it is the correct fix. The problem is elsewhere ;-)
17419 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
17420 parameters of the parms method are themselves compatible or not !
17422 (StandardConversionExists): Fix very dangerous bug where we were forgetting
17423 to check that a class implements an interface before saying that an implicit
17424 conversion was allowed. Use ImplementsInterface to do the checking.
17426 2002-02-13 Miguel de Icaza <miguel@ximian.com>
17428 * class.cs (Method.Define): Track whether we are an explicit
17429 implementation or not. And only call DefineMethodOverride if we
17430 are an explicit implementation.
17432 (Property.DefineMethod): Ditto.
17434 2002-02-11 Ravi Pratap <ravi@ximian.com>
17436 * expression.cs (BetterFunction): Catch hideous bug which was
17437 preventing us from detecting ambiguous calls due to implicit casts i.e
17440 2002-01-29 Miguel de Icaza <miguel@ximian.com>
17442 * support.cs (Pair): Remove un-needed method. I figured why I was
17443 getting the error in cs-parser.jay, the variable in a foreach loop
17444 is readonly, and the compiler does not really treat this as a variable.
17446 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
17447 instead of EQUALS in grammar.
17449 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
17451 * expression.cs (Unary.DoResolve): Check whether the argument is
17454 2002-01-28 Miguel de Icaza <miguel@ximian.com>
17456 * support.cs: Api for Pair to set a value. Despite the fact that
17457 the variables are public the MS C# compiler refuses to compile
17458 code that accesses the field if the variable is part of a foreach
17461 * statement.cs (Fixed): Begin implementation of the fixed
17464 (Block.AddVariable): Return the VariableInfo on success and null
17465 on failure instead of true/false.
17467 * cs-parser.jay (foreach): Catch errors on variables already
17468 defined (we were ignoring this value before) and properly unwind
17469 the block hierarchy
17471 (fixed_statement): grammar for the fixed statement.
17473 2002-01-25 Miguel de Icaza <miguel@ximian.com>
17475 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
17476 pointer types to be incretemented.
17478 (SizeOf): Implement.
17480 * cs-parser.jay (pointer_member_access): Implement
17481 expr->IDENTIFIER production.
17483 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
17484 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
17487 (Unary): Implement indirection.
17489 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
17490 use in non-unsafe context).
17492 (SimpleName.DoResolve): Check for pointers in field access on safe
17495 (Expression.LoadFromPtr): Factor the load-indirect code in this
17496 function. This was duplicated in UnboxCast and ParameterReference
17498 2002-01-24 Miguel de Icaza <miguel@ximian.com>
17500 * expression.cs (ComposedCast): report an error if a pointer cast
17501 is used in a safe region.
17503 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
17504 pointer type casts in unsafe context.
17506 * codegen.cs (EmitContext): Set up IsUnsafe.
17508 * cs-parser.jay (non_expression_type): Add productions for pointer
17511 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
17512 code. We should not use force into static mode if the method is
17513 not virtual. Fixes bug in MIS
17515 * statement.cs (Do.Emit, While.Emit, For.Emit,
17516 Statement.EmitBoolExpression): Add support to Do and While to
17517 propagate infinite loop as `I do return' semantics.
17519 Improve the For case to also test for boolean constants.
17521 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
17522 to the list of attributes we can add.
17524 Remove `EmitContext' argument.
17526 * class.cs (Method.Define): Apply parameter attributes.
17527 (Constructor.Define): Apply parameter attributes.
17528 (MethodCore.LabelParameters): Move here the core of labeling
17531 * support.cs (ReflectionParameters.ParameterModifier,
17532 InternalParameters.ParameterModifier): Use IsByRef on the type and
17533 only return the OUT bit for these parameters instead of in/out/ref
17536 This is because I miss-understood things. The ParameterInfo.IsIn
17537 and IsOut represent whether the parameter has the [In] and [Out]
17540 2002-01-22 Miguel de Icaza <miguel@ximian.com>
17542 * ecore.cs (FieldExpr.Emit): Release temporaries.
17544 * assign.cs (LocalTemporary.Release): new function.
17546 * codegen.cs (EmitContext.GetTemporaryStorage,
17547 EmitContext.FreeTemporaryStorage): Rework the way we deal with
17548 temporary storage. Now we can "put back" localbuilders when we
17551 2002-01-21 Miguel de Icaza <miguel@ximian.com>
17553 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
17554 need to make a copy of the variable to generate verifiable code.
17556 2002-01-19 Miguel de Icaza <miguel@ximian.com>
17558 * driver.cs: Compute dynamically the system directory.
17560 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
17561 Slower, but more generally useful. Used by the abstract
17562 registering implementation.
17564 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
17565 the rules for the special rule on Type/instances. First check if
17566 we have the same name, and if so, try that special static path
17567 rather than the instance path.
17569 2002-01-18 Miguel de Icaza <miguel@ximian.com>
17571 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
17574 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
17575 Enum, ValueType, Delegate or Array for non-corlib compiles.
17577 * cs-tokenizer.cs: Catch long identifiers (645)
17579 * typemanager.cs (IndexerPropetyName): Ravi never tested this
17582 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
17583 fix, we were returning too early, so we were not registering
17584 pending methods from abstract classes.
17586 Do not register pending methods if the class is abstract.
17588 * expression.cs (Conditional.DoResolve): Report circular implicit
17589 conversions when we neecd to compute it for conditional
17592 (Is.DoResolve): If the expression is always of the provided type,
17593 flag warning 183. If the expression can not ever be of the
17594 provided type flag warning 184.
17596 * class.cs: Catch 169 as well.
17598 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
17601 2002-01-18 Nick Drochak <ndrochak@gol.com>
17603 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
17605 2002-01-17 Miguel de Icaza <miguel@ximian.com>
17607 * interface.cs: (PopulateMethod): Check for pointers being defined
17608 only if the unsafe context is active.
17609 (PopulateProperty): ditto.
17610 (PopulateIndexer): ditto.
17612 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
17613 specified. If pointers are present, make sure that they are
17614 present in an unsafe context.
17615 (Constructor, Constructor.Define): ditto.
17616 (Field, Field.Define): ditto.
17617 (Property, Property.Define): ditto.
17618 (Event, Event.Define): ditto.
17620 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
17621 hashtable if there are classes or structs defined.
17623 * expression.cs (LocalVariableReference.DoResolve): Simplify this
17624 code, as the constant resolution moved.
17626 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
17627 the metadata, so we can flag error 133.
17629 * decl.cs (MemberCore.UnsafeOK): New function to test that a
17630 pointer is being declared in an unsafe context.
17632 2002-01-16 Miguel de Icaza <miguel@ximian.com>
17634 * modifiers.cs (Modifiers.Check): Require a Location argument.
17635 Report error 227 for Unsafe use.
17637 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
17639 * statement.cs (For.Emit): If the test is null, then report that
17640 we do `return', as we wont reach anything afterwards.
17642 (Switch.SwitchGoverningType): Track the expression that matched
17645 * driver.cs: Allow negative numbers as an error code to flag.
17647 * cs-parser.jay: Handle 1551.
17649 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
17651 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17653 * cs-parser.jay: Report 1518 (type declaration can only contain
17654 class, struct, interface, enum or delegate)
17656 (switch_label): Report 1523 (keywords `case' or `default' must
17659 (opt_switch_sections): Report 1522 (empty switch)
17661 * driver.cs: Report 1515 (response file specified multiple times)
17662 Report 1516 (Source file specified multiple times).
17664 * expression.cs (Argument.Resolve): Signal 1510
17666 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
17667 access not allowed in static code)
17669 2002-01-11 Ravi Pratap <ravi@ximian.com>
17671 * typemanager.cs (IsPointerType): Utility method which we are going
17674 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
17675 the object type, so we take care of that.
17677 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
17679 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
17680 added to non-params parameters :-)
17682 * typemanager.cs (CSharpName): Include 'void' type too.
17684 (void_ptr_type): Include in the set of core types.
17686 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
17689 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
17692 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
17693 completely forgotten about it.
17695 2002-01-10 Ravi Pratap <ravi@ximian.com>
17697 * cs-parser.jay (pointer_type): Add. This begins our implementation
17698 of parsing rules for unsafe code.
17700 (unsafe_statement): Implement.
17702 (embedded_statement): Modify to include the above.
17704 * statement.cs (Unsafe): Implement new class for unsafe blocks.
17706 * codegen.cs (EmitContext.InUnsafe): Add. This determines
17707 if the current context is an unsafe one.
17709 * cs-parser.jay (local_variable_pointer_type): Since local variable types
17710 are handled differently, we need separate rules for them.
17712 (local_variable_declaration): Update to use local_variable_pointer_type
17713 to allow variable declarations of unmanaged pointer types.
17715 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
17716 in unsafe contexts.
17718 * ../errors/cs0214.cs : Add.
17720 2002-01-16 Nick Drochak <ndrochak@gol.com>
17722 * makefile: remove 'response' file when cleaning.
17724 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17726 * cs-parser.jay: Report 1524.
17728 2002-01-14 Miguel de Icaza <miguel@ximian.com>
17730 * typemanager.cs (RegisterMethod): drop checking if we have
17731 registered this from here
17733 2002-01-12 Miguel de Icaza <miguel@ximian.com>
17735 * class.cs (Method.EmitDestructor): Implement calling our base
17738 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
17739 value of InFinally.
17741 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
17742 this routine and will wrap the call in a try/catch block. Deal
17745 2002-01-11 Miguel de Icaza <miguel@ximian.com>
17747 * ecore.cs (Expression.MemberLookup): instead of taking a
17748 parameter `same_type' that was used to tell whether we could
17749 access private members we compute our containing type from the
17752 (FieldExpr): Added partial support for volatile fields. This does
17753 not work for volatile fields exposed from assemblies, as I can not
17754 figure out how to extract the modreq from it.
17756 Updated all the source files to use this.
17758 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
17759 because it is referenced by MemberLookup very often.
17761 2002-01-09 Ravi Pratap <ravi@ximian.com>
17763 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
17764 TypeBuilder.GetCustomAttributes to retrieve what we need.
17766 Get rid of redundant default_member_attr_type as this is the same as
17767 default_member_type which already exists.
17769 * interface.cs, attribute.cs : Update accordingly.
17771 2002-01-08 Miguel de Icaza <miguel@ximian.com>
17773 * typemanager.cs: Enable IndexerPropertyName again. It does not
17774 work for TYpeBuilders though. Ravi, can you please fix this?
17776 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
17778 * expression.cs (Argument.Emit): Handle the case of ref objects
17779 being passed to ref functions;
17781 (ParameterReference.EmitLoad): Loads the content of the pointer
17782 without dereferencing.
17784 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17786 * cs-tokenizer.cs: Implemented the pre-processing expressions.
17788 2002-01-08 Ravi Pratap <ravi@ximian.com>
17790 * class.cs (Indexer.DefineMethod): Incorporate the interface
17791 type in the name of the method if we are doing explicit interface
17794 * expression.cs (ConversionExists): Remove as it is completely obsolete.
17796 (BetterConversion): Fix extremely trivial bug where we were referring to
17797 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
17800 * ../errors/bug16.cs : Add although we have fixed it.
17802 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17804 * expression.cs (BaseIndexer): Begin implementation.
17806 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
17808 * cs-parser.jay (indexer_declarator): Use qualified_identifier
17809 production directly to remove a shift/reduce, and implement
17810 explicit interface implementation.
17812 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
17813 after a floating point suffix.
17815 * expression.cs (DoNumericPromotions): Improved the conversion for
17816 uint/uint. If we have a constant, we avoid doing a typecast to a
17819 * class.cs (Indexer): Implement explicit interface implementation
17822 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
17824 * class.cs: make the default instance constructor public and hidebysig.
17826 2001-01-03 Ravi Pratap <ravi@ximian.com>
17828 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
17829 so we can call it from elsewhere.
17831 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
17832 we emit it internally if the class has a defined indexer; otherwise the user
17833 emits it by decorating the class definition with the DefaultMemberAttribute.
17835 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
17836 attribute is not used on a type which defines an indexer.
17838 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
17839 character when we skip whitespace.
17841 * ../errors/cs0646.cs : Add.
17843 2002-01-03 Miguel de Icaza <miguel@ximian.com>
17845 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
17848 * makefile: Add practical target `mcs3.exe' which builds the third
17849 generation compiler.
17851 * expression.cs (New): Fix structures constructor calling.
17853 * class.cs (Property, Method, Indexer): Emit Final flag on the
17854 method if we are an interface implementation and we are not
17857 * ecore.cs (PropertyExpr): New public field `IsBase', tells
17858 whether this property is referencing a `base' method.
17860 * expression.cs (Invocation.EmitCall): take an extra argument:
17861 is_base, this is used to determine whether the `call' or
17862 `callvirt' opcode should be used.
17865 * delegate.cs: update EmitCall.
17867 * class.cs (Method.Define): Set NewSlot for the cases where we are
17868 not implementing an interface method.
17870 (Property.Define): ditto.
17872 2002-01-02 Miguel de Icaza <miguel@ximian.com>
17874 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
17875 'r'. Allows mcs to parse itself fully.
17877 2002-01-02 Ravi Pratap <ravi@ximian.com>
17879 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
17880 of the number of initializers that require the InitializeArray method.
17882 (CheckIndices): Store the Expression in all cases - not the plain value. Also
17883 update the above field where necessary.
17885 (MakeByteBlob): Update accordingly.
17887 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
17890 (EmitDynamicInitializers): Update in accordance with the new optimization.
17892 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
17893 same OpCode applies.
17895 * cs-parser.jay : Fix some glaring errors I introduced.
17897 2002-01-01 Ravi Pratap <ravi@ximian.com>
17899 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
17900 so that we can check for name clashes there too.
17902 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
17903 for interface indexers.
17905 * interfaces.cs (Define): Emit the default member attribute.
17907 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
17908 variable was being referred to while setting the value ;-)
17910 2002-01-01 Miguel de Icaza <miguel@ximian.com>
17912 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
17913 byte-by-byte information when we know the data is zero.
17915 Make the block always a multiple of 4, because
17916 DefineInitializedData has a bug.
17918 * assign.cs: Fix, we should assign from the temporary, not from
17921 * expression.cs (MakeByteBlob): Fix my incorrect code.
17923 2001-12-31 Miguel de Icaza <miguel@ximian.com>
17925 * typemanager.cs (EnumToUnderlying): This function is used to get
17926 the underlying type from an enumeration, because it does not
17929 * constant.cs: Use the I4_S form for values between -128 and 127.
17931 * statement.cs (Block.LookupLabel): Looks up a label.
17932 (Block): Drop support for labeled blocks.
17934 (LabeledStatement): New kind of statement that represents a label
17937 (Goto): Finally implement this bad boy.
17939 * cs-parser.jay: Update to reflect new mechanism to implement
17942 2001-12-30 Miguel de Icaza <miguel@ximian.com>
17944 * codegen.cs (EmitContext.This): a codegen property that keeps the
17945 a single instance of this instead of creating many different this
17948 * delegate.cs (Delegate.DoResolve): Update to use the property;
17950 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
17952 * expression.cs (BaseAccess.DoResolve): Ditto.
17954 2001-12-29 Ravi Pratap <ravi@ximian.com>
17956 * typemanager.cs (methodimpl_attr_type): Add to hold the type
17957 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
17959 (InitCoreTypes): Update accordingly.
17961 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
17962 so we can quickly store the state.
17964 (ApplyAttributes): Set the correct implementation flags
17965 for InternalCall methods.
17967 2001-12-29 Miguel de Icaza <miguel@ximian.com>
17969 * expression.cs (EmitCall): if a method is not virtual, then do
17970 not use callvirt on it.
17972 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
17973 user defined stuff) requires the use of stobj, which takes an
17974 address on the stack instead of an array and an index. So emit
17975 the Ldelema operation for it.
17977 (EmitStoreOpcode): Use stobj for valuetypes.
17979 (UnaryMutator.EmitCode): Use the right 1 value depending on
17980 whether we are dealing with int64/uint64, float or doubles.
17982 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
17983 constructors that I implemented last night.
17985 (Constructor.IsDefault): Fix to work properly for static
17988 * cs-parser.jay (CheckDef): report method signature errors.
17989 Update error number 103 to be 132.
17991 * decl.cs: New AdditionResult enumeration value: MethodExists.
17992 Although we do this check for methods later on in the semantic
17993 analysis, catching repeated default constructors is so easy that
17994 we catch these here.
17996 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
17999 (ParameterReference.EmitAssign, Emit): handle
18002 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
18003 (ArrayAccess.EmitStoreOpcode): ditto.
18005 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
18007 * expression.cs (MakeByteBlob): Complete all the missing types
18008 (uint, short, ushort, byte, sbyte)
18010 * class.cs: Only init instance field initializers on instance
18013 Rename `constructors' to instance_constructors.
18015 (TypeContainer.AddConstructor): Only add constructors to the list
18016 if it is not static.
18018 Make sure that we handle default_static_constructor independently
18019 everywhere where we handle instance_constructors
18021 2001-12-28 Miguel de Icaza <miguel@ximian.com>
18023 * class.cs: Do not lookup or create a base initializer for a
18024 static constructor.
18026 (ConstructorInitializer.Resolve): use the proper type to lookup
18029 * cs-parser.jay: Report error 1585 (modifiers between type and name).
18031 * enum.cs, interface.cs: Remove CloseType, this is taken care by
18034 * decl.cs: CloseType is now an virtual method, the default
18035 implementation just closes this type.
18037 2001-12-28 Ravi Pratap <ravi@ximian.com>
18039 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
18040 to PreserveSig by default. Also emit HideBySig on such methods.
18042 Basically, set the defaults to standard values.
18044 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
18045 argument, if candidate is better, it can't be worse than the best !
18047 (Invocation): Re-write bits to differentiate between methods being
18048 applicable in their expanded form and their normal form - for params
18051 Get rid of use_standard everywhere as only standard conversions are allowed
18052 in overload resolution.
18054 More spec conformance.
18056 2001-12-27 Miguel de Icaza <miguel@ximian.com>
18058 * driver.cs: Add --timestamp, to see where the compiler spends
18061 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
18062 `this' in static code.
18064 (SimpleName.DoResolve): Implement in terms of a helper function
18065 that allows static-references to be passed upstream to
18068 (Expression.ResolveWithSimpleName): Resolve specially simple
18069 names when called by MemberAccess to implement the special
18072 (Expression.ImplicitReferenceConversion): Handle conversions from
18073 Null to reference types before others, as Null's type is
18076 * expression.cs (Invocation.EmitCall): Handle the special case of
18077 calling methods declared on a reference type from a ValueType
18078 (Base classes System.Object and System.Enum)
18080 (MemberAccess.Resolve): Only perform lookups on Enumerations if
18081 the left hand side is a TypeExpr, not on every enumeration.
18083 (Binary.Resolve): If types are reference types, then do a cast to
18084 object on operators != and == of both arguments.
18086 * typemanager.cs (FindMembers): Extract instance and static
18087 members if requested.
18089 * interface.cs (PopulateProperty): Use void_type instead of null
18090 as the return type for the setter method.
18092 (PopulateIndexer): ditto.
18094 2001-12-27 Ravi Pratap <ravi@ximian.com>
18096 * support.cs (ReflectionParameters): Fix minor bug where we
18097 were examining the wrong parameter for the ParamArray attribute.
18099 Cope with requests for the type of the parameter at position
18100 greater than the params parameter's. We now return the element
18101 type of the params array as that makes more sense.
18103 * expression.cs (Invocation.IsParamsMethodApplicable): Update
18104 accordingly as we no longer have to extract the element type
18107 (Invocation.OverloadResolve): Update.
18109 2001-12-27 Miguel de Icaza <miguel@ximian.com>
18111 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
18112 against IEnumerator, test whether the return value is a descendant
18113 of the IEnumerator interface.
18115 * class.cs (Indexer.Define): Use an auxiliary method to implement
18116 the other bits of the method definition. Begin support for
18117 explicit interface implementation.
18119 (Property.DefineMethod): Use TypeManager.void_type instead of null
18120 for an empty return value.
18122 2001-12-26 Miguel de Icaza <miguel@ximian.com>
18124 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
18125 dealing with a FieldExpr which is composed of a FieldBuilder, in
18126 the code path we did extract the constant, but we should have
18127 obtained the underlying value to be able to cast it (otherwise we
18128 end up in an infinite loop, this is what Ravi was running into).
18130 (ArrayCreation.UpdateIndices): Arrays might be empty.
18132 (MemberAccess.ResolveMemberAccess): Add support for section
18133 14.5.4.1 that deals with the special case of E.I when E is a type
18134 and something else, that I can be a reference to a static member.
18136 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
18137 handle a particular array type to create byte blobs, it is just
18138 something we dont generate byteblobs for.
18140 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
18143 * location.cs (Push): remove the key from the hashtable that we
18144 are about to add. This happens for empty files.
18146 * driver.cs: Dispose files after we have parsed them.
18148 (tokenize): new function that only runs the tokenizer on its
18149 input, for speed testing.
18151 2001-12-26 Ravi Pratap <ravi@ximian.com>
18153 * class.cs (Event.Define): Define the private field only if there
18154 are no accessors defined.
18156 * expression.cs (ResolveMemberAccess): If there is no associated
18157 field with the event, that means we have an event defined with its
18158 own accessors and we should flag error cs0070 since transforming
18159 ourselves into a field is not valid in that case.
18161 * ecore.cs (SimpleName.DoResolve): Same as above.
18163 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
18164 and charset to sane values.
18166 2001-12-25 Ravi Pratap <ravi@ximian.com>
18168 * assign.cs (DoResolve): Perform check on events only if they
18169 are being accessed outside the declaring type.
18171 * cs-parser.jay (event_declarations): Update rules to correctly
18172 set the type of the implicit parameter etc.
18174 (add_accessor, remove_accessor): Set current local parameters.
18176 * expression.cs (Binary): For delegate addition and subtraction,
18177 cast the return value from the method into the appropriate delegate
18180 2001-12-24 Ravi Pratap <ravi@ximian.com>
18182 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
18183 of these as the workaround is unnecessary.
18185 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
18186 delegate data - none of that is needed at all.
18188 Re-write bits to extract the instance expression and the delegate method
18191 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
18194 * attribute.cs (ApplyAttributes): New method to take care of common tasks
18195 of attaching attributes instead of duplicating code everywhere.
18197 * everywhere : Update code to do attribute emission using the above method.
18199 2001-12-23 Miguel de Icaza <miguel@ximian.com>
18201 * expression.cs (IsParamsMethodApplicable): if there are not
18202 parameters, return immediately.
18204 * ecore.cs: The 0 literal can be implicity converted to an enum
18207 (SimpleName.DoResolve): First lookup the type, then lookup the
18210 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
18211 want to get its address. If the InstanceExpression is not
18212 addressable, store the result in a temporary variable, then get
18215 * codegen.cs: Only display 219 errors on warning level or above.
18217 * expression.cs (ArrayAccess): Make it implement the
18218 IMemoryLocation interface.
18220 (Binary.DoResolve): handle the operator == (object a, object b)
18221 and operator != (object a, object b) without incurring into a
18222 BoxedCast (because 5 != o should never be performed).
18224 Handle binary enumerator operators.
18226 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
18227 value type, otherwise use Ldelem_ref.
18229 Use precomputed names;
18231 (AddressOf): Implement address of
18233 * cs-parser.jay (labeled_statement): Fix recursive block
18234 addition by reworking the production.
18236 * expression.cs (New.DoEmit): New has a special case:
18238 If we are dealing with a ValueType, we have a few
18239 situations to deal with:
18241 * The target of New is a ValueType variable, that is
18242 easy, we just pass this as the variable reference
18244 * The target of New is being passed as an argument,
18245 to a boxing operation or a function that takes a
18248 In this case, we need to create a temporary variable
18249 that is the argument of New.
18252 2001-12-23 Ravi Pratap <ravi@ximian.com>
18254 * rootcontext.cs (LookupType): Check that current_type is not null before
18255 going about looking at nested types.
18257 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
18258 not implement the IAssignMethod interface any more.
18260 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
18261 where we tranform them into FieldExprs if they are being resolved from within
18262 the declaring type.
18264 * ecore.cs (SimpleName.DoResolve): Do the same here.
18266 * assign.cs (DoResolve, Emit): Clean up code considerably.
18268 * ../errors/bug10.cs : Add.
18270 * ../errors/cs0070.cs : Add.
18272 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
18274 * assign.cs : Get rid of EventIsLocal everywhere.
18276 2001-12-23 Miguel de Icaza <miguel@ximian.com>
18278 * ecore.cs (ConvertIntLiteral): finished the implementation.
18280 * statement.cs (SwitchLabel): Convert the value we are using as a
18281 key before looking up the table.
18283 2001-12-22 Miguel de Icaza <miguel@ximian.com>
18285 * codegen.cs (EmitTopBlock): Require a Location argument now.
18287 * cs-parser.jay (constructor_declarator): We need to setup
18288 current_local_parameters before we parse the
18289 opt_constructor_initializer, to allow the variables to be bound
18290 to the constructor arguments.
18292 * rootcontext.cs (LookupType): First lookup nested classes in our
18293 class and our parents before we go looking outside our class.
18295 * expression.cs (ConstantFold): Extract/debox the values at the
18298 * rootcontext.cs (EmitCode): Resolve the constants first before we
18299 resolve the types. This is not really needed, but it helps debugging.
18301 * statement.cs: report location.
18303 * cs-parser.jay: pass location to throw statement.
18305 * driver.cs: Small bug fix.
18307 * report.cs: Updated format to be 4-zero filled digits.
18309 2001-12-22 Ravi Pratap <ravi@ximian.com>
18311 * expression.cs (CheckIndices): Fix minor bug where the wrong
18312 variable was being referred to ;-)
18314 (DoEmit): Do not call EmitStaticInitializers when the
18315 underlying type is System.Object.
18317 2001-12-21 Ravi Pratap <ravi@ximian.com>
18319 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
18320 and do the usual workaround for SRE.
18322 * class.cs (MyEventBuilder.EventType): New member to get at the type
18323 of the event, quickly.
18325 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
18327 * assign.cs (Assign.DoResolve): Handle the case when the target
18328 is an EventExpr and perform the necessary checks.
18330 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
18333 (SimpleName.MemberStaticCheck): Include check for EventExpr.
18335 (EventExpr): Set the type in the constructor itself since we
18336 are meant to be born fully resolved.
18338 (EventExpr.Define): Revert code I wrote earlier.
18340 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
18341 instance expression is null. The instance expression is a This in that case
18342 or a null, depending on whether it is a static method or not.
18344 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
18345 refers to more than one method.
18347 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
18348 and accordingly flag errors.
18350 2001-12-21 Miguel de Icaza <miguel@ximian.com>
18352 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
18354 2001-12-22 Miguel de Icaza <miguel@ximian.com>
18356 * location.cs (ToString): Provide useful rutine.
18358 2001-12-21 Miguel de Icaza <miguel@ximian.com>
18360 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
18361 objects, return the actual integral boxed.
18363 * statement.cs (SwitchLabel): define an ILLabel for each
18366 (Switch.CheckSwitch): If the value is a Literal, extract
18367 the underlying literal.
18369 Also in the unused hashtable we had, add the SwitchLabel so we can
18370 quickly look this value up.
18372 * constant.cs: Implement a bunch of new constants. Rewrite
18373 Literal based on this. Made changes everywhere to adapt to this.
18375 * expression.cs (Expression.MakeByteBlob): Optimize routine by
18376 dereferencing array only once, and also copes with enumrations.
18378 bytes are two bytes wide, not one.
18380 (Cast): Perform constant conversions.
18382 * ecore.cs (TryImplicitIntConversion): Return literals instead of
18383 wrappers to the literals here.
18385 * expression.cs (DoNumericPromotions): long literals can converted
18386 to ulong implicity (this is taken care of elsewhere, but I was
18387 missing this spot).
18389 * ecore.cs (Expression.Literalize): Make the return type Literal,
18390 to improve type checking.
18392 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
18394 2001-12-20 Miguel de Icaza <miguel@ximian.com>
18396 * literal.cs: Revert code from ravi that checked the bounds. The
18397 bounds are sane by the definition of the type itself.
18399 * typemanager.cs: Fix implementation of ImplementsInterface. We
18400 need to actually look up in our parent hierarchy for interfaces
18403 * const.cs: Use the underlying type for enumerations
18405 * delegate.cs: Compute the basename for the delegate creation,
18406 that should fix the delegate test case, and restore the correct
18407 Type Lookup semantics in rootcontext
18409 * rootcontext.cs: Revert Ravi's last patch. The correct way of
18410 referencing a nested type with the Reflection API is using the "+"
18413 * cs-parser.jay: Do not require EOF token at the end.
18415 2001-12-20 Ravi Pratap <ravi@ximian.com>
18417 * rootcontext.cs (LookupType): Concatenate type names with
18418 a '.' instead of a '+' The test suite passes again.
18420 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
18421 field of the enumeration.
18423 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
18424 the case when the member is an EventExpr.
18426 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
18427 static has an associated instance expression.
18429 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
18431 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
18433 * class.cs (Event.Define): Register event and perform appropriate checks
18436 We define the Add and Remove methods even if the use provides none because
18437 in that case, we provide default implementations ourselves.
18439 Define a private field of the type of the event. This is done by the CSC compiler
18440 and we should be doing it too ;-)
18442 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
18443 More methods we use in code we generate.
18445 (multicast_delegate_type, delegate_type): Two separate types since the distinction
18448 (InitCoreTypes): Update accordingly for the above.
18450 * class.cs (Event.Emit): Generate code for default accessors that we provide
18452 (EmitDefaultMethod): Do the job in the above.
18454 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
18457 2001-12-20 Miguel de Icaza <miguel@ximian.com>
18459 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
18460 builders even if we were missing one.
18462 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
18463 pass the Basename as our class name instead of the Name. The
18464 basename will be correctly composed for us.
18466 * parameter.cs (Paramters): Now takes a Location argument.
18468 * decl.cs (DeclSpace.LookupType): Removed convenience function and
18469 make all the code call directly LookupType in RootContext and take
18470 this chance to pass the Location information everywhere.
18472 * Everywhere: pass Location information.
18474 2001-12-19 Miguel de Icaza <miguel@ximian.com>
18476 * class.cs (Constructor.Define): Updated way of detecting the
18477 length of the parameters.
18479 (TypeContainer.DefineType): Use basename as the type name for
18482 (TypeContainer.Define): Do not recursively define types here, as
18483 definition is taken care in order by the RootContext.
18485 * tree.cs: Keep track of namespaces in a per-file basis.
18487 * parameter.cs (Parameter.ComputeSignature): Update to use
18490 (Parameters.GetSignature): ditto.
18492 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
18493 instead of a TypeContainer.
18495 (Interface.SemanticAnalysis): Use `this' instead of our parent to
18496 resolve names. Because we need to be resolve in our context, not
18499 * driver.cs: Implement response files.
18501 * class.cs (TypeContainer.DefineType): If we are defined, do not
18502 redefine ourselves.
18504 (Event.Emit): Emit the code for add/remove handlers.
18505 (Event.Define): Save the MethodBuilders for add/remove.
18507 * typemanager.cs: Use pair here too.
18509 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
18510 DictionaryEntry requires the first argument to be non-null.
18512 (enum_declaration): Compute full name for registering the
18515 (delegate_declaration): Instead of using
18516 formal_parameter_list, use opt_formal_parameter_list as the list
18519 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
18520 (EventParsing): New property that controls whether `add' and
18521 `remove' are returned as tokens or identifiers (for events);
18523 2001-12-19 Ravi Pratap <ravi@ximian.com>
18525 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
18526 use MyEventBuilder only and let it wrap the real builder for us.
18528 (MyEventBuilder): Revamp constructor etc.
18530 Implement all operations that we perform on EventBuilder in precisely the same
18533 (FindMembers): Update to use the EventBuilder member.
18535 (Event.Emit): Update accordingly.
18537 2001-12-18 Ravi Pratap <ravi@ximian.com>
18539 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
18540 by calling the appropriate methods.
18542 (GetCustomAttributes): Make stubs as they cannot possibly do anything
18545 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
18547 2001-12-17 Ravi Pratap <ravi@ximian.com>
18549 * delegate.cs (Delegate.Populate): Check that the return type
18550 and various parameters types are indeed accessible.
18552 * class.cs (Constructor.Define): Same here.
18554 (Field.Define): Ditto.
18556 (Event.Define): Ditto.
18558 (Operator.Define): Check that the underlying Method defined itself
18559 correctly - so it's MethodBuilder should not be null.
18561 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
18562 expression happens to be null.
18564 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
18565 members but as of now we don't seem to be able to do anything really useful with it.
18567 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
18568 not the EventBuilder.
18570 2001-12-18 Miguel de Icaza <miguel@ximian.com>
18572 * cs-tokenizer.cs: Add support for defines.
18573 Add support for #if, #elif, #else, #endif
18575 (eval_var): evaluates a variable.
18576 (eval): stubbed for evaluating functions.
18578 * cs-parser.jay: Pass the defines information
18580 * driver.cs: Add --define command line option.
18582 * decl.cs: Move MemberCore here.
18584 Make it the base class for DeclSpace. This allows us to catch and
18585 report 108 and 109 for everything now.
18587 * class.cs (TypeContainer.Define): Extract all the members
18588 before populating and emit the warning 108 (new keyword required
18589 to override) instead of having each member implement this.
18591 (MemberCore.Define): New abstract method, we will be using this in
18592 the warning reporting engine in Populate.
18594 (Operator.Define): Adjust to new MemberCore protocol.
18596 * const.cs (Const): This does not derive from Expression, it is a
18597 temporary object we use to create fields, it is a MemberCore.
18599 * class.cs (Method.Define): Allow the entry point to be in a
18602 * driver.cs: Rewrite the argument handler to clean it up a bit.
18604 * rootcontext.cs: Made it just an auxiliary namespace feature by
18605 making everything static.
18607 * driver.cs: Adapt code to use RootContext type name instead of
18610 * delegate.cs: Remove RootContext argument.
18612 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
18615 * class.cs (Event.Define): The lookup can fail.
18617 * cs-tokenizer.cs: Begin implementation of pre-procesor.
18619 * expression.cs: Resolve the this instance before invoking the code.
18621 2001-12-17 Miguel de Icaza <miguel@ximian.com>
18623 * cs-parser.jay: Add a production in element_access that allows
18624 the thing to become a "type" reference. This way we can parse
18625 things like "(string [])" as a type.
18627 Note that this still does not handle the more complex rules of
18631 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
18633 * ecore.cs: (CopyNewMethods): new utility function used to
18634 assemble the list of methods from running FindMembers.
18636 (MemberLookup): Rework FindMembers so that
18638 2001-12-16 Miguel de Icaza <miguel@ximian.com>
18640 * class.cs (TypeContainer): Remove Delegates who fail to be
18643 * delegate.cs (Populate): Verify that we dont get null return
18644 values. TODO: Check for AsAccessible.
18646 * cs-parser.jay: Use basename to emit error 574 (destructor should
18647 have the same name as container class), not the full name.
18649 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
18650 possible representation.
18652 Also implements integer type suffixes U and L.
18654 2001-12-15 Miguel de Icaza <miguel@ximian.com>
18656 * expression.cs (ArrayCreation.DoResolve): We need to do the
18657 argument resolution *always*.
18659 * decl.cs: Make this hold the namespace. Hold the root context as
18661 (LookupType): Move here.
18663 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
18665 * location.cs (Row, Name): Fixed the code, it was always returning
18666 references to the first file.
18668 * interface.cs: Register properties defined through interfaces.
18670 * driver.cs: Add support for globbing on the command line
18672 * class.cs (Field): Make it derive from MemberCore as well.
18675 2001-12-15 Ravi Pratap <ravi@ximian.com>
18677 * class.cs (Event::Define): Check that the type of the event is a delegate
18678 type else flag error #66.
18680 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
18683 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
18684 values of EntryPoint, CharSet etc etc.
18686 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
18688 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
18689 be null and we should ignore this. I am not sure if this is really clean. Apparently,
18690 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
18691 which needs this to do its work.
18693 * ../errors/cs0066.cs : Add.
18695 2001-12-14 Miguel de Icaza <miguel@ximian.com>
18697 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
18700 * class.cs: (MethodSignature.MethodSignature): Removed hack that
18701 clears out the parameters field.
18702 (MemberSignatureCompare): Cleanup
18704 (MemberCore): New base class used to share code between MethodCore
18707 (RegisterRequiredImplementations) BindingFlags.Public requires
18708 either BindingFlags.Instace or Static. Use instance here.
18710 (Property): Refactored code to cope better with the full spec.
18712 * parameter.cs (GetParameterInfo): Return an empty array instead
18715 * class.cs (Property): Abstract or extern properties have no bodies.
18717 * parameter.cs (GetParameterInfo): return a zero-sized array.
18719 * class.cs (TypeContainer.MethodModifiersValid): Move all the
18720 method modifier validation to the typecontainer so we can reuse
18721 this on properties.
18723 (MethodCore.ParameterTypes): return an empty sized array of types.
18725 (Property.Define): Test property modifier validity.
18727 Add tests for sealed/override too.
18729 (Method.Emit): abstract or extern methods have no bodies.
18731 2001-12-14 Ravi Pratap <ravi@ximian.com>
18733 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
18736 (Method::Define, ::Emit): Modify accordingly.
18738 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
18740 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
18742 * makefile: Pass in /unsafe.
18744 2001-12-13 Miguel de Icaza <miguel@ximian.com>
18746 * class.cs (MakeKey): Kill routine.
18748 * class.cs (TypeContainer.Define): Correctly define explicit
18749 method implementations (they require the full interface name plus
18752 * typemanager.cs: Deply the PtrHashtable here and stop using the
18753 lame keys. Things work so much better.
18755 This of course broke everyone who depended on `RegisterMethod' to
18756 do the `test for existance' test. This has to be done elsewhere.
18758 * support.cs (PtrHashtable): A hashtable that avoid comparing with
18759 the object stupid Equals method (because, that like fails all over
18760 the place). We still do not use it.
18762 * class.cs (TypeContainer.SetRequiredInterface,
18763 TypeContainer.RequireMethods): Killed these two routines and moved
18764 all the functionality to RegisterRequiredImplementations.
18766 (TypeContainer.RegisterRequiredImplementations): This routine now
18767 registers all the implementations required in an array for the
18768 interfaces and abstract methods. We use an array of structures
18769 which can be computed ahead of time to reduce memory usage and we
18770 also assume that lookups are cheap as most classes will not
18771 implement too many interfaces.
18773 We also avoid creating too many MethodSignatures.
18775 (TypeContainer.IsInterfaceMethod): Update and optionally does not
18776 clear the "pending" bit if we find that there are problems with
18779 (TypeContainer.VerifyPendingMethods): Update to report errors of
18780 methods that look like implementations but are not.
18782 (TypeContainer.Define): Add support for explicit interface method
18785 2001-12-12 Miguel de Icaza <miguel@ximian.com>
18787 * typemanager.cs: Keep track of the parameters here instead of
18788 being a feature of the TypeContainer.
18790 * class.cs: Drop the registration of parameters here, as
18791 InterfaceMethods are also interface declarations.
18793 * delegate.cs: Register methods with the TypeManager not only with
18794 the TypeContainer. This code was buggy.
18796 * interface.cs: Full registation here.
18798 2001-12-11 Miguel de Icaza <miguel@ximian.com>
18800 * expression.cs: Remove reducer for binary expressions, it can not
18803 * const.cs: Put here the code that used to go into constant.cs
18805 * constant.cs: Put here the code for constants, this is a new base
18806 class for Literals.
18808 * literal.cs: Make Literal derive from Constant.
18810 2001-12-09 Miguel de Icaza <miguel@ximian.com>
18812 * statement.cs (Return.Emit): Report error 157 if the user
18813 attempts to return from a finally block.
18815 (Return.Emit): Instead of emitting a return, jump to the end of
18818 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
18819 LocalBuilder to store the result of the function. ReturnLabel is
18820 the target where we jump.
18823 2001-12-09 Radek Doulik <rodo@ximian.com>
18825 * cs-parser.jay: remember alias in current namespace
18827 * ecore.cs (SimpleName::DoResolve): use aliases for types or
18830 * class.cs (LookupAlias): lookup alias in my_namespace
18832 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
18834 (LookupAlias): lookup alias in this and if needed in parent
18837 2001-12-08 Miguel de Icaza <miguel@ximian.com>
18841 * rootcontext.cs: (ModuleBuilder) Made static, first step into
18842 making things static. I need this to avoid passing the
18843 TypeContainer when calling ParameterType.
18845 * support.cs (InternalParameters.ParameterType): Remove ugly hack
18846 that did string manipulation to compute the type and then call
18847 GetType. Use Parameter.ParameterType instead.
18849 * cs-tokenizer.cs: Consume the suffix for floating values.
18851 * expression.cs (ParameterReference): figure out whether this is a
18852 reference parameter or not. Kill an extra variable by computing
18853 the arg_idx during emission.
18855 * parameter.cs (Parameters.GetParameterInfo): New overloaded
18856 function that returns whether a parameter is an out/ref value or not.
18858 (Parameter.ParameterType): The type of the parameter (base,
18859 without ref/out applied).
18861 (Parameter.Resolve): Perform resolution here.
18862 (Parameter.ExternalType): The full type (with ref/out applied).
18864 * statement.cs (Using.Emit, Using.EmitExpression): Implement
18865 support for expressions on the using statement.
18867 2001-12-07 Miguel de Icaza <miguel@ximian.com>
18869 * statement.cs (Using.EmitLocalVariableDecls): Split the
18870 localvariable handling of the using statement.
18872 (Block.EmitMeta): Keep track of variable count across blocks. We
18873 were reusing slots on separate branches of blocks.
18875 (Try.Emit): Emit the general code block, we were not emitting it.
18877 Check the type of the declaration to be an IDisposable or
18878 something that can be implicity converted to it.
18880 Emit conversions if required.
18882 * ecore.cs (EmptyExpression): New utility class.
18883 (Expression.ImplicitConversionExists): New utility function.
18885 2001-12-06 Miguel de Icaza <miguel@ximian.com>
18887 * statement.cs (Using): Implement.
18889 * expression.cs (LocalVariableReference): Support read only variables.
18891 * statement.cs: Remove the explicit emit for the Leave opcode.
18892 (VariableInfo): Add a readonly field.
18894 2001-12-05 Miguel de Icaza <miguel@ximian.com>
18896 * ecore.cs (ConvCast): new class used to encapsulate the various
18897 explicit integer conversions that works in both checked and
18898 unchecked contexts.
18900 (Expression.ConvertNumericExplicit): Use new ConvCast class to
18901 properly generate the overflow opcodes.
18903 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18905 * statement.cs: The correct type for the EmptyExpression is the
18906 element_type, not the variable type. Ravi pointed this out.
18908 2001-12-04 Ravi Pratap <ravi@ximian.com>
18910 * class.cs (Method::Define): Handle PInvoke methods specially
18911 by using DefinePInvokeMethod instead of the usual one.
18913 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
18914 above to do the task of extracting information and defining the method.
18916 2001-12-04 Ravi Pratap <ravi@ximian.com>
18918 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
18919 of the condition for string type.
18921 (Emit): Move that here.
18923 (ArrayCreation::CheckIndices): Keep string literals in their expression
18926 (EmitDynamicInitializers): Handle strings appropriately.
18928 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18930 * codegen.cs (EmitContext): Replace multiple variables with a
18931 single pointer to the current Switch statement.
18933 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
18936 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18940 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
18943 (Foreach.Emit): Foreach on arrays was not setting
18944 up the loop variables (for break/continue).
18946 (GotoCase): Semi-implented.
18948 2001-12-03 Ravi Pratap <ravi@ximian.com>
18950 * attribute.cs (CheckAttribute): Handle system attributes by using
18951 Attribute.GetAttributes to examine information we need.
18953 (GetValidPlaces): Same here.
18955 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
18957 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
18959 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
18961 (Method::Define): Set appropriate flags if we have a DllImport attribute.
18963 (Method::Emit): Handle the case when we are a PInvoke method.
18965 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18967 * expression.cs: Use ResolveWithSimpleName on compound names.
18969 2001-12-02 Ravi Pratap <ravi@ximian.com>
18971 * constant.cs (EmitConstant): Make sure we resolve the associated expression
18972 before trying to reduce it.
18974 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
18976 * constant.cs (LookupConstantValue): Implement.
18978 (EmitConstant): Use the above in emitting the constant.
18980 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
18981 that are user-defined by doing a LookupConstantValue on them.
18983 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
18986 2001-11-29 Miguel de Icaza <miguel@ximian.com>
18988 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
18990 (BaseAccess.DoResolve): Implement.
18992 (MemberAccess.DoResolve): Split this routine into a
18993 ResolveMemberAccess routine that can be used independently
18995 2001-11-28 Miguel de Icaza <miguel@ximian.com>
18997 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
18998 As that share bits of the implementation. Is returns a boolean,
18999 while As returns the Type that is being probed.
19001 2001-12-01 Ravi Pratap <ravi@ximian.com>
19003 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
19004 instead of a Literal - much easier.
19006 (EnumInTransit): Remove - utterly useless :-)
19008 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
19010 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
19012 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
19013 chain when we have no associated expression.
19015 2001-11-30 Ravi Pratap <ravi@ximian.com>
19017 * constant.cs (Define): Use Location while reporting the errror.
19019 Also emit a warning when 'new' is used and there is no inherited
19022 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
19025 (LookupEnumValue): Implement to lookup an enum member's value and define it
19028 (Populate): Re-write accordingly to use the above routine.
19030 2001-11-27 Miguel de Icaza <miguel@ximian.com>
19032 * expression.cs (This): Fix prototype for DoResolveLValue to
19033 override the base class DoResolveLValue.
19035 * cs-parser.cs: Report errors cs574 and cs575 (destructor
19038 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
19039 (we need to load the address of the field here). This fixes
19042 (FieldExpr.DoResolveLValue): Call the DoResolve
19043 function to initialize the Instance expression.
19045 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
19046 correctly the GetEnumerator operation on a value type.
19048 * cs-parser.jay: Add more simple parsing error catches.
19050 * statement.cs (Switch): Add support for string switches.
19051 Handle null specially.
19053 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
19055 2001-11-28 Ravi Pratap <ravi@ximian.com>
19057 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
19059 (declare_local_constant): New helper function.
19061 * statement.cs (AddConstant): Keep a separate record of constants
19063 (IsConstant): Implement to determine if a variable is a constant.
19065 (GetConstantExpression): Implement.
19067 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
19069 * statement.cs (IsVariableDefined): Re-write.
19071 2001-11-27 Ravi Pratap <ravi@ximian.com>
19073 * class.cs (TypeContainer::FindMembers): Look for constants
19074 in the case when we are looking for MemberTypes.Field
19076 * expression.cs (MemberAccess::DoResolve): Check that in the
19077 case we are a FieldExpr and a Literal, we are not being accessed
19078 by an instance reference.
19080 * cs-parser.jay (local_constant_declaration): Implement.
19082 (declaration_statement): Implement for constant declarations.
19084 2001-11-26 Miguel de Icaza <miguel@ximian.com>
19086 * statement.cs (Switch): Catch double defaults.
19088 (Switch): More work on the switch() statement
19089 implementation. It works for integral values now, need to finish
19093 2001-11-24 Miguel de Icaza <miguel@ximian.com>
19095 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
19096 integer literals into other integer literals. To be used by
19099 2001-11-24 Ravi Pratap <ravi@ximian.com>
19101 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
19104 (EmitDynamicInitializers): Cope with the above since we extract data
19105 directly from ArrayData now.
19107 (ExpectInitializers): Keep track of whether initializers are mandatory
19110 (Bounds): Make it a hashtable to prevent the same dimension being
19111 recorded for every element in that dimension.
19113 (EmitDynamicInitializers): Fix bug which prevented the Set array method
19116 Also fix bug which was causing the indices to be emitted in the reverse
19119 2001-11-24 Miguel de Icaza <miguel@ximian.com>
19121 * expression.cs (ArrayCreation): Implement the bits that Ravi left
19122 unfinished. They do not work, because the underlying code is
19125 2001-11-22 Miguel de Icaza <miguel@ximian.com>
19127 * cs-parser.jay: Remove bogus fixme.
19129 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
19130 on Switch statement.
19132 2001-11-23 Ravi Pratap <ravi@ximian.com>
19134 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
19137 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
19138 parameter. Apparently, any expression is allowed.
19140 (ValidateInitializers): Update accordingly.
19142 (CheckIndices): Fix some tricky bugs thanks to recursion.
19144 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
19145 I was being completely brain-dead.
19147 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
19148 and re-write acordingly.
19150 (DelegateInvocation): Re-write accordingly.
19152 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
19154 (MakeByteBlob): Handle types more correctly.
19156 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
19157 initialization from expressions but it is incomplete because I am a complete
19160 2001-11-22 Miguel de Icaza <miguel@ximian.com>
19162 * statement.cs (If.Emit): Fix a bug that generated incorrect code
19163 on If. Basically, we have to return `true' (ie, we do return to
19164 our caller) only if both branches of the if return.
19166 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
19167 short-circuit operators, handle them as short circuit operators.
19169 (Cast.DoResolve): Resolve type.
19170 (Cast.Cast): Take an expression as the target type.
19172 * cs-parser.jay (cast_expression): Remove old hack that only
19173 allowed a limited set of types to be handled. Now we take a
19174 unary_expression and we resolve to a type during semantic
19177 Use the grammar productions from Rhys to handle casts (this is
19178 not complete like Rhys syntax yet, we fail to handle that corner
19179 case that C# has regarding (-x), but we will get there.
19181 2001-11-22 Ravi Pratap <ravi@ximian.com>
19183 * class.cs (EmitFieldInitializer): Take care of the case when we have a
19184 field which is an array type.
19186 * cs-parser.jay (declare_local_variables): Support array initialization too.
19188 * typemanager.cs (MakeKey): Implement.
19190 (everywhere): Use the above appropriately.
19192 * cs-parser.jay (for_statement): Update for array initialization while
19193 declaring variables.
19195 * ecore.cs : The error message was correct, it's the variable's names that
19196 were misleading ;-) Make the code more readable.
19198 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
19199 the correct type etc.
19201 (ConvertExplicit): Handle Enum types by examining the underlying type.
19203 2001-11-21 Ravi Pratap <ravi@ximian.com>
19205 * parameter.cs (GetCallingConvention): Always return
19206 CallingConventions.Standard for now.
19208 2001-11-22 Miguel de Icaza <miguel@ximian.com>
19210 * expression.cs (Binary.ResolveOperator): Update the values of `l'
19211 and `r' after calling DoNumericPromotions.
19213 * ecore.cs: Fix error message (the types were in the wrong order).
19215 * statement.cs (Foreach.ProbeCollectionType): Need to pass
19216 BindingFlags.Instance as well
19218 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
19219 implicit int literal conversion in an empty cast so that we
19220 propagate the right type upstream.
19222 (UnboxCast): new class used to unbox value types.
19223 (Expression.ConvertExplicit): Add explicit type conversions done
19226 (Expression.ImplicitNumericConversion): Oops, forgot to test for
19227 the target type before applying the implicit LongLiterals to ULong
19230 2001-11-21 Miguel de Icaza <miguel@ximian.com>
19232 * cs-parser.jay (for_statement): Reworked the way For works: now
19233 we declare manually any variables that are introduced in
19234 for_initializer to solve the problem of having out-of-band code
19235 emition (that is what got for broken).
19237 (declaration_statement): Perform the actual variable declaration
19238 that used to be done in local_variable_declaration here.
19240 (local_variable_declaration): Do not declare anything, just pass
19241 the information on a DictionaryEntry
19243 2001-11-20 Ravi Pratap <ravi@ximian.com>
19245 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
19246 re-write of the logic to now make it recursive.
19248 (UpdateIndices): Re-write accordingly.
19250 Store element data in a separate ArrayData list in the above methods.
19252 (MakeByteBlob): Implement to dump the array data into a byte array.
19254 2001-11-19 Ravi Pratap <ravi@ximian.com>
19256 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
19259 * constant.cs (Define): Implement.
19261 (EmitConstant): Re-write fully.
19263 Pass in location info.
19265 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
19268 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
19269 DictionaryEntry since we need location info too.
19271 (constant_declaration): Update accordingly.
19273 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
19274 code into another method : UpdateIndices.
19276 2001-11-18 Ravi Pratap <ravi@ximian.com>
19278 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
19279 some type checking etc.
19281 2001-11-17 Ravi Pratap <ravi@ximian.com>
19283 * expression.cs (ArrayCreation::ValidateInitializers): Implement
19284 bits to provide dimension info if the user skips doing that.
19286 Update second constructor to store the rank correctly.
19288 2001-11-16 Ravi Pratap <ravi@ximian.com>
19290 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
19291 and try to implement.
19293 * ../errors/cs0150.cs : Add.
19295 * ../errors/cs0178.cs : Add.
19297 2001-11-16 Miguel de Icaza <miguel@ximian.com>
19299 * statement.cs: Implement foreach on multi-dimensional arrays.
19301 * parameter.cs (Parameters.GetParameterByName): Also lookup the
19302 name of the params argument.
19304 * expression.cs: Use EmitStoreOpcode to get the right opcode while
19305 initializing the array.
19307 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
19308 we can use this elsewhere.
19310 * statement.cs: Finish implementation of foreach for single
19313 * cs-parser.jay: Use an out-of-band stack to pass information
19314 around, I wonder why I need this.
19316 foreach_block: Make the new foreach_block the current_block.
19318 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
19319 function used to return a static Parameters structure. Used for
19320 empty parameters, as those are created very frequently.
19322 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
19324 2001-11-15 Ravi Pratap <ravi@ximian.com>
19326 * interface.cs : Default modifier is private, not public. The
19327 make verify test passes again.
19329 2001-11-15 Ravi Pratap <ravi@ximian.com>
19331 * support.cs (ReflectionParameters): Fix logic to determine
19332 whether the last parameter is a params one. Test 9 passes again.
19334 * delegate.cs (Populate): Register the builders we define with
19335 RegisterParameterForBuilder. Test 19 passes again.
19337 * cs-parser.jay (property_declaration): Reference $6 instead
19338 of $$ to get at the location.
19340 (indexer_declaration): Similar stuff.
19342 (attribute): Ditto.
19344 * class.cs (Property): Register parameters for the Get and Set methods
19345 if they exist. Test 23 passes again.
19347 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
19348 call to EmitArguments as we are sure there aren't any params arguments.
19349 Test 32 passes again.
19351 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
19352 IndexOutOfRangeException.
19354 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
19355 Test 33 now passes again.
19357 2001-11-15 Miguel de Icaza <miguel@ximian.com>
19359 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
19360 broke a bunch of things. Will have to come up with a better way
19361 of tracking locations.
19363 * statement.cs: Implemented foreach for single dimension arrays.
19365 2001-11-09 Miguel de Icaza <miguel@ximian.com>
19367 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
19368 an error. This removes the lookup from the critical path.
19370 * cs-parser.jay: Removed use of temporary_loc, which is completely
19373 2001-11-14 Miguel de Icaza <miguel@ximian.com>
19375 * support.cs (ReflectionParameters.ParameterModifier): Report
19376 whether the argument is a PARAMS argument or not.
19378 * class.cs: Set the attribute `ParamArrayAttribute' on the
19379 parameter argument.
19381 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
19382 and cons_param_array_attribute (ConstructorInfo for
19383 ParamArrayAttribute).,
19385 * codegen.cs: Emit the return using the `Return' statement, that
19386 way we can report the error correctly for missing return values.
19388 * class.cs (Method.Emit): Clean up.
19390 * expression.cs (Argument.Resolve): Take another argument: the
19391 location where this argument is used. Notice that this is not
19392 part of the "Argument" class as to reduce the size of the
19393 structure (we know the approximate location anyways).
19395 Test if the argument is a variable-reference, if not, then
19396 complain with a 206.
19398 (Argument.Emit): Emit addresses of variables.
19400 (Argument.FullDesc): Simplify.
19402 (Invocation.DoResolve): Update for Argument.Resolve.
19404 (ElementAccess.DoResolve): ditto.
19406 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
19407 method should be virtual, as this method is always virtual.
19409 (NewDelegate.DoResolve): Update for Argument.Resolve.
19411 * class.cs (ConstructorInitializer.DoResolve): ditto.
19413 * attribute.cs (Attribute.Resolve): ditto.
19415 2001-11-13 Miguel de Icaza <miguel@ximian.com>
19417 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
19419 * expression.cs (ParameterReference): Drop IStackStorage and implement
19420 IAssignMethod instead.
19422 (LocalVariableReference): ditto.
19424 * ecore.cs (FieldExpr): Drop IStackStorage and implement
19425 IAssignMethod instead.
19427 2001-11-13 Miguel de Icaza <miguel@ximian.com>
19429 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
19430 enumerations that are used in heavily used structures derive from
19431 byte in a laughable and pathetic attempt to reduce memory usage.
19432 This is the kind of pre-optimzations that you should not do at
19433 home without adult supervision.
19435 * expression.cs (UnaryMutator): New class, used to handle ++ and
19436 -- separatedly from the other unary operators. Cleans up the
19437 code, and kills the ExpressionStatement dependency in Unary.
19439 (Unary): Removed `method' and `Arguments' from this class, making
19440 it smaller, and moving it all to SimpleCall, so I can reuse this
19441 code in other locations and avoid creating a lot of transient data
19442 strucutres when not required.
19444 * cs-parser.jay: Adjust for new changes.
19446 2001-11-11 Miguel de Icaza <miguel@ximian.com>
19448 * enum.cs (Enum.Populate): If there is a failure during
19451 * cs-parser.jay (opt_enum_base): we used to catch type errors
19452 here, but this is really incorrect. The type error should be
19453 catched during semantic analysis.
19455 2001-12-11 Ravi Pratap <ravi@ximian.com>
19457 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
19458 current_local_parameters as expected since I, in my stupidity, had forgotten
19461 * attribute.cs (GetValidPlaces): Fix stupid bug.
19463 * class.cs (Method::Emit): Perform check on applicability of attributes.
19465 (Constructor::Emit): Ditto.
19467 (Field::Emit): Ditto.
19469 (Field.Location): Store location information.
19471 (Property, Event, Indexer, Operator): Ditto.
19473 * cs-parser.jay (field_declaration): Pass in location for each field.
19475 * ../errors/cs0592.cs : Add.
19477 2001-11-12 Ravi Pratap <ravi@ximian.com>
19479 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
19481 (InitCoreTypes): Update accordingly.
19483 (RegisterAttrType, LookupAttr): Implement.
19485 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
19486 info about the same.
19488 (Resolve): Update to populate the above as necessary.
19490 (Error592): Helper.
19492 (GetValidPlaces): Helper to the above.
19494 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
19496 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
19498 2001-11-12 Ravi Pratap <ravi@ximian.com>
19500 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
19502 * ../errors/cs0617.cs : Add.
19504 2001-11-11 Ravi Pratap <ravi@ximian.com>
19506 * enum.cs (Emit): Rename to Populate to be more consistent with what
19507 we expect it to do and when exactly it is called.
19509 * class.cs, rootcontext.cs : Update accordingly.
19511 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
19512 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
19514 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
19516 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
19517 of a fieldinfo using the above, when dealing with a FieldBuilder.
19519 2001-11-10 Ravi Pratap <ravi@ximian.com>
19521 * ../errors/cs0031.cs : Add.
19523 * ../errors/cs1008.cs : Add.
19525 * ../errrors/cs0543.cs : Add.
19527 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
19530 (FindMembers): Implement.
19532 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
19533 enums and delegates too.
19535 (enum_types): Rename to builder_to_enum.
19537 (delegate_types): Rename to builder_to_delegate.
19539 * delegate.cs (FindMembers): Implement.
19541 2001-11-09 Ravi Pratap <ravi@ximian.com>
19543 * typemanager.cs (IsEnumType): Implement.
19545 * enum.cs (Emit): Re-write parts to account for the underlying type
19546 better and perform checking etc.
19548 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
19549 of the underlying type.
19551 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
19554 * enum.cs (error31): Helper to report error #31.
19556 * cs-parser.jay (enum_declaration): Store location of each member too.
19558 * enum.cs (member_to_location): New hashtable.
19560 (AddEnumMember): Update location hashtable.
19562 (Emit): Use the location of each member while reporting errors.
19564 2001-11-09 Miguel de Icaza <miguel@ximian.com>
19566 * cs-parser.jay: A for_initializer if is a
19567 local_variable_declaration really ammount to have an implicit
19568 block with the variable declaration and no initializer for for.
19570 * statement.cs (For.Emit): Cope with null initializers.
19572 This fixes the infinite loop on for initializers.
19574 2001-11-08 Miguel de Icaza <miguel@ximian.com>
19576 * enum.cs: More cleanup.
19578 * ecore.cs: Remove dead code.
19580 * class.cs (Property.Emit): More simplification.
19581 (Event.Emit): ditto.
19583 Reworked to have less levels of indentation.
19585 2001-11-08 Ravi Pratap <ravi@ximian.com>
19587 * class.cs (Property): Emit attributes.
19597 * enum.cs (Emit): Ditto.
19599 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
19602 * class.cs (Field, Event, etc.): Move attribute generation into the
19603 Emit method everywhere.
19605 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
19606 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
19607 as we had no way of defining nested enums !
19609 * rootcontext.cs : Adjust code accordingly.
19611 * typemanager.cs (AddEnumType): To keep track of enum types separately.
19613 2001-11-07 Ravi Pratap <ravi@ximian.com>
19615 * expression.cs (EvalConstantExpression): Move into ecore.cs
19617 * enum.cs (Enum): Rename some members and make them public and readonly
19618 according to our convention.
19620 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
19623 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
19625 (Enum::Emit): Write a simple version for now which doesn't try to compute
19626 expressions. I shall modify this to be more robust in just a while.
19628 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
19630 (TypeContainer::CloseType): Create the Enum types too.
19632 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
19634 * expression.cs (EvalConstantExpression): Get rid of completely.
19636 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
19637 user-defined values and other cases.
19639 (IsValidEnumLiteral): Helper function.
19641 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
19642 out there in the case we had a literal FieldExpr.
19644 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
19646 (Literalize): Revamp a bit to take two arguments.
19648 (EnumLiteral): New class which derives from Literal to wrap enum literals.
19650 2001-11-06 Ravi Pratap <ravi@ximian.com>
19652 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
19654 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
19656 (Resolve): Use the above to ensure we have proper initializers.
19658 2001-11-05 Ravi Pratap <ravi@ximian.com>
19660 * expression.cs (Expression::EvalConstantExpression): New method to
19661 evaluate constant expressions.
19663 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
19665 2001-11-07 Miguel de Icaza <miguel@ximian.com>
19667 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
19670 (Binary.ResolveOperator): Handle operator != (object a, object b)
19671 and operator == (object a, object b);
19673 (Binary.DoNumericPromotions): Indicate whether the numeric
19674 promotion was possible.
19676 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
19679 Made the ArrayAccess implement interface IAssignMethod instead of
19680 IStackStore as the order in which arguments are passed reflects
19683 * assign.cs: Instead of using expr.ExprClass to select the way of
19684 assinging, probe for the IStackStore/IAssignMethod interfaces.
19686 * typemanager.cs: Load InitializeArray definition.
19688 * rootcontext.cs (RootContext.MakeStaticData): Used to define
19689 static data that can be used to initialize arrays.
19691 2001-11-05 Miguel de Icaza <miguel@ximian.com>
19693 * expression.cs: Handle operator== and operator!= for booleans.
19695 (Conditioal.Reduce): Implement reducer for the ?: operator.
19697 (Conditional.Resolve): Implement dead code elimination.
19699 (Binary.Resolve): Catch string literals and return a new
19700 concatenated string.
19702 (Unary.Reduce): Implement reduction of unary expressions.
19704 * ecore.cs: Split out the expression core handling here.
19706 (Expression.Reduce): New method used to perform constant folding
19707 and CSE. This is needed to support constant-expressions.
19709 * statement.cs (Statement.EmitBoolExpression): Pass true and false
19710 targets, and optimize for !x.
19712 2001-11-04 Ravi Pratap <ravi@ximian.com>
19714 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
19715 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
19716 set custom atttributes.
19718 * literal.cs (Literal::GetValue): New abstract method to return the actual
19719 value of the literal, cast as an object.
19721 (*Literal): Implement GetValue method.
19723 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
19724 expressions to the arraylist but objects of type Argument.
19726 * class.cs (TypeContainer::Emit): Emit our attributes too.
19728 (Method::Emit, Constructor::Emit): Ditto.
19730 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
19731 to be ignoring earlier.
19733 2001-11-03 Ravi Pratap <ravi@ximian.com>
19735 * attribute.cs (AttributeSection::Define): Implement to do the business
19736 of constructing a CustomAttributeBuilder.
19738 (Attribute): New trivial class. Increases readability of code.
19740 * cs-parser.jay : Update accordingly.
19742 (positional_argument_list, named_argument_list, named_argument): New rules
19744 (attribute_arguments): Use the above so that we are more correct.
19746 2001-11-02 Ravi Pratap <ravi@ximian.com>
19748 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
19749 to perform all checks for a method with a params parameter.
19751 (Invocation::OverloadResolve): Update to use the above method and therefore
19752 cope correctly with params method invocations.
19754 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
19757 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
19758 constructors in our parent too because we can't afford to miss out on
19761 * attribute.cs (AttributeSection): New name for the class Attribute
19763 Other trivial changes to improve readability.
19765 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
19766 use the new class names.
19768 2001-11-01 Ravi Pratap <ravi@ximian.com>
19770 * class.cs (Method::Define): Complete definition for params types too
19772 (Indexer::Define): Ditto.
19774 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
19775 Cope everywhere with a request for info about the array parameter.
19777 2001-11-01 Ravi Pratap <ravi@ximian.com>
19779 * tree.cs (RecordNamespace): Fix up to check for the correct key.
19781 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
19782 local_variable_type to extract the string corresponding to the type.
19784 (local_variable_type): Fixup the action to use the new helper method.
19786 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
19789 * expression.cs : Clean out code which uses the above.
19791 2001-10-31 Ravi Pratap <ravi@ximian.com>
19793 * typemanager.cs (RegisterMethod): Check if we already have an existing key
19794 and bale out if necessary by returning a false.
19796 (RegisterProperty): Ditto.
19798 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
19799 and print out appropriate error messages.
19801 * interface.cs (everywhere): Ditto.
19803 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
19804 location to constructor.
19806 * class.cs (Property, Event, Indexer): Update accordingly.
19808 * ../errors/cs111.cs : Added.
19810 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
19811 of a method, as laid down by the spec.
19813 (Invocation::OverloadResolve): Use the above method.
19815 2001-10-31 Ravi Pratap <ravi@ximian.com>
19817 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
19818 now take a TypeContainer and a Parameters object.
19820 (ParameterData): Modify return type of ParameterModifier method to be
19821 Parameter.Modifier and not a string.
19823 (ReflectionParameters, InternalParameters): Update accordingly.
19825 * expression.cs (Argument::GetParameterModifier): Same here.
19827 * support.cs (InternalParameters::ParameterType): Find a better way of determining
19828 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
19829 symbol in it at all so maybe this is only for now.
19831 2001-10-30 Ravi Pratap <ravi@ximian.com>
19833 * support.cs (InternalParameters): Constructor now takes an extra argument
19834 which is the actual Parameters class.
19836 (ParameterDesc): Update to provide info on ref/out modifiers.
19838 * class.cs (everywhere): Update call to InternalParameters to pass in
19839 the second argument too.
19841 * support.cs (ParameterData): Add ParameterModifier, which is a method
19842 to return the modifier info [ref/out etc]
19844 (InternalParameters, ReflectionParameters): Implement the above.
19846 * expression.cs (Argument::ParameterModifier): Similar function to return
19847 info about the argument's modifiers.
19849 (Invocation::OverloadResolve): Update to take into account matching modifiers
19852 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
19853 a new SetFormalParameters object which we pass to InternalParameters.
19855 2001-10-30 Ravi Pratap <ravi@ximian.com>
19857 * expression.cs (NewArray): Merge into the ArrayCreation class.
19859 2001-10-29 Ravi Pratap <ravi@ximian.com>
19861 * expression.cs (NewArray): Merge classes NewBuiltinArray and
19862 NewUserdefinedArray into one as there wasn't much of a use in having
19865 * expression.cs (Argument): Change field's name to ArgType from Type.
19867 (Type): New readonly property which returns the proper type, taking into
19868 account ref/out modifiers.
19870 (everywhere): Adjust code accordingly for the above.
19872 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
19873 whether we are emitting for a ref or out parameter.
19875 * expression.cs (Argument::Emit): Use the above field to set the state.
19877 (LocalVariableReference::Emit): Update to honour the flag and emit the
19880 * parameter.cs (Attributes): Set the correct flags for ref parameters.
19882 * expression.cs (Argument::FullDesc): New function to provide a full desc.
19884 * support.cs (ParameterData): Add method ParameterDesc to the interface.
19886 (ReflectionParameters, InternalParameters): Implement the above method.
19888 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
19891 (Invocation::FullMethodDesc): Ditto.
19893 2001-10-29 Miguel de Icaza <miguel@ximian.com>
19895 * cs-parser.jay: Add extra production for the second form of array
19898 * expression.cs (ArrayCreation): Update to reflect the above
19901 * Small changes to prepare for Array initialization.
19903 2001-10-28 Miguel de Icaza <miguel@ximian.com>
19905 * typemanager.cs (ImplementsInterface): interface might be null;
19906 Deal with this problem;
19908 Also, we do store negative hits on the cache (null values), so use
19909 this instead of calling t.GetInterfaces on the type everytime.
19911 2001-10-28 Ravi Pratap <ravi@ximian.com>
19913 * typemanager.cs (IsBuiltinType): New method to help determine the same.
19915 * expression.cs (New::DoResolve): Get rid of array creation code and instead
19916 split functionality out into different classes.
19918 (New::FormArrayType): Move into NewBuiltinArray.
19920 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
19923 (NewBuiltinArray): New class to handle creation of built-in arrays.
19925 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
19926 account creation of one-dimensional arrays.
19928 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
19930 (NewUserdefinedArray::DoResolve): Implement.
19932 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
19934 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
19935 we maintain inside the TypeManager. This is necessary to perform lookups on the
19938 (LookupType): Update to perform GetType on the module builders too.
19940 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
19942 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
19944 2001-10-23 Ravi Pratap <ravi@ximian.com>
19946 * expression.cs (New::DoResolve): Implement guts of array creation.
19948 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
19950 2001-10-27 Miguel de Icaza <miguel@ximian.com>
19952 * expression.cs: Fix bug I introduced lsat night that broke
19955 (Expression.Resolve): Report a 246 error (can not resolve name)
19956 if we find a SimpleName in the stream.
19958 (Expression.ResolveLValue): Ditto.
19960 (Expression.ResolveWithSimpleName): This function is a variant of
19961 ResolveName, this one allows SimpleNames to be returned without a
19962 warning. The only consumer of SimpleNames is MemberAccess
19964 2001-10-26 Miguel de Icaza <miguel@ximian.com>
19966 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
19967 might arrive here. I have my doubts that this is correct.
19969 * statement.cs (Lock): Implement lock statement.
19971 * cs-parser.jay: Small fixes to support `lock' and `using'
19973 * cs-tokenizer.cs: Remove extra space
19975 * driver.cs: New flag --checked, allows to turn on integer math
19978 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
19979 Threading.Monitor.Exit
19981 2001-10-23 Miguel de Icaza <miguel@ximian.com>
19983 * expression.cs (IndexerAccess::DoResolveLValue): Set the
19984 Expression Class to be IndexerAccess.
19986 Notice that Indexer::DoResolve sets the eclass to Value.
19988 2001-10-22 Miguel de Icaza <miguel@ximian.com>
19990 * class.cs (TypeContainer::Emit): Emit code for indexers.
19992 * assign.cs (IAssignMethod): New interface implemented by Indexers
19993 and Properties for handling assignment.
19995 (Assign::Emit): Simplify and reuse code.
19997 * expression.cs (IndexerAccess, PropertyExpr): Implement
19998 IAssignMethod, clean up old code.
20000 2001-10-22 Ravi Pratap <ravi@ximian.com>
20002 * typemanager.cs (ImplementsInterface): New method to determine if a type
20003 implements a given interface. Provides a nice cache too.
20005 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
20008 (ConvertReferenceExplicit): Ditto.
20010 * delegate.cs (Delegate::Populate): Update to define the parameters on the
20011 various methods, with correct names etc.
20013 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
20014 Operator.UnaryNegation.
20016 * cs-parser.jay (operator_declarator): Be a little clever in the case where
20017 we have a unary plus or minus operator.
20019 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
20022 * everywhere : update accordingly.
20024 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
20027 * class.cs (Method::Define): For the case where we are implementing a method
20028 inherited from an interface, we need to set the MethodAttributes.Final flag too.
20029 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
20031 2001-10-21 Ravi Pratap <ravi@ximian.com>
20033 * interface.cs (FindMembers): Implement to work around S.R.E
20036 * typemanager.cs (IsInterfaceType): Implement.
20038 (FindMembers): Update to handle interface types too.
20040 * expression.cs (ImplicitReferenceConversion): Re-write bits which
20041 use IsAssignableFrom as that is not correct - it doesn't work.
20043 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
20044 and accordingly override EmitStatement.
20046 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
20047 using the correct logic :-)
20049 2001-10-19 Ravi Pratap <ravi@ximian.com>
20051 * ../errors/cs-11.cs : Add to demonstrate error -11
20053 2001-10-17 Miguel de Icaza <miguel@ximian.com>
20055 * assign.cs (Assign::Resolve): Resolve right hand side first, and
20056 then pass this as a hint to ResolveLValue.
20058 * expression.cs (FieldExpr): Add Location information
20060 (FieldExpr::LValueResolve): Report assignment to readonly
20063 (Expression::ExprClassFromMemberInfo): Pass location information.
20065 (Expression::ResolveLValue): Add new method that resolves an
20068 (Expression::DoResolveLValue): Default invocation calls
20071 (Indexers): New class used to keep track of indexers in a given
20074 (IStackStore): Renamed from LValue, as it did not really describe
20075 what this did. Also ResolveLValue is gone from this interface and
20076 now is part of Expression.
20078 (ElementAccess): Depending on the element access type
20080 * typemanager.cs: Add `indexer_name_type' as a Core type
20081 (System.Runtime.CompilerServices.IndexerNameAttribute)
20083 * statement.cs (Goto): Take a location.
20085 2001-10-18 Ravi Pratap <ravi@ximian.com>
20087 * delegate.cs (Delegate::VerifyDelegate): New method to verify
20088 if two delegates are compatible.
20090 (NewDelegate::DoResolve): Update to take care of the case when
20091 we instantiate a delegate from another delegate.
20093 * typemanager.cs (FindMembers): Don't even try to look up members
20094 of Delegate types for now.
20096 2001-10-18 Ravi Pratap <ravi@ximian.com>
20098 * delegate.cs (NewDelegate): New class to take care of delegate
20101 * expression.cs (New): Split the delegate related code out into
20102 the NewDelegate class.
20104 * delegate.cs (DelegateInvocation): New class to handle delegate
20107 * expression.cs (Invocation): Split out delegate related code into
20108 the DelegateInvocation class.
20110 2001-10-17 Ravi Pratap <ravi@ximian.com>
20112 * expression.cs (New::DoResolve): Implement delegate creation fully
20113 and according to the spec.
20115 (New::DoEmit): Update to handle delegates differently.
20117 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
20118 because of which we were printing out arguments in reverse order !
20120 * delegate.cs (VerifyMethod): Implement to check if the given method
20121 matches the delegate.
20123 (FullDelegateDesc): Implement.
20125 (VerifyApplicability): Implement.
20127 * expression.cs (Invocation::DoResolve): Update to accordingly handle
20128 delegate invocations too.
20130 (Invocation::Emit): Ditto.
20132 * ../errors/cs1593.cs : Added.
20134 * ../errors/cs1594.cs : Added.
20136 * delegate.cs (InstanceExpression, TargetMethod): New properties.
20138 2001-10-16 Ravi Pratap <ravi@ximian.com>
20140 * typemanager.cs (intptr_type): Core type for System.IntPtr
20142 (InitCoreTypes): Update for the same.
20144 (iasyncresult_type, asynccallback_type): Ditto.
20146 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
20149 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
20152 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
20153 the builders for the 4 members of a delegate type :-)
20155 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
20158 * expression.cs (New::DoResolve): Implement guts for delegate creation.
20160 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
20162 2001-10-15 Miguel de Icaza <miguel@ximian.com>
20164 * statement.cs (Break::Emit): Implement.
20165 (Continue::Emit): Implement.
20167 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
20168 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
20169 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
20170 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
20173 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
20174 properties that track the label for the current loop (begin of the
20175 loop and end of the loop).
20177 2001-10-15 Ravi Pratap <ravi@ximian.com>
20179 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
20180 use of emitting anything at all.
20182 * class.cs, rootcontext.cs : Get rid of calls to the same.
20184 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
20186 (Populate): Define the constructor correctly and set the implementation
20189 * typemanager.cs (delegate_types): New hashtable to hold delegates that
20192 (AddDelegateType): Implement.
20194 (IsDelegateType): Implement helper method.
20196 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
20198 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
20199 and accordingly handle it.
20201 * delegate.cs (Populate): Take TypeContainer argument.
20202 Implement bits to define the Invoke method. However, I still haven't figured out
20203 how to take care of the native int bit :-(
20205 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
20206 Qualify the name of the delegate, not its return type !
20208 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
20211 (StandardConversionExists): Checking for array types turns out to be recursive.
20213 (ConvertReferenceExplicit): Implement array conversion.
20215 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
20217 2001-10-12 Ravi Pratap <ravi@ximian.com>
20219 * cs-parser.jay (delegate_declaration): Store the fully qualified
20220 name as it is a type declaration.
20222 * delegate.cs (ReturnType, Name): Rename members to these. Make them
20225 (DefineDelegate): Renamed from Define. Does the same thing essentially,
20226 as TypeContainer::DefineType.
20228 (Populate): Method in which all the definition of the various methods (Invoke)
20231 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
20234 (CloseDelegate): Finally creates the delegate.
20236 * class.cs (TypeContainer::DefineType): Update to define delegates.
20237 (Populate, Emit and CloseType): Do the same thing here too.
20239 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
20240 delegates in all these operations.
20242 2001-10-14 Miguel de Icaza <miguel@ximian.com>
20244 * expression.cs: LocalTemporary: a new expression used to
20245 reference a temporary that has been created.
20247 * assign.cs: Handle PropertyAccess back here, so that we can
20248 provide the proper semantic access to properties.
20250 * expression.cs (Expression::ConvertReferenceExplicit): Implement
20251 a few more explicit conversions.
20253 * modifiers.cs: `NEW' modifier maps to HideBySig.
20255 * expression.cs (PropertyExpr): Make this into an
20256 ExpressionStatement, and support the EmitStatement code path.
20258 Perform get/set error checking, clean up the interface.
20260 * assign.cs: recognize PropertyExprs as targets, and if so, turn
20261 them into toplevel access objects.
20263 2001-10-12 Miguel de Icaza <miguel@ximian.com>
20265 * expression.cs: PropertyExpr::PropertyExpr: use work around the
20268 * typemanager.cs: Keep track here of our PropertyBuilders again to
20269 work around lameness in SRE.
20271 2001-10-11 Miguel de Icaza <miguel@ximian.com>
20273 * expression.cs (LValue::LValueResolve): New method in the
20274 interface, used to perform a second resolution pass for LValues.
20276 (This::DoResolve): Catch the use of this in static methods.
20278 (This::LValueResolve): Implement.
20280 (This::Store): Remove warning, assigning to `this' in structures
20283 (Invocation::Emit): Deal with invocation of
20284 methods on value types. We need to pass the address to structure
20285 methods rather than the object itself. (The equivalent code to
20286 emit "this" for structures leaves the entire structure on the
20287 stack instead of a pointer to it).
20289 (ParameterReference::DoResolve): Compute the real index for the
20290 argument based on whether the method takes or not a `this' pointer
20291 (ie, the method is static).
20293 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
20294 value types returned from functions when we need to invoke a
20295 method on the sturcture.
20298 2001-10-11 Ravi Pratap <ravi@ximian.com>
20300 * class.cs (TypeContainer::DefineType): Method to actually do the business of
20301 defining the type in the Modulebuilder or Typebuilder. This is to take
20302 care of nested types which need to be defined on the TypeBuilder using
20303 DefineNestedMethod.
20305 (TypeContainer::GetClassBases): Implement. Essentially the code from the
20306 methods in RootContext, only ported to be part of TypeContainer.
20308 (TypeContainer::GetInterfaceOrClass): Ditto.
20310 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
20312 * interface.cs (Interface::DefineInterface): New method. Does exactly
20313 what RootContext.CreateInterface did earlier, only it takes care of nested types
20316 (Interface::GetInterfaces): Move from RootContext here and port.
20318 (Interface::GetInterfaceByName): Same here.
20320 * rootcontext.cs (ResolveTree): Re-write.
20322 (PopulateTypes): Re-write.
20324 * class.cs (TypeContainer::Populate): Populate nested types too.
20325 (TypeContainer::Emit): Emit nested members too.
20327 * typemanager.cs (AddUserType): Do not make use of the FullName property,
20328 instead just use the name argument passed in as it is already fully
20331 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
20332 to TypeContainer mapping to see if a type is user-defined.
20334 * class.cs (TypeContainer::CloseType): Implement.
20336 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
20337 the default constructor.
20339 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
20342 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
20344 * interface.cs (CloseType): Create the type here.
20346 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
20349 Remove all the methods which are now in TypeContainer.
20351 2001-10-10 Ravi Pratap <ravi@ximian.com>
20353 * delegate.cs (Define): Re-write bits to define the delegate
20356 2001-10-10 Miguel de Icaza <miguel@ximian.com>
20358 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
20360 * expression.cs (ImplicitReferenceConversion): handle null as well
20361 as a source to convert to any reference type.
20363 * statement.cs (Return): Perform any implicit conversions to
20364 expected return type.
20366 Validate use of return statement.
20368 * codegen.cs (EmitContext): Pass the expected return type here.
20370 * class.cs (Method, Constructor, Property): Pass expected return
20371 type to EmitContext.
20373 2001-10-09 Miguel de Icaza <miguel@ximian.com>
20375 * expression.cs: Make DoResolve take an EmitContext instead of a
20378 Replaced `l' and `location' for `loc', for consistency.
20380 (Error, Warning): Remove unneeded Tc argument.
20382 * assign.cs, literal.cs, constant.cs: Update to new calling
20385 * codegen.cs: EmitContext now contains a flag indicating whether
20386 code is being generated in a static method or not.
20388 * cs-parser.jay: DecomposeQI, new function that replaces the old
20389 QualifiedIdentifier. Now we always decompose the assembled
20390 strings from qualified_identifier productions into a group of
20393 2001-10-08 Miguel de Icaza <miguel@ximian.com>
20395 * rootcontext.cs: Deal with field-less struct types correctly now
20396 by passing the size option to Define Type.
20398 * class.cs: Removed hack that created one static field.
20400 2001-10-07 Miguel de Icaza <miguel@ximian.com>
20402 * statement.cs: Moved most of the code generation here.
20404 2001-10-09 Ravi Pratap <ravi@ximian.com>
20406 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
20409 (ElementAccess): Remove useless bits for now - keep checks as the spec
20412 2001-10-08 Ravi Pratap <ravi@ximian.com>
20414 * expression.cs (ElementAccess::DoResolve): Remove my crap code
20415 and start performing checks according to the spec.
20417 2001-10-07 Ravi Pratap <ravi@ximian.com>
20419 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
20420 rank_specifiers instead.
20422 (rank_specifiers): Change the order in which the rank specifiers are stored
20424 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
20426 * expression.cs (ElementAccess): Implement the LValue interface too.
20428 2001-10-06 Ravi Pratap <ravi@ximian.com>
20430 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
20431 except that user defined conversions are not included.
20433 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
20434 perform the conversion of the return type, if necessary.
20436 (New::DoResolve): Check whether we are creating an array or an object
20437 and accordingly do the needful.
20439 (New::Emit): Same here.
20441 (New::DoResolve): Implement guts of array creation.
20443 (New::FormLookupType): Helper function.
20445 2001-10-07 Miguel de Icaza <miguel@ximian.com>
20447 * codegen.cs: Removed most of the code generation here, and move the
20448 corresponding code generation bits to the statement classes.
20450 Added support for try/catch/finalize and throw.
20452 * cs-parser.jay: Added support for try/catch/finalize.
20454 * class.cs: Catch static methods having the flags override,
20455 virtual or abstract.
20457 * expression.cs (UserCast): This user cast was not really doing
20458 what it was supposed to do. Which is to be born in fully resolved
20459 state. Parts of the resolution were being performed at Emit time!
20463 2001-10-05 Miguel de Icaza <miguel@ximian.com>
20465 * expression.cs: Implicity convert the result from UserCast.
20467 2001-10-05 Ravi Pratap <ravi@ximian.com>
20469 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
20470 prevented it from working correctly.
20472 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
20473 merely ConvertImplicit.
20475 2001-10-05 Miguel de Icaza <miguel@ximian.com>
20477 * typemanager.cs: Make the LookupTypeContainer function static,
20478 and not per-instance.
20480 * class.cs: Make static FindMembers (the one that takes a Type
20483 * codegen.cs: Add EmitForeach here.
20485 * cs-parser.jay: Make foreach a toplevel object instead of the
20486 inline expansion, as we need to perform semantic analysis on it.
20488 2001-10-05 Ravi Pratap <ravi@ximian.com>
20490 * expression.cs (Expression::ImplicitUserConversion): Rename to
20491 UserDefinedConversion.
20493 (Expression::UserDefinedConversion): Take an extra argument specifying
20494 whether we look for explicit user conversions too.
20496 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
20498 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
20500 (ExplicitUserConversion): Make it a call to UserDefinedConversion
20501 with the appropriate arguments.
20503 * cs-parser.jay (cast_expression): Record location too.
20505 * expression.cs (Cast): Record location info.
20507 (Expression::ConvertExplicit): Take location argument.
20509 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
20510 to determine if we are doing explicit conversions.
20512 (UserCast::Emit): Update accordingly.
20514 (Expression::ConvertExplicit): Report an error if everything fails.
20516 * ../errors/cs0030.cs : Add.
20518 2001-10-04 Miguel de Icaza <miguel@ximian.com>
20520 * modifiers.cs: If the ABSTRACT keyword is present, also set the
20521 virtual and newslot bits.
20523 * class.cs (TypeContainer::RegisterRequiredImplementations):
20524 Record methods we need.
20526 (TypeContainer::MakeKey): Helper function to make keys for
20527 MethodBases, since the Methodbase key is useless.
20529 (TypeContainer::Populate): Call RegisterRequiredImplementations
20530 before defining the methods.
20532 Create a mapping for method_builders_to_methods ahead of time
20533 instead of inside a tight loop.
20535 (::RequireMethods): Accept an object as the data to set into the
20536 hashtable so we can report interface vs abstract method mismatch.
20538 2001-10-03 Miguel de Icaza <miguel@ximian.com>
20540 * report.cs: Make all of it static.
20542 * rootcontext.cs: Drop object_type and value_type computations, as
20543 we have those in the TypeManager anyways.
20545 Drop report instance variable too, now it is a global.
20547 * driver.cs: Use try/catch on command line handling.
20549 Add --probe option to debug the error reporting system with a test
20552 * report.cs: Add support for exiting program when a probe
20553 condition is reached.
20555 2001-10-03 Ravi Pratap <ravi@ximian.com>
20557 * expression.cs (Binary::DoNumericPromotions): Fix the case when
20558 we do a forcible conversion regardless of type, to check if
20559 ForceConversion returns a null.
20561 (Binary::error19): Use location to report error.
20563 (Unary::error23): Use location here too.
20565 * ../errors/cs0019.cs : Check in.
20567 * ../errors/cs0023.cs : Check in.
20569 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
20570 case of a non-null MethodInfo object with a length of 0 !
20572 (Binary::ResolveOperator): Flag error if overload resolution fails to find
20573 an applicable member - according to the spec :-)
20574 Also fix logic to find members in base types.
20576 (Unary::ResolveOperator): Same here.
20578 (Unary::report23): Change name to error23 and make first argument a TypeContainer
20579 as I was getting thoroughly confused between this and error19 :-)
20581 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
20582 (::FindMostEncompassedType): Implement.
20583 (::FindMostEncompassingType): Implement.
20584 (::StandardConversionExists): Implement.
20586 (UserImplicitCast): Re-vamp. We now need info about most specific
20587 source and target types so that we can do the necessary conversions.
20589 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
20590 mathematical union with no duplicates.
20592 2001-10-03 Miguel de Icaza <miguel@ximian.com>
20594 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
20595 in order from base classes to child classes, so that we can in
20596 child classes look up in our parent for method names and
20597 attributes (required for handling abstract, virtual, new, override
20598 constructs: we need to instrospect our base class, and if we dont
20599 populate the classes in order, the introspection might be
20600 incorrect. For example, a method could query its parent before
20601 the parent has any methods and would determine that the parent has
20602 no abstract methods (while it could have had them)).
20604 (RootContext::CreateType): Record the order in which we define the
20607 2001-10-02 Miguel de Icaza <miguel@ximian.com>
20609 * class.cs (TypeContainer::Populate): Also method definitions can
20610 fail now, keep track of this.
20612 (TypeContainer::FindMembers): Implement support for
20613 DeclaredOnly/noDeclaredOnly flag.
20615 (Constructor::Emit) Return the ConstructorBuilder.
20617 (Method::Emit) Return the MethodBuilder.
20618 Check for abstract or virtual methods to be public.
20620 * rootcontext.cs (RootContext::CreateType): Register all the
20621 abstract methods required for the class to be complete and the
20622 interface methods that must be implemented.
20624 * cs-parser.jay: Report error 501 (method requires body if it is
20625 not marked abstract or extern).
20627 * expression.cs (TypeOf::Emit): Implement.
20629 * typemanager.cs: runtime_handle_type, new global type.
20631 * class.cs (Property::Emit): Generate code for properties.
20633 2001-10-02 Ravi Pratap <ravi@ximian.com>
20635 * expression.cs (Unary::ResolveOperator): Find operators on base type
20636 too - we now conform exactly to the spec.
20638 (Binary::ResolveOperator): Same here.
20640 * class.cs (Operator::Define): Fix minor quirk in the tests.
20642 * ../errors/cs0215.cs : Added.
20644 * ../errors/cs0556.cs : Added.
20646 * ../errors/cs0555.cs : Added.
20648 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20650 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
20651 single integer which is really efficient
20653 2001-10-01 Ravi Pratap <ravi@ximian.com>
20655 * expression.cs (Expression::ImplicitUserConversion): Use location
20656 even in the case when we are examining True operators.
20658 * class.cs (Operator::Define): Perform extensive checks to conform
20659 with the rules for operator overloading in the spec.
20661 * expression.cs (Expression::ImplicitReferenceConversion): Implement
20662 some of the other conversions mentioned in the spec.
20664 * typemanager.cs (array_type): New static member for the System.Array built-in
20667 (cloneable_interface): For System.ICloneable interface.
20669 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
20670 we start resolving the tree and populating types.
20672 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
20674 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20676 * expression.cs (Expression::ExprClassFromMemberInfo,
20677 Expression::Literalize): Create literal expressions from
20678 FieldInfos which are literals.
20680 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
20681 type casts, because they were wrong. The test suite in tests
20684 (ImplicitNumericConversion): ushort to ulong requires a widening
20687 Int32 constant to long requires widening cast as well.
20689 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
20690 for integers because the type on the stack is not i4.
20692 2001-09-30 Miguel de Icaza <miguel@ximian.com>
20694 * expression.cs (report118): require location argument.
20696 * parameter.cs: Do not dereference potential null value.
20698 * class.cs: Catch methods that lack the `new' keyword when
20699 overriding a name. Report warnings when `new' is used without
20700 anything being there to override.
20702 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
20704 * class.cs: Only add constructor to hashtable if it is non-null
20705 (as now constructors can fail on define).
20707 (TypeManager, Class, Struct): Take location arguments.
20709 Catch field instance initialization in structs as errors.
20711 accepting_filter: a new filter for FindMembers that is static so
20712 that we dont create an instance per invocation.
20714 (Constructor::Define): Catch errors where a struct constructor is
20717 * cs-parser.jay: Pass location information for various new
20720 * delegate.cs (Delegate): take a location argument.
20722 * driver.cs: Do not call EmitCode if there were problesm in the
20723 Definition of the types, as many Builders wont be there.
20725 * decl.cs (Decl::Decl): Require a location argument.
20727 * cs-tokenizer.cs: Handle properly hex constants that can not fit
20728 into integers, and find the most appropiate integer for it.
20730 * literal.cs: Implement ULongLiteral.
20732 * rootcontext.cs: Provide better information about the location of
20733 failure when CreateType fails.
20735 2001-09-29 Miguel de Icaza <miguel@ximian.com>
20737 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
20740 * expression.cs (Binary::CheckShiftArguments): Add missing type
20742 (Binary::ResolveOperator): Add type to the logical and and logical
20743 or, Bitwise And/Or and Exclusive Or code paths, it was missing
20746 (Binary::DoNumericPromotions): In the case where either argument
20747 is ulong (and most signed types combined with ulong cause an
20748 error) perform implicit integer constant conversions as well.
20750 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20752 * expression.cs (UserImplicitCast): Method should always be
20754 (Invocation::BetterConversion): Simplified test for IntLiteral.
20756 (Expression::ImplicitNumericConversion): Split this routine out.
20757 Put the code that performs implicit constant integer conversions
20760 (Expression::Resolve): Become a wrapper around DoResolve so we can
20761 check eclass and type being set after resolve.
20763 (Invocation::Badness): Remove this dead function
20765 (Binary::ResolveOperator): Do not compute the expensive argumnets
20766 unless we have a union for it.
20768 (Probe::Emit): Is needs to do an isinst and then
20769 compare against null.
20771 (::CanConvert): Added Location argument. If the Location argument
20772 is null (Location.Null), then we do not report errors. This is
20773 used by the `probe' mechanism of the Explicit conversion. We do
20774 not want to generate an error for something that the user
20775 explicitly requested to be casted. But the pipeline for an
20776 explicit cast first tests for potential implicit casts.
20778 So for now, if the Location is null, it means `Probe only' to
20779 avoid adding another argument. Might have to revise this
20782 (ClassCast): New class used to type cast objects into arbitrary
20783 classes (used in Explicit Reference Conversions).
20785 Implement `as' as well.
20787 Reverted all the patches from Ravi below: they were broken:
20789 * The use of `level' as a mechanism to stop recursive
20790 invocations is wrong. That was there just to catch the
20791 bug with a strack trace but not as a way of addressing
20794 To fix the problem we have to *understand* what is going
20795 on and the interactions and come up with a plan, not
20796 just get things going.
20798 * The use of the type conversion cache that I proposed
20799 last night had an open topic: How does this work across
20800 protection domains. A user defined conversion might not
20801 be public in the location where we are applying the
20802 conversion, a different conversion might be selected
20803 (ie, private A->B (better) but public B->A (worse),
20804 inside A, A->B applies, but outside it, B->A will
20807 * On top of that (ie, even if the above is solved),
20808 conversions in a cache need to be abstract. Ie, `To
20809 convert from an Int to a Short use an OpcodeCast', not
20810 `To convert from an Int to a Short use the OpcodeCast on
20811 the variable 5' (which is what this patch was doing).
20813 2001-09-28 Ravi Pratap <ravi@ximian.com>
20815 * expression.cs (Invocation::ConversionExists): Re-write to use
20816 the conversion cache
20818 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
20819 cache all conversions done, not just user-defined ones.
20821 (Invocation::BetterConversion): The real culprit. Use ConversionExists
20822 to determine if a conversion exists instead of acutually trying to
20823 perform the conversion. It's faster too.
20825 (Expression::ConvertExplicit): Modify to use ConversionExists to check
20826 and only then attempt the implicit conversion.
20828 2001-09-28 Ravi Pratap <ravi@ximian.com>
20830 * expression.cs (ConvertImplicit): Use a cache for conversions
20831 already found. Check level of recursion and bail out if necessary.
20833 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20835 * typemanager.cs (string_concat_string_string, string_concat_object_object):
20836 Export standard methods that we expect for string operations.
20838 * statement.cs (Block::UsageWarning): Track usage of variables and
20839 report the errors for not used variables.
20841 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
20844 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20846 * codegen.cs: remove unnneded code
20848 * expression.cs: Removed BuiltinTypeAccess class
20850 Fix the order in which implicit conversions are
20853 The previous fixed dropped support for boxed conversions (adding a
20854 test to the test suite now)
20856 (UserImplicitCast::CanConvert): Remove test for source being null,
20857 that code is broken. We should not feed a null to begin with, if
20858 we do, then we should track the bug where the problem originates
20859 and not try to cover it up here.
20861 Return a resolved expression of type UserImplicitCast on success
20862 rather than true/false. Ravi: this is what I was talking about,
20863 the pattern is to use a static method as a "constructor" for
20866 Also, do not create arguments until the very last minute,
20867 otherwise we always create the arguments even for lookups that
20868 will never be performed.
20870 (UserImplicitCast::Resolve): Eliminate, objects of type
20871 UserImplicitCast are born in a fully resolved state.
20873 * typemanager.cs (InitCoreTypes): Init also value_type
20874 (System.ValueType).
20876 * expression.cs (Cast::Resolve): First resolve the child expression.
20878 (LValue): Add new method AddressOf to be used by
20881 Change the argument of Store to take an EmitContext instead of an
20882 ILGenerator, because things like FieldExpr need to be able to call
20883 their children expression to generate the instance code.
20885 (Expression::Error, Expression::Warning): Sugar functions for
20888 (Expression::MemberLookup): Accept a TypeContainer instead of a
20889 Report as the first argument.
20891 (Expression::ResolvePrimary): Killed. I still want to improve
20892 this as currently the code is just not right.
20894 (Expression::ResolveMemberAccess): Simplify, but it is still
20897 (Unary::Resolve): Catch errors in AddressOf operators.
20899 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
20900 index to a byte for the short-version, or the compiler will choose
20901 the wrong Emit call, which generates the wrong data.
20903 (ParameterReference::Emit, ::Store): same.
20905 (FieldExpr::AddressOf): Implement.
20907 * typemanager.cs: TypeManager: made public variable instead of
20910 * driver.cs: document --fatal.
20912 * report.cs (ErrorMessage, WarningMessage): new names for the old
20913 Error and Warning classes.
20915 * cs-parser.jay (member_access): Turn built-in access to types
20916 into a normal simplename
20918 2001-09-27 Ravi Pratap <ravi@ximian.com>
20920 * expression.cs (Invocation::BetterConversion): Fix to cope
20921 with q being null, since this was introducing a bug.
20923 * expression.cs (ConvertImplicit): Do built-in conversions first.
20925 2001-09-27 Ravi Pratap <ravi@ximian.com>
20927 * expression.cs (UserImplicitCast::Resolve): Fix bug.
20929 2001-09-27 Ravi Pratap <ravi@ximian.com>
20931 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
20932 I had introduced long ago (what's new ?).
20934 * expression.cs (UserImplicitCast::CanConvert): Static method to do
20935 the work of all the checking.
20936 (ConvertImplicit): Call CanConvert and only then create object if necessary.
20937 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
20939 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
20940 that is the right way.
20942 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
20943 overloading resolution. Use everywhere instead of cutting and pasting code.
20945 (Binary::ResolveOperator): Use MakeUnionSet.
20947 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
20948 we have to convert to bool types. Not complete yet.
20950 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20952 * typemanager.cs (TypeManager::CSharpName): support ushort.
20954 * expression.cs (Expression::TryImplicitIntConversion): Attempts
20955 to provide an expression that performsn an implicit constant int
20956 conversion (section 6.1.6).
20957 (Expression::ConvertImplicitRequired): Reworked to include
20958 implicit constant expression conversions.
20960 (Expression::ConvertNumericExplicit): Finished.
20962 (Invocation::Emit): If InstanceExpression is null, then it means
20963 that we perform a call on this.
20965 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20967 * expression.cs (Unary::Emit): Remove some dead code.
20968 (Probe): Implement Resolve and Emit for `is'.
20969 (Expression::ConvertImplicitRequired): Attempt to do constant
20970 expression conversions here. Maybe should be moved to
20971 ConvertImplicit, but I am not sure.
20972 (Expression::ImplicitLongConstantConversionPossible,
20973 Expression::ImplicitIntConstantConversionPossible): New functions
20974 that tell whether is it possible to apply an implicit constant
20975 expression conversion.
20977 (ConvertNumericExplicit): Started work on explicit numeric
20980 * cs-parser.jay: Update operator constants.
20982 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
20983 (Parameters::GetSignature): Hook up VerifyArgs here.
20984 (Parameters::VerifyArgs): Verifies that no two arguments have the
20987 * class.cs (Operator): Update the operator names to reflect the
20988 ones that the spec expects (as we are just stringizing the
20991 * expression.cs (Unary::ResolveOperator): Fix bug: Use
20992 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
20993 previous usage did only work for our methods.
20994 (Expression::ConvertImplicit): Handle decimal implicit numeric
20995 conversions as well.
20996 (Expression::InternalTypeConstructor): Used to invoke constructors
20997 on internal types for default promotions.
20999 (Unary::Emit): Implement special handling for the pre/post
21000 increment/decrement for overloaded operators, as they need to have
21001 the same semantics as the other operators.
21003 (Binary::ResolveOperator): ditto.
21004 (Invocation::ConversionExists): ditto.
21005 (UserImplicitCast::Resolve): ditto.
21007 2001-09-26 Ravi Pratap <ravi@ximian.com>
21009 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
21010 operator, return after emitting body. Regression tests pass again !
21012 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
21013 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
21014 (Invocation::OverloadResolve): Ditto.
21015 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
21017 * everywhere : update calls to the above methods accordingly.
21019 2001-09-26 Miguel de Icaza <miguel@ximian.com>
21021 * assign.cs (Assign): Make it inherit from ExpressionStatement.
21023 * expression.cs (ExpressionStatement): New base class used for
21024 expressions that can appear in statements, so that we can provide
21025 an alternate path to generate expression that do not leave a value
21028 (Expression::Emit, and all the derivatives): We no longer return
21029 whether a value is left on the stack or not. Every expression
21030 after being emitted leaves a single value on the stack.
21032 * codegen.cs (EmitContext::EmitStatementExpression): Use the
21033 facilties of ExpressionStatement if possible.
21035 * cs-parser.jay: Update statement_expression.
21037 2001-09-25 Miguel de Icaza <miguel@ximian.com>
21039 * driver.cs: Change the wording of message
21041 2001-09-25 Ravi Pratap <ravi@ximian.com>
21043 * expression.cs (Binary::ResolveOperator): Had forgottten to set
21044 the type of the expression to the return type of the method if
21045 we have an overloaded operator match ! The regression tests pass again !
21046 (Unary::ResolveOperator): Ditto.
21048 * expression.cs (Invocation::ConversionExists): Correct the member lookup
21049 to find "op_Implicit", not "implicit" ;-)
21050 (UserImplicitCast): New class to take care of user-defined implicit conversions.
21051 (ConvertImplicit, ForceConversion): Take TypeContainer argument
21053 * everywhere : Correct calls to the above accordingly.
21055 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
21056 (ConvertImplicit): Do user-defined conversion if it exists.
21058 2001-09-24 Miguel de Icaza <miguel@ximian.com>
21060 * assign.cs: track location.
21061 (Resolve): Use implicit conversions on assignment.
21063 * literal.cs: Oops. Not good, Emit of short access values should
21064 pass (Bytes) or the wrong argument will be selected.
21066 * expression.cs (Unary::Emit): Emit code for -expr.
21068 (Unary::ResolveOperator): Handle `Substract' for non-constants
21069 (substract from zero from the non-constants).
21070 Deal with Doubles as well.
21072 (Expression::ConvertImplicitRequired): New routine that reports an
21073 error if no implicit conversion exists.
21075 (Invocation::OverloadResolve): Store the converted implicit
21076 expressions if we make them
21078 2001-09-24 Ravi Pratap <ravi@ximian.com>
21080 * class.cs (ConstructorInitializer): Take a Location argument.
21081 (ConstructorBaseInitializer): Same here.
21082 (ConstructorThisInitializer): Same here.
21084 * cs-parser.jay : Update all calls accordingly.
21086 * expression.cs (Unary, Binary, New): Take location argument.
21087 Update accordingly everywhere.
21089 * cs-parser.jay : Update all calls to the above to take a location
21092 * class.cs : Ditto.
21094 2001-09-24 Ravi Pratap <ravi@ximian.com>
21096 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
21097 (Invocation::BetterConversion): Same here
21098 (Invocation::ConversionExists): Ditto.
21100 (Invocation::ConversionExists): Implement.
21102 2001-09-22 Ravi Pratap <ravi@ximian.com>
21104 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
21105 Also take an additional TypeContainer argument.
21107 * All over : Pass in TypeContainer as argument to OverloadResolve.
21109 * typemanager.cs (CSharpName): Update to check for the string type and return
21112 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
21115 2001-09-21 Ravi Pratap <ravi@ximian.com>
21117 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
21118 (Invocation::BetterFunction): Implement.
21119 (Invocation::BetterConversion): Implement.
21120 (Invocation::ConversionExists): Skeleton, no implementation yet.
21122 Okay, things work fine !
21124 2001-09-21 Miguel de Icaza <miguel@ximian.com>
21126 * typemanager.cs: declare and load enum_type, delegate_type and
21129 * expression.cs (Expression::Emit): Now emit returns a value that
21130 tells whether a value is left on the stack or not. This strategy
21131 might be reveted tomorrow with a mechanism that would address
21132 multiple assignments.
21133 (Expression::report118): Utility routine to report mismatches on
21136 (Unary::Report23): Report impossible type/operator combination
21139 (Unary::IsIncrementableNumber): Whether the type can be
21140 incremented or decremented with add.
21141 (Unary::ResolveOperator): Also allow enumerations to be bitwise
21143 (Unary::ResolveOperator): Implement ++, !, ~,
21145 (Invocation::Emit): Deal with new Emit convetion.
21147 * All Expression derivatives: Updated their Emit method to return
21148 whether they leave values on the stack or not.
21150 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
21151 stack for expressions that are statements.
21153 2001-09-20 Miguel de Icaza <miguel@ximian.com>
21155 * expression.cs (LValue): New interface. Must be implemented by
21157 (LocalVariableReference, ParameterReference, FieldExpr): Implement
21160 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
21161 interface for generating code, simplifies the code.
21163 2001-09-20 Ravi Pratap <ravi@ximian.com>
21165 * expression.cs (everywhere): Comment out return statements in ::Resolve
21166 methods to avoid the warnings.
21168 2001-09-20 Miguel de Icaza <miguel@ximian.com>
21170 * driver.cs (parse): Report error 2001 if we can not open the
21173 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
21176 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
21179 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
21180 otherwise nested blocks end up with the same index.
21182 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
21184 * expression.cs: Instead of having FIXMEs in the Resolve
21185 functions, throw exceptions so it is obvious that we are facing a
21188 * cs-parser.jay (invocation_expression): Pass Location information.
21190 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
21191 Use a basename for those routines because .NET does not like paths
21194 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
21197 2001-09-19 Miguel de Icaza <miguel@ximian.com>
21199 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
21200 are loading the correct data types (throws an exception if not).
21201 (TypeManager::InitCoreTypes): Use CoreLookupType
21203 * expression.cs (Unary::ResolveOperator): return the child
21204 expression for expressions which are just +expr.
21205 (Unary::ResolveOperator): Return negative literals for -LITERAL
21206 expressions (otherwise they are Unary {Literal}).
21207 (Invocation::Badness): Take into account `Implicit constant
21208 expression conversions'.
21210 * literal.cs (LongLiteral): Implement long literal class.
21211 (IntLiteral): export the `Value' of the intliteral.
21213 2001-09-19 Ravi Pratap <ravi@ximian.com>
21215 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
21217 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
21218 instead of 'Operator'
21220 * expression.cs (Binary::ResolveOperator): Update accordingly.
21221 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
21224 * cs-parser.jay (unary_expression): Update to use the new names.
21226 * gen-treedump.cs (GetUnary): Same here.
21228 * expression.cs (Unary::Resolve): Implement.
21229 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
21230 operators are found instead of making noise ;-)
21231 (Unary::ResolveOperator): New method to do precisely the same thing which
21232 Binary::ResolveOperator does for Binary expressions.
21233 (Unary.method, .Arguments): Add.
21234 (Unary::OperName): Implement.
21235 (Unary::ForceConversion): Copy and Paste !
21237 * class.cs (Operator::Define): Fix a small bug for the case when we have
21240 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
21241 for the inbuilt operators. Only overloading works for now ;-)
21243 2001-09-18 Miguel de Icaza <miguel@ximian.com>
21245 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
21246 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
21248 * expression.cs (This::Emit): Implement.
21249 (This::Resolve): Implement.
21250 (TypeOf:Resolve): Implement.
21251 (Expression::ResolveSimpleName): Add an implicit this to instance
21253 (MemberAccess::Resolve): Deal with Parameters and Fields.
21254 Bind instance variable to Field expressions.
21255 (FieldExpr::Instance): New field used to track the expression that
21256 represents the object instance.
21257 (FieldExpr::Resolve): Track potential errors from MemberLookup not
21259 (FieldExpr::Emit): Implement.
21261 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
21262 the last instruction contains a return opcode to avoid generating
21263 the last `ret' instruction (this generates correct code, and it is
21264 nice to pass the peverify output).
21266 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
21267 initializer for static and instance variables.
21268 (Constructor::Emit): Allow initializer to be null in the case of
21269 static constructors. Only emit initializer for instance
21272 (TypeContainer::FindMembers): Return a null array if there are no
21275 Also fix the code for the MemberTypes.Method branch, as it was not
21276 scanning that for operators (or tried to access null variables before).
21278 * assign.cs (Assign::Emit): Handle instance and static fields.
21282 * driver.cs: Stop compilation if there are parse errors.
21284 * cs-parser.jay (constructor_declaration): Provide default base
21285 initializer for non-static constructors.
21286 (constructor_declarator): Do not provide a default base
21287 initializers if none was specified.
21288 Catch the fact that constructors should not have parameters.
21290 * class.cs: Do not emit parent class initializers for static
21291 constructors, that should be flagged as an error.
21293 2001-09-18 Ravi Pratap <ravi@ximian.com>
21295 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
21296 Move back code into TypeContainer::Populate.
21298 2001-09-18 Ravi Pratap <ravi@ximian.com>
21300 * class.cs (TypeContainer::AddConstructor): Fix the check to
21301 compare against Name, not Basename.
21302 (Operator::OpType): Change Plus and Minus to Add and Subtract.
21304 * cs-parser.jay : Update accordingly.
21306 * class.cs (TypeContainer::FindMembers): For the case where we are searching
21307 for methods, don't forget to look into the operators too.
21308 (RegisterMethodBuilder): Helper method to take care of this for
21309 methods, constructors and operators.
21310 (Operator::Define): Completely revamp.
21311 (Operator.OperatorMethod, MethodName): New fields.
21312 (TypeContainer::Populate): Move the registering of builders into
21313 RegisterMethodBuilder.
21314 (Operator::Emit): Re-write.
21316 * expression.cs (Binary::Emit): Comment out code path to emit method
21317 invocation stuff for the case when we have a user defined operator. I am
21318 just not able to get it right !
21320 2001-09-17 Miguel de Icaza <miguel@ximian.com>
21322 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
21325 (Expression::MemberLookup): Provide a version that allows to
21326 specify the MemberTypes and BindingFlags.
21328 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
21329 so it was not fetching variable information from outer blocks.
21331 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
21332 Beforefieldinit as it was buggy.
21334 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
21335 that Ravi put here.
21337 * class.cs (Constructor::Emit): Only emit if block is not null.
21338 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
21339 deal with this by semantically definining it as if the user had
21342 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
21343 constructors as we now "emit" them at a higher level.
21345 (TypeContainer::DefineDefaultConstructor): Used to define the
21346 default constructors if none was provided.
21348 (ConstructorInitializer): Add methods Resolve and Emit.
21350 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
21352 2001-09-17 Ravi Pratap <ravi@ximian.com>
21354 * class.cs (TypeContainer::EmitDefaultConstructor): Register
21355 the default constructor builder with our hashtable for methodbuilders
21358 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
21359 and argument_count is 0 in which case we have a match.
21360 (Binary::ResolveOperator): More null checking and miscellaneous coding
21363 2001-09-17 Ravi Pratap <ravi@ximian.com>
21365 * rootcontext.cs (IsNameSpace): Compare against null.
21367 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
21369 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
21370 and Unary::Operator.
21372 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
21375 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
21376 we have overloaded operators.
21377 (Binary::ResolveOperator): Implement the part which does the operator overload
21380 * class.cs (Operator::Emit): Implement.
21381 (TypeContainer::Emit): Emit the operators we have too.
21383 * expression.cs (Binary::Emit): Update to emit the appropriate code for
21384 the case when we have a user-defined operator.
21386 2001-09-17 Miguel de Icaza <miguel@ximian.com>
21388 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
21390 2001-09-16 Ravi Pratap <ravi@ximian.com>
21392 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
21393 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
21394 (Constructor::Emit): Implement.
21395 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
21396 if we have no work to do.
21397 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
21400 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
21401 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
21403 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
21406 2001-09-15 Ravi Pratap <ravi@ximian.com>
21408 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
21410 (Tree::RecordNamespace): Method to do what the name says ;-)
21411 (Tree::Namespaces): Property to get at the namespaces hashtable.
21413 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
21416 * rootcontext.cs (IsNamespace): Fixed it :-)
21418 2001-09-14 Miguel de Icaza <miguel@ximian.com>
21420 * class.cs (TypeContainer::FindMembers): Add support for
21422 (MethodCore): New class that encapsulates both the shared aspects
21423 of a Constructor and a Method.
21424 (Method, Constructor): Factored pieces into MethodCore.
21426 * driver.cs: Added --fatal which makes errors throw exceptions.
21427 Load System assembly as well as part of the standard library.
21429 * report.cs: Allow throwing exceptions on errors for debugging.
21431 * modifiers.cs: Do not use `parent', instead use the real type
21432 container to evaluate permission settings.
21434 * class.cs: Put Ravi's patch back in. He is right, and we will
21435 have to cope with the
21437 2001-09-14 Ravi Pratap <ravi@ximian.com>
21439 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
21440 FamORAssem, not FamANDAssem.
21442 2001-09-14 Miguel de Icaza <miguel@ximian.com>
21444 * driver.cs: Added --parse option that only parses its input files
21447 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
21448 incorrect. IsTopLevel is not used to tell whether an object is
21449 root_types or not (that can be achieved by testing this ==
21450 root_types). But to see if this is a top-level *class* (not
21451 necessarly our "toplevel" container).
21453 2001-09-14 Ravi Pratap <ravi@ximian.com>
21455 * enum.cs (Enum::Define): Modify to call the Lookup method on the
21456 parent instead of a direct call to GetType.
21458 2001-09-14 Ravi Pratap <ravi@ximian.com>
21460 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
21461 Modifiers.TypeAttr. This should just be a call to that method.
21463 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
21464 object so that we can determine if we are top-level or not.
21466 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
21469 * enum.cs (Enum::Define): Ditto.
21471 * modifiers.cs (FieldAttr): Re-write.
21473 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
21474 (TypeContainer::HaveStaticConstructor): New property to provide access
21475 to precisely that info.
21477 * modifiers.cs (MethodAttr): Re-write.
21478 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
21480 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
21481 of top-level types as claimed.
21483 2001-09-13 Miguel de Icaza <miguel@ximian.com>
21485 * expression.cs (MemberLookup): Fruitless attempt to lookup
21486 constructors. Maybe I need to emit default constructors? That
21487 might be it (currently .NET emits this for me automatically).
21488 (Invocation::OverloadResolve): Cope with Arguments == null.
21489 (Invocation::EmitArguments): new function, shared by the new
21490 constructor and us.
21491 (Invocation::Emit): Handle static and instance methods. Emit
21492 proper call instruction for virtual or non-virtual invocations.
21493 (New::Emit): Implement.
21494 (New::Resolve): Implement.
21495 (MemberAccess:Resolve): Implement.
21496 (MethodGroupExpr::InstanceExpression): used conforming to the spec
21497 to track instances.
21498 (FieldExpr::Resolve): Set type.
21500 * support.cs: Handle empty arguments.
21502 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
21503 SimpleLookup): Auxiliary routines to help parse a qualifier
21506 Update qualifier_identifier rule.
21508 * codegen.cs: Removed debugging messages.
21510 * class.cs: Make this a global thing, this acts just as a "key" to
21511 objects that we might have around.
21513 (Populate): Only initialize method_builders_to_methods once.
21515 * expression.cs (PropertyExpr): Initialize type from the
21518 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
21519 Resolve pattern. Attempt to implicitly convert value to boolean.
21522 * expression.cs: Set the type for the int32/int32 argument case.
21523 (Binary::ResolveOperator): Set the return type to boolean for
21524 comparission operators
21526 * typemanager.cs: Remove debugging print code.
21528 (Invocation::Resolve): resolve type.
21530 * class.cs: Allocate a MemberInfo of the correct size, as the code
21531 elsewhere depends on the test to reflect the correct contents.
21533 (Method::) Keep track of parameters, due to System.Reflection holes
21535 (TypeContainer::Populate): Keep track of MethodBuilders to Method
21538 (TypeContainer::FindMembers): Use ArrayList and then copy an array
21539 of the exact size and return that.
21541 (Class::LookupMethodByBuilder): New function that maps
21542 MethodBuilders to its methods. Required to locate the information
21543 on methods because System.Reflection bit us again.
21545 * support.cs: New file, contains an interface ParameterData and
21546 two implementations: ReflectionParameters and InternalParameters
21547 used to access Parameter information. We will need to grow this
21550 * expression.cs (Invocation::GetParameterData): implement a cache
21551 and a wrapper around the ParameterData creation for methods.
21552 (Invocation::OverloadResolve): Use new code.
21554 2001-09-13 Ravi Pratap <ravi@ximian.com>
21556 * class.cs (TypeContainer::EmitField): Remove and move into
21557 (Field::Define): here and modify accordingly.
21558 (Field.FieldBuilder): New member.
21559 (TypeContainer::Populate): Update accordingly.
21560 (TypeContainer::FindMembers): Implement.
21562 2001-09-13 Miguel de Icaza <miguel@ximian.com>
21564 * statement.cs: (VariableInfo::VariableType): New field to be
21565 initialized with the full type once it is resolved.
21567 2001-09-12 Miguel de Icaza <miguel@ximian.com>
21569 * parameter.cs (GetParameterInfo): Use a type cache to compute
21570 things only once, and to reuse this information
21572 * expression.cs (LocalVariableReference::Emit): Implement.
21573 (OpcodeCast::Emit): fix.
21575 (ParameterReference::Resolve): Implement.
21576 (ParameterReference::Emit): Implement.
21578 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
21579 that are expressions need to stay as Expressions.
21581 * typemanager.cs (CSharpName): Returns the C# name of a type if
21584 * expression.cs (Expression::ConvertImplicit): New function that
21585 implements implicit type conversions.
21587 (Expression::ImplicitReferenceConversion): Implements implicit
21588 reference conversions.
21590 (EmptyCast): New type for transparent casts.
21592 (OpcodeCast): New type for casts of types that are performed with
21593 a sequence of bytecodes.
21595 (BoxedCast): New type used for casting value types into reference
21596 types. Emits a box opcode.
21598 (Binary::DoNumericPromotions): Implements numeric promotions of
21599 and computation of the Binary::Type.
21601 (Binary::EmitBranchable): Optimization.
21603 (Binary::Emit): Implement code emission for expressions.
21605 * typemanager.cs (TypeManager): Added two new core types: sbyte
21608 2001-09-12 Ravi Pratap <ravi@ximian.com>
21610 * class.cs (TypeContainer::FindMembers): Method which does exactly
21611 what Type.FindMembers does, only we don't have to use reflection. No
21612 implementation yet.
21614 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
21615 typecontainer objects as we need to get at them.
21616 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
21618 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
21619 typecontainer object.
21621 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
21622 of just a Report object.
21624 2001-09-11 Ravi Pratap <ravi@ximian.com>
21626 * class.cs (Event::Define): Go back to using the prefixes "add_" and
21628 (TypeContainer::Populate): Now define the delegates of the type too.
21629 (TypeContainer.Delegates): Property to access the list of delegates defined
21632 * delegates.cs (Delegate::Define): Implement partially.
21634 * modifiers.cs (TypeAttr): Handle more flags.
21636 2001-09-11 Ravi Pratap <ravi@ximian.com>
21638 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
21640 (Operator::Define): Re-write logic to get types by using the LookupType method
21641 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
21642 (Indexer::Define): Ditto.
21643 (Event::Define): Ditto.
21644 (Property::Define): Ditto.
21646 2001-09-10 Ravi Pratap <ravi@ximian.com>
21648 * class.cs (TypeContainer::Populate): Now define operators too.
21649 (TypeContainer.Operators): New property to access the list of operators
21651 (Operator.OperatorMethodBuilder): New member to hold the method builder
21652 for the operator we are defining.
21653 (Operator::Define): Implement.
21655 2001-09-10 Ravi Pratap <ravi@ximian.com>
21657 * class.cs (Event::Define): Make the prefixes of the accessor methods
21658 addOn_ and removeOn_
21660 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
21661 of the location being passed in too. Ideally, this should go later since all
21662 error reporting should be done through the Report object.
21664 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
21665 (Populate): Iterate thru the indexers we have and define them too.
21666 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
21667 for the get and set accessors.
21668 (Indexer::Define): Implement.
21670 2001-09-09 Miguel de Icaza <miguel@ximian.com>
21672 * expression.cs (Binary::Resolve): Beginning of it. I scratched
21673 my previous implementation, did not work.
21675 * typemanager.cs: Add a couple of missing types (the longs).
21677 * literal.cs: Use TypeManager.bool_type instead of getting it.
21679 * expression.cs (EventExpr): New kind of expressions.
21680 (Expressio::ExprClassFromMemberInfo): finish
21682 2001-09-08 Miguel de Icaza <miguel@ximian.com>
21684 * assign.cs: Emit stores to static fields differently.
21686 2001-09-08 Ravi Pratap <ravi@ximian.com>
21688 * Merge in changes and adjust code to tackle conflicts. Backed out my
21689 code in Assign::Resolve ;-)
21691 2001-09-08 Ravi Pratap <ravi@ximian.com>
21693 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
21694 instead Report.Error and also pass in the location.
21695 (CSharpParser::Lexer): New readonly property to return the reference
21696 to the Tokenizer object.
21697 (declare_local_variables): Use Report.Error with location instead of plain
21701 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
21702 (Operator.CheckBinaryOperator): Ditto.
21704 * cs-parser.jay (operator_declarator): Update accordingly.
21706 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
21707 (CheckBinaryOperator): Same here.
21709 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
21710 on the name without any prefixes of namespace names etc. This is because we
21711 already might have something already fully qualified like
21712 'System.Console.WriteLine'
21714 * assign.cs (Resolve): Begin implementation. Stuck ;-)
21716 2001-09-07 Ravi Pratap <ravi@ximian.com>
21718 * cs-tokenizer.cs (location): Return a string which also contains
21721 * expression.cs (ElementAccess): New class for expressions of the
21722 type 'element access.'
21723 (BaseAccess): New class for expressions of the type 'base access.'
21724 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
21727 * cs-parser.jay (element_access): Implement action.
21728 (base_access): Implement actions.
21729 (checked_expression, unchecked_expression): Implement.
21731 * cs-parser.jay (local_variable_type): Correct and implement.
21732 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
21734 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
21736 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
21737 name and the specifiers.
21739 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
21741 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
21742 making them all public ;-)
21744 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
21747 2001-09-07 Miguel de Icaza <miguel@ximian.com>
21749 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
21751 (FieldExpr, PropertyExprs): New resolved expressions.
21752 (SimpleName::MemberStaticCheck): Perform static checks for access
21753 to non-static fields on static methods. Maybe this should be
21754 generalized for MemberAccesses.
21755 (SimpleName::ResolveSimpleName): More work on simple name
21758 * cs-parser.jay (primary_expression/qualified_identifier): track
21759 the parameter index.
21761 * codegen.cs (CodeGen::Save): Catch save exception, report error.
21762 (EmitContext::EmitBoolExpression): Chain to expression generation
21763 instead of temporary hack.
21764 (::EmitStatementExpression): Put generic expression code generation.
21766 * assign.cs (Assign::Emit): Implement variable assignments to
21767 local variables, parameters and fields.
21769 2001-09-06 Miguel de Icaza <miguel@ximian.com>
21771 * statement.cs (Block::GetVariableInfo): New method, returns the
21772 VariableInfo for a variable name in a block.
21773 (Block::GetVariableType): Implement in terms of GetVariableInfo
21775 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
21776 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
21778 2001-09-06 Ravi Pratap <ravi@ximian.com>
21780 * cs-parser.jay (operator_declaration): Continue on my quest : update
21781 to take attributes argument.
21782 (event_declaration): Ditto.
21783 (enum_declaration): Ditto.
21784 (indexer_declaration): Ditto.
21786 * class.cs (Operator::Operator): Update constructor accordingly.
21787 (Event::Event): Ditto.
21789 * delegate.cs (Delegate::Delegate): Same here.
21791 * enum.cs (Enum::Enum): Same here.
21793 2001-09-05 Ravi Pratap <ravi@ximian.com>
21795 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
21797 * ../tests/cs0658.cs : New file to demonstrate error 0658.
21799 * attribute.cs (Attributes): New class to encapsulate all attributes which were
21800 being passed around as an arraylist.
21801 (Attributes::AddAttribute): Method to add attribute sections.
21803 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
21804 (struct_declaration): Update accordingly.
21805 (constant_declaration): Update.
21806 (field_declaration): Update.
21807 (method_header): Update.
21808 (fixed_parameter): Update.
21809 (parameter_array): Ditto.
21810 (property_declaration): Ditto.
21811 (destructor_declaration): Ditto.
21813 * class.cs (Struct::Struct): Update constructors accordingly.
21814 (Class::Class): Ditto.
21815 (Field::Field): Ditto.
21816 (Method::Method): Ditto.
21817 (Property::Property): Ditto.
21818 (TypeContainer::OptAttribute): update property's return type.
21820 * interface.cs (Interface.opt_attributes): New member.
21821 (Interface::Interface): Update to take the extra Attributes argument.
21823 * parameter.cs (Parameter::Parameter): Ditto.
21825 * constant.cs (Constant::Constant): Ditto.
21827 * interface.cs (InterfaceMemberBase): New OptAttributes field.
21828 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
21829 the attributes as a parameter.
21830 (InterfaceProperty): Update constructor call.
21831 (InterfaceEvent): Ditto.
21832 (InterfaceMethod): Ditto.
21833 (InterfaceIndexer): Ditto.
21835 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
21836 pass the attributes too.
21837 (interface_event_declaration): Ditto.
21838 (interface_property_declaration): Ditto.
21839 (interface_method_declaration): Ditto.
21840 (interface_declaration): Ditto.
21842 2001-09-05 Miguel de Icaza <miguel@ximian.com>
21844 * class.cs (Method::Define): Track the "static Main" definition to
21845 create an entry point.
21847 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
21848 EntryPoint if we find it.
21850 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
21851 (EmitContext::ig): Make this variable public.
21853 * driver.cs: Make the default output file be the first file name
21854 with the .exe extension.
21856 Detect empty compilations
21858 Handle various kinds of output targets. Handle --target and
21859 rename -t to --dumper.
21861 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
21862 methods inherited from Expression return now an Expression. This
21863 will is used during the tree rewriting as we resolve them during
21866 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
21867 the spec. Missing entirely is the information about
21868 accessability of elements of it.
21870 (Expression::ExprClassFromMemberInfo): New constructor for
21871 Expressions that creates a fully initialized Expression based on
21872 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
21875 (Invocation::Resolve): Begin implementing resolution of invocations.
21877 * literal.cs (StringLiteral): Implement Emit.
21879 2001-09-05 Ravi Pratap <ravi@ximian.com>
21881 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
21884 2001-09-04 Ravi Pratap <ravi@ximian.com>
21886 * cs-parser.jay (attribute_arguments): Implement actions.
21887 (attribute): Fix bug in production. Implement action.
21888 (attribute_list): Implement.
21889 (attribute_target): Implement.
21890 (attribute_target_specifier, opt_target_specifier): Implement
21891 (CheckAttributeTarget): New method to check if the attribute target
21893 (attribute_section): Implement.
21894 (opt_attributes): Implement.
21896 * attribute.cs : New file to handle attributes.
21897 (Attribute): Class to hold attribute info.
21899 * cs-parser.jay (opt_attribute_target_specifier): Remove production
21900 (attribute_section): Modify production to use 2 different rules to
21901 achieve the same thing. 1 s/r conflict down !
21902 Clean out commented, useless, non-reducing dimension_separator rules.
21904 * class.cs (TypeContainer.attributes): New member to hold list
21905 of attributes for a type.
21906 (Struct::Struct): Modify to take one more argument, the attribute list.
21907 (Class::Class): Ditto.
21908 (Field::Field): Ditto.
21909 (Method::Method): Ditto.
21910 (Property::Property): Ditto.
21912 * cs-parser.jay (struct_declaration): Update constructor call to
21913 pass in the attributes too.
21914 (class_declaration): Ditto.
21915 (constant_declaration): Ditto.
21916 (field_declaration): Ditto.
21917 (method_header): Ditto.
21918 (fixed_parameter): Ditto.
21919 (parameter_array): Ditto.
21920 (property_declaration): Ditto.
21922 * constant.cs (Constant::Constant): Update constructor similarly.
21923 Use System.Collections.
21925 * parameter.cs (Parameter::Parameter): Update as above.
21927 2001-09-02 Ravi Pratap <ravi@ximian.com>
21929 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
21930 (TypeContainer.delegates): New member to hold list of delegates.
21932 * cs-parser.jay (delegate_declaration): Implement the action correctly
21933 this time as I seem to be on crack ;-)
21935 2001-09-02 Miguel de Icaza <miguel@ximian.com>
21937 * rootcontext.cs (RootContext::IsNamespace): new function, used to
21938 tell whether an identifier represents a namespace.
21940 * expression.cs (NamespaceExpr): A namespace expression, used only
21941 temporarly during expression resolution.
21942 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
21943 utility functions to resolve names on expressions.
21945 2001-09-01 Miguel de Icaza <miguel@ximian.com>
21947 * codegen.cs: Add hook for StatementExpressions.
21949 * class.cs: Fix inverted test for static flag in methods.
21951 2001-09-02 Ravi Pratap <ravi@ximian.com>
21953 * class.cs (Operator::CheckUnaryOperator): Correct error number used
21954 to make it coincide with MS' number.
21955 (Operator::CheckBinaryOperator): Ditto.
21957 * ../errors/errors.txt : Remove error numbers added earlier.
21959 * ../errors/cs1019.cs : Test case for error # 1019
21961 * ../errros/cs1020.cs : Test case for error # 1020
21963 * cs-parser.jay : Clean out commented cruft.
21964 (dimension_separators, dimension_separator): Comment out. Ostensibly not
21965 used anywhere - non-reducing rule.
21966 (namespace_declarations): Non-reducing rule - comment out.
21968 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
21969 with TypeContainer::AddEnum.
21971 * delegate.cs : New file for delegate handling classes.
21972 (Delegate): Class for declaring delegates.
21974 * makefile : Update.
21976 * cs-parser.jay (delegate_declaration): Implement.
21978 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
21980 * class.cs (Event::Define): Implement.
21981 (Event.EventBuilder): New member.
21983 * class.cs (TypeContainer::Populate): Update to define all enums and events
21985 (Events): New property for the events arraylist we hold. Shouldn't we move to using
21986 readonly fields for all these cases ?
21988 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21990 * class.cs (Property): Revamp to use the convention of making fields readonly.
21991 Accordingly modify code elsewhere.
21993 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
21994 the Define method of the Property class.
21996 * class.cs : Clean up applied patch and update references to variables etc. Fix
21998 (TypeContainer::Populate): Update to define all the properties we have. Also
21999 define all enumerations.
22001 * enum.cs (Define): Implement.
22003 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
22005 * cs-parser.jay (overloadable_operator): The semantic value is an
22006 enum of the Operator class.
22007 (operator_declarator): Implement actions.
22008 (operator_declaration): Implement.
22010 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
22011 validity of definitions.
22012 (Operator::CheckBinaryOperator): Static method to check for binary operators
22013 (TypeContainer::AddOperator): New method to add an operator to a type.
22015 * cs-parser.jay (indexer_declaration): Added line to actually call the
22016 AddIndexer method so it gets added ;-)
22018 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
22019 already taken care of by the MS compiler ?
22021 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
22023 * class.cs (Operator): New class for operator declarations.
22024 (Operator::OpType): Enum for the various operators.
22026 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
22028 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
22029 ostensibly handle this in semantic analysis.
22031 * cs-parser.jay (general_catch_clause): Comment out
22032 (specific_catch_clauses, specific_catch_clause): Ditto.
22033 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
22034 (catch_args, opt_catch_args): New productions.
22035 (catch_clause): Rewrite to use the new productions above
22036 (catch_clauses): Modify accordingly.
22037 (opt_catch_clauses): New production to use in try_statement
22038 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
22039 and re-write the code in the actions to extract the specific and
22040 general catch clauses by being a little smart ;-)
22042 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
22043 Hooray, try and catch statements parse fine !
22045 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
22047 * statement.cs (Block::GetVariableType): Fix logic to extract the type
22048 string from the hashtable of variables.
22050 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
22051 I end up making that mistake ;-)
22052 (catch_clauses): Fixed gross error which made Key and Value of the
22053 DictionaryEntry the same : $1 !!
22055 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
22057 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
22059 * cs-parser.jay (event_declaration): Correct to remove the semicolon
22060 when the add and remove accessors are specified.
22062 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
22064 * cs-parser.jay (IndexerDeclaration): New helper class to hold
22065 information about indexer_declarator.
22066 (indexer_declarator): Implement actions.
22067 (parsing_indexer): New local boolean used to keep track of whether
22068 we are parsing indexers or properties. This is necessary because
22069 implicit_parameters come into picture even for the get accessor in the
22070 case of an indexer.
22071 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
22073 * class.cs (Indexer): New class for indexer declarations.
22074 (TypeContainer::AddIndexer): New method to add an indexer to a type.
22075 (TypeContainer::indexers): New member to hold list of indexers for the
22078 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
22080 * cs-parser.jay (add_accessor_declaration): Implement action.
22081 (remove_accessor_declaration): Implement action.
22082 (event_accessors_declaration): Implement
22083 (variable_declarators): swap statements for first rule - trivial.
22085 * class.cs (Event): New class to hold information about event
22087 (TypeContainer::AddEvent): New method to add an event to a type
22088 (TypeContainer::events): New member to hold list of events.
22090 * cs-parser.jay (event_declaration): Implement actions.
22092 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
22094 * cs-parser.jay (dim_separators): Implement. Make it a string
22095 concatenating all the commas together, just as they appear.
22096 (opt_dim_separators): Modify accordingly
22097 (rank_specifiers): Update accordingly. Basically do the same
22098 thing - instead, collect the brackets here.
22099 (opt_rank_sepcifiers): Modify accordingly.
22100 (array_type): Modify to actually return the complete type string
22101 instead of ignoring the rank_specifiers.
22102 (expression_list): Implement to collect the expressions
22103 (variable_initializer): Implement. We make it a list of expressions
22104 essentially so that we can handle the array_initializer case neatly too.
22105 (variable_initializer_list): Implement.
22106 (array_initializer): Make it a list of variable_initializers
22107 (opt_array_initializer): Modify accordingly.
22109 * expression.cs (New::NType): Add enumeration to help us
22110 keep track of whether we have an object/delegate creation
22111 or an array creation.
22112 (New:NewType, New::Rank, New::Indices, New::Initializers): New
22113 members to hold data about array creation.
22114 (New:New): Modify to update NewType
22115 (New:New): New Overloaded contructor for the array creation
22118 * cs-parser.jay (array_creation_expression): Implement to call
22119 the overloaded New constructor.
22121 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
22123 * class.cs (TypeContainer::Constructors): Return member
22124 constructors instead of returning null.
22126 2001-08-26 Miguel de Icaza <miguel@ximian.com>
22128 * typemanager.cs (InitCoreTypes): Initialize the various core
22129 types after we have populated the type manager with the user
22130 defined types (this distinction will be important later while
22131 compiling corlib.dll)
22133 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
22134 on Expression Classification. Now all expressions have a method
22135 `Resolve' and a method `Emit'.
22137 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
22138 generation from working. Also add some temporary debugging
22141 2001-08-24 Miguel de Icaza <miguel@ximian.com>
22143 * codegen.cs: Lots of code generation pieces. This is only the
22144 beginning, will continue tomorrow with more touches of polish. We
22145 handle the fundamentals of if, while, do, for, return. Others are
22146 trickier and I need to start working on invocations soon.
22148 * gen-treedump.cs: Bug fix, use s.Increment here instead of
22151 * codegen.cs (EmitContext): New struct, used during code
22152 emission to keep a context. Most of the code generation will be
22155 * cs-parser.jay: Add embedded blocks to the list of statements of
22156 this block. So code generation proceeds in a top down fashion.
22158 2001-08-23 Miguel de Icaza <miguel@ximian.com>
22160 * statement.cs: Add support for multiple child blocks.
22162 2001-08-22 Miguel de Icaza <miguel@ximian.com>
22164 * codegen.cs (EmitCode): New function, will emit the code for a
22165 Block of code given a TypeContainer and its ILGenerator.
22167 * statement.cs (Block): Standard public readonly optimization.
22168 (Block::Block constructors): Link children.
22169 (Block::Child): Child Linker.
22170 (Block::EmitVariables): Emits IL variable declarations.
22172 * class.cs: Drop support for MethodGroups here, delay until
22174 (Method::): Applied the same simplification that I did before, and
22175 move from Properties to public readonly fields.
22176 (Method::ParameterTypes): Returns the parameter types for the
22177 function, and implements a cache that will be useful later when I
22178 do error checking and the semantic analysis on the methods is
22180 (Constructor::GetCallingConvention): Renamed from CallingConvetion
22181 and made a method, optional argument tells whether this is a class
22182 or a structure to apply the `has-this' bit.
22183 (Method::GetCallingConvention): Implement, returns the calling
22185 (Method::Define): Defines the type, a second pass is performed
22186 later to populate the methods.
22188 (Constructor::ParameterTypes): implement a cache similar to the
22189 one on Method::ParameterTypes, useful later when we do semantic
22192 (TypeContainer::EmitMethod): New method. Emits methods.
22194 * expression.cs: Removed MethodGroup class from here.
22196 * parameter.cs (Parameters::GetCallingConvention): new method.
22198 2001-08-21 Miguel de Icaza <miguel@ximian.com>
22200 * class.cs (TypeContainer::Populate): Drop RootContext from the
22203 (Constructor::CallingConvention): Returns the calling convention.
22204 (Constructor::ParameterTypes): Returns the constructor parameter
22207 (TypeContainer::AddConstructor): Keep track of default constructor
22208 and the default static constructor.
22210 (Constructor::) Another class that starts using `public readonly'
22211 instead of properties.
22213 (Constructor::IsDefault): Whether this is a default constructor.
22215 (Field::) use readonly public fields instead of properties also.
22217 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
22218 track of static constructors; If none is used, turn on
22219 BeforeFieldInit in the TypeAttributes.
22221 * cs-parser.jay (opt_argument_list): now the return can be null
22222 for the cases where there are no arguments.
22224 (constructor_declarator): If there is no implicit `base' or
22225 `this', then invoke the default parent constructor.
22227 * modifiers.cs (MethodAttr): New static function maps a set of
22228 modifiers flags into a MethodAttributes enum
22229 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
22230 MethodAttr, TypeAttr to represent the various mappings where the
22231 modifiers are used.
22232 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
22234 2001-08-19 Miguel de Icaza <miguel@ximian.com>
22236 * parameter.cs (GetParameterInfo): Fix bug where there would be no
22239 * interface.cs (PopulateIndexer): Implemented the code generator
22240 for interface indexers.
22242 2001-08-17 Miguel de Icaza <miguel@ximian.com>
22244 * interface.cs (InterfaceMemberBase): Now we track the new status
22247 (PopulateProperty): Implement property population. Woohoo! Got
22248 Methods and Properties going today.
22250 Removed all the properties for interfaces, and replaced them with
22251 `public readonly' fields.
22253 2001-08-16 Miguel de Icaza <miguel@ximian.com>
22255 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
22256 initialize their hashtables/arraylists only when they are needed
22257 instead of doing this always.
22259 * parameter.cs: Handle refs and out parameters.
22261 * cs-parser.jay: Use an ArrayList to construct the arguments
22262 instead of the ParameterCollection, and then cast that to a
22265 * parameter.cs: Drop the use of ParameterCollection and use
22266 instead arrays of Parameters.
22268 (GetParameterInfo): Use the Type, not the Name when resolving
22271 2001-08-13 Miguel de Icaza <miguel@ximian.com>
22273 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
22274 and instead use public readonly fields.
22276 * class.cs: Put back walking code for type containers.
22278 2001-08-11 Miguel de Icaza <miguel@ximian.com>
22280 * class.cs (MakeConstant): Code to define constants.
22282 * rootcontext.cs (LookupType): New function. Used to locate types
22285 2001-08-08 Miguel de Icaza <miguel@ximian.com>
22287 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
22288 this System.Reflection code is. Kudos to Microsoft
22290 * typemanager.cs: Implement a type cache and avoid loading all
22291 types at boot time. Wrap in LookupType the internals. This made
22292 the compiler so much faster. Wow. I rule!
22294 * driver.cs: Make sure we always load mscorlib first (for
22295 debugging purposes, nothing really important).
22297 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
22298 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
22300 * rootcontext.cs: Lookup types on their namespace; Lookup types
22301 on namespaces that have been imported using the `using' keyword.
22303 * class.cs (TypeContainer::TypeAttr): Virtualize.
22304 (Class::TypeAttr): Return attributes suitable for this bad boy.
22305 (Struct::TypeAttr): ditto.
22306 Handle nested classes.
22307 (TypeContainer::) Remove all the type visiting code, it is now
22308 replaced with the rootcontext.cs code
22310 * rootcontext.cs (GetClassBases): Added support for structs.
22312 2001-08-06 Miguel de Icaza <miguel@ximian.com>
22314 * interface.cs, statement.cs, class.cs, parameter.cs,
22315 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
22316 Drop use of TypeRefs, and use strings instead.
22318 2001-08-04 Miguel de Icaza <miguel@ximian.com>
22322 * class.cs (Struct::Struct): set the SEALED flags after
22323 checking the modifiers.
22324 (TypeContainer::TypeAttr): new property, returns the
22325 TypeAttributes for a class.
22327 * cs-parser.jay (type_list): Oops, list production was creating a
22328 new list of base types.
22330 * rootcontext.cs (StdLib): New property.
22331 (GetInterfaceTypeByName): returns an interface by type name, and
22332 encapsulates error handling here.
22333 (GetInterfaces): simplified.
22334 (ResolveTree): Encapsulated all the tree resolution here.
22335 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
22338 * driver.cs: Add support for --nostdlib, to avoid loading the
22339 default assemblies.
22340 (Main): Do not put tree resolution here.
22342 * rootcontext.cs: Beginning of the class resolution.
22344 2001-08-03 Miguel de Icaza <miguel@ximian.com>
22346 * rootcontext.cs: Provide better error reporting.
22348 * cs-parser.jay (interface_base): set our $$ to be interfaces.
22350 * rootcontext.cs (CreateInterface): Handle the case where there
22351 are no parent interfaces.
22353 (CloseTypes): Routine to flush types at the end.
22354 (CreateInterface): Track types.
22355 (GetInterfaces): Returns an array of Types from the list of
22356 defined interfaces.
22358 * typemanager.c (AddUserType): Mechanism to track user types (puts
22359 the type on the global type hash, and allows us to close it at the
22362 2001-08-02 Miguel de Icaza <miguel@ximian.com>
22364 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
22365 RecordInterface instead.
22367 * cs-parser.jay: Updated to reflect changes above.
22369 * decl.cs (Definition): Keep track of the TypeBuilder type that
22370 represents this type here. Not sure we will use it in the long
22371 run, but wont hurt for now.
22373 * driver.cs: Smaller changes to accomodate the new code.
22375 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
22378 * rootcontext.cs (CreateInterface): New method, used to create
22379 the System.TypeBuilder type for interfaces.
22380 (ResolveInterfaces): new entry point to resolve the interface
22382 (CodeGen): Property, used to keep track of the code generator.
22384 2001-07-26 Miguel de Icaza <miguel@ximian.com>
22386 * cs-parser.jay: Add a second production for delegate_declaration
22389 (enum_body): Put an opt_comma here instead of putting it on
22390 enum_body or enum_member_declarations so we can handle trailing
22391 commas on enumeration members. Gets rid of a shift/reduce.
22393 (type_list): Need a COMMA in the middle.
22395 (indexer_declaration): Tell tokenizer to recognize get/set
22397 * Remove old targets.
22399 * Re-add the parser target.
22401 2001-07-13 Simon Cozens <simon@simon-cozens.org>
22403 * cs-parser.jay: Add precendence rules for a number of operators
22404 ot reduce the number of shift/reduce conflicts in the grammar.
22406 2001-07-17 Miguel de Icaza <miguel@ximian.com>
22408 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
22411 Get rid of old crufty code.
22413 * rootcontext.cs: Use this to keep track of the parsed
22414 representation and the defined types available to the program.
22416 * gen-treedump.cs: adjust for new convention.
22418 * type.cs: Split out the type manager, and the assembly builder
22421 * typemanager.cs: the type manager will live here now.
22423 * cil-codegen.cs: And the code generator here.
22425 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
22427 * makefile: Fixed up for easy making.
22429 2001-07-13 Simon Cozens <simon@simon-cozens.org>
22431 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
22434 (unary_expression): Expand pre_increment_expression and
22435 post_decrement_expression to reduce a shift/reduce.
22437 2001-07-11 Simon Cozens
22439 * cs-tokenizer.cs: Hex numbers should begin with a 0.
22441 Improve allow_keyword_as_indent name.
22443 2001-06-19 Miguel de Icaza <miguel@ximian.com>
22445 * Adjustments for Beta2.
22447 2001-06-13 Miguel de Icaza <miguel@ximian.com>
22449 * decl.cs: Added `Define' abstract method.
22450 (InTransit): new property, used to catch recursive definitions.
22452 * interface.cs: Implement `Define'.
22454 * modifiers.cs: Map Modifiers.constants to
22455 System.Reflection.TypeAttribute flags.
22457 * class.cs: Keep track of types and user-defined types.
22458 (BuilderInit): New method for creating an assembly
22459 (ResolveType): New function to launch the resolution process, only
22460 used by interfaces for now.
22462 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
22463 that are inserted into the name space.
22465 2001-06-08 Miguel de Icaza <miguel@ximian.com>
22467 * ARGH. I have screwed up my tree so many times due to the use of
22468 rsync rather than using CVS. Going to fix this at once.
22470 * driver.cs: Objetify driver. Load assemblies, use assemblies to
22473 2001-06-07 Miguel de Icaza <miguel@ximian.com>
22475 * Experiment successful: Use System.Type rather that our own
22478 2001-05-25 Miguel de Icaza <miguel@ximian.com>
22480 * cs-parser.jay: Removed nsAliases from here.
22482 Use new namespaces, handle `using XXX;'
22484 * namespace.cs: Reimplemented namespace handling, use a recursive
22485 definition of the class. Now we can keep track of using clauses
22486 and catch invalid using clauses.
22488 2001-05-24 Miguel de Icaza <miguel@ximian.com>
22490 * gen-treedump.cs: Adapted for all the renaming.
22492 * expression.cs (Expression): this class now has a Type property
22493 which returns an expression Type.
22495 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
22496 `Type', as this has a different meaning now in the base
22498 2001-05-22 Miguel de Icaza <miguel@ximian.com>
22500 * interface.cs, class.cs: Removed from all the sources the
22501 references to signature computation, as we can not do method
22502 signature computation during the parsing time, as we are not
22503 trying to solve at that point distinguishing:
22507 void a (NS.Blah x) {}
22510 Which depending on the context might be valid or not, as we do not
22511 know if Blah is the same thing as NS.Blah at that point.
22513 * Redid everything so the code uses TypeRefs now instead of
22514 Types. TypeRefs are just temporary type placeholders, that need
22515 to be resolved. They initially have a pointer to a string and the
22516 current scope in which they are used. This is used later by the
22517 compiler to resolve the reference to an actual Type.
22519 * DeclSpace is no longer a CIR.Type, and neither are
22520 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
22521 are all DeclSpaces, but no Types.
22523 * type.cs (TypeRefManager): This implements the TypeRef manager,
22524 which keeps track of all the types that need to be resolved after
22525 the parsing has finished.
22527 2001-05-13 Miguel de Icaza <miguel@ximian.com>
22529 * ARGH. We are going to have to store `foreach' as a class rather
22530 than resolving it, as we need to verify error 1579 after name
22531 resolution. *OR* we could keep a flag that says `This request to
22532 IEnumerator comes from a foreach statement' which we can then use
22533 to generate the error.
22535 2001-05-10 Miguel de Icaza <miguel@ximian.com>
22537 * class.cs (TypeContainer.AddMethod): we now add methods to the
22538 MethodGroup instead of the method hashtable.
22540 * expression.cs: Add MethodGroup abstraction, which gets us one
22541 step closer to the specification in the way we handle method
22544 * cs-parser.jay (primary_expression): qualified_identifier now
22545 tried to match up an identifier to a local variable reference or
22546 to a parameter reference.
22548 current_local_parameters is now a parser global variable that
22549 points to the current parameters for the block, used during name
22552 (property_declaration): Now creates an implicit `value' argument to
22555 2001-05-09 Miguel de Icaza <miguel@ximian.com>
22557 * parameter.cs: Do not use `param' arguments as part of the
22558 signature, per the spec.
22560 2001-05-08 Miguel de Icaza <miguel@ximian.com>
22562 * decl.cs: Base class for classes, structs and interfaces. This
22563 is the "Declaration Space"
22565 * cs-parser.jay: Use CheckDef for checking declaration errors
22566 instead of having one on each function.
22568 * class.cs: Factor out some code for handling error handling in
22569 accordance to the "Declarations" section in the "Basic Concepts"
22570 chapter in the ECMA C# spec.
22572 * interface.cs: Make all interface member classes derive from
22573 InterfaceMemberBase.
22575 2001-05-07 Miguel de Icaza <miguel@ximian.com>
22577 * Many things: all interfaces are parsed and generated in
22578 gen-treedump. Support for member variables, constructors,
22579 destructors, properties, constants is there.
22581 Beginning of the IL backend, but very little done, just there for
22584 2001-04-29 Miguel de Icaza <miguel@ximian.com>
22586 * cs-parser.jay: Fix labeled statement.
22588 * cs-tokenizer.cs (escape): Escape " and ' always.
22589 ref_line, ref_name: keep track of the line/filename as instructed
22590 by #line by the compiler.
22593 2001-04-27 Miguel de Icaza <miguel@ximian.com>
22595 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
22596 to match the values in System.CodeDOM.
22598 Divid renamed to Divide.
22600 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
22602 (Statements.set): remove.
22604 * System.CodeDOM/CodeCatchClause.cs: always have a valid
22607 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
22608 falseStatements always have valid values.
22610 * cs-parser.jay: Use System.CodeDOM now.