1 2005-06-07 Raja R Harinath <rharinath@novell.com>
3 Ensure that partial classes are registered in their enclosing
4 namespace. Initial part of fix of #75160.
5 * tree.cs (Tree.RecordDecl): Add new namespace argument.
6 Register declspace with namespace here, not in
8 * cs-parser.jay: Pass namespace to RecordDecl.
9 * class.cs (PartialContainer.Create): Likewise.
10 (ClassPart.DefineType): New sanity-check. Throws an exception if
12 * decl.cs (Declspace.RecordDecl): Remove.
13 * namespace.cs (NamespaceEntry.DefineName): Remove.
15 2005-06-06 Marek Safar <marek.safar@seznam.cz>
17 * rootcontext.cs: Reset TargetExt as well.
19 2005-06-03 Raja R Harinath <rharinath@novell.com>
21 * ecore.cs (Expression.Resolve): Emit CS0654 error when
24 2005-06-02 Raja R Harinath <rharinath@novell.com>
26 Fix #75080, cs0119.cs.
27 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
29 (Expression.Resolve): ... this. Use it. Remove bogus code
30 allowing ExprClass.Type and ExprClass.Namespace for
31 ResolveFlags.VariableOrValue.
32 (Expression.Resolve) [1-argument variant]: Change default resolve
33 flags based on language version.
34 (Expression.Error_UnexpectedKind): Use a simple string array
35 rather than an ArrayList.
36 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
38 (TypeOfVoid.DoResolve): Likewise.
39 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
40 flags argument -- it always has the same value.
42 2005-05-31 Raja R Harinath <rharinath@novell.com>
45 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
46 Use it in the error message.
47 * assign.cs, expression.cs, statement.cs: Update.
49 2005-05-30 Raja R Harinath <rharinath@novell.com>
52 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
53 the "almostMatchedMember" case too.
54 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
55 that failed the accessibility checks to 'almost_match'.
57 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
59 * attribute.cs: Use internal MethodBuilder methods to set
60 ExactSpelling and SetLastError on PInvoke methods, instead
61 of passing them via charset. Fixes #75060.
63 2005-05-27 Raja R Harinath <rharinath@novell.com>
65 * parameter.cs (Parameter): Remove TODO comment.
66 (Parameter.DefineParameter): Remove Location parameter.
67 (Parameters.LabelParameters): Likewise.
68 * class.cs (Constructor.Emit): Update to change.
69 (MethodData.Emit): Likewise.
70 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
71 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
73 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
76 Removed Parameters.Location and added Parameter.Location instead.
77 Removed Location parameter from Emit() and GetSignature().
84 Modified all related calls.
86 2005-06-21 Martin Baulig <martin@ximian.com>
88 * generic.cs (NullCoalescingOperator.Emit): Make this work if the
89 left-hand side is not a nullable type; fixes #75328.
91 2005-06-21 Martin Baulig <martin@ximian.com>
94 (TypeManager.CSharpName): Use GetFullName() instead of `t.FullName'.
95 (TypeManager.GetFullNameSignature): Likewise.
97 * convert.cs (Convert.Error_CannotImplicitConversion): Compare
98 `source.FullName' and `target.FullName' to check whether there are
99 two conflicting definitions.
101 2005-06-21 Martin Baulig <martin@ximian.com>
103 * convert.cs (Convert.ImplicitTypeParameterConversion): Always use
104 a BoxedCast - also for reference types - to be compatible with csc.
106 2005-06-21 Martin Baulig <martin@ximian.com>
108 * expression.cs (MemberAccess.DoResolve): Add support for nested
109 types in a generic instance; fixes #75320.
111 2005-06-20 Martin Baulig <martin@ximian.com>
113 * generic.cs (TypeManager.InferType): Also walk the class
114 hierarchy for generic instances; fixes #75261.
116 2005-06-17 Martin Baulig <martin@ximian.com>
118 * typemanager.cs (TypeManager.IsBuiltinType): Use TypeToCoreType()
119 to make things work for corlib.
121 2005-06-15 Martin Baulig <martin@ximian.com>
123 * attribute.cs (Attribute.CheckSecurityActionValidity): Remove the
124 obsolete `SecurityAction' values.
126 2005-06-06 Marek Safar <marek.safar@seznam.cz>
128 * rootcontext.cs: Reset TargetExt as well.
130 2005-06-09 Martin Baulig <martin@ximian.com>
132 * delegate.cs (Delegate.VerifyMethod): Added
133 `MethodGroupExpr old_mg' argument; inherit its
134 `HasTypeParameters'; fix #75085.
136 2005-06-09 Martin Baulig <martin@ximian.com>
138 * expression.cs (Invocation.OverloadResolve): Correctly handle
139 generic methods for the SetMemberIsUsed(); fix #75064.
141 2005-06-09 Martin Baulig <martin@ximian.com>
143 * statement.cs (Throw.Resolve): Use TypeManager.IsSubclassOf();
146 2005-06-08 Martin Baulig <martin@ximian.com>
148 * cs-parser.jay (nullable_type_or_conditional): If we put the
149 nullable back and our `type' is a `ComposedCast', remove the
150 nullable from it. Fixes #75156.
152 * expression.cs (ComposedCast.RemoveNullable): New public method.
154 2005-06-08 Martin Baulig <martin@ximian.com>
156 The big Iterators rewrite :-)
158 * iterators.cs: Rewrite this to use the anonymous methods framework.
160 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
161 before the TypeContainers; see 2test-21.cs.
164 (TypeContainer.DefineType): Don't create a new EmitContext if we
165 already have one (this only happens if we're an Iterator).
166 (TypeContainer.Define): Also call Define() on all our iterators.
167 (Method.CreateEmitContext): Added support for iterators.
170 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
171 (AnonymousContainer.CreateMethodHost): Moved here from
172 AnonymousMethod and made abstract.
173 (AnonymousContainer.CreateScopeType): New abstract method.
174 (AnonymousContainer.IsIterator): New public property.
175 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
176 get the ScopeTypeBuilder rather than manually defining it here.
177 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
180 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
181 before RootContext.DefineTypes().
183 * codegen.cs (EmitContext.RemapToProxy): Removed.
184 (EmitContext.CurrentAnonymousMethod): Changed type from
185 AnonymousMethod -> AnonymousContainer.
186 (EmitContext.ResolveTopBlock): Protect from being called twice.
187 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
188 (EmitContext.EmitThis): Removed the iterators hacks; use the
189 anonymous methods framework for that.
192 (ToplevelBlock.Container): Make this a property, not a field.
193 (ToplevelBlock.ReParent): New public method; move the
194 ToplevelBlock into a new container.
195 (Foreach.TemporaryVariable): Simplify.
197 2005-06-05 Martin Baulig <martin@ximian.com>
199 * statement.cs (LocalInfo.CompilerGenerated): New flag.
200 (Block.AddTemporaryVariable): New public method; creates a new
201 `LocalInfo' for a temporary variable.
202 (Block.EmitMeta): Create the LocalBuilders for all the temporary
204 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
205 non-iterator variables.
207 2005-06-05 Martin Baulig <martin@ximian.com>
209 * statement.cs (Foreach.TemporaryVariable): Create the
210 LocalBuilder in the Emit phase and not in Resolve since in some
211 situations, we don't have an ILGenerator during Resolve; see
212 2test-19.cs for an example.
214 2005-06-04 Martin Baulig <martin@ximian.com>
216 The big Foreach rewrite - Part II.
218 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
219 with `PropertyInfo ienumerator_getcurrent'.
221 * codegen.cs (VariableStorage): Removed.
224 (Foreach): Derive from Statement, not ExceptionStatement.
225 (Foreach.CollectionForeach): New nested class. Moved all the code
226 dealing with collection foreach here.
227 (Foreach.ForeachHelperMethods): Removed.
228 (Foreach.TemporaryVariable): Implement IMemoryLocation.
230 2005-05-23 Martin Baulig <martin@ximian.com>
232 * statement.cs (Try.DoResolve): Don't create a `finally' if we
233 don't need to. Fix #75014.
235 2005-05-24 Duncan Mak <duncan@novell.com>
237 * ecore.cs (CastFromDecimal): New class for casting a decimal to
238 another class, used in Convert.ExplicitNumericConversion.
239 (CastToDecimal): New class, similar to above, but casts to
240 System.Decimal, used in Convert.ImplicitNumericConversion and also
241 in explicit convesion from double/float to decimal.
243 * convert.cs (ImplicitNumericConversion): Handle implicit
244 conversions to System.Decimal.
245 (ExplicitNumericConversion): handle explicit conversions to
250 2005-05-20 Miguel de Icaza <miguel@novell.com>
252 * typemanager.cs: Do not throw an exception in the TypeBuilder
253 case, we take care of it on the TypeCode.
255 2005-05-17 Marek Safar <marek.safar@seznam.cz>
257 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
260 * cs-parser.jay: Catch more lexical errors.
262 * report.cs: Add one more Error method.
265 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
267 2005-05-20 Martin Baulig <martin@ximian.com>
269 * class.cs (TypeContainer.CircularDepException): Removed.
270 (TypeContainer.DefineType): Removed the `InTransit' stuff.
271 (TypeContainer.CheckRecursiveDefinition): Check for circular class
272 (CS0146) and interface (CS0529) dependencies here.
274 2005-05-20 Martin Baulig <martin@ximian.com>
276 * expression.cs (New.DoResolve): Move the CS0712 check above the
277 CS0144 check; otherwise it can never be reached.
279 2005-05-20 Martin Baulig <martin@ximian.com>
281 * cs-parser.jay: Fix CS0080 check; add CS0231 and CS0257 from MCS.
283 2005-05-20 Martin Baulig <martin@ximian.com>
285 * class.cs (TypeContainer.DefineType): Fix CS0698 check.
287 * typemanager.cs (TypeManager.IsAttributeType): New public method.
289 2005-05-19 Martin Baulig <martin@ximian.com>
292 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
293 to disable error reporting.
295 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
296 here since we don't want to report an error; see the new test-336.cs.
298 2005-05-19 Raja R Harinath <rharinath@novell.com>
300 * statement.cs (ToplevelBlock.GetParameterReference)
301 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
302 Move here from class Block.
303 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
304 * expression.cs (ParameterReference.DoResolveBase): Likewise.
306 2005-05-18 Martin Baulig <martin@ximian.com>
311 (FlowBranching.Reachability): Add non-static public And() and Or()
313 (FlowBranchingSwitch): New class; do the `break_origins' thing
314 like in FlowBranchingLoop.
315 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
316 reachability, not just locals and parameters.
317 (FlowBranching.MergeChild): Remove some of the hacks for loop and
318 switch; MergeBreakOrigins() now takes care of that.
320 2005-05-18 Martin Baulig <martin@ximian.com>
322 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
323 a loop and may leave it, reset the barrier; fixes #74974.
325 2005-05-16 Raja R Harinath <rharinath@novell.com>
327 Fix test-382.cs. Emit values of decimal constants.
328 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
330 (TypeContainer.AddField): ... this.
331 (TypeContainer.EmitFieldInitializers): Allow the list of fields
332 with initializers to include 'Const's.
333 (ClassPart.RegisterFieldForInitialization): Forward to
335 * const.cs (Const.Const): Pass initializer to base class.
336 (Const.Define): In case of decimal constants, register them for
337 initialization in a static constructor.
339 2005-05-14 Martin Baulig <martin@ximian.com>
341 * statement.cs (Block.Resolve): Correctly handle unreachable code;
342 do not call ResolveUnreachable() on unreachable statements in
343 here, see the comment in the source code.
345 2005-05-13 Raja R Harinath <rharinath@novell.com>
348 * expression.cs (BinaryResolveOperator): If one of the operands of
349 an equality comparison is 'null' and the other is a pointer type,
350 convert the null to a NullPointer.
351 * convert.cs (ImplicitReferenceConversion): If the expression is a
352 NullLiteral and the target type is a pointer type, return a
354 (ImplicitConversionStandard): Likewise.
356 2005-05-13 Marek Safar <marek.safar@seznam.cz>
358 * cs-parser.jay: Set readonly context based on special constructs.
360 * expression.cs (LocalVariableReference.DoResolveBase): Improved
361 readonly variable error handling.
363 * rootcontext.cs (EmitCode): Don't verify members when error
366 * statement.cs (LocalInfo): Add reaodnly context information.
367 (SetReadOnlyContext, GetReadOnlyContext): New methods.
369 2005-05-17 Martin Baulig <martin@ximian.com>
371 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
374 2005-05-13 Martin Baulig <martin@ximian.com>
376 * statement.cs (Block.Resolve, ResolveUnreachable): Correctly
377 handle unreachable blocks.
379 2005-05-13 Martin Baulig <martin@ximian.com>
382 (ConstructorInitializer.GetOverloadedConstructor): Don't crash.
383 (MethodCore.CheckCore): Use TypeManager.IsEqual(); fix #74904 and
386 2005-05-13 Martin Baulig <martin@ximian.com>
388 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
389 instance variable, not a local. Fix #74873.
390 (Block.ResolveUnreachable): Set it to true here.
392 2005-05-12 Martin Baulig <martin@ximian.com>
394 * cs-parser.jay (property_declaration): Pass the `current_class',
395 not the `current_container' to Property's .ctor. Fixes #74912.
397 2005-05-11 Martin Baulig <martin@ximian.com>
399 * typemanager.cs (Closure): Copy this from MCS and merge all the
400 GMCS-specific changes into it.
402 2005-05-12 Raja R Harinath <harinath@gmail.com>
405 * typemanager.cs (unmanaged_enclosing_types): New.
406 (IsUnmanagedType): Avoid infloops by using
407 'unmanaged_enclosing_types' to talk with recursive invocations.
409 2005-05-11 Duncan Mak <duncan@novell.com>
411 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
412 continuing to process for 'arg'.
413 (handle_preprocessing_directive): Check the argument of the #endif
414 directive and report error CS1025 if there are any trailing
417 According to the C# spec, having even whitespace after the #endif
418 directive is illegal; however, because we call arg.TrimEnd ()
419 beforehand, we have the same behavior as csc, allowing whitespace
424 2005-05-11 Marek Safar <marek.safar@seznam.cz>
428 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
429 (Constructor.GetObsoleteAttribute): Implemented correctly.
431 2005-05-10 Martin Baulig <martin@ximian.com>
433 * generic.cs (Constraints.Resolve): Report CS0246 if we cannot
434 resolve the type; fixes #74864.
435 (DefaultValueExpression): Create the LocalTemporary in Emit(), not
436 in DoResolve(); fixes #74862.
438 2005-05-10 Martin Baulig <martin@ximian.com>
440 * support.cs (ReflectionParameters.ParameterModifier): Use
441 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
442 and `ParameterAttributes.In'. Fixes #74884.
444 2005-05-10 Martin Baulig <martin@ximian.com>
446 * typemanager.cs (TypeManager.MemberLookup_FindMembers): Don't use
447 the cache if we're just looking for `MemberTypes.NestedType' in a
450 * ecore.cs (Expression.ResolveAsTypeTerminal): Don't check the
451 constraints if we're still resolving the type tree.
452 (Expression.MemberLookup): If we're resolving the type tree, only
453 look for `MemberTypes.NestedType' since we're only interested in
456 * class.cs (TypeContainer.DefineType): Don't resolve the type
457 parameters here; do this later in ResolveType() after the type
458 tree has been resolved.
459 (TypeContainer.ResolveType): New public method; this is called
460 after the type tree is resolved and before the types are being
461 populated. We resolve the generic constraints here.
462 (TypeContainer.DoDefineMember): Check the constraints on our base
463 class and interfaces.
465 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Make this protected;
466 set the `ResolvingTypeTree' flag on the EmitContext.
468 * codegen.cs (EmitContext.ResolvingTypeTree): New public field.
470 2005-05-10 Marek Safar <marek.safar@seznam.cz>
472 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
474 * expression.cs (Argument.GetParameterModifier): Turned to property.
475 (Invocation.Error_InvalidArguments): Add more descriptive errors.
477 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
480 2005-05-09 Raja R Harinath <rharinath@novell.com>
483 * decl.cs (MemberCache.AddMethods): Register override methods,
484 rather than non-override methods.
485 * typemanager.cs (RegisterOverride): New.
486 (IsOverride): Update.
488 2005-05-09 Marek Safar <marek.safar@seznam.cz>
490 * typemanager.cs (TypeManager): Moved InitGenerics to Reset method.
492 2005-05-06 Martin Baulig <martin@ximian.com>
495 (Attributable.IsClsComplianceRequired): Fix typo in the method name.
496 (AttributeTester.AnalyzeTypeCompliance): Add generics support.
498 2005-05-09 Marek Safar <marek.safar@seznam.cz>
502 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
503 recursive declaration.
505 * statement.cs (Block.ResolveMeta): Report any error in resolving.
507 2005-05-06 Marek Safar <marek.safar@seznam.cz>
509 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
511 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
513 2005-05-05 Raja R Harinath <rharinath@novell.com>
516 * decl.cs (DeclSpace.FamilyAccessible):
517 Use TypeManager.IsNestedFamilyAccessible.
520 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
523 2005-05-04 Raja R Harinath <rharinath@novell.com>
524 Abin Thomas <projectmonokochi@rediffmail.com>
525 Anoob V E <projectmonokochi@rediffmail.com>
526 Harilal P R <projectmonokochi@rediffmail.com>
529 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
530 allow access to all static members.
532 2005-05-04 Martin Baulig <martin@ximian.com>
534 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
536 2005-05-04 Martin Baulig <martin@ximian.com>
540 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
541 section at the end; make things work if `default' is not the last
544 2005-05-04 Martin Baulig <martin@ximian.com>
548 * statement.cs (Switch): Replaced the `got_default' field with a
549 `default_section' one.
550 (Switch.CheckSwitch): Set `default_section' here.
551 (Switch.Resolve): If we're a constant switch and the constant is
552 not found, use the default section.
554 2005-05-03 Martin Baulig <martin@ximian.com>
556 * expression.cs (ArrayAccess.EmitGetLength): New public method.
558 * statement.cs (Foreach.ArrayForeach): New nested class.
559 (Foreach.TemporaryVariable): New nested class.
560 (Foreach.EmitArrayForeach): Removed; this is now in the new
563 2005-05-03 Raja R Harinath <rharinath@novell.com>
565 * pending.cs (BaseImplements): Move the #74773 fix here. This is
567 (VerifyPendingMethods): Revert change below.
569 * typemanager.cs (IsOverride, RegisterNonOverride): New.
570 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
571 that used to trigger warning -28. Remove warning -28.
572 * expression.cs (Invocation.OverloadResolve): Use
573 TypeManager.IsOverride to distinguish override methods.
576 * pending.cs (VerifyPendingMethods): If a base type implements the
577 requested interface, don't bother checking individual methods of
578 the base type. As a side-effect, this prevents the creation of
581 2005-05-02 Martin Baulig <martin@ximian.com>
585 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
586 Also `And' the locals if the old vector is null.
587 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
588 null; in this case we basically reset all the variables.
590 2005-05-02 Martin Baulig <martin@ximian.com>
594 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
595 Added `FlowBranching branching' argument; always `and' the
596 variables instead of `or'ing them unless we're an infinite loop.
598 * statement.cs (While.Resolve): Create a new sibling unless we're
601 2005-05-02 Martin Baulig <martin@ximian.com>
605 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
606 arguments; use it instead of creating a new TopLevelBlock.
607 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
608 our ConstructorInitializer.
611 (TopLevelBlock.TopLevelBranching): New public property.
612 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
613 and create our `TopLevelBranching'.
615 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
616 anonymous method host, use `block.TopLevelBranching' rather than
617 creating a new branching.
619 2005-04-20 Miguel de Icaza <miguel@novell.com>
621 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
622 a ScopeInfo, if any of the current children is a child of the new
623 entry, move those children there.
625 2005-04-30 Martin Baulig <martin@ximian.com>
627 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
628 at the beginning of a SwitchSection. Fix #73335.
630 2005-04-27 Marek Safar <marek.safar@seznam.cz>
633 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
635 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
636 (FieldExpr.DoResolve): Obsolete members are ignored for field
639 2005-04-26 Marek Safar <marek.safar@seznam.cz>
641 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
644 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
646 (Field.VerifyClsCompliance): Volatile fields are not compliant.
648 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
651 2005-04-25 Ben Maurer <bmaurer@ximian.com>
653 * cs-parser.jay: Use the prefered version of -unsafe in error
656 2005-04-22 Marek Safar <marek.safar@seznam.cz>
658 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
661 2005-04-20 John Luke <john.luke@gmail.com>
663 * driver.cs: fix typo in error message, --outout to --output
665 2005-04-30 Martin Baulig <martin@ximian.com>
667 * attribute.cs (Attribute.CheckSecurityActionValidity): Correctly
668 handle the .NET 2.x security attributes.
670 2005-04-30 Martin Baulig <martin@ximian.com>
673 (TypeManager.ExpandInterfaces): Don't add things twice.
676 (TypeContainer.VerifyClsCompliance): Allow generic instances.
678 2005-04-29 Martin Baulig <martin@ximian.com>
680 * generic.cs (Constraints.ResolveTypes): Expand interfaces.
682 * anonymous.cs: Added support for anonymous generic methods.
684 2005-04-29 Martin Baulig <martin@ximian.com>
686 * typemanager.cs (TypeManager.GetInterfaces): Correctly handle
689 2005-04-29 Martin Baulig <martin@ximian.com>
691 * generic.cs (TypeManager.HasConstructorConstraint): Removed.
693 * expression.cs (New.DoResolve): Fix the CS0304 check.
695 2005-04-29 Martin Baulig <martin@ximian.com>
697 * typemanager.cs (TypeManager.GetFullName): Updated to the new
700 * class.cs (MethodCore.IsDuplicateImplementation): If we're an
701 explicit interface implementation, compare the interface types.
702 (MethodData.Define): Use the new naming scheme from the latest
704 (MemberBase.DoDefineBase): Resolve `InterfaceType' here.
706 * decl.cs (MemberName.GetMemberName): Removed.
707 (MemberName.MethodName, FullName): New properties.
709 2005-04-25 Raja R Harinath <rharinath@novell.com>
711 * gmcs.exe.config: Update v2.0.40607 -> v2.0.50215.
713 2005-04-22 Martin Baulig <martin@ximian.com>
715 * generic.cs (GenericMethod): Create the EmitContext in the
716 `Define()'; in `Define(MethodBuilder)', create the type parameters
717 before calling `Define()'. Fixes #73933.
719 2005-04-22 Martin Baulig <martin@ximian.com>
722 (Constraints.Resolve): Make things work wrt. the new type lookup system.
723 (ConstructedType.ResolveAsTypeTerminal): Don't override this.
725 * ecore.cs (Expression.ResolveAsTypeTerminal): If `te' is a
726 ConstructedType, check its constraints.
728 2005-04-20 Marek Safar <marek.safar@seznam.cz>
730 * codegen.cs (InRefOutArgumentResolving): New field.
732 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
733 fields outside contructor.
735 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
737 2005-04-19 Miguel de Icaza <miguel@novell.com>
739 * anonymous.cs (CaptureContext.EmitParameterInstance): The
740 parameter code was not completed ever, so it was not as up-to-date
741 as local variables. Must finish it.
743 The bug fix was to compare the Toplevel of the block, not the
744 current block. Thanks for Ben for pointing this out.
746 2005-04-19 Raja R Harinath <rharinath@novell.com>
748 * decl.cs (AddMethods): Use the declaring type of the problem
749 method to determine if we want to squash a warning.
751 2005-04-19 Marek Safar <marek.safar@seznam.cz>
753 * attribute.cs: Removed debug output.
755 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
757 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
760 2005-04-18 Raja R Harinath <rharinath@novell.com>
763 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
764 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
765 all null comparisons against reference types.
767 2005-04-18 Marek Safar <marek.safar@seznam.cz>
770 * class.cs (TypeContainer.CircularDepException) New nested
772 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
773 (TypeContainer.DefineType): Removed error, reset InTransit before
775 (Class.DefineType): Throw exception when is in Transit.
776 Catch exception and report error.
777 (Struct.DefineType): Throw exception when is in Transit.
778 Catch exception and report error.
779 (Interface.DefineType): Throw exception when is in Transit.
780 Catch exception and report error.
782 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
783 handle nested exception handlers.
785 * flowanalysis.cs (InTryWithCatch): New method, search for try with
788 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
789 InFinally and InCatch storage.
791 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
792 (Catch.Resolve): Set and Restore ec.InCatch.
793 (Try.Resolve): Set and Restore ec.InFinally.
794 (Try.HasCatch): True when try has catch.
796 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
798 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
799 for the same event member, so exclude such cases from warning 419.
802 2005-04-16 Miguel de Icaza <miguel@novell.com>
804 * expression.cs (Binary.ResolveOperator): Apply patch from John
805 Luke to fix bug 59864: operators &, | and ^ on enumerations
806 require that the same enum type on both sides.
808 * driver.cs: Add warnings to old flag usage, this is to assist
809 people who produce Makefiles and hope that the Makefiles will be
812 * class.cs (TypeContainer.EmitType): Moved the definition of the
813 special $PRIVATE$ field from the resolve phase to the Emit phase.
814 During resolve we do not know if we are a struct with
815 HasExplicitLayout, we know this only after the attributes for the
818 Set the FieldOffset to zero on the dummy field that we create for
819 the class. Fixes 74590.
821 2005-04-16 Raja R Harinath <rharinath@novell.com>
824 * ecore.cs (PropertyExpr.resolved): New.
825 (DoResolve): Use it to handle a case of double resolution here.
826 Handle a case of identical-name-and-type-name.
827 * expression.cs (ArrayCreation.CheckIndices): Avoid double
828 resolution by storing the results of expression resolution back
829 into the "probes" array.
831 2005-04-15 Raja R Harinath <rharinath@novell.com>
833 Fix cs0208-7.cs and cs0208-8.cs.
834 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
835 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
836 error reporting to point out the reason a struct is not unmanaged.
838 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
840 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
841 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
843 2005-04-13 Raja R Harinath <rharinath@novell.com>
846 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
847 IdenticalNameAndTypeName here.
848 (EventExpr.InstanceResolve): Likewise.
850 2005-04-13 Marek Safar <marek.safar@seznam.cz>
852 C# 2.0 DefaultCharSetAttribute implementation
854 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
855 which allows us to set GlobalNamespace for every resolve.
856 (Attribute.ResolveArguments): Cut from Resolve.
857 (Attribute.GetCharSetValue): Returns CharSet named argument.
858 (Attribute.DefinePInvokeMethod): Gets default charset from
860 (GlobalAttribute.ResolveAsTypeStep): Override.
861 (GlobalAttribute.ResolveArguments): Override.
863 * class.cs (TypeAttr): Is protected.
865 * codegen.cs (ModuleClass.DefaultCharSet): New member.
866 (ModuleClass.DefaultCharSetType): New memeber.
867 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
869 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
872 * delegate.cs (TypeAttr): Override.
873 (Delegate.DefineType): Use this TypeAttr.
875 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
876 at very early stage (before types are defined) to resolve model
877 module attributes. It will probably not work with corlib but it
880 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
883 * typemanager.cs (default_charset_type): New type.
885 2005-04-13 Raja R Harinath <rharinath@novell.com>
887 * decl.cs (MemberCache.AddMethods): Don't warn if
888 System.Object.Finalize has buggy MethodAttributes.
890 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
893 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
895 * doc.cs : detect ambiguous reference to overloaded members.
896 Fixed bug #71603. MS 1.1 csc does not detect it.
898 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
900 * doc.cs : delegates must not be referenced with parameters.
903 2005-04-12 Miguel de Icaza <miguel@novell.com>
905 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
907 2005-04-10 Miguel de Icaza <miguel@novell.com>
909 * driver.cs (MainDriver): Stop processing if the CLS stage found
912 (CompilerCallableEntryPoint.InvokeCompiler): Always
913 reset after execution; Take a TextWriter argument for the
916 * report.cs: Use the error stream instead of hardcoding stderr.
918 2005-04-09 Miguel de Icaza <miguel@novell.com>
920 * class.cs: Reduce code paths to test, too small of an
921 optimization to make it worth the extra testing. Always perform
924 2005-04-08 Raja R Harinath <rharinath@novell.com>
927 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
928 operators that had errors reported on them.
930 2005-04-08 Marek Safar <marek.safar@seznam.cz>
932 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
934 (Attribute.Resolve): Add named argument type checking.
936 * class.cs (FixedField.Define): Use IsPrimitiveType
938 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
940 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
941 unsafe parameter types.
943 * statement.cs (Using.ResolveExpression): Add better error description.
945 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
947 2005-04-08 Raja R Harinath <rharinath@novell.com>
950 * attribute.cs (Attribute.GetAttributeUsage): Resolve
951 AttributeUsageAttribute in the emitcontext of the attribute class,
952 not in the emitcontext of the attributable entity it was attached to.
953 * cs-parser.jay: Use 'current_class', not 'current_container',
954 when creating a GlobalAttribute.
956 2005-04-08 Alp Toker <alp@atoker.com>
958 * pending.cs: The fix to #58413 failed to compile methods implementing
959 interfaces with/without params modifiers and vice versa, even though
960 params modifiers aren't part of the signature. Make the modifier check
961 less strict as in csc.
963 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
964 Anoob V E <projectmonokochi@rediffmail.com>
965 Harilal P R <projectmonokochi@rediffmail.com>
968 * pending.cs (TypeAndMethods.mods): New. Store the parameter
969 modifiers of pending methods.
970 (PendingImplementation.PendingImplementation): Initialize it.
971 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
972 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
973 with ParameterData. Add check for modifiers.
974 * class.cs (MethodData.Define): Update to changes.
976 2005-04-07 Raja R Harinath <rharinath@novell.com>
978 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
980 2005-04-07 Marek Safar <marek.safar@seznam.cz>
982 * class.cs (PropertyMethod.Define): Check private accessor in abstract
985 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
988 * typemanager.cs: Registered RequiredAttributeAttribute.
990 2005-04-06 Marek Safar <marek.safar@seznam.cz>
992 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
993 Warning CS0169 is back at level 3.
994 (IMethodData.SetMemberIsUsed): New method.
996 * decl.cs (IsUsed): New value; moved from FieldBase.Status
997 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
999 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
1001 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
1003 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
1006 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
1009 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
1010 to avoid the problems with nested types.
1012 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
1013 Anoob V.E <projectmonokochi@rediffmail.com>
1014 Harilal P.R <projectmonokochi@rediffmail.com>
1015 Raja R Harinath <rharinath@novell.com>
1018 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
1020 * typemanager (GetConstructor): Make public.
1022 2005-04-05 John Luke <john.luke@gmail.com>
1023 Raja R Harinath <rharinath@novell.com>
1026 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
1027 struct too. Return false quicker in a few cases.
1028 (VerifyUnManaged): Use it.
1030 2005-04-05 Raja R Harinath <rharinath@novell.com>
1033 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
1034 not 'unreachable_seen'.
1036 2005-04-04 Marek Safar <marek.safar@seznam.cz>
1038 * attribute.cs (Attribute.GetValue): Removed unused.
1040 * codegen.cs (CodeGen.TrimExt): Removed unused.
1042 * cs-parser.jay (output): Removed unused.
1044 * cs-tokenizer.cs (hex_digits): Removed unused.
1046 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
1048 * expression.cs (Indirection.LoadExprValue): Removed unused.
1049 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
1051 * iterators.cs (Iterator.param_types): Removed unused.
1053 * statement.cs (Goto.block): Removed unused.
1054 (ToplevelBlock.did): Removed unused.
1055 (Switch.ResolveConstantSwitch): Removed unused.
1057 2005-04-01 Ben Maurer <bmaurer@ximian.com>
1059 * rootcontext.cs: Allow mcs to bootstrap with the compilation
1062 2005-04-19 Martin Baulig <martin@ximian.com>
1064 Merged r42462 from MCS and made it work for GMCS.
1066 * class.cs (MethodCore.ds): Moved this field to `MemberBase'.
1068 * generic.cs (GenericMethod.Define): Removed `return_type' argument.
1070 2005-04-01 Raja R Harinath <rharinath@novell.com>
1072 Fix #74232 and cs0208-3.cs.
1073 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
1074 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
1075 unmanaged type. Don't use FieldBuilders when 't' is a
1076 TypeBuilder. Use ModFlags and MemberType fields.
1077 * class.cs (MemberBase.member_type): Rename from MemberType.
1078 (MemberBase.MemberType): New property. Determines member_type on
1080 (MemberBase.DoDefine): Don't initialize MemberType here.
1081 (FieldMember.Define): Likewise.
1083 2005-04-01 Marek Safar <marek.safar@seznam.cz>
1086 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
1087 Attributes are emitted there.
1089 2005-04-01 Raja R Harinath <rharinath@novell.com>
1091 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
1092 keyword in 'partial enum' too.
1093 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
1095 Report from Kamil Skalski <nazgul@omega.pl>.
1098 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
1099 have partial containers too.
1101 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
1102 in block' checks to Block.CheckInvariantMeaningInBlock.
1103 * statement.cs (Block.GetKnownVariableInfo): Make private.
1104 (Block.IsVariableUsedInChildBlock): Remove.
1105 (Block.IsVariableUsedInBlock): Likewise.
1106 (Block.CheckInvariantMeaningInBlock): New. Show location of
1107 conflicting declaration.
1108 (Block.AddVariable): Make error messages less long-winded and more
1109 specific. Show location of conflicting declaration.
1110 * parameter.cs (Parameters.Location): New readonly property.
1112 2005-03-31 Raja R Harinath <rharinath@novell.com>
1114 Clean up semantics of invoking ResolveMemberAccess.
1115 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
1116 can have an instance, ensure that we pass in a non-TypeExpression
1117 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
1118 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
1119 argument. Update to changes and simplify.
1120 (FieldExpr.Emitinstance): Remove CS0120 check.
1121 (PropertyExpr.EmitInstance): Likewise.
1122 * expression.cs (Argument.Resolve): Likewise.
1123 (Invocation.DoResolve): Update to changes in semantics of
1126 2005-03-31 Marek Safar <marek.safar@seznam.cz>
1129 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
1132 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
1134 2005-03-31 Raja R Harinath <rharinath@novell.com>
1136 Fix difference in behaviour with commandline invocation.
1137 * driver.cs (Driver.Reset): New.
1138 (CompilerCallableEntryPoint): Call it.
1140 * statement.cs (If.Resolve): Avoid spurious "uninitialized
1141 variable" warnings if the boolean expression failed to resolve.
1143 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
1145 * attribute.cs: Fix the union of several permissions when some of them
1146 are unrestricted (so the result isn't an unrestricted permission set).
1149 2005-03-30 Raja R Harinath <rharinath@novell.com>
1151 * ecore.cs (MemberExpr): New class. Convert from interface
1153 (MemberExpr.ResolveMemberAccess): Refactor and move here from
1154 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
1156 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
1157 (MethodGroupExpr.IsExplicitImpl): Remove.
1158 (Expression.GetFieldFromEvent): Remove.
1159 (SimpleName.MemberStaticCheck): Remove.
1160 (SimpleName.DoSimpleNameResolve): Update to changes.
1161 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
1162 (MemberAccess.IdenticalNameAndTypeName): Remove.
1163 (MemberAccess.error176): Move to MemberExpr.
1164 (MemberAccess.DoResolve): Update to changes.
1165 (BaseAccess.DoResolve): Likewise.
1167 2005-03-30 Marek Safar <marek.safar@seznam.cz>
1169 C# 2.0 Conditional attribute class implementation
1171 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
1172 Analyzes class whether it has attribute which has ConditionalAttribute
1173 and its condition is not defined.
1175 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
1176 (Class.IsExcluded): New method. Search for at least one defined
1177 condition in ConditionalAttribute of attribute class.
1179 2005-03-30 Raja R Harinath <rharinath@novell.com>
1181 * ecore.cs (PropertyExpr): Derive from Expression, not
1182 ExpressionStatement.
1183 (PropertyExpr.EmitStatement): Remove.
1185 2005-03-29 Raja R Harinath <rharinath@novell.com>
1188 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
1189 internal field "value__" of an enum be private. The examples for
1190 "value__" that I found on MSDN all used FieldAttributes.Private.
1192 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
1193 Don't mention IL method attribute names.
1195 Fix #47991. Remove a TODO.
1196 * statement.cs (Block.Toplevel): Make into a field.
1197 (Block.Parameters): Move into ToplevelBlock.
1198 (Block.known_variables): Rename from child_variable_names.
1199 (Block.Block): Remove variants that take Parameters. Initialize
1200 'Toplevel' with the immediately surrounding toplevel block.
1201 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
1202 LocalInfo parameter.
1203 (Block.GetKnownVariableInfo): New.
1204 (Block.IsVariableNameUsedInChildBlock): Update.
1205 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
1206 the block, even though it may not be in scope.
1207 (Block.AddVariable): Remove Parameters parameter. Use
1208 Toplevel.Parameters instead.
1209 (Block.AddConstant): Remove Parameters parameter.
1210 (Block.GetParameterReference): Update to use Toplevel.Parameters.
1211 (Block.IsParamaterReference): Likewise.
1212 (Block.IsLocalParameter): Likewise. Simplify a lot.
1213 (ToplevelBlock.Parameters): New. Moved from Block.
1214 (ToplevelBlock.ToplevelBlock): Update to changes. Always
1215 initialize Parameters to a non-null value.
1216 * cs-parser.jay: Update to changes.
1217 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
1218 simple names that mean different things in the same block. Use
1219 Block.IsVariableNameUsedInBlock.
1221 2005-03-28 Raja R Harinath <rharinath@novell.com>
1223 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
1225 2005-03-26 Raja R Harinath <harinath@acm.org>
1228 * assign.cs (Assign.DoResolve): When the RHS of an assignment
1229 fails to resolve, ensure that the LHS is still resolved as an
1232 2005-03-25 Raja R Harinath <harinath@acm.org>
1234 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
1236 (Enum.current_ec): Remove.
1237 (Enum.LookupEnumValue): Remove EmitContext argument.
1238 Just uses the one created during DefineType.
1239 (Enum.FindMembers): Update.
1240 * expression.cs (MemberAccess.DoResolve): Update.
1242 2005-03-22 Marek Safar <marek.safar@seznam.cz>
1244 * assign.cs (Assign.DoResolve): Check for CS1717 when
1245 source and target are same (uses Equals).
1247 * expression.cs (LocalVariableReference, ParameterReference,
1248 This): Implemented Equals, GetHashCode.
1250 * statement.cs (Block.GetParameterReference): Removed useless
1253 2005-03-22 Raja R Harinath <rharinath@novell.com>
1256 * statement.cs (Block.AddVariable): Ensure that we skip implicit
1257 blocks before deciding whether the error is cs0136 or cs0128.
1259 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
1260 (using_alias_directive, using_namespace_directive): Pass
1261 MemberName, not an expression to Namespace.UsingAlias and
1263 (MakeName): Use the MemberName of the namespace.
1264 * namespace.cs (Namespace.MemberName): New.
1265 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
1266 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
1268 * decl.cs (MemberName.Name): Make readonly.
1269 (MemberName.FromDotted): New "constructor".
1270 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
1271 (MemberCore.Name): Compute from MemberName on demand.
1272 (MemberCore.SetMemberName): Provide a way to change the
1274 (MemberCore.AddToContainer): Don't take a fullname parameter.
1275 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
1276 fully qualified name of the container to the member name.
1277 (TypeContainer.AddToTypeContainer): Use a fully qualified name
1278 only if the type is a member of the root container.
1279 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
1280 MemberName.Left rather than searching for an embedded ".".
1281 (PartialContainer.CreatePart): Update to changes in RootContext.
1282 (MemberBase.ShortName): Turn into a property. Use
1283 MemberCore.SetMemberName.
1284 (MemberBase.ExplicitInterfaceName): Remove.
1285 (MemberBase.UpdateMemberName): Remove.
1286 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
1287 (PropertyBase.SetMemberName): New override.
1288 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
1289 (Tree.GetDecl): New.
1290 (Tree.AllDecls): Rename from Decls.
1291 * attribute.cs, enum.cs, report.cs: Update to changes.
1292 * driver.cs (MainDriver): Use MemberName.FromDotted on
1293 RootContext.MainClass.
1295 2005-03-21 Marek Safar <marek.safar@seznam.cz>
1297 * class.cs (FixedField.Define): Check for CS1664 and more sanity
1300 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
1302 2005-03-18 Marek Safar <marek.safar@seznam.cz>
1304 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
1305 property accessor modifiers.
1307 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
1308 fixed buffer attribute (CS1716).
1309 (PropertyMethod.HasCustomAccessModifier): When property accessor
1310 has custom modifier.
1312 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
1314 (PropertyExpr.DoResolveLValue): Add CS0272.
1316 2005-03-17 Miguel de Icaza <miguel@novell.com>
1318 * convert.cs: When converting to a pointer, use the proper Conv.U
1319 or Conv.I depending on the source data type.
1321 * cs-tokenizer.cs: Make the size for large decimal constants,
1324 2005-03-17 Martin Baulig <martin@ximian.com>
1326 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
1327 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
1329 2005-03-17 Martin Baulig <martin@ximian.com>
1331 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
1332 to bool so we can return an error condition.
1333 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
1336 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
1338 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
1341 2005-03-16 Raja R Harinath <rharinath@novell.com>
1343 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
1344 Refactor to avoid traversing the list of assemblies, and to avoid
1345 string concatenation.
1346 * typemanager.cs (guid_attr_type): Remove.
1347 (negative_hits, pointers, references): Remove hashes.
1349 (GetConstructedType): New. Uses type_hash to handle constructed
1350 types (arrays, references, pointers).
1351 (GetReferenceType, GetPointerType): Use it.
1352 (GetNestedType): New. Uses type_hash to handle nested types of
1354 (LookupType, LookupTypeDirect): Remove.
1355 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
1356 'types' hash and LookupTypeReflection directly.
1357 (params_string, params_object): Use GetConstructedType.
1358 * namespace.cs (Namespace.cached_types): New. Cache of reflected
1360 (Namespace.Lookup): Use cached_types.
1361 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
1362 provided by old TypeManager.LookupType.
1363 * rootcontext.cs (MakeFQN): Remove.
1364 * decl.cs (DeclSpace.MakeFQN): Likewise.
1365 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
1366 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
1367 TypeManager.GetConstructedType.
1368 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
1370 2005-04-16 Zoltan Varga <vargaz@freemail.hu>
1372 * cs-parser.jay: Fix build.
1374 2005-03-15 Marek Safar <marek.safar@seznam.cz>
1376 * class.cs (TypeContainer.CircularDepException) New nested
1377 (MethodCore.CheckBase): Report CS1715 for properties and indexers.
1379 * cs-parser.jay: Reports CS1527 for any namespace element.
1381 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
1384 * expression.cs (ParameterReference.IsAssigned): Changed error to
1386 (Error_WrongNumArguments): Moved CS0245 detection here.
1388 * statement.cs (Return.Resolve): Add CS1622 report.
1390 2005-03-11 Marek Safar <marek.safar@seznam.cz>
1392 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
1394 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
1396 * attribute.cs expression.cs: Get rid of some allocations.
1398 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
1400 * doc.cs : just eliminate the latest change.
1402 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1404 * doc.cs : commented out the latest change. It breaks xml-030.cs
1406 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1408 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
1409 fail. So invoke CreateType() in FindDocumentedType().
1411 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1413 * cs-tokenizer.cs : added IsKeyword().
1414 * doc.cs : Detect keyword incorrectly used as identifier.
1415 Allow identifiers prefixed by @.
1417 2005-03-10 Marek Safar <marek.safar@seznam.cz>
1419 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
1420 It caused exception in namespace resolving (again!).
1422 * class.cs (Class.ctor): Removed exit.
1423 (PropertyMethod.ctor): ditto.
1425 * codegen.cs (Codegen.Reset): Reset static data.
1426 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
1428 * cs-tokenizer.cs (Cleanup): Removed.
1430 * driver.cs (GetSystemDir): Rewrote to one line command.
1431 It caused problem with unloaded dynamic modules.
1432 (UnixParseOption): Removed Exit.
1433 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
1434 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
1435 Now can be mcs used as library.
1437 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
1440 * location.cs (Reset): Reset static data.
1442 * namespace.cs (Reset): Reset static data.
1444 * report.cs (Report.Reset): Reset static data.
1446 * rootcontext.cs (RootContext.Reset): Reset static data.
1448 * tree.cs (RootTypes.ctor): Use Location.Null
1450 * typemanager.cs (TypeManager.Reset): Reset static data.
1451 (CoreLookupType): Removed Exit.
1452 (TypeHandle.Reset): Reset static data.
1454 2005-03-10 Raja R Harinath <rharinath@novell.com>
1457 * typemanager.cs (ComputeNamespaces): Import namespaces from
1458 referenced modules too.
1460 2005-03-09 Raja R Harinath <rharinath@novell.com>
1462 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
1465 2005-03-09 Raja R Harinath <rharinath@novell.com>
1467 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
1468 enclosing DeclSpace. This ensures that a name-lookup populates
1469 more caches and there are fewer 'TypeExpression's. Carve out
1470 nested type lookup into ...
1471 (LookupNestedTypeInHierarchy): ... this.
1473 2005-04-15 Martin Baulig <martin@ximian.com>
1475 Merged r41590 from MCS and make it work in the generics land.
1477 * generic.cs (TypeParameter.UpdateConstraints): Removed the
1480 * class.cs (PartialContainer.UpdateConstraints): Removed.
1481 (PartialContainer.CheckConstraints): Removed.
1482 (PartialContainer.SetParameterInfo): Store the constraints here.
1483 (PartialContainer.DefineTypeParameters): New public method;
1484 resolve the type parameter's constraints here. Note that the
1485 PartialContainer doesn't have an EmitContext anymore, so we must
1486 do this in the ClassPart.
1488 2005-03-09 Raja R Harinath <rharinath@novell.com>
1490 Clean up a few partial-class semantics.
1491 Fixes test-357.cs and cs1618-2.cs.
1492 * cs-parser.jay (struct_declaration): Use 'current_class' as
1493 parent of newly-created struct. Remove call to Register ().
1494 Use 'pop_current_class' to complete handing the current struct.
1495 (interface_declaration): Likewise.
1496 (class_declaration): Likewise.
1497 (enum_declaration): Use 'current_class' as parent of newly created
1499 (delegate_declaration): Likewise.
1500 (pop_current_class): New function. This is used to handle closing
1501 up the 'current_class' and 'current_container', and pointing them
1502 to the enclosing class/container.
1503 (CSharpParser): Initialize 'current_class' too.
1504 * decl.cs (MemberCore): Add check for invariant: a partial
1505 container is not a parsed entity, and thus does not enclose any
1507 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
1508 (DeclSpace.BaseTypeExpr): Use it.
1509 (DeclSpace.LookupType): Add check for invariant.
1510 * class.cs (TypeContainer): Add check for invariant: a nested
1511 class should have the same NamespaceEntry as its enclosing class.
1512 (TypeContainer.EmitFieldInitializers): Make virtual.
1513 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
1515 (TypeContainer.Register): Remove.
1516 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
1517 null. Use TypeResolveEmitContext for resolving base types and
1518 interfaces. Move initialization of Parts.TypeBuilder here from
1520 (TypeContainer.DefineNestedTypes): ... here.
1521 (PartialContainer): Take a Namespace not a NamespaceEntry.
1522 (PartialContainer.Create): Don't use Register. Call the
1523 appropriate Add... function directly.
1524 (ClassPart): Take both the PartialContainer and the enclosing
1525 class as constructor arguments.
1526 (ClassPart.EmitFieldInitializers): Override.
1527 (ClassPart.PartFindNestedTypes): Remove.
1528 (FieldBase.GetInitializerExpression): Resolve the initializer
1529 expression in the emit context of the enclosing class.
1530 * tree.cs (RootTypes): Remove Register ().
1532 2005-03-08 Marek Safar <marek.safar@seznam.cz>
1534 * cs-parser.jay: Removed CS0134.
1536 * driver.cs: Removed CS1901.
1538 * expression.cs (SizeOf.DoResolve): Don't report CS0233
1539 for predefined types.
1541 2005-03-07 Duncan Mak <duncan@novell.com>
1543 * codegen.cs (Save): Catch UnauthorizedAccessException as
1544 well. Fixes bug #73454.
1546 2005-03-07 Marek Safar <marek.safar@seznam.cz>
1548 * cs-tokenizer.cs (xtoken): Add CS1035.
1550 * class.cs (MethodData.Define): Add CS0683.
1551 (FieldMember.ctor): Add CS0681.
1553 2005-03-07 Raja R Harinath <rharinath@novell.com>
1555 * ecore.cs (SimpleName.DoResolve): Rename from
1556 SimpleName.DoResolveAllowStatic.
1557 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
1558 Pass 'intermediate' flag to MemberStaticCheck.
1559 (SimpleName.MemberStaticCheck): Skip "static check" only in case
1560 of "intermediate" lookups via MemberAccess.
1561 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
1562 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
1564 2005-03-07 Raja R Harinath <rharinath@novell.com>
1567 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
1568 slipped in because of variable names that are identical to a
1569 builtin type's BCL equivalent ('string String;', 'int Int32;').
1570 (PropertyExpr.EmitInstance): Likewise.
1572 2005-03-04 Marek Safar <marek.safar@seznam.cz>
1574 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
1576 * report.cs (warning_ignore_table): Made public.
1578 2005-03-04 Raja R Harinath <rharinath@novell.com>
1581 * class.cs (MethodData.Emit): Pass 'container' to
1582 container.GetObsoleteAttribute instead of 'container.Parent'.
1584 2005-03-03 Marek Safar <marek.safar@seznam.cz>
1586 * cs-parser.jay: Add 1534 error test.
1588 * iterators.cs (Yield.CheckContext): Add error 1629.
1589 (Iterator.ctor): Save unsafe modifier.
1590 (MoveNextMethod.DoEmit): Restore unsafe context.
1592 * namespace.cs (UsingAlias): Better error message.
1594 2005-03-03 Dan Winship <danw@novell.com>
1596 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
1597 the warning message [#73219]
1599 2005-03-03 Raja R Harinath <rharinath@novell.com>
1601 Fix compile with MCS 1.0.0.0.
1602 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
1603 w_restore to not depend on string constant folding.
1605 2005-03-03 Raja R Harinath <rharinath@novell.com>
1607 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
1608 CS0246 check to users who passed 'silent = false'.
1609 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
1611 (SimpleName.SimpleNameResolve): Update.
1612 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
1613 (MemberAccess.IdenticalNameAndTypeName): Update.
1614 * doc.cs (FindDocumentedTypeNonArray): Update.
1616 2005-03-03 Raja R Harinath <rharinath@novell.com>
1618 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
1619 * parameters.cs (ComputeAndDefineParameters): Remove.
1620 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
1621 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
1622 Use GetParameterInfo.
1624 2005-03-02 Marek Safar <marek.safar@seznam.cz>
1626 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
1628 2005-03-02 Raja R Harinath <rharinath@novell.com>
1630 Unify DeclSpace.LookupType and DeclSpace.FindType.
1631 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
1632 is in charge of defining nested types on demand.
1633 (DeclSpace.LookupType): Use it when the current_type is a
1634 TypeBuilder. Use LookupTypeDirect for reflected types.
1635 (DeclSpace.FindType): Remove.
1636 (DeclSpace.LookupInterfaceOrClass): Likewise.
1637 (DeclSpace.DefineTypeAndParents): Likewise.
1638 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
1639 DeclSpace.LookupType.
1640 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
1641 * typemanager.cs (LookupType): Simplify.
1642 (AddUserType): Remove type from negative_hits.
1643 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
1644 * class.cs (TypeContainer.FindMembers): Move handling of nested
1646 (TypeContainer.FindMembers_NestedTypes): ... here.
1647 (TypeContainer.FindNestedType): Implement override.
1648 (ClassPart.FindNestedType): Delegate to PartialContainer.
1649 (ClassPart.PartFindNestedType): Looks up the nested types of the
1652 2005-04-14 Martin Baulig <martin@ximian.com>
1654 * generic.cs (ConstructedType): Moved all the type lookup and
1655 nested class logic into SimpleName.
1656 (ConstructedType.ResolveConstructedType): Our underlying type is
1657 already fully resolved; all the type lookup stuff is in
1660 * ecore.cs (SimpleName.ResolveAsTypeStep): Resolve nested
1661 constructed types here instead of in ConstructedType.
1663 * decl.cs (MemberName.GetTypeExpression): Always create a
1664 SimpleName, not a ConstructedType.
1665 (DeclSpace.ResolveNestedType): Removed; this is now in SimpleName.
1667 2005-03-02 Martin Baulig <martin@ximian.com>
1669 * class.cs (TypeContainer.DoDefineMembers): We also need a default
1670 static constructor in static classes.
1672 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
1674 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
1675 sizeParamIndex is not specified.
1677 2005-03-01 Marek Safar <marek.safar@seznam.cz>
1680 * report.cs (WarningMessage.IsEnabled): Missing null check.
1682 2005-02-28 Marek Safar <marek.safar@seznam.cz>
1684 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
1685 in the fields and not in the properties.
1687 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
1689 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
1692 2005-02-28 Marek Safar <marek.safar@seznam.cz>
1694 * attribute.cs: Small refactoring (improved robustness).
1695 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
1696 (ValidateGuid): Removed.
1697 (Resolve): Removed referenced to above mentioned.
1698 (GetAttributeUsage): Made private and changed to work without
1700 (GetIndexerAttributeValue): Don't crash.
1701 (GetConditionalAttributeValue): Ditto.
1702 (GetClsCompliantAttributeValue): Ditto.
1703 (ExtractSecurityPermissionSet): All attributes exceptions are
1705 (GetPropertyValue): New helper.
1706 (GetMethodImplOptions): New method.
1707 (DefinePInvokeMethod): Reuse common code. Implemented handling of
1708 some missing properties.
1710 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
1711 (Method.ApplyAttributeBuilder): Updated.
1713 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
1716 2005-02-28 Raja R Harinath <rharinath@novell.com>
1719 * report.cs (Report.SymbolRelatedToPreviousError): Handle
1720 non-simple types (array, pointer, reference).
1722 2005-02-28 Marek Safar <marek.safar@seznam.cz>
1724 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
1726 * class.cs (MethodCore.IsDuplicateImplementation): Special error
1728 (Method.CheckBase): Catch wrong destructor here.
1729 (MethodData.Define): Add errors 550, 668.
1731 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
1733 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
1735 * pending.cs (VerifyPendingMethods): Add error 551.
1737 * typemanager.cs (CSharpName): Next error report helper.
1739 2005-02-25 Marek Safar <marek.safar@seznam.cz>
1741 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
1742 attributes. Removed useless attribute double check.
1743 It saves almost 2MBs for corlib.
1745 2005-02-25 Raja R Harinath <rharinath@novell.com>
1748 * statement.cs (ExpressionStatement.Resolve): Make robust to being
1749 called twice in case of error.
1751 2005-02-23 Chris Toshok <toshok@ximian.com>
1753 Fix compiler portions of #72827.
1754 * statement.cs (Block.Emit): call Begin/EndScope on the
1755 EmitContext instead of the ILGenerator.
1757 * codegen.cs (EmitContext.BeginScope): new method, call
1758 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
1760 (EmitContext.BeginScope): same, but EndScope and CloseScope
1762 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
1763 offset and call the superclass's OpenScope(int) with it.
1764 (SymbolWriter.CloseScope): get the current il
1765 offset and call superclass's CloseScope(int) with it.
1767 2005-02-23 Marek Safar <marek.safar@seznam.cz>
1769 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
1770 CS1677 for out and ref as well.
1772 * class.cs (Method.Define): Add error CS1599 detection.
1774 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
1776 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
1778 * delegate.cs (Delegate.Define): Add error CS1599 detection.
1780 * support.cs.cs (ModifierDesc): New helper method.
1782 2005-02-23 Raja R Harinath <rharinath@novell.com>
1783 Abin Thomas <projectmonokochi@rediffmail.com>
1784 Anoob V E <projectmonokochi@rediffmail.com>
1785 Harilal P R <projectmonokochi@rediffmail.com>
1788 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
1789 MemberLookup (used for error reporting) actually returns a result.
1790 Fix error report number (122, not 112).
1792 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
1793 Anoob V E <projectmonokochi@rediffmail.com>
1794 Harilal P R <projectmonokochi@rediffmail.com>
1797 * pending.cs (PendingImplementation.GetAbstractMethods):
1798 Find NonPublic members too.
1800 2005-02-22 Marek Safar <marek.safar@seznam.cz>
1802 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
1805 * class.cs (MethodCore.CheckMethodAgainstBase):
1806 Add error 239 report.
1808 2005-02-21 Marek Safar <marek.safar@seznam.cz>
1810 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
1812 * class.cs (Operator.Define): Add error 217 report.
1814 2005-02-21 Raja R Harinath <rharinath@novell.com>
1817 * expression.cs (Invocation.IsApplicable): Make public.
1818 (Invocation.IsParamsMethodApplicable): Likewise.
1819 * delegate.cs (Delegate.VerifyApplicability): Don't use
1820 Invocation.VerifyArgumentCompat for parameter applicability
1821 testing. Use Invocation.IsApplicable and
1822 Invocation.IsParamsMethodApplicable.
1824 2005-02-21 Marek Safar <marek.safar@seznam.cz>
1826 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
1828 * class.cs (Operator.Define): Add error 217 report.
1830 2005-02-21 Raja R Harinath <rharinath@novell.com>
1832 * namespace.cs (UsingEntry.Resolve): Undo change below.
1834 2005-02-21 Raja R Harinath <rharinath@novell.com>
1837 * ecore.cs (Expression.MemberLookupFailed): Add argument to
1838 disable the error message when the extended MemberLookup also
1840 (Expression.MemberLookupFinal): Update.
1841 (SimpleName.DoSimpleNameResolve): Update.
1842 * expression.cs (MemberAccess.ResolveNamespaceOrType):
1843 Don't use MemberLookupFinal.
1844 (New.DoResolve): Update.
1845 (BaseAccess.CommonResolve): Update.
1847 2005-02-21 Raja R Harinath <rharinath@novell.com>
1850 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
1851 occured previously, don't resolve again.
1853 2005-02-21 Marek Safar <marek.safar@seznam.cz>
1856 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
1857 argument. Call ResolveAttributeUsage for unresolved.
1858 when types doesn't match ctor arguments.
1860 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
1861 for nested attribute classes.
1862 (Class.attribute_usage): Removed.
1863 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
1864 for attribute class.
1866 * ecore.cs (IsAttribute): Removed.
1868 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
1870 * rootcontext.cs (RegisterAttribute): Removed, attributes are
1872 (attribute_types): Removed.
1873 (EmitCode): Global attributes are emited as the latest.
1875 2005-02-18 Marek Safar <marek.safar@seznam.cz>
1877 * class.cs (EmitFieldInitializers): Don't emit field initializer
1878 for default values when optimilization is on.
1880 * constant.cs (Constant.IsDefaultValue): New property.
1882 * driver.cs: Add /optimize handling.
1886 * literal.cs: Implement new IsDefaultValue property.
1888 * rootcontext.cs (Optimize): New field, holds /optimize option.
1890 2005-02-18 Raja R Harinath <rharinath@novell.com>
1892 Fix crasher in re-opened #72347.
1893 * namespace.cs (Namespace.Lookup): Return null if
1894 DeclSpace.DefineType returns null.
1897 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
1899 2005-02-18 Raja R Harinath <rharinath@novell.com>
1901 Fix remainder of #63202. Change semantics of DoResolveLValue: it
1902 now returns null if it cannot resolve to an lvalue.
1903 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
1904 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
1905 returned null. Remove check for SimpleName.
1906 (EventExpr.DoResolveLValue): New.
1907 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
1908 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
1910 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
1912 (Unary.ResolveOperator): Move CS0211 check ...
1913 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
1915 (Unary.DoResolveLValue): Simplify.
1916 (AddressOf.DoResolveLValue): New.
1917 (ArrayAccess.DoResolveLValue): New.
1919 2005-02-16 Marek Safar <marek.safar@seznam.cz>
1921 * attribute.cs (Attribute.Resolve): Add arguments casting for
1922 when types doesn't match ctor arguments.
1924 2005-02-16 Raja R Harinath <rharinath@novell.com>
1926 Fix parts of #63202.
1927 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
1928 lookup of operator in base type. Ensure that all checks happen
1929 when the operator resolves to an "op_..." method.
1931 2005-02-15 Raja R Harinath <rharinath@novell.com>
1934 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
1935 'ignore_cs0104' parameter. Pass it to ...
1936 (NamespaceEntry.Lookup): ... this.
1937 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
1938 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
1939 (TypeLookupExpression.DoResolveAsTypeStep): Update.
1940 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
1941 Update. Request that cs0104 errors be ignored.
1942 (ComposedCast.ResolveAsTypeStep): Update.
1944 2005-02-14 Raja R Harinath <rharinath@novell.com>
1947 * expression.cs (Invocation.BetterFunction): Remove support for
1948 comparing virtual functions and their overrides.
1949 (Invocation.IsOverride): New.
1950 (Invocation.OverloadResolve): Don't consider 'override' functions
1951 during candidate selection. Store them in a lookaside list.
1952 If the selected method is a 'virtual' function, use the list to
1953 find any overrides that are closer to the LHS type.
1955 2005-02-14 Marek Safar <marek.safar@seznam.cz>
1957 * expression.cs (New.DoResolve): Add complex core type reduction.
1958 (New.Constantify): Converts complex core type syntax like 'new int ()'
1961 2005-02-14 Raja R Harinath <rharinath@novell.com>
1963 * decl.cs (EntryType.EntryType): New constructor to create an
1964 updated copy of a cache entry.
1965 (MemberCache.AddMethods): Use it.
1966 (MemberCache.ClearDeclaredOnly): Remove.
1967 (MemberCache.MemberCache): Update.
1969 2005-02-11 Miguel de Icaza <miguel@novell.com>
1971 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
1972 variable. This one is represents the actual low-level declaration
1973 of the method, as opposed to the semantic level `IsStatic'.
1975 An anonymous method which is hosted into a static method might be
1976 actually an instance method. IsStatic would reflect the
1977 container, while MethodIsStatic represents the actual code
1980 * expression.cs (ParameterReference): Use the new MethodIsStatic
1981 instead of IsStatic.
1983 * anonymous.cs (AnonymousMethod.Compatible): Pass the
1984 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
1985 set on the current EmitContext.
1987 * expression.cs (Cast): Overload DoResolveLValue so we can pass
1988 resolve our casted expression as an LValue. This triggers the
1989 proper LValue processing that is later required by Assign.
1993 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
1995 2005-02-11 Marek Safar <marek.safar@seznam.cz>
1997 C# 2.0 Fixed buffer implementation
1999 * anonymous.cs: Update after RegisterHelperClass renaming.
2001 * attribute.cs (AttributeTester.fixed_buffer_cache):
2002 Cache of external fixed buffers.
2003 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
2004 implementation if field is fixed buffer else null.
2007 (TypeContainer.AddField): Accept FieldMember instead of Field.
2008 (FieldBase.IsFieldClsCompliant): Extracted code from
2009 VerifyClsCompliance descendant customization.
2010 (FixedField): New class handles fixed buffer fields.
2011 (FixedFieldExternal): Keeps information about imported fixed
2013 (IFixedField): Make access to internal or external fixed buffer
2016 * cs-parser.jay: Add fixed buffer parsing.
2018 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
2021 * expression.cs (Indirection): Extended implementation to accept
2023 (PointerArithmetic.Emit): Get element from fixed buffer as well.
2024 (ElementAccess.MakePointerAccess): Get type as parameter.
2025 (DoResolve): Add fixed buffer field expression conversion.
2026 (DoResolveLValue): Ditto.
2027 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
2028 (ArrayPtr): Derives from FixedBufferPtr.
2029 (ArrayPtr.Emit): Add extra emit for array elements.
2031 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
2033 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
2034 for compiler generated types.
2035 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
2037 * statement.cs (Fixed): Refactored to be easier add fixed buffer
2038 and consume less memory.
2039 (Fixed.Resolve): Add fixed buffer case.
2041 * typemanager.cs (compiler_generated_attr_ctor,
2042 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
2043 (HasElementType): Add our own implementation to work on every
2046 2005-02-11 Miguel de Icaza <miguel@novell.com>
2048 * anonymous.cs (CaptureContext): Track whether `this' has been
2051 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
2052 only captured `this' if it was implicitly done (instance
2053 methods/variables were used).
2055 * codegen.cs (EmitContext.CaptureThis): New method to flag that
2056 `this' must be captured.
2058 2005-01-30 Miguel de Icaza <miguel@novell.com>
2060 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
2061 is null it means that there has been no need to capture anything,
2062 so we just create a sibling.
2064 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
2066 Just a partial fix. The other half is fairly elusive.
2068 2005-02-10 Raja R Harinath <rharinath@novell.com>
2070 Fix #52586, cs0121-4.cs.
2071 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
2072 and return a hashtable.
2073 (MemberCache.ClearDeclaredOnly): New.
2074 (MemberCache.MemberCache): Update to change. Make a deep copy of
2075 the method_hash of a base type too.
2076 (MemberCache.AddMethods): Adapt to having a deep copy of the base
2077 type methods. Overwrite entries with the same MethodHandle so
2078 that the ReflectedType is correct. The process leaves in base
2079 virtual functions and their overrides as distinct entries.
2080 (CacheEntry): Now a class instead of a struct. It shouldn't alter
2081 matters since it was boxed in a ArrayList before.
2082 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
2084 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
2085 case of a virtual function and its override (choose the overload
2087 (Invocation.OverloadResolve): Avoid 'override' members during
2088 'applicable_type' calculation.
2090 2005-03-28 Raja R Harinath <rharinath@novell.com>
2092 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
2093 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
2094 GetTypeHandle. It is possible for a reflected type to derive from
2095 a TypeBuilder (e.g., int[] derives from the TypeBuilder
2096 System.Array during mscorlib compilation).
2097 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
2098 contain a method_hash, don't create one either. Don't create a
2099 deep copy of the base cache's method_hash.
2100 (MemberCache.SetupCache): Rename back from DeepCopy.
2101 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
2102 already initialized. If we see an override function, add its
2103 underlying base virtual function to the member_hash too.
2105 2005-02-09 Raja R Harinath <rharinath@novell.com>
2107 Combine two near-redundant caches.
2108 * typemanager.cs (method_params): Rename from method_internal_params.
2109 (TypeManager.GetParameterData): New. Replace
2110 Invocation.GetParameterData.
2111 (TypeManager.LookupParametersByBuilder): Remove.
2112 * expression.cs (Invocation.method_parameter_cache): Remove.
2113 (Invocation.GetParameterData): Remove.
2115 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
2118 2005-02-08 Raja R Harinath <rharinath@novell.com>
2121 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
2122 TypeManager.multicast_delegate_type is null, resolve it by looking
2123 up "System.MulticastDelegate".
2124 * rootcontext.cs (RootContext.ResolveCore): Simplify.
2126 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
2127 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
2128 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
2131 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
2132 (LabeledStatement.AddReference): New. Set 'referenced'.
2133 (Goto.Resolve): Use it.
2135 2005-02-05 John Luke <john.luke@gmail.com>
2137 * driver.cs: remove duplicate -doc line in Usage ()
2139 2005-02-04 Raja R Harinath <rharinath@novell.com>
2141 * location.cs (Location.AddFile): Fix CS2002 error report.
2143 2005-02-02 Martin Baulig <martin@ximian.com>
2145 * delegate.cs (Delegate.DefineType): Report an internal error if
2146 TypeManager.multicast_delegate_type is null. See bug #72015 for
2149 2005-02-02 Raja R Harinath <rharinath@novell.com>
2151 Fix a crasher in a variant of #31984.
2152 * const.cs (Constant.CheckBase): New override that defers the
2153 new-or-override check in case the base type hasn't been populated
2155 (Constant.Define): Ensure the new-or-override check is performed.
2157 2005-02-01 Duncan Mak <duncan@ximian.com>
2159 * const.cs (LookupConstantValue): Check that `ce' is not null
2160 before calling GetValue ().
2162 2005-02-01 Raja R Harinath <rharinath@novell.com>
2164 Fix test-334.cs (#69519).
2165 * cs-parser.jay (using_alias_directive): Pass in an expression to
2166 NamespaceEntry.UsingAlias.
2167 (using_namespace_directive): Pass in an expression to
2168 NamespaceEntry.Using.
2169 (namespace_name): Don't flatten to a string.
2170 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
2171 (NamespaceEntry.AliasEntry.Resolve): Lookup using
2173 (NamespaceEntry.UsingEntry): Likewise.
2174 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
2176 (NamespaceEntry.LookupForUsing): Remove.
2177 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
2179 (NamespaceEntry.Lookup): Remove support for dotted names.
2181 2005-02-01 Raja R Harinath <rharinath@novell.com>
2183 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
2185 (NamespaceEntry.ImplicitParent): Compute on demand.
2186 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
2187 parallels the current.
2188 (NamespaceEntry.LookupForUsing): Use it.
2189 (NamespaceEntry.Lookup): If the current namespace-entry is
2190 implicit, don't search aliases and using tables.
2192 2005-02-01 Raja R Harinath <rharinath@novell.com>
2195 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
2197 (TypeContainer.BaseCache): Compute on demand.
2198 (TypeContainer.FindMembers): Define constants and types if they're
2199 not already created.
2200 (FieldMember.Define): Move resetting of ec.InUnsafe before error
2202 * const.cs (Constant.Define): Make idempotent.
2204 2005-01-29 Miguel de Icaza <miguel@novell.com>
2206 * pending.cs: Produce better code (no nops produced by using Ldarg
2209 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
2210 i - 1' it should be arg + 1.
2214 2005-01-28 Raja R Harinath <rharinath@novell.com>
2216 * attribute.cs (Attribute.CheckAttributeType): Make private
2218 (Attribute.ResolveType): Make virtual.
2219 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
2220 handling of RootContext.Tree.Types.
2222 2005-01-27 Raja R Harinath <rharinath@novell.com>
2224 Update attribute-handling to use the SimpleName/MemberAccess
2226 * cs-parser.jay (attribute): Pass in an expression to the
2227 constructors of Attribute and GlobalAttribute.
2228 * attribute.cs (Attribute): Take an expression for the name.
2229 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
2230 passed in attribute name expression.
2231 (Attribute.CheckAttributeType): Use it.
2232 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
2233 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
2234 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
2235 argument to prevent error messages if the lookup fails.
2237 2005-01-27 Marek Safar <marek.safar@seznam.cz>
2239 * expression.cs (Indirection): Implemented IVariable interface
2240 to support indirection in AddressOf operator.
2241 (PointerArithmetic.Emit): Add optimalization for case where
2242 result can be precomputed.
2244 2005-01-26 Martin Baulig <martin@ximian.com>
2246 * class.cs (TypeContainer.AttributeTargets): Return the correct
2247 AttributeTargets depending on our `Kind' instead of throwing an
2248 exception; fixes #71632.
2250 2005-01-26 Marek Safar <marek.safar@seznam.cz>
2253 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
2256 2005-03-17 Martin Baulig <martin@ximian.com>
2258 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2259 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2261 2005-03-17 Martin Baulig <martin@ximian.com>
2263 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2264 to bool so we can return an error condition.
2265 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2268 2005-03-17 Martin Baulig <martin@ximian.com>
2270 * generic.cs (TypeMananager.IsIEnumerable): New public method.
2272 * convert.cs (Convert.ImplicitReferenceConversion(Exists)): Allow
2273 converting from an array-type of T to `IEnumerable<T>'.
2275 2005-03-16 Martin Baulig <martin@ximian.com>
2277 * generic.cs (Nullable.Unwrap): Implement IAssignMethod.
2278 (Nullable.LiftedUnaryMutator): New public class.
2280 * expression.cs (UnaryMutator.DoResolve): Added support for
2283 2005-03-14 Martin Baulig <martin@ximian.com>
2285 * generic.cs (Nullable.NullCoalescingOperator): Implemented.
2287 2005-03-14 Martin Baulig <martin@ximian.com>
2289 * generic.cs (Nullable.LiftedBinaryOperator): Added support for
2290 the comparision operators `<', `>', `<=' and `>='.
2292 2005-03-13 Martin Baulig <martin@ximian.com>
2295 (Nullable.NullLiteral): Renamed to `Nullable.NullableLiteral' to
2296 avoid confusion with the `NullLiteral'.
2297 (Nullable.LiftedBinaryOperator): Correctly implement `==' and '!='.
2299 2005-03-13 Martin Baulig <martin@ximian.com>
2301 * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
2302 comparing arbitrary types with the null literal.
2304 2005-03-13 Martin Baulig <martin@ximian.com>
2306 * generic.cs (Nullable.LiftedBinaryOperator): Add support for the
2307 boolean operators '&&', '||', '&' and '|'.
2308 (Nullable.OperatorTrueOrFalse): New public class.
2310 * ecore.cs (Expression.GetOperatorTrue/False): Return an `Expression'
2311 instead of a `StaticCallExpr'; added support for nullables.
2313 2005-03-10 Martin Baulig <martin@ximian.com>
2316 (ArrayAccess.EmitDynamicInitializers): Use `etype.IsValueType'
2317 rather than `etype.IsSubclassOf (TypeManager.value_type)'.
2319 2005-03-07 Martin Baulig <martin@ximian.com>
2321 * generic.cs (Nullable.Unwrap): Implement IMemoryLocation and make
2322 it work if `expr' is not an IMemoryLocation.
2323 (Nullable.Lifted): Implement IMemoryLocation.
2324 (Nullable.LiftedConversion.ResolveUnderlying): Use the correct
2327 2005-03-05 Martin Baulig <martin@ximian.com>
2329 * generic.cs (Nullable.Unwrap, Wrap): New protected classes.
2330 (Nullable.Lifted): New abstract class; rewrote the lifted conversions.
2331 (Nullable): Added support for lifted unary and binary operators.
2333 * expression.cs (Unary.DoResolve): Added support for nullable types.
2334 (Binary.DoResolve): Likewise.
2335 (Conditional.DoResolve): Likewise.
2337 2005-03-02 Martin Baulig <martin@ximian.com>
2339 * decl.cs (DeclSpace.SetParameterInfo): Make this virtual.
2341 * class.cs (ClassPart.SetParameterInfo): Override this.
2342 (PartialContainer.SetParameterInfo): Override this.
2343 (TypeContainer.CheckConstraints): New protected method.
2344 (PartialContainer.CheckConstraints): Override this and check
2345 whether the same contraints were specified in all parts of a
2346 partial generic type definition.
2347 (PartialContainer.UpdateConstraints): New public method.
2349 * generic.cs (TypeParameter.UpdateConstraints): New public method.
2351 2005-03-02 Martin Baulig <martin@ximian.com>
2353 Committing a patch from Carlos Alberto Cortez to fix #72887.
2355 * convert.cs (Convert.ExplicitReferenceConversionExists): Allow
2356 casts from `T []' to `int []'.
2358 2005-03-02 Martin Baulig <martin@ximian.com>
2360 * generic.cs (TypeManager.IsEqual): Make this symmetric.
2362 * expression.cs (Binary.ResolveOperator): When resolving a
2363 BinaryDelegate, use `TypeManager.IsEqual (l, r)' rather than just
2364 `=='. Fixes #71866. See gen-127.cs.
2366 2005-03-02 Martin Baulig <martin@ximian.com>
2368 * class.cs (TypeContainer.DoDefineMembers): We also need a default
2369 static constructor in static classes.
2371 2005-03-02 Martin Baulig <martin@ximian.com>
2374 (NullableType.Name, NullableType.FullName): Add a "?" to the name.
2375 (Nullable.LiftedConversion): Added support for user-defined
2378 * cs-tokenizer.cs (Tokenizer.PutbackCloseParens): New public method.
2380 * cs-parser.jay: Use ComposedCast everywhere instead of
2381 NullableType, so we don't need to check for NullableType
2383 (conditional_expression): Added `INTERR CLOSE_PARENS' rule for the
2384 case where we'll be resolved into a `parenthesized_expression_0'
2388 (Convert.UserDefinedConversion): Added nullable conversions.
2390 2005-02-28 Martin Baulig <martin@ximian.com>
2392 * generic.cs (TypeManager.IsNullableType): New static method.
2393 (Nullable): New abstract class.
2394 (Nullable.NullLiteral): New public class.
2395 (Nullable.LiftedConversion): New public class.
2397 * cs-parser.jay (non_expression_type): Changed `builtin_types' to
2398 `builtin_types opt_nullable'.
2401 (Convert.ImplicitConversionStandard): Added nullable conversions.
2402 (Convert.ExplicitConversionStandard): Likewise.
2403 (Convert.ExplicitConversion): Likewise.
2405 2005-02-26 Martin Baulig <martin@ximian.com>
2407 * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
2408 begin with a "?", for instance "?[]". Don't do a type lookup if
2411 2005-02-25 Martin Baulig <martin@ximian.com>
2413 The first part of Nullable Types :-)
2415 * generic.cs (NullableType): New public class.
2416 (NullCoalescingOperator): New public class.
2417 (TypeArguments.Resolve): Add a CS0306 check.
2419 * cs-parser.jay (opt_error_modifier): Removed, this was unused.
2420 (opt_nullable): New rule.
2421 (type): Added `opt_nullable' to `namespace_or_type_name',
2422 `builtin_types' and `pointer_type'.
2423 (array_type): Added `opt_nullable'.
2424 (opt_rank_specifier_or_nullable): New rule; this is the
2425 combination of `opt_rank_specifier' and `opt_nullable'.
2426 (opt_error): New rule; catch errors here.
2427 (nullable_type_or_conditional): New rule; we use this to check for
2428 nullable and still detect the conditional operator.
2429 (local_variable_type): Use `opt_rank_specifier_or_nullable'
2430 instead `opt_rank_specifier'.
2432 * expression.cs (ComposedCast.DoResolveAsTypeStep): Added support
2435 2005-02-24 Martin Baulig <martin@ximian.com>
2437 * README, README.Changes: Removed; they're old and obsolete.
2439 2005-02-22 Martin Baulig <martin@ximian.com>
2441 * generic.cs (TypeParameter.Resolve): If resolving the constraints
2442 returned an error, set `constraints' to null to avoid a crash
2444 (TypeParameter.ResolveType): Likewise.
2446 2005-02-22 Martin Baulig <martin@ximian.com>
2449 (Constraints.ResolveTypes): Protect against being called twice.
2450 (Constraints.CheckInterfaceMethod): Don't call ResolveTypes().
2451 (TypeParameter.ResolveType): New public method; calls
2452 constraints.ResolveTypes().
2453 (TypeParameter.DefineType): Moved constraints.ResolveType() out
2454 into the new ResolveType().
2455 (GenericMethod.Define): Call ResolveType() on all our
2458 2005-02-21 Martin Baulig <martin@ximian.com>
2461 (TypeManager.generic_nullable_type): New static public field.
2462 (TypeManager.InitGenericCoreType): Lookup "System.Nullable`1".
2465 (RootContext.ResolveCore): Resolve "System.Nullable`1".
2467 2005-02-15 Martin Baulig <martin@ximian.com>
2469 * generic.cs (ConstructedType.Constraints): Correctly check
2470 constraints if the argument type is a type parameter; fixes
2473 2005-02-02 Martin Baulig <martin@ximian.com>
2475 * delegate.cs (Delegate.DefineType): Report an internal error if
2476 TypeManager.multicast_delegate_type is null. See bug #72015 for
2479 2005-01-29 Miguel de Icaza <miguel@novell.com>
2481 * pending.cs: Produce better code (no nops produced by using Ldarg
2484 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
2485 i - 1' it should be arg + 1.
2489 2005-01-26 Martin Baulig <martin@ximian.com>
2491 * cs-parser.jay (indexer_declarator): Don't report an error if we
2492 have type parameters since we can be an explicit interface
2493 implementation; fixes #71449.
2495 2005-01-26 Martin Baulig <martin@ximian.com>
2497 * class.cs (TypeContainer.AttributeTargets): Return the correct
2498 AttributeTargets depending on our `Kind' instead of throwing an
2499 exception; fixes #71632.
2501 2005-01-26 Martin Baulig <martin@ximian.com>
2503 * delegate.cs (Delegate.DefineType): Correctly define our type
2504 parameters. Fixes #71483.
2506 2005-01-25 Raja R Harinath <rharinath@novell.com>
2509 * expression.cs (MemberAccess.DoResolve): Don't complain with
2510 cs0572 when the LHS of a member access has identical name and type
2513 2005-01-25 Marek Safar <marek.safar@seznam.cz>
2516 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
2518 Create custom PermissionSet only for PermissionSetAttribute.
2520 2005-01-24 Marek Safar <marek.safar@seznam.cz>
2523 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
2524 delegates in static class.
2526 2005-01-24 Martin Baulig <martin@ximian.com>
2528 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2529 merging an implicit block, just use its reachability.
2531 * statement.cs (Block.Resolve): Make the unreachable code check
2532 work wrt. implicit blocks; see test-337 from #63842.
2534 2005-01-21 Alp Toker <alp@atoker.com>
2536 * cs-parser.jay: destructor_declaration's container is PartialContainer
2537 not Class when partial types are used, so use Kind prop instead of
2540 2005-01-22 Miguel de Icaza <miguel@ximian.com>
2542 * cs-parser.jay: Improve error reporting when an interface
2545 2005-01-20 Dick Porter <dick@ximian.com>
2547 * support.cs: SeekableStreamReader fix from Sandor Dobos
2548 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
2549 chars are read. Fixes bug 70369.
2551 2005-01-20 Raja R Harinath <rharinath@novell.com>
2553 * cs-parser.jay (catch_clause): Simplify current_block handling
2556 2005-01-17 Miguel de Icaza <miguel@ximian.com>
2558 * convert.cs (ImplicitStandardConversionExists): Synchronize the
2559 code with ImplicitStandardConversion to handle the implicit
2560 conversion of method groups into valid delegate invocations.
2562 The problem is that in parameter handling we were using this code
2563 path. Fixes bug #64698
2565 2005-01-19 Raja R Harinath <rharinath@novell.com>
2567 * cs-parser.jay: Fix several infelicities.
2568 - Avoid assigning to the parser value stack. Code like
2569 '$3 = null' is unclean. Synthesize a value for the code block
2571 - Avoid using oob_stack for storing location information. Use ...
2572 (_mark_): ... this. New (empty) rule. Saves the current location
2574 (foreach_statement): Avoid using oob_stack for current_block
2575 handling. Use technique used in for_statement and
2576 using_statement. Synthesize a value for the code block to store
2577 additional intermediate information.
2579 2005-01-13 Miguel de Icaza <miguel@ximian.com>
2581 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
2582 of a different type is only allowed to private fields of a
2583 containing type, not on fields of a base class.
2585 See test-174.cs and error cs0122-9.cs
2587 2005-01-13 Raja R Harinath <rharinath@novell.com>
2589 Fix test-335.cs (bug #58126).
2590 * cs-parser.jay (argument): Split out non-expression parts of the
2591 rule into 'non_simple_argument'.
2592 (invocation_expression): Support parenthesized invocations with
2593 multiple arguments, and with single non-simple arguments.
2595 2005-01-13 Raja R Harinath <rharinath@novell.com>
2597 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
2600 2005-01-12 Raja R Harinath <rharinath@novell.com>
2602 Fix cs0038-1.cs, cs1640-6.cs.
2603 * ecore.cs (Expression.Resolve): Remove special-case for
2604 SimpleName in error-handling.
2605 (Expression.almostMatchedMembers): Relax access permission to
2607 (Expression.MemberLookupFailed): Handle duplicates in
2608 almostMatchedMembers list.
2609 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
2610 * expression.cs (New.DoResolve): Report CS1540 for more cases.
2611 * typemanager.cs (GetFullNameSignature): Use the MethodBase
2612 overload if the passed in MemberInfo is a MethodBase.
2614 2005-01-25 Martin Baulig <martin@ximian.com>
2617 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
2619 2005-01-12 Marek Safar <marek.safar@seznam.cz>
2622 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
2623 for non-CAS & merge permission sets properly.
2625 2005-01-11 Raja R Harinath <rharinath@novell.com>
2627 Improve standard-compliance of simple name and member access
2628 resolution. Fixes bugs #52697, #57200, #67520, #69519.
2629 * ecore.cs (FullNamedExpression): New abstract base class
2630 for Namespaces and TypeExpressions.
2631 (ResolveFlags.SimpleName): Remove.
2632 (SimpleName): Remove support for dotted names.
2633 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
2634 DeclSpace.FindType and DeclSpace.LookupType.
2635 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
2636 (Expression.ExprClassName): Make member function.
2637 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
2638 a namespace. Remove creation of dotted "SimpleName"s.
2639 (MemberAccess.DoResolve): Likewise.
2640 * decl.cs (DeclSpace.Cache): Make private.
2641 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
2642 (DeclSpace.FindType): Update.
2643 (DeclSpace.LookupType): Move here from RootContext. Return a
2644 FullNamedExpression.
2645 * namespace.cs (Namespace): Derive from FullNamedExpression
2646 so that it can be part of expression resolution.
2647 (Namespace.Lookup): Return an FullNamedExpression.
2648 (NamespaceEntry.LookupAlias): Lookup aliases only in current
2650 * rootcontext.cs (NamespaceLookup): Remove.
2651 (LookupType): Move to DeclSpace.
2652 * attribute.cs (CheckAttributeType): Update.
2653 * doc.cs (FindDocumentedType): Remove allowAlias argument.
2654 (FindDocumentedTypeNonArray): Likewise.
2656 2005-01-11 Raja R Harinath <rharinath@novell.com>
2658 Fix cs0509.cs, cs1632.cs.
2659 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
2660 is the same as IsInterface.
2661 (TypeContainer.GetClassBases): Likewise.
2662 * statement.cs (LabeledStatement.ig): New field.
2663 (LabeledStatement.LabelTarget): Save ILGenerator which created the
2665 (LabeledStatement.DoEmit): Check that the label was created with
2666 the same ILGenerator.
2668 2005-01-10 Marek Safar <marek.safar@seznam.cz>
2671 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
2672 accessors to its properties.
2674 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
2675 from accessors to property.
2677 2005-01-10 Marek Safar <marek.safar@seznam.cz>
2680 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
2683 2005-01-08 Miguel de Icaza <miguel@ximian.com>
2685 * attribute.cs: Check for null and empty strings.
2687 I have lost another battle to Paolo.
2689 2005-01-07 Marek Safar <marek.safar@seznam.cz>
2692 * class.cs (PropertyMethod): Set Parent field in ctors.
2693 (SetMethod.InternalParameters): Add unsafe switch hack.
2694 Override MarkForDuplicationCheck where it is appropriate.
2696 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
2697 It says whether container allows members with the same name.
2699 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
2700 Removed is_method parameter.
2702 2005-01-06 Duncan Mak <duncan@ximian.com>
2704 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
2705 because the previous change led to incorrect reporting of CS1032
2706 ("Cannot define/undefine preprocessor symbols after first token in
2707 file"). Instead of using `tokens_seen' as the only flag that
2708 triggers CS1040, introduce `comments_seen'. This new flag is used
2709 to signify having seen comments on the current line, so it is
2710 unset after a newline.
2712 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
2714 * doc.cs : When searching for a type, find nested type too.
2715 This fixes bug #71040.
2717 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
2720 - Warn missing member comment on those classes which also does not
2721 have doc comments. Fixed bug #71041.
2722 - Don't warn missing doc comment on default constructor.
2725 2005-01-06 Duncan Mak <duncan@ximian.com>
2727 * cs-tokenizer.cs (xtoken): After handling traditional C-style
2728 comments, set `tokens_seen' to true. This allows us to detect
2729 misplaced preprocessor directives (i.e. not at the beginning of
2730 the a line, nor after whitespaces). In that case, report error
2731 CS1040. This fixes bug #56460.
2733 * cs-parser.jay (interface_member_declaration): Add checks for
2734 IsExplicitImpl, and report CS0541 error if an interface member is
2735 defined as an explicit interface declaration.
2737 2005-01-06 Marek Safar <marek.safar@seznam.cz>
2740 * class.cs (PropertyMethod): Set Parent field in ctors.
2741 (SetMethod.InternalParameters): Add unsafe switch hack.
2743 * decl.cs (MemberCore.Parent): Cannot be readonly.
2745 2005-01-06 Raja R Harinath <rharinath@novell.com>
2747 * decl.cs (DeclSpace.ResolveType): Remove.
2748 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
2749 Merge in code from ...
2750 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
2751 * class.cs, enum.cs: Update to changes.
2753 2005-01-06 Miguel de Icaza <miguel@ximian.com>
2755 * anonymous.cs: Ensure that we init the scope of our parent if it
2756 has not been initialized yet.
2758 2004-12-30 Duncan Mak <duncan@ximian.com>
2760 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
2761 if field.FieldBuilder is null. Fixes #70758.
2763 * convert.cs: Fixed some typos and updated some of the comments.
2764 (ImplicitStandardConversionExists):
2765 (TryImplicitIntConversion): If `target_type' is an interface and
2766 the type of `ic' implements this interface, return true or a new
2767 BoxedCast instead of null. This fixes #70468.
2769 2004-12-29 Duncan Mak <duncan@ximian.com>
2771 * expression.cs (Argument.Emit): Check that Expr is
2772 IMemoryLocation before casting to it, and report CS1510 otherwise.
2776 2004-12-21 Ben Maurer <bmaurer@ximian.com>
2778 * statement.cs (Block.ThisVariable): remove the recursion here, to
2779 make the --profile more sane.
2781 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
2783 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
2784 assembly, by JB Evain.
2786 2004-12-17 Raja R Harinath <rharinath@novell.com>
2788 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
2789 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
2790 "parent" refers to enclosing type/class. "base" refers to superclass.
2792 2004-12-17 Raja R Harinath <rharinath@novell.com>
2794 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
2795 Ensure that we only have GlobalAttributes.
2796 * attribute.cs (Attribute.Emit): Make non-virtual.
2797 (GlobalAttribute.Emit): Remove.
2798 (Attribute.Resolve): Make virtual.
2799 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
2800 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
2801 the argument. Don't create one.
2802 (Attribute.GetObsoleteAttribute): Likewise.
2803 (Attribute.GetClsCompliantAttributeValue): Likewise.
2804 * class.cs, decl.cs: Update to changes.
2806 2004-12-17 Marek Safar <marek.safar@seznam.cz>
2808 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
2810 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
2812 * statement.cs (Foreach.Resolve): Add error 186 report.
2814 2004-12-16 Marek Safar <marek.safar@seznam.cz>
2816 * expression.cs (Conditional.DoResolve): Add warning 429.
2818 * statement.cs (If.Resolve): Add warning 665.
2820 2004-12-16 Raja R Harinath <rharinath@novell.com>
2822 New invariant: RootContext.Tree.Types.NamespaceEntry == null
2823 except when in the parser, and in GlobalAttribute.
2824 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
2825 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
2826 RootContext.Tree.Types.NamespaceEntry once work is done.
2827 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
2828 and resets RootContext.Tree.Types.NamespaceEntry.
2830 2004-12-15 Marek Safar <marek.safar@seznam.cz>
2832 * cs-parser.jay: Don't create a block for every variable.
2834 2004-12-14 Miguel de Icaza <miguel@ximian.com>
2836 * location.cs: Provide extra information.
2838 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
2839 variables from the captured environment, it is the ldarg_0.
2841 2004-12-14 Marek Safar <marek.safar@seznam.cz>
2843 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
2846 * class.cs: Changed warning level for 169 to avoid developer
2847 displeasure from warning flooding. It will be changed back when they
2848 fix most of current BCL warnings.
2850 * RootContext.cs: Pushed default WarningLevel to 3.
2852 * statement.cs: Removed unused variable.
2854 2004-12-14 Marek Safar <marek.safar@seznam.cz>
2856 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
2857 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
2858 Add error 502 report.
2859 (StaticClass.DefineType): Add error 441 report.
2860 (Class.AllowedModifiersProp): New virtual property as temporary
2861 extension to AllowedModifiers.
2862 (Class.DefineType): Add error 418 report. Moved ModFlags check here
2863 to share implementation with StaticClass and don't call virtual
2866 * driver.cs (MainDriver): Add error 1558 test.
2868 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
2869 report. Moved error 36 test here.
2871 * statement.cs (Throw.Resolve): Add error 724 report.
2873 * typemanager.cs: Add out_attribute_type core type.
2875 2004-12-13 Marek Safar <marek.safar@seznam.cz>
2877 * class.cs (TypeContainer.VerifyClsCompliance): Add error
2879 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
2881 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
2884 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
2886 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
2887 Add error 3023 report.
2888 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
2890 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
2893 2004-12-12 John Luke <john.luke@gmail.com>
2895 * driver.cs (AddArgs): take -- into account when
2896 adding arguments, fixes bug 65710
2898 2004-12-12 Martin Baulig <martin@ximian.com>
2900 * expression.cs (Unary.TryReduceNegative): Added support for
2901 SByteConstant and ByteConstant.
2902 (Unary.Reduce): Check error values from TryReduceNegative().
2904 2004-12-10 Marek Safar <marek.safar@seznam.cz>
2906 * attributes.cs (Attribute.Resolve): Avoid multiple error report
2907 and report exception as error 182.
2909 2004-12-10 Raja R Harinath <rharinath@novell.com>
2911 * driver.cs (Main): Fix message when there are warnings.
2913 2004-12-09 Miguel de Icaza <miguel@ximian.com>
2915 * delegate.cs: Fixed my fix from yesterday, sorry about that.
2917 2004-12-09 Marek Safar <marek.safar@seznam.cz>
2919 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
2920 Reduced number of warnings.
2922 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
2924 2004-12-08 Miguel de Icaza <miguel@ximian.com>
2926 * driver.cs: Removed message.
2928 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
2930 2004-12-08 <vargaz@freemail.hu>
2932 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
2934 2004-12-08 Martin Baulig <martin@ximian.com>
2936 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
2937 instead of a CS3002 for properties and indexer.
2939 2004-12-08 Martin Baulig <martin@ximian.com>
2941 * decl.cs (MemberName.ToString): Make this work again.
2943 2004-12-08 Marek Safar <marek.safar@seznam.cz>
2945 * attribute.cs (Resolve): Add error 591 detection.
2947 * class.cs (FieldMember.Define): Add error 1547 detection.
2948 (Indexer.Define): Add error 620 detection.
2949 (Operator.Define): Add error 590 detection.
2951 * ecore.cs: Missing argument for error 79.
2953 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
2956 2004-12-07 Marek Safar <marek.safar@seznam.cz>
2959 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
2962 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
2964 * cs-parser.jay : handle doc comments on implicit/explicit operators.
2965 Some operator comments were suppressed.
2966 * doc.cs : Implicit/explicit operator name in doc comments are like
2967 "op_Explicit(type)~returnType", so added suffix handling.
2969 2005-01-21 Alp Toker <alp@atoker.com>
2971 * cs-parser.jay: destructor_declaration's container is PartialContainer
2972 not Class when partial types are used, so use Kind prop instead of 'is'.
2974 2004-12-12 Martin Baulig <martin@ximian.com>
2976 * expression.cs (Unary.TryReduceNegative): Added support for
2977 SByteConstant and ByteConstant.
2978 (Unary.Reduce): Check error values from TryReduceNegative().
2980 2004-12-11 Martin Baulig <martin@ximian.com>
2982 * support.cs (ReflectionParameters.ParameterName): If we have a
2983 `gpd', call `ParameterName' on it.
2985 * parameter.cs (Parameter.GetParameterAttributes): New static method.
2987 * pending.cs (PendingImplementation.DefineProxy): Call
2988 DefineParameter() for all of the MethodBuilder's arguments.
2990 2004-12-09 Martin Baulig <martin@ximian.com>
2992 * doc.cs (DocUtil): Make this a static class.
2994 2004-12-09 Martin Baulig <martin@ximian.com>
2996 * expression.cs (Invocation.InferType): Moved the type inference
2997 implementation into TypeManager.
2999 * generics.cs (TypeManager): Moved the type inference
3000 implementation here.
3002 2004-12-09 Martin Baulig <martin@ximian.com>
3004 * typemanager.cs (TypeManager): Make this a partial class.
3007 (TypeManager): Move the generics part of `TypeManager' here.
3009 2004-12-08 Martin Baulig <martin@ximian.com>
3011 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
3012 instead of a CS3002 for properties and indexer. Added CS3024
3013 check for generic interfaces.
3015 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
3016 instances are not CLS-compliant.
3018 2004-12-08 Martin Baulig <martin@ximian.com>
3021 (void_pointer_expression): New rule for `void*', `void**' etc.
3022 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
3024 2004-12-08 Martin Baulig <martin@ximian.com>
3026 * expression.cs (Invocation.InferType): Removed the hack for
3027 MethodCore.MayUnify().
3029 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
3032 * class.cs (MethodCore.MayUnify): Use
3033 TypeManager.MayBecomeEqualGenericTypes().
3035 2004-12-08 Martin Baulig <martin@ximian.com>
3037 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
3038 parameter, box it. Fixes #69233.
3040 2004-12-08 Martin Baulig <martin@ximian.com>
3042 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
3043 have the ctor constraint. Fixes #68326.
3045 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
3047 * cs-parser.jay : interface comment was not consumed because of
3048 extra opt_semicolon before doc handling.
3050 2004-12-03 Raja R Harinath <rharinath@novell.com>
3052 Fix test-327.cs, test-328.cs, and put in early infrastructure
3053 for eventually fixing #52697.
3054 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
3055 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
3057 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
3058 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
3059 (VerifyUsing, error246): Update.
3060 * rootcontext.cs (RootContext.NamespaceLookup): Just use
3061 'NamespaceEntry.LookupNamespaceOrType'.
3063 2004-12-07 Martin Baulig <martin@ximian.com>
3065 * driver.cs: Call it "BETA SOFTWARE" :-)
3067 2004-12-06 Raja R Harinath <rharinath@novell.com>
3069 Fix crash on cs0657-17.cs.
3070 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3071 Use RootContext.Tree.Types, not 'new RootTypes ()'.
3072 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
3073 the case where the NamespaceEntry gets overwritten.
3075 2004-12-06 Marek Safar <marek.safar@seznam.cz>
3077 Fixed #69195, #56821
3078 * ecore.cs (ResolveBoolean): Tiny refactoring.
3080 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
3081 of right expression resolving when left is false constant and
3082 operator is LogicalAnd OR true constant and operator is LogicalOr.
3084 * statement.cs (ResolveUnreachable): Always reports warning.
3086 2004-12-05 Miguel de Icaza <miguel@ximian.com>
3088 * class.cs: Distinguish between 1721 and 1722 (just a little help
3089 for the programmer).
3091 2004-12-03 Miguel de Icaza <miguel@ximian.com>
3093 * delegate.cs: Only allow this on new versions of the language.
3095 2004-12-02 Duncan Mak <duncan@ximian.com>
3097 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
3099 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
3100 here as a static method. Take an additional bool out parameter
3101 `must_do_cs1540_check' for signaling to InstanceResolve.
3102 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
3103 member field from PropertyExpr class and made it an argument of
3105 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
3106 check for MarshalByRefObject, and report CS0122 instead of CS1540.
3107 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
3108 and `remove_accessor' as well as InstanceResolve: report CS0122
3113 2004-12-07 Martin Baulig <martin@ximian.com>
3115 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
3116 and CS0692 where appropriate.
3118 2004-12-06 Martin Baulig <martin@ximian.com>
3120 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
3121 IsDuplicateImplementation() and improved it.
3123 * expression.cs (Invocation.InferTypeArguments): Added
3124 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
3125 and removed the "ref" modifier from `infered_types'.
3127 * decl.cs (MemberName.ToString): Removed the exception.
3129 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
3131 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
3132 comments are allowed.
3134 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3136 * delegate.cs: Add checks for subtypes in paramaters and return values
3137 in VerifyMethod () to add support for Covariance/Contravariance
3140 2004-12-02 Miguel de Icaza <miguel@ximian.com>
3142 * report.cs: Remove extra closing parenthesis.
3144 * convert.cs (Error_CannotImplicitConversion): If the name of the
3145 types are the same, provide some extra information.
3147 2004-12-02 Marek Safar <marek.safar@seznam.cz>
3150 * attribute.cs (Resolve): Improved implementation of params
3151 attribute arguments.
3153 * support.cs (ParameterData): Add HasParams to be faster.
3155 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
3157 all things are for /doc support:
3159 * doc.cs: new file that supports XML documentation generation.
3160 * mcs.exe.sources: added doc.cs.
3162 Handle /doc command line option.
3163 Report error 2006 instead of 5 for missing file name for /doc.
3164 Generate XML documentation when required, after type resolution.
3166 Added support for picking up documentation (/// and /** ... */),
3167 including a new XmlCommentState enumeration.
3169 Added lines to fill Documentation element for field, constant,
3170 property, indexer, method, constructor, destructor, operator, event
3171 and class, struct, interface, delegate, enum.
3172 Added lines to warn incorrect comment.
3174 Added Documentation field (passed only when /doc was specified).
3176 Added DocComment, DocCommentHeader, GenerateDocComment() and
3177 OnGenerateDocComment() and some supporting private members for
3178 /doc feature to MemberCore.
3180 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
3182 Added overriden DocCommentHeader.
3184 Added overriden DocCommentHeader and GenerateDocComment().
3186 2004-12-01 Miguel de Icaza <miguel@ximian.com>
3188 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
3189 unwrapping the enumeration values, chain to
3190 DoConstantNumericPromotions again, so we can promote things to the
3191 fundamental types (takes care of enums that are bytes, sbytes).
3195 2004-12-01 Raja R Harinath <rharinath@novell.com>
3197 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
3198 Fix long-standing bug in type-lookup. Use FindType instead of
3199 LookupType when ec.ResolvingTypeTree.
3200 (Attribute.ResolveType, Attribute.Resolve)
3201 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
3203 (Attributes.Search): Remove internal version. Update.
3204 (Attributes.SearchMulti): Update.
3205 (Attributes.GetClsCompliantAttribute): Remove.
3206 (Attributes.GetIndexerNameAttribute): Remove.
3207 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
3208 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
3209 * class.cs (Indexer.Define): Likewise.
3211 2004-12-01 Marek Safar <marek.safar@seznam.cz>
3214 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
3215 MarshallByReference members access.
3217 * expression.cs: Use CheckMarshallByRefAccess;
3218 Better error CS0197 message.
3220 * report.cs: Print whole related error message.
3222 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3224 * class (GetClassBases): Better error 60 report.
3225 (EventProperty): Disabled warning 67 detection.
3227 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3230 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
3232 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
3235 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3238 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
3240 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
3242 2004-11-26 Miguel de Icaza <miguel@ximian.com>
3244 * attribute.cs (Attribute.Resolve): Refine error reporting and
3245 report a cs0117 if the identifier does not exist, to distinguish
3246 from 0617 which is a miss-use of the actual identifier.
3248 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
3249 between cs0070 and cs0079.
3251 * class.cs (MemberBase.DoDefine): When reporting a wrong
3252 accessibility level, we use MethodCore to compare instead of
3253 Method (this was a regression in some refactoring effort).
3255 So now we correctly report cs0056 again.
3257 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
3258 testing the target_type (which was known to be object_type) and
3259 not the source type (which is anonymous_method).
3261 Fixed reporting of error cs1660.
3263 * expression.cs (UserCast.Source): Expose the underlying cast.
3265 * statement.cs (Switch.SwitchGoverningType): Sort the list of
3266 allowed types to find a match to int32 first (most common).
3268 In addition, it ignores any ImplicitUserConversions that did an
3269 internal implicit conversion (as the switch statement allows only
3270 one integral conversion to exist).
3272 * class.cs (PartialContainer.Create): rename `name' to
3273 `member_name' for clarity. Then replace the string calls with a
3274 call to MemberName.GetPartialName, as now using
3275 MemberName.ToString is an error (this is due to the side effects
3276 it had, that were fixed in the past).
3278 This will restore the error reporting on a number of partial class
3279 errors that were missusing this (and getting an exception as a
3280 results, which is now just a plain textual warning, because
3281 yyparse debug output would crash otherwise).
3283 2004-11-26 Raja R Harinath <rharinath@novell.com>
3285 * Makefile (PROGRAM_INSTALL_DIR): Remove.
3287 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3289 * rootcontext.cs (LookupType): Make sure to cache lookups that
3290 don't give us a negative result. This saves about 5% of corlib
3293 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3295 * report.cs (AbstractMessage.Print): messages are sent to stderr
3297 * class.cs (TypeContainer.GetClassBases): It is an error to have a
3298 non-interface in the list of interfaces (at this point, either
3299 parent was properly set, or a base class is being listed in the
3300 interfaces section).
3302 This flags error 1722, and resolves the crash from bug 69259.
3304 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3306 * statement.cs (Using.EmitExpressionFinally): make this work right
3307 for valuetypes. Fixes 69926.
3309 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3311 * const.cs (Const.ChangeType): Cope with the "0 literal can be
3312 converted to an enum" here, before we try to change the underlying
3313 type. This code exists, but it is a different code path than the
3314 one used while encoding constants.
3316 (ImplicitReferenceConversionExists): In addition, resynchronized
3317 the code here, so it matches the same code in
3318 ImplicitReferenceConversionExists for the `from any class-type S
3319 to any interface-type T'.
3321 2004-11-25 Marek Safar <marek.safar@seznam.cz>
3323 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
3325 2004-11-24 Miguel de Icaza <miguel@ximian.com>
3327 * cs-parser.jay: Use verbosity accordingly.
3329 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3331 * expression.cs (Unary.ResolveOperator): Do not report warning;
3332 AddressOf reads from variable.
3334 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
3336 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3340 * attribute.cs (Attributable): Removed CheckTargets.
3341 (Attributes.Emit): Explicit attribute targets are tested here.
3343 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
3344 not enabled for interfaces.
3346 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
3347 (GetAssemblyName): Ouch next bug there.
3349 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3351 * expression.cs: Error 275 added.
3353 2004-11-23 Marek Safar <marek.safar@seznam.cz>
3355 Fix bug #69177 (Implemented decimal constant support)
3357 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
3358 (BinaryFold): Add DecimalConstant.
3360 * const.cs (Define): Decimal constant
3362 (ChangeType): Add decimal type handling.
3363 (LookupConstantValue): Don't set value for decimal type but
3364 emit DecimalConstantAttribute. Needed for constant optimization.
3366 * constant.cs (ToDecimal): New method.
3367 (ConvertToDecimal): New method.
3368 (IntConstant): Implemented ConvertToDecimal.
3369 (DecimalConstant.Emit): Emit optimized version for decimals in
3372 * expression.cs (ResolveOperator): Changed order of constant
3373 reduction to work correctly with native types which have
3374 overloaded operators.
3375 (ResolveMemberAccess): Extract constant value from attribute
3378 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
3380 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
3381 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
3382 (ChangeType): Decimal is special.
3383 (TypeToCoreType): Add decimal type.
3385 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3387 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
3390 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3392 * class.cs (EventField.ApplyAttributeBuilder): Fix error
3395 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3397 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
3399 * pending.cs (PendingImplementation): Grab only interfaces.
3401 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3403 * statement.cs (ForeachHelperMethods): Add location member and
3404 error 202 detection.
3406 2004-11-18 Marek Safar <marek.safar@seznam.cz>
3408 * expression.cs (DoResolveBase): Fixed wrong warning for out
3411 2004-12-04 Martin Baulig <martin@ximian.com>
3413 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
3414 to check whether the conversion is ok.
3416 * typemanager.cs (TypeManager.GetTypeArguments): Just return
3417 `Type.EmptyTypes' if we're not a generic TypeContainer.
3419 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3421 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
3422 old bug: when converting from the null literal to a pointer,
3423 return an EmptyCast, not the NullLiteral.
3425 This fixes #69921, the recent null_type changes probably made this
3428 2004-12-03 Martin Baulig <martin@ximian.com>
3430 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3431 method as our child, call AnonymousMethod.Compatible() on it.
3433 2004-12-02 Miguel de Icaza <miguel@ximian.com>
3435 * class.cs (FieldBase): Use an unused bit field from the field to
3436 encode the `has_offset' property from the FieldMember. This saves
3437 a couple of Ks on bootstrap compilation.
3439 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3440 method as our child, return the AnonymousMethod resolved
3443 * expression.cs (New.DoResolve): Allow return values from
3444 NewDelegate to also include AnonymousMethods.
3448 2004-11-29 Raja R Harinath <rharinath@novell.com>
3450 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
3452 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
3453 System.Runtime.InteropServices._Exception, since it's a base
3454 interface of the core type System.Exception in the net_2_0 profile.
3456 2004-11-27 Martin Baulig <martin@ximian.com>
3458 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
3460 2004-11-26 Raja R Harinath <rharinath@novell.com>
3462 * Makefile: Convert to use executable.make.
3463 * gmcs.exe.sources: New.
3465 2004-11-25 Martin Baulig <martin@ximian.com>
3467 * expression.cs (Invocation.InferType): Added support for byref types.
3469 2004-11-25 Martin Baulig <martin@ximian.com>
3471 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
3472 in TypeManager.TypeToCoreType().
3474 2004-11-25 Martin Baulig <martin@ximian.com>
3476 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
3477 "Dispose" method from the `current_type'.
3478 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
3479 DoDefineMembers() instead of using the MethodBuilder; this is
3480 required for generic iterators.
3482 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
3484 2004-11-24 Martin Baulig <martin@ximian.com>
3486 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
3488 2004-11-20 Martin Baulig <martin@ximian.com>
3490 * expression.cs (Invocation.InferType): Correctly infer generic
3491 instances; see gen-103.cs.
3492 (Invocation.InferTypeArguments): If a generic method doesn't have
3493 any unbound type parameters, we don't need to infer anything.
3495 2004-11-19 Raja R Harinath <rharinath@novell.com>
3497 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
3499 2004-11-17 Raja R Harinath <rharinath@novell.com>
3501 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
3502 (TypeHandle.GetMemberCache): New.
3503 (TypeHandle.TypeHandle): Update.
3504 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
3505 (TypeManager.LookupParentInterfacesCache):
3506 Rename from LookupInterfaceCache. Optimize slightly.
3507 (TypeManager.MemberLookup_FindMembers): Update.
3508 * decl.cs (MemberCache.MemberCache): Set Container to null in the
3510 (AddCacheContents): Rename from AddHashtable.
3511 * class.cs (TypeContainer.parent_container): Remove.
3512 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
3513 (TypeContainer.DoDefineMembers): Don't initialize it.
3514 Update to name changes.
3516 2004-11-17 Miguel de Icaza <miguel@ximian.com>
3518 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
3519 that factors the code to check access modifiers on override.
3521 (PropertyBase): Use the code here.
3523 Patch from Lluis S'anchez, fixes bug #69361.
3525 2004-11-15 Miguel de Icaza <miguel@ximian.com>
3527 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
3528 routine that is used to report the use of a captured variable
3529 whose address has been taken.
3531 There are two checks: one when variables are being captured and
3532 the other check is when the address of a variable is taken.
3534 (because an anonymous methods might be resolved before *or* after
3535 the address has been taken) and
3537 * expression.cs (Conditional.DoResolve): Remove the special
3538 casing that Martin added to trueExpr and falseExpr being both
3539 NullLiteral. We get the right behavior now just by introducing
3540 the null_type into the compiler.
3542 * convert.cs (ExplicitConversion): Change the code to use
3543 null_type instead of testing `expr is NullLiteral'.
3544 (ImplicitConversionStandard): use null_type too.
3545 (ImplicitReferenceConversionExists): use null_type too.
3546 (ImplicitReferenceConversion): use null_type too.
3548 * literal.cs: The type of `NullLiteral' is now null_type instead
3550 (Resolve): Set the type here.
3552 * typemanager.cs: Introduce null_type.
3554 2004-11-18 Martin Baulig <martin@ximian.com>
3557 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
3559 2004-11-18 Martin Baulig <martin@ximian.com>
3561 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
3563 2004-11-18 Martin Baulig <martin@ximian.com>
3565 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
3566 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
3567 call ResolveConstructedType() on it to resolve it without checking
3569 (Constraints.ResolveTypes): Check them here.
3570 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
3571 but don't check constraints.
3572 (ConstructedType.ResolveAsTypeTerminal): Override this and also
3573 check constraints here.
3574 (ConstructedType.ResolveConstructedType): New public method. This
3575 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
3576 resolve ourselves without checking constraints.
3578 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
3580 2004-11-18 Martin Baulig <martin@ximian.com>
3583 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
3585 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
3587 2004-11-18 Martin Baulig <martin@ximian.com>
3589 * ecore.cs (TypeExpr.ResolveType): Removed.
3590 (Expression.ResolveAsTypeTerminal): We always return a fully
3591 resolved `TypeExpr', so we can just access its `Type'.
3593 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
3595 2004-11-17 Martin Baulig <martin@ximian.com>
3597 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
3598 sure we don't return any unresolved TypeExpr's.
3599 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
3601 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
3603 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
3604 unresolved `ConstructedType's.
3606 2004-11-17 Martin Baulig <martin@ximian.com>
3608 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
3610 2004-11-17 Martin Baulig <martin@ximian.com>
3613 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
3615 * decl.cs (DeclSpace.ResolveType): Removed.
3616 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
3618 2004-11-17 Martin Baulig <martin@ximian.com>
3620 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
3621 direction, like FindMembers() does. Fixes #69546, testcase is in
3624 2004-11-16 Martin Baulig <martin@ximian.com>
3626 This is based on a patch from Marek Safar, see bug #69082.
3627 Fixes bugs #63705 and #67130.
3629 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
3630 method; create a MemberCache for an interface type and cache the
3633 * decl.cs (IMemberContainer.ParentContainer): Removed.
3634 (IMemberContainer.ParentCache): New property.
3635 (MemberCache.SetupCacheForInterface): Removed.
3636 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
3637 to create a cache for an interface's "parent".
3639 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
3642 2004-11-14 Ben Maurer <bmaurer@ximian.com>
3644 * statement.cs: Avoid adding bools to a hashtable.
3646 2004-11-15 Martin Baulig <martin@ximian.com>
3648 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
3650 2004-11-11 Martin Baulig <martin@ximian.com>
3652 * typemanager.cs (TypeManager.GetMethodName): New method.
3654 * class.cs (MethodData.Define): Include the generic arity in the
3655 name of an explicit interface; also add it to the method name.
3657 * pending.cs (PendingImplementation.InterfaceMethod): The method
3658 name now includes the generic arity.
3660 2004-11-07 Miguel de Icaza <miguel@ximian.com>
3662 * expression.cs (Invocation.OverloadResolve): Flag error if we are
3663 calling an unsafe method from a safe location.
3665 2004-11-06 Marek Safar <marek.safar@seznam.cz>
3668 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
3670 2004-11-06 Miguel de Icaza <miguel@ximian.com>
3672 * namespace.cs (VerifyUsing): use GetPartialName instead of
3675 2004-11-05 Miguel de Icaza <miguel@ximian.com>
3677 * statement.cs (Return.Resolve): Fix regression in typo: if
3678 `in_exc', we have to request a NeedReturnLabel, this was a typo
3679 introduced in the anonymous method check-in. Fixes #69131.
3681 * Indexers were using the ShortName when defining themselves,
3682 causing a regression in the compiler bootstrap when applying the
3683 patch from 2004-11-02 (first part), now they use their full name
3684 and the bug is gone.
3686 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
3688 * driver.cs: Strip the path from the names of embedded resources. Fixes
3691 2004-11-04 Raja R Harinath <rharinath@novell.com>
3693 Fix error message regression: cs0104-2.cs.
3694 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
3695 (AliasEntry.Resolve): Update.
3696 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
3698 (RootContext.LookupType): Update.
3700 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
3702 * cs-parser.jay: Add support for handling accessor modifiers
3703 * class: Add support port accessor modifiers and error checking,
3704 define PropertyMethod.Define as virtual (not abstract anymore)
3705 * ecore.cs: Add checking for proeprties access with access modifiers
3706 * iterators.cs: Modify Accessor constructor call based in the modified
3708 2004-11-02 Ben Maurer <bmaurer@ximian.com>
3710 * expression.cs (StringConcat): Handle being called twice,
3711 as when we have a concat in a field init with more than two
3714 2004-11-02 Miguel de Icaza <miguel@ximian.com>
3716 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
3717 special case explicit implementations, we should always produce
3718 the .property or .event declaration.
3720 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
3721 since it will not return correct data if people use this
3722 unresolved in the presence of using statements (see test-313).
3724 * class.cs (MethodData.Define): If we are an explicit interface
3725 implementation, set the method name to the full name of the
3726 interface plus the name of the method.
3728 Notice that using the method.MethodName.GetFullName() does not
3729 work, as it will only contain the name as declared on the source
3730 file (it can be a shorthand in the presence of using statements)
3731 and not the fully qualifed type name, for example:
3735 class D : ICloneable {
3736 object ICloneable.Clone () {
3740 Would produce a method called `ICloneable.Clone' instead of
3741 `System.ICloneable.Clone'.
3743 * namespace.cs (Alias.Resolve): Use GetPartialName.
3745 2004-11-01 Marek Safar <marek.safar@seznam.cz>
3747 * cs-parser.jay: Add error 1055 report.
3749 2004-11-01 Miguel de Icaza <miguel@ximian.com>
3751 * assign.cs (Assign.DoResolve): Only do the transform of
3752 assignment into a New if the types are compatible, if not, fall
3753 through and let the implicit code deal with the errors and with
3754 the necessary conversions.
3756 2004-11-01 Marek Safar <marek.safar@seznam.cz>
3758 * cs-parser.jay: Add error 1031 report.
3760 * cs-tokenizer.cs: Add location for error 1038.
3762 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3764 * cs-parser.jay: Add error 1016 report.
3766 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3768 * cs-parser.jay: Add errors 1575,1611 report.
3770 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3772 * cs-parser.jay: Add error 1001 report.
3774 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3777 * attribute.cs (GetMarshal): Add method argument for
3778 caller identification.
3780 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
3781 agument for GetMarshal and RuntimeMissingSupport.
3783 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3785 * attribute.cs (ExtractSecurityPermissionSet): Removed
3786 TypeManager.code_access_permission_type.
3788 * typemanager.cs: Removed TypeManager.code_access_permission_type.
3790 2004-10-27 Miguel de Icaza <miguel@ximian.com>
3792 * expression.cs (LocalVariableReference.DoResolveLValue): Check
3793 for obsolete use of a variable here. Fixes regression on errors
3794 cs0619-25 and cs0619-26.
3796 2004-10-27 Marek Safar <marek.safar@seznam.cz>
3798 Fix #62358, implemented security attribute encoding.
3800 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
3801 Tests permitted SecurityAction for assembly or other types.
3802 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
3803 data from SecurityPermissionAttribute to PermisionSet class.
3805 * class.cs (ApplyAttributeBuilder): Added special handling
3806 for System.Security.Permissions.SecurityAttribute based types.
3808 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
3809 special handling for System.Security.Permissions.SecurityAttribute
3812 * enum.cs (ApplyAttributeBuilder): Added special handling
3813 for System.Security.Permissions.SecurityAttribute based types.
3815 * parameter.cs (ApplyAttributeBuilder): Added special handling
3816 for System.Security.Permissions.SecurityAttribute based types.
3818 * rootcontext.cs: Next 2 core types.
3820 * typemanager.cs (TypeManager.security_permission_attr_type):
3821 Built in type for the SecurityPermission Attribute.
3822 (code_access_permission_type): Build in type.
3824 2004-10-17 Miguel de Icaza <miguel@ximian.com>
3826 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
3827 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
3828 all of this information into
3829 EmitContext.EmitCapturedVariableInstance.
3831 * codegen.cs (EmitCapturedVariableInstance): move here the
3832 funcionality of emitting an ldarg.0 in the presence of a
3833 remapping. This centralizes the instance emit code.
3835 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
3836 then emit a load of this: it means that we have reached the
3837 topmost ScopeInfo: the one that contains the pointer to the
3838 instance of the class hosting the anonymous method.
3840 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
3841 captures to the topmost CaptureContext.
3843 2004-10-12 Miguel de Icaza <miguel@ximian.com>
3845 * expression.cs (LocalVariableReference): Move the knowledge about
3846 the iterators into codegen's EmitCapturedVariableInstance.
3848 2004-10-11 Miguel de Icaza <miguel@ximian.com>
3850 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
3851 all code paths return a value from an anonymous method (it is the
3852 same as the 161 error, but for anonymous methods).
3854 2004-10-08 Miguel de Icaza <miguel@ximian.com>
3856 The introduction of anonymous methods in the compiler changed
3857 various ways of doing things in the compiler. The most
3858 significant one is the hard split between the resolution phase
3859 and the emission phases of the compiler.
3861 For instance, routines that referenced local variables no
3862 longer can safely create temporary variables during the
3863 resolution phase: they must do so from the emission phase,
3864 since the variable might have been "captured", hence access to
3865 it can not be done with the local-variable operations from the runtime.
3869 (Block.Flags): New flag `IsTopLevel' to indicate that this block
3870 is a toplevel block.
3872 (ToplevelBlock): A new kind of Block, these are the blocks that
3873 are created by the parser for all toplevel method bodies. These
3874 include methods, accessors and anonymous methods.
3876 These contain some extra information not found in regular blocks:
3877 A pointer to an optional CaptureContext (for tracking captured
3878 local variables and parameters). A pointer to the parent
3881 (Return.Resolve): Catch missmatches when returning a value from an
3882 anonymous method (error 1662).
3883 Invoke NeedReturnLabel from the Resolve phase instead of the emit
3886 (Break.Resolve): ditto.
3888 (SwitchLabel): instead of defining the labels during the
3889 resolution phase, we now turned the public ILLabel and ILLabelCode
3890 labels into methods called GetILLabelCode() and GetILLabel() that
3891 only define the label during the Emit phase.
3893 (GotoCase): Track the SwitchLabel instead of the computed label
3894 (its contained therein). Emit the code by using
3895 SwitchLabel.GetILLabelCode ().
3897 (LocalInfo.Flags.Captured): A new flag has been introduce to track
3898 whether the Local has been captured or not.
3900 (LocalInfo.IsCaptured): New property, used to tell whether the
3901 local has been captured.
3903 * anonymous.cs: Vastly updated to contain the anonymous method
3906 The main classes here are: CaptureContext which tracks any
3907 captured information for a toplevel block and ScopeInfo used to
3908 track the activation frames for various local variables.
3910 Each toplevel block has an optional capture context associated
3911 with it. When a method contains an anonymous method both the
3912 toplevel method and the anonymous method will create a capture
3913 context. When variables or parameters are captured, they are
3914 recorded on the CaptureContext that owns them, for example:
3918 MyDelegate d = delegate {
3923 Here `a' will be recorded as captured on the toplevel
3924 CapturedContext, the inner captured context will not have anything
3925 (it will only have data if local variables or parameters from it
3926 are captured in a nested anonymous method.
3928 The ScopeInfo is used to track the activation frames for local
3929 variables, for example:
3931 for (int i = 0; i < 10; i++)
3932 for (int j = 0; j < 10; j++){
3933 MyDelegate d = delegate {
3938 At runtime this captures a single captured variable `i', but it
3939 captures 10 different versions of the variable `j'. The variable
3940 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
3941 recorded on a child.
3943 The toplevel ScopeInfo will also track information like the `this'
3944 pointer if instance variables were referenced (this is necessary
3945 as the anonymous method lives inside a nested class in the host
3946 type of the method).
3948 (AnonymousMethod): Expanded to track the Toplevel, implement
3949 `AnonymousMethod.Compatible' to tell whether an anonymous method
3950 can be converted to a target delegate type.
3952 The routine now also produces the anonymous method content
3954 (AnonymousDelegate): A helper class that derives from
3955 DelegateCreation, this is used to generate the code necessary to
3956 produce the delegate for the anonymous method that was created.
3958 * assign.cs: API adjustments for new changes in
3959 Convert.ImplicitStandardConversionExists.
3961 * class.cs: Adjustments to cope with the fact that now toplevel
3962 blocks are of type `ToplevelBlock'.
3964 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
3965 insteda of standard blocks.
3967 Flag errors if params arguments are passed to anonymous methods.
3969 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
3970 `CurrentAnonymousMethod' which points to the current Anonymous
3971 Method. The variable points to the AnonymousMethod class that
3972 holds the code being compiled. It is set in the new EmitContext
3973 created for the anonymous method.
3975 (EmitContext.Phase): Introduce a variable and an enumeration to
3976 assist in enforcing some rules about when and where we are allowed
3977 to invoke certain methods (EmitContext.NeedsReturnLabel is the
3978 only one that enfonces this right now).
3980 (EmitContext.HaveCaptureInfo): new helper method that returns
3981 whether we have a CapturedContext initialized.
3983 (EmitContext.CaptureVariable): New method used to register that a
3984 LocalInfo must be flagged for capturing.
3986 (EmitContext.CapturedParameter): New method used to register that a
3987 parameters must be flagged for capturing.
3989 (EmitContext.CapturedField): New method used to register that a
3990 field must be flagged for capturing.
3992 (EmitContext.HaveCapturedVariables,
3993 EmitContext.HaveCapturedFields): Return whether there are captured
3994 variables or fields.
3996 (EmitContext.EmitMethodHostInstance): This is used to emit the
3997 instance for the anonymous method. The instance might be null
3998 (static methods), this (for anonymous methods that capture nothing
3999 and happen to live side-by-side with the current method body) or a
4000 more complicated expression if the method has a CaptureContext.
4002 (EmitContext.EmitTopBlock): Routine that drives the emission of
4003 code: it will first resolve the top block, then emit any metadata
4004 and then emit the code. The split is done so that we can extract
4005 any anonymous methods and flag any captured variables/parameters.
4007 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
4008 during this phase, the ILGenerator should not be used as labels
4009 and local variables declared here might not be accessible to any
4010 code that is part of an anonymous method.
4012 Exceptions to this include the temporary variables that are
4013 created by some statements internally for holding temporary
4016 (EmitContext.EmitMeta): New routine, in charge of emitting all the
4019 (EmitContext.TemporaryReturn): This method is typically called
4020 from the Emit phase, and its the only place where we allow the
4021 ReturnLabel to be defined other than the EmitMeta. The reason is
4022 that otherwise we would have to duplicate a lot of logic in the
4023 Resolve phases of various methods that today is on the Emit
4026 (EmitContext.NeedReturnLabel): This no longer creates the label,
4027 as the ILGenerator is not valid during the resolve phase.
4029 (EmitContext.EmitThis): Extended the knowledge in this class to
4030 work in anonymous methods in addition to iterators.
4032 (EmitContext.EmitCapturedVariableInstance): This emits whatever
4033 code is necessary on the stack to access the instance to a local
4034 variable (the variable will be accessed as a field).
4036 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
4037 EmitContext.EmitAddressOfParameter): Routines to support
4038 parameters (not completed at this point).
4040 Removals: Removed RemapLocal and RemapLocalLValue. We probably
4041 will also remove the parameters.
4043 * convert.cs (Convert): Define a `ConstantEC' which points to a
4044 null. This is just to prefity some code that uses
4045 ImplicitStandardConversion code and do not have an EmitContext
4048 The idea is to flag explicitly that at that point in time, it is
4049 known that the conversion will not trigger the delegate checking
4050 code in implicit conversions (which requires a valid
4053 Everywhere: pass new EmitContext parameter since
4054 ImplicitStandardConversionExists now requires it to check for
4055 anonymous method conversions.
4057 (Convert.ImplicitStandardConversionExists): If the type of an
4058 expression is the anonymous_method_type, and the type is a
4059 delegate, we invoke the AnonymousMethod.Compatible method to check
4060 whether an implicit conversion is possible.
4062 (Convert.ImplicitConversionStandard): Only do implicit method
4063 group conversions if the language level is not ISO_1.
4065 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
4066 MethodInfo for the Invoke method. used by Delegate and
4069 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
4070 method conversions if the target type is a delegate.
4072 Removed extra debugging nops.
4074 (LocalVariableReference): Turn the `local_info' into a public
4077 Add `prepared' field, the same hack used for FieldExprs to cope
4078 with composed assignments, as Local variables do not necessarily
4079 operate purely on the stack as they used to: they can be captured
4082 Add `temp' for a temporary result, like fields.
4084 Refactor DoResolve and DoResolveLValue into DoResolveBase.
4086 It now copes with Local variables that are captured and emits the
4087 proper instance variable to load it from a field in the captured
4090 (ParameterReference.DoResolveBase): During the resolve phase,
4091 capture parameters if we are in an anonymous method.
4093 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
4094 anonymous method, use the EmitContext helper routines to emit the
4095 parameter reference.
4097 * iterators.cs: Set RemapToProxy to true/false during the
4100 * parameters.cs (GetParameterByName): New helper method.
4102 * typemanager.cs (anonymous_method_type) a new type that
4103 represents an anonyous method. This is always an internal type,
4104 used as a fencepost to test against the anonymous-methodness of an
4107 2004-10-20 Marek Safar <marek.safar@seznam.cz>
4109 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
4111 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
4113 2004-11-10 Martin Baulig <martin@ximian.com>
4115 * expression.cs (Invocation.BetterFunction): If two methods have
4116 equal parameter types, but only one of them is generic, the
4117 non-generic one wins.
4118 (New.DoResolve): Don't set `is_struct' to false if we're a generic
4119 instance; just use `Type.IsValueType' to determine whether
4120 something is a struct or not.
4121 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
4122 so we can be called multiple times.
4124 2004-11-10 Martin Baulig <martin@ximian.com>
4126 * generic.cs (TypeParameter.DefineConstraints): New public method.
4127 (TypeParameter.CheckAccessLevel): Override this and return true.
4128 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
4129 override ResolveType() anymore.
4130 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
4132 2004-11-10 Martin Baulig <martin@ximian.com>
4134 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
4135 call DeclSpace.ResolveNestedType() on it.
4137 2004-11-10 Martin Baulig <martin@ximian.com>
4139 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
4140 non-null, call ParameterModifier() on it.
4142 2004-11-10 Martin Baulig <martin@ximian.com>
4145 (Iterators): Added `current_type' and `this_type' fields.
4146 (Iterators.DefineIterator): Create a new EmitContext and store it
4147 in `ec'; compute `this_type'.
4149 2004-11-10 Martin Baulig <martin@ximian.com>
4152 (TypeManager.IsPrivateAccessible): New public method.
4153 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
4155 2004-11-10 Martin Baulig <martin@ximian.com>
4157 * class.cs (TypeContainer.DefineType): Call
4158 TypeBuilder.DefineGenericParameters() before resolving the type
4160 (MethodData.parent_method): New protected field.
4161 (MethodData..ctor): Added `MethodInfo parent_method' argument.
4162 (MethodData.Define): Compute `parent_method'.
4165 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
4166 (MemberCore.GetClsCompliantAttributeValue): Likewise.
4167 (DeclSpace.ec): New protected field; store the EmitContext here.
4168 (DeclSpace.EmitContext): New public property.
4169 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
4170 (DeclSpace.ResolveNestedType): New public method.
4171 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
4172 (DeclSpace.NestedAccessible): Added `Type tb' argument.
4173 (DeclSpace.FamilyAccessible): Likewise.
4174 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
4175 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
4178 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
4181 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
4182 (Enum.Emit): Don't create a new EmitContext.
4184 2004-10-18 Martin Baulig <martin@ximian.com>
4186 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
4187 `Type' directly, but call ResolveType() on it.
4188 (Catch.Resolve): Likewise.
4189 (Foreach.Resolve): Likewise.
4191 2004-10-18 Martin Baulig <martin@ximian.com>
4193 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
4194 `Type' directly, but call ResolveType() on it.
4195 (Probe.DoResolve): Likewise.
4196 (ArrayCreation.LookupType): Likewise.
4197 (TypeOf.DoResolve): Likewise.
4198 (SizeOf.DoResolve): Likewise.
4200 2004-10-18 Raja R Harinath <rharinath@novell.com>
4202 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
4205 2004-10-17 John Luke <john.luke@gmail.com>
4207 * class.cs (Operator.GetSignatureForError): use CSharpName
4209 * parameter.cs (Parameter.GetSignatureForError): Returns
4210 correct name even if was not defined.
4212 2004-10-13 Raja R Harinath <rharinath@novell.com>
4215 * class.cs (TypeContainer.EmitContext): New property.
4216 (DefineNestedTypes): Create an emitcontext for each part.
4217 (MethodCore.DoDefineParameters): Use container's emitcontext.
4218 Pass type array to InternalParameters.
4219 (MemberBase.DoDefine): Use container's emitcontext.
4220 (FieldMember.Define): Likewise.
4221 (Event.Define): Likewise.
4222 (SetMethod.GetParameterInfo): Change argument to EmitContext.
4223 Pass type array to InternalParameters.
4224 (SetIndexerMethod.GetParameterInfo): Likewise.
4225 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
4226 * delegate.cs (Define): Pass emitcontext to
4227 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
4228 array to InternalParameters.
4229 * expression.cs (ParameterReference.DoResolveBase): Pass
4230 emitcontext to GetParameterInfo.
4231 (ComposedCast.DoResolveAsTypeStep): Remove check on
4232 ec.ResolvingTypeTree.
4233 * parameter.cs (Parameter.Resolve): Change argument to
4234 EmitContext. Use ResolveAsTypeTerminal.
4235 (Parameter.GetSignature): Change argument to EmitContext.
4236 (Parameters.ComputeSignature): Likewise.
4237 (Parameters.ComputeParameterTypes): Likewise.
4238 (Parameters.GetParameterInfo): Likewise.
4239 (Parameters.ComputeAndDefineParameterTypes): Likewise.
4240 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
4241 * support.cs (InternalParameters..ctor): Remove variant that takes
4243 * typemanager.cs (system_intptr_expr): New.
4244 (InitExpressionTypes): Initialize it.
4246 2004-10-12 Chris Toshok <toshok@ximian.com>
4248 * cs-parser.jay: fix location for try_statement and catch_clause.
4250 2004-10-18 Martin Baulig <martin@ximian.com>
4252 * class.cs (FieldMember.Define): Don't access the TypeExpr's
4253 `Type' directly, but call ResolveType() on it.
4254 (MemberBase.DoDefine): Likewise.
4256 * expression.cs (New.DoResolve): Don't access the TypeExpr's
4257 `Type' directly, but call ResolveType() on it.
4258 (ComposedCast.DoResolveAsTypeStep): Likewise.
4260 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
4261 `Type' directly, but call ResolveType() on it.
4263 2004-10-17 John Luke <john.luke@gmail.com>
4265 * class.cs (Operator.GetSignatureForError): use CSharpName
4267 * parameter.cs (Parameter.GetSignatureForError): Returns
4268 correct name even if was not defined.
4270 2004-10-13 Raja R Harinath <rharinath@novell.com>
4273 * class.cs (TypeContainer.EmitContext): New property.
4274 (DefineNestedTypes): Create an emitcontext for each part.
4275 (MethodCore.DoDefineParameters): Use container's emitcontext.
4276 Pass type array to InternalParameters.
4277 (MemberBase.DoDefine): Use container's emitcontext.
4278 (FieldMember.Define): Likewise.
4279 (Event.Define): Likewise.
4280 (SetMethod.GetParameterInfo): Change argument to EmitContext.
4281 Pass type array to InternalParameters.
4282 (SetIndexerMethod.GetParameterInfo): Likewise.
4283 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
4284 * delegate.cs (Define): Pass emitcontext to
4285 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
4286 array to InternalParameters.
4287 * expression.cs (ParameterReference.DoResolveBase): Pass
4288 emitcontext to GetParameterInfo.
4289 (ComposedCast.DoResolveAsTypeStep): Remove check on
4290 ec.ResolvingTypeTree.
4291 * parameter.cs (Parameter.Resolve): Change argument to
4292 EmitContext. Use ResolveAsTypeTerminal.
4293 (Parameter.GetSignature): Change argument to EmitContext.
4294 (Parameters.ComputeSignature): Likewise.
4295 (Parameters.ComputeParameterTypes): Likewise.
4296 (Parameters.GetParameterInfo): Likewise.
4297 (Parameters.ComputeAndDefineParameterTypes): Likewise.
4298 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
4299 * support.cs (InternalParameters..ctor): Remove variant that takes
4301 * typemanager.cs (system_intptr_expr): New.
4302 (InitExpressionTypes): Initialize it.
4304 2004-10-12 Chris Toshok <toshok@ximian.com>
4306 * cs-parser.jay: fix location for try_statement and catch_clause.
4308 2004-10-07 Raja R Harinath <rharinath@novell.com>
4310 More DeclSpace.ResolveType avoidance.
4311 * decl.cs (MemberCore.InUnsafe): New property.
4312 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
4313 with newly created EmitContext.
4314 (FieldMember.Define): Likewise.
4315 * delegate.cs (Delegate.Define): Likewise.
4316 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
4317 only if normal name-lookup fails.
4318 (TypeExpr.DoResolve): Enable error-checking.
4319 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
4320 (SizeOf.DoResolve): Likewise.
4321 (ComposedCast.DoResolveAsTypeStep): Likewise.
4322 (StackAlloc.DoResolve): Likewise.
4323 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
4324 (Block.Unsafe): New property.
4325 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
4326 (Unsafe): Set 'unsafe' flag of contained block.
4327 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
4328 (Fixed.Resolve): Likewise.
4329 (Catch.Resolve): Likewise.
4330 (Using.ResolveLocalVariableDecls): Likewise.
4331 (Foreach.Resolve): Likewise.
4333 2004-10-05 John Luke <john.luke@gmail.com>
4335 * cs-parser.jay: add location to error CS0175
4337 2004-10-04 Miguel de Icaza <miguel@ximian.com>
4339 * ecore.cs (Expression.Constantity): Add support for turning null
4342 * const.cs (Const.Define): Allow constants to be reference types
4343 as long as the value is Null.
4345 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
4347 * namespace.cs (NamespaceEntry.Using): No matter which warning
4348 level is set, check if this namespace name has already been added.
4350 2004-10-03 Ben Maurer <bmaurer@ximian.com>
4352 * expression.cs: reftype [!=]= null should always use br[true,false].
4355 2004-10-03 Marek Safar <marek.safar@seznam.cz>
4358 * attribute.cs: Enum conversion moved to
4359 GetAttributeArgumentExpression to be applied to the all
4362 2004-10-01 Raja R Harinath <rharinath@novell.com>
4364 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
4365 * class.c (TypeContainer.DefineType): Flag error if
4366 base types aren't accessible due to access permissions.
4367 * decl.cs (DeclSpace.ResolveType): Move logic to
4368 Expression.ResolveAsTypeTerminal.
4369 (DeclSpace.ResolveTypeExpr): Thin layer over
4370 Expression.ResolveAsTypeTerminal.
4371 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
4372 Refactor code into NestedAccess. Use it.
4373 (DeclSpace.NestedAccess): New.
4374 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
4375 argument to silence errors. Check access permissions.
4376 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
4377 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
4378 (Cast.DoResolve): Likewise.
4379 (New.DoResolve): Likewise.
4380 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
4381 (TypeOf.DoResolve): Likewise.
4383 * expression.cs (Invocation.BetterConversion): Return the Type of
4384 the better conversion. Implement section 14.4.2.3 more faithfully.
4385 (Invocation.BetterFunction): Make boolean. Make correspondence to
4386 section 14.4.2.2 explicit.
4387 (Invocation.OverloadResolve): Update.
4388 (Invocation): Remove is_base field.
4389 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
4390 (Invocation.Emit): Likewise.
4392 2004-09-24 Marek Safar <marek.safar@seznam.cz>
4394 * cs-parser.jay: Reverted 642 warning fix.
4396 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4399 * decl.cs (FindMemberWithSameName): Indexer can have more than
4402 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4404 * expression.cs (LocalVariableReference.DoResolveLValue):
4405 Do not report warning 219 for out values.
4406 (EmptyExpression.Null): New member to avoid extra allocations.
4408 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4410 * cs-parser.jay: Fix wrong warning 642 report.
4412 * cs-tokenizer.cs (CheckNextToken): New helper;
4413 Inspect next character if is same as expected.
4415 2004-09-23 Martin Baulig <martin@ximian.com>
4417 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
4418 (Convert.ImplicitReferenceConversionExists): Likewise.
4420 2004-11-09 Raja R Harinath <rharinath@novell.com>
4422 * Makefile (DISTFILES): Comment out a few missing files.
4424 2004-10-29 Raja R Harinath <rharinath@novell.com>
4426 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
4427 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
4428 (gmcs.exe): Invoke bootstrap-libs.
4429 (clean-local): Clean the net_2_0_bootstrap profile too.
4430 (PROGRAM_INSTALL_DIR): New.
4431 (install-local): Use it.
4433 2004-10-13 Martin Baulig <martin@ximian.com>
4435 * generic.cs (TypeManager.InflatedConstraints): New nested class.
4436 (TypeParameter.DefineType): If we're a method type parameter and
4437 that method is overriding something, "inflate" its constraints.
4439 2004-10-12 Martin Baulig <martin@ximian.com>
4441 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
4442 and have type arguments, create and resolve a ConstructedType.
4444 2004-10-12 Martin Baulig <martin@ximian.com>
4446 * decl.cs (MemberCache.FindMemberToOverride): Use
4447 TypeManager.IsEqual() to compare the parameters and Type.Equals()
4448 to compare the invocationType.
4450 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
4451 When comparing two type parameters, only do the signature-only
4452 comparision for method type parameters.
4454 2004-10-11 Martin Baulig <martin@ximian.com>
4456 * report.cs: Don't make --fatal abort on warnings, we have
4457 -warnaserror for that.
4459 2004-10-11 Martin Baulig <martin@ximian.com>
4462 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
4463 (TypeManager.IsEqual): Call ourself recursively instead of using
4466 2004-10-11 Martin Baulig <martin@ximian.com>
4468 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
4469 on our own type parameters, not on the ones we inherit from a containing
4472 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
4475 * generic.cs (TypeParameter.Define): We may only be called once.
4477 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
4478 instead of TypeManager.IsEqual().
4480 2004-09-28 Martin Baulig <martin@ximian.com>
4483 (GenericConstraints.EffectiveBaseClass): New public property.
4484 (TypeParameter.GenericConstraints): New public property.
4485 (ConstructedType.CheckConstraints): Improved.
4487 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
4488 (Convert.TypeParameterConversion): New private method; use this in
4489 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
4490 for all conversions related to type parameters.
4492 2004-09-24 Martin Baulig <martin@ximian.com>
4494 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
4495 type parameter conversions for type parameters which are known to
4498 2004-09-24 Martin Baulig <martin@ximian.com>
4500 * generic.cs (GenericConstraints): Added `IsReferenceType' and
4501 `IsValueType' properties.
4503 * support.cs (ReflectionConstraints): Use
4504 Type.GetGenericParameterConstraints() instead of the old hack.
4506 2004-09-24 Martin Baulig <martin@ximian.com>
4508 * generic.cs (GenericConstraints): Moved here and made it an
4511 * support.cs (GenericConstraints): Moved to generic.cs.
4513 2004-09-24 Martin Baulig <martin@ximian.com>
4516 (ReflectionConstraints): Un-nested this class and made it public.
4519 (TypeManager.GetTypeParameterConstraints): New public method.
4520 (TypeManager.HasConstructorConstraint): Use the attributes.
4522 2004-09-24 Martin Baulig <martin@ximian.com>
4524 * support.cs (GenericConstraints): Replaced `HasConstructor',
4525 `IsReferenceType' and `IsValueType' with `Attributes'.
4526 (ReflectionParameters.ReflectionConstraints): Removed the Create()
4527 method and made the .ctor public.
4529 * generic.cs (Constraints.Attributes): New public property.
4530 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
4531 `IsReferenceType' -> `HasReferenceTypeConstraint' and
4532 `IsValueType' -> `HasValueTypeConstraint'.
4534 2004-09-23 Martin Baulig <martin@ximian.com>
4536 * generic.cs (Constraints): Reflect latest runtime changes.
4538 2004-09-23 Martin Baulig <martin@ximian.com>
4540 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
4541 (Convert.ImplicitReferenceConversionExists): Likewise.
4543 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4545 * class.cs (Operator.Define): Add error 448 and 559 report.
4547 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4549 * class.cs (MemberBase.IsTypePermitted): New protected
4550 method for checking error CS0610.
4552 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4554 * class.cs (TypeContainer.HasExplicitLayout): New property
4555 Returns whether container has StructLayout attribute set Explicit.
4556 (FieldMember): New abstract class for consts and fields.
4557 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
4558 (Field): Reuse FieldMember.
4560 * const.cs (Const): Reuse FieldMember.
4562 * rootcontext.cs: EmitConstants call moved to class.
4564 2004-09-22 Martin Baulig <martin@ximian.com>
4566 Marek and me just fixed one of our oldest bugs: #28562 :-)
4568 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
4570 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
4571 we're an EnumConstant, just return that.
4572 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
4573 an EnumConstant. In this case, we need to use GetValueAsEnumType()
4574 to get the value which'll actually be written into the attribute.
4575 However, we have to use GetValue() to access the attribute's value
4578 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4580 * constant.cs (Constant.IsNegative): New abstract property
4583 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
4584 (StackAlloc.DoResolve): Reused IsNegative.
4586 2004-09-22 Martin Baulig <martin@ximian.com>
4588 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
4589 public method; like LookupTypeContainer, but also works for
4592 * report.cs (Report.SymbolRelatedToPreviousError): Use
4593 TypeManager.LookupGenericTypeContainer().
4595 2004-09-22 Martin Baulig <martin@ximian.com>
4597 Thanks to Peter Sestoft for this bug report.
4599 * expression.cs (Conditional): If both the `trueExpr' and the
4600 `falseExpr' is a NullLiteral, return a NullLiteral.
4602 2004-09-22 Martin Baulig <martin@ximian.com>
4604 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
4605 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
4606 for the "get_Current" call.
4608 2004-09-21 Martin Baulig <martin@ximian.com>
4610 * convert.cs (Convert.ImplicitReferenceConversion): When
4611 converting to an interface type, first check whether we're
4612 converting from a reference type.
4614 2004-09-14 Martin Baulig <martin@ximian.com>
4616 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
4618 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4621 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
4622 called and is obsolete then this member suppress message
4623 when call is inside next [Obsolete] method or type.
4625 * expression.cs: Use TestObsoleteMethodUsage member.
4627 2004-09-14 Martin Baulig <martin@ximian.com>
4629 * genericparser.cs: Removed.
4631 2004-09-13 Marek Safar <marek.safar@seznam.cz>
4633 * class.cs (MethodCore.CheckBase): Fix bug #65757.
4635 2004-09-12 Marek Safar <marek.safar@seznam.cz>
4637 * attribute.cs (Attribute.Resolve): Add error 653 report.
4639 * class.cs (Class.ApplyAttributeBuilder): Add error 641
4641 (Method.ApplyAttributeBuilder): Add error 685 report.
4642 (Operator.Define): Add error 564 report.
4644 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
4646 * expression.cs (Invocation.DoResolve): Add error
4649 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
4652 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4654 * class.cs (ConstructorInitializer.Resolve):
4655 Wrong error number (515->516).
4657 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4659 * class.cs (Indexer.Define): Add error 631 report.
4661 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4663 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
4665 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4667 * expression.cs (Probe.DoResolve): Add error CS0241 report.
4669 2004-09-10 Marek Safar <marek.safar@seznam.cz>
4671 * cs-parser.jay: Added error CS0241 report.
4673 2004-09-10 Raja R Harinath <rharinath@novell.com>
4675 * cs-parser.jay (fixed_statement): Introduce a scope for the
4676 declaration in the 'fixed' statement.
4678 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4680 * cs-parser.jay: Added CS0230 error report.
4682 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4684 * cs-parser.jay: Added errors CS0231 and CS0257 report.
4686 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4688 * expression.cs (Argument.Resolve): Added error CS0192 and
4691 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4693 C# 2.0 #pragma warning feature
4695 * cs-tokenizer.cs (PreProcessPragma): New method;
4696 Handles #pragma directive.
4698 * report.cs (WarningRegions): New class; Support
4699 class for #pragma warning directive. It tests whether
4700 warning is enabled for a given line.
4702 2004-09-08 Miguel de Icaza <miguel@ximian.com>
4704 * const.cs: Add more descriptive error report, tahnks to
4707 2004-09-08 Marek Safar <marek.safar@seznam.cz>
4709 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
4711 2004-09-07 Miguel de Icaza <miguel@ximian.com>
4713 * expression.cs: Apply patch from Ben: Remove dead code from
4714 ArrayCreation, and remove the TurnintoConstant call in const.cs,
4715 as that code just threw an exception anwyays.
4717 * const.cs: Remove the call to the turnintoconstant, for details
4720 * literal.cs: The type of the null-literal is the null type; So
4721 we use a placeholder type (literal.cs:System.Null, defined here)
4724 * expression.cs (Conditional.DoResolve): Remove some old code that
4725 is no longer needed, conversions have been fixed.
4727 (ArrayCreationExpression.DoResolve): Return false if we fail to
4728 resolve the inner expression.
4730 2004-09-07 Raja R Harinath <rharinath@novell.com>
4733 * cs-parser.jay (delegate_declaration): Record a delegate
4734 declaration as a type declaration.
4735 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
4737 2004-09-06 Miguel de Icaza <miguel@ximian.com>
4739 * parameter.cs: Do not crash if the type can not be resolved.
4741 * expression.cs: Report errors with unsafe pointers, fixes #64896
4743 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
4745 * expression.cs: Pointer arith always needs to do a conv.i
4746 if the operand is a long. fix 65320
4748 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4750 Fixed cs0619-37.cs, cs0619-38.cs
4752 * enum.cs (GetObsoleteAttribute): Removed.
4754 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
4755 on Enum member is double staged. The first is tested member
4758 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4760 Fixed #56986, #63631, #65231
4762 * class.cs: (TypeContainer.AddToMemberContainer): New method,
4763 adds member to name container.
4764 (TypeContainer.AddToTypeContainer): New method, adds type to
4766 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
4767 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
4768 AddOperator): Simplified by reusing AddToMemberContainer.
4769 (TypeContainer.UserDefinedStaticConstructor): Changed to property
4771 (Method.CheckForDuplications): Fixed implementation to test all
4773 (MemberBase): Detection whether member is explicit interface
4774 implementation is now in constructor.
4775 (MemberBase.UpdateMemberName): Handles IndexerName.
4776 (Accessor): Changed to keep also location information.
4777 (AbstractPropertyEventMethod): Is derived from MemberCore.
4778 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
4779 will be emited or not.
4780 (PropertyBase.AreAccessorsDuplicateImplementation):
4781 Tests whether accessors are not in collision with some method.
4782 (Operator): Is derived from MethodCore to simplify common
4785 * decl.cs (Flags.TestMethodDuplication): Test for duplication
4787 (DeclSpace.AddToContainer): Adds the member to defined_names
4788 table. It tests for duplications and enclosing name conflicts.
4790 * enum.cs (EnumMember): Clean up to reuse the base structures
4792 2004-09-03 Martin Baulig <martin@ximian.com>
4794 Merged latest changes into gmcs. Please keep this comment in
4795 here, it makes it easier for me to see what changed in MCS since
4796 the last time I merged.
4798 2004-09-03 Martin Baulig <martin@ximian.com>
4800 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
4801 into TypeContainer, to make partial classes work again.
4803 2004-09-03 Martin Baulig <martin@ximian.com>
4805 * rootcontext.cs (RootContext.V2): Removed.
4807 2004-03-23 Martin Baulig <martin@ximian.com>
4809 * expression.cs (Invocation.OverloadResolve): Added `bool
4810 may_fail' argument and use it instead of the Location.IsNull() hack.
4812 2004-09-09 Martin Baulig <martin@ximian.com>
4814 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
4816 2004-09-09 Martin Baulig <martin@ximian.com>
4818 * generic.cs (TypeParameter.DefineType): Added support for
4819 explicit interface methods.
4821 2004-09-09 Martin Baulig <martin@ximian.com>
4823 * README.Changes: New document. Started to list important changes
4824 between MCS and GMCS here.
4826 2004-09-08 Martin Baulig <martin@ximian.com>
4829 (TypeContainer.CheckRecursiveDefinition): New protected method.
4830 (TypeContainer.DefineType): Move the CS0146 check into
4831 CheckRecursiveDefinition().
4833 2004-09-06 Martin Baulig <martin@ximian.com>
4835 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
4836 types for the constructor constraint.
4838 2004-09-03 Martin Baulig <martin@ximian.com>
4840 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
4841 into TypeContainer, to make partial classes work again.
4843 2004-09-03 Martin Baulig <martin@ximian.com>
4845 * rootcontext.cs (RootContext.V2): Removed.
4847 2004-03-23 Martin Baulig <martin@ximian.com>
4849 * expression.cs (Invocation.OverloadResolve): Added `bool
4850 may_fail' argument and use it instead of the Location.IsNull() hack.
4852 2004-09-03 Martin Baulig <martin@ximian.com>
4854 Merged latest changes into gmcs. Please keep this comment in
4855 here, it makes it easier for me to see what changed in MCS since
4856 the last time I merged.
4858 2004-09-03 Raja R Harinath <rharinath@novell.com>
4861 * expression.cs (BetterConversion): Don't allow either conversion
4862 to be null. Remove redundant implicit conversion test when 'q ==
4863 null' -- when this function is invoked, we already know that the
4864 implicit conversion exists.
4865 (BetterFunction): Assume that 'best' is non-null. Remove
4866 redundant reimplementation of IsApplicable when 'best' is null.
4867 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
4868 number of arguments.
4869 (IsAncestralType): Extract from OverloadResolve.
4870 (OverloadResolve): Make robust to the MethodGroupExpr being
4871 unsorted. Implement all the logic of Section 14.5.5.1, and
4872 support overloading of methods from multiple applicable types.
4873 Clean up logic somewhat. Don't pass null methods to BetterFunction.
4875 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
4876 (RealError, Warning): Append type of report to related symbol.
4878 2004-09-03 Marek Safar <marek.safar@seznam.cz>
4880 * enum.cs: Fixed CLS-Compliance checks for enum members.
4881 Error tests cs3008-8.cs, cs3014-8.cs
4883 2004-09-02 Marek Safar <marek.safar@seznam.cz>
4885 Fixed bug #62342, #63102
4886 * class.cs: ImplementIndexer uses member.IsExplicitImpl
4887 like ImplementMethod.
4889 2004-09-02 Marek Safar <marek.safar@seznam.cz>
4891 * attribute.cs (Attribute.GetAttributeArgumentExpression):
4894 2004-09-02 Martin Baulig <martin@ximian.com>
4896 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
4897 TypeManager.GetArgumentTypes() rather than calling GetParameters()
4900 2004-09-01 Marek Safar <marek.safar@seznam.cz>
4902 C# 2.0 Static classes implemented
4904 * class.cs (TypeContainer): instance_constructors,
4905 initialized_fields, initialized_static_fields,
4906 default_constructor, base_inteface_types are protected to be
4907 accessible from StaticClass.
4908 (TypeContainer.DefineDefaultConstructor): New virtual method
4909 for custom default constructor generating
4910 (StaticClass): New class to handle "Static classes" feature.
4912 * cs-parser.jay: Handle static keyword on class like instance
4915 * driver.cs: Added "/langversion" command line switch with two
4916 options (iso-1, default).
4918 2004-08-31 Marek Safar <marek.safar@seznam.cz>
4920 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
4922 2004-08-31 Miguel de Icaza <miguel@ximian.com>
4924 * delegate.cs: Style.
4926 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
4928 * delegate.cs: Add seperate instance expr field for miguel.
4930 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
4932 * PointerArithmetic (Resolve): make sure we are not doing
4933 pointer arith on void*. Also, make sure we are resolved
4934 by not setting eclass until resolve.
4936 All callers: Make sure that PointerArithmetic gets resolved.
4938 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
4940 * ArrayCreation (LookupType): If the type does not resolve
4941 to an array, give an error.
4943 2004-08-27 Marek Safar <marek.safar@seznam.cz>
4945 * statement.cs (Try.Resolve): Fixed bug #64222
4947 2004-08-27 Martin Baulig <martin@ximian.com>
4950 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
4953 2004-08-26 Marek Safar <marek.safar@seznam.cz>
4955 * ecore.cs (Constantify): Get underlying type via
4956 System.Enum.GetUnderlyingType to avoid StackOverflow on the
4957 Windows in special cases.
4959 2004-08-26 Marek Safar <marek.safar@seznam.cz>
4961 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
4962 for obtaining also private methods.
4963 (GetRemoveMethod): Used GetRemoveMethod (true)
4964 for obtaining also private methods.
4966 2004-09-02 Martin Baulig <martin@ximian.com>
4968 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
4969 TypeManager.GetArgumentTypes() rather than calling GetParameters()
4972 2004-08-27 Martin Baulig <martin@ximian.com>
4975 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
4978 2004-08-25 Martin Baulig <martin@ximian.com>
4980 * support.cs (ReflectionParameters..ctor): If this is a generic
4981 method, retrieve and store its type parameters.
4982 (InternalParameters..ctor): Added `TypeParameter[]' argument.
4983 (ReflectionParameters.GenericConstraints): The argument specifies
4984 the type parameter, not the method parameter.
4985 (InternalParameters.GenericConstraints): Likewise.
4987 * generic.cs (TypeParameter.DefineType): Correctly handle
4988 constraints wrt. generic methods in interfaces and their
4991 2004-08-24 Martin Baulig <martin@ximian.com>
4993 * generic.cs (TypeParameter.IsSubclassOf): New public method.
4994 (Constraints.IsSubclassOf): New internal method.
4996 * typemanager.cs (TypeManager.FindMembers): Added special support
4997 for GenericTypeParameterBuilder's.
4998 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
5001 2004-08-24 Martin Baulig <martin@ximian.com>
5004 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
5005 this for accessibility checks.
5006 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
5007 IsNestedFamilyAccessible.
5008 (TypeManager.IsSubclassOf): New method, do what the name actually
5011 2004-08-24 Martin Baulig <martin@ximian.com>
5013 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
5014 as a SimpleName, include the generic arity.
5016 2004-08-24 Martin Baulig <martin@ximian.com>
5018 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5019 MethodAttributes.HideBySig for operators.
5021 2004-08-23 Martin Baulig <martin@ximian.com>
5023 Back to the old error reporting system :-)
5025 * report.cs (Message): Removed.
5026 (Report.MessageData, ErrorData, WarningData): Removed.
5027 (Report.Error, Warning): Back to the old system.
5029 2004-08-23 Martin Baulig <martin@ximian.com>
5031 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5033 * class.cs (TypeContainer.ParentContainer): New public virtual
5034 method; replaces the explicit interface implementation.
5035 (ClassPart.ParentContainer): Override.
5037 2004-08-23 Martin Baulig <martin@ximian.com>
5039 * statement.cs (Switch): Added support for constant switches; see
5040 #59428 or test-285.cs.
5042 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5045 * statement.cs (GetEnumeratorFilter): Removed useless
5046 logic because C# specs is strict. GetEnumerator must be
5049 2004-08-22 Martin Baulig <martin@ximian.com>
5051 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5052 a switch and may break, reset the barrier. Fixes #59867.
5054 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5056 CLS-Compliance speed up (~5% for corlib)
5058 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5059 New method. Tests container for CLS-Compliant names
5061 * class.cs (TypeContainer.VerifyClsName): New method.
5062 Checks whether container name is CLS Compliant.
5063 (Constructor): Implements IMethodData.
5065 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5066 low-case table for CLS Compliance test.
5067 (MemberCache.VerifyClsParameterConflict): New method.
5068 Checks method parameters for CS3006 error.
5070 * enum.cs (EnumMember): Is derived from MemberCore.
5071 (Enum.VerifyClsName): Optimized for better performance.
5073 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5075 * report.cs: Renamed Error_T to Error and changed all
5078 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5080 * class.cs (TypeContainer.IndexerArrayList): New inner class
5081 container for indexers.
5082 (TypeContainer.DefaultIndexerName): New constant for default
5083 indexer name. Replaced all "Item" with this constant.
5084 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5086 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5087 DefaultMemberAttribute constructor.
5089 2004-08-05 Martin Baulig <martin@ximian.com>
5091 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5094 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5096 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5097 multi platforms problem.
5099 * compiler.csproj: Included shared files.
5101 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5103 Fix bug 60333, 55971 in the more general way
5104 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5105 Added arg_type argument for constant conversion.
5106 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5108 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5111 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5112 OperatorArrayList, MethodCoreArrayList for typecontainer
5113 containers. Changed class member types to these new types.
5114 (MethodArrayList.DefineMembers): Added test for CS0659.
5116 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5118 * cfold.cs: Synchronize the folding with the code in expression.cs
5119 Binary.DoNumericPromotions for uint operands.
5121 * attribute.cs: Revert patch from Raja, it introduced a regression
5122 while building Blam-1.2.1 (hard to isolate a test case).
5124 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5128 (TypeContainer.Define): Renamed to DefineContainerMembers because of
5130 (MethodCore.parent_method): New member. The method we're overriding
5131 if this is an override method.
5132 (MethodCore.CheckBase): Moved from Method class and made common.
5133 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
5135 (MethodCore.CheckForDuplications): New abstract method. For custom
5136 member duplication search in a container
5137 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
5138 method and its return type.
5139 (Event.conflict_symbol): New member. Symbol with same name in the
5143 (MemberCache.FindMemberWithSameName): New method. The method
5144 is looking for conflict with inherited symbols.
5146 2004-08-04 Martin Baulig <martin@ximian.com>
5148 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5150 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5152 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5154 * report.cs (Message): New enum for better error, warning reference in
5156 (MessageData): New inner abstract class. It generally handles printing of
5157 error and warning messages.
5158 Removed unused Error, Warning, Message methods.
5160 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5162 Fix for cs0592-8.cs test
5164 (Attributable.ValidAttributeTargets): Made public.
5165 (Attribute.ExplicitTarget): New member for explicit target value.
5166 (Attribute.CheckTargets): Now we translate explicit attribute
5167 target to Target here.
5169 2004-08-03 Ben Maurer <bmaurer@ximian.com>
5171 * ecore.cs (MethodGroupExpr): new IsBase property.
5173 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
5175 * delegate.cs (DelegateCreation): store a MethodGroupExpr
5176 rather than an instance expr.
5178 (DelegateCreation.Emit): Use the method group rather than
5179 the instance expression. Also, if you have base.Foo as the
5180 method for a delegate, make sure to emit ldftn, not ldftnvirt.
5182 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
5184 (NewDelegate.DoResolve): Only check for the existance of Invoke
5185 if the method is going to be needed. Use MethodGroupExpr.
5187 (NewDelegate.Emit): Remove, DelegateCreation implements this.
5189 * expression.cs: For pointer arith., make sure to use
5190 the size of the type, not the size of the pointer to
5193 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5196 * class.cs (Class): Added error CS0502 test.
5198 2004-08-03 John Luke <jluke@cfl.rr.com>
5199 Raja R Harinath <rharinath@novell.com>
5202 * attribute.cs (Attribute.complained_before): New flag.
5203 (Attribute.ResolveType, Attribute.Resolve),
5204 (Attribute.DefinePInvokeMethod): Set it.
5205 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
5207 2004-08-03 Martin Baulig <martin@ximian.com>
5209 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5210 use a user-defined operator; we still need to do numeric
5211 promotions in case one argument is a builtin type and the other
5212 one has an implicit conversion to that type. Fixes #62322.
5214 2004-08-18 Martin Baulig <martin@ximian.com>
5216 * class.cs (Method.Define): Use the correct method name when
5217 creating the MethodBuilder for a generic method.
5219 2004-08-17 Martin Baulig <martin@ximian.com>
5221 * generic.cs (Constraints): Support type parameter constraints.
5223 2004-08-16 Martin Baulig <martin@ximian.com>
5225 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
5226 (Token.GENERIC_DIMENSION): New token; this is returned if we
5227 encounter an unbound generic type in a typeof() expression.
5229 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
5230 this token is only generated while parsing a typeof() expression.
5231 (typeof_expression): Removed the old unbound_type hack.
5233 * generic.cs (TypeArguments.IsUnbound): New public property.
5235 * decl.cs (MemberName): Added support for unbound types.
5237 2004-08-14 Martin Baulig <martin@ximian.com>
5240 (TypeManager.IsEqualGenericInstance): New static method.
5241 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
5242 just used to check accessibility, so follow the rules of 26.1.6.
5244 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
5245 ConstructedType instead of a TypeExpression if we have type arguments.
5247 * cs-parser.jay (typeof_expression): Support unbound generic types.
5249 * ecore.cs (UnboundTypeExpression): New public class.
5251 2004-08-12 Martin Baulig <martin@ximian.com>
5253 * typemanager.cs (TypeManager.IsNestedChildOf): Use
5254 TypeManager.IsEqual() rather than `=='.
5256 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
5257 generic instances as well.
5259 2004-08-12 Martin Baulig <martin@ximian.com>
5261 * expression.cs (Invocation.InferType): We can only infer method
5262 type parameters. Fixes #62647.
5264 2004-08-11 Martin Baulig <martin@ximian.com>
5266 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
5267 before resolving the base classes.
5269 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5271 * Makefile: install .mdb file too.
5273 2004-08-05 Martin Baulig <martin@ximian.com>
5275 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
5276 initializer, the current type is just the TypeBuilder, not the
5277 instantiated generic type.
5278 (FieldExpr.IsFieldInitializer): New public property.
5280 2004-08-04 Martin Baulig <martin@ximian.com>
5282 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5284 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5286 2004-08-03 Martin Baulig <martin@ximian.com>
5288 * class.cs (MethodData.Define): If we're an explicit
5289 implementation, remove the generic arity from the type name.
5291 2004-08-03 Martin Baulig <martin@ximian.com>
5293 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5294 use a user-defined operator; we still need to do numeric
5295 promotions in case one argument is a builtin type and the other
5296 one has an implicit conversion to that type. Fixes #62322.
5298 2004-08-02 Martin Baulig <martin@ximian.com>
5300 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
5302 (TypeContainer.GetClassBases): Return the unexpanded list of
5303 interfaces; we expand them later.
5304 (TypeContainer.DefineType): After creating the TypeBuilder, call
5305 TypeManager.ExpandInterfaces() to get an expanded and resolved
5308 * ecore.cs (TypeExpr.GetInterfaces): Removed
5310 * generics.cs (Constraints.InterfaceConstraints): Remove.
5311 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
5312 register the interface constraints.
5315 (TypeManager.AddUserType): Removed the `ifaces' argument.
5316 (TypeManager.AddTypeParameter): Likewise.
5317 (TypeManager.AddUserInterface): Removed, was unused.
5318 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
5319 `TypeExpr[]' array for the interfaces.
5320 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
5321 has been defined, returns a list of the resolved interfaces types.
5322 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
5323 (TypeManager.GetExplicitInterfaces): Likewise.
5325 2004-08-02 Martin Baulig <martin@ximian.com>
5327 * expression.cs (Invocation.EmitCall): If we're invoking a method
5328 on a type parameter, use the new `Constrained' prefix opcode.
5330 2004-08-02 Martin Baulig <martin@ximian.com>
5332 * statement.cs (LocalInfo.Flags): Added `IsThis'.
5333 (LocalInfo.IsThis): New public property.
5334 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
5336 2004-08-01 Martin Baulig <martin@ximian.com>
5338 * class.cs (TypeContainer.GetClassBases): Don't set the default
5339 here since we may get called from GetPartialBases().
5340 (TypeContainer.DefineType): If GetClassBases() didn't return a
5341 parent, use the default one.
5343 2004-07-30 Martin Baulig <martin@ximian.com>
5345 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
5347 * class.cs (SourceMethod): New public class, derive from the
5348 symbol writer's ISourceMethod.
5349 (Method): Use the new symbol writer API.
5351 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
5352 as argument and use the new symbol writer.
5355 (SourceFile): Implement the symbol writer's ISourceFile.
5356 (Location.SymbolDocument): Removed.
5357 (Location.SourceFile): New public property.
5359 * symbolwriter.cs: Use the new symbol writer API.
5361 2004-07-30 Raja R Harinath <rharinath@novell.com>
5363 * Makefile (install-local): Remove. Functionality moved to
5366 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
5368 * Makefile: Install mcs.exe.config file together with mcs.exe.
5369 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
5370 correct runtime version.
5372 2004-07-25 Martin Baulig <martin@ximian.com>
5375 (TypeContainer.RegisterOrder): Removed, this was unused.
5376 (TypeContainer, interface_order): Removed.
5377 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
5378 TypeContainer as argument since we can also be called with a
5379 `PartialContainer' for a partial class/struct/interface.
5380 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
5381 of checking whether we're an `Interface' - we could be a
5383 (PartialContainer.Register): Override; call
5384 AddClass()/AddStruct()/AddInterface() on our parent.
5386 * cs-parser.jay (interface_member_declaration): Add things to the
5387 `current_container', not the `current_class'.
5389 * rootcontext.cs (RegisterOrder): The overloaded version which
5390 takes an `Interface' was unused, removed.
5392 * typemanager.cs (TypeManager.LookupInterface): Return a
5393 `TypeContainer', not an `Interface'.
5394 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
5395 contain a `PartialContainer' for an interface, so check it's
5396 `Kind' to figure out what it is.
5398 2004-07-25 Martin Baulig <martin@ximian.com>
5400 * class.cs (Class.DefaultTypeAttributes): New public constant.
5401 (Struct.DefaultTypeAttributes): Likewise.
5402 (Interface.DefaultTypeAttributes): Likewise.
5403 (PartialContainer.TypeAttr): Override this and add the
5404 DefaultTypeAttributes.
5406 2004-07-25 Martin Baulig <martin@ximian.com>
5408 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
5409 we can just use the `Parent' field instead.
5411 2004-07-25 Martin Baulig <martin@ximian.com>
5413 * class.cs (TypeContainer.Emit): Renamed to EmitType().
5415 2004-07-25 Martin Baulig <martin@ximian.com>
5417 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
5418 our parts before defining any methods.
5419 (TypeContainer.VerifyImplements): Make this virtual.
5420 (ClassPart.VerifyImplements): Override and call VerifyImplements()
5421 on our PartialContainer.
5423 2004-07-25 Martin Baulig <martin@ximian.com>
5425 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
5427 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
5428 argument, we can just use the `Parent' field instead.
5431 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
5432 (MemberBase.DoDefine): Likewise.
5434 2004-07-24 Martin Baulig <martin@ximian.com>
5436 * decl.cs (MemberCore.Parent): New public field.
5437 (DeclSpace.Parent): Moved to MemberCore.
5439 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
5440 (MemberBase.ctor): Added TypeContainer argument, pass it to our
5442 (FieldBase, Field, Operator): Likewise.
5443 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
5444 (EventField, Event): Likewise.
5446 2004-07-23 Martin Baulig <martin@ximian.com>
5448 * class.cs (PartialContainer): New public class.
5449 (ClassPart): New public class.
5450 (TypeContainer): Added support for partial classes.
5451 (TypeContainer.GetClassBases): Splitted some of the functionality
5452 out into GetNormalBases() and GetPartialBases().
5454 * cs-tokenizer.cs (Token.PARTIAL): New token.
5455 (Tokenizer.consume_identifier): Added some hacks to recognize
5456 `partial', but only if it's immediately followed by `class',
5457 `struct' or `interface'.
5459 * cs-parser.jay: Added support for partial clases.
5461 2004-07-23 Martin Baulig <martin@ximian.com>
5463 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
5464 a `DeclSpace' and also made it readonly.
5465 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
5466 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
5467 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
5469 * cs-parser.jay: Pass the `current_class', not the
5470 `current_container' (at the moment, this is still the same thing)
5471 to a new Method, Property, Event, Indexer or Constructor.
5473 2004-07-23 Martin Baulig <martin@ximian.com>
5475 * cs-parser.jay (CSharpParser): Added a new `current_class' field
5476 and removed the `current_interface' one.
5477 (struct_declaration, class_declaration, interface_declaration):
5478 Set `current_class' to the newly created class/struct/interface;
5479 set their `Bases' and call Register() before parsing their body.
5481 2004-07-23 Martin Baulig <martin@ximian.com>
5483 * class.cs (Kind): New public enum.
5484 (TypeContainer): Made this class abstract.
5485 (TypeContainer.Kind): New public readonly field.
5486 (TypeContainer.CheckDef): New public method; moved here from
5488 (TypeContainer.Register): New public abstract method.
5489 (TypeContainer.GetPendingImplementations): New public abstract
5491 (TypeContainer.GetClassBases): Removed the `is_class' and
5492 `is_iface' parameters.
5493 (TypeContainer.DefineNestedTypes): Formerly known as
5495 (ClassOrStruct): Made this class abstract.
5497 * tree.cs (RootTypes): New public type.
5499 2004-07-20 Martin Baulig <martin@ximian.com>
5501 * tree.cs (Tree.RecordNamespace): Removed.
5502 (Tree.Namespaces): Removed.
5504 * rootcontext.cs (RootContext.IsNamespace): Removed.
5506 * cs-parser.jay (namespace_declaration): Just create a new
5507 NamespaceEntry here.
5509 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
5511 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
5512 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
5513 entry to make sure it runs in the correct runtime version.
5515 2004-07-18 Martin Baulig <martin@ximian.com>
5517 * generic.cs (ConstructedType.CheckConstraints): Improved
5518 constraints checking.
5520 2004-07-18 Martin Baulig <martin@ximian.com>
5522 * expression.cs (Invocation.BetterMethod): Call
5523 TypeManager.TypeToCoreType() on all types and removed my previous
5524 hack; we're already doig the right thing here.
5526 2004-07-17 Martin Baulig <martin@ximian.com>
5528 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
5530 2004-07-16 Martin Baulig <martin@ximian.com>
5532 * iterators.cs: Added generics support.
5534 2004-07-16 Martin Baulig <martin@ximian.com>
5536 * iterators.cs: Rewrote this. We're now using one single Proxy
5537 class for both the IEnumerable and the IEnumerator interface and
5538 `Iterator' derives from Class so we can use the high-level API.
5540 * class.cs (TypeContainer.AddIterator): New method.
5541 (TypeContainer.DoDefineType): New protected virtual method, which
5542 is called from DefineType().
5543 (TypeContainer.DoDefineMembers): Call DefineType() and
5544 DefineMembers() on all our iterators.
5545 (TypeContainer.Emit): Call Emit() on all our iterators.
5546 (TypeContainer.CloseType): Call CloseType() on all our iterators.
5548 * codegen.cs (EmitContext.CurrentIterator): New public field.
5550 2004-07-15 Martin Baulig <martin@ximian.com>
5553 (TypeManager.not_supported_exception_type): New type.
5555 2004-07-14 Martin Baulig <martin@ximian.com>
5558 (TypeManager.generic_ienumerable_type): New type.
5559 (TypeManager.generic_ienumerator_type): New type.
5562 (RootContext.interfaces_first_stage): Added
5563 "System.Collections.Generic.IEnumerator`1" and
5564 "System.Collections.Generic.IEnumerable`1".
5566 2004-07-14 Martin Baulig <martin@ximian.com>
5568 * iterators.cs: Use real error numbers.
5570 2004-07-14 Martin Baulig <martin@ximian.com>
5572 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
5573 requires this to be a System.Collection.IEnumerable and not a
5574 class implementing that interface.
5575 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
5577 2004-07-13 Marek Safar <marek.safar@seznam.cz>
5579 * class.cs: Fixed previous fix, it broke some error tests.
5581 2004-07-12 Martin Baulig <martin@ximian.com>
5583 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
5586 2004-07-14 Martin Baulig <martin@ximian.com>
5588 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
5589 an exclamation mark (!) for the generic arity to reflect the
5590 latest spec changes; ie. use "System.Collections.Generic.IList`1".
5592 2004-07-13 Martin Baulig <martin@ximian.com>
5594 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
5595 specifiers being part of a type argument.
5597 2004-07-13 Martin Baulig <martin@ximian.com>
5599 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
5600 name for generic types.
5602 2004-07-13 Martin Baulig <martin@ximian.com>
5604 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
5607 2004-07-09 Miguel de Icaza <miguel@ximian.com>
5609 * assign.cs (LocalTemporary): Add new argument: is_address,If
5610 `is_address' is true, then the value that we store is the address
5611 to the real value, and not the value itself.
5613 * ecore.cs (PropertyExpr): use the new local temporary
5614 stuff to allow us to handle X.Y += z (where X is a struct)
5616 2004-07-08 Martin Baulig <martin@ximian.com>
5618 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
5619 not always return, just like we're doing in Using.Resolve().
5621 2004-07-07 Miguel de Icaza <miguel@ximian.com>
5623 * cs-parser.jay (fixed_statement): flag this as Pinned.
5625 2004-07-06 Miguel de Icaza <miguel@ximian.com>
5627 * typemanager.cs (TypeManager): Removed MakePinned method, this
5628 mechanism is replaced with the .NET 2.x compatible mechanism of
5629 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
5631 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
5632 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
5633 `IsFixed' property which has a different meaning.
5635 2004-07-02 Raja R Harinath <rharinath@novell.com>
5637 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
5638 visible from inside a nested class, not just the names of the
5639 immediately enclosing class.
5642 2004-06-24 Raja R Harinath <rharinath@novell.com>
5644 * expression.cs (BetterConversion): Remove buggy special-case
5645 handling of "implicit constant expression conversions". At this
5646 point, we already know that the conversion is possible -- we're
5647 only checking to see which is better.
5649 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5651 * cs-parser.jay: Added error CS0210 test.
5653 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5655 * cs-parser.jay: Added error CS0134 test.
5657 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5660 * cs-parser.jay: Added error CS0145 test.
5662 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5664 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
5666 2004-06-23 Ben Maurer <bmaurer@ximian.com>
5668 * expression.cs (StackAlloc.Resolve): The argument may not
5669 be a constant; deal with this case.
5671 2004-06-23 Marek Safar <marek.safar@seznam.cz>
5673 * attribute.cs (IndexerName_GetIndexerName): Renamed to
5674 GetIndexerAttributeValue.
5675 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
5677 * class.cs (Indexer.Define): Added error tests for CS0415,
5680 2004-06-23 Miguel de Icaza <miguel@ximian.com>
5682 * attribute.cs (Attribute.Resolve): Keep field code in sync with
5685 2004-06-23 Martin Baulig <martin@ximian.com>
5687 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
5688 neither return nor throw, reset the barrier as well. Fixes #60457.
5690 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
5692 * class.cs : EventAttributes is now set to None by default.
5693 This fixes bug #60459.
5695 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5698 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5699 Don't throw exception but return null (it's sufficient now).
5701 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5703 * typemanager.cs (GetArgumentTypes): Faster implementation.
5705 2004-06-18 Martin Baulig <martin@ximian.com>
5707 * attribute.cs (Attribute.Resolve): Check whether we're an
5708 EmptyCast which a Constant child. Fixes #60333.
5710 2004-06-17 Ben Maurer <bmaurer@ximian.com>
5712 * statement.cs (EmitCollectionForeach): Account for the fact that
5713 not all valuetypes are in areas which we can take the address of.
5714 For these variables, we store to a temporary variable. Also, make
5715 sure that we dont emit a `callvirt' on a valuetype method.
5717 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5719 * expression.cs (StackAlloc.DoReSolve): Added test for
5720 negative parameter (CS0247).
5722 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5725 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
5727 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5730 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
5733 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5735 Fix bug #58254 & cs1555.cs, cs1556.cs
5736 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
5738 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5740 * cs-parser.jay: Added error CS1669 test for indexers.
5742 2004-06-18 Martin Baulig <martin@ximian.com>
5744 * generics.cs (GenericMethod.ctor): Don't take an Attributes
5745 argument. Fixes #60441.
5747 2004-06-16 Ben Maurer <bmaurer@ximian.com>
5748 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
5749 The name needs to have the actual name of the method in order
5750 for other tests (such as the one in OverloadResolve for Invoke
5751 on a delegate) to work. As well, it does not really help
5752 error reporting because the method group had multiple methods.
5753 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
5754 Make profiling work.
5756 2004-06-13 Martin Baulig <martin@ximian.com>
5758 * cs-parser.jay: Don't allow generic attributes.
5760 2004-06-13 Martin Baulig <martin@ximian.com>
5762 * class.cs (MemberBase.DoDefineBase): New protected method.
5763 (MemberBase.DoDefine): Compute the `flags' in the new
5764 DoDefineBase() which must be called first.
5765 (Method.Define): Call DoDefineBase() first so we have the flags
5766 when defining the generic method.
5768 * cs-parser.jay (interface_method_declaration): Support generic methods.
5770 2004-06-13 Martin Baulig <martin@ximian.com>
5772 * decl.cs (TypeName): Removed.
5773 (MemberName): Removed TypeName and MemberNow; now we just have
5776 * cs-parser.jay: Don't distinguish between type arguments and type
5777 parameters in the grammar and simplified the rules a bit. The
5778 reduce/reduce conflicts are now gone (except the one we inherited
5781 2004-06-11 Martin Baulig <martin@ximian.com>
5783 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
5784 call this twice: for params and varargs methods.
5786 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5789 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
5791 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5793 * attribute.cs (Attribute.GetValidTargets): Made public.
5796 (AbstractPropertyEventMethod): New class for better code sharing.
5797 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
5799 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
5801 2004-06-09 Martin Baulig <martin@ximian.com>
5803 * cs-parser.jay: Removed a reduce/reduce conflict.
5805 2004-06-03 Martin Baulig <martin@ximian.com>
5807 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
5808 GetSimpleName() and return a SimpleName.
5810 * ecore.cs (SimpleName.Arguments): New public field.
5811 (SimpleName): Added overloaded ctor which takes an additional
5812 TypeArguments argument.
5813 (SimpleName.SimpleNameResolve): Added support for generic methods.
5814 (MethodGroupExpr.ResolveGeneric): New public method. The code was
5815 formerly in MemberAccess.DoResolve(), but we also need it in
5816 SimpleNameResolve().
5818 * expression.cs (MemberAccess.DoResolve): Use the new
5819 MethodGroupExpr.ResolveGeneric().
5821 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5823 * decl.cs: If possible, use lookuptypedirect here. We can only do
5824 this if there is no `.' after the namespace. Avoids using
5825 LookupType, which does lots of slow processing.
5826 (FindNestedType) New method, does what it says :-).
5827 * namespace.cs: use LookupTypeDirect.
5828 * rootcontext.cs: use membercache, if possible.
5829 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
5831 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5834 According to the spec,
5836 In a member access of the form E.I, if E is a single identifier,
5837 and if the meaning of E as a simple-name (§7.5.2) is a constant,
5838 field, property, localvariable, or parameter with the same type as
5839 the meaning of E as a type-name (§3.8), then both possible
5840 meanings of E are permitted.
5842 We did not check that E as a simple-name had the same type as E as
5845 This trivial check gives us 5-7% on bootstrap time.
5847 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5849 * expression.cs (Invocation.OverloadResolve): Avoid the
5850 use of hashtables and boxing here by allocating on demand.
5852 2004-05-30 Martin Baulig <martin@ximian.com>
5854 * rootcontext.cs (RootContext.LookupType): Don't cache things if
5855 we're doing a silent lookup. Don't try to lookup nested types in
5856 TypeManager.object_type (thanks to Ben Maurer).
5858 2004-05-30 Martin Baulig <martin@ximian.com>
5860 Committing a patch from Ben Maurer.
5862 * rootcontext.cs (RootContext.LookupType): Cache negative results.
5864 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5866 * convert.cs: add a trivial cache for overload operator resolution.
5868 2004-05-31 Marek Safar <marek.safar@seznam.cz>
5871 (AttributeTester.GetObsoleteAttribute): Returns instance of
5872 ObsoleteAttribute when type is obsolete.
5875 (TypeContainer.VerifyObsoleteAttribute): Override.
5876 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
5877 (MethodCode.VerifyObsoleteAttribute): Override.
5878 (MemberBase.VerifyObsoleteAttribute): Override.
5881 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
5882 and report proper error.
5885 (Delegate.VerifyObsoleteAttribute): Override.
5888 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
5889 and report proper error.
5890 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
5893 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
5897 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
5898 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
5899 Added test for ObsoleteAttribute.
5902 (Catch): Derived from Statement.
5904 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5906 * decl.cs: If possible, use lookuptypedirect here. We can only do
5907 this if there is no `.' after the namespace. Avoids using
5908 LookupType, which does lots of slow processing.
5909 (FindNestedType) New method, does what it says :-).
5910 * namespace.cs: use LookupTypeDirect.
5911 * rootcontext.cs: use membercache, if possible.
5912 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
5914 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5917 According to the spec,
5919 In a member access of the form E.I, if E is a single identifier,
5920 and if the meaning of E as a simple-name (§7.5.2) is a constant,
5921 field, property, localvariable, or parameter with the same type as
5922 the meaning of E as a type-name (§3.8), then both possible
5923 meanings of E are permitted.
5925 We did not check that E as a simple-name had the same type as E as
5928 This trivial check gives us 5-7% on bootstrap time.
5930 2004-05-30 Marek Safar <marek.safar@seznam.cz>
5932 Fixed bug #59071 & cs0160.cs
5933 * statement.cs (Try.Resolve): Check here whether order of catch
5934 clauses matches their dependencies.
5936 2004-05-30 Marek Safar <marek.safar@seznam.cz>
5939 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
5942 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5944 * expression.cs (Invocation.OverloadResolve): Avoid the
5945 use of hashtables and boxing here by allocating on demand.
5947 2004-05-30 Martin Baulig <martin@ximian.com>
5949 * rootcontext.cs (RootContext.LookupType): Don't cache things if
5950 we're doing a silent lookup. Don't try to lookup nested types in
5951 TypeManager.object_type (thanks to Ben Maurer).
5953 2004-05-30 Martin Baulig <martin@ximian.com>
5955 Committing a patch from Ben Maurer.
5957 * rootcontext.cs (RootContext.LookupType): Cache negative results.
5959 2004-05-29 Martin Baulig <martin@ximian.com>
5961 * class.cs (IMethodData.ShouldIgnore): New method.
5963 * typemanager.cs (TypeManager.MethodFlags): Don't take a
5964 `Location' argument, we don't need it anywhere. Use
5965 `IMethodData.ShouldIgnore ()' instead of
5966 `MethodData.GetMethodFlags ()'.
5967 (TypeManager.AddMethod): Removed.
5968 (TypeManager.AddMethod2): Renamed to AddMethod.
5970 2004-05-29 Martin Baulig <martin@ximian.com>
5972 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
5974 * convert.cs (Convert.ImplicitReferenceConversion): If we're
5975 converting from a class type S to an interface type and we already
5976 have an object on the stack, don't box it again. Fixes #52578.
5978 2004-05-29 Martin Baulig <martin@ximian.com>
5980 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5981 Added support for `params' parameters. Fixes #59267.
5983 2004-05-29 Martin Baulig <martin@ximian.com>
5985 * literal.cs (NullPointer): Provide a private .ctor which sets
5986 `type' to TypeManager.object_type. Fixes #59048.
5988 2004-05-29 Martin Baulig <martin@ximian.com>
5990 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
5991 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
5993 * ecore.cs (EventExpr.instance_expr): Make the field private.
5995 2004-05-26 Marek Safar <marek.safar@seznam.cz>
5997 Fixed bug #50080 & cs0214-2.cs
5998 * expression.cs (Cast.DoResolve): Check unsafe context here.
6000 * statement.cs (Resolve.DoResolve): Likewise.
6002 2004-05-26 Martin Baulig <martin@ximian.com>
6004 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6006 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6007 (RootContext.LookupType): Pass down the `silent' flag.
6009 2004-05-25 Martin Baulig <martin@ximian.com>
6012 (MethodGroupExpr.IdenticalTypeName): New public property.
6013 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6014 expression actually refers to a type.
6016 2004-05-25 Martin Baulig <martin@ximian.com>
6018 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6019 for #56176 and made it actually work.
6021 2004-05-25 Martin Baulig <martin@ximian.com>
6023 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6024 (FieldExpr, PropertyExpr): Override and implement
6025 CacheTemporaries. Fixes #52279.
6027 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6029 * location.cs: In the new compiler listing a file twice is a
6030 warning, not an error.
6032 2004-05-24 Martin Baulig <martin@ximian.com>
6034 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6035 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6037 2004-05-24 Martin Baulig <martin@ximian.com>
6039 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6040 walking the `using' list. Fixes #53921.
6042 2004-05-24 Martin Baulig <martin@ximian.com>
6044 * const.cs (Const.LookupConstantValue): Added support for
6045 EmptyCast's; fixes #55251.
6047 2004-05-24 Martin Baulig <martin@ximian.com>
6049 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6050 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6051 which does the CS0135 check. The reason is that we first need to
6052 check whether the variable actually exists.
6054 2004-05-24 Martin Baulig <martin@ximian.com>
6056 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6057 than RootContext.LookupType() to find the explicit interface
6060 2004-05-24 Raja R Harinath <rharinath@novell.com>
6062 * Makefile: Simplify. Use executable.make.
6063 * mcs.exe.sources: New file. List of sources of mcs.exe.
6065 2004-05-24 Anders Carlsson <andersca@gnome.org>
6069 Use the invariant culture when doing String.Compare for CLS case
6072 2004-05-23 Martin Baulig <martin@ximian.com>
6074 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6075 don't have any dots. Fixes #52622, added cs0246-8.cs.
6077 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6079 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6081 * class.cs (MemberBase.Define): Reuse MemberType member for
6082 resolved type. Other methods can use it too.
6084 2004-05-23 Martin Baulig <martin@ximian.com>
6086 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6087 the variable also exists in the current block (otherwise, we need
6088 to report a CS0103). Fixes #58670.
6090 2004-05-23 Martin Baulig <martin@ximian.com>
6092 * flowanalysis.cs (Reachability.Reachable): Compute this
6093 on-the-fly rather than storing it as a field.
6095 2004-05-23 Martin Baulig <martin@ximian.com>
6097 * flowanalysis.cs (Reachability.And): Manually compute the
6098 resulting `barrier' from the reachability.
6100 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6103 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6104 instance of ObsoleteAttribute when symbol is obsolete.
6107 (IMethodData): Extended interface for ObsoleteAttribute support.
6109 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6111 * attribute.cs: Fix bug #55970
6113 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6117 (GetObsoleteAttribute): New method. Creates the instance of
6119 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6120 ObsoleteAttribute when member is obsolete.
6121 (AttributeTester.Report_ObsoleteMessage): Common method for
6122 Obsolete error/warning reporting.
6125 (TypeContainer.base_classs_type): New member for storing parent type.
6128 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6129 for this MemberCore.
6131 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6133 * attribute.cs, const.cs: Fix bug #58590
6135 2004-05-21 Martin Baulig <martin@ximian.com>
6137 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
6138 out parameters if the end of the method is unreachable. Fixes
6141 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6143 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
6144 Hari was right, why extra method.
6146 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6148 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
6150 2004-05-20 Martin Baulig <martin@ximian.com>
6152 * delegate.cs: Convert this file to Unix mode - like the original
6155 2004-05-20 Martin Baulig <martin@ximian.com>
6157 * attribute.cs: Convert this file to Unix mode - like the original
6160 2004-05-19 Marek Safar <marek.safar@seznam.cz>
6162 Fix bug #58688 (MCS does not report error when the same attribute
6165 * attribute.cs (Attribute.Emit): Distinction between null and default.
6167 2004-05-19 Raja R Harinath <rharinath@novell.com>
6169 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
6170 of a top-level attribute without an attribute target.
6171 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
6173 (Attribute.Conditional_GetConditionName),
6174 (Attribute.Obsolete_GetObsoleteMessage): Update.
6175 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
6176 part of ScanForIndexerName.
6177 (Attribute.CanIgnoreInvalidAttribute): New function.
6178 (Attribute.ScanForIndexerName): Move to ...
6179 (Attributes.ScanForIndexerName): ... here.
6180 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
6181 (Attributes.Search): New internal variant that can choose not to
6182 complain if types aren't resolved. The original signature now
6184 (Attributes.GetClsCompliantAttribute): Use internal variant, with
6185 complaints suppressed.
6186 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
6187 only if it not useful.
6188 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
6189 top-level for attributes that are shared between the assembly
6190 and a top-level class.
6191 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
6192 * class.cs: Update to reflect changes.
6193 (DefineIndexers): Fuse loops.
6194 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
6195 a couple more variants of attribute names.
6197 2004-05-18 Marek Safar <marek.safar@seznam.cz>
6199 Fix bug #52585 (Implemented explicit attribute declaration)
6202 (Attributable.ValidAttributeTargets): New abstract method. It gets
6203 list of valid attribute targets for explicit target declaration.
6204 (Attribute.Target): It holds target itself.
6205 (AttributeSection): Removed.
6206 (Attribute.CheckTargets): New method. It checks whether attribute
6207 target is valid for the current element.
6210 (EventProperty): New class. For events that are declared like
6211 property (with add and remove accessors).
6212 (EventField): New class. For events that are declared like field.
6215 * cs-parser.jay: Implemented explicit attribute target declaration.
6217 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
6218 Override ValidAttributeTargets.
6221 (ReturnParameter): Class for applying custom attributes on
6223 (ParameterAtribute): New class. Class for applying custom
6224 attributes on the parameter type.
6226 2004-05-17 Miguel de Icaza <miguel@ximian.com>
6228 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
6231 (Method): Allow UNSAFE here.
6233 * modifiers.cs: Support unsafe reporting.
6235 2004-05-17 Marek Safar <marek.safar@seznam.cz>
6237 * decl.cs: Fix bug #58478.
6239 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6241 * statement.cs: When checking for unreachable code on an EmptyStatement,
6242 set the location. Fixes bug #58488.
6244 2004-05-13 Miguel de Icaza <miguel@ximian.com>
6246 * driver.cs: Add -pkg handling.
6248 From Gonzalo: UseShelLExecute=false
6250 2004-05-12 Marek Safar <marek.safar@seznam.cz>
6253 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
6255 (Attribute.IsClsCompliaceRequired): Moved to base for better
6257 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
6258 when attribute is AttributeUsageAttribute.
6259 (Attribute.GetValidTargets): Simplified.
6260 (Attribute.GetAttributeUsage): New method returns AttributeUsage
6261 attribute for this type.
6262 (Attribute.ApplyAttributes): Method renamed to Emit and make
6264 (GlobalAttributeSection): New class for special handling of global
6265 attributes (assembly, module).
6266 (AttributeSection.Emit): New method.
6268 * class.cs: Implemented Attributable abstract methods.
6269 (MethodCore.LabelParameters): Moved to Parameter class.
6270 (Accessor): Is back simple class.
6271 (PropertyMethod): Implemented Attributable abstract class.
6272 (DelegateMethod): Implemented Attributable abstract class.
6273 (Event): New constructor for disctintion between normal Event
6274 and Event with accessors.
6276 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
6278 * codegen.cs, const.cs, decl.cs, delegate.cs:
6279 (CommonAssemblyModulClass): Implemented Attributable abstract class
6282 * enum.cs: Implement IAttributeSupport interface.
6283 (EnumMember): New class for emum members. Implemented Attributable
6287 (ParameterBase): Is abstract.
6288 (ReturnParameter): New class for easier [return:] attribute handling.
6290 * typemanager.cs: Removed builder_to_attr.
6292 2004-05-11 Raja R Harinath <rharinath@novell.com>
6295 * attribute.cs (Attribute.GetPositionalValue): New function.
6296 * class.cs (TypeContainer.VerifyMembers): New function.
6297 (TypeContainer.Emit): Use it.
6298 (ClassOrStruct): New base class for Class and Struct.
6299 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
6300 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
6302 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
6303 then each non-static field should have a FieldOffset attribute.
6304 Otherwise, none of the fields should have a FieldOffset attribute.
6305 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
6306 and FieldOffset attributes.
6307 * typemanager.cs (TypeManager.struct_layout_attribute_type)
6308 (TypeManager.field_offset_attribute_type): New core types.
6309 (TypeManager.InitCoreTypes): Initialize them.
6311 2004-05-11 Michal Moskal <malekith@pld-linux.org>
6313 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
6314 Return correct type.
6317 2004-05-09 Miguel de Icaza <miguel@ximian.com>
6319 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
6320 be implicitly converted to ulong.
6322 * expression.cs: The logic for allowing operator &, | and ^ worked
6323 was wrong, it worked before because we did not report an error in
6324 an else branch. Fixes 57895.
6326 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
6327 allow volatile fields to be reference types.
6329 2004-05-07 Miguel de Icaza <miguel@ximian.com>
6331 * driver.cs: Add support for /debug-
6333 2004-05-07 Raja R Harinath <rharinath@novell.com>
6335 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
6336 Add a 'complain' parameter to silence errors.
6337 (Attribute.Resolve): Update to changes. Put in sanity check to catch
6338 silently overlooked type-resolutions.
6339 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
6341 (Attributes.Search): New function.
6342 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
6343 (Attributes.GetAttributeFullName): Remove hack.
6344 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
6345 Update to reflect changes.
6346 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
6347 Use Attributes.Search instead of nested loops.
6349 2004-05-07 Marek Safar <marek.safar@seznam.cz>
6352 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
6353 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
6354 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
6356 * report.cs: (Report.Warning): Renamed to Warning_T because of
6357 parameter collision.
6359 2004-05-05 Raja R Harinath <rharinath@novell.com>
6361 * expression.cs (MemberAccess.ResolveMemberAccess):
6362 Exit with non-zero status after Report.Error.
6363 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
6365 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
6367 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6369 * support.cs: Don't hang when the file is empty.
6371 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6373 * support.cs: In SeekableStreamReader, compute the preamble size of the
6374 underlying stream. Position changes should take into account that initial
6377 2004-05-03 Todd Berman <tberman@sevenl.net>
6379 * driver.cs: remove unused GetSysVersion function.
6381 2004-05-03 Todd Berman <tberman@sevenl.net>
6383 * driver.cs: Remove the hack from saturday, as well as the hack
6384 from jackson (LoadAssemblyFromGac), also adds the CWD to the
6385 link_paths to get that bit proper.
6387 2004-05-01 Todd Berman <tberman@sevenl.net>
6389 * driver.cs: Try a LoadFrom before a Load, this checks the current
6390 path. This is currently a bug in mono that is be fixed, however, this
6391 provides a workaround for now. This will be removed when the bug
6394 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
6396 * CryptoConvert.cs: Updated to latest version. Fix issue with
6397 incomplete key pairs (#57941).
6399 2004-05-01 Todd Berman <tberman@sevenl.net>
6401 * driver.cs: Remove '.' from path_chars, now System.* loads properly
6404 2004-04-30 Jackson Harper <jackson@ximian.com>
6406 * codegen.cs: Open keys readonly.
6408 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6410 * typemanager.cs: don't report cyclic struct layout when a struct
6411 contains 2 or more fields of the same type. Failed for Pango.AttrShape
6412 which has 2 Pango.Rectangle fields.
6414 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
6416 * expression.cs: Handle IntPtr comparisons with IL code
6417 rather than a method call.
6419 2004-04-29 Martin Baulig <martin@ximian.com>
6421 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
6422 the list of PropertyInfo's in class hierarchy and find the
6423 accessor. Fixes #56013.
6425 2004-04-29 Martin Baulig <martin@ximian.com>
6427 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
6429 2004-04-29 Martin Baulig <martin@ximian.com>
6431 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6433 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
6435 2004-04-29 Martin Baulig <martin@ximian.com>
6437 * class.cs (ConstructorInitializer.Resolve): Check whether the
6438 parent .ctor is accessible. Fixes #52146.
6440 2004-04-29 Martin Baulig <martin@ximian.com>
6442 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6444 * statement.cs (Using.EmitLocalVariableDecls): Use
6445 TypeManager.idisposable_type, not typeof (IDisposable).
6446 (Foreach.EmitCollectionForeach): Added support for valuetypes.
6448 2004-04-29 Martin Baulig <martin@ximian.com>
6450 * class.cs (Event.Define): Don't emit the field and don't set
6451 RTSpecialName and SpecialName for events on interfaces. Fixes
6454 2004-04-29 Raja R Harinath <rharinath@novell.com>
6456 Refactor Attribute.ApplyAttributes.
6457 * attribute.cs (Attributable): New base class for objects that can
6458 have Attributes applied on them.
6459 (Attribute): Make AttributeUsage fields public.
6460 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
6461 (Attribute.IsInternalCall): New property.
6462 (Attribute.UsageAttr): Convert to a public read-only property.
6463 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
6464 (Attribute.ResolveType, Attribute.Resolve)
6465 (Attribute.ScanForIndexerName): Update to reflect changes.
6466 (Attribute.CheckAttributeTarget): Re-format.
6467 (Attribute.ApplyAttributes): Refactor, to various
6468 Attributable.ApplyAttributeBuilder methods.
6469 * decl.cs (MemberCore): Make Attributable.
6470 * class.cs (Accessor): Make Attributable.
6471 (MethodData.ApplyAttributes): Use proper attribute types, not
6473 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
6474 (TypeContainer.ApplyAttributeBuilder)
6475 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
6476 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
6477 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
6478 (Operator.ApplyAttributeBuilder): New factored-out methods.
6479 * const.cs (Const.ApplyAttributeBuilder): Likewise.
6480 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
6481 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
6482 * parameter.cs (ParameterBase): New Attributable base class
6483 that can also represent Return types.
6484 (Parameter): Update to the changes.
6486 2004-04-29 Jackson Harper <jackson@ximian.com>
6488 * driver.cs: Prefer the corlib system version when looking for
6489 assemblies in the GAC. This is still a hack, but its a better hack
6492 2004-04-29 Marek Safar <marek.safar@seznam.cz>
6494 * decl.cs, enum.cs: Improved error 3005 reporting.
6496 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
6497 (related_symbols): New private member for list of symbols
6498 related to reported error/warning.
6500 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
6502 2004-04-29 Martin Baulig <martin@ximian.com>
6504 * ecore.cs (Expression.Constantify): If we're an enum and
6505 TypeManager.TypeToCoreType() doesn't give us another type, use
6506 t.UnderlyingSystemType. Fixes #56178.
6508 2004-04-29 Martin Baulig <martin@ximian.com>
6510 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
6511 interfaces and for each interface, only add members directly
6512 declared in that interface. Fixes #53255.
6514 2004-04-28 Martin Baulig <martin@ximian.com>
6516 * expression.cs (ConditionalLogicalOperator): Use a temporary
6517 variable for `left' to avoid that we evaluate it more than once;
6520 2004-04-28 Martin Baulig <martin@ximian.com>
6522 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
6525 2004-04-28 Martin Baulig <martin@ximian.com>
6527 * statement.cs (LocalInfo.Resolve): Check whether the type is not
6530 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
6531 whether the type is not void (CS1547).
6533 2004-04-28 Martin Baulig <martin@ximian.com>
6535 * expression.cs (Unary.DoResolveLValue): Override this and report
6536 CS0131 for anything but Operator.Indirection.
6538 2004-04-28 Martin Baulig <martin@ximian.com>
6540 Committing a patch from Ben Maurer; see bug #50820.
6542 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6545 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6548 2004-04-28 Martin Baulig <martin@ximian.com>
6550 Committing a patch from Ben Maurer; see bug #50820.
6552 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6555 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6558 2004-04-28 Martin Baulig <martin@ximian.com>
6560 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
6561 (Block.AddLabel): Call DoLookupLabel() to only search in the
6564 2004-04-28 Martin Baulig <martin@ximian.com>
6566 * cfold.cs (ConstantFold.BinaryFold): Added special support for
6567 comparing StringConstants and NullLiterals in Equality and Inequality.
6569 2004-04-28 Jackson Harper <jackson@ximian.com>
6571 * driver.cs: Attempt to load referenced assemblies from the
6572 GAC. This is the quick and dirty version of this method that
6573 doesnt take into account versions and just takes the first
6574 canidate found. Will be good enough for now as we will not have more
6575 then one version installed into the GAC until I update this method.
6577 2004-04-28 Martin Baulig <martin@ximian.com>
6579 * typemanager.cs (TypeManager.CheckStructCycles): New public
6580 static method to check for cycles in the struct layout.
6582 * rootcontext.cs (RootContext.PopulateTypes): Call
6583 TypeManager.CheckStructCycles() for each TypeContainer.
6584 [Note: We only need to visit each type once.]
6586 2004-04-28 Martin Baulig <martin@ximian.com>
6588 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
6590 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
6591 success and added `out object value'. Use a `bool resolved' field
6592 to check whether we've already been called rather than
6593 `ConstantValue != null' since this breaks for NullLiterals.
6595 2004-04-28 Raja R Harinath <rharinath@novell.com>
6597 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
6598 setting of this flag, since the 'set' method may be non-public.
6600 2004-04-28 Raja R Harinath <rharinath@novell.com>
6602 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
6603 check on current_vector.Block.
6605 2004-04-27 Martin Baulig <martin@ximian.com>
6607 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
6608 a field initializer. Fixes #56459.
6610 2004-04-27 Martin Baulig <martin@ximian.com>
6612 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
6613 we're not attempting to use an indexer. Fixes #52154.
6615 2004-04-27 Martin Baulig <martin@ximian.com>
6617 * statement.cs (Return): Don't create a return label if we don't
6618 need it; reverts my change from January 20th. Thanks to Ben
6621 2004-04-27 Martin Baulig <martin@ximian.com>
6623 According to the spec, `goto' can only leave a nested scope, but
6626 * statement.cs (Block.LookupLabel): Only lookup in the current
6627 block, don't recurse into parent or child blocks.
6628 (Block.AddLabel): Check in parent and child blocks, report
6629 CS0140/CS0158 if we find a duplicate.
6630 (Block): Removed this indexer for label lookups.
6631 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
6632 this already does the error reporting for us.
6635 (FlowBranching.UsageVector.Block): New public variable; may be null.
6636 (FlowBranching.CreateSibling): Added `Block' argument.
6637 (FlowBranching.LookupLabel): New public virtual method. Lookup a
6638 label for the target of a `goto' and check whether we're not
6639 leaving a `finally'.
6641 2004-04-27 Martin Baulig <martin@ximian.com>
6643 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
6644 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
6647 2004-04-27 Martin Baulig <martin@ximian.com>
6649 * statement.cs (Block.AddLabel): Also check for implicit blocks
6650 and added a CS0158 check.
6652 2004-04-27 Martin Baulig <martin@ximian.com>
6654 * flowanalysis.cs (FlowBranchingLoop): New class.
6655 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
6656 UsageVector's instead of an ArrayList.
6657 (FlowBranching.Label): Likewise.
6658 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
6659 (FlowBranching.AddBreakVector): New method.
6661 2004-04-27 Miguel de Icaza <miguel@ximian.com>
6663 * attribute.cs: Small regression fix: only convert the type if we
6664 the type is different, fixes System.Drawing build.
6666 2004-04-27 Martin Baulig <martin@ximian.com>
6668 * attribute.cs (Attribute.Resolve): If we have a constant value
6669 for a named field or property, implicity convert it to the correct
6672 2004-04-27 Raja R Harinath <rharinath@novell.com>
6674 * statement.cs (Block.Block): Implicit blocks share
6675 'child_variable_names' fields with parent blocks.
6676 (Block.AddChildVariableNames): Remove.
6677 (Block.AddVariable): Mark variable as "used by a child block" in
6678 every surrounding block.
6679 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
6680 been used in a child block, complain about violation of "Invariant
6681 meaning in blocks" rule.
6682 * cs-parser.jay (declare_local_variables): Don't use
6683 AddChildVariableNames.
6684 (foreach_statement): Don't create an implicit block: 'foreach'
6687 2004-04-23 Miguel de Icaza <miguel@ximian.com>
6689 * convert.cs (ImplicitNumericConversion): 0 is also positive when
6690 converting from 0L to ulong. Fixes 57522.
6692 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6694 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
6695 derived class hides via 'new' keyword field from base class (test-242.cs).
6696 TODO: Handle this in the more general way.
6698 * class.cs (CheckBase): Ditto.
6700 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6702 * decl.cs (caching_flags): New member for storing cached values
6704 (MemberCore.Flags): New enum where bit flags for caching_flags
6706 (MemberCore.cls_compliance): Moved to caching_flags.
6707 (DeclSpace.Created): Moved to caching_flags.
6709 * class.cs: Use caching_flags instead of DeclSpace.Created
6711 2004-04-21 Miguel de Icaza <miguel@ximian.com>
6713 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
6714 if we are only a derived class, not a nested class.
6716 * typemanager.cs: Same as above, but do this at the MemberLookup
6717 level (used by field and methods, properties are handled in
6718 PropertyExpr). Allow for the qualified access if we are a nested
6721 2004-04-21 Marek Safar <marek.safar@seznam.cz>
6723 * class.cs: Refactoring.
6724 (IMethodData): New inteface; Holds links to parent members
6725 to avoid member duplication (reduced memory allocation).
6726 (Method): Implemented IMethodData interface.
6727 (PropertyBase): New inner classes for get/set methods.
6728 (PropertyBase.PropertyMethod): Implemented IMethodData interface
6729 (Event): New inner classes for add/remove methods.
6730 (Event.DelegateMethod): Implemented IMethodData interface.
6732 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
6733 EmitContext (related to class.cs refactoring).
6735 2004-04-21 Raja R Harinath <rharinath@novell.com>
6737 * delegate.cs (Delegate.VerifyApplicability): If the number of
6738 arguments are the same as the number of parameters, first try to
6739 verify applicability ignoring any 'params' modifier on the last
6743 2004-04-08 Martin Baulig <martin@ximian.com>
6745 Merged latest changes into gmcs. Please keep this comment in
6746 here, it makes it easier for me to see what changed in MCS since
6747 the last time I merged.
6749 2004-04-16 Raja R Harinath <rharinath@novell.com>
6751 * class.cs (TypeContainer.AddIndexer): Use
6752 'ExplicitInterfaceName' to determine if interface name was
6753 explicitly specified. 'InterfaceType' is not initialized at this time.
6754 (TypeContainer.DefineIndexers): Remove use of temporary list. The
6755 Indexers array is already in the required order. Initialize
6756 'IndexerName' only if there are normal indexers.
6757 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
6758 (TypeContainer.Emit): Emit DefaultMember attribute only if
6759 IndexerName is initialized.
6762 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
6764 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
6767 2004-04-15 Raja R Harinath <rharinath@novell.com>
6769 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
6773 * attribute.cs (Attribute.Resolve): Check for duplicate named
6777 2004-04-15 Miguel de Icaza <miguel@ximian.com>
6779 * iterators.cs (MarkYield): track whether we are in an exception,
6780 and generate code accordingly. Use a temporary value to store the
6781 result for our state.
6783 I had ignored a bit the interaction of try/catch with iterators
6784 since their behavior was not entirely obvious, but now it is
6785 possible to verify that our behavior is the same as MS .NET 2.0
6789 2004-04-14 Miguel de Icaza <miguel@ximian.com>
6791 * iterators.cs: Avoid creating temporaries if there is no work to
6794 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
6795 Enumerations, use TypeManager.EnumToUnderlying and call
6798 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
6801 (This.Emit): Use EmitContext.EmitThis to emit our
6804 (This.EmitAssign): Ditto.
6806 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
6807 codepaths, we will move all the functionality into
6810 (FieldExpr.EmitAssign): Ditto.
6812 This fixes several hidden bugs that I uncovered while doing a code
6813 review of this today.
6815 * codegen.cs (EmitThis): reworked so the semantics are more clear
6816 and also support value types "this" instances.
6818 * iterators.cs: Changed so that for iterators in value types, we
6819 do not pass the value type as a parameter.
6821 Initialization of the enumerator helpers is now done in the caller
6822 instead of passing the parameters to the constructors and having
6823 the constructor set the fields.
6825 The fields have now `assembly' visibility instead of private.
6827 2004-04-11 Miguel de Icaza <miguel@ximian.com>
6829 * expression.cs (Argument.Resolve): Check if fields passed as ref
6830 or out are contained in a MarshalByRefObject.
6832 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
6833 another compiler type.
6835 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
6837 * class.cs (Indexer.Define): use the new name checking method.
6838 Also, return false on an error.
6839 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
6840 (is_identifier_[start/part]_character): make static.
6842 2004-04-10 Miguel de Icaza <miguel@ximian.com>
6844 * expression.cs (Binary.ResolveOperator): Do no append strings
6845 twice: since we can be invoked more than once (array evaluation)
6846 on the same concatenation, take care of this here. Based on a fix
6847 from Ben (bug #56454)
6849 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
6851 * codegen.cs: Fix another case where CS1548 must be reported (when
6852 delay-sign isn't specified and no private is available #56564). Fix
6853 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
6854 error when MCS is used on the MS runtime and we need to delay-sign
6855 (which seems unsupported by AssemblyBuilder - see #56621).
6857 2004-04-08 Marek Safar <marek.safar@seznam.cz>
6859 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
6860 (TypeManager.ComputeNamespaces): Faster implementation for
6863 * compiler.csproj: Updated AssemblyName to mcs.
6865 2004-05-11 Jackson Harper <jackson@ximian.com>
6867 * Makefile: Preserve MONO_PATH
6869 2004-05-11 Jackson Harper <jackson@ximian.com>
6871 * Makefile: Use mono and mcs to build gmcs
6873 2004-05-03 Miguel de Icaza <miguel@ximian.com>
6875 * codegen.cs: Add patch from Robert Shade
6876 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
6879 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
6881 * CryptoConvert.cs: Updated to latest version. Fix issue with
6882 incomplete key pairs (#57941).
6884 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
6886 * codegen.cs: Fix another case where CS1548 must be reported (when
6887 delay-sign isn't specified and no private is available #56564). Fix
6888 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
6889 error when MCS is used on the MS runtime and we need to delay-sign
6890 (which seems unsupported by AssemblyBuilder - see #56621).
6892 2004-04-29 Jackson Harper <jackson@ximian.com>
6894 * Makefile: Set MONO_PATH to use the bootstrap corlib
6895 * driver.cs: Check the GAC for referenced assemblies.
6897 2004-04-29 Martin Baulig <martin@ximian.com>
6899 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
6901 2004-04-07 Martin Baulig <martin@ximian.com>
6903 * expression.cs (Binary.ResolveOperator): Added special case for
6904 Equality/Inequality between a type parameter and a null literal.
6906 2004-04-07 Martin Baulig <martin@ximian.com>
6908 * convert.cs: Check null literal -> type parameter conversions.
6910 2004-04-07 Martin Baulig <martin@ximian.com>
6912 * generic.cs (ConstructedType.CheckConstraints): Enforce the
6913 `class' and `struct' constraints.
6915 2004-04-07 Martin Baulig <martin@ximian.com>
6917 * generic.cs (SpecialConstraint): New public enum.
6918 (Constraints.Resolve): Added support for the `class' and `struct'
6921 * cs-parser.jay (type_parameter_constraint): Added support for the
6922 `class' and `struct' constraints.
6924 2004-04-07 Martin Baulig <martin@ximian.com>
6926 * support.cs (GenericConstraints): Replaced `Types' by
6927 `ClassConstraint' and `InterfaceConstraints'; added
6928 `HasClassConstraint'.
6930 2004-04-07 Martin Baulig <martin@ximian.com>
6933 (Constraints.InterfaceConstraints): New public property.
6934 (Constraints.Types): Make this property public
6935 (TypeParameter): Implement IMemberContainer.
6936 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
6937 instead of a TypeBuilder/MethodBuilder; pass the interface
6938 constraints to TypeManager.AddTypeParameter().
6939 (TypeParameter.DefineType): Just take an EmitContext and no
6940 TypeBuilder/MethodBuilder. Use the new public API.
6942 * typemanager.cs (TypeManager.AddTypeParameter): Added
6943 `TypeExpr[]' argument; add the interfaces to the
6944 `builder_to_ifaces' hash.
6945 (TypeManager.LookupMemberContainer): For
6946 GenericTypeParameterBuilders, get the TypeParameter from the
6947 `builder_to_type_param'.
6948 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
6949 the TypeParameter and call FindMembers on it.
6951 2004-04-07 Martin Baulig <martin@ximian.com>
6954 (MethodCore.GenericMethod): Moved this field here from Method.
6955 (MethodCore.IsDuplicateImplementation): Take the number of type
6956 parameters into account if we're a generic method.
6958 * expression.cs (Invocation.InferTypeArguments): Don't return true
6959 if `arguments' is null; we still need to check whether we actually
6960 don't need to infer anything in this case.
6961 (MemberAccess): Merged the functionality from GenericMemberAccess
6964 * generic.cs (GenericMemberAccess): Removed.
6966 2004-04-05 Martin Baulig <martin@ximian.com>
6968 * decl.cs (MemberCore): For generic classes, interfaces and
6969 structs, `Name' now includes the number of type parameters
6971 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
6972 encode the number of type arguments in the type name.
6974 * expression.cs (Expression.MemberLookup): Removed the
6975 `num_type_args' argument; we now encode the number of type
6976 arguments in the type name.
6978 * ecore.cs (SimpleName): Encode the number of type arguments in
6979 the type name itself.
6981 * generic.cs (ConstructedType): Likewise.
6983 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
6984 `MemberName'; we now include the number of type parameters in the
6987 * typemanager.cs (TypeManager.CheckGeneric): Removed.
6988 (TypeManager.MemberLookup): Removed the
6989 `num_type_args' argument; we now encode the number of type
6990 arguments in the type name.
6992 2004-04-03 Martin Baulig <martin@ximian.com>
6994 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
6995 (MemberCore.MemberName): Moved here from MemberBase.
6996 (DeclSpace.SetParameterInfo): Just take the constraints as an
6997 ArrayList; we already have the type parameters in our
6998 `MemberName'; also do the CS0080 reporting here.
7000 * cs-parser.jay (struct_declaration): Use `member_name' instead of
7001 `IDENTIFIER opt_type_parameter_list'; when constructing our
7002 `MemberName', it'll already include our type parameters.
7003 (class_declaration, interface_declaration): Likewise.
7004 (delegate_declaration): Likewise.
7005 (MakeName): Take a MemberName and return a MemberName.
7006 The following two changes are required to avoid shift/reduce conflicts:
7007 (member_name): Don't include a TypeName anymore; ie. this is now
7008 just 'IDENTIFIER opt_type_parameter_list'.
7009 (property_declaration, event_declaration): Use a
7010 `namespace_or_type_name' instead of a `member_name'.
7012 2004-04-03 Martin Baulig <martin@ximian.com>
7014 * decl.cs (MemberName): Renamed to `TypeName' and created a new
7016 (TypeName): Formerly known as MemberName.
7018 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
7019 instead of a `MemberName'.
7021 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
7022 (member_name): New rule; create a MemberName.
7024 2004-04-02 Martin Baulig <martin@ximian.com>
7026 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
7027 (CS0305 and CS0308).
7029 2004-04-02 Martin Baulig <martin@ximian.com>
7031 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
7032 support for nested types.
7034 2004-04-02 Martin Baulig <martin@ximian.com>
7036 * ecore.cs (IAlias): New public interface.
7037 (TypeExpr, TypeExpression): Implement IAlias.
7038 (TypeAliasExpression): New public class.
7040 * namespace.cs (Namespace): Implement IAlias.
7041 (Namespace.Lookup): Return an IAlias instead on an object.
7042 (Namespace.DefineName): Take an IAlias instead of an object.
7043 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
7045 (NamespaceEntry.UsingAlias): Take a Membername instead of an
7047 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
7049 (NamespaceEntry.Lookup): Likewise.
7051 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
7054 * decl.cs (DeclSpace): Implement IAlias.
7055 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
7057 * generic.cs (ConstructedType): Improved error checking.
7059 2004-04-02 Martin Baulig <martin@ximian.com>
7061 * convert.cs: Added type parameter conversions.
7064 (UnboxCast.Emit): Emit an `unbox.any' for type params.
7065 (ClassCast.Emit): If the source type is a type parameter, box it.
7066 If the target type is a type parameter, emit an `unbox.any'
7067 instead of a `classcast'.1
7069 2004-04-01 Martin Baulig <martin@ximian.com>
7071 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
7073 2004-04-01 Martin Baulig <martin@ximian.com>
7075 * generic.cs (ConstructedType.CheckConstraints): Use
7076 Convert.ImplicitStandardConversionExists(); user-defined implicit
7077 conversions are not allowed according to the spec.
7079 2004-03-30 Martin Baulig <martin@ximian.com>
7081 * expression.cs (New): Added support for type parameters.
7084 (TypeManager.activator_type): New public static field.
7085 (TypeManager.activator_create_instance): Likewise.
7087 2004-03-30 Martin Baulig <martin@ximian.com>
7089 * typemanager.cs (TypeManager.HasConstructorConstraint): New
7092 2004-03-30 Martin Baulig <martin@ximian.com>
7094 * generic.cs (ConstructedType.CheckConstraints): Actually follow
7095 the spec here: the argument type must be convertible to the
7098 2004-03-30 Martin Baulig <martin@ximian.com>
7101 (TypeParameter.Define, TypeParameter.DefineMethod): Call
7102 TypeManager.AddTypeParameter().
7103 (ConstructedType.CheckConstraints): Re-enable this and actually
7104 check whether we have a constructor constraint.
7107 (TypeManager.builder_to_type_param): New static field.
7108 (TypeManager.AddTypeParameter): New static method.
7109 (TypeManager.LookupTypeParameter): New public method.
7111 2004-03-30 Martin Baulig <martin@ximian.com>
7113 * generic.cs (TypeParameter.DefineType): Return a boolean and use
7114 the new API to actually define the constructor constraint.
7117 (TypeManager.new_constraint_attr_type): New static field.
7118 (TypeManager.InitCoreTypes): Initialize it.
7120 2004-03-30 Martin Baulig <martin@ximian.com>
7122 * generic.cs (Constraints): Completed error checking, use correct
7125 2004-03-29 Martin Baulig <martin@ximian.com>
7127 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
7129 * expression.cs (Invocation.InferTypeArguments): Added overloaded
7130 public version which takes a `ParameterData pd' instead of an
7133 2004-03-29 Martin Baulig <martin@ximian.com>
7135 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
7138 2004-03-29 Martin Baulig <martin@ximian.com>
7140 * expression.cs (Argument.ResolveMethodGroup): If we're a
7141 ConstructedType, call GetMemberAccess() on it.
7143 2004-03-29 Martin Baulig <martin@ximian.com>
7145 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
7146 (MethodCore.CheckGenericOverride): When overriding a generic
7147 method, check whether the constraints match.
7149 * support.cs (GenericConstraints): New public interface.
7150 (ParameterData.GenericConstraints): New public method.
7152 * parameter.cs (Parameter.Resolve): Check whether we're a generic
7153 method parameter and compute our constraints if appropriate.
7154 (Parameter.GenericConstraints): New public property.
7156 * generic.cs (Constraints): Implement GenericConstraints.
7158 2004-03-29 Martin Baulig <martin@ximian.com>
7160 * decl.cs (MemberCache.FindMemberToOverride): Use
7161 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
7163 2004-03-29 Martin Baulig <martin@ximian.com>
7165 * generic.cs (GenericMethod.Define): Resolve our type parameters.
7167 2004-03-29 Martin Baulig <martin@ximian.com>
7169 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
7170 not allowed on non-generic declarations").
7172 2004-03-29 Martin Baulig <martin@ximian.com>
7174 * expression.cs (Invocation.InferTypeArguments): Added overloaded
7175 public version of this method.
7177 * class.cs (MethodCore.IsDuplicateImplementation): Use
7178 Invocation.InferTypeArguments() to check this.
7180 2004-03-29 Martin Baulig <martin@ximian.com>
7182 * convert.cs: Use TypeManager.IsDelegateType() instead of
7183 comparing types correctly.
7185 2004-03-29 Martin Baulig <martin@ximian.com>
7187 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
7188 types directly to make it work for generic instances.
7190 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
7192 2004-03-29 Martin Baulig <martin@ximian.com>
7194 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
7197 2004-03-24 Martin Baulig <martin@ximian.com>
7199 * decl.cs (DeclSpace.FindType): Also use
7200 TypeManager.CheckGeneric() for types from the using clauses.
7202 2004-03-23 Martin Baulig <martin@ximian.com>
7204 * expression.cs (Invocation.OverloadResolve): Added `bool
7205 may_fail' argument and use it instead of the Location.IsNull() hack.
7207 2004-03-23 Martin Baulig <martin@ximian.com>
7209 * expression.cs (Invocation.InferType): Use correct type inference
7212 2004-03-23 Martin Baulig <martin@ximian.com>
7214 * ecore.cs (MethodGroupExpr.Name): Use
7215 TypeManager.CSharpSignature() instead of just the name.
7217 * expression.cs (Invocation.OverloadResolve): Provide better error
7219 (Invocation.DoResolve): OverloadResolve() never returns null
7220 without reporting an error, so removed the error -6 reporting here.
7222 2004-03-23 Martin Baulig <martin@ximian.com>
7224 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
7227 * cs-parser.jay (delegate_declaration): Support generic delegates.
7229 * delegate.cs: Support generic delegates.
7231 2004-03-22 Martin Baulig <martin@ximian.com>
7233 * expression.cs (Invocation.InferParamsTypeArguments): New static
7234 method; does type inference for params arguments.
7236 2004-03-21 Martin Baulig <martin@ximian.com>
7238 * typemanager.cs (TypeManager.IsGenericMethod): New public static
7239 method; checks whether a method is a generic method.
7241 * expression.cs (Invocation.InferTypeArguments): New static method;
7242 infer type arguments for generic method invocation.
7244 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
7245 property; we set this to true if we're resolving a generic method
7246 invocation and the user specified type arguments, ie. we're not
7247 doing type inference.
7249 2004-03-20 Martin Baulig <martin@ximian.com>
7251 * class.cs (MethodData.DeclaringType): New public property.
7252 (MethodData.Define): Set DeclaringType here.
7253 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
7254 instead of OperatorMethodBuilder.DeclaringType.
7256 2004-03-20 Martin Baulig <martin@ximian.com>
7258 * cs-tokenizer.cs (xtoken): Return a special
7259 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
7261 * cs-parser.jay (default_value_expression): Switch to the new
7264 2004-03-19 Martin Baulig <martin@ximian.com>
7266 * decl.cs (MemberName): New class. We use this to "construct"
7267 namespace_or_type_name's.
7269 * generics.cs (TypeArguments.GetDeclarations): New public method;
7270 returns the type arguments as a string[] and reports a CS0081 if
7271 one of them is not an identifier.
7273 * class.cs (MemberBase): The .ctor now takes the name as a
7274 MemberName instead of a string.
7275 (MemberBase.ExplicitInterfaceName): Changed type from string to
7277 (MemberBase.DoDefine): If we're an explicit implementation, the
7278 InterfaceType may be a generic instance.
7280 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
7281 (namespace_name): Call MemberName.GetName () to transform the
7282 MemberName into a string and ensure we don't have any type
7284 (type_name): Call MemberName.GetTypeExpression() to transfrom the
7285 MemberName into an expression.
7286 (method_header): Use namespace_or_type_name instead of member_name.
7288 2004-04-07 Miguel de Icaza <miguel@ximian.com>
7290 * rootcontext.cs: Add new types to the boot resolution.
7292 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
7293 MulticastDelegate is not allowed.
7295 * typemanager.cs: Add new types to lookup: System.TypedReference
7298 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
7299 check for TypedReference or ArgIterator, they are not allowed.
7301 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
7302 makes us properly catch 1510 in some conditions (see bug 56016 for
7305 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
7307 * CryptoConvert.cs: update from corlib version
7310 2004-04-05 Miguel de Icaza <miguel@ximian.com>
7312 * class.cs (Indexer.Define): Check indexername declaration
7314 2004-04-05 Marek Safar <marek.safar@seznam.cz>
7316 * attribute.cs (IsClsCompliant): Fixed problem with handling
7317 all three states (compliant, not-compliant, undetected).
7319 2004-03-30 Marek Safar <marek.safar@seznam.cz>
7321 * attribute.cs (Attribute): Location is now public.
7322 (Resolve): Store resolved arguments (pos_values) in attribute class.
7323 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
7324 (GetClsCompliantAttributeValue): New method that gets
7325 CLSCompliantAttribute value.
7326 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
7327 if exists else null.
7328 (AttributeTester): New class for CLS-Compliant verification routines.
7330 * class.cs (Emit): Add CLS-Compliant verification.
7331 (Method.GetSignatureForError): Implemented.
7332 (Constructor.GetSignatureForError): Implemented
7333 (Constructor.HasCompliantArgs): Returns if constructor has
7334 CLS-Compliant arguments.
7335 (Constructor.Emit): Override.
7336 (Construcor.IsIdentifierClsCompliant): New method; For constructors
7337 is needed to test only parameters.
7338 (FieldBase.GetSignatureForError): Implemented.
7339 (TypeContainer): New member for storing base interfaces.
7340 (TypeContainer.FindMembers): Search in base interfaces too.
7342 * codegen.cs (GetClsComplianceAttribute): New method that gets
7343 assembly or module CLSCompliantAttribute value.
7344 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7346 (ModuleClass.Emit): Add error 3012 test.
7348 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7350 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7351 state for all decl types.
7352 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7353 if CLS-Compliant tests are required.
7354 (IsClsCompliaceRequired): New method. Analyze whether code
7355 must be CLS-Compliant.
7356 (IsExposedFromAssembly): New method. Returns true when MemberCore
7357 is exposed from assembly.
7358 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7359 value or gets cached value.
7360 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7361 is explicitly marked with CLSCompliantAttribute.
7362 (IsIdentifierClsCompliant): New abstract method. This method is
7363 used to testing error 3005.
7364 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7365 for identifier and parameters CLS-Compliant testing.
7366 (VerifyClsCompliance): New method. The main virtual method for
7367 CLS-Compliant verifications.
7368 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7369 null. I don't know why is null (too many public members !).
7370 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7371 and get value of first CLSCompliantAttribute that found.
7373 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7374 (VerifyClsCompliance): Override and add extra tests.
7376 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7377 clscheck- disable CLS-Compliant verification event if assembly is has
7378 CLSCompliantAttribute(true).
7380 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7381 ApllyAttribute is now called in emit section as in the other cases.
7382 Possible future Emit integration.
7383 (IsIdentifierClsCompliant): New override.
7384 (VerifyClsCompliance): New override.
7385 (GetEnumeratorName): Returns full enum name.
7387 * parameter.cs (GetSignatureForError): Implemented.
7389 * report.cs (WarningData): New struct for Warning message information.
7390 (LocationOfPreviousError): New method.
7391 (Warning): New method. Reports warning based on the warning table.
7392 (Error_T): New method. Reports error based on the error table.
7394 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7395 verifications are done here.
7397 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7399 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7400 CLSCompliantAttribute.
7401 (all_imported_types): New member holds all imported types from other
7403 (LoadAllImportedTypes): New method fills static table with exported types
7404 from all referenced assemblies.
7405 (Modules): New property returns all assembly modules.
7407 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7409 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7410 throwing a parser error.
7412 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7413 which removes the hardcoded get_/set_ prefixes for properties, as
7414 IL allows for the properties to be named something else.
7418 * expression.cs: Do not override operand before we know if it is
7421 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7423 * typemanager.cs: support for pinned variables.
7425 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7427 * decl.cs, typemanager.cs: Avoid using an arraylist
7428 as a buffer if there is only one result set.
7430 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7432 * expression.cs: Make sure you cant call a static method
7433 with an instance expression, bug #56174.
7435 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7437 * class.cs (IsDuplicateImplementation): Improve error reporting to
7438 flag 663 (method only differs in parameter modifier).
7440 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7441 in preprocessor directives.
7443 * location.cs (LookupFile): Allow for the empty path.
7445 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7446 better approach for some of that patch, but its failing with the
7447 CharSet enumeration. For now try/catch will do.
7449 * typemanager.cs: Do not crash if a struct does not have fields.
7452 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7454 * expression.cs: cs0213, cant fix a fixed expression.
7457 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7459 * cs-parser.jay: detect invalid embeded statements gracefully.
7462 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7464 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7467 the invocation type may not be a subclass of the tye of the item/
7468 The type of the item must be a subclass of the invocation item.
7473 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7475 * attribute.cs: Added methods to get a string and a bool from an
7476 attribute. Required to information from AssemblyKeyFileAttribute,
7477 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7478 * codegen.cs: Modified AssemblyName creation to include support for
7479 strongnames. Catch additional exceptions to report them as CS1548.
7480 * compiler.csproj: Updated include CryptoConvert.cs.
7481 * compiler.csproj.user: Removed file - user specific configuration.
7482 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7483 Mono.Security assembly. The original class is maintained and tested in
7484 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7485 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7486 like CSC 8.0 (C# v2) supports.
7487 * Makefile: Added CryptoConvert.cs to mcs sources.
7488 * rootcontext.cs: Added new options for strongnames.
7490 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7492 * driver.cs: For --expect-error, report error code `2'
7493 if the program compiled with no errors, error code `1' if
7494 it compiled with an error other than the one expected.
7496 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7498 * compiler.csproj: Updated for Visual Studio .NET 2003.
7499 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7500 * compiler.sln: Updated for Visual Studio .NET 2003.
7502 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7504 * expression.cs: Fix bug #47234. We basically need to apply the
7505 rule that we prefer the conversion of null to a reference type
7506 when faced with a conversion to 'object' (csc behaviour).
7508 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7510 * statement.cs: Shorter form for foreach, eliminates
7511 a local variable. r=Martin.
7513 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7515 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7516 checks if we can use brtrue/brfalse to test for 0.
7517 * expression.cs: use the above in the test for using brtrue/brfalse.
7520 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7522 * expression.cs: Rewrite string concat stuff. Benefits:
7524 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7525 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7526 rather than a concat chain.
7528 * typemanager.cs: Add lookups for more concat overloads.
7530 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7532 * expression.cs: Emit shorter il code for array init.
7549 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7551 * statement.cs: Before, two switch blocks would be merged if the
7552 total size of the blocks (end_item - begin_item + 1) was less than
7553 two times the combined sizes of the blocks.
7555 Now, it will only merge if after the merge at least half of the
7560 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7562 * class.cs : csc build fix for GetMethods(). See bug #52503.
7564 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7566 * expression.cs: Make sure fp comparisons work with NaN.
7567 This fixes bug #54303. Mig approved this patch a long
7568 time ago, but we were not able to test b/c the runtime
7571 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7573 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7575 2004-03-19 Martin Baulig <martin@ximian.com>
7577 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
7578 two overloads may unify for some type parameter substitutions and
7579 report a CS0408 if appropriate.
7581 2004-03-19 Martin Baulig <martin@ximian.com>
7583 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7584 error here and not in our caller.
7586 2004-03-19 Martin Baulig <martin@ximian.com>
7588 * interface.cs: Completely killed this file.
7589 (Interface): We're now a TypeContainer and live in class.cs.
7591 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7592 argument; we're now also called for interfaces.
7593 (TypeContainer.DefineMembers): Allow this method being called
7595 (TypeContainer.GetMethods): New public method; formerly known as
7596 Interface.GetMethod(). This is used by PendingImplementation.
7597 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7598 it's now private and non-static.
7599 (Interface): Moved this here; it's now implemented similar to
7601 (Method, Property, Event, Indexer): Added `bool is_interface'
7602 argument to their .ctor's.
7603 (MemberBase.IsInterface): New public field.
7605 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7606 instances instead of InterfaceMethod, InterfaceProperty, etc.
7607 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7608 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
7610 2004-03-19 Martin Baulig <martin@ximian.com>
7612 * class.cs (MethodCore.IsDuplicateImplementation): New private
7613 method which does the CS0111 checking.
7614 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
7615 Use IsDuplicateImplementation().
7617 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
7619 * decl.cs (FindMemberToOverride): New method to find the correct
7620 method or property to override in the base class.
7622 - Make Method/Property use the above method to find the
7623 version in the base class.
7624 - Remove the InheritableMemberSignatureCompare as it is now
7627 This patch makes large code bases much faster to compile, as it is
7628 O(n) rather than O(n^2) to do this validation.
7630 Also, it fixes bug 52458 which is that nested classes are not
7631 taken into account when finding the base class member.
7633 Reviewed/Approved by Martin.
7635 2004-03-17 Martin Baulig <martin@ximian.com>
7637 * expression.cs (MemberAccess.DoResolve): Take the parent's number
7638 of type arguments into account; use the `real_num_type_args'
7639 approach like in DoResolveAsTypeStep().
7641 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
7644 2004-03-17 Marek Safar <marek.safar@seznam.cz>
7646 * interface.cs: In all interface classes removed redundant
7647 member initialization.
7649 2004-03-16 Martin Baulig <martin@ximian.com>
7651 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7653 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7655 * decl.cs (DefineTypeAndParents): New helper method to define a
7656 type's containers before the type itself is defined; This is a
7657 bug exposed by the recent changes to Windows.Forms when an
7658 implemented interface was defined inside a class that had not been
7661 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
7663 (Check): Loop correctly to report errors modifiers
7664 (UNSAFE was not in the loop, since it was the same as TOP).
7666 * interface.cs: Every interface member now takes a ModFlags,
7667 instead of a "is_new" bool, which we set on the base MemberCore.
7669 Every place where we called "UnsafeOk" in the interface, now we
7670 call the proper member (InterfaceMethod.UnsafeOK) instead to get
7671 the unsafe settings from the member declaration instead of the
7672 container interface.
7674 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
7676 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7677 `set_indexer_name' to the pending bits (one per type).
7679 We fixed a bug today that was picking the wrong method to
7680 override, since for properties the existing InterfaceMethod code
7681 basically ignored the method name. Now we make sure that the
7682 method name is one of the valid indexer names.
7684 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
7686 * support.cs (SeekableStreamReader): Keep track of stream byte
7687 positions and don't mix them with character offsets to the buffer.
7689 Patch from Gustavo Giráldez
7691 2004-03-15 Marek Safar <marek.safar@seznam.cz>
7693 * interface.cs (InterfaceSetGetBase): Removed double member
7694 initialization, base class does it as well.
7696 2004-03-13 Martin Baulig <martin@ximian.com>
7698 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
7699 when compiling corlib.
7701 2004-03-13 Miguel de Icaza <miguel@ximian.com>
7703 * convert.cs (ExplicitConversion): We were reporting an error on
7704 certain conversions (object_type source to a value type, when the
7705 expression was `null') before we had a chance to pass it through
7706 the user defined conversions.
7708 * driver.cs: Replace / and \ in resource specifications to dots.
7711 * class.cs: Add check for duplicate operators. Fixes 52477
7713 2004-03-11 Miguel de Icaza <miguel@ximian.com>
7715 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
7716 that are in the middle of the statements, not only at the end.
7719 * class.cs (TypeContainer.AddField): No longer set the
7720 `HaveStaticConstructor' flag, now we call it
7721 `UserDefineStaticConstructor' to diferentiate the slightly
7722 semantic difference.
7724 The situation is that we were not adding BeforeFieldInit (from
7725 Modifiers.TypeAttr) to classes that could have it.
7726 BeforeFieldInit should be set to classes that have no static
7731 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
7733 And most importantly Zoltan's comment:
7735 http://bugzilla.ximian.com/show_bug.cgi?id=44229
7737 "I think beforefieldinit means 'it's ok to initialize the type sometime
7738 before its static fields are used', i.e. initialization does not need
7739 to be triggered by the first access to the type. Setting this flag
7740 helps the JIT to compile better code, since it can run the static
7741 constructor at JIT time, and does not need to generate code to call it
7742 (possibly lots of times) at runtime. Unfortunately, mcs does not set
7743 this flag for lots of classes like String.
7745 csc sets this flag if the type does not have an explicit static
7746 constructor. The reasoning seems to be that if there are only static
7747 initalizers for a type, and no static constructor, then the programmer
7748 does not care when this initialization happens, so beforefieldinit
7751 This bug prevents the AOT compiler from being usable, since it
7752 generates so many calls to mono_runtime_class_init that the AOT code
7753 is much slower than the JITted code. The JITted code is faster,
7754 because it does not generate these calls if the vtable is type is
7755 already initialized, which is true in the majority of cases. But the
7756 AOT compiler can't do this."
7758 2004-03-10 Miguel de Icaza <miguel@ximian.com>
7760 * class.cs (MethodData.Emit): Refactor the code so symbolic
7761 information is generated for destructors; For some reasons we
7762 were taking a code path that did not generate symbolic information
7765 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
7767 * class.cs: Create a Constructor.CheckBase method that
7768 takes care of all validation type code. The method
7769 contains some code that was moved from Define.
7771 It also includes new code that checks for duplicate ctors.
7772 This fixes bug #55148.
7774 2004-03-09 Joshua Tauberer <tauberer@for.net>
7776 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
7777 a { ... }-style array creation invokes EmitStaticInitializers
7778 which is not good for reference-type arrays. String, decimal
7779 and now null constants (NullCast) are not counted toward
7780 static initializers.
7782 2004-03-05 Martin Baulig <martin@ximian.com>
7784 * location.cs (SourceFile.HasLineDirective): New public field;
7785 specifies whether the file contains or is referenced by a "#line"
7787 (Location.DefineSymbolDocuments): Ignore source files which
7788 either contain or are referenced by a "#line" directive.
7790 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
7792 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
7793 direct access to our parent, so check the method inline there.
7795 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
7797 * expression.cs (Invocation.EmitCall): Miguel's last commit
7798 caused a regression. If you had:
7803 In Foo the implict this would be null.
7805 2004-02-27 Miguel de Icaza <miguel@ximian.com>
7807 * expression.cs (Invocation.EmitCall): If the method is not
7808 virtual, do not emit a CallVirt to it, use Call.
7810 * typemanager.cs (GetFullNameSignature): Improve the method to
7811 cope with ".ctor" and replace it with the type name.
7813 * class.cs (ConstructorInitializer.Resolve): Now the method takes
7814 as an argument the ConstructorBuilder where it is being defined,
7815 to catch the recursive constructor invocations.
7817 2004-03-16 Martin Baulig <martin@ximian.com>
7819 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
7820 ConstructedType, call ResolveType() on it to get the type rather
7821 than just using `expr.Type'.
7823 2004-03-16 Martin Baulig <martin@ximian.com>
7825 * generics.cs (ConstructedType.GetMemberAccess): Take the
7826 EmitContext instead on the TypeExpr and use
7827 ec.TypeContainer.CurrentType/ec.ContainerType.
7829 2004-03-16 Martin Baulig <martin@ximian.com>
7831 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
7832 parameters before aliases.
7834 2004-03-16 Martin Baulig <martin@ximian.com>
7836 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
7837 New oublic function; checks whether two generic instances may become
7838 equal under some instantiations (26.3.1).
7840 * class.cs (TypeContainer.Define): Call
7841 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
7844 2004-03-16 Martin Baulig <martin@ximian.com>
7846 * class.cs (TypeContainer.GetClassBases): Moved
7847 Error_TypeParameterAsBase() here and also check whether the base
7848 class is not an attribute.
7850 2004-03-16 Martin Baulig <martin@ximian.com>
7852 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7854 2004-03-16 Martin Baulig <martin@ximian.com>
7856 * class.cs (Error_TypeParameterAsBase): Use correct error number
7859 2004-03-16 Martin Baulig <martin@ximian.com>
7861 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
7864 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
7867 2004-03-15 Martin Baulig <martin@ximian.com>
7869 * typemanager.cs (TypeManager.GetFullName): New public method.
7870 (TypeManager.MemberLookup): Added `int_num_type_arguments'
7871 argument; only return members with the correct number of type
7873 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
7874 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
7875 whether the number of type arguments matches.
7877 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
7878 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
7880 * expression.cs (MemberAccess): Added public `NumTypeArguments'
7881 field; it's set by the protected .ctor when we're actually a
7882 GenericMemberAccess.
7883 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
7884 arguments and pass it to MemberLookupFinal ().
7886 * ecore.cs (Expression.MemberLookup): Added `int
7887 num_type_arguments' argument; only return members with the correct
7888 number of type arguments.
7889 (Expression.MemberLookupFailed): Check whether the MemberLookup
7890 failed because we did not have the correct number of type
7891 arguments; report CS0305 in this case.
7893 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
7894 `e.ResolveAsTypeTerminal()' already did so.
7896 2004-03-15 Martin Baulig <martin@ximian.com>
7898 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
7899 we're a ConstructedType; in this case, the caller must report an
7900 error (for instance CS0131).
7902 * generic.cs (TypeArguments): Added Location argument to the .ctor.
7903 (TypeArguments.Resolve): Actually report errors here.
7905 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7907 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7908 `set_indexer_name' to the pending bits (one per type).
7910 We fixed a bug today that was picking the wrong method to
7911 override, since for properties the existing InterfaceMethod code
7912 basically ignored the method name. Now we make sure that the
7913 method name is one of the valid indexer names.
7915 2004-03-15 Martin Baulig <martin@ximian.com>
7917 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
7918 for generic instances.
7920 2004-03-13 Martin Baulig <martin@ximian.com>
7922 * class.cs (TypeContainer.DefineType): Call
7923 TypeManager.AddUserType() immediately after creating the
7924 TypeBuilder; pass all type parameters when creating the
7927 * decl.cs (DeclSpace.FindNestedType): New public method.
7928 (DeclSpace.FindType): Added `int num_type_args' argument; only
7929 return types with the correct number of type parameters.
7930 (DeclSpace.CountTypeParams): New public property.
7932 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
7933 the number of type parameters; defaults to zero.
7935 * generic.cs (TypeArguments.Count): New public property.
7936 (ConstructedType.DoResolveAsTypeStep): First call
7937 ds.FindNestedType() to find out whether we're nested in the
7938 current generic type; in this case, we inherit all type parameters
7939 from the current class.
7941 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
7942 num_type_args' argument.
7943 (RootContext.LookupType): Added overloaded version which takes the
7944 number of type arguments; only return types with the correct
7945 number of type arguments.
7947 * typemanager.cs (TypeManager.CheckGeneric): New public function;
7948 checks whether `Type t' has `int num_type_args'.
7950 2004-03-13 Martin Baulig <martin@ximian.com>
7952 * generic.cs (GenericMethod.DefineType): New method; calls
7953 DefineType() on all the type parameters.
7955 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
7956 (MethodData.Define): If we're a generic method, call
7957 GenericMethod.DefineType() to define the type parameters.
7959 2004-03-10 Martin Baulig <martin@ximian.com>
7961 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
7962 instead of IsAssignableFrom.
7964 2004-03-10 Martin Baulig <martin@ximian.com>
7966 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
7968 * support.cs (ParameterData.HasArrayParameter): New property.
7969 (ReflectionParameters.ctor): Take a MethodBase instead of a
7970 ParameterInfo[]. If we have any type parameters, get the generic
7971 method definition and ask it whether we have variable arguments.
7973 2004-02-26 Miguel de Icaza <miguel@ximian.com>
7975 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
7976 routines to check if a type is an enumerable/enumerator allow
7977 classes that implement the IEnumerable or IEnumerator interfaces.
7979 * class.cs (Property, Operator): Implement IIteratorContainer, and
7980 implement SetYields.
7982 (Property.Define): Do the block swapping for get_methods in the
7983 context of iterators. We need to check if Properties also
7984 include indexers or not.
7986 (Operator): Assign the Block before invoking the
7987 OperatorMethod.Define, so we can trigger the Iterator code
7990 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
7991 Property and Operator classes are not created when we parse the
7992 declarator but until we have the block completed, so we use a
7993 singleton SimpleIteratorContainer.Simple to flag whether the
7994 SetYields has been invoked.
7996 We propagate this setting then to the Property or the Operator to
7997 allow the `yield' to function.
7999 2004-02-25 Marek Safar <marek.safar@seznam.cz>
8001 * codegen.cs: Implemented attribute support for modules.
8002 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
8003 Assembly/Module functionality.
8005 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
8006 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
8007 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
8009 2004-02-16 Marek Safar <marek.safar@seznam.cz>
8011 * interface.cs (FindMembers): The operation is performed on all base
8012 interfaces and not only on the first. It is required for future CLS Compliance patch.
8014 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
8016 * statement.cs, codegen.cs:
8017 This patch deals with patterns such as:
8019 public class List : IEnumerable {
8021 public MyEnumerator GetEnumerator () {
8022 return new MyEnumerator(this);
8025 IEnumerator IEnumerable.GetEnumerator () {
8029 public struct MyEnumerator : IEnumerator {
8034 Before, there were a few things we did wrong:
8035 1) we would emit callvirt on a struct, which is illegal
8036 2) we emited ldarg when we needed to emit ldarga
8037 3) we would mistakenly call the interface methods on an enumerator
8038 type that derived from IEnumerator and was in another assembly. For example:
8040 public class MyEnumerator : IEnumerator
8042 Would have the interface methods called, even if there were public impls of the
8043 method. In a struct, this lead to invalid IL code.
8045 2004-02-11 Marek Safar <marek.safar@seznam.cz>
8047 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
8050 * delegate.cs (Define): Fixed crash when delegate type is undefined.
8052 2004-02-11 Miguel de Icaza <miguel@ximian.com>
8054 * cs-parser.jay: Fix small regression: we were not testing V2
8055 compiler features correctly.
8057 * interface.cs: If the emit context is null, then create one
8059 2004-02-09 Marek Safar <marek.safar@seznam.cz>
8061 * decl.cs (GetSignatureForError): New virtual method to get full name
8064 * attribute.cs (IAttributeSupport): New interface for attribute setting.
8065 Now it is possible to rewrite ApplyAttributes method to be less if/else.
8067 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
8068 Duplicated members and code in these classes has been removed.
8069 Better encapsulation in these classes.
8071 2004-02-07 Miguel de Icaza <miguel@ximian.com>
8073 * assign.cs (Assign.DoResolve): When dealing with compound
8074 assignments, there is a new rule in ECMA C# 2.4 (might have been
8075 there before, but it is documented here) that states that in:
8079 If b is of type int, and the `op' is a shift-operator, then the
8080 above is evaluated as:
8084 * expression.cs (Binary.ResolveOperator): Instead of testing for
8085 int/uint/long/ulong, try to implicitly convert to any of those
8086 types and use that in pointer arithmetic.
8088 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
8089 method to print information for from the type, not from the
8090 null-method we were given.
8092 2004-02-01 Duncan Mak <duncan@ximian.com>
8094 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
8095 parsing for cmd, fixes bug #53694.
8097 2004-02-04 Marek Safar <marek.safar@seznam.cz>
8099 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
8100 in the member name duplication tests. Property and operator name duplication
8101 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
8103 2004-02-03 Marek Safar <marek.safar@seznam.cz>
8105 * interface.cs (PopulateMethod): Fixed crash when interface method
8106 returns not existing type (error test cs0246-3.cs).
8108 2004-02-02 Ravi Pratap M <ravi@ximian.com>
8110 * cs-parser.jay (interface_accessors): Re-write actions to also
8111 store attributes attached to get and set methods. Fix spelling
8114 (inteface_property_declaration): Modify accordingly.
8116 (InterfaceAccessorInfo): New helper class to store information to pass
8117 around between rules that use interface_accessors.
8119 * interface.cs (Emit): Apply attributes on the get and set
8120 accessors of properties and indexers too.
8122 * attribute.cs (ApplyAttributes): Modify accordingly to use the
8123 right MethodBuilder when applying attributes to the get and set accessors.
8125 2004-01-31 Miguel de Icaza <miguel@ximian.com>
8127 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
8129 2004-01-26 Miguel de Icaza <miguel@ximian.com>
8131 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
8133 2004-01-25 Miguel de Icaza <miguel@ximian.com>
8135 * cs-parser.jay: Remove YIELD token, instead use the new grammar
8136 changes that treat `yield' specially when present before `break'
8139 * cs-tokenizer.cs: yield is no longer a keyword.
8141 2004-01-23 Marek Safar <marek.safar@seznam.cz>
8143 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
8144 setting for default constructors.
8145 For default constructors are almost every time set wrong Modifier. The
8146 generated IL code has been alright. But inside mcs this values was
8147 wrong and this was reason why several of my CLS Compliance tests
8150 2004-02-27 Martin Baulig <martin@ximian.com>
8152 * generics.cs (ConstructedType.ResolveType): Make the nested type
8153 stuff actually work.
8155 2004-02-25 Martin Baulig <martin@ximian.com>
8157 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
8158 property; returns the type parameters just from the current type,
8159 ie. with the ones from outer classes.
8160 (DeclSpace.LookupGeneric): First search in the current class, then
8162 (DeclSpace.initialize_type_params): When hiding a type parameter
8163 from an outer class, put it into the `type_param_list' anyways.
8165 * expression.cs (MemberAccess.expr): Made this field protected.
8167 * class.cs (TypeContainer.Define): The `CurrentType' just contains
8168 the type parameters from the current class.
8170 * generic.cs (ConstructedType.ResolveType): Support nested generic
8171 types by taking the type parameters which we inherit from outer
8172 classes into account.
8173 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
8174 support for nested generic types.
8176 2004-02-23 Martin Baulig <martin@ximian.com>
8178 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
8179 field and check whether we're nested inside a generic type.
8180 (DeclSpace.ResolveType): If we're resolving to a generic type
8181 definition, create a ConstructedType and return its resolved type.
8182 (DeclSpace.initialize_type_params): New private method;
8183 initializes the `type_param_list' field from the type parameters
8184 from this and all enclosing classes.
8185 (DeclSpace.TypeParameters): Call initialize_type_params() unless
8186 we're already initialized.
8188 2004-02-23 Martin Baulig <martin@ximian.com>
8190 * class.cs (Method.Define): Create the generic method before
8192 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
8193 the TypeContainer one); we use this for generic methods.
8195 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
8196 parent's TypeBuilder.
8198 2004-02-18 Martin Baulig <martin@ximian.com>
8200 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
8201 to check for equality.
8203 2004-02-05 Martin Baulig <martin@ximian.com>
8205 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
8206 `ec.TypeContainer.CurrentType', use it instead of
8207 `ec.ContainerType' to check whether we're in the type's ctor.
8209 2004-01-29 Martin Baulig <martin@ximian.com>
8211 * expression.cs (Invocation.DoResolve): If we're a
8212 `ConstructedType', then we're actually a generic method, so
8213 rewrite the expr as a GenericMemberAccess.
8215 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
8216 here; manually parse it into a string.
8218 2004-01-28 Martin Baulig <martin@ximian.com>
8220 * typemanager.cs (TypeManager.IsEqual): New static method.
8221 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
8222 check for equality instead of using `=='.
8224 2004-01-26 Martin Baulig <martin@ximian.com>
8226 * decl.cs (DeclSpace.CurrentType): New public field.
8228 * expression.cs (This.ResolveBase): If we have an
8229 `ec.TypeContainer.CurrentType', use it instead of
8232 * class.cs (TypeContainer.DefineType): If we're a generic type,
8233 create the `CurrentType' (unresolved).
8234 (TypeContainer.GenericType): New private field.
8235 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
8236 it and store it in `GenericType' before creating the MemberCache.
8237 (TypeContainer.GetMembers): If we have a `GenericType', call
8238 TypeManager.FindMembers() on it.
8240 * interface.cs (Interface.GenericType): New private field.
8241 (Interface.DefineType): If we're a generic type, create the
8242 `CurrentType' (unresolved).
8243 (Interface.DefineMembers): If we have a `CurrentType', resolve it
8244 and store it in `GenericType' before creating the MemberCache.
8245 (Interface.GetMembers): If we have a `GenericType', call
8246 TypeManager.FindMembers() on it.
8248 2004-01-22 Martin Baulig <martin@ximian.com>
8250 * cs-parser.jay (namespace_or_type_name): Return an Expression,
8251 not a QualifiedIdentifier. This is what `type_name_expression'
8252 was previously doing.
8253 (type_name_expression): Removed; the code is now in
8254 `namespace_or_type_name'.
8255 (qualified_identifier): Removed, use `namespace_or_type_name'
8257 (QualifiedIdentifier): Removed this class.
8259 2004-01-22 Martin Baulig <martin@ximian.com>
8261 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
8262 not a string as alias name.
8264 2004-01-21 Miguel de Icaza <miguel@ximian.com>
8266 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
8267 #52730 bug, and instead compute correctly the need to use a
8268 temporary variable when requesting an address based on the
8269 static/instace modified of the field and the constructor.
8271 2004-01-21 Martin Baulig <martin@ximian.com>
8273 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
8274 class and namespace before looking up aliases. Fixes #52517.
8276 2004-01-21 Martin Baulig <martin@ximian.com>
8278 * flowanalysis.cs (UsageVector.Merge): Allow variables being
8279 assinged in a 'try'; fixes exception4.cs.
8281 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8282 * class.cs : Implemented parameter-less constructor for TypeContainer
8284 * decl.cs: Attributes are now stored here. New property OptAttributes
8286 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
8288 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
8290 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8292 * typemanager.cs (CSharpSignature): Now reports also inner class name.
8293 (CSharpSignature): New method for indexer and property signature.
8295 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8297 * pending.cs (IsVirtualFilter): Faster implementation.
8299 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8301 * typemanager.cs: Avoid inclusion of same assembly more than once.
8303 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8305 * cs-parser.jay: Fixed problem where the last assembly attribute
8306 has been applied also to following declaration (class, struct, etc.)
8308 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8310 * class.cs: Added error CS0538, CS0539 reporting.
8311 Fixed crash on Microsoft runtime when field type is void.
8313 * cs-parser.jay: Added error CS0537 reporting.
8315 * pending.cs: Added error CS0535 reporting.
8316 Improved error report for errors CS0536, CS0534.
8318 2004-01-20 Miguel de Icaza <miguel@ximian.com>
8320 Merge a few bits from the Anonymous Method MCS tree.
8322 * statement.cs (ToplevelBlock): New class for toplevel methods,
8323 will hold anonymous methods, lifted variables.
8325 * cs-parser.jay: Create toplevel blocks for delegates and for
8326 regular blocks of code.
8328 2004-01-20 Martin Baulig <martin@ximian.com>
8330 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
8331 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
8332 and `NeedExplicitReturn'; added `IsLastStatement'.
8333 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
8334 have a `ReturnLabel' or we're not unreachable.
8336 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
8337 child's reachability; don't just override ours with it. Fixes
8338 #58058 (lluis's example).
8339 (FlowBranching): Added public InTryOrCatch(), InCatch(),
8340 InFinally(), InLoop(), InSwitch() and
8341 BreakCrossesTryCatchBoundary() methods.
8343 * statement.cs (Return): Do all error checking in Resolve().
8344 Unless we are the last statement in a top-level block, always
8345 create a return label and jump to it.
8346 (Break, Continue): Do all error checking in Resolve(); also make
8347 sure we aren't leaving a `finally'.
8348 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
8349 statement in a top-level block.
8350 (Block.Flags): Added `IsDestructor'.
8351 (Block.IsDestructor): New public property.
8353 2004-01-20 Martin Baulig <martin@ximian.com>
8355 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
8357 2004-01-20 Martin Baulig <martin@ximian.com>
8359 * statement.cs (Statement.ResolveUnreachable): New public method.
8360 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
8361 (Block.Resolve): Resolve unreachable statements.
8363 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8365 * expression.cs: We need to fix the case where we do
8366 not have a temp variable here.
8368 * assign.cs: Only expression compound assignments need
8369 temporary variables.
8371 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8373 * flowanalysis.cs: Reduce memory allocation in a few ways:
8374 - A block with no variables should not allocate a bit
8376 - A method with no out parameters does not need any tracking
8377 for assignment of the parameters, so we need not allocate
8380 public readonly Type[] VariableTypes;
8381 public readonly string[] VariableNames;
8382 Are redundant. The data is already stored in the variable
8383 map, so we need not allocate another array for it.
8384 - We need to add alot of checks for if (params | locals) == null
8385 due to the first two changes.
8387 2004-01-18 Miguel de Icaza <miguel@ximian.com>
8389 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
8390 implement IMemoryLocation, we store a copy on a local variable and
8391 take the address of it. Patch from Benjamin Jemlich
8393 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
8394 to use a special "type_name_expression" rule which reduces the
8395 number of "QualifiedIdentifier" classes created, and instead
8396 directly creates MemberAccess expressions.
8398 2004-01-17 Miguel de Icaza <miguel@ximian.com>
8400 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
8401 that fixes #52853. Null literal assignment to ValueType
8403 * class.cs (MethodData.Emit): Instead of checking the name of the
8404 method to determine if its a destructor, create a new derived
8405 class from Method called Destructor, and test for that.
8407 * cs-parser.jay: Create a Destructor object instead of a Method.
8409 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
8413 2004-01-16 Miguel de Icaza <miguel@ximian.com>
8415 * expression.cs (Binary.ResolveOperator): Perform an implicit
8416 conversion from MethodGroups to their delegate types on the
8419 * delegate.cs: Introduce a new class DelegateCreation that is the
8420 base class for `NewDelegate' and `ImplicitDelegateCreation',
8421 factor some code in here.
8423 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
8424 conversion from MethodGroups to compatible delegate types.
8426 * ecore.cs (Expression.Resolve): Do not flag error 654
8427 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
8428 we allow conversions from MethodGroups to delegate types now.
8430 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
8431 assignments in v2 either.
8433 2004-01-10 Miguel de Icaza <miguel@ximian.com>
8435 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
8436 static read-only fields in ctors.
8438 Applied patch from Benjamin Jemlich
8440 * expression.cs (UnaryMutator): Avoid leaking local variables.
8442 2004-01-09 Miguel de Icaza <miguel@ximian.com>
8444 * cs-tokenizer.cs (IsCastToken): Allow the various native types
8445 here to return true, as they can be used like this:
8449 Fixed 49836 and all the other dups
8451 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
8453 * driver.cs: Implement /win32res and /win32icon.
8455 2004-01-08 Miguel de Icaza <miguel@ximian.com>
8457 * cs-parser.jay: Add a rule to improve error handling for the
8458 common mistake of placing modifiers after the type.
8460 2004-01-07 Miguel de Icaza <miguel@ximian.com>
8462 * cs-parser.jay (interface_event_declaration): Catch
8463 initialization of events on interfaces, and report cs0068
8465 * cs-parser.jay (interface_event_declaration): Catch
8466 initialization of events.
8468 * ecore.cs: Better report missing constructors.
8470 * expression.cs (Binary.ResolveOperator): My previous bug fix had
8471 the error reporting done in the wrong place. Fix.
8473 * expression.cs (Binary.ResolveOperator): Catch the
8474 operator + (E x, E y) error earlier, and later allow for implicit
8475 conversions in operator +/- (E e, U x) from U to the underlying
8478 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
8479 52596, if the container class is abstract, the default constructor
8480 is protected otherwise its public (before, we were always public).
8482 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
8485 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
8486 Jemlich that fixes bug #52597, MCS was generating invalid code for
8487 idisposable structs. Thanks to Ben for following up with this
8490 2004-01-06 Miguel de Icaza <miguel@ximian.com>
8492 * driver.cs: Allow assemblies without code to be generated, fixes
8495 2004-01-07 Nick Drochak <ndrochak@gol.com>
8497 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
8499 2004-01-05 Miguel de Icaza <miguel@ximian.com>
8501 * cs-parser.jay: Add rules to improve error reporting if fields or
8502 methods are declared at the namespace level (error 116)
8504 * Add rules to catch event add/remove
8506 2004-01-04 David Sheldon <dave-mono@earth.li>
8508 * expression.cs: Added matching ")" to error message for
8511 2004-01-03 Todd Berman <tberman@gentoo.org>
8513 * ecore.cs, attribute.cs:
8514 Applying fix from #52429.
8516 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8518 * ecore.cs, expression.cs, statement.cs:
8519 Total rewrite of how we handle branching. We
8520 now handle complex boolean expressions with fewer
8521 jumps. As well if (x == 0) no longer emits a ceq.
8523 if (x is Foo) is much faster now, because we generate
8526 Overall, we get a pretty big improvement on our benchmark
8527 tests. The code we generate is smaller and more readable.
8529 I did a full two-stage bootstrap. The patch was reviewed
8530 by Martin and Miguel.
8532 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8534 * cs-parser.jay: Make primary_expression not take a QI.
8535 we dont need this because the member_access rule covers
8536 us here. So we replace the rule with just IDENTIFIER.
8538 This has two good effects. First, we remove a s/r conflict.
8539 Second, we allocate many fewer QualifiedIdentifier objects.
8541 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8543 * attribute.cs: Handle MarshalAs attributes as pseudo, and
8544 set the correct information via SRE. This prevents
8545 hanging on the MS runtime. Fixes #29374.
8547 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8549 * convert.cs: correctly handle conversions to value types
8550 from Enum and ValueType as unboxing conversions.
8552 Fixes bug #52569. Patch by Benjamin Jemlich.
8554 2004-01-02 Ravi Pratap <ravi@ximian.com>
8556 * expression.cs (BetterConversion): Prefer int -> uint
8557 over int -> ulong (csc's behaviour). This fixed bug #52046.
8559 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8561 * decl.cs (MemberCache.FindMembers): now returns a
8564 * typemanager.cs: In general, go with with ^^.
8565 (CopyNewMethods): take an IList.
8566 (RealMemberLookup): Only allocate an arraylist
8567 if we copy from two sets of methods.
8569 This change basically does two things:
8570 1) Fewer array lists allocated due to CopyNewMethods.
8571 2) the explicit cast in MemberList costed ALOT.
8573 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8575 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8576 a hashtable to avoid needless string allocations when an identifier is
8577 used more than once (the common case).
8579 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8581 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8582 is broken, it will not return anything. So, we
8583 have to use the information we have in mcs to
8586 * typemanager.cs: Add a cache for GetInterfaces,
8587 since this will now be used more often (due to ^^)
8589 (GetExplicitInterfaces) New method that gets the
8590 declared, not effective, interfaces on a type
8591 builder (eg, if you have interface IFoo, interface
8592 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8595 This patch makes MCS able to bootstrap itself on
8598 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8600 * expression.cs: Remove the Nop's that Miguel put
8603 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8605 * report.cs, codegen.cs: Give the real stack trace to
8606 the error when an exception is thrown.
8608 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8610 * decl.cs: only allocate hashtables for ifaces if
8613 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8615 * expression.cs: fix the error from cs0121-2.cs
8616 (a parent interface has two child interfaces that
8617 have a function with the same name and 0 params
8618 and the function is called through the parent).
8620 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8622 * class.cs, rootcontext.cs, typmanager.cs: do not
8625 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8627 * codegen.cs: remove stack for the ec flow branching.
8628 It is already a linked list, so no need.
8630 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8632 * Makefile: Allow custom profiler here.
8634 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8636 * typemanager.cs (LookupType):
8637 - Use a static char [], because split takes
8638 a param array for args, so it was allocating
8640 - Do not store true in a hashtable, it boxes.
8642 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8644 * flowanalysis.cs: bytify common enums.
8646 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8648 * modifiers.cs: Add a new set of flags for the
8649 flags allowed on explicit interface impls.
8650 * cs-parser.jay: catch the use of modifiers in
8651 interfaces correctly.
8652 * class.cs: catch private void IFoo.Blah ().
8654 All related to bug #50572.
8656 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8658 * decl.cs: Rewrite the consistant accessability checking.
8659 Accessability is not linear, it must be implemented in
8660 a tableish way. Fixes #49704.
8662 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8664 * expression.cs: Handle negation in a checked context.
8665 We must use subtraction from zero. Fixes #38674.
8667 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8669 * class.cs: Ignore static void main in DLLs.
8670 * rootcontext.cs: Handle the target type here,
8671 since we are have to access it from class.cs
8672 * driver.cs: account for the above.
8674 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8676 * report.cs: Give line numbers and files if available.
8678 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8680 * driver.cs: Implement /addmodule.
8682 * typemanager.cs: Change 'modules' field so it now contains Modules not
8685 2003-12-20 Martin Baulig <martin@ximian.com>
8687 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8688 (FieldBase.IsAssigned): Removed this field.
8689 (FieldBase.SetAssigned): New public method.
8690 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8692 2003-12-20 Martin Baulig <martin@ximian.com>
8694 * expression.cs (LocalVariableReference.DoResolve): Don't set
8695 `vi.Used' if we're called from DoResolveLValue().
8697 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8698 returns the usage vector it just merged into the current one -
8699 pass this one to UsageWarning().
8700 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8701 of the `EmitContext', don't call this recursively on our children.
8703 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8705 * driver.cs: Implement /target:module.
8707 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8709 * support.cs (CharArrayHashtable): New helper class.
8711 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8712 char arrays, not strings, so we can avoid creating a string in
8713 consume_identifier if the identifier is a keyword.
8715 2003-12-16 Martin Baulig <martin@ximian.com>
8717 * statement.cs (LocalInfo.Assigned): Removed this property.
8718 (LocalInfo.Flags): Removed `Assigned'.
8719 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8720 and uses flow analysis.
8721 (Block.UsageWarning): Made this method private.
8722 (Block.Resolve): Call UsageWarning() if appropriate.
8724 * expression.cs (LocalVariableReference.DoResolve): Always set
8725 LocalInfo.Used here.
8727 2003-12-13 Martin Baulig <martin@ximian.com>
8729 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8730 any value here; we're now using flow analysis to figure out
8731 whether a statement/block returns a value.
8733 2003-12-13 Martin Baulig <martin@ximian.com>
8735 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8737 (FlowBranching.MergeFinally): Don't call
8738 `branching.CheckOutParameters()' here, this is called in
8740 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8741 when adding the `finally' vector.
8743 2003-12-13 Martin Baulig <martin@ximian.com>
8746 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8747 actually work and also fix #48962.
8749 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8751 * decl.cs: Do not check System.Object for nested types,
8752 since we know it does not have any. Big bang for buck:
8757 corlib: 17.99 seconds
8761 corlib: 17.39 seconds
8763 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8765 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8766 time we are returning 0 members, so we save alot here.
8768 2003-12-11 Martin Baulig <martin@ximian.com>
8770 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8771 `MergeChild()', also just take the `FlowBranching' as argument;
8772 call Merge() on it and return the result.
8773 (FlowBranching.Merge): We don't need to do anything if we just
8776 2003-12-11 Martin Baulig <martin@ximian.com>
8778 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8779 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8780 Maurer for this idea.
8782 2003-12-11 Martin Baulig <martin@ximian.com>
8784 * flowanalysis.cs (MergeResult): This class is now gone; we now
8785 use the `UsageVector' for this. The reason for this is that if a
8786 branching just has one sibling, we don't need to "merge" them at
8787 all - that's the next step to do.
8788 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8791 2003-12-11 Martin Baulig <martin@ximian.com>
8793 Reworked flow analyis and made it more precise and bug-free. The
8794 most important change is that we're now using a special `Reachability'
8795 class instead of having "magic" meanings of `FlowReturns'. I'll
8796 do some more cleanups and optimizations and also add some more
8797 documentation this week.
8799 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8800 largely reworked this class.
8801 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8802 the new `Reachability' class instead of having "magic" values here.
8803 (FlowBranching): We're now using an instance of `Reachability'
8804 instead of having separate `Returns', `Breaks' etc. fields.
8806 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8807 based on flow analysis; ignore the return value of block.Emit ().
8809 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8811 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8812 if they are private.
8814 2003-12-09 Martin Baulig <martin@ximian.com>
8816 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8817 call them directly on the UsageVector.
8819 2003-12-09 Martin Baulig <martin@ximian.com>
8821 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8822 Changed return type from `FlowReturns' to `Reachability'.
8824 2003-12-09 Martin Baulig <martin@ximian.com>
8826 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8827 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8828 `Reachable' fields with a single `Reachability' one.
8830 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8832 * class.cs (FindMembers): Remove foreach's.
8845 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8850 This patch does a few things:
8851 1. EmptyStatement is now a singleton, so it is never reallocated.
8852 2. All blah is EmptyStatement constructs have been changed to
8853 blah == EmptyStatement.Value, which is much faster and valid
8854 now that EmptyStatement is a singleton.
8855 3. When resolving a block, rather than allocating a new array for
8856 the non-empty statements, empty statements are replaced with
8857 EmptyStatement.Value
8858 4. Some recursive functions have been made non-recursive.
8859 Mainly the performance impact is from (3), however (1) and (2) are needed for
8860 this to work. (4) does not make a big difference in normal situations, however
8861 it makes the profile look saner.
8866 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8867 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8868 Total memory allocated: 56397 KB
8871 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
8872 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
8873 Total memory allocated: 55666 KB
8875 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8877 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
8878 than the hashtable in a hashtable version
8880 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
8881 we always end up concating a string. This results in a huge perf
8882 loss, because many strings have to be tracked by the GC. In this
8883 patch, we first use a hashtable that works with two keys, so that
8884 the strings do not need to be concat'ed.
8895 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8897 * Makefile: Add a new target `do-time' that does a quick and simple
8898 profile, leaving easy to parse output.
8900 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
8902 * codegen.cs (Init): Create the dynamic assembly with
8903 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
8905 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
8907 * support.cs: Make the PtrHashtable use only one
8908 instance of its comparer.
8910 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
8912 * typemanager.cs: Fix lookup of GetNamespaces.
8914 2003-11-29 Miguel de Icaza <miguel@ximian.com>
8916 * expression.cs: Removed redundant line.
8918 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
8919 ArrayLists, use for loops with bounds.
8921 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
8924 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
8925 arraylists, use for loop with bounds.
8927 The above three changes give us a 0.071 second performance
8928 improvement out of 3.294 seconds down to 3.223. On my machine
8929 the above changes reduced the memory usage by 1,387 KB during
8932 * cs-parser.jay (QualifiedIdentifier): New class used to represent
8933 QualifiedIdentifiers. Before we created a new string through
8934 concatenation, and mostly later on, the result would be
8935 manipulated by DecomposeQI through string manipulation.
8937 This reduced the compiler memory usage for bootstrapping from
8938 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
8939 compile times in 0.05 seconds.
8941 2003-11-28 Dick Porter <dick@ximian.com>
8943 * support.cs: Do string compares with the Invariant culture.
8951 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
8952 the comparison is done with the Invariant culture.
8954 2003-11-27 Miguel de Icaza <miguel@ximian.com>
8956 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
8957 GetEnumerator method.
8959 (ProbeCollectionType): Iterate starting at the most specific type
8960 upwards looking for a GetEnumerator
8962 * expression.cs: Shift count can be up to 31 for int/uint and 63
8965 2003-11-26 Miguel de Icaza <miguel@ximian.com>
8967 * statement.cs (Block.LookupLabel): Also look for the label on the
8968 children blocks. Use a hash table to keep track of visited
8971 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
8972 we actually did transform the other operand, otherwise fall back
8973 to the common codepath that casts to long.
8975 * cs-tokenizer.cs: Use the same code pattern as the int case.
8976 Maybe I should do the parsing myself, and avoid depending on the
8977 Parse routines to get this done.
8979 2003-11-25 Miguel de Icaza <miguel@ximian.com>
8981 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8982 which fixes bug 51347. This time test it.
8984 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
8985 attributes for example can not tell the difference between these.
8986 The difference was only a syntax feature of the language.
8988 * attribute.cs: Apply attributes to delegates.
8990 * delegate.cs: Call the apply attributes method.
8992 2003-11-24 Miguel de Icaza <miguel@ximian.com>
8994 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
8995 comparing 0 vs Byte.MinValue, not the value
8997 (ImplicitConversionRequired): When reporting a conversion error,
8998 use error 31 to print out the constant error instead of the
9001 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9002 which fixes bug 51347.
9004 2003-11-22 Miguel de Icaza <miguel@ximian.com>
9006 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
9007 which fixes the -warnaserror command line option.
9009 2003-11-21 Miguel de Icaza <miguel@ximian.com>
9011 * cfold.cs (DoNumericPromotions): During constant folding of
9012 additions on UIntConstant, special case intconstants with
9013 IntConstants like we do on the expression binary operator.
9015 2003-11-12 Miguel de Icaza <miguel@ximian.com>
9017 * convert.cs (ImplicitReferenceConversion): We were missing a case
9018 (System.Enum are not value types or class types, so we need to
9019 classify them separatedly).
9021 * driver.cs: We do not support error 2007.
9023 2003-11-12 Jackson Harper <jackson@ximian.com>
9025 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
9026 system directory. Also use the full file name so users can
9027 libraries names mscorlib-o-tron.dll in a non system dir.
9029 2004-01-04 David Sheldon <dave-mono@earth.li>
9031 * expression.cs: Added matching ")" to error message for CS0077.
9033 2003-12-19 Martin Baulig <martin@ximian.com>
9035 * typemanager.cs (TypeManager.IsEqualGenericType): New public
9036 static method; see documentation in the method.
9037 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
9039 * convert.cs (Convert.ImplicitReferenceConversion,
9040 Convert.ImplicitReferenceConversionExists): Add support for
9041 generic type declarations; see gen-36.cs.
9043 2003-12-19 Martin Baulig <martin@ximian.com>
9045 * pending.cs (Pending.InterfaceMethod): Use
9046 `Type.IsAssignableFrom()' instead of `=='.
9048 2003-12-18 Martin Baulig <martin@ximian.com>
9050 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
9053 * convert.cs (Convert.ImplicitStandardConversionExists): Use
9054 `expr_type.Equals (target_type)' instead of `=='.
9056 2003-12-08 Martin Baulig <martin@ximian.com>
9058 * generics.cs (Constraints.Types): Removed.
9059 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
9061 (Constraints.ResolveTypes): New public method; resolves the
9062 TypeExpr's to Type's.
9063 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
9064 longer takes the constraints.
9065 (TypeParameter.DefineMethod): Likewise.
9066 (TypeParameter.DefineType): New public method. Calls
9067 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
9070 2003-12-08 Martin Baulig <martin@ximian.com>
9072 * convert.cs (Convert.ImplicitConversionStandard): Use
9073 `expr_type.Equals (target_type)' instead of `=='.
9075 2003-12-08 Martin Baulig <martin@ximian.com>
9077 * typemanager.cs (TypeManager.GetReferenceType): Call
9078 `Type.MakeByRefType ()'.
9080 2003-12-08 Martin Baulig <martin@ximian.com>
9082 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
9083 just has some special meaning in some situations. For instance,
9084 it is allowed to use `where' as the name of a variable etc.
9086 2003-12-04 Martin Baulig <martin@ximian.com>
9088 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
9089 `Type.MakeArrayType()' for array types.
9091 2003-11-18 Miguel de Icaza <miguel@ximian.com>
9093 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
9096 (SizeOf.DoResolve): assign the `type_queried' field. This gets
9099 2003-11-16 Martin Baulig <martin@ximian.com>
9101 * codegen.cs (EmitContext.IsGeneric): Removed.
9103 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
9104 ResolveGeneric() on the DeclSpace.
9106 2003-11-16 Martin Baulig <martin@ximian.com>
9108 * generic.cs (TypeArguments.Resolve):
9109 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
9110 `ResolveType()' on it to get the Type.
9112 2003-11-15 Martin Baulig <martin@ximian.com>
9114 * generic.cs (ConstructedType.GetInterfaces): Override this.
9116 2003-11-14 Martin Baulig <martin@ximian.com>
9118 * interface.cs (Interface.DefineType): Define all type parameters
9119 before adding the interfaces we inherit.
9121 2003-11-11 Martin Baulig <martin@ximian.com>
9123 * generic.cs (ConstructedType.ResolveType): Always call
9124 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
9126 2003-11-10 Martin Baulig <martin@ximian.com>
9128 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
9129 (TypeManager.InitCoreTypes): Initialize them here, but instead of
9130 calling `ResolveType()' on them, directly assign their `Type'.
9132 2003-11-08 Martin Baulig <martin@ximian.com>
9134 * generic.cs (ConstructedType): Override `IsClass' etc.
9136 2003-11-08 Martin Baulig <martin@ximian.com>
9138 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
9139 return value and the `out parent' parameter.
9140 (TypeContainer.DefineType): Moved the CS0644 check into
9141 GetClassBases(). Don't pass the interface types to the
9142 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
9143 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
9145 * ecore.cs (TypeExpr.IsAttribute): New property.
9146 (TypeExpr.GetInterfaces): New method.
9148 * interface.cs (Interface.GetInterfaceTypeByName): Return a
9149 TypeExpr instead of a Type.
9150 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
9151 (Interface.DefineType): Don't pass the interface types to the
9152 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
9153 them later and then call `TypeBulider.AddInterfaceImplementation()'.
9155 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
9156 instead of a `Type[]'.
9157 (TypeManager.RegisterBuilder): Likewise.
9158 (TypeManager.AddUserInterface): Likewise.
9159 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
9160 `Type[]' and also return a `TypeExpr[]'.
9161 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
9163 2003-11-08 Martin Baulig <martin@ximian.com>
9165 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
9168 2003-11-08 Martin Baulig <martin@ximian.com>
9170 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
9171 TypeManager.ResolveExpressionTypes().
9173 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
9174 instead of an Expression.
9175 (TypeExpr): This is now an abstract base class for `TypeExpression'.
9176 (TypeExpression): New public class; formerly known as `TypeExpr'.
9178 * expression.cs (ComposedCast): Derive from TypeExpr.
9180 * typemanager.cs (TypeManager.system_*_expr): These are now
9181 TypExpr's instead of Expression's.
9182 (TypeManager.ResolveExpressionTypes): New public static function;
9183 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
9186 2003-11-06 Miguel de Icaza <miguel@ximian.com>
9188 * expression.cs (New.DoResolve): Do not dereference value that
9189 might be a null return.
9191 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
9192 sure that the constant value has the right type. Fixes an
9193 unreported bug, similar to 50425.
9195 * const.cs (Const.LookupConstantValue): Call
9196 ImplicitStandardConversionExists before doing a conversion to
9197 avoid havng the TypeManager.ChangeType do conversions.
9199 Reduced the number of casts used
9201 (Const.ChangeType): New routine to enable reuse of the constant
9202 type changing code from statement.
9204 * typemanager.cs (ChangeType): Move common initialization to
9205 static global variables.
9209 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
9210 every value type to go through, even if it was void. Fix that.
9212 * cs-tokenizer.cs: Use is_identifier_start_character on the start
9213 character of the define, and the is_identifier_part_character for
9214 the rest of the string.
9216 2003-11-05 Miguel de Icaza <miguel@ximian.com>
9218 * expression.cs (UnaryMutator.EmitCode): When I updated
9219 LocalVariableReference.DoResolve, I overdid it, and dropped an
9220 optimization done on local variable references.
9222 2003-11-04 Miguel de Icaza <miguel@ximian.com>
9224 * ecore.cs: Convert the return from Ldlen into an int.
9226 2003-10-20 Miguel de Icaza <miguel@ximian.com>
9228 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
9229 the accessibility, this is a special case for toplevel non-public
9230 classes (internal for instance).
9232 2003-10-20 Nick Drochak <ndrochak@gol.com>
9234 * ecore.cs: Fix typo and build. Needed another right paren.
9236 2003-10-19 Miguel de Icaza <miguel@ximian.com>
9238 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
9239 `internal' case regular and protected, but not allowing protected
9240 to be evaluated later. Bug 49840
9242 2003-10-15 Miguel de Icaza <miguel@ximian.com>
9244 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
9245 to kb.Nlast, and not the kb.nFirst to isolate the switch
9248 Extract the underlying type, so enumerations of long/ulong are
9249 treated like long/ulong.
9251 2003-10-14 Miguel de Icaza <miguel@ximian.com>
9253 * expression.cs (New): Overload the meaning of RequestedType to
9254 track the possible creation of the NewDelegate type, since
9255 DoResolve is invoked more than once for new constructors on field
9258 See bugs: #48800 and #37014
9260 * cs-parser.jay (declare_local_constants): Take an arraylist
9261 instead of a single constant.
9263 (local_constant_declaration): It should take a
9264 constant_declarators, not a constant_declarator. Fixes 49487
9266 * convert.cs: Fix error report.
9268 2003-10-13 Jackson Harper <jackson@ximian.com>
9270 * typemanager.cs (TypeToCoreType): Add float and double this fixes
9273 2003-11-03 Martin Baulig <martin@ximian.com>
9275 * expression.cs (ArrayAccess.GetStoreOpcode): Added
9276 `out bool has_type_arg'; if set, we need to pass the type to
9278 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
9279 Stelem_Any/Ldelem_Any for generic parameters.
9281 2003-11-02 Martin Baulig <martin@ximian.com>
9283 * expression.cs (Invocation.EmitCall): Use
9284 `TypeManager.IsValueType()' to check whether it's a value type.
9285 Don't set `struct_call' when calling a method on a type parameter.
9287 2003-11-02 Martin Baulig <martin@ximian.com>
9289 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
9290 and removed the TypeBuilder argument.
9292 * typemanager.cs (TypeManager.IsValueType): Return
9293 `t.IsGenericParameter || t.IsValueType'.
9295 2003-10-25 Martin Baulig <martin@ximian.com>
9297 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
9298 call ConstructedType.Resolve() on it.
9300 * generic.cs (ConstructedType.Resolve): Set `type' on success.
9302 2003-10-25 Martin Baulig <martin@ximian.com>
9304 * class.cs (TypeContainer.GetClassBases): Changed
9305 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
9306 CS8214 reporting here.
9307 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
9308 instead of a `Type' for our parent. In case of a recursive
9309 declaration (see tests/gen-23.cs for an example), our parent is a
9310 ConstructedType and it doesn't have its type set. So, first
9311 create our own TypeBuilder, then call constructed.Resolve() to get
9312 the parent's type and finally TypeBuilder.SetParent() it.
9314 * ecore.cs (TypeExpr.Name): New public virtual property.
9317 (ConstructedType): We're now a TypeExpr and not just an Expression.
9318 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
9319 arguments here; this is done later.
9320 (ConstructedType.Resolve): New public method to resolve the type
9321 arguments and bind them.
9323 2003-10-21 Martin Baulig <martin@ximian.com>
9325 * convert.cs: Use `TypeManager.IsValueType' instead of
9326 'type.IsValueType' everywhere.
9328 * typemanager.cs (TypeManager.IsValueType): Return true for type
9329 parameters. The reason for this is that we need to box a type
9330 parameter when converting it to a reference type.
9332 * cs-parser.jay: Added support for default value expressions.
9334 * generics.cs (DefaultValueExpression): New public class.
9336 2003-10-17 Martin Baulig <martin@ximian.com>
9338 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
9339 TypeContainer so we can also use this for Interfaces.
9340 (TypeParameter.Resolve): Likewise.
9342 * interface.cs (Interface.DefineType): Added support for generic
9345 * cs-parser.jay: Added support for generic structs and interfaces.
9347 2003-10-17 Martin Baulig <martin@ximian.com>
9349 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
9350 call generic methods :-)
9352 2003-10-16 Martin Baulig <martin@ximian.com>
9354 * cs-parser.jay (namespace_or_type_name): Only create a
9355 GenericMemberAccess if we actually have type arguments.
9357 2003-10-13 Martin Baulig <martin@ximian.com>
9359 * class.cs (Method.Define): If we're a generic method, call
9360 TypeBuilder.DefineGenericMethod () before resolving
9362 (MethodData): Added .ctor which takes an additional MethodBuilder
9363 argument; this is used for generic methods.
9364 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
9365 we already have a MethodBuilder.
9367 2003-10-10 Martin Baulig <martin@ximian.com>
9369 * class.cs (Method): Added .ctor which takes a `GenericMethod'
9370 instead of a `DeclSpace'. This is used for generic methods.
9372 * cs-parser.jay (method_header): Added support for generic
9373 methods; create a `GenericMethod' instance and pass it to the
9374 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
9375 parameters and locals.
9377 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
9378 since we already have the location. Check whether we're a generic
9379 type declaration or a generic method and create the correct type
9382 * generic.cs (TypeParameter.DefineMethod): New public method.
9383 (GenericMethod): New public class; derives from DeclSpace and is
9384 used for generic methods.
9386 2003-10-09 Martin Baulig <martin@ximian.com>
9388 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
9390 (MethodCore.DoDefineParameters): Removed the TypeContainer
9391 argument; use the DeclSpace which was passed to the .ctor instead.
9392 (MethodCore.CheckParameter): Take a DeclSpace instead of a
9393 TypeContainer; we only need a DeclSpace here.
9395 2003-10-09 Martin Baulig <martin@ximian.com>
9397 * class.cs (MethodData): Added additional `DeclSpace ds' argument
9399 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
9400 EmitContext's .ctor.
9402 2003-10-09 Martin Baulig <martin@ximian.com>
9404 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
9405 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
9406 AsAccessible(), moved them as well.
9408 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
9410 2003-10-07 Miguel de Icaza <miguel@ximian.com>
9412 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
9413 generation for >=, as spotted by Paolo, bug 48679.
9414 Patch from David Waite.
9416 * cs-tokenizer.cs: Add handling for #pragma.
9418 * cs-parser.jay: Allow for both yield and yield return in the
9419 syntax. The anti-cobolization of C# fight will go on!
9421 * class.cs (TypeBuilder.DefineType): Catch error condition here
9422 (Parent.DefineType erroring out and returning null).
9424 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9425 coping with enumerations variables, we were mistakenly processing
9426 them as a regular value type instead of built-in types. Fixes the
9429 * typemanager.cs (IsBuiltinOrEnum): New method.
9431 2003-09-30 Miguel de Icaza <miguel@ximian.com>
9433 * cs-parser.jay: Upgrade: yield now needs the return clause.
9435 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
9437 * cs-parser.jay : Renamed yyName to yyNames related to jay.
9439 2003-09-29 Martin Baulig <martin@ximian.com>
9441 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
9442 inflated generic methods.
9444 * generics.cs (ConstructedType): Distinguish between open and
9445 closed constructed types; correctly resolve the arguments.
9447 2003-09-22 Martin Baulig <martin@ximian.com>
9449 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
9450 all type arguments meet their constraints.
9452 2003-09-19 Martin Baulig <martin@ximian.com>
9454 * decl.cs (MemberCache.SetupCacheForInterface): Take a
9455 `MemberCache parent' argument. Normally, an interface doesn't
9456 have a parent type except System.Object, but we use this in gmcs
9457 for generic type parameters.
9459 2003-09-18 Martin Baulig <martin@ximian.com>
9461 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
9462 on `type.IsInterface'; don't check whether the type has a parent
9463 to determine whether it's an interface.
9465 2003-09-17 Martin Baulig <martin@ximian.com>
9467 * generic.cs (ConstructedType.ToString): Always use `name' as the
9470 2003-09-15 Martin Baulig <martin@ximian.com>
9472 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
9474 * generic.cs (Constraints.Resolve): New public method; this is
9475 called to resolve the constraint types and to check whether all
9476 the constraints are correct.
9477 (Constraints.Types): New public property.
9478 (TypeParameter.Resolve): New public method; resolves all the
9481 * class.cs (TypeContainer.DefineType): Call
9482 TypeParameter.Resolve() before actually defining the type.
9484 2003-09-15 Martin Baulig <martin@ximian.com>
9486 * class.cs (TypeContainer.DefineType): Added an error flag to
9487 avoid reporting duplicate CS0146's ("class definition is
9490 * driver.cs (Driver.MainDriver): Abort if
9491 RootContext.ResolveTree() reported any errors.
9493 2003-09-07 Martin Baulig <martin@ximian.com>
9495 * report.cs (Error, Warning): Added overloaded versions which take
9496 a `params object[] args' and call String.Format().
9498 2003-09-07 Martin Baulig <martin@ximian.com>
9500 * decl.cs (DeclSpace..ctor): Don't call
9501 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
9502 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
9503 (DeclSpace.RecordDecl): New method.
9505 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
9507 2003-09-02 Ravi Pratap <ravi@ximian.com>
9509 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
9510 value attributes to be applied to ParameterBuilders.
9512 * class.cs (MethodCore.LabelParameters): Make static and more
9513 generic so that it can be used from other places - like interface
9514 methods, for instance.
9516 * interface.cs (Interface.Emit): Call LabelParameters before
9517 emitting attributes on the InterfaceMethod.
9519 2003-09-07 Martin Baulig <martin@ximian.com>
9521 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
9522 if the number of type parameters doesn't match.
9524 2003-09-04 Martin Baulig <martin@ximian.com>
9526 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
9527 for arrays of generic type params (ie. `!0[]').
9529 2003-09-04 Martin Baulig <martin@ximian.com>
9531 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
9534 2003-09-04 Martin Baulig <martin@ximian.com>
9536 * decl.cs (DeclSpace.LookupGeneric): New method.
9537 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
9540 * generic.cs (TypeParameterExpr): Take a TypeParameter as
9541 argument, not just a string.
9542 (TypeParameter.Define): New public method; this is called to
9543 actually define the generic parameter; after this, you can use the
9544 new `Type' property to get the type.
9546 2003-09-04 Martin Baulig <martin@ximian.com>
9548 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
9549 is now an ArrayList; initialize the result of the `TypeParameters'
9551 (DeclSpace.GetGenericData): Removed.
9552 (DeclSpace.LookupGeneric): Temporarily removed; we need to
9553 implement this in a different way.
9554 (DeclSpace.GetTypeParameters): Removed; there's now a
9555 `TypeParameters' property.
9556 (DeclSpace.TypeParameters): New public property.
9558 * generic.cs (Constraints): Make this class public.
9559 (TypeParameter): New public class.
9561 2003-09-04 Martin Baulig <martin@ximian.com>
9563 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
9566 * class.cs (TypeContainer.DefineType): Call
9567 TypeBuilder.DefineGenericParameter () on all generic parameters if
9568 this is a generic type.
9570 2003-08-28 Martin Baulig <martin@ximian.com>
9572 * sample-stack.il: Compile this with ilasm: "ilasm /dll
9575 * sample-hello.cs: Compile this with gmcs: "gmcs
9576 /r:sample-stack.dll sample-hello.cs".
9578 2003-08-28 Martin Baulig <martin@ximian.com>
9580 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
9581 the parameters to the generic type.
9583 2003-08-28 Martin Baulig <martin@ximian.com>
9585 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
9587 2003-08-28 Martin Baulig <martin@ximian.com>
9589 * cs-parser.jay (opt_type_argument_list): Use
9590 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
9591 (primary_expression): Replace `qualified_identifier' with `type_name'.
9592 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
9594 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
9595 parser to check whether it is syntactically a type parameter list;
9596 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
9599 2003-08-26 Martin Baulig <martin@ximian.com>
9601 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
9602 resolving aliases; fixes #47927.
9604 2003-08-26 Martin Baulig <martin@ximian.com>
9606 * statement.cs (Using.DoResolve): This is internally emitting a
9607 try/finally clause, so we need to set ec.NeedExplicitReturn if we
9608 do not always return. Fixes #47681.
9610 2003-08-26 Martin Baulig <martin@ximian.com>
9612 * decl.cs (MemberCore): Moved WarningNotHiding(),
9613 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
9615 (AdditionResult): Make this nested in DeclSpace.
9616 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
9617 argument; call NamespaceEntry.Define() unless we're nested in a
9620 * namespace.cs (Namespace.DefineName): New public function. This
9621 is called from DeclSpace's .ctor to add
9622 (Namespace.Lookup): Include DeclSpaces in the lookup.
9624 * class.cs (Operator): Derive from MemberBase, not MemberCore.
9626 * const.cs (Const): Derive from MemberBase, not MemberCore.
9628 2003-08-25 Martin Baulig <martin@ximian.com>
9630 * convert.cs (Convert.ExplicitReferenceConversion): When
9631 converting from an interface type to a class, unbox if the target
9632 type is a struct type. Fixes #47822.
9634 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9636 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
9639 2003-08-22 Martin Baulig <martin@ximian.com>
9641 * class.cs (TypeManager.DefineType): When defining a nested type,
9642 call DefineType() on our parent; fixes #47801.
9644 2003-08-22 Martin Baulig <martin@ximian.com>
9646 * class.cs (MethodData.Define): While checking if a method is an
9647 interface implementation, improve the test a bit more to fix #47654.
9649 2003-08-22 Martin Baulig <martin@ximian.com>
9651 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
9652 correctly; fixes #47722.
9654 2003-08-22 Martin Baulig <martin@ximian.com>
9656 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9657 LocalVariableReference, ensure it's not read-only. Fixes #47536.
9659 * statement.cs (Fixed.DoResolve): Make all variables read-only.
9661 2003-08-22 Martin Baulig <martin@ximian.com>
9663 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
9664 can only be assigned in static constructors. Fixes #47161.
9666 2003-08-22 Martin Baulig <martin@ximian.com>
9668 Rewrote and improved the flow analysis code.
9670 * flowbranching.cs (FlowBranching): Make this class abstract.
9671 (FlowBranching.CreateBranching): New static function to create a
9673 (FlowBranchingBlock, FlowBranchingException): New classes.
9674 (FlowBranching.UsageVector.Type): New public readonly field.
9675 (FlowBranching.UsageVector.Breaks): Removed the setter.
9676 (FlowBranching.UsageVector.Returns): Removed the setter.
9677 (FlowBranching.UsageVector): Added Break(), Return(),
9678 NeverReachable() and Throw() methods to modify the reachability.
9679 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
9680 done by FlowBranching.Merge().
9681 (FlowBranching.UsageVector.MergeChild): New method; merges the
9682 merge result into the current vector.
9683 (FlowBranching.Merge): New abstract method to merge a branching.
9685 2003-08-12 Martin Baulig <martin@ximian.com>
9687 * expression.cs (Indirection.CacheTemporaries): Create the
9688 LocalTemporary with the pointer type, not its element type.
9690 2003-08-10 Miguel de Icaza <miguel@ximian.com>
9692 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
9693 token was a keyword or not.
9695 Add `error' options where an IDENTIFIER was expected; Provide
9696 CheckToken and CheckIdentifierToken convenience error reporting
9699 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
9701 * decl.cs: Rename `NamespaceEntry Namespace' public field into
9702 NameSpaceEntry NameSpaceEntry.
9704 (LookupInterfaceOrClass): Avoid creating a full qualified name
9705 from namespace and name: avoid doing lookups when we know the
9706 namespace is non-existant. Use new Tree.LookupByNamespace which
9707 looks up DeclSpaces based on their namespace, name pair.
9709 * driver.cs: Provide a new `parser verbose' to display the
9710 exception thrown during parsing. This is turned off by default
9711 now, so the output of a failure from mcs is more graceful.
9713 * namespace.cs: Track all the namespaces defined in a hashtable
9716 (IsNamespace): New method
9718 2003-08-09 Miguel de Icaza <miguel@ximian.com>
9720 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
9721 we know that we need to concatenate (full typename can never be
9726 * statement.cs: Use a bitfield; Do not initialize to null things
9727 which are done by the constructor by default.
9729 * cs-parser.jay: bug fix, parameter was 4, not 3.
9731 * expression.cs: Just use the property;
9733 * statement.cs: No need for GetVariableInfo method.
9735 2003-08-08 Martin Baulig <martin@ximian.com>
9737 * flowanalysis.cs (FlowReturns): This is now nested in the
9738 `FlowBranching' class.
9739 (MyBitVector): Moved this here from statement.cs.
9740 (FlowBranching.SiblingType): New enum type.
9741 (FlowBranching.CreateSibling): Added `SiblingType' argument.
9743 2003-08-07 Martin Baulig <martin@ximian.com>
9745 * flowanalysis.cs (FlowBranchingType): This is now nested in the
9746 `FlowBranching' class and called `BranchingType'.
9748 2003-08-07 Martin Baulig <martin@ximian.com>
9750 * flowanalysis.cs: Moved all the control flow analysis code into
9753 2003-08-07 Martin Baulig <martin@ximian.com>
9755 * assign.cs (Assign.DoResolve): `target' must either be an
9756 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
9759 2003-08-07 Miguel de Icaza <miguel@ximian.com>
9761 * expression.cs (BinaryMethod): This kind of expression is created by the
9762 Binary class if it determines that the operator has to be handled
9765 (BinaryDelegate): This kind of expression is created if we are
9766 dealing with a + or - operator on delegates.
9768 (Binary): remove method, argumetns, and DelegateOperator: when
9769 dealing with methods,
9771 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
9773 * statement.cs (Block): use bitfields for the three extra booleans
9774 we had in use. Remove unused topblock parameter.
9776 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
9778 * assign.cs: Drop extra unneeded tests.
9780 2003-08-06 Miguel de Icaza <miguel@ximian.com>
9782 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
9784 * statement.cs (Foreach): Use VariableStorage instead of
9787 * codegen.cs (VariableStorage): New class used by clients that
9788 require a variable stored: locals or fields for variables that
9789 need to live across yield.
9791 Maybe provide a convenience api for EmitThis+EmitLoad?
9793 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
9796 2003-08-05 Miguel de Icaza <miguel@ximian.com>
9798 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
9799 RemapParameterLValue): New methods that are used to turn a
9800 precomputed FieldInfo into an expression like this:
9804 The idea is to use this instead of making LocalVariableReference
9805 have more than one meaning.
9807 * cs-parser.jay: Add error production to BASE.
9809 * ecore.cs: Deal with TypeManager.GetField returning null, which
9810 is now a valid return value.
9812 (FieldExprNoAddress): New expression for Fields whose address can
9815 * expression.cs (LocalVariableReference): During the resolve
9816 phases, create new expressions if we are in a remapping context.
9817 Remove code that dealt with remapping here.
9819 (ParameterReference): same.
9821 (ProxyInstance): New expression, like the `This' expression, but
9822 it is born fully resolved. We know what we are doing, so remove
9823 the errors that are targeted to user-provided uses of `this'.
9825 * statement.cs (Foreach): our variable is now stored as an
9826 Expression; During resolution, follow the protocol, dont just
9827 assume it will return this.
9829 2003-08-06 Martin Baulig <martin@ximian.com>
9831 * support.cs (SeekableStreamReader.cs): New public class.
9833 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
9834 SeekableStreamReader instead of the normal StreamReader.
9836 2003-08-04 Martin Baulig <martin@ximian.com>
9838 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
9839 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
9840 deambiguate casts and delegate invocations.
9841 (parenthesized_expression): Use the new tokens to ensure this is
9842 not a cast of method invocation.
9844 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
9845 when reading a `)' and Deambiguate_CloseParens () was previously
9848 * expression.cs (ParenthesizedExpression): New class. This is
9849 just used for the CS0075 test.
9850 (Binary.DoResolve): Check for CS0075.
9852 2003-07-29 Ravi Pratap <ravi@ximian.com>
9854 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
9855 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
9856 reference comparison.
9858 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
9859 examine the ReturnType for equality - this is necessary in the
9860 cases of implicit and explicit operators whose signature also
9861 includes the return type.
9863 2003-07-26 Miguel de Icaza <miguel@ximian.com>
9865 * namespace.cs: Cache the result of the namespace computation,
9866 instead of computing it every time.
9868 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9870 * decl.cs: Use a global arraylist that we reuse over invocations
9871 to avoid excesive memory consumption. Reduces memory usage on an
9872 mcs compile by one meg (45 average).
9874 * typemanager.cs (LookupTypeReflection): In .NET pointers are
9875 private, work around that.
9877 2003-07-23 Miguel de Icaza <miguel@ximian.com>
9879 * literal.cs (IntLiteral): Define Zero and One static literals.
9881 * cs-parser.jay (integer_literal): use static literals to reduce
9882 memory usage for the most used literals (0, 1 and -1). 211kb
9883 reduced in memory usage.
9885 Replace all calls to `new ArrayList' with `new
9886 ArrayList(4)' which is a good average number for most allocations,
9887 and also requires only 16 bytes of memory for its buffer by
9890 This reduced MCS memory usage in seven megabytes for the RSS after
9893 2003-07-28 Ravi Pratap <ravi@ximian.com>
9895 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
9896 handle params methods the correct way by forming only one
9897 applicable set with params and normal methods in them. Earlier we
9898 were looking at params methods only if we found no normal methods
9899 which was not the correct thing to do.
9901 (Invocation.BetterFunction): Take separate arguments indicating
9902 when candidate and the best method are params methods in their
9905 This fixes bugs #43367 and #46199.
9907 * attribute.cs: Documentation updates.
9909 (CheckAttribute): Rename to CheckAttributeTarget.
9910 (GetValidPlaces): Rename to GetValidTargets.
9912 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
9913 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
9917 2003-07-28 Miguel de Icaza <miguel@ximian.com>
9919 * codegen.cs: Compute IsGeneric correctly.
9921 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
9924 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
9925 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
9926 regressions, and I was chasing more bugs than I required.
9928 * interface.cs: Use expressions for base type names (like classes
9929 and structs have been doing for a while now), and resolve that.
9930 This patch should probably go into head as well.
9932 This makes it one less user of FindType.
9934 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9936 This compiler can not self host currently. Need to fix that.
9938 * Makefile: compile to `gmcs.exe'
9940 * driver.cs: Turn on v2 by default on gmcs.
9942 * generic.cs (ConstructedType): Does no longer take a container
9943 type argument; That will be taken care of later.
9945 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
9946 Use SimpleName to resolve for now, so we can continue the work on
9947 the parser, until we get Type.GetType that understands generics.
9949 (ConstructedType.ToString): Implement
9951 (TypeArguments.Resolve): Resolve the child expressions as types.
9953 * cs-parser.jay: Rename interface_constraints to
9954 type_parameter_constraints
9956 (namespace_or_type_name): Only use constructed types for the basic
9957 construction, we will deal with identifier<...> later.
9959 (type/type_name): No longer call DecomposeQI, as
9960 namespace_or_type_name is always decoded now.
9962 2003-07-22 Ravi Pratap <ravi@ximian.com>
9964 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9965 closely: we eliminate methods in base types when we have an
9966 applicable method in a top-level type.
9968 Please see section 14.5.5.1 for an exact description of what goes
9971 This fixes bug #45127 and a host of other related to corlib compilation.
9973 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9974 array is the method corresponding to the top-level type (this is
9975 because of the changes made to icall.c) so we change this
9978 (MethodGroupExpr.Name): This too.
9980 * typemanager.cs (GetElementType): New method which does the right
9981 thing when compiling corlib.
9983 * everywhere: Make use of the above in the relevant places.
9985 2003-07-22 Martin Baulig <martin@ximian.com>
9987 * cs-parser.jay (invocation_expression): Moved
9988 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9989 `cast_expression', but create a InvocationOrCast which later
9990 resolves to either an Invocation or a Cast.
9992 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9993 method; call this before EmitStatement() to make sure that this
9994 expression can be used as a statement.
9996 * expression.cs (InvocationOrCast): New class; resolves to either
9997 an Invocation or a Cast.
9999 * statement.cs (StatementExpression): Call ResolveStatement() on
10000 the ExpressionStatement before emitting it.
10002 2003-07-21 Martin Baulig <martin@ximian.com>
10004 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
10005 `ref' and `out' attributes match; fixes #46220.
10006 (MemberAccess.ResolveMemberAccess): You can't reference a type
10007 through an expression; fixes #33180.
10008 (Indexers.GetIndexersForType): Don't return the indexers from
10009 interfaces the class implements; fixes #46502.
10011 2003-07-21 Martin Baulig <martin@ximian.com>
10013 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
10014 CS0661 checks; fixes bug #30442.
10016 2003-07-21 Martin Baulig <martin@ximian.com>
10018 * decl.cs (AdditionResult): Added `Error'.
10020 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
10022 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
10023 cs0031.cs actually work.
10025 2003-07-20 Miguel de Icaza <miguel@ximian.com>
10027 * cs-parser.jay (namespace_name): do not use
10028 namespace_or_type_name, use qualified_identifier, because
10029 namespace_or_type_name will soon return a composed expression
10030 instead of a string.
10032 (namespace_or_type_name): Instead of returning a string, now this
10033 production returns an expression.
10035 * codegen.cs (EmitContext): Setup IsGeneric property based on
10036 whether our DeclSpace is generic, our the method is generic.
10038 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
10039 the method is generic.
10041 * cs-parser.jay (type_arguments, opt_type_argument_list,
10042 type_parameters, type_parameter_list, opt_type_parameter_list,
10043 type_parameter,, opt_type_parameter_constraints_clauses,
10044 type_parameter_constraints_clauses,
10045 type_parameter_constraint_clause, type_parameter_constraint,
10046 interface_constraints): Add new production
10048 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
10049 DeclSpace is generic or not.
10051 (DeclSpace.SetParameterInfo): New routine, used to set the
10052 parameter info for a type.
10054 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
10055 returns a GenericTypeExpr
10057 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
10058 generic, lookup the generic argument.
10060 * attribute.cs: Do not allow TypeParameterExpressions in
10063 * class.cs: Do not allow the Main method to be defined in a
10066 * expression.cs (SizeOf): Do not allow generic types to be used as
10067 arguments to sizeof.
10069 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
10070 it: whether a type is generic or not. Only works for types we are
10071 currently building for now.
10073 2003-07-20 Martin Baulig <martin@ximian.com>
10075 * namespace.cs: Fixed that bug which caused a crash when compiling
10076 the debugger's GUI.
10078 2003-07-20 Miguel de Icaza <miguel@ximian.com>
10080 * typemanager.cs (LookupTypeReflection): Never expose types which
10081 are NotPublic, NestedPrivate, NestedAssembly, or
10082 NestedFamANDAssem. We used to return these, and later do a check
10083 that would report a meaningful error, but the problem is that we
10084 would not get the real match, if there was a name override.
10086 2003-07-18 Miguel de Icaza <miguel@ximian.com>
10088 * namespace.cs (Namespace, Name): Do not compute the namespace
10089 name dynamically, compute it in the constructor. This reduced
10090 memory usage by 1697 KB.
10092 * driver.cs: Use --pause to pause at the end.
10094 2003-07-17 Peter Williams <peter@newton.cx>
10096 * Makefile: Change the name of the test target so that it doesn't
10097 conflict with the recursive test target.
10099 2003-07-17 Miguel de Icaza <miguel@ximian.com>
10101 * expression.cs (LocalVariableReference.Emit, EmitAssign,
10102 AddressOf): Do not use EmitThis, that was wrong, use the actual
10105 2003-07-15 Miguel de Icaza <miguel@ximian.com>
10107 * class.cs (MethodData.Define): While checking if a method is an
10108 interface implementation, improve the test: If we are not public
10109 (use new test here: use the computed MethodAttributes directly,
10110 instead of the parsed modifier flags) check if the `implementing'
10111 method comes from an interface or not.
10113 * pending.cs (VerifyPendingMethods): Slightly better error
10116 * makefile: add test target that does the mcs bootstrap.
10118 2003-07-16 Ravi Pratap <ravi@ximian.com>
10120 * interface.cs (Define): Do nothing here since there are no
10121 members to populate etc. Move the attribute emission out of here
10122 since this was just totally the wrong place to put it. Attribute
10123 application happens during the 'Emit' phase, not in the 'Define'
10126 (Emit): Add this method and move the attribute emission here
10128 * rootcontext.cs (EmitCode): Call the Emit method on interface
10131 2003-07-14 Ravi Pratap M <ravi@ximian.com>
10133 * expression.cs (OverloadResolve): Report error only if Location
10134 is not 'Null' which means that there was a probe going on.
10136 2003-07-14 Martin Baulig <martin@ximian.com>
10138 * expression.cs (ConditionalLogicalOperator): New public class to
10139 implement user defined conditional logical operators.
10140 This is section 14.11.2 in the spec and bug #40505.
10142 2003-07-14 Martin Baulig <martin@ximian.com>
10144 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
10146 2003-07-14 Martin Baulig <martin@ximian.com>
10148 * codegen.cs (EmitContext.InFixedInitializer): New public field.
10150 * ecore.cs (IVariable.VerifyFixed): New interface method.
10152 * expression.cs (Unary.ResolveOperator): When resolving the `&'
10153 operator, check whether the variable is actually fixed. Fixes bug
10154 #36055. Set a variable definitely assigned when taking its
10155 address as required by the spec.
10157 * statement.cs (LocalInfo.IsFixed): New field.
10158 (LocalInfo.MakePinned): Set `IsFixed' to true.
10160 2003-07-14 Ravi Pratap M <ravi@ximian.com>
10162 * attribute.cs (Attribute.Resolve): While doing a Member lookup
10163 for .ctors, ensure that we only ask for members declared in the
10164 attribute type (BindingFlags.DeclaredOnly).
10168 * expression.cs (Error_WrongNumArguments): Report error 1501
10169 correctly the way CSC does.
10171 2003-07-13 Martin Baulig <martin@ximian.com>
10173 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
10174 lookup on the fully qualified name, to make things like "X.X" work
10175 where "X.X" is a fully qualified type name, but we also have a
10176 namespace "X" in the using list. Fixes #41975.
10178 2003-07-13 Martin Baulig <martin@ximian.com>
10180 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
10181 function. If we're a CompoundAssign, we need to create an embedded
10182 CompoundAssign, not an embedded Assign.
10183 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
10186 2003-07-13 Martin Baulig <martin@ximian.com>
10188 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
10189 work to fix bug #46088.
10191 2003-07-13 Ravi Pratap <ravi@ximian.com>
10193 * class.cs (Operator.Emit): Do not emit attributes here - it is
10194 taken care of by the Method class that we delegate too. This takes
10195 care of bug #45876.
10197 2003-07-10 Martin Baulig <martin@ximian.com>
10199 * expression.cs (TypeOfVoid): New class.
10200 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
10202 2003-07-10 Martin Baulig <martin@ximian.com>
10204 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
10207 2003-07-10 Martin Baulig <martin@ximian.com>
10209 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
10210 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
10212 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
10214 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
10216 2003-07-10 Martin Baulig <martin@ximian.com>
10218 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
10219 of decimal. Fixes #42850.
10221 NOTE: I also fixed the created byte blob, but this doesn't work on
10222 the MS runtime and csc never produces any byte blobs for decimal
10225 2003-07-10 Martin Baulig <martin@ximian.com>
10227 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
10228 structs; fixes #32068.
10229 (Block.AddChildVariableNames): Fixed #44302.
10231 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10233 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
10235 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10237 * attribute.cs: And this test is onger needed.
10239 2003-07-08 Martin Baulig <martin@ximian.com>
10241 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
10242 inaccessible types. Fixes #36313.
10244 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
10246 * namespace.cs (NamespaceEntry): Create implicit entries for all
10247 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
10248 implicit entries for N1.N2 and N1.
10250 2003-07-08 Martin Baulig <martin@ximian.com>
10252 Rewrote the handling of namespaces to fix a lot of the issues
10253 wrt. `using' aliases etc.
10255 * namespace.cs (Namespace): Splitted this class into a
10256 per-assembly `Namespace' and a per-file `NamespaceEntry'.
10258 * typemanager.cs (TypeManager.IsNamespace): Removed.
10259 (TypeManager.ComputeNamespaces): Only compute namespaces from
10260 loaded assemblies here, not the namespaces from the assembly we're
10261 currently compiling.
10263 2003-07-08 Martin Baulig <martin@ximian.com>
10265 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
10267 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10269 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
10272 I thought about the memory savings here, but LookupTypeReflection
10273 is used under already very constrained scenarios. Compiling
10274 corlib or mcs only exposes one hit, so it would not really reduce
10275 any memory consumption.
10277 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10279 * typemanager.cs: fixes bug #45889 by only adding public types from
10280 other assemblies to the list of known types.
10282 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10284 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
10285 on the type we resolved.
10287 2003-07-05 Martin Baulig <martin@ximian.com>
10289 * pending.cs (PendingImplementation.ParentImplements): Don't
10290 create the proxy if the parent is abstract.
10292 * class.cs (TypeContainer.DefineIndexers): Process explicit
10293 interface implementations first. Fixes #37714.
10295 2003-07-04 Miguel de Icaza <miguel@ximian.com>
10297 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
10298 defined recursively; but since we modify the input parameters
10299 (left is set to `this' temporarily), we reset this value if the
10300 left_is_explicit is false, which gives the original semantics to
10303 * literal.cs (NullPointer): new class used to represent a null
10304 literal in a pointer context.
10306 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
10307 type is a pointer, use a NullPointer object instead of a
10308 NullLiteral. Closes 43687
10310 (ExplicitConversion): Convert pointer values using
10311 the conv opcode to the proper type.
10313 * ecore.cs (New): change ValueTypeVariable property into a method,
10314 that returns whether the valuetype is suitable for being used.
10316 * expression.cs (Binary.DoNumericPromotions): Only return if we
10317 the int constant was a valid uint, and we can return both left and
10318 right as uints. If not, we continue processing, to trigger the
10319 type conversion. This fixes 39018.
10321 * statement.cs (Block.EmitMeta): During constant resolution, set
10322 the CurrentBlock property on the emitcontext, so that we resolve
10323 constants propertly.
10325 2003-07-02 Martin Baulig <martin@ximian.com>
10327 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
10328 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
10330 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
10331 than emitting it here.
10333 * statement.cs: Fixed some more flow analysis bugs.
10335 2003-07-02 Martin Baulig <martin@ximian.com>
10337 * class.cs (MethodData.Define): When implementing interface
10338 methods, set Final unless we're Virtual.
10340 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
10341 check work for interface methods.
10343 2003-07-01 Martin Baulig <martin@ximian.com>
10345 * ecore.cs (EmitContext.This): Replaced this property with a
10346 GetThis() method which takes a Location argument. This ensures
10347 that we get the correct error location for a CS0188.
10349 2003-07-01 Miguel de Icaza <miguel@ximian.com>
10351 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
10352 ImplicitStandardConversion.
10354 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
10356 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
10358 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
10361 2003-06-30 Miguel de Icaza <miguel@ximian.com>
10363 * class.cs (Constructor.Define): Turn off initlocals for unsafe
10366 (MethodData.Define): Turn off initlocals for unsafe methods.
10368 2003-06-29 Miguel de Icaza <miguel@ximian.com>
10370 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
10371 complete; Fixes #37521.
10373 * delegate.cs: Use Modifiers.TypeAttr to compute the
10374 TypeAttributes, instead of rolling our own. This makes the flags
10375 correct for the delegates.
10377 2003-06-28 Miguel de Icaza <miguel@ximian.com>
10379 * class.cs (Constructor.Define): Set the private flag for static
10380 constructors as well.
10382 * cs-parser.jay (statement_expression): Set the return value to
10383 null, to avoid a crash when we catch an error.
10385 2003-06-24 Miguel de Icaza <miguel@ximian.com>
10387 * cs-parser.jay: Applied patch from Jackson that adds support for
10388 extern and unsafe modifiers to destructor declarations.
10390 * expression.cs: Report error 21 if the user is trying to index a
10393 * driver.cs: Add an error message, suggested by the bug report.
10395 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
10396 if we do not have a ": this ()" constructor initializer. Fixes 45149
10398 2003-06-14 Miguel de Icaza <miguel@ximian.com>
10400 * namespace.cs: Add some information to reduce FAQs.
10402 2003-06-13 Miguel de Icaza <miguel@ximian.com>
10404 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
10405 underlying enumeration types. Fixes #43915.
10407 * expression.cs: Treat ushort/short as legal values to be used in
10408 bitwise operations.
10410 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
10412 * delegate.cs: transfer custom attributes for paramenters from
10413 the delegate declaration to Invoke and BeginInvoke.
10415 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
10417 * attribute.cs: handle custom marshalers and emit marshal info
10420 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
10422 * makefile.gnu: Added anonymous.cs to the compiler sources.
10424 2003-05-28 Miguel de Icaza <miguel@ximian.com>
10426 * iterators.cs: Change the name of the proxy class to include two
10429 * cs-parser.jay: Update grammar to include anonymous methods.
10431 * anonymous.cs: new file.
10433 2003-05-27 Miguel de Icaza <miguel@ximian.com>
10435 * class.cs (Field.Define): Add missing test for pointers and
10438 2003-05-27 Ravi Pratap <ravi@ximian.com>
10440 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
10441 we use the stobj opcode.
10443 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
10444 since it wasn't the correct fix.
10446 It still is puzzling that we are required to use stobj for IntPtr
10447 which seems to be a ValueType.
10449 2003-05-26 Miguel de Icaza <miguel@ximian.com>
10451 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
10452 during regular simple name resolution. Now, the trick is that
10453 instead of returning for processing the simplename, we do a
10454 TypeManager.LookupType (ie, a rooted lookup as opposed to a
10455 contextual lookup type). If a match is found, return that, if
10456 not, return for further composition.
10458 This fixes long-standing 30485.
10460 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
10461 using the address to initialize an object, do an Stobj instead of
10462 using the regular Stelem.
10464 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
10465 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
10466 Because if we are a BaseIndexerAccess that value will be true.
10469 * statement.cs (GotoCase.Resolve): Return after reporting an
10470 error, do not attempt to continue.
10472 * expression.cs (PointerArithmetic.Emit): If our operand is a
10473 long, convert our constants to match the operand before
10474 multiplying. Convert to I type before adding. Fixes 43670.
10476 2003-05-14 Ravi Pratap <ravi@ximian.com>
10478 * enum.cs (ImplicitConversionExists) : Rename to
10479 ImplicitEnumConversionExists to remove ambiguity.
10481 * ecore.cs (NullCast): New type of cast expression class which
10482 basically is very similar to EmptyCast with the difference being
10483 it still is a constant since it is used only to cast a null to
10485 (eg. (string) null)
10487 * convert.cs (ImplicitReferenceConversion): When casting a null
10488 literal, we return a NullCast.
10490 * literal.cs (NullLiteralTyped): Remove - I don't see why this
10491 should be around anymore.
10493 The renaming (reported was slightly wrong). Corrections:
10495 ConvertImplicitStandard -> ImplicitConversionStandard
10496 ConvertExplicitStandard -> ExplicitConversionStandard
10498 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
10499 before passing them in !
10501 * convert.cs (ImplicitConversionStandard): When comparing for
10502 equal expr and target types, ensure that expr is not a
10505 In general, we must not be checking (expr_type ==
10506 target_type) in the top level conversion methods
10507 (ImplicitConversion, ExplicitConversion etc). This checking is
10508 done in the methods that they delegate to.
10510 2003-05-20 Miguel de Icaza <miguel@ximian.com>
10512 * convert.cs: Move Error_CannotConvertType,
10513 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
10514 ImplicitNumericConversion, ImplicitConversionExists,
10515 ImplicitUserConversionExists, StandardConversionExists,
10516 FindMostEncompassedType, FindMostSpecificSource,
10517 FindMostSpecificTarget, ImplicitUserConversion,
10518 ExplicitUserConversion, GetConversionOperators,
10519 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
10520 TryImplicitIntConversion, Error_CannotConvertImplicit,
10521 ConvertImplicitRequired, ConvertNumericExplicit,
10522 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
10523 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
10526 Perform the following renames:
10528 StandardConversionExists -> ImplicitStandardConversionExists
10529 ConvertImplicit -> ImplicitConversion
10530 ConvertImplicitStandard -> ImplicitStandardConversion
10531 TryImplicitIntConversion -> ImplicitIntConversion
10532 ConvertImplicitRequired -> ImplicitConversionRequired
10533 ConvertNumericExplicit -> ExplicitNumericConversion
10534 ConvertReferenceExplicit -> ExplicitReferenceConversion
10535 ConvertExplicit -> ExplicitConversion
10536 ConvertExplicitStandard -> ExplicitStandardConversion
10538 2003-05-19 Martin Baulig <martin@ximian.com>
10540 * statement.cs (TypeInfo.StructInfo): Made this type protected.
10541 (TypeInfo): Added support for structs having structs as fields.
10543 * ecore.cs (FieldExpr): Implement IVariable.
10544 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
10545 VariableInfo for the field.
10547 2003-05-18 Martin Baulig <martin@ximian.com>
10549 * expression.cs (This.DoResolve): Report a CS0027 if we're
10550 emitting a field initializer.
10552 2003-05-18 Martin Baulig <martin@ximian.com>
10554 * expression.cs (This.ResolveBase): New public function.
10555 (This.DoResolve): Check for CS0188.
10557 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
10560 * ecore.cs (MethodGroupExpr.DoResolve): Set the
10561 `instance_expression' to null if we don't have any non-static
10564 2003-05-18 Martin Baulig <martin@ximian.com>
10566 Reworked the way how local variables and parameters are handled by
10567 the flow analysis code.
10569 * statement.cs (TypeInfo, VariableMap): New public classes.
10570 (VariableInfo): New public class. This is now responsible for
10571 checking whether a variable has been assigned. It is used for
10572 parameters and local variables.
10573 (Block.EmitMeta): Take the InternalParameters as argument; compute
10574 the layout of the flow vectors here.
10575 (Block.LocalMap, Block.ParameterMap): New public properties.
10576 (FlowBranching): The .ctor doesn't get the InternalParameters
10577 anymore since Block.EmitMeta() now computes the layout of the flow
10579 (MyStructInfo): This class is now known as `StructInfo' and nested
10580 in `TypeInfo'; we don't access this directly anymore.
10582 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
10583 property and removed IsAssigned(), IsFieldAssigned(),
10584 SetAssigned() and SetFieldAssigned(); we now call them on the
10585 VariableInfo so we don't need to duplicate this code everywhere.
10587 * expression.cs (ParameterReference): Added `Block block' argument
10589 (LocalVariableReference, ParameterReference, This): The new
10590 VariableInfo class is now responsible for all the definite
10593 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
10594 IsParameterAssigned, SetParameterAssigned): Removed.
10596 2003-05-18 Martin Baulig <martin@ximian.com>
10598 * typemanager.cs (InitCoreTypes): Try calling
10599 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
10600 the 3-args-version. Corlib now also needs our `void_type'.
10601 (GetMethod): Added overloaded version which takes an optional
10602 `bool report_errors' to allow lookups of optional methods.
10604 2003-05-12 Martin Baulig <martin@ximian.com>
10606 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
10607 only used for locals and not for parameters.
10609 2003-05-12 Miguel de Icaza <miguel@ximian.com>
10611 * support.cs (InternalParameters.ParameterType): Return the
10612 ExternalType of the parameter.
10614 * parameter.cs (Parameter.ExternalType): drop the two arguments,
10617 2003-05-11 Miguel de Icaza <miguel@ximian.com>
10619 * class.cs (MethodData.Define): Do not set the `newslot' on
10620 interface members, if they are also flagged as "override".
10622 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
10623 better code for ++i and i++. This only works for static fields
10624 and local variables.
10626 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
10627 want to pull the DeclSpace out of the builder_to_declspace instead
10628 of the TypeBuilder (like in TypeContainer.FindMembers).
10630 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
10631 instead of LookupTypeContainer. Fixes the crash on .NET for
10632 looking up interface members.
10634 * const.cs: Create our own emit context during the Definition
10635 stage, so that constants are evaluated in the proper context, when
10636 a recursive definition happens.
10638 2003-05-11 Martin Baulig <martin@ximian.com>
10640 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
10641 new block for a switch section.
10642 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
10643 the adding/lookup in the switch block. Fixes #39828.
10645 2003-05-09 Miguel de Icaza <miguel@ximian.com>
10647 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
10648 functionality: I needed to convert the data after I had performed
10649 the add/sub operation into the operands type size.
10651 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
10652 pass the type for the box operation, otherwise the resulting
10653 object would have been of type object.
10655 (BoxedCast): Add constructor to specify the type to box as.
10657 2003-05-07 Miguel de Icaza <miguel@ximian.com>
10659 * iterators.cs: I was reusing the `count' variable inadvertently,
10660 take steps to not allow this to happen.
10662 2003-05-06 Miguel de Icaza <miguel@ximian.com>
10664 * attribute.cs (Attribute.Resolve): Params attributes are encoded
10665 by creating an array at the point where the params starts and
10666 putting all those arguments there, then adjusting the size of the
10669 2003-05-05 Miguel de Icaza <miguel@ximian.com>
10671 * expression.cs (New.AddressOf): Implement interface
10672 IMemoryLocation. This is used when the `new' operator is used in
10673 the context of an invocation to a method on a value type.
10675 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
10678 * namespace.cs: Also check the using aliases here.
10680 * driver.cs: Move the test for using validity after the types have
10681 been entered, so we do a single pass that also includes the using
10684 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
10685 in the regular case. CreateSiblingForFinally is doing extra
10688 * attribute.cs (GetAttributeArgumentExpression): Store the result
10689 on an out value, and use the return value to indicate failure
10690 instead of using null (which is a valid return for Constant.GetValue).
10692 * statement.cs: Perform the analysis flow for the increment
10693 portion after the statement, because this will be the real flow of
10694 execution. Fixes #42385
10696 * codegen.cs (EmitContext.EmitArgument,
10697 EmitContext.EmitStoreArgument): New helper functions when the
10698 RemapToProxy flag is set.
10700 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
10703 Add support for remapping parameters.
10705 * iterators.cs: Propagate parameter values; Store parameter
10706 values in the proxy classes.
10708 2003-05-04 Miguel de Icaza <miguel@ximian.com>
10710 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
10711 need a proxy reference; I do not know what I was thinking
10713 * cs-parser.jay (constructor_initializer): catch another error,
10714 and display nice message.
10716 (field_declaration): catch void field declaration
10717 to flag a better error.
10719 * class.cs (MemberBase.CheckBase): Report an error instead of a
10720 warning if a new protected member is declared in a struct.
10721 (Field.Define): catch the error of readonly/volatile.
10723 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
10725 (FieldExpr.AddressOf): ditto. Catch error where the address of a
10726 volatile variable is taken
10728 2003-05-02 Miguel de Icaza <miguel@ximian.com>
10730 * statement.cs (Fixed.Resolve): Report an error if we are not in
10733 2003-05-01 Miguel de Icaza <miguel@ximian.com>
10735 * typemanager.cs: reuse the code that handles type clashes for
10736 delegates and enumerations.
10738 * class.cs (Report28): Always report.
10740 * expression.cs (EncodeAsAttribute): Allow nulls here.
10742 2003-04-28 Miguel de Icaza <miguel@ximian.com>
10744 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
10745 the functionality for testing whether an expression is valid for
10746 an attribute here. Also handle the case of arrays of elements
10749 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
10750 encoding a linear array into an array of objects that are suitable
10751 to be passed to an CustomAttributeBuilder.
10753 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
10755 * ecore.cs: (FieldExpr): Handle field remapping here.
10757 * iteratators.cs: Pass the instance variable (if the method is an
10758 instance method) to the constructors, so we can access the field
10759 variables on the class.
10761 TODO: Test this with structs. I think the THIS variable on
10762 structs might have to be a pointer, and not a refenrece
10764 2003-04-27 Miguel de Icaza <miguel@ximian.com>
10766 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
10767 local variables to fields in a proxy class.
10769 * iterators.cs (PopulateProxy): Rename our internal fields to
10771 Create a <THIS> field if we are an instance method, so we can
10772 reference our parent container variables.
10773 (MapVariable): Called back from the EmitContext code to enter a
10774 new variable to field mapping into the proxy class (we just create
10778 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
10779 for using the remapped locals to fields.
10781 I placed the code here, because that gives the same semantics to
10782 local variables, and only changes the Emit code.
10784 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
10785 statements inside iterators.
10786 (VariableInfo): Add a FieldBuilder for the cases when we are
10787 remapping local variables to fields in a proxy class
10789 * ecore.cs (SimpleNameResolve): Avoid testing two times for
10790 current_block != null.
10792 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
10793 not cope with strings, as it has been moved to the
10794 TableSwitchEmit. Fixed bug in switch generation.
10796 * expression.cs (New.DoResolve): Provide more context for the user
10797 when reporting an error.
10799 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
10802 * expression.cs (MemberAccess.DoResolve): When we get a type back,
10803 check the permissions for it. Note than in a type-resolution
10804 context the check was already present in DeclSpace.ResolveType,
10805 but was missing from the MemberAccess.
10807 (ArrayCreation.CheckIndices): warn if the user has
10808 more nested levels of expressions, but there are no more
10809 dimensions specified. Avoids crash on bug 41906.
10811 2003-04-26 Miguel de Icaza <miguel@ximian.com>
10813 * statement.cs (Block): replace Implicit bool, for a generic
10815 New flag: `Unchecked'. This is used during the EmitMeta phase
10816 (which is out-of-line with the regular Resolve/Emit process for a
10817 statement, as this is done ahead of time, but still gets a chance
10818 to call constant resolve).
10820 (Block.Flags): new enum for adding a new flag.
10822 (Block.EmitMeta): track the state of unchecked.
10824 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
10825 to enable constant resolution to work there as well.
10827 2003-04-22 Miguel de Icaza <miguel@ximian.com>
10829 * typemanager.cs (ienumerable_type): Also look up
10830 System.Collections.IEnumerable.
10832 2003-04-21 Miguel de Icaza <miguel@ximian.com>
10834 TODO: Test more than one conditional per method.
10836 * class.cs (Indexer.Define): Report the location where the user is
10837 referencing the unsupported feature.
10839 (MethodData): Overload the use of `conditionals' to
10840 minimize the creation of needless ArrayLists. This saves roughly
10841 212kb on my machine.
10843 (Method): Implement the new IIteratorContainer interface.
10844 (Method.SetYields): Implement the method by setting the ModFlags
10845 to contain METHOD_YIELDS.
10847 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
10848 which just got set to null.
10850 * iterators.cs: New file.
10852 (Yield, YieldBreak): New statements.
10854 * statement.cs (Return.Resolve): Flag an error if we are used in
10855 an iterator method.
10857 * codegen.cs (InIterator): New flag set if the code is being
10858 compiled in an iterator method.
10860 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
10861 internal modifier, and we just use it to avoid adding extra
10862 fields, as this is seldom used.
10864 * cs-parser.jay: Add yield_statement (yield and yield break).
10866 * driver.cs: New flag -v2 to turn on version 2 features.
10868 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
10869 hashtable when v2 is enabled.
10871 2003-04-20 Miguel de Icaza <miguel@ximian.com>
10873 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
10874 there is already a namespace defined with this name.
10876 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
10877 people upgraded their corlibs.
10879 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
10880 always use fully qualified types, no need to use the compiler
10883 (TypeManager.IsNamespace): Use binarysearch.
10885 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
10886 AddDelegate): I did not quite use the new IsValid API properly: I
10887 have to pass the short-name and the fullname. I was passing only
10888 the basename instead of the fullname sometimes.
10890 (TypeContainer.DefineType): call NamespaceClash.
10892 * interface.cs (Interface.DefineType): use NamespaceClash before
10895 * delegate.cs (Delegate.DefineType): use NamespaceClash before
10898 * enum.cs: (Enum.DefineType): use NamespaceClash before
10901 * typemanager.cs (: 3-line patch that gives us some tasty 11%
10902 speed increase. First, use the negative_hits cache when we get a
10903 negative. Second, add the type with its full original name
10904 instead of the new . and + encoded name (reflection uses + to
10905 separate type from a nested type). Use LookupTypeReflection
10906 directly which bypasses the type->name hashtable (that we already
10907 know does not contain the type.
10909 * decl.cs (DeclSpace.ResolveTypeExpr): track the
10910 location/container type.
10912 * driver.cs: When passing utf8, use directly the UTF8Encoding.
10914 2003-04-19 Miguel de Icaza <miguel@ximian.com>
10916 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
10918 * delegate.cs (NewDelegate.Resolve): Test whether an instance
10919 method is being referenced in the method group from a static
10920 context, and report error 120 if so.
10922 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
10925 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
10926 is created, we create the A namespace).
10928 * cs-parser.jay: A namespace also introduces a DeclarationFound.
10931 2003-04-18 Miguel de Icaza <miguel@ximian.com>
10933 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
10934 invocation to ModuleBuilder.GetType with the same values will
10935 return a new type instance, so we need to cache its return
10938 * expression.cs (Binary.ResolveOperator): Only allow the compare
10939 operators on enums if they are of the same type.
10941 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
10942 types of ValueType on their own case. Before we were giving them
10943 the same treatment as objects.
10945 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10946 fullname. Short name is used to compare against container name.
10947 Fullname is used to check against defined namespace names.
10949 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10950 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10952 (Method.CheckBase): Call parent.
10953 (MemberBase.CheckBase): Check for protected members on sealed
10955 (PropertyBase.CheckBase): Call parent.
10956 (Field.Define): Call parent.
10958 * report.cs: Negative error codes are now mapped to 8000 - code,
10959 so that the display is render more nicely.
10961 * typemanager.cs: Do not use try/catch, instead report a regular
10964 (GetPointerType, GetReferenceType): These methods provide
10965 mechanisms to obtain the T* and T& from a T. We had the code
10966 previously scattered around the code base, and it also used
10967 TypeManager.LookupType that would go through plenty of caches.
10968 This one goes directly to the type source.
10970 In some places we did the Type.GetType followed by
10971 ModuleBuilder.GetType, but not in others, so this unifies the
10972 processing as well.
10974 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10975 statements now that we have namespace information.
10977 * typemanager.cs (IsNamespace): New method, returns whether the
10978 string presented is a namespace or not.
10980 (ComputeNamespaces): New public entry point, computes the list of
10981 available namespaces, using the GetNamespaces API call in Mono, or
10982 the slower version in MS.NET.
10984 Now before we start the semantic analysis phase, we have a
10985 complete list of namespaces including everything that the user has
10988 Deleted old code to cache namespaces in .nsc files.
10990 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10992 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10993 class/struct location definition Location for the implicit
10994 constructor location.
10996 (Operator.Define): Use the location of the operator for the
10997 implicit Method definition.
10999 (Constructor.Emit): use the constructor location for the implicit
11000 base initializer constructor.
11002 * ecore.cs: Remove ITypeExpression. This interface is now gone,
11003 and the Expression class now contains two new methods:
11005 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
11006 isolate type lookup from the rest of the resolution process.
11008 Since we use Expressions to hold type definitions due to the way
11009 we parse the input we have historically overloaded Resolve to
11010 perform the Type lookups if a special flag is passed. Now this is
11011 eliminated and two methods take their place.
11013 The differences in the two methods between xStep and xTerminal is
11014 that xStep is involved in our current lookup system that uses
11015 SimpleNames to compose a name, while xTerminal is used just to
11016 catch the case where the simplename lookup failed.
11018 2003-04-16 Miguel de Icaza <miguel@ximian.com>
11020 * expression.cs (ResolveMemberAccess): Remove redundant code.
11021 TypeExpr expressions are always born fully resolved.
11023 * interface.cs (PopulateMethod): Do not lookup the types twice.
11024 We were doing it once during SemanticAnalysis and once during
11027 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
11028 in local variable type definitions, were being returned as a
11029 SimpleName (we decomposed everything into a string), that is
11030 because primary_expression was being used instead of a type in the
11031 grammar (reduce/reduce conflicts).
11033 The part that was wrong is that we converted the expression into a
11034 string (an oversimplification in one hand, compounded with primary
11035 expressions doing string concatenation).
11041 Would return "A.B.C[]" as a SimpleName. This stopped things like
11042 using clauses from working on this particular context. And a type
11043 was being matched directly against "A.B.C[]".
11045 We now use the correct approach, and allow for ComposedCast to be
11046 part of the unary expression. So the "A.B.C []" become a composed
11047 cast of "A.B.C" (as a nested group of MemberAccess with a
11048 SimpleName at the end) plus the rank composition "[]".
11052 2003-04-10 Miguel de Icaza <miguel@ximian.com>
11054 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
11055 for the access level checking.
11057 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
11058 `TypeContainer container', because I kept getting confused when I
11059 was debugging this code.
11061 * expression.cs (Indexers): Instead of tracking getters/setters,
11062 we now track them in parallel. We create one arraylist less, but
11063 most importantly it is possible now for the LValue code to find a
11064 matching get for a set.
11066 (IndexerAccess.DoResolveLValue): Update the code.
11067 GetIndexersForType has been modified already to extract all the
11068 indexers from a type. The code assumed it did not.
11070 Also make the code set the correct return type for the indexer.
11071 This was fixed a long time ago for properties, but was missing for
11072 indexers. It used to be void_type.
11074 (Binary.Emit): Test first for doubles instead of
11075 floats, as they are more common.
11077 (Binary.EmitBranchable): Use the .un version of the branch opcodes
11078 when dealing with floats and the <=, >= operators. This fixes bug
11081 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
11082 to load the array value by emitting a load on the foreach variable
11083 type. This was incorrect.
11085 We now emit the code to load an element using the the array
11086 variable type, and then we emit the conversion operator.
11090 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
11092 * attribute.cs: Avoid allocation of ArrayLists in the common case.
11094 2003-04-09 Miguel de Icaza <miguel@ximian.com>
11096 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
11097 test for protection before we test for signatures.
11099 (MethodSignature.ToString): implement.
11101 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
11102 to the case where we reduced into a LongConstant.
11104 * decl.cs (CheckAccessLevel): If the type is an array, we can not
11105 depend on whether the information is acurrate, because the
11106 Microsoft runtime will always claim that the array type is public,
11107 regardless of the real state.
11109 If the type is a pointer, another problem happens: the type is
11110 reported as non-public in Microsoft.
11112 In both cases we have to call CheckAccessLevel recursively with
11113 the underlying type as the argument to be tested.
11115 2003-04-08 Miguel de Icaza <miguel@ximian.com>
11117 * assign.cs (Assign.Emit): If we are dealing with a compound
11118 assignment expression, we should use the code path that stores the
11119 intermediate result in a temporary value. This fixes #40903.
11121 *expression.cs (Indirection.ToString): Provide ToString method for
11124 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
11126 * class.cs: Null out fields holding references to Block objects so
11127 they can be garbage collected.
11129 * expression.cs (OverloadResolve): Remove unused local.
11131 2003-04-07 Martin Baulig <martin@ximian.com>
11133 * codegen.cs (EmitContext.CurrentFile): New public field.
11134 (EmitContext.Mark): Use the CurrentFile to check whether the
11135 location is in the correct file.
11136 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
11138 2003-04-07 Martin Baulig <martin@ximian.com>
11140 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
11142 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
11143 location. [FIXME: The location argument which gets passed to this
11144 method is sometimes wrong!]
11146 2003-04-07 Nick Drochak <ndrochak@gol.com>
11148 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
11150 2003-04-07 Miguel de Icaza <miguel@ximian.com>
11152 * expression.cs (Indirection.EmitAssign): We were using the
11153 temporary, but returning immediately instead of continuing the
11156 2003-04-06 Martin Baulig <martin@ximian.com>
11158 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
11159 if it's a nested child, but also deriving from the outer class.
11162 * typemanager.cs (IsNestedChildOf): Make this work if it's a
11163 nested child, but also deriving from the outer class. See
11165 (FilterWithClosure): We may access private members of the outer
11166 class if we're a nested child and deriving from the outer class.
11167 (RealMemberLookup): Only set `closure_private_ok' if the
11168 `original_bf' contained BindingFlags.NonPublic.
11170 2003-04-05 Martin Baulig <martin@ximian.com>
11172 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
11173 probe if its a type parameter, and if so, flag an error.
11175 * decl.cs: Move here the SetParameterInfo code from class.cs.
11176 Handle IsGeneric here.
11178 Handle a variety of errors in the parameter info definition.
11180 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
11181 type parameters here.
11183 * cs-parser.jay (class_declaration): report errors for parameters
11186 2003-01-21 Miguel de Icaza <miguel@ximian.com>
11188 * generic.cs: New file, contains support code for generics.
11190 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
11191 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
11193 Update parser for the above removals.
11195 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
11196 now taken care of in the parser.
11198 2003-04-02 Miguel de Icaza <miguel@ximian.com>
11200 * class.cs (Event.Define): Do not allow abstract events to have
11203 2003-04-01 Miguel de Icaza <miguel@ximian.com>
11205 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
11206 block in event declarations.
11208 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
11209 value type, get its address.
11211 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
11212 leaving a class on the stack instead of a boolean value (int
11213 0/1). Change the code so we compare against null, and then the
11214 result against zero.
11216 * class.cs (TypeContainer.GetClassBases): We were checking for the
11217 parent class being sealed too late.
11219 * expression.cs (Binary.Emit): For <= and >= when dealing with
11220 floating point values, use cgt.un and clt.un instead of cgt and
11223 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
11225 * statement.cs: Apply the same optimization as MS: skip the
11226 GetEnumerator returning an IEnumerator, and use the one returning a
11227 CharEnumerator instead. This allows us to avoid the try-finally block
11230 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
11232 * cs-parser.jay: Attributes cannot be applied to
11233 namespaces. Fixes #40473
11235 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11238 (Add*): check if the name is valid using the full name for constants,
11239 fields, properties and events.
11241 2003-03-28 Miguel de Icaza <miguel@ximian.com>
11243 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
11244 char constants to be part of the enumeration.
11246 * expression.cs (Conditional.DoResolve): Add support for operator
11247 true. Implements the missing functionality from 14.12
11249 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
11250 operator true/false as required by the spec.
11252 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
11253 implicit conversion to boolean.
11255 * statement.cs (Statement.ResolveBoolean): A boolean expression is
11256 also one where the type implements `operator true'.
11258 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
11259 get an expression that will invoke operator true based on an
11262 (GetConversionOperators): Removed the hack that called op_True
11265 (Expression.ResolveBoolean): Move this from Statement.
11267 2003-03-17 Miguel de Icaza <miguel@ximian.com>
11269 * ecore.cs (FieldExpr): do not allow initialization of initonly
11270 fields on derived classes
11272 2003-03-13 Martin Baulig <martin@ximian.com>
11274 * statement.cs (Block.Emit): Call ig.BeginScope() and
11275 ig.EndScope() when compiling with debugging info; call
11276 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
11278 2003-03-08 Miguel de Icaza <miguel@ximian.com>
11280 * expression.cs (Indexers): Do not construct immediately, allow
11281 for new members to be appended as we go. Fixes 38143
11283 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11285 * expression.cs: save/restore context when resolving an unchecked
11288 2003-03-05 Miguel de Icaza <miguel@ximian.com>
11290 * cfold.cs: Catch division by zero in modulus operator during
11293 2003-03-03 Miguel de Icaza <miguel@ximian.com>
11295 * interface.cs (Interface.DefineMembers): Avoid defining members
11298 2003-02-27 Miguel de Icaza <miguel@ximian.com>
11300 * driver.cs: handle the +/- options for -noconfig
11302 * statement.cs (Unckeched.Resolve): Also track the state of
11303 unchecked in the Resolve phase.
11305 2003-02-27 Martin Baulig <martin@ximian.com>
11307 * ecore.cs (Expression.MemberLookup): Don't create a
11308 MethodGroupExpr for something which is not a method. Fixes #38291.
11310 2003-02-25 Miguel de Icaza <miguel@ximian.com>
11312 * class.cs (MemberBase.CheckParameters): Also check that the type
11313 is unmanaged if it is a pointer.
11315 * expression.cs (SizeOf.Resolve): Add location information.
11317 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
11318 a managed type is declared.
11320 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
11321 parameter modifiers as well. Fixes bug 38606
11323 * class.cs: Very sad. Am backing out the speed up changes
11324 introduced by the ArrayList -> Array in the TypeContainer, as they
11325 were not actually that much faster, and introduced a bug (no error
11326 reports on duplicated methods).
11328 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
11329 source first, this will guarantee that we have a valid expression
11330 before calling in lower levels functions that will require a
11331 resolved object. Then use this original_source in the
11332 target.ResolveLValue instead of the original source that was
11335 Another change. Use target.Resolve instead of LValueResolve.
11336 Although we are resolving for LValues, we will let the Assign code
11337 take care of that (it will be called again from Resolve). This
11338 basically allows code like this:
11340 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
11341 class Y { void A (X x) { x [0] += o; }
11343 The problem was that the indexer was trying to resolve for
11344 set_Item (idx, object o) and never finding one. The real set_Item
11345 was set_Item (idx, X). By delaying the process we get the right
11350 2003-02-23 Martin Baulig <martin@ximian.com>
11352 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
11353 while calling DoEmit ().
11355 * codegen.cs (EmitContext.Mark): Don't mark locations in other
11356 source files; if you use the #line directive inside a method, the
11357 compiler stops emitting line numbers for the debugger until it
11358 reaches the end of the method or another #line directive which
11359 restores the original file.
11361 2003-02-23 Martin Baulig <martin@ximian.com>
11363 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
11365 2003-02-23 Martin Baulig <martin@ximian.com>
11367 * statement.cs (Block.AddChildVariableNames): We need to call this
11368 recursively, not just for our immediate children.
11370 2003-02-23 Martin Baulig <martin@ximian.com>
11372 * class.cs (Event.Define): Always make the field private, like csc does.
11374 * typemanager.cs (TypeManager.RealMemberLookup): Make events
11375 actually work, fixes bug #37521.
11377 2003-02-23 Miguel de Icaza <miguel@ximian.com>
11379 * delegate.cs: When creating the various temporary "Parameters"
11380 classes, make sure that we call the ComputeAndDefineParameterTypes
11381 on those new parameters (just like we do with the formal ones), to
11382 allow them to be resolved in the context of the DeclSpace.
11384 This fixes the bug that Dick observed in Bugzilla #38530.
11386 2003-02-22 Miguel de Icaza <miguel@ximian.com>
11388 * expression.cs (ResolveMemberAccess): When resolving a constant,
11389 do not attempt to pull a constant if the value was not able to
11390 generate a valid constant.
11392 * const.cs (LookupConstantValue): Do not report more errors than required.
11394 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11396 * expression.cs: fixes bug #38328.
11398 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11400 * class.cs: Changed all the various members that can be part of a
11401 class from being an ArrayList to be an Array of the right type.
11402 During the DefineType type_list, interface_list, delegate_list and
11403 enum_list are turned into types, interfaces, delegates and enums
11406 And during the member population, indexer_list, event_list,
11407 constant_list, field_list, instance_constructor_list, method_list,
11408 operator_list and property_list are turned into their real arrays.
11410 Although we could probably perform this operation earlier, for
11411 good error reporting we need to keep the lists and remove the
11412 lists for longer than required.
11414 This optimization was triggered by Paolo profiling the compiler
11415 speed on the output of `gen-sample-program.pl' perl script.
11417 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
11418 not crash in methods like MemberLookupFailed that use this field.
11420 This problem arises when the compiler fails to resolve a type
11421 during interface type definition for example.
11423 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11425 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
11426 inherit from System.Object, so we have to stop at null, not only
11427 when reaching System.Object.
11429 2003-02-17 Miguel de Icaza <miguel@ximian.com>
11431 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
11432 DeclaredOnly because the parent indexer might have had a different
11433 name, but did not loop until the top of the hierarchy was reached.
11435 The problem this one fixes is 35492: when a class implemented an
11436 indexer from an interface, we were getting the interface method
11437 (which was abstract) and we were flagging an error (can not invoke
11440 This also keeps bug 33089 functioning, and test-148 functioning.
11442 * typemanager.cs (IsSpecialMethod): The correct way of figuring
11443 out if a method is special is to see if it is declared in a
11444 property or event, or whether it is one of the predefined operator
11445 names. This should fix correctly #36804.
11447 2003-02-15 Miguel de Icaza <miguel@ximian.com>
11449 The goal here is to remove the dependency on EmptyCast.Peel ().
11450 Killing it completely.
11452 The problem is that currently in a number of places where
11453 constants are expected, we have to "probe" for an EmptyCast, and
11454 Peel, which is not the correct thing to do, as this will be
11455 repetitive and will likely lead to errors.
11457 The idea is to remove any EmptyCasts that are used in casts that
11458 can be reduced to constants, so we only have to cope with
11461 This bug hunt was triggered by Bug 37363 and the desire to remove
11462 the duplicate pattern where we were "peeling" emptycasts to check
11463 whether they were constants. Now constants will always be
11466 * ecore.cs: Use an enumconstant here instead of wrapping with
11469 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
11470 throwing me off. By handling this we can get rid of a few hacks.
11472 * statement.cs (Switch): Removed Peel() code.
11474 2003-02-14 Miguel de Icaza <miguel@ximian.com>
11476 * class.cs: Location information for error 508
11478 * expression.cs (New.DoResolve): Add a guard against double
11479 resolution of an expression.
11481 The New DoResolve might be called twice when initializing field
11482 expressions (see EmitFieldInitializers, the call to
11483 GetInitializerExpression will perform a resolve on the expression,
11484 and later the assign will trigger another resolution
11486 This leads to bugs (#37014)
11488 * delegate.cs: The signature for EndInvoke should contain any ref
11489 or out parameters as well. We were not doing this in the past.
11491 * class.cs (Field.Define): Do not overwrite the type definition
11492 inside the `volatile' group. Turns out that volatile enumerations
11493 were changing the type here to perform a validity test, which
11496 2003-02-12 Miguel de Icaza <miguel@ximian.com>
11498 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
11499 and structs, we do not want to load the instance variable
11501 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
11502 enum_type has to be handled like an object reference (implicit
11503 conversions exists from this to object), but the regular IsClass
11504 and IsValueType tests will never return true for this one.
11506 Also we use TypeManager.IsValueType instead of type.IsValueType,
11507 just for consistency with the rest of the code (this is only
11508 needed if we ever use the construct exposed by test-180.cs inside
11509 corlib, which we dont today).
11511 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
11513 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
11516 2003-02-09 Martin Baulig <martin@ximian.com>
11518 * namespace.cs (Namespace..ctor): Added SourceFile argument.
11519 (Namespace.DefineNamespaces): New static public method; this is
11520 called when we're compiling with debugging to add all namespaces
11521 to the symbol file.
11523 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
11524 pass it to the Namespace's .ctor.
11526 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
11527 and MethodBase arguments; pass the namespace ID to the symwriter;
11528 pass the MethodBase instead of the token to the symwriter.
11529 (SymbolWriter.DefineNamespace): New method to add a namespace to
11532 2003-02-09 Martin Baulig <martin@ximian.com>
11534 * symbolwriter.cs: New file. This is a wrapper around
11535 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
11536 methods here in near future.
11538 2003-02-09 Martin Baulig <martin@ximian.com>
11540 * codegen.cs (EmitContext.Mark): Just pass the arguments to
11541 ILGenerator.MarkSequencePoint() which are actually used by the
11544 2003-02-09 Martin Baulig <martin@ximian.com>
11546 * location.cs (SourceFile): New public sealed class. This
11547 contains the name and an index which is used in the location's token.
11548 (Location): Reserve an appropriate number of bits in the token for
11549 the source file instead of walking over that list, this gives us a
11550 really huge performance improvement when compiling with debugging.
11552 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
11553 `SourceFile' argument instead of a string.
11554 (Driver.ProcessFile): Add all the files via Location.AddFile(),
11555 but don't parse/tokenize here, we need to generate the list of all
11556 source files before we do that.
11557 (Driver.ProcessFiles): New static function. Parses/tokenizes all
11560 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
11561 instead of a string.
11563 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
11566 2003-02-09 Martin Baulig <martin@ximian.com>
11568 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
11569 filename on `#line default'.
11571 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
11573 * statement.cs: don't clear the pinned var when the fixed statement
11574 returns from the method (fixes bug#37752).
11576 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
11578 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
11581 2003-02-07 Martin Baulig <martin@ximian.com>
11583 * driver.cs: Removed the `--debug-args' command line argument.
11585 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
11586 automatically by the AsssemblyBuilder.
11587 (CodeGen.InitializeSymbolWriter): We don't need to call any
11588 initialization function on the symbol writer anymore. This method
11589 doesn't take any arguments.
11591 2003-02-03 Miguel de Icaza <miguel@ximian.com>
11593 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
11594 from referenced assemblies as well.
11596 2003-02-02 Martin Baulig <martin@ximian.com>
11598 * class.cs (MethodData.Emit): Generate debugging info for external methods.
11600 2003-02-02 Martin Baulig <martin@ximian.com>
11602 * class.cs (Constructor.Emit): Open the symbol writer before
11603 emitting the constructor initializer.
11604 (ConstructorInitializer.Emit): Call ec.Mark() to allow
11605 single-stepping through constructor initializers.
11607 2003-01-30 Miguel de Icaza <miguel@ximian.com>
11609 * class.cs: Handle error 549: do not allow virtual methods in
11612 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
11614 * decl.cs: Check access levels when resolving types
11616 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
11618 * statement.cs: Add parameters and locals set in catch blocks that might
11619 return to set vector
11621 2003-01-29 Miguel de Icaza <miguel@ximian.com>
11623 * class.cs (Operator): Set the SpecialName flags for operators.
11625 * expression.cs (Invocation.DoResolve): Only block calls to
11626 accessors and operators on SpecialName methods.
11628 (Cast.TryReduce): Handle conversions from char constants.
11631 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
11633 * statement.cs: small memory and time optimization in FlowBranching.
11635 2003-01-28 Pedro Mart <yoros@wanadoo.es>
11637 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
11638 problem that the last fix but in the other sid (Set).
11640 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
11641 access when there is no indexer in the hierarchy.
11643 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
11645 * class.cs: Combine some if statements.
11647 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11649 * driver.cs: fixed bug #37187.
11651 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
11653 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
11654 any indexer, it's needed to build a list with all the indexers in the
11655 hierarchy (AllGetters), else we have problems. Fixes #35653.
11657 2003-01-23 Miguel de Icaza <miguel@ximian.com>
11659 * class.cs (MethodData.Define): It is wrong for an interface
11660 implementation to be static in both cases: explicit and implicit.
11661 We were only handling this in one case.
11663 Improve the if situation there to not have negations.
11665 * class.cs (Field.Define): Turns out that we do not need to check
11666 the unsafe bit on field definition, only on usage. Remove the test.
11668 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11670 * driver.cs: use assembly.Location instead of Codebase (the latest
11671 patch made mcs fail when using MS assemblies).
11673 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
11675 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
11676 get the path to *corlib.dll.
11678 2003-01-21 Nick Drochak <ndrochak@gol.com>
11682 * typemanager.cs: Remove compiler warnings
11684 2003-01-20 Duncan Mak <duncan@ximian.com>
11686 * AssemblyInfo.cs: Bump the version number to 0.19.
11688 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11690 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
11692 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
11694 * class.cs (Constructor::Emit): Emit debugging info for constructors.
11696 2003-01-17 Miguel de Icaza <miguel@ximian.com>
11698 * cs-parser.jay: Small fix: we were not comparing the constructor
11699 name correctly. Thanks to Zoltan for the initial pointer.
11701 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
11703 * cs-tokenizer.cs: Set file name when specified with #line
11705 2003-01-15 Miguel de Icaza <miguel@ximian.com>
11707 * cs-parser.jay: Only perform the constructor checks here if we
11708 are named like the class; This will help provider a better
11709 error. The constructor path is taken when a type definition is
11710 not found, but most likely the user forgot to add the type, so
11711 report that rather than the constructor error.
11713 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
11715 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
11718 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11720 * cs-parser.jay: Add cleanup call.
11722 2003-01-13 Duncan Mak <duncan@ximian.com>
11724 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
11725 consistent with other methods.
11727 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11729 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
11731 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
11733 * attribute.cs: only set GuidAttr to true when we have a
11736 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11740 * typemanager.cs: fixes to allow mcs compile corlib with the new
11741 Type.IsSubclassOf fix.
11743 2003-01-08 Miguel de Icaza <miguel@ximian.com>
11745 * expression.cs (LocalVariableReference.DoResolve): Classify a
11746 constant as a value, not as a variable. Also, set the type for
11749 * cs-parser.jay (fixed_statement): take a type instead of a
11750 pointer_type, so we can produce a better error message later.
11752 * statement.cs (Fixed.Resolve): Flag types that are not pointers
11755 (For.DoEmit): Make inifinite loops have a
11756 non-conditional branch back.
11758 (Fixed.DoEmit): First populate the pinned variables, then emit the
11759 statement, then clear the variables. Before I was emitting the
11760 code once for each fixed piece.
11763 2003-01-08 Martin Baulig <martin@ximian.com>
11765 * statement.cs (FlowBranching.MergeChild): A break in a
11766 SWITCH_SECTION does not leave a loop. Fixes #36155.
11768 2003-01-08 Martin Baulig <martin@ximian.com>
11770 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
11771 lives in the same number space than `param_map'. Fixes #36154.
11773 2003-01-07 Miguel de Icaza <miguel@ximian.com>
11775 * cs-parser.jay (constructor_declaration): Set the
11776 Constructor.ModFlags before probing for it. This makes the
11777 compiler report 514, 515 and 132 (the code was there, but got
11780 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
11781 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
11782 (GotoCase.Resolve): Set `Returns' to ALWAYS.
11784 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
11786 * enum.cs: create the enum static fields using the enum type.
11788 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
11790 * class.cs: don't try to create the ParamBuilder for the return
11791 type if it's not needed (and handle it breaking for the ms runtime
11794 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
11796 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
11798 2002-12-29 Miguel de Icaza <miguel@ximian.com>
11800 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
11801 the command. This showed up while compiling the JANET source
11802 code, which used \r as its only newline separator.
11804 2002-12-28 Miguel de Icaza <miguel@ximian.com>
11806 * class.cs (Method.Define): If we are an operator (because it
11807 reuses our code), then set the SpecialName and HideBySig. #36128
11809 2002-12-22 Miguel de Icaza <miguel@ximian.com>
11811 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
11812 exception, report error 120 `object reference required'.
11814 * driver.cs: Add --pause option, used during to measure the size
11815 of the process as it goes with --timestamp.
11817 * expression.cs (Invocation.DoResolve): Do not allow methods with
11818 SpecialName to be invoked.
11820 2002-12-21 Miguel de Icaza <miguel@ximian.com>
11822 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
11823 number before adding it.
11825 2002-12-21 Ravi Pratap <ravi@ximian.com>
11827 * ecore.cs (StandardImplicitConversion): When in an unsafe
11828 context, we allow conversion between void * to any other pointer
11829 type. This fixes bug #35973.
11831 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
11833 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
11834 is not thrown when extensionless outputs are used
11836 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11838 * rootcontext.cs: fixed compilation of corlib.
11840 2002-12-19 Miguel de Icaza <miguel@ximian.com>
11842 * attribute.cs (Attributes.Contains): Add new method.
11844 * class.cs (MethodCore.LabelParameters): if the parameter is an
11845 `out' parameter, check that no attribute `[In]' has been passed.
11847 * enum.cs: Handle the `value__' name in an enumeration.
11849 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
11851 * decl.cs: Added special case to allow overrides on "protected
11854 2002-12-18 Ravi Pratap <ravi@ximian.com>
11856 * attribute.cs (Attributes.AddAttributeSection): Rename to this
11857 since it makes much more sense.
11859 (Attributes.ctor): Don't require a Location parameter.
11861 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
11863 * attribute.cs (ApplyAttributes): Remove extra Location parameters
11864 since we already have that information per attribute.
11866 * everywhere : make appropriate changes.
11868 * class.cs (LabelParameters): Write the code which actually
11869 applies attributes to the return type. We can't do this on the MS
11870 .NET runtime so we flag a warning in the case an exception is
11873 2002-12-18 Miguel de Icaza <miguel@ximian.com>
11875 * const.cs: Handle implicit null conversions here too.
11877 2002-12-17 Ravi Pratap <ravi@ximian.com>
11879 * class.cs (MethodCore.LabelParameters): Remove the extra
11880 Type [] parameter since it is completely unnecessary. Instead
11881 pass in the method's attributes so that we can extract
11882 the "return" attribute.
11884 2002-12-17 Miguel de Icaza <miguel@ximian.com>
11886 * cs-parser.jay (parse): Use Report.Error to flag errors instead
11887 of ignoring it and letting the compile continue.
11889 * typemanager.cs (ChangeType): use an extra argument to return an
11890 error condition instead of throwing an exception.
11892 2002-12-15 Miguel de Icaza <miguel@ximian.com>
11894 * expression.cs (Unary.TryReduce): mimic the code for the regular
11895 code path. Perform an implicit cast in the cases where we can
11896 implicitly convert to one of the integral types, and then reduce
11897 based on that constant. This fixes bug #35483.
11899 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11901 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
11903 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11905 * namespace.cs: fixed bug #35489.
11907 2002-12-12 Miguel de Icaza <miguel@ximian.com>
11909 * class.cs: Remove some dead code.
11911 * cs-parser.jay: Estimate the number of methods needed
11912 (RootContext.MethodCount);
11914 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
11915 numbers instead of StringBuilders.
11917 * support.cs (PtrHashtable): Add constructor with initial size;
11918 We can now reduce reallocations of the method table.
11920 2002-12-10 Ravi Pratap <ravi@ximian.com>
11922 * attribute.cs (ApplyAttributes): Keep track of the emitted
11923 attributes on a per-target basis. This fixes bug #35413.
11925 2002-12-10 Miguel de Icaza <miguel@ximian.com>
11927 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
11928 default to the Windows 1252 encoding.
11930 (UnixParseOption): Support version, thanks to Alp for the missing
11933 * AssemblyInfo.cs: Add nice assembly information.
11935 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
11938 * cs-parser.jay: Allow a trailing comma before the close bracked
11939 in the attribute_section production.
11941 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
11942 address of the instance was being taken, I will take this out,
11943 because we take the address of the object immediately here.
11945 2002-12-09 Ravi Pratap <ravi@ximian.com>
11947 * typemanager.cs (AreMultipleAllowed): Take care of the most
11948 obvious case where attribute type is not in the current assembly -
11951 2002-12-08 Miguel de Icaza <miguel@ximian.com>
11953 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
11954 definitions, instead of doing that afterwards.
11956 Also we use a nice little hack, depending on the constructor, we
11957 know if we are a "composed" name or a simple name. Hence, we
11958 avoid the IndexOf test, and we avoid
11960 * codegen.cs: Add code to assist in a bug reporter to track down
11961 the source of a compiler crash.
11963 2002-12-07 Ravi Pratap <ravi@ximian.com>
11965 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
11966 types have been emitted for a given element and flag an error
11967 if something which does not have AllowMultiple set is used more
11970 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11971 attribute types and their corresponding AllowMultiple properties
11973 (AreMultipleAllowed): Check the property for a given type.
11975 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11976 property in the case we have a TypeContainer.
11978 (Attributes.AddAttribute): Detect duplicates and just skip on
11979 adding them. This trivial fix catches a pretty gross error in our
11980 attribute emission - global attributes were being emitted twice!
11982 Bugzilla bug #33187 is now fixed.
11984 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11986 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11987 instead of pp_and).
11989 * expression.cs (Binary.ResolveOperator): I can only use the
11990 Concat (string, string, string) and Concat (string, string,
11991 string, string) if the child is actually a concatenation of
11994 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11996 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11997 context where we need a 2-character lookahead.
11999 * pending.cs (PendingImplementation): Rework so we can keep track
12000 of interface types all the time, and flag those which were
12001 implemented by parents as optional.
12003 2002-12-03 Miguel de Icaza <miguel@ximian.com>
12005 * expression.cs (Binary.ResolveOperator): Use
12006 String.Concat(string,string,string) or
12007 String.Concat(string,string,string,string) when possible.
12009 * typemanager: More helper methods.
12012 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
12014 * pending.cs: remove the bogus return from GetMissingInterfaces()
12015 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
12017 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12019 * namespace.cs: avoid duplicated 'using xxx' being added to
12020 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
12021 when we get more than one 'using' statement for the same namespace.
12022 Report a CS0105 warning for it.
12024 2002-11-30 Miguel de Icaza <miguel@ximian.com>
12026 * cs-tokenizer.cs (consume_identifier): use read directly, instead
12027 of calling getChar/putback, uses internal knowledge of it.
12029 (xtoken): Reorder tokenizer so most common patterns are checked
12030 first. This reduces the compilation time in another 5% (from 8.11s
12031 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
12033 The parsing time is 22% of the compilation in mcs, and from that
12034 64% is spent on the tokenization process.
12036 I tried using a binary search for keywords, but this is slower
12037 than the hashtable. Another option would be to do a couple of
12040 * Not use a StringBuilder, instead use an array of chars,
12041 with a set value. Notice that this way we could catch
12042 the 645 error without having to do it *afterwards*.
12044 * We could write a hand-parser to avoid the hashtable
12045 compares altogether.
12047 The identifier consumption process takes 37% of the tokenization
12048 time. Another 15% is spent on is_number. 56% of the time spent
12049 on is_number is spent on Int64.Parse:
12051 * We could probably choose based on the string length to
12052 use Int32.Parse or Int64.Parse and avoid all the 64-bit
12055 Another 3% is spend on wrapping `xtoken' in the `token' function.
12057 Handle 0xa0 as whitespace (#34752)
12059 2002-11-26 Miguel de Icaza <miguel@ximian.com>
12061 * typemanager.cs (IsCLRType): New routine to tell whether a type
12062 is one of the builtin types.
12064 Maybe it needs to use TypeCodes to be faster. Maybe we could use
12065 typecode in more places instead of doing pointer comparissions.
12066 We could leverage some knowledge about the way the typecodes are
12069 New code to cache namespaces in assemblies, it is currently not
12070 invoked, to be used soon.
12072 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
12074 * expression.cs (Binary.ResolveOperator): specially handle
12075 strings, and do not perform user-defined operator overloading for
12078 2002-11-24 Miguel de Icaza <miguel@ximian.com>
12080 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
12081 internalcall as it is a pretty simple operation; Avoid whenever
12082 possible to call Char.IsLetter.
12084 (consume_identifier): Cut by half the number of
12085 hashtable calls by merging the is_keyword and GetKeyword behavior.
12087 Do not short-circuit, because if we do, we
12088 report errors (ie, #if false && true would produce an invalid
12092 2002-11-24 Martin Baulig <martin@ximian.com>
12094 * expression.cs (Cast.TryReduce): If we're in checked syntax,
12095 check constant ranges and report a CS0221. Fixes #33186.
12097 2002-11-24 Martin Baulig <martin@ximian.com>
12099 * cs-parser.jay: Make this work for uninitialized variable
12100 declarations in the `for' initializer. Fixes #32416.
12102 2002-11-24 Martin Baulig <martin@ximian.com>
12104 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
12105 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
12107 2002-11-24 Martin Baulig <martin@ximian.com>
12109 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
12110 argument; if true, we also check for user-defined conversions.
12111 This is only needed if both arguments are of a user-defined type.
12112 Fixes #30443, added test-175.cs.
12113 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
12115 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
12117 2002-11-24 Martin Baulig <martin@ximian.com>
12119 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
12120 function to get the store opcode.
12121 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
12122 only emit the Ldelema if the store opcode is Stobj. You must run
12123 both test-34 and test-167 to test this. Fixes #34529.
12125 2002-11-23 Martin Baulig <martin@ximian.com>
12127 * ecore.cs (Expression.MemberLookup): Added additional
12128 `qualifier_type' argument which is used when we're being called
12129 from MemberAccess.DoResolve() and null if we're called from a
12131 (Expression.MemberLookupFailed): New method to report errors; this
12132 does the CS1540 check and reports the correct error message.
12134 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
12135 argument for the CS1540 check and redone the way how we're dealing
12136 with private members. See the comment in the source code for details.
12137 (FilterWithClosure): Reverted this back to revision 1.197; renamed
12138 `closure_start_type' to `closure_qualifier_type' and check whether
12139 it's not null. It was not this filter being broken, it was just
12140 being called with the wrong arguments.
12142 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
12143 and pass it the correct `qualifier_type'; this also does the error
12146 2002-11-22 Miguel de Icaza <miguel@ximian.com>
12148 * expression.cs (Invocation.EmitParams): If the we are dealing
12149 with a non-built-in value type, load its address as well.
12151 (ArrayCreation): Use a a pretty constant instead
12152 of the hardcoded value 2. Use 6 instead of 2 for the number of
12153 static initializers.
12155 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
12156 because they are not really value types, just glorified integers.
12158 * driver.cs: Do not append .exe, the CSC compiler does not do it.
12160 * ecore.cs: Remove redundant code for enumerations, make them use
12161 the same code path as everything else, fixes the casting issue
12162 with enumerations in Windows.Forms.
12164 * attribute.cs: Do only cast to string if it is a string, the
12165 validation happens later.
12167 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
12168 people upgrade their corlibs.
12170 * ecore.cs: Oops, enumerations were not following the entire code path
12172 2002-11-21 Miguel de Icaza <miguel@ximian.com>
12174 * typemanager.cs (FilterWithClosure): Commented out the test for
12175 1540 in typemanager.cs, as it has problems when accessing
12176 protected methods from a parent class (see test-174.cs).
12178 * attribute.cs (Attribute.ValidateGuid): new method.
12179 (Attribute.Resolve): Use above.
12181 2002-11-19 Miguel de Icaza <miguel@ximian.com>
12183 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
12185 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
12186 handling for enumerations, as we only needed the TypeContainer
12187 functionality to begin with (this is required for the fix below to
12188 work for enums that reference constants in a container class for
12191 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
12193 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
12194 a valid TypeBuilder to perform lookups on.o
12196 * class.cs (InheritableMemberSignatureCompare): Use true in the
12197 call to GetGetMethod and GetSetMethod, because we are comparing
12198 the signature, and we need to get the methods *even* if they are
12201 (PropertyBase.CheckBase): ditto.
12203 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
12204 GotoCase.Resolve): Use Peel on EmpytCasts.
12206 * ecore.cs (EmptyCast): drop child, add Peel method.
12208 2002-11-17 Martin Baulig <martin@ximian.com>
12210 * ecore.cs (EmptyCast.Child): New public property.
12212 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
12213 label resolved to an EmptyCast. Fixes #34162.
12214 (GotoCase.Resolve): Likewise.
12215 (Block.EmitMeta): Likewise.
12217 2002-11-17 Martin Baulig <martin@ximian.com>
12219 * expression.cs (Invocation.BetterConversion): Prefer int over
12220 uint; short over ushort; long over ulong for integer literals.
12221 Use ImplicitConversionExists instead of StandardConversionExists
12222 since we also need to check for user-defined implicit conversions.
12223 Fixes #34165. Added test-173.cs.
12225 2002-11-16 Martin Baulig <martin@ximian.com>
12227 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
12228 with the `true' and `false' literals. Fixes #33151.
12230 2002-11-16 Martin Baulig <martin@ximian.com>
12232 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
12233 October 22nd; don't do the cs1540 check for static members.
12235 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
12236 now using our own filter here and doing the cs1540 check again.
12238 2002-11-16 Martin Baulig <martin@ximian.com>
12240 * support.cs (InternalParameters): Don't crash if we don't have
12241 any fixed parameters. Fixes #33532.
12243 2002-11-16 Martin Baulig <martin@ximian.com>
12245 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
12246 when looking up static methods to make this work on Windows.
12249 2002-11-16 Martin Baulig <martin@ximian.com>
12251 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
12252 a setter rather than using PropertyInfo.CanWrite.
12254 2002-11-15 Nick Drochak <ndrochak@gol.com>
12256 * class.cs: Allow acces to block member by subclasses. Fixes build
12259 2002-11-14 Martin Baulig <martin@ximian.com>
12261 * class.cs (Constructor.Emit): Added the extern/block check.
12264 2002-11-14 Martin Baulig <martin@ximian.com>
12266 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
12267 iteration while looking for indexers, this is needed because the
12268 indexer may have a different name in our base classes. Fixed the
12269 error reporting (no indexers at all, not get accessor, no
12270 overloaded match). Fixes bug #33089.
12271 (IndexerAccess.DoResolveLValue): Likewise.
12273 2002-11-14 Martin Baulig <martin@ximian.com>
12275 * class.cs (PropertyBase.CheckBase): Make this work for multiple
12276 indexers. Fixes the first part of bug #33089.
12277 (MethodSignature.InheritableMemberSignatureCompare): Added support
12280 2002-11-13 Ravi Pratap <ravi@ximian.com>
12282 * attribute.cs (Attribute.Resolve): Catch the
12283 NullReferenceException and report it since it isn't supposed to
12286 2002-11-12 Miguel de Icaza <miguel@ximian.com>
12288 * expression.cs (Binary.EmitBranchable): Also handle the cases for
12289 LogicalOr and LogicalAnd that can benefit from recursively
12290 handling EmitBranchable. The code now should be nice for Paolo.
12292 2002-11-08 Miguel de Icaza <miguel@ximian.com>
12294 * typemanager.cs (LookupType): Added a negative-hit hashtable for
12295 the Type lookups, as we perform quite a number of lookups on
12296 non-Types. This can be removed once we can deterministically tell
12297 whether we have a type or a namespace in advance.
12299 But this might require special hacks from our corlib.
12303 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
12304 and double which avoids a conversion from an integer to a double.
12306 * expression.cs: tiny optimization, avoid calling IsConstant,
12307 because it effectively performs the lookup twice.
12309 2002-11-06 Miguel de Icaza <miguel@ximian.com>
12311 But a bogus return here to keep the semantics of the old code
12312 until the Mono runtime is fixed.
12314 * pending.cs (GetMissingInterfaces): New method used to remove all
12315 the interfaces that are already implemented by our parent
12316 classes from the list of pending methods.
12318 * interface.cs: Add checks for calls after ResolveTypeExpr.
12320 2002-11-05 Miguel de Icaza <miguel@ximian.com>
12322 * class.cs (Class.Emit): Report warning 67: event not used if the
12323 warning level is beyond 3.
12325 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
12326 being a NullLiteral.
12328 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
12331 * class.cs (TypeContainer.GetClassBases): Cover a missing code
12332 path that might fail if a type can not be resolved.
12334 * expression.cs (Binary.Emit): Emit unsigned versions of the
12337 * driver.cs: use error 5.
12339 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
12341 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
12343 2002-11-01 Miguel de Icaza <miguel@ximian.com>
12345 * cs-parser.jay (switch_section): A beautiful patch from Martin
12346 Baulig that fixed 33094.
12348 2002-10-31 Miguel de Icaza <miguel@ximian.com>
12350 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
12351 Check whether the base is abstract and report an error if so.
12353 * expression.cs (IndexerAccess.DoResolveLValue,
12354 IndexerAccess.DoResolve): ditto.
12356 (Invocation.DoResolve): ditto.
12358 (Invocation.FullMethodDesc): Improve the report string.
12360 * statement.cs (Block): Eliminate IsVariableDefined as it is
12361 basically just a wrapper for GetVariableInfo.
12363 * ecore.cs (SimpleName): Use new
12365 * support.cs (ReflectionParamter.ParameterType): We unwrap the
12366 type, as we return the actual parameter ref/unref state on a
12369 2002-10-30 Miguel de Icaza <miguel@ximian.com>
12371 * support.cs: Return proper flags REF/OUT fixing the previous
12374 * expression.cs: Reverted last patch, that was wrong. Is_ref is
12375 not used to mean `ref' but `ref or out' in ParameterReference
12377 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
12378 full type signature instead of calling TypeManger.CSharpName
12381 * support.cs (InternalParameters.ParameterDesc): Do not compare
12382 directly to the modflags, because REF/OUT will actually be bitsets
12385 * delegate.cs (VerifyMethod): Check also the modifiers.
12387 * cs-tokenizer.cs: Fix bug where floating point values with an
12388 exponent where a sign was missing was ignored.
12390 * driver.cs: Allow multiple assemblies to be specified in a single
12393 2002-10-28 Miguel de Icaza <miguel@ximian.com>
12395 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
12396 because identifiers after a parenthesis would end up in this kind
12397 of production, and we needed to desamiguate it for having casts
12400 (UserDefinedType *) xxx
12402 2002-10-24 Miguel de Icaza <miguel@ximian.com>
12404 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
12405 we should set on the Bindingflags.NonPublic, but not turn on
12406 private_ok. private_ok controls whether a Private member is
12407 returned (this is chekced on the filter routine), while the
12408 BindingFlags.NonPublic just controls whether private/protected
12409 will be allowed. This fixes the problem part of the problem of
12410 private properties being allowed to be used in derived classes.
12412 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
12413 so we can call the children DoResolveLValue method (this will
12414 properly signal errors on lvalue assignments to base properties)
12416 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
12417 getter are null, and we have a property info, we know that this
12418 happened because the lookup failed, so we report an error 122 for
12419 protection level violation.
12421 We also silently return if setter and getter are null in the
12422 resolve functions, this condition only happens if we have flagged
12423 the error before. This is the other half of the problem.
12425 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
12426 not have accessibility information, that is why we were returning
12427 true in the filter function in typemanager.cs.
12429 To properly report 122 (property is inaccessible because of its
12430 protection level) correctly, we report this error in ResolveAccess
12431 by failing if both the setter and the getter are lacking (ie, the
12434 DoResolve and DoLResolve have been modified to check for both
12435 setter/getter being null and returning silently, the reason being
12436 that I did not want to put the knowledge about this error in upper
12439 int old = Report.Errors;
12440 x = new PropertyExpr (...);
12441 if (old != Report.Errors)
12446 So the property expr is returned, but it is invalid, so the error
12447 will be flagged during the resolve process.
12449 * class.cs: Remove InheritablePropertySignatureCompare from the
12450 class, as we no longer depend on the property signature to compute
12451 whether it is possible to implement a method or not.
12453 The reason is that calling PropertyInfo.GetGetMethod will return
12454 null (in .NET, in Mono it works, and we should change this), in
12455 cases where the Get Method does not exist in that particular
12460 class X { public virtual int A { get { return 1; } } }
12462 class Z : Y { public override int A { get { return 2; } } }
12464 Would fail in Z because the parent (Y) would not have the property
12465 defined. So we avoid this completely now (because the alternative
12466 fix was ugly and slow), and we now depend exclusively on the
12469 (PropertyBase.CheckBase): Use a method-base mechanism to find our
12470 reference method, instead of using the property.
12472 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
12473 routines are gone now.
12475 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
12476 names, they were incorrectly named.
12478 * cs-tokenizer.cs: Return are more gentle token on failure.
12480 * pending.cs (PendingImplementation.InterfaceMethod): This routine
12481 had an out-of-sync index variable, which caused it to remove from
12482 the list of pending methods the wrong method sometimes.
12484 2002-10-22 Miguel de Icaza <miguel@ximian.com>
12486 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
12487 CanWrite, because those refer to this particular instance of the
12488 property, and do not take into account the fact that we can
12489 override single members of a property.
12491 Constructor requires an EmitContext. The resolution process does
12492 not happen here, but we need to compute the accessors before,
12493 because the resolution does not always happen for properties.
12495 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
12496 subclass, before we did not update this flag, but we did update
12499 (GetAccessors): Drop this routine, as it did not work in the
12500 presence of partially overwritten set/get methods.
12502 Notice that this broke the cs1540 detection, but that will require
12505 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12509 * driver.cs: issue a warning instead of an error if we don't support
12510 debugging for the platform. Also ignore a couple of errors that may
12511 arise when trying to write the symbols. Undo my previous patch.
12513 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12515 * driver.cs: ignore /debug switch except for Unix platforms.
12517 2002-10-23 Nick Drochak <ndrochak@gol.com>
12519 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
12521 2002-10-21 Miguel de Icaza <miguel@ximian.com>
12523 * driver.cs: Do not make mcs-debug conditional, so we do not break
12524 builds that use it.
12526 * statement.cs (UsageVector.MergeChildren): I would like Martin to
12527 review this patch. But basically after all the children variables
12528 have been merged, the value of "Breaks" was not being set to
12529 new_breaks for Switch blocks. I think that it should be set after
12530 it has executed. Currently I set this to the value of new_breaks,
12531 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
12532 conservative, but I do not understand this code very well.
12534 I did not break anything in the build, so that is good ;-)
12536 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
12538 2002-10-20 Mark Crichton <crichton@gimp.org>
12540 * cfold.cs: Fixed compile blocker. Really fixed it this time.
12542 2002-10-20 Nick Drochak <ndrochak@gol.com>
12544 * cfold.cs: Fixed compile blocker.
12546 2002-10-20 Miguel de Icaza <miguel@ximian.com>
12548 * driver.cs: I was chekcing the key, not the file.
12550 2002-10-19 Ravi Pratap <ravi@ximian.com>
12552 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
12553 message that we were generating - we just need to silently return
12556 2002-10-19 Miguel de Icaza <miguel@ximian.com>
12558 * class.cs (Event.Define): Change my previous commit, as this
12559 breaks the debugger. This is a temporary hack, as it seems like
12560 the compiler is generating events incorrectly to begin with.
12562 * expression.cs (Binary.ResolveOperator): Added support for
12563 "U operator - (E x, E y)"
12565 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
12568 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
12569 init-only variables, but this path did not take into account that
12570 there might be also instance readonly variables. Correct this
12573 This fixes bug 32253
12575 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
12578 * driver.cs: Change the extension for modules to `netmodule'
12580 * cs-parser.jay: Improved slightly the location tracking for
12581 the debugger symbols.
12583 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
12584 modifiers that were specified instead of the hardcoded value
12585 (FamAndAssem). This was basically ignoring the static modifier,
12586 and others. Fixes 32429.
12588 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
12589 fixed a bug in the process (32476)
12591 * expression.cs (ArrayAccess.EmitAssign): Patch from
12592 hwang_rob@yahoo.ca that fixes bug 31834.3
12594 2002-10-18 Miguel de Icaza <miguel@ximian.com>
12596 * driver.cs: Make the module extension .netmodule.
12598 2002-10-16 Miguel de Icaza <miguel@ximian.com>
12600 * driver.cs: Report an error if the resource file is not found
12601 instead of crashing.
12603 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
12604 false, like Emit does.
12606 2002-10-16 Nick Drochak <ndrochak@gol.com>
12608 * typemanager.cs: Remove unused private member. Also reported mcs
12609 bug to report this as a warning like csc.
12611 2002-10-15 Martin Baulig <martin@gnome.org>
12613 * statement.cs (Statement.Emit): Made this a virtual method; emits
12614 the line number info and calls DoEmit().
12615 (Statement.DoEmit): New protected abstract method, formerly knows
12616 as Statement.Emit().
12618 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
12620 2002-10-11 Miguel de Icaza <miguel@ximian.com>
12622 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
12623 have fixed a remaining problem: not every AddXXXX was adding a
12624 fully qualified name.
12626 Now everyone registers a fully qualified name in the DeclSpace as
12627 being defined instead of the partial name.
12629 Downsides: we are slower than we need to be due to the excess
12630 copies and the names being registered this way.
12632 The reason for this is that we currently depend (on the corlib
12633 bootstrap for instance) that types are fully qualified, because
12634 we dump all the types in the namespace, and we should really have
12635 types inserted into the proper namespace, so we can only store the
12636 basenames in the defined_names array.
12638 2002-10-10 Martin Baulig <martin@gnome.org>
12640 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
12641 from bug #31834, see the bug report for a testcase which is
12644 2002-10-10 Martin Baulig <martin@gnome.org>
12646 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
12647 flow analysis code for this.
12649 * statement.cs (Do, While, For): Tell the flow analysis code about
12651 (FlowBranching.UsageVector): Added support for infinite loops.
12652 (Block.Resolve): Moved the dead code elimination here and use flow
12655 2002-10-09 Miguel de Icaza <miguel@ximian.com>
12657 * class.cs (Field.Define): Catch cycles on struct type
12660 * typemanager.cs (IsUnmanagedtype): Do not recursively check
12661 fields if the fields are static. We only need to check instance
12664 * expression.cs (As.DoResolve): Test for reference type.
12666 * statement.cs (Using.ResolveExpression): Use
12667 ConvertImplicitRequired, not ConvertImplicit which reports an
12669 (Using.ResolveLocalVariableDecls): ditto.
12671 * expression.cs (Binary.ResolveOperator): Report errors in a few
12672 places where we had to.
12674 * typemanager.cs (IsUnmanagedtype): Finish implementation.
12676 2002-10-08 Miguel de Icaza <miguel@ximian.com>
12678 * expression.cs: Use StoreFromPtr instead of extracting the type
12679 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
12681 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
12682 an enumeration value to a System.Enum, but System.Enum is not a
12683 value type, but an class type, so we need to box.
12685 (Expression.ConvertExplicit): One codepath could return
12686 errors but not flag them. Fix this. Fixes #31853
12688 * parameter.cs (Resolve): Do not allow void as a parameter type.
12690 2002-10-06 Martin Baulig <martin@gnome.org>
12692 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
12693 if it's a class type and not a struct. Fixes #31815.
12695 2002-10-06 Martin Baulig <martin@gnome.org>
12697 * statement.cs: Reworked the flow analysis code a bit to make it
12698 usable for dead code elimination.
12700 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12702 * cs-parser.jay: allow empty source files. Fixes bug #31781.
12704 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12706 * expression.cs (ComposedCast.DoResolveType): A quick workaround
12707 to fix the test 165, will investigate deeper.
12709 2002-10-04 Martin Baulig <martin@gnome.org>
12711 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
12712 finally blocks actually work.
12713 (Try.Resolve): We don't need to create a sibling for `finally' if
12714 there is no finally block.
12716 2002-10-04 Martin Baulig <martin@gnome.org>
12718 * class.cs (Constructor.Define): The default accessibility for a
12719 non-default constructor is private, not public.
12721 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12723 * class.cs (Constructor): Make AllowedModifiers public, add
12726 * cs-parser.jay: Perform the modifiers test here, as the
12727 constructor for the Constructor class usually receives a zero
12728 because of the way we create it (first we create, later we
12729 customize, and we were never checking the modifiers).
12731 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
12732 is a version of LookupTypeReflection that includes the type-name
12733 cache. This can be used as a fast path for functions that know
12734 the fully qualified name and are only calling into *.GetType() to
12735 obtain a composed type.
12737 This is also used by TypeManager.LookupType during its type
12740 (LookupType): We now also track the real type name, as sometimes
12741 we can get a quey for the real type name from things like
12742 ComposedCast. This fixes bug 31422.
12744 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
12745 complete type fullname, it does not have to go through the type
12746 resolution system to obtain the composed version of the type (for
12747 obtaining arrays or pointers).
12749 (Conditional.Emit): Use the EmitBoolExpression to
12750 generate nicer code, as requested by Paolo.
12752 (ArrayCreation.CheckIndices): Use the patch from
12753 hwang_rob@yahoo.ca to validate the array initializers.
12755 2002-10-03 Miguel de Icaza <miguel@ximian.com>
12757 * class.cs (ConstructorInitializer.Emit): simplify code by using
12758 Invocation.EmitCall, and at the same time, fix the bugs in calling
12759 parent constructors that took variable arguments.
12761 * ecore.cs (Expression.ConvertNumericExplicit,
12762 Expression.ImplicitNumericConversion): Remove the code that
12763 manually wrapped decimal (InternalTypeConstructor call is now gone
12766 * expression.cs (Cast.TryReduce): Also handle decimal types when
12767 trying to perform a constant fold on the type.
12769 * typemanager.cs (IsUnmanagedtype): Partially implemented.
12771 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
12772 that only turned off an error report, and did nothing else.
12774 2002-10-02 Miguel de Icaza <miguel@ximian.com>
12776 * driver.cs: Handle and ignore /fullpaths
12778 2002-10-01 Miguel de Icaza <miguel@ximian.com>
12780 * expression.cs (Binary.ResolveOperator): Catch the case where
12781 DoNumericPromotions returns true,
12783 (Binary.DoNumericPromotions): Simplify the code, and the tests.
12785 2002-09-27 Miguel de Icaza <miguel@ximian.com>
12787 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
12790 2002-09-26 Miguel de Icaza <miguel@ximian.com>
12792 * ecore.cs (ConvertNumericExplicit): It is not enough that the
12793 conversion exists, but it is also required that the conversion be
12794 performed. This manifested in "(Type64Enum) 2".
12796 * class.cs (TypeManager.AddMethod): The fix is not to change
12797 AddEnum, because that one was using a fully qualified name (every
12798 DeclSpace derivative does), but to change the AddMethod routine
12799 that was using an un-namespaced name. This now correctly reports
12800 the duplicated name.
12802 Revert patch until I can properly fix it. The issue
12803 is that we have a shared Type space across all namespaces
12804 currently, which is wrong.
12806 Options include making the Namespace a DeclSpace, and merge
12807 current_namespace/current_container in the parser.
12809 2002-09-25 Miguel de Icaza <miguel@ximian.com>
12811 * cs-parser.jay: Improve error reporting when we get a different
12812 kind of expression in local_variable_type and
12813 local_variable_pointer_type.
12815 Propagate this to avoid missleading errors being reported.
12817 * ecore.cs (ImplicitReferenceConversion): treat
12818 TypeManager.value_type as a target just like object_type. As
12823 Is valid, and needs to result in the int 1 being boxed before it
12824 is assigned to the value type v.
12826 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
12827 to validate the enumeration name.
12829 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
12830 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
12831 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
12833 * ecore.cs (TryImplicitIntConversion): When doing an
12834 implicit-enumeration-conversion, check if the type is 64-bits and
12835 perform a conversion before passing to EnumConstant.
12837 2002-09-23 Miguel de Icaza <miguel@ximian.com>
12839 * decl.cs (Error_AmbiguousTypeReference); New routine used to
12840 report ambiguous type references. Unlike the MS version, we
12841 report what the ambiguity is. Innovation at work ;-)
12843 (DeclSpace.FindType): Require a location argument to
12844 display when we display an ambiguous error.
12846 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
12848 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
12850 * expression.cs (EmitDynamicInitializers): Apply patch from
12851 hwang_rob@yahoo.ca that fixes the order in which we emit our
12854 2002-09-21 Martin Baulig <martin@gnome.org>
12856 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
12857 delegate takes no arguments.
12859 2002-09-20 Miguel de Icaza <miguel@ximian.com>
12861 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
12864 * expression.cs: Extract the underlying type.
12866 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
12868 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
12870 2002-09-19 Miguel de Icaza <miguel@ximian.com>
12872 * class.cs (TypeContainer.DefineType): We can not use the nice
12873 PackingSize with the size set to 1 DefineType method, because it
12874 will not allow us to define the interfaces that the struct
12877 This completes the fixing of bug 27287
12879 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
12880 means also structs. This fixes part of the problem.
12881 (Expresion.ImplicitReferenceConversionExists): ditto.
12883 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
12884 error if there were no errors reported during the type lookup
12885 process, to avoid duplicates or redundant errors. Without this
12886 you would get an ambiguous errors plus a type not found. We have
12887 beaten the user enough with the first error.
12889 (DeclSparce.FindType): Emit a warning if we have an ambiguous
12892 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
12893 during the resolution process, stop the lookup, this avoids
12894 repeated error reports (same error twice).
12896 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
12898 * typemanager.cs (LookupType): Redo the type lookup code to match
12899 the needs of System.Reflection.
12901 The issue is that System.Reflection requires references to nested
12902 types to begin with a "+" sign instead of a dot. So toplevel
12903 types look like: "NameSpace.TopLevelClass", and nested ones look
12904 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
12907 2002-09-19 Martin Baulig <martin@gnome.org>
12909 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
12910 says that a method always returns or always throws an exception,
12911 don't report the CS0161.
12913 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
12914 set `Returns = new_returns'.
12916 2002-09-19 Martin Baulig <martin@gnome.org>
12918 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
12919 to an enum constant, check for a CS0176.
12921 2002-09-18 Miguel de Icaza <miguel@ximian.com>
12923 * class.cs (TypeContainer.CheckPairedOperators): Now we check
12924 for operators that must be in pairs and report errors.
12926 * ecore.cs (SimpleName.DoResolveType): During the initial type
12927 resolution process, when we define types recursively, we must
12928 check first for types in our current scope before we perform
12929 lookups in the enclosing scopes.
12931 * expression.cs (MakeByteBlob): Handle Decimal blobs.
12933 (Invocation.VerifyArgumentsCompat): Call
12934 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
12935 I thought we were supposed to always call this, but there are a
12936 few places in the code where we dont do it.
12938 2002-09-17 Miguel de Icaza <miguel@ximian.com>
12940 * driver.cs: Add support in -linkres and -resource to specify the
12941 name of the identifier.
12943 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12945 * ecore.cs (StandardConversionExists): Sync with the conversion
12946 code: allow anything-* to void* conversions.
12948 (FindMostSpecificSource): Use an Expression argument
12949 instead of a Type, because we might be handed over a Literal which
12950 gets a few more implicit conversions that plain types do not. So
12951 this information was being lost.
12953 Also, we drop the temporary type-holder expression when not
12956 2002-09-17 Martin Baulig <martin@gnome.org>
12958 * class.cs (PropertyBase.CheckBase): Don't check the base class if
12959 this is an explicit interface implementation.
12961 2002-09-17 Martin Baulig <martin@gnome.org>
12963 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
12964 different `IndexerName' attributes.
12966 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
12967 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
12968 virtual CommonResolve().
12970 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12972 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12973 and convert that to the UnderlyingType.
12975 * statement.cs (Foreach.Resolve): Indexers are just like variables
12976 or PropertyAccesses.
12978 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12979 inside quoted strings, we were not doing this before.
12981 2002-09-16 Martin Baulig <martin@gnome.org>
12983 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12984 resolve it. This is needed for the definite assignment check of the
12985 instance expression, fixes bug #29846.
12986 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12988 2002-09-16 Nick Drochak <ndrochak@gol.com>
12990 * parameter.cs: Fix compile error. Cannot reference static member
12991 from an instance object. Is this an mcs bug?
12993 2002-09-14 Martin Baulig <martin@gnome.org>
12995 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12996 multiple times. Fixes bug #30295, added test-166.cs.
12998 2002-09-14 Martin Baulig <martin@gnome.org>
13000 * statement.cs (Block.Emit): Don't emit unreachable code.
13001 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
13002 `break' statements.
13003 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
13005 2002-09-14 Martin Baulig <martin@gnome.org>
13007 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
13010 2002-09-14 Martin Baulig <martin@gnome.org>
13012 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
13013 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
13014 be false on the ms runtime.
13016 2002-09-13 Martin Baulig <martin@gnome.org>
13018 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
13019 the CS0038 error message.
13021 2002-09-12 Miguel de Icaza <miguel@ximian.com>
13023 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
13024 constant inside, return it.
13026 2002-09-12 Martin Baulig <martin@gnome.org>
13028 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
13029 implicit conversion can be done between enum types.
13031 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
13032 check whether an implicit conversion to the current enum's UnderlyingType
13033 exists and report an error if not.
13035 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
13036 without debugging support.
13038 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
13039 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
13041 2002-09-12 Martin Baulig <martin@gnome.org>
13043 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
13045 * ecore.cs (IMemberExpr.DeclaringType): New property.
13046 (SimpleName.SimpleNameResolve): Check whether we're accessing a
13047 nonstatic member of an outer type (CS0038).
13049 2002-09-11 Miguel de Icaza <miguel@ximian.com>
13051 * driver.cs: Activate the using-error detector at warning level
13052 4 (at least for MS-compatible APIs).
13054 * namespace.cs (VerifyUsing): Small buglett fix.
13056 * pending.cs (PendingImplementation): pass the container pointer.
13058 * interface.cs (GetMethods): Allow for recursive definition. Long
13059 term, I would like to move every type to support recursive
13060 definitions, not the current ordering mechanism that we have right
13063 The situation is this: Attributes are handled before interfaces,
13064 so we can apply attributes to interfaces. But some attributes
13065 implement interfaces, we will now handle the simple cases
13066 (recursive definitions will just get an error).
13068 * parameter.cs: Only invalidate types at the end if we fail to
13071 2002-09-09 Martin Baulig <martin@gnome.org>
13073 * ecore.cs (PropertyExpr.Emit): Also check for
13074 TypeManager.system_int_array_get_length so this'll also work when
13075 compiling corlib. Fixes #30003.
13077 2002-09-09 Martin Baulig <martin@gnome.org>
13079 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
13080 and throw an exception if we can't get the type's size. Fixed #30040,
13083 2002-09-09 Martin Baulig <martin@gnome.org>
13085 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
13087 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
13088 context. Fixes bug #30027.
13090 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
13091 virtual functions. Fixes bug #30043, added test-164.cs.
13093 2002-09-08 Ravi Pratap <ravi@ximian.com>
13095 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
13097 2002-09-08 Nick Drochak <ndrochak@gol.com>
13099 * driver.cs: Use an object to get the windows codepage since it's not a
13102 2002-09-08 Miguel de Icaza <miguel@ximian.com>
13104 * statement.cs (For.Emit): for infinite loops (test == null)
13105 return whether there is a break inside, not always "true".
13107 * namespace.cs (UsingEntry): New struct to hold the name of the
13108 using definition, the location where it is defined, and whether it
13109 has been used in a successful type lookup.
13111 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
13116 2002-09-06 Ravi Pratap <ravi@ximian.com>
13118 * attribute.cs : Fix incorrect code which relied on catching
13119 a NullReferenceException to detect a null being passed in
13120 where an object was expected.
13122 2002-09-06 Miguel de Icaza <miguel@ximian.com>
13124 * statement.cs (Try): flag the catch variable as assigned
13126 * expression.cs (Cast): Simplified by using ResolveType instead of
13127 manually resolving.
13129 * statement.cs (Catch): Fix bug by using ResolveType.
13131 2002-09-06 Ravi Pratap <ravi@ximian.com>
13133 * expression.cs (BetterConversion): Special case for when we have
13134 a NullLiteral as the argument and we have to choose between string
13135 and object types - we choose string the way csc does.
13137 * attribute.cs (Attribute.Resolve): Catch the
13138 NullReferenceException and report error #182 since the Mono
13139 runtime no more has the bug and having this exception raised means
13140 we tried to select a constructor which takes an object and is
13143 2002-09-05 Ravi Pratap <ravi@ximian.com>
13145 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
13146 message (1502, 1503) when we can't locate a method after overload
13147 resolution. This is much more informative and closes the bug
13150 * interface.cs (PopulateMethod): Return if there are no argument
13151 types. Fixes a NullReferenceException bug.
13153 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
13154 expressions too. Previously we were checking only in one place for
13155 positional arguments leaving out named arguments.
13157 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
13158 type to the enum type is not allowed. Remove code corresponding to
13161 (ConvertNumericExplicit): Allow explicit conversions from
13162 the underlying type to enum type. This precisely follows the spec
13163 and closes a bug filed by Gonzalo.
13165 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13168 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
13170 2002-09-03 Miguel de Icaza <miguel@ximian.com>
13172 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
13173 it was important that we stored the right value after the
13174 reduction in `converted'.
13176 2002-09-04 Martin Baulig <martin@gnome.org>
13178 * location.cs (Location.SymbolDocument): Use full pathnames for the
13181 2002-08-30 Miguel de Icaza <miguel@ximian.com>
13183 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
13184 of the expression resolve mechanism, because that will catch the
13185 SimpleName error failures.
13187 (Conditional): If we can not resolve the
13188 expression, return, do not crash.
13190 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13193 (location): display token name instead of its number.
13195 2002-08-28 Martin Baulig <martin@gnome.org>
13197 * expression.cs (Binary.ResolveOperator): Don't silently return
13198 but return an error if an operator cannot be applied between two
13201 2002-08-28 Martin Baulig <martin@gnome.org>
13203 * class.cs (Constructor.Define): Set the permission attributes
13204 correctly instead of making all constructors public.
13206 2002-08-28 Martin Baulig <martin@gnome.org>
13208 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
13209 for private members before reporting a CS0103; if we find anything,
13212 2002-08-28 Martin Baulig <martin@gnome.org>
13214 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
13215 to check whether `closure_start_type == closure_invocation_type',
13216 we also need to check whether `m.DeclaringType == closure_invocation_type'
13217 before bypassing the permission checks. We might be accessing
13218 protected/private members from the base class.
13219 (TypeManager.RealMemberLookup): Only set private_ok if private
13220 members were requested via BindingFlags.NonPublic.
13222 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
13224 * expression.cs (MemberAccess.ResolveMemberAccess): Set
13225 MethodGroupExpr.IsExplicitImpl if appropriate.
13226 (Invocation.DoResolve): Don't report the CS0120 for explicit
13227 interface implementations.
13229 2002-08-27 Martin Baulig <martin@gnome.org>
13231 * expression.cs (Invocation.DoResolve): If this is a static
13232 method and we don't have an InstanceExpression, we must report
13235 2002-08-25 Martin Baulig <martin@gnome.org>
13237 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
13238 `==' between a valuetype and an object.
13240 2002-08-25 Miguel de Icaza <miguel@ximian.com>
13242 * ecore.cs (TypeExpr): Provide a ToString method.
13244 2002-08-24 Martin Baulig <martin@gnome.org>
13246 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
13247 now called proggie.dbg and it's a binary file.
13249 2002-08-23 Martin Baulig <martin@gnome.org>
13251 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
13253 2002-08-23 Martin Baulig <martin@gnome.org>
13255 * struct.cs (MyStructInfo.ctor): Make this work with empty
13256 structs; it's not allowed to use foreach() on null.
13258 2002-08-23 Martin Baulig <martin@gnome.org>
13260 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
13261 writer the full pathname of the generated assembly.
13263 2002-08-23 Martin Baulig <martin@gnome.org>
13265 * statements.cs (FlowBranching.UsageVector.MergeChildren):
13266 A `finally' block never returns or breaks; improved handling of
13269 2002-08-23 Martin Baulig <martin@gnome.org>
13271 * statement.cs (Throw.Resolve): Allow `throw null'.
13273 2002-08-23 Martin Baulig <martin@gnome.org>
13275 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
13276 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
13277 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
13278 MemberLookup would return a wrong event if this is an explicit
13279 interface implementation and the class has an event with the same
13282 2002-08-23 Martin Baulig <martin@gnome.org>
13284 * statement.cs (Block.AddChildVariableNames): New public method.
13285 (Block.AddChildVariableName): Likewise.
13286 (Block.IsVariableNameUsedInChildBlock): Likewise.
13287 (Block.AddVariable): Check whether a variable name has already
13288 been used in a child block.
13290 * cs-parser.jay (declare_local_variables): Mark all variable names
13291 from the current block as being used in a child block in the
13294 2002-08-23 Martin Baulig <martin@gnome.org>
13296 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
13297 find the symbol writer.
13299 * driver.cs: csc also allows the arguments to /define being
13300 separated by commas, not only by semicolons.
13302 2002-08-23 Martin Baulig <martin@gnome.org>
13304 * interface.cs (Interface.GetMembers): Added static check for events.
13306 2002-08-15 Martin Baulig <martin@gnome.org>
13308 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
13309 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
13311 * ecore.cs (Expression.MemberLookup): Added documentation and explained
13312 why the MethodData.EmitDestructor() change was necessary.
13314 2002-08-20 Martin Baulig <martin@gnome.org>
13316 * class.cs (TypeContainer.FindMembers): Added static check for events.
13318 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
13320 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
13321 use Type.GetEvents(), not Type.FindMembers().
13323 2002-08-20 Martin Baulig <martin@gnome.org>
13325 * decl.cs (MemberCache): Added a special method cache which will
13326 be used for method-only searched. This ensures that a method
13327 search will return a MethodInfo with the correct ReflectedType for
13330 2002-08-20 Martin Baulig <martin@gnome.org>
13332 * decl.cs (DeclSpace.FindMembers): Made this public.
13334 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13336 * delegate.cs: fixed build on windows.
13337 [FIXME: Filed as bug #29150: MCS must report these errors.]
13339 2002-08-19 Ravi Pratap <ravi@ximian.com>
13341 * ecore.cs (StandardConversionExists): Return a false
13342 if we are trying to convert the void type to anything else
13343 since that is not allowed.
13345 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
13346 we flag error 70 in the event an event is trying to be accessed
13347 directly from outside the declaring type.
13349 2002-08-20 Martin Baulig <martin@gnome.org>
13351 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
13352 MemberCache from typemanager.cs to decl.cs.
13354 2002-08-19 Martin Baulig <martin@gnome.org>
13356 * class.cs (TypeContainer): Implement IMemberContainer.
13357 (TypeContainer.DefineMembers): Create the MemberCache.
13358 (TypeContainer.FindMembers): Do better BindingFlags checking; only
13359 return public members if BindingFlags.Public was given, check
13360 whether members are static.
13362 2002-08-16 Martin Baulig <martin@gnome.org>
13364 * decl.cs (DeclSpace.Define): Splitted this in Define and
13365 DefineMembers. DefineMembers is called first and initializes the
13368 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
13369 DefineMembers() on all our DeclSpaces.
13371 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
13372 but call DefineMembers() on all nested interfaces. We call their
13373 Define() in our new Define() function.
13375 * interface.cs (Interface): Implement IMemberContainer.
13376 (Interface.Define): Moved all code except the attribute stuf to
13378 (Interface.DefineMembers): Initialize the member cache.
13380 * typemanager.cs (IMemberFinder): Removed this interface, we don't
13381 need this anymore since we can use MemberCache.FindMembers directly.
13383 2002-08-19 Martin Baulig <martin@gnome.org>
13385 * typemanager.cs (MemberCache): When creating the cache for an
13386 interface type, add all inherited members.
13387 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
13388 to `out bool used_cache' and documented it.
13389 (TypeManager.MemberLookup): If we already used the cache in the first
13390 iteration, we don't need to do the interfaces check.
13392 2002-08-19 Martin Baulig <martin@gnome.org>
13394 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
13395 here from IMemberFinder and don't implement this interface anymore.
13396 (DeclSpace.MemberCache): Moved here from IMemberFinder.
13398 * typemanager.cs (IMemberFinder): This interface is now only used by
13399 classes which actually support the member cache.
13400 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
13401 since we only put DeclSpaces into this Hashtable.
13402 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
13403 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
13405 2002-08-16 Martin Baulig <martin@gnome.org>
13407 * typemanager.cs (ICachingMemberFinder): Removed.
13408 (IMemberFinder.MemberCache): New property.
13409 (TypeManager.FindMembers): Merged this with RealFindMembers().
13410 This function will never be called from TypeManager.MemberLookup()
13411 so we can't use the cache here, just the IMemberFinder.
13412 (TypeManager.MemberLookup_FindMembers): Check whether the
13413 IMemberFinder has a MemberCache and call the cache's FindMembers
13415 (MemberCache): Rewrote larger parts of this yet another time and
13416 cleaned it up a bit.
13418 2002-08-15 Miguel de Icaza <miguel@ximian.com>
13420 * driver.cs (LoadArgs): Support quoting.
13422 (Usage): Show the CSC-like command line arguments.
13424 Improved a few error messages.
13426 2002-08-15 Martin Baulig <martin@gnome.org>
13428 * typemanager.cs (IMemberContainer.Type): New property.
13429 (IMemberContainer.IsInterface): New property.
13431 The following changes are conditional to BROKEN_RUNTIME, which is
13432 defined at the top of the file.
13434 * typemanager.cs (MemberCache.MemberCache): Don't add the base
13435 class'es members, but add all members from TypeHandle.ObjectType
13436 if we're an interface.
13437 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
13438 is the current type.
13439 (MemberCache.CacheEntry.Container): Removed this field.
13440 (TypeHandle.GetMembers): Include inherited members.
13442 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13444 * typemanager.cs: fixed compilation and added a comment on a field that
13447 2002-08-15 Martin Baulig <martin@gnome.org>
13449 * class.cs (ConstructorInitializer.Resolve): In the
13450 Expression.MemberLookup call, use the queried_type as
13453 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
13454 declared' attribute, it's always true.
13455 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
13456 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
13457 temporary wrapper for FindMembers which tells MemberLookup whether
13458 members from the base classes are included in the return value.
13459 This will go away soon.
13460 (TypeManager.MemberLookup): Use this temporary hack here; once the
13461 new MemberCache is completed, we don't need to do the DeclaredOnly
13462 looping here anymore since the MemberCache will take care of this.
13463 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
13464 (MemberCache): When creating the MemberCache for a class, get
13465 members from the current class and all its base classes.
13466 (MemberCache.CacheEntry.Container): New field. This is a
13467 temporary hack until the Mono runtime is fixed to distinguish
13468 between ReflectedType and DeclaringType. It allows us to use MCS
13469 with both the MS runtime and the unfixed Mono runtime without
13470 problems and without accecting performance.
13471 (MemberCache.SearchMembers): The DeclaredOnly looping from
13472 TypeManager.MemberLookup is now done here.
13474 2002-08-14 Martin Baulig <martin@gnome.org>
13476 * statement.cs (MyStructInfo.MyStructInfo): Don't call
13477 Type.GetFields on dynamic types but get the fields from the
13478 corresponding TypeContainer.
13479 (MyStructInfo.GetStructInfo): Added check for enum types.
13481 * typemanager.cs (MemberList.IsSynchronized): Implemented.
13482 (MemberList.SyncRoot): Implemented.
13483 (TypeManager.FilterWithClosure): No need to check permissions if
13484 closure_start_type == closure_invocation_type, don't crash if
13485 closure_invocation_type is null.
13487 2002-08-13 Martin Baulig <martin@gnome.org>
13489 Rewrote TypeContainer.FindMembers to use a member cache. This
13490 gives us a speed increase of about 35% for the self-hosting MCS
13491 build and of about 15-20% for the class libs (both on GNU/Linux).
13493 * report.cs (Timer): New class to get enhanced profiling. This
13494 whole class is "TIMER" conditional since it remarkably slows down
13497 * class.cs (MemberList): New class. This is an IList wrapper
13498 which we're now using instead of passing MemberInfo[]'s around to
13499 avoid copying this array unnecessarily.
13500 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
13501 (ICachingMemberFinder, IMemberContainer): New interface.
13502 (TypeManager.FilterWithClosure): If `criteria' is null, the name
13503 has already been checked, otherwise use it for the name comparision.
13504 (TypeManager.FindMembers): Renamed to RealMemberFinder and
13505 provided wrapper which tries to use ICachingMemberFinder.FindMembers
13506 if possible. Returns a MemberList, not a MemberInfo [].
13507 (TypeHandle): New class, implements IMemberContainer. We create
13508 one instance of this class per type, it contains a MemberCache
13509 which is used to do the member lookups.
13510 (MemberCache): New class. Each instance of this class contains
13511 all members of a type and a name-based hash table.
13512 (MemberCache.FindMembers): This is our new member lookup
13513 function. First, it looks up all members of the requested name in
13514 the hash table. Then, it walks this list and sorts out all
13515 applicable members and returns them.
13517 2002-08-13 Martin Baulig <martin@gnome.org>
13519 In addition to a nice code cleanup, this gives us a performance
13520 increase of about 1.4% on GNU/Linux - not much, but it's already
13521 half a second for the self-hosting MCS compilation.
13523 * typemanager.cs (IMemberFinder): New interface. It is used by
13524 TypeManager.FindMembers to call FindMembers on a TypeContainer,
13525 Enum, Delegate or Interface.
13526 (TypeManager.finder_to_member_finder): New PtrHashtable.
13527 (TypeManager.finder_to_container): Removed.
13528 (TypeManager.finder_to_delegate): Removed.
13529 (TypeManager.finder_to_interface): Removed.
13530 (TypeManager.finder_to_enum): Removed.
13532 * interface.cs (Interface): Implement IMemberFinder.
13534 * delegate.cs (Delegate): Implement IMemberFinder.
13536 * enum.cs (Enum): Implement IMemberFinder.
13538 * class.cs (TypeContainer): Implement IMemberFinder.
13540 2002-08-12 Martin Baulig <martin@gnome.org>
13542 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
13544 2002-08-12 Martin Baulig <martin@gnome.org>
13546 * ecore.cs (ITypeExpression): New interface for expressions which
13548 (TypeExpression): Renamed to TypeLookupExpression.
13549 (Expression.DoResolve): If we're doing a types-only lookup, the
13550 expression must implement the ITypeExpression interface and we
13551 call DoResolveType() on it.
13552 (SimpleName): Implement the new ITypeExpression interface.
13553 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
13554 hack, the situation that we're only looking up types can't happen
13555 anymore when this method is called. Moved the type lookup code to
13556 DoResolveType() and call it.
13557 (SimpleName.DoResolveType): This ITypeExpression interface method
13558 is now doing the types-only lookup.
13559 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
13560 (ResolveFlags): Added MaskExprClass.
13562 * expression.cs (MemberAccess): Implement the ITypeExpression
13564 (MemberAccess.DoResolve): Added support for a types-only lookup
13565 when we're called via ITypeExpression.DoResolveType().
13566 (ComposedCast): Implement the ITypeExpression interface.
13568 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
13569 Expression.Resolve() with ResolveFlags.Type instead.
13571 2002-08-12 Martin Baulig <martin@gnome.org>
13573 * interface.cs (Interface.Define): Apply attributes.
13575 * attribute.cs (Attribute.ApplyAttributes): Added support for
13576 interface attributes.
13578 2002-08-11 Martin Baulig <martin@gnome.org>
13580 * statement.cs (Block.Emit): Only check the "this" variable if we
13581 do not always throw an exception.
13583 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
13584 whether the property has a set accessor.
13586 2002-08-11 Martin Baulig <martin@gnome.org>
13588 Added control flow analysis support for structs.
13590 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
13591 with control flow analysis turned off.
13592 (IVariable): New interface.
13593 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
13594 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
13595 (FieldExpr.DoResolve): Resolve the instance expression with flow
13596 analysis turned off and do the definite assignment check after the
13597 resolving when we know what the expression will resolve to.
13599 * expression.cs (LocalVariableReference, ParameterReference):
13600 Implement the new IVariable interface, only call the flow analysis
13601 code if ec.DoFlowAnalysis is true.
13602 (This): Added constructor which takes a Block argument. Implement
13603 the new IVariable interface.
13604 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
13605 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
13606 This does the definite assignment checks for struct members.
13608 * class.cs (Constructor.Emit): If this is a non-static `struct'
13609 constructor which doesn't have any initializer, call
13610 Block.AddThisVariable() to tell the flow analysis code that all
13611 struct elements must be initialized before control returns from
13614 * statement.cs (MyStructInfo): New public class.
13615 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
13616 argument to this indexer. If non-zero, check an individual struct
13617 member, not the whole struct.
13618 (FlowBranching.CheckOutParameters): Check struct members.
13619 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
13620 overloaded versions of these methods which take an additional
13621 `int field_idx' argument to check struct members.
13622 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
13623 overloaded versions of these methods which take an additional
13624 `string field_name' argument to check struct member.s
13625 (VariableInfo): Implement the IVariable interface.
13626 (VariableInfo.StructInfo): New public property. Returns the
13627 MyStructInfo instance of the variable if it's a struct or null.
13628 (Block.AddThisVariable): New public method. This is called from
13629 Constructor.Emit() for non-static `struct' constructor which do
13630 not have any initializer. It creates a special variable for the
13631 "this" instance variable which will be checked by the flow
13632 analysis code to ensure that all of the struct's fields are
13633 initialized before control returns from the constructor.
13634 (UsageVector): Added support for struct members. If a
13635 variable/parameter is a struct with N members, we reserve a slot
13636 in the usage vector for each member. A struct is considered fully
13637 initialized if either the struct itself (slot 0) or all its
13638 members are initialized.
13640 2002-08-08 Martin Baulig <martin@gnome.org>
13642 * driver.cs (Driver.MainDriver): Only report an error CS5001
13643 if there were no compilation errors.
13645 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
13646 `UnsafeContext' property to determine whether the parent is in
13647 unsafe context rather than checking the parent's ModFlags:
13648 classes nested in an unsafe class are unsafe as well.
13650 2002-08-08 Martin Baulig <martin@gnome.org>
13652 * statement.cs (UsageVector.MergeChildren): Distinguish between
13653 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
13654 we return. Added test17() and test18() to test-154.cs.
13656 2002-08-08 Martin Baulig <martin@gnome.org>
13658 * typemanager.cs (TypeManager.FilterWithClosure): If we have
13659 Family access, make sure the invoking type isn't a subclass of the
13660 queried type (that'd be a CS1540).
13662 * ecore.cs (Expression.MemberLookup): Added overloaded version of
13663 this method which takes an additional `Type invocation_type'.
13665 * expression.cs (BaseAccess.DoResolve): Use the base type as
13666 invocation and query type.
13667 (MemberAccess.DoResolve): If the lookup failed and we're about to
13668 report a CS0122, try a lookup with the ec.ContainerType - if this
13669 succeeds, we must report a CS1540.
13671 2002-08-08 Martin Baulig <martin@gnome.org>
13673 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
13674 (MethodGroupExpr): Implement the IMemberExpr interface.
13676 * expression (MemberAccess.ResolveMemberAccess): No need to have
13677 any special code for MethodGroupExprs anymore, they're now
13680 2002-08-08 Martin Baulig <martin@gnome.org>
13682 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
13683 Family, FamANDAssem and FamORAssem permissions.
13684 (TypeManager.IsSubclassOrNestedChildOf): New public method.
13686 2002-08-08 Martin Baulig <martin@gnome.org>
13688 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
13689 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
13692 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
13694 * driver.cs: implemented /resource option to embed managed resources.
13696 2002-08-07 Martin Baulig <martin@gnome.org>
13698 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
13699 (FieldBase.HasFieldInitializer): New public property.
13700 (FieldBase.GetInitializerExpression): New public method. Resolves and
13701 returns the field initializer and makes sure it is only resolved once.
13702 (TypeContainer.EmitFieldInitializers): Call
13703 FieldBase.GetInitializerExpression to get the initializer, this ensures
13704 that it isn't resolved multiple times.
13706 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
13707 the resolving process (SimpleName/MemberLookup) that we're currently
13708 emitting a field initializer (which must not access any instance members,
13709 this is an error CS0236).
13711 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
13712 argument, if the `IsFieldInitializer' flag is set, we must report and
13713 error CS0236 and not an error CS0120.
13715 2002-08-07 Martin Baulig <martin@gnome.org>
13717 * ecore.cs (IMemberExpr): New public interface.
13718 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
13719 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
13720 if the expression is an IMemberExpr.
13722 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
13723 to be null, implicitly default to `this' if we're non-static in
13724 this case. Simplified the code a lot by using the new IMemberExpr
13725 interface. Also fixed bug #28176 here.
13727 2002-08-06 Martin Baulig <martin@gnome.org>
13729 * cs-parser.jay (SimpleLookup): Removed. We need to create
13730 ParameterReferences during semantic analysis so that we can do a
13731 type-only search when resolving Cast, TypeOf and SizeOf.
13732 (block): Pass the `current_local_parameters' to the Block's
13735 * class.cs (ConstructorInitializer): Added `Parameters parameters'
13736 argument to the constructor.
13737 (ConstructorInitializer.Resolve): Create a temporary implicit
13738 block with the parameters.
13740 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
13741 references here if we aren't doing a type-only search.
13743 * statement.cs (Block): Added constructor which takes a
13744 `Parameters parameters' argument.
13745 (Block.Parameters): New public property.
13747 * support.cs (InternalParameters.Parameters): Renamed `parameters'
13748 to `Parameters' and made it public readonly.
13750 2002-08-06 Martin Baulig <martin@gnome.org>
13752 * ecore.cs (Expression.Warning): Made this public as well.
13754 * report.cs (Report.Debug): Print the contents of collections.
13756 2002-08-06 Martin Baulig <martin@gnome.org>
13758 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
13759 used to tell Resolve() which kinds of expressions it may return.
13760 (Expression.Resolve): Added overloaded version of this method which
13761 takes a `ResolveFlags flags' argument. This can be used to tell
13762 Resolve() which kinds of expressions it may return. Reports a
13764 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
13765 ResolveFlags.SimpleName.
13766 (Expression.Error118): Added overloaded version of this method which
13767 takes a `ResolveFlags flags' argument. It uses the flags to determine
13768 which kinds of expressions are allowed.
13770 * expression.cs (Argument.ResolveMethodGroup): New public method.
13771 Resolves an argument, but allows a MethodGroup to be returned.
13772 This is used when invoking a delegate.
13774 * TODO: Updated a bit.
13776 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13778 Fixed compilation with csc.
13780 * ecore.cs: Expression.Error made public. Is this correct? Should
13781 Warning be made public too?
13783 * expression.cs: use ea.Location instead of ea.loc.
13784 [FIXME: Filed as bug #28607: MCS must report these errors.]
13786 2002-08-06 Martin Baulig <martin@gnome.org>
13788 * ecore.cs (Expression.loc): Moved the location here instead of
13789 duplicating it in all derived classes.
13790 (Expression.Location): New public property.
13791 (Expression.Error, Expression.Warning): Made them non-static and
13792 removed the location argument.
13793 (Expression.Warning): Added overloaded version which takes an
13794 `int level' argument.
13795 (Expression.Error118): Make this non-static and removed the
13796 expression and location arguments.
13797 (TypeExpr): Added location argument to the constructor.
13799 * expression.cs (StaticCallExpr): Added location argument to
13801 (Indirection, PointerArithmetic): Likewise.
13802 (CheckedExpr, UnCheckedExpr): Likewise.
13803 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
13804 (StringPtr): Likewise.
13807 2002-08-05 Martin Baulig <martin@gnome.org>
13809 * expression.cs (BaseAccess.DoResolve): Actually report errors.
13811 * assign.cs (Assign.DoResolve): Check whether the source
13812 expression is a value or variable.
13814 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
13815 while resolving the corresponding blocks.
13817 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
13818 an error, don't silently return null.
13820 * statement.cs (Block.AddVariable): Do the error reporting here
13821 and distinguish between CS0128 and CS0136.
13822 (Block.DoResolve): Report all unused labels (warning CS0164).
13823 (LabeledStatement): Pass the location to the constructor.
13824 (LabeledStatement.HasBeenReferenced): New property.
13825 (LabeledStatement.Resolve): Set it to true here.
13827 * statement.cs (Return.Emit): Return success even after reporting
13828 a type mismatch error (CS0126 or CS0127), this is what csc does and
13829 it avoids confusing the users with any consecutive errors.
13831 2002-08-05 Martin Baulig <martin@gnome.org>
13833 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
13835 * const.cs (Const.LookupConstantValue): Catch circular definitions.
13837 * expression.cs (MemberAccess.DoResolve): Silently return if an
13838 error has already been reported.
13840 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
13841 error has already been reported.
13843 2002-08-05 Martin Baulig <martin@gnome.org>
13845 * statement.cs (UsageVector): Only initialize the `parameters'
13846 vector if we actually have any "out" parameters.
13848 2002-08-05 Martin Baulig <martin@gnome.org>
13850 * expression.cs (Binary.ResolveOperator): When combining delegates,
13851 they must have the same type.
13853 2002-08-05 Martin Baulig <martin@gnome.org>
13855 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
13856 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
13857 work with the ms runtime and we also don't need it: if we're a
13858 PropertyBuilder and not in the `indexer_arguments' hash, then we
13859 are a property and not an indexer.
13861 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
13862 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
13863 since the latter one doesn't work with the ms runtime.
13865 2002-08-03 Martin Baulig <martin@gnome.org>
13867 Fixed bugs #27998 and #22735.
13869 * class.cs (Method.IsOperator): New public field.
13870 (Method.CheckBase): Report CS0111 if there's already a method
13871 with the same parameters in the current class. Report CS0508 when
13872 attempting to change the return type of an inherited method.
13873 (MethodData.Emit): Report CS0179 if a method doesn't have a body
13874 and it's not marked abstract or extern.
13875 (PropertyBase): New abstract base class for Property and Indexer.
13876 (PropertyBase.CheckBase): Moved here from Property and made it work
13878 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
13879 the same so we can reuse it there.
13880 (Property, Indexer): Derive from PropertyBase.
13881 (MethodSignature.inheritable_property_signature_filter): New delegate
13882 to find properties and indexers.
13884 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
13885 argument and improved error reporting.
13887 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
13888 EmptyReadOnlyParameters and made it a property.
13890 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
13891 version of this method which takes a `PropertyInfo indexer'.
13892 (TypeManager.RegisterIndexer): New method.
13894 * class.cs: Added myself as author of this file :-)
13896 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13898 * class.cs: fixed compilation on windoze.
13900 2002-08-03 Martin Baulig <martin@gnome.org>
13902 * interface.cs (Interface.GetInterfaceBases): Check whether all
13903 base interfaces are at least as accessible than the current one.
13905 * class.cs (TypeContainer.GetClassBases): Check whether base types
13906 are at least as accessible than the current type.
13907 (TypeContainer.AsAccessible): Implemented and made non-static.
13908 (MemberBase.CheckParameters): Report errors if the accessibility
13911 * delegate.cs (Delegate.Delegate): The default visibility is
13912 internal for top-level types and private for nested types.
13913 (Delegate.Define): Report errors if the accessibility checks fail.
13915 * enum.cs (Enum.Enum): The default visibility is internal for
13916 top-level types and private for nested types.
13917 (Enum.DefineType): Compute the correct visibility.
13919 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
13920 function which takes a `bool is_toplevel' instead of a TypeContainer.
13922 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
13925 2002-08-02 Martin Baulig <martin@gnome.org>
13927 * expression.cs (LocalVariableReferenc): Added constructor which
13928 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
13929 (LocalVariableReference.IsReadOnly): New property.
13930 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
13931 variable is readonly, use our own readonly flag to do this; you can
13932 use the new constructor to get a writable reference to a read-only
13935 * cs-parser.jay (foreach_statement, using_statement): Get a writable
13936 reference to the local variable.
13938 2002-08-01 Miguel de Icaza <miguel@ximian.com>
13940 * rootcontext.cs (ResolveCore): Also include System.Exception
13942 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
13943 we reach an EmptyStatement.
13945 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
13948 * expression.cs (Binary.ResolveOperator): Check error result in
13951 use brtrue/brfalse directly and avoid compares to null.
13953 2002-08-02 Martin Baulig <martin@gnome.org>
13955 * class.cs (TypeContainer.Define): Define all nested interfaces here.
13956 Fixes bug #28407, added test-155.cs.
13958 2002-08-01 Martin Baulig <martin@gnome.org>
13960 * class.cs (Event.EmitDefaultMethod): Make this work with static
13961 events. Fixes #28311, added verify-3.cs.
13963 2002-08-01 Martin Baulig <martin@gnome.org>
13965 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
13966 `is_disposable' fields.
13967 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
13968 `hm.is_disposable' if we're using the collection pattern.
13969 (Foreach.EmitCollectionForeach): Use the correct type for the
13970 enumerator's local variable, only emit the try/finally block if
13971 necessary (fixes #27713).
13973 2002-08-01 Martin Baulig <martin@gnome.org>
13975 * ecore.cs (Expression.report118): Renamed to Error118 and made
13978 * statement.cs (Throw.Resolve): Check whether the expression is of
13979 the correct type (CS0118) and whether the type derives from
13980 System.Exception (CS0155).
13981 (Catch.Resolve): New method. Do the type lookup here and check
13982 whether it derives from System.Exception (CS0155).
13983 (Catch.CatchType, Catch.IsGeneral): New public properties.
13985 * typemanager.cs (TypeManager.exception_type): Added.
13987 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13989 * driver.cs: Updated About function.
13991 2002-07-31 Martin Baulig <martin@gnome.org>
13993 Implemented Control Flow Analysis.
13995 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13996 (EmitContext.CurrentBranching): Added.
13997 (EmitContext.StartFlowBranching): Added.
13998 (EmitContext.EndFlowBranching): Added.
13999 (EmitContext.KillFlowBranching): Added.
14000 (EmitContext.IsVariableAssigned): Added.
14001 (EmitContext.SetVariableAssigned): Added.
14002 (EmitContext.IsParameterAssigned): Added.
14003 (EmitContext.SetParameterAssigned): Added.
14004 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
14005 Added control flow analysis stuff here.
14007 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
14008 resolve the expression as lvalue.
14009 (LocalVariableReference.DoResolve): Check whether the variable has
14010 already been assigned.
14011 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
14012 the parameter as assigned here.
14013 (ParameterReference.DoResolve): Check whether the parameter has already
14015 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
14016 expression as lvalue.
14018 * statement.cs (FlowBranching): New class for the flow analysis code.
14019 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
14020 (LabeledStatement.IsDefined): New public property.
14021 (LabeledStatement.AddUsageVector): New public method to tell flow
14022 analyis that the label may be reached via a forward jump.
14023 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
14025 (VariableInfo.Number): New public field. This is used by flow analysis
14026 to number all locals of a block.
14027 (Block.CountVariables): New public property. This is the number of
14028 local variables in this block (including the locals from all parent
14030 (Block.EmitMeta): Number all the variables.
14032 * statement.cs: Added flow analysis support to all classes.
14034 2002-07-31 Martin Baulig <martin@gnome.org>
14036 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
14037 To get debugging messages, compile mcs with /define:MCS_DEBUG and
14038 then use this argument.
14040 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
14042 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
14043 use this to specify /define options.
14045 2002-07-29 Martin Baulig <martin@gnome.org>
14047 * statement.cs (Fixed): Moved all code that does variable lookups
14048 and resolvings from Emit to Resolve.
14050 * statement.cs (For): Moved all code that does variable lookups
14051 and resolvings from Emit to Resolve.
14053 * statement.cs (Using): Moved all code that does variable lookups
14054 and resolvings from Emit to Resolve.
14056 2002-07-29 Martin Baulig <martin@gnome.org>
14058 * attribute.cs (Attribute.Resolve): Explicitly catch a
14059 System.NullReferenceException when creating the
14060 CustromAttributeBuilder and report a different warning message.
14062 2002-07-29 Martin Baulig <martin@gnome.org>
14064 * support.cs (ParameterData.ParameterName): Added method to
14065 get the name of a parameter.
14067 * typemanager.cs (TypeManager.IsValueType): New public method.
14069 2002-07-29 Martin Baulig <martin@gnome.org>
14071 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
14072 is a flag which specifies that it's either ref or out.
14073 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
14074 the out parameter to `out Parameter.Modifier mod', also set the
14075 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
14077 * support.cs (InternalParameters.ParameterModifier): Distinguish
14078 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
14079 Parameter.Modifier.ISBYREF flag if it's either ref or out.
14081 * expression.cs (Argument.GetParameterModifier): Distinguish
14082 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
14083 Parameter.Modifier.ISBYREF flag if it's either ref or out.
14085 2002-07-29 Martin Baulig <martin@gnome.org>
14087 * expression.cs (ParameterReference.ParameterReference): Added
14088 `Location loc' argument to the constructor.
14090 * cs-parser.jay: Pass location to ParameterReference.
14092 2002-07-28 Miguel de Icaza <miguel@ximian.com>
14094 * statement.cs (Try): Initialize the location.
14096 * cs-parser.jay: pass location to Try.
14098 * expression.cs (Unary.Reduce): Change the prototype to return
14099 whether a constant fold could be performed or not. The result is
14100 returned in an out parameters. In the case of Indirection and
14101 AddressOf, we want to perform the full tests.
14103 2002-07-26 Miguel de Icaza <miguel@ximian.com>
14105 * statement.cs (Statement.Emit): Flag dead code.
14107 2002-07-27 Andrew Birkett <andy@nobugs.org>
14109 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
14111 2002-07-27 Martin Baulig <martin@gnome.org>
14113 * class.cs (MethodData.Define): Put back call to
14114 TypeManager.AddMethod(), accidentally commented this out.
14116 * report.cs (Debug): New public method to print debugging information,
14117 this is `[Conditional ("DEBUG")]'.
14119 2002-07-26 Martin Baulig <martin@gnome.org>
14121 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
14122 (switch_statement): Push the current_block to the switch_stack and
14123 pop it again when we're done with the switch.
14124 (switch_section): The new block is a child of the current_block.
14125 Fixes bug #24007, added test-152.cs.
14127 2002-07-27 Martin Baulig <martin@gnome.org>
14129 * expression.cs (Invocation.EmitArguments): When calling a varargs
14130 function with only its fixed arguments, we need to pass an empty
14133 2002-07-27 Martin Baulig <martin@gnome.org>
14135 Mono 0.13 has been released.
14137 2002-07-25 Miguel de Icaza <miguel@ximian.com>
14139 * driver.cs: Rename --resource to --linkres, because that is what
14140 we do currently, we dont support --resource yet.
14142 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
14144 2002-07-25 Martin Baulig <martin@gnome.org>
14146 * class.cs (MethodData): New public class. This is a `method builder'
14147 class for a method or one accessor of a Property/Indexer/Event.
14148 (MethodData.GetMethodFlags): Moved here from MemberBase.
14149 (MethodData.ApplyAttributes): Likewise.
14150 (MethodData.ApplyObsoleteAttribute): Likewise.
14151 (MethodData.ApplyConditionalAttribute): Likewise.
14152 (MethodData.ApplyDllImportAttribute): Likewise.
14153 (MethodData.CheckAbstractAndExternal): Likewise.
14154 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
14155 (MethodData.Emit): Formerly known as Method.Emit().
14156 (MemberBase): Moved everything which was specific to a single
14157 accessor/method to MethodData.
14158 (Method): Create a new MethodData and call Define() and Emit() on it.
14159 (Property, Indexer, Event): Create a new MethodData objects for each
14160 accessor and call Define() and Emit() on them.
14162 2002-07-25 Martin Baulig <martin@gnome.org>
14164 Made MethodCore derive from MemberBase to reuse the code from there.
14165 MemberBase now also checks for attributes.
14167 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
14168 (MemberBase.GetMethodFlags): Moved here from class Method and marked
14170 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
14171 `CallingConventions cc' and `Attributes opt_attrs' arguments.
14172 (MemberBase.ApplyAttributes): New virtual method; applies the
14173 attributes to a method or accessor.
14174 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
14175 (MemberBase.ApplyConditionalAttribute): Likewise.
14176 (MemberBase.ApplyDllImportAttribute): Likewise.
14177 (MemberBase.CheckAbstractAndExternal): Likewise.
14178 (MethodCore.ParameterTypes): This is now a property instead of a
14179 method, it's initialized from DoDefineParameters().
14180 (MethodCore.ParameterInfo): Removed the set accessor.
14181 (MethodCore.DoDefineParameters): New protected virtual method to
14182 initialize ParameterTypes and ParameterInfo.
14183 (Method.GetReturnType): We can now simply return the MemberType.
14184 (Method.GetMethodFlags): Override the MemberBase version and add
14185 the conditional flags.
14186 (Method.CheckBase): Moved some code from Define() here, call
14187 DoDefineParameters() here.
14188 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
14189 here to avoid some larger code duplication.
14190 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
14191 ensure that abstract and external accessors don't declare a body.
14193 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
14194 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
14195 lookup in the attribute's parent classes, so we need to abort as soon
14196 as we found the first match.
14197 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
14198 the attribute has no arguments.
14200 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
14203 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14205 * cs-parser.jay: reverted previous patch.
14207 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14209 * cs-parser.jay: fixed bug #22119.
14211 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14213 * attribute.cs: fixed compilation. The error was:
14214 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
14215 be assigned to before control leaves the current method."
14216 [FIXME: Filed as bug #28186: MCS must report this error.]
14218 2002-07-25 Martin Baulig <martin@gnome.org>
14220 * attribute.cs (Attribute.Conditional_GetConditionName): New static
14221 method to pull the condition name ouf of a Conditional attribute.
14222 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
14223 the obsolete message and error flag out of an Obsolete attribute.
14225 * class.cs (Method.GetMethodFlags): New public method to get the
14226 TypeManager.MethodFlags for this method.
14227 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
14229 (Method.Define): Get and apply the Obsolete and Conditional attributes;
14230 if we're overriding a virtual function, set the new private variable
14231 `parent_method'; call the new TypeManager.AddMethod().
14233 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
14234 the MethodBuilder and the Method in a PtrHashtable.
14235 (TypeManager.builder_to_method): Added for this purpose.
14236 (TypeManager.MethodFlags): Added IsObsoleteError.
14237 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
14238 Obsolete and Conditional arguments in MethodBuilders. If we discover
14239 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
14240 the message from the attribute.
14242 2002-07-24 Martin Baulig <martin@gnome.org>
14244 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
14245 preprocessor directives, ensure that the argument to #define/#undef is
14246 exactly one identifier and that it's actually an identifier.
14248 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
14251 2002-07-24 Martin Baulig <martin@gnome.org>
14253 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
14254 initialize it to TypeManager.object_type in the constructor.
14255 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
14256 of the `hm.get_current' method if we're using the collection pattern.
14257 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
14258 for the explicit conversion to make it work when we're using the collection
14259 pattern and the `Current' property has a different return type than `object'.
14262 2002-07-24 Martin Baulig <martin@gnome.org>
14264 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
14265 does not match, but don't report any errors. This method is called in
14266 order for all methods in a MethodGroupExpr until a matching method is
14267 found, so we don't want to bail out if the first method doesn't match.
14268 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
14269 matches, report the 123. Fixes #28070.
14271 2002-07-24 Martin Baulig <martin@gnome.org>
14273 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
14274 TypeManager.TypeToCoreType() to the top of the method so the
14275 following equality checks will work. Fixes #28107.
14277 2002-07-24 Martin Baulig <martin@gnome.org>
14279 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
14280 operand is of type uint, and the other operand is of type sbyte,
14281 short or int, the operands are converted to type long." -
14282 Actually do what this comment already told us. Fixes bug #28106,
14285 2002-07-24 Martin Baulig <martin@gnome.org>
14287 * class.cs (MethodBase): New abstract class. This is now a base
14288 class for Property, Indexer and Event to avoid some code duplication
14289 in their Define() and DefineMethods() methods.
14290 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
14291 generic methods for Define() and DefineMethods().
14292 (FieldBase): Derive from MemberBase, not MemberCore.
14293 (Property): Derive from MemberBase, not MemberCore.
14294 (Property.DefineMethod): Moved all the code from this method to the
14295 new MethodBase.DefineAccessor(), just call it with appropriate
14297 (Property.Define): Call the new Property.DoDefine(), this does some
14298 sanity checks and we don't need to duplicate the code everywhere.
14299 (Event): Derive from MemberBase, not MemberCore.
14300 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
14301 accessors, this will also make them work with interface events.
14302 (Indexer): Derive from MemberBase, not MemberCore.
14303 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
14304 (Indexer.Define): Use the new MethodBase functions.
14306 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
14307 argument to the constructor.
14308 (Interface.FindMembers): Added support for interface events.
14309 (Interface.PopluateEvent): Implemented.
14311 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
14313 2002-07-22 Miguel de Icaza <miguel@ximian.com>
14315 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
14316 but this is required to check for a method name being the same as
14317 the containing class.
14321 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14323 * interface.cs: initialize variable.
14325 2002-07-23 Martin Baulig <martin@gnome.org>
14327 Implemented the IndexerName attribute in interfaces.
14329 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
14330 name if this is an explicit interface implementation.
14331 (Indexer.InterfaceIndexerName): New public variable. If we're
14332 implementing an interface indexer, this is the IndexerName in that
14333 interface. Otherwise, it's the IndexerName.
14334 (Indexer.DefineMethod): If we're implementing interface indexer,
14335 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
14336 and Pending.ImplementIndexer methods.
14337 (Indexer.Define): Also define the PropertyBuilder if we're
14338 implementing an interface indexer and this is neither an explicit
14339 interface implementation nor do the IndexerName match the one in
14342 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
14343 If a method is defined here, then we always need to create a proxy
14344 for it. This is used when implementing interface indexers.
14345 (Pending.IsInterfaceIndexer): New public method.
14346 (Pending.ImplementIndexer): New public method.
14347 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
14348 This is used when implementing interface indexers to define a proxy
14350 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
14351 define a proxy if necessary.
14353 * interface.cs (Interface.IndexerName): New public variable.
14354 (Interface.PopulateIndexer): Set the IndexerName.
14355 (Interface.DefineIndexers): New private method. Populate all the
14356 indexers and make sure their IndexerNames match.
14358 * typemanager.cs (IndexerPropertyName): Added support for interface
14361 2002-07-22 Martin Baulig <martin@gnome.org>
14363 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
14364 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
14365 ret if HasReturnLabel.
14366 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
14369 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
14370 and set the ec.LoopBeginTryCatchLevel.
14371 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
14372 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
14373 the current ec.TryCatchLevel, the branch goes out of an exception
14374 block. In this case, we need to use Leave and not Br.
14376 2002-07-22 Martin Baulig <martin@gnome.org>
14378 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
14379 block unless the block does not always return or it is contained in
14380 another try { ... } catch { ... } block. Fixes bug #26506.
14381 Added verify-1.cs to the test suite.
14383 2002-07-22 Martin Baulig <martin@gnome.org>
14385 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
14386 then we do not always return. Fixes bug #24985.
14388 2002-07-22 Martin Baulig <martin@gnome.org>
14390 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
14391 lookup on a per-class level; ie. walk up the class hierarchy until we
14392 found at least one applicable method, then choose the best among them.
14393 Fixes bug #24463 and test-29.cs.
14395 2002-07-22 Martin Baulig <martin@gnome.org>
14397 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
14398 return types of the methods. The return type is not part of the
14399 signature and we must not check it to make the `new' modifier work.
14400 Fixes bug #27999, also added test-147.cs.
14401 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
14403 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
14404 on the method's return type.
14406 2002-07-21 Martin Baulig <martin@gnome.org>
14408 * assign.cs: Make this work if the rightmost source is a constant and
14409 we need to do an implicit type conversion. Also adding a few more tests
14410 to test-38.cs which should have caught this.
14412 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
14413 target in the makefile for this. The makefile.gnu is primarily intended
14414 for end-users who don't want to debug the compiler.
14416 2002-07-21 Martin Baulig <martin@gnome.org>
14418 * assign.cs: Improved the Assign class so it can now handle embedded
14419 assignments (X = Y = Z = something). As a side-effect this'll now also
14420 consume less local variables. test-38.cs now passes with MCS, added
14421 a few new test cases to that test.
14423 2002-07-20 Martin Baulig <martin@gnome.org>
14425 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
14426 instructions. Fixes bug #27977, also added test-146.cs.
14428 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14430 * cs-tokenizer.cs: fixed getHex ().
14432 2002-07-19 Martin Baulig <martin@gnome.org>
14434 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
14435 not Type.GetType() to lookup the array type. This is needed when
14436 we're constructing an array of a user-defined type.
14437 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
14438 single-dimensional arrays, but also for single-dimensial arrays of
14441 2002-07-19 Martin Baulig <martin@gnome.org>
14443 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
14444 this function is called, it's not allowed to share LocalBuilders
14445 among ILGenerators.
14447 2002-07-19 Martin Baulig <martin@gnome.org>
14449 * expression.cs (Argument.Resolve): Report an error 118 when trying
14450 to pass a type as argument.
14452 2002-07-18 Martin Baulig <martin@gnome.org>
14454 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
14455 Conv_R_Un for the signed `long' type.
14457 2002-07-15 Miguel de Icaza <miguel@ximian.com>
14459 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
14460 `expr' for the temporary result, as that will fail if we do
14461 multiple resolves on the same expression.
14463 2002-07-05 Miguel de Icaza <miguel@ximian.com>
14465 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
14466 ec.TypeContainer for looking up aliases.
14468 * class.cs (TypeContainer): Remove LookupAlias from here.
14470 * decl.cs (DeclSpace); Move here.
14472 2002-07-01 Miguel de Icaza <miguel@ximian.com>
14474 * class.cs (FindMembers): Only call filter if the constructor
14475 bulider is not null.
14477 Also handle delegates in `NestedTypes' now. Now we will perform
14478 type lookups using the standard resolution process. This also
14481 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
14482 This uses Expressions (the limited kind that can be parsed by the
14483 tree) instead of strings.
14485 * expression.cs (ComposedCast.ToString): Implement, used to flag
14486 errors since now we have to render expressions.
14488 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
14491 * ecore.cs (SimpleName.ToString): ditto.
14493 * cs-parser.jay: Instead of using strings to assemble types, use
14494 Expressions to assemble the type (using SimpleName, ComposedCast,
14495 MemberAccess). This should fix the type lookups in declarations,
14496 because we were using a different code path for this.
14498 * statement.cs (Block.Resolve): Continue processing statements
14499 even when there is an error.
14501 2002-07-17 Miguel de Icaza <miguel@ximian.com>
14503 * class.cs (Event.Define): Also remove the `remove' method from
14504 the list of pending items.
14506 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
14507 generate more compact code.
14509 2002-07-17 Martin Baulig <martin@gnome.org>
14511 * const.cs (Const.LookupConstantValue): Add support for constant
14512 `unchecked' and `checked' expressions.
14513 Also adding test case test-140.cs for this.
14515 2002-07-17 Martin Baulig <martin@gnome.org>
14517 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
14518 check whether mi.ReturnType implements the IEnumerator interface; the
14519 `==' and the IsAssignableFrom() will fail in this situation.
14521 2002-07-16 Ravi Pratap <ravi@ximian.com>
14523 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
14526 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14528 * expression.cs: fixed bug #27811.
14530 2002-07-14 Miguel de Icaza <miguel@ximian.com>
14532 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
14533 Molaro: when we are a ref, the value already contains a pointer
14534 value, do not take the address of it.
14536 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14537 * removed mb-parser.jay and mb-tokenizer.cs
14539 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14541 * expression.cs: check against the building corlib void type.
14543 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
14545 * ecore.cs: fix for valuetype static readonly fields: when
14546 initializing them, we need their address, not the address of a copy.
14548 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
14550 * typemanager.cs: register also enum_type in corlib.
14552 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14554 * class.cs: allow calling this (but not base) initializers in structs.
14556 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
14558 * ecore.cs: make sure we compare against the building base types
14561 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
14563 * typemanager.cs: fix TypeToCoreType() to handle void and object
14564 (corlib gets no more typerefs after this change).
14566 2002-07-12 Miguel de Icaza <miguel@ximian.com>
14568 * expression.cs (ArrayCreation.EmitArrayArguments): use
14569 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
14571 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
14572 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
14573 array indexes, the runtime actually forbids them.
14575 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
14576 for array arguments here.
14578 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
14579 instead of the default for ValueTypes.
14581 (New.DoEmit): Use IsValueType instead of
14582 IsSubclassOf (value_type)
14583 (New.DoResolve): ditto.
14584 (Invocation.EmitCall): ditto.
14586 * assign.cs (Assign): ditto.
14588 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
14589 Statements *are* currently doing part of their resolution during
14592 Expressions do always resolve during resolve, but statements are
14593 only required to propagate resolution to their children.
14595 2002-07-11 Miguel de Icaza <miguel@ximian.com>
14597 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
14599 (LoadAssembly): Do not add the dll if it is already specified
14601 (MainDriver): Add the System directory to the link path at the end,
14602 after all the other -L arguments.
14604 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
14605 wrong opcode for loading bytes and bools (ldelem.i1 instead of
14606 ldelem.u1) and using the opposite for sbytes.
14608 This fixes Digger, and we can finally run it.
14610 * driver.cs (UnixParseOption): Move the option parsing here.
14611 (CSCParseOption): Implement CSC-like parsing of options.
14613 We now support both modes of operation, the old Unix way, and the
14614 new CSC-like way. This should help those who wanted to make cross
14615 platform makefiles.
14617 The only thing broken is that /r:, /reference: and /lib: are not
14618 implemented, because I want to make those have the same semantics
14619 as the CSC compiler has, and kill once and for all the confussion
14620 around this. Will be doing this tomorrow.
14622 * statement.cs (Unsafe.Resolve): The state is checked during
14623 resolve, not emit, so we have to set the flags for IsUnsfe here.
14625 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14627 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
14628 not catch the Error_ObjectRefRequired in SimpleName (as it is
14629 possible to have a class/instance variable name that later gets
14630 deambiguated), we have to check this here.
14632 2002-07-10 Ravi Pratap <ravi@ximian.com>
14634 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
14635 make static and put into Expression.
14637 (Event.Define): Register the private field of the event with the
14638 TypeManager so that GetFieldFromEvent can get at it.
14640 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
14641 keep track of the private field associated with an event which
14644 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
14647 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
14649 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14651 * expression.cs (Binary.EmitBranchable): this routine emits the
14652 Binary expression in a branchable context. This basically means:
14653 we need to branch somewhere, not just get the value on the stack.
14655 This works together with Statement.EmitBoolExpression.
14657 * statement.cs (Statement.EmitBoolExpression): Use
14660 2002-07-09 Miguel de Icaza <miguel@ximian.com>
14662 * statement.cs (For): Reduce the number of jumps in loops.
14664 (For): Implement loop inversion for the For statement.
14666 (Break): We can be breaking out of a Try/Catch controlled section
14667 (foreach might have an implicit try/catch clause), so we need to
14668 use Leave instead of Br.
14670 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
14671 now). If the instace expression supports IMemoryLocation, we use
14672 the AddressOf method from the IMemoryLocation to extract the
14673 address instead of emitting the instance.
14675 This showed up with `This', as we were emitting the instance
14676 always (Emit) instead of the Address of This. Particularly
14677 interesting when This is a value type, as we dont want the Emit
14678 effect (which was to load the object).
14680 2002-07-08 Miguel de Icaza <miguel@ximian.com>
14682 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
14684 * statement.cs (Checked): Set the CheckedState during the resolve
14685 process too, as the ConvCast operations track the checked state on
14686 the resolve process, and not emit.
14688 * cs-parser.jay (namespace_member_declaration): Flag that we have
14689 found a declaration when we do. This is used to flag error 1529
14691 * driver.cs: Report ok when we display the help only.
14693 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
14695 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
14697 2002-07-04 Miguel de Icaza <miguel@ximian.com>
14699 * cs-tokenizer.cs (define): We also have to track locally the
14700 defines. AllDefines is just used for the Conditional Attribute,
14701 but we also need the local defines for the current source code.
14703 2002-07-03 Miguel de Icaza <miguel@ximian.com>
14705 * statement.cs (While, For, Do): These loops can exit through a
14706 Break statement, use this information to tell whether the
14707 statement is the last piece of code.
14709 (Break): Flag that we break.
14711 * codegen.cs (EmitContexts): New `Breaks' state variable.
14713 2002-07-03 Martin Baulig <martin@gnome.org>
14715 * class.cs (TypeContainer.MethodModifiersValid): Allow override
14716 modifiers in method declarations in structs. Otherwise, you won't
14717 be able to override things like Object.Equals().
14719 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14721 * class.cs (Method, Property, Indexer): Do not allow the public
14722 modifier to be used in explicit interface implementations.
14724 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
14725 override modifiers in method declarations in structs
14727 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
14729 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
14730 integer or real overflow, report an error
14732 2002-07-02 Martin Baulig <martin@gnome.org>
14734 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
14735 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
14736 to tell the runtime about our newly created System.Object and
14737 System.ValueType types.
14739 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14741 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
14742 struct instead of Ldarg/Starg.
14744 2002-07-02 Martin Baulig <martin@gnome.org>
14746 * expression.cs (Indirection.Indirection): Call
14747 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
14749 2002-07-02 Martin Baulig <martin@gnome.org>
14751 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
14752 ValueType, call TypeManager.TypeToCoreType() on it.
14753 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
14754 the OpCodes.Newarr argument.
14756 2002-07-02 Martin Baulig <martin@gnome.org>
14758 * expression.cs (Invocation.EmitCall): When compiling corlib,
14759 replace all calls to the system's System.Array type to calls to
14760 the newly created one.
14762 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
14763 System.Array methods.
14764 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
14765 from the system's System.Array type which must be replaced.
14767 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
14769 * typemanager.cs: load unverifiable_code_ctor so we can build
14770 corlib using the correct type. Avoid using GetTypeCode() with
14772 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
14773 TypeManager.object_type to allow building corlib.
14775 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
14777 * ecore.cs: handle System.Enum separately in LoadFromPtr().
14779 2002-07-01 Martin Baulig <martin@gnome.org>
14781 * class.cs: Make the last change actually work, we need to check
14782 whether `ifaces != null' to avoid a crash.
14784 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14786 * class.cs: when we build structs without fields that implement
14787 interfaces, we need to add the interfaces separately, since there is
14788 no API to both set the size and add the interfaces at type creation
14791 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14793 * expression.cs: the dimension arguments to the array constructors
14794 need to be converted if they are a long.
14796 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
14798 * class.cs: don't emit ldarg.0 if there is no parent constructor
14799 (fixes showstopper for corlib).
14801 2002-06-29 Martin Baulig <martin@gnome.org>
14803 MCS now compiles corlib on GNU/Linux :-)
14805 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
14806 ie. check for MethodImplOptions.InternalCall.
14808 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
14809 and TypeManager.attribute_type are null, so we must explicitly check
14810 whether parent is not null to find out whether it's an attribute type.
14811 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
14812 and SetBuilder, not only if the property is neither abstract nor external.
14813 This is necessary to set the MethodImplOptions on the accessor methods.
14814 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
14815 SetBuilder, see Property.Emit().
14817 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
14818 populate "System.Object", "System.ValueType" and "System.Attribute" since
14819 they've already been populated from BootCorlib_PopulateCoreTypes().
14821 2002-06-29 Martin Baulig <martin@gnome.org>
14823 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
14824 is the NullLiteral, we also need to make sure that target_type is not
14827 2002-06-29 Martin Baulig <martin@gnome.org>
14829 * rootcontext.cs (RootContext.ResolveCore): We must initialize
14830 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
14831 before calling BootstrapCorlib_ResolveDelegate ().
14833 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14835 * statement.cs: fixed build-breaker. All tests passed ok.
14837 2002-06-27 Martin Baulig <martin@gnome.org>
14839 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
14840 for System.Decimal when compiling corlib.
14842 2002-06-27 Martin Baulig <martin@gnome.org>
14844 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
14845 switch blocks which contain nothing but a default clause.
14847 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
14849 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
14851 2002-06-27 Martin Baulig <martin@gnome.org>
14853 * ecore.cs (PropertyExpr.PropertyExpr): Call
14854 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
14856 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
14857 is already a TypeBuilder.
14859 2002-06-27 Martin Baulig <martin@gnome.org>
14861 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
14862 `target_type == TypeManager.array_type', not IsAssignableFrom() in
14863 the "from an array-type to System.Array" case. This makes it work
14864 when compiling corlib.
14866 2002-06-27 Martin Baulig <martin@gnome.org>
14868 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
14869 non-static PropertyExpr, set its InstanceExpression. This makes
14870 the `ICollection.Count' property work in System/Array.cs.
14872 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
14874 * driver.cs: Made error handling more consistent. Errors now
14875 tracked by Report class, so many methods which used to return int
14876 now return void. Main() now prints success/failure and
14877 errors/warnings message.
14879 Renamed '--probe' compiler argument to '--expect-error'. Removed
14880 the magic number return values (123 and 124). Now, if the
14881 expected error occurs, the compiler exits with success (exit value
14882 0). If the compilation completes without seeing that particular
14883 error, the compiler exits with failure (exit value 1). The
14884 makefile in mcs/errors has been changed to handle the new behaviour.
14886 * report.cs: Made 'expected error' number a property and renamed
14887 it from 'Probe' to 'ExpectedError'.
14889 * genericparser.cs: Removed error handling support, since it is
14890 now all done by Report class.
14892 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
14893 class, so parse() no longer returns an int.
14895 * namespace.cs: Use Report.Error instead of GenericParser.error
14897 2002-06-22 Miguel de Icaza <miguel@ximian.com>
14899 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
14900 TypeContainer.AddOperator): At the front of the list put the
14901 explicit implementations, so they get resolved/defined first.
14903 2002-06-21 Miguel de Icaza <miguel@ximian.com>
14905 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
14906 interface type is implemented by this TypeContainer. Used during
14907 explicit interface implementation.
14909 (Property.Define, Indexer.Define, Method.Define): Validate that
14910 the given interface in the explicit implementation is one of the
14911 base classes for the containing type.
14913 Also if we are explicitly implementing an interface, but there is
14914 no match in the pending implementation table, report an error.
14916 (Property.Define): Only define the property if we are
14917 not explicitly implementing a property from an interface. Use the
14918 correct name also for those properties (the same CSC uses,
14919 although that is really not needed).
14921 (Property.Emit): Do not emit attributes for explicitly implemented
14922 properties, as there is no TypeBuilder.
14924 (Indexer.Emit): ditto.
14926 Hiding then means that we do not really *implement* a pending
14927 implementation, which makes code fail.
14929 2002-06-22 Martin Baulig <martin@gnome.org>
14931 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
14932 the return value of Object.GetType(). [FIXME: we need to do this whenever
14933 we get a type back from the reflection library].
14935 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
14937 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
14939 2002-06-20 Miguel de Icaza <miguel@ximian.com>
14941 * attribute.cs: Return null if we can not look up the type.
14943 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
14944 the interface types found.
14946 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
14947 interface types found.
14949 * typemanager.cs (GetInterfaces): Make this routine returns alll
14950 the interfaces and work around the lame differences between
14951 System.Type and System.Reflection.Emit.TypeBuilder in the results
14952 result for GetInterfaces.
14954 (ExpandInterfaces): Given an array of interface types, expand and
14955 eliminate repeated ocurrences of an interface. This expands in
14956 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
14959 2002-06-21 Martin Baulig <martin@gnome.org>
14961 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
14964 2002-06-21 Martin Baulig <martin@gnome.org>
14966 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
14967 and called with one of the core types, return the corresponding typebuilder for
14970 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14973 2002-06-21 Martin Baulig <martin@gnome.org>
14975 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14976 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14977 (Expression.ConvertReferenceExplicit): Likewise.
14979 * expression.cs (ElementAccess.DoResolve): Likewise.
14980 (ElementAccess.DoResolveLValue): Likewise.
14982 2002-06-10 Martin Baulig <martin@gnome.org>
14984 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14985 add the "value" parameter to the parameter list.
14987 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14990 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14992 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14993 the argument to an int, uint, long or ulong, per the spec. Also
14994 catch negative constants in array creation.
14996 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14998 * class.cs: do not allow the same interface to appear twice in
14999 the definition list.
15001 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
15003 * ecore.cs: don't use ldlen with System.Array.
15005 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
15007 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
15009 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
15011 * modifiers.cs: produce correct field attributes for protected
15012 internal. Easy fix so miguel can work on ther harder stuff:-)
15014 2002-06-18 Miguel de Icaza <miguel@ximian.com>
15016 * pending.cs: New file. Move the code from class.cs here.
15017 Support clearning the pending flag for all methods (when not doing
15018 explicit interface implementation).
15020 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
15022 * rootcontext.cs: added a couple more types needed to bootstrap.
15024 2002-06-17 Miguel de Icaza <miguel@ximian.com>
15026 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
15027 constructor in the type, instead of any constructor in the type
15028 hierarchy. Thanks to Paolo for finding this bug (it showed up as
15029 a bug in the Mono runtime when applying the params attribute).
15031 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
15032 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
15034 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
15036 * expression.cs (Unary.ResolveOperator): Use TypeManager
15037 to resolve the type.
15039 2002-06-13 Ravi Pratap <ravi@ximian.com>
15041 * cs-parser.jay (enum_member_declaration): Pass in the attributes
15044 * enum.cs (AddEnumMember): Add support to store the attributes associated
15045 with each member too.
15047 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
15048 field builders too - this takes care of the enum member case.
15050 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
15052 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
15053 address-of operator on both value types and pointers.
15055 2002-06-10 Martin Baulig <martin@gnome.org>
15057 * interface.cs (Interface.PopulateIndexer): Add the indexer's
15058 PropertyBuilder to the `property_builders' list.
15060 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
15061 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
15062 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
15063 find any indexers which are inherited from an interface.
15065 2002-06-09 Martin Baulig <martin@gnome.org>
15067 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
15068 the same type as the constant if necessary. There's also a test-130.cs
15071 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
15073 * typemanager.cs (TypeManager.ChangeType): Previously known as
15074 Enum.ChangeEnumType().
15076 2002-06-09 Martin Baulig <martin@gnome.org>
15078 * expression.cs (Cast.TryReduce): Added support for consts.
15080 2002-06-08 Ravi Pratap <ravi@ximian.com>
15082 * class.cs (Accessor): Hold attributes information so we can pass
15085 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
15086 Modify to pass in attributes attached to the methods.
15088 (add_accessor_declaration, remove_accessor_declaration): Ditto.
15090 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
15091 to handle the Accessor kind :-)
15093 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
15095 2002-06-08 Martin Baulig <martin@gnome.org>
15097 * expression.cs (Unary.TryReduceNegative): Added support for
15100 2002-06-08 Martin Baulig <martin@gnome.org>
15102 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
15103 name can't be found in the `defined_names' - the caller will do a
15104 MemberLookup in this case and thus find methods in System.Enum
15105 such as Enum.IsDefined().
15107 2002-06-08 Martin Baulig <martin@gnome.org>
15109 * enum.cs (Enum.ChangeEnumType): This is a custom version of
15110 Convert.ChangeType() which works with TypeBuilder created types.
15111 (Enum.LookupEnumValue, Enum.Define): Use it here.
15113 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
15114 `TypeBuilder.BaseType != null' check.
15115 (TypeContainer.FindMembers): Only lookup parent members if we
15116 actually have a parent.
15117 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
15118 (ConstructorInitializer.Resolve): Likewise.
15120 * interface.cs (Interface.FindMembers): Added
15121 `TypeBuilder.BaseType != null' check.
15123 * rootcontext.cs (RootContext.ResolveCore): Added
15124 "System.Runtime.CompilerServices.IndexerNameAttribute" to
15125 classes_second_stage.
15127 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
15128 debug_type and trace_type when compiling with --nostdlib.
15130 2002-06-07 Martin Baulig <martin@gnome.org>
15132 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
15133 (AddField): Set it to true when adding a non-static field.
15134 (DefineType): Use `have_nonstatic_fields' to find out whether we
15135 have non-static fields, not `Fields != null'.
15137 2002-06-02 Miguel de Icaza <miguel@ximian.com>
15139 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
15140 dereferencing a null on the static-field code path)
15142 2002-05-30 Martin Baulig <martin@gnome.org>
15144 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
15145 to take command line arguments. Use reflection to call the new
15146 custom `Initialize' function on the symbol writer and pass it the
15147 command line arguments.
15149 * driver.cs (--debug-args): New command line argument to pass command
15150 line arguments to the symbol writer.
15152 2002-05-28 Miguel de Icaza <miguel@ximian.com>
15154 * assign.cs (DoResolve): Forgot to do the implicit conversion to
15155 the target type for indexers and properties. Thanks to Joe for
15158 2002-05-27 Miguel de Icaza <miguel@ximian.com>
15160 * typemanager.cs (MethodFlags): returns the method flags
15161 (Obsolete/ShouldIgnore) that control warning emission and whether
15162 the invocation should be made, or ignored.
15164 * expression.cs (Invocation.Emit): Remove previous hack, we should
15165 not do this on matching a base type, we should do this based on an attribute
15167 Only emit calls to System.Diagnostics.Debug and
15168 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
15169 on the command line.
15171 * rootcontext.cs: Global settings for tracing and debugging.
15173 * cs-tokenizer.cs (define): New utility function to track
15174 defines. Set the global settings for TRACE and DEBUG if found.
15176 2002-05-25 Ravi Pratap <ravi@ximian.com>
15178 * interface.cs (Populate*): Pass in the TypeContainer as well as
15179 the DeclSpace as parameters so that we can create EmitContexts and
15180 then use that to apply attributes etc.
15182 (PopulateMethod, PopulateEvent, PopulateProperty)
15183 (PopulateIndexer): Apply attributes everywhere.
15185 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
15188 (ApplyAttributes): Update accordingly.
15190 We now apply interface attributes for all members too.
15192 2002-05-26 Miguel de Icaza <miguel@ximian.com>
15194 * class.cs (Indexer.Define); Correctly check if we are explicit
15195 implementation (instead of checking the Name for a ".", we
15196 directly look up if the InterfaceType was specified).
15198 Delay the creation of the PropertyBuilder.
15200 Only create the PropertyBuilder if we are not an explicit
15201 interface implementation. This means that explicit interface
15202 implementation members do not participate in regular function
15203 lookups, and hence fixes another major ambiguity problem in
15204 overload resolution (that was the visible effect).
15206 (DefineMethod): Return whether we are doing an interface
15209 * typemanager.cs: Temporary hack until we get attributes in
15210 interfaces (Ravi is working on that) and we get IndexerName
15211 support in interfaces.
15213 * interface.cs: Register the indexers as properties.
15215 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
15216 warning, I have verified that this is a bug in the .NET runtime
15217 (JavaScript suffers of the same problem).
15219 * typemanager.cs (MemberLookup): When looking up members for
15220 interfaces, the parent of an interface is the implicit
15221 System.Object (so we succeed in searches of Object methods in an
15222 interface method invocation. Example: IEnumerable x; x.ToString
15225 2002-05-25 Miguel de Icaza <miguel@ximian.com>
15227 * class.cs (Event): Events should also register if they do
15228 implement the methods that an interface requires.
15230 * typemanager.cs (MemberLookup); use the new GetInterfaces
15233 (GetInterfaces): The code used to lookup interfaces for a type is
15234 used in more than one place, factor it here.
15236 * driver.cs: Track the errors at the bottom of the file, we kept
15239 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
15240 instance if the method we are calling is static!
15242 2002-05-24 Miguel de Icaza <miguel@ximian.com>
15244 * attribute.cs (ApplyAttributes): Make this function filter out
15245 the IndexerName attribute (as that attribute in reality is never
15246 applied) and return the string constant for the IndexerName
15249 * class.cs (TypeContainer.Emit): Validate that all the indexers
15250 have the same IndexerName attribute, and if so, set the
15251 DefaultName attribute on the class.
15253 * typemanager.cs: The return value might contain other stuff (not
15254 only methods). For instance, consider a method with an "Item"
15255 property and an Item method.
15257 * class.cs: If there is a problem with the parameter types,
15260 2002-05-24 Ravi Pratap <ravi@ximian.com>
15262 * ecore.cs (ImplicitConversionExists): Wrapper function which also
15263 looks at user defined conversion after making a call to
15264 StandardConversionExists - we need this for overload resolution.
15266 * expression.cs : Update accordingly the various method calls.
15268 This fixes 2 bugs filed against implicit user defined conversions
15270 2002-05-22 Miguel de Icaza <miguel@ximian.com>
15272 * statement.cs: Track the result of the assignment.
15274 2002-05-21 Miguel de Icaza <miguel@ximian.com>
15276 * expression.cs (MemberAccess): Improved error reporting for
15277 inaccessible members.
15279 2002-05-22 Martin Baulig <martin@gnome.org>
15281 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
15282 itself with debugging support.
15284 2002-05-22 Martin Baulig <martin@gnome.org>
15286 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
15287 Removed, this isn't needed anymore.
15289 2002-05-20 Martin Baulig <martin@gnome.org>
15291 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
15292 be underlying type for an enum.
15294 2002-05-20 Miguel de Icaza <miguel@ximian.com>
15296 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
15297 that splits out the loading of just the core types.
15299 * rootcontext.cs (ResolveCore): Split the struct resolution in
15300 two, so we can load the enumeration underlying types before any
15303 * expression.cs (Is): Bandaid until we fix properly Switch (see
15304 bug #24985 for details).
15306 * typemanager.cs (ImplementsInterface): The hashtable will contain
15307 a null if there are no interfaces implemented.
15309 2002-05-18 Miguel de Icaza <miguel@ximian.com>
15311 * cs-parser.jay (indexer_declarator): It is fine to have array
15314 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15316 * typemanager.cs: (RegisterBuilder): New function used to register
15317 TypeBuilders that implement interfaces. Since
15318 TypeBuilder.GetInterfaces (as usual) does not work with lame
15320 (AddUserType): register interfaces.
15322 (ImplementsInterface): Use the builder_to_ifaces hash if we are
15323 dealing with TypeBuilder. Also, arrays are showing up as
15324 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
15325 methods can not be invoked on them!
15327 * ecore.cs (ExplicitReferenceConversionExists): Made public.
15328 (ImplicitReferenceConversionExists): Split out from
15329 StandardConversionExists.
15331 * expression.cs (As): We were only implementing one of the three
15332 cases for the as operator. We now implement them all.
15333 (Is): Implement the various other cases for Is as well.
15335 * typemanager.cs (CACHE): New define used to control if we want or
15336 not the FindMembers cache. Seems to have a negative impact on
15337 performance currently
15339 (MemberLookup): Nested types have full acess to
15340 enclosing type members
15342 Remove code that coped with instance/static returns for events, we
15343 now catch this in RealFindMembers.
15345 (RealFindMembers): only perform static lookup if the instance
15346 lookup did not return a type or an event.
15348 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15350 * assign.cs (CompoundAssign): We pass more semantic information
15351 now to Compound Assignments than we did before: now we have all
15352 the information at hand, and now we resolve the target *before* we
15353 do the expression expansion, which allows the "CacheValue" method
15354 to have the effect we intended (before, a [x] += 1 would generate
15355 two differen ArrayAccess expressions from the ElementAccess,
15356 during the resolution process).
15358 (CompoundAssign.DoResolve): Resolve target and original_source here.
15360 2002-05-16 Miguel de Icaza <miguel@ximian.com>
15362 * expression.cs (ArrayAccess): dropped debugging information.
15364 * typemanager.cs: Small bug fix: I was always returning i_members,
15365 instead of one of i_members or s_members (depending on which had
15368 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
15369 method is invoked before any code generation takes place, and it
15370 is a mechanism to inform that the expression will be invoked more
15371 than once, and that the method should use temporary values to
15372 avoid having side effects
15374 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
15376 * ecore.cs (Expression.CacheTemporaries): Provide empty default
15379 * expression.cs (Indirection, ArrayAccess): Add support for
15380 CacheTemporaries in these two bad boys.
15382 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
15383 ldobj or ldind_ref.
15384 (StoreFromPtr): Handle stobj as well.
15386 * expression.cs (UnaryMutator): Share more code.
15388 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
15389 down: I was not tracking the Filter function as well, which
15390 was affecting the results of the cache.
15392 2002-05-15 Miguel de Icaza <miguel@ximian.com>
15394 * attribute.cs: Remove the hack to handle the CharSet property on
15397 2002-05-14 Miguel de Icaza <miguel@ximian.com>
15399 * attribute.cs (DoResolve): More uglyness, we now only try to
15400 resolve the attribute partially, to extract the CharSet
15401 information (only if we are a StructLayout attribute). Otherwise
15403 (GetExtraTypeInfo): Add some code to conditionally kill in the
15404 future this. I am more and more convinced that the .NET
15405 framework has special code to handle the attribute setting on
15408 * expression.cs (IsParamsMethodApplicable): Revert my previous
15409 foreach change here, it was wrong.
15411 2002-05-13 Miguel de Icaza <miguel@ximian.com>
15413 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
15414 (pp_expr): do not abort on unknown input, just return.
15415 (eval): abort if there are pending chars.
15417 * attribute.cs (Attribute.Resolve): Positional parameters are
15418 optional. Deal with that case.
15420 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
15421 the Ansi/Unicode/Auto information for the type.
15423 (TypeContainer.DefineType): instantiate the EmitContext here, as
15424 we will be using it during the type definition (to resolve
15425 attributes) and during the emit phase.
15427 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
15428 to pull type information out of the attributes
15430 (Attribute.Resolve): track the constructor builder, and allow for
15431 multiple invocations (structs and classes will use this).
15433 * ecore.cs (MemberLookupFinal): new version with all the
15434 parameters customizable.
15436 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
15437 constructors. Return if the result value is null (as the error
15438 would have been flagged already by MemberLookupFinal)
15440 Do not allow instances of abstract classes or interfaces to be
15443 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
15444 We have to compare the assembly property here when dealing with
15445 FamANDAssem and Assembly access modifiers, because we might be
15446 creating an assembly from *modules* (that means that we are not
15447 getting TypeBuilders for types defined in other modules that are
15448 part of this assembly).
15450 (Method.Emit): If the method is marked abstract and has a body,
15453 (TypeContainer.DefineMembers): If both the defined member and the
15454 parent name match are methods, then do not emit any warnings: let
15455 the Method.Define routine take care of flagging warnings. But if
15456 there is a mismatch (method overrides something else, or method is
15457 overriwritten by something, then emit warning).
15459 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
15460 set to null, this means `do not check for the return type on the
15463 (Method.Define): set the return type for the method signature to
15464 null, so that we get methods with the same name and parameters and
15465 different return types. This is used to flag warning 114 (you are
15466 hiding a method, and you probably want to use the new/override
15469 * typemanager.cs (MemberLookup): Implemented proper access
15470 control, closing a long standing set of bug reports. The problem
15471 was that the Framework only has two bits: Public and NonPublic,
15472 and NonPublic includes private and protected methods, but we need
15473 to enforce the FamANDAssem, FamOrAssem and Family.
15475 2002-05-11 Miguel de Icaza <miguel@ximian.com>
15477 * statement.cs (GotoCase): Return true: Ammounts to giving up
15478 knowledge on whether we return or not, and letting the other case
15479 be responsible for it.
15481 2002-05-10 Miguel de Icaza <miguel@ximian.com>
15483 * driver.cs: Do not load directories for each file processed, only
15484 do it if there is a pattern.
15486 * ecore.cs: Report readonly assigns here as well, as we might have
15487 been resolved only by MemberAccess.
15489 (SimpleName.SimpleNameResolve): Also be useful for LValue
15490 resolution. We need this to propagate assign to local readonly variables
15492 * typemanager.cs: Use a ptrhashtable for the criteria, because we
15493 do not want to reuse potential criteria memory.
15495 * class.cs (MyEventBuilder): Set reflected_type;
15497 * ecore.cs (Constantify): Added support for constifying bools.
15499 (RootContext.LookupType): Added a cache for values looked up in
15500 the declaration space.
15502 * typemanager.cs (FindMembers): Now is a front-end to
15503 RealFindMembers, and provides a two-level hashtable-based cache to
15506 15% performance improvement: from 22.5 to 19.2 seconds.
15508 * expression.cs (IsParamsMethodApplicable): use foreach.
15509 (Invocation.DoResolve): ditto.
15510 (New.DoResolve): ditto.
15511 (ArrayCreation.DoResolve): ditto.
15513 * ecore.cs (FindMostEncompassingType): use foreach.
15515 * delegate.cs (NewDelegate.DoResolve): Use foreach
15517 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
15518 (RemoveMethods): use foreach.
15520 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
15521 nested foreach statements instead of for, and also break out of
15522 the inner loop once a match is found.
15524 (Invocation.OverloadResolve): Use foreach, simplify the code.
15526 2002-05-08 Miguel de Icaza <miguel@ximian.com>
15528 * cfold.cs (BinaryFold): During an enumeration evaluation context,
15529 we actually unwrap the expression to allow for extra information
15532 * expression.cs: Use Shr_Un on unsigned operations.
15534 2002-05-08 Ravi Pratap <ravi@ximian.com>
15536 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
15537 applicable operators was not being considered correctly. This closes
15538 the bug Miguel reported.
15540 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
15542 * attribute.cs: check that the type derives from System.Attribute
15543 and report the correct error in that case (moved the duplicate code to
15544 its own method, too).
15546 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
15548 * attribute.cs: lookup attribute type name as the spec says: first the
15549 bare attribute name and then name + "Attribute" (nant compiles with
15550 mcs after this fix).
15552 2002-05-07 Miguel de Icaza <miguel@ximian.com>
15554 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
15555 Because of the way we parse things, we should try to see if a
15556 UIntConstant can fit in an integer.
15558 2002-05-07 Ravi Pratap <ravi@ximian.com>
15560 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
15561 when we are in an explicit context.
15563 (ConvertReferenceExplicit): When converting from Iface type S to Class
15564 T make sure the rules are implemented as an OR.
15566 * parameter.cs (ParameterType): Make it a property for now although the
15567 purpose really isn't anything immediate.
15569 * expression.cs (Is*Applicable): Do better checking on the parameter type
15570 of a ref/out parameter. The ones from the system assemblies are already
15571 marked with the correct type so we don't need to do any correction.
15573 * ecore.cs (StandardConversionExists): Conversion from Interface types to
15574 the object type is standard too so include that.
15576 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15578 * ecore.cs (StandardConversionExists): Augment with missing code:
15579 deal with IntConstant, LongConstants and Enumerations.
15581 * assign.cs: Report the error, instead of failing silently
15583 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
15584 typecontainer that they are declared, because the
15585 typecontainer/namespace will have the list of using clauses that
15586 need to be applied.
15588 Assembly Attributes were escaping the normal registration
15591 (EmitCode): Apply attributes within an EmitContext that represents
15592 the container they were declared on.
15594 * cs-parser.jay: Track bases for structs. How did I get this wrong?
15596 2002-05-06 Ravi Pratap <ravi@ximian.com>
15598 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
15599 Revamp completely - make much cleaner as we now operate only
15602 (FindMostSpecificSource, FindMostSpecificTarget): New methods
15603 to implement the logic detailed in the spec more correctly.
15605 (UserDefinedConversion): Update accordingly.
15607 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15609 * statement.cs: Return flow analysis information up.
15611 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
15614 (token): Do not consume an extra character before calling
15617 2002-05-06 Piers Haken <piersh@friskit.com>
15619 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
15621 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15623 * class.cs (Constructor.Emit): Set the IsStatic flag in the
15624 EmitContext during the instance constructor initializer
15625 resolution, to stop access to instance variables.
15627 This is mandated by the spec, last paragraph of the `constructor
15628 initializers' section.
15630 2002-05-05 Miguel de Icaza <miguel@ximian.com>
15632 * cs-parser.jay, class.cs (Accessor): new class used to represent
15633 an accessor (get or set). In the past we used `null' to represent
15634 a missing accessor. But this is ambiguous because there was no
15635 way to tell in abstract indexers/properties if one of them was
15638 Now there is a way of addressing that.
15640 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
15641 instead of FindMembers.
15643 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
15644 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
15646 * attribute.cs: Treat indexers and properties as the same in terms
15647 of applying attributes
15649 * ecore.cs (FindMostEncompassedType): Use statically initialized
15650 EmptyExpressions()s like we do elsewhere to avoid creating useless
15651 objects (and we take this out of the tight loop).
15653 (GetConversionOperators): Move the code to extract the actual
15654 operators to a separate routine to clean things up.
15656 2002-05-04 Miguel de Icaza <miguel@ximian.com>
15658 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
15659 events are always registered FieldBuilders.
15661 * class.cs (FieldBase): New class shared by Fields
15663 * delegate.cs: If we are a toplevel delegate, use our full name.
15664 If we are a nested delegate, then only use our tail name.
15666 2002-05-02 Ravi Pratap <ravi@ximian.com>
15668 * expression.cs (IsApplicable): Ensure that we add the "&" to
15669 ref/out types before comparing it with the type of the argument.
15671 (IsParamsMethodApplicable): Ditto.
15673 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
15676 * delegate.cs : Handle the case when we have more than one applicable
15677 method. Flag an error only when we finish checking all.
15679 2002-05-02 Miguel de Icaza <miguel@ximian.com>
15681 * expression.cs: Add support for boolean static initializers.
15683 2002-05-01 Miguel de Icaza <miguel@ximian.com>
15685 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
15687 * parameter.cs (ComputeParameterTypes,
15688 ComputeAndDefineParameterTypes): Better error handling: now we
15689 clear the `types' cache if we fail during any of the type lookups.
15690 We also return the status code correctly to our caller
15692 * delegate.cs: If we fail to define a delegate, abort the extra
15695 * expression.cs (Binary.ResolveOperator): for
15696 operator==(object,object) and operator !=(object, object) we also
15697 have to verify that there is an implicit conversion from one to
15700 (ArrayAccess.DoResolve): Array Access can operate on
15703 2002-04-30 Miguel de Icaza <miguel@ximian.com>
15705 * assign.cs (CompoundAssign): A new class used as a "flag" that
15706 the assignment actually is happening as part of a compound
15707 assignment operator.
15709 During compound assignment, a few new rules exist to enable things
15716 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
15717 to the type of x) if y is implicitly convertible to the type of x,
15718 and the operator is a builtin operator and the return type of the
15719 operator is explicitly convertible to the type of x.
15721 * rootcontext.cs: Reset warning level to 2. 4 catches various
15722 "interesting" features in mcs, we must clean this up at some
15723 point, but currently am trying to kill other bugs ;-)
15725 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
15726 in container classes as well.
15728 * expression.cs (Binary.ResolveOperator): Handle string case
15729 before anything else (as operator overloading does emit an error
15730 before doing anything else).
15732 This code could go away when we move to a table driven model, but
15733 i could not come up with a good plan last night.
15735 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
15737 * typemanager.cs (CSharpName): reimplementation using regex.
15738 * class.cs: added null check for fields in Emit
15739 * rootcontext.cs: set warninglevel to 4
15741 2002-04-29 Miguel de Icaza <miguel@ximian.com>
15743 * typemanager.cs (CSharpName): reimplemented with Lupus
15746 2002-04-28 Miguel de Icaza <miguel@ximian.com>
15748 * statement.cs (If): correclty implement Resolve, because we were
15749 not catching sem errors in there. The same process is needed
15751 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
15754 (Statement.Warning_DeadCodeFound): Factorize code.
15755 (While): Report dead code here too.
15757 (Statement): Added Resolve virtual method to allow
15758 for resolution split from the emit code.
15760 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15762 * statement.cs (EmitBoolExpression): No longer try to resolve the
15764 (MakeBoolean): New utility function that resolve, implicitly
15765 converts to boolean and tags the expression.
15768 (If, Do): Implement dead code elimination.
15769 (While): Implement loop inversion
15771 (Do, While, For, If): Resolve the expression prior to calling our
15774 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
15777 - added method Report28 (warning: program has more than one entry point)
15778 - added method IsEntryPoint, implements paragraph 10.1 of the spec
15779 - modified method Method.Define, the part at the end of the method
15781 * rootcontext.cs: added static public Location EntryPointLocation;
15783 * ../errors/cs0028.cs : Add test case for the above warning.
15786 - modified method CSharpName to allow arrays of primitive type to
15787 be printed nicely (e.g. instead of System.Int32[][] it now prints
15789 - added method CSharpSignature: returns the signature of a method
15790 in string format to be used in reporting errors, warnings, etc.
15792 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
15795 2002-04-26 Ravi Pratap <ravi@ximian.com>
15797 * delegate.cs (Define): Fix extremely silly bug where I was
15798 setting the type of the 'object' parameter of the BeginInvoke
15799 method to System.IAsyncResult instead of System.Object ;-)
15801 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15803 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
15806 (Constructor.Emit): return if we fail to initialize the
15807 constructor. Another door closed!
15809 * expression.cs (New.DoResolve): Improve error message (from -6 to
15810 1501). Use DeclaredOnly lookup to find the exact constructor.
15812 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
15813 loop. This is useful.
15815 * cs-parser.jay: Adjust the default parameters so that destructors
15816 have the proper signature.
15818 2002-04-26 Martin Baulig <martin@gnome.org>
15820 * driver.cs (LoadAssembly): If `assembly' contains any characters
15821 which are only valid in path names and not in assembly names
15822 (currently slash, backslash and point), use Assembly.LoadFrom ()
15823 instead of Assembly.Load () on the `assembly' (before iteration
15824 over the link_paths).
15826 2002-04-26 Martin Baulig <martin@gnome.org>
15828 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
15830 2002-04-25 Miguel de Icaza <miguel@ximian.com>
15832 * class.cs (Property): use the new typemanager.MemberLookup
15834 (TypeContainer.MemberLookup): Implement using the
15835 TypeManager.MemberLookup now.
15837 * typemanager.cs: Make MemberLookup a function of the TypeManager,
15838 and return MemberInfos, so that these can be used without an
15839 EmitContext (what we had before).
15841 2002-04-24 Miguel de Icaza <miguel@ximian.com>
15843 * expression.cs: Fix the case where the argument to params if the
15844 type of the params. I omitted handling this before. Fixed
15846 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15848 * driver.cs: Call BootCorlib_PopulateCoreType
15850 * class.cs (Property.CheckBase): Check for properties only, not
15853 * interface.cs: Temporary hack: try/catch around the
15854 CustomAttributeBuilder, because I am getting an exception that I
15857 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
15858 types whose definitions are required to be there (attributes are
15859 defined before standard types).
15861 Compute definitions as we boot the various types, as they are used
15862 immediately (value_type class will need object_type, but if we do
15863 not initialize object_type, we will pass a null, which will let
15864 the runtime pick the System.Object from the existing corlib, which
15865 is not what we want).
15867 2002-04-22 Patrik Torstensson <totte@labs2.com>
15869 * cs-tokenizer.cs: fixed a number of trim() issues.
15871 2002-04-22 Ravi Pratap <ravi@ximian.com>
15873 * expression.cs (Argument.Type): Ensure that we return the correct
15874 type when we have out or ref parameters [in which case we
15877 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15879 * class.cs (Property, Indexer): Allow extern modifier in there.
15881 * typemanager.cs (InitBaseTypes): Initializes object_type and
15882 value_type, since those will be used early on during the bootstrap
15883 process to compile corlib.
15885 (InitCoreTypes): Move code from here to InitBaseTypes.
15887 2002-04-21 Miguel de Icaza <miguel@ximian.com>
15889 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
15890 single-dimension arrays as using the ldlen opcode.
15892 Daniel Lewis discovered this optimization.
15894 * typemanager.cs: Add signature for System.Array::get_Length
15896 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15898 * statement.cs: report the error when the foreach does not apply to an
15899 array nor a collection.
15901 2002-04-19 Miguel de Icaza <miguel@ximian.com>
15903 * expression.cs: Add implicit conversions to the operator ~.
15905 * constant.cs (DecimalConstant.Emit): Emit decimal value.
15907 * typemanager.cs: Locate the decimal constructor.
15909 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15911 * attribute.cs: use the new property of TypeOf.
15912 * expression.cs: added 'get' property around typearg.
15914 These changes fix a build breaker reported by NickD. Is this the
15915 correct way to fix? If not, please, revert my changes and make it
15918 2002-04-17 Miguel de Icaza <miguel@ximian.com>
15920 * attribute.cs: Add support for typeof in attribute invocations.
15921 I am not sure that this is right though.
15923 2002-04-14 Duncan Mak <duncan@ximian.com>
15925 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
15926 Binary.Operator.Division case.
15928 2002-04-13 Ravi Pratap <ravi@ximian.com>
15930 * class.cs (DefineType): Ensure that we do a proper check on
15931 attribute types and also register it with the TypeManager.
15933 (TypeContainer.Targets): The default for attribute types is
15934 AttributeTargets.All.
15936 * attribute.cs (ApplyAttributes): Registering the attribute type
15937 is done elsewhere, not when we discover we have a Usage attribute.
15939 2002-04-12 Ravi Pratap <ravi@ximian.com>
15941 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
15942 and get rid of is_delegate parameter.
15944 * everywhere : update.
15946 2002-04-12 Ravi Pratap <ravi@ximian.com>
15948 * cs-parser.jay (compilation_unit): Revamp completely to use
15949 some new ideas that I got from Rhys' grammar to solve the problems
15950 with assembly level attributes.
15952 (outer_declaration): New grammar production.
15954 (attribute_sections): Add.
15956 (opt_attributes): Base on attribute_sections
15958 (namespace_declaration): Allow opt_attributes to tackle the case
15959 when we have assembly level attributes - we are clever in this
15962 * attribute.cs (ApplyAttributes): Do not worry about assembly
15963 attributes in the non-global context.
15965 * rootcontext.cs (AddGlobalAttributes): Go back to using this
15966 instead of SetGlobalAttributes.
15968 * class.cs, rootcontext.cs : Ensure we define and generate
15969 attribute types before anything else.
15971 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15972 and flag the new error -20 for the case when the attribute type
15973 does not have valid targets specified. csc does not catch this.
15975 * ../errors/errors.txt : update for error # -20
15977 2002-04-11 Ravi Pratap <ravi@ximian.com>
15979 * support.cs (InternalParameters.ParameterModifier): Do some null
15980 checking and return sane values.
15982 * class.cs (Method.Define): If we are a PInvoke method, ensure
15983 that we are static and extern. Report error # 601
15985 * ../errors/cs0601.cs : Add test case for the above error.
15987 2002-04-07 Ravi Pratap <ravi@ximian.com>
15989 * rootcontext.cs (attribute_types): We need to keep type of
15990 all attribute types separately and emit code for them first.
15992 (RegisterAttribute) : Implement.
15994 * class.cs (DefineType): Check if the current Type is a custom
15995 attribute type and register it accordingly.
15997 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15998 adding the first attribute twice and rename to
16000 (SetGlobalAttributes): this.
16002 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
16005 * attribute.cs (ApplyAttributes): Take an additional argument telling us
16006 if we are processing global arguments. Hmm, I am unsure of this.
16008 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
16010 * expression.cs: added static array of strings to avoid calling
16011 Enum.ToString () for Operator in Binary. Significant recover of
16014 2002-04-10 Miguel de Icaza <miguel@ximian.com>
16016 * class.cs (FindMembers): Allow the Builders of the various
16017 members to be null. If they are skip them. This only happens
16018 during the PInvoke declaration.
16020 2002-04-09 Miguel de Icaza <miguel@ximian.com>
16022 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
16023 failure, so we do not keep going afterwards.
16025 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
16026 wanted to pass `false' as the `is_delegate' argument. If this is
16027 the case, why not use delegate_type == null to mean `is_delegate =
16028 false' and anything else as is_delegate = true.
16030 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
16032 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
16033 code for the section, not the beginning of the tests.
16035 2002-04-08 Miguel de Icaza <miguel@ximian.com>
16037 * cfold.cs: Handle operator + (Enum x, Underlying x)
16039 * expression.cs (Binary): same. Warn about errors where we have
16040 Enum/Enum in operator + as well.
16042 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
16045 - added support for switch(bool)
16046 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
16047 - add TableSwitchEmit() to handle table-based switch statements
16049 2002-04-05 Ravi Pratap <ravi@ximian.com>
16051 * expression.cs (Invocation.OverloadResolve): Factor out code which
16052 does parameter compatibility checking with arguments so that we can
16053 re-use the code even from Delegate.VerifyApplicability
16055 (VerifyArgumentsCompat): Move above code here.
16057 * delegate.cs (VerifyApplicability): Get rid of duplicate code
16058 and instead make a call to the above method.
16060 2002-03-31 Ravi Pratap <ravi@ximian.com>
16062 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
16063 We use it to keep track of classes which are attribute types.
16065 2002-04-02 Miguel de Icaza <miguel@ximian.com>
16067 * delegate.cs (Delegate.Define): Correctly define the types in the
16068 presence of fixed and array parameters.
16070 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
16073 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
16074 include NonPublic after the first iteration.
16076 * class.cs (Indexer.CheckBase): Only check if both parents are
16079 * cs-parser.jay (accessor_body): If empty, set to null.
16081 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
16082 same code path here to resolve constants names that we did have in
16083 MemberAccess.DoResolve. There is too much code duplicated here.
16085 2002-04-01 Miguel de Icaza <miguel@ximian.com>
16087 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
16089 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
16092 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
16093 tokens, numbers and strings.
16095 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
16098 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
16099 asyncronous parameters and the regular parameters.
16101 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
16102 specify the target directory.
16104 * expression.cs: (This.DoResolve): Simplify
16105 (As.Emit): Optimize, do not generate IsInst if the expression is
16106 always of the given type.
16108 (Is.DoResolve): Bug fix, we were reporting both always/never for
16111 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
16112 creating too many unnecessary arrays.
16114 2002-03-31 Miguel de Icaza <miguel@ximian.com>
16116 * class.cs (EmitFieldInitializer): Use Assign expression to assign
16117 fields instead of rolling our own initializer. Takes care of all
16118 implicit conversions, and drops unnecessary static checks/argument.
16120 2002-03-31 Dick Porter <dick@ximian.com>
16122 * driver.cs: use the GetDirectories() return values properly, and
16123 use "/" as path separator.
16125 2002-03-30 Miguel de Icaza <miguel@ximian.com>
16127 * expression.cs (Unary): Optimize - - expr into expr.
16128 (Binary): Optimize a + (-b) into a -b.
16130 * codegen.cs (CodeGen): Made all methods static.
16132 2002-03-29 Miguel de Icaza <miguel@ximian.com>
16136 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
16137 TypeBuilder property.
16139 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
16142 * tree.cs: Removed the various RecordXXXX, and replaced with a
16143 single RecordDecl. Removed all the accessor methods, and just
16144 left a single access point Type
16146 * enum.cs: Rename DefineEnum to DefineType.
16148 * decl.cs: New abstract method `DefineType' used to unify the
16149 Defines for Enumerations, Interfaces, TypeContainers and
16152 (FindType): Moved LookupInterfaceOrClass here. Moved the
16153 LookupBaseClasses method that used to live in class.cs and
16154 interface.cs here, and renamed to FindType.
16156 * delegate.cs: Implement DefineType. Take advantage of the
16157 refactored pattern for locating the parent builder without taking
16158 the parent_builder argument (which we know does not work if we are
16159 nested, and triggering a toplevel definition).
16161 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16163 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
16164 accessibility of a member has changed during override and report
16167 * class.cs (Method.Define, Property.Define): Only complain on
16168 overrides if the method is private, any other accessibility is
16169 fine (and since we just checked the permission is the same, we are
16172 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
16173 and elif are processed always. The other pre-processing
16174 directives are only processed if we are "taking" the path
16176 2002-03-29 Martin Baulig <martin@gnome.org>
16178 * class.cs (Method.Emit): Only emit symbolic debugging info if the
16179 current location is not Null.
16181 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
16182 a separate method so we can profile it.
16184 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
16185 `span.Seconds' are just seconds, but no minutes or hours.
16186 (MainDriver): Profile the CodeGen.SaveSymbols calls.
16188 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16190 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
16191 Remove the gratuitous set of Final:
16193 // If an interface implementation, then we can set Final.
16194 if (((flags & MethodAttributes.Abstract) == 0) &&
16195 implementing.DeclaringType.IsInterface)
16196 flags |= MethodAttributes.Final;
16198 I do not know what I was smoking when I used that.
16201 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
16202 step into fixing the name resolution issues for delegates and
16203 unifying the toplevel name resolution.
16205 2002-03-28 Martin Baulig <martin@gnome.org>
16207 * class.cs (Method.Emit): If we have a symbol writer, call its
16208 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
16209 tell it about the current method.
16211 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
16212 writer that we're going to emit the first byte of IL code for a new
16213 statement (a new source line).
16214 (EmitContext.EmitTopBlock): If we have a symbol writer, call
16215 EmitContext.Mark() before emitting any code.
16217 * location.cs (SymbolDocument): Return null when we're Null.
16219 * statement.cs (Statement): Moved the `Location loc' variable here.
16220 (Statement.EmitBoolExpression): If we have a symbol writer, call
16221 ec.Mark() before emitting any code to tell it that we're at the
16222 beginning of a new statement.
16223 (StatementExpression): Added `Location' argument to the constructor.
16224 (Block): Added public readonly variable `StartLocation' and public
16225 variable `EndLocation'. The latter is to be set using SetEndLocation().
16226 (Block): Added constructor which takes a start and end location.
16227 (Block.SetEndLocation): New method. This sets the end location.
16228 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
16229 local variables we create.
16230 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
16231 each statement and do also mark the begin and end of the block.
16233 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
16234 tell it the current lexer.Location, use Location.Null for the end of the
16236 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
16237 current block, set its end location using SetEndLocation().
16238 (statement_expression): StatementExpression constructor now takes the
16239 lexer.Location as additional argument.
16240 (for_statement, declare_local_variables): Likewise.
16241 (declare_local_variables): When creating a new implicit block, use the
16242 new Block constructor and pass it the lexer.Location.
16244 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16246 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
16247 members also on the parent interfaces recursively.
16249 2002-03-27 Miguel de Icaza <miguel@ximian.com>
16251 * report.cs: Use new formats, since Gonzalo finished the missing
16254 * expression.cs (Binary.ResolveOperator): added missing operator|
16255 operator& and operator^ for bool/bool.
16257 * cs-parser.jay: CheckDef now takes a Location argument that is
16258 used to report errors more precisly (instead of reporting the end
16259 of a definition, we try to track something which is a lot closer
16260 to the source of the problem).
16262 * cs-tokenizer.cs: Track global token use, so we can properly flag
16263 the use of #define/#undef after the first token has been seen.
16265 Also, rename the reportXXXX to Error_DescriptiveName
16267 * decl.cs (DeclSpace.IsTopLevel): Move property here from
16268 TypeContainer, so that Enum and Interface can use this too.
16270 * class.cs (TypeContainer.LookupInterfaceOrClass,
16271 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
16272 `builder' argument. Typically this was used to pass the parent
16273 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
16276 The problem is that a nested class could trigger the definition of
16277 a toplevel class, and the builder would be obviously wrong in that
16280 So we drop this argument, and we compute dynamically the
16281 TypeBuilder/ModuleBuilder (the correct information was available
16282 to us anyways from DeclSpace.Parent)
16284 * interface.cs (Interface.DefineInterface): Drop builder
16285 parameter cleanup like class.cs
16287 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
16290 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
16293 (Try.Emit): Propagate the returns value from the statement.
16295 (Return.Emit): Even if we are leavning
16297 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
16299 * modifiers.cs: Fix the computation of MethodAttributes flags.
16301 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
16303 * driver.cs: allow compilation of files that start with '/'.
16304 Add a default case when checking the argument of --target.
16306 2002-03-25 Miguel de Icaza <miguel@ximian.com>
16308 * interface.cs: Implement the same search algorithm for types in
16309 the interface code.
16311 * delegate.cs: Do not allow multiple definition.
16313 * Recovered ChangeLog that got accidentally amputated
16315 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
16317 * rootcontext.cs: Load manually enum to allow core classes to
16318 contain enumerations.
16320 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
16321 Update to new static methods in TypeManager.
16323 * typemanager.cs (GetMethod, GetConstructor): Use our
16324 implementation of FindMembers to find the members, since during
16325 corlib compilation, the types are TypeBuilders and GetMethod and
16326 GetConstructor do not work.
16328 Make all methods in TypeManager static.
16330 (InitCodeHelpers): Split the functionality from
16331 the InitCodeTypes function.
16333 * driver.cs: Call InitCodeHelpers after we have populated the
16336 * cs-parser.jay (delegate_declaration): we did not used to compute
16337 the delegate name correctly for void delegates.
16339 2002-03-24 Miguel de Icaza <miguel@ximian.com>
16341 * rootcontext.cs (RootContext): Init the interface_resolve_order
16342 and type_container_resolve_order always.
16344 (ResolveCore, BootstrapCorlib_ResolveClass,
16345 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
16346 compiler when compiling with --nostdlib
16348 * class.cs (TypeContainer.DefineType): Check that our parent is
16349 not null. This test is most important when we are bootstraping
16352 * codegen.cs: Split out the symbol writing code.
16354 2002-03-25 Martin Baulig <martin@gnome.org>
16356 * driver.cs (-g): Made -g an alias for --debug.
16358 2002-03-24 Martin Baulig <martin@gnome.org>
16360 * codegen.cs (SymbolWriter): New public variable. Returns the
16361 current symbol writer.
16362 (CodeGen): Added `bool want_debugging_support' argument to the
16363 constructor. If true, tell the ModuleBuild that we want debugging
16364 support and ask it for the ISymbolWriter.
16365 (Save): If we have a symbol writer, call it's Close() method after
16366 saving the assembly.
16368 * driver.c (--debug): New command line argument to create a
16369 debugger information file.
16371 * location.cs (SymbolDocument): New public property. Returns an
16372 ISymbolDocumentWriter object for the current source file or null
16373 if we don't have a symbol writer.
16375 2002-03-21 Miguel de Icaza <miguel@ximian.com>
16377 * driver.cs (LoadAssembly): Correctly return when all the paths
16378 have been tried and not before.
16380 * statement.cs (Switch.Emit): return the actual coverage for this
16381 statement (returns/not-returns)
16383 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
16384 switch of the statement if we are the last switch section. That
16385 kills two problems: try/catch problems (we used to emit an empty
16386 nop at the end) and switch statements where all branches would
16389 2002-03-19 Miguel de Icaza <miguel@ximian.com>
16391 * driver.cs: Add default assemblies (the equivalent to the
16392 Microsoft CSC.RSP file)
16394 * cs-tokenizer.cs: When updating `cols and setting it to zero,
16395 also update tokens_seen and set it to false.
16397 * driver.cs: Implement --recurse for Mike.
16399 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
16400 correctly splitting out the paths.
16402 2002-03-18 Miguel de Icaza <miguel@ximian.com>
16404 * interface.cs (Interface.PopulateProperty): Instead of using
16405 `parent' as the declaration space for the set parameters, use
16408 * support.cs (InternalParameters): InternalParameters constructor
16409 takes a DeclSpace instead of a TypeContainer.
16411 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
16412 types are being initialized, load the address of it before calling
16415 (New): Provide a mechanism to disable the generation of local
16416 value type temporaries when the caller will be providing us with
16417 an address to store it.
16419 (ArrayCreation.EmitDynamicInitializers): Use it.
16421 2002-03-17 Miguel de Icaza <miguel@ximian.com>
16423 * expression.cs (Invocation.EmitArguments): Only probe for array
16424 property if there is more than one argument. Sorry about that.
16426 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
16427 empty param arrays.
16429 * class.cs (Method.LabelParameters): Fix incorrect code path that
16430 prevented the `ParamArrayAttribute' from being applied to the
16433 2002-03-16 Miguel de Icaza <miguel@ximian.com>
16435 * support.cs (ReflectionParameters): Correctly compute whether the
16436 last argument is a params array. Fixes the problem with
16439 * typemanager.cs: Make the assemblies array always be non-null
16440 (empty, but non-null)
16442 * tree.cs (RecordDecl): New function that abstracts the recording
16443 of names. This reports error 101, and provides a pointer to the
16444 previous declaration. Fixes a crash in the compiler.
16446 * cs-parser.jay (constructor_declaration): Update to new grammar,
16447 and provide a constructor_body that can be empty.
16449 2002-03-15 Miguel de Icaza <miguel@ximian.com>
16451 * driver.cs: Add support for --resources.
16453 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
16454 Make all types for the various array helper methods be integer.
16456 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
16457 CheckState to ConvCast.
16459 (ConvCast): Now it takes a `checked' state argument, to avoid
16460 depending on the emit context for the conversion, and just using
16461 the resolve time setting.
16463 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
16464 instead of Invocation.EmitArguments. We do not emit the original
16465 arguments, instead we emit those which have been converted to
16466 unsigned int expressions.
16468 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
16470 * codegen.cs: ditto.
16472 * expression.cs (LocalVariableReference): Drop the use of the
16473 Store function that depended on the variable index.
16475 * statement.cs (VariableInfo): Drop the `Idx' property from this
16476 class, as this is not taking into account the indexes for
16477 temporaries tat we generate during the execution, getting the
16480 * class.cs: First emit class initializers, then call the parent
16483 * expression.cs (Binary): Fix opcode emision.
16484 (UnaryMutator.EmitCode): Support checked code generation
16486 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
16487 matches for events for both the Static and Instance scans,
16488 pointing to the same element. Fix that.
16490 2002-03-14 Miguel de Icaza <miguel@ximian.com>
16492 * rootcontext.cs (ResolveTree): Always set the
16493 interface_resolve_order, because nested interfaces will be calling
16496 * class.cs (GetInterfaceOrClass): Track the same resolution
16497 process used by TypeManager.LookupType. This fixes the nested
16498 type lookups in class declarations (separate path from
16501 (TypeContainer.DefineType): Also define nested interfaces.
16502 (TypeContainer.RegisterOrder): New public function used to
16503 register the order in which child interfaces need to be closed.
16505 Nested interfaces need to be closed after their parents have been
16508 * interface.cs (InterfaceAttr): Put all the logic for computing
16509 the interface attribute here.
16511 (DefineInterface): Register our interface order with the
16512 RootContext or with the TypeContainer depending on the case.
16514 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16516 * cs-parser.jay: rework foreach statement to work with the new
16517 changes to the policy on SimpleNames.
16519 * report.cs: support Stacktrace on warnings as well.
16521 * makefile: drop --unsafe and /unsafe from the compile.
16523 2002-03-13 Ravi Pratap <ravi@ximian.com>
16525 * ecore.cs (StandardConversionExists): Modify to take an Expression
16526 as the first parameter. Ensure we do null -> reference type conversion
16529 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
16530 temporary Expression objects.
16532 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
16534 * interface.cs: workaround bug in method overloading resolution
16535 (there is already a bugzilla bug for it).
16537 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16539 We could also solve this problem by having a separate path for
16540 performing type lookups, instead of DoResolve, we could have a
16541 ResolveType entry point, and only participating pieces of the
16542 production (simplename, deref, array) would implement this.
16544 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
16545 signal SimpleName to only resolve type names and not attempt to
16546 resolve anything else.
16548 * expression.cs (Cast): Set the flag.
16550 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
16552 * class.cs: Only report 108 if there is no `new' modifier.
16554 * cs-parser.jay: rework foreach statement to work with the new
16555 changes to the policy on SimpleNames.
16557 * report.cs: support Stacktrace on warnings as well.
16559 * makefile: drop --unsafe and /unsafe from the compile.
16561 2002-03-11 Miguel de Icaza <miguel@ximian.com>
16563 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16564 lookups here, instead of doing that at parse time. This means
16565 that our grammar will not introduce `LocalVariableReferences' as
16566 expressions at this point. That solves the problem of code like
16570 static void Main ()
16574 This is only half the fix. The full fix requires parameters to
16575 also be handled in this way.
16577 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
16578 makes the use more obvious of the DeclSpace. The
16579 ec.TypeContainer.TypeBuilder is now only used to pull the
16580 TypeBuilder for it.
16582 My theory is that I can get rid of the TypeBuilder completely from
16583 the EmitContext, and have typecasts where it is used (from
16584 DeclSpace to where it matters).
16586 The only pending problem is that the code that implements Aliases
16587 is on TypeContainer, and probably should go in DeclSpace.
16589 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16590 lookups here, instead of doing that at parse time. This means
16591 that our grammar will not introduce `LocalVariableReferences' as
16592 expressions at this point. That solves the problem of code like
16596 static void Main ()
16600 This is only half the fix. The full fix requires parameters to
16601 also be handled in this way.
16603 * class.cs (Property.DefineMethod): When implementing an interface
16604 method, set newslot, when implementing an abstract method, do not
16605 set the flag (before we tried never setting it, or always setting
16606 it, which is the difference).
16607 (Indexer.DefineMethod): same.
16608 (Method.DefineMethod): same.
16610 * ecore.cs: Only set the status used flag if we get back a Field.
16612 * attribute.cs: Temporary hack, so Paolo can keep working.
16614 2002-03-08 Ravi Pratap <ravi@ximian.com>
16616 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
16617 the unmanaged type in the case we have a MarshalAs attribute.
16619 (Resolve): Handle the case when we are parsing the special MarshalAs
16620 attribute [we need to store the unmanaged type to use later]
16622 * typemanager.cs (marshal_as_attr_type): Built in type for the
16623 MarshalAs Attribute.
16625 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
16626 on parameters and accordingly set the marshalling info.
16628 2002-03-09 Miguel de Icaza <miguel@ximian.com>
16630 * class.cs: Optimizing slightly by removing redundant code after
16631 we switched to the `NoTypes' return value.
16632 (Property.DefineMethod): use NoTypes here too.
16634 This fixes the bug I introduced in my last batch of changes.
16636 2002-03-05 Ravi Pratap <ravi@ximian.com>
16638 * tree.cs (RecordEnum): Add. We now keep track of enums too.
16640 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
16641 Enums since those are types too.
16643 * cs-parser.jay (enum_declaration): Record enums as we parse them.
16645 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
16646 thanks to a call during the lookup process.
16648 2002-03-07 Miguel de Icaza <miguel@ximian.com>
16650 * statement.cs (Foreach): Lots of work to accomodate a particular
16651 kind of foreach statement that I had not kept in mind. It is
16652 possible to have foreachs on classes that provide a GetEnumerator
16653 method that return objects that implement the "pattern" for using
16654 a foreach, there is no need to support GetEnumerator
16657 This is needed to compile nant.
16659 * decl.cs: Only report 114 if the member is not `Finalize' and if
16660 the warning level is at least 2.
16662 * class.cs: Moved the compare function from Method to
16665 (MethodSignature.InheritableMemberSignatureCompare): Add new
16666 filter function that is used to extract inheritable methods from a
16669 (Method.Define): Use the new `inheritable_method_signature_filter'
16672 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
16675 2002-03-06 Miguel de Icaza <miguel@ximian.com>
16677 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
16679 * cs-parser.jay: Add opt_semicolon to the interface declaration.
16681 * expression.cs: Pass location information to
16682 ConvertImplicitStandard.
16684 * class.cs: Added debugging code to track return values from
16687 2002-03-05 Miguel de Icaza <miguel@ximian.com>
16689 * expression.cs (Is.DoResolve): If either side of the `is' is an
16690 interface, do not flag the warning.
16692 * ecore.cs (ImplicitReferenceConversion): We need a separate test
16695 * report.cs: Allow for --fatal to be used with --probe.
16697 * typemanager.cs (NoTypes): Move the definition for the empty Type
16700 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
16702 (TypeContainer.DefineProxy): New function used to proxy to parent
16703 implementations when implementing interfaces.
16704 (TypeContainer.ParentImplements): used to lookup if our parent
16705 implements a public function that is required by an interface.
16706 (TypeContainer.VerifyPendingMethods): Hook this up.
16708 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
16709 `modules' and `assemblies' arraylists into arrays. We only grow
16710 these are the very early start up of the program, so this improves
16711 the speedof LookupType (nicely measured).
16713 * expression.cs (MakeByteBlob): Replaced unsafe code with
16714 BitConverter, as suggested by Paolo.
16716 * cfold.cs (ConstantFold.Binary): Special case: perform constant
16717 folding of string concatenation, but if either side is a string,
16718 and the other is not, then return null, and let the runtime use
16719 the concatenation on the string plus the object (using
16720 `Object.ToString').
16722 2002-03-04 Miguel de Icaza <miguel@ximian.com>
16724 Constant Folding has been implemented now.
16726 * expression.cs (Unary.Reduce): Do not throw an exception, catch
16727 the error instead on types that are not supported in one's
16730 * constant.cs (Constant and all children): New set of functions to
16731 perform implict and explicit conversions.
16733 * ecore.cs (EnumConstant): Implement the new functions to perform
16734 conversion by proxying to the child expression.
16736 * codegen.cs: (ConstantCheckState): Constant evaluation has its
16737 own separate setting that can not be turned off from the command
16738 line using --unchecked or --checked and is only controlled using
16739 the checked/unchecked statements and expressions. This setting is
16740 used by the constant folder to flag errors.
16742 * expression.cs (CheckedExpr, UncheckedExpr): Set the
16743 ConstantCheckState as well.
16745 During Resolve, they also have to flag the state, because the
16746 constant folder runs completely in the Resolve phase.
16748 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
16751 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16753 * cfold.cs: New file, this file contains the constant folder.
16755 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
16756 argument to track whether we are using the resulting address to
16757 load or store a value and provide better error messages.
16759 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
16760 new AddressOf arguments.
16762 * statement.cs (Foreach.EmitCollectionForeach): Update
16764 * expression.cs (Argument.Emit): Call AddressOf with proper
16765 arguments to track usage.
16767 (New.DoEmit): Call AddressOf with new arguments.
16769 (Unary.Emit): Adjust AddressOf call.
16771 2002-03-01 Ravi Pratap <ravi@ximian.com>
16773 * cs-parser.jay (member_access): Change the case for pre-defined types
16774 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
16777 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
16780 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
16781 essentially like methods and apply attributes like MethodImplOptions to them too.
16783 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
16786 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
16787 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
16790 * Update code everywhere accordingly.
16792 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
16794 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
16796 2002-02-28 Ravi Pratap <ravi@ximian.com>
16798 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
16799 try performing lookups against those instead of jumping straight into using
16800 the 'using' clauses.
16802 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
16804 (LookupType): Perform lookups in implicit parents too.
16806 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
16807 sequence as RootContext.LookupType.
16809 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
16810 the various cases of namespace lookups into this method.
16812 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16814 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
16815 in positional arguments)
16817 * class.cs (Operator): Update the AllowedModifiers to contain
16820 * cs-parser.jay: Update operator declaration to allow for the
16821 operator body to be empty.
16823 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
16826 2002-02-27 Miguel de Icaza <miguel@ximian.com>
16828 * class.cs (Method.Emit): Label parameters.
16830 * driver.cs: Return 1 or 0 as the program exit code.
16832 2002-02-26 Miguel de Icaza <miguel@ximian.com>
16834 * expression.cs: Special case the `null' object when trying to
16835 auto-compute the type, as anything can be explicitly converted to
16838 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16839 spotting this Paolo.
16841 (Expression.ImplicitNumericConversion): Perform comparissions of
16842 the type using the underlying type in the case of an enumeration
16843 rather than using the enumeration type for the compare.
16845 Cope with the underlying == type case, which is not possible to
16848 (Expression.ConvertNumericExplicit): Perform comparissions of
16849 the type using the underlying type in the case of an enumeration
16850 rather than using the enumeration type for the compare.
16852 * driver.cs: If the user does not supply an extension, assume .exe
16854 * cs-parser.jay (if_statement): Rewrote so that we can track the
16855 location for the if statement.
16857 * expression.cs (Binary.ConstantFold): Only concat strings when
16858 the operation is "+", not everything ;-)
16860 * statement.cs (Statement.EmitBoolExpression): Take a location
16862 (If, While, Do): Track location.
16864 * expression.cs (Binary.ResolveOperator): In the object + string
16865 case, I was missing a call to ConvertImplicit
16867 2002-02-25 Ravi Pratap <ravi@ximian.com>
16869 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
16870 Location arguments. Ensure we use RootContext.LookupType to do our work
16871 and not try to do a direct Type.GetType and ModuleBuilder.GetType
16873 * interface.cs (PopulateMethod): Handle the type of the parameter being
16876 * expression.cs (Invocation.BetterFunction): Handle the case when we
16877 have a params method with no fixed arguments and a call is made with no
16880 2002-02-25 Miguel de Icaza <miguel@ximian.com>
16882 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
16883 the verbatim-string-literal
16885 * support.cs (InternalParameters.ParameterModifier): handle null
16887 (InternalParameters.ParameterType): ditto.
16889 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
16890 duplicating the name of the variable parameter.
16891 (GetParameterByName): Fix bug where we were not looking up array
16892 paramters if they were the only present (thanks Paolo!).
16893 (GetParameterInfo): We only have an empty set of types if both
16894 fixed and array are set to null.
16895 (GetParameterInfo-idx): Handle FixedParameter == null
16897 * cs-parser.jay: Handle the case where there is no catch
16898 statements (missing null test).
16900 2002-02-22 Miguel de Icaza <miguel@ximian.com>
16902 * driver.cs (MainDriver): Be conservative on our command line
16905 Catch DirectoryNotFoundException when calling GetFiles.
16907 (SplitPathAndPattern): Used to split the input specification into
16908 a path and a pattern that we can feed to Directory.GetFiles.
16910 2002-02-21 Miguel de Icaza <miguel@ximian.com>
16912 * statement.cs (Fixed): Implement the last case of the Fixed
16913 statement (string handling).
16915 * expression.cs (StringPtr): New class used to return a char * to
16916 a string; Used by the Fixed statement.
16918 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
16920 * expression.cs (Binary.ResolveOperator): Remove redundant
16921 MemberLookup pn parent type.
16922 Optimize union call, we do not need a union if the types are the same.
16923 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
16926 Specialize the use of MemberLookup everywhere, instead of using
16927 the default settings.
16929 (StackAlloc): Implement stackalloc keyword.
16931 * cs-parser.jay: Add rule to parse stackalloc.
16933 * driver.cs: Handle /h, /help, /?
16935 * expression.cs (MakeByteBlob): Removed the hacks we had in place
16936 before we supported unsafe code.
16938 * makefile: add --unsafe to the self compilation of mcs.
16940 2002-02-20 Miguel de Icaza <miguel@ximian.com>
16942 * expression.cs (PointerArithmetic): New class that is used to
16943 perform pointer arithmetic.
16944 (Binary.Resolve): Handle pointer arithmetic
16945 Handle pointer comparission.
16946 (ArrayPtr): Utility expression class that is used to take the
16947 address of an array.
16949 (ElementAccess): Implement array access for pointers
16951 * statement.cs (Fixed): Implement fixed statement for arrays, we
16952 are missing one more case before we are done.
16954 * expression.cs (Indirection): Implement EmitAssign and set the
16955 ExprClass to Variable. This allows pointer dereferences to be
16956 treated as variables, and to have values assigned to them.
16958 * ecore.cs (Expression.StoreFromPtr): New utility function to
16959 store values dereferencing.
16961 2002-02-20 Ravi Pratap <ravi@ximian.com>
16963 * expression.cs (Binary.ResolveOperator): Ensure that we are
16964 not trying to operate on a void type - this fixes the reported
16967 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
16968 the parent implementation is sealed.
16970 * ../errors/cs0239.cs : Add.
16972 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16974 * typemanager.cs (unverifiable_code_type): Corresponds to
16975 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16976 which have unsafe code in them.
16978 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16981 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16983 * cs-tokenizer.cs: Add support for @"litreal strings"
16985 Make tokenizer accept pre-processor directives
16986 on any column (remove the old C-like limitation).
16988 * rootcontext.cs (EmitCode): Emit any global attributes.
16989 (AddGlobalAttributes): Used to keep track of assembly attributes.
16991 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16993 * cs-parser.jay: Add support for global attributes.
16995 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16997 * expression.cs (Indirection): New helper class. Unary will
16998 create Indirection classes to be able to implement the
16999 IMemoryLocation interface on it.
17001 2002-02-16 Miguel de Icaza <miguel@ximian.com>
17003 * cs-parser.jay (fixed_statement): reference the right statement.
17005 * statement.cs (Fixed.Emit): Finish implementing the fixed
17006 statement for the &x case.
17008 2002-02-14 Miguel de Icaza <miguel@ximian.com>
17010 * class.cs (Property.Define, Method.Define): Remove newslot when
17013 * modifiers.cs: My use of NewSlot when `Abstract' was set was
17014 wrong. NewSlot should only be used if the `new' keyword is present.
17016 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
17017 locating our system dir. Sorry about this.
17019 2002-02-13 Miguel de Icaza <miguel@ximian.com>
17021 * driver.cs (GetSystemDir): Compute correctly the location of our
17022 system assemblies. I was using the compiler directory instead of
17023 the library directory.
17025 2002-02-13 Ravi Pratap <ravi@ximian.com>
17027 * expression.cs (BetterFunction): Put back in what Miguel commented out
17028 since it is the correct fix. The problem is elsewhere ;-)
17030 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
17031 parameters of the parms method are themselves compatible or not !
17033 (StandardConversionExists): Fix very dangerous bug where we were forgetting
17034 to check that a class implements an interface before saying that an implicit
17035 conversion was allowed. Use ImplementsInterface to do the checking.
17037 2002-02-13 Miguel de Icaza <miguel@ximian.com>
17039 * class.cs (Method.Define): Track whether we are an explicit
17040 implementation or not. And only call DefineMethodOverride if we
17041 are an explicit implementation.
17043 (Property.DefineMethod): Ditto.
17045 2002-02-11 Ravi Pratap <ravi@ximian.com>
17047 * expression.cs (BetterFunction): Catch hideous bug which was
17048 preventing us from detecting ambiguous calls due to implicit casts i.e
17051 2002-01-29 Miguel de Icaza <miguel@ximian.com>
17053 * support.cs (Pair): Remove un-needed method. I figured why I was
17054 getting the error in cs-parser.jay, the variable in a foreach loop
17055 is readonly, and the compiler does not really treat this as a variable.
17057 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
17058 instead of EQUALS in grammar.
17060 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
17062 * expression.cs (Unary.DoResolve): Check whether the argument is
17065 2002-01-28 Miguel de Icaza <miguel@ximian.com>
17067 * support.cs: Api for Pair to set a value. Despite the fact that
17068 the variables are public the MS C# compiler refuses to compile
17069 code that accesses the field if the variable is part of a foreach
17072 * statement.cs (Fixed): Begin implementation of the fixed
17075 (Block.AddVariable): Return the VariableInfo on success and null
17076 on failure instead of true/false.
17078 * cs-parser.jay (foreach): Catch errors on variables already
17079 defined (we were ignoring this value before) and properly unwind
17080 the block hierarchy
17082 (fixed_statement): grammar for the fixed statement.
17084 2002-01-25 Miguel de Icaza <miguel@ximian.com>
17086 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
17087 pointer types to be incretemented.
17089 (SizeOf): Implement.
17091 * cs-parser.jay (pointer_member_access): Implement
17092 expr->IDENTIFIER production.
17094 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
17095 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
17098 (Unary): Implement indirection.
17100 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
17101 use in non-unsafe context).
17103 (SimpleName.DoResolve): Check for pointers in field access on safe
17106 (Expression.LoadFromPtr): Factor the load-indirect code in this
17107 function. This was duplicated in UnboxCast and ParameterReference
17109 2002-01-24 Miguel de Icaza <miguel@ximian.com>
17111 * expression.cs (ComposedCast): report an error if a pointer cast
17112 is used in a safe region.
17114 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
17115 pointer type casts in unsafe context.
17117 * codegen.cs (EmitContext): Set up IsUnsafe.
17119 * cs-parser.jay (non_expression_type): Add productions for pointer
17122 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
17123 code. We should not use force into static mode if the method is
17124 not virtual. Fixes bug in MIS
17126 * statement.cs (Do.Emit, While.Emit, For.Emit,
17127 Statement.EmitBoolExpression): Add support to Do and While to
17128 propagate infinite loop as `I do return' semantics.
17130 Improve the For case to also test for boolean constants.
17132 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
17133 to the list of attributes we can add.
17135 Remove `EmitContext' argument.
17137 * class.cs (Method.Define): Apply parameter attributes.
17138 (Constructor.Define): Apply parameter attributes.
17139 (MethodCore.LabelParameters): Move here the core of labeling
17142 * support.cs (ReflectionParameters.ParameterModifier,
17143 InternalParameters.ParameterModifier): Use IsByRef on the type and
17144 only return the OUT bit for these parameters instead of in/out/ref
17147 This is because I miss-understood things. The ParameterInfo.IsIn
17148 and IsOut represent whether the parameter has the [In] and [Out]
17151 2002-01-22 Miguel de Icaza <miguel@ximian.com>
17153 * ecore.cs (FieldExpr.Emit): Release temporaries.
17155 * assign.cs (LocalTemporary.Release): new function.
17157 * codegen.cs (EmitContext.GetTemporaryStorage,
17158 EmitContext.FreeTemporaryStorage): Rework the way we deal with
17159 temporary storage. Now we can "put back" localbuilders when we
17162 2002-01-21 Miguel de Icaza <miguel@ximian.com>
17164 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
17165 need to make a copy of the variable to generate verifiable code.
17167 2002-01-19 Miguel de Icaza <miguel@ximian.com>
17169 * driver.cs: Compute dynamically the system directory.
17171 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
17172 Slower, but more generally useful. Used by the abstract
17173 registering implementation.
17175 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
17176 the rules for the special rule on Type/instances. First check if
17177 we have the same name, and if so, try that special static path
17178 rather than the instance path.
17180 2002-01-18 Miguel de Icaza <miguel@ximian.com>
17182 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
17185 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
17186 Enum, ValueType, Delegate or Array for non-corlib compiles.
17188 * cs-tokenizer.cs: Catch long identifiers (645)
17190 * typemanager.cs (IndexerPropetyName): Ravi never tested this
17193 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
17194 fix, we were returning too early, so we were not registering
17195 pending methods from abstract classes.
17197 Do not register pending methods if the class is abstract.
17199 * expression.cs (Conditional.DoResolve): Report circular implicit
17200 conversions when we neecd to compute it for conditional
17203 (Is.DoResolve): If the expression is always of the provided type,
17204 flag warning 183. If the expression can not ever be of the
17205 provided type flag warning 184.
17207 * class.cs: Catch 169 as well.
17209 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
17212 2002-01-18 Nick Drochak <ndrochak@gol.com>
17214 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
17216 2002-01-17 Miguel de Icaza <miguel@ximian.com>
17218 * interface.cs: (PopulateMethod): Check for pointers being defined
17219 only if the unsafe context is active.
17220 (PopulateProperty): ditto.
17221 (PopulateIndexer): ditto.
17223 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
17224 specified. If pointers are present, make sure that they are
17225 present in an unsafe context.
17226 (Constructor, Constructor.Define): ditto.
17227 (Field, Field.Define): ditto.
17228 (Property, Property.Define): ditto.
17229 (Event, Event.Define): ditto.
17231 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
17232 hashtable if there are classes or structs defined.
17234 * expression.cs (LocalVariableReference.DoResolve): Simplify this
17235 code, as the constant resolution moved.
17237 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
17238 the metadata, so we can flag error 133.
17240 * decl.cs (MemberCore.UnsafeOK): New function to test that a
17241 pointer is being declared in an unsafe context.
17243 2002-01-16 Miguel de Icaza <miguel@ximian.com>
17245 * modifiers.cs (Modifiers.Check): Require a Location argument.
17246 Report error 227 for Unsafe use.
17248 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
17250 * statement.cs (For.Emit): If the test is null, then report that
17251 we do `return', as we wont reach anything afterwards.
17253 (Switch.SwitchGoverningType): Track the expression that matched
17256 * driver.cs: Allow negative numbers as an error code to flag.
17258 * cs-parser.jay: Handle 1551.
17260 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
17262 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17264 * cs-parser.jay: Report 1518 (type declaration can only contain
17265 class, struct, interface, enum or delegate)
17267 (switch_label): Report 1523 (keywords `case' or `default' must
17270 (opt_switch_sections): Report 1522 (empty switch)
17272 * driver.cs: Report 1515 (response file specified multiple times)
17273 Report 1516 (Source file specified multiple times).
17275 * expression.cs (Argument.Resolve): Signal 1510
17277 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
17278 access not allowed in static code)
17280 2002-01-11 Ravi Pratap <ravi@ximian.com>
17282 * typemanager.cs (IsPointerType): Utility method which we are going
17285 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
17286 the object type, so we take care of that.
17288 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
17290 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
17291 added to non-params parameters :-)
17293 * typemanager.cs (CSharpName): Include 'void' type too.
17295 (void_ptr_type): Include in the set of core types.
17297 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
17300 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
17303 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
17304 completely forgotten about it.
17306 2002-01-10 Ravi Pratap <ravi@ximian.com>
17308 * cs-parser.jay (pointer_type): Add. This begins our implementation
17309 of parsing rules for unsafe code.
17311 (unsafe_statement): Implement.
17313 (embedded_statement): Modify to include the above.
17315 * statement.cs (Unsafe): Implement new class for unsafe blocks.
17317 * codegen.cs (EmitContext.InUnsafe): Add. This determines
17318 if the current context is an unsafe one.
17320 * cs-parser.jay (local_variable_pointer_type): Since local variable types
17321 are handled differently, we need separate rules for them.
17323 (local_variable_declaration): Update to use local_variable_pointer_type
17324 to allow variable declarations of unmanaged pointer types.
17326 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
17327 in unsafe contexts.
17329 * ../errors/cs0214.cs : Add.
17331 2002-01-16 Nick Drochak <ndrochak@gol.com>
17333 * makefile: remove 'response' file when cleaning.
17335 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17337 * cs-parser.jay: Report 1524.
17339 2002-01-14 Miguel de Icaza <miguel@ximian.com>
17341 * typemanager.cs (RegisterMethod): drop checking if we have
17342 registered this from here
17344 2002-01-12 Miguel de Icaza <miguel@ximian.com>
17346 * class.cs (Method.EmitDestructor): Implement calling our base
17349 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
17350 value of InFinally.
17352 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
17353 this routine and will wrap the call in a try/catch block. Deal
17356 2002-01-11 Miguel de Icaza <miguel@ximian.com>
17358 * ecore.cs (Expression.MemberLookup): instead of taking a
17359 parameter `same_type' that was used to tell whether we could
17360 access private members we compute our containing type from the
17363 (FieldExpr): Added partial support for volatile fields. This does
17364 not work for volatile fields exposed from assemblies, as I can not
17365 figure out how to extract the modreq from it.
17367 Updated all the source files to use this.
17369 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
17370 because it is referenced by MemberLookup very often.
17372 2002-01-09 Ravi Pratap <ravi@ximian.com>
17374 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
17375 TypeBuilder.GetCustomAttributes to retrieve what we need.
17377 Get rid of redundant default_member_attr_type as this is the same as
17378 default_member_type which already exists.
17380 * interface.cs, attribute.cs : Update accordingly.
17382 2002-01-08 Miguel de Icaza <miguel@ximian.com>
17384 * typemanager.cs: Enable IndexerPropertyName again. It does not
17385 work for TYpeBuilders though. Ravi, can you please fix this?
17387 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
17389 * expression.cs (Argument.Emit): Handle the case of ref objects
17390 being passed to ref functions;
17392 (ParameterReference.EmitLoad): Loads the content of the pointer
17393 without dereferencing.
17395 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17397 * cs-tokenizer.cs: Implemented the pre-processing expressions.
17399 2002-01-08 Ravi Pratap <ravi@ximian.com>
17401 * class.cs (Indexer.DefineMethod): Incorporate the interface
17402 type in the name of the method if we are doing explicit interface
17405 * expression.cs (ConversionExists): Remove as it is completely obsolete.
17407 (BetterConversion): Fix extremely trivial bug where we were referring to
17408 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
17411 * ../errors/bug16.cs : Add although we have fixed it.
17413 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17415 * expression.cs (BaseIndexer): Begin implementation.
17417 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
17419 * cs-parser.jay (indexer_declarator): Use qualified_identifier
17420 production directly to remove a shift/reduce, and implement
17421 explicit interface implementation.
17423 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
17424 after a floating point suffix.
17426 * expression.cs (DoNumericPromotions): Improved the conversion for
17427 uint/uint. If we have a constant, we avoid doing a typecast to a
17430 * class.cs (Indexer): Implement explicit interface implementation
17433 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
17435 * class.cs: make the default instance constructor public and hidebysig.
17437 2001-01-03 Ravi Pratap <ravi@ximian.com>
17439 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
17440 so we can call it from elsewhere.
17442 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
17443 we emit it internally if the class has a defined indexer; otherwise the user
17444 emits it by decorating the class definition with the DefaultMemberAttribute.
17446 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
17447 attribute is not used on a type which defines an indexer.
17449 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
17450 character when we skip whitespace.
17452 * ../errors/cs0646.cs : Add.
17454 2002-01-03 Miguel de Icaza <miguel@ximian.com>
17456 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
17459 * makefile: Add practical target `mcs3.exe' which builds the third
17460 generation compiler.
17462 * expression.cs (New): Fix structures constructor calling.
17464 * class.cs (Property, Method, Indexer): Emit Final flag on the
17465 method if we are an interface implementation and we are not
17468 * ecore.cs (PropertyExpr): New public field `IsBase', tells
17469 whether this property is referencing a `base' method.
17471 * expression.cs (Invocation.EmitCall): take an extra argument:
17472 is_base, this is used to determine whether the `call' or
17473 `callvirt' opcode should be used.
17476 * delegate.cs: update EmitCall.
17478 * class.cs (Method.Define): Set NewSlot for the cases where we are
17479 not implementing an interface method.
17481 (Property.Define): ditto.
17483 2002-01-02 Miguel de Icaza <miguel@ximian.com>
17485 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
17486 'r'. Allows mcs to parse itself fully.
17488 2002-01-02 Ravi Pratap <ravi@ximian.com>
17490 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
17491 of the number of initializers that require the InitializeArray method.
17493 (CheckIndices): Store the Expression in all cases - not the plain value. Also
17494 update the above field where necessary.
17496 (MakeByteBlob): Update accordingly.
17498 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
17501 (EmitDynamicInitializers): Update in accordance with the new optimization.
17503 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
17504 same OpCode applies.
17506 * cs-parser.jay : Fix some glaring errors I introduced.
17508 2002-01-01 Ravi Pratap <ravi@ximian.com>
17510 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
17511 so that we can check for name clashes there too.
17513 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
17514 for interface indexers.
17516 * interfaces.cs (Define): Emit the default member attribute.
17518 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
17519 variable was being referred to while setting the value ;-)
17521 2002-01-01 Miguel de Icaza <miguel@ximian.com>
17523 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
17524 byte-by-byte information when we know the data is zero.
17526 Make the block always a multiple of 4, because
17527 DefineInitializedData has a bug.
17529 * assign.cs: Fix, we should assign from the temporary, not from
17532 * expression.cs (MakeByteBlob): Fix my incorrect code.
17534 2001-12-31 Miguel de Icaza <miguel@ximian.com>
17536 * typemanager.cs (EnumToUnderlying): This function is used to get
17537 the underlying type from an enumeration, because it does not
17540 * constant.cs: Use the I4_S form for values between -128 and 127.
17542 * statement.cs (Block.LookupLabel): Looks up a label.
17543 (Block): Drop support for labeled blocks.
17545 (LabeledStatement): New kind of statement that represents a label
17548 (Goto): Finally implement this bad boy.
17550 * cs-parser.jay: Update to reflect new mechanism to implement
17553 2001-12-30 Miguel de Icaza <miguel@ximian.com>
17555 * codegen.cs (EmitContext.This): a codegen property that keeps the
17556 a single instance of this instead of creating many different this
17559 * delegate.cs (Delegate.DoResolve): Update to use the property;
17561 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
17563 * expression.cs (BaseAccess.DoResolve): Ditto.
17565 2001-12-29 Ravi Pratap <ravi@ximian.com>
17567 * typemanager.cs (methodimpl_attr_type): Add to hold the type
17568 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
17570 (InitCoreTypes): Update accordingly.
17572 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
17573 so we can quickly store the state.
17575 (ApplyAttributes): Set the correct implementation flags
17576 for InternalCall methods.
17578 2001-12-29 Miguel de Icaza <miguel@ximian.com>
17580 * expression.cs (EmitCall): if a method is not virtual, then do
17581 not use callvirt on it.
17583 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
17584 user defined stuff) requires the use of stobj, which takes an
17585 address on the stack instead of an array and an index. So emit
17586 the Ldelema operation for it.
17588 (EmitStoreOpcode): Use stobj for valuetypes.
17590 (UnaryMutator.EmitCode): Use the right 1 value depending on
17591 whether we are dealing with int64/uint64, float or doubles.
17593 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
17594 constructors that I implemented last night.
17596 (Constructor.IsDefault): Fix to work properly for static
17599 * cs-parser.jay (CheckDef): report method signature errors.
17600 Update error number 103 to be 132.
17602 * decl.cs: New AdditionResult enumeration value: MethodExists.
17603 Although we do this check for methods later on in the semantic
17604 analysis, catching repeated default constructors is so easy that
17605 we catch these here.
17607 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
17610 (ParameterReference.EmitAssign, Emit): handle
17613 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
17614 (ArrayAccess.EmitStoreOpcode): ditto.
17616 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
17618 * expression.cs (MakeByteBlob): Complete all the missing types
17619 (uint, short, ushort, byte, sbyte)
17621 * class.cs: Only init instance field initializers on instance
17624 Rename `constructors' to instance_constructors.
17626 (TypeContainer.AddConstructor): Only add constructors to the list
17627 if it is not static.
17629 Make sure that we handle default_static_constructor independently
17630 everywhere where we handle instance_constructors
17632 2001-12-28 Miguel de Icaza <miguel@ximian.com>
17634 * class.cs: Do not lookup or create a base initializer for a
17635 static constructor.
17637 (ConstructorInitializer.Resolve): use the proper type to lookup
17640 * cs-parser.jay: Report error 1585 (modifiers between type and name).
17642 * enum.cs, interface.cs: Remove CloseType, this is taken care by
17645 * decl.cs: CloseType is now an virtual method, the default
17646 implementation just closes this type.
17648 2001-12-28 Ravi Pratap <ravi@ximian.com>
17650 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
17651 to PreserveSig by default. Also emit HideBySig on such methods.
17653 Basically, set the defaults to standard values.
17655 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
17656 argument, if candidate is better, it can't be worse than the best !
17658 (Invocation): Re-write bits to differentiate between methods being
17659 applicable in their expanded form and their normal form - for params
17662 Get rid of use_standard everywhere as only standard conversions are allowed
17663 in overload resolution.
17665 More spec conformance.
17667 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17669 * driver.cs: Add --timestamp, to see where the compiler spends
17672 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
17673 `this' in static code.
17675 (SimpleName.DoResolve): Implement in terms of a helper function
17676 that allows static-references to be passed upstream to
17679 (Expression.ResolveWithSimpleName): Resolve specially simple
17680 names when called by MemberAccess to implement the special
17683 (Expression.ImplicitReferenceConversion): Handle conversions from
17684 Null to reference types before others, as Null's type is
17687 * expression.cs (Invocation.EmitCall): Handle the special case of
17688 calling methods declared on a reference type from a ValueType
17689 (Base classes System.Object and System.Enum)
17691 (MemberAccess.Resolve): Only perform lookups on Enumerations if
17692 the left hand side is a TypeExpr, not on every enumeration.
17694 (Binary.Resolve): If types are reference types, then do a cast to
17695 object on operators != and == of both arguments.
17697 * typemanager.cs (FindMembers): Extract instance and static
17698 members if requested.
17700 * interface.cs (PopulateProperty): Use void_type instead of null
17701 as the return type for the setter method.
17703 (PopulateIndexer): ditto.
17705 2001-12-27 Ravi Pratap <ravi@ximian.com>
17707 * support.cs (ReflectionParameters): Fix minor bug where we
17708 were examining the wrong parameter for the ParamArray attribute.
17710 Cope with requests for the type of the parameter at position
17711 greater than the params parameter's. We now return the element
17712 type of the params array as that makes more sense.
17714 * expression.cs (Invocation.IsParamsMethodApplicable): Update
17715 accordingly as we no longer have to extract the element type
17718 (Invocation.OverloadResolve): Update.
17720 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17722 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
17723 against IEnumerator, test whether the return value is a descendant
17724 of the IEnumerator interface.
17726 * class.cs (Indexer.Define): Use an auxiliary method to implement
17727 the other bits of the method definition. Begin support for
17728 explicit interface implementation.
17730 (Property.DefineMethod): Use TypeManager.void_type instead of null
17731 for an empty return value.
17733 2001-12-26 Miguel de Icaza <miguel@ximian.com>
17735 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
17736 dealing with a FieldExpr which is composed of a FieldBuilder, in
17737 the code path we did extract the constant, but we should have
17738 obtained the underlying value to be able to cast it (otherwise we
17739 end up in an infinite loop, this is what Ravi was running into).
17741 (ArrayCreation.UpdateIndices): Arrays might be empty.
17743 (MemberAccess.ResolveMemberAccess): Add support for section
17744 14.5.4.1 that deals with the special case of E.I when E is a type
17745 and something else, that I can be a reference to a static member.
17747 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
17748 handle a particular array type to create byte blobs, it is just
17749 something we dont generate byteblobs for.
17751 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
17754 * location.cs (Push): remove the key from the hashtable that we
17755 are about to add. This happens for empty files.
17757 * driver.cs: Dispose files after we have parsed them.
17759 (tokenize): new function that only runs the tokenizer on its
17760 input, for speed testing.
17762 2001-12-26 Ravi Pratap <ravi@ximian.com>
17764 * class.cs (Event.Define): Define the private field only if there
17765 are no accessors defined.
17767 * expression.cs (ResolveMemberAccess): If there is no associated
17768 field with the event, that means we have an event defined with its
17769 own accessors and we should flag error cs0070 since transforming
17770 ourselves into a field is not valid in that case.
17772 * ecore.cs (SimpleName.DoResolve): Same as above.
17774 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
17775 and charset to sane values.
17777 2001-12-25 Ravi Pratap <ravi@ximian.com>
17779 * assign.cs (DoResolve): Perform check on events only if they
17780 are being accessed outside the declaring type.
17782 * cs-parser.jay (event_declarations): Update rules to correctly
17783 set the type of the implicit parameter etc.
17785 (add_accessor, remove_accessor): Set current local parameters.
17787 * expression.cs (Binary): For delegate addition and subtraction,
17788 cast the return value from the method into the appropriate delegate
17791 2001-12-24 Ravi Pratap <ravi@ximian.com>
17793 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
17794 of these as the workaround is unnecessary.
17796 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
17797 delegate data - none of that is needed at all.
17799 Re-write bits to extract the instance expression and the delegate method
17802 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
17805 * attribute.cs (ApplyAttributes): New method to take care of common tasks
17806 of attaching attributes instead of duplicating code everywhere.
17808 * everywhere : Update code to do attribute emission using the above method.
17810 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17812 * expression.cs (IsParamsMethodApplicable): if there are not
17813 parameters, return immediately.
17815 * ecore.cs: The 0 literal can be implicity converted to an enum
17818 (SimpleName.DoResolve): First lookup the type, then lookup the
17821 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
17822 want to get its address. If the InstanceExpression is not
17823 addressable, store the result in a temporary variable, then get
17826 * codegen.cs: Only display 219 errors on warning level or above.
17828 * expression.cs (ArrayAccess): Make it implement the
17829 IMemoryLocation interface.
17831 (Binary.DoResolve): handle the operator == (object a, object b)
17832 and operator != (object a, object b) without incurring into a
17833 BoxedCast (because 5 != o should never be performed).
17835 Handle binary enumerator operators.
17837 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
17838 value type, otherwise use Ldelem_ref.
17840 Use precomputed names;
17842 (AddressOf): Implement address of
17844 * cs-parser.jay (labeled_statement): Fix recursive block
17845 addition by reworking the production.
17847 * expression.cs (New.DoEmit): New has a special case:
17849 If we are dealing with a ValueType, we have a few
17850 situations to deal with:
17852 * The target of New is a ValueType variable, that is
17853 easy, we just pass this as the variable reference
17855 * The target of New is being passed as an argument,
17856 to a boxing operation or a function that takes a
17859 In this case, we need to create a temporary variable
17860 that is the argument of New.
17863 2001-12-23 Ravi Pratap <ravi@ximian.com>
17865 * rootcontext.cs (LookupType): Check that current_type is not null before
17866 going about looking at nested types.
17868 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
17869 not implement the IAssignMethod interface any more.
17871 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
17872 where we tranform them into FieldExprs if they are being resolved from within
17873 the declaring type.
17875 * ecore.cs (SimpleName.DoResolve): Do the same here.
17877 * assign.cs (DoResolve, Emit): Clean up code considerably.
17879 * ../errors/bug10.cs : Add.
17881 * ../errors/cs0070.cs : Add.
17883 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
17885 * assign.cs : Get rid of EventIsLocal everywhere.
17887 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17889 * ecore.cs (ConvertIntLiteral): finished the implementation.
17891 * statement.cs (SwitchLabel): Convert the value we are using as a
17892 key before looking up the table.
17894 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17896 * codegen.cs (EmitTopBlock): Require a Location argument now.
17898 * cs-parser.jay (constructor_declarator): We need to setup
17899 current_local_parameters before we parse the
17900 opt_constructor_initializer, to allow the variables to be bound
17901 to the constructor arguments.
17903 * rootcontext.cs (LookupType): First lookup nested classes in our
17904 class and our parents before we go looking outside our class.
17906 * expression.cs (ConstantFold): Extract/debox the values at the
17909 * rootcontext.cs (EmitCode): Resolve the constants first before we
17910 resolve the types. This is not really needed, but it helps debugging.
17912 * statement.cs: report location.
17914 * cs-parser.jay: pass location to throw statement.
17916 * driver.cs: Small bug fix.
17918 * report.cs: Updated format to be 4-zero filled digits.
17920 2001-12-22 Ravi Pratap <ravi@ximian.com>
17922 * expression.cs (CheckIndices): Fix minor bug where the wrong
17923 variable was being referred to ;-)
17925 (DoEmit): Do not call EmitStaticInitializers when the
17926 underlying type is System.Object.
17928 2001-12-21 Ravi Pratap <ravi@ximian.com>
17930 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
17931 and do the usual workaround for SRE.
17933 * class.cs (MyEventBuilder.EventType): New member to get at the type
17934 of the event, quickly.
17936 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
17938 * assign.cs (Assign.DoResolve): Handle the case when the target
17939 is an EventExpr and perform the necessary checks.
17941 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
17944 (SimpleName.MemberStaticCheck): Include check for EventExpr.
17946 (EventExpr): Set the type in the constructor itself since we
17947 are meant to be born fully resolved.
17949 (EventExpr.Define): Revert code I wrote earlier.
17951 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
17952 instance expression is null. The instance expression is a This in that case
17953 or a null, depending on whether it is a static method or not.
17955 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
17956 refers to more than one method.
17958 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
17959 and accordingly flag errors.
17961 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17963 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
17965 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17967 * location.cs (ToString): Provide useful rutine.
17969 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17971 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17972 objects, return the actual integral boxed.
17974 * statement.cs (SwitchLabel): define an ILLabel for each
17977 (Switch.CheckSwitch): If the value is a Literal, extract
17978 the underlying literal.
17980 Also in the unused hashtable we had, add the SwitchLabel so we can
17981 quickly look this value up.
17983 * constant.cs: Implement a bunch of new constants. Rewrite
17984 Literal based on this. Made changes everywhere to adapt to this.
17986 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17987 dereferencing array only once, and also copes with enumrations.
17989 bytes are two bytes wide, not one.
17991 (Cast): Perform constant conversions.
17993 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17994 wrappers to the literals here.
17996 * expression.cs (DoNumericPromotions): long literals can converted
17997 to ulong implicity (this is taken care of elsewhere, but I was
17998 missing this spot).
18000 * ecore.cs (Expression.Literalize): Make the return type Literal,
18001 to improve type checking.
18003 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
18005 2001-12-20 Miguel de Icaza <miguel@ximian.com>
18007 * literal.cs: Revert code from ravi that checked the bounds. The
18008 bounds are sane by the definition of the type itself.
18010 * typemanager.cs: Fix implementation of ImplementsInterface. We
18011 need to actually look up in our parent hierarchy for interfaces
18014 * const.cs: Use the underlying type for enumerations
18016 * delegate.cs: Compute the basename for the delegate creation,
18017 that should fix the delegate test case, and restore the correct
18018 Type Lookup semantics in rootcontext
18020 * rootcontext.cs: Revert Ravi's last patch. The correct way of
18021 referencing a nested type with the Reflection API is using the "+"
18024 * cs-parser.jay: Do not require EOF token at the end.
18026 2001-12-20 Ravi Pratap <ravi@ximian.com>
18028 * rootcontext.cs (LookupType): Concatenate type names with
18029 a '.' instead of a '+' The test suite passes again.
18031 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
18032 field of the enumeration.
18034 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
18035 the case when the member is an EventExpr.
18037 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
18038 static has an associated instance expression.
18040 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
18042 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
18044 * class.cs (Event.Define): Register event and perform appropriate checks
18047 We define the Add and Remove methods even if the use provides none because
18048 in that case, we provide default implementations ourselves.
18050 Define a private field of the type of the event. This is done by the CSC compiler
18051 and we should be doing it too ;-)
18053 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
18054 More methods we use in code we generate.
18056 (multicast_delegate_type, delegate_type): Two separate types since the distinction
18059 (InitCoreTypes): Update accordingly for the above.
18061 * class.cs (Event.Emit): Generate code for default accessors that we provide
18063 (EmitDefaultMethod): Do the job in the above.
18065 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
18068 2001-12-20 Miguel de Icaza <miguel@ximian.com>
18070 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
18071 builders even if we were missing one.
18073 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
18074 pass the Basename as our class name instead of the Name. The
18075 basename will be correctly composed for us.
18077 * parameter.cs (Paramters): Now takes a Location argument.
18079 * decl.cs (DeclSpace.LookupType): Removed convenience function and
18080 make all the code call directly LookupType in RootContext and take
18081 this chance to pass the Location information everywhere.
18083 * Everywhere: pass Location information.
18085 2001-12-19 Miguel de Icaza <miguel@ximian.com>
18087 * class.cs (Constructor.Define): Updated way of detecting the
18088 length of the parameters.
18090 (TypeContainer.DefineType): Use basename as the type name for
18093 (TypeContainer.Define): Do not recursively define types here, as
18094 definition is taken care in order by the RootContext.
18096 * tree.cs: Keep track of namespaces in a per-file basis.
18098 * parameter.cs (Parameter.ComputeSignature): Update to use
18101 (Parameters.GetSignature): ditto.
18103 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
18104 instead of a TypeContainer.
18106 (Interface.SemanticAnalysis): Use `this' instead of our parent to
18107 resolve names. Because we need to be resolve in our context, not
18110 * driver.cs: Implement response files.
18112 * class.cs (TypeContainer.DefineType): If we are defined, do not
18113 redefine ourselves.
18115 (Event.Emit): Emit the code for add/remove handlers.
18116 (Event.Define): Save the MethodBuilders for add/remove.
18118 * typemanager.cs: Use pair here too.
18120 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
18121 DictionaryEntry requires the first argument to be non-null.
18123 (enum_declaration): Compute full name for registering the
18126 (delegate_declaration): Instead of using
18127 formal_parameter_list, use opt_formal_parameter_list as the list
18130 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
18131 (EventParsing): New property that controls whether `add' and
18132 `remove' are returned as tokens or identifiers (for events);
18134 2001-12-19 Ravi Pratap <ravi@ximian.com>
18136 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
18137 use MyEventBuilder only and let it wrap the real builder for us.
18139 (MyEventBuilder): Revamp constructor etc.
18141 Implement all operations that we perform on EventBuilder in precisely the same
18144 (FindMembers): Update to use the EventBuilder member.
18146 (Event.Emit): Update accordingly.
18148 2001-12-18 Ravi Pratap <ravi@ximian.com>
18150 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
18151 by calling the appropriate methods.
18153 (GetCustomAttributes): Make stubs as they cannot possibly do anything
18156 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
18158 2001-12-17 Ravi Pratap <ravi@ximian.com>
18160 * delegate.cs (Delegate.Populate): Check that the return type
18161 and various parameters types are indeed accessible.
18163 * class.cs (Constructor.Define): Same here.
18165 (Field.Define): Ditto.
18167 (Event.Define): Ditto.
18169 (Operator.Define): Check that the underlying Method defined itself
18170 correctly - so it's MethodBuilder should not be null.
18172 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
18173 expression happens to be null.
18175 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
18176 members but as of now we don't seem to be able to do anything really useful with it.
18178 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
18179 not the EventBuilder.
18181 2001-12-18 Miguel de Icaza <miguel@ximian.com>
18183 * cs-tokenizer.cs: Add support for defines.
18184 Add support for #if, #elif, #else, #endif
18186 (eval_var): evaluates a variable.
18187 (eval): stubbed for evaluating functions.
18189 * cs-parser.jay: Pass the defines information
18191 * driver.cs: Add --define command line option.
18193 * decl.cs: Move MemberCore here.
18195 Make it the base class for DeclSpace. This allows us to catch and
18196 report 108 and 109 for everything now.
18198 * class.cs (TypeContainer.Define): Extract all the members
18199 before populating and emit the warning 108 (new keyword required
18200 to override) instead of having each member implement this.
18202 (MemberCore.Define): New abstract method, we will be using this in
18203 the warning reporting engine in Populate.
18205 (Operator.Define): Adjust to new MemberCore protocol.
18207 * const.cs (Const): This does not derive from Expression, it is a
18208 temporary object we use to create fields, it is a MemberCore.
18210 * class.cs (Method.Define): Allow the entry point to be in a
18213 * driver.cs: Rewrite the argument handler to clean it up a bit.
18215 * rootcontext.cs: Made it just an auxiliary namespace feature by
18216 making everything static.
18218 * driver.cs: Adapt code to use RootContext type name instead of
18221 * delegate.cs: Remove RootContext argument.
18223 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
18226 * class.cs (Event.Define): The lookup can fail.
18228 * cs-tokenizer.cs: Begin implementation of pre-procesor.
18230 * expression.cs: Resolve the this instance before invoking the code.
18232 2001-12-17 Miguel de Icaza <miguel@ximian.com>
18234 * cs-parser.jay: Add a production in element_access that allows
18235 the thing to become a "type" reference. This way we can parse
18236 things like "(string [])" as a type.
18238 Note that this still does not handle the more complex rules of
18242 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
18244 * ecore.cs: (CopyNewMethods): new utility function used to
18245 assemble the list of methods from running FindMembers.
18247 (MemberLookup): Rework FindMembers so that
18249 2001-12-16 Miguel de Icaza <miguel@ximian.com>
18251 * class.cs (TypeContainer): Remove Delegates who fail to be
18254 * delegate.cs (Populate): Verify that we dont get null return
18255 values. TODO: Check for AsAccessible.
18257 * cs-parser.jay: Use basename to emit error 574 (destructor should
18258 have the same name as container class), not the full name.
18260 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
18261 possible representation.
18263 Also implements integer type suffixes U and L.
18265 2001-12-15 Miguel de Icaza <miguel@ximian.com>
18267 * expression.cs (ArrayCreation.DoResolve): We need to do the
18268 argument resolution *always*.
18270 * decl.cs: Make this hold the namespace. Hold the root context as
18272 (LookupType): Move here.
18274 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
18276 * location.cs (Row, Name): Fixed the code, it was always returning
18277 references to the first file.
18279 * interface.cs: Register properties defined through interfaces.
18281 * driver.cs: Add support for globbing on the command line
18283 * class.cs (Field): Make it derive from MemberCore as well.
18286 2001-12-15 Ravi Pratap <ravi@ximian.com>
18288 * class.cs (Event::Define): Check that the type of the event is a delegate
18289 type else flag error #66.
18291 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
18294 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
18295 values of EntryPoint, CharSet etc etc.
18297 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
18299 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
18300 be null and we should ignore this. I am not sure if this is really clean. Apparently,
18301 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
18302 which needs this to do its work.
18304 * ../errors/cs0066.cs : Add.
18306 2001-12-14 Miguel de Icaza <miguel@ximian.com>
18308 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
18311 * class.cs: (MethodSignature.MethodSignature): Removed hack that
18312 clears out the parameters field.
18313 (MemberSignatureCompare): Cleanup
18315 (MemberCore): New base class used to share code between MethodCore
18318 (RegisterRequiredImplementations) BindingFlags.Public requires
18319 either BindingFlags.Instace or Static. Use instance here.
18321 (Property): Refactored code to cope better with the full spec.
18323 * parameter.cs (GetParameterInfo): Return an empty array instead
18326 * class.cs (Property): Abstract or extern properties have no bodies.
18328 * parameter.cs (GetParameterInfo): return a zero-sized array.
18330 * class.cs (TypeContainer.MethodModifiersValid): Move all the
18331 method modifier validation to the typecontainer so we can reuse
18332 this on properties.
18334 (MethodCore.ParameterTypes): return an empty sized array of types.
18336 (Property.Define): Test property modifier validity.
18338 Add tests for sealed/override too.
18340 (Method.Emit): abstract or extern methods have no bodies.
18342 2001-12-14 Ravi Pratap <ravi@ximian.com>
18344 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
18347 (Method::Define, ::Emit): Modify accordingly.
18349 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
18351 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
18353 * makefile: Pass in /unsafe.
18355 2001-12-13 Miguel de Icaza <miguel@ximian.com>
18357 * class.cs (MakeKey): Kill routine.
18359 * class.cs (TypeContainer.Define): Correctly define explicit
18360 method implementations (they require the full interface name plus
18363 * typemanager.cs: Deply the PtrHashtable here and stop using the
18364 lame keys. Things work so much better.
18366 This of course broke everyone who depended on `RegisterMethod' to
18367 do the `test for existance' test. This has to be done elsewhere.
18369 * support.cs (PtrHashtable): A hashtable that avoid comparing with
18370 the object stupid Equals method (because, that like fails all over
18371 the place). We still do not use it.
18373 * class.cs (TypeContainer.SetRequiredInterface,
18374 TypeContainer.RequireMethods): Killed these two routines and moved
18375 all the functionality to RegisterRequiredImplementations.
18377 (TypeContainer.RegisterRequiredImplementations): This routine now
18378 registers all the implementations required in an array for the
18379 interfaces and abstract methods. We use an array of structures
18380 which can be computed ahead of time to reduce memory usage and we
18381 also assume that lookups are cheap as most classes will not
18382 implement too many interfaces.
18384 We also avoid creating too many MethodSignatures.
18386 (TypeContainer.IsInterfaceMethod): Update and optionally does not
18387 clear the "pending" bit if we find that there are problems with
18390 (TypeContainer.VerifyPendingMethods): Update to report errors of
18391 methods that look like implementations but are not.
18393 (TypeContainer.Define): Add support for explicit interface method
18396 2001-12-12 Miguel de Icaza <miguel@ximian.com>
18398 * typemanager.cs: Keep track of the parameters here instead of
18399 being a feature of the TypeContainer.
18401 * class.cs: Drop the registration of parameters here, as
18402 InterfaceMethods are also interface declarations.
18404 * delegate.cs: Register methods with the TypeManager not only with
18405 the TypeContainer. This code was buggy.
18407 * interface.cs: Full registation here.
18409 2001-12-11 Miguel de Icaza <miguel@ximian.com>
18411 * expression.cs: Remove reducer for binary expressions, it can not
18414 * const.cs: Put here the code that used to go into constant.cs
18416 * constant.cs: Put here the code for constants, this is a new base
18417 class for Literals.
18419 * literal.cs: Make Literal derive from Constant.
18421 2001-12-09 Miguel de Icaza <miguel@ximian.com>
18423 * statement.cs (Return.Emit): Report error 157 if the user
18424 attempts to return from a finally block.
18426 (Return.Emit): Instead of emitting a return, jump to the end of
18429 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
18430 LocalBuilder to store the result of the function. ReturnLabel is
18431 the target where we jump.
18434 2001-12-09 Radek Doulik <rodo@ximian.com>
18436 * cs-parser.jay: remember alias in current namespace
18438 * ecore.cs (SimpleName::DoResolve): use aliases for types or
18441 * class.cs (LookupAlias): lookup alias in my_namespace
18443 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
18445 (LookupAlias): lookup alias in this and if needed in parent
18448 2001-12-08 Miguel de Icaza <miguel@ximian.com>
18452 * rootcontext.cs: (ModuleBuilder) Made static, first step into
18453 making things static. I need this to avoid passing the
18454 TypeContainer when calling ParameterType.
18456 * support.cs (InternalParameters.ParameterType): Remove ugly hack
18457 that did string manipulation to compute the type and then call
18458 GetType. Use Parameter.ParameterType instead.
18460 * cs-tokenizer.cs: Consume the suffix for floating values.
18462 * expression.cs (ParameterReference): figure out whether this is a
18463 reference parameter or not. Kill an extra variable by computing
18464 the arg_idx during emission.
18466 * parameter.cs (Parameters.GetParameterInfo): New overloaded
18467 function that returns whether a parameter is an out/ref value or not.
18469 (Parameter.ParameterType): The type of the parameter (base,
18470 without ref/out applied).
18472 (Parameter.Resolve): Perform resolution here.
18473 (Parameter.ExternalType): The full type (with ref/out applied).
18475 * statement.cs (Using.Emit, Using.EmitExpression): Implement
18476 support for expressions on the using statement.
18478 2001-12-07 Miguel de Icaza <miguel@ximian.com>
18480 * statement.cs (Using.EmitLocalVariableDecls): Split the
18481 localvariable handling of the using statement.
18483 (Block.EmitMeta): Keep track of variable count across blocks. We
18484 were reusing slots on separate branches of blocks.
18486 (Try.Emit): Emit the general code block, we were not emitting it.
18488 Check the type of the declaration to be an IDisposable or
18489 something that can be implicity converted to it.
18491 Emit conversions if required.
18493 * ecore.cs (EmptyExpression): New utility class.
18494 (Expression.ImplicitConversionExists): New utility function.
18496 2001-12-06 Miguel de Icaza <miguel@ximian.com>
18498 * statement.cs (Using): Implement.
18500 * expression.cs (LocalVariableReference): Support read only variables.
18502 * statement.cs: Remove the explicit emit for the Leave opcode.
18503 (VariableInfo): Add a readonly field.
18505 2001-12-05 Miguel de Icaza <miguel@ximian.com>
18507 * ecore.cs (ConvCast): new class used to encapsulate the various
18508 explicit integer conversions that works in both checked and
18509 unchecked contexts.
18511 (Expression.ConvertNumericExplicit): Use new ConvCast class to
18512 properly generate the overflow opcodes.
18514 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18516 * statement.cs: The correct type for the EmptyExpression is the
18517 element_type, not the variable type. Ravi pointed this out.
18519 2001-12-04 Ravi Pratap <ravi@ximian.com>
18521 * class.cs (Method::Define): Handle PInvoke methods specially
18522 by using DefinePInvokeMethod instead of the usual one.
18524 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
18525 above to do the task of extracting information and defining the method.
18527 2001-12-04 Ravi Pratap <ravi@ximian.com>
18529 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
18530 of the condition for string type.
18532 (Emit): Move that here.
18534 (ArrayCreation::CheckIndices): Keep string literals in their expression
18537 (EmitDynamicInitializers): Handle strings appropriately.
18539 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18541 * codegen.cs (EmitContext): Replace multiple variables with a
18542 single pointer to the current Switch statement.
18544 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
18547 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18551 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
18554 (Foreach.Emit): Foreach on arrays was not setting
18555 up the loop variables (for break/continue).
18557 (GotoCase): Semi-implented.
18559 2001-12-03 Ravi Pratap <ravi@ximian.com>
18561 * attribute.cs (CheckAttribute): Handle system attributes by using
18562 Attribute.GetAttributes to examine information we need.
18564 (GetValidPlaces): Same here.
18566 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
18568 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
18570 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
18572 (Method::Define): Set appropriate flags if we have a DllImport attribute.
18574 (Method::Emit): Handle the case when we are a PInvoke method.
18576 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18578 * expression.cs: Use ResolveWithSimpleName on compound names.
18580 2001-12-02 Ravi Pratap <ravi@ximian.com>
18582 * constant.cs (EmitConstant): Make sure we resolve the associated expression
18583 before trying to reduce it.
18585 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
18587 * constant.cs (LookupConstantValue): Implement.
18589 (EmitConstant): Use the above in emitting the constant.
18591 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
18592 that are user-defined by doing a LookupConstantValue on them.
18594 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
18597 2001-11-29 Miguel de Icaza <miguel@ximian.com>
18599 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
18601 (BaseAccess.DoResolve): Implement.
18603 (MemberAccess.DoResolve): Split this routine into a
18604 ResolveMemberAccess routine that can be used independently
18606 2001-11-28 Miguel de Icaza <miguel@ximian.com>
18608 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
18609 As that share bits of the implementation. Is returns a boolean,
18610 while As returns the Type that is being probed.
18612 2001-12-01 Ravi Pratap <ravi@ximian.com>
18614 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
18615 instead of a Literal - much easier.
18617 (EnumInTransit): Remove - utterly useless :-)
18619 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
18621 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
18623 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
18624 chain when we have no associated expression.
18626 2001-11-30 Ravi Pratap <ravi@ximian.com>
18628 * constant.cs (Define): Use Location while reporting the errror.
18630 Also emit a warning when 'new' is used and there is no inherited
18633 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
18636 (LookupEnumValue): Implement to lookup an enum member's value and define it
18639 (Populate): Re-write accordingly to use the above routine.
18641 2001-11-27 Miguel de Icaza <miguel@ximian.com>
18643 * expression.cs (This): Fix prototype for DoResolveLValue to
18644 override the base class DoResolveLValue.
18646 * cs-parser.cs: Report errors cs574 and cs575 (destructor
18649 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
18650 (we need to load the address of the field here). This fixes
18653 (FieldExpr.DoResolveLValue): Call the DoResolve
18654 function to initialize the Instance expression.
18656 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
18657 correctly the GetEnumerator operation on a value type.
18659 * cs-parser.jay: Add more simple parsing error catches.
18661 * statement.cs (Switch): Add support for string switches.
18662 Handle null specially.
18664 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
18666 2001-11-28 Ravi Pratap <ravi@ximian.com>
18668 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
18670 (declare_local_constant): New helper function.
18672 * statement.cs (AddConstant): Keep a separate record of constants
18674 (IsConstant): Implement to determine if a variable is a constant.
18676 (GetConstantExpression): Implement.
18678 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
18680 * statement.cs (IsVariableDefined): Re-write.
18682 2001-11-27 Ravi Pratap <ravi@ximian.com>
18684 * class.cs (TypeContainer::FindMembers): Look for constants
18685 in the case when we are looking for MemberTypes.Field
18687 * expression.cs (MemberAccess::DoResolve): Check that in the
18688 case we are a FieldExpr and a Literal, we are not being accessed
18689 by an instance reference.
18691 * cs-parser.jay (local_constant_declaration): Implement.
18693 (declaration_statement): Implement for constant declarations.
18695 2001-11-26 Miguel de Icaza <miguel@ximian.com>
18697 * statement.cs (Switch): Catch double defaults.
18699 (Switch): More work on the switch() statement
18700 implementation. It works for integral values now, need to finish
18704 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18706 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
18707 integer literals into other integer literals. To be used by
18710 2001-11-24 Ravi Pratap <ravi@ximian.com>
18712 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
18715 (EmitDynamicInitializers): Cope with the above since we extract data
18716 directly from ArrayData now.
18718 (ExpectInitializers): Keep track of whether initializers are mandatory
18721 (Bounds): Make it a hashtable to prevent the same dimension being
18722 recorded for every element in that dimension.
18724 (EmitDynamicInitializers): Fix bug which prevented the Set array method
18727 Also fix bug which was causing the indices to be emitted in the reverse
18730 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18732 * expression.cs (ArrayCreation): Implement the bits that Ravi left
18733 unfinished. They do not work, because the underlying code is
18736 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18738 * cs-parser.jay: Remove bogus fixme.
18740 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
18741 on Switch statement.
18743 2001-11-23 Ravi Pratap <ravi@ximian.com>
18745 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
18748 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
18749 parameter. Apparently, any expression is allowed.
18751 (ValidateInitializers): Update accordingly.
18753 (CheckIndices): Fix some tricky bugs thanks to recursion.
18755 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
18756 I was being completely brain-dead.
18758 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
18759 and re-write acordingly.
18761 (DelegateInvocation): Re-write accordingly.
18763 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
18765 (MakeByteBlob): Handle types more correctly.
18767 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
18768 initialization from expressions but it is incomplete because I am a complete
18771 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18773 * statement.cs (If.Emit): Fix a bug that generated incorrect code
18774 on If. Basically, we have to return `true' (ie, we do return to
18775 our caller) only if both branches of the if return.
18777 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
18778 short-circuit operators, handle them as short circuit operators.
18780 (Cast.DoResolve): Resolve type.
18781 (Cast.Cast): Take an expression as the target type.
18783 * cs-parser.jay (cast_expression): Remove old hack that only
18784 allowed a limited set of types to be handled. Now we take a
18785 unary_expression and we resolve to a type during semantic
18788 Use the grammar productions from Rhys to handle casts (this is
18789 not complete like Rhys syntax yet, we fail to handle that corner
18790 case that C# has regarding (-x), but we will get there.
18792 2001-11-22 Ravi Pratap <ravi@ximian.com>
18794 * class.cs (EmitFieldInitializer): Take care of the case when we have a
18795 field which is an array type.
18797 * cs-parser.jay (declare_local_variables): Support array initialization too.
18799 * typemanager.cs (MakeKey): Implement.
18801 (everywhere): Use the above appropriately.
18803 * cs-parser.jay (for_statement): Update for array initialization while
18804 declaring variables.
18806 * ecore.cs : The error message was correct, it's the variable's names that
18807 were misleading ;-) Make the code more readable.
18809 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
18810 the correct type etc.
18812 (ConvertExplicit): Handle Enum types by examining the underlying type.
18814 2001-11-21 Ravi Pratap <ravi@ximian.com>
18816 * parameter.cs (GetCallingConvention): Always return
18817 CallingConventions.Standard for now.
18819 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18821 * expression.cs (Binary.ResolveOperator): Update the values of `l'
18822 and `r' after calling DoNumericPromotions.
18824 * ecore.cs: Fix error message (the types were in the wrong order).
18826 * statement.cs (Foreach.ProbeCollectionType): Need to pass
18827 BindingFlags.Instance as well
18829 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
18830 implicit int literal conversion in an empty cast so that we
18831 propagate the right type upstream.
18833 (UnboxCast): new class used to unbox value types.
18834 (Expression.ConvertExplicit): Add explicit type conversions done
18837 (Expression.ImplicitNumericConversion): Oops, forgot to test for
18838 the target type before applying the implicit LongLiterals to ULong
18841 2001-11-21 Miguel de Icaza <miguel@ximian.com>
18843 * cs-parser.jay (for_statement): Reworked the way For works: now
18844 we declare manually any variables that are introduced in
18845 for_initializer to solve the problem of having out-of-band code
18846 emition (that is what got for broken).
18848 (declaration_statement): Perform the actual variable declaration
18849 that used to be done in local_variable_declaration here.
18851 (local_variable_declaration): Do not declare anything, just pass
18852 the information on a DictionaryEntry
18854 2001-11-20 Ravi Pratap <ravi@ximian.com>
18856 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
18857 re-write of the logic to now make it recursive.
18859 (UpdateIndices): Re-write accordingly.
18861 Store element data in a separate ArrayData list in the above methods.
18863 (MakeByteBlob): Implement to dump the array data into a byte array.
18865 2001-11-19 Ravi Pratap <ravi@ximian.com>
18867 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
18870 * constant.cs (Define): Implement.
18872 (EmitConstant): Re-write fully.
18874 Pass in location info.
18876 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
18879 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
18880 DictionaryEntry since we need location info too.
18882 (constant_declaration): Update accordingly.
18884 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
18885 code into another method : UpdateIndices.
18887 2001-11-18 Ravi Pratap <ravi@ximian.com>
18889 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
18890 some type checking etc.
18892 2001-11-17 Ravi Pratap <ravi@ximian.com>
18894 * expression.cs (ArrayCreation::ValidateInitializers): Implement
18895 bits to provide dimension info if the user skips doing that.
18897 Update second constructor to store the rank correctly.
18899 2001-11-16 Ravi Pratap <ravi@ximian.com>
18901 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
18902 and try to implement.
18904 * ../errors/cs0150.cs : Add.
18906 * ../errors/cs0178.cs : Add.
18908 2001-11-16 Miguel de Icaza <miguel@ximian.com>
18910 * statement.cs: Implement foreach on multi-dimensional arrays.
18912 * parameter.cs (Parameters.GetParameterByName): Also lookup the
18913 name of the params argument.
18915 * expression.cs: Use EmitStoreOpcode to get the right opcode while
18916 initializing the array.
18918 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
18919 we can use this elsewhere.
18921 * statement.cs: Finish implementation of foreach for single
18924 * cs-parser.jay: Use an out-of-band stack to pass information
18925 around, I wonder why I need this.
18927 foreach_block: Make the new foreach_block the current_block.
18929 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
18930 function used to return a static Parameters structure. Used for
18931 empty parameters, as those are created very frequently.
18933 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
18935 2001-11-15 Ravi Pratap <ravi@ximian.com>
18937 * interface.cs : Default modifier is private, not public. The
18938 make verify test passes again.
18940 2001-11-15 Ravi Pratap <ravi@ximian.com>
18942 * support.cs (ReflectionParameters): Fix logic to determine
18943 whether the last parameter is a params one. Test 9 passes again.
18945 * delegate.cs (Populate): Register the builders we define with
18946 RegisterParameterForBuilder. Test 19 passes again.
18948 * cs-parser.jay (property_declaration): Reference $6 instead
18949 of $$ to get at the location.
18951 (indexer_declaration): Similar stuff.
18953 (attribute): Ditto.
18955 * class.cs (Property): Register parameters for the Get and Set methods
18956 if they exist. Test 23 passes again.
18958 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
18959 call to EmitArguments as we are sure there aren't any params arguments.
18960 Test 32 passes again.
18962 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
18963 IndexOutOfRangeException.
18965 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
18966 Test 33 now passes again.
18968 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18970 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18971 broke a bunch of things. Will have to come up with a better way
18972 of tracking locations.
18974 * statement.cs: Implemented foreach for single dimension arrays.
18976 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18978 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18979 an error. This removes the lookup from the critical path.
18981 * cs-parser.jay: Removed use of temporary_loc, which is completely
18984 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18986 * support.cs (ReflectionParameters.ParameterModifier): Report
18987 whether the argument is a PARAMS argument or not.
18989 * class.cs: Set the attribute `ParamArrayAttribute' on the
18990 parameter argument.
18992 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18993 and cons_param_array_attribute (ConstructorInfo for
18994 ParamArrayAttribute).,
18996 * codegen.cs: Emit the return using the `Return' statement, that
18997 way we can report the error correctly for missing return values.
18999 * class.cs (Method.Emit): Clean up.
19001 * expression.cs (Argument.Resolve): Take another argument: the
19002 location where this argument is used. Notice that this is not
19003 part of the "Argument" class as to reduce the size of the
19004 structure (we know the approximate location anyways).
19006 Test if the argument is a variable-reference, if not, then
19007 complain with a 206.
19009 (Argument.Emit): Emit addresses of variables.
19011 (Argument.FullDesc): Simplify.
19013 (Invocation.DoResolve): Update for Argument.Resolve.
19015 (ElementAccess.DoResolve): ditto.
19017 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
19018 method should be virtual, as this method is always virtual.
19020 (NewDelegate.DoResolve): Update for Argument.Resolve.
19022 * class.cs (ConstructorInitializer.DoResolve): ditto.
19024 * attribute.cs (Attribute.Resolve): ditto.
19026 2001-11-13 Miguel de Icaza <miguel@ximian.com>
19028 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
19030 * expression.cs (ParameterReference): Drop IStackStorage and implement
19031 IAssignMethod instead.
19033 (LocalVariableReference): ditto.
19035 * ecore.cs (FieldExpr): Drop IStackStorage and implement
19036 IAssignMethod instead.
19038 2001-11-13 Miguel de Icaza <miguel@ximian.com>
19040 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
19041 enumerations that are used in heavily used structures derive from
19042 byte in a laughable and pathetic attempt to reduce memory usage.
19043 This is the kind of pre-optimzations that you should not do at
19044 home without adult supervision.
19046 * expression.cs (UnaryMutator): New class, used to handle ++ and
19047 -- separatedly from the other unary operators. Cleans up the
19048 code, and kills the ExpressionStatement dependency in Unary.
19050 (Unary): Removed `method' and `Arguments' from this class, making
19051 it smaller, and moving it all to SimpleCall, so I can reuse this
19052 code in other locations and avoid creating a lot of transient data
19053 strucutres when not required.
19055 * cs-parser.jay: Adjust for new changes.
19057 2001-11-11 Miguel de Icaza <miguel@ximian.com>
19059 * enum.cs (Enum.Populate): If there is a failure during
19062 * cs-parser.jay (opt_enum_base): we used to catch type errors
19063 here, but this is really incorrect. The type error should be
19064 catched during semantic analysis.
19066 2001-12-11 Ravi Pratap <ravi@ximian.com>
19068 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
19069 current_local_parameters as expected since I, in my stupidity, had forgotten
19072 * attribute.cs (GetValidPlaces): Fix stupid bug.
19074 * class.cs (Method::Emit): Perform check on applicability of attributes.
19076 (Constructor::Emit): Ditto.
19078 (Field::Emit): Ditto.
19080 (Field.Location): Store location information.
19082 (Property, Event, Indexer, Operator): Ditto.
19084 * cs-parser.jay (field_declaration): Pass in location for each field.
19086 * ../errors/cs0592.cs : Add.
19088 2001-11-12 Ravi Pratap <ravi@ximian.com>
19090 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
19092 (InitCoreTypes): Update accordingly.
19094 (RegisterAttrType, LookupAttr): Implement.
19096 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
19097 info about the same.
19099 (Resolve): Update to populate the above as necessary.
19101 (Error592): Helper.
19103 (GetValidPlaces): Helper to the above.
19105 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
19107 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
19109 2001-11-12 Ravi Pratap <ravi@ximian.com>
19111 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
19113 * ../errors/cs0617.cs : Add.
19115 2001-11-11 Ravi Pratap <ravi@ximian.com>
19117 * enum.cs (Emit): Rename to Populate to be more consistent with what
19118 we expect it to do and when exactly it is called.
19120 * class.cs, rootcontext.cs : Update accordingly.
19122 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
19123 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
19125 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
19127 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
19128 of a fieldinfo using the above, when dealing with a FieldBuilder.
19130 2001-11-10 Ravi Pratap <ravi@ximian.com>
19132 * ../errors/cs0031.cs : Add.
19134 * ../errors/cs1008.cs : Add.
19136 * ../errrors/cs0543.cs : Add.
19138 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
19141 (FindMembers): Implement.
19143 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
19144 enums and delegates too.
19146 (enum_types): Rename to builder_to_enum.
19148 (delegate_types): Rename to builder_to_delegate.
19150 * delegate.cs (FindMembers): Implement.
19152 2001-11-09 Ravi Pratap <ravi@ximian.com>
19154 * typemanager.cs (IsEnumType): Implement.
19156 * enum.cs (Emit): Re-write parts to account for the underlying type
19157 better and perform checking etc.
19159 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
19160 of the underlying type.
19162 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
19165 * enum.cs (error31): Helper to report error #31.
19167 * cs-parser.jay (enum_declaration): Store location of each member too.
19169 * enum.cs (member_to_location): New hashtable.
19171 (AddEnumMember): Update location hashtable.
19173 (Emit): Use the location of each member while reporting errors.
19175 2001-11-09 Miguel de Icaza <miguel@ximian.com>
19177 * cs-parser.jay: A for_initializer if is a
19178 local_variable_declaration really ammount to have an implicit
19179 block with the variable declaration and no initializer for for.
19181 * statement.cs (For.Emit): Cope with null initializers.
19183 This fixes the infinite loop on for initializers.
19185 2001-11-08 Miguel de Icaza <miguel@ximian.com>
19187 * enum.cs: More cleanup.
19189 * ecore.cs: Remove dead code.
19191 * class.cs (Property.Emit): More simplification.
19192 (Event.Emit): ditto.
19194 Reworked to have less levels of indentation.
19196 2001-11-08 Ravi Pratap <ravi@ximian.com>
19198 * class.cs (Property): Emit attributes.
19208 * enum.cs (Emit): Ditto.
19210 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
19213 * class.cs (Field, Event, etc.): Move attribute generation into the
19214 Emit method everywhere.
19216 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
19217 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
19218 as we had no way of defining nested enums !
19220 * rootcontext.cs : Adjust code accordingly.
19222 * typemanager.cs (AddEnumType): To keep track of enum types separately.
19224 2001-11-07 Ravi Pratap <ravi@ximian.com>
19226 * expression.cs (EvalConstantExpression): Move into ecore.cs
19228 * enum.cs (Enum): Rename some members and make them public and readonly
19229 according to our convention.
19231 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
19234 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
19236 (Enum::Emit): Write a simple version for now which doesn't try to compute
19237 expressions. I shall modify this to be more robust in just a while.
19239 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
19241 (TypeContainer::CloseType): Create the Enum types too.
19243 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
19245 * expression.cs (EvalConstantExpression): Get rid of completely.
19247 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
19248 user-defined values and other cases.
19250 (IsValidEnumLiteral): Helper function.
19252 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
19253 out there in the case we had a literal FieldExpr.
19255 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
19257 (Literalize): Revamp a bit to take two arguments.
19259 (EnumLiteral): New class which derives from Literal to wrap enum literals.
19261 2001-11-06 Ravi Pratap <ravi@ximian.com>
19263 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
19265 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
19267 (Resolve): Use the above to ensure we have proper initializers.
19269 2001-11-05 Ravi Pratap <ravi@ximian.com>
19271 * expression.cs (Expression::EvalConstantExpression): New method to
19272 evaluate constant expressions.
19274 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
19276 2001-11-07 Miguel de Icaza <miguel@ximian.com>
19278 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
19281 (Binary.ResolveOperator): Handle operator != (object a, object b)
19282 and operator == (object a, object b);
19284 (Binary.DoNumericPromotions): Indicate whether the numeric
19285 promotion was possible.
19287 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
19290 Made the ArrayAccess implement interface IAssignMethod instead of
19291 IStackStore as the order in which arguments are passed reflects
19294 * assign.cs: Instead of using expr.ExprClass to select the way of
19295 assinging, probe for the IStackStore/IAssignMethod interfaces.
19297 * typemanager.cs: Load InitializeArray definition.
19299 * rootcontext.cs (RootContext.MakeStaticData): Used to define
19300 static data that can be used to initialize arrays.
19302 2001-11-05 Miguel de Icaza <miguel@ximian.com>
19304 * expression.cs: Handle operator== and operator!= for booleans.
19306 (Conditioal.Reduce): Implement reducer for the ?: operator.
19308 (Conditional.Resolve): Implement dead code elimination.
19310 (Binary.Resolve): Catch string literals and return a new
19311 concatenated string.
19313 (Unary.Reduce): Implement reduction of unary expressions.
19315 * ecore.cs: Split out the expression core handling here.
19317 (Expression.Reduce): New method used to perform constant folding
19318 and CSE. This is needed to support constant-expressions.
19320 * statement.cs (Statement.EmitBoolExpression): Pass true and false
19321 targets, and optimize for !x.
19323 2001-11-04 Ravi Pratap <ravi@ximian.com>
19325 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
19326 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
19327 set custom atttributes.
19329 * literal.cs (Literal::GetValue): New abstract method to return the actual
19330 value of the literal, cast as an object.
19332 (*Literal): Implement GetValue method.
19334 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
19335 expressions to the arraylist but objects of type Argument.
19337 * class.cs (TypeContainer::Emit): Emit our attributes too.
19339 (Method::Emit, Constructor::Emit): Ditto.
19341 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
19342 to be ignoring earlier.
19344 2001-11-03 Ravi Pratap <ravi@ximian.com>
19346 * attribute.cs (AttributeSection::Define): Implement to do the business
19347 of constructing a CustomAttributeBuilder.
19349 (Attribute): New trivial class. Increases readability of code.
19351 * cs-parser.jay : Update accordingly.
19353 (positional_argument_list, named_argument_list, named_argument): New rules
19355 (attribute_arguments): Use the above so that we are more correct.
19357 2001-11-02 Ravi Pratap <ravi@ximian.com>
19359 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
19360 to perform all checks for a method with a params parameter.
19362 (Invocation::OverloadResolve): Update to use the above method and therefore
19363 cope correctly with params method invocations.
19365 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
19368 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
19369 constructors in our parent too because we can't afford to miss out on
19372 * attribute.cs (AttributeSection): New name for the class Attribute
19374 Other trivial changes to improve readability.
19376 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
19377 use the new class names.
19379 2001-11-01 Ravi Pratap <ravi@ximian.com>
19381 * class.cs (Method::Define): Complete definition for params types too
19383 (Indexer::Define): Ditto.
19385 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
19386 Cope everywhere with a request for info about the array parameter.
19388 2001-11-01 Ravi Pratap <ravi@ximian.com>
19390 * tree.cs (RecordNamespace): Fix up to check for the correct key.
19392 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
19393 local_variable_type to extract the string corresponding to the type.
19395 (local_variable_type): Fixup the action to use the new helper method.
19397 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
19400 * expression.cs : Clean out code which uses the above.
19402 2001-10-31 Ravi Pratap <ravi@ximian.com>
19404 * typemanager.cs (RegisterMethod): Check if we already have an existing key
19405 and bale out if necessary by returning a false.
19407 (RegisterProperty): Ditto.
19409 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
19410 and print out appropriate error messages.
19412 * interface.cs (everywhere): Ditto.
19414 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
19415 location to constructor.
19417 * class.cs (Property, Event, Indexer): Update accordingly.
19419 * ../errors/cs111.cs : Added.
19421 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
19422 of a method, as laid down by the spec.
19424 (Invocation::OverloadResolve): Use the above method.
19426 2001-10-31 Ravi Pratap <ravi@ximian.com>
19428 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
19429 now take a TypeContainer and a Parameters object.
19431 (ParameterData): Modify return type of ParameterModifier method to be
19432 Parameter.Modifier and not a string.
19434 (ReflectionParameters, InternalParameters): Update accordingly.
19436 * expression.cs (Argument::GetParameterModifier): Same here.
19438 * support.cs (InternalParameters::ParameterType): Find a better way of determining
19439 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
19440 symbol in it at all so maybe this is only for now.
19442 2001-10-30 Ravi Pratap <ravi@ximian.com>
19444 * support.cs (InternalParameters): Constructor now takes an extra argument
19445 which is the actual Parameters class.
19447 (ParameterDesc): Update to provide info on ref/out modifiers.
19449 * class.cs (everywhere): Update call to InternalParameters to pass in
19450 the second argument too.
19452 * support.cs (ParameterData): Add ParameterModifier, which is a method
19453 to return the modifier info [ref/out etc]
19455 (InternalParameters, ReflectionParameters): Implement the above.
19457 * expression.cs (Argument::ParameterModifier): Similar function to return
19458 info about the argument's modifiers.
19460 (Invocation::OverloadResolve): Update to take into account matching modifiers
19463 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
19464 a new SetFormalParameters object which we pass to InternalParameters.
19466 2001-10-30 Ravi Pratap <ravi@ximian.com>
19468 * expression.cs (NewArray): Merge into the ArrayCreation class.
19470 2001-10-29 Ravi Pratap <ravi@ximian.com>
19472 * expression.cs (NewArray): Merge classes NewBuiltinArray and
19473 NewUserdefinedArray into one as there wasn't much of a use in having
19476 * expression.cs (Argument): Change field's name to ArgType from Type.
19478 (Type): New readonly property which returns the proper type, taking into
19479 account ref/out modifiers.
19481 (everywhere): Adjust code accordingly for the above.
19483 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
19484 whether we are emitting for a ref or out parameter.
19486 * expression.cs (Argument::Emit): Use the above field to set the state.
19488 (LocalVariableReference::Emit): Update to honour the flag and emit the
19491 * parameter.cs (Attributes): Set the correct flags for ref parameters.
19493 * expression.cs (Argument::FullDesc): New function to provide a full desc.
19495 * support.cs (ParameterData): Add method ParameterDesc to the interface.
19497 (ReflectionParameters, InternalParameters): Implement the above method.
19499 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
19502 (Invocation::FullMethodDesc): Ditto.
19504 2001-10-29 Miguel de Icaza <miguel@ximian.com>
19506 * cs-parser.jay: Add extra production for the second form of array
19509 * expression.cs (ArrayCreation): Update to reflect the above
19512 * Small changes to prepare for Array initialization.
19514 2001-10-28 Miguel de Icaza <miguel@ximian.com>
19516 * typemanager.cs (ImplementsInterface): interface might be null;
19517 Deal with this problem;
19519 Also, we do store negative hits on the cache (null values), so use
19520 this instead of calling t.GetInterfaces on the type everytime.
19522 2001-10-28 Ravi Pratap <ravi@ximian.com>
19524 * typemanager.cs (IsBuiltinType): New method to help determine the same.
19526 * expression.cs (New::DoResolve): Get rid of array creation code and instead
19527 split functionality out into different classes.
19529 (New::FormArrayType): Move into NewBuiltinArray.
19531 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
19534 (NewBuiltinArray): New class to handle creation of built-in arrays.
19536 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
19537 account creation of one-dimensional arrays.
19539 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
19541 (NewUserdefinedArray::DoResolve): Implement.
19543 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
19545 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
19546 we maintain inside the TypeManager. This is necessary to perform lookups on the
19549 (LookupType): Update to perform GetType on the module builders too.
19551 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
19553 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
19555 2001-10-23 Ravi Pratap <ravi@ximian.com>
19557 * expression.cs (New::DoResolve): Implement guts of array creation.
19559 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
19561 2001-10-27 Miguel de Icaza <miguel@ximian.com>
19563 * expression.cs: Fix bug I introduced lsat night that broke
19566 (Expression.Resolve): Report a 246 error (can not resolve name)
19567 if we find a SimpleName in the stream.
19569 (Expression.ResolveLValue): Ditto.
19571 (Expression.ResolveWithSimpleName): This function is a variant of
19572 ResolveName, this one allows SimpleNames to be returned without a
19573 warning. The only consumer of SimpleNames is MemberAccess
19575 2001-10-26 Miguel de Icaza <miguel@ximian.com>
19577 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
19578 might arrive here. I have my doubts that this is correct.
19580 * statement.cs (Lock): Implement lock statement.
19582 * cs-parser.jay: Small fixes to support `lock' and `using'
19584 * cs-tokenizer.cs: Remove extra space
19586 * driver.cs: New flag --checked, allows to turn on integer math
19589 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
19590 Threading.Monitor.Exit
19592 2001-10-23 Miguel de Icaza <miguel@ximian.com>
19594 * expression.cs (IndexerAccess::DoResolveLValue): Set the
19595 Expression Class to be IndexerAccess.
19597 Notice that Indexer::DoResolve sets the eclass to Value.
19599 2001-10-22 Miguel de Icaza <miguel@ximian.com>
19601 * class.cs (TypeContainer::Emit): Emit code for indexers.
19603 * assign.cs (IAssignMethod): New interface implemented by Indexers
19604 and Properties for handling assignment.
19606 (Assign::Emit): Simplify and reuse code.
19608 * expression.cs (IndexerAccess, PropertyExpr): Implement
19609 IAssignMethod, clean up old code.
19611 2001-10-22 Ravi Pratap <ravi@ximian.com>
19613 * typemanager.cs (ImplementsInterface): New method to determine if a type
19614 implements a given interface. Provides a nice cache too.
19616 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
19619 (ConvertReferenceExplicit): Ditto.
19621 * delegate.cs (Delegate::Populate): Update to define the parameters on the
19622 various methods, with correct names etc.
19624 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
19625 Operator.UnaryNegation.
19627 * cs-parser.jay (operator_declarator): Be a little clever in the case where
19628 we have a unary plus or minus operator.
19630 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
19633 * everywhere : update accordingly.
19635 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
19638 * class.cs (Method::Define): For the case where we are implementing a method
19639 inherited from an interface, we need to set the MethodAttributes.Final flag too.
19640 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
19642 2001-10-21 Ravi Pratap <ravi@ximian.com>
19644 * interface.cs (FindMembers): Implement to work around S.R.E
19647 * typemanager.cs (IsInterfaceType): Implement.
19649 (FindMembers): Update to handle interface types too.
19651 * expression.cs (ImplicitReferenceConversion): Re-write bits which
19652 use IsAssignableFrom as that is not correct - it doesn't work.
19654 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
19655 and accordingly override EmitStatement.
19657 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
19658 using the correct logic :-)
19660 2001-10-19 Ravi Pratap <ravi@ximian.com>
19662 * ../errors/cs-11.cs : Add to demonstrate error -11
19664 2001-10-17 Miguel de Icaza <miguel@ximian.com>
19666 * assign.cs (Assign::Resolve): Resolve right hand side first, and
19667 then pass this as a hint to ResolveLValue.
19669 * expression.cs (FieldExpr): Add Location information
19671 (FieldExpr::LValueResolve): Report assignment to readonly
19674 (Expression::ExprClassFromMemberInfo): Pass location information.
19676 (Expression::ResolveLValue): Add new method that resolves an
19679 (Expression::DoResolveLValue): Default invocation calls
19682 (Indexers): New class used to keep track of indexers in a given
19685 (IStackStore): Renamed from LValue, as it did not really describe
19686 what this did. Also ResolveLValue is gone from this interface and
19687 now is part of Expression.
19689 (ElementAccess): Depending on the element access type
19691 * typemanager.cs: Add `indexer_name_type' as a Core type
19692 (System.Runtime.CompilerServices.IndexerNameAttribute)
19694 * statement.cs (Goto): Take a location.
19696 2001-10-18 Ravi Pratap <ravi@ximian.com>
19698 * delegate.cs (Delegate::VerifyDelegate): New method to verify
19699 if two delegates are compatible.
19701 (NewDelegate::DoResolve): Update to take care of the case when
19702 we instantiate a delegate from another delegate.
19704 * typemanager.cs (FindMembers): Don't even try to look up members
19705 of Delegate types for now.
19707 2001-10-18 Ravi Pratap <ravi@ximian.com>
19709 * delegate.cs (NewDelegate): New class to take care of delegate
19712 * expression.cs (New): Split the delegate related code out into
19713 the NewDelegate class.
19715 * delegate.cs (DelegateInvocation): New class to handle delegate
19718 * expression.cs (Invocation): Split out delegate related code into
19719 the DelegateInvocation class.
19721 2001-10-17 Ravi Pratap <ravi@ximian.com>
19723 * expression.cs (New::DoResolve): Implement delegate creation fully
19724 and according to the spec.
19726 (New::DoEmit): Update to handle delegates differently.
19728 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
19729 because of which we were printing out arguments in reverse order !
19731 * delegate.cs (VerifyMethod): Implement to check if the given method
19732 matches the delegate.
19734 (FullDelegateDesc): Implement.
19736 (VerifyApplicability): Implement.
19738 * expression.cs (Invocation::DoResolve): Update to accordingly handle
19739 delegate invocations too.
19741 (Invocation::Emit): Ditto.
19743 * ../errors/cs1593.cs : Added.
19745 * ../errors/cs1594.cs : Added.
19747 * delegate.cs (InstanceExpression, TargetMethod): New properties.
19749 2001-10-16 Ravi Pratap <ravi@ximian.com>
19751 * typemanager.cs (intptr_type): Core type for System.IntPtr
19753 (InitCoreTypes): Update for the same.
19755 (iasyncresult_type, asynccallback_type): Ditto.
19757 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
19760 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
19763 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
19764 the builders for the 4 members of a delegate type :-)
19766 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
19769 * expression.cs (New::DoResolve): Implement guts for delegate creation.
19771 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
19773 2001-10-15 Miguel de Icaza <miguel@ximian.com>
19775 * statement.cs (Break::Emit): Implement.
19776 (Continue::Emit): Implement.
19778 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
19779 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
19780 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
19781 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
19784 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
19785 properties that track the label for the current loop (begin of the
19786 loop and end of the loop).
19788 2001-10-15 Ravi Pratap <ravi@ximian.com>
19790 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
19791 use of emitting anything at all.
19793 * class.cs, rootcontext.cs : Get rid of calls to the same.
19795 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
19797 (Populate): Define the constructor correctly and set the implementation
19800 * typemanager.cs (delegate_types): New hashtable to hold delegates that
19803 (AddDelegateType): Implement.
19805 (IsDelegateType): Implement helper method.
19807 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
19809 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
19810 and accordingly handle it.
19812 * delegate.cs (Populate): Take TypeContainer argument.
19813 Implement bits to define the Invoke method. However, I still haven't figured out
19814 how to take care of the native int bit :-(
19816 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
19817 Qualify the name of the delegate, not its return type !
19819 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
19822 (StandardConversionExists): Checking for array types turns out to be recursive.
19824 (ConvertReferenceExplicit): Implement array conversion.
19826 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
19828 2001-10-12 Ravi Pratap <ravi@ximian.com>
19830 * cs-parser.jay (delegate_declaration): Store the fully qualified
19831 name as it is a type declaration.
19833 * delegate.cs (ReturnType, Name): Rename members to these. Make them
19836 (DefineDelegate): Renamed from Define. Does the same thing essentially,
19837 as TypeContainer::DefineType.
19839 (Populate): Method in which all the definition of the various methods (Invoke)
19842 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
19845 (CloseDelegate): Finally creates the delegate.
19847 * class.cs (TypeContainer::DefineType): Update to define delegates.
19848 (Populate, Emit and CloseType): Do the same thing here too.
19850 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
19851 delegates in all these operations.
19853 2001-10-14 Miguel de Icaza <miguel@ximian.com>
19855 * expression.cs: LocalTemporary: a new expression used to
19856 reference a temporary that has been created.
19858 * assign.cs: Handle PropertyAccess back here, so that we can
19859 provide the proper semantic access to properties.
19861 * expression.cs (Expression::ConvertReferenceExplicit): Implement
19862 a few more explicit conversions.
19864 * modifiers.cs: `NEW' modifier maps to HideBySig.
19866 * expression.cs (PropertyExpr): Make this into an
19867 ExpressionStatement, and support the EmitStatement code path.
19869 Perform get/set error checking, clean up the interface.
19871 * assign.cs: recognize PropertyExprs as targets, and if so, turn
19872 them into toplevel access objects.
19874 2001-10-12 Miguel de Icaza <miguel@ximian.com>
19876 * expression.cs: PropertyExpr::PropertyExpr: use work around the
19879 * typemanager.cs: Keep track here of our PropertyBuilders again to
19880 work around lameness in SRE.
19882 2001-10-11 Miguel de Icaza <miguel@ximian.com>
19884 * expression.cs (LValue::LValueResolve): New method in the
19885 interface, used to perform a second resolution pass for LValues.
19887 (This::DoResolve): Catch the use of this in static methods.
19889 (This::LValueResolve): Implement.
19891 (This::Store): Remove warning, assigning to `this' in structures
19894 (Invocation::Emit): Deal with invocation of
19895 methods on value types. We need to pass the address to structure
19896 methods rather than the object itself. (The equivalent code to
19897 emit "this" for structures leaves the entire structure on the
19898 stack instead of a pointer to it).
19900 (ParameterReference::DoResolve): Compute the real index for the
19901 argument based on whether the method takes or not a `this' pointer
19902 (ie, the method is static).
19904 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
19905 value types returned from functions when we need to invoke a
19906 method on the sturcture.
19909 2001-10-11 Ravi Pratap <ravi@ximian.com>
19911 * class.cs (TypeContainer::DefineType): Method to actually do the business of
19912 defining the type in the Modulebuilder or Typebuilder. This is to take
19913 care of nested types which need to be defined on the TypeBuilder using
19914 DefineNestedMethod.
19916 (TypeContainer::GetClassBases): Implement. Essentially the code from the
19917 methods in RootContext, only ported to be part of TypeContainer.
19919 (TypeContainer::GetInterfaceOrClass): Ditto.
19921 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
19923 * interface.cs (Interface::DefineInterface): New method. Does exactly
19924 what RootContext.CreateInterface did earlier, only it takes care of nested types
19927 (Interface::GetInterfaces): Move from RootContext here and port.
19929 (Interface::GetInterfaceByName): Same here.
19931 * rootcontext.cs (ResolveTree): Re-write.
19933 (PopulateTypes): Re-write.
19935 * class.cs (TypeContainer::Populate): Populate nested types too.
19936 (TypeContainer::Emit): Emit nested members too.
19938 * typemanager.cs (AddUserType): Do not make use of the FullName property,
19939 instead just use the name argument passed in as it is already fully
19942 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
19943 to TypeContainer mapping to see if a type is user-defined.
19945 * class.cs (TypeContainer::CloseType): Implement.
19947 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
19948 the default constructor.
19950 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
19953 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
19955 * interface.cs (CloseType): Create the type here.
19957 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
19960 Remove all the methods which are now in TypeContainer.
19962 2001-10-10 Ravi Pratap <ravi@ximian.com>
19964 * delegate.cs (Define): Re-write bits to define the delegate
19967 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19969 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19971 * expression.cs (ImplicitReferenceConversion): handle null as well
19972 as a source to convert to any reference type.
19974 * statement.cs (Return): Perform any implicit conversions to
19975 expected return type.
19977 Validate use of return statement.
19979 * codegen.cs (EmitContext): Pass the expected return type here.
19981 * class.cs (Method, Constructor, Property): Pass expected return
19982 type to EmitContext.
19984 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19986 * expression.cs: Make DoResolve take an EmitContext instead of a
19989 Replaced `l' and `location' for `loc', for consistency.
19991 (Error, Warning): Remove unneeded Tc argument.
19993 * assign.cs, literal.cs, constant.cs: Update to new calling
19996 * codegen.cs: EmitContext now contains a flag indicating whether
19997 code is being generated in a static method or not.
19999 * cs-parser.jay: DecomposeQI, new function that replaces the old
20000 QualifiedIdentifier. Now we always decompose the assembled
20001 strings from qualified_identifier productions into a group of
20004 2001-10-08 Miguel de Icaza <miguel@ximian.com>
20006 * rootcontext.cs: Deal with field-less struct types correctly now
20007 by passing the size option to Define Type.
20009 * class.cs: Removed hack that created one static field.
20011 2001-10-07 Miguel de Icaza <miguel@ximian.com>
20013 * statement.cs: Moved most of the code generation here.
20015 2001-10-09 Ravi Pratap <ravi@ximian.com>
20017 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
20020 (ElementAccess): Remove useless bits for now - keep checks as the spec
20023 2001-10-08 Ravi Pratap <ravi@ximian.com>
20025 * expression.cs (ElementAccess::DoResolve): Remove my crap code
20026 and start performing checks according to the spec.
20028 2001-10-07 Ravi Pratap <ravi@ximian.com>
20030 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
20031 rank_specifiers instead.
20033 (rank_specifiers): Change the order in which the rank specifiers are stored
20035 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
20037 * expression.cs (ElementAccess): Implement the LValue interface too.
20039 2001-10-06 Ravi Pratap <ravi@ximian.com>
20041 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
20042 except that user defined conversions are not included.
20044 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
20045 perform the conversion of the return type, if necessary.
20047 (New::DoResolve): Check whether we are creating an array or an object
20048 and accordingly do the needful.
20050 (New::Emit): Same here.
20052 (New::DoResolve): Implement guts of array creation.
20054 (New::FormLookupType): Helper function.
20056 2001-10-07 Miguel de Icaza <miguel@ximian.com>
20058 * codegen.cs: Removed most of the code generation here, and move the
20059 corresponding code generation bits to the statement classes.
20061 Added support for try/catch/finalize and throw.
20063 * cs-parser.jay: Added support for try/catch/finalize.
20065 * class.cs: Catch static methods having the flags override,
20066 virtual or abstract.
20068 * expression.cs (UserCast): This user cast was not really doing
20069 what it was supposed to do. Which is to be born in fully resolved
20070 state. Parts of the resolution were being performed at Emit time!
20074 2001-10-05 Miguel de Icaza <miguel@ximian.com>
20076 * expression.cs: Implicity convert the result from UserCast.
20078 2001-10-05 Ravi Pratap <ravi@ximian.com>
20080 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
20081 prevented it from working correctly.
20083 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
20084 merely ConvertImplicit.
20086 2001-10-05 Miguel de Icaza <miguel@ximian.com>
20088 * typemanager.cs: Make the LookupTypeContainer function static,
20089 and not per-instance.
20091 * class.cs: Make static FindMembers (the one that takes a Type
20094 * codegen.cs: Add EmitForeach here.
20096 * cs-parser.jay: Make foreach a toplevel object instead of the
20097 inline expansion, as we need to perform semantic analysis on it.
20099 2001-10-05 Ravi Pratap <ravi@ximian.com>
20101 * expression.cs (Expression::ImplicitUserConversion): Rename to
20102 UserDefinedConversion.
20104 (Expression::UserDefinedConversion): Take an extra argument specifying
20105 whether we look for explicit user conversions too.
20107 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
20109 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
20111 (ExplicitUserConversion): Make it a call to UserDefinedConversion
20112 with the appropriate arguments.
20114 * cs-parser.jay (cast_expression): Record location too.
20116 * expression.cs (Cast): Record location info.
20118 (Expression::ConvertExplicit): Take location argument.
20120 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
20121 to determine if we are doing explicit conversions.
20123 (UserCast::Emit): Update accordingly.
20125 (Expression::ConvertExplicit): Report an error if everything fails.
20127 * ../errors/cs0030.cs : Add.
20129 2001-10-04 Miguel de Icaza <miguel@ximian.com>
20131 * modifiers.cs: If the ABSTRACT keyword is present, also set the
20132 virtual and newslot bits.
20134 * class.cs (TypeContainer::RegisterRequiredImplementations):
20135 Record methods we need.
20137 (TypeContainer::MakeKey): Helper function to make keys for
20138 MethodBases, since the Methodbase key is useless.
20140 (TypeContainer::Populate): Call RegisterRequiredImplementations
20141 before defining the methods.
20143 Create a mapping for method_builders_to_methods ahead of time
20144 instead of inside a tight loop.
20146 (::RequireMethods): Accept an object as the data to set into the
20147 hashtable so we can report interface vs abstract method mismatch.
20149 2001-10-03 Miguel de Icaza <miguel@ximian.com>
20151 * report.cs: Make all of it static.
20153 * rootcontext.cs: Drop object_type and value_type computations, as
20154 we have those in the TypeManager anyways.
20156 Drop report instance variable too, now it is a global.
20158 * driver.cs: Use try/catch on command line handling.
20160 Add --probe option to debug the error reporting system with a test
20163 * report.cs: Add support for exiting program when a probe
20164 condition is reached.
20166 2001-10-03 Ravi Pratap <ravi@ximian.com>
20168 * expression.cs (Binary::DoNumericPromotions): Fix the case when
20169 we do a forcible conversion regardless of type, to check if
20170 ForceConversion returns a null.
20172 (Binary::error19): Use location to report error.
20174 (Unary::error23): Use location here too.
20176 * ../errors/cs0019.cs : Check in.
20178 * ../errors/cs0023.cs : Check in.
20180 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
20181 case of a non-null MethodInfo object with a length of 0 !
20183 (Binary::ResolveOperator): Flag error if overload resolution fails to find
20184 an applicable member - according to the spec :-)
20185 Also fix logic to find members in base types.
20187 (Unary::ResolveOperator): Same here.
20189 (Unary::report23): Change name to error23 and make first argument a TypeContainer
20190 as I was getting thoroughly confused between this and error19 :-)
20192 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
20193 (::FindMostEncompassedType): Implement.
20194 (::FindMostEncompassingType): Implement.
20195 (::StandardConversionExists): Implement.
20197 (UserImplicitCast): Re-vamp. We now need info about most specific
20198 source and target types so that we can do the necessary conversions.
20200 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
20201 mathematical union with no duplicates.
20203 2001-10-03 Miguel de Icaza <miguel@ximian.com>
20205 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
20206 in order from base classes to child classes, so that we can in
20207 child classes look up in our parent for method names and
20208 attributes (required for handling abstract, virtual, new, override
20209 constructs: we need to instrospect our base class, and if we dont
20210 populate the classes in order, the introspection might be
20211 incorrect. For example, a method could query its parent before
20212 the parent has any methods and would determine that the parent has
20213 no abstract methods (while it could have had them)).
20215 (RootContext::CreateType): Record the order in which we define the
20218 2001-10-02 Miguel de Icaza <miguel@ximian.com>
20220 * class.cs (TypeContainer::Populate): Also method definitions can
20221 fail now, keep track of this.
20223 (TypeContainer::FindMembers): Implement support for
20224 DeclaredOnly/noDeclaredOnly flag.
20226 (Constructor::Emit) Return the ConstructorBuilder.
20228 (Method::Emit) Return the MethodBuilder.
20229 Check for abstract or virtual methods to be public.
20231 * rootcontext.cs (RootContext::CreateType): Register all the
20232 abstract methods required for the class to be complete and the
20233 interface methods that must be implemented.
20235 * cs-parser.jay: Report error 501 (method requires body if it is
20236 not marked abstract or extern).
20238 * expression.cs (TypeOf::Emit): Implement.
20240 * typemanager.cs: runtime_handle_type, new global type.
20242 * class.cs (Property::Emit): Generate code for properties.
20244 2001-10-02 Ravi Pratap <ravi@ximian.com>
20246 * expression.cs (Unary::ResolveOperator): Find operators on base type
20247 too - we now conform exactly to the spec.
20249 (Binary::ResolveOperator): Same here.
20251 * class.cs (Operator::Define): Fix minor quirk in the tests.
20253 * ../errors/cs0215.cs : Added.
20255 * ../errors/cs0556.cs : Added.
20257 * ../errors/cs0555.cs : Added.
20259 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20261 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
20262 single integer which is really efficient
20264 2001-10-01 Ravi Pratap <ravi@ximian.com>
20266 * expression.cs (Expression::ImplicitUserConversion): Use location
20267 even in the case when we are examining True operators.
20269 * class.cs (Operator::Define): Perform extensive checks to conform
20270 with the rules for operator overloading in the spec.
20272 * expression.cs (Expression::ImplicitReferenceConversion): Implement
20273 some of the other conversions mentioned in the spec.
20275 * typemanager.cs (array_type): New static member for the System.Array built-in
20278 (cloneable_interface): For System.ICloneable interface.
20280 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
20281 we start resolving the tree and populating types.
20283 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
20285 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20287 * expression.cs (Expression::ExprClassFromMemberInfo,
20288 Expression::Literalize): Create literal expressions from
20289 FieldInfos which are literals.
20291 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
20292 type casts, because they were wrong. The test suite in tests
20295 (ImplicitNumericConversion): ushort to ulong requires a widening
20298 Int32 constant to long requires widening cast as well.
20300 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
20301 for integers because the type on the stack is not i4.
20303 2001-09-30 Miguel de Icaza <miguel@ximian.com>
20305 * expression.cs (report118): require location argument.
20307 * parameter.cs: Do not dereference potential null value.
20309 * class.cs: Catch methods that lack the `new' keyword when
20310 overriding a name. Report warnings when `new' is used without
20311 anything being there to override.
20313 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
20315 * class.cs: Only add constructor to hashtable if it is non-null
20316 (as now constructors can fail on define).
20318 (TypeManager, Class, Struct): Take location arguments.
20320 Catch field instance initialization in structs as errors.
20322 accepting_filter: a new filter for FindMembers that is static so
20323 that we dont create an instance per invocation.
20325 (Constructor::Define): Catch errors where a struct constructor is
20328 * cs-parser.jay: Pass location information for various new
20331 * delegate.cs (Delegate): take a location argument.
20333 * driver.cs: Do not call EmitCode if there were problesm in the
20334 Definition of the types, as many Builders wont be there.
20336 * decl.cs (Decl::Decl): Require a location argument.
20338 * cs-tokenizer.cs: Handle properly hex constants that can not fit
20339 into integers, and find the most appropiate integer for it.
20341 * literal.cs: Implement ULongLiteral.
20343 * rootcontext.cs: Provide better information about the location of
20344 failure when CreateType fails.
20346 2001-09-29 Miguel de Icaza <miguel@ximian.com>
20348 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
20351 * expression.cs (Binary::CheckShiftArguments): Add missing type
20353 (Binary::ResolveOperator): Add type to the logical and and logical
20354 or, Bitwise And/Or and Exclusive Or code paths, it was missing
20357 (Binary::DoNumericPromotions): In the case where either argument
20358 is ulong (and most signed types combined with ulong cause an
20359 error) perform implicit integer constant conversions as well.
20361 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20363 * expression.cs (UserImplicitCast): Method should always be
20365 (Invocation::BetterConversion): Simplified test for IntLiteral.
20367 (Expression::ImplicitNumericConversion): Split this routine out.
20368 Put the code that performs implicit constant integer conversions
20371 (Expression::Resolve): Become a wrapper around DoResolve so we can
20372 check eclass and type being set after resolve.
20374 (Invocation::Badness): Remove this dead function
20376 (Binary::ResolveOperator): Do not compute the expensive argumnets
20377 unless we have a union for it.
20379 (Probe::Emit): Is needs to do an isinst and then
20380 compare against null.
20382 (::CanConvert): Added Location argument. If the Location argument
20383 is null (Location.Null), then we do not report errors. This is
20384 used by the `probe' mechanism of the Explicit conversion. We do
20385 not want to generate an error for something that the user
20386 explicitly requested to be casted. But the pipeline for an
20387 explicit cast first tests for potential implicit casts.
20389 So for now, if the Location is null, it means `Probe only' to
20390 avoid adding another argument. Might have to revise this
20393 (ClassCast): New class used to type cast objects into arbitrary
20394 classes (used in Explicit Reference Conversions).
20396 Implement `as' as well.
20398 Reverted all the patches from Ravi below: they were broken:
20400 * The use of `level' as a mechanism to stop recursive
20401 invocations is wrong. That was there just to catch the
20402 bug with a strack trace but not as a way of addressing
20405 To fix the problem we have to *understand* what is going
20406 on and the interactions and come up with a plan, not
20407 just get things going.
20409 * The use of the type conversion cache that I proposed
20410 last night had an open topic: How does this work across
20411 protection domains. A user defined conversion might not
20412 be public in the location where we are applying the
20413 conversion, a different conversion might be selected
20414 (ie, private A->B (better) but public B->A (worse),
20415 inside A, A->B applies, but outside it, B->A will
20418 * On top of that (ie, even if the above is solved),
20419 conversions in a cache need to be abstract. Ie, `To
20420 convert from an Int to a Short use an OpcodeCast', not
20421 `To convert from an Int to a Short use the OpcodeCast on
20422 the variable 5' (which is what this patch was doing).
20424 2001-09-28 Ravi Pratap <ravi@ximian.com>
20426 * expression.cs (Invocation::ConversionExists): Re-write to use
20427 the conversion cache
20429 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
20430 cache all conversions done, not just user-defined ones.
20432 (Invocation::BetterConversion): The real culprit. Use ConversionExists
20433 to determine if a conversion exists instead of acutually trying to
20434 perform the conversion. It's faster too.
20436 (Expression::ConvertExplicit): Modify to use ConversionExists to check
20437 and only then attempt the implicit conversion.
20439 2001-09-28 Ravi Pratap <ravi@ximian.com>
20441 * expression.cs (ConvertImplicit): Use a cache for conversions
20442 already found. Check level of recursion and bail out if necessary.
20444 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20446 * typemanager.cs (string_concat_string_string, string_concat_object_object):
20447 Export standard methods that we expect for string operations.
20449 * statement.cs (Block::UsageWarning): Track usage of variables and
20450 report the errors for not used variables.
20452 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
20455 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20457 * codegen.cs: remove unnneded code
20459 * expression.cs: Removed BuiltinTypeAccess class
20461 Fix the order in which implicit conversions are
20464 The previous fixed dropped support for boxed conversions (adding a
20465 test to the test suite now)
20467 (UserImplicitCast::CanConvert): Remove test for source being null,
20468 that code is broken. We should not feed a null to begin with, if
20469 we do, then we should track the bug where the problem originates
20470 and not try to cover it up here.
20472 Return a resolved expression of type UserImplicitCast on success
20473 rather than true/false. Ravi: this is what I was talking about,
20474 the pattern is to use a static method as a "constructor" for
20477 Also, do not create arguments until the very last minute,
20478 otherwise we always create the arguments even for lookups that
20479 will never be performed.
20481 (UserImplicitCast::Resolve): Eliminate, objects of type
20482 UserImplicitCast are born in a fully resolved state.
20484 * typemanager.cs (InitCoreTypes): Init also value_type
20485 (System.ValueType).
20487 * expression.cs (Cast::Resolve): First resolve the child expression.
20489 (LValue): Add new method AddressOf to be used by
20492 Change the argument of Store to take an EmitContext instead of an
20493 ILGenerator, because things like FieldExpr need to be able to call
20494 their children expression to generate the instance code.
20496 (Expression::Error, Expression::Warning): Sugar functions for
20499 (Expression::MemberLookup): Accept a TypeContainer instead of a
20500 Report as the first argument.
20502 (Expression::ResolvePrimary): Killed. I still want to improve
20503 this as currently the code is just not right.
20505 (Expression::ResolveMemberAccess): Simplify, but it is still
20508 (Unary::Resolve): Catch errors in AddressOf operators.
20510 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
20511 index to a byte for the short-version, or the compiler will choose
20512 the wrong Emit call, which generates the wrong data.
20514 (ParameterReference::Emit, ::Store): same.
20516 (FieldExpr::AddressOf): Implement.
20518 * typemanager.cs: TypeManager: made public variable instead of
20521 * driver.cs: document --fatal.
20523 * report.cs (ErrorMessage, WarningMessage): new names for the old
20524 Error and Warning classes.
20526 * cs-parser.jay (member_access): Turn built-in access to types
20527 into a normal simplename
20529 2001-09-27 Ravi Pratap <ravi@ximian.com>
20531 * expression.cs (Invocation::BetterConversion): Fix to cope
20532 with q being null, since this was introducing a bug.
20534 * expression.cs (ConvertImplicit): Do built-in conversions first.
20536 2001-09-27 Ravi Pratap <ravi@ximian.com>
20538 * expression.cs (UserImplicitCast::Resolve): Fix bug.
20540 2001-09-27 Ravi Pratap <ravi@ximian.com>
20542 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
20543 I had introduced long ago (what's new ?).
20545 * expression.cs (UserImplicitCast::CanConvert): Static method to do
20546 the work of all the checking.
20547 (ConvertImplicit): Call CanConvert and only then create object if necessary.
20548 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
20550 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
20551 that is the right way.
20553 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
20554 overloading resolution. Use everywhere instead of cutting and pasting code.
20556 (Binary::ResolveOperator): Use MakeUnionSet.
20558 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
20559 we have to convert to bool types. Not complete yet.
20561 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20563 * typemanager.cs (TypeManager::CSharpName): support ushort.
20565 * expression.cs (Expression::TryImplicitIntConversion): Attempts
20566 to provide an expression that performsn an implicit constant int
20567 conversion (section 6.1.6).
20568 (Expression::ConvertImplicitRequired): Reworked to include
20569 implicit constant expression conversions.
20571 (Expression::ConvertNumericExplicit): Finished.
20573 (Invocation::Emit): If InstanceExpression is null, then it means
20574 that we perform a call on this.
20576 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20578 * expression.cs (Unary::Emit): Remove some dead code.
20579 (Probe): Implement Resolve and Emit for `is'.
20580 (Expression::ConvertImplicitRequired): Attempt to do constant
20581 expression conversions here. Maybe should be moved to
20582 ConvertImplicit, but I am not sure.
20583 (Expression::ImplicitLongConstantConversionPossible,
20584 Expression::ImplicitIntConstantConversionPossible): New functions
20585 that tell whether is it possible to apply an implicit constant
20586 expression conversion.
20588 (ConvertNumericExplicit): Started work on explicit numeric
20591 * cs-parser.jay: Update operator constants.
20593 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
20594 (Parameters::GetSignature): Hook up VerifyArgs here.
20595 (Parameters::VerifyArgs): Verifies that no two arguments have the
20598 * class.cs (Operator): Update the operator names to reflect the
20599 ones that the spec expects (as we are just stringizing the
20602 * expression.cs (Unary::ResolveOperator): Fix bug: Use
20603 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
20604 previous usage did only work for our methods.
20605 (Expression::ConvertImplicit): Handle decimal implicit numeric
20606 conversions as well.
20607 (Expression::InternalTypeConstructor): Used to invoke constructors
20608 on internal types for default promotions.
20610 (Unary::Emit): Implement special handling for the pre/post
20611 increment/decrement for overloaded operators, as they need to have
20612 the same semantics as the other operators.
20614 (Binary::ResolveOperator): ditto.
20615 (Invocation::ConversionExists): ditto.
20616 (UserImplicitCast::Resolve): ditto.
20618 2001-09-26 Ravi Pratap <ravi@ximian.com>
20620 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
20621 operator, return after emitting body. Regression tests pass again !
20623 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
20624 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
20625 (Invocation::OverloadResolve): Ditto.
20626 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
20628 * everywhere : update calls to the above methods accordingly.
20630 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20632 * assign.cs (Assign): Make it inherit from ExpressionStatement.
20634 * expression.cs (ExpressionStatement): New base class used for
20635 expressions that can appear in statements, so that we can provide
20636 an alternate path to generate expression that do not leave a value
20639 (Expression::Emit, and all the derivatives): We no longer return
20640 whether a value is left on the stack or not. Every expression
20641 after being emitted leaves a single value on the stack.
20643 * codegen.cs (EmitContext::EmitStatementExpression): Use the
20644 facilties of ExpressionStatement if possible.
20646 * cs-parser.jay: Update statement_expression.
20648 2001-09-25 Miguel de Icaza <miguel@ximian.com>
20650 * driver.cs: Change the wording of message
20652 2001-09-25 Ravi Pratap <ravi@ximian.com>
20654 * expression.cs (Binary::ResolveOperator): Had forgottten to set
20655 the type of the expression to the return type of the method if
20656 we have an overloaded operator match ! The regression tests pass again !
20657 (Unary::ResolveOperator): Ditto.
20659 * expression.cs (Invocation::ConversionExists): Correct the member lookup
20660 to find "op_Implicit", not "implicit" ;-)
20661 (UserImplicitCast): New class to take care of user-defined implicit conversions.
20662 (ConvertImplicit, ForceConversion): Take TypeContainer argument
20664 * everywhere : Correct calls to the above accordingly.
20666 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
20667 (ConvertImplicit): Do user-defined conversion if it exists.
20669 2001-09-24 Miguel de Icaza <miguel@ximian.com>
20671 * assign.cs: track location.
20672 (Resolve): Use implicit conversions on assignment.
20674 * literal.cs: Oops. Not good, Emit of short access values should
20675 pass (Bytes) or the wrong argument will be selected.
20677 * expression.cs (Unary::Emit): Emit code for -expr.
20679 (Unary::ResolveOperator): Handle `Substract' for non-constants
20680 (substract from zero from the non-constants).
20681 Deal with Doubles as well.
20683 (Expression::ConvertImplicitRequired): New routine that reports an
20684 error if no implicit conversion exists.
20686 (Invocation::OverloadResolve): Store the converted implicit
20687 expressions if we make them
20689 2001-09-24 Ravi Pratap <ravi@ximian.com>
20691 * class.cs (ConstructorInitializer): Take a Location argument.
20692 (ConstructorBaseInitializer): Same here.
20693 (ConstructorThisInitializer): Same here.
20695 * cs-parser.jay : Update all calls accordingly.
20697 * expression.cs (Unary, Binary, New): Take location argument.
20698 Update accordingly everywhere.
20700 * cs-parser.jay : Update all calls to the above to take a location
20703 * class.cs : Ditto.
20705 2001-09-24 Ravi Pratap <ravi@ximian.com>
20707 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
20708 (Invocation::BetterConversion): Same here
20709 (Invocation::ConversionExists): Ditto.
20711 (Invocation::ConversionExists): Implement.
20713 2001-09-22 Ravi Pratap <ravi@ximian.com>
20715 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
20716 Also take an additional TypeContainer argument.
20718 * All over : Pass in TypeContainer as argument to OverloadResolve.
20720 * typemanager.cs (CSharpName): Update to check for the string type and return
20723 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
20726 2001-09-21 Ravi Pratap <ravi@ximian.com>
20728 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
20729 (Invocation::BetterFunction): Implement.
20730 (Invocation::BetterConversion): Implement.
20731 (Invocation::ConversionExists): Skeleton, no implementation yet.
20733 Okay, things work fine !
20735 2001-09-21 Miguel de Icaza <miguel@ximian.com>
20737 * typemanager.cs: declare and load enum_type, delegate_type and
20740 * expression.cs (Expression::Emit): Now emit returns a value that
20741 tells whether a value is left on the stack or not. This strategy
20742 might be reveted tomorrow with a mechanism that would address
20743 multiple assignments.
20744 (Expression::report118): Utility routine to report mismatches on
20747 (Unary::Report23): Report impossible type/operator combination
20750 (Unary::IsIncrementableNumber): Whether the type can be
20751 incremented or decremented with add.
20752 (Unary::ResolveOperator): Also allow enumerations to be bitwise
20754 (Unary::ResolveOperator): Implement ++, !, ~,
20756 (Invocation::Emit): Deal with new Emit convetion.
20758 * All Expression derivatives: Updated their Emit method to return
20759 whether they leave values on the stack or not.
20761 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
20762 stack for expressions that are statements.
20764 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20766 * expression.cs (LValue): New interface. Must be implemented by
20768 (LocalVariableReference, ParameterReference, FieldExpr): Implement
20771 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
20772 interface for generating code, simplifies the code.
20774 2001-09-20 Ravi Pratap <ravi@ximian.com>
20776 * expression.cs (everywhere): Comment out return statements in ::Resolve
20777 methods to avoid the warnings.
20779 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20781 * driver.cs (parse): Report error 2001 if we can not open the
20784 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
20787 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
20790 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
20791 otherwise nested blocks end up with the same index.
20793 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
20795 * expression.cs: Instead of having FIXMEs in the Resolve
20796 functions, throw exceptions so it is obvious that we are facing a
20799 * cs-parser.jay (invocation_expression): Pass Location information.
20801 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
20802 Use a basename for those routines because .NET does not like paths
20805 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
20808 2001-09-19 Miguel de Icaza <miguel@ximian.com>
20810 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
20811 are loading the correct data types (throws an exception if not).
20812 (TypeManager::InitCoreTypes): Use CoreLookupType
20814 * expression.cs (Unary::ResolveOperator): return the child
20815 expression for expressions which are just +expr.
20816 (Unary::ResolveOperator): Return negative literals for -LITERAL
20817 expressions (otherwise they are Unary {Literal}).
20818 (Invocation::Badness): Take into account `Implicit constant
20819 expression conversions'.
20821 * literal.cs (LongLiteral): Implement long literal class.
20822 (IntLiteral): export the `Value' of the intliteral.
20824 2001-09-19 Ravi Pratap <ravi@ximian.com>
20826 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
20828 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
20829 instead of 'Operator'
20831 * expression.cs (Binary::ResolveOperator): Update accordingly.
20832 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
20835 * cs-parser.jay (unary_expression): Update to use the new names.
20837 * gen-treedump.cs (GetUnary): Same here.
20839 * expression.cs (Unary::Resolve): Implement.
20840 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
20841 operators are found instead of making noise ;-)
20842 (Unary::ResolveOperator): New method to do precisely the same thing which
20843 Binary::ResolveOperator does for Binary expressions.
20844 (Unary.method, .Arguments): Add.
20845 (Unary::OperName): Implement.
20846 (Unary::ForceConversion): Copy and Paste !
20848 * class.cs (Operator::Define): Fix a small bug for the case when we have
20851 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
20852 for the inbuilt operators. Only overloading works for now ;-)
20854 2001-09-18 Miguel de Icaza <miguel@ximian.com>
20856 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
20857 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
20859 * expression.cs (This::Emit): Implement.
20860 (This::Resolve): Implement.
20861 (TypeOf:Resolve): Implement.
20862 (Expression::ResolveSimpleName): Add an implicit this to instance
20864 (MemberAccess::Resolve): Deal with Parameters and Fields.
20865 Bind instance variable to Field expressions.
20866 (FieldExpr::Instance): New field used to track the expression that
20867 represents the object instance.
20868 (FieldExpr::Resolve): Track potential errors from MemberLookup not
20870 (FieldExpr::Emit): Implement.
20872 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
20873 the last instruction contains a return opcode to avoid generating
20874 the last `ret' instruction (this generates correct code, and it is
20875 nice to pass the peverify output).
20877 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
20878 initializer for static and instance variables.
20879 (Constructor::Emit): Allow initializer to be null in the case of
20880 static constructors. Only emit initializer for instance
20883 (TypeContainer::FindMembers): Return a null array if there are no
20886 Also fix the code for the MemberTypes.Method branch, as it was not
20887 scanning that for operators (or tried to access null variables before).
20889 * assign.cs (Assign::Emit): Handle instance and static fields.
20893 * driver.cs: Stop compilation if there are parse errors.
20895 * cs-parser.jay (constructor_declaration): Provide default base
20896 initializer for non-static constructors.
20897 (constructor_declarator): Do not provide a default base
20898 initializers if none was specified.
20899 Catch the fact that constructors should not have parameters.
20901 * class.cs: Do not emit parent class initializers for static
20902 constructors, that should be flagged as an error.
20904 2001-09-18 Ravi Pratap <ravi@ximian.com>
20906 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
20907 Move back code into TypeContainer::Populate.
20909 2001-09-18 Ravi Pratap <ravi@ximian.com>
20911 * class.cs (TypeContainer::AddConstructor): Fix the check to
20912 compare against Name, not Basename.
20913 (Operator::OpType): Change Plus and Minus to Add and Subtract.
20915 * cs-parser.jay : Update accordingly.
20917 * class.cs (TypeContainer::FindMembers): For the case where we are searching
20918 for methods, don't forget to look into the operators too.
20919 (RegisterMethodBuilder): Helper method to take care of this for
20920 methods, constructors and operators.
20921 (Operator::Define): Completely revamp.
20922 (Operator.OperatorMethod, MethodName): New fields.
20923 (TypeContainer::Populate): Move the registering of builders into
20924 RegisterMethodBuilder.
20925 (Operator::Emit): Re-write.
20927 * expression.cs (Binary::Emit): Comment out code path to emit method
20928 invocation stuff for the case when we have a user defined operator. I am
20929 just not able to get it right !
20931 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20933 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
20936 (Expression::MemberLookup): Provide a version that allows to
20937 specify the MemberTypes and BindingFlags.
20939 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
20940 so it was not fetching variable information from outer blocks.
20942 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
20943 Beforefieldinit as it was buggy.
20945 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
20946 that Ravi put here.
20948 * class.cs (Constructor::Emit): Only emit if block is not null.
20949 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
20950 deal with this by semantically definining it as if the user had
20953 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
20954 constructors as we now "emit" them at a higher level.
20956 (TypeContainer::DefineDefaultConstructor): Used to define the
20957 default constructors if none was provided.
20959 (ConstructorInitializer): Add methods Resolve and Emit.
20961 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
20963 2001-09-17 Ravi Pratap <ravi@ximian.com>
20965 * class.cs (TypeContainer::EmitDefaultConstructor): Register
20966 the default constructor builder with our hashtable for methodbuilders
20969 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20970 and argument_count is 0 in which case we have a match.
20971 (Binary::ResolveOperator): More null checking and miscellaneous coding
20974 2001-09-17 Ravi Pratap <ravi@ximian.com>
20976 * rootcontext.cs (IsNameSpace): Compare against null.
20978 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20980 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20981 and Unary::Operator.
20983 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20986 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20987 we have overloaded operators.
20988 (Binary::ResolveOperator): Implement the part which does the operator overload
20991 * class.cs (Operator::Emit): Implement.
20992 (TypeContainer::Emit): Emit the operators we have too.
20994 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20995 the case when we have a user-defined operator.
20997 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20999 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
21001 2001-09-16 Ravi Pratap <ravi@ximian.com>
21003 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
21004 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
21005 (Constructor::Emit): Implement.
21006 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
21007 if we have no work to do.
21008 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
21011 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
21012 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
21014 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
21017 2001-09-15 Ravi Pratap <ravi@ximian.com>
21019 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
21021 (Tree::RecordNamespace): Method to do what the name says ;-)
21022 (Tree::Namespaces): Property to get at the namespaces hashtable.
21024 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
21027 * rootcontext.cs (IsNamespace): Fixed it :-)
21029 2001-09-14 Miguel de Icaza <miguel@ximian.com>
21031 * class.cs (TypeContainer::FindMembers): Add support for
21033 (MethodCore): New class that encapsulates both the shared aspects
21034 of a Constructor and a Method.
21035 (Method, Constructor): Factored pieces into MethodCore.
21037 * driver.cs: Added --fatal which makes errors throw exceptions.
21038 Load System assembly as well as part of the standard library.
21040 * report.cs: Allow throwing exceptions on errors for debugging.
21042 * modifiers.cs: Do not use `parent', instead use the real type
21043 container to evaluate permission settings.
21045 * class.cs: Put Ravi's patch back in. He is right, and we will
21046 have to cope with the
21048 2001-09-14 Ravi Pratap <ravi@ximian.com>
21050 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
21051 FamORAssem, not FamANDAssem.
21053 2001-09-14 Miguel de Icaza <miguel@ximian.com>
21055 * driver.cs: Added --parse option that only parses its input files
21058 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
21059 incorrect. IsTopLevel is not used to tell whether an object is
21060 root_types or not (that can be achieved by testing this ==
21061 root_types). But to see if this is a top-level *class* (not
21062 necessarly our "toplevel" container).
21064 2001-09-14 Ravi Pratap <ravi@ximian.com>
21066 * enum.cs (Enum::Define): Modify to call the Lookup method on the
21067 parent instead of a direct call to GetType.
21069 2001-09-14 Ravi Pratap <ravi@ximian.com>
21071 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
21072 Modifiers.TypeAttr. This should just be a call to that method.
21074 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
21075 object so that we can determine if we are top-level or not.
21077 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
21080 * enum.cs (Enum::Define): Ditto.
21082 * modifiers.cs (FieldAttr): Re-write.
21084 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
21085 (TypeContainer::HaveStaticConstructor): New property to provide access
21086 to precisely that info.
21088 * modifiers.cs (MethodAttr): Re-write.
21089 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
21091 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
21092 of top-level types as claimed.
21094 2001-09-13 Miguel de Icaza <miguel@ximian.com>
21096 * expression.cs (MemberLookup): Fruitless attempt to lookup
21097 constructors. Maybe I need to emit default constructors? That
21098 might be it (currently .NET emits this for me automatically).
21099 (Invocation::OverloadResolve): Cope with Arguments == null.
21100 (Invocation::EmitArguments): new function, shared by the new
21101 constructor and us.
21102 (Invocation::Emit): Handle static and instance methods. Emit
21103 proper call instruction for virtual or non-virtual invocations.
21104 (New::Emit): Implement.
21105 (New::Resolve): Implement.
21106 (MemberAccess:Resolve): Implement.
21107 (MethodGroupExpr::InstanceExpression): used conforming to the spec
21108 to track instances.
21109 (FieldExpr::Resolve): Set type.
21111 * support.cs: Handle empty arguments.
21113 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
21114 SimpleLookup): Auxiliary routines to help parse a qualifier
21117 Update qualifier_identifier rule.
21119 * codegen.cs: Removed debugging messages.
21121 * class.cs: Make this a global thing, this acts just as a "key" to
21122 objects that we might have around.
21124 (Populate): Only initialize method_builders_to_methods once.
21126 * expression.cs (PropertyExpr): Initialize type from the
21129 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
21130 Resolve pattern. Attempt to implicitly convert value to boolean.
21133 * expression.cs: Set the type for the int32/int32 argument case.
21134 (Binary::ResolveOperator): Set the return type to boolean for
21135 comparission operators
21137 * typemanager.cs: Remove debugging print code.
21139 (Invocation::Resolve): resolve type.
21141 * class.cs: Allocate a MemberInfo of the correct size, as the code
21142 elsewhere depends on the test to reflect the correct contents.
21144 (Method::) Keep track of parameters, due to System.Reflection holes
21146 (TypeContainer::Populate): Keep track of MethodBuilders to Method
21149 (TypeContainer::FindMembers): Use ArrayList and then copy an array
21150 of the exact size and return that.
21152 (Class::LookupMethodByBuilder): New function that maps
21153 MethodBuilders to its methods. Required to locate the information
21154 on methods because System.Reflection bit us again.
21156 * support.cs: New file, contains an interface ParameterData and
21157 two implementations: ReflectionParameters and InternalParameters
21158 used to access Parameter information. We will need to grow this
21161 * expression.cs (Invocation::GetParameterData): implement a cache
21162 and a wrapper around the ParameterData creation for methods.
21163 (Invocation::OverloadResolve): Use new code.
21165 2001-09-13 Ravi Pratap <ravi@ximian.com>
21167 * class.cs (TypeContainer::EmitField): Remove and move into
21168 (Field::Define): here and modify accordingly.
21169 (Field.FieldBuilder): New member.
21170 (TypeContainer::Populate): Update accordingly.
21171 (TypeContainer::FindMembers): Implement.
21173 2001-09-13 Miguel de Icaza <miguel@ximian.com>
21175 * statement.cs: (VariableInfo::VariableType): New field to be
21176 initialized with the full type once it is resolved.
21178 2001-09-12 Miguel de Icaza <miguel@ximian.com>
21180 * parameter.cs (GetParameterInfo): Use a type cache to compute
21181 things only once, and to reuse this information
21183 * expression.cs (LocalVariableReference::Emit): Implement.
21184 (OpcodeCast::Emit): fix.
21186 (ParameterReference::Resolve): Implement.
21187 (ParameterReference::Emit): Implement.
21189 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
21190 that are expressions need to stay as Expressions.
21192 * typemanager.cs (CSharpName): Returns the C# name of a type if
21195 * expression.cs (Expression::ConvertImplicit): New function that
21196 implements implicit type conversions.
21198 (Expression::ImplicitReferenceConversion): Implements implicit
21199 reference conversions.
21201 (EmptyCast): New type for transparent casts.
21203 (OpcodeCast): New type for casts of types that are performed with
21204 a sequence of bytecodes.
21206 (BoxedCast): New type used for casting value types into reference
21207 types. Emits a box opcode.
21209 (Binary::DoNumericPromotions): Implements numeric promotions of
21210 and computation of the Binary::Type.
21212 (Binary::EmitBranchable): Optimization.
21214 (Binary::Emit): Implement code emission for expressions.
21216 * typemanager.cs (TypeManager): Added two new core types: sbyte
21219 2001-09-12 Ravi Pratap <ravi@ximian.com>
21221 * class.cs (TypeContainer::FindMembers): Method which does exactly
21222 what Type.FindMembers does, only we don't have to use reflection. No
21223 implementation yet.
21225 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
21226 typecontainer objects as we need to get at them.
21227 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
21229 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
21230 typecontainer object.
21232 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
21233 of just a Report object.
21235 2001-09-11 Ravi Pratap <ravi@ximian.com>
21237 * class.cs (Event::Define): Go back to using the prefixes "add_" and
21239 (TypeContainer::Populate): Now define the delegates of the type too.
21240 (TypeContainer.Delegates): Property to access the list of delegates defined
21243 * delegates.cs (Delegate::Define): Implement partially.
21245 * modifiers.cs (TypeAttr): Handle more flags.
21247 2001-09-11 Ravi Pratap <ravi@ximian.com>
21249 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
21251 (Operator::Define): Re-write logic to get types by using the LookupType method
21252 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
21253 (Indexer::Define): Ditto.
21254 (Event::Define): Ditto.
21255 (Property::Define): Ditto.
21257 2001-09-10 Ravi Pratap <ravi@ximian.com>
21259 * class.cs (TypeContainer::Populate): Now define operators too.
21260 (TypeContainer.Operators): New property to access the list of operators
21262 (Operator.OperatorMethodBuilder): New member to hold the method builder
21263 for the operator we are defining.
21264 (Operator::Define): Implement.
21266 2001-09-10 Ravi Pratap <ravi@ximian.com>
21268 * class.cs (Event::Define): Make the prefixes of the accessor methods
21269 addOn_ and removeOn_
21271 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
21272 of the location being passed in too. Ideally, this should go later since all
21273 error reporting should be done through the Report object.
21275 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
21276 (Populate): Iterate thru the indexers we have and define them too.
21277 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
21278 for the get and set accessors.
21279 (Indexer::Define): Implement.
21281 2001-09-09 Miguel de Icaza <miguel@ximian.com>
21283 * expression.cs (Binary::Resolve): Beginning of it. I scratched
21284 my previous implementation, did not work.
21286 * typemanager.cs: Add a couple of missing types (the longs).
21288 * literal.cs: Use TypeManager.bool_type instead of getting it.
21290 * expression.cs (EventExpr): New kind of expressions.
21291 (Expressio::ExprClassFromMemberInfo): finish
21293 2001-09-08 Miguel de Icaza <miguel@ximian.com>
21295 * assign.cs: Emit stores to static fields differently.
21297 2001-09-08 Ravi Pratap <ravi@ximian.com>
21299 * Merge in changes and adjust code to tackle conflicts. Backed out my
21300 code in Assign::Resolve ;-)
21302 2001-09-08 Ravi Pratap <ravi@ximian.com>
21304 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
21305 instead Report.Error and also pass in the location.
21306 (CSharpParser::Lexer): New readonly property to return the reference
21307 to the Tokenizer object.
21308 (declare_local_variables): Use Report.Error with location instead of plain
21312 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
21313 (Operator.CheckBinaryOperator): Ditto.
21315 * cs-parser.jay (operator_declarator): Update accordingly.
21317 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
21318 (CheckBinaryOperator): Same here.
21320 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
21321 on the name without any prefixes of namespace names etc. This is because we
21322 already might have something already fully qualified like
21323 'System.Console.WriteLine'
21325 * assign.cs (Resolve): Begin implementation. Stuck ;-)
21327 2001-09-07 Ravi Pratap <ravi@ximian.com>
21329 * cs-tokenizer.cs (location): Return a string which also contains
21332 * expression.cs (ElementAccess): New class for expressions of the
21333 type 'element access.'
21334 (BaseAccess): New class for expressions of the type 'base access.'
21335 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
21338 * cs-parser.jay (element_access): Implement action.
21339 (base_access): Implement actions.
21340 (checked_expression, unchecked_expression): Implement.
21342 * cs-parser.jay (local_variable_type): Correct and implement.
21343 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
21345 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
21347 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
21348 name and the specifiers.
21350 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
21352 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
21353 making them all public ;-)
21355 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
21358 2001-09-07 Miguel de Icaza <miguel@ximian.com>
21360 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
21362 (FieldExpr, PropertyExprs): New resolved expressions.
21363 (SimpleName::MemberStaticCheck): Perform static checks for access
21364 to non-static fields on static methods. Maybe this should be
21365 generalized for MemberAccesses.
21366 (SimpleName::ResolveSimpleName): More work on simple name
21369 * cs-parser.jay (primary_expression/qualified_identifier): track
21370 the parameter index.
21372 * codegen.cs (CodeGen::Save): Catch save exception, report error.
21373 (EmitContext::EmitBoolExpression): Chain to expression generation
21374 instead of temporary hack.
21375 (::EmitStatementExpression): Put generic expression code generation.
21377 * assign.cs (Assign::Emit): Implement variable assignments to
21378 local variables, parameters and fields.
21380 2001-09-06 Miguel de Icaza <miguel@ximian.com>
21382 * statement.cs (Block::GetVariableInfo): New method, returns the
21383 VariableInfo for a variable name in a block.
21384 (Block::GetVariableType): Implement in terms of GetVariableInfo
21386 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
21387 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
21389 2001-09-06 Ravi Pratap <ravi@ximian.com>
21391 * cs-parser.jay (operator_declaration): Continue on my quest : update
21392 to take attributes argument.
21393 (event_declaration): Ditto.
21394 (enum_declaration): Ditto.
21395 (indexer_declaration): Ditto.
21397 * class.cs (Operator::Operator): Update constructor accordingly.
21398 (Event::Event): Ditto.
21400 * delegate.cs (Delegate::Delegate): Same here.
21402 * enum.cs (Enum::Enum): Same here.
21404 2001-09-05 Ravi Pratap <ravi@ximian.com>
21406 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
21408 * ../tests/cs0658.cs : New file to demonstrate error 0658.
21410 * attribute.cs (Attributes): New class to encapsulate all attributes which were
21411 being passed around as an arraylist.
21412 (Attributes::AddAttribute): Method to add attribute sections.
21414 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
21415 (struct_declaration): Update accordingly.
21416 (constant_declaration): Update.
21417 (field_declaration): Update.
21418 (method_header): Update.
21419 (fixed_parameter): Update.
21420 (parameter_array): Ditto.
21421 (property_declaration): Ditto.
21422 (destructor_declaration): Ditto.
21424 * class.cs (Struct::Struct): Update constructors accordingly.
21425 (Class::Class): Ditto.
21426 (Field::Field): Ditto.
21427 (Method::Method): Ditto.
21428 (Property::Property): Ditto.
21429 (TypeContainer::OptAttribute): update property's return type.
21431 * interface.cs (Interface.opt_attributes): New member.
21432 (Interface::Interface): Update to take the extra Attributes argument.
21434 * parameter.cs (Parameter::Parameter): Ditto.
21436 * constant.cs (Constant::Constant): Ditto.
21438 * interface.cs (InterfaceMemberBase): New OptAttributes field.
21439 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
21440 the attributes as a parameter.
21441 (InterfaceProperty): Update constructor call.
21442 (InterfaceEvent): Ditto.
21443 (InterfaceMethod): Ditto.
21444 (InterfaceIndexer): Ditto.
21446 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
21447 pass the attributes too.
21448 (interface_event_declaration): Ditto.
21449 (interface_property_declaration): Ditto.
21450 (interface_method_declaration): Ditto.
21451 (interface_declaration): Ditto.
21453 2001-09-05 Miguel de Icaza <miguel@ximian.com>
21455 * class.cs (Method::Define): Track the "static Main" definition to
21456 create an entry point.
21458 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
21459 EntryPoint if we find it.
21461 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
21462 (EmitContext::ig): Make this variable public.
21464 * driver.cs: Make the default output file be the first file name
21465 with the .exe extension.
21467 Detect empty compilations
21469 Handle various kinds of output targets. Handle --target and
21470 rename -t to --dumper.
21472 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
21473 methods inherited from Expression return now an Expression. This
21474 will is used during the tree rewriting as we resolve them during
21477 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
21478 the spec. Missing entirely is the information about
21479 accessability of elements of it.
21481 (Expression::ExprClassFromMemberInfo): New constructor for
21482 Expressions that creates a fully initialized Expression based on
21483 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
21486 (Invocation::Resolve): Begin implementing resolution of invocations.
21488 * literal.cs (StringLiteral): Implement Emit.
21490 2001-09-05 Ravi Pratap <ravi@ximian.com>
21492 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
21495 2001-09-04 Ravi Pratap <ravi@ximian.com>
21497 * cs-parser.jay (attribute_arguments): Implement actions.
21498 (attribute): Fix bug in production. Implement action.
21499 (attribute_list): Implement.
21500 (attribute_target): Implement.
21501 (attribute_target_specifier, opt_target_specifier): Implement
21502 (CheckAttributeTarget): New method to check if the attribute target
21504 (attribute_section): Implement.
21505 (opt_attributes): Implement.
21507 * attribute.cs : New file to handle attributes.
21508 (Attribute): Class to hold attribute info.
21510 * cs-parser.jay (opt_attribute_target_specifier): Remove production
21511 (attribute_section): Modify production to use 2 different rules to
21512 achieve the same thing. 1 s/r conflict down !
21513 Clean out commented, useless, non-reducing dimension_separator rules.
21515 * class.cs (TypeContainer.attributes): New member to hold list
21516 of attributes for a type.
21517 (Struct::Struct): Modify to take one more argument, the attribute list.
21518 (Class::Class): Ditto.
21519 (Field::Field): Ditto.
21520 (Method::Method): Ditto.
21521 (Property::Property): Ditto.
21523 * cs-parser.jay (struct_declaration): Update constructor call to
21524 pass in the attributes too.
21525 (class_declaration): Ditto.
21526 (constant_declaration): Ditto.
21527 (field_declaration): Ditto.
21528 (method_header): Ditto.
21529 (fixed_parameter): Ditto.
21530 (parameter_array): Ditto.
21531 (property_declaration): Ditto.
21533 * constant.cs (Constant::Constant): Update constructor similarly.
21534 Use System.Collections.
21536 * parameter.cs (Parameter::Parameter): Update as above.
21538 2001-09-02 Ravi Pratap <ravi@ximian.com>
21540 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
21541 (TypeContainer.delegates): New member to hold list of delegates.
21543 * cs-parser.jay (delegate_declaration): Implement the action correctly
21544 this time as I seem to be on crack ;-)
21546 2001-09-02 Miguel de Icaza <miguel@ximian.com>
21548 * rootcontext.cs (RootContext::IsNamespace): new function, used to
21549 tell whether an identifier represents a namespace.
21551 * expression.cs (NamespaceExpr): A namespace expression, used only
21552 temporarly during expression resolution.
21553 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
21554 utility functions to resolve names on expressions.
21556 2001-09-01 Miguel de Icaza <miguel@ximian.com>
21558 * codegen.cs: Add hook for StatementExpressions.
21560 * class.cs: Fix inverted test for static flag in methods.
21562 2001-09-02 Ravi Pratap <ravi@ximian.com>
21564 * class.cs (Operator::CheckUnaryOperator): Correct error number used
21565 to make it coincide with MS' number.
21566 (Operator::CheckBinaryOperator): Ditto.
21568 * ../errors/errors.txt : Remove error numbers added earlier.
21570 * ../errors/cs1019.cs : Test case for error # 1019
21572 * ../errros/cs1020.cs : Test case for error # 1020
21574 * cs-parser.jay : Clean out commented cruft.
21575 (dimension_separators, dimension_separator): Comment out. Ostensibly not
21576 used anywhere - non-reducing rule.
21577 (namespace_declarations): Non-reducing rule - comment out.
21579 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
21580 with TypeContainer::AddEnum.
21582 * delegate.cs : New file for delegate handling classes.
21583 (Delegate): Class for declaring delegates.
21585 * makefile : Update.
21587 * cs-parser.jay (delegate_declaration): Implement.
21589 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
21591 * class.cs (Event::Define): Implement.
21592 (Event.EventBuilder): New member.
21594 * class.cs (TypeContainer::Populate): Update to define all enums and events
21596 (Events): New property for the events arraylist we hold. Shouldn't we move to using
21597 readonly fields for all these cases ?
21599 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21601 * class.cs (Property): Revamp to use the convention of making fields readonly.
21602 Accordingly modify code elsewhere.
21604 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
21605 the Define method of the Property class.
21607 * class.cs : Clean up applied patch and update references to variables etc. Fix
21609 (TypeContainer::Populate): Update to define all the properties we have. Also
21610 define all enumerations.
21612 * enum.cs (Define): Implement.
21614 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21616 * cs-parser.jay (overloadable_operator): The semantic value is an
21617 enum of the Operator class.
21618 (operator_declarator): Implement actions.
21619 (operator_declaration): Implement.
21621 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
21622 validity of definitions.
21623 (Operator::CheckBinaryOperator): Static method to check for binary operators
21624 (TypeContainer::AddOperator): New method to add an operator to a type.
21626 * cs-parser.jay (indexer_declaration): Added line to actually call the
21627 AddIndexer method so it gets added ;-)
21629 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
21630 already taken care of by the MS compiler ?
21632 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21634 * class.cs (Operator): New class for operator declarations.
21635 (Operator::OpType): Enum for the various operators.
21637 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21639 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
21640 ostensibly handle this in semantic analysis.
21642 * cs-parser.jay (general_catch_clause): Comment out
21643 (specific_catch_clauses, specific_catch_clause): Ditto.
21644 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
21645 (catch_args, opt_catch_args): New productions.
21646 (catch_clause): Rewrite to use the new productions above
21647 (catch_clauses): Modify accordingly.
21648 (opt_catch_clauses): New production to use in try_statement
21649 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
21650 and re-write the code in the actions to extract the specific and
21651 general catch clauses by being a little smart ;-)
21653 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
21654 Hooray, try and catch statements parse fine !
21656 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21658 * statement.cs (Block::GetVariableType): Fix logic to extract the type
21659 string from the hashtable of variables.
21661 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
21662 I end up making that mistake ;-)
21663 (catch_clauses): Fixed gross error which made Key and Value of the
21664 DictionaryEntry the same : $1 !!
21666 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21668 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
21670 * cs-parser.jay (event_declaration): Correct to remove the semicolon
21671 when the add and remove accessors are specified.
21673 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21675 * cs-parser.jay (IndexerDeclaration): New helper class to hold
21676 information about indexer_declarator.
21677 (indexer_declarator): Implement actions.
21678 (parsing_indexer): New local boolean used to keep track of whether
21679 we are parsing indexers or properties. This is necessary because
21680 implicit_parameters come into picture even for the get accessor in the
21681 case of an indexer.
21682 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
21684 * class.cs (Indexer): New class for indexer declarations.
21685 (TypeContainer::AddIndexer): New method to add an indexer to a type.
21686 (TypeContainer::indexers): New member to hold list of indexers for the
21689 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21691 * cs-parser.jay (add_accessor_declaration): Implement action.
21692 (remove_accessor_declaration): Implement action.
21693 (event_accessors_declaration): Implement
21694 (variable_declarators): swap statements for first rule - trivial.
21696 * class.cs (Event): New class to hold information about event
21698 (TypeContainer::AddEvent): New method to add an event to a type
21699 (TypeContainer::events): New member to hold list of events.
21701 * cs-parser.jay (event_declaration): Implement actions.
21703 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21705 * cs-parser.jay (dim_separators): Implement. Make it a string
21706 concatenating all the commas together, just as they appear.
21707 (opt_dim_separators): Modify accordingly
21708 (rank_specifiers): Update accordingly. Basically do the same
21709 thing - instead, collect the brackets here.
21710 (opt_rank_sepcifiers): Modify accordingly.
21711 (array_type): Modify to actually return the complete type string
21712 instead of ignoring the rank_specifiers.
21713 (expression_list): Implement to collect the expressions
21714 (variable_initializer): Implement. We make it a list of expressions
21715 essentially so that we can handle the array_initializer case neatly too.
21716 (variable_initializer_list): Implement.
21717 (array_initializer): Make it a list of variable_initializers
21718 (opt_array_initializer): Modify accordingly.
21720 * expression.cs (New::NType): Add enumeration to help us
21721 keep track of whether we have an object/delegate creation
21722 or an array creation.
21723 (New:NewType, New::Rank, New::Indices, New::Initializers): New
21724 members to hold data about array creation.
21725 (New:New): Modify to update NewType
21726 (New:New): New Overloaded contructor for the array creation
21729 * cs-parser.jay (array_creation_expression): Implement to call
21730 the overloaded New constructor.
21732 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
21734 * class.cs (TypeContainer::Constructors): Return member
21735 constructors instead of returning null.
21737 2001-08-26 Miguel de Icaza <miguel@ximian.com>
21739 * typemanager.cs (InitCoreTypes): Initialize the various core
21740 types after we have populated the type manager with the user
21741 defined types (this distinction will be important later while
21742 compiling corlib.dll)
21744 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
21745 on Expression Classification. Now all expressions have a method
21746 `Resolve' and a method `Emit'.
21748 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
21749 generation from working. Also add some temporary debugging
21752 2001-08-24 Miguel de Icaza <miguel@ximian.com>
21754 * codegen.cs: Lots of code generation pieces. This is only the
21755 beginning, will continue tomorrow with more touches of polish. We
21756 handle the fundamentals of if, while, do, for, return. Others are
21757 trickier and I need to start working on invocations soon.
21759 * gen-treedump.cs: Bug fix, use s.Increment here instead of
21762 * codegen.cs (EmitContext): New struct, used during code
21763 emission to keep a context. Most of the code generation will be
21766 * cs-parser.jay: Add embedded blocks to the list of statements of
21767 this block. So code generation proceeds in a top down fashion.
21769 2001-08-23 Miguel de Icaza <miguel@ximian.com>
21771 * statement.cs: Add support for multiple child blocks.
21773 2001-08-22 Miguel de Icaza <miguel@ximian.com>
21775 * codegen.cs (EmitCode): New function, will emit the code for a
21776 Block of code given a TypeContainer and its ILGenerator.
21778 * statement.cs (Block): Standard public readonly optimization.
21779 (Block::Block constructors): Link children.
21780 (Block::Child): Child Linker.
21781 (Block::EmitVariables): Emits IL variable declarations.
21783 * class.cs: Drop support for MethodGroups here, delay until
21785 (Method::): Applied the same simplification that I did before, and
21786 move from Properties to public readonly fields.
21787 (Method::ParameterTypes): Returns the parameter types for the
21788 function, and implements a cache that will be useful later when I
21789 do error checking and the semantic analysis on the methods is
21791 (Constructor::GetCallingConvention): Renamed from CallingConvetion
21792 and made a method, optional argument tells whether this is a class
21793 or a structure to apply the `has-this' bit.
21794 (Method::GetCallingConvention): Implement, returns the calling
21796 (Method::Define): Defines the type, a second pass is performed
21797 later to populate the methods.
21799 (Constructor::ParameterTypes): implement a cache similar to the
21800 one on Method::ParameterTypes, useful later when we do semantic
21803 (TypeContainer::EmitMethod): New method. Emits methods.
21805 * expression.cs: Removed MethodGroup class from here.
21807 * parameter.cs (Parameters::GetCallingConvention): new method.
21809 2001-08-21 Miguel de Icaza <miguel@ximian.com>
21811 * class.cs (TypeContainer::Populate): Drop RootContext from the
21814 (Constructor::CallingConvention): Returns the calling convention.
21815 (Constructor::ParameterTypes): Returns the constructor parameter
21818 (TypeContainer::AddConstructor): Keep track of default constructor
21819 and the default static constructor.
21821 (Constructor::) Another class that starts using `public readonly'
21822 instead of properties.
21824 (Constructor::IsDefault): Whether this is a default constructor.
21826 (Field::) use readonly public fields instead of properties also.
21828 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
21829 track of static constructors; If none is used, turn on
21830 BeforeFieldInit in the TypeAttributes.
21832 * cs-parser.jay (opt_argument_list): now the return can be null
21833 for the cases where there are no arguments.
21835 (constructor_declarator): If there is no implicit `base' or
21836 `this', then invoke the default parent constructor.
21838 * modifiers.cs (MethodAttr): New static function maps a set of
21839 modifiers flags into a MethodAttributes enum
21840 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
21841 MethodAttr, TypeAttr to represent the various mappings where the
21842 modifiers are used.
21843 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
21845 2001-08-19 Miguel de Icaza <miguel@ximian.com>
21847 * parameter.cs (GetParameterInfo): Fix bug where there would be no
21850 * interface.cs (PopulateIndexer): Implemented the code generator
21851 for interface indexers.
21853 2001-08-17 Miguel de Icaza <miguel@ximian.com>
21855 * interface.cs (InterfaceMemberBase): Now we track the new status
21858 (PopulateProperty): Implement property population. Woohoo! Got
21859 Methods and Properties going today.
21861 Removed all the properties for interfaces, and replaced them with
21862 `public readonly' fields.
21864 2001-08-16 Miguel de Icaza <miguel@ximian.com>
21866 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
21867 initialize their hashtables/arraylists only when they are needed
21868 instead of doing this always.
21870 * parameter.cs: Handle refs and out parameters.
21872 * cs-parser.jay: Use an ArrayList to construct the arguments
21873 instead of the ParameterCollection, and then cast that to a
21876 * parameter.cs: Drop the use of ParameterCollection and use
21877 instead arrays of Parameters.
21879 (GetParameterInfo): Use the Type, not the Name when resolving
21882 2001-08-13 Miguel de Icaza <miguel@ximian.com>
21884 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
21885 and instead use public readonly fields.
21887 * class.cs: Put back walking code for type containers.
21889 2001-08-11 Miguel de Icaza <miguel@ximian.com>
21891 * class.cs (MakeConstant): Code to define constants.
21893 * rootcontext.cs (LookupType): New function. Used to locate types
21896 2001-08-08 Miguel de Icaza <miguel@ximian.com>
21898 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
21899 this System.Reflection code is. Kudos to Microsoft
21901 * typemanager.cs: Implement a type cache and avoid loading all
21902 types at boot time. Wrap in LookupType the internals. This made
21903 the compiler so much faster. Wow. I rule!
21905 * driver.cs: Make sure we always load mscorlib first (for
21906 debugging purposes, nothing really important).
21908 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
21909 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
21911 * rootcontext.cs: Lookup types on their namespace; Lookup types
21912 on namespaces that have been imported using the `using' keyword.
21914 * class.cs (TypeContainer::TypeAttr): Virtualize.
21915 (Class::TypeAttr): Return attributes suitable for this bad boy.
21916 (Struct::TypeAttr): ditto.
21917 Handle nested classes.
21918 (TypeContainer::) Remove all the type visiting code, it is now
21919 replaced with the rootcontext.cs code
21921 * rootcontext.cs (GetClassBases): Added support for structs.
21923 2001-08-06 Miguel de Icaza <miguel@ximian.com>
21925 * interface.cs, statement.cs, class.cs, parameter.cs,
21926 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
21927 Drop use of TypeRefs, and use strings instead.
21929 2001-08-04 Miguel de Icaza <miguel@ximian.com>
21933 * class.cs (Struct::Struct): set the SEALED flags after
21934 checking the modifiers.
21935 (TypeContainer::TypeAttr): new property, returns the
21936 TypeAttributes for a class.
21938 * cs-parser.jay (type_list): Oops, list production was creating a
21939 new list of base types.
21941 * rootcontext.cs (StdLib): New property.
21942 (GetInterfaceTypeByName): returns an interface by type name, and
21943 encapsulates error handling here.
21944 (GetInterfaces): simplified.
21945 (ResolveTree): Encapsulated all the tree resolution here.
21946 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
21949 * driver.cs: Add support for --nostdlib, to avoid loading the
21950 default assemblies.
21951 (Main): Do not put tree resolution here.
21953 * rootcontext.cs: Beginning of the class resolution.
21955 2001-08-03 Miguel de Icaza <miguel@ximian.com>
21957 * rootcontext.cs: Provide better error reporting.
21959 * cs-parser.jay (interface_base): set our $$ to be interfaces.
21961 * rootcontext.cs (CreateInterface): Handle the case where there
21962 are no parent interfaces.
21964 (CloseTypes): Routine to flush types at the end.
21965 (CreateInterface): Track types.
21966 (GetInterfaces): Returns an array of Types from the list of
21967 defined interfaces.
21969 * typemanager.c (AddUserType): Mechanism to track user types (puts
21970 the type on the global type hash, and allows us to close it at the
21973 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21975 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21976 RecordInterface instead.
21978 * cs-parser.jay: Updated to reflect changes above.
21980 * decl.cs (Definition): Keep track of the TypeBuilder type that
21981 represents this type here. Not sure we will use it in the long
21982 run, but wont hurt for now.
21984 * driver.cs: Smaller changes to accomodate the new code.
21986 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21989 * rootcontext.cs (CreateInterface): New method, used to create
21990 the System.TypeBuilder type for interfaces.
21991 (ResolveInterfaces): new entry point to resolve the interface
21993 (CodeGen): Property, used to keep track of the code generator.
21995 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21997 * cs-parser.jay: Add a second production for delegate_declaration
22000 (enum_body): Put an opt_comma here instead of putting it on
22001 enum_body or enum_member_declarations so we can handle trailing
22002 commas on enumeration members. Gets rid of a shift/reduce.
22004 (type_list): Need a COMMA in the middle.
22006 (indexer_declaration): Tell tokenizer to recognize get/set
22008 * Remove old targets.
22010 * Re-add the parser target.
22012 2001-07-13 Simon Cozens <simon@simon-cozens.org>
22014 * cs-parser.jay: Add precendence rules for a number of operators
22015 ot reduce the number of shift/reduce conflicts in the grammar.
22017 2001-07-17 Miguel de Icaza <miguel@ximian.com>
22019 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
22022 Get rid of old crufty code.
22024 * rootcontext.cs: Use this to keep track of the parsed
22025 representation and the defined types available to the program.
22027 * gen-treedump.cs: adjust for new convention.
22029 * type.cs: Split out the type manager, and the assembly builder
22032 * typemanager.cs: the type manager will live here now.
22034 * cil-codegen.cs: And the code generator here.
22036 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
22038 * makefile: Fixed up for easy making.
22040 2001-07-13 Simon Cozens <simon@simon-cozens.org>
22042 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
22045 (unary_expression): Expand pre_increment_expression and
22046 post_decrement_expression to reduce a shift/reduce.
22048 2001-07-11 Simon Cozens
22050 * cs-tokenizer.cs: Hex numbers should begin with a 0.
22052 Improve allow_keyword_as_indent name.
22054 2001-06-19 Miguel de Icaza <miguel@ximian.com>
22056 * Adjustments for Beta2.
22058 2001-06-13 Miguel de Icaza <miguel@ximian.com>
22060 * decl.cs: Added `Define' abstract method.
22061 (InTransit): new property, used to catch recursive definitions.
22063 * interface.cs: Implement `Define'.
22065 * modifiers.cs: Map Modifiers.constants to
22066 System.Reflection.TypeAttribute flags.
22068 * class.cs: Keep track of types and user-defined types.
22069 (BuilderInit): New method for creating an assembly
22070 (ResolveType): New function to launch the resolution process, only
22071 used by interfaces for now.
22073 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
22074 that are inserted into the name space.
22076 2001-06-08 Miguel de Icaza <miguel@ximian.com>
22078 * ARGH. I have screwed up my tree so many times due to the use of
22079 rsync rather than using CVS. Going to fix this at once.
22081 * driver.cs: Objetify driver. Load assemblies, use assemblies to
22084 2001-06-07 Miguel de Icaza <miguel@ximian.com>
22086 * Experiment successful: Use System.Type rather that our own
22089 2001-05-25 Miguel de Icaza <miguel@ximian.com>
22091 * cs-parser.jay: Removed nsAliases from here.
22093 Use new namespaces, handle `using XXX;'
22095 * namespace.cs: Reimplemented namespace handling, use a recursive
22096 definition of the class. Now we can keep track of using clauses
22097 and catch invalid using clauses.
22099 2001-05-24 Miguel de Icaza <miguel@ximian.com>
22101 * gen-treedump.cs: Adapted for all the renaming.
22103 * expression.cs (Expression): this class now has a Type property
22104 which returns an expression Type.
22106 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
22107 `Type', as this has a different meaning now in the base
22109 2001-05-22 Miguel de Icaza <miguel@ximian.com>
22111 * interface.cs, class.cs: Removed from all the sources the
22112 references to signature computation, as we can not do method
22113 signature computation during the parsing time, as we are not
22114 trying to solve at that point distinguishing:
22118 void a (NS.Blah x) {}
22121 Which depending on the context might be valid or not, as we do not
22122 know if Blah is the same thing as NS.Blah at that point.
22124 * Redid everything so the code uses TypeRefs now instead of
22125 Types. TypeRefs are just temporary type placeholders, that need
22126 to be resolved. They initially have a pointer to a string and the
22127 current scope in which they are used. This is used later by the
22128 compiler to resolve the reference to an actual Type.
22130 * DeclSpace is no longer a CIR.Type, and neither are
22131 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
22132 are all DeclSpaces, but no Types.
22134 * type.cs (TypeRefManager): This implements the TypeRef manager,
22135 which keeps track of all the types that need to be resolved after
22136 the parsing has finished.
22138 2001-05-13 Miguel de Icaza <miguel@ximian.com>
22140 * ARGH. We are going to have to store `foreach' as a class rather
22141 than resolving it, as we need to verify error 1579 after name
22142 resolution. *OR* we could keep a flag that says `This request to
22143 IEnumerator comes from a foreach statement' which we can then use
22144 to generate the error.
22146 2001-05-10 Miguel de Icaza <miguel@ximian.com>
22148 * class.cs (TypeContainer.AddMethod): we now add methods to the
22149 MethodGroup instead of the method hashtable.
22151 * expression.cs: Add MethodGroup abstraction, which gets us one
22152 step closer to the specification in the way we handle method
22155 * cs-parser.jay (primary_expression): qualified_identifier now
22156 tried to match up an identifier to a local variable reference or
22157 to a parameter reference.
22159 current_local_parameters is now a parser global variable that
22160 points to the current parameters for the block, used during name
22163 (property_declaration): Now creates an implicit `value' argument to
22166 2001-05-09 Miguel de Icaza <miguel@ximian.com>
22168 * parameter.cs: Do not use `param' arguments as part of the
22169 signature, per the spec.
22171 2001-05-08 Miguel de Icaza <miguel@ximian.com>
22173 * decl.cs: Base class for classes, structs and interfaces. This
22174 is the "Declaration Space"
22176 * cs-parser.jay: Use CheckDef for checking declaration errors
22177 instead of having one on each function.
22179 * class.cs: Factor out some code for handling error handling in
22180 accordance to the "Declarations" section in the "Basic Concepts"
22181 chapter in the ECMA C# spec.
22183 * interface.cs: Make all interface member classes derive from
22184 InterfaceMemberBase.
22186 2001-05-07 Miguel de Icaza <miguel@ximian.com>
22188 * Many things: all interfaces are parsed and generated in
22189 gen-treedump. Support for member variables, constructors,
22190 destructors, properties, constants is there.
22192 Beginning of the IL backend, but very little done, just there for
22195 2001-04-29 Miguel de Icaza <miguel@ximian.com>
22197 * cs-parser.jay: Fix labeled statement.
22199 * cs-tokenizer.cs (escape): Escape " and ' always.
22200 ref_line, ref_name: keep track of the line/filename as instructed
22201 by #line by the compiler.
22204 2001-04-27 Miguel de Icaza <miguel@ximian.com>
22206 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
22207 to match the values in System.CodeDOM.
22209 Divid renamed to Divide.
22211 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
22213 (Statements.set): remove.
22215 * System.CodeDOM/CodeCatchClause.cs: always have a valid
22218 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
22219 falseStatements always have valid values.
22221 * cs-parser.jay: Use System.CodeDOM now.