1 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
3 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
4 allowed inside a switch (without loop). Fixed bug #75433.
6 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
8 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
9 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
11 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
13 * driver.cs : kinda reverting the default encoding changes (not exact
14 revert since I noticed that "codepage:reset" might not work fine).
16 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
18 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
19 Location. Now getter and setter store location correctly.
20 (errors/cs0111-12.cs now reports the expected location.)
22 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
24 * driver.cs : Use default encoding on the environment.
25 Removed (now that) extra parameter for SeekableStreamReader.
26 * support.cs : (SeekableStreamReader) third .ctor() argument for
27 StreamReader is not required (always true). preamble size could
28 be acquired in simpler and safe way.
30 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
32 * cs-parser.jay: report CS0642 at warning level 3
33 and report CS0642 for an if else statement also
34 fixes bug #74745. Patch by John Luke (and a bit
36 Removed extra CS0642 warning check for "while",
38 * statement.cs: In Block.Resolve(), CS0642 check
39 is reimplemented to check a sequence of an empty
40 statement and a block.
44 2005-08-24 Marek Safar <marek.safar@seznam.cz>
46 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
47 detection until I fix it.
49 * cs-tokenizer.cs: Changed error message.
51 * cs-parser.jay: Fixed 2 error locations.
53 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
54 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
57 * enum.cs (GetSignatureForError): Fixed.
59 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
63 * typemanager.cs (RegisterProperty): Removed.
65 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
67 2005-08-24 Raja R Harinath <rharinath@novell.com>
70 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
71 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
73 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
75 * expression.cs : tiny fix is required for not warning positive ulong.
78 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
80 * expression.cs : add CS0652 check for constant and integral
81 expression. Fixed bug #53974.
83 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
85 * expression.cs : in DoNumericPromotions(), check if there is implicit
86 conversion overload for string (to check CS0034). Fixed bug #52492.
88 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
90 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
92 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
94 * ecore.cs : report location when it is *not* Null.
96 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
102 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
103 correctly. Fixed bug #75721.
105 2005-08-23 Raja R Harinath <rharinath@novell.com>
107 * support.cs (SeekableStreamReader.Position): Avoid an expensive
108 loop that performs 'min (pos, char_count)'.
111 * expression.cs (Unary.ResolveOperator): Don't discard implicit
112 converted value in Operator.OnesComplement.
114 2005-08-22 Ben Maurer <bmaurer@ximian.com>
116 * anonymous.cs: If the anon method is pulled into a helper class,
117 it needs to be `internal' not `private'. Fixes runtime behavior on
120 2005-08-20 Martin Baulig <martin@ximian.com>
122 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
123 scope if we don't already have it.
125 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
126 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
129 2005-08-17 Marek Safar <marek.safar@seznam.cz>
132 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
135 2005-08-16 Marek Safar <marek.safar@seznam.cz>
137 The big constants rewrite
138 Fix #75746, #75685 and more
139 As a side effect saved 1MB for MWF ;-)
141 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
142 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
143 enum based for corlib compilation.
145 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
148 * class.cs (FixedField.Define): Use ResolveAsConstant.
150 * const.cs (IConstant): Interface constants and enums.
151 (Const.ResolveValue): New method for constant resolvning.
152 (ExternalConstant): Constants from imported assemblies.
154 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
155 conversion; like enums.
156 (Constant.ToType): Converts this constant to different type.
157 (Constant.Increment): Adds 1.
159 * convert.cs (ImplicitConversionRequired): Simplified.
161 * cs-parser.jay: Create EnumMember directly.
163 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
165 * doc.cs (GenerateEnumDocComment): Removed.
167 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
168 (ConvertIntLiteral): Removed.
169 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
171 * enum.cs (EnumMember): Implement IConstant.
172 (Enum.IsValidEnumConstant): Removed.
173 (Enum.GetNextDefaultValue): Removed.
174 (Enum.FindMembers): Updated.
175 (Enum.GenerateDocComment): Iterate enum members.
177 * expression.cs (Cast.TryReduce): Handle enums correctly.
178 (New.Constantify): Made public.
179 (MemberAccess.DoResolve): Removed contant specific if(s).
181 * literal.cs (NullLiteral): Implement new abstract methods.
183 * statement.cs (GotoCase.Resolve): Use new constant methods.
184 (SwitchLabel.ResolveAndReduce): Use new constant methods.
186 * typemanager.cs (LookupEnum): Removed.
187 (IsEnumType): Fixed to work with corlib.
188 (RegisterConstant): Removed.
189 (LookupConstant): Removed.
190 (GetConstant): Changed to work with IConstant.
192 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
194 * location.cs : Fixed overflown (>255) column number.
196 2005-08-03 Raja R Harinath <rharinath@novell.com>
198 First cut of the qualified-alias-member feature.
199 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
201 * cs-parser.jay (DOUBLE_COLON): New token.
202 (namespace_or_type_name): Add rule for recognizing
203 qualified-alias-members.
204 (primary_expression): Likewise.
205 (element_access): Allow QualifiedAliasMember as a possible
206 type-bearing expression.
207 (local_variable_type, local_variable_pointer_type): Likewise.
208 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
209 aliases in the current and enclosing namespace declarations.
210 (NamespaceEntry.UsingAlias): Add CS0440 warning.
211 * decl.cs (MemberName.is_double_colon): New.
212 (MemberName.MemberName): Add new constructor for alias-member.
213 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
214 * expression.cs (QualifiedAliasMember): New expression type.
216 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
218 * location.cs : it borked when no argument was specified.
220 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
222 * location.cs : tiny ToString() format fix.
224 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
226 * statement.cs : oops, it was missing.
228 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
230 A set of fixes for precise line/column location.
233 "token" field now holds a file/line "delta", a line number offset
234 from the segment, and a column number. See also:
235 http://lists.ximian.com/pipermail/mono-devel-list/2004-
237 Removed static IsNull. Use instance IsNull property instead.
239 For some tokens it stores Location. For Identifier it stores
240 LocatedToken which is a pair of string name and location.
241 Column numbers are adjusted only at getChar().
243 Use Location.ToString() for reporting (it now contains column).
245 Largely modified to use LocatedToken instead of
246 string (IDENTIFIER), and to acquire Location from some tokens.
247 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
248 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
250 Now MemberName holds Location. DeclSpace.ctor() receives Location
251 as a parameter. Removed extra parameters to all derived classes.
252 Replaced Location.IsNull() with instance property.
253 * assign.cs, expression.cs :
254 Added .ctor() overload that omits Location.
256 Added "nameEscaped" flag that indicates the identifier was escaped
257 in the source file. This fixes bug #57047.
259 2005-08-02 Marek Safar <marek.safar@seznam.cz>
261 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
262 New method, looking for lo-case imported cls type.
264 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
267 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
269 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
271 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
273 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
275 Optimized to save 3.5 MB for SWF compilation.
277 2005-08-01 Marek Safar <marek.safar@seznam.cz>
279 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
280 (PartialContainer.Create): Moved logic AddToContainer.
281 (PartialContainer.MarkForDuplicationCheck): Shares name.
283 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
286 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
288 (Namespace.GetSignatureForError): New method.
290 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
291 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
293 2005-08-01 Raja R Harinath <rharinath@novell.com>
296 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
297 member lookup rather than qualifier_type, since qualifier_type can
300 2005-08-01 Marek Safar <marek.safar@seznam.cz>
302 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
305 2005-07-31 Miguel de Icaza <miguel@novell.com>
307 * statement.cs: Copy the local exception into the exception
308 captured local. Fixes 75674
310 2005-07-31 Raja R Harinath <harinath@gmail.com>
313 * expression.cs (Invocation.OverloadResolve): Don't report error
314 CS1501 if error CS1502 has been reported.
315 (New.DoResolve): Delegate CS1501 reporting to
316 Invocation.OverloadResolve.
319 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
320 invariant-meaning-in-block property in an enclosing block if
323 2005-07-29 Marek Safar <marek.safar@seznam.cz>
325 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
326 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
327 (Switch.CheckSwitch): Just save 50kb for SWF.
329 2005-07-27 Martin Baulig <martin@ximian.com>
331 * anonymous.cs (CaptureContext.AddField): Added
332 `AnonymousContainer am' argument; compute its toplevel scope if
333 it's not already computed. Fixes #75649.
335 2005-07-26 Raja R Harinath <rharinath@novell.com>
338 * class.cs (Constructor.Emit): Reset block to null if the block
341 2005-07-25 Marek Safar <marek.safar@seznam.cz>
343 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
345 2005-07-25 Marek Safar <marek.safar@seznam.cz>
347 * class.cs (MethodData.Define): Check whether accessor implementing
350 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
352 2005-07-22 Marek Safar <marek.safar@seznam.cz>
355 * namespace.cs (LookupType): Moved same type check to...
357 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
360 2005-07-21 Raja R Harinath <rharinath@novell.com>
362 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
363 already found a typebuilder.
364 * class.cs (MethodCore.IsDuplicateImplementation): Compare
365 MemberNames, not strings.
367 * const.cs (Error_ExpressionMustBeConst):
368 Rename from Error_EpressionMustBeConst.
369 * const.cs, class.cs, statement.cd: Update.
371 2005-07-21 Marek Safar <marek.safar@seznam.cz>
375 * const.cs (Const.LookupConstantValue): Report missing contant expression
377 (Error_EpressionMustBeConstant): Only one error method.
379 * class.cs, statement.c: Updated.
381 2005-07-20 Raja R Harinath <rharinath@novell.com>
383 * statement.cs (Block.Flags): Add back HasVarargs.
384 (Block.flags): Make protected.
385 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
387 * typemanager.cs (types, typecontainers, user_types): Remove.
388 (UserTypes, TypeContainers): Likewise.
389 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
390 (CleanUp, Reset): Update.
391 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
392 (GetNestedType): Use Type.GetNestedType.
393 (CoreLookupType): Take two arguments, the namespace and the
394 basename of the type. Update to use the Namespace.Lookup
396 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
397 (RealMemberLookup): Use IsNestedChildOf instead of playing with
398 string concatenation and substring matches.
399 * class.cs, enum.cs, delegate.cs: Update to changes.
401 2005-07-20 Marek Safar <marek.safar@seznam.cz>
403 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
404 Expression and made virtual.
406 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
407 (ImplicitStandardConversionExists): Fixed `byte' typo ?
409 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
411 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
414 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
417 2005-07-18 Marek Safar <marek.safar@seznam.cz>
420 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
421 AssemblyCultureAttribute is not used on executable.
424 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
426 2005-07-16 Raja R Harinath <rharinath@novell.com>
429 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
430 New. Reports CS0252/CS0253.
431 Mostly taken from preliminary patch by Duncak Mak.
432 (Binary.DoResolveOperator): Store results of operator lookup.
433 Use them to detect if we need to warn about unintended reference
436 2005-07-15 Raja R Harinath <rharinath@novell.com>
439 * namespace.cs (Namespace.Lookup): Add back location parameter.
440 (Namespace.LookupType): Add CS0436 report. Add location parameter.
441 * delegate.cs, ecore.cs, expression.cs: Update to changes.
443 * codegen.cs (EmitContext.DeclSpace): Make readonly.
444 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
445 (Namespace.LookupType): ... this.
446 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
448 * typemanager.cs (LookupTypeReflection): Remove buggy code that
449 purported to handle pointers.
450 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
453 2005-07-15 Marek Safar <marek.safar@seznam.cz>
455 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
458 2005-07-15 Raja R Harinath <rharinath@novell.com>
460 * namespace.cs (Namespace.Lookup): Drop location parameter.
461 (NamespaceEntry.LookupAlias): Remove. Merge into ...
462 (NamespaceEntry.Lookup): ... this.
463 (NamespaceEntry.Error_AmbiguousTypeReference):
464 Move here from DeclSpace.
465 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
467 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
468 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
469 Move to NamespaceEntry.
470 * delegate.cs, expression.cs: Update to changes.
472 2005-07-14 Marek Safar <marek.safar@seznam.cz>
474 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
475 CheckAttributeType and refactored.
476 (Attribute.ResolvePossibleAttributeType): Changed to reuse
477 ResolveAsTypeTerminal error handling.
478 (ResolveAsTypeTerminal): Introduced because of global attributes extra
480 (GetSignatureForError): Print errors in same way.
483 * codegen.cs: Reflect attribute GetSignatureForError change.
486 * expression.cs: Add silent parameter to ResolveAsTypeStep.
488 * namespace.cs (UsingEntry): Refactored to make fields private.
491 statement.cs: Error_UnexpectedKind has extra parameter.
493 2005-07-14 Raja R Harinath <rharinath@novell.com>
495 * ecore.cs (IAlias): Remove.
496 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
497 that implement the interface.
498 * namespace.cs (Namespace): Likewise.
499 (Namespace.declspaces): Renamed from 'defined_names'.
500 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
501 DeclSpace instead of an IAlias.
502 * tree.cs (Tree.AddDecl): Update.
504 2005-07-12 Raja R Harinath <rharinath@novell.com>
506 * statement.cs (Block.Flags); Remove HasVarargs.
507 (Block.HasVarargs): Move to ToplevelBlock.
508 (Block.ThisVariable, Block.AddThisVariable): Likewise.
509 (Block.Variables): Make protected. Initialize variable hashtable
511 (Block.AddVariable): Update.
512 (Block.Resolve): Update to changes.
513 (ToplevelBlock.HasVarargs): New boolean.
514 (ToplevelBlock.ThisVariable): Move here from Block.
515 (ToplevelBlock.AddThisVariable): Likewise.
516 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
517 * expression.cs (This.ResolveBase): Update to changes.
518 (ArglistAccess.DoResolve): Likewise.
520 2005-07-11 Marek Safar <marek.safar@seznam.cz>
523 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
525 * class.cs (TypeContainer.VerifyMembers): Distinguish between
526 not used and not used & assigned.
527 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
529 2005-07-11 Marek Safar <marek.safar@seznam.cz>
532 * expression.cs (Is.DoResolve): null is never provided type.
534 2005-07-08 Marek Safar <marek.safar@seznam.cz>
537 * cs-parser.jay: Less strict event error rule to catch more errors.
539 2005-07-08 Martin Baulig <martin@ximian.com>
541 Fix test-iter-10.cs - distinguish whether we `yield' in a property
542 gettter (allowed) or setter (not allowed).
544 * class.cs (Accessor): Implement IIteratorContainer.
545 (Accessor.Yields): New public field.
546 (PropertyBase.PropertyMethod.Define): Handle iterators on a
550 (get_accessor_declaration, set_accessor_declaration): Set the
551 `yields' flag on the accessor, not the property.
552 (property_declaration): Do the iterators check on a per-accessor
553 basis and not for the whole property.
555 2005-07-08 Martin Baulig <martin@ximian.com>
557 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
558 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
560 2005-07-07 Marek Safar <marek.safar@seznam.cz>
563 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
564 (ExtractSecurityPermissionSet): Cope with self referencing security
567 * driver.cs (SetOutputFile): Made public property OutputFile.
569 2005-07-07 Raja R Harinath <rharinath@novell.com>
572 * class.cs (TypeContainer.first_nonstatic_field): Rename from
573 has_nonstatic_fields. Make into a FieldBase pointer.
574 (TypeContainer.AddField): Add CS0282 check.
575 (TypeContainer.EmitType): Update.
577 2005-07-06 Miguel de Icaza <miguel@novell.com>
579 * cs-tokenizer.cs (consume_identifier): Do not create strings to
580 compare if they start with __.
582 2005-07-06 Raja R Harinath <rharinath@novell.com>
584 * statement.cs (Switch.SwitchGoverningType): Only look at
585 UserCasts that don't need implicit standard conversions to one of
586 the allowed switch types (Fixes test-322.cs).
587 (LocalInfo.Resolve): Re-enable sanity-test.
589 2005-07-06 Marek Safar <marek.safar@seznam.cz>
591 * cs-tokenizer.cs (consume_identifier): Detect double undescores
593 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
595 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
597 2005-07-06 Raja R Harinath <rharinath@novell.com>
600 * ecore.cs (SimpleName.GetSignatureForError): Add.
601 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
602 (MemberAccess.GetSignatureForError): Add.
604 2005-07-05 Marek Safar <marek.safar@seznam.cz>
606 The big error and warning messages review.
636 * typemanager.cs: Updated.
638 * class.cs: (MethodCore.SetYields): Moved here to share.
639 (PropertyMethod.Define): Moved iterator setup here.
641 * iterators.cs: Add orig_method to have full access to parent
644 2005-07-05 Raja R Harinath <rharinath@novell.com>
646 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
647 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
648 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
649 variable of struct type.
650 * expression.cs (Unary.ResolveOperator): Update to change.
651 (Indirection.VerifyFixed): Likewise.
652 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
653 (ParameterReference.VerifyFixed): Value parameters are fixed.
654 (This.VerifyFixed): Treat 'this' as a value parameter.
655 * statement.cs (LocalInfo.IsFixed): Remove.
657 2005-07-01 Martin Baulig <martin@ximian.com>
659 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
660 `ec.EmitThis ()' to get the correct scope.
662 2005-07-01 Martin Baulig <martin@ximian.com>
664 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
665 instance is a ParameterReference; fixes #75299.
667 2005-07-01 Martin Baulig <martin@ximian.com>
669 Reverted Marek's latest patch (r46725):
670 - it contains structural changes which are neither mentioned in
671 the ChangeLog nor explained anywhere; for example the additional
672 argument of EmitContext's and Iterator's .ctor's and the
673 TypeContainer.DefineMembers() change.
674 - structural changes like this should go in in seperate patches
675 and not be hidden in a huge patch which just seems to affect
677 a big and hard to understand patch.
678 - it breaks iterators and causes regressions, for instance in
681 2005-06-30 Raja R Harinath <rharinath@novell.com>
684 * expression.cs (Indexers.map): Remove.
685 (Indexers.Append): Filter out inaccessible setters and getters.
686 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
689 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
691 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
692 (FieldExpr.Emit, PropertyExpr.Emit): Update.
693 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
694 * expression.cs (Invocation.EmitCall): Add CS0120 check.
696 2005-06-30 Marek Safar <marek.safar@seznam.cz>
699 * class.cs (FieldBase.GetInitializerExpression): One more field
702 2005-06-28 Miguel de Icaza <miguel@novell.com>
704 * pending.cs: Do not define a proxy if the base method is virtual,
705 it will be picked up by the runtime (bug 75270).
707 2005-06-08 Martin Baulig <martin@ximian.com>
709 The big Iterators rewrite :-)
711 * iterators.cs: Rewrite this to use the anonymous methods framework.
713 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
714 before the TypeContainers; see 2test-21.cs.
717 (TypeContainer.DefineType): Don't create a new EmitContext if we
718 already have one (this only happens if we're an Iterator).
719 (TypeContainer.Define): Also call Define() on all our iterators.
720 (Method.CreateEmitContext): Added support for iterators.
723 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
724 (AnonymousContainer.CreateMethodHost): Moved here from
725 AnonymousMethod and made abstract.
726 (AnonymousContainer.CreateScopeType): New abstract method.
727 (AnonymousContainer.IsIterator): New public property.
728 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
729 get the ScopeTypeBuilder rather than manually defining it here.
730 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
733 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
734 before RootContext.DefineTypes().
736 * codegen.cs (EmitContext.RemapToProxy): Removed.
737 (EmitContext.CurrentAnonymousMethod): Changed type from
738 AnonymousMethod -> AnonymousContainer.
739 (EmitContext.ResolveTopBlock): Protect from being called twice.
740 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
741 (EmitContext.EmitThis): Removed the iterators hacks; use the
742 anonymous methods framework for that.
745 (ToplevelBlock.Container): Make this a property, not a field.
746 (ToplevelBlock.ReParent): New public method; move the
747 ToplevelBlock into a new container.
748 (Foreach.TemporaryVariable): Simplify.
750 2005-06-05 Martin Baulig <martin@ximian.com>
752 * statement.cs (LocalInfo.CompilerGenerated): New flag.
753 (Block.AddTemporaryVariable): New public method; creates a new
754 `LocalInfo' for a temporary variable.
755 (Block.EmitMeta): Create the LocalBuilders for all the temporary
757 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
758 non-iterator variables.
760 2005-06-05 Martin Baulig <martin@ximian.com>
762 * statement.cs (Foreach.TemporaryVariable): Create the
763 LocalBuilder in the Emit phase and not in Resolve since in some
764 situations, we don't have an ILGenerator during Resolve; see
765 2test-19.cs for an example.
767 2005-06-04 Martin Baulig <martin@ximian.com>
769 **** Merged r45395 from GCS ****
771 The big Foreach rewrite - Part II.
773 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
774 with `PropertyInfo ienumerator_getcurrent'.
776 * codegen.cs (VariableStorage): Removed.
779 (Foreach): Derive from Statement, not ExceptionStatement.
780 (Foreach.CollectionForeach): New nested class. Moved all the code
781 dealing with collection foreach here.
782 (Foreach.ForeachHelperMethods): Removed.
783 (Foreach.TemporaryVariable): Implement IMemoryLocation.
785 2005-05-23 Martin Baulig <martin@ximian.com>
787 * statement.cs (Try.DoResolve): Don't create a `finally' if we
788 don't need to. Fix #75014.
790 2005-05-20 Martin Baulig <martin@ximian.com>
792 Merged r44808 from GMCS.
794 * class.cs (TypeContainer.CircularDepException): Removed.
795 (TypeContainer.DefineType): Removed the `InTransit' stuff.
796 (TypeContainer.CheckRecursiveDefinition): Check for circular class
797 (CS0146) and interface (CS0529) dependencies here.
799 2005-06-21 Raja R Harinath <rharinath@novell.com>
801 * expression.cs (Invocation.EmitCall): Fix initialization
802 'this_call' to reflect current behaviour. Fix indentation.
804 * convert.cs (FindMostEncompassedType): Add two trivial special
805 cases (number_of_types == 0 || number_of_types == 1).
806 (FindMostEncompasingType): Likewise.
808 2005-06-17 Raja R Harinath <rharinath@novell.com>
810 Some cleanups preparing for the fix of #75283.
811 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
813 (EventExpr.InstanceResolve): Likewise.
814 (EventExpr.DoResolve): Remove redundant checks.
816 2005-06-10 Duncan Mak <duncan@novell.com>
818 * cs-tokenizer.cs (process_directives): New flag for controlling
819 the processing of preprocessor directives.
820 (x_token): After seeing a '#', return Token.NONE instead of going
821 to handle_preprocessing_directive() when not processing
822 directives. This avoids unnecessary processing during the token peek in
827 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
828 the existing error reporting methods instead of Report.Error.
830 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
831 after Raja's rewrite.
833 2005-06-08 Miguel de Icaza <miguel@novell.com>
835 * class.cs: Small fix.
837 2005-06-08 Raja R Harinath <rharinath@novell.com>
840 * class.cs (GetPartialBases): Fix return value check of
843 2005-06-07 Raja R Harinath <rharinath@novell.com>
845 Ensure that partial classes are registered in their enclosing
846 namespace. Initial part of fix of #75160.
847 * tree.cs (Tree.RecordDecl): Add new namespace argument.
848 Register declspace with namespace here, not in
849 DeclSpace.RecordDecl.
850 * cs-parser.jay: Pass namespace to RecordDecl.
851 * class.cs (PartialContainer.Create): Likewise.
852 (ClassPart.DefineType): New sanity-check. Throws an exception if
854 * decl.cs (Declspace.RecordDecl): Remove.
855 * namespace.cs (NamespaceEntry.DefineName): Remove.
857 2005-06-06 Marek Safar <marek.safar@seznam.cz>
859 * rootcontext.cs: Reset TargetExt as well.
861 2005-06-03 Raja R Harinath <rharinath@novell.com>
863 * ecore.cs (Expression.Resolve): Emit CS0654 error when
866 2005-06-02 Raja R Harinath <rharinath@novell.com>
868 Fix #75080, cs0119.cs.
869 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
871 (Expression.Resolve): ... this. Use it. Remove bogus code
872 allowing ExprClass.Type and ExprClass.Namespace for
873 ResolveFlags.VariableOrValue.
874 (Expression.Resolve) [1-argument variant]: Change default resolve
875 flags based on language version.
876 (Expression.Error_UnexpectedKind): Use a simple string array
877 rather than an ArrayList.
878 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
880 (TypeOfVoid.DoResolve): Likewise.
881 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
882 flags argument -- it always has the same value.
884 2005-05-31 Raja R Harinath <rharinath@novell.com>
887 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
888 Use it in the error message.
889 * assign.cs, expression.cs, statement.cs: Update.
891 2005-05-30 Raja R Harinath <rharinath@novell.com>
894 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
895 the "almostMatchedMember" case too.
896 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
897 that failed the accessibility checks to 'almost_match'.
899 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
901 * attribute.cs: Use internal MethodBuilder methods to set
902 ExactSpelling and SetLastError on PInvoke methods, instead
903 of passing them via charset. Fixes #75060.
905 2005-05-27 Raja R Harinath <rharinath@novell.com>
907 * parameter.cs (Parameter): Remove TODO comment.
908 (Parameter.DefineParameter): Remove Location parameter.
909 (Parameters.LabelParameters): Likewise.
910 * class.cs (Constructor.Emit): Update to change.
911 (MethodData.Emit): Likewise.
912 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
913 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
915 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
918 Removed Parameters.Location and added Parameter.Location instead.
919 Removed Location parameter from Emit() and GetSignature().
926 Modified all related calls.
928 2005-05-26 Raja R Harinath <rharinath@novell.com>
930 Improve user-defined conversion handling.
931 * convert.cs (GetConversionOperators): Rewrite. Return only the
932 applicable operators.
933 (AddConversionOperators): New. Helper for GetConversionOperators.
934 (FindMostEncompassedType, FindMostEncompassingType): Verify that
935 there is only one most encompassed/encompassing type.
936 (FindMostSpecificSource, FindMostSpecificTarget): Remove
937 "applicable operator" handling.
938 (UserConversion): Move cache here from GetConversionOperators.
939 Directly cache the chosen operator, rather than the whole
941 (ExplicitNumericConversion): Fix buggy implementation of Decimal
942 case. Allow conversion of decimal to sbyte and byte too.
943 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
944 New static methods. Used to avoid allocating EmptyExpressions in
947 2005-05-24 Duncan Mak <duncan@novell.com>
949 * ecore.cs (CastFromDecimal): New class for casting a decimal to
950 another class, used in Convert.ExplicitNumericConversion.
951 (CastToDecimal): New class, similar to above, but casts to
952 System.Decimal, used in Convert.ImplicitNumericConversion and also
953 in explicit convesion from double/float to decimal.
955 * convert.cs (ImplicitNumericConversion): Handle implicit
956 conversions to System.Decimal.
957 (ExplicitNumericConversion): handle explicit conversions to
962 2005-05-20 Miguel de Icaza <miguel@novell.com>
964 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
965 know the type at this stage, just break through. Fixes #75008
967 2005-05-19 Martin Baulig <martin@ximian.com>
970 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
971 to disable error reporting.
973 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
974 here since we don't want to report an error; see the new test-336.cs.
976 2005-05-19 Raja R Harinath <rharinath@novell.com>
978 * statement.cs (ToplevelBlock.GetParameterReference)
979 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
980 Move here from class Block.
981 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
982 * expression.cs (ParameterReference.DoResolveBase): Likewise.
984 2005-05-18 Martin Baulig <martin@ximian.com>
989 (FlowBranching.Reachability): Add non-static public And() and Or()
991 (FlowBranchingSwitch): New class; do the `break_origins' thing
992 like in FlowBranchingLoop.
993 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
994 reachability, not just locals and parameters.
995 (FlowBranching.MergeChild): Remove some of the hacks for loop and
996 switch; MergeBreakOrigins() now takes care of that.
998 2005-05-18 Martin Baulig <martin@ximian.com>
1000 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1001 a loop and may leave it, reset the barrier; fixes #74974.
1003 2005-05-17 Marek Safar <marek.safar@seznam.cz>
1005 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
1008 * cs-parser.jay: Catch more lexical errors.
1010 * report.cs: Add one more Error method.
1013 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
1015 2005-05-17 Martin Baulig <martin@ximian.com>
1017 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
1020 2005-05-16 Raja R Harinath <rharinath@novell.com>
1022 Fix test-382.cs. Emit values of decimal constants.
1023 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
1025 (TypeContainer.AddField): ... this.
1026 (TypeContainer.EmitFieldInitializers): Allow the list of fields
1027 with initializers to include 'Const's.
1028 (ClassPart.RegisterFieldForInitialization): Forward to
1030 * const.cs (Const.Const): Pass initializer to base class.
1031 (Const.Define): In case of decimal constants, register them for
1032 initialization in a static constructor.
1034 2005-05-14 Martin Baulig <martin@ximian.com>
1036 * statement.cs (Block.Resolve): Correctly handle unreachable code;
1037 do not call ResolveUnreachable() on unreachable statements in
1038 here, see the comment in the source code.
1040 2005-05-13 Raja R Harinath <rharinath@novell.com>
1043 * expression.cs (BinaryResolveOperator): If one of the operands of
1044 an equality comparison is 'null' and the other is a pointer type,
1045 convert the null to a NullPointer.
1046 * convert.cs (ImplicitReferenceConversion): If the expression is a
1047 NullLiteral and the target type is a pointer type, return a
1048 NullPointer instead.
1049 (ImplicitConversionStandard): Likewise.
1051 2005-05-13 Marek Safar <marek.safar@seznam.cz>
1053 * cs-parser.jay: Set readonly context based on special constructs.
1055 * expression.cs (LocalVariableReference.DoResolveBase): Improved
1056 readonly variable error handling.
1058 * rootcontext.cs (EmitCode): Don't verify members when error
1061 * statement.cs (LocalInfo): Add reaodnly context information.
1062 (SetReadOnlyContext, GetReadOnlyContext): New methods.
1064 2005-05-13 Raja R Harinath <rharinath@novell.com>
1066 * statement.cs (Block.Resolve): Revert change below. Modify fix
1067 for #74041 to initialize 'resolved' to false only for explicit
1068 blocks. Fixes #74873.
1070 2005-05-12 Raja R Harinath <harinath@gmail.com>
1073 * typemanager.cs (unmanaged_enclosing_types): New.
1074 (IsUnmanagedType): Avoid infloops by using
1075 'unmanaged_enclosing_types' to talk with recursive invocations.
1077 2005-05-13 Martin Baulig <martin@ximian.com>
1079 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
1080 instance variable, not a local. Fix #74873.
1081 (Block.ResolveUnreachable): Set it to true here.
1083 2005-05-11 Duncan Mak <duncan@novell.com>
1085 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
1086 continuing to process for 'arg'.
1087 (handle_preprocessing_directive): Check the argument of the #endif
1088 directive and report error CS1025 if there are any trailing
1091 According to the C# spec, having even whitespace after the #endif
1092 directive is illegal; however, because we call arg.TrimEnd ()
1093 beforehand, we have the same behavior as csc, allowing whitespace
1094 after the directive.
1098 2005-05-11 Marek Safar <marek.safar@seznam.cz>
1102 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
1103 (Constructor.GetObsoleteAttribute): Implemented correctly.
1105 2005-05-10 Martin Baulig <martin@ximian.com>
1107 * support.cs (ReflectionParameters.ParameterModifier): Use
1108 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
1109 and `ParameterAttributes.In'. Fixes #74884.
1111 2005-05-10 Marek Safar <marek.safar@seznam.cz>
1113 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
1115 * expression.cs (Argument.GetParameterModifier): Turned to property.
1116 (Invocation.Error_InvalidArguments): Add more descriptive errors.
1118 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
1121 2005-05-09 Raja R Harinath <rharinath@novell.com>
1124 * decl.cs (MemberCache.AddMethods): Register override methods,
1125 rather than non-override methods.
1126 * typemanager.cs (RegisterOverride): New.
1127 (IsOverride): Update.
1129 2005-05-09 Marek Safar <marek.safar@seznam.cz>
1133 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
1134 recursive declaration.
1136 * statement.cs (Block.ResolveMeta): Report any error in resolving.
1138 2005-05-06 Marek Safar <marek.safar@seznam.cz>
1140 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
1142 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
1144 2005-05-05 Raja R Harinath <rharinath@novell.com>
1147 * decl.cs (DeclSpace.FamilyAccessible):
1148 Use TypeManager.IsNestedFamilyAccessible.
1150 Fix reopened #64812.
1151 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
1154 2005-05-04 Raja R Harinath <rharinath@novell.com>
1155 Abin Thomas <projectmonokochi@rediffmail.com>
1156 Anoob V E <projectmonokochi@rediffmail.com>
1157 Harilal P R <projectmonokochi@rediffmail.com>
1160 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
1161 allow access to all static members.
1163 2005-05-04 Martin Baulig <martin@ximian.com>
1165 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
1167 2005-05-04 Martin Baulig <martin@ximian.com>
1171 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
1172 section at the end; make things work if `default' is not the last
1175 2005-05-04 Martin Baulig <martin@ximian.com>
1179 * statement.cs (Switch): Replaced the `got_default' field with a
1180 `default_section' one.
1181 (Switch.CheckSwitch): Set `default_section' here.
1182 (Switch.Resolve): If we're a constant switch and the constant is
1183 not found, use the default section.
1185 2005-05-03 Martin Baulig <martin@ximian.com>
1187 * expression.cs (ArrayAccess.EmitGetLength): New public method.
1189 * statement.cs (Foreach.ArrayForeach): New nested class.
1190 (Foreach.TemporaryVariable): New nested class.
1191 (Foreach.EmitArrayForeach): Removed; this is now in the new
1194 2005-05-03 Raja R Harinath <rharinath@novell.com>
1196 * pending.cs (BaseImplements): Move the #74773 fix here. This is
1198 (VerifyPendingMethods): Revert change below.
1200 * typemanager.cs (IsOverride, RegisterNonOverride): New.
1201 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
1202 that used to trigger warning -28. Remove warning -28.
1203 * expression.cs (Invocation.OverloadResolve): Use
1204 TypeManager.IsOverride to distinguish override methods.
1207 * pending.cs (VerifyPendingMethods): If a base type implements the
1208 requested interface, don't bother checking individual methods of
1209 the base type. As a side-effect, this prevents the creation of
1210 unnecessary proxies.
1212 2005-05-02 Martin Baulig <martin@ximian.com>
1216 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
1217 Also `And' the locals if the old vector is null.
1218 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
1219 null; in this case we basically reset all the variables.
1221 2005-05-02 Martin Baulig <martin@ximian.com>
1225 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
1226 Added `FlowBranching branching' argument; always `and' the
1227 variables instead of `or'ing them unless we're an infinite loop.
1229 * statement.cs (While.Resolve): Create a new sibling unless we're
1232 2005-05-02 Martin Baulig <martin@ximian.com>
1236 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
1237 arguments; use it instead of creating a new TopLevelBlock.
1238 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
1239 our ConstructorInitializer.
1242 (TopLevelBlock.TopLevelBranching): New public property.
1243 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
1244 and create our `TopLevelBranching'.
1246 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
1247 anonymous method host, use `block.TopLevelBranching' rather than
1248 creating a new branching.
1250 2005-04-20 Miguel de Icaza <miguel@novell.com>
1252 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
1253 a ScopeInfo, if any of the current children is a child of the new
1254 entry, move those children there.
1256 2005-04-30 Martin Baulig <martin@ximian.com>
1258 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
1259 at the beginning of a SwitchSection. Fix #73335.
1261 2005-04-27 Marek Safar <marek.safar@seznam.cz>
1264 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
1266 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
1267 (FieldExpr.DoResolve): Obsolete members are ignored for field
1270 2005-04-26 Marek Safar <marek.safar@seznam.cz>
1272 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
1273 of arrays detection.
1275 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
1277 (Field.VerifyClsCompliance): Volatile fields are not compliant.
1279 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
1282 2005-04-25 Ben Maurer <bmaurer@ximian.com>
1284 * cs-parser.jay: Use the prefered version of -unsafe in error
1287 2005-04-22 Marek Safar <marek.safar@seznam.cz>
1289 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
1292 2005-04-20 John Luke <john.luke@gmail.com>
1294 * driver.cs: fix typo in error message, --outout to --output
1296 2005-04-20 Marek Safar <marek.safar@seznam.cz>
1298 * codegen.cs (InRefOutArgumentResolving): New field.
1300 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
1301 fields outside contructor.
1303 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
1305 2005-04-19 Miguel de Icaza <miguel@novell.com>
1307 * anonymous.cs (CaptureContext.EmitParameterInstance): The
1308 parameter code was not completed ever, so it was not as up-to-date
1309 as local variables. Must finish it.
1311 The bug fix was to compare the Toplevel of the block, not the
1312 current block. Thanks for Ben for pointing this out.
1314 2005-04-19 Raja R Harinath <rharinath@novell.com>
1316 * decl.cs (AddMethods): Use the declaring type of the problem
1317 method to determine if we want to squash a warning.
1319 2005-04-19 Marek Safar <marek.safar@seznam.cz>
1321 * attribute.cs: Removed debug output.
1323 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
1325 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
1328 2005-04-18 Raja R Harinath <rharinath@novell.com>
1331 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
1332 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
1333 all null comparisons against reference types.
1335 2005-04-18 Marek Safar <marek.safar@seznam.cz>
1338 * class.cs (TypeContainer.CircularDepException) New nested
1340 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
1341 (TypeContainer.DefineType): Removed error, reset InTransit before
1343 (Class.DefineType): Throw exception when is in Transit.
1344 Catch exception and report error.
1345 (Struct.DefineType): Throw exception when is in Transit.
1346 Catch exception and report error.
1347 (Interface.DefineType): Throw exception when is in Transit.
1348 Catch exception and report error.
1350 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
1351 handle nested exception handlers.
1353 * flowanalysis.cs (InTryWithCatch): New method, search for try with
1356 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
1357 InFinally and InCatch storage.
1359 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
1360 (Catch.Resolve): Set and Restore ec.InCatch.
1361 (Try.Resolve): Set and Restore ec.InFinally.
1362 (Try.HasCatch): True when try has catch.
1364 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
1366 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
1367 for the same event member, so exclude such cases from warning 419.
1370 2005-04-16 Miguel de Icaza <miguel@novell.com>
1372 * expression.cs (Binary.ResolveOperator): Apply patch from John
1373 Luke to fix bug 59864: operators &, | and ^ on enumerations
1374 require that the same enum type on both sides.
1376 * driver.cs: Add warnings to old flag usage, this is to assist
1377 people who produce Makefiles and hope that the Makefiles will be
1380 * class.cs (TypeContainer.EmitType): Moved the definition of the
1381 special $PRIVATE$ field from the resolve phase to the Emit phase.
1382 During resolve we do not know if we are a struct with
1383 HasExplicitLayout, we know this only after the attributes for the
1386 Set the FieldOffset to zero on the dummy field that we create for
1387 the class. Fixes 74590.
1389 2005-04-16 Raja R Harinath <rharinath@novell.com>
1392 * ecore.cs (PropertyExpr.resolved): New.
1393 (DoResolve): Use it to handle a case of double resolution here.
1394 Handle a case of identical-name-and-type-name.
1395 * expression.cs (ArrayCreation.CheckIndices): Avoid double
1396 resolution by storing the results of expression resolution back
1397 into the "probes" array.
1399 2005-04-15 Raja R Harinath <rharinath@novell.com>
1401 Fix cs0208-7.cs and cs0208-8.cs.
1402 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
1403 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
1404 error reporting to point out the reason a struct is not unmanaged.
1406 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1408 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
1409 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
1411 2005-04-13 Raja R Harinath <rharinath@novell.com>
1414 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
1415 IdenticalNameAndTypeName here.
1416 (EventExpr.InstanceResolve): Likewise.
1418 2005-04-13 Marek Safar <marek.safar@seznam.cz>
1420 C# 2.0 DefaultCharSetAttribute implementation
1422 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
1423 which allows us to set GlobalNamespace for every resolve.
1424 (Attribute.ResolveArguments): Cut from Resolve.
1425 (Attribute.GetCharSetValue): Returns CharSet named argument.
1426 (Attribute.DefinePInvokeMethod): Gets default charset from
1428 (GlobalAttribute.ResolveAsTypeStep): Override.
1429 (GlobalAttribute.ResolveArguments): Override.
1431 * class.cs (TypeAttr): Is protected.
1433 * codegen.cs (ModuleClass.DefaultCharSet): New member.
1434 (ModuleClass.DefaultCharSetType): New memeber.
1435 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
1437 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
1438 charset from module.
1440 * delegate.cs (TypeAttr): Override.
1441 (Delegate.DefineType): Use this TypeAttr.
1443 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
1444 at very early stage (before types are defined) to resolve model
1445 module attributes. It will probably not work with corlib but it
1448 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
1449 charset from module.
1451 * typemanager.cs (default_charset_type): New type.
1453 2005-04-13 Raja R Harinath <rharinath@novell.com>
1455 * decl.cs (MemberCache.AddMethods): Don't warn if
1456 System.Object.Finalize has buggy MethodAttributes.
1458 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
1461 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1463 * doc.cs : detect ambiguous reference to overloaded members.
1464 Fixed bug #71603. MS 1.1 csc does not detect it.
1466 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1468 * doc.cs : delegates must not be referenced with parameters.
1471 2005-04-12 Miguel de Icaza <miguel@novell.com>
1473 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
1475 2005-04-10 Miguel de Icaza <miguel@novell.com>
1477 * driver.cs (MainDriver): Stop processing if the CLS stage found
1480 (CompilerCallableEntryPoint.InvokeCompiler): Always
1481 reset after execution; Take a TextWriter argument for the
1484 * report.cs: Use the error stream instead of hardcoding stderr.
1486 2005-04-09 Miguel de Icaza <miguel@novell.com>
1488 * class.cs: Reduce code paths to test, too small of an
1489 optimization to make it worth the extra testing. Always perform
1492 2005-04-08 Raja R Harinath <rharinath@novell.com>
1495 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
1496 operators that had errors reported on them.
1498 2005-04-08 Marek Safar <marek.safar@seznam.cz>
1500 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
1502 (Attribute.Resolve): Add named argument type checking.
1504 * class.cs (FixedField.Define): Use IsPrimitiveType
1506 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
1508 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
1509 unsafe parameter types.
1511 * statement.cs (Using.ResolveExpression): Add better error description.
1513 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
1515 2005-04-08 Raja R Harinath <rharinath@novell.com>
1518 * attribute.cs (Attribute.GetAttributeUsage): Resolve
1519 AttributeUsageAttribute in the emitcontext of the attribute class,
1520 not in the emitcontext of the attributable entity it was attached to.
1521 * cs-parser.jay: Use 'current_class', not 'current_container',
1522 when creating a GlobalAttribute.
1524 2005-04-08 Alp Toker <alp@atoker.com>
1526 * pending.cs: The fix to #58413 failed to compile methods implementing
1527 interfaces with/without params modifiers and vice versa, even though
1528 params modifiers aren't part of the signature. Make the modifier check
1529 less strict as in csc.
1531 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
1532 Anoob V E <projectmonokochi@rediffmail.com>
1533 Harilal P R <projectmonokochi@rediffmail.com>
1536 * pending.cs (TypeAndMethods.mods): New. Store the parameter
1537 modifiers of pending methods.
1538 (PendingImplementation.PendingImplementation): Initialize it.
1539 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
1540 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
1541 with ParameterData. Add check for modifiers.
1542 * class.cs (MethodData.Define): Update to changes.
1544 2005-04-07 Raja R Harinath <rharinath@novell.com>
1546 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
1548 2005-04-07 Marek Safar <marek.safar@seznam.cz>
1550 * class.cs (PropertyMethod.Define): Check private accessor in abstract
1553 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
1556 * typemanager.cs: Registered RequiredAttributeAttribute.
1558 2005-04-06 Marek Safar <marek.safar@seznam.cz>
1560 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
1561 Warning CS0169 is back at level 3.
1562 (IMethodData.SetMemberIsUsed): New method.
1564 * decl.cs (IsUsed): New value; moved from FieldBase.Status
1565 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
1567 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
1569 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
1571 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
1574 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
1577 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
1578 to avoid the problems with nested types.
1580 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
1581 Anoob V.E <projectmonokochi@rediffmail.com>
1582 Harilal P.R <projectmonokochi@rediffmail.com>
1583 Raja R Harinath <rharinath@novell.com>
1586 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
1588 * typemanager (GetConstructor): Make public.
1590 2005-04-05 John Luke <john.luke@gmail.com>
1591 Raja R Harinath <rharinath@novell.com>
1594 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
1595 struct too. Return false quicker in a few cases.
1596 (VerifyUnManaged): Use it.
1598 2005-04-05 Raja R Harinath <rharinath@novell.com>
1601 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
1602 not 'unreachable_seen'.
1604 2005-04-04 Marek Safar <marek.safar@seznam.cz>
1606 * attribute.cs (Attribute.GetValue): Removed unused.
1608 * codegen.cs (CodeGen.TrimExt): Removed unused.
1610 * cs-parser.jay (output): Removed unused.
1612 * cs-tokenizer.cs (hex_digits): Removed unused.
1614 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
1616 * expression.cs (Indirection.LoadExprValue): Removed unused.
1617 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
1619 * iterators.cs (Iterator.param_types): Removed unused.
1621 * statement.cs (Goto.block): Removed unused.
1622 (ToplevelBlock.did): Removed unused.
1623 (Switch.ResolveConstantSwitch): Removed unused.
1625 2005-04-01 Ben Maurer <bmaurer@ximian.com>
1627 * rootcontext.cs: Allow mcs to bootstrap with the compilation
1630 2005-04-01 Raja R Harinath <rharinath@novell.com>
1632 Fix #74232 and cs0208-3.cs.
1633 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
1634 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
1635 unmanaged type. Don't use FieldBuilders when 't' is a
1636 TypeBuilder. Use ModFlags and MemberType fields.
1637 * class.cs (MemberBase.member_type): Rename from MemberType.
1638 (MemberBase.MemberType): New property. Determines member_type on
1640 (MemberBase.DoDefine): Don't initialize MemberType here.
1641 (FieldMember.Define): Likewise.
1643 2005-04-01 Marek Safar <marek.safar@seznam.cz>
1646 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
1647 Attributes are emitted there.
1649 2005-04-01 Raja R Harinath <rharinath@novell.com>
1651 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
1652 keyword in 'partial enum' too.
1653 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
1655 Report from Kamil Skalski <nazgul@omega.pl>.
1658 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
1659 have partial containers too.
1661 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
1662 in block' checks to Block.CheckInvariantMeaningInBlock.
1663 * statement.cs (Block.GetKnownVariableInfo): Make private.
1664 (Block.IsVariableUsedInChildBlock): Remove.
1665 (Block.IsVariableUsedInBlock): Likewise.
1666 (Block.CheckInvariantMeaningInBlock): New. Show location of
1667 conflicting declaration.
1668 (Block.AddVariable): Make error messages less long-winded and more
1669 specific. Show location of conflicting declaration.
1670 * parameter.cs (Parameters.Location): New readonly property.
1672 2005-03-31 Raja R Harinath <rharinath@novell.com>
1674 Clean up semantics of invoking ResolveMemberAccess.
1675 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
1676 can have an instance, ensure that we pass in a non-TypeExpression
1677 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
1678 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
1679 argument. Update to changes and simplify.
1680 (FieldExpr.Emitinstance): Remove CS0120 check.
1681 (PropertyExpr.EmitInstance): Likewise.
1682 * expression.cs (Argument.Resolve): Likewise.
1683 (Invocation.DoResolve): Update to changes in semantics of
1686 2005-03-31 Marek Safar <marek.safar@seznam.cz>
1689 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
1692 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
1694 2005-03-31 Raja R Harinath <rharinath@novell.com>
1696 Fix difference in behaviour with commandline invocation.
1697 * driver.cs (Driver.Reset): New.
1698 (CompilerCallableEntryPoint): Call it.
1700 * statement.cs (If.Resolve): Avoid spurious "uninitialized
1701 variable" warnings if the boolean expression failed to resolve.
1703 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
1705 * attribute.cs: Fix the union of several permissions when some of them
1706 are unrestricted (so the result isn't an unrestricted permission set).
1709 2005-03-30 Raja R Harinath <rharinath@novell.com>
1711 * ecore.cs (MemberExpr): New class. Convert from interface
1713 (MemberExpr.ResolveMemberAccess): Refactor and move here from
1714 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
1716 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
1717 (MethodGroupExpr.IsExplicitImpl): Remove.
1718 (Expression.GetFieldFromEvent): Remove.
1719 (SimpleName.MemberStaticCheck): Remove.
1720 (SimpleName.DoSimpleNameResolve): Update to changes.
1721 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
1722 (MemberAccess.IdenticalNameAndTypeName): Remove.
1723 (MemberAccess.error176): Move to MemberExpr.
1724 (MemberAccess.DoResolve): Update to changes.
1725 (BaseAccess.DoResolve): Likewise.
1727 2005-03-30 Marek Safar <marek.safar@seznam.cz>
1729 C# 2.0 Conditional attribute class implementation
1731 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
1732 Analyzes class whether it has attribute which has ConditionalAttribute
1733 and its condition is not defined.
1735 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
1736 (Class.IsExcluded): New method. Search for at least one defined
1737 condition in ConditionalAttribute of attribute class.
1739 2005-03-30 Raja R Harinath <rharinath@novell.com>
1741 * ecore.cs (PropertyExpr): Derive from Expression, not
1742 ExpressionStatement.
1743 (PropertyExpr.EmitStatement): Remove.
1745 2005-03-29 Raja R Harinath <rharinath@novell.com>
1748 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
1749 internal field "value__" of an enum be private. The examples for
1750 "value__" that I found on MSDN all used FieldAttributes.Private.
1752 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
1753 Don't mention IL method attribute names.
1755 Fix #47991. Remove a TODO.
1756 * statement.cs (Block.Toplevel): Make into a field.
1757 (Block.Parameters): Move into ToplevelBlock.
1758 (Block.known_variables): Rename from child_variable_names.
1759 (Block.Block): Remove variants that take Parameters. Initialize
1760 'Toplevel' with the immediately surrounding toplevel block.
1761 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
1762 LocalInfo parameter.
1763 (Block.GetKnownVariableInfo): New.
1764 (Block.IsVariableNameUsedInChildBlock): Update.
1765 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
1766 the block, even though it may not be in scope.
1767 (Block.AddVariable): Remove Parameters parameter. Use
1768 Toplevel.Parameters instead.
1769 (Block.AddConstant): Remove Parameters parameter.
1770 (Block.GetParameterReference): Update to use Toplevel.Parameters.
1771 (Block.IsParamaterReference): Likewise.
1772 (Block.IsLocalParameter): Likewise. Simplify a lot.
1773 (ToplevelBlock.Parameters): New. Moved from Block.
1774 (ToplevelBlock.ToplevelBlock): Update to changes. Always
1775 initialize Parameters to a non-null value.
1776 * cs-parser.jay: Update to changes.
1777 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
1778 simple names that mean different things in the same block. Use
1779 Block.IsVariableNameUsedInBlock.
1781 2005-03-28 Raja R Harinath <rharinath@novell.com>
1783 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
1784 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
1785 GetTypeHandle. It is possible for a reflected type to derive from
1786 a TypeBuilder (e.g., int[] derives from the TypeBuilder
1787 System.Array during mscorlib compilation).
1788 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
1789 contain a method_hash, don't create one either. Don't create a
1790 deep copy of the base cache's method_hash.
1791 (MemberCache.SetupCache): Rename back from DeepCopy.
1792 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
1793 already initialized. If we see an override function, add its
1794 underlying base virtual function to the member_hash too.
1796 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
1798 2005-03-26 Raja R Harinath <harinath@acm.org>
1801 * assign.cs (Assign.DoResolve): When the RHS of an assignment
1802 fails to resolve, ensure that the LHS is still resolved as an
1805 2005-03-25 Raja R Harinath <harinath@acm.org>
1807 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
1809 (Enum.current_ec): Remove.
1810 (Enum.LookupEnumValue): Remove EmitContext argument.
1811 Just uses the one created during DefineType.
1812 (Enum.FindMembers): Update.
1813 * expression.cs (MemberAccess.DoResolve): Update.
1815 2005-03-22 Marek Safar <marek.safar@seznam.cz>
1817 * assign.cs (Assign.DoResolve): Check for CS1717 when
1818 source and target are same (uses Equals).
1820 * expression.cs (LocalVariableReference, ParameterReference,
1821 This): Implemented Equals, GetHashCode.
1823 * statement.cs (Block.GetParameterReference): Removed useless
1826 2005-03-22 Raja R Harinath <rharinath@novell.com>
1829 * statement.cs (Block.AddVariable): Ensure that we skip implicit
1830 blocks before deciding whether the error is cs0136 or cs0128.
1832 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
1833 (using_alias_directive, using_namespace_directive): Pass
1834 MemberName, not an expression to Namespace.UsingAlias and
1836 (MakeName): Use the MemberName of the namespace.
1837 * namespace.cs (Namespace.MemberName): New.
1838 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
1839 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
1841 * decl.cs (MemberName.Name): Make readonly.
1842 (MemberName.FromDotted): New "constructor".
1843 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
1844 (MemberCore.Name): Compute from MemberName on demand.
1845 (MemberCore.SetMemberName): Provide a way to change the
1847 (MemberCore.AddToContainer): Don't take a fullname parameter.
1848 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
1849 fully qualified name of the container to the member name.
1850 (TypeContainer.AddToTypeContainer): Use a fully qualified name
1851 only if the type is a member of the root container.
1852 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
1853 MemberName.Left rather than searching for an embedded ".".
1854 (PartialContainer.CreatePart): Update to changes in RootContext.
1855 (MemberBase.ShortName): Turn into a property. Use
1856 MemberCore.SetMemberName.
1857 (MemberBase.ExplicitInterfaceName): Remove.
1858 (MemberBase.UpdateMemberName): Remove.
1859 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
1860 (PropertyBase.SetMemberName): New override.
1861 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
1862 (Tree.GetDecl): New.
1863 (Tree.AllDecls): Rename from Decls.
1864 * attribute.cs, enum.cs, report.cs: Update to changes.
1865 * driver.cs (MainDriver): Use MemberName.FromDotted on
1866 RootContext.MainClass.
1868 2005-03-21 Marek Safar <marek.safar@seznam.cz>
1870 * class.cs (FixedField.Define): Check for CS1664 and more sanity
1873 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
1875 2005-03-18 Marek Safar <marek.safar@seznam.cz>
1877 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
1878 property accessor modifiers.
1880 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
1881 fixed buffer attribute (CS1716).
1882 (PropertyMethod.HasCustomAccessModifier): When property accessor
1883 has custom modifier.
1885 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
1887 (PropertyExpr.DoResolveLValue): Add CS0272.
1889 2005-03-17 Miguel de Icaza <miguel@novell.com>
1891 * convert.cs: When converting to a pointer, use the proper Conv.U
1892 or Conv.I depending on the source data type.
1894 * cs-tokenizer.cs: Make the size for large decimal constants,
1897 2005-03-17 Martin Baulig <martin@ximian.com>
1899 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
1900 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
1902 2005-03-17 Martin Baulig <martin@ximian.com>
1904 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
1905 to bool so we can return an error condition.
1906 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
1909 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
1911 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
1914 2005-03-16 Raja R Harinath <rharinath@novell.com>
1916 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
1917 Refactor to avoid traversing the list of assemblies, and to avoid
1918 string concatenation.
1919 * typemanager.cs (guid_attr_type): Remove.
1920 (negative_hits, pointers, references): Remove hashes.
1922 (GetConstructedType): New. Uses type_hash to handle constructed
1923 types (arrays, references, pointers).
1924 (GetReferenceType, GetPointerType): Use it.
1925 (GetNestedType): New. Uses type_hash to handle nested types of
1927 (LookupType, LookupTypeDirect): Remove.
1928 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
1929 'types' hash and LookupTypeReflection directly.
1930 (params_string, params_object): Use GetConstructedType.
1931 * namespace.cs (Namespace.cached_types): New. Cache of reflected
1933 (Namespace.Lookup): Use cached_types.
1934 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
1935 provided by old TypeManager.LookupType.
1936 * rootcontext.cs (MakeFQN): Remove.
1937 * decl.cs (DeclSpace.MakeFQN): Likewise.
1938 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
1939 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
1940 TypeManager.GetConstructedType.
1941 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
1943 2005-03-15 Marek Safar <marek.safar@seznam.cz>
1945 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
1948 * cs-parser.jay: Reports CS1527 for any namespace element.
1950 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
1953 * expression.cs (ParameterReference.IsAssigned): Changed error to
1955 (Error_WrongNumArguments): Moved CS0245 detection here.
1957 * statement.cs (Return.Resolve): Add CS1622 report.
1959 2005-03-11 Marek Safar <marek.safar@seznam.cz>
1961 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
1963 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
1965 * attribute.cs expression.cs: Get rid of some allocations.
1967 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
1969 * doc.cs : just eliminate the latest change.
1971 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1973 * doc.cs : commented out the latest change. It breaks xml-030.cs
1975 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1977 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
1978 fail. So invoke CreateType() in FindDocumentedType().
1980 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
1982 * cs-tokenizer.cs : added IsKeyword().
1983 * doc.cs : Detect keyword incorrectly used as identifier.
1984 Allow identifiers prefixed by @.
1986 2005-03-10 Marek Safar <marek.safar@seznam.cz>
1988 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
1989 It caused exception in namespace resolving (again!).
1991 * class.cs (Class.ctor): Removed exit.
1992 (PropertyMethod.ctor): ditto.
1994 * codegen.cs (Codegen.Reset): Reset static data.
1995 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
1997 * cs-tokenizer.cs (Cleanup): Removed.
1999 * driver.cs (GetSystemDir): Rewrote to one line command.
2000 It caused problem with unloaded dynamic modules.
2001 (UnixParseOption): Removed Exit.
2002 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
2003 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
2004 Now can be mcs used as library.
2006 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
2009 * location.cs (Reset): Reset static data.
2011 * namespace.cs (Reset): Reset static data.
2013 * report.cs (Report.Reset): Reset static data.
2015 * rootcontext.cs (RootContext.Reset): Reset static data.
2017 * tree.cs (RootTypes.ctor): Use Location.Null
2019 * typemanager.cs (TypeManager.Reset): Reset static data.
2020 (CoreLookupType): Removed Exit.
2021 (TypeHandle.Reset): Reset static data.
2023 2005-03-10 Raja R Harinath <rharinath@novell.com>
2026 * typemanager.cs (ComputeNamespaces): Import namespaces from
2027 referenced modules too.
2029 2005-03-09 Raja R Harinath <rharinath@novell.com>
2031 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
2034 2005-03-09 Raja R Harinath <rharinath@novell.com>
2036 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
2037 enclosing DeclSpace. This ensures that a name-lookup populates
2038 more caches and there are fewer 'TypeExpression's. Carve out
2039 nested type lookup into ...
2040 (LookupNestedTypeInHierarchy): ... this.
2042 2005-03-09 Raja R Harinath <rharinath@novell.com>
2044 Clean up a few partial-class semantics.
2045 Fixes test-357.cs and cs1618-2.cs.
2046 * cs-parser.jay (struct_declaration): Use 'current_class' as
2047 parent of newly-created struct. Remove call to Register ().
2048 Use 'pop_current_class' to complete handing the current struct.
2049 (interface_declaration): Likewise.
2050 (class_declaration): Likewise.
2051 (enum_declaration): Use 'current_class' as parent of newly created
2053 (delegate_declaration): Likewise.
2054 (pop_current_class): New function. This is used to handle closing
2055 up the 'current_class' and 'current_container', and pointing them
2056 to the enclosing class/container.
2057 (CSharpParser): Initialize 'current_class' too.
2058 * decl.cs (MemberCore): Add check for invariant: a partial
2059 container is not a parsed entity, and thus does not enclose any
2061 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
2062 (DeclSpace.BaseTypeExpr): Use it.
2063 (DeclSpace.LookupType): Add check for invariant.
2064 * class.cs (TypeContainer): Add check for invariant: a nested
2065 class should have the same NamespaceEntry as its enclosing class.
2066 (TypeContainer.EmitFieldInitializers): Make virtual.
2067 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
2069 (TypeContainer.Register): Remove.
2070 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
2071 null. Use TypeResolveEmitContext for resolving base types and
2072 interfaces. Move initialization of Parts.TypeBuilder here from
2074 (TypeContainer.DefineNestedTypes): ... here.
2075 (PartialContainer): Take a Namespace not a NamespaceEntry.
2076 (PartialContainer.Create): Don't use Register. Call the
2077 appropriate Add... function directly.
2078 (ClassPart): Take both the PartialContainer and the enclosing
2079 class as constructor arguments.
2080 (ClassPart.EmitFieldInitializers): Override.
2081 (ClassPart.PartFindNestedTypes): Remove.
2082 (FieldBase.GetInitializerExpression): Resolve the initializer
2083 expression in the emit context of the enclosing class.
2084 * tree.cs (RootTypes): Remove Register ().
2086 2005-03-08 Marek Safar <marek.safar@seznam.cz>
2088 * cs-parser.jay: Removed CS0134.
2090 * driver.cs: Removed CS1901.
2092 * expression.cs (SizeOf.DoResolve): Don't report CS0233
2093 for predefined types.
2095 2005-03-07 Duncan Mak <duncan@novell.com>
2097 * codegen.cs (Save): Catch UnauthorizedAccessException as
2098 well. Fixes bug #73454.
2100 2005-03-07 Marek Safar <marek.safar@seznam.cz>
2102 * cs-tokenizer.cs (xtoken): Add CS1035.
2104 * class.cs (MethodData.Define): Add CS0683.
2105 (FieldMember.ctor): Add CS0681.
2107 2005-03-07 Raja R Harinath <rharinath@novell.com>
2109 * ecore.cs (SimpleName.DoResolve): Rename from
2110 SimpleName.DoResolveAllowStatic.
2111 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
2112 Pass 'intermediate' flag to MemberStaticCheck.
2113 (SimpleName.MemberStaticCheck): Skip "static check" only in case
2114 of "intermediate" lookups via MemberAccess.
2115 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
2116 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
2118 2005-03-07 Raja R Harinath <rharinath@novell.com>
2121 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
2122 slipped in because of variable names that are identical to a
2123 builtin type's BCL equivalent ('string String;', 'int Int32;').
2124 (PropertyExpr.EmitInstance): Likewise.
2126 2005-03-04 Marek Safar <marek.safar@seznam.cz>
2128 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
2130 * report.cs (warning_ignore_table): Made public.
2132 2005-03-04 Raja R Harinath <rharinath@novell.com>
2135 * class.cs (MethodData.Emit): Pass 'container' to
2136 container.GetObsoleteAttribute instead of 'container.Parent'.
2138 2005-03-03 Marek Safar <marek.safar@seznam.cz>
2140 * cs-parser.jay: Add 1534 error test.
2142 * iterators.cs (Yield.CheckContext): Add error 1629.
2143 (Iterator.ctor): Save unsafe modifier.
2144 (MoveNextMethod.DoEmit): Restore unsafe context.
2146 * namespace.cs (UsingAlias): Better error message.
2148 2005-03-03 Dan Winship <danw@novell.com>
2150 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
2151 the warning message [#73219]
2153 2005-03-03 Raja R Harinath <rharinath@novell.com>
2155 Fix compile with MCS 1.0.0.0.
2156 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
2157 w_restore to not depend on string constant folding.
2159 2005-03-03 Raja R Harinath <rharinath@novell.com>
2161 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
2162 CS0246 check to users who passed 'silent = false'.
2163 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
2165 (SimpleName.SimpleNameResolve): Update.
2166 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
2167 (MemberAccess.IdenticalNameAndTypeName): Update.
2168 * doc.cs (FindDocumentedTypeNonArray): Update.
2170 2005-03-03 Raja R Harinath <rharinath@novell.com>
2172 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
2173 * parameters.cs (ComputeAndDefineParameters): Remove.
2174 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
2175 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
2176 Use GetParameterInfo.
2178 2005-03-02 Marek Safar <marek.safar@seznam.cz>
2180 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
2182 2005-03-02 Raja R Harinath <rharinath@novell.com>
2184 Unify DeclSpace.LookupType and DeclSpace.FindType.
2185 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
2186 is in charge of defining nested types on demand.
2187 (DeclSpace.LookupType): Use it when the current_type is a
2188 TypeBuilder. Use LookupTypeDirect for reflected types.
2189 (DeclSpace.FindType): Remove.
2190 (DeclSpace.LookupInterfaceOrClass): Likewise.
2191 (DeclSpace.DefineTypeAndParents): Likewise.
2192 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
2193 DeclSpace.LookupType.
2194 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
2195 * typemanager.cs (LookupType): Simplify.
2196 (AddUserType): Remove type from negative_hits.
2197 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
2198 * class.cs (TypeContainer.FindMembers): Move handling of nested
2200 (TypeContainer.FindMembers_NestedTypes): ... here.
2201 (TypeContainer.FindNestedType): Implement override.
2202 (ClassPart.FindNestedType): Delegate to PartialContainer.
2203 (ClassPart.PartFindNestedType): Looks up the nested types of the
2206 2005-03-02 Martin Baulig <martin@ximian.com>
2208 * class.cs (TypeContainer.DoDefineMembers): We also need a default
2209 static constructor in static classes.
2211 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
2213 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
2214 sizeParamIndex is not specified.
2216 2005-03-01 Marek Safar <marek.safar@seznam.cz>
2219 * report.cs (WarningMessage.IsEnabled): Missing null check.
2221 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2223 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
2224 in the fields and not in the properties.
2226 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
2228 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
2231 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2233 * attribute.cs: Small refactoring (improved robustness).
2234 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
2235 (ValidateGuid): Removed.
2236 (Resolve): Removed referenced to above mentioned.
2237 (GetAttributeUsage): Made private and changed to work without
2239 (GetIndexerAttributeValue): Don't crash.
2240 (GetConditionalAttributeValue): Ditto.
2241 (GetClsCompliantAttributeValue): Ditto.
2242 (ExtractSecurityPermissionSet): All attributes exceptions are
2244 (GetPropertyValue): New helper.
2245 (GetMethodImplOptions): New method.
2246 (DefinePInvokeMethod): Reuse common code. Implemented handling of
2247 some missing properties.
2249 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
2250 (Method.ApplyAttributeBuilder): Updated.
2252 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
2255 2005-02-28 Raja R Harinath <rharinath@novell.com>
2258 * report.cs (Report.SymbolRelatedToPreviousError): Handle
2259 non-simple types (array, pointer, reference).
2261 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2263 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
2265 * class.cs (MethodCore.IsDuplicateImplementation): Special error
2267 (Method.CheckBase): Catch wrong destructor here.
2268 (MethodData.Define): Add errors 550, 668.
2270 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
2272 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
2274 * pending.cs (VerifyPendingMethods): Add error 551.
2276 * typemanager.cs (CSharpName): Next error report helper.
2278 2005-02-25 Marek Safar <marek.safar@seznam.cz>
2280 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
2281 attributes. Removed useless attribute double check.
2282 It saves almost 2MBs for corlib.
2284 2005-02-25 Raja R Harinath <rharinath@novell.com>
2287 * statement.cs (ExpressionStatement.Resolve): Make robust to being
2288 called twice in case of error.
2290 2005-02-23 Chris Toshok <toshok@ximian.com>
2292 Fix compiler portions of #72827.
2293 * statement.cs (Block.Emit): call Begin/EndScope on the
2294 EmitContext instead of the ILGenerator.
2296 * codegen.cs (EmitContext.BeginScope): new method, call
2297 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
2299 (EmitContext.BeginScope): same, but EndScope and CloseScope
2301 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
2302 offset and call the superclass's OpenScope(int) with it.
2303 (SymbolWriter.CloseScope): get the current il
2304 offset and call superclass's CloseScope(int) with it.
2306 2005-02-23 Marek Safar <marek.safar@seznam.cz>
2308 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
2309 CS1677 for out and ref as well.
2311 * class.cs (Method.Define): Add error CS1599 detection.
2313 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
2315 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
2317 * delegate.cs (Delegate.Define): Add error CS1599 detection.
2319 * support.cs.cs (ModifierDesc): New helper method.
2321 2005-02-23 Raja R Harinath <rharinath@novell.com>
2322 Abin Thomas <projectmonokochi@rediffmail.com>
2323 Anoob V E <projectmonokochi@rediffmail.com>
2324 Harilal P R <projectmonokochi@rediffmail.com>
2327 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
2328 MemberLookup (used for error reporting) actually returns a result.
2329 Fix error report number (122, not 112).
2331 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
2332 Anoob V E <projectmonokochi@rediffmail.com>
2333 Harilal P R <projectmonokochi@rediffmail.com>
2336 * pending.cs (PendingImplementation.GetAbstractMethods):
2337 Find NonPublic members too.
2339 2005-02-22 Marek Safar <marek.safar@seznam.cz>
2341 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
2344 * class.cs (MethodCore.CheckMethodAgainstBase):
2345 Add error 239 report.
2347 2005-02-21 Raja R Harinath <rharinath@novell.com>
2350 * expression.cs (Invocation.IsApplicable): Make public.
2351 (Invocation.IsParamsMethodApplicable): Likewise.
2352 * delegate.cs (Delegate.VerifyApplicability): Don't use
2353 Invocation.VerifyArgumentCompat for parameter applicability
2354 testing. Use Invocation.IsApplicable and
2355 Invocation.IsParamsMethodApplicable.
2357 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2359 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
2361 * class.cs (Operator.Define): Add error 217 report.
2363 2005-02-21 Raja R Harinath <rharinath@novell.com>
2365 * namespace.cs (UsingEntry.Resolve): Undo change below.
2367 2005-02-21 Raja R Harinath <rharinath@novell.com>
2370 * ecore.cs (Expression.MemberLookupFailed): Add argument to
2371 disable the error message when the extended MemberLookup also
2373 (Expression.MemberLookupFinal): Update.
2374 (SimpleName.DoSimpleNameResolve): Update.
2375 * expression.cs (MemberAccess.ResolveNamespaceOrType):
2376 Don't use MemberLookupFinal.
2377 (New.DoResolve): Update.
2378 (BaseAccess.CommonResolve): Update.
2380 2005-02-21 Raja R Harinath <rharinath@novell.com>
2383 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
2384 occured previously, don't resolve again.
2386 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2389 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
2390 argument. Call ResolveAttributeUsage for unresolved.
2391 when types doesn't match ctor arguments.
2393 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
2394 for nested attribute classes.
2395 (Class.attribute_usage): Removed.
2396 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
2397 for attribute class.
2399 * ecore.cs (IsAttribute): Removed.
2401 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
2403 * rootcontext.cs (RegisterAttribute): Removed, attributes are
2405 (attribute_types): Removed.
2406 (EmitCode): Global attributes are emited as the latest.
2408 2005-02-18 Marek Safar <marek.safar@seznam.cz>
2410 * class.cs (EmitFieldInitializers): Don't emit field initializer
2411 for default values when optimilization is on.
2413 * constant.cs (Constant.IsDefaultValue): New property.
2415 * driver.cs: Add /optimize handling.
2419 * literal.cs: Implement new IsDefaultValue property.
2421 * rootcontext.cs (Optimize): New field, holds /optimize option.
2423 2005-02-18 Raja R Harinath <rharinath@novell.com>
2425 Fix crasher in re-opened #72347.
2426 * namespace.cs (Namespace.Lookup): Return null if
2427 DeclSpace.DefineType returns null.
2430 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
2432 2005-02-18 Raja R Harinath <rharinath@novell.com>
2434 Fix remainder of #63202. Change semantics of DoResolveLValue: it
2435 now returns null if it cannot resolve to an lvalue.
2436 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
2437 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
2438 returned null. Remove check for SimpleName.
2439 (EventExpr.DoResolveLValue): New.
2440 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
2441 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
2443 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
2445 (Unary.ResolveOperator): Move CS0211 check ...
2446 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
2448 (Unary.DoResolveLValue): Simplify.
2449 (AddressOf.DoResolveLValue): New.
2450 (ArrayAccess.DoResolveLValue): New.
2452 2005-02-16 Marek Safar <marek.safar@seznam.cz>
2454 * attribute.cs (Attribute.Resolve): Add arguments casting for
2455 when types doesn't match ctor arguments.
2457 2005-02-16 Raja R Harinath <rharinath@novell.com>
2459 Fix parts of #63202.
2460 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
2461 lookup of operator in base type. Ensure that all checks happen
2462 when the operator resolves to an "op_..." method.
2464 2005-02-15 Raja R Harinath <rharinath@novell.com>
2467 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
2468 'ignore_cs0104' parameter. Pass it to ...
2469 (NamespaceEntry.Lookup): ... this.
2470 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
2471 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
2472 (TypeLookupExpression.DoResolveAsTypeStep): Update.
2473 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
2474 Update. Request that cs0104 errors be ignored.
2475 (ComposedCast.ResolveAsTypeStep): Update.
2477 2005-02-14 Raja R Harinath <rharinath@novell.com>
2480 * expression.cs (Invocation.BetterFunction): Remove support for
2481 comparing virtual functions and their overrides.
2482 (Invocation.IsOverride): New.
2483 (Invocation.OverloadResolve): Don't consider 'override' functions
2484 during candidate selection. Store them in a lookaside list.
2485 If the selected method is a 'virtual' function, use the list to
2486 find any overrides that are closer to the LHS type.
2488 2005-02-14 Marek Safar <marek.safar@seznam.cz>
2490 * expression.cs (New.DoResolve): Add complex core type reduction.
2491 (New.Constantify): Converts complex core type syntax like 'new int ()'
2494 2005-02-14 Raja R Harinath <rharinath@novell.com>
2496 * decl.cs (EntryType.EntryType): New constructor to create an
2497 updated copy of a cache entry.
2498 (MemberCache.AddMethods): Use it.
2499 (MemberCache.ClearDeclaredOnly): Remove.
2500 (MemberCache.MemberCache): Update.
2502 2005-02-11 Miguel de Icaza <miguel@novell.com>
2504 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
2505 variable. This one is represents the actual low-level declaration
2506 of the method, as opposed to the semantic level `IsStatic'.
2508 An anonymous method which is hosted into a static method might be
2509 actually an instance method. IsStatic would reflect the
2510 container, while MethodIsStatic represents the actual code
2513 * expression.cs (ParameterReference): Use the new MethodIsStatic
2514 instead of IsStatic.
2516 * anonymous.cs (AnonymousMethod.Compatible): Pass the
2517 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
2518 set on the current EmitContext.
2520 * expression.cs (Cast): Overload DoResolveLValue so we can pass
2521 resolve our casted expression as an LValue. This triggers the
2522 proper LValue processing that is later required by Assign.
2526 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
2528 2005-02-11 Marek Safar <marek.safar@seznam.cz>
2530 C# 2.0 Fixed buffer implementation
2532 * anonymous.cs: Update after RegisterHelperClass renaming.
2534 * attribute.cs (AttributeTester.fixed_buffer_cache):
2535 Cache of external fixed buffers.
2536 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
2537 implementation if field is fixed buffer else null.
2540 (TypeContainer.AddField): Accept FieldMember instead of Field.
2541 (FieldBase.IsFieldClsCompliant): Extracted code from
2542 VerifyClsCompliance descendant customization.
2543 (FixedField): New class handles fixed buffer fields.
2544 (FixedFieldExternal): Keeps information about imported fixed
2546 (IFixedField): Make access to internal or external fixed buffer
2549 * cs-parser.jay: Add fixed buffer parsing.
2551 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
2554 * expression.cs (Indirection): Extended implementation to accept
2556 (PointerArithmetic.Emit): Get element from fixed buffer as well.
2557 (ElementAccess.MakePointerAccess): Get type as parameter.
2558 (DoResolve): Add fixed buffer field expression conversion.
2559 (DoResolveLValue): Ditto.
2560 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
2561 (ArrayPtr): Derives from FixedBufferPtr.
2562 (ArrayPtr.Emit): Add extra emit for array elements.
2564 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
2566 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
2567 for compiler generated types.
2568 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
2570 * statement.cs (Fixed): Refactored to be easier add fixed buffer
2571 and consume less memory.
2572 (Fixed.Resolve): Add fixed buffer case.
2574 * typemanager.cs (compiler_generated_attr_ctor,
2575 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
2576 (HasElementType): Add our own implementation to work on every
2579 2005-02-11 Miguel de Icaza <miguel@novell.com>
2581 * anonymous.cs (CaptureContext): Track whether `this' has been
2584 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
2585 only captured `this' if it was implicitly done (instance
2586 methods/variables were used).
2588 * codegen.cs (EmitContext.CaptureThis): New method to flag that
2589 `this' must be captured.
2591 2005-01-30 Miguel de Icaza <miguel@novell.com>
2593 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
2594 is null it means that there has been no need to capture anything,
2595 so we just create a sibling.
2597 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
2599 Just a partial fix. The other half is fairly elusive.
2601 2005-02-10 Raja R Harinath <rharinath@novell.com>
2603 Fix #52586, cs0121-4.cs.
2604 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
2605 and return a hashtable.
2606 (MemberCache.ClearDeclaredOnly): New.
2607 (MemberCache.MemberCache): Update to change. Make a deep copy of
2608 the method_hash of a base type too.
2609 (MemberCache.AddMethods): Adapt to having a deep copy of the base
2610 type methods. Overwrite entries with the same MethodHandle so
2611 that the ReflectedType is correct. The process leaves in base
2612 virtual functions and their overrides as distinct entries.
2613 (CacheEntry): Now a class instead of a struct. It shouldn't alter
2614 matters since it was boxed in a ArrayList before.
2615 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
2617 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
2618 case of a virtual function and its override (choose the overload
2620 (Invocation.OverloadResolve): Avoid 'override' members during
2621 'applicable_type' calculation.
2623 2005-02-09 Raja R Harinath <rharinath@novell.com>
2625 Combine two near-redundant caches.
2626 * typemanager.cs (method_params): Rename from method_internal_params.
2627 (TypeManager.GetParameterData): New. Replace
2628 Invocation.GetParameterData.
2629 (TypeManager.LookupParametersByBuilder): Remove.
2630 * expression.cs (Invocation.method_parameter_cache): Remove.
2631 (Invocation.GetParameterData): Remove.
2633 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
2636 2005-02-08 Raja R Harinath <rharinath@novell.com>
2639 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
2640 TypeManager.multicast_delegate_type is null, resolve it by looking
2641 up "System.MulticastDelegate".
2642 * rootcontext.cs (RootContext.ResolveCore): Simplify.
2644 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
2645 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
2646 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
2649 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
2650 (LabeledStatement.AddReference): New. Set 'referenced'.
2651 (Goto.Resolve): Use it.
2653 2005-02-05 John Luke <john.luke@gmail.com>
2655 * driver.cs: remove duplicate -doc line in Usage ()
2657 2005-02-04 Raja R Harinath <rharinath@novell.com>
2659 * location.cs (Location.AddFile): Fix CS2002 error report.
2661 2005-02-02 Martin Baulig <martin@ximian.com>
2663 * delegate.cs (Delegate.DefineType): Report an internal error if
2664 TypeManager.multicast_delegate_type is null. See bug #72015 for
2667 2005-02-02 Raja R Harinath <rharinath@novell.com>
2669 Fix a crasher in a variant of #31984.
2670 * const.cs (Constant.CheckBase): New override that defers the
2671 new-or-override check in case the base type hasn't been populated
2673 (Constant.Define): Ensure the new-or-override check is performed.
2675 2005-02-01 Duncan Mak <duncan@ximian.com>
2677 * const.cs (LookupConstantValue): Check that `ce' is not null
2678 before calling GetValue ().
2680 2005-02-01 Raja R Harinath <rharinath@novell.com>
2682 Fix test-334.cs (#69519).
2683 * cs-parser.jay (using_alias_directive): Pass in an expression to
2684 NamespaceEntry.UsingAlias.
2685 (using_namespace_directive): Pass in an expression to
2686 NamespaceEntry.Using.
2687 (namespace_name): Don't flatten to a string.
2688 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
2689 (NamespaceEntry.AliasEntry.Resolve): Lookup using
2691 (NamespaceEntry.UsingEntry): Likewise.
2692 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
2694 (NamespaceEntry.LookupForUsing): Remove.
2695 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
2697 (NamespaceEntry.Lookup): Remove support for dotted names.
2699 2005-02-01 Raja R Harinath <rharinath@novell.com>
2701 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
2703 (NamespaceEntry.ImplicitParent): Compute on demand.
2704 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
2705 parallels the current.
2706 (NamespaceEntry.LookupForUsing): Use it.
2707 (NamespaceEntry.Lookup): If the current namespace-entry is
2708 implicit, don't search aliases and using tables.
2710 2005-02-01 Raja R Harinath <rharinath@novell.com>
2713 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
2715 (TypeContainer.BaseCache): Compute on demand.
2716 (TypeContainer.FindMembers): Define constants and types if they're
2717 not already created.
2718 (FieldMember.Define): Move resetting of ec.InUnsafe before error
2720 * const.cs (Constant.Define): Make idempotent.
2722 2005-01-29 Miguel de Icaza <miguel@novell.com>
2724 * pending.cs: Produce better code (no nops produced by using Ldarg
2727 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
2728 i - 1' it should be arg + 1.
2732 2005-01-28 Raja R Harinath <rharinath@novell.com>
2734 * attribute.cs (Attribute.CheckAttributeType): Make private
2736 (Attribute.ResolveType): Make virtual.
2737 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
2738 handling of RootContext.Tree.Types.
2740 2005-01-27 Raja R Harinath <rharinath@novell.com>
2742 Update attribute-handling to use the SimpleName/MemberAccess
2744 * cs-parser.jay (attribute): Pass in an expression to the
2745 constructors of Attribute and GlobalAttribute.
2746 * attribute.cs (Attribute): Take an expression for the name.
2747 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
2748 passed in attribute name expression.
2749 (Attribute.CheckAttributeType): Use it.
2750 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
2751 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
2752 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
2753 argument to prevent error messages if the lookup fails.
2755 2005-01-27 Marek Safar <marek.safar@seznam.cz>
2757 * expression.cs (Indirection): Implemented IVariable interface
2758 to support indirection in AddressOf operator.
2759 (PointerArithmetic.Emit): Add optimalization for case where
2760 result can be precomputed.
2762 2005-01-26 Martin Baulig <martin@ximian.com>
2764 * class.cs (TypeContainer.AttributeTargets): Return the correct
2765 AttributeTargets depending on our `Kind' instead of throwing an
2766 exception; fixes #71632.
2768 2005-01-26 Marek Safar <marek.safar@seznam.cz>
2771 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
2774 2005-01-25 Raja R Harinath <rharinath@novell.com>
2777 * expression.cs (MemberAccess.DoResolve): Don't complain with
2778 cs0572 when the LHS of a member access has identical name and type
2781 2005-01-25 Marek Safar <marek.safar@seznam.cz>
2784 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
2786 Create custom PermissionSet only for PermissionSetAttribute.
2788 2005-01-24 Marek Safar <marek.safar@seznam.cz>
2791 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
2792 delegates in static class.
2794 2005-01-24 Martin Baulig <martin@ximian.com>
2796 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2797 merging an implicit block, just use its reachability.
2799 * statement.cs (Block.Resolve): Make the unreachable code check
2800 work wrt. implicit blocks; see test-337 from #63842.
2802 2005-01-21 Alp Toker <alp@atoker.com>
2804 * cs-parser.jay: destructor_declaration's container is PartialContainer
2805 not Class when partial types are used, so use Kind prop instead of
2808 2005-01-22 Miguel de Icaza <miguel@ximian.com>
2810 * cs-parser.jay: Improve error reporting when an interface
2813 2005-01-20 Dick Porter <dick@ximian.com>
2815 * support.cs: SeekableStreamReader fix from Sandor Dobos
2816 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
2817 chars are read. Fixes bug 70369.
2819 2005-01-20 Raja R Harinath <rharinath@novell.com>
2821 * cs-parser.jay (catch_clause): Simplify current_block handling
2824 2005-01-17 Miguel de Icaza <miguel@ximian.com>
2826 * convert.cs (ImplicitStandardConversionExists): Synchronize the
2827 code with ImplicitStandardConversion to handle the implicit
2828 conversion of method groups into valid delegate invocations.
2830 The problem is that in parameter handling we were using this code
2831 path. Fixes bug #64698
2833 2005-01-19 Raja R Harinath <rharinath@novell.com>
2835 * cs-parser.jay: Fix several infelicities.
2836 - Avoid assigning to the parser value stack. Code like
2837 '$3 = null' is unclean. Synthesize a value for the code block
2839 - Avoid using oob_stack for storing location information. Use ...
2840 (_mark_): ... this. New (empty) rule. Saves the current location
2842 (foreach_statement): Avoid using oob_stack for current_block
2843 handling. Use technique used in for_statement and
2844 using_statement. Synthesize a value for the code block to store
2845 additional intermediate information.
2847 2005-01-13 Miguel de Icaza <miguel@ximian.com>
2849 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
2850 of a different type is only allowed to private fields of a
2851 containing type, not on fields of a base class.
2853 See test-174.cs and error cs0122-9.cs
2855 2005-01-13 Raja R Harinath <rharinath@novell.com>
2857 Fix test-335.cs (bug #58126).
2858 * cs-parser.jay (argument): Split out non-expression parts of the
2859 rule into 'non_simple_argument'.
2860 (invocation_expression): Support parenthesized invocations with
2861 multiple arguments, and with single non-simple arguments.
2863 2005-01-13 Raja R Harinath <rharinath@novell.com>
2865 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
2868 2005-01-12 Raja R Harinath <rharinath@novell.com>
2870 Fix cs0038-1.cs, cs1640-6.cs.
2871 * ecore.cs (Expression.Resolve): Remove special-case for
2872 SimpleName in error-handling.
2873 (Expression.almostMatchedMembers): Relax access permission to
2875 (Expression.MemberLookupFailed): Handle duplicates in
2876 almostMatchedMembers list.
2877 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
2878 * expression.cs (New.DoResolve): Report CS1540 for more cases.
2879 * typemanager.cs (GetFullNameSignature): Use the MethodBase
2880 overload if the passed in MemberInfo is a MethodBase.
2882 2005-01-12 Marek Safar <marek.safar@seznam.cz>
2885 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
2886 for non-CAS & merge permission sets properly.
2888 2005-01-11 Raja R Harinath <rharinath@novell.com>
2890 Improve standard-compliance of simple name and member access
2891 resolution. Fixes bugs #52697, #57200, #67520, #69519.
2892 * ecore.cs (FullNamedExpression): New abstract base class
2893 for Namespaces and TypeExpressions.
2894 (ResolveFlags.SimpleName): Remove.
2895 (SimpleName): Remove support for dotted names.
2896 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
2897 DeclSpace.FindType and DeclSpace.LookupType.
2898 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
2899 (Expression.ExprClassName): Make member function.
2900 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
2901 a namespace. Remove creation of dotted "SimpleName"s.
2902 (MemberAccess.DoResolve): Likewise.
2903 * decl.cs (DeclSpace.Cache): Make private.
2904 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
2905 (DeclSpace.FindType): Update.
2906 (DeclSpace.LookupType): Move here from RootContext. Return a
2907 FullNamedExpression.
2908 * namespace.cs (Namespace): Derive from FullNamedExpression
2909 so that it can be part of expression resolution.
2910 (Namespace.Lookup): Return an FullNamedExpression.
2911 (NamespaceEntry.LookupAlias): Lookup aliases only in current
2913 * rootcontext.cs (NamespaceLookup): Remove.
2914 (LookupType): Move to DeclSpace.
2915 * attribute.cs (CheckAttributeType): Update.
2916 * doc.cs (FindDocumentedType): Remove allowAlias argument.
2917 (FindDocumentedTypeNonArray): Likewise.
2919 2005-01-11 Raja R Harinath <rharinath@novell.com>
2921 Fix cs0509.cs, cs1632.cs.
2922 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
2923 is the same as IsInterface.
2924 (TypeContainer.GetClassBases): Likewise.
2925 * statement.cs (LabeledStatement.ig): New field.
2926 (LabeledStatement.LabelTarget): Save ILGenerator which created the
2928 (LabeledStatement.DoEmit): Check that the label was created with
2929 the same ILGenerator.
2931 2005-01-10 Marek Safar <marek.safar@seznam.cz>
2934 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
2935 accessors to its properties.
2937 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
2938 from accessors to property.
2940 2005-01-10 Marek Safar <marek.safar@seznam.cz>
2943 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
2946 2005-01-08 Miguel de Icaza <miguel@ximian.com>
2948 * attribute.cs: Check for null and empty strings.
2950 I have lost another battle to Paolo.
2952 2005-01-07 Marek Safar <marek.safar@seznam.cz>
2955 * class.cs (PropertyMethod): Set Parent field in ctors.
2956 (SetMethod.InternalParameters): Add unsafe switch hack.
2957 Override MarkForDuplicationCheck where it is appropriate.
2959 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
2960 It says whether container allows members with the same name.
2962 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
2963 Removed is_method parameter.
2965 2005-01-06 Duncan Mak <duncan@ximian.com>
2967 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
2968 because the previous change led to incorrect reporting of CS1032
2969 ("Cannot define/undefine preprocessor symbols after first token in
2970 file"). Instead of using `tokens_seen' as the only flag that
2971 triggers CS1040, introduce `comments_seen'. This new flag is used
2972 to signify having seen comments on the current line, so it is
2973 unset after a newline.
2975 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
2977 * doc.cs : When searching for a type, find nested type too.
2978 This fixes bug #71040.
2980 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
2983 - Warn missing member comment on those classes which also does not
2984 have doc comments. Fixed bug #71041.
2985 - Don't warn missing doc comment on default constructor.
2988 2005-01-06 Duncan Mak <duncan@ximian.com>
2990 * cs-tokenizer.cs (xtoken): After handling traditional C-style
2991 comments, set `tokens_seen' to true. This allows us to detect
2992 misplaced preprocessor directives (i.e. not at the beginning of
2993 the a line, nor after whitespaces). In that case, report error
2994 CS1040. This fixes bug #56460.
2996 * cs-parser.jay (interface_member_declaration): Add checks for
2997 IsExplicitImpl, and report CS0541 error if an interface member is
2998 defined as an explicit interface declaration.
3000 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3003 * class.cs (PropertyMethod): Set Parent field in ctors.
3004 (SetMethod.InternalParameters): Add unsafe switch hack.
3006 * decl.cs (MemberCore.Parent): Cannot be readonly.
3008 2005-01-06 Raja R Harinath <rharinath@novell.com>
3010 * decl.cs (DeclSpace.ResolveType): Remove.
3011 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3012 Merge in code from ...
3013 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3014 * class.cs, enum.cs: Update to changes.
3016 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3018 * anonymous.cs: Ensure that we init the scope of our parent if it
3019 has not been initialized yet.
3021 2004-12-30 Duncan Mak <duncan@ximian.com>
3023 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3024 if field.FieldBuilder is null. Fixes #70758.
3026 * convert.cs: Fixed some typos and updated some of the comments.
3027 (ImplicitStandardConversionExists):
3028 (TryImplicitIntConversion): If `target_type' is an interface and
3029 the type of `ic' implements this interface, return true or a new
3030 BoxedCast instead of null. This fixes #70468.
3032 2004-12-29 Duncan Mak <duncan@ximian.com>
3034 * expression.cs (Argument.Emit): Check that Expr is
3035 IMemoryLocation before casting to it, and report CS1510 otherwise.
3039 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3041 * statement.cs (Block.ThisVariable): remove the recursion here, to
3042 make the --profile more sane.
3044 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3046 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3047 assembly, by JB Evain.
3049 2004-12-17 Raja R Harinath <rharinath@novell.com>
3051 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
3052 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
3053 "parent" refers to enclosing type/class. "base" refers to superclass.
3055 2004-12-17 Raja R Harinath <rharinath@novell.com>
3057 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3058 Ensure that we only have GlobalAttributes.
3059 * attribute.cs (Attribute.Emit): Make non-virtual.
3060 (GlobalAttribute.Emit): Remove.
3061 (Attribute.Resolve): Make virtual.
3062 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
3063 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
3064 the argument. Don't create one.
3065 (Attribute.GetObsoleteAttribute): Likewise.
3066 (Attribute.GetClsCompliantAttributeValue): Likewise.
3067 * class.cs, decl.cs: Update to changes.
3069 2004-12-17 Marek Safar <marek.safar@seznam.cz>
3071 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
3073 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
3075 * statement.cs (Foreach.Resolve): Add error 186 report.
3077 2004-12-16 Marek Safar <marek.safar@seznam.cz>
3079 * expression.cs (Conditional.DoResolve): Add warning 429.
3081 * statement.cs (If.Resolve): Add warning 665.
3083 2004-12-16 Raja R Harinath <rharinath@novell.com>
3085 New invariant: RootContext.Tree.Types.NamespaceEntry == null
3086 except when in the parser, and in GlobalAttribute.
3087 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
3088 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
3089 RootContext.Tree.Types.NamespaceEntry once work is done.
3090 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
3091 and resets RootContext.Tree.Types.NamespaceEntry.
3093 2004-12-15 Marek Safar <marek.safar@seznam.cz>
3095 * cs-parser.jay: Don't create a block for every variable.
3097 2004-12-14 Miguel de Icaza <miguel@ximian.com>
3099 * location.cs: Provide extra information.
3101 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
3102 variables from the captured environment, it is the ldarg_0.
3104 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3106 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
3109 * class.cs: Changed warning level for 169 to avoid developer
3110 displeasure from warning flooding. It will be changed back when they
3111 fix most of current BCL warnings.
3113 * RootContext.cs: Pushed default WarningLevel to 3.
3115 * statement.cs: Removed unused variable.
3117 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3119 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
3120 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
3121 Add error 502 report.
3122 (StaticClass.DefineType): Add error 441 report.
3123 (Class.AllowedModifiersProp): New virtual property as temporary
3124 extension to AllowedModifiers.
3125 (Class.DefineType): Add error 418 report. Moved ModFlags check here
3126 to share implementation with StaticClass and don't call virtual
3129 * driver.cs (MainDriver): Add error 1558 test.
3131 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
3132 report. Moved error 36 test here.
3134 * statement.cs (Throw.Resolve): Add error 724 report.
3136 * typemanager.cs: Add out_attribute_type core type.
3138 2004-12-13 Marek Safar <marek.safar@seznam.cz>
3140 * class.cs (TypeContainer.VerifyClsCompliance): Add error
3142 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
3144 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
3147 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
3149 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
3150 Add error 3023 report.
3151 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
3153 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
3156 2004-12-12 John Luke <john.luke@gmail.com>
3158 * driver.cs (AddArgs): take -- into account when
3159 adding arguments, fixes bug 65710
3161 2004-12-12 Martin Baulig <martin@ximian.com>
3163 * expression.cs (Unary.TryReduceNegative): Added support for
3164 SByteConstant and ByteConstant.
3165 (Unary.Reduce): Check error values from TryReduceNegative().
3167 2004-12-10 Marek Safar <marek.safar@seznam.cz>
3169 * attributes.cs (Attribute.Resolve): Avoid multiple error report
3170 and report exception as error 182.
3172 2004-12-10 Raja R Harinath <rharinath@novell.com>
3174 * driver.cs (Main): Fix message when there are warnings.
3176 2004-12-09 Miguel de Icaza <miguel@ximian.com>
3178 * delegate.cs: Fixed my fix from yesterday, sorry about that.
3180 2004-12-09 Marek Safar <marek.safar@seznam.cz>
3182 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
3183 Reduced number of warnings.
3185 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
3187 2004-12-08 Miguel de Icaza <miguel@ximian.com>
3189 * driver.cs: Removed message.
3191 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
3193 2004-12-08 <vargaz@freemail.hu>
3195 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
3197 2004-12-08 Martin Baulig <martin@ximian.com>
3199 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
3200 instead of a CS3002 for properties and indexer.
3202 2004-12-08 Martin Baulig <martin@ximian.com>
3204 * decl.cs (MemberName.ToString): Make this work again.
3206 2004-12-08 Marek Safar <marek.safar@seznam.cz>
3208 * attribute.cs (Resolve): Add error 591 detection.
3210 * class.cs (FieldMember.Define): Add error 1547 detection.
3211 (Indexer.Define): Add error 620 detection.
3212 (Operator.Define): Add error 590 detection.
3214 * ecore.cs: Missing argument for error 79.
3216 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
3219 2004-12-07 Marek Safar <marek.safar@seznam.cz>
3222 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
3225 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
3227 * cs-parser.jay : handle doc comments on implicit/explicit operators.
3228 Some operator comments were suppressed.
3229 * doc.cs : Implicit/explicit operator name in doc comments are like
3230 "op_Explicit(type)~returnType", so added suffix handling.
3232 2004-12-07 Martin Baulig <martin@ximian.com>
3235 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
3236 (MemberCore.GetClsCompliantAttributeValue): Likewise.
3237 (DeclSpace.ec): New protected field; store the EmitContext here.
3238 (DeclSpace.EmitContext): New public property; moved here from
3240 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
3243 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
3244 (Enum.Emit): Don't create a new EmitContext.
3246 * delegate.cs (Delegate.DefineType): Always create the
3249 * iterators.cs (Iterators.DefineIterator): Create a new
3250 EmitContext and store it in `ec'.
3252 2004-08-24 Martin Baulig <martin@ximian.com>
3255 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
3256 this for accessibility checks.
3257 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
3258 IsNestedFamilyAccessible.
3259 (TypeManager.IsSubclassOf): New method, do what the name actually
3262 2004-12-06 Raja R Harinath <rharinath@novell.com>
3264 Fix crash on cs0657-17.cs.
3265 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3266 Use RootContext.Tree.Types, not 'new RootTypes ()'.
3267 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
3268 the case where the NamespaceEntry gets overwritten.
3270 2004-12-06 Marek Safar <marek.safar@seznam.cz>
3272 Fixed #69195, #56821
3273 * ecore.cs (ResolveBoolean): Tiny refactoring.
3275 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
3276 of right expression resolving when left is false constant and
3277 operator is LogicalAnd OR true constant and operator is LogicalOr.
3279 * statement.cs (ResolveUnreachable): Always reports warning.
3281 2004-12-05 Miguel de Icaza <miguel@ximian.com>
3283 * class.cs: Distinguish between 1721 and 1722 (just a little help
3284 for the programmer).
3286 2004-12-03 Miguel de Icaza <miguel@ximian.com>
3288 * delegate.cs: Only allow this on new versions of the language.
3290 2004-12-02 Duncan Mak <duncan@ximian.com>
3292 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
3294 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
3295 here as a static method. Take an additional bool out parameter
3296 `must_do_cs1540_check' for signaling to InstanceResolve.
3297 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
3298 member field from PropertyExpr class and made it an argument of
3300 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
3301 check for MarshalByRefObject, and report CS0122 instead of CS1540.
3302 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
3303 and `remove_accessor' as well as InstanceResolve: report CS0122
3308 2004-12-03 Raja R Harinath <rharinath@novell.com>
3310 Fix test-327.cs, test-328.cs, and put in early infrastructure
3311 for eventually fixing #52697.
3312 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
3313 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
3315 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
3316 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
3317 (VerifyUsing, error246): Update.
3318 * rootcontext.cs (RootContext.NamespaceLookup): Just use
3319 'NamespaceEntry.LookupNamespaceOrType'.
3321 2004-12-03 Martin Baulig <martin@ximian.com>
3323 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3324 method as our child, call AnonymousMethod.Compatible() on it.
3326 2004-12-03 Raja R Harinath <rharinath@novell.com>
3328 Disable XML documentation support in 'basic' profile.
3329 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
3330 Redirect XmlElement to System.Object.
3331 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
3332 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
3333 * mcs.exe.sources: Add doc-bootstrap.cs.
3334 * doc-bootstrap.cs: New file. Contains empty stub implementation
3337 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
3339 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
3340 comments are allowed.
3342 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3344 * delegate.cs: Add checks for subtypes in paramaters and return values
3345 in VerifyMethod () to add support for Covariance/Contravariance
3348 2004-12-02 Miguel de Icaza <miguel@ximian.com>
3350 * report.cs: Remove extra closing parenthesis.
3352 * convert.cs (Error_CannotImplicitConversion): If the name of the
3353 types are the same, provide some extra information.
3355 * class.cs (FieldBase): Use an unused bit field from the field to
3356 encode the `has_offset' property from the FieldMember. This saves
3357 a couple of Ks on bootstrap compilation.
3359 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3360 method as our child, return the AnonymousMethod resolved
3363 * expression.cs (New.DoResolve): Allow return values from
3364 NewDelegate to also include AnonymousMethods.
3368 2004-12-02 Marek Safar <marek.safar@seznam.cz>
3371 * attribute.cs (Resolve): Improved implementation of params
3372 attribute arguments.
3374 * support.cs (ParameterData): Add HasParams to be faster.
3376 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
3378 all things are for /doc support:
3380 * doc.cs: new file that supports XML documentation generation.
3381 * mcs.exe.sources: added doc.cs.
3383 Handle /doc command line option.
3384 Report error 2006 instead of 5 for missing file name for /doc.
3385 Generate XML documentation when required, after type resolution.
3387 Added support for picking up documentation (/// and /** ... */),
3388 including a new XmlCommentState enumeration.
3390 Added lines to fill Documentation element for field, constant,
3391 property, indexer, method, constructor, destructor, operator, event
3392 and class, struct, interface, delegate, enum.
3393 Added lines to warn incorrect comment.
3395 Added Documentation field (passed only when /doc was specified).
3397 Added DocComment, DocCommentHeader, GenerateDocComment() and
3398 OnGenerateDocComment() and some supporting private members for
3399 /doc feature to MemberCore.
3401 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
3403 Added overriden DocCommentHeader.
3405 Added overriden DocCommentHeader and GenerateDocComment().
3407 2004-12-01 Miguel de Icaza <miguel@ximian.com>
3409 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
3410 unwrapping the enumeration values, chain to
3411 DoConstantNumericPromotions again, so we can promote things to the
3412 fundamental types (takes care of enums that are bytes, sbytes).
3416 2004-12-01 Raja R Harinath <rharinath@novell.com>
3418 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
3419 Fix long-standing bug in type-lookup. Use FindType instead of
3420 LookupType when ec.ResolvingTypeTree.
3421 (Attribute.ResolveType, Attribute.Resolve)
3422 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
3424 (Attributes.Search): Remove internal version. Update.
3425 (Attributes.SearchMulti): Update.
3426 (Attributes.GetClsCompliantAttribute): Remove.
3427 (Attributes.GetIndexerNameAttribute): Remove.
3428 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
3429 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
3430 * class.cs (Indexer.Define): Likewise.
3432 2004-12-01 Marek Safar <marek.safar@seznam.cz>
3435 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
3436 MarshallByReference members access.
3438 * expression.cs: Use CheckMarshallByRefAccess;
3439 Better error CS0197 message.
3441 * report.cs: Print whole related error message.
3443 2004-11-30 Raja R Harinath <rharinath@novell.com>
3445 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
3446 the current directory to help debugging.
3448 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3450 * class (GetClassBases): Better error 60 report.
3451 (EventProperty): Disabled warning 67 detection.
3453 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3456 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
3458 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
3461 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3464 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
3466 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
3468 2004-11-26 Miguel de Icaza <miguel@ximian.com>
3470 * attribute.cs (Attribute.Resolve): Refine error reporting and
3471 report a cs0117 if the identifier does not exist, to distinguish
3472 from 0617 which is a miss-use of the actual identifier.
3474 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
3475 between cs0070 and cs0079.
3477 * class.cs (MemberBase.DoDefine): When reporting a wrong
3478 accessibility level, we use MethodCore to compare instead of
3479 Method (this was a regression in some refactoring effort).
3481 So now we correctly report cs0056 again.
3483 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
3484 testing the target_type (which was known to be object_type) and
3485 not the source type (which is anonymous_method).
3487 Fixed reporting of error cs1660.
3489 * expression.cs (UserCast.Source): Expose the underlying cast.
3491 * statement.cs (Switch.SwitchGoverningType): Sort the list of
3492 allowed types to find a match to int32 first (most common).
3494 In addition, it ignores any ImplicitUserConversions that did an
3495 internal implicit conversion (as the switch statement allows only
3496 one integral conversion to exist).
3498 * class.cs (PartialContainer.Create): rename `name' to
3499 `member_name' for clarity. Then replace the string calls with a
3500 call to MemberName.GetPartialName, as now using
3501 MemberName.ToString is an error (this is due to the side effects
3502 it had, that were fixed in the past).
3504 This will restore the error reporting on a number of partial class
3505 errors that were missusing this (and getting an exception as a
3506 results, which is now just a plain textual warning, because
3507 yyparse debug output would crash otherwise).
3509 2004-11-26 Raja R Harinath <rharinath@novell.com>
3511 * Makefile (PROGRAM_INSTALL_DIR): Remove.
3513 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3515 * rootcontext.cs (LookupType): Make sure to cache lookups that
3516 don't give us a negative result. This saves about 5% of corlib
3519 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3521 * report.cs (AbstractMessage.Print): messages are sent to stderr
3523 * class.cs (TypeContainer.GetClassBases): It is an error to have a
3524 non-interface in the list of interfaces (at this point, either
3525 parent was properly set, or a base class is being listed in the
3526 interfaces section).
3528 This flags error 1722, and resolves the crash from bug 69259.
3530 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3532 * statement.cs (Using.EmitExpressionFinally): make this work right
3533 for valuetypes. Fixes 69926.
3535 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3537 * const.cs (Const.ChangeType): Cope with the "0 literal can be
3538 converted to an enum" here, before we try to change the underlying
3539 type. This code exists, but it is a different code path than the
3540 one used while encoding constants.
3542 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
3543 old bug: when converting from the null literal to a pointer,
3544 return an EmptyCast, not the NullLiteral.
3546 This fixes #69921, the recent null_type changes probably made this
3549 (ImplicitReferenceConversionExists): In addition, resynchronized
3550 the code here, so it matches the same code in
3551 ImplicitReferenceConversionExists for the `from any class-type S
3552 to any interface-type T'.
3555 2004-11-25 Marek Safar <marek.safar@seznam.cz>
3557 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
3559 2004-11-24 Miguel de Icaza <miguel@ximian.com>
3561 * cs-parser.jay: Use verbosity accordingly.
3563 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3565 * expression.cs (Unary.ResolveOperator): Do not report warning;
3566 AddressOf reads from variable.
3568 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
3570 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3574 * attribute.cs (Attributable): Removed CheckTargets.
3575 (Attributes.Emit): Explicit attribute targets are tested here.
3577 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
3578 not enabled for interfaces.
3580 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
3581 (GetAssemblyName): Ouch next bug there.
3583 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3585 * expression.cs: Error 275 added.
3587 2004-11-23 Marek Safar <marek.safar@seznam.cz>
3589 Fix bug #69177 (Implemented decimal constant support)
3591 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
3592 (BinaryFold): Add DecimalConstant.
3594 * const.cs (Define): Decimal constant
3596 (ChangeType): Add decimal type handling.
3597 (LookupConstantValue): Don't set value for decimal type but
3598 emit DecimalConstantAttribute. Needed for constant optimization.
3600 * constant.cs (ToDecimal): New method.
3601 (ConvertToDecimal): New method.
3602 (IntConstant): Implemented ConvertToDecimal.
3603 (DecimalConstant.Emit): Emit optimized version for decimals in
3606 * expression.cs (ResolveOperator): Changed order of constant
3607 reduction to work correctly with native types which have
3608 overloaded operators.
3609 (ResolveMemberAccess): Extract constant value from attribute
3612 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
3614 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
3615 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
3616 (ChangeType): Decimal is special.
3617 (TypeToCoreType): Add decimal type.
3619 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3621 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
3624 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3626 * class.cs (EventField.ApplyAttributeBuilder): Fix error
3629 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3631 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
3633 * pending.cs (PendingImplementation): Grab only interfaces.
3635 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3637 * statement.cs (ForeachHelperMethods): Add location member and
3638 error 202 detection.
3640 2004-11-19 Raja R Harinath <rharinath@novell.com>
3642 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
3643 automatically handled by executable.make.
3644 (PROGRAM): Make profile-specific.
3646 2004-11-18 Marek Safar <marek.safar@seznam.cz>
3648 * expression.cs (DoResolveBase): Fixed wrong warning for out
3651 2004-11-18 Martin Baulig <martin@ximian.com>
3653 Merged latest changes into gmcs. Please keep this comment in
3654 here, it makes it easier for me to see what changed in MCS since
3655 the last time I merged.
3657 2004-11-17 Raja R Harinath <rharinath@novell.com>
3659 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
3660 (TypeHandle.GetMemberCache): New.
3661 (TypeHandle.TypeHandle): Update.
3662 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
3663 (TypeManager.LookupParentInterfacesCache):
3664 Rename from LookupInterfaceCache. Optimize slightly.
3665 (TypeManager.MemberLookup_FindMembers): Update.
3666 * decl.cs (MemberCache.MemberCache): Set Container to null in the
3668 (AddCacheContents): Rename from AddHashtable.
3669 * class.cs (TypeContainer.parent_container): Remove.
3670 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
3671 (TypeContainer.DoDefineMembers): Don't initialize it.
3672 Update to name changes.
3674 2004-11-17 Miguel de Icaza <miguel@ximian.com>
3676 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
3677 that factors the code to check access modifiers on override.
3679 (PropertyBase): Use the code here.
3681 Patch from Lluis S'anchez, fixes bug #69361.
3683 2004-11-15 Miguel de Icaza <miguel@ximian.com>
3685 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
3686 routine that is used to report the use of a captured variable
3687 whose address has been taken.
3689 There are two checks: one when variables are being captured and
3690 the other check is when the address of a variable is taken.
3692 (because an anonymous methods might be resolved before *or* after
3693 the address has been taken) and
3695 * expression.cs (Conditional.DoResolve): Remove the special
3696 casing that Martin added to trueExpr and falseExpr being both
3697 NullLiteral. We get the right behavior now just by introducing
3698 the null_type into the compiler.
3700 * convert.cs (ExplicitConversion): Change the code to use
3701 null_type instead of testing `expr is NullLiteral'.
3702 (ImplicitConversionStandard): use null_type too.
3703 (ImplicitReferenceConversionExists): use null_type too.
3704 (ImplicitReferenceConversion): use null_type too.
3706 * literal.cs: The type of `NullLiteral' is now null_type instead
3708 (Resolve): Set the type here.
3710 * typemanager.cs: Introduce null_type.
3712 2004-11-17 Martin Baulig <martin@ximian.com>
3714 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
3715 direction, like FindMembers() does. Fixes #69546, testcase is in
3718 2004-11-16 Martin Baulig <martin@ximian.com>
3720 This is based on a patch from Marek Safar, see bug #69082.
3721 Fixes bugs #63705 and #67130.
3723 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
3724 method; create a MemberCache for an interface type and cache the
3727 * decl.cs (IMemberContainer.ParentContainer): Removed.
3728 (IMemberContainer.ParentCache): New property.
3729 (MemberCache.SetupCacheForInterface): Removed.
3730 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
3731 to create a cache for an interface's "parent".
3733 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
3736 2004-11-16 Martin Baulig <martin@ximian.com>
3738 Merged back from gmcs; these changes already went into gmcs a
3739 couple of weeks ago.
3742 (TypeManager.AddUserType): Removed the `ifaces' argument.
3743 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
3745 (TypeManager.AddUserInterface): Removed.
3746 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
3748 (TypeManager.GetInterfaces): Likewise.
3749 (TypeManager.GetExplicitInterfaces): Likewise.
3751 * ecore.cs (TypeExpr.GetInterfaces): Removed.
3753 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
3754 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
3756 2004-11-14 Ben Maurer <bmaurer@ximian.com>
3758 * statement.cs: Avoid adding bools to a hashtable.
3760 2004-11-07 Miguel de Icaza <miguel@ximian.com>
3762 * expression.cs (Invocation.OverloadResolve): Flag error if we are
3763 calling an unsafe method from a safe location.
3765 2004-11-06 Marek Safar <marek.safar@seznam.cz>
3768 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
3770 2004-11-06 Miguel de Icaza <miguel@ximian.com>
3772 * namespace.cs (VerifyUsing): use GetPartialName instead of
3775 2004-11-05 Miguel de Icaza <miguel@ximian.com>
3777 * statement.cs (Return.Resolve): Fix regression in typo: if
3778 `in_exc', we have to request a NeedReturnLabel, this was a typo
3779 introduced in the anonymous method check-in. Fixes #69131.
3781 * Indexers were using the ShortName when defining themselves,
3782 causing a regression in the compiler bootstrap when applying the
3783 patch from 2004-11-02 (first part), now they use their full name
3784 and the bug is gone.
3786 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
3788 * driver.cs: Strip the path from the names of embedded resources. Fixes
3791 2004-11-04 Raja R Harinath <rharinath@novell.com>
3793 Fix error message regression: cs0104-2.cs.
3794 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
3795 (AliasEntry.Resolve): Update.
3796 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
3798 (RootContext.LookupType): Update.
3800 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
3802 * cs-parser.jay: Add support for handling accessor modifiers
3803 * class: Add support port accessor modifiers and error checking,
3804 define PropertyMethod.Define as virtual (not abstract anymore)
3805 * ecore.cs: Add checking for proeprties access with access modifiers
3806 * iterators.cs: Modify Accessor constructor call based in the modified
3808 2004-11-02 Ben Maurer <bmaurer@ximian.com>
3810 * expression.cs (StringConcat): Handle being called twice,
3811 as when we have a concat in a field init with more than two
3814 2004-11-02 Miguel de Icaza <miguel@ximian.com>
3816 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
3817 special case explicit implementations, we should always produce
3818 the .property or .event declaration.
3820 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
3821 since it will not return correct data if people use this
3822 unresolved in the presence of using statements (see test-313).
3824 * class.cs (MethodData.Define): If we are an explicit interface
3825 implementation, set the method name to the full name of the
3826 interface plus the name of the method.
3828 Notice that using the method.MethodName.GetFullName() does not
3829 work, as it will only contain the name as declared on the source
3830 file (it can be a shorthand in the presence of using statements)
3831 and not the fully qualifed type name, for example:
3835 class D : ICloneable {
3836 object ICloneable.Clone () {
3840 Would produce a method called `ICloneable.Clone' instead of
3841 `System.ICloneable.Clone'.
3843 * namespace.cs (Alias.Resolve): Use GetPartialName.
3845 2004-11-01 Marek Safar <marek.safar@seznam.cz>
3847 * cs-parser.jay: Add error 1055 report.
3849 2004-11-01 Miguel de Icaza <miguel@ximian.com>
3851 * assign.cs (Assign.DoResolve): Only do the transform of
3852 assignment into a New if the types are compatible, if not, fall
3853 through and let the implicit code deal with the errors and with
3854 the necessary conversions.
3856 2004-11-01 Marek Safar <marek.safar@seznam.cz>
3858 * cs-parser.jay: Add error 1031 report.
3860 * cs-tokenizer.cs: Add location for error 1038.
3862 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3864 * cs-parser.jay: Add error 1016 report.
3866 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3868 * cs-parser.jay: Add errors 1575,1611 report.
3870 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3872 * cs-parser.jay: Add error 1001 report.
3874 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3877 * attribute.cs (GetMarshal): Add method argument for
3878 caller identification.
3880 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
3881 agument for GetMarshal and RuntimeMissingSupport.
3883 2004-10-31 Marek Safar <marek.safar@seznam.cz>
3885 * attribute.cs (ExtractSecurityPermissionSet): Removed
3886 TypeManager.code_access_permission_type.
3888 * typemanager.cs: Removed TypeManager.code_access_permission_type.
3890 2004-10-27 Miguel de Icaza <miguel@ximian.com>
3892 * expression.cs (LocalVariableReference.DoResolveLValue): Check
3893 for obsolete use of a variable here. Fixes regression on errors
3894 cs0619-25 and cs0619-26.
3896 2004-10-27 Marek Safar <marek.safar@seznam.cz>
3898 Fix #62358, implemented security attribute encoding.
3900 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
3901 Tests permitted SecurityAction for assembly or other types.
3902 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
3903 data from SecurityPermissionAttribute to PermisionSet class.
3905 * class.cs (ApplyAttributeBuilder): Added special handling
3906 for System.Security.Permissions.SecurityAttribute based types.
3908 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
3909 special handling for System.Security.Permissions.SecurityAttribute
3912 * enum.cs (ApplyAttributeBuilder): Added special handling
3913 for System.Security.Permissions.SecurityAttribute based types.
3915 * parameter.cs (ApplyAttributeBuilder): Added special handling
3916 for System.Security.Permissions.SecurityAttribute based types.
3918 * rootcontext.cs: Next 2 core types.
3920 * typemanager.cs (TypeManager.security_permission_attr_type):
3921 Built in type for the SecurityPermission Attribute.
3922 (code_access_permission_type): Build in type.
3924 2004-10-17 Miguel de Icaza <miguel@ximian.com>
3926 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
3927 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
3928 all of this information into
3929 EmitContext.EmitCapturedVariableInstance.
3931 * codegen.cs (EmitCapturedVariableInstance): move here the
3932 funcionality of emitting an ldarg.0 in the presence of a
3933 remapping. This centralizes the instance emit code.
3935 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
3936 then emit a load of this: it means that we have reached the
3937 topmost ScopeInfo: the one that contains the pointer to the
3938 instance of the class hosting the anonymous method.
3940 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
3941 captures to the topmost CaptureContext.
3943 2004-10-12 Miguel de Icaza <miguel@ximian.com>
3945 * expression.cs (LocalVariableReference): Move the knowledge about
3946 the iterators into codegen's EmitCapturedVariableInstance.
3948 2004-10-11 Miguel de Icaza <miguel@ximian.com>
3950 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
3951 all code paths return a value from an anonymous method (it is the
3952 same as the 161 error, but for anonymous methods).
3954 2004-10-08 Miguel de Icaza <miguel@ximian.com>
3956 The introduction of anonymous methods in the compiler changed
3957 various ways of doing things in the compiler. The most
3958 significant one is the hard split between the resolution phase
3959 and the emission phases of the compiler.
3961 For instance, routines that referenced local variables no
3962 longer can safely create temporary variables during the
3963 resolution phase: they must do so from the emission phase,
3964 since the variable might have been "captured", hence access to
3965 it can not be done with the local-variable operations from the runtime.
3969 (Block.Flags): New flag `IsTopLevel' to indicate that this block
3970 is a toplevel block.
3972 (ToplevelBlock): A new kind of Block, these are the blocks that
3973 are created by the parser for all toplevel method bodies. These
3974 include methods, accessors and anonymous methods.
3976 These contain some extra information not found in regular blocks:
3977 A pointer to an optional CaptureContext (for tracking captured
3978 local variables and parameters). A pointer to the parent
3981 (Return.Resolve): Catch missmatches when returning a value from an
3982 anonymous method (error 1662).
3983 Invoke NeedReturnLabel from the Resolve phase instead of the emit
3986 (Break.Resolve): ditto.
3988 (SwitchLabel): instead of defining the labels during the
3989 resolution phase, we now turned the public ILLabel and ILLabelCode
3990 labels into methods called GetILLabelCode() and GetILLabel() that
3991 only define the label during the Emit phase.
3993 (GotoCase): Track the SwitchLabel instead of the computed label
3994 (its contained therein). Emit the code by using
3995 SwitchLabel.GetILLabelCode ().
3997 (LocalInfo.Flags.Captured): A new flag has been introduce to track
3998 whether the Local has been captured or not.
4000 (LocalInfo.IsCaptured): New property, used to tell whether the
4001 local has been captured.
4003 * anonymous.cs: Vastly updated to contain the anonymous method
4006 The main classes here are: CaptureContext which tracks any
4007 captured information for a toplevel block and ScopeInfo used to
4008 track the activation frames for various local variables.
4010 Each toplevel block has an optional capture context associated
4011 with it. When a method contains an anonymous method both the
4012 toplevel method and the anonymous method will create a capture
4013 context. When variables or parameters are captured, they are
4014 recorded on the CaptureContext that owns them, for example:
4018 MyDelegate d = delegate {
4023 Here `a' will be recorded as captured on the toplevel
4024 CapturedContext, the inner captured context will not have anything
4025 (it will only have data if local variables or parameters from it
4026 are captured in a nested anonymous method.
4028 The ScopeInfo is used to track the activation frames for local
4029 variables, for example:
4031 for (int i = 0; i < 10; i++)
4032 for (int j = 0; j < 10; j++){
4033 MyDelegate d = delegate {
4038 At runtime this captures a single captured variable `i', but it
4039 captures 10 different versions of the variable `j'. The variable
4040 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4041 recorded on a child.
4043 The toplevel ScopeInfo will also track information like the `this'
4044 pointer if instance variables were referenced (this is necessary
4045 as the anonymous method lives inside a nested class in the host
4046 type of the method).
4048 (AnonymousMethod): Expanded to track the Toplevel, implement
4049 `AnonymousMethod.Compatible' to tell whether an anonymous method
4050 can be converted to a target delegate type.
4052 The routine now also produces the anonymous method content
4054 (AnonymousDelegate): A helper class that derives from
4055 DelegateCreation, this is used to generate the code necessary to
4056 produce the delegate for the anonymous method that was created.
4058 * assign.cs: API adjustments for new changes in
4059 Convert.ImplicitStandardConversionExists.
4061 * class.cs: Adjustments to cope with the fact that now toplevel
4062 blocks are of type `ToplevelBlock'.
4064 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
4065 insteda of standard blocks.
4067 Flag errors if params arguments are passed to anonymous methods.
4069 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
4070 `CurrentAnonymousMethod' which points to the current Anonymous
4071 Method. The variable points to the AnonymousMethod class that
4072 holds the code being compiled. It is set in the new EmitContext
4073 created for the anonymous method.
4075 (EmitContext.Phase): Introduce a variable and an enumeration to
4076 assist in enforcing some rules about when and where we are allowed
4077 to invoke certain methods (EmitContext.NeedsReturnLabel is the
4078 only one that enfonces this right now).
4080 (EmitContext.HaveCaptureInfo): new helper method that returns
4081 whether we have a CapturedContext initialized.
4083 (EmitContext.CaptureVariable): New method used to register that a
4084 LocalInfo must be flagged for capturing.
4086 (EmitContext.CapturedParameter): New method used to register that a
4087 parameters must be flagged for capturing.
4089 (EmitContext.CapturedField): New method used to register that a
4090 field must be flagged for capturing.
4092 (EmitContext.HaveCapturedVariables,
4093 EmitContext.HaveCapturedFields): Return whether there are captured
4094 variables or fields.
4096 (EmitContext.EmitMethodHostInstance): This is used to emit the
4097 instance for the anonymous method. The instance might be null
4098 (static methods), this (for anonymous methods that capture nothing
4099 and happen to live side-by-side with the current method body) or a
4100 more complicated expression if the method has a CaptureContext.
4102 (EmitContext.EmitTopBlock): Routine that drives the emission of
4103 code: it will first resolve the top block, then emit any metadata
4104 and then emit the code. The split is done so that we can extract
4105 any anonymous methods and flag any captured variables/parameters.
4107 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
4108 during this phase, the ILGenerator should not be used as labels
4109 and local variables declared here might not be accessible to any
4110 code that is part of an anonymous method.
4112 Exceptions to this include the temporary variables that are
4113 created by some statements internally for holding temporary
4116 (EmitContext.EmitMeta): New routine, in charge of emitting all the
4119 (EmitContext.TemporaryReturn): This method is typically called
4120 from the Emit phase, and its the only place where we allow the
4121 ReturnLabel to be defined other than the EmitMeta. The reason is
4122 that otherwise we would have to duplicate a lot of logic in the
4123 Resolve phases of various methods that today is on the Emit
4126 (EmitContext.NeedReturnLabel): This no longer creates the label,
4127 as the ILGenerator is not valid during the resolve phase.
4129 (EmitContext.EmitThis): Extended the knowledge in this class to
4130 work in anonymous methods in addition to iterators.
4132 (EmitContext.EmitCapturedVariableInstance): This emits whatever
4133 code is necessary on the stack to access the instance to a local
4134 variable (the variable will be accessed as a field).
4136 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
4137 EmitContext.EmitAddressOfParameter): Routines to support
4138 parameters (not completed at this point).
4140 Removals: Removed RemapLocal and RemapLocalLValue. We probably
4141 will also remove the parameters.
4143 * convert.cs (Convert): Define a `ConstantEC' which points to a
4144 null. This is just to prefity some code that uses
4145 ImplicitStandardConversion code and do not have an EmitContext
4148 The idea is to flag explicitly that at that point in time, it is
4149 known that the conversion will not trigger the delegate checking
4150 code in implicit conversions (which requires a valid
4153 Everywhere: pass new EmitContext parameter since
4154 ImplicitStandardConversionExists now requires it to check for
4155 anonymous method conversions.
4157 (Convert.ImplicitStandardConversionExists): If the type of an
4158 expression is the anonymous_method_type, and the type is a
4159 delegate, we invoke the AnonymousMethod.Compatible method to check
4160 whether an implicit conversion is possible.
4162 (Convert.ImplicitConversionStandard): Only do implicit method
4163 group conversions if the language level is not ISO_1.
4165 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
4166 MethodInfo for the Invoke method. used by Delegate and
4169 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
4170 method conversions if the target type is a delegate.
4172 Removed extra debugging nops.
4174 (LocalVariableReference): Turn the `local_info' into a public
4177 Add `prepared' field, the same hack used for FieldExprs to cope
4178 with composed assignments, as Local variables do not necessarily
4179 operate purely on the stack as they used to: they can be captured
4182 Add `temp' for a temporary result, like fields.
4184 Refactor DoResolve and DoResolveLValue into DoResolveBase.
4186 It now copes with Local variables that are captured and emits the
4187 proper instance variable to load it from a field in the captured
4190 (ParameterReference.DoResolveBase): During the resolve phase,
4191 capture parameters if we are in an anonymous method.
4193 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
4194 anonymous method, use the EmitContext helper routines to emit the
4195 parameter reference.
4197 * iterators.cs: Set RemapToProxy to true/false during the
4200 * parameters.cs (GetParameterByName): New helper method.
4202 * typemanager.cs (anonymous_method_type) a new type that
4203 represents an anonyous method. This is always an internal type,
4204 used as a fencepost to test against the anonymous-methodness of an
4207 2004-10-20 Marek Safar <marek.safar@seznam.cz>
4209 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
4211 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
4213 2004-10-18 Martin Baulig <martin@ximian.com>
4215 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
4216 `Type' directly, but call ResolveType() on it.
4217 (Catch.Resolve): Likewise.
4218 (Foreach.Resolve): Likewise.
4220 2004-10-18 Martin Baulig <martin@ximian.com>
4222 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
4223 `Type' directly, but call ResolveType() on it.
4224 (Probe.DoResolve): Likewise.
4225 (ArrayCreation.LookupType): Likewise.
4226 (TypeOf.DoResolve): Likewise.
4227 (SizeOf.DoResolve): Likewise.
4229 2004-10-18 Martin Baulig <martin@ximian.com>
4231 * expression.cs (Invocation.BetterFunction): Put back
4232 TypeManager.TypeToCoreType().
4234 2004-10-18 Raja R Harinath <rharinath@novell.com>
4236 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
4239 2004-10-18 Martin Baulig <martin@ximian.com>
4241 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
4242 `Type' directly, but call ResolveType() on it.
4244 2004-10-18 Martin Baulig <martin@ximian.com>
4246 * class.cs (FieldMember.Define): Don't access the TypeExpr's
4247 `Type' directly, but call ResolveType() on it.
4248 (MemberBase.DoDefine): Likewise.
4250 * expression.cs (New.DoResolve): Don't access the TypeExpr's
4251 `Type' directly, but call ResolveType() on it.
4252 (ComposedCast.DoResolveAsTypeStep): Likewise.
4254 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
4255 `Type' directly, but call ResolveType() on it.
4257 2004-10-17 John Luke <john.luke@gmail.com>
4259 * class.cs (Operator.GetSignatureForError): use CSharpName
4261 * parameter.cs (Parameter.GetSignatureForError): Returns
4262 correct name even if was not defined.
4264 2004-10-13 Raja R Harinath <rharinath@novell.com>
4267 * class.cs (TypeContainer.EmitContext): New property.
4268 (DefineNestedTypes): Create an emitcontext for each part.
4269 (MethodCore.DoDefineParameters): Use container's emitcontext.
4270 Pass type array to InternalParameters.
4271 (MemberBase.DoDefine): Use container's emitcontext.
4272 (FieldMember.Define): Likewise.
4273 (Event.Define): Likewise.
4274 (SetMethod.GetParameterInfo): Change argument to EmitContext.
4275 Pass type array to InternalParameters.
4276 (SetIndexerMethod.GetParameterInfo): Likewise.
4277 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
4278 * delegate.cs (Define): Pass emitcontext to
4279 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
4280 array to InternalParameters.
4281 * expression.cs (ParameterReference.DoResolveBase): Pass
4282 emitcontext to GetParameterInfo.
4283 (ComposedCast.DoResolveAsTypeStep): Remove check on
4284 ec.ResolvingTypeTree.
4285 * parameter.cs (Parameter.Resolve): Change argument to
4286 EmitContext. Use ResolveAsTypeTerminal.
4287 (Parameter.GetSignature): Change argument to EmitContext.
4288 (Parameters.ComputeSignature): Likewise.
4289 (Parameters.ComputeParameterTypes): Likewise.
4290 (Parameters.GetParameterInfo): Likewise.
4291 (Parameters.ComputeAndDefineParameterTypes): Likewise.
4292 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
4293 * support.cs (InternalParameters..ctor): Remove variant that takes
4295 * typemanager.cs (system_intptr_expr): New.
4296 (InitExpressionTypes): Initialize it.
4298 2004-10-12 Chris Toshok <toshok@ximian.com>
4300 * cs-parser.jay: fix location for try_statement and catch_clause.
4302 2004-10-11 Martin Baulig <martin@ximian.com>
4304 * report.cs: Don't make --fatal abort on warnings, we have
4305 -warnaserror for that.
4307 2004-10-07 Raja R Harinath <rharinath@novell.com>
4309 More DeclSpace.ResolveType avoidance.
4310 * decl.cs (MemberCore.InUnsafe): New property.
4311 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
4312 with newly created EmitContext.
4313 (FieldMember.Define): Likewise.
4314 * delegate.cs (Delegate.Define): Likewise.
4315 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
4316 only if normal name-lookup fails.
4317 (TypeExpr.DoResolve): Enable error-checking.
4318 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
4319 (SizeOf.DoResolve): Likewise.
4320 (ComposedCast.DoResolveAsTypeStep): Likewise.
4321 (StackAlloc.DoResolve): Likewise.
4322 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
4323 (Block.Unsafe): New property.
4324 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
4325 (Unsafe): Set 'unsafe' flag of contained block.
4326 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
4327 (Fixed.Resolve): Likewise.
4328 (Catch.Resolve): Likewise.
4329 (Using.ResolveLocalVariableDecls): Likewise.
4330 (Foreach.Resolve): Likewise.
4332 2004-10-05 John Luke <john.luke@gmail.com>
4334 * cs-parser.jay: add location to error CS0175
4336 2004-10-04 Miguel de Icaza <miguel@ximian.com>
4338 * ecore.cs (Expression.Constantity): Add support for turning null
4341 * const.cs (Const.Define): Allow constants to be reference types
4342 as long as the value is Null.
4344 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
4346 * namespace.cs (NamespaceEntry.Using): No matter which warning
4347 level is set, check if this namespace name has already been added.
4349 2004-10-03 Ben Maurer <bmaurer@ximian.com>
4351 * expression.cs: reftype [!=]= null should always use br[true,false].
4354 2004-10-03 Marek Safar <marek.safar@seznam.cz>
4357 * attribute.cs: Enum conversion moved to
4358 GetAttributeArgumentExpression to be applied to the all
4361 2004-10-01 Raja R Harinath <rharinath@novell.com>
4363 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
4364 * class.c (TypeContainer.DefineType): Flag error if
4365 base types aren't accessible due to access permissions.
4366 * decl.cs (DeclSpace.ResolveType): Move logic to
4367 Expression.ResolveAsTypeTerminal.
4368 (DeclSpace.ResolveTypeExpr): Thin layer over
4369 Expression.ResolveAsTypeTerminal.
4370 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
4371 Refactor code into NestedAccess. Use it.
4372 (DeclSpace.NestedAccess): New.
4373 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
4374 argument to silence errors. Check access permissions.
4375 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
4376 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
4377 (Cast.DoResolve): Likewise.
4378 (New.DoResolve): Likewise.
4379 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
4380 (TypeOf.DoResolve): Likewise.
4382 * expression.cs (Invocation.BetterConversion): Return the Type of
4383 the better conversion. Implement section 14.4.2.3 more faithfully.
4384 (Invocation.BetterFunction): Make boolean. Make correspondence to
4385 section 14.4.2.2 explicit.
4386 (Invocation.OverloadResolve): Update.
4387 (Invocation): Remove is_base field.
4388 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
4389 (Invocation.Emit): Likewise.
4391 2004-09-27 Raja R Harinath <rharinath@novell.com>
4393 * README: Update to changes.
4395 2004-09-24 Marek Safar <marek.safar@seznam.cz>
4397 * cs-parser.jay: Reverted 642 warning fix.
4399 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4402 * decl.cs (FindMemberWithSameName): Indexer can have more than
4405 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4407 * expression.cs (LocalVariableReference.DoResolveLValue):
4408 Do not report warning 219 for out values.
4409 (EmptyExpression.Null): New member to avoid extra allocations.
4411 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4413 * cs-parser.jay: Fix wrong warning 642 report.
4415 * cs-tokenizer.cs (CheckNextToken): New helper;
4416 Inspect next character if is same as expected.
4418 2004-09-23 Martin Baulig <martin@ximian.com>
4420 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
4421 (Convert.ImplicitReferenceConversionExists): Likewise.
4423 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4425 * class.cs (Operator.Define): Add error 448 and 559 report.
4427 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4429 * class.cs (MemberBase.IsTypePermitted): New protected
4430 method for checking error CS0610.
4432 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4434 * class.cs (TypeContainer.HasExplicitLayout): New property
4435 Returns whether container has StructLayout attribute set Explicit.
4436 (FieldMember): New abstract class for consts and fields.
4437 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
4438 (Field): Reuse FieldMember.
4440 * const.cs (Const): Reuse FieldMember.
4442 * rootcontext.cs: EmitConstants call moved to class.
4444 2004-09-22 Martin Baulig <martin@ximian.com>
4446 Thanks to Peter Sestoft for this bug report.
4448 * expression.cs (Conditional): If both the `trueExpr' and the
4449 `falseExpr' is a NullLiteral, return a NullLiteral.
4451 2004-09-22 Martin Baulig <martin@ximian.com>
4453 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
4454 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
4455 for the "get_Current" call.
4457 2004-09-22 Martin Baulig <martin@ximian.com>
4459 Marek and me just fixed one of our oldest bugs: #28562 :-)
4461 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
4463 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
4464 we're an EnumConstant, just return that.
4465 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
4466 an EnumConstant. In this case, we need to use GetValueAsEnumType()
4467 to get the value which'll actually be written into the attribute.
4468 However, we have to use GetValue() to access the attribute's value
4471 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4473 * constant.cs (Constant.IsNegative): New abstract property
4476 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
4477 (StackAlloc.DoResolve): Reused IsNegative.
4479 2004-09-21 Martin Baulig <martin@ximian.com>
4481 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
4482 if we're used in an iterator, we may be called from different
4485 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
4486 we actually have an exception block.
4488 2004-09-20 John Luke <jluke@cfl.rr.com>
4490 * class.cs, cs-parser.jay: Improve the error report for 1520:
4491 report the actual line where the error happens, not where the
4494 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
4495 Pass location information that was available elsewhere.
4497 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
4499 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
4500 runtime to delay sign assemblies.
4502 2004-09-19 Miguel de Icaza <miguel@ximian.com>
4504 * cs-parser.jay: Do not report the stack trace, this is barely
4507 2004-08-22 John Luke <john.luke@gmail.com>
4509 * driver.cs : check that a resource id is not already used
4510 before adding it, report CS1508 if it is, bug #63637
4512 2004-09-19 Miguel de Icaza <miguel@ximian.com>
4514 * ecore.cs: Removed dead code.
4516 2004-09-18 Marek Safar <marek.safar@seznam.cz>
4518 * class.cs: Do not report warning CS0067 on the interfaces.
4520 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4522 * cs-parser.jay: Add error 504 report.
4524 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4526 * rootcontext.cs: WarningLevel is 4 by default now.
4528 * statement.cs (Fixed.Resolve): Do not null
4531 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4534 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
4535 deep search when property is not virtual.
4536 (PropertyExpr.ResolveAccessors): Make one call for both
4539 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4542 * statement.cs: Error 152 report constains also location.
4544 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4547 * const.cs: Explicitly set constant as static.
4549 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4552 * cs-parser.jay: Add error 1017 report.
4554 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4556 Fixed bug #59980, #64224
4557 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
4559 * typemanager.cs (IsSpecialMethod): Simplified
4561 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4563 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
4564 condition with better params.
4566 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4569 * attribute.cs (Resolve): Property has to have both
4572 2004-09-14 Martin Baulig <martin@ximian.com>
4574 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
4576 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4579 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
4580 called and is obsolete then this member suppress message
4581 when call is inside next [Obsolete] method or type.
4583 * expression.cs: Use TestObsoleteMethodUsage member.
4585 2004-09-14 Martin Baulig <martin@ximian.com>
4587 * cs-parser.jay: Sync a bit with the GMCS version.
4589 2004-09-14 Martin Baulig <martin@ximian.com>
4591 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
4592 (CSharpParser.yacc_verbose_flag): New public field.
4594 * genericparser.cs: Removed.
4596 2004-09-14 Raja R Harinath <rharinath@novell.com>
4598 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
4600 2004-09-13 Marek Safar <marek.safar@seznam.cz>
4602 * class.cs (MethodCore.CheckBase): Fix bug #65757.
4604 2004-09-10 Martin Baulig <martin@ximian.com>
4606 Backported my MemberName changes from GMCS into MCS.
4608 - we are now using a special `MemberName' class instead of using
4609 strings; in GMCS, the `MemberName' also contains the type
4612 - changed the grammar rules a bit:
4613 * the old `member_name' is now a `namespace_or_type_name':
4614 The rule is that we use `namespace_or_type_name' everywhere
4615 where we expect either a "member name" (GetEnumerator) or a
4616 "member name" with an explicit interface name
4617 (IEnumerable.GetEnumerator).
4618 In GMCS, the explicit interface name may include type arguments
4619 (IEnumerable<T>.GetEnumerator).
4620 * we use `member_name' instead of just `IDENTIFIER' for
4622 The rule is that we use `member_name' wherever a member may
4623 have type parameters in GMCS.
4625 * decl.cs (MemberName): New public class.
4626 (MemberCore.MemberName): New public readonly field.
4627 (MemberCore.ctor): Take a `MemberName' argument, not a string.
4628 (DeclSpace): Likewise.
4630 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
4631 * enum.cs (Enum.ctor): Likewise.
4633 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
4635 (AliasEntry.ctor): Take a MemberName, not an Expression.
4636 (AliasEntry.UsingAlias): Likewise.
4638 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
4639 (IMethodData.MemberName): Changed type from string to MemberName.
4640 (MemberBase.ExplicitInterfaceName): Likewise.
4641 (AbstractPropertyEventMethod.SetupName): Make this private.
4642 (AbstractPropertyEventMethod.ctor): Added `string prefix'
4643 argument; compute the member name here.
4644 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
4645 on the `member.MemberName' and the `prefix'.
4647 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
4649 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
4650 thus, we get a `MemberName' instead of a `string'. These
4651 declarations may have type parameters in GMCS.
4652 (interface_method_declaration, delegate_declaration): Likewise.
4653 (class_declaration, interface_declaration): Likewise.
4654 (method_header): Use `namespace_or_type_name' instead of
4655 `member_name'. We may be an explicit interface implementation.
4656 (property_declaration, event_declaration): Likewise.
4657 (member_name): This is now just an `IDENTIFIER', not a
4658 `namespace_or_type_name'.
4659 (type_name, interface_type): Removed.
4660 (namespace_or_type_name): Return a MemberName, not an Expression.
4661 (primary_expression): Use `member_name' instead of `IDENTIFIER';
4662 call GetTypeExpression() on the MemberName to get an expression.
4663 (IndexerDeclaration.interface_type): Changed type from string to
4665 (MakeName): Operate on MemberName's instead of string's.
4667 2004-09-13 Raja R Harinath <rharinath@novell.com>
4670 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
4671 (NamespaceEntry.Lookup): Add new argument to flag if we want the
4672 lookup to avoid symbols introduced by 'using'.
4673 * rootcontext.cs (NamespaceLookup): Update.
4675 2004-09-12 Marek Safar <marek.safar@seznam.cz>
4677 * class.cs (TypeContainer.DoDefineMembers): Do not call
4678 DefineDefaultConstructor for static classes.
4680 2004-09-12 Marek Safar <marek.safar@seznam.cz>
4682 * attribute.cs (Attribute.Resolve): Add error 653 report.
4684 * class.cs (Class.ApplyAttributeBuilder): Add error 641
4686 (Method.ApplyAttributeBuilder): Add error 685 report.
4687 (Operator.Define): Add error 564 report.
4689 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
4691 * expression.cs (Invocation.DoResolve): Add error
4694 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
4697 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4699 * class.cs (ConstructorInitializer.Resolve):
4700 Wrong error number (515->516).
4702 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4704 * class.cs (Indexer.Define): Add error 631 report.
4706 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4708 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
4710 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4712 * expression.cs (Probe.DoResolve): Add error CS0241 report.
4714 2004-09-10 Marek Safar <marek.safar@seznam.cz>
4716 * cs-parser.jay: Added error CS0241 report.
4718 2004-09-10 Raja R Harinath <rharinath@novell.com>
4720 * cs-parser.jay (fixed_statement): Introduce a scope for the
4721 declaration in the 'fixed' statement.
4723 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4725 * cs-parser.jay: Added CS0230 error report.
4727 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4729 * cs-parser.jay: Added errors CS0231 and CS0257 report.
4731 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4733 * expression.cs (Argument.Resolve): Added error CS0192 and
4736 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4738 C# 2.0 #pragma warning feature
4740 * cs-tokenizer.cs (PreProcessPragma): New method;
4741 Handles #pragma directive.
4743 * report.cs (WarningRegions): New class; Support
4744 class for #pragma warning directive. It tests whether
4745 warning is enabled for a given line.
4747 2004-09-08 Miguel de Icaza <miguel@ximian.com>
4749 * const.cs: Add more descriptive error report, tahnks to
4752 2004-09-08 Marek Safar <marek.safar@seznam.cz>
4754 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
4756 2004-09-07 Miguel de Icaza <miguel@ximian.com>
4758 * expression.cs: Apply patch from Ben: Remove dead code from
4759 ArrayCreation, and remove the TurnintoConstant call in const.cs,
4760 as that code just threw an exception anwyays.
4762 * const.cs: Remove the call to the turnintoconstant, for details
4765 * literal.cs: The type of the null-literal is the null type; So
4766 we use a placeholder type (literal.cs:System.Null, defined here)
4769 * expression.cs (Conditional.DoResolve): Remove some old code that
4770 is no longer needed, conversions have been fixed.
4772 (ArrayCreationExpression.DoResolve): Return false if we fail to
4773 resolve the inner expression.
4775 2004-09-07 Raja R Harinath <rharinath@novell.com>
4778 * cs-parser.jay (delegate_declaration): Record a delegate
4779 declaration as a type declaration.
4780 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
4782 2004-09-06 Miguel de Icaza <miguel@ximian.com>
4784 * parameter.cs: Do not crash if the type can not be resolved.
4786 * expression.cs: Report errors with unsafe pointers, fixes #64896
4788 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
4790 * expression.cs: Pointer arith always needs to do a conv.i
4791 if the operand is a long. fix 65320
4793 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4795 Fixed cs0619-37.cs, cs0619-38.cs
4797 * enum.cs (GetObsoleteAttribute): Removed.
4799 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
4800 on Enum member is double staged. The first is tested member
4803 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4805 Fixed #56986, #63631, #65231
4807 * class.cs: (TypeContainer.AddToMemberContainer): New method,
4808 adds member to name container.
4809 (TypeContainer.AddToTypeContainer): New method, adds type to
4811 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
4812 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
4813 AddOperator): Simplified by reusing AddToMemberContainer.
4814 (TypeContainer.UserDefinedStaticConstructor): Changed to property
4816 (Method.CheckForDuplications): Fixed implementation to test all
4818 (MemberBase): Detection whether member is explicit interface
4819 implementation is now in constructor.
4820 (MemberBase.UpdateMemberName): Handles IndexerName.
4821 (Accessor): Changed to keep also location information.
4822 (AbstractPropertyEventMethod): Is derived from MemberCore.
4823 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
4824 will be emited or not.
4825 (PropertyBase.AreAccessorsDuplicateImplementation):
4826 Tests whether accessors are not in collision with some method.
4827 (Operator): Is derived from MethodCore to simplify common
4830 * decl.cs (Flags.TestMethodDuplication): Test for duplication
4832 (DeclSpace.AddToContainer): Adds the member to defined_names
4833 table. It tests for duplications and enclosing name conflicts.
4835 * enum.cs (EnumMember): Clean up to reuse the base structures
4837 2004-09-03 Martin Baulig <martin@ximian.com>
4839 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
4840 into TypeContainer, to make partial classes work again.
4842 2004-09-03 Martin Baulig <martin@ximian.com>
4844 * rootcontext.cs (RootContext.V2): Removed.
4846 2004-03-23 Martin Baulig <martin@ximian.com>
4848 * expression.cs (Invocation.OverloadResolve): Added `bool
4849 may_fail' argument and use it instead of the Location.IsNull() hack.
4851 2004-09-03 Martin Baulig <martin@ximian.com>
4853 Merged latest changes into gmcs. Please keep this comment in
4854 here, it makes it easier for me to see what changed in MCS since
4855 the last time I merged.
4857 2004-09-03 Raja R Harinath <rharinath@novell.com>
4860 * expression.cs (BetterConversion): Don't allow either conversion
4861 to be null. Remove redundant implicit conversion test when 'q ==
4862 null' -- when this function is invoked, we already know that the
4863 implicit conversion exists.
4864 (BetterFunction): Assume that 'best' is non-null. Remove
4865 redundant reimplementation of IsApplicable when 'best' is null.
4866 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
4867 number of arguments.
4868 (IsAncestralType): Extract from OverloadResolve.
4869 (OverloadResolve): Make robust to the MethodGroupExpr being
4870 unsorted. Implement all the logic of Section 14.5.5.1, and
4871 support overloading of methods from multiple applicable types.
4872 Clean up logic somewhat. Don't pass null methods to BetterFunction.
4874 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
4875 (RealError, Warning): Append type of report to related symbol.
4877 2004-09-03 Marek Safar <marek.safar@seznam.cz>
4879 * enum.cs: Fixed CLS-Compliance checks for enum members.
4880 Error tests cs3008-8.cs, cs3014-8.cs
4882 2004-09-02 Marek Safar <marek.safar@seznam.cz>
4884 Fixed bug #62342, #63102
4885 * class.cs: ImplementIndexer uses member.IsExplicitImpl
4886 like ImplementMethod.
4888 2004-09-02 Marek Safar <marek.safar@seznam.cz>
4890 * attribute.cs (Attribute.GetAttributeArgumentExpression):
4893 2004-09-02 Martin Baulig <martin@ximian.com>
4895 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
4896 TypeManager.GetArgumentTypes() rather than calling GetParameters()
4899 2004-09-01 Marek Safar <marek.safar@seznam.cz>
4901 C# 2.0 Static classes implemented
4903 * class.cs (TypeContainer): instance_constructors,
4904 initialized_fields, initialized_static_fields,
4905 default_constructor, base_inteface_types are protected to be
4906 accessible from StaticClass.
4907 (TypeContainer.DefineDefaultConstructor): New virtual method
4908 for custom default constructor generating
4909 (StaticClass): New class to handle "Static classes" feature.
4911 * cs-parser.jay: Handle static keyword on class like instance
4914 * driver.cs: Added "/langversion" command line switch with two
4915 options (iso-1, default).
4917 2004-08-31 Marek Safar <marek.safar@seznam.cz>
4919 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
4921 2004-08-31 Miguel de Icaza <miguel@ximian.com>
4923 * delegate.cs: Style.
4925 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
4927 * delegate.cs: Add seperate instance expr field for miguel.
4929 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
4931 * PointerArithmetic (Resolve): make sure we are not doing
4932 pointer arith on void*. Also, make sure we are resolved
4933 by not setting eclass until resolve.
4935 All callers: Make sure that PointerArithmetic gets resolved.
4937 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
4939 * ArrayCreation (LookupType): If the type does not resolve
4940 to an array, give an error.
4942 2004-08-27 Marek Safar <marek.safar@seznam.cz>
4944 * statement.cs (Try.Resolve): Fixed bug #64222
4946 2004-08-27 Martin Baulig <martin@ximian.com>
4949 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
4952 2004-08-26 Marek Safar <marek.safar@seznam.cz>
4954 * ecore.cs (Constantify): Get underlying type via
4955 System.Enum.GetUnderlyingType to avoid StackOverflow on the
4956 Windows in special cases.
4958 2004-08-26 Marek Safar <marek.safar@seznam.cz>
4960 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
4961 for obtaining also private methods.
4962 (GetRemoveMethod): Used GetRemoveMethod (true)
4963 for obtaining also private methods.
4965 2004-08-24 Martin Baulig <martin@ximian.com>
4967 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
4968 MethodAttributes.HideBySig for operators.
4970 2004-08-23 Martin Baulig <martin@ximian.com>
4972 Back to the old error reporting system :-)
4974 * report.cs (Message): Removed.
4975 (Report.MessageData, ErrorData, WarningData): Removed.
4976 (Report.Error, Warning): Back to the old system.
4978 2004-08-23 Martin Baulig <martin@ximian.com>
4980 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
4982 * class.cs (TypeContainer.ParentContainer): New public virtual
4983 method; replaces the explicit interface implementation.
4984 (ClassPart.ParentContainer): Override.
4986 2004-08-23 Martin Baulig <martin@ximian.com>
4988 * statement.cs (Switch): Added support for constant switches; see
4989 #59428 or test-285.cs.
4991 2004-08-22 Marek Safar <marek.safar@seznam.cz>
4994 * statement.cs (GetEnumeratorFilter): Removed useless
4995 logic because C# specs is strict. GetEnumerator must be
4998 2004-08-22 Martin Baulig <martin@ximian.com>
5000 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5001 a switch and may break, reset the barrier. Fixes #59867.
5003 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5005 CLS-Compliance speed up (~5% for corlib)
5007 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5008 New method. Tests container for CLS-Compliant names
5010 * class.cs (TypeContainer.VerifyClsName): New method.
5011 Checks whether container name is CLS Compliant.
5012 (Constructor): Implements IMethodData.
5014 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5015 low-case table for CLS Compliance test.
5016 (MemberCache.VerifyClsParameterConflict): New method.
5017 Checks method parameters for CS3006 error.
5019 * enum.cs (EnumMember): Is derived from MemberCore.
5020 (Enum.VerifyClsName): Optimized for better performance.
5022 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5024 * report.cs: Renamed Error_T to Error and changed all
5027 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5029 * class.cs (TypeContainer.IndexerArrayList): New inner class
5030 container for indexers.
5031 (TypeContainer.DefaultIndexerName): New constant for default
5032 indexer name. Replaced all "Item" with this constant.
5033 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5035 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5036 DefaultMemberAttribute constructor.
5038 2004-08-05 Martin Baulig <martin@ximian.com>
5040 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5043 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5045 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5046 multi platforms problem.
5048 * compiler.csproj: Included shared files.
5050 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5052 Fix bug 60333, 55971 in the more general way
5053 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5054 Added arg_type argument for constant conversion.
5055 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5057 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5060 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5061 OperatorArrayList, MethodCoreArrayList for typecontainer
5062 containers. Changed class member types to these new types.
5063 (MethodArrayList.DefineMembers): Added test for CS0659.
5065 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5067 * cfold.cs: Synchronize the folding with the code in expression.cs
5068 Binary.DoNumericPromotions for uint operands.
5070 * attribute.cs: Revert patch from Raja, it introduced a regression
5071 while building Blam-1.2.1 (hard to isolate a test case).
5073 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5077 (TypeContainer.Define): Renamed to DefineContainerMembers because of
5079 (MethodCore.parent_method): New member. The method we're overriding
5080 if this is an override method.
5081 (MethodCore.CheckBase): Moved from Method class and made common.
5082 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
5084 (MethodCore.CheckForDuplications): New abstract method. For custom
5085 member duplication search in a container
5086 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
5087 method and its return type.
5088 (Event.conflict_symbol): New member. Symbol with same name in the
5092 (MemberCache.FindMemberWithSameName): New method. The method
5093 is looking for conflict with inherited symbols.
5095 2004-08-04 Martin Baulig <martin@ximian.com>
5097 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5099 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5101 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5103 * report.cs (Message): New enum for better error, warning reference in
5105 (MessageData): New inner abstract class. It generally handles printing of
5106 error and warning messages.
5107 Removed unused Error, Warning, Message methods.
5109 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5111 Fix for cs0592-8.cs test
5113 (Attributable.ValidAttributeTargets): Made public.
5114 (Attribute.ExplicitTarget): New member for explicit target value.
5115 (Attribute.CheckTargets): Now we translate explicit attribute
5116 target to Target here.
5118 2004-08-03 Ben Maurer <bmaurer@ximian.com>
5120 * ecore.cs (MethodGroupExpr): new IsBase property.
5122 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
5124 * delegate.cs (DelegateCreation): store a MethodGroupExpr
5125 rather than an instance expr.
5127 (DelegateCreation.Emit): Use the method group rather than
5128 the instance expression. Also, if you have base.Foo as the
5129 method for a delegate, make sure to emit ldftn, not ldftnvirt.
5131 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
5133 (NewDelegate.DoResolve): Only check for the existance of Invoke
5134 if the method is going to be needed. Use MethodGroupExpr.
5136 (NewDelegate.Emit): Remove, DelegateCreation implements this.
5138 * expression.cs: For pointer arith., make sure to use
5139 the size of the type, not the size of the pointer to
5142 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5145 * class.cs (Class): Added error CS0502 test.
5147 2004-08-03 John Luke <jluke@cfl.rr.com>
5148 Raja R Harinath <rharinath@novell.com>
5151 * attribute.cs (Attribute.complained_before): New flag.
5152 (Attribute.ResolveType, Attribute.Resolve),
5153 (Attribute.DefinePInvokeMethod): Set it.
5154 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
5156 2004-08-03 Martin Baulig <martin@ximian.com>
5158 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5159 use a user-defined operator; we still need to do numeric
5160 promotions in case one argument is a builtin type and the other
5161 one has an implicit conversion to that type. Fixes #62322.
5163 2004-08-02 Martin Baulig <martin@ximian.com>
5165 * statement.cs (LocalInfo.Flags): Added `IsThis'.
5166 (LocalInfo.IsThis): New public property.
5167 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
5169 2004-08-01 Martin Baulig <martin@ximian.com>
5171 * class.cs (TypeContainer.GetClassBases): Don't set the default
5172 here since we may get called from GetPartialBases().
5173 (TypeContainer.DefineType): If GetClassBases() didn't return a
5174 parent, use the default one.
5176 2004-07-30 Duncan Mak <duncan@ximian.com>
5178 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
5180 2004-07-30 Martin Baulig <martin@ximian.com>
5182 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
5184 * class.cs (SourceMethod): New public class, derive from the
5185 symbol writer's ISourceMethod.
5186 (Method): Use the new symbol writer API.
5188 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
5189 as argument and use the new symbol writer.
5192 (SourceFile): Implement the symbol writer's ISourceFile.
5193 (Location.SymbolDocument): Removed.
5194 (Location.SourceFile): New public property.
5196 * symbolwriter.cs: Use the new symbol writer API.
5198 2004-07-30 Raja R Harinath <rharinath@novell.com>
5200 * Makefile (install-local): Remove. Functionality moved to
5203 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
5205 * Makefile: Install mcs.exe.config file together with mcs.exe.
5206 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
5207 correct runtime version.
5209 2004-07-25 Martin Baulig <martin@ximian.com>
5212 (TypeContainer.RegisterOrder): Removed, this was unused.
5213 (TypeContainer, interface_order): Removed.
5214 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
5215 TypeContainer as argument since we can also be called with a
5216 `PartialContainer' for a partial class/struct/interface.
5217 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
5218 of checking whether we're an `Interface' - we could be a
5220 (PartialContainer.Register): Override; call
5221 AddClass()/AddStruct()/AddInterface() on our parent.
5223 * cs-parser.jay (interface_member_declaration): Add things to the
5224 `current_container', not the `current_class'.
5226 * rootcontext.cs (RegisterOrder): The overloaded version which
5227 takes an `Interface' was unused, removed.
5229 * typemanager.cs (TypeManager.LookupInterface): Return a
5230 `TypeContainer', not an `Interface'.
5231 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
5232 contain a `PartialContainer' for an interface, so check it's
5233 `Kind' to figure out what it is.
5235 2004-07-25 Martin Baulig <martin@ximian.com>
5237 * class.cs (Class.DefaultTypeAttributes): New public constant.
5238 (Struct.DefaultTypeAttributes): Likewise.
5239 (Interface.DefaultTypeAttributes): Likewise.
5240 (PartialContainer.TypeAttr): Override this and add the
5241 DefaultTypeAttributes.
5243 2004-07-25 Martin Baulig <martin@ximian.com>
5245 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
5246 we can just use the `Parent' field instead.
5248 2004-07-25 Martin Baulig <martin@ximian.com>
5250 * class.cs (TypeContainer.Emit): Renamed to EmitType().
5252 2004-07-25 Martin Baulig <martin@ximian.com>
5254 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
5255 our parts before defining any methods.
5256 (TypeContainer.VerifyImplements): Make this virtual.
5257 (ClassPart.VerifyImplements): Override and call VerifyImplements()
5258 on our PartialContainer.
5260 2004-07-25 Martin Baulig <martin@ximian.com>
5262 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
5264 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
5265 argument, we can just use the `Parent' field instead.
5268 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
5269 (MemberBase.DoDefine): Likewise.
5271 2004-07-24 Martin Baulig <martin@ximian.com>
5273 * decl.cs (MemberCore.Parent): New public field.
5274 (DeclSpace.Parent): Moved to MemberCore.
5276 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
5277 (MemberBase.ctor): Added TypeContainer argument, pass it to our
5279 (FieldBase, Field, Operator): Likewise.
5280 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
5281 (EventField, Event): Likewise.
5283 2004-07-23 Martin Baulig <martin@ximian.com>
5285 * class.cs (PartialContainer): New public class.
5286 (ClassPart): New public class.
5287 (TypeContainer): Added support for partial classes.
5288 (TypeContainer.GetClassBases): Splitted some of the functionality
5289 out into GetNormalBases() and GetPartialBases().
5291 * cs-tokenizer.cs (Token.PARTIAL): New token.
5292 (Tokenizer.consume_identifier): Added some hacks to recognize
5293 `partial', but only if it's immediately followed by `class',
5294 `struct' or `interface'.
5296 * cs-parser.jay: Added support for partial clases.
5298 2004-07-23 Martin Baulig <martin@ximian.com>
5300 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
5301 a `DeclSpace' and also made it readonly.
5302 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
5303 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
5304 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
5306 * cs-parser.jay: Pass the `current_class', not the
5307 `current_container' (at the moment, this is still the same thing)
5308 to a new Method, Property, Event, Indexer or Constructor.
5310 2004-07-23 Martin Baulig <martin@ximian.com>
5312 * cs-parser.jay (CSharpParser): Added a new `current_class' field
5313 and removed the `current_interface' one.
5314 (struct_declaration, class_declaration, interface_declaration):
5315 Set `current_class' to the newly created class/struct/interface;
5316 set their `Bases' and call Register() before parsing their body.
5318 2004-07-23 Martin Baulig <martin@ximian.com>
5320 * class.cs (Kind): New public enum.
5321 (TypeContainer): Made this class abstract.
5322 (TypeContainer.Kind): New public readonly field.
5323 (TypeContainer.CheckDef): New public method; moved here from
5325 (TypeContainer.Register): New public abstract method.
5326 (TypeContainer.GetPendingImplementations): New public abstract
5328 (TypeContainer.GetClassBases): Removed the `is_class' and
5329 `is_iface' parameters.
5330 (TypeContainer.DefineNestedTypes): Formerly known as
5332 (ClassOrStruct): Made this class abstract.
5334 * tree.cs (RootTypes): New public type.
5336 2004-07-20 Martin Baulig <martin@ximian.com>
5338 * tree.cs (Tree.RecordNamespace): Removed.
5339 (Tree.Namespaces): Removed.
5341 * rootcontext.cs (RootContext.IsNamespace): Removed.
5343 * cs-parser.jay (namespace_declaration): Just create a new
5344 NamespaceEntry here.
5346 2004-07-20 Martin Baulig <martin@ximian.com>
5348 * statement.cs (ExceptionStatement): New abstract class. This is
5349 now used as a base class for everyone who's using `finally'.
5350 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
5351 our local variables before using them.
5353 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
5354 virtual method. This is used by Yield.Resolve() to "steal" an
5355 outer block's `finally' clauses.
5356 (FlowBranchingException): The .ctor now takes an ExceptionStatement
5359 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
5360 version which takes an ExceptionStatement. This version must be
5361 used to create exception branchings.
5364 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
5365 (Iterator.EmitMoveNext): Added exception support; protect the
5366 block with a `fault' clause, properly handle 'finally' clauses.
5367 (Iterator.EmitDispose): Run all the `finally' clauses here.
5369 2004-07-20 Martin Baulig <martin@ximian.com>
5371 * iterator.cs: This is the first of a set of changes in the
5372 iterator code. Match the spec more closely: if we're an
5373 IEnumerable, then GetEnumerator() must be called. The first time
5374 GetEnumerator() is called, it returns the current instance; all
5375 subsequent invocations (if any) must create a copy.
5377 2004-07-19 Miguel de Icaza <miguel@ximian.com>
5379 * expression.cs: Resolve the constant expression before returning
5382 2004-07-19 Martin Baulig <martin@ximian.com>
5384 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
5385 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
5386 the return type of the new EmitContext.
5388 2004-07-18 Martin Baulig <martin@ximian.com>
5390 * class.cs (Property.Define): Fix iterators.
5392 * iterators.cs (Iterator.Define): Moved the
5393 `container.AddInterator (this)' call here from the .ctor; only do
5394 it if we resolved successfully.
5396 2004-07-17 Miguel de Icaza <miguel@ximian.com>
5398 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
5399 `true' for preprocessing directives that we parse. The return
5400 value indicates whether we should return to regular tokenizing or
5401 not, not whether it was parsed successfully.
5403 In the past if we were in: #if false ... #line #endif, we would
5404 resume parsing after `#line'. See bug 61604.
5406 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
5407 building: IsEnumType should return true only for enums, not for
5408 enums or System.Enum itself. This fixes #61593.
5410 Likely what happened is that corlib was wrong: mcs depended on
5411 this bug in some places. The bug got fixed, we had to add the
5412 hack, which caused bug 61593.
5414 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
5415 that was a workaround for the older conditions.
5417 2004-07-16 Ben Maurer <bmaurer@ximian.com>
5419 * assign.cs: IAssignMethod has a new interface, as documented
5420 inline. All assignment code now uses this new api.
5422 * ecore.cs, expression.cs: All classes which implement
5423 IAssignMethod now use the new interface.
5425 * expression.cs (Invocation): add a hack to EmitCall so that
5426 IndexerAccess can be the target of a compound assignment without
5427 evaluating its arguments twice.
5429 * statement.cs: Handle changes in Invocation api.
5431 2004-07-16 Martin Baulig <martin@ximian.com>
5433 * iterators.cs: Rewrote this. We're now using one single Proxy
5434 class for both the IEnumerable and the IEnumerator interface and
5435 `Iterator' derives from Class so we can use the high-level API.
5437 * class.cs (TypeContainer.AddIterator): New method.
5438 (TypeContainer.DoDefineType): New protected virtual method, which
5439 is called from DefineType().
5440 (TypeContainer.DoDefineMembers): Call DefineType() and
5441 DefineMembers() on all our iterators.
5442 (TypeContainer.Emit): Call Emit() on all our iterators.
5443 (TypeContainer.CloseType): Call CloseType() on all our iterators.
5445 * codegen.cs (EmitContext.CurrentIterator): New public field.
5447 2004-07-15 Martin Baulig <martin@ximian.com>
5450 (TypeManager.not_supported_exception_type): New type.
5452 2004-07-14 Martin Baulig <martin@ximian.com>
5454 * iterators.cs: Use real error numbers.
5456 2004-07-14 Martin Baulig <martin@ximian.com>
5458 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
5459 requires this to be a System.Collection.IEnumerable and not a
5460 class implementing that interface.
5461 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
5463 2004-07-13 Marek Safar <marek.safar@seznam.cz>
5465 * class.cs: Fixed previous fix, it broke some error tests.
5467 2004-07-12 Martin Baulig <martin@ximian.com>
5469 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
5472 2004-07-09 Miguel de Icaza <miguel@ximian.com>
5474 * assign.cs (LocalTemporary): Add new argument: is_address,If
5475 `is_address' is true, then the value that we store is the address
5476 to the real value, and not the value itself.
5478 * ecore.cs (PropertyExpr): use the new local temporary
5479 stuff to allow us to handle X.Y += z (where X is a struct)
5481 2004-07-08 Martin Baulig <martin@ximian.com>
5483 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
5484 not always return, just like we're doing in Using.Resolve().
5486 2004-07-07 Miguel de Icaza <miguel@ximian.com>
5488 * cs-parser.jay (fixed_statement): flag this as Pinned.
5490 2004-07-06 Miguel de Icaza <miguel@ximian.com>
5492 * typemanager.cs (TypeManager): Removed MakePinned method, this
5493 mechanism is replaced with the .NET 2.x compatible mechanism of
5494 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
5496 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
5497 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
5498 `IsFixed' property which has a different meaning.
5500 2004-07-02 Raja R Harinath <rharinath@novell.com>
5502 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
5503 visible from inside a nested class, not just the names of the
5504 immediately enclosing class.
5507 2004-06-24 Raja R Harinath <rharinath@novell.com>
5509 * expression.cs (BetterConversion): Remove buggy special-case
5510 handling of "implicit constant expression conversions". At this
5511 point, we already know that the conversion is possible -- we're
5512 only checking to see which is better.
5514 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5516 * cs-parser.jay: Added error CS0210 test.
5518 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5520 * cs-parser.jay: Added error CS0134 test.
5522 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5525 * cs-parser.jay: Added error CS0145 test.
5527 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5529 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
5531 2004-06-23 Ben Maurer <bmaurer@ximian.com>
5533 * expression.cs (StackAlloc.Resolve): The argument may not
5534 be a constant; deal with this case.
5536 2004-06-23 Marek Safar <marek.safar@seznam.cz>
5538 * attribute.cs (IndexerName_GetIndexerName): Renamed to
5539 GetIndexerAttributeValue.
5540 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
5542 * class.cs (Indexer.Define): Added error tests for CS0415,
5545 2004-06-23 Miguel de Icaza <miguel@ximian.com>
5547 * attribute.cs (Attribute.Resolve): Keep field code in sync with
5550 2004-06-23 Martin Baulig <martin@ximian.com>
5552 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
5553 neither return nor throw, reset the barrier as well. Fixes #60457.
5555 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
5557 * class.cs : EventAttributes is now set to None by default.
5558 This fixes bug #60459.
5560 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5563 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5564 Don't throw exception but return null (it's sufficient now).
5566 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5568 * typemanager.cs (GetArgumentTypes): Faster implementation.
5570 2004-06-18 Martin Baulig <martin@ximian.com>
5572 * attribute.cs (Attribute.Resolve): Check whether we're an
5573 EmptyCast which a Constant child. Fixes #60333.
5575 2004-06-17 Ben Maurer <bmaurer@ximian.com>
5577 * statement.cs (EmitCollectionForeach): Account for the fact that
5578 not all valuetypes are in areas which we can take the address of.
5579 For these variables, we store to a temporary variable. Also, make
5580 sure that we dont emit a `callvirt' on a valuetype method.
5582 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5584 * expression.cs (StackAlloc.DoReSolve): Added test for
5585 negative parameter (CS0247).
5587 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5590 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
5592 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5595 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
5598 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5600 Fix bug #58254 & cs1555.cs, cs1556.cs
5601 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
5603 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5605 * cs-parser.jay: Added error CS1669 test for indexers.
5607 2004-06-11 Martin Baulig <martin@ximian.com>
5609 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
5610 call this twice: for params and varargs methods.
5612 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5615 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
5617 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5619 * attribute.cs (Attribute.GetValidTargets): Made public.
5622 (AbstractPropertyEventMethod): New class for better code sharing.
5623 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
5625 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
5627 2004-06-11 Raja R Harinath <rharinath@novell.com>
5630 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
5631 that the call to Resolve is part of a MemberAccess.
5632 (Expression.Resolve): Use it for SimpleName resolution.
5633 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
5634 Add 'intermediate' boolean argument.
5635 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
5636 error message when the SimpleName can be resolved ambiguously
5637 between an expression and a type.
5638 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
5640 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
5641 call on the left-side.
5643 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5646 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
5648 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5650 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
5652 2004-06-11 Martin Baulig <martin@ximian.com>
5654 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
5655 varargs methods if applicable.
5657 2004-06-11 Martin Baulig <martin@ximian.com>
5659 * expression.cs (Invocation.EmitCall): Don't use
5660 `method.CallingConvention == CallingConventions.VarArgs' since the
5661 method could also have `CallingConventions.HasThis'.
5663 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5665 * class.cs (Event.GetSignatureForError): Implemented.
5666 Fixed crash in error test cs3010.cs
5668 2004-06-10 Miguel de Icaza <miguel@ximian.com>
5670 * cs-tokenizer.cs: Change the way we track __arglist to be
5671 consistent with the other keywords.
5673 2004-06-09 Miguel de Icaza <miguel@ximian.com>
5675 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
5678 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
5680 * codegen.cs: Check that all referenced assemblies have a strongname
5681 before strongnaming the compiled assembly. If not report error CS1577.
5682 Fix bug #56563. Patch by Jackson Harper.
5683 * typemanager.cs: Added a method to return all referenced assemblies.
5684 Fix bug #56563. Patch by Jackson Harper.
5686 2004-06-08 Marek Safar <marek.safar@seznam.cz>
5689 (Method.ApplyAttributeBuilder): Moved and added conditional
5690 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
5693 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
5695 2004-06-08 Marek Safar <marek.safar@seznam.cz>
5698 * class.cs: (EventField.attribute_targets): Changed default target.
5700 2004-06-08 Martin Baulig <martin@ximian.com>
5702 * expression.cs (Invocation.EmitCall): Enable varargs methods.
5704 2004-06-08 Martin Baulig <martin@ximian.com>
5706 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
5708 2004-06-07 Martin Baulig <martin@ximian.com>
5710 Added support for varargs methods.
5712 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
5715 * cs-parser.jay: Added support for `__arglist'.
5717 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
5719 * expression.cs (Argument.AType): Added `ArgList'.
5720 (Invocation): Added support for varargs methods.
5721 (ArglistAccess): New public class.
5722 (Arglist): New public class.
5724 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
5726 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
5727 a method's top-level block if the method has varargs.
5729 * support.cs (ReflectionParameters, InternalParameters): Added
5730 support for varargs methods.
5732 2004-06-07 Miguel de Icaza <miguel@ximian.com>
5734 * class.cs: Provide location in indexer error report.
5736 * driver.cs: Use standard names.
5738 * namespace.cs: Catch the use of using after a namespace has been
5739 declared also on using aliases.
5741 2004-06-03 Raja R Harinath <rharinath@novell.com>
5744 * typemanager.cs (closure_private_ok, closure_invocation_type)
5745 (closure_qualifier_type, closure_invocation_assembly)
5746 (FilterWithClosure): Move to ...
5747 (Closure): New internal nested class.
5748 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
5749 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
5750 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
5751 (MemberLookup, MemberLookupFailed): Use it.
5752 * expression.cs (New.DoResolve): Treat the lookup for the
5753 constructor as being qualified by the 'new'ed type.
5754 (Indexers.GetIndexersForTypeOrInterface): Update.
5756 2004-06-03 Marek Safar <marek.safar@seznam.cz>
5759 (GetConditionalAttributeValue): New method. Returns
5760 condition of ConditionalAttribute.
5761 (SearchMulti): New method. Returns all attributes of type 't'.
5762 Use it when attribute is AllowMultiple = true.
5763 (IsConditionalMethodExcluded): New method.
5766 (Method.IsExcluded): Implemented. Returns true if method has conditional
5767 attribute and the conditions is not defined (method is excluded).
5768 (IMethodData): Extended interface for ConditionalAttribute support.
5769 (PropertyMethod.IsExcluded): Implemented.
5772 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
5775 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
5778 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
5780 * expression.cs (ArrayCreationExpression): Make this just an
5781 `expression'. It can't be a statement, so the code here was
5784 2004-06-02 Marek Safar <marek.safar@seznam.cz>
5787 * typemanager.cs (GetFullNameSignature): New method for
5790 2004-06-02 Marek Safar <marek.safar@seznam.cz>
5793 * class.cs (MemberBase.GetSignatureForError): New virtual method.
5794 Use this method when MethodBuilder is null.
5795 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
5796 Added test for error CS0626 (MONO reports error for this situation).
5797 (IMethodData.GetSignatureForError): Extended interface.
5799 2004-06-01 Marek Safar <marek.safar@seznam.cz>
5802 (AttributeTester.GetObsoleteAttribute): Returns instance of
5803 ObsoleteAttribute when type is obsolete.
5806 (TypeContainer.VerifyObsoleteAttribute): Override.
5807 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
5808 (MethodCode.VerifyObsoleteAttribute): Override.
5809 (MemberBase.VerifyObsoleteAttribute): Override.
5812 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
5813 and report proper error.
5816 Delegate.VerifyObsoleteAttribute): Override.
5819 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
5820 and report proper error.
5821 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
5824 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
5828 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
5829 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
5830 Added test for ObsoleteAttribute.
5833 (Catch): Derived from Statement.
5835 2004-06-01 Marek Safar <marek.safar@seznam.cz>
5837 Fixed bug #59071 & cs0160.cs
5839 * statement.cs (Try.Resolve): Check here whether order of catch
5840 clauses matches their dependencies.
5842 2004-05-31 Miguel de Icaza <miguel@ximian.com>
5844 * Reverted patch to namespace.cs (Use lookuptypedirect). This
5845 caused a regression: #59343. Referencing nested classes from an
5846 assembly stopped working.
5848 2004-05-31 Martin Baulig <martin@ximian.com>
5850 MCS is now frozen for beta 2.
5852 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5854 * convert.cs: add a trivial cache for overload operator resolution.
5856 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5858 * decl.cs: If possible, use lookuptypedirect here. We can only do
5859 this if there is no `.' after the namespace. Avoids using
5860 LookupType, which does lots of slow processing.
5861 (FindNestedType) New method, does what it says :-).
5862 * namespace.cs: use LookupTypeDirect.
5863 * rootcontext.cs: use membercache, if possible.
5864 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
5866 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5869 According to the spec,
5871 In a member access of the form E.I, if E is a single identifier,
5872 and if the meaning of E as a simple-name (§7.5.2) is a constant,
5873 field, property, localvariable, or parameter with the same type as
5874 the meaning of E as a type-name (§3.8), then both possible
5875 meanings of E are permitted.
5877 We did not check that E as a simple-name had the same type as E as
5880 This trivial check gives us 5-7% on bootstrap time.
5882 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5884 * expression.cs (Invocation.OverloadResolve): Avoid the
5885 use of hashtables and boxing here by allocating on demand.
5887 2004-05-30 Martin Baulig <martin@ximian.com>
5889 * rootcontext.cs (RootContext.LookupType): Don't cache things if
5890 we're doing a silent lookup. Don't try to lookup nested types in
5891 TypeManager.object_type (thanks to Ben Maurer).
5893 2004-05-30 Martin Baulig <martin@ximian.com>
5895 Committing a patch from Ben Maurer.
5897 * rootcontext.cs (RootContext.LookupType): Cache negative results.
5899 2004-05-29 Martin Baulig <martin@ximian.com>
5901 * class.cs (IMethodData.ShouldIgnore): New method.
5903 * typemanager.cs (TypeManager.MethodFlags): Don't take a
5904 `Location' argument, we don't need it anywhere. Use
5905 `IMethodData.ShouldIgnore ()' instead of
5906 `MethodData.GetMethodFlags ()'.
5907 (TypeManager.AddMethod): Removed.
5908 (TypeManager.AddMethod2): Renamed to AddMethod.
5910 2004-05-29 Martin Baulig <martin@ximian.com>
5912 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
5914 * convert.cs (Convert.ImplicitReferenceConversion): If we're
5915 converting from a class type S to an interface type and we already
5916 have an object on the stack, don't box it again. Fixes #52578.
5918 2004-05-29 Martin Baulig <martin@ximian.com>
5920 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5921 Added support for `params' parameters. Fixes #59267.
5923 2004-05-29 Martin Baulig <martin@ximian.com>
5925 * literal.cs (NullPointer): Provide a private .ctor which sets
5926 `type' to TypeManager.object_type. Fixes #59048.
5928 2004-05-29 Martin Baulig <martin@ximian.com>
5930 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
5931 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
5933 * ecore.cs (EventExpr.instance_expr): Make the field private.
5935 2004-05-26 Marek Safar <marek.safar@seznam.cz>
5937 Fixed bug #50080 & cs0214-2.cs
5938 * expression.cs (Cast.DoResolve): Check unsafe context here.
5940 * statement.cs (Resolve.DoResolve): Likewise.
5942 2004-05-26 Martin Baulig <martin@ximian.com>
5944 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
5946 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
5947 (RootContext.LookupType): Pass down the `silent' flag.
5949 2004-05-25 Martin Baulig <martin@ximian.com>
5952 (MethodGroupExpr.IdenticalTypeName): New public property.
5953 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
5954 expression actually refers to a type.
5956 2004-05-25 Martin Baulig <martin@ximian.com>
5958 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
5959 for #56176 and made it actually work.
5961 2004-05-25 Martin Baulig <martin@ximian.com>
5963 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
5964 (FieldExpr, PropertyExpr): Override and implement
5965 CacheTemporaries. Fixes #52279.
5967 2004-05-25 Miguel de Icaza <miguel@ximian.com>
5969 * location.cs: In the new compiler listing a file twice is a
5970 warning, not an error.
5972 2004-05-24 Martin Baulig <martin@ximian.com>
5974 * enum.cs (Enum.DefineType): For the `BaseType' to be a
5975 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
5977 2004-05-24 Martin Baulig <martin@ximian.com>
5979 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
5980 walking the `using' list. Fixes #53921.
5982 2004-05-24 Martin Baulig <martin@ximian.com>
5984 * const.cs (Const.LookupConstantValue): Added support for
5985 EmptyCast's; fixes #55251.
5987 2004-05-24 Martin Baulig <martin@ximian.com>
5989 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
5990 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
5991 which does the CS0135 check. The reason is that we first need to
5992 check whether the variable actually exists.
5994 2004-05-24 Martin Baulig <martin@ximian.com>
5996 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
5997 than RootContext.LookupType() to find the explicit interface
6000 2004-05-24 Raja R Harinath <rharinath@novell.com>
6002 * Makefile: Simplify. Use executable.make.
6003 * mcs.exe.sources: New file. List of sources of mcs.exe.
6005 2004-05-24 Anders Carlsson <andersca@gnome.org>
6009 Use the invariant culture when doing String.Compare for CLS case
6012 2004-05-23 Martin Baulig <martin@ximian.com>
6014 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6015 don't have any dots. Fixes #52622, added cs0246-8.cs.
6017 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6019 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6021 * class.cs (MemberBase.Define): Reuse MemberType member for
6022 resolved type. Other methods can use it too.
6024 2004-05-23 Martin Baulig <martin@ximian.com>
6026 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6027 the variable also exists in the current block (otherwise, we need
6028 to report a CS0103). Fixes #58670.
6030 2004-05-23 Martin Baulig <martin@ximian.com>
6032 * flowanalysis.cs (Reachability.Reachable): Compute this
6033 on-the-fly rather than storing it as a field.
6035 2004-05-23 Martin Baulig <martin@ximian.com>
6037 * flowanalysis.cs (Reachability.And): Manually compute the
6038 resulting `barrier' from the reachability.
6040 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6043 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6044 instance of ObsoleteAttribute when symbol is obsolete.
6047 (IMethodData): Extended interface for ObsoleteAttribute support.
6049 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6051 * attribute.cs: Fix bug #55970
6053 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6057 (GetObsoleteAttribute): New method. Creates the instance of
6059 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6060 ObsoleteAttribute when member is obsolete.
6061 (AttributeTester.Report_ObsoleteMessage): Common method for
6062 Obsolete error/warning reporting.
6065 (TypeContainer.base_classs_type): New member for storing parent type.
6068 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6069 for this MemberCore.
6071 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6073 * attribute.cs, const.cs: Fix bug #58590
6075 2004-05-21 Martin Baulig <martin@ximian.com>
6077 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
6078 out parameters if the end of the method is unreachable. Fixes
6081 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6083 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
6084 Hari was right, why extra method.
6086 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6088 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
6090 2004-05-20 Martin Baulig <martin@ximian.com>
6092 Merged this back from gmcs to keep the differences to a minumum.
6094 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
6095 instead of a Declspace.
6096 (Attribute.ResolveType): Likewise.
6097 (Attributes.Search): Likewise.
6098 (Attributes.Contains): Likewise.
6099 (Attributes.GetClsCompliantAttribute): Likewise.
6101 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
6103 (MethodData.ApplyAttributes): Take an EmitContext instead of a
6106 2004-05-19 Marek Safar <marek.safar@seznam.cz>
6108 Fix bug #58688 (MCS does not report error when the same attribute
6111 * attribute.cs (Attribute.Emit): Distinction between null and default.
6113 2004-05-19 Raja R Harinath <rharinath@novell.com>
6115 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
6116 of a top-level attribute without an attribute target.
6117 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
6119 (Attribute.Conditional_GetConditionName),
6120 (Attribute.Obsolete_GetObsoleteMessage): Update.
6121 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
6122 part of ScanForIndexerName.
6123 (Attribute.CanIgnoreInvalidAttribute): New function.
6124 (Attribute.ScanForIndexerName): Move to ...
6125 (Attributes.ScanForIndexerName): ... here.
6126 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
6127 (Attributes.Search): New internal variant that can choose not to
6128 complain if types aren't resolved. The original signature now
6130 (Attributes.GetClsCompliantAttribute): Use internal variant, with
6131 complaints suppressed.
6132 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
6133 only if it not useful.
6134 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
6135 top-level for attributes that are shared between the assembly
6136 and a top-level class.
6137 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
6138 * class.cs: Update to reflect changes.
6139 (DefineIndexers): Fuse loops.
6140 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
6141 a couple more variants of attribute names.
6143 2004-05-18 Marek Safar <marek.safar@seznam.cz>
6145 Fix bug #52585 (Implemented explicit attribute declaration)
6148 (Attributable.ValidAttributeTargets): New abstract method. It gets
6149 list of valid attribute targets for explicit target declaration.
6150 (Attribute.Target): It holds target itself.
6151 (AttributeSection): Removed.
6152 (Attribute.CheckTargets): New method. It checks whether attribute
6153 target is valid for the current element.
6156 (EventProperty): New class. For events that are declared like
6157 property (with add and remove accessors).
6158 (EventField): New class. For events that are declared like field.
6161 * cs-parser.jay: Implemented explicit attribute target declaration.
6163 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
6164 Override ValidAttributeTargets.
6167 (ReturnParameter): Class for applying custom attributes on
6169 (ParameterAtribute): New class. Class for applying custom
6170 attributes on the parameter type.
6172 2004-05-17 Miguel de Icaza <miguel@ximian.com>
6174 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
6177 (Method): Allow UNSAFE here.
6179 * modifiers.cs: Support unsafe reporting.
6181 2004-05-17 Marek Safar <marek.safar@seznam.cz>
6183 * decl.cs: Fix bug #58478.
6185 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6187 * statement.cs: When checking for unreachable code on an EmptyStatement,
6188 set the location. Fixes bug #58488.
6190 2004-05-13 Miguel de Icaza <miguel@ximian.com>
6192 * driver.cs: Add -pkg handling.
6194 From Gonzalo: UseShelLExecute=false
6196 2004-05-12 Marek Safar <marek.safar@seznam.cz>
6199 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
6201 (Attribute.IsClsCompliaceRequired): Moved to base for better
6203 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
6204 when attribute is AttributeUsageAttribute.
6205 (Attribute.GetValidTargets): Simplified.
6206 (Attribute.GetAttributeUsage): New method returns AttributeUsage
6207 attribute for this type.
6208 (Attribute.ApplyAttributes): Method renamed to Emit and make
6210 (GlobalAttributeSection): New class for special handling of global
6211 attributes (assembly, module).
6212 (AttributeSection.Emit): New method.
6214 * class.cs: Implemented Attributable abstract methods.
6215 (MethodCore.LabelParameters): Moved to Parameter class.
6216 (Accessor): Is back simple class.
6217 (PropertyMethod): Implemented Attributable abstract class.
6218 (DelegateMethod): Implemented Attributable abstract class.
6219 (Event): New constructor for disctintion between normal Event
6220 and Event with accessors.
6222 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
6224 * codegen.cs, const.cs, decl.cs, delegate.cs:
6225 (CommonAssemblyModulClass): Implemented Attributable abstract class
6228 * enum.cs: Implement IAttributeSupport interface.
6229 (EnumMember): New class for emum members. Implemented Attributable
6233 (ParameterBase): Is abstract.
6234 (ReturnParameter): New class for easier [return:] attribute handling.
6236 * typemanager.cs: Removed builder_to_attr.
6238 2004-05-11 Raja R Harinath <rharinath@novell.com>
6241 * attribute.cs (Attribute.GetPositionalValue): New function.
6242 * class.cs (TypeContainer.VerifyMembers): New function.
6243 (TypeContainer.Emit): Use it.
6244 (ClassOrStruct): New base class for Class and Struct.
6245 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
6246 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
6248 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
6249 then each non-static field should have a FieldOffset attribute.
6250 Otherwise, none of the fields should have a FieldOffset attribute.
6251 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
6252 and FieldOffset attributes.
6253 * typemanager.cs (TypeManager.struct_layout_attribute_type)
6254 (TypeManager.field_offset_attribute_type): New core types.
6255 (TypeManager.InitCoreTypes): Initialize them.
6257 2004-05-11 Michal Moskal <malekith@pld-linux.org>
6259 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
6260 Return correct type.
6263 2004-05-09 Miguel de Icaza <miguel@ximian.com>
6265 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
6266 be implicitly converted to ulong.
6268 * expression.cs: The logic for allowing operator &, | and ^ worked
6269 was wrong, it worked before because we did not report an error in
6270 an else branch. Fixes 57895.
6272 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
6273 allow volatile fields to be reference types.
6275 2004-05-07 Miguel de Icaza <miguel@ximian.com>
6277 * driver.cs: Add support for /debug-
6279 2004-05-07 Raja R Harinath <rharinath@novell.com>
6281 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
6282 Add a 'complain' parameter to silence errors.
6283 (Attribute.Resolve): Update to changes. Put in sanity check to catch
6284 silently overlooked type-resolutions.
6285 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
6287 (Attributes.Search): New function.
6288 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
6289 (Attributes.GetAttributeFullName): Remove hack.
6290 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
6291 Update to reflect changes.
6292 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
6293 Use Attributes.Search instead of nested loops.
6295 2004-05-07 Marek Safar <marek.safar@seznam.cz>
6298 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
6299 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
6300 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
6302 * report.cs: (Report.Warning): Renamed to Warning_T because of
6303 parameter collision.
6305 2004-05-05 Raja R Harinath <rharinath@novell.com>
6307 * expression.cs (MemberAccess.ResolveMemberAccess):
6308 Exit with non-zero status after Report.Error.
6309 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
6311 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
6313 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6315 * support.cs: Don't hang when the file is empty.
6317 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6319 * support.cs: In SeekableStreamReader, compute the preamble size of the
6320 underlying stream. Position changes should take into account that initial
6323 2004-05-03 Todd Berman <tberman@sevenl.net>
6325 * driver.cs: remove unused GetSysVersion function.
6327 2004-05-03 Todd Berman <tberman@sevenl.net>
6329 * driver.cs: Remove the hack from saturday, as well as the hack
6330 from jackson (LoadAssemblyFromGac), also adds the CWD to the
6331 link_paths to get that bit proper.
6333 2004-05-01 Todd Berman <tberman@sevenl.net>
6335 * driver.cs: Try a LoadFrom before a Load, this checks the current
6336 path. This is currently a bug in mono that is be fixed, however, this
6337 provides a workaround for now. This will be removed when the bug
6340 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
6342 * CryptoConvert.cs: Updated to latest version. Fix issue with
6343 incomplete key pairs (#57941).
6345 2004-05-01 Todd Berman <tberman@sevenl.net>
6347 * driver.cs: Remove '.' from path_chars, now System.* loads properly
6350 2004-04-30 Jackson Harper <jackson@ximian.com>
6352 * codegen.cs: Open keys readonly.
6354 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6356 * typemanager.cs: don't report cyclic struct layout when a struct
6357 contains 2 or more fields of the same type. Failed for Pango.AttrShape
6358 which has 2 Pango.Rectangle fields.
6360 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
6362 * expression.cs: Handle IntPtr comparisons with IL code
6363 rather than a method call.
6365 2004-04-29 Martin Baulig <martin@ximian.com>
6367 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
6368 the list of PropertyInfo's in class hierarchy and find the
6369 accessor. Fixes #56013.
6371 2004-04-29 Martin Baulig <martin@ximian.com>
6373 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
6375 2004-04-29 Martin Baulig <martin@ximian.com>
6377 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6379 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
6381 2004-04-29 Martin Baulig <martin@ximian.com>
6383 * class.cs (ConstructorInitializer.Resolve): Check whether the
6384 parent .ctor is accessible. Fixes #52146.
6386 2004-04-29 Martin Baulig <martin@ximian.com>
6388 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6390 * statement.cs (Using.EmitLocalVariableDecls): Use
6391 TypeManager.idisposable_type, not typeof (IDisposable).
6392 (Foreach.EmitCollectionForeach): Added support for valuetypes.
6394 2004-04-29 Martin Baulig <martin@ximian.com>
6396 * class.cs (Event.Define): Don't emit the field and don't set
6397 RTSpecialName and SpecialName for events on interfaces. Fixes
6400 2004-04-29 Raja R Harinath <rharinath@novell.com>
6402 Refactor Attribute.ApplyAttributes.
6403 * attribute.cs (Attributable): New base class for objects that can
6404 have Attributes applied on them.
6405 (Attribute): Make AttributeUsage fields public.
6406 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
6407 (Attribute.IsInternalCall): New property.
6408 (Attribute.UsageAttr): Convert to a public read-only property.
6409 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
6410 (Attribute.ResolveType, Attribute.Resolve)
6411 (Attribute.ScanForIndexerName): Update to reflect changes.
6412 (Attribute.CheckAttributeTarget): Re-format.
6413 (Attribute.ApplyAttributes): Refactor, to various
6414 Attributable.ApplyAttributeBuilder methods.
6415 * decl.cs (MemberCore): Make Attributable.
6416 * class.cs (Accessor): Make Attributable.
6417 (MethodData.ApplyAttributes): Use proper attribute types, not
6419 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
6420 (TypeContainer.ApplyAttributeBuilder)
6421 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
6422 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
6423 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
6424 (Operator.ApplyAttributeBuilder): New factored-out methods.
6425 * const.cs (Const.ApplyAttributeBuilder): Likewise.
6426 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
6427 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
6428 * parameter.cs (ParameterBase): New Attributable base class
6429 that can also represent Return types.
6430 (Parameter): Update to the changes.
6432 2004-04-29 Jackson Harper <jackson@ximian.com>
6434 * driver.cs: Prefer the corlib system version when looking for
6435 assemblies in the GAC. This is still a hack, but its a better hack
6438 2004-04-29 Marek Safar <marek.safar@seznam.cz>
6440 * decl.cs, enum.cs: Improved error 3005 reporting.
6442 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
6443 (related_symbols): New private member for list of symbols
6444 related to reported error/warning.
6446 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
6448 2004-04-29 Martin Baulig <martin@ximian.com>
6450 * ecore.cs (Expression.Constantify): If we're an enum and
6451 TypeManager.TypeToCoreType() doesn't give us another type, use
6452 t.UnderlyingSystemType. Fixes #56178.
6454 2004-04-29 Martin Baulig <martin@ximian.com>
6456 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
6457 interfaces and for each interface, only add members directly
6458 declared in that interface. Fixes #53255.
6460 2004-04-28 Martin Baulig <martin@ximian.com>
6462 * expression.cs (ConditionalLogicalOperator): Use a temporary
6463 variable for `left' to avoid that we evaluate it more than once;
6466 2004-04-28 Martin Baulig <martin@ximian.com>
6468 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
6471 2004-04-28 Martin Baulig <martin@ximian.com>
6473 * statement.cs (LocalInfo.Resolve): Check whether the type is not
6476 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
6477 whether the type is not void (CS1547).
6479 2004-04-28 Martin Baulig <martin@ximian.com>
6481 * expression.cs (Unary.DoResolveLValue): Override this and report
6482 CS0131 for anything but Operator.Indirection.
6484 2004-04-28 Martin Baulig <martin@ximian.com>
6486 Committing a patch from Ben Maurer; see bug #50820.
6488 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6491 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6494 2004-04-28 Martin Baulig <martin@ximian.com>
6496 Committing a patch from Ben Maurer; see bug #50820.
6498 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6501 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6504 2004-04-28 Martin Baulig <martin@ximian.com>
6506 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
6507 (Block.AddLabel): Call DoLookupLabel() to only search in the
6510 2004-04-28 Martin Baulig <martin@ximian.com>
6512 * cfold.cs (ConstantFold.BinaryFold): Added special support for
6513 comparing StringConstants and NullLiterals in Equality and Inequality.
6515 2004-04-28 Jackson Harper <jackson@ximian.com>
6517 * driver.cs: Attempt to load referenced assemblies from the
6518 GAC. This is the quick and dirty version of this method that
6519 doesnt take into account versions and just takes the first
6520 canidate found. Will be good enough for now as we will not have more
6521 then one version installed into the GAC until I update this method.
6523 2004-04-28 Martin Baulig <martin@ximian.com>
6525 * typemanager.cs (TypeManager.CheckStructCycles): New public
6526 static method to check for cycles in the struct layout.
6528 * rootcontext.cs (RootContext.PopulateTypes): Call
6529 TypeManager.CheckStructCycles() for each TypeContainer.
6530 [Note: We only need to visit each type once.]
6532 2004-04-28 Martin Baulig <martin@ximian.com>
6534 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
6536 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
6537 success and added `out object value'. Use a `bool resolved' field
6538 to check whether we've already been called rather than
6539 `ConstantValue != null' since this breaks for NullLiterals.
6541 2004-04-28 Raja R Harinath <rharinath@novell.com>
6543 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
6544 setting of this flag, since the 'set' method may be non-public.
6546 2004-04-28 Raja R Harinath <rharinath@novell.com>
6548 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
6549 check on current_vector.Block.
6551 2004-04-27 Martin Baulig <martin@ximian.com>
6553 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
6554 a field initializer. Fixes #56459.
6556 2004-04-27 Martin Baulig <martin@ximian.com>
6558 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
6559 we're not attempting to use an indexer. Fixes #52154.
6561 2004-04-27 Martin Baulig <martin@ximian.com>
6563 * statement.cs (Return): Don't create a return label if we don't
6564 need it; reverts my change from January 20th. Thanks to Ben
6567 2004-04-27 Martin Baulig <martin@ximian.com>
6569 According to the spec, `goto' can only leave a nested scope, but
6572 * statement.cs (Block.LookupLabel): Only lookup in the current
6573 block, don't recurse into parent or child blocks.
6574 (Block.AddLabel): Check in parent and child blocks, report
6575 CS0140/CS0158 if we find a duplicate.
6576 (Block): Removed this indexer for label lookups.
6577 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
6578 this already does the error reporting for us.
6581 (FlowBranching.UsageVector.Block): New public variable; may be null.
6582 (FlowBranching.CreateSibling): Added `Block' argument.
6583 (FlowBranching.LookupLabel): New public virtual method. Lookup a
6584 label for the target of a `goto' and check whether we're not
6585 leaving a `finally'.
6587 2004-04-27 Martin Baulig <martin@ximian.com>
6589 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
6590 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
6593 2004-04-27 Martin Baulig <martin@ximian.com>
6595 * statement.cs (Block.AddLabel): Also check for implicit blocks
6596 and added a CS0158 check.
6598 2004-04-27 Martin Baulig <martin@ximian.com>
6600 * flowanalysis.cs (FlowBranchingLoop): New class.
6601 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
6602 UsageVector's instead of an ArrayList.
6603 (FlowBranching.Label): Likewise.
6604 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
6605 (FlowBranching.AddBreakVector): New method.
6607 2004-04-27 Miguel de Icaza <miguel@ximian.com>
6609 * attribute.cs: Small regression fix: only convert the type if we
6610 the type is different, fixes System.Drawing build.
6612 2004-04-27 Martin Baulig <martin@ximian.com>
6614 * attribute.cs (Attribute.Resolve): If we have a constant value
6615 for a named field or property, implicity convert it to the correct
6618 2004-04-27 Raja R Harinath <rharinath@novell.com>
6620 * statement.cs (Block.Block): Implicit blocks share
6621 'child_variable_names' fields with parent blocks.
6622 (Block.AddChildVariableNames): Remove.
6623 (Block.AddVariable): Mark variable as "used by a child block" in
6624 every surrounding block.
6625 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
6626 been used in a child block, complain about violation of "Invariant
6627 meaning in blocks" rule.
6628 * cs-parser.jay (declare_local_variables): Don't use
6629 AddChildVariableNames.
6630 (foreach_statement): Don't create an implicit block: 'foreach'
6633 2004-04-23 Miguel de Icaza <miguel@ximian.com>
6635 * convert.cs (ImplicitNumericConversion): 0 is also positive when
6636 converting from 0L to ulong. Fixes 57522.
6638 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6640 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
6641 derived class hides via 'new' keyword field from base class (test-242.cs).
6642 TODO: Handle this in the more general way.
6644 * class.cs (CheckBase): Ditto.
6646 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6648 * decl.cs (caching_flags): New member for storing cached values
6650 (MemberCore.Flags): New enum where bit flags for caching_flags
6652 (MemberCore.cls_compliance): Moved to caching_flags.
6653 (DeclSpace.Created): Moved to caching_flags.
6655 * class.cs: Use caching_flags instead of DeclSpace.Created
6657 2004-04-21 Miguel de Icaza <miguel@ximian.com>
6659 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
6660 if we are only a derived class, not a nested class.
6662 * typemanager.cs: Same as above, but do this at the MemberLookup
6663 level (used by field and methods, properties are handled in
6664 PropertyExpr). Allow for the qualified access if we are a nested
6667 2004-04-21 Marek Safar <marek.safar@seznam.cz>
6669 * class.cs: Refactoring.
6670 (IMethodData): New inteface; Holds links to parent members
6671 to avoid member duplication (reduced memory allocation).
6672 (Method): Implemented IMethodData interface.
6673 (PropertyBase): New inner classes for get/set methods.
6674 (PropertyBase.PropertyMethod): Implemented IMethodData interface
6675 (Event): New inner classes for add/remove methods.
6676 (Event.DelegateMethod): Implemented IMethodData interface.
6678 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
6679 EmitContext (related to class.cs refactoring).
6681 2004-04-21 Raja R Harinath <rharinath@novell.com>
6683 * delegate.cs (Delegate.VerifyApplicability): If the number of
6684 arguments are the same as the number of parameters, first try to
6685 verify applicability ignoring any 'params' modifier on the last
6689 2004-04-16 Raja R Harinath <rharinath@novell.com>
6691 * class.cs (TypeContainer.AddIndexer): Use
6692 'ExplicitInterfaceName' to determine if interface name was
6693 explicitly specified. 'InterfaceType' is not initialized at this time.
6694 (TypeContainer.DefineIndexers): Remove use of temporary list. The
6695 Indexers array is already in the required order. Initialize
6696 'IndexerName' only if there are normal indexers.
6697 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
6698 (TypeContainer.Emit): Emit DefaultMember attribute only if
6699 IndexerName is initialized.
6702 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
6704 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
6707 2004-04-15 Raja R Harinath <rharinath@novell.com>
6709 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
6713 * attribute.cs (Attribute.Resolve): Check for duplicate named
6717 2004-04-15 Miguel de Icaza <miguel@ximian.com>
6719 * iterators.cs (MarkYield): track whether we are in an exception,
6720 and generate code accordingly. Use a temporary value to store the
6721 result for our state.
6723 I had ignored a bit the interaction of try/catch with iterators
6724 since their behavior was not entirely obvious, but now it is
6725 possible to verify that our behavior is the same as MS .NET 2.0
6729 2004-04-14 Miguel de Icaza <miguel@ximian.com>
6731 * iterators.cs: Avoid creating temporaries if there is no work to
6734 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
6735 Enumerations, use TypeManager.EnumToUnderlying and call
6738 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
6741 (This.Emit): Use EmitContext.EmitThis to emit our
6744 (This.EmitAssign): Ditto.
6746 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
6747 codepaths, we will move all the functionality into
6750 (FieldExpr.EmitAssign): Ditto.
6752 This fixes several hidden bugs that I uncovered while doing a code
6753 review of this today.
6755 * codegen.cs (EmitThis): reworked so the semantics are more clear
6756 and also support value types "this" instances.
6758 * iterators.cs: Changed so that for iterators in value types, we
6759 do not pass the value type as a parameter.
6761 Initialization of the enumerator helpers is now done in the caller
6762 instead of passing the parameters to the constructors and having
6763 the constructor set the fields.
6765 The fields have now `assembly' visibility instead of private.
6767 2004-04-11 Miguel de Icaza <miguel@ximian.com>
6769 * expression.cs (Argument.Resolve): Check if fields passed as ref
6770 or out are contained in a MarshalByRefObject.
6772 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
6773 another compiler type.
6775 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
6777 * class.cs (Indexer.Define): use the new name checking method.
6778 Also, return false on an error.
6779 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
6780 (is_identifier_[start/part]_character): make static.
6782 2004-04-10 Miguel de Icaza <miguel@ximian.com>
6784 * expression.cs (Binary.ResolveOperator): Do no append strings
6785 twice: since we can be invoked more than once (array evaluation)
6786 on the same concatenation, take care of this here. Based on a fix
6787 from Ben (bug #56454)
6789 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
6791 * codegen.cs: Fix another case where CS1548 must be reported (when
6792 delay-sign isn't specified and no private is available #56564). Fix
6793 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
6794 error when MCS is used on the MS runtime and we need to delay-sign
6795 (which seems unsupported by AssemblyBuilder - see #56621).
6797 2004-04-08 Marek Safar <marek.safar@seznam.cz>
6799 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
6800 (TypeManager.ComputeNamespaces): Faster implementation for
6803 * compiler.csproj: Updated AssemblyName to mcs.
6805 2004-04-07 Miguel de Icaza <miguel@ximian.com>
6807 * rootcontext.cs: Add new types to the boot resolution.
6809 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
6810 MulticastDelegate is not allowed.
6812 * typemanager.cs: Add new types to lookup: System.TypedReference
6815 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
6816 check for TypedReference or ArgIterator, they are not allowed.
6818 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
6819 makes us properly catch 1510 in some conditions (see bug 56016 for
6822 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
6824 * CryptoConvert.cs: update from corlib version
6827 2004-04-05 Miguel de Icaza <miguel@ximian.com>
6829 * class.cs (Indexer.Define): Check indexername declaration
6831 2004-04-05 Marek Safar <marek.safar@seznam.cz>
6833 * attribute.cs (IsClsCompliant): Fixed problem with handling
6834 all three states (compliant, not-compliant, undetected).
6836 2004-03-30 Marek Safar <marek.safar@seznam.cz>
6838 * attribute.cs (Attribute): Location is now public.
6839 (Resolve): Store resolved arguments (pos_values) in attribute class.
6840 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
6841 (GetClsCompliantAttributeValue): New method that gets
6842 CLSCompliantAttribute value.
6843 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
6844 if exists else null.
6845 (AttributeTester): New class for CLS-Compliant verification routines.
6847 * class.cs (Emit): Add CLS-Compliant verification.
6848 (Method.GetSignatureForError): Implemented.
6849 (Constructor.GetSignatureForError): Implemented
6850 (Constructor.HasCompliantArgs): Returns if constructor has
6851 CLS-Compliant arguments.
6852 (Constructor.Emit): Override.
6853 (Construcor.IsIdentifierClsCompliant): New method; For constructors
6854 is needed to test only parameters.
6855 (FieldBase.GetSignatureForError): Implemented.
6856 (TypeContainer): New member for storing base interfaces.
6857 (TypeContainer.FindMembers): Search in base interfaces too.
6859 * codegen.cs (GetClsComplianceAttribute): New method that gets
6860 assembly or module CLSCompliantAttribute value.
6861 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
6863 (ModuleClass.Emit): Add error 3012 test.
6865 * const.cs (Emit): Override and call base for CLS-Compliant tests.
6867 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
6868 state for all decl types.
6869 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
6870 if CLS-Compliant tests are required.
6871 (IsClsCompliaceRequired): New method. Analyze whether code
6872 must be CLS-Compliant.
6873 (IsExposedFromAssembly): New method. Returns true when MemberCore
6874 is exposed from assembly.
6875 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
6876 value or gets cached value.
6877 (HasClsCompliantAttribute): New method. Returns true if MemberCore
6878 is explicitly marked with CLSCompliantAttribute.
6879 (IsIdentifierClsCompliant): New abstract method. This method is
6880 used to testing error 3005.
6881 (IsIdentifierAndParamClsCompliant): New method. Common helper method
6882 for identifier and parameters CLS-Compliant testing.
6883 (VerifyClsCompliance): New method. The main virtual method for
6884 CLS-Compliant verifications.
6885 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
6886 null. I don't know why is null (too many public members !).
6887 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
6888 and get value of first CLSCompliantAttribute that found.
6890 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
6891 (VerifyClsCompliance): Override and add extra tests.
6893 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
6894 clscheck- disable CLS-Compliant verification event if assembly is has
6895 CLSCompliantAttribute(true).
6897 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
6898 ApllyAttribute is now called in emit section as in the other cases.
6899 Possible future Emit integration.
6900 (IsIdentifierClsCompliant): New override.
6901 (VerifyClsCompliance): New override.
6902 (GetEnumeratorName): Returns full enum name.
6904 * parameter.cs (GetSignatureForError): Implemented.
6906 * report.cs (WarningData): New struct for Warning message information.
6907 (LocationOfPreviousError): New method.
6908 (Warning): New method. Reports warning based on the warning table.
6909 (Error_T): New method. Reports error based on the error table.
6911 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
6912 verifications are done here.
6914 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
6916 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
6917 CLSCompliantAttribute.
6918 (all_imported_types): New member holds all imported types from other
6920 (LoadAllImportedTypes): New method fills static table with exported types
6921 from all referenced assemblies.
6922 (Modules): New property returns all assembly modules.
6924 2004-03-30 Miguel de Icaza <miguel@ximian.com>
6926 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
6927 throwing a parser error.
6929 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
6930 which removes the hardcoded get_/set_ prefixes for properties, as
6931 IL allows for the properties to be named something else.
6935 * expression.cs: Do not override operand before we know if it is
6938 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
6940 * typemanager.cs: support for pinned variables.
6942 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
6944 * decl.cs, typemanager.cs: Avoid using an arraylist
6945 as a buffer if there is only one result set.
6947 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
6949 * expression.cs: Make sure you cant call a static method
6950 with an instance expression, bug #56174.
6952 2004-03-29 Miguel de Icaza <miguel@ximian.com>
6954 * class.cs (IsDuplicateImplementation): Improve error reporting to
6955 flag 663 (method only differs in parameter modifier).
6957 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
6958 in preprocessor directives.
6960 * location.cs (LookupFile): Allow for the empty path.
6962 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
6963 better approach for some of that patch, but its failing with the
6964 CharSet enumeration. For now try/catch will do.
6966 * typemanager.cs: Do not crash if a struct does not have fields.
6969 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
6971 * expression.cs: cs0213, cant fix a fixed expression.
6974 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
6976 * cs-parser.jay: detect invalid embeded statements gracefully.
6979 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
6981 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
6984 the invocation type may not be a subclass of the tye of the item/
6985 The type of the item must be a subclass of the invocation item.
6990 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
6992 * attribute.cs: Added methods to get a string and a bool from an
6993 attribute. Required to information from AssemblyKeyFileAttribute,
6994 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
6995 * codegen.cs: Modified AssemblyName creation to include support for
6996 strongnames. Catch additional exceptions to report them as CS1548.
6997 * compiler.csproj: Updated include CryptoConvert.cs.
6998 * compiler.csproj.user: Removed file - user specific configuration.
6999 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7000 Mono.Security assembly. The original class is maintained and tested in
7001 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7002 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7003 like CSC 8.0 (C# v2) supports.
7004 * Makefile: Added CryptoConvert.cs to mcs sources.
7005 * rootcontext.cs: Added new options for strongnames.
7007 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7009 * driver.cs: For --expect-error, report error code `2'
7010 if the program compiled with no errors, error code `1' if
7011 it compiled with an error other than the one expected.
7013 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7015 * compiler.csproj: Updated for Visual Studio .NET 2003.
7016 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7017 * compiler.sln: Updated for Visual Studio .NET 2003.
7019 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7021 * expression.cs: Fix bug #47234. We basically need to apply the
7022 rule that we prefer the conversion of null to a reference type
7023 when faced with a conversion to 'object' (csc behaviour).
7025 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7027 * statement.cs: Shorter form for foreach, eliminates
7028 a local variable. r=Martin.
7030 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7032 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7033 checks if we can use brtrue/brfalse to test for 0.
7034 * expression.cs: use the above in the test for using brtrue/brfalse.
7037 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7039 * expression.cs: Rewrite string concat stuff. Benefits:
7041 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7042 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7043 rather than a concat chain.
7045 * typemanager.cs: Add lookups for more concat overloads.
7047 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7049 * expression.cs: Emit shorter il code for array init.
7066 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7068 * statement.cs: Before, two switch blocks would be merged if the
7069 total size of the blocks (end_item - begin_item + 1) was less than
7070 two times the combined sizes of the blocks.
7072 Now, it will only merge if after the merge at least half of the
7077 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7079 * class.cs : csc build fix for GetMethods(). See bug #52503.
7081 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7083 * expression.cs: Make sure fp comparisons work with NaN.
7084 This fixes bug #54303. Mig approved this patch a long
7085 time ago, but we were not able to test b/c the runtime
7088 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7090 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7092 2004-03-19 Martin Baulig <martin@ximian.com>
7094 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7095 error here and not in our caller.
7097 2004-03-19 Martin Baulig <martin@ximian.com>
7099 * interface.cs: Completely killed this file.
7100 (Interface): We're now a TypeContainer and live in class.cs.
7102 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7103 argument; we're now also called for interfaces.
7104 (TypeContainer.DefineMembers): Allow this method being called
7106 (TypeContainer.GetMethods): New public method; formerly known as
7107 Interface.GetMethod(). This is used by PendingImplementation.
7108 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7109 it's now private and non-static.
7110 (Interface): Moved this here; it's now implemented similar to
7112 (Method, Property, Event, Indexer): Added `bool is_interface'
7113 argument to their .ctor's.
7114 (MemberBase.IsInterface): New public field.
7116 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7117 instances instead of InterfaceMethod, InterfaceProperty, etc.
7118 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7119 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
7121 2004-03-19 Martin Baulig <martin@ximian.com>
7123 * class.cs (MethodCore.IsDuplicateImplementation): New private
7124 method which does the CS0111 checking.
7125 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
7126 Use IsDuplicateImplementation().
7128 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
7130 * decl.cs (FindMemberToOverride): New method to find the correct
7131 method or property to override in the base class.
7133 - Make Method/Property use the above method to find the
7134 version in the base class.
7135 - Remove the InheritableMemberSignatureCompare as it is now
7138 This patch makes large code bases much faster to compile, as it is
7139 O(n) rather than O(n^2) to do this validation.
7141 Also, it fixes bug 52458 which is that nested classes are not
7142 taken into account when finding the base class member.
7144 Reviewed/Approved by Martin.
7146 2004-03-17 Marek Safar <marek.safar@seznam.cz>
7148 * interface.cs: In all interface classes removed redundant
7149 member initialization.
7151 2004-03-16 Martin Baulig <martin@ximian.com>
7153 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7155 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7157 * decl.cs (DefineTypeAndParents): New helper method to define a
7158 type's containers before the type itself is defined; This is a
7159 bug exposed by the recent changes to Windows.Forms when an
7160 implemented interface was defined inside a class that had not been
7163 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
7165 (Check): Loop correctly to report errors modifiers
7166 (UNSAFE was not in the loop, since it was the same as TOP).
7168 * interface.cs: Every interface member now takes a ModFlags,
7169 instead of a "is_new" bool, which we set on the base MemberCore.
7171 Every place where we called "UnsafeOk" in the interface, now we
7172 call the proper member (InterfaceMethod.UnsafeOK) instead to get
7173 the unsafe settings from the member declaration instead of the
7174 container interface.
7176 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
7178 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7179 `set_indexer_name' to the pending bits (one per type).
7181 We fixed a bug today that was picking the wrong method to
7182 override, since for properties the existing InterfaceMethod code
7183 basically ignored the method name. Now we make sure that the
7184 method name is one of the valid indexer names.
7186 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
7188 * support.cs (SeekableStreamReader): Keep track of stream byte
7189 positions and don't mix them with character offsets to the buffer.
7191 Patch from Gustavo Giráldez
7193 2004-03-15 Marek Safar <marek.safar@seznam.cz>
7195 * interface.cs (InterfaceSetGetBase): Removed double member
7196 initialization, base class does it as well.
7198 2004-03-13 Martin Baulig <martin@ximian.com>
7200 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
7201 when compiling corlib.
7203 2004-03-13 Miguel de Icaza <miguel@ximian.com>
7205 * convert.cs (ExplicitConversion): We were reporting an error on
7206 certain conversions (object_type source to a value type, when the
7207 expression was `null') before we had a chance to pass it through
7208 the user defined conversions.
7210 * driver.cs: Replace / and \ in resource specifications to dots.
7213 * class.cs: Add check for duplicate operators. Fixes 52477
7215 2004-03-11 Miguel de Icaza <miguel@ximian.com>
7217 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
7218 that are in the middle of the statements, not only at the end.
7221 * class.cs (TypeContainer.AddField): No longer set the
7222 `HaveStaticConstructor' flag, now we call it
7223 `UserDefineStaticConstructor' to diferentiate the slightly
7224 semantic difference.
7226 The situation is that we were not adding BeforeFieldInit (from
7227 Modifiers.TypeAttr) to classes that could have it.
7228 BeforeFieldInit should be set to classes that have no static
7233 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
7235 And most importantly Zoltan's comment:
7237 http://bugzilla.ximian.com/show_bug.cgi?id=44229
7239 "I think beforefieldinit means 'it's ok to initialize the type sometime
7240 before its static fields are used', i.e. initialization does not need
7241 to be triggered by the first access to the type. Setting this flag
7242 helps the JIT to compile better code, since it can run the static
7243 constructor at JIT time, and does not need to generate code to call it
7244 (possibly lots of times) at runtime. Unfortunately, mcs does not set
7245 this flag for lots of classes like String.
7247 csc sets this flag if the type does not have an explicit static
7248 constructor. The reasoning seems to be that if there are only static
7249 initalizers for a type, and no static constructor, then the programmer
7250 does not care when this initialization happens, so beforefieldinit
7253 This bug prevents the AOT compiler from being usable, since it
7254 generates so many calls to mono_runtime_class_init that the AOT code
7255 is much slower than the JITted code. The JITted code is faster,
7256 because it does not generate these calls if the vtable is type is
7257 already initialized, which is true in the majority of cases. But the
7258 AOT compiler can't do this."
7260 2004-03-10 Miguel de Icaza <miguel@ximian.com>
7262 * class.cs (MethodData.Emit): Refactor the code so symbolic
7263 information is generated for destructors; For some reasons we
7264 were taking a code path that did not generate symbolic information
7267 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
7269 * class.cs: Create a Constructor.CheckBase method that
7270 takes care of all validation type code. The method
7271 contains some code that was moved from Define.
7273 It also includes new code that checks for duplicate ctors.
7274 This fixes bug #55148.
7276 2004-03-09 Joshua Tauberer <tauberer@for.net>
7278 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
7279 a { ... }-style array creation invokes EmitStaticInitializers
7280 which is not good for reference-type arrays. String, decimal
7281 and now null constants (NullCast) are not counted toward
7282 static initializers.
7284 2004-03-05 Martin Baulig <martin@ximian.com>
7286 * location.cs (SourceFile.HasLineDirective): New public field;
7287 specifies whether the file contains or is referenced by a "#line"
7289 (Location.DefineSymbolDocuments): Ignore source files which
7290 either contain or are referenced by a "#line" directive.
7292 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
7294 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
7295 direct access to our parent, so check the method inline there.
7297 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
7299 * expression.cs (Invocation.EmitCall): Miguel's last commit
7300 caused a regression. If you had:
7305 In Foo the implict this would be null.
7307 2004-02-27 Miguel de Icaza <miguel@ximian.com>
7309 * expression.cs (Invocation.EmitCall): If the method is not
7310 virtual, do not emit a CallVirt to it, use Call.
7312 * typemanager.cs (GetFullNameSignature): Improve the method to
7313 cope with ".ctor" and replace it with the type name.
7315 * class.cs (ConstructorInitializer.Resolve): Now the method takes
7316 as an argument the ConstructorBuilder where it is being defined,
7317 to catch the recursive constructor invocations.
7319 2004-02-26 Miguel de Icaza <miguel@ximian.com>
7321 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
7322 routines to check if a type is an enumerable/enumerator allow
7323 classes that implement the IEnumerable or IEnumerator interfaces.
7325 * class.cs (Property, Operator): Implement IIteratorContainer, and
7326 implement SetYields.
7328 (Property.Define): Do the block swapping for get_methods in the
7329 context of iterators. We need to check if Properties also
7330 include indexers or not.
7332 (Operator): Assign the Block before invoking the
7333 OperatorMethod.Define, so we can trigger the Iterator code
7336 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
7337 Property and Operator classes are not created when we parse the
7338 declarator but until we have the block completed, so we use a
7339 singleton SimpleIteratorContainer.Simple to flag whether the
7340 SetYields has been invoked.
7342 We propagate this setting then to the Property or the Operator to
7343 allow the `yield' to function.
7345 2004-02-25 Marek Safar <marek.safar@seznam.cz>
7347 * codegen.cs: Implemented attribute support for modules.
7348 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
7349 Assembly/Module functionality.
7351 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
7352 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
7353 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
7355 2004-02-16 Marek Safar <marek.safar@seznam.cz>
7357 * interface.cs (FindMembers): The operation is performed on all base
7358 interfaces and not only on the first. It is required for future CLS Compliance patch.
7360 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
7362 * statement.cs, codegen.cs:
7363 This patch deals with patterns such as:
7365 public class List : IEnumerable {
7367 public MyEnumerator GetEnumerator () {
7368 return new MyEnumerator(this);
7371 IEnumerator IEnumerable.GetEnumerator () {
7375 public struct MyEnumerator : IEnumerator {
7380 Before, there were a few things we did wrong:
7381 1) we would emit callvirt on a struct, which is illegal
7382 2) we emited ldarg when we needed to emit ldarga
7383 3) we would mistakenly call the interface methods on an enumerator
7384 type that derived from IEnumerator and was in another assembly. For example:
7386 public class MyEnumerator : IEnumerator
7388 Would have the interface methods called, even if there were public impls of the
7389 method. In a struct, this lead to invalid IL code.
7391 2004-02-11 Marek Safar <marek.safar@seznam.cz>
7393 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
7396 * delegate.cs (Define): Fixed crash when delegate type is undefined.
7398 2004-02-11 Miguel de Icaza <miguel@ximian.com>
7400 * cs-parser.jay: Fix small regression: we were not testing V2
7401 compiler features correctly.
7403 * interface.cs: If the emit context is null, then create one
7405 2004-02-09 Marek Safar <marek.safar@seznam.cz>
7407 * decl.cs (GetSignatureForError): New virtual method to get full name
7410 * attribute.cs (IAttributeSupport): New interface for attribute setting.
7411 Now it is possible to rewrite ApplyAttributes method to be less if/else.
7413 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
7414 Duplicated members and code in these classes has been removed.
7415 Better encapsulation in these classes.
7417 2004-02-07 Miguel de Icaza <miguel@ximian.com>
7419 * assign.cs (Assign.DoResolve): When dealing with compound
7420 assignments, there is a new rule in ECMA C# 2.4 (might have been
7421 there before, but it is documented here) that states that in:
7425 If b is of type int, and the `op' is a shift-operator, then the
7426 above is evaluated as:
7430 * expression.cs (Binary.ResolveOperator): Instead of testing for
7431 int/uint/long/ulong, try to implicitly convert to any of those
7432 types and use that in pointer arithmetic.
7434 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
7435 method to print information for from the type, not from the
7436 null-method we were given.
7438 2004-02-01 Duncan Mak <duncan@ximian.com>
7440 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
7441 parsing for cmd, fixes bug #53694.
7443 2004-02-04 Marek Safar <marek.safar@seznam.cz>
7445 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
7446 in the member name duplication tests. Property and operator name duplication
7447 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
7449 2004-02-03 Marek Safar <marek.safar@seznam.cz>
7451 * interface.cs (PopulateMethod): Fixed crash when interface method
7452 returns not existing type (error test cs0246-3.cs).
7454 2004-02-02 Ravi Pratap M <ravi@ximian.com>
7456 * cs-parser.jay (interface_accessors): Re-write actions to also
7457 store attributes attached to get and set methods. Fix spelling
7460 (inteface_property_declaration): Modify accordingly.
7462 (InterfaceAccessorInfo): New helper class to store information to pass
7463 around between rules that use interface_accessors.
7465 * interface.cs (Emit): Apply attributes on the get and set
7466 accessors of properties and indexers too.
7468 * attribute.cs (ApplyAttributes): Modify accordingly to use the
7469 right MethodBuilder when applying attributes to the get and set accessors.
7471 2004-01-31 Miguel de Icaza <miguel@ximian.com>
7473 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
7475 2004-01-26 Miguel de Icaza <miguel@ximian.com>
7477 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
7479 2004-01-25 Miguel de Icaza <miguel@ximian.com>
7481 * cs-parser.jay: Remove YIELD token, instead use the new grammar
7482 changes that treat `yield' specially when present before `break'
7485 * cs-tokenizer.cs: yield is no longer a keyword.
7487 2004-01-23 Marek Safar <marek.safar@seznam.cz>
7489 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
7490 setting for default constructors.
7491 For default constructors are almost every time set wrong Modifier. The
7492 generated IL code has been alright. But inside mcs this values was
7493 wrong and this was reason why several of my CLS Compliance tests
7496 2004-01-22 Martin Baulig <martin@ximian.com>
7498 * cs-parser.jay (namespace_or_type_name): Return an Expression,
7499 not a QualifiedIdentifier. This is what `type_name_expression'
7500 was previously doing.
7501 (type_name_expression): Removed; the code is now in
7502 `namespace_or_type_name'.
7503 (qualified_identifier): Removed, use `namespace_or_type_name'
7505 (QualifiedIdentifier): Removed this class.
7507 2004-01-22 Martin Baulig <martin@ximian.com>
7509 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
7510 not a string as alias name.
7512 2004-01-21 Miguel de Icaza <miguel@ximian.com>
7514 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
7515 #52730 bug, and instead compute correctly the need to use a
7516 temporary variable when requesting an address based on the
7517 static/instace modified of the field and the constructor.
7519 2004-01-21 Martin Baulig <martin@ximian.com>
7521 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
7522 class and namespace before looking up aliases. Fixes #52517.
7524 2004-01-21 Martin Baulig <martin@ximian.com>
7526 * flowanalysis.cs (UsageVector.Merge): Allow variables being
7527 assinged in a 'try'; fixes exception4.cs.
7529 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7530 * class.cs : Implemented parameter-less constructor for TypeContainer
7532 * decl.cs: Attributes are now stored here. New property OptAttributes
7534 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
7536 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
7538 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7540 * typemanager.cs (CSharpSignature): Now reports also inner class name.
7541 (CSharpSignature): New method for indexer and property signature.
7543 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7545 * pending.cs (IsVirtualFilter): Faster implementation.
7547 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7549 * typemanager.cs: Avoid inclusion of same assembly more than once.
7551 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7553 * cs-parser.jay: Fixed problem where the last assembly attribute
7554 has been applied also to following declaration (class, struct, etc.)
7556 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7558 * class.cs: Added error CS0538, CS0539 reporting.
7559 Fixed crash on Microsoft runtime when field type is void.
7561 * cs-parser.jay: Added error CS0537 reporting.
7563 * pending.cs: Added error CS0535 reporting.
7564 Improved error report for errors CS0536, CS0534.
7566 2004-01-20 Miguel de Icaza <miguel@ximian.com>
7568 Merge a few bits from the Anonymous Method MCS tree.
7570 * statement.cs (ToplevelBlock): New class for toplevel methods,
7571 will hold anonymous methods, lifted variables.
7573 * cs-parser.jay: Create toplevel blocks for delegates and for
7574 regular blocks of code.
7576 2004-01-20 Martin Baulig <martin@ximian.com>
7578 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
7579 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
7580 and `NeedExplicitReturn'; added `IsLastStatement'.
7581 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
7582 have a `ReturnLabel' or we're not unreachable.
7584 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
7585 child's reachability; don't just override ours with it. Fixes
7586 #58058 (lluis's example).
7587 (FlowBranching): Added public InTryOrCatch(), InCatch(),
7588 InFinally(), InLoop(), InSwitch() and
7589 BreakCrossesTryCatchBoundary() methods.
7591 * statement.cs (Return): Do all error checking in Resolve().
7592 Unless we are the last statement in a top-level block, always
7593 create a return label and jump to it.
7594 (Break, Continue): Do all error checking in Resolve(); also make
7595 sure we aren't leaving a `finally'.
7596 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
7597 statement in a top-level block.
7598 (Block.Flags): Added `IsDestructor'.
7599 (Block.IsDestructor): New public property.
7601 2004-01-20 Martin Baulig <martin@ximian.com>
7603 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
7605 2004-01-20 Martin Baulig <martin@ximian.com>
7607 * statement.cs (Statement.ResolveUnreachable): New public method.
7608 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
7609 (Block.Resolve): Resolve unreachable statements.
7611 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7613 * expression.cs: We need to fix the case where we do
7614 not have a temp variable here.
7616 * assign.cs: Only expression compound assignments need
7617 temporary variables.
7619 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7621 * flowanalysis.cs: Reduce memory allocation in a few ways:
7622 - A block with no variables should not allocate a bit
7624 - A method with no out parameters does not need any tracking
7625 for assignment of the parameters, so we need not allocate
7628 public readonly Type[] VariableTypes;
7629 public readonly string[] VariableNames;
7630 Are redundant. The data is already stored in the variable
7631 map, so we need not allocate another array for it.
7632 - We need to add alot of checks for if (params | locals) == null
7633 due to the first two changes.
7635 2004-01-18 Miguel de Icaza <miguel@ximian.com>
7637 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
7638 implement IMemoryLocation, we store a copy on a local variable and
7639 take the address of it. Patch from Benjamin Jemlich
7641 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
7642 to use a special "type_name_expression" rule which reduces the
7643 number of "QualifiedIdentifier" classes created, and instead
7644 directly creates MemberAccess expressions.
7646 2004-01-17 Miguel de Icaza <miguel@ximian.com>
7648 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
7649 that fixes #52853. Null literal assignment to ValueType
7651 * class.cs (MethodData.Emit): Instead of checking the name of the
7652 method to determine if its a destructor, create a new derived
7653 class from Method called Destructor, and test for that.
7655 * cs-parser.jay: Create a Destructor object instead of a Method.
7657 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
7661 2004-01-16 Miguel de Icaza <miguel@ximian.com>
7663 * expression.cs (Binary.ResolveOperator): Perform an implicit
7664 conversion from MethodGroups to their delegate types on the
7667 * delegate.cs: Introduce a new class DelegateCreation that is the
7668 base class for `NewDelegate' and `ImplicitDelegateCreation',
7669 factor some code in here.
7671 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
7672 conversion from MethodGroups to compatible delegate types.
7674 * ecore.cs (Expression.Resolve): Do not flag error 654
7675 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
7676 we allow conversions from MethodGroups to delegate types now.
7678 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
7679 assignments in v2 either.
7681 2004-01-10 Miguel de Icaza <miguel@ximian.com>
7683 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
7684 static read-only fields in ctors.
7686 Applied patch from Benjamin Jemlich
7688 * expression.cs (UnaryMutator): Avoid leaking local variables.
7690 2004-01-09 Miguel de Icaza <miguel@ximian.com>
7692 * cs-tokenizer.cs (IsCastToken): Allow the various native types
7693 here to return true, as they can be used like this:
7697 Fixed 49836 and all the other dups
7699 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
7701 * driver.cs: Implement /win32res and /win32icon.
7703 2004-01-08 Miguel de Icaza <miguel@ximian.com>
7705 * cs-parser.jay: Add a rule to improve error handling for the
7706 common mistake of placing modifiers after the type.
7708 2004-01-07 Miguel de Icaza <miguel@ximian.com>
7710 * cs-parser.jay (interface_event_declaration): Catch
7711 initialization of events on interfaces, and report cs0068
7713 * cs-parser.jay (interface_event_declaration): Catch
7714 initialization of events.
7716 * ecore.cs: Better report missing constructors.
7718 * expression.cs (Binary.ResolveOperator): My previous bug fix had
7719 the error reporting done in the wrong place. Fix.
7721 * expression.cs (Binary.ResolveOperator): Catch the
7722 operator + (E x, E y) error earlier, and later allow for implicit
7723 conversions in operator +/- (E e, U x) from U to the underlying
7726 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
7727 52596, if the container class is abstract, the default constructor
7728 is protected otherwise its public (before, we were always public).
7730 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
7733 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
7734 Jemlich that fixes bug #52597, MCS was generating invalid code for
7735 idisposable structs. Thanks to Ben for following up with this
7738 2004-01-06 Miguel de Icaza <miguel@ximian.com>
7740 * driver.cs: Allow assemblies without code to be generated, fixes
7743 2004-01-07 Nick Drochak <ndrochak@gol.com>
7745 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
7747 2004-01-05 Miguel de Icaza <miguel@ximian.com>
7749 * cs-parser.jay: Add rules to improve error reporting if fields or
7750 methods are declared at the namespace level (error 116)
7752 * Add rules to catch event add/remove
7754 2004-01-04 David Sheldon <dave-mono@earth.li>
7756 * expression.cs: Added matching ")" to error message for
7759 2004-01-03 Todd Berman <tberman@gentoo.org>
7761 * ecore.cs, attribute.cs:
7762 Applying fix from #52429.
7764 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7766 * ecore.cs, expression.cs, statement.cs:
7767 Total rewrite of how we handle branching. We
7768 now handle complex boolean expressions with fewer
7769 jumps. As well if (x == 0) no longer emits a ceq.
7771 if (x is Foo) is much faster now, because we generate
7774 Overall, we get a pretty big improvement on our benchmark
7775 tests. The code we generate is smaller and more readable.
7777 I did a full two-stage bootstrap. The patch was reviewed
7778 by Martin and Miguel.
7780 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7782 * cs-parser.jay: Make primary_expression not take a QI.
7783 we dont need this because the member_access rule covers
7784 us here. So we replace the rule with just IDENTIFIER.
7786 This has two good effects. First, we remove a s/r conflict.
7787 Second, we allocate many fewer QualifiedIdentifier objects.
7789 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7791 * attribute.cs: Handle MarshalAs attributes as pseudo, and
7792 set the correct information via SRE. This prevents
7793 hanging on the MS runtime. Fixes #29374.
7795 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7797 * convert.cs: correctly handle conversions to value types
7798 from Enum and ValueType as unboxing conversions.
7800 Fixes bug #52569. Patch by Benjamin Jemlich.
7802 2004-01-02 Ravi Pratap <ravi@ximian.com>
7804 * expression.cs (BetterConversion): Prefer int -> uint
7805 over int -> ulong (csc's behaviour). This fixed bug #52046.
7807 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
7809 * decl.cs (MemberCache.FindMembers): now returns a
7812 * typemanager.cs: In general, go with with ^^.
7813 (CopyNewMethods): take an IList.
7814 (RealMemberLookup): Only allocate an arraylist
7815 if we copy from two sets of methods.
7817 This change basically does two things:
7818 1) Fewer array lists allocated due to CopyNewMethods.
7819 2) the explicit cast in MemberList costed ALOT.
7821 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
7823 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
7824 a hashtable to avoid needless string allocations when an identifier is
7825 used more than once (the common case).
7827 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
7829 * pending.cs: MS's TypeBuilder.GetInterfaces ()
7830 is broken, it will not return anything. So, we
7831 have to use the information we have in mcs to
7834 * typemanager.cs: Add a cache for GetInterfaces,
7835 since this will now be used more often (due to ^^)
7837 (GetExplicitInterfaces) New method that gets the
7838 declared, not effective, interfaces on a type
7839 builder (eg, if you have interface IFoo, interface
7840 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
7843 This patch makes MCS able to bootstrap itself on
7846 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
7848 * expression.cs: Remove the Nop's that Miguel put
7851 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
7853 * report.cs, codegen.cs: Give the real stack trace to
7854 the error when an exception is thrown.
7856 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
7858 * decl.cs: only allocate hashtables for ifaces if
7861 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
7863 * expression.cs: fix the error from cs0121-2.cs
7864 (a parent interface has two child interfaces that
7865 have a function with the same name and 0 params
7866 and the function is called through the parent).
7868 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
7870 * class.cs, rootcontext.cs, typmanager.cs: do not
7873 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
7875 * codegen.cs: remove stack for the ec flow branching.
7876 It is already a linked list, so no need.
7878 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
7880 * Makefile: Allow custom profiler here.
7882 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
7884 * typemanager.cs (LookupType):
7885 - Use a static char [], because split takes
7886 a param array for args, so it was allocating
7888 - Do not store true in a hashtable, it boxes.
7890 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
7892 * flowanalysis.cs: bytify common enums.
7894 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
7896 * modifiers.cs: Add a new set of flags for the
7897 flags allowed on explicit interface impls.
7898 * cs-parser.jay: catch the use of modifiers in
7899 interfaces correctly.
7900 * class.cs: catch private void IFoo.Blah ().
7902 All related to bug #50572.
7904 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
7906 * decl.cs: Rewrite the consistant accessability checking.
7907 Accessability is not linear, it must be implemented in
7908 a tableish way. Fixes #49704.
7910 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
7912 * expression.cs: Handle negation in a checked context.
7913 We must use subtraction from zero. Fixes #38674.
7915 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
7917 * class.cs: Ignore static void main in DLLs.
7918 * rootcontext.cs: Handle the target type here,
7919 since we are have to access it from class.cs
7920 * driver.cs: account for the above.
7922 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
7924 * report.cs: Give line numbers and files if available.
7926 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
7928 * driver.cs: Implement /addmodule.
7930 * typemanager.cs: Change 'modules' field so it now contains Modules not
7933 2003-12-20 Martin Baulig <martin@ximian.com>
7935 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
7936 (FieldBase.IsAssigned): Removed this field.
7937 (FieldBase.SetAssigned): New public method.
7938 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
7940 2003-12-20 Martin Baulig <martin@ximian.com>
7942 * expression.cs (LocalVariableReference.DoResolve): Don't set
7943 `vi.Used' if we're called from DoResolveLValue().
7945 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
7946 returns the usage vector it just merged into the current one -
7947 pass this one to UsageWarning().
7948 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
7949 of the `EmitContext', don't call this recursively on our children.
7951 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
7953 * driver.cs: Implement /target:module.
7955 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
7957 * support.cs (CharArrayHashtable): New helper class.
7959 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
7960 char arrays, not strings, so we can avoid creating a string in
7961 consume_identifier if the identifier is a keyword.
7963 2003-12-16 Martin Baulig <martin@ximian.com>
7965 * statement.cs (LocalInfo.Assigned): Removed this property.
7966 (LocalInfo.Flags): Removed `Assigned'.
7967 (LocalInfo.IsAssigned): New public method; takes the EmitContext
7968 and uses flow analysis.
7969 (Block.UsageWarning): Made this method private.
7970 (Block.Resolve): Call UsageWarning() if appropriate.
7972 * expression.cs (LocalVariableReference.DoResolve): Always set
7973 LocalInfo.Used here.
7975 2003-12-13 Martin Baulig <martin@ximian.com>
7977 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
7978 any value here; we're now using flow analysis to figure out
7979 whether a statement/block returns a value.
7981 2003-12-13 Martin Baulig <martin@ximian.com>
7983 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
7985 (FlowBranching.MergeFinally): Don't call
7986 `branching.CheckOutParameters()' here, this is called in
7988 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
7989 when adding the `finally' vector.
7991 2003-12-13 Martin Baulig <martin@ximian.com>
7994 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
7995 actually work and also fix #48962.
7997 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
7999 * decl.cs: Do not check System.Object for nested types,
8000 since we know it does not have any. Big bang for buck:
8005 corlib: 17.99 seconds
8009 corlib: 17.39 seconds
8011 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8013 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8014 time we are returning 0 members, so we save alot here.
8016 2003-12-11 Martin Baulig <martin@ximian.com>
8018 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8019 `MergeChild()', also just take the `FlowBranching' as argument;
8020 call Merge() on it and return the result.
8021 (FlowBranching.Merge): We don't need to do anything if we just
8024 2003-12-11 Martin Baulig <martin@ximian.com>
8026 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8027 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8028 Maurer for this idea.
8030 2003-12-11 Martin Baulig <martin@ximian.com>
8032 * flowanalysis.cs (MergeResult): This class is now gone; we now
8033 use the `UsageVector' for this. The reason for this is that if a
8034 branching just has one sibling, we don't need to "merge" them at
8035 all - that's the next step to do.
8036 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8039 2003-12-11 Martin Baulig <martin@ximian.com>
8041 Reworked flow analyis and made it more precise and bug-free. The
8042 most important change is that we're now using a special `Reachability'
8043 class instead of having "magic" meanings of `FlowReturns'. I'll
8044 do some more cleanups and optimizations and also add some more
8045 documentation this week.
8047 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8048 largely reworked this class.
8049 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8050 the new `Reachability' class instead of having "magic" values here.
8051 (FlowBranching): We're now using an instance of `Reachability'
8052 instead of having separate `Returns', `Breaks' etc. fields.
8054 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8055 based on flow analysis; ignore the return value of block.Emit ().
8057 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8059 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8060 if they are private.
8062 2003-12-09 Martin Baulig <martin@ximian.com>
8064 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8065 call them directly on the UsageVector.
8067 2003-12-09 Martin Baulig <martin@ximian.com>
8069 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8070 Changed return type from `FlowReturns' to `Reachability'.
8072 2003-12-09 Martin Baulig <martin@ximian.com>
8074 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8075 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8076 `Reachable' fields with a single `Reachability' one.
8078 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8080 * class.cs (FindMembers): Remove foreach's.
8093 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8098 This patch does a few things:
8099 1. EmptyStatement is now a singleton, so it is never reallocated.
8100 2. All blah is EmptyStatement constructs have been changed to
8101 blah == EmptyStatement.Value, which is much faster and valid
8102 now that EmptyStatement is a singleton.
8103 3. When resolving a block, rather than allocating a new array for
8104 the non-empty statements, empty statements are replaced with
8105 EmptyStatement.Value
8106 4. Some recursive functions have been made non-recursive.
8107 Mainly the performance impact is from (3), however (1) and (2) are needed for
8108 this to work. (4) does not make a big difference in normal situations, however
8109 it makes the profile look saner.
8114 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8115 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8116 Total memory allocated: 56397 KB
8119 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
8120 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
8121 Total memory allocated: 55666 KB
8123 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8125 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
8126 than the hashtable in a hashtable version
8128 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
8129 we always end up concating a string. This results in a huge perf
8130 loss, because many strings have to be tracked by the GC. In this
8131 patch, we first use a hashtable that works with two keys, so that
8132 the strings do not need to be concat'ed.
8143 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8145 * Makefile: Add a new target `do-time' that does a quick and simple
8146 profile, leaving easy to parse output.
8148 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
8150 * codegen.cs (Init): Create the dynamic assembly with
8151 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
8153 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
8155 * support.cs: Make the PtrHashtable use only one
8156 instance of its comparer.
8158 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
8160 * typemanager.cs: Fix lookup of GetNamespaces.
8162 2003-11-29 Miguel de Icaza <miguel@ximian.com>
8164 * expression.cs: Removed redundant line.
8166 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
8167 ArrayLists, use for loops with bounds.
8169 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
8172 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
8173 arraylists, use for loop with bounds.
8175 The above three changes give us a 0.071 second performance
8176 improvement out of 3.294 seconds down to 3.223. On my machine
8177 the above changes reduced the memory usage by 1,387 KB during
8180 * cs-parser.jay (QualifiedIdentifier): New class used to represent
8181 QualifiedIdentifiers. Before we created a new string through
8182 concatenation, and mostly later on, the result would be
8183 manipulated by DecomposeQI through string manipulation.
8185 This reduced the compiler memory usage for bootstrapping from
8186 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
8187 compile times in 0.05 seconds.
8189 2003-11-28 Dick Porter <dick@ximian.com>
8191 * support.cs: Do string compares with the Invariant culture.
8199 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
8200 the comparison is done with the Invariant culture.
8202 2003-11-27 Miguel de Icaza <miguel@ximian.com>
8204 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
8205 GetEnumerator method.
8207 (ProbeCollectionType): Iterate starting at the most specific type
8208 upwards looking for a GetEnumerator
8210 * expression.cs: Shift count can be up to 31 for int/uint and 63
8213 2003-11-26 Miguel de Icaza <miguel@ximian.com>
8215 * statement.cs (Block.LookupLabel): Also look for the label on the
8216 children blocks. Use a hash table to keep track of visited
8219 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
8220 we actually did transform the other operand, otherwise fall back
8221 to the common codepath that casts to long.
8223 * cs-tokenizer.cs: Use the same code pattern as the int case.
8224 Maybe I should do the parsing myself, and avoid depending on the
8225 Parse routines to get this done.
8227 2003-11-25 Miguel de Icaza <miguel@ximian.com>
8229 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8230 which fixes bug 51347. This time test it.
8232 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
8233 attributes for example can not tell the difference between these.
8234 The difference was only a syntax feature of the language.
8236 * attribute.cs: Apply attributes to delegates.
8238 * delegate.cs: Call the apply attributes method.
8240 2003-11-24 Miguel de Icaza <miguel@ximian.com>
8242 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
8243 comparing 0 vs Byte.MinValue, not the value
8245 (ImplicitConversionRequired): When reporting a conversion error,
8246 use error 31 to print out the constant error instead of the
8249 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8250 which fixes bug 51347.
8252 2003-11-22 Miguel de Icaza <miguel@ximian.com>
8254 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
8255 which fixes the -warnaserror command line option.
8257 2003-11-21 Miguel de Icaza <miguel@ximian.com>
8259 * cfold.cs (DoNumericPromotions): During constant folding of
8260 additions on UIntConstant, special case intconstants with
8261 IntConstants like we do on the expression binary operator.
8263 2003-11-12 Miguel de Icaza <miguel@ximian.com>
8265 * convert.cs (ImplicitReferenceConversion): We were missing a case
8266 (System.Enum are not value types or class types, so we need to
8267 classify them separatedly).
8269 * driver.cs: We do not support error 2007.
8271 2003-11-12 Jackson Harper <jackson@ximian.com>
8273 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
8274 system directory. Also use the full file name so users can
8275 libraries names mscorlib-o-tron.dll in a non system dir.
8277 2003-11-10 Martin Baulig <martin@ximian.com>
8279 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
8280 (TypeManager.InitCoreTypes): Initialize them here, but instead of
8281 calling `ResolveType()' on them, directly assign their `Type'.
8283 2003-11-08 Martin Baulig <martin@ximian.com>
8285 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
8286 return value and the `out parent' parameter.
8287 (TypeContainer.DefineType): Moved the CS0644 check into
8288 GetClassBases(). Don't pass the interface types to the
8289 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
8290 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
8292 * ecore.cs (TypeExpr.IsAttribute): New property.
8293 (TypeExpr.GetInterfaces): New method.
8295 * interface.cs (Interface.GetInterfaceTypeByName): Return a
8296 TypeExpr instead of a Type.
8297 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
8298 (Interface.DefineType): Don't pass the interface types to the
8299 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
8300 them later and then call `TypeBulider.AddInterfaceImplementation()'.
8302 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
8303 instead of a `Type[]'.
8304 (TypeManager.RegisterBuilder): Likewise.
8305 (TypeManager.AddUserInterface): Likewise.
8306 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
8307 `Type[]' and also return a `TypeExpr[]'.
8308 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
8310 2003-11-08 Martin Baulig <martin@ximian.com>
8312 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
8315 2003-11-08 Martin Baulig <martin@ximian.com>
8317 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
8318 TypeManager.ResolveExpressionTypes().
8320 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
8321 instead of an Expression.
8322 (TypeExpr): This is now an abstract base class for `TypeExpression'.
8323 (TypeExpression): New public class; formerly known as `TypeExpr'.
8325 * expression.cs (ComposedCast): Derive from TypeExpr.
8327 * typemanager.cs (TypeManager.system_*_expr): These are now
8328 TypExpr's instead of Expression's.
8329 (TypeManager.ResolveExpressionTypes): New public static function;
8330 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
8333 2003-11-06 Miguel de Icaza <miguel@ximian.com>
8335 * expression.cs (New.DoResolve): Do not dereference value that
8336 might be a null return.
8338 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
8339 sure that the constant value has the right type. Fixes an
8340 unreported bug, similar to 50425.
8342 * const.cs (Const.LookupConstantValue): Call
8343 ImplicitStandardConversionExists before doing a conversion to
8344 avoid havng the TypeManager.ChangeType do conversions.
8346 Reduced the number of casts used
8348 (Const.ChangeType): New routine to enable reuse of the constant
8349 type changing code from statement.
8351 * typemanager.cs (ChangeType): Move common initialization to
8352 static global variables.
8356 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
8357 every value type to go through, even if it was void. Fix that.
8359 * cs-tokenizer.cs: Use is_identifier_start_character on the start
8360 character of the define, and the is_identifier_part_character for
8361 the rest of the string.
8363 2003-11-05 Miguel de Icaza <miguel@ximian.com>
8365 * expression.cs (UnaryMutator.EmitCode): When I updated
8366 LocalVariableReference.DoResolve, I overdid it, and dropped an
8367 optimization done on local variable references.
8369 2003-11-04 Miguel de Icaza <miguel@ximian.com>
8371 * ecore.cs: Convert the return from Ldlen into an int.
8373 2003-10-20 Miguel de Icaza <miguel@ximian.com>
8375 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
8376 the accessibility, this is a special case for toplevel non-public
8377 classes (internal for instance).
8379 2003-10-20 Nick Drochak <ndrochak@gol.com>
8381 * ecore.cs: Fix typo and build. Needed another right paren.
8383 2003-10-19 Miguel de Icaza <miguel@ximian.com>
8385 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
8386 `internal' case regular and protected, but not allowing protected
8387 to be evaluated later. Bug 49840
8389 2003-10-15 Miguel de Icaza <miguel@ximian.com>
8391 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
8392 to kb.Nlast, and not the kb.nFirst to isolate the switch
8395 Extract the underlying type, so enumerations of long/ulong are
8396 treated like long/ulong.
8398 2003-10-14 Miguel de Icaza <miguel@ximian.com>
8400 * expression.cs (New): Overload the meaning of RequestedType to
8401 track the possible creation of the NewDelegate type, since
8402 DoResolve is invoked more than once for new constructors on field
8405 See bugs: #48800 and #37014
8407 * cs-parser.jay (declare_local_constants): Take an arraylist
8408 instead of a single constant.
8410 (local_constant_declaration): It should take a
8411 constant_declarators, not a constant_declarator. Fixes 49487
8413 * convert.cs: Fix error report.
8415 2003-10-13 Jackson Harper <jackson@ximian.com>
8417 * typemanager.cs (TypeToCoreType): Add float and double this fixes
8420 2003-10-09 Martin Baulig <martin@ximian.com>
8422 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
8424 (MethodCore.DoDefineParameters): Removed the TypeContainer
8425 argument; use the DeclSpace which was passed to the .ctor instead.
8426 (MethodCore.CheckParameter): Take a DeclSpace instead of a
8427 TypeContainer; we only need a DeclSpace here.
8429 2003-10-09 Martin Baulig <martin@ximian.com>
8431 * class.cs (MethodData): Added additional `DeclSpace ds' argument
8433 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
8434 EmitContext's .ctor.
8436 2003-10-09 Martin Baulig <martin@ximian.com>
8438 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
8439 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
8440 AsAccessible(), moved them as well.
8442 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
8444 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
8446 * cs-parser.jay : Renamed yyName to yyNames related to jay.
8448 2003-10-07 Miguel de Icaza <miguel@ximian.com>
8450 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
8451 generation for >=, as spotted by Paolo, bug 48679.
8452 Patch from David Waite.
8454 * cs-tokenizer.cs: Add handling for #pragma.
8456 * cs-parser.jay: Allow for both yield and yield return in the
8457 syntax. The anti-cobolization of C# fight will go on!
8459 * class.cs (TypeBuilder.DefineType): Catch error condition here
8460 (Parent.DefineType erroring out and returning null).
8462 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8463 coping with enumerations variables, we were mistakenly processing
8464 them as a regular value type instead of built-in types. Fixes the
8467 * typemanager.cs (IsBuiltinOrEnum): New method.
8469 2003-09-30 Miguel de Icaza <miguel@ximian.com>
8471 * cs-parser.jay: Upgrade: yield now needs the return clause.
8473 2003-09-19 Martin Baulig <martin@ximian.com>
8475 * decl.cs (MemberCache.SetupCacheForInterface): Take a
8476 `MemberCache parent' argument. Normally, an interface doesn't
8477 have a parent type except System.Object, but we use this in gmcs
8478 for generic type parameters.
8480 2003-09-18 Martin Baulig <martin@ximian.com>
8482 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
8483 on `type.IsInterface'; don't check whether the type has a parent
8484 to determine whether it's an interface.
8486 2003-09-15 Martin Baulig <martin@ximian.com>
8488 * class.cs (TypeContainer.DefineType): Added an error flag to
8489 avoid reporting duplicate CS0146's ("class definition is
8492 * driver.cs (Driver.MainDriver): Abort if
8493 RootContext.ResolveTree() reported any errors.
8495 2003-09-07 Martin Baulig <martin@ximian.com>
8497 * report.cs (Error, Warning): Added overloaded versions which take
8498 a `params object[] args' and call String.Format().
8500 2003-09-07 Martin Baulig <martin@ximian.com>
8502 * decl.cs (DeclSpace..ctor): Don't call
8503 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
8504 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
8505 (DeclSpace.RecordDecl): New method.
8507 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
8509 2003-09-02 Ravi Pratap <ravi@ximian.com>
8511 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
8512 value attributes to be applied to ParameterBuilders.
8514 * class.cs (MethodCore.LabelParameters): Make static and more
8515 generic so that it can be used from other places - like interface
8516 methods, for instance.
8518 * interface.cs (Interface.Emit): Call LabelParameters before
8519 emitting attributes on the InterfaceMethod.
8521 2003-08-26 Martin Baulig <martin@ximian.com>
8523 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
8524 resolving aliases; fixes #47927.
8526 2003-08-26 Martin Baulig <martin@ximian.com>
8528 * statement.cs (Using.DoResolve): This is internally emitting a
8529 try/finally clause, so we need to set ec.NeedExplicitReturn if we
8530 do not always return. Fixes #47681.
8532 2003-08-26 Martin Baulig <martin@ximian.com>
8534 * decl.cs (MemberCore): Moved WarningNotHiding(),
8535 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
8537 (AdditionResult): Make this nested in DeclSpace.
8538 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
8539 argument; call NamespaceEntry.Define() unless we're nested in a
8542 * namespace.cs (Namespace.DefineName): New public function. This
8543 is called from DeclSpace's .ctor to add
8544 (Namespace.Lookup): Include DeclSpaces in the lookup.
8546 * class.cs (Operator): Derive from MemberBase, not MemberCore.
8548 * const.cs (Const): Derive from MemberBase, not MemberCore.
8550 2003-08-25 Martin Baulig <martin@ximian.com>
8552 * convert.cs (Convert.ExplicitReferenceConversion): When
8553 converting from an interface type to a class, unbox if the target
8554 type is a struct type. Fixes #47822.
8556 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8558 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
8561 2003-08-22 Martin Baulig <martin@ximian.com>
8563 * class.cs (TypeManager.DefineType): When defining a nested type,
8564 call DefineType() on our parent; fixes #47801.
8566 2003-08-22 Martin Baulig <martin@ximian.com>
8568 * class.cs (MethodData.Define): While checking if a method is an
8569 interface implementation, improve the test a bit more to fix #47654.
8571 2003-08-22 Martin Baulig <martin@ximian.com>
8573 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
8574 correctly; fixes #47722.
8576 2003-08-22 Martin Baulig <martin@ximian.com>
8578 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
8579 LocalVariableReference, ensure it's not read-only. Fixes #47536.
8581 * statement.cs (Fixed.DoResolve): Make all variables read-only.
8583 2003-08-22 Martin Baulig <martin@ximian.com>
8585 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
8586 can only be assigned in static constructors. Fixes #47161.
8588 2003-08-22 Martin Baulig <martin@ximian.com>
8590 Rewrote and improved the flow analysis code.
8592 * flowbranching.cs (FlowBranching): Make this class abstract.
8593 (FlowBranching.CreateBranching): New static function to create a
8595 (FlowBranchingBlock, FlowBranchingException): New classes.
8596 (FlowBranching.UsageVector.Type): New public readonly field.
8597 (FlowBranching.UsageVector.Breaks): Removed the setter.
8598 (FlowBranching.UsageVector.Returns): Removed the setter.
8599 (FlowBranching.UsageVector): Added Break(), Return(),
8600 NeverReachable() and Throw() methods to modify the reachability.
8601 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
8602 done by FlowBranching.Merge().
8603 (FlowBranching.UsageVector.MergeChild): New method; merges the
8604 merge result into the current vector.
8605 (FlowBranching.Merge): New abstract method to merge a branching.
8607 2003-08-12 Martin Baulig <martin@ximian.com>
8609 * expression.cs (Indirection.CacheTemporaries): Create the
8610 LocalTemporary with the pointer type, not its element type.
8612 2003-08-10 Miguel de Icaza <miguel@ximian.com>
8614 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
8615 token was a keyword or not.
8617 Add `error' options where an IDENTIFIER was expected; Provide
8618 CheckToken and CheckIdentifierToken convenience error reporting
8621 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
8623 * decl.cs: Rename `NamespaceEntry Namespace' public field into
8624 NameSpaceEntry NameSpaceEntry.
8626 (LookupInterfaceOrClass): Avoid creating a full qualified name
8627 from namespace and name: avoid doing lookups when we know the
8628 namespace is non-existant. Use new Tree.LookupByNamespace which
8629 looks up DeclSpaces based on their namespace, name pair.
8631 * driver.cs: Provide a new `parser verbose' to display the
8632 exception thrown during parsing. This is turned off by default
8633 now, so the output of a failure from mcs is more graceful.
8635 * namespace.cs: Track all the namespaces defined in a hashtable
8638 (IsNamespace): New method
8640 2003-08-09 Miguel de Icaza <miguel@ximian.com>
8642 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
8643 we know that we need to concatenate (full typename can never be
8648 * statement.cs: Use a bitfield; Do not initialize to null things
8649 which are done by the constructor by default.
8651 * cs-parser.jay: bug fix, parameter was 4, not 3.
8653 * expression.cs: Just use the property;
8655 * statement.cs: No need for GetVariableInfo method.
8657 2003-08-08 Martin Baulig <martin@ximian.com>
8659 * flowanalysis.cs (FlowReturns): This is now nested in the
8660 `FlowBranching' class.
8661 (MyBitVector): Moved this here from statement.cs.
8662 (FlowBranching.SiblingType): New enum type.
8663 (FlowBranching.CreateSibling): Added `SiblingType' argument.
8665 2003-08-07 Martin Baulig <martin@ximian.com>
8667 * flowanalysis.cs (FlowBranchingType): This is now nested in the
8668 `FlowBranching' class and called `BranchingType'.
8670 2003-08-07 Martin Baulig <martin@ximian.com>
8672 * flowanalysis.cs: Moved all the control flow analysis code into
8675 2003-08-07 Martin Baulig <martin@ximian.com>
8677 * assign.cs (Assign.DoResolve): `target' must either be an
8678 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
8681 2003-08-07 Miguel de Icaza <miguel@ximian.com>
8683 * expression.cs (BinaryMethod): This kind of expression is created by the
8684 Binary class if it determines that the operator has to be handled
8687 (BinaryDelegate): This kind of expression is created if we are
8688 dealing with a + or - operator on delegates.
8690 (Binary): remove method, argumetns, and DelegateOperator: when
8691 dealing with methods,
8693 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
8695 * statement.cs (Block): use bitfields for the three extra booleans
8696 we had in use. Remove unused topblock parameter.
8698 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
8700 * assign.cs: Drop extra unneeded tests.
8702 2003-08-06 Miguel de Icaza <miguel@ximian.com>
8704 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
8706 * statement.cs (Foreach): Use VariableStorage instead of
8709 * codegen.cs (VariableStorage): New class used by clients that
8710 require a variable stored: locals or fields for variables that
8711 need to live across yield.
8713 Maybe provide a convenience api for EmitThis+EmitLoad?
8715 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
8718 2003-08-05 Miguel de Icaza <miguel@ximian.com>
8720 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
8721 RemapParameterLValue): New methods that are used to turn a
8722 precomputed FieldInfo into an expression like this:
8726 The idea is to use this instead of making LocalVariableReference
8727 have more than one meaning.
8729 * cs-parser.jay: Add error production to BASE.
8731 * ecore.cs: Deal with TypeManager.GetField returning null, which
8732 is now a valid return value.
8734 (FieldExprNoAddress): New expression for Fields whose address can
8737 * expression.cs (LocalVariableReference): During the resolve
8738 phases, create new expressions if we are in a remapping context.
8739 Remove code that dealt with remapping here.
8741 (ParameterReference): same.
8743 (ProxyInstance): New expression, like the `This' expression, but
8744 it is born fully resolved. We know what we are doing, so remove
8745 the errors that are targeted to user-provided uses of `this'.
8747 * statement.cs (Foreach): our variable is now stored as an
8748 Expression; During resolution, follow the protocol, dont just
8749 assume it will return this.
8751 2003-08-06 Martin Baulig <martin@ximian.com>
8753 * support.cs (SeekableStreamReader.cs): New public class.
8755 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
8756 SeekableStreamReader instead of the normal StreamReader.
8758 2003-08-04 Martin Baulig <martin@ximian.com>
8760 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
8761 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
8762 deambiguate casts and delegate invocations.
8763 (parenthesized_expression): Use the new tokens to ensure this is
8764 not a cast of method invocation.
8766 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
8767 when reading a `)' and Deambiguate_CloseParens () was previously
8770 * expression.cs (ParenthesizedExpression): New class. This is
8771 just used for the CS0075 test.
8772 (Binary.DoResolve): Check for CS0075.
8774 2003-07-29 Ravi Pratap <ravi@ximian.com>
8776 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
8777 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
8778 reference comparison.
8780 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
8781 examine the ReturnType for equality - this is necessary in the
8782 cases of implicit and explicit operators whose signature also
8783 includes the return type.
8785 2003-07-26 Miguel de Icaza <miguel@ximian.com>
8787 * namespace.cs: Cache the result of the namespace computation,
8788 instead of computing it every time.
8790 2003-07-24 Miguel de Icaza <miguel@ximian.com>
8792 * decl.cs: Use a global arraylist that we reuse over invocations
8793 to avoid excesive memory consumption. Reduces memory usage on an
8794 mcs compile by one meg (45 average).
8796 * typemanager.cs (LookupTypeReflection): In .NET pointers are
8797 private, work around that.
8799 2003-07-23 Miguel de Icaza <miguel@ximian.com>
8801 * literal.cs (IntLiteral): Define Zero and One static literals.
8803 * cs-parser.jay (integer_literal): use static literals to reduce
8804 memory usage for the most used literals (0, 1 and -1). 211kb
8805 reduced in memory usage.
8807 Replace all calls to `new ArrayList' with `new
8808 ArrayList(4)' which is a good average number for most allocations,
8809 and also requires only 16 bytes of memory for its buffer by
8812 This reduced MCS memory usage in seven megabytes for the RSS after
8815 2003-07-28 Ravi Pratap <ravi@ximian.com>
8817 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
8818 handle params methods the correct way by forming only one
8819 applicable set with params and normal methods in them. Earlier we
8820 were looking at params methods only if we found no normal methods
8821 which was not the correct thing to do.
8823 (Invocation.BetterFunction): Take separate arguments indicating
8824 when candidate and the best method are params methods in their
8827 This fixes bugs #43367 and #46199.
8829 * attribute.cs: Documentation updates.
8831 (CheckAttribute): Rename to CheckAttributeTarget.
8832 (GetValidPlaces): Rename to GetValidTargets.
8834 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
8835 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
8839 2003-07-28 Martin Baulig <martin@ximian.com>
8841 * class.cs (TypeContainer.DefineMembers): Use the base type's full
8842 name when looking up the base class of a nested class. Fixes #46977.
8844 2003-07-26 Martin Baulig <martin@ximian.com>
8846 * expression.cs (Indexers.Indexer): New nested struct; contains
8847 getter, setter and the indexer's type.
8848 (Indexers.Properties): This is now an ArrayList of
8850 (IndexerAccess.DoResolveLValue): Correctly set the type if the
8851 indexer doesn't have any getters.
8853 * assign.cs (Assign.DoResolve): Also do the implicit conversions
8854 for embedded property and indexer assignments.
8856 2003-07-26 Martin Baulig <martin@ximian.com>
8858 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
8859 preprocessor directive is not the first non-whitespace character
8862 2003-07-26 Martin Baulig <martin@ximian.com>
8864 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
8865 namespace parsing, follow the spec more closely.
8867 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
8868 NamespaceEntry.Lookup().
8870 2003-07-25 Martin Baulig <martin@ximian.com>
8872 * MethodCore.cs (OverridesSomething): New public field; it's set
8873 from TypeContainer.DefineMembers if this method overrides
8874 something (which doesn't need to be a method). Fix #39462.
8876 2003-07-25 Ravi Pratap <ravi@ximian.com>
8878 * typemanager.cs (GetMembers): Ensure that the list of members is
8879 reversed. This keeps things in sync.
8881 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
8882 find an AttributeUsage attribute.
8884 * expression.cs (Invocation.OverloadResolve): Perform the check
8885 which disallows Invoke to be directly called on a Delegate.
8887 (Error_InvokeOnDelegate): Report error cs1533.
8889 2003-07-25 Martin Baulig <martin@ximian.com>
8891 * expression.cs (Indexers.GetIndexersForType): Only look in the
8892 interface hierarchy if the requested type is already an
8893 interface. Fixes #46788 while keeping #46502 fixed.
8895 2003-07-25 Martin Baulig <martin@ximian.com>
8897 * class.cs (TypeContainer.DefineMembers): Check whether all
8898 readonly fields have been assigned and report warning CS0649 if
8901 * statement.cs (LocalInfo.IsFixed): Always return true if this is
8904 2003-07-24 Ravi Pratap <ravi@ximian.com>
8906 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
8907 returned from GetMethods to make things consistent with the
8908 assumptions MCS makes about ordering of methods.
8910 This should comprehensively fix bug #45127 and it does :-)
8912 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
8913 ordering is actually reverse.
8915 * Clean up some debug messages I left lying around.
8917 * interface.cs (Populate*): Get rid of code which emits attributes
8918 since the stage in which we emit attributes is the 'Emit' stage,
8919 not the define stage.
8921 (Emit): Move attribute emission for interface members here.
8923 2003-07-22 Ravi Pratap <ravi@ximian.com>
8925 * expression.cs (Invocation.OverloadResolve): Follow the spec more
8926 closely: we eliminate methods in base types when we have an
8927 applicable method in a top-level type.
8929 Please see section 14.5.5.1 for an exact description of what goes
8932 This fixes bug #45127 and a host of other related to corlib compilation.
8934 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
8935 array is the method corresponding to the top-level type (this is
8936 because of the changes made to icall.c) so we change this
8939 (MethodGroupExpr.Name): This too.
8941 * typemanager.cs (GetElementType): New method which does the right
8942 thing when compiling corlib.
8944 * everywhere: Make use of the above in the relevant places.
8946 2003-07-22 Martin Baulig <martin@ximian.com>
8948 * cs-parser.jay (invocation_expression): Moved
8949 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
8950 `cast_expression', but create a InvocationOrCast which later
8951 resolves to either an Invocation or a Cast.
8953 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
8954 method; call this before EmitStatement() to make sure that this
8955 expression can be used as a statement.
8957 * expression.cs (InvocationOrCast): New class; resolves to either
8958 an Invocation or a Cast.
8960 * statement.cs (StatementExpression): Call ResolveStatement() on
8961 the ExpressionStatement before emitting it.
8963 2003-07-21 Martin Baulig <martin@ximian.com>
8965 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
8966 `ref' and `out' attributes match; fixes #46220.
8967 (MemberAccess.ResolveMemberAccess): You can't reference a type
8968 through an expression; fixes #33180.
8969 (Indexers.GetIndexersForType): Don't return the indexers from
8970 interfaces the class implements; fixes #46502.
8972 2003-07-21 Martin Baulig <martin@ximian.com>
8974 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
8975 CS0661 checks; fixes bug #30442.
8977 2003-07-21 Martin Baulig <martin@ximian.com>
8979 * decl.cs (AdditionResult): Added `Error'.
8981 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
8983 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
8984 makes cs0031.cs actually work.
8986 2003-07-20 Martin Baulig <martin@ximian.com>
8988 * namespace.cs: Fixed that bug which caused a crash when compiling
8991 2003-07-20 Miguel de Icaza <miguel@ximian.com>
8993 * typemanager.cs (LookupTypeReflection): Never expose types which
8994 are NotPublic, NestedPrivate, NestedAssembly, or
8995 NestedFamANDAssem. We used to return these, and later do a check
8996 that would report a meaningful error, but the problem is that we
8997 would not get the real match, if there was a name override.
8999 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9001 * namespace.cs (Namespace, Name): Do not compute the namespace
9002 name dynamically, compute it in the constructor. This reduced
9003 memory usage by 1697 KB.
9005 * driver.cs: Use --pause to pause at the end.
9007 2003-07-17 Peter Williams <peter@newton.cx>
9009 * Makefile: Change the name of the test target so that it doesn't
9010 conflict with the recursive test target.
9012 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9014 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9015 AddressOf): Do not use EmitThis, that was wrong, use the actual
9018 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9020 * class.cs (MethodData.Define): While checking if a method is an
9021 interface implementation, improve the test: If we are not public
9022 (use new test here: use the computed MethodAttributes directly,
9023 instead of the parsed modifier flags) check if the `implementing'
9024 method comes from an interface or not.
9026 * pending.cs (VerifyPendingMethods): Slightly better error
9029 * makefile: add test target that does the mcs bootstrap.
9031 2003-07-16 Ravi Pratap <ravi@ximian.com>
9033 * interface.cs (Define): Do nothing here since there are no
9034 members to populate etc. Move the attribute emission out of here
9035 since this was just totally the wrong place to put it. Attribute
9036 application happens during the 'Emit' phase, not in the 'Define'
9039 (Emit): Add this method and move the attribute emission here
9041 * rootcontext.cs (EmitCode): Call the Emit method on interface
9044 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9046 * expression.cs (OverloadResolve): Report error only if Location
9047 is not 'Null' which means that there was a probe going on.
9049 2003-07-14 Martin Baulig <martin@ximian.com>
9051 * expression.cs (ConditionalLogicalOperator): New public class to
9052 implement user defined conditional logical operators.
9053 This is section 14.11.2 in the spec and bug #40505.
9055 2003-07-14 Martin Baulig <martin@ximian.com>
9057 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
9059 2003-07-14 Martin Baulig <martin@ximian.com>
9061 * codegen.cs (EmitContext.InFixedInitializer): New public field.
9063 * ecore.cs (IVariable.VerifyFixed): New interface method.
9065 * expression.cs (Unary.ResolveOperator): When resolving the `&'
9066 operator, check whether the variable is actually fixed. Fixes bug
9067 #36055. Set a variable definitely assigned when taking its
9068 address as required by the spec.
9070 * statement.cs (LocalInfo.IsFixed): New field.
9071 (LocalInfo.MakePinned): Set `IsFixed' to true.
9073 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9075 * attribute.cs (Attribute.Resolve): While doing a Member lookup
9076 for .ctors, ensure that we only ask for members declared in the
9077 attribute type (BindingFlags.DeclaredOnly).
9081 * expression.cs (Error_WrongNumArguments): Report error 1501
9082 correctly the way CSC does.
9084 2003-07-13 Martin Baulig <martin@ximian.com>
9086 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
9087 lookup on the fully qualified name, to make things like "X.X" work
9088 where "X.X" is a fully qualified type name, but we also have a
9089 namespace "X" in the using list. Fixes #41975.
9091 2003-07-13 Martin Baulig <martin@ximian.com>
9093 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
9094 function. If we're a CompoundAssign, we need to create an embedded
9095 CompoundAssign, not an embedded Assign.
9096 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
9099 2003-07-13 Martin Baulig <martin@ximian.com>
9101 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
9102 work to fix bug #46088.
9104 2003-07-13 Ravi Pratap <ravi@ximian.com>
9106 * class.cs (Operator.Emit): Do not emit attributes here - it is
9107 taken care of by the Method class that we delegate too. This takes
9110 2003-07-10 Martin Baulig <martin@ximian.com>
9112 * expression.cs (TypeOfVoid): New class.
9113 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
9115 2003-07-10 Martin Baulig <martin@ximian.com>
9117 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
9120 2003-07-10 Martin Baulig <martin@ximian.com>
9122 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
9123 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
9125 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
9127 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
9129 2003-07-10 Martin Baulig <martin@ximian.com>
9131 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
9132 of decimal. Fixes #42850.
9134 NOTE: I also fixed the created byte blob, but this doesn't work on
9135 the MS runtime and csc never produces any byte blobs for decimal
9138 2003-07-10 Martin Baulig <martin@ximian.com>
9140 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
9141 structs; fixes #32068.
9142 (Block.AddChildVariableNames): Fixed #44302.
9144 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9146 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
9148 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9150 * attribute.cs: And this test is onger needed.
9152 2003-07-08 Martin Baulig <martin@ximian.com>
9154 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
9155 inaccessible types. Fixes #36313.
9157 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
9159 * namespace.cs (NamespaceEntry): Create implicit entries for all
9160 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
9161 implicit entries for N1.N2 and N1.
9163 2003-07-08 Martin Baulig <martin@ximian.com>
9165 Rewrote the handling of namespaces to fix a lot of the issues
9166 wrt. `using' aliases etc.
9168 * namespace.cs (Namespace): Splitted this class into a
9169 per-assembly `Namespace' and a per-file `NamespaceEntry'.
9171 * typemanager.cs (TypeManager.IsNamespace): Removed.
9172 (TypeManager.ComputeNamespaces): Only compute namespaces from
9173 loaded assemblies here, not the namespaces from the assembly we're
9174 currently compiling.
9176 2003-07-08 Martin Baulig <martin@ximian.com>
9178 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
9180 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9182 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
9185 I thought about the memory savings here, but LookupTypeReflection
9186 is used under already very constrained scenarios. Compiling
9187 corlib or mcs only exposes one hit, so it would not really reduce
9188 any memory consumption.
9190 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9192 * typemanager.cs: fixes bug #45889 by only adding public types from
9193 other assemblies to the list of known types.
9195 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9197 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
9198 on the type we resolved.
9200 2003-07-05 Martin Baulig <martin@ximian.com>
9202 * pending.cs (PendingImplementation.ParentImplements): Don't
9203 create the proxy if the parent is abstract.
9205 * class.cs (TypeContainer.DefineIndexers): Process explicit
9206 interface implementations first. Fixes #37714.
9208 2003-07-04 Miguel de Icaza <miguel@ximian.com>
9210 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
9211 defined recursively; but since we modify the input parameters
9212 (left is set to `this' temporarily), we reset this value if the
9213 left_is_explicit is false, which gives the original semantics to
9216 * literal.cs (NullPointer): new class used to represent a null
9217 literal in a pointer context.
9219 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
9220 type is a pointer, use a NullPointer object instead of a
9221 NullLiteral. Closes 43687
9223 (ExplicitConversion): Convert pointer values using
9224 the conv opcode to the proper type.
9226 * ecore.cs (New): change ValueTypeVariable property into a method,
9227 that returns whether the valuetype is suitable for being used.
9229 * expression.cs (Binary.DoNumericPromotions): Only return if we
9230 the int constant was a valid uint, and we can return both left and
9231 right as uints. If not, we continue processing, to trigger the
9232 type conversion. This fixes 39018.
9234 * statement.cs (Block.EmitMeta): During constant resolution, set
9235 the CurrentBlock property on the emitcontext, so that we resolve
9236 constants propertly.
9238 2003-07-02 Martin Baulig <martin@ximian.com>
9240 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
9241 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
9243 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
9244 than emitting it here.
9246 * statement.cs: Fixed some more flow analysis bugs.
9248 2003-07-02 Martin Baulig <martin@ximian.com>
9250 * class.cs (MethodData.Define): When implementing interface
9251 methods, set Final unless we're Virtual.
9253 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
9254 check work for interface methods.
9256 2003-07-01 Martin Baulig <martin@ximian.com>
9258 * ecore.cs (EmitContext.This): Replaced this property with a
9259 GetThis() method which takes a Location argument. This ensures
9260 that we get the correct error location for a CS0188.
9262 2003-07-01 Miguel de Icaza <miguel@ximian.com>
9264 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
9265 ImplicitStandardConversion.
9267 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
9269 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
9271 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
9274 2003-06-30 Miguel de Icaza <miguel@ximian.com>
9276 * class.cs (Constructor.Define): Turn off initlocals for unsafe
9279 (MethodData.Define): Turn off initlocals for unsafe methods.
9281 2003-06-29 Miguel de Icaza <miguel@ximian.com>
9283 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
9284 complete; Fixes #37521.
9286 * delegate.cs: Use Modifiers.TypeAttr to compute the
9287 TypeAttributes, instead of rolling our own. This makes the flags
9288 correct for the delegates.
9290 2003-06-28 Miguel de Icaza <miguel@ximian.com>
9292 * class.cs (Constructor.Define): Set the private flag for static
9293 constructors as well.
9295 * cs-parser.jay (statement_expression): Set the return value to
9296 null, to avoid a crash when we catch an error.
9298 2003-06-24 Miguel de Icaza <miguel@ximian.com>
9300 * cs-parser.jay: Applied patch from Jackson that adds support for
9301 extern and unsafe modifiers to destructor declarations.
9303 * expression.cs: Report error 21 if the user is trying to index a
9306 * driver.cs: Add an error message, suggested by the bug report.
9308 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
9309 if we do not have a ": this ()" constructor initializer. Fixes 45149
9311 2003-06-14 Miguel de Icaza <miguel@ximian.com>
9313 * namespace.cs: Add some information to reduce FAQs.
9315 2003-06-13 Miguel de Icaza <miguel@ximian.com>
9317 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
9318 underlying enumeration types. Fixes #43915.
9320 * expression.cs: Treat ushort/short as legal values to be used in
9323 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
9325 * delegate.cs: transfer custom attributes for paramenters from
9326 the delegate declaration to Invoke and BeginInvoke.
9328 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
9330 * attribute.cs: handle custom marshalers and emit marshal info
9333 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
9335 * makefile.gnu: Added anonymous.cs to the compiler sources.
9337 2003-05-28 Miguel de Icaza <miguel@ximian.com>
9339 * iterators.cs: Change the name of the proxy class to include two
9342 * cs-parser.jay: Update grammar to include anonymous methods.
9344 * anonymous.cs: new file.
9346 2003-05-27 Miguel de Icaza <miguel@ximian.com>
9348 * class.cs (Field.Define): Add missing test for pointers and
9351 2003-05-27 Ravi Pratap <ravi@ximian.com>
9353 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
9354 we use the stobj opcode.
9356 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
9357 since it wasn't the correct fix.
9359 It still is puzzling that we are required to use stobj for IntPtr
9360 which seems to be a ValueType.
9362 2003-05-26 Miguel de Icaza <miguel@ximian.com>
9364 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
9365 during regular simple name resolution. Now, the trick is that
9366 instead of returning for processing the simplename, we do a
9367 TypeManager.LookupType (ie, a rooted lookup as opposed to a
9368 contextual lookup type). If a match is found, return that, if
9369 not, return for further composition.
9371 This fixes long-standing 30485.
9373 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9374 using the address to initialize an object, do an Stobj instead of
9375 using the regular Stelem.
9377 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
9378 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
9379 Because if we are a BaseIndexerAccess that value will be true.
9382 * statement.cs (GotoCase.Resolve): Return after reporting an
9383 error, do not attempt to continue.
9385 * expression.cs (PointerArithmetic.Emit): If our operand is a
9386 long, convert our constants to match the operand before
9387 multiplying. Convert to I type before adding. Fixes 43670.
9389 2003-05-14 Ravi Pratap <ravi@ximian.com>
9391 * enum.cs (ImplicitConversionExists) : Rename to
9392 ImplicitEnumConversionExists to remove ambiguity.
9394 * ecore.cs (NullCast): New type of cast expression class which
9395 basically is very similar to EmptyCast with the difference being
9396 it still is a constant since it is used only to cast a null to
9400 * convert.cs (ImplicitReferenceConversion): When casting a null
9401 literal, we return a NullCast.
9403 * literal.cs (NullLiteralTyped): Remove - I don't see why this
9404 should be around anymore.
9406 The renaming (reported was slightly wrong). Corrections:
9408 ConvertImplicitStandard -> ImplicitConversionStandard
9409 ConvertExplicitStandard -> ExplicitConversionStandard
9411 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
9412 before passing them in !
9414 * convert.cs (ImplicitConversionStandard): When comparing for
9415 equal expr and target types, ensure that expr is not a
9418 In general, we must not be checking (expr_type ==
9419 target_type) in the top level conversion methods
9420 (ImplicitConversion, ExplicitConversion etc). This checking is
9421 done in the methods that they delegate to.
9423 2003-05-20 Miguel de Icaza <miguel@ximian.com>
9425 * convert.cs: Move Error_CannotConvertType,
9426 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
9427 ImplicitNumericConversion, ImplicitConversionExists,
9428 ImplicitUserConversionExists, StandardConversionExists,
9429 FindMostEncompassedType, FindMostSpecificSource,
9430 FindMostSpecificTarget, ImplicitUserConversion,
9431 ExplicitUserConversion, GetConversionOperators,
9432 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
9433 TryImplicitIntConversion, Error_CannotConvertImplicit,
9434 ConvertImplicitRequired, ConvertNumericExplicit,
9435 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
9436 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
9439 Perform the following renames:
9441 StandardConversionExists -> ImplicitStandardConversionExists
9442 ConvertImplicit -> ImplicitConversion
9443 ConvertImplicitStandard -> ImplicitStandardConversion
9444 TryImplicitIntConversion -> ImplicitIntConversion
9445 ConvertImplicitRequired -> ImplicitConversionRequired
9446 ConvertNumericExplicit -> ExplicitNumericConversion
9447 ConvertReferenceExplicit -> ExplicitReferenceConversion
9448 ConvertExplicit -> ExplicitConversion
9449 ConvertExplicitStandard -> ExplicitStandardConversion
9451 2003-05-19 Martin Baulig <martin@ximian.com>
9453 * statement.cs (TypeInfo.StructInfo): Made this type protected.
9454 (TypeInfo): Added support for structs having structs as fields.
9456 * ecore.cs (FieldExpr): Implement IVariable.
9457 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
9458 VariableInfo for the field.
9460 2003-05-18 Martin Baulig <martin@ximian.com>
9462 * expression.cs (This.DoResolve): Report a CS0027 if we're
9463 emitting a field initializer.
9465 2003-05-18 Martin Baulig <martin@ximian.com>
9467 * expression.cs (This.ResolveBase): New public function.
9468 (This.DoResolve): Check for CS0188.
9470 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
9473 * ecore.cs (MethodGroupExpr.DoResolve): Set the
9474 `instance_expression' to null if we don't have any non-static
9477 2003-05-18 Martin Baulig <martin@ximian.com>
9479 Reworked the way how local variables and parameters are handled by
9480 the flow analysis code.
9482 * statement.cs (TypeInfo, VariableMap): New public classes.
9483 (VariableInfo): New public class. This is now responsible for
9484 checking whether a variable has been assigned. It is used for
9485 parameters and local variables.
9486 (Block.EmitMeta): Take the InternalParameters as argument; compute
9487 the layout of the flow vectors here.
9488 (Block.LocalMap, Block.ParameterMap): New public properties.
9489 (FlowBranching): The .ctor doesn't get the InternalParameters
9490 anymore since Block.EmitMeta() now computes the layout of the flow
9492 (MyStructInfo): This class is now known as `StructInfo' and nested
9493 in `TypeInfo'; we don't access this directly anymore.
9495 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
9496 property and removed IsAssigned(), IsFieldAssigned(),
9497 SetAssigned() and SetFieldAssigned(); we now call them on the
9498 VariableInfo so we don't need to duplicate this code everywhere.
9500 * expression.cs (ParameterReference): Added `Block block' argument
9502 (LocalVariableReference, ParameterReference, This): The new
9503 VariableInfo class is now responsible for all the definite
9506 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
9507 IsParameterAssigned, SetParameterAssigned): Removed.
9509 2003-05-18 Martin Baulig <martin@ximian.com>
9511 * typemanager.cs (InitCoreTypes): Try calling
9512 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
9513 the 3-args-version. Corlib now also needs our `void_type'.
9514 (GetMethod): Added overloaded version which takes an optional
9515 `bool report_errors' to allow lookups of optional methods.
9517 2003-05-12 Martin Baulig <martin@ximian.com>
9519 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
9520 only used for locals and not for parameters.
9522 2003-05-12 Miguel de Icaza <miguel@ximian.com>
9524 * support.cs (InternalParameters.ParameterType): Return the
9525 ExternalType of the parameter.
9527 * parameter.cs (Parameter.ExternalType): drop the two arguments,
9530 2003-05-11 Miguel de Icaza <miguel@ximian.com>
9532 * class.cs (MethodData.Define): Do not set the `newslot' on
9533 interface members, if they are also flagged as "override".
9535 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
9536 better code for ++i and i++. This only works for static fields
9537 and local variables.
9539 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
9540 want to pull the DeclSpace out of the builder_to_declspace instead
9541 of the TypeBuilder (like in TypeContainer.FindMembers).
9543 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
9544 instead of LookupTypeContainer. Fixes the crash on .NET for
9545 looking up interface members.
9547 * const.cs: Create our own emit context during the Definition
9548 stage, so that constants are evaluated in the proper context, when
9549 a recursive definition happens.
9551 2003-05-11 Martin Baulig <martin@ximian.com>
9553 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
9554 new block for a switch section.
9555 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
9556 the adding/lookup in the switch block. Fixes #39828.
9558 2003-05-09 Miguel de Icaza <miguel@ximian.com>
9560 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
9561 functionality: I needed to convert the data after I had performed
9562 the add/sub operation into the operands type size.
9564 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
9565 pass the type for the box operation, otherwise the resulting
9566 object would have been of type object.
9568 (BoxedCast): Add constructor to specify the type to box as.
9570 2003-05-07 Miguel de Icaza <miguel@ximian.com>
9572 * iterators.cs: I was reusing the `count' variable inadvertently,
9573 take steps to not allow this to happen.
9575 2003-05-06 Miguel de Icaza <miguel@ximian.com>
9577 * attribute.cs (Attribute.Resolve): Params attributes are encoded
9578 by creating an array at the point where the params starts and
9579 putting all those arguments there, then adjusting the size of the
9582 2003-05-05 Miguel de Icaza <miguel@ximian.com>
9584 * expression.cs (New.AddressOf): Implement interface
9585 IMemoryLocation. This is used when the `new' operator is used in
9586 the context of an invocation to a method on a value type.
9588 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
9591 * namespace.cs: Also check the using aliases here.
9593 * driver.cs: Move the test for using validity after the types have
9594 been entered, so we do a single pass that also includes the using
9597 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
9598 in the regular case. CreateSiblingForFinally is doing extra
9601 * attribute.cs (GetAttributeArgumentExpression): Store the result
9602 on an out value, and use the return value to indicate failure
9603 instead of using null (which is a valid return for Constant.GetValue).
9605 * statement.cs: Perform the analysis flow for the increment
9606 portion after the statement, because this will be the real flow of
9607 execution. Fixes #42385
9609 * codegen.cs (EmitContext.EmitArgument,
9610 EmitContext.EmitStoreArgument): New helper functions when the
9611 RemapToProxy flag is set.
9613 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
9616 Add support for remapping parameters.
9618 * iterators.cs: Propagate parameter values; Store parameter
9619 values in the proxy classes.
9621 2003-05-04 Miguel de Icaza <miguel@ximian.com>
9623 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
9624 need a proxy reference; I do not know what I was thinking
9626 * cs-parser.jay (constructor_initializer): catch another error,
9627 and display nice message.
9629 (field_declaration): catch void field declaration
9630 to flag a better error.
9632 * class.cs (MemberBase.CheckBase): Report an error instead of a
9633 warning if a new protected member is declared in a struct.
9634 (Field.Define): catch the error of readonly/volatile.
9636 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
9638 (FieldExpr.AddressOf): ditto. Catch error where the address of a
9639 volatile variable is taken
9641 2003-05-02 Miguel de Icaza <miguel@ximian.com>
9643 * statement.cs (Fixed.Resolve): Report an error if we are not in
9646 2003-05-01 Miguel de Icaza <miguel@ximian.com>
9648 * typemanager.cs: reuse the code that handles type clashes for
9649 delegates and enumerations.
9651 * class.cs (Report28): Always report.
9653 * expression.cs (EncodeAsAttribute): Allow nulls here.
9655 2003-04-28 Miguel de Icaza <miguel@ximian.com>
9657 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
9658 the functionality for testing whether an expression is valid for
9659 an attribute here. Also handle the case of arrays of elements
9662 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
9663 encoding a linear array into an array of objects that are suitable
9664 to be passed to an CustomAttributeBuilder.
9666 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
9668 * ecore.cs: (FieldExpr): Handle field remapping here.
9670 * iteratators.cs: Pass the instance variable (if the method is an
9671 instance method) to the constructors, so we can access the field
9672 variables on the class.
9674 TODO: Test this with structs. I think the THIS variable on
9675 structs might have to be a pointer, and not a refenrece
9677 2003-04-27 Miguel de Icaza <miguel@ximian.com>
9679 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
9680 local variables to fields in a proxy class.
9682 * iterators.cs (PopulateProxy): Rename our internal fields to
9684 Create a <THIS> field if we are an instance method, so we can
9685 reference our parent container variables.
9686 (MapVariable): Called back from the EmitContext code to enter a
9687 new variable to field mapping into the proxy class (we just create
9691 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
9692 for using the remapped locals to fields.
9694 I placed the code here, because that gives the same semantics to
9695 local variables, and only changes the Emit code.
9697 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
9698 statements inside iterators.
9699 (VariableInfo): Add a FieldBuilder for the cases when we are
9700 remapping local variables to fields in a proxy class
9702 * ecore.cs (SimpleNameResolve): Avoid testing two times for
9703 current_block != null.
9705 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
9706 not cope with strings, as it has been moved to the
9707 TableSwitchEmit. Fixed bug in switch generation.
9709 * expression.cs (New.DoResolve): Provide more context for the user
9710 when reporting an error.
9712 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
9715 * expression.cs (MemberAccess.DoResolve): When we get a type back,
9716 check the permissions for it. Note than in a type-resolution
9717 context the check was already present in DeclSpace.ResolveType,
9718 but was missing from the MemberAccess.
9720 (ArrayCreation.CheckIndices): warn if the user has
9721 more nested levels of expressions, but there are no more
9722 dimensions specified. Avoids crash on bug 41906.
9724 2003-04-26 Miguel de Icaza <miguel@ximian.com>
9726 * statement.cs (Block): replace Implicit bool, for a generic
9728 New flag: `Unchecked'. This is used during the EmitMeta phase
9729 (which is out-of-line with the regular Resolve/Emit process for a
9730 statement, as this is done ahead of time, but still gets a chance
9731 to call constant resolve).
9733 (Block.Flags): new enum for adding a new flag.
9735 (Block.EmitMeta): track the state of unchecked.
9737 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
9738 to enable constant resolution to work there as well.
9740 2003-04-22 Miguel de Icaza <miguel@ximian.com>
9742 * typemanager.cs (ienumerable_type): Also look up
9743 System.Collections.IEnumerable.
9745 2003-04-21 Miguel de Icaza <miguel@ximian.com>
9747 TODO: Test more than one conditional per method.
9749 * class.cs (Indexer.Define): Report the location where the user is
9750 referencing the unsupported feature.
9752 (MethodData): Overload the use of `conditionals' to
9753 minimize the creation of needless ArrayLists. This saves roughly
9754 212kb on my machine.
9756 (Method): Implement the new IIteratorContainer interface.
9757 (Method.SetYields): Implement the method by setting the ModFlags
9758 to contain METHOD_YIELDS.
9760 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
9761 which just got set to null.
9763 * iterators.cs: New file.
9765 (Yield, YieldBreak): New statements.
9767 * statement.cs (Return.Resolve): Flag an error if we are used in
9770 * codegen.cs (InIterator): New flag set if the code is being
9771 compiled in an iterator method.
9773 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
9774 internal modifier, and we just use it to avoid adding extra
9775 fields, as this is seldom used.
9777 * cs-parser.jay: Add yield_statement (yield and yield break).
9779 * driver.cs: New flag -v2 to turn on version 2 features.
9781 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
9782 hashtable when v2 is enabled.
9784 2003-04-20 Miguel de Icaza <miguel@ximian.com>
9786 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
9787 there is already a namespace defined with this name.
9789 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
9790 people upgraded their corlibs.
9792 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
9793 always use fully qualified types, no need to use the compiler
9796 (TypeManager.IsNamespace): Use binarysearch.
9798 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
9799 AddDelegate): I did not quite use the new IsValid API properly: I
9800 have to pass the short-name and the fullname. I was passing only
9801 the basename instead of the fullname sometimes.
9803 (TypeContainer.DefineType): call NamespaceClash.
9805 * interface.cs (Interface.DefineType): use NamespaceClash before
9808 * delegate.cs (Delegate.DefineType): use NamespaceClash before
9811 * enum.cs: (Enum.DefineType): use NamespaceClash before
9814 * typemanager.cs (: 3-line patch that gives us some tasty 11%
9815 speed increase. First, use the negative_hits cache when we get a
9816 negative. Second, add the type with its full original name
9817 instead of the new . and + encoded name (reflection uses + to
9818 separate type from a nested type). Use LookupTypeReflection
9819 directly which bypasses the type->name hashtable (that we already
9820 know does not contain the type.
9822 * decl.cs (DeclSpace.ResolveTypeExpr): track the
9823 location/container type.
9825 * driver.cs: When passing utf8, use directly the UTF8Encoding.
9827 2003-04-19 Miguel de Icaza <miguel@ximian.com>
9829 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
9831 * delegate.cs (NewDelegate.Resolve): Test whether an instance
9832 method is being referenced in the method group from a static
9833 context, and report error 120 if so.
9835 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
9838 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
9839 is created, we create the A namespace).
9841 * cs-parser.jay: A namespace also introduces a DeclarationFound.
9844 2003-04-18 Miguel de Icaza <miguel@ximian.com>
9846 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
9847 invocation to ModuleBuilder.GetType with the same values will
9848 return a new type instance, so we need to cache its return
9851 * expression.cs (Binary.ResolveOperator): Only allow the compare
9852 operators on enums if they are of the same type.
9854 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
9855 types of ValueType on their own case. Before we were giving them
9856 the same treatment as objects.
9858 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
9859 fullname. Short name is used to compare against container name.
9860 Fullname is used to check against defined namespace names.
9862 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
9863 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
9865 (Method.CheckBase): Call parent.
9866 (MemberBase.CheckBase): Check for protected members on sealed
9868 (PropertyBase.CheckBase): Call parent.
9869 (Field.Define): Call parent.
9871 * report.cs: Negative error codes are now mapped to 8000 - code,
9872 so that the display is render more nicely.
9874 * typemanager.cs: Do not use try/catch, instead report a regular
9877 (GetPointerType, GetReferenceType): These methods provide
9878 mechanisms to obtain the T* and T& from a T. We had the code
9879 previously scattered around the code base, and it also used
9880 TypeManager.LookupType that would go through plenty of caches.
9881 This one goes directly to the type source.
9883 In some places we did the Type.GetType followed by
9884 ModuleBuilder.GetType, but not in others, so this unifies the
9887 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
9888 statements now that we have namespace information.
9890 * typemanager.cs (IsNamespace): New method, returns whether the
9891 string presented is a namespace or not.
9893 (ComputeNamespaces): New public entry point, computes the list of
9894 available namespaces, using the GetNamespaces API call in Mono, or
9895 the slower version in MS.NET.
9897 Now before we start the semantic analysis phase, we have a
9898 complete list of namespaces including everything that the user has
9901 Deleted old code to cache namespaces in .nsc files.
9903 2003-04-17 Miguel de Icaza <miguel@ximian.com>
9905 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
9906 class/struct location definition Location for the implicit
9907 constructor location.
9909 (Operator.Define): Use the location of the operator for the
9910 implicit Method definition.
9912 (Constructor.Emit): use the constructor location for the implicit
9913 base initializer constructor.
9915 * ecore.cs: Remove ITypeExpression. This interface is now gone,
9916 and the Expression class now contains two new methods:
9918 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
9919 isolate type lookup from the rest of the resolution process.
9921 Since we use Expressions to hold type definitions due to the way
9922 we parse the input we have historically overloaded Resolve to
9923 perform the Type lookups if a special flag is passed. Now this is
9924 eliminated and two methods take their place.
9926 The differences in the two methods between xStep and xTerminal is
9927 that xStep is involved in our current lookup system that uses
9928 SimpleNames to compose a name, while xTerminal is used just to
9929 catch the case where the simplename lookup failed.
9931 2003-04-16 Miguel de Icaza <miguel@ximian.com>
9933 * expression.cs (ResolveMemberAccess): Remove redundant code.
9934 TypeExpr expressions are always born fully resolved.
9936 * interface.cs (PopulateMethod): Do not lookup the types twice.
9937 We were doing it once during SemanticAnalysis and once during
9940 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
9941 in local variable type definitions, were being returned as a
9942 SimpleName (we decomposed everything into a string), that is
9943 because primary_expression was being used instead of a type in the
9944 grammar (reduce/reduce conflicts).
9946 The part that was wrong is that we converted the expression into a
9947 string (an oversimplification in one hand, compounded with primary
9948 expressions doing string concatenation).
9954 Would return "A.B.C[]" as a SimpleName. This stopped things like
9955 using clauses from working on this particular context. And a type
9956 was being matched directly against "A.B.C[]".
9958 We now use the correct approach, and allow for ComposedCast to be
9959 part of the unary expression. So the "A.B.C []" become a composed
9960 cast of "A.B.C" (as a nested group of MemberAccess with a
9961 SimpleName at the end) plus the rank composition "[]".
9965 2003-04-10 Miguel de Icaza <miguel@ximian.com>
9967 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
9968 for the access level checking.
9970 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
9971 `TypeContainer container', because I kept getting confused when I
9972 was debugging this code.
9974 * expression.cs (Indexers): Instead of tracking getters/setters,
9975 we now track them in parallel. We create one arraylist less, but
9976 most importantly it is possible now for the LValue code to find a
9977 matching get for a set.
9979 (IndexerAccess.DoResolveLValue): Update the code.
9980 GetIndexersForType has been modified already to extract all the
9981 indexers from a type. The code assumed it did not.
9983 Also make the code set the correct return type for the indexer.
9984 This was fixed a long time ago for properties, but was missing for
9985 indexers. It used to be void_type.
9987 (Binary.Emit): Test first for doubles instead of
9988 floats, as they are more common.
9990 (Binary.EmitBranchable): Use the .un version of the branch opcodes
9991 when dealing with floats and the <=, >= operators. This fixes bug
9994 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
9995 to load the array value by emitting a load on the foreach variable
9996 type. This was incorrect.
9998 We now emit the code to load an element using the the array
9999 variable type, and then we emit the conversion operator.
10003 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10005 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10007 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10009 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10010 test for protection before we test for signatures.
10012 (MethodSignature.ToString): implement.
10014 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10015 to the case where we reduced into a LongConstant.
10017 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10018 depend on whether the information is acurrate, because the
10019 Microsoft runtime will always claim that the array type is public,
10020 regardless of the real state.
10022 If the type is a pointer, another problem happens: the type is
10023 reported as non-public in Microsoft.
10025 In both cases we have to call CheckAccessLevel recursively with
10026 the underlying type as the argument to be tested.
10028 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10030 * assign.cs (Assign.Emit): If we are dealing with a compound
10031 assignment expression, we should use the code path that stores the
10032 intermediate result in a temporary value. This fixes #40903.
10034 *expression.cs (Indirection.ToString): Provide ToString method for
10037 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10039 * class.cs: Null out fields holding references to Block objects so
10040 they can be garbage collected.
10042 * expression.cs (OverloadResolve): Remove unused local.
10044 2003-04-07 Martin Baulig <martin@ximian.com>
10046 * codegen.cs (EmitContext.CurrentFile): New public field.
10047 (EmitContext.Mark): Use the CurrentFile to check whether the
10048 location is in the correct file.
10049 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
10051 2003-04-07 Martin Baulig <martin@ximian.com>
10053 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
10055 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
10056 location. [FIXME: The location argument which gets passed to this
10057 method is sometimes wrong!]
10059 2003-04-07 Nick Drochak <ndrochak@gol.com>
10061 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
10063 2003-04-07 Miguel de Icaza <miguel@ximian.com>
10065 * expression.cs (Indirection.EmitAssign): We were using the
10066 temporary, but returning immediately instead of continuing the
10069 2003-04-06 Martin Baulig <martin@ximian.com>
10071 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
10072 if it's a nested child, but also deriving from the outer class.
10075 * typemanager.cs (IsNestedChildOf): Make this work if it's a
10076 nested child, but also deriving from the outer class. See
10078 (FilterWithClosure): We may access private members of the outer
10079 class if we're a nested child and deriving from the outer class.
10080 (RealMemberLookup): Only set `closure_private_ok' if the
10081 `original_bf' contained BindingFlags.NonPublic.
10083 2003-04-05 Martin Baulig <martin@ximian.com>
10085 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
10087 2003-04-02 Miguel de Icaza <miguel@ximian.com>
10089 * class.cs (Event.Define): Do not allow abstract events to have
10092 2003-04-01 Miguel de Icaza <miguel@ximian.com>
10094 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
10095 block in event declarations.
10097 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
10098 value type, get its address.
10100 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
10101 leaving a class on the stack instead of a boolean value (int
10102 0/1). Change the code so we compare against null, and then the
10103 result against zero.
10105 * class.cs (TypeContainer.GetClassBases): We were checking for the
10106 parent class being sealed too late.
10108 * expression.cs (Binary.Emit): For <= and >= when dealing with
10109 floating point values, use cgt.un and clt.un instead of cgt and
10112 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
10114 * statement.cs: Apply the same optimization as MS: skip the
10115 GetEnumerator returning an IEnumerator, and use the one returning a
10116 CharEnumerator instead. This allows us to avoid the try-finally block
10119 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
10121 * cs-parser.jay: Attributes cannot be applied to
10122 namespaces. Fixes #40473
10124 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10127 (Add*): check if the name is valid using the full name for constants,
10128 fields, properties and events.
10130 2003-03-28 Miguel de Icaza <miguel@ximian.com>
10132 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
10133 char constants to be part of the enumeration.
10135 * expression.cs (Conditional.DoResolve): Add support for operator
10136 true. Implements the missing functionality from 14.12
10138 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
10139 operator true/false as required by the spec.
10141 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
10142 implicit conversion to boolean.
10144 * statement.cs (Statement.ResolveBoolean): A boolean expression is
10145 also one where the type implements `operator true'.
10147 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
10148 get an expression that will invoke operator true based on an
10151 (GetConversionOperators): Removed the hack that called op_True
10154 (Expression.ResolveBoolean): Move this from Statement.
10156 2003-03-17 Miguel de Icaza <miguel@ximian.com>
10158 * ecore.cs (FieldExpr): do not allow initialization of initonly
10159 fields on derived classes
10161 2003-03-13 Martin Baulig <martin@ximian.com>
10163 * statement.cs (Block.Emit): Call ig.BeginScope() and
10164 ig.EndScope() when compiling with debugging info; call
10165 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
10167 2003-03-08 Miguel de Icaza <miguel@ximian.com>
10169 * expression.cs (Indexers): Do not construct immediately, allow
10170 for new members to be appended as we go. Fixes 38143
10172 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10174 * expression.cs: save/restore context when resolving an unchecked
10177 2003-03-05 Miguel de Icaza <miguel@ximian.com>
10179 * cfold.cs: Catch division by zero in modulus operator during
10182 2003-03-03 Miguel de Icaza <miguel@ximian.com>
10184 * interface.cs (Interface.DefineMembers): Avoid defining members
10187 2003-02-27 Miguel de Icaza <miguel@ximian.com>
10189 * driver.cs: handle the +/- options for -noconfig
10191 * statement.cs (Unckeched.Resolve): Also track the state of
10192 unchecked in the Resolve phase.
10194 2003-02-27 Martin Baulig <martin@ximian.com>
10196 * ecore.cs (Expression.MemberLookup): Don't create a
10197 MethodGroupExpr for something which is not a method. Fixes #38291.
10199 2003-02-25 Miguel de Icaza <miguel@ximian.com>
10201 * class.cs (MemberBase.CheckParameters): Also check that the type
10202 is unmanaged if it is a pointer.
10204 * expression.cs (SizeOf.Resolve): Add location information.
10206 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
10207 a managed type is declared.
10209 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
10210 parameter modifiers as well. Fixes bug 38606
10212 * class.cs: Very sad. Am backing out the speed up changes
10213 introduced by the ArrayList -> Array in the TypeContainer, as they
10214 were not actually that much faster, and introduced a bug (no error
10215 reports on duplicated methods).
10217 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
10218 source first, this will guarantee that we have a valid expression
10219 before calling in lower levels functions that will require a
10220 resolved object. Then use this original_source in the
10221 target.ResolveLValue instead of the original source that was
10224 Another change. Use target.Resolve instead of LValueResolve.
10225 Although we are resolving for LValues, we will let the Assign code
10226 take care of that (it will be called again from Resolve). This
10227 basically allows code like this:
10229 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
10230 class Y { void A (X x) { x [0] += o; }
10232 The problem was that the indexer was trying to resolve for
10233 set_Item (idx, object o) and never finding one. The real set_Item
10234 was set_Item (idx, X). By delaying the process we get the right
10239 2003-02-23 Martin Baulig <martin@ximian.com>
10241 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
10242 while calling DoEmit ().
10244 * codegen.cs (EmitContext.Mark): Don't mark locations in other
10245 source files; if you use the #line directive inside a method, the
10246 compiler stops emitting line numbers for the debugger until it
10247 reaches the end of the method or another #line directive which
10248 restores the original file.
10250 2003-02-23 Martin Baulig <martin@ximian.com>
10252 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
10254 2003-02-23 Martin Baulig <martin@ximian.com>
10256 * statement.cs (Block.AddChildVariableNames): We need to call this
10257 recursively, not just for our immediate children.
10259 2003-02-23 Martin Baulig <martin@ximian.com>
10261 * class.cs (Event.Define): Always make the field private, like csc does.
10263 * typemanager.cs (TypeManager.RealMemberLookup): Make events
10264 actually work, fixes bug #37521.
10266 2003-02-23 Miguel de Icaza <miguel@ximian.com>
10268 * delegate.cs: When creating the various temporary "Parameters"
10269 classes, make sure that we call the ComputeAndDefineParameterTypes
10270 on those new parameters (just like we do with the formal ones), to
10271 allow them to be resolved in the context of the DeclSpace.
10273 This fixes the bug that Dick observed in Bugzilla #38530.
10275 2003-02-22 Miguel de Icaza <miguel@ximian.com>
10277 * expression.cs (ResolveMemberAccess): When resolving a constant,
10278 do not attempt to pull a constant if the value was not able to
10279 generate a valid constant.
10281 * const.cs (LookupConstantValue): Do not report more errors than required.
10283 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10285 * expression.cs: fixes bug #38328.
10287 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10289 * class.cs: Changed all the various members that can be part of a
10290 class from being an ArrayList to be an Array of the right type.
10291 During the DefineType type_list, interface_list, delegate_list and
10292 enum_list are turned into types, interfaces, delegates and enums
10295 And during the member population, indexer_list, event_list,
10296 constant_list, field_list, instance_constructor_list, method_list,
10297 operator_list and property_list are turned into their real arrays.
10299 Although we could probably perform this operation earlier, for
10300 good error reporting we need to keep the lists and remove the
10301 lists for longer than required.
10303 This optimization was triggered by Paolo profiling the compiler
10304 speed on the output of `gen-sample-program.pl' perl script.
10306 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
10307 not crash in methods like MemberLookupFailed that use this field.
10309 This problem arises when the compiler fails to resolve a type
10310 during interface type definition for example.
10312 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10314 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
10315 inherit from System.Object, so we have to stop at null, not only
10316 when reaching System.Object.
10318 2003-02-17 Miguel de Icaza <miguel@ximian.com>
10320 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
10321 DeclaredOnly because the parent indexer might have had a different
10322 name, but did not loop until the top of the hierarchy was reached.
10324 The problem this one fixes is 35492: when a class implemented an
10325 indexer from an interface, we were getting the interface method
10326 (which was abstract) and we were flagging an error (can not invoke
10329 This also keeps bug 33089 functioning, and test-148 functioning.
10331 * typemanager.cs (IsSpecialMethod): The correct way of figuring
10332 out if a method is special is to see if it is declared in a
10333 property or event, or whether it is one of the predefined operator
10334 names. This should fix correctly #36804.
10336 2003-02-15 Miguel de Icaza <miguel@ximian.com>
10338 The goal here is to remove the dependency on EmptyCast.Peel ().
10339 Killing it completely.
10341 The problem is that currently in a number of places where
10342 constants are expected, we have to "probe" for an EmptyCast, and
10343 Peel, which is not the correct thing to do, as this will be
10344 repetitive and will likely lead to errors.
10346 The idea is to remove any EmptyCasts that are used in casts that
10347 can be reduced to constants, so we only have to cope with
10350 This bug hunt was triggered by Bug 37363 and the desire to remove
10351 the duplicate pattern where we were "peeling" emptycasts to check
10352 whether they were constants. Now constants will always be
10355 * ecore.cs: Use an enumconstant here instead of wrapping with
10358 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
10359 throwing me off. By handling this we can get rid of a few hacks.
10361 * statement.cs (Switch): Removed Peel() code.
10363 2003-02-14 Miguel de Icaza <miguel@ximian.com>
10365 * class.cs: Location information for error 508
10367 * expression.cs (New.DoResolve): Add a guard against double
10368 resolution of an expression.
10370 The New DoResolve might be called twice when initializing field
10371 expressions (see EmitFieldInitializers, the call to
10372 GetInitializerExpression will perform a resolve on the expression,
10373 and later the assign will trigger another resolution
10375 This leads to bugs (#37014)
10377 * delegate.cs: The signature for EndInvoke should contain any ref
10378 or out parameters as well. We were not doing this in the past.
10380 * class.cs (Field.Define): Do not overwrite the type definition
10381 inside the `volatile' group. Turns out that volatile enumerations
10382 were changing the type here to perform a validity test, which
10385 2003-02-12 Miguel de Icaza <miguel@ximian.com>
10387 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
10388 and structs, we do not want to load the instance variable
10390 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
10391 enum_type has to be handled like an object reference (implicit
10392 conversions exists from this to object), but the regular IsClass
10393 and IsValueType tests will never return true for this one.
10395 Also we use TypeManager.IsValueType instead of type.IsValueType,
10396 just for consistency with the rest of the code (this is only
10397 needed if we ever use the construct exposed by test-180.cs inside
10398 corlib, which we dont today).
10400 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
10402 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
10405 2003-02-09 Martin Baulig <martin@ximian.com>
10407 * namespace.cs (Namespace..ctor): Added SourceFile argument.
10408 (Namespace.DefineNamespaces): New static public method; this is
10409 called when we're compiling with debugging to add all namespaces
10410 to the symbol file.
10412 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
10413 pass it to the Namespace's .ctor.
10415 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
10416 and MethodBase arguments; pass the namespace ID to the symwriter;
10417 pass the MethodBase instead of the token to the symwriter.
10418 (SymbolWriter.DefineNamespace): New method to add a namespace to
10421 2003-02-09 Martin Baulig <martin@ximian.com>
10423 * symbolwriter.cs: New file. This is a wrapper around
10424 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
10425 methods here in near future.
10427 2003-02-09 Martin Baulig <martin@ximian.com>
10429 * codegen.cs (EmitContext.Mark): Just pass the arguments to
10430 ILGenerator.MarkSequencePoint() which are actually used by the
10433 2003-02-09 Martin Baulig <martin@ximian.com>
10435 * location.cs (SourceFile): New public sealed class. This
10436 contains the name and an index which is used in the location's token.
10437 (Location): Reserve an appropriate number of bits in the token for
10438 the source file instead of walking over that list, this gives us a
10439 really huge performance improvement when compiling with debugging.
10441 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
10442 `SourceFile' argument instead of a string.
10443 (Driver.ProcessFile): Add all the files via Location.AddFile(),
10444 but don't parse/tokenize here, we need to generate the list of all
10445 source files before we do that.
10446 (Driver.ProcessFiles): New static function. Parses/tokenizes all
10449 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
10450 instead of a string.
10452 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
10455 2003-02-09 Martin Baulig <martin@ximian.com>
10457 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
10458 filename on `#line default'.
10460 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
10462 * statement.cs: don't clear the pinned var when the fixed statement
10463 returns from the method (fixes bug#37752).
10465 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
10467 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
10470 2003-02-07 Martin Baulig <martin@ximian.com>
10472 * driver.cs: Removed the `--debug-args' command line argument.
10474 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
10475 automatically by the AsssemblyBuilder.
10476 (CodeGen.InitializeSymbolWriter): We don't need to call any
10477 initialization function on the symbol writer anymore. This method
10478 doesn't take any arguments.
10480 2003-02-03 Miguel de Icaza <miguel@ximian.com>
10482 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
10483 from referenced assemblies as well.
10485 2003-02-02 Martin Baulig <martin@ximian.com>
10487 * class.cs (MethodData.Emit): Generate debugging info for external methods.
10489 2003-02-02 Martin Baulig <martin@ximian.com>
10491 * class.cs (Constructor.Emit): Open the symbol writer before
10492 emitting the constructor initializer.
10493 (ConstructorInitializer.Emit): Call ec.Mark() to allow
10494 single-stepping through constructor initializers.
10496 2003-01-30 Miguel de Icaza <miguel@ximian.com>
10498 * class.cs: Handle error 549: do not allow virtual methods in
10501 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
10503 * decl.cs: Check access levels when resolving types
10505 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
10507 * statement.cs: Add parameters and locals set in catch blocks that might
10508 return to set vector
10510 2003-01-29 Miguel de Icaza <miguel@ximian.com>
10512 * class.cs (Operator): Set the SpecialName flags for operators.
10514 * expression.cs (Invocation.DoResolve): Only block calls to
10515 accessors and operators on SpecialName methods.
10517 (Cast.TryReduce): Handle conversions from char constants.
10520 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
10522 * statement.cs: small memory and time optimization in FlowBranching.
10524 2003-01-28 Pedro Mart <yoros@wanadoo.es>
10526 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
10527 problem that the last fix but in the other sid (Set).
10529 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
10530 access when there is no indexer in the hierarchy.
10532 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
10534 * class.cs: Combine some if statements.
10536 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10538 * driver.cs: fixed bug #37187.
10540 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
10542 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
10543 any indexer, it's needed to build a list with all the indexers in the
10544 hierarchy (AllGetters), else we have problems. Fixes #35653.
10546 2003-01-23 Miguel de Icaza <miguel@ximian.com>
10548 * class.cs (MethodData.Define): It is wrong for an interface
10549 implementation to be static in both cases: explicit and implicit.
10550 We were only handling this in one case.
10552 Improve the if situation there to not have negations.
10554 * class.cs (Field.Define): Turns out that we do not need to check
10555 the unsafe bit on field definition, only on usage. Remove the test.
10557 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10559 * driver.cs: use assembly.Location instead of Codebase (the latest
10560 patch made mcs fail when using MS assemblies).
10562 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
10564 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
10565 get the path to *corlib.dll.
10567 2003-01-21 Nick Drochak <ndrochak@gol.com>
10571 * typemanager.cs: Remove compiler warnings
10573 2003-01-20 Duncan Mak <duncan@ximian.com>
10575 * AssemblyInfo.cs: Bump the version number to 0.19.
10577 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10579 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
10581 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
10583 * class.cs (Constructor::Emit): Emit debugging info for constructors.
10585 2003-01-17 Miguel de Icaza <miguel@ximian.com>
10587 * cs-parser.jay: Small fix: we were not comparing the constructor
10588 name correctly. Thanks to Zoltan for the initial pointer.
10590 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
10592 * cs-tokenizer.cs: Set file name when specified with #line
10594 2003-01-15 Miguel de Icaza <miguel@ximian.com>
10596 * cs-parser.jay: Only perform the constructor checks here if we
10597 are named like the class; This will help provider a better
10598 error. The constructor path is taken when a type definition is
10599 not found, but most likely the user forgot to add the type, so
10600 report that rather than the constructor error.
10602 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
10604 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
10607 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10609 * cs-parser.jay: Add cleanup call.
10611 2003-01-13 Duncan Mak <duncan@ximian.com>
10613 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
10614 consistent with other methods.
10616 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10618 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
10620 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
10622 * attribute.cs: only set GuidAttr to true when we have a
10625 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10629 * typemanager.cs: fixes to allow mcs compile corlib with the new
10630 Type.IsSubclassOf fix.
10632 2003-01-08 Miguel de Icaza <miguel@ximian.com>
10634 * expression.cs (LocalVariableReference.DoResolve): Classify a
10635 constant as a value, not as a variable. Also, set the type for
10638 * cs-parser.jay (fixed_statement): take a type instead of a
10639 pointer_type, so we can produce a better error message later.
10641 * statement.cs (Fixed.Resolve): Flag types that are not pointers
10644 (For.DoEmit): Make inifinite loops have a
10645 non-conditional branch back.
10647 (Fixed.DoEmit): First populate the pinned variables, then emit the
10648 statement, then clear the variables. Before I was emitting the
10649 code once for each fixed piece.
10652 2003-01-08 Martin Baulig <martin@ximian.com>
10654 * statement.cs (FlowBranching.MergeChild): A break in a
10655 SWITCH_SECTION does not leave a loop. Fixes #36155.
10657 2003-01-08 Martin Baulig <martin@ximian.com>
10659 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
10660 lives in the same number space than `param_map'. Fixes #36154.
10662 2003-01-07 Miguel de Icaza <miguel@ximian.com>
10664 * cs-parser.jay (constructor_declaration): Set the
10665 Constructor.ModFlags before probing for it. This makes the
10666 compiler report 514, 515 and 132 (the code was there, but got
10669 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
10670 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
10671 (GotoCase.Resolve): Set `Returns' to ALWAYS.
10673 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
10675 * enum.cs: create the enum static fields using the enum type.
10677 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
10679 * class.cs: don't try to create the ParamBuilder for the return
10680 type if it's not needed (and handle it breaking for the ms runtime
10683 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
10685 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
10687 2002-12-29 Miguel de Icaza <miguel@ximian.com>
10689 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
10690 the command. This showed up while compiling the JANET source
10691 code, which used \r as its only newline separator.
10693 2002-12-28 Miguel de Icaza <miguel@ximian.com>
10695 * class.cs (Method.Define): If we are an operator (because it
10696 reuses our code), then set the SpecialName and HideBySig. #36128
10698 2002-12-22 Miguel de Icaza <miguel@ximian.com>
10700 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
10701 exception, report error 120 `object reference required'.
10703 * driver.cs: Add --pause option, used during to measure the size
10704 of the process as it goes with --timestamp.
10706 * expression.cs (Invocation.DoResolve): Do not allow methods with
10707 SpecialName to be invoked.
10709 2002-12-21 Miguel de Icaza <miguel@ximian.com>
10711 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
10712 number before adding it.
10714 2002-12-21 Ravi Pratap <ravi@ximian.com>
10716 * ecore.cs (StandardImplicitConversion): When in an unsafe
10717 context, we allow conversion between void * to any other pointer
10718 type. This fixes bug #35973.
10720 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
10722 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
10723 is not thrown when extensionless outputs are used
10725 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10727 * rootcontext.cs: fixed compilation of corlib.
10729 2002-12-19 Miguel de Icaza <miguel@ximian.com>
10731 * attribute.cs (Attributes.Contains): Add new method.
10733 * class.cs (MethodCore.LabelParameters): if the parameter is an
10734 `out' parameter, check that no attribute `[In]' has been passed.
10736 * enum.cs: Handle the `value__' name in an enumeration.
10738 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
10740 * decl.cs: Added special case to allow overrides on "protected
10743 2002-12-18 Ravi Pratap <ravi@ximian.com>
10745 * attribute.cs (Attributes.AddAttributeSection): Rename to this
10746 since it makes much more sense.
10748 (Attributes.ctor): Don't require a Location parameter.
10750 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
10752 * attribute.cs (ApplyAttributes): Remove extra Location parameters
10753 since we already have that information per attribute.
10755 * everywhere : make appropriate changes.
10757 * class.cs (LabelParameters): Write the code which actually
10758 applies attributes to the return type. We can't do this on the MS
10759 .NET runtime so we flag a warning in the case an exception is
10762 2002-12-18 Miguel de Icaza <miguel@ximian.com>
10764 * const.cs: Handle implicit null conversions here too.
10766 2002-12-17 Ravi Pratap <ravi@ximian.com>
10768 * class.cs (MethodCore.LabelParameters): Remove the extra
10769 Type [] parameter since it is completely unnecessary. Instead
10770 pass in the method's attributes so that we can extract
10771 the "return" attribute.
10773 2002-12-17 Miguel de Icaza <miguel@ximian.com>
10775 * cs-parser.jay (parse): Use Report.Error to flag errors instead
10776 of ignoring it and letting the compile continue.
10778 * typemanager.cs (ChangeType): use an extra argument to return an
10779 error condition instead of throwing an exception.
10781 2002-12-15 Miguel de Icaza <miguel@ximian.com>
10783 * expression.cs (Unary.TryReduce): mimic the code for the regular
10784 code path. Perform an implicit cast in the cases where we can
10785 implicitly convert to one of the integral types, and then reduce
10786 based on that constant. This fixes bug #35483.
10788 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10790 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
10792 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10794 * namespace.cs: fixed bug #35489.
10796 2002-12-12 Miguel de Icaza <miguel@ximian.com>
10798 * class.cs: Remove some dead code.
10800 * cs-parser.jay: Estimate the number of methods needed
10801 (RootContext.MethodCount);
10803 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
10804 numbers instead of StringBuilders.
10806 * support.cs (PtrHashtable): Add constructor with initial size;
10807 We can now reduce reallocations of the method table.
10809 2002-12-10 Ravi Pratap <ravi@ximian.com>
10811 * attribute.cs (ApplyAttributes): Keep track of the emitted
10812 attributes on a per-target basis. This fixes bug #35413.
10814 2002-12-10 Miguel de Icaza <miguel@ximian.com>
10816 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
10817 default to the Windows 1252 encoding.
10819 (UnixParseOption): Support version, thanks to Alp for the missing
10822 * AssemblyInfo.cs: Add nice assembly information.
10824 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
10827 * cs-parser.jay: Allow a trailing comma before the close bracked
10828 in the attribute_section production.
10830 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
10831 address of the instance was being taken, I will take this out,
10832 because we take the address of the object immediately here.
10834 2002-12-09 Ravi Pratap <ravi@ximian.com>
10836 * typemanager.cs (AreMultipleAllowed): Take care of the most
10837 obvious case where attribute type is not in the current assembly -
10840 2002-12-08 Miguel de Icaza <miguel@ximian.com>
10842 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
10843 definitions, instead of doing that afterwards.
10845 Also we use a nice little hack, depending on the constructor, we
10846 know if we are a "composed" name or a simple name. Hence, we
10847 avoid the IndexOf test, and we avoid
10849 * codegen.cs: Add code to assist in a bug reporter to track down
10850 the source of a compiler crash.
10852 2002-12-07 Ravi Pratap <ravi@ximian.com>
10854 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
10855 types have been emitted for a given element and flag an error
10856 if something which does not have AllowMultiple set is used more
10859 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
10860 attribute types and their corresponding AllowMultiple properties
10862 (AreMultipleAllowed): Check the property for a given type.
10864 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
10865 property in the case we have a TypeContainer.
10867 (Attributes.AddAttribute): Detect duplicates and just skip on
10868 adding them. This trivial fix catches a pretty gross error in our
10869 attribute emission - global attributes were being emitted twice!
10871 Bugzilla bug #33187 is now fixed.
10873 2002-12-06 Miguel de Icaza <miguel@ximian.com>
10875 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
10876 instead of pp_and).
10878 * expression.cs (Binary.ResolveOperator): I can only use the
10879 Concat (string, string, string) and Concat (string, string,
10880 string, string) if the child is actually a concatenation of
10883 2002-12-04 Miguel de Icaza <miguel@ximian.com>
10885 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
10886 context where we need a 2-character lookahead.
10888 * pending.cs (PendingImplementation): Rework so we can keep track
10889 of interface types all the time, and flag those which were
10890 implemented by parents as optional.
10892 2002-12-03 Miguel de Icaza <miguel@ximian.com>
10894 * expression.cs (Binary.ResolveOperator): Use
10895 String.Concat(string,string,string) or
10896 String.Concat(string,string,string,string) when possible.
10898 * typemanager: More helper methods.
10901 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
10903 * pending.cs: remove the bogus return from GetMissingInterfaces()
10904 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
10906 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10908 * namespace.cs: avoid duplicated 'using xxx' being added to
10909 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
10910 when we get more than one 'using' statement for the same namespace.
10911 Report a CS0105 warning for it.
10913 2002-11-30 Miguel de Icaza <miguel@ximian.com>
10915 * cs-tokenizer.cs (consume_identifier): use read directly, instead
10916 of calling getChar/putback, uses internal knowledge of it.
10918 (xtoken): Reorder tokenizer so most common patterns are checked
10919 first. This reduces the compilation time in another 5% (from 8.11s
10920 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
10922 The parsing time is 22% of the compilation in mcs, and from that
10923 64% is spent on the tokenization process.
10925 I tried using a binary search for keywords, but this is slower
10926 than the hashtable. Another option would be to do a couple of
10929 * Not use a StringBuilder, instead use an array of chars,
10930 with a set value. Notice that this way we could catch
10931 the 645 error without having to do it *afterwards*.
10933 * We could write a hand-parser to avoid the hashtable
10934 compares altogether.
10936 The identifier consumption process takes 37% of the tokenization
10937 time. Another 15% is spent on is_number. 56% of the time spent
10938 on is_number is spent on Int64.Parse:
10940 * We could probably choose based on the string length to
10941 use Int32.Parse or Int64.Parse and avoid all the 64-bit
10944 Another 3% is spend on wrapping `xtoken' in the `token' function.
10946 Handle 0xa0 as whitespace (#34752)
10948 2002-11-26 Miguel de Icaza <miguel@ximian.com>
10950 * typemanager.cs (IsCLRType): New routine to tell whether a type
10951 is one of the builtin types.
10953 Maybe it needs to use TypeCodes to be faster. Maybe we could use
10954 typecode in more places instead of doing pointer comparissions.
10955 We could leverage some knowledge about the way the typecodes are
10958 New code to cache namespaces in assemblies, it is currently not
10959 invoked, to be used soon.
10961 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
10963 * expression.cs (Binary.ResolveOperator): specially handle
10964 strings, and do not perform user-defined operator overloading for
10967 2002-11-24 Miguel de Icaza <miguel@ximian.com>
10969 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
10970 internalcall as it is a pretty simple operation; Avoid whenever
10971 possible to call Char.IsLetter.
10973 (consume_identifier): Cut by half the number of
10974 hashtable calls by merging the is_keyword and GetKeyword behavior.
10976 Do not short-circuit, because if we do, we
10977 report errors (ie, #if false && true would produce an invalid
10981 2002-11-24 Martin Baulig <martin@ximian.com>
10983 * expression.cs (Cast.TryReduce): If we're in checked syntax,
10984 check constant ranges and report a CS0221. Fixes #33186.
10986 2002-11-24 Martin Baulig <martin@ximian.com>
10988 * cs-parser.jay: Make this work for uninitialized variable
10989 declarations in the `for' initializer. Fixes #32416.
10991 2002-11-24 Martin Baulig <martin@ximian.com>
10993 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
10994 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
10996 2002-11-24 Martin Baulig <martin@ximian.com>
10998 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
10999 argument; if true, we also check for user-defined conversions.
11000 This is only needed if both arguments are of a user-defined type.
11001 Fixes #30443, added test-175.cs.
11002 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11004 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11006 2002-11-24 Martin Baulig <martin@ximian.com>
11008 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11009 function to get the store opcode.
11010 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11011 only emit the Ldelema if the store opcode is Stobj. You must run
11012 both test-34 and test-167 to test this. Fixes #34529.
11014 2002-11-23 Martin Baulig <martin@ximian.com>
11016 * ecore.cs (Expression.MemberLookup): Added additional
11017 `qualifier_type' argument which is used when we're being called
11018 from MemberAccess.DoResolve() and null if we're called from a
11020 (Expression.MemberLookupFailed): New method to report errors; this
11021 does the CS1540 check and reports the correct error message.
11023 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11024 argument for the CS1540 check and redone the way how we're dealing
11025 with private members. See the comment in the source code for details.
11026 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11027 `closure_start_type' to `closure_qualifier_type' and check whether
11028 it's not null. It was not this filter being broken, it was just
11029 being called with the wrong arguments.
11031 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11032 and pass it the correct `qualifier_type'; this also does the error
11035 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11037 * expression.cs (Invocation.EmitParams): If the we are dealing
11038 with a non-built-in value type, load its address as well.
11040 (ArrayCreation): Use a a pretty constant instead
11041 of the hardcoded value 2. Use 6 instead of 2 for the number of
11042 static initializers.
11044 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11045 because they are not really value types, just glorified integers.
11047 * driver.cs: Do not append .exe, the CSC compiler does not do it.
11049 * ecore.cs: Remove redundant code for enumerations, make them use
11050 the same code path as everything else, fixes the casting issue
11051 with enumerations in Windows.Forms.
11053 * attribute.cs: Do only cast to string if it is a string, the
11054 validation happens later.
11056 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
11057 people upgrade their corlibs.
11059 * ecore.cs: Oops, enumerations were not following the entire code path
11061 2002-11-21 Miguel de Icaza <miguel@ximian.com>
11063 * typemanager.cs (FilterWithClosure): Commented out the test for
11064 1540 in typemanager.cs, as it has problems when accessing
11065 protected methods from a parent class (see test-174.cs).
11067 * attribute.cs (Attribute.ValidateGuid): new method.
11068 (Attribute.Resolve): Use above.
11070 2002-11-19 Miguel de Icaza <miguel@ximian.com>
11072 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
11074 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
11075 handling for enumerations, as we only needed the TypeContainer
11076 functionality to begin with (this is required for the fix below to
11077 work for enums that reference constants in a container class for
11080 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
11082 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
11083 a valid TypeBuilder to perform lookups on.o
11085 * class.cs (InheritableMemberSignatureCompare): Use true in the
11086 call to GetGetMethod and GetSetMethod, because we are comparing
11087 the signature, and we need to get the methods *even* if they are
11090 (PropertyBase.CheckBase): ditto.
11092 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
11093 GotoCase.Resolve): Use Peel on EmpytCasts.
11095 * ecore.cs (EmptyCast): drop child, add Peel method.
11097 2002-11-17 Martin Baulig <martin@ximian.com>
11099 * ecore.cs (EmptyCast.Child): New public property.
11101 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
11102 label resolved to an EmptyCast. Fixes #34162.
11103 (GotoCase.Resolve): Likewise.
11104 (Block.EmitMeta): Likewise.
11106 2002-11-17 Martin Baulig <martin@ximian.com>
11108 * expression.cs (Invocation.BetterConversion): Prefer int over
11109 uint; short over ushort; long over ulong for integer literals.
11110 Use ImplicitConversionExists instead of StandardConversionExists
11111 since we also need to check for user-defined implicit conversions.
11112 Fixes #34165. Added test-173.cs.
11114 2002-11-16 Martin Baulig <martin@ximian.com>
11116 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
11117 with the `true' and `false' literals. Fixes #33151.
11119 2002-11-16 Martin Baulig <martin@ximian.com>
11121 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
11122 October 22nd; don't do the cs1540 check for static members.
11124 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
11125 now using our own filter here and doing the cs1540 check again.
11127 2002-11-16 Martin Baulig <martin@ximian.com>
11129 * support.cs (InternalParameters): Don't crash if we don't have
11130 any fixed parameters. Fixes #33532.
11132 2002-11-16 Martin Baulig <martin@ximian.com>
11134 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
11135 when looking up static methods to make this work on Windows.
11138 2002-11-16 Martin Baulig <martin@ximian.com>
11140 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
11141 a setter rather than using PropertyInfo.CanWrite.
11143 2002-11-15 Nick Drochak <ndrochak@gol.com>
11145 * class.cs: Allow acces to block member by subclasses. Fixes build
11148 2002-11-14 Martin Baulig <martin@ximian.com>
11150 * class.cs (Constructor.Emit): Added the extern/block check.
11153 2002-11-14 Martin Baulig <martin@ximian.com>
11155 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
11156 iteration while looking for indexers, this is needed because the
11157 indexer may have a different name in our base classes. Fixed the
11158 error reporting (no indexers at all, not get accessor, no
11159 overloaded match). Fixes bug #33089.
11160 (IndexerAccess.DoResolveLValue): Likewise.
11162 2002-11-14 Martin Baulig <martin@ximian.com>
11164 * class.cs (PropertyBase.CheckBase): Make this work for multiple
11165 indexers. Fixes the first part of bug #33089.
11166 (MethodSignature.InheritableMemberSignatureCompare): Added support
11169 2002-11-13 Ravi Pratap <ravi@ximian.com>
11171 * attribute.cs (Attribute.Resolve): Catch the
11172 NullReferenceException and report it since it isn't supposed to
11175 2002-11-12 Miguel de Icaza <miguel@ximian.com>
11177 * expression.cs (Binary.EmitBranchable): Also handle the cases for
11178 LogicalOr and LogicalAnd that can benefit from recursively
11179 handling EmitBranchable. The code now should be nice for Paolo.
11181 2002-11-08 Miguel de Icaza <miguel@ximian.com>
11183 * typemanager.cs (LookupType): Added a negative-hit hashtable for
11184 the Type lookups, as we perform quite a number of lookups on
11185 non-Types. This can be removed once we can deterministically tell
11186 whether we have a type or a namespace in advance.
11188 But this might require special hacks from our corlib.
11192 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
11193 and double which avoids a conversion from an integer to a double.
11195 * expression.cs: tiny optimization, avoid calling IsConstant,
11196 because it effectively performs the lookup twice.
11198 2002-11-06 Miguel de Icaza <miguel@ximian.com>
11200 But a bogus return here to keep the semantics of the old code
11201 until the Mono runtime is fixed.
11203 * pending.cs (GetMissingInterfaces): New method used to remove all
11204 the interfaces that are already implemented by our parent
11205 classes from the list of pending methods.
11207 * interface.cs: Add checks for calls after ResolveTypeExpr.
11209 2002-11-05 Miguel de Icaza <miguel@ximian.com>
11211 * class.cs (Class.Emit): Report warning 67: event not used if the
11212 warning level is beyond 3.
11214 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
11215 being a NullLiteral.
11217 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
11220 * class.cs (TypeContainer.GetClassBases): Cover a missing code
11221 path that might fail if a type can not be resolved.
11223 * expression.cs (Binary.Emit): Emit unsigned versions of the
11226 * driver.cs: use error 5.
11228 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
11230 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
11232 2002-11-01 Miguel de Icaza <miguel@ximian.com>
11234 * cs-parser.jay (switch_section): A beautiful patch from Martin
11235 Baulig that fixed 33094.
11237 2002-10-31 Miguel de Icaza <miguel@ximian.com>
11239 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
11240 Check whether the base is abstract and report an error if so.
11242 * expression.cs (IndexerAccess.DoResolveLValue,
11243 IndexerAccess.DoResolve): ditto.
11245 (Invocation.DoResolve): ditto.
11247 (Invocation.FullMethodDesc): Improve the report string.
11249 * statement.cs (Block): Eliminate IsVariableDefined as it is
11250 basically just a wrapper for GetVariableInfo.
11252 * ecore.cs (SimpleName): Use new
11254 * support.cs (ReflectionParamter.ParameterType): We unwrap the
11255 type, as we return the actual parameter ref/unref state on a
11258 2002-10-30 Miguel de Icaza <miguel@ximian.com>
11260 * support.cs: Return proper flags REF/OUT fixing the previous
11263 * expression.cs: Reverted last patch, that was wrong. Is_ref is
11264 not used to mean `ref' but `ref or out' in ParameterReference
11266 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
11267 full type signature instead of calling TypeManger.CSharpName
11270 * support.cs (InternalParameters.ParameterDesc): Do not compare
11271 directly to the modflags, because REF/OUT will actually be bitsets
11274 * delegate.cs (VerifyMethod): Check also the modifiers.
11276 * cs-tokenizer.cs: Fix bug where floating point values with an
11277 exponent where a sign was missing was ignored.
11279 * driver.cs: Allow multiple assemblies to be specified in a single
11282 2002-10-28 Miguel de Icaza <miguel@ximian.com>
11284 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
11285 because identifiers after a parenthesis would end up in this kind
11286 of production, and we needed to desamiguate it for having casts
11289 (UserDefinedType *) xxx
11291 2002-10-24 Miguel de Icaza <miguel@ximian.com>
11293 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
11294 we should set on the Bindingflags.NonPublic, but not turn on
11295 private_ok. private_ok controls whether a Private member is
11296 returned (this is chekced on the filter routine), while the
11297 BindingFlags.NonPublic just controls whether private/protected
11298 will be allowed. This fixes the problem part of the problem of
11299 private properties being allowed to be used in derived classes.
11301 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
11302 so we can call the children DoResolveLValue method (this will
11303 properly signal errors on lvalue assignments to base properties)
11305 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
11306 getter are null, and we have a property info, we know that this
11307 happened because the lookup failed, so we report an error 122 for
11308 protection level violation.
11310 We also silently return if setter and getter are null in the
11311 resolve functions, this condition only happens if we have flagged
11312 the error before. This is the other half of the problem.
11314 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
11315 not have accessibility information, that is why we were returning
11316 true in the filter function in typemanager.cs.
11318 To properly report 122 (property is inaccessible because of its
11319 protection level) correctly, we report this error in ResolveAccess
11320 by failing if both the setter and the getter are lacking (ie, the
11323 DoResolve and DoLResolve have been modified to check for both
11324 setter/getter being null and returning silently, the reason being
11325 that I did not want to put the knowledge about this error in upper
11328 int old = Report.Errors;
11329 x = new PropertyExpr (...);
11330 if (old != Report.Errors)
11335 So the property expr is returned, but it is invalid, so the error
11336 will be flagged during the resolve process.
11338 * class.cs: Remove InheritablePropertySignatureCompare from the
11339 class, as we no longer depend on the property signature to compute
11340 whether it is possible to implement a method or not.
11342 The reason is that calling PropertyInfo.GetGetMethod will return
11343 null (in .NET, in Mono it works, and we should change this), in
11344 cases where the Get Method does not exist in that particular
11349 class X { public virtual int A { get { return 1; } } }
11351 class Z : Y { public override int A { get { return 2; } } }
11353 Would fail in Z because the parent (Y) would not have the property
11354 defined. So we avoid this completely now (because the alternative
11355 fix was ugly and slow), and we now depend exclusively on the
11358 (PropertyBase.CheckBase): Use a method-base mechanism to find our
11359 reference method, instead of using the property.
11361 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
11362 routines are gone now.
11364 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
11365 names, they were incorrectly named.
11367 * cs-tokenizer.cs: Return are more gentle token on failure.
11369 * pending.cs (PendingImplementation.InterfaceMethod): This routine
11370 had an out-of-sync index variable, which caused it to remove from
11371 the list of pending methods the wrong method sometimes.
11373 2002-10-22 Miguel de Icaza <miguel@ximian.com>
11375 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
11376 CanWrite, because those refer to this particular instance of the
11377 property, and do not take into account the fact that we can
11378 override single members of a property.
11380 Constructor requires an EmitContext. The resolution process does
11381 not happen here, but we need to compute the accessors before,
11382 because the resolution does not always happen for properties.
11384 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
11385 subclass, before we did not update this flag, but we did update
11388 (GetAccessors): Drop this routine, as it did not work in the
11389 presence of partially overwritten set/get methods.
11391 Notice that this broke the cs1540 detection, but that will require
11394 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11398 * driver.cs: issue a warning instead of an error if we don't support
11399 debugging for the platform. Also ignore a couple of errors that may
11400 arise when trying to write the symbols. Undo my previous patch.
11402 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11404 * driver.cs: ignore /debug switch except for Unix platforms.
11406 2002-10-23 Nick Drochak <ndrochak@gol.com>
11408 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
11410 2002-10-21 Miguel de Icaza <miguel@ximian.com>
11412 * driver.cs: Do not make mcs-debug conditional, so we do not break
11413 builds that use it.
11415 * statement.cs (UsageVector.MergeChildren): I would like Martin to
11416 review this patch. But basically after all the children variables
11417 have been merged, the value of "Breaks" was not being set to
11418 new_breaks for Switch blocks. I think that it should be set after
11419 it has executed. Currently I set this to the value of new_breaks,
11420 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
11421 conservative, but I do not understand this code very well.
11423 I did not break anything in the build, so that is good ;-)
11425 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
11427 2002-10-20 Mark Crichton <crichton@gimp.org>
11429 * cfold.cs: Fixed compile blocker. Really fixed it this time.
11431 2002-10-20 Nick Drochak <ndrochak@gol.com>
11433 * cfold.cs: Fixed compile blocker.
11435 2002-10-20 Miguel de Icaza <miguel@ximian.com>
11437 * driver.cs: I was chekcing the key, not the file.
11439 2002-10-19 Ravi Pratap <ravi@ximian.com>
11441 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
11442 message that we were generating - we just need to silently return
11445 2002-10-19 Miguel de Icaza <miguel@ximian.com>
11447 * class.cs (Event.Define): Change my previous commit, as this
11448 breaks the debugger. This is a temporary hack, as it seems like
11449 the compiler is generating events incorrectly to begin with.
11451 * expression.cs (Binary.ResolveOperator): Added support for
11452 "U operator - (E x, E y)"
11454 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
11457 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
11458 init-only variables, but this path did not take into account that
11459 there might be also instance readonly variables. Correct this
11462 This fixes bug 32253
11464 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
11467 * driver.cs: Change the extension for modules to `netmodule'
11469 * cs-parser.jay: Improved slightly the location tracking for
11470 the debugger symbols.
11472 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
11473 modifiers that were specified instead of the hardcoded value
11474 (FamAndAssem). This was basically ignoring the static modifier,
11475 and others. Fixes 32429.
11477 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
11478 fixed a bug in the process (32476)
11480 * expression.cs (ArrayAccess.EmitAssign): Patch from
11481 hwang_rob@yahoo.ca that fixes bug 31834.3
11483 2002-10-18 Miguel de Icaza <miguel@ximian.com>
11485 * driver.cs: Make the module extension .netmodule.
11487 2002-10-16 Miguel de Icaza <miguel@ximian.com>
11489 * driver.cs: Report an error if the resource file is not found
11490 instead of crashing.
11492 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
11493 false, like Emit does.
11495 2002-10-16 Nick Drochak <ndrochak@gol.com>
11497 * typemanager.cs: Remove unused private member. Also reported mcs
11498 bug to report this as a warning like csc.
11500 2002-10-15 Martin Baulig <martin@gnome.org>
11502 * statement.cs (Statement.Emit): Made this a virtual method; emits
11503 the line number info and calls DoEmit().
11504 (Statement.DoEmit): New protected abstract method, formerly knows
11505 as Statement.Emit().
11507 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
11509 2002-10-11 Miguel de Icaza <miguel@ximian.com>
11511 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
11512 have fixed a remaining problem: not every AddXXXX was adding a
11513 fully qualified name.
11515 Now everyone registers a fully qualified name in the DeclSpace as
11516 being defined instead of the partial name.
11518 Downsides: we are slower than we need to be due to the excess
11519 copies and the names being registered this way.
11521 The reason for this is that we currently depend (on the corlib
11522 bootstrap for instance) that types are fully qualified, because
11523 we dump all the types in the namespace, and we should really have
11524 types inserted into the proper namespace, so we can only store the
11525 basenames in the defined_names array.
11527 2002-10-10 Martin Baulig <martin@gnome.org>
11529 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
11530 from bug #31834, see the bug report for a testcase which is
11533 2002-10-10 Martin Baulig <martin@gnome.org>
11535 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
11536 flow analysis code for this.
11538 * statement.cs (Do, While, For): Tell the flow analysis code about
11540 (FlowBranching.UsageVector): Added support for infinite loops.
11541 (Block.Resolve): Moved the dead code elimination here and use flow
11544 2002-10-09 Miguel de Icaza <miguel@ximian.com>
11546 * class.cs (Field.Define): Catch cycles on struct type
11549 * typemanager.cs (IsUnmanagedtype): Do not recursively check
11550 fields if the fields are static. We only need to check instance
11553 * expression.cs (As.DoResolve): Test for reference type.
11555 * statement.cs (Using.ResolveExpression): Use
11556 ConvertImplicitRequired, not ConvertImplicit which reports an
11558 (Using.ResolveLocalVariableDecls): ditto.
11560 * expression.cs (Binary.ResolveOperator): Report errors in a few
11561 places where we had to.
11563 * typemanager.cs (IsUnmanagedtype): Finish implementation.
11565 2002-10-08 Miguel de Icaza <miguel@ximian.com>
11567 * expression.cs: Use StoreFromPtr instead of extracting the type
11568 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
11570 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
11571 an enumeration value to a System.Enum, but System.Enum is not a
11572 value type, but an class type, so we need to box.
11574 (Expression.ConvertExplicit): One codepath could return
11575 errors but not flag them. Fix this. Fixes #31853
11577 * parameter.cs (Resolve): Do not allow void as a parameter type.
11579 2002-10-06 Martin Baulig <martin@gnome.org>
11581 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
11582 if it's a class type and not a struct. Fixes #31815.
11584 2002-10-06 Martin Baulig <martin@gnome.org>
11586 * statement.cs: Reworked the flow analysis code a bit to make it
11587 usable for dead code elimination.
11589 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11591 * cs-parser.jay: allow empty source files. Fixes bug #31781.
11593 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11595 * expression.cs (ComposedCast.DoResolveType): A quick workaround
11596 to fix the test 165, will investigate deeper.
11598 2002-10-04 Martin Baulig <martin@gnome.org>
11600 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
11601 finally blocks actually work.
11602 (Try.Resolve): We don't need to create a sibling for `finally' if
11603 there is no finally block.
11605 2002-10-04 Martin Baulig <martin@gnome.org>
11607 * class.cs (Constructor.Define): The default accessibility for a
11608 non-default constructor is private, not public.
11610 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11612 * class.cs (Constructor): Make AllowedModifiers public, add
11615 * cs-parser.jay: Perform the modifiers test here, as the
11616 constructor for the Constructor class usually receives a zero
11617 because of the way we create it (first we create, later we
11618 customize, and we were never checking the modifiers).
11620 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
11621 is a version of LookupTypeReflection that includes the type-name
11622 cache. This can be used as a fast path for functions that know
11623 the fully qualified name and are only calling into *.GetType() to
11624 obtain a composed type.
11626 This is also used by TypeManager.LookupType during its type
11629 (LookupType): We now also track the real type name, as sometimes
11630 we can get a quey for the real type name from things like
11631 ComposedCast. This fixes bug 31422.
11633 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
11634 complete type fullname, it does not have to go through the type
11635 resolution system to obtain the composed version of the type (for
11636 obtaining arrays or pointers).
11638 (Conditional.Emit): Use the EmitBoolExpression to
11639 generate nicer code, as requested by Paolo.
11641 (ArrayCreation.CheckIndices): Use the patch from
11642 hwang_rob@yahoo.ca to validate the array initializers.
11644 2002-10-03 Miguel de Icaza <miguel@ximian.com>
11646 * class.cs (ConstructorInitializer.Emit): simplify code by using
11647 Invocation.EmitCall, and at the same time, fix the bugs in calling
11648 parent constructors that took variable arguments.
11650 * ecore.cs (Expression.ConvertNumericExplicit,
11651 Expression.ImplicitNumericConversion): Remove the code that
11652 manually wrapped decimal (InternalTypeConstructor call is now gone
11655 * expression.cs (Cast.TryReduce): Also handle decimal types when
11656 trying to perform a constant fold on the type.
11658 * typemanager.cs (IsUnmanagedtype): Partially implemented.
11660 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
11661 that only turned off an error report, and did nothing else.
11663 2002-10-02 Miguel de Icaza <miguel@ximian.com>
11665 * driver.cs: Handle and ignore /fullpaths
11667 2002-10-01 Miguel de Icaza <miguel@ximian.com>
11669 * expression.cs (Binary.ResolveOperator): Catch the case where
11670 DoNumericPromotions returns true,
11672 (Binary.DoNumericPromotions): Simplify the code, and the tests.
11674 2002-09-27 Miguel de Icaza <miguel@ximian.com>
11676 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
11679 2002-09-26 Miguel de Icaza <miguel@ximian.com>
11681 * ecore.cs (ConvertNumericExplicit): It is not enough that the
11682 conversion exists, but it is also required that the conversion be
11683 performed. This manifested in "(Type64Enum) 2".
11685 * class.cs (TypeManager.AddMethod): The fix is not to change
11686 AddEnum, because that one was using a fully qualified name (every
11687 DeclSpace derivative does), but to change the AddMethod routine
11688 that was using an un-namespaced name. This now correctly reports
11689 the duplicated name.
11691 Revert patch until I can properly fix it. The issue
11692 is that we have a shared Type space across all namespaces
11693 currently, which is wrong.
11695 Options include making the Namespace a DeclSpace, and merge
11696 current_namespace/current_container in the parser.
11698 2002-09-25 Miguel de Icaza <miguel@ximian.com>
11700 * cs-parser.jay: Improve error reporting when we get a different
11701 kind of expression in local_variable_type and
11702 local_variable_pointer_type.
11704 Propagate this to avoid missleading errors being reported.
11706 * ecore.cs (ImplicitReferenceConversion): treat
11707 TypeManager.value_type as a target just like object_type. As
11712 Is valid, and needs to result in the int 1 being boxed before it
11713 is assigned to the value type v.
11715 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
11716 to validate the enumeration name.
11718 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
11719 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
11720 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
11722 * ecore.cs (TryImplicitIntConversion): When doing an
11723 implicit-enumeration-conversion, check if the type is 64-bits and
11724 perform a conversion before passing to EnumConstant.
11726 2002-09-23 Miguel de Icaza <miguel@ximian.com>
11728 * decl.cs (Error_AmbiguousTypeReference); New routine used to
11729 report ambiguous type references. Unlike the MS version, we
11730 report what the ambiguity is. Innovation at work ;-)
11732 (DeclSpace.FindType): Require a location argument to
11733 display when we display an ambiguous error.
11735 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
11737 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
11739 * expression.cs (EmitDynamicInitializers): Apply patch from
11740 hwang_rob@yahoo.ca that fixes the order in which we emit our
11743 2002-09-21 Martin Baulig <martin@gnome.org>
11745 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
11746 delegate takes no arguments.
11748 2002-09-20 Miguel de Icaza <miguel@ximian.com>
11750 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
11753 * expression.cs: Extract the underlying type.
11755 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
11757 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
11759 2002-09-19 Miguel de Icaza <miguel@ximian.com>
11761 * class.cs (TypeContainer.DefineType): We can not use the nice
11762 PackingSize with the size set to 1 DefineType method, because it
11763 will not allow us to define the interfaces that the struct
11766 This completes the fixing of bug 27287
11768 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
11769 means also structs. This fixes part of the problem.
11770 (Expresion.ImplicitReferenceConversionExists): ditto.
11772 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
11773 error if there were no errors reported during the type lookup
11774 process, to avoid duplicates or redundant errors. Without this
11775 you would get an ambiguous errors plus a type not found. We have
11776 beaten the user enough with the first error.
11778 (DeclSparce.FindType): Emit a warning if we have an ambiguous
11781 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
11782 during the resolution process, stop the lookup, this avoids
11783 repeated error reports (same error twice).
11785 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
11787 * typemanager.cs (LookupType): Redo the type lookup code to match
11788 the needs of System.Reflection.
11790 The issue is that System.Reflection requires references to nested
11791 types to begin with a "+" sign instead of a dot. So toplevel
11792 types look like: "NameSpace.TopLevelClass", and nested ones look
11793 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
11796 2002-09-19 Martin Baulig <martin@gnome.org>
11798 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
11799 says that a method always returns or always throws an exception,
11800 don't report the CS0161.
11802 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
11803 set `Returns = new_returns'.
11805 2002-09-19 Martin Baulig <martin@gnome.org>
11807 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
11808 to an enum constant, check for a CS0176.
11810 2002-09-18 Miguel de Icaza <miguel@ximian.com>
11812 * class.cs (TypeContainer.CheckPairedOperators): Now we check
11813 for operators that must be in pairs and report errors.
11815 * ecore.cs (SimpleName.DoResolveType): During the initial type
11816 resolution process, when we define types recursively, we must
11817 check first for types in our current scope before we perform
11818 lookups in the enclosing scopes.
11820 * expression.cs (MakeByteBlob): Handle Decimal blobs.
11822 (Invocation.VerifyArgumentsCompat): Call
11823 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
11824 I thought we were supposed to always call this, but there are a
11825 few places in the code where we dont do it.
11827 2002-09-17 Miguel de Icaza <miguel@ximian.com>
11829 * driver.cs: Add support in -linkres and -resource to specify the
11830 name of the identifier.
11832 2002-09-16 Miguel de Icaza <miguel@ximian.com>
11834 * ecore.cs (StandardConversionExists): Sync with the conversion
11835 code: allow anything-* to void* conversions.
11837 (FindMostSpecificSource): Use an Expression argument
11838 instead of a Type, because we might be handed over a Literal which
11839 gets a few more implicit conversions that plain types do not. So
11840 this information was being lost.
11842 Also, we drop the temporary type-holder expression when not
11845 2002-09-17 Martin Baulig <martin@gnome.org>
11847 * class.cs (PropertyBase.CheckBase): Don't check the base class if
11848 this is an explicit interface implementation.
11850 2002-09-17 Martin Baulig <martin@gnome.org>
11852 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
11853 different `IndexerName' attributes.
11855 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
11856 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
11857 virtual CommonResolve().
11859 2002-09-16 Miguel de Icaza <miguel@ximian.com>
11861 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
11862 and convert that to the UnderlyingType.
11864 * statement.cs (Foreach.Resolve): Indexers are just like variables
11865 or PropertyAccesses.
11867 * cs-tokenizer.cs (consume_string): Track line numbers and columns
11868 inside quoted strings, we were not doing this before.
11870 2002-09-16 Martin Baulig <martin@gnome.org>
11872 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
11873 resolve it. This is needed for the definite assignment check of the
11874 instance expression, fixes bug #29846.
11875 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
11877 2002-09-16 Nick Drochak <ndrochak@gol.com>
11879 * parameter.cs: Fix compile error. Cannot reference static member
11880 from an instance object. Is this an mcs bug?
11882 2002-09-14 Martin Baulig <martin@gnome.org>
11884 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
11885 multiple times. Fixes bug #30295, added test-166.cs.
11887 2002-09-14 Martin Baulig <martin@gnome.org>
11889 * statement.cs (Block.Emit): Don't emit unreachable code.
11890 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
11891 `break' statements.
11892 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
11894 2002-09-14 Martin Baulig <martin@gnome.org>
11896 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
11899 2002-09-14 Martin Baulig <martin@gnome.org>
11901 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
11902 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
11903 be false on the ms runtime.
11905 2002-09-13 Martin Baulig <martin@gnome.org>
11907 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
11908 the CS0038 error message.
11910 2002-09-12 Miguel de Icaza <miguel@ximian.com>
11912 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
11913 constant inside, return it.
11915 2002-09-12 Martin Baulig <martin@gnome.org>
11917 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
11918 implicit conversion can be done between enum types.
11920 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
11921 check whether an implicit conversion to the current enum's UnderlyingType
11922 exists and report an error if not.
11924 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
11925 without debugging support.
11927 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
11928 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
11930 2002-09-12 Martin Baulig <martin@gnome.org>
11932 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
11934 * ecore.cs (IMemberExpr.DeclaringType): New property.
11935 (SimpleName.SimpleNameResolve): Check whether we're accessing a
11936 nonstatic member of an outer type (CS0038).
11938 2002-09-11 Miguel de Icaza <miguel@ximian.com>
11940 * driver.cs: Activate the using-error detector at warning level
11941 4 (at least for MS-compatible APIs).
11943 * namespace.cs (VerifyUsing): Small buglett fix.
11945 * pending.cs (PendingImplementation): pass the container pointer.
11947 * interface.cs (GetMethods): Allow for recursive definition. Long
11948 term, I would like to move every type to support recursive
11949 definitions, not the current ordering mechanism that we have right
11952 The situation is this: Attributes are handled before interfaces,
11953 so we can apply attributes to interfaces. But some attributes
11954 implement interfaces, we will now handle the simple cases
11955 (recursive definitions will just get an error).
11957 * parameter.cs: Only invalidate types at the end if we fail to
11960 2002-09-09 Martin Baulig <martin@gnome.org>
11962 * ecore.cs (PropertyExpr.Emit): Also check for
11963 TypeManager.system_int_array_get_length so this'll also work when
11964 compiling corlib. Fixes #30003.
11966 2002-09-09 Martin Baulig <martin@gnome.org>
11968 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
11969 and throw an exception if we can't get the type's size. Fixed #30040,
11972 2002-09-09 Martin Baulig <martin@gnome.org>
11974 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
11976 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
11977 context. Fixes bug #30027.
11979 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
11980 virtual functions. Fixes bug #30043, added test-164.cs.
11982 2002-09-08 Ravi Pratap <ravi@ximian.com>
11984 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
11986 2002-09-08 Nick Drochak <ndrochak@gol.com>
11988 * driver.cs: Use an object to get the windows codepage since it's not a
11991 2002-09-08 Miguel de Icaza <miguel@ximian.com>
11993 * statement.cs (For.Emit): for infinite loops (test == null)
11994 return whether there is a break inside, not always "true".
11996 * namespace.cs (UsingEntry): New struct to hold the name of the
11997 using definition, the location where it is defined, and whether it
11998 has been used in a successful type lookup.
12000 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12005 2002-09-06 Ravi Pratap <ravi@ximian.com>
12007 * attribute.cs : Fix incorrect code which relied on catching
12008 a NullReferenceException to detect a null being passed in
12009 where an object was expected.
12011 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12013 * statement.cs (Try): flag the catch variable as assigned
12015 * expression.cs (Cast): Simplified by using ResolveType instead of
12016 manually resolving.
12018 * statement.cs (Catch): Fix bug by using ResolveType.
12020 2002-09-06 Ravi Pratap <ravi@ximian.com>
12022 * expression.cs (BetterConversion): Special case for when we have
12023 a NullLiteral as the argument and we have to choose between string
12024 and object types - we choose string the way csc does.
12026 * attribute.cs (Attribute.Resolve): Catch the
12027 NullReferenceException and report error #182 since the Mono
12028 runtime no more has the bug and having this exception raised means
12029 we tried to select a constructor which takes an object and is
12032 2002-09-05 Ravi Pratap <ravi@ximian.com>
12034 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12035 message (1502, 1503) when we can't locate a method after overload
12036 resolution. This is much more informative and closes the bug
12039 * interface.cs (PopulateMethod): Return if there are no argument
12040 types. Fixes a NullReferenceException bug.
12042 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12043 expressions too. Previously we were checking only in one place for
12044 positional arguments leaving out named arguments.
12046 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12047 type to the enum type is not allowed. Remove code corresponding to
12050 (ConvertNumericExplicit): Allow explicit conversions from
12051 the underlying type to enum type. This precisely follows the spec
12052 and closes a bug filed by Gonzalo.
12054 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12057 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
12059 2002-09-03 Miguel de Icaza <miguel@ximian.com>
12061 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
12062 it was important that we stored the right value after the
12063 reduction in `converted'.
12065 2002-09-04 Martin Baulig <martin@gnome.org>
12067 * location.cs (Location.SymbolDocument): Use full pathnames for the
12070 2002-08-30 Miguel de Icaza <miguel@ximian.com>
12072 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
12073 of the expression resolve mechanism, because that will catch the
12074 SimpleName error failures.
12076 (Conditional): If we can not resolve the
12077 expression, return, do not crash.
12079 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12082 (location): display token name instead of its number.
12084 2002-08-28 Martin Baulig <martin@gnome.org>
12086 * expression.cs (Binary.ResolveOperator): Don't silently return
12087 but return an error if an operator cannot be applied between two
12090 2002-08-28 Martin Baulig <martin@gnome.org>
12092 * class.cs (Constructor.Define): Set the permission attributes
12093 correctly instead of making all constructors public.
12095 2002-08-28 Martin Baulig <martin@gnome.org>
12097 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
12098 for private members before reporting a CS0103; if we find anything,
12101 2002-08-28 Martin Baulig <martin@gnome.org>
12103 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
12104 to check whether `closure_start_type == closure_invocation_type',
12105 we also need to check whether `m.DeclaringType == closure_invocation_type'
12106 before bypassing the permission checks. We might be accessing
12107 protected/private members from the base class.
12108 (TypeManager.RealMemberLookup): Only set private_ok if private
12109 members were requested via BindingFlags.NonPublic.
12111 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
12113 * expression.cs (MemberAccess.ResolveMemberAccess): Set
12114 MethodGroupExpr.IsExplicitImpl if appropriate.
12115 (Invocation.DoResolve): Don't report the CS0120 for explicit
12116 interface implementations.
12118 2002-08-27 Martin Baulig <martin@gnome.org>
12120 * expression.cs (Invocation.DoResolve): If this is a static
12121 method and we don't have an InstanceExpression, we must report
12124 2002-08-25 Martin Baulig <martin@gnome.org>
12126 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
12127 `==' between a valuetype and an object.
12129 2002-08-25 Miguel de Icaza <miguel@ximian.com>
12131 * ecore.cs (TypeExpr): Provide a ToString method.
12133 2002-08-24 Martin Baulig <martin@gnome.org>
12135 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
12136 now called proggie.dbg and it's a binary file.
12138 2002-08-23 Martin Baulig <martin@gnome.org>
12140 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
12142 2002-08-23 Martin Baulig <martin@gnome.org>
12144 * struct.cs (MyStructInfo.ctor): Make this work with empty
12145 structs; it's not allowed to use foreach() on null.
12147 2002-08-23 Martin Baulig <martin@gnome.org>
12149 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
12150 writer the full pathname of the generated assembly.
12152 2002-08-23 Martin Baulig <martin@gnome.org>
12154 * statements.cs (FlowBranching.UsageVector.MergeChildren):
12155 A `finally' block never returns or breaks; improved handling of
12158 2002-08-23 Martin Baulig <martin@gnome.org>
12160 * statement.cs (Throw.Resolve): Allow `throw null'.
12162 2002-08-23 Martin Baulig <martin@gnome.org>
12164 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
12165 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
12166 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
12167 MemberLookup would return a wrong event if this is an explicit
12168 interface implementation and the class has an event with the same
12171 2002-08-23 Martin Baulig <martin@gnome.org>
12173 * statement.cs (Block.AddChildVariableNames): New public method.
12174 (Block.AddChildVariableName): Likewise.
12175 (Block.IsVariableNameUsedInChildBlock): Likewise.
12176 (Block.AddVariable): Check whether a variable name has already
12177 been used in a child block.
12179 * cs-parser.jay (declare_local_variables): Mark all variable names
12180 from the current block as being used in a child block in the
12183 2002-08-23 Martin Baulig <martin@gnome.org>
12185 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
12186 find the symbol writer.
12188 * driver.cs: csc also allows the arguments to /define being
12189 separated by commas, not only by semicolons.
12191 2002-08-23 Martin Baulig <martin@gnome.org>
12193 * interface.cs (Interface.GetMembers): Added static check for events.
12195 2002-08-15 Martin Baulig <martin@gnome.org>
12197 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
12198 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
12200 * ecore.cs (Expression.MemberLookup): Added documentation and explained
12201 why the MethodData.EmitDestructor() change was necessary.
12203 2002-08-20 Martin Baulig <martin@gnome.org>
12205 * class.cs (TypeContainer.FindMembers): Added static check for events.
12207 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
12209 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
12210 use Type.GetEvents(), not Type.FindMembers().
12212 2002-08-20 Martin Baulig <martin@gnome.org>
12214 * decl.cs (MemberCache): Added a special method cache which will
12215 be used for method-only searched. This ensures that a method
12216 search will return a MethodInfo with the correct ReflectedType for
12219 2002-08-20 Martin Baulig <martin@gnome.org>
12221 * decl.cs (DeclSpace.FindMembers): Made this public.
12223 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12225 * delegate.cs: fixed build on windows.
12226 [FIXME: Filed as bug #29150: MCS must report these errors.]
12228 2002-08-19 Ravi Pratap <ravi@ximian.com>
12230 * ecore.cs (StandardConversionExists): Return a false
12231 if we are trying to convert the void type to anything else
12232 since that is not allowed.
12234 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
12235 we flag error 70 in the event an event is trying to be accessed
12236 directly from outside the declaring type.
12238 2002-08-20 Martin Baulig <martin@gnome.org>
12240 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
12241 MemberCache from typemanager.cs to decl.cs.
12243 2002-08-19 Martin Baulig <martin@gnome.org>
12245 * class.cs (TypeContainer): Implement IMemberContainer.
12246 (TypeContainer.DefineMembers): Create the MemberCache.
12247 (TypeContainer.FindMembers): Do better BindingFlags checking; only
12248 return public members if BindingFlags.Public was given, check
12249 whether members are static.
12251 2002-08-16 Martin Baulig <martin@gnome.org>
12253 * decl.cs (DeclSpace.Define): Splitted this in Define and
12254 DefineMembers. DefineMembers is called first and initializes the
12257 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
12258 DefineMembers() on all our DeclSpaces.
12260 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
12261 but call DefineMembers() on all nested interfaces. We call their
12262 Define() in our new Define() function.
12264 * interface.cs (Interface): Implement IMemberContainer.
12265 (Interface.Define): Moved all code except the attribute stuf to
12267 (Interface.DefineMembers): Initialize the member cache.
12269 * typemanager.cs (IMemberFinder): Removed this interface, we don't
12270 need this anymore since we can use MemberCache.FindMembers directly.
12272 2002-08-19 Martin Baulig <martin@gnome.org>
12274 * typemanager.cs (MemberCache): When creating the cache for an
12275 interface type, add all inherited members.
12276 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
12277 to `out bool used_cache' and documented it.
12278 (TypeManager.MemberLookup): If we already used the cache in the first
12279 iteration, we don't need to do the interfaces check.
12281 2002-08-19 Martin Baulig <martin@gnome.org>
12283 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
12284 here from IMemberFinder and don't implement this interface anymore.
12285 (DeclSpace.MemberCache): Moved here from IMemberFinder.
12287 * typemanager.cs (IMemberFinder): This interface is now only used by
12288 classes which actually support the member cache.
12289 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
12290 since we only put DeclSpaces into this Hashtable.
12291 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
12292 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
12294 2002-08-16 Martin Baulig <martin@gnome.org>
12296 * typemanager.cs (ICachingMemberFinder): Removed.
12297 (IMemberFinder.MemberCache): New property.
12298 (TypeManager.FindMembers): Merged this with RealFindMembers().
12299 This function will never be called from TypeManager.MemberLookup()
12300 so we can't use the cache here, just the IMemberFinder.
12301 (TypeManager.MemberLookup_FindMembers): Check whether the
12302 IMemberFinder has a MemberCache and call the cache's FindMembers
12304 (MemberCache): Rewrote larger parts of this yet another time and
12305 cleaned it up a bit.
12307 2002-08-15 Miguel de Icaza <miguel@ximian.com>
12309 * driver.cs (LoadArgs): Support quoting.
12311 (Usage): Show the CSC-like command line arguments.
12313 Improved a few error messages.
12315 2002-08-15 Martin Baulig <martin@gnome.org>
12317 * typemanager.cs (IMemberContainer.Type): New property.
12318 (IMemberContainer.IsInterface): New property.
12320 The following changes are conditional to BROKEN_RUNTIME, which is
12321 defined at the top of the file.
12323 * typemanager.cs (MemberCache.MemberCache): Don't add the base
12324 class'es members, but add all members from TypeHandle.ObjectType
12325 if we're an interface.
12326 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
12327 is the current type.
12328 (MemberCache.CacheEntry.Container): Removed this field.
12329 (TypeHandle.GetMembers): Include inherited members.
12331 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12333 * typemanager.cs: fixed compilation and added a comment on a field that
12336 2002-08-15 Martin Baulig <martin@gnome.org>
12338 * class.cs (ConstructorInitializer.Resolve): In the
12339 Expression.MemberLookup call, use the queried_type as
12342 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
12343 declared' attribute, it's always true.
12344 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
12345 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
12346 temporary wrapper for FindMembers which tells MemberLookup whether
12347 members from the base classes are included in the return value.
12348 This will go away soon.
12349 (TypeManager.MemberLookup): Use this temporary hack here; once the
12350 new MemberCache is completed, we don't need to do the DeclaredOnly
12351 looping here anymore since the MemberCache will take care of this.
12352 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
12353 (MemberCache): When creating the MemberCache for a class, get
12354 members from the current class and all its base classes.
12355 (MemberCache.CacheEntry.Container): New field. This is a
12356 temporary hack until the Mono runtime is fixed to distinguish
12357 between ReflectedType and DeclaringType. It allows us to use MCS
12358 with both the MS runtime and the unfixed Mono runtime without
12359 problems and without accecting performance.
12360 (MemberCache.SearchMembers): The DeclaredOnly looping from
12361 TypeManager.MemberLookup is now done here.
12363 2002-08-14 Martin Baulig <martin@gnome.org>
12365 * statement.cs (MyStructInfo.MyStructInfo): Don't call
12366 Type.GetFields on dynamic types but get the fields from the
12367 corresponding TypeContainer.
12368 (MyStructInfo.GetStructInfo): Added check for enum types.
12370 * typemanager.cs (MemberList.IsSynchronized): Implemented.
12371 (MemberList.SyncRoot): Implemented.
12372 (TypeManager.FilterWithClosure): No need to check permissions if
12373 closure_start_type == closure_invocation_type, don't crash if
12374 closure_invocation_type is null.
12376 2002-08-13 Martin Baulig <martin@gnome.org>
12378 Rewrote TypeContainer.FindMembers to use a member cache. This
12379 gives us a speed increase of about 35% for the self-hosting MCS
12380 build and of about 15-20% for the class libs (both on GNU/Linux).
12382 * report.cs (Timer): New class to get enhanced profiling. This
12383 whole class is "TIMER" conditional since it remarkably slows down
12386 * class.cs (MemberList): New class. This is an IList wrapper
12387 which we're now using instead of passing MemberInfo[]'s around to
12388 avoid copying this array unnecessarily.
12389 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
12390 (ICachingMemberFinder, IMemberContainer): New interface.
12391 (TypeManager.FilterWithClosure): If `criteria' is null, the name
12392 has already been checked, otherwise use it for the name comparision.
12393 (TypeManager.FindMembers): Renamed to RealMemberFinder and
12394 provided wrapper which tries to use ICachingMemberFinder.FindMembers
12395 if possible. Returns a MemberList, not a MemberInfo [].
12396 (TypeHandle): New class, implements IMemberContainer. We create
12397 one instance of this class per type, it contains a MemberCache
12398 which is used to do the member lookups.
12399 (MemberCache): New class. Each instance of this class contains
12400 all members of a type and a name-based hash table.
12401 (MemberCache.FindMembers): This is our new member lookup
12402 function. First, it looks up all members of the requested name in
12403 the hash table. Then, it walks this list and sorts out all
12404 applicable members and returns them.
12406 2002-08-13 Martin Baulig <martin@gnome.org>
12408 In addition to a nice code cleanup, this gives us a performance
12409 increase of about 1.4% on GNU/Linux - not much, but it's already
12410 half a second for the self-hosting MCS compilation.
12412 * typemanager.cs (IMemberFinder): New interface. It is used by
12413 TypeManager.FindMembers to call FindMembers on a TypeContainer,
12414 Enum, Delegate or Interface.
12415 (TypeManager.finder_to_member_finder): New PtrHashtable.
12416 (TypeManager.finder_to_container): Removed.
12417 (TypeManager.finder_to_delegate): Removed.
12418 (TypeManager.finder_to_interface): Removed.
12419 (TypeManager.finder_to_enum): Removed.
12421 * interface.cs (Interface): Implement IMemberFinder.
12423 * delegate.cs (Delegate): Implement IMemberFinder.
12425 * enum.cs (Enum): Implement IMemberFinder.
12427 * class.cs (TypeContainer): Implement IMemberFinder.
12429 2002-08-12 Martin Baulig <martin@gnome.org>
12431 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
12433 2002-08-12 Martin Baulig <martin@gnome.org>
12435 * ecore.cs (ITypeExpression): New interface for expressions which
12437 (TypeExpression): Renamed to TypeLookupExpression.
12438 (Expression.DoResolve): If we're doing a types-only lookup, the
12439 expression must implement the ITypeExpression interface and we
12440 call DoResolveType() on it.
12441 (SimpleName): Implement the new ITypeExpression interface.
12442 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
12443 hack, the situation that we're only looking up types can't happen
12444 anymore when this method is called. Moved the type lookup code to
12445 DoResolveType() and call it.
12446 (SimpleName.DoResolveType): This ITypeExpression interface method
12447 is now doing the types-only lookup.
12448 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
12449 (ResolveFlags): Added MaskExprClass.
12451 * expression.cs (MemberAccess): Implement the ITypeExpression
12453 (MemberAccess.DoResolve): Added support for a types-only lookup
12454 when we're called via ITypeExpression.DoResolveType().
12455 (ComposedCast): Implement the ITypeExpression interface.
12457 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
12458 Expression.Resolve() with ResolveFlags.Type instead.
12460 2002-08-12 Martin Baulig <martin@gnome.org>
12462 * interface.cs (Interface.Define): Apply attributes.
12464 * attribute.cs (Attribute.ApplyAttributes): Added support for
12465 interface attributes.
12467 2002-08-11 Martin Baulig <martin@gnome.org>
12469 * statement.cs (Block.Emit): Only check the "this" variable if we
12470 do not always throw an exception.
12472 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
12473 whether the property has a set accessor.
12475 2002-08-11 Martin Baulig <martin@gnome.org>
12477 Added control flow analysis support for structs.
12479 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
12480 with control flow analysis turned off.
12481 (IVariable): New interface.
12482 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
12483 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
12484 (FieldExpr.DoResolve): Resolve the instance expression with flow
12485 analysis turned off and do the definite assignment check after the
12486 resolving when we know what the expression will resolve to.
12488 * expression.cs (LocalVariableReference, ParameterReference):
12489 Implement the new IVariable interface, only call the flow analysis
12490 code if ec.DoFlowAnalysis is true.
12491 (This): Added constructor which takes a Block argument. Implement
12492 the new IVariable interface.
12493 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
12494 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
12495 This does the definite assignment checks for struct members.
12497 * class.cs (Constructor.Emit): If this is a non-static `struct'
12498 constructor which doesn't have any initializer, call
12499 Block.AddThisVariable() to tell the flow analysis code that all
12500 struct elements must be initialized before control returns from
12503 * statement.cs (MyStructInfo): New public class.
12504 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
12505 argument to this indexer. If non-zero, check an individual struct
12506 member, not the whole struct.
12507 (FlowBranching.CheckOutParameters): Check struct members.
12508 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
12509 overloaded versions of these methods which take an additional
12510 `int field_idx' argument to check struct members.
12511 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
12512 overloaded versions of these methods which take an additional
12513 `string field_name' argument to check struct member.s
12514 (VariableInfo): Implement the IVariable interface.
12515 (VariableInfo.StructInfo): New public property. Returns the
12516 MyStructInfo instance of the variable if it's a struct or null.
12517 (Block.AddThisVariable): New public method. This is called from
12518 Constructor.Emit() for non-static `struct' constructor which do
12519 not have any initializer. It creates a special variable for the
12520 "this" instance variable which will be checked by the flow
12521 analysis code to ensure that all of the struct's fields are
12522 initialized before control returns from the constructor.
12523 (UsageVector): Added support for struct members. If a
12524 variable/parameter is a struct with N members, we reserve a slot
12525 in the usage vector for each member. A struct is considered fully
12526 initialized if either the struct itself (slot 0) or all its
12527 members are initialized.
12529 2002-08-08 Martin Baulig <martin@gnome.org>
12531 * driver.cs (Driver.MainDriver): Only report an error CS5001
12532 if there were no compilation errors.
12534 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
12535 `UnsafeContext' property to determine whether the parent is in
12536 unsafe context rather than checking the parent's ModFlags:
12537 classes nested in an unsafe class are unsafe as well.
12539 2002-08-08 Martin Baulig <martin@gnome.org>
12541 * statement.cs (UsageVector.MergeChildren): Distinguish between
12542 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
12543 we return. Added test17() and test18() to test-154.cs.
12545 2002-08-08 Martin Baulig <martin@gnome.org>
12547 * typemanager.cs (TypeManager.FilterWithClosure): If we have
12548 Family access, make sure the invoking type isn't a subclass of the
12549 queried type (that'd be a CS1540).
12551 * ecore.cs (Expression.MemberLookup): Added overloaded version of
12552 this method which takes an additional `Type invocation_type'.
12554 * expression.cs (BaseAccess.DoResolve): Use the base type as
12555 invocation and query type.
12556 (MemberAccess.DoResolve): If the lookup failed and we're about to
12557 report a CS0122, try a lookup with the ec.ContainerType - if this
12558 succeeds, we must report a CS1540.
12560 2002-08-08 Martin Baulig <martin@gnome.org>
12562 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
12563 (MethodGroupExpr): Implement the IMemberExpr interface.
12565 * expression (MemberAccess.ResolveMemberAccess): No need to have
12566 any special code for MethodGroupExprs anymore, they're now
12569 2002-08-08 Martin Baulig <martin@gnome.org>
12571 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
12572 Family, FamANDAssem and FamORAssem permissions.
12573 (TypeManager.IsSubclassOrNestedChildOf): New public method.
12575 2002-08-08 Martin Baulig <martin@gnome.org>
12577 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
12578 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
12581 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
12583 * driver.cs: implemented /resource option to embed managed resources.
12585 2002-08-07 Martin Baulig <martin@gnome.org>
12587 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
12588 (FieldBase.HasFieldInitializer): New public property.
12589 (FieldBase.GetInitializerExpression): New public method. Resolves and
12590 returns the field initializer and makes sure it is only resolved once.
12591 (TypeContainer.EmitFieldInitializers): Call
12592 FieldBase.GetInitializerExpression to get the initializer, this ensures
12593 that it isn't resolved multiple times.
12595 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
12596 the resolving process (SimpleName/MemberLookup) that we're currently
12597 emitting a field initializer (which must not access any instance members,
12598 this is an error CS0236).
12600 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
12601 argument, if the `IsFieldInitializer' flag is set, we must report and
12602 error CS0236 and not an error CS0120.
12604 2002-08-07 Martin Baulig <martin@gnome.org>
12606 * ecore.cs (IMemberExpr): New public interface.
12607 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
12608 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
12609 if the expression is an IMemberExpr.
12611 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
12612 to be null, implicitly default to `this' if we're non-static in
12613 this case. Simplified the code a lot by using the new IMemberExpr
12614 interface. Also fixed bug #28176 here.
12616 2002-08-06 Martin Baulig <martin@gnome.org>
12618 * cs-parser.jay (SimpleLookup): Removed. We need to create
12619 ParameterReferences during semantic analysis so that we can do a
12620 type-only search when resolving Cast, TypeOf and SizeOf.
12621 (block): Pass the `current_local_parameters' to the Block's
12624 * class.cs (ConstructorInitializer): Added `Parameters parameters'
12625 argument to the constructor.
12626 (ConstructorInitializer.Resolve): Create a temporary implicit
12627 block with the parameters.
12629 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
12630 references here if we aren't doing a type-only search.
12632 * statement.cs (Block): Added constructor which takes a
12633 `Parameters parameters' argument.
12634 (Block.Parameters): New public property.
12636 * support.cs (InternalParameters.Parameters): Renamed `parameters'
12637 to `Parameters' and made it public readonly.
12639 2002-08-06 Martin Baulig <martin@gnome.org>
12641 * ecore.cs (Expression.Warning): Made this public as well.
12643 * report.cs (Report.Debug): Print the contents of collections.
12645 2002-08-06 Martin Baulig <martin@gnome.org>
12647 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
12648 used to tell Resolve() which kinds of expressions it may return.
12649 (Expression.Resolve): Added overloaded version of this method which
12650 takes a `ResolveFlags flags' argument. This can be used to tell
12651 Resolve() which kinds of expressions it may return. Reports a
12653 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
12654 ResolveFlags.SimpleName.
12655 (Expression.Error118): Added overloaded version of this method which
12656 takes a `ResolveFlags flags' argument. It uses the flags to determine
12657 which kinds of expressions are allowed.
12659 * expression.cs (Argument.ResolveMethodGroup): New public method.
12660 Resolves an argument, but allows a MethodGroup to be returned.
12661 This is used when invoking a delegate.
12663 * TODO: Updated a bit.
12665 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12667 Fixed compilation with csc.
12669 * ecore.cs: Expression.Error made public. Is this correct? Should
12670 Warning be made public too?
12672 * expression.cs: use ea.Location instead of ea.loc.
12673 [FIXME: Filed as bug #28607: MCS must report these errors.]
12675 2002-08-06 Martin Baulig <martin@gnome.org>
12677 * ecore.cs (Expression.loc): Moved the location here instead of
12678 duplicating it in all derived classes.
12679 (Expression.Location): New public property.
12680 (Expression.Error, Expression.Warning): Made them non-static and
12681 removed the location argument.
12682 (Expression.Warning): Added overloaded version which takes an
12683 `int level' argument.
12684 (Expression.Error118): Make this non-static and removed the
12685 expression and location arguments.
12686 (TypeExpr): Added location argument to the constructor.
12688 * expression.cs (StaticCallExpr): Added location argument to
12690 (Indirection, PointerArithmetic): Likewise.
12691 (CheckedExpr, UnCheckedExpr): Likewise.
12692 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
12693 (StringPtr): Likewise.
12696 2002-08-05 Martin Baulig <martin@gnome.org>
12698 * expression.cs (BaseAccess.DoResolve): Actually report errors.
12700 * assign.cs (Assign.DoResolve): Check whether the source
12701 expression is a value or variable.
12703 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
12704 while resolving the corresponding blocks.
12706 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
12707 an error, don't silently return null.
12709 * statement.cs (Block.AddVariable): Do the error reporting here
12710 and distinguish between CS0128 and CS0136.
12711 (Block.DoResolve): Report all unused labels (warning CS0164).
12712 (LabeledStatement): Pass the location to the constructor.
12713 (LabeledStatement.HasBeenReferenced): New property.
12714 (LabeledStatement.Resolve): Set it to true here.
12716 * statement.cs (Return.Emit): Return success even after reporting
12717 a type mismatch error (CS0126 or CS0127), this is what csc does and
12718 it avoids confusing the users with any consecutive errors.
12720 2002-08-05 Martin Baulig <martin@gnome.org>
12722 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
12724 * const.cs (Const.LookupConstantValue): Catch circular definitions.
12726 * expression.cs (MemberAccess.DoResolve): Silently return if an
12727 error has already been reported.
12729 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
12730 error has already been reported.
12732 2002-08-05 Martin Baulig <martin@gnome.org>
12734 * statement.cs (UsageVector): Only initialize the `parameters'
12735 vector if we actually have any "out" parameters.
12737 2002-08-05 Martin Baulig <martin@gnome.org>
12739 * expression.cs (Binary.ResolveOperator): When combining delegates,
12740 they must have the same type.
12742 2002-08-05 Martin Baulig <martin@gnome.org>
12744 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
12745 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
12746 work with the ms runtime and we also don't need it: if we're a
12747 PropertyBuilder and not in the `indexer_arguments' hash, then we
12748 are a property and not an indexer.
12750 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
12751 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
12752 since the latter one doesn't work with the ms runtime.
12754 2002-08-03 Martin Baulig <martin@gnome.org>
12756 Fixed bugs #27998 and #22735.
12758 * class.cs (Method.IsOperator): New public field.
12759 (Method.CheckBase): Report CS0111 if there's already a method
12760 with the same parameters in the current class. Report CS0508 when
12761 attempting to change the return type of an inherited method.
12762 (MethodData.Emit): Report CS0179 if a method doesn't have a body
12763 and it's not marked abstract or extern.
12764 (PropertyBase): New abstract base class for Property and Indexer.
12765 (PropertyBase.CheckBase): Moved here from Property and made it work
12767 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
12768 the same so we can reuse it there.
12769 (Property, Indexer): Derive from PropertyBase.
12770 (MethodSignature.inheritable_property_signature_filter): New delegate
12771 to find properties and indexers.
12773 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
12774 argument and improved error reporting.
12776 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
12777 EmptyReadOnlyParameters and made it a property.
12779 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
12780 version of this method which takes a `PropertyInfo indexer'.
12781 (TypeManager.RegisterIndexer): New method.
12783 * class.cs: Added myself as author of this file :-)
12785 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12787 * class.cs: fixed compilation on windoze.
12789 2002-08-03 Martin Baulig <martin@gnome.org>
12791 * interface.cs (Interface.GetInterfaceBases): Check whether all
12792 base interfaces are at least as accessible than the current one.
12794 * class.cs (TypeContainer.GetClassBases): Check whether base types
12795 are at least as accessible than the current type.
12796 (TypeContainer.AsAccessible): Implemented and made non-static.
12797 (MemberBase.CheckParameters): Report errors if the accessibility
12800 * delegate.cs (Delegate.Delegate): The default visibility is
12801 internal for top-level types and private for nested types.
12802 (Delegate.Define): Report errors if the accessibility checks fail.
12804 * enum.cs (Enum.Enum): The default visibility is internal for
12805 top-level types and private for nested types.
12806 (Enum.DefineType): Compute the correct visibility.
12808 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
12809 function which takes a `bool is_toplevel' instead of a TypeContainer.
12811 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
12814 2002-08-02 Martin Baulig <martin@gnome.org>
12816 * expression.cs (LocalVariableReferenc): Added constructor which
12817 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
12818 (LocalVariableReference.IsReadOnly): New property.
12819 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
12820 variable is readonly, use our own readonly flag to do this; you can
12821 use the new constructor to get a writable reference to a read-only
12824 * cs-parser.jay (foreach_statement, using_statement): Get a writable
12825 reference to the local variable.
12827 2002-08-01 Miguel de Icaza <miguel@ximian.com>
12829 * rootcontext.cs (ResolveCore): Also include System.Exception
12831 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
12832 we reach an EmptyStatement.
12834 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
12837 * expression.cs (Binary.ResolveOperator): Check error result in
12840 use brtrue/brfalse directly and avoid compares to null.
12842 2002-08-02 Martin Baulig <martin@gnome.org>
12844 * class.cs (TypeContainer.Define): Define all nested interfaces here.
12845 Fixes bug #28407, added test-155.cs.
12847 2002-08-01 Martin Baulig <martin@gnome.org>
12849 * class.cs (Event.EmitDefaultMethod): Make this work with static
12850 events. Fixes #28311, added verify-3.cs.
12852 2002-08-01 Martin Baulig <martin@gnome.org>
12854 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
12855 `is_disposable' fields.
12856 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
12857 `hm.is_disposable' if we're using the collection pattern.
12858 (Foreach.EmitCollectionForeach): Use the correct type for the
12859 enumerator's local variable, only emit the try/finally block if
12860 necessary (fixes #27713).
12862 2002-08-01 Martin Baulig <martin@gnome.org>
12864 * ecore.cs (Expression.report118): Renamed to Error118 and made
12867 * statement.cs (Throw.Resolve): Check whether the expression is of
12868 the correct type (CS0118) and whether the type derives from
12869 System.Exception (CS0155).
12870 (Catch.Resolve): New method. Do the type lookup here and check
12871 whether it derives from System.Exception (CS0155).
12872 (Catch.CatchType, Catch.IsGeneral): New public properties.
12874 * typemanager.cs (TypeManager.exception_type): Added.
12876 2002-07-31 Miguel de Icaza <miguel@ximian.com>
12878 * driver.cs: Updated About function.
12880 2002-07-31 Martin Baulig <martin@gnome.org>
12882 Implemented Control Flow Analysis.
12884 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
12885 (EmitContext.CurrentBranching): Added.
12886 (EmitContext.StartFlowBranching): Added.
12887 (EmitContext.EndFlowBranching): Added.
12888 (EmitContext.KillFlowBranching): Added.
12889 (EmitContext.IsVariableAssigned): Added.
12890 (EmitContext.SetVariableAssigned): Added.
12891 (EmitContext.IsParameterAssigned): Added.
12892 (EmitContext.SetParameterAssigned): Added.
12893 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
12894 Added control flow analysis stuff here.
12896 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
12897 resolve the expression as lvalue.
12898 (LocalVariableReference.DoResolve): Check whether the variable has
12899 already been assigned.
12900 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
12901 the parameter as assigned here.
12902 (ParameterReference.DoResolve): Check whether the parameter has already
12904 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
12905 expression as lvalue.
12907 * statement.cs (FlowBranching): New class for the flow analysis code.
12908 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
12909 (LabeledStatement.IsDefined): New public property.
12910 (LabeledStatement.AddUsageVector): New public method to tell flow
12911 analyis that the label may be reached via a forward jump.
12912 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
12914 (VariableInfo.Number): New public field. This is used by flow analysis
12915 to number all locals of a block.
12916 (Block.CountVariables): New public property. This is the number of
12917 local variables in this block (including the locals from all parent
12919 (Block.EmitMeta): Number all the variables.
12921 * statement.cs: Added flow analysis support to all classes.
12923 2002-07-31 Martin Baulig <martin@gnome.org>
12925 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
12926 To get debugging messages, compile mcs with /define:MCS_DEBUG and
12927 then use this argument.
12929 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
12931 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
12932 use this to specify /define options.
12934 2002-07-29 Martin Baulig <martin@gnome.org>
12936 * statement.cs (Fixed): Moved all code that does variable lookups
12937 and resolvings from Emit to Resolve.
12939 * statement.cs (For): Moved all code that does variable lookups
12940 and resolvings from Emit to Resolve.
12942 * statement.cs (Using): Moved all code that does variable lookups
12943 and resolvings from Emit to Resolve.
12945 2002-07-29 Martin Baulig <martin@gnome.org>
12947 * attribute.cs (Attribute.Resolve): Explicitly catch a
12948 System.NullReferenceException when creating the
12949 CustromAttributeBuilder and report a different warning message.
12951 2002-07-29 Martin Baulig <martin@gnome.org>
12953 * support.cs (ParameterData.ParameterName): Added method to
12954 get the name of a parameter.
12956 * typemanager.cs (TypeManager.IsValueType): New public method.
12958 2002-07-29 Martin Baulig <martin@gnome.org>
12960 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
12961 is a flag which specifies that it's either ref or out.
12962 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
12963 the out parameter to `out Parameter.Modifier mod', also set the
12964 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
12966 * support.cs (InternalParameters.ParameterModifier): Distinguish
12967 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12968 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12970 * expression.cs (Argument.GetParameterModifier): Distinguish
12971 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12972 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12974 2002-07-29 Martin Baulig <martin@gnome.org>
12976 * expression.cs (ParameterReference.ParameterReference): Added
12977 `Location loc' argument to the constructor.
12979 * cs-parser.jay: Pass location to ParameterReference.
12981 2002-07-28 Miguel de Icaza <miguel@ximian.com>
12983 * statement.cs (Try): Initialize the location.
12985 * cs-parser.jay: pass location to Try.
12987 * expression.cs (Unary.Reduce): Change the prototype to return
12988 whether a constant fold could be performed or not. The result is
12989 returned in an out parameters. In the case of Indirection and
12990 AddressOf, we want to perform the full tests.
12992 2002-07-26 Miguel de Icaza <miguel@ximian.com>
12994 * statement.cs (Statement.Emit): Flag dead code.
12996 2002-07-27 Andrew Birkett <andy@nobugs.org>
12998 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13000 2002-07-27 Martin Baulig <martin@gnome.org>
13002 * class.cs (MethodData.Define): Put back call to
13003 TypeManager.AddMethod(), accidentally commented this out.
13005 * report.cs (Debug): New public method to print debugging information,
13006 this is `[Conditional ("DEBUG")]'.
13008 2002-07-26 Martin Baulig <martin@gnome.org>
13010 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13011 (switch_statement): Push the current_block to the switch_stack and
13012 pop it again when we're done with the switch.
13013 (switch_section): The new block is a child of the current_block.
13014 Fixes bug #24007, added test-152.cs.
13016 2002-07-27 Martin Baulig <martin@gnome.org>
13018 * expression.cs (Invocation.EmitArguments): When calling a varargs
13019 function with only its fixed arguments, we need to pass an empty
13022 2002-07-27 Martin Baulig <martin@gnome.org>
13024 Mono 0.13 has been released.
13026 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13028 * driver.cs: Rename --resource to --linkres, because that is what
13029 we do currently, we dont support --resource yet.
13031 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13033 2002-07-25 Martin Baulig <martin@gnome.org>
13035 * class.cs (MethodData): New public class. This is a `method builder'
13036 class for a method or one accessor of a Property/Indexer/Event.
13037 (MethodData.GetMethodFlags): Moved here from MemberBase.
13038 (MethodData.ApplyAttributes): Likewise.
13039 (MethodData.ApplyObsoleteAttribute): Likewise.
13040 (MethodData.ApplyConditionalAttribute): Likewise.
13041 (MethodData.ApplyDllImportAttribute): Likewise.
13042 (MethodData.CheckAbstractAndExternal): Likewise.
13043 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13044 (MethodData.Emit): Formerly known as Method.Emit().
13045 (MemberBase): Moved everything which was specific to a single
13046 accessor/method to MethodData.
13047 (Method): Create a new MethodData and call Define() and Emit() on it.
13048 (Property, Indexer, Event): Create a new MethodData objects for each
13049 accessor and call Define() and Emit() on them.
13051 2002-07-25 Martin Baulig <martin@gnome.org>
13053 Made MethodCore derive from MemberBase to reuse the code from there.
13054 MemberBase now also checks for attributes.
13056 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
13057 (MemberBase.GetMethodFlags): Moved here from class Method and marked
13059 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
13060 `CallingConventions cc' and `Attributes opt_attrs' arguments.
13061 (MemberBase.ApplyAttributes): New virtual method; applies the
13062 attributes to a method or accessor.
13063 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
13064 (MemberBase.ApplyConditionalAttribute): Likewise.
13065 (MemberBase.ApplyDllImportAttribute): Likewise.
13066 (MemberBase.CheckAbstractAndExternal): Likewise.
13067 (MethodCore.ParameterTypes): This is now a property instead of a
13068 method, it's initialized from DoDefineParameters().
13069 (MethodCore.ParameterInfo): Removed the set accessor.
13070 (MethodCore.DoDefineParameters): New protected virtual method to
13071 initialize ParameterTypes and ParameterInfo.
13072 (Method.GetReturnType): We can now simply return the MemberType.
13073 (Method.GetMethodFlags): Override the MemberBase version and add
13074 the conditional flags.
13075 (Method.CheckBase): Moved some code from Define() here, call
13076 DoDefineParameters() here.
13077 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
13078 here to avoid some larger code duplication.
13079 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
13080 ensure that abstract and external accessors don't declare a body.
13082 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
13083 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
13084 lookup in the attribute's parent classes, so we need to abort as soon
13085 as we found the first match.
13086 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
13087 the attribute has no arguments.
13089 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
13092 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13094 * cs-parser.jay: reverted previous patch.
13096 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13098 * cs-parser.jay: fixed bug #22119.
13100 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13102 * attribute.cs: fixed compilation. The error was:
13103 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
13104 be assigned to before control leaves the current method."
13105 [FIXME: Filed as bug #28186: MCS must report this error.]
13107 2002-07-25 Martin Baulig <martin@gnome.org>
13109 * attribute.cs (Attribute.Conditional_GetConditionName): New static
13110 method to pull the condition name ouf of a Conditional attribute.
13111 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
13112 the obsolete message and error flag out of an Obsolete attribute.
13114 * class.cs (Method.GetMethodFlags): New public method to get the
13115 TypeManager.MethodFlags for this method.
13116 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
13118 (Method.Define): Get and apply the Obsolete and Conditional attributes;
13119 if we're overriding a virtual function, set the new private variable
13120 `parent_method'; call the new TypeManager.AddMethod().
13122 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
13123 the MethodBuilder and the Method in a PtrHashtable.
13124 (TypeManager.builder_to_method): Added for this purpose.
13125 (TypeManager.MethodFlags): Added IsObsoleteError.
13126 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
13127 Obsolete and Conditional arguments in MethodBuilders. If we discover
13128 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
13129 the message from the attribute.
13131 2002-07-24 Martin Baulig <martin@gnome.org>
13133 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
13134 preprocessor directives, ensure that the argument to #define/#undef is
13135 exactly one identifier and that it's actually an identifier.
13137 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
13140 2002-07-24 Martin Baulig <martin@gnome.org>
13142 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
13143 initialize it to TypeManager.object_type in the constructor.
13144 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
13145 of the `hm.get_current' method if we're using the collection pattern.
13146 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
13147 for the explicit conversion to make it work when we're using the collection
13148 pattern and the `Current' property has a different return type than `object'.
13151 2002-07-24 Martin Baulig <martin@gnome.org>
13153 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
13154 does not match, but don't report any errors. This method is called in
13155 order for all methods in a MethodGroupExpr until a matching method is
13156 found, so we don't want to bail out if the first method doesn't match.
13157 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
13158 matches, report the 123. Fixes #28070.
13160 2002-07-24 Martin Baulig <martin@gnome.org>
13162 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
13163 TypeManager.TypeToCoreType() to the top of the method so the
13164 following equality checks will work. Fixes #28107.
13166 2002-07-24 Martin Baulig <martin@gnome.org>
13168 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
13169 operand is of type uint, and the other operand is of type sbyte,
13170 short or int, the operands are converted to type long." -
13171 Actually do what this comment already told us. Fixes bug #28106,
13174 2002-07-24 Martin Baulig <martin@gnome.org>
13176 * class.cs (MethodBase): New abstract class. This is now a base
13177 class for Property, Indexer and Event to avoid some code duplication
13178 in their Define() and DefineMethods() methods.
13179 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
13180 generic methods for Define() and DefineMethods().
13181 (FieldBase): Derive from MemberBase, not MemberCore.
13182 (Property): Derive from MemberBase, not MemberCore.
13183 (Property.DefineMethod): Moved all the code from this method to the
13184 new MethodBase.DefineAccessor(), just call it with appropriate
13186 (Property.Define): Call the new Property.DoDefine(), this does some
13187 sanity checks and we don't need to duplicate the code everywhere.
13188 (Event): Derive from MemberBase, not MemberCore.
13189 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
13190 accessors, this will also make them work with interface events.
13191 (Indexer): Derive from MemberBase, not MemberCore.
13192 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
13193 (Indexer.Define): Use the new MethodBase functions.
13195 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
13196 argument to the constructor.
13197 (Interface.FindMembers): Added support for interface events.
13198 (Interface.PopluateEvent): Implemented.
13200 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
13202 2002-07-22 Miguel de Icaza <miguel@ximian.com>
13204 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
13205 but this is required to check for a method name being the same as
13206 the containing class.
13210 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13212 * interface.cs: initialize variable.
13214 2002-07-23 Martin Baulig <martin@gnome.org>
13216 Implemented the IndexerName attribute in interfaces.
13218 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
13219 name if this is an explicit interface implementation.
13220 (Indexer.InterfaceIndexerName): New public variable. If we're
13221 implementing an interface indexer, this is the IndexerName in that
13222 interface. Otherwise, it's the IndexerName.
13223 (Indexer.DefineMethod): If we're implementing interface indexer,
13224 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
13225 and Pending.ImplementIndexer methods.
13226 (Indexer.Define): Also define the PropertyBuilder if we're
13227 implementing an interface indexer and this is neither an explicit
13228 interface implementation nor do the IndexerName match the one in
13231 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
13232 If a method is defined here, then we always need to create a proxy
13233 for it. This is used when implementing interface indexers.
13234 (Pending.IsInterfaceIndexer): New public method.
13235 (Pending.ImplementIndexer): New public method.
13236 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
13237 This is used when implementing interface indexers to define a proxy
13239 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
13240 define a proxy if necessary.
13242 * interface.cs (Interface.IndexerName): New public variable.
13243 (Interface.PopulateIndexer): Set the IndexerName.
13244 (Interface.DefineIndexers): New private method. Populate all the
13245 indexers and make sure their IndexerNames match.
13247 * typemanager.cs (IndexerPropertyName): Added support for interface
13250 2002-07-22 Martin Baulig <martin@gnome.org>
13252 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
13253 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
13254 ret if HasReturnLabel.
13255 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
13258 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
13259 and set the ec.LoopBeginTryCatchLevel.
13260 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
13261 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
13262 the current ec.TryCatchLevel, the branch goes out of an exception
13263 block. In this case, we need to use Leave and not Br.
13265 2002-07-22 Martin Baulig <martin@gnome.org>
13267 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
13268 block unless the block does not always return or it is contained in
13269 another try { ... } catch { ... } block. Fixes bug #26506.
13270 Added verify-1.cs to the test suite.
13272 2002-07-22 Martin Baulig <martin@gnome.org>
13274 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
13275 then we do not always return. Fixes bug #24985.
13277 2002-07-22 Martin Baulig <martin@gnome.org>
13279 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
13280 lookup on a per-class level; ie. walk up the class hierarchy until we
13281 found at least one applicable method, then choose the best among them.
13282 Fixes bug #24463 and test-29.cs.
13284 2002-07-22 Martin Baulig <martin@gnome.org>
13286 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
13287 return types of the methods. The return type is not part of the
13288 signature and we must not check it to make the `new' modifier work.
13289 Fixes bug #27999, also added test-147.cs.
13290 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
13292 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
13293 on the method's return type.
13295 2002-07-21 Martin Baulig <martin@gnome.org>
13297 * assign.cs: Make this work if the rightmost source is a constant and
13298 we need to do an implicit type conversion. Also adding a few more tests
13299 to test-38.cs which should have caught this.
13301 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
13302 target in the makefile for this. The makefile.gnu is primarily intended
13303 for end-users who don't want to debug the compiler.
13305 2002-07-21 Martin Baulig <martin@gnome.org>
13307 * assign.cs: Improved the Assign class so it can now handle embedded
13308 assignments (X = Y = Z = something). As a side-effect this'll now also
13309 consume less local variables. test-38.cs now passes with MCS, added
13310 a few new test cases to that test.
13312 2002-07-20 Martin Baulig <martin@gnome.org>
13314 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
13315 instructions. Fixes bug #27977, also added test-146.cs.
13317 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13319 * cs-tokenizer.cs: fixed getHex ().
13321 2002-07-19 Martin Baulig <martin@gnome.org>
13323 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
13324 not Type.GetType() to lookup the array type. This is needed when
13325 we're constructing an array of a user-defined type.
13326 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
13327 single-dimensional arrays, but also for single-dimensial arrays of
13330 2002-07-19 Martin Baulig <martin@gnome.org>
13332 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
13333 this function is called, it's not allowed to share LocalBuilders
13334 among ILGenerators.
13336 2002-07-19 Martin Baulig <martin@gnome.org>
13338 * expression.cs (Argument.Resolve): Report an error 118 when trying
13339 to pass a type as argument.
13341 2002-07-18 Martin Baulig <martin@gnome.org>
13343 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
13344 Conv_R_Un for the signed `long' type.
13346 2002-07-15 Miguel de Icaza <miguel@ximian.com>
13348 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
13349 `expr' for the temporary result, as that will fail if we do
13350 multiple resolves on the same expression.
13352 2002-07-05 Miguel de Icaza <miguel@ximian.com>
13354 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
13355 ec.TypeContainer for looking up aliases.
13357 * class.cs (TypeContainer): Remove LookupAlias from here.
13359 * decl.cs (DeclSpace); Move here.
13361 2002-07-01 Miguel de Icaza <miguel@ximian.com>
13363 * class.cs (FindMembers): Only call filter if the constructor
13364 bulider is not null.
13366 Also handle delegates in `NestedTypes' now. Now we will perform
13367 type lookups using the standard resolution process. This also
13370 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
13371 This uses Expressions (the limited kind that can be parsed by the
13372 tree) instead of strings.
13374 * expression.cs (ComposedCast.ToString): Implement, used to flag
13375 errors since now we have to render expressions.
13377 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
13380 * ecore.cs (SimpleName.ToString): ditto.
13382 * cs-parser.jay: Instead of using strings to assemble types, use
13383 Expressions to assemble the type (using SimpleName, ComposedCast,
13384 MemberAccess). This should fix the type lookups in declarations,
13385 because we were using a different code path for this.
13387 * statement.cs (Block.Resolve): Continue processing statements
13388 even when there is an error.
13390 2002-07-17 Miguel de Icaza <miguel@ximian.com>
13392 * class.cs (Event.Define): Also remove the `remove' method from
13393 the list of pending items.
13395 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
13396 generate more compact code.
13398 2002-07-17 Martin Baulig <martin@gnome.org>
13400 * const.cs (Const.LookupConstantValue): Add support for constant
13401 `unchecked' and `checked' expressions.
13402 Also adding test case test-140.cs for this.
13404 2002-07-17 Martin Baulig <martin@gnome.org>
13406 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
13407 check whether mi.ReturnType implements the IEnumerator interface; the
13408 `==' and the IsAssignableFrom() will fail in this situation.
13410 2002-07-16 Ravi Pratap <ravi@ximian.com>
13412 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
13415 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13417 * expression.cs: fixed bug #27811.
13419 2002-07-14 Miguel de Icaza <miguel@ximian.com>
13421 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
13422 Molaro: when we are a ref, the value already contains a pointer
13423 value, do not take the address of it.
13425 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
13426 * removed mb-parser.jay and mb-tokenizer.cs
13428 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13430 * expression.cs: check against the building corlib void type.
13432 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
13434 * ecore.cs: fix for valuetype static readonly fields: when
13435 initializing them, we need their address, not the address of a copy.
13437 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
13439 * typemanager.cs: register also enum_type in corlib.
13441 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
13443 * class.cs: allow calling this (but not base) initializers in structs.
13445 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
13447 * ecore.cs: make sure we compare against the building base types
13450 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
13452 * typemanager.cs: fix TypeToCoreType() to handle void and object
13453 (corlib gets no more typerefs after this change).
13455 2002-07-12 Miguel de Icaza <miguel@ximian.com>
13457 * expression.cs (ArrayCreation.EmitArrayArguments): use
13458 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
13460 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
13461 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
13462 array indexes, the runtime actually forbids them.
13464 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
13465 for array arguments here.
13467 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
13468 instead of the default for ValueTypes.
13470 (New.DoEmit): Use IsValueType instead of
13471 IsSubclassOf (value_type)
13472 (New.DoResolve): ditto.
13473 (Invocation.EmitCall): ditto.
13475 * assign.cs (Assign): ditto.
13477 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
13478 Statements *are* currently doing part of their resolution during
13481 Expressions do always resolve during resolve, but statements are
13482 only required to propagate resolution to their children.
13484 2002-07-11 Miguel de Icaza <miguel@ximian.com>
13486 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
13488 (LoadAssembly): Do not add the dll if it is already specified
13490 (MainDriver): Add the System directory to the link path at the end,
13491 after all the other -L arguments.
13493 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
13494 wrong opcode for loading bytes and bools (ldelem.i1 instead of
13495 ldelem.u1) and using the opposite for sbytes.
13497 This fixes Digger, and we can finally run it.
13499 * driver.cs (UnixParseOption): Move the option parsing here.
13500 (CSCParseOption): Implement CSC-like parsing of options.
13502 We now support both modes of operation, the old Unix way, and the
13503 new CSC-like way. This should help those who wanted to make cross
13504 platform makefiles.
13506 The only thing broken is that /r:, /reference: and /lib: are not
13507 implemented, because I want to make those have the same semantics
13508 as the CSC compiler has, and kill once and for all the confussion
13509 around this. Will be doing this tomorrow.
13511 * statement.cs (Unsafe.Resolve): The state is checked during
13512 resolve, not emit, so we have to set the flags for IsUnsfe here.
13514 2002-07-10 Miguel de Icaza <miguel@ximian.com>
13516 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
13517 not catch the Error_ObjectRefRequired in SimpleName (as it is
13518 possible to have a class/instance variable name that later gets
13519 deambiguated), we have to check this here.
13521 2002-07-10 Ravi Pratap <ravi@ximian.com>
13523 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
13524 make static and put into Expression.
13526 (Event.Define): Register the private field of the event with the
13527 TypeManager so that GetFieldFromEvent can get at it.
13529 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
13530 keep track of the private field associated with an event which
13533 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
13536 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
13538 2002-07-10 Miguel de Icaza <miguel@ximian.com>
13540 * expression.cs (Binary.EmitBranchable): this routine emits the
13541 Binary expression in a branchable context. This basically means:
13542 we need to branch somewhere, not just get the value on the stack.
13544 This works together with Statement.EmitBoolExpression.
13546 * statement.cs (Statement.EmitBoolExpression): Use
13549 2002-07-09 Miguel de Icaza <miguel@ximian.com>
13551 * statement.cs (For): Reduce the number of jumps in loops.
13553 (For): Implement loop inversion for the For statement.
13555 (Break): We can be breaking out of a Try/Catch controlled section
13556 (foreach might have an implicit try/catch clause), so we need to
13557 use Leave instead of Br.
13559 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
13560 now). If the instace expression supports IMemoryLocation, we use
13561 the AddressOf method from the IMemoryLocation to extract the
13562 address instead of emitting the instance.
13564 This showed up with `This', as we were emitting the instance
13565 always (Emit) instead of the Address of This. Particularly
13566 interesting when This is a value type, as we dont want the Emit
13567 effect (which was to load the object).
13569 2002-07-08 Miguel de Icaza <miguel@ximian.com>
13571 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
13573 * statement.cs (Checked): Set the CheckedState during the resolve
13574 process too, as the ConvCast operations track the checked state on
13575 the resolve process, and not emit.
13577 * cs-parser.jay (namespace_member_declaration): Flag that we have
13578 found a declaration when we do. This is used to flag error 1529
13580 * driver.cs: Report ok when we display the help only.
13582 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
13584 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
13586 2002-07-04 Miguel de Icaza <miguel@ximian.com>
13588 * cs-tokenizer.cs (define): We also have to track locally the
13589 defines. AllDefines is just used for the Conditional Attribute,
13590 but we also need the local defines for the current source code.
13592 2002-07-03 Miguel de Icaza <miguel@ximian.com>
13594 * statement.cs (While, For, Do): These loops can exit through a
13595 Break statement, use this information to tell whether the
13596 statement is the last piece of code.
13598 (Break): Flag that we break.
13600 * codegen.cs (EmitContexts): New `Breaks' state variable.
13602 2002-07-03 Martin Baulig <martin@gnome.org>
13604 * class.cs (TypeContainer.MethodModifiersValid): Allow override
13605 modifiers in method declarations in structs. Otherwise, you won't
13606 be able to override things like Object.Equals().
13608 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13610 * class.cs (Method, Property, Indexer): Do not allow the public
13611 modifier to be used in explicit interface implementations.
13613 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
13614 override modifiers in method declarations in structs
13616 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
13618 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
13619 integer or real overflow, report an error
13621 2002-07-02 Martin Baulig <martin@gnome.org>
13623 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
13624 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
13625 to tell the runtime about our newly created System.Object and
13626 System.ValueType types.
13628 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13630 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
13631 struct instead of Ldarg/Starg.
13633 2002-07-02 Martin Baulig <martin@gnome.org>
13635 * expression.cs (Indirection.Indirection): Call
13636 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
13638 2002-07-02 Martin Baulig <martin@gnome.org>
13640 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
13641 ValueType, call TypeManager.TypeToCoreType() on it.
13642 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
13643 the OpCodes.Newarr argument.
13645 2002-07-02 Martin Baulig <martin@gnome.org>
13647 * expression.cs (Invocation.EmitCall): When compiling corlib,
13648 replace all calls to the system's System.Array type to calls to
13649 the newly created one.
13651 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
13652 System.Array methods.
13653 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
13654 from the system's System.Array type which must be replaced.
13656 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
13658 * typemanager.cs: load unverifiable_code_ctor so we can build
13659 corlib using the correct type. Avoid using GetTypeCode() with
13661 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
13662 TypeManager.object_type to allow building corlib.
13664 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
13666 * ecore.cs: handle System.Enum separately in LoadFromPtr().
13668 2002-07-01 Martin Baulig <martin@gnome.org>
13670 * class.cs: Make the last change actually work, we need to check
13671 whether `ifaces != null' to avoid a crash.
13673 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13675 * class.cs: when we build structs without fields that implement
13676 interfaces, we need to add the interfaces separately, since there is
13677 no API to both set the size and add the interfaces at type creation
13680 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
13682 * expression.cs: the dimension arguments to the array constructors
13683 need to be converted if they are a long.
13685 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
13687 * class.cs: don't emit ldarg.0 if there is no parent constructor
13688 (fixes showstopper for corlib).
13690 2002-06-29 Martin Baulig <martin@gnome.org>
13692 MCS now compiles corlib on GNU/Linux :-)
13694 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
13695 ie. check for MethodImplOptions.InternalCall.
13697 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
13698 and TypeManager.attribute_type are null, so we must explicitly check
13699 whether parent is not null to find out whether it's an attribute type.
13700 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
13701 and SetBuilder, not only if the property is neither abstract nor external.
13702 This is necessary to set the MethodImplOptions on the accessor methods.
13703 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
13704 SetBuilder, see Property.Emit().
13706 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
13707 populate "System.Object", "System.ValueType" and "System.Attribute" since
13708 they've already been populated from BootCorlib_PopulateCoreTypes().
13710 2002-06-29 Martin Baulig <martin@gnome.org>
13712 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
13713 is the NullLiteral, we also need to make sure that target_type is not
13716 2002-06-29 Martin Baulig <martin@gnome.org>
13718 * rootcontext.cs (RootContext.ResolveCore): We must initialize
13719 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
13720 before calling BootstrapCorlib_ResolveDelegate ().
13722 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13724 * statement.cs: fixed build-breaker. All tests passed ok.
13726 2002-06-27 Martin Baulig <martin@gnome.org>
13728 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
13729 for System.Decimal when compiling corlib.
13731 2002-06-27 Martin Baulig <martin@gnome.org>
13733 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
13734 switch blocks which contain nothing but a default clause.
13736 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
13738 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
13740 2002-06-27 Martin Baulig <martin@gnome.org>
13742 * ecore.cs (PropertyExpr.PropertyExpr): Call
13743 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
13745 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
13746 is already a TypeBuilder.
13748 2002-06-27 Martin Baulig <martin@gnome.org>
13750 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
13751 `target_type == TypeManager.array_type', not IsAssignableFrom() in
13752 the "from an array-type to System.Array" case. This makes it work
13753 when compiling corlib.
13755 2002-06-27 Martin Baulig <martin@gnome.org>
13757 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
13758 non-static PropertyExpr, set its InstanceExpression. This makes
13759 the `ICollection.Count' property work in System/Array.cs.
13761 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
13763 * driver.cs: Made error handling more consistent. Errors now
13764 tracked by Report class, so many methods which used to return int
13765 now return void. Main() now prints success/failure and
13766 errors/warnings message.
13768 Renamed '--probe' compiler argument to '--expect-error'. Removed
13769 the magic number return values (123 and 124). Now, if the
13770 expected error occurs, the compiler exits with success (exit value
13771 0). If the compilation completes without seeing that particular
13772 error, the compiler exits with failure (exit value 1). The
13773 makefile in mcs/errors has been changed to handle the new behaviour.
13775 * report.cs: Made 'expected error' number a property and renamed
13776 it from 'Probe' to 'ExpectedError'.
13778 * genericparser.cs: Removed error handling support, since it is
13779 now all done by Report class.
13781 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
13782 class, so parse() no longer returns an int.
13784 * namespace.cs: Use Report.Error instead of GenericParser.error
13786 2002-06-22 Miguel de Icaza <miguel@ximian.com>
13788 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
13789 TypeContainer.AddOperator): At the front of the list put the
13790 explicit implementations, so they get resolved/defined first.
13792 2002-06-21 Miguel de Icaza <miguel@ximian.com>
13794 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
13795 interface type is implemented by this TypeContainer. Used during
13796 explicit interface implementation.
13798 (Property.Define, Indexer.Define, Method.Define): Validate that
13799 the given interface in the explicit implementation is one of the
13800 base classes for the containing type.
13802 Also if we are explicitly implementing an interface, but there is
13803 no match in the pending implementation table, report an error.
13805 (Property.Define): Only define the property if we are
13806 not explicitly implementing a property from an interface. Use the
13807 correct name also for those properties (the same CSC uses,
13808 although that is really not needed).
13810 (Property.Emit): Do not emit attributes for explicitly implemented
13811 properties, as there is no TypeBuilder.
13813 (Indexer.Emit): ditto.
13815 Hiding then means that we do not really *implement* a pending
13816 implementation, which makes code fail.
13818 2002-06-22 Martin Baulig <martin@gnome.org>
13820 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
13821 the return value of Object.GetType(). [FIXME: we need to do this whenever
13822 we get a type back from the reflection library].
13824 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
13826 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
13828 2002-06-20 Miguel de Icaza <miguel@ximian.com>
13830 * attribute.cs: Return null if we can not look up the type.
13832 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
13833 the interface types found.
13835 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
13836 interface types found.
13838 * typemanager.cs (GetInterfaces): Make this routine returns alll
13839 the interfaces and work around the lame differences between
13840 System.Type and System.Reflection.Emit.TypeBuilder in the results
13841 result for GetInterfaces.
13843 (ExpandInterfaces): Given an array of interface types, expand and
13844 eliminate repeated ocurrences of an interface. This expands in
13845 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
13848 2002-06-21 Martin Baulig <martin@gnome.org>
13850 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
13853 2002-06-21 Martin Baulig <martin@gnome.org>
13855 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
13856 and called with one of the core types, return the corresponding typebuilder for
13859 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
13862 2002-06-21 Martin Baulig <martin@gnome.org>
13864 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
13865 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
13866 (Expression.ConvertReferenceExplicit): Likewise.
13868 * expression.cs (ElementAccess.DoResolve): Likewise.
13869 (ElementAccess.DoResolveLValue): Likewise.
13871 2002-06-10 Martin Baulig <martin@gnome.org>
13873 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
13874 add the "value" parameter to the parameter list.
13876 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
13879 2002-06-19 Miguel de Icaza <miguel@ximian.com>
13881 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
13882 the argument to an int, uint, long or ulong, per the spec. Also
13883 catch negative constants in array creation.
13885 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
13887 * class.cs: do not allow the same interface to appear twice in
13888 the definition list.
13890 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
13892 * ecore.cs: don't use ldlen with System.Array.
13894 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
13896 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
13898 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
13900 * modifiers.cs: produce correct field attributes for protected
13901 internal. Easy fix so miguel can work on ther harder stuff:-)
13903 2002-06-18 Miguel de Icaza <miguel@ximian.com>
13905 * pending.cs: New file. Move the code from class.cs here.
13906 Support clearning the pending flag for all methods (when not doing
13907 explicit interface implementation).
13909 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
13911 * rootcontext.cs: added a couple more types needed to bootstrap.
13913 2002-06-17 Miguel de Icaza <miguel@ximian.com>
13915 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
13916 constructor in the type, instead of any constructor in the type
13917 hierarchy. Thanks to Paolo for finding this bug (it showed up as
13918 a bug in the Mono runtime when applying the params attribute).
13920 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
13921 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
13923 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
13925 * expression.cs (Unary.ResolveOperator): Use TypeManager
13926 to resolve the type.
13928 2002-06-13 Ravi Pratap <ravi@ximian.com>
13930 * cs-parser.jay (enum_member_declaration): Pass in the attributes
13933 * enum.cs (AddEnumMember): Add support to store the attributes associated
13934 with each member too.
13936 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
13937 field builders too - this takes care of the enum member case.
13939 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
13941 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
13942 address-of operator on both value types and pointers.
13944 2002-06-10 Martin Baulig <martin@gnome.org>
13946 * interface.cs (Interface.PopulateIndexer): Add the indexer's
13947 PropertyBuilder to the `property_builders' list.
13949 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
13950 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
13951 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
13952 find any indexers which are inherited from an interface.
13954 2002-06-09 Martin Baulig <martin@gnome.org>
13956 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
13957 the same type as the constant if necessary. There's also a test-130.cs
13960 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
13962 * typemanager.cs (TypeManager.ChangeType): Previously known as
13963 Enum.ChangeEnumType().
13965 2002-06-09 Martin Baulig <martin@gnome.org>
13967 * expression.cs (Cast.TryReduce): Added support for consts.
13969 2002-06-08 Ravi Pratap <ravi@ximian.com>
13971 * class.cs (Accessor): Hold attributes information so we can pass
13974 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
13975 Modify to pass in attributes attached to the methods.
13977 (add_accessor_declaration, remove_accessor_declaration): Ditto.
13979 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
13980 to handle the Accessor kind :-)
13982 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
13984 2002-06-08 Martin Baulig <martin@gnome.org>
13986 * expression.cs (Unary.TryReduceNegative): Added support for
13989 2002-06-08 Martin Baulig <martin@gnome.org>
13991 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
13992 name can't be found in the `defined_names' - the caller will do a
13993 MemberLookup in this case and thus find methods in System.Enum
13994 such as Enum.IsDefined().
13996 2002-06-08 Martin Baulig <martin@gnome.org>
13998 * enum.cs (Enum.ChangeEnumType): This is a custom version of
13999 Convert.ChangeType() which works with TypeBuilder created types.
14000 (Enum.LookupEnumValue, Enum.Define): Use it here.
14002 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14003 `TypeBuilder.BaseType != null' check.
14004 (TypeContainer.FindMembers): Only lookup parent members if we
14005 actually have a parent.
14006 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14007 (ConstructorInitializer.Resolve): Likewise.
14009 * interface.cs (Interface.FindMembers): Added
14010 `TypeBuilder.BaseType != null' check.
14012 * rootcontext.cs (RootContext.ResolveCore): Added
14013 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14014 classes_second_stage.
14016 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14017 debug_type and trace_type when compiling with --nostdlib.
14019 2002-06-07 Martin Baulig <martin@gnome.org>
14021 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14022 (AddField): Set it to true when adding a non-static field.
14023 (DefineType): Use `have_nonstatic_fields' to find out whether we
14024 have non-static fields, not `Fields != null'.
14026 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14028 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14029 dereferencing a null on the static-field code path)
14031 2002-05-30 Martin Baulig <martin@gnome.org>
14033 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14034 to take command line arguments. Use reflection to call the new
14035 custom `Initialize' function on the symbol writer and pass it the
14036 command line arguments.
14038 * driver.cs (--debug-args): New command line argument to pass command
14039 line arguments to the symbol writer.
14041 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14043 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14044 the target type for indexers and properties. Thanks to Joe for
14047 2002-05-27 Miguel de Icaza <miguel@ximian.com>
14049 * typemanager.cs (MethodFlags): returns the method flags
14050 (Obsolete/ShouldIgnore) that control warning emission and whether
14051 the invocation should be made, or ignored.
14053 * expression.cs (Invocation.Emit): Remove previous hack, we should
14054 not do this on matching a base type, we should do this based on an attribute
14056 Only emit calls to System.Diagnostics.Debug and
14057 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
14058 on the command line.
14060 * rootcontext.cs: Global settings for tracing and debugging.
14062 * cs-tokenizer.cs (define): New utility function to track
14063 defines. Set the global settings for TRACE and DEBUG if found.
14065 2002-05-25 Ravi Pratap <ravi@ximian.com>
14067 * interface.cs (Populate*): Pass in the TypeContainer as well as
14068 the DeclSpace as parameters so that we can create EmitContexts and
14069 then use that to apply attributes etc.
14071 (PopulateMethod, PopulateEvent, PopulateProperty)
14072 (PopulateIndexer): Apply attributes everywhere.
14074 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
14077 (ApplyAttributes): Update accordingly.
14079 We now apply interface attributes for all members too.
14081 2002-05-26 Miguel de Icaza <miguel@ximian.com>
14083 * class.cs (Indexer.Define); Correctly check if we are explicit
14084 implementation (instead of checking the Name for a ".", we
14085 directly look up if the InterfaceType was specified).
14087 Delay the creation of the PropertyBuilder.
14089 Only create the PropertyBuilder if we are not an explicit
14090 interface implementation. This means that explicit interface
14091 implementation members do not participate in regular function
14092 lookups, and hence fixes another major ambiguity problem in
14093 overload resolution (that was the visible effect).
14095 (DefineMethod): Return whether we are doing an interface
14098 * typemanager.cs: Temporary hack until we get attributes in
14099 interfaces (Ravi is working on that) and we get IndexerName
14100 support in interfaces.
14102 * interface.cs: Register the indexers as properties.
14104 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
14105 warning, I have verified that this is a bug in the .NET runtime
14106 (JavaScript suffers of the same problem).
14108 * typemanager.cs (MemberLookup): When looking up members for
14109 interfaces, the parent of an interface is the implicit
14110 System.Object (so we succeed in searches of Object methods in an
14111 interface method invocation. Example: IEnumerable x; x.ToString
14114 2002-05-25 Miguel de Icaza <miguel@ximian.com>
14116 * class.cs (Event): Events should also register if they do
14117 implement the methods that an interface requires.
14119 * typemanager.cs (MemberLookup); use the new GetInterfaces
14122 (GetInterfaces): The code used to lookup interfaces for a type is
14123 used in more than one place, factor it here.
14125 * driver.cs: Track the errors at the bottom of the file, we kept
14128 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
14129 instance if the method we are calling is static!
14131 2002-05-24 Miguel de Icaza <miguel@ximian.com>
14133 * attribute.cs (ApplyAttributes): Make this function filter out
14134 the IndexerName attribute (as that attribute in reality is never
14135 applied) and return the string constant for the IndexerName
14138 * class.cs (TypeContainer.Emit): Validate that all the indexers
14139 have the same IndexerName attribute, and if so, set the
14140 DefaultName attribute on the class.
14142 * typemanager.cs: The return value might contain other stuff (not
14143 only methods). For instance, consider a method with an "Item"
14144 property and an Item method.
14146 * class.cs: If there is a problem with the parameter types,
14149 2002-05-24 Ravi Pratap <ravi@ximian.com>
14151 * ecore.cs (ImplicitConversionExists): Wrapper function which also
14152 looks at user defined conversion after making a call to
14153 StandardConversionExists - we need this for overload resolution.
14155 * expression.cs : Update accordingly the various method calls.
14157 This fixes 2 bugs filed against implicit user defined conversions
14159 2002-05-22 Miguel de Icaza <miguel@ximian.com>
14161 * statement.cs: Track the result of the assignment.
14163 2002-05-21 Miguel de Icaza <miguel@ximian.com>
14165 * expression.cs (MemberAccess): Improved error reporting for
14166 inaccessible members.
14168 2002-05-22 Martin Baulig <martin@gnome.org>
14170 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
14171 itself with debugging support.
14173 2002-05-22 Martin Baulig <martin@gnome.org>
14175 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
14176 Removed, this isn't needed anymore.
14178 2002-05-20 Martin Baulig <martin@gnome.org>
14180 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
14181 be underlying type for an enum.
14183 2002-05-20 Miguel de Icaza <miguel@ximian.com>
14185 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
14186 that splits out the loading of just the core types.
14188 * rootcontext.cs (ResolveCore): Split the struct resolution in
14189 two, so we can load the enumeration underlying types before any
14192 * expression.cs (Is): Bandaid until we fix properly Switch (see
14193 bug #24985 for details).
14195 * typemanager.cs (ImplementsInterface): The hashtable will contain
14196 a null if there are no interfaces implemented.
14198 2002-05-18 Miguel de Icaza <miguel@ximian.com>
14200 * cs-parser.jay (indexer_declarator): It is fine to have array
14203 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14205 * typemanager.cs: (RegisterBuilder): New function used to register
14206 TypeBuilders that implement interfaces. Since
14207 TypeBuilder.GetInterfaces (as usual) does not work with lame
14209 (AddUserType): register interfaces.
14211 (ImplementsInterface): Use the builder_to_ifaces hash if we are
14212 dealing with TypeBuilder. Also, arrays are showing up as
14213 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
14214 methods can not be invoked on them!
14216 * ecore.cs (ExplicitReferenceConversionExists): Made public.
14217 (ImplicitReferenceConversionExists): Split out from
14218 StandardConversionExists.
14220 * expression.cs (As): We were only implementing one of the three
14221 cases for the as operator. We now implement them all.
14222 (Is): Implement the various other cases for Is as well.
14224 * typemanager.cs (CACHE): New define used to control if we want or
14225 not the FindMembers cache. Seems to have a negative impact on
14226 performance currently
14228 (MemberLookup): Nested types have full acess to
14229 enclosing type members
14231 Remove code that coped with instance/static returns for events, we
14232 now catch this in RealFindMembers.
14234 (RealFindMembers): only perform static lookup if the instance
14235 lookup did not return a type or an event.
14237 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14239 * assign.cs (CompoundAssign): We pass more semantic information
14240 now to Compound Assignments than we did before: now we have all
14241 the information at hand, and now we resolve the target *before* we
14242 do the expression expansion, which allows the "CacheValue" method
14243 to have the effect we intended (before, a [x] += 1 would generate
14244 two differen ArrayAccess expressions from the ElementAccess,
14245 during the resolution process).
14247 (CompoundAssign.DoResolve): Resolve target and original_source here.
14249 2002-05-16 Miguel de Icaza <miguel@ximian.com>
14251 * expression.cs (ArrayAccess): dropped debugging information.
14253 * typemanager.cs: Small bug fix: I was always returning i_members,
14254 instead of one of i_members or s_members (depending on which had
14257 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
14258 method is invoked before any code generation takes place, and it
14259 is a mechanism to inform that the expression will be invoked more
14260 than once, and that the method should use temporary values to
14261 avoid having side effects
14263 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
14265 * ecore.cs (Expression.CacheTemporaries): Provide empty default
14268 * expression.cs (Indirection, ArrayAccess): Add support for
14269 CacheTemporaries in these two bad boys.
14271 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
14272 ldobj or ldind_ref.
14273 (StoreFromPtr): Handle stobj as well.
14275 * expression.cs (UnaryMutator): Share more code.
14277 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
14278 down: I was not tracking the Filter function as well, which
14279 was affecting the results of the cache.
14281 2002-05-15 Miguel de Icaza <miguel@ximian.com>
14283 * attribute.cs: Remove the hack to handle the CharSet property on
14286 2002-05-14 Miguel de Icaza <miguel@ximian.com>
14288 * attribute.cs (DoResolve): More uglyness, we now only try to
14289 resolve the attribute partially, to extract the CharSet
14290 information (only if we are a StructLayout attribute). Otherwise
14292 (GetExtraTypeInfo): Add some code to conditionally kill in the
14293 future this. I am more and more convinced that the .NET
14294 framework has special code to handle the attribute setting on
14297 * expression.cs (IsParamsMethodApplicable): Revert my previous
14298 foreach change here, it was wrong.
14300 2002-05-13 Miguel de Icaza <miguel@ximian.com>
14302 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
14303 (pp_expr): do not abort on unknown input, just return.
14304 (eval): abort if there are pending chars.
14306 * attribute.cs (Attribute.Resolve): Positional parameters are
14307 optional. Deal with that case.
14309 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
14310 the Ansi/Unicode/Auto information for the type.
14312 (TypeContainer.DefineType): instantiate the EmitContext here, as
14313 we will be using it during the type definition (to resolve
14314 attributes) and during the emit phase.
14316 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
14317 to pull type information out of the attributes
14319 (Attribute.Resolve): track the constructor builder, and allow for
14320 multiple invocations (structs and classes will use this).
14322 * ecore.cs (MemberLookupFinal): new version with all the
14323 parameters customizable.
14325 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
14326 constructors. Return if the result value is null (as the error
14327 would have been flagged already by MemberLookupFinal)
14329 Do not allow instances of abstract classes or interfaces to be
14332 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
14333 We have to compare the assembly property here when dealing with
14334 FamANDAssem and Assembly access modifiers, because we might be
14335 creating an assembly from *modules* (that means that we are not
14336 getting TypeBuilders for types defined in other modules that are
14337 part of this assembly).
14339 (Method.Emit): If the method is marked abstract and has a body,
14342 (TypeContainer.DefineMembers): If both the defined member and the
14343 parent name match are methods, then do not emit any warnings: let
14344 the Method.Define routine take care of flagging warnings. But if
14345 there is a mismatch (method overrides something else, or method is
14346 overriwritten by something, then emit warning).
14348 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
14349 set to null, this means `do not check for the return type on the
14352 (Method.Define): set the return type for the method signature to
14353 null, so that we get methods with the same name and parameters and
14354 different return types. This is used to flag warning 114 (you are
14355 hiding a method, and you probably want to use the new/override
14358 * typemanager.cs (MemberLookup): Implemented proper access
14359 control, closing a long standing set of bug reports. The problem
14360 was that the Framework only has two bits: Public and NonPublic,
14361 and NonPublic includes private and protected methods, but we need
14362 to enforce the FamANDAssem, FamOrAssem and Family.
14364 2002-05-11 Miguel de Icaza <miguel@ximian.com>
14366 * statement.cs (GotoCase): Return true: Ammounts to giving up
14367 knowledge on whether we return or not, and letting the other case
14368 be responsible for it.
14370 2002-05-10 Miguel de Icaza <miguel@ximian.com>
14372 * driver.cs: Do not load directories for each file processed, only
14373 do it if there is a pattern.
14375 * ecore.cs: Report readonly assigns here as well, as we might have
14376 been resolved only by MemberAccess.
14378 (SimpleName.SimpleNameResolve): Also be useful for LValue
14379 resolution. We need this to propagate assign to local readonly variables
14381 * typemanager.cs: Use a ptrhashtable for the criteria, because we
14382 do not want to reuse potential criteria memory.
14384 * class.cs (MyEventBuilder): Set reflected_type;
14386 * ecore.cs (Constantify): Added support for constifying bools.
14388 (RootContext.LookupType): Added a cache for values looked up in
14389 the declaration space.
14391 * typemanager.cs (FindMembers): Now is a front-end to
14392 RealFindMembers, and provides a two-level hashtable-based cache to
14395 15% performance improvement: from 22.5 to 19.2 seconds.
14397 * expression.cs (IsParamsMethodApplicable): use foreach.
14398 (Invocation.DoResolve): ditto.
14399 (New.DoResolve): ditto.
14400 (ArrayCreation.DoResolve): ditto.
14402 * ecore.cs (FindMostEncompassingType): use foreach.
14404 * delegate.cs (NewDelegate.DoResolve): Use foreach
14406 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
14407 (RemoveMethods): use foreach.
14409 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
14410 nested foreach statements instead of for, and also break out of
14411 the inner loop once a match is found.
14413 (Invocation.OverloadResolve): Use foreach, simplify the code.
14415 2002-05-08 Miguel de Icaza <miguel@ximian.com>
14417 * cfold.cs (BinaryFold): During an enumeration evaluation context,
14418 we actually unwrap the expression to allow for extra information
14421 * expression.cs: Use Shr_Un on unsigned operations.
14423 2002-05-08 Ravi Pratap <ravi@ximian.com>
14425 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
14426 applicable operators was not being considered correctly. This closes
14427 the bug Miguel reported.
14429 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
14431 * attribute.cs: check that the type derives from System.Attribute
14432 and report the correct error in that case (moved the duplicate code to
14433 its own method, too).
14435 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
14437 * attribute.cs: lookup attribute type name as the spec says: first the
14438 bare attribute name and then name + "Attribute" (nant compiles with
14439 mcs after this fix).
14441 2002-05-07 Miguel de Icaza <miguel@ximian.com>
14443 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
14444 Because of the way we parse things, we should try to see if a
14445 UIntConstant can fit in an integer.
14447 2002-05-07 Ravi Pratap <ravi@ximian.com>
14449 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
14450 when we are in an explicit context.
14452 (ConvertReferenceExplicit): When converting from Iface type S to Class
14453 T make sure the rules are implemented as an OR.
14455 * parameter.cs (ParameterType): Make it a property for now although the
14456 purpose really isn't anything immediate.
14458 * expression.cs (Is*Applicable): Do better checking on the parameter type
14459 of a ref/out parameter. The ones from the system assemblies are already
14460 marked with the correct type so we don't need to do any correction.
14462 * ecore.cs (StandardConversionExists): Conversion from Interface types to
14463 the object type is standard too so include that.
14465 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14467 * ecore.cs (StandardConversionExists): Augment with missing code:
14468 deal with IntConstant, LongConstants and Enumerations.
14470 * assign.cs: Report the error, instead of failing silently
14472 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
14473 typecontainer that they are declared, because the
14474 typecontainer/namespace will have the list of using clauses that
14475 need to be applied.
14477 Assembly Attributes were escaping the normal registration
14480 (EmitCode): Apply attributes within an EmitContext that represents
14481 the container they were declared on.
14483 * cs-parser.jay: Track bases for structs. How did I get this wrong?
14485 2002-05-06 Ravi Pratap <ravi@ximian.com>
14487 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
14488 Revamp completely - make much cleaner as we now operate only
14491 (FindMostSpecificSource, FindMostSpecificTarget): New methods
14492 to implement the logic detailed in the spec more correctly.
14494 (UserDefinedConversion): Update accordingly.
14496 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14498 * statement.cs: Return flow analysis information up.
14500 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
14503 (token): Do not consume an extra character before calling
14506 2002-05-06 Piers Haken <piersh@friskit.com>
14508 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
14510 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14512 * class.cs (Constructor.Emit): Set the IsStatic flag in the
14513 EmitContext during the instance constructor initializer
14514 resolution, to stop access to instance variables.
14516 This is mandated by the spec, last paragraph of the `constructor
14517 initializers' section.
14519 2002-05-05 Miguel de Icaza <miguel@ximian.com>
14521 * cs-parser.jay, class.cs (Accessor): new class used to represent
14522 an accessor (get or set). In the past we used `null' to represent
14523 a missing accessor. But this is ambiguous because there was no
14524 way to tell in abstract indexers/properties if one of them was
14527 Now there is a way of addressing that.
14529 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
14530 instead of FindMembers.
14532 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
14533 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
14535 * attribute.cs: Treat indexers and properties as the same in terms
14536 of applying attributes
14538 * ecore.cs (FindMostEncompassedType): Use statically initialized
14539 EmptyExpressions()s like we do elsewhere to avoid creating useless
14540 objects (and we take this out of the tight loop).
14542 (GetConversionOperators): Move the code to extract the actual
14543 operators to a separate routine to clean things up.
14545 2002-05-04 Miguel de Icaza <miguel@ximian.com>
14547 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
14548 events are always registered FieldBuilders.
14550 * class.cs (FieldBase): New class shared by Fields
14552 * delegate.cs: If we are a toplevel delegate, use our full name.
14553 If we are a nested delegate, then only use our tail name.
14555 2002-05-02 Ravi Pratap <ravi@ximian.com>
14557 * expression.cs (IsApplicable): Ensure that we add the "&" to
14558 ref/out types before comparing it with the type of the argument.
14560 (IsParamsMethodApplicable): Ditto.
14562 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
14565 * delegate.cs : Handle the case when we have more than one applicable
14566 method. Flag an error only when we finish checking all.
14568 2002-05-02 Miguel de Icaza <miguel@ximian.com>
14570 * expression.cs: Add support for boolean static initializers.
14572 2002-05-01 Miguel de Icaza <miguel@ximian.com>
14574 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
14576 * parameter.cs (ComputeParameterTypes,
14577 ComputeAndDefineParameterTypes): Better error handling: now we
14578 clear the `types' cache if we fail during any of the type lookups.
14579 We also return the status code correctly to our caller
14581 * delegate.cs: If we fail to define a delegate, abort the extra
14584 * expression.cs (Binary.ResolveOperator): for
14585 operator==(object,object) and operator !=(object, object) we also
14586 have to verify that there is an implicit conversion from one to
14589 (ArrayAccess.DoResolve): Array Access can operate on
14592 2002-04-30 Miguel de Icaza <miguel@ximian.com>
14594 * assign.cs (CompoundAssign): A new class used as a "flag" that
14595 the assignment actually is happening as part of a compound
14596 assignment operator.
14598 During compound assignment, a few new rules exist to enable things
14605 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
14606 to the type of x) if y is implicitly convertible to the type of x,
14607 and the operator is a builtin operator and the return type of the
14608 operator is explicitly convertible to the type of x.
14610 * rootcontext.cs: Reset warning level to 2. 4 catches various
14611 "interesting" features in mcs, we must clean this up at some
14612 point, but currently am trying to kill other bugs ;-)
14614 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
14615 in container classes as well.
14617 * expression.cs (Binary.ResolveOperator): Handle string case
14618 before anything else (as operator overloading does emit an error
14619 before doing anything else).
14621 This code could go away when we move to a table driven model, but
14622 i could not come up with a good plan last night.
14624 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
14626 * typemanager.cs (CSharpName): reimplementation using regex.
14627 * class.cs: added null check for fields in Emit
14628 * rootcontext.cs: set warninglevel to 4
14630 2002-04-29 Miguel de Icaza <miguel@ximian.com>
14632 * typemanager.cs (CSharpName): reimplemented with Lupus
14635 2002-04-28 Miguel de Icaza <miguel@ximian.com>
14637 * statement.cs (If): correclty implement Resolve, because we were
14638 not catching sem errors in there. The same process is needed
14640 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
14643 (Statement.Warning_DeadCodeFound): Factorize code.
14644 (While): Report dead code here too.
14646 (Statement): Added Resolve virtual method to allow
14647 for resolution split from the emit code.
14649 2002-04-26 Miguel de Icaza <miguel@ximian.com>
14651 * statement.cs (EmitBoolExpression): No longer try to resolve the
14653 (MakeBoolean): New utility function that resolve, implicitly
14654 converts to boolean and tags the expression.
14657 (If, Do): Implement dead code elimination.
14658 (While): Implement loop inversion
14660 (Do, While, For, If): Resolve the expression prior to calling our
14663 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
14666 - added method Report28 (warning: program has more than one entry point)
14667 - added method IsEntryPoint, implements paragraph 10.1 of the spec
14668 - modified method Method.Define, the part at the end of the method
14670 * rootcontext.cs: added static public Location EntryPointLocation;
14672 * ../errors/cs0028.cs : Add test case for the above warning.
14675 - modified method CSharpName to allow arrays of primitive type to
14676 be printed nicely (e.g. instead of System.Int32[][] it now prints
14678 - added method CSharpSignature: returns the signature of a method
14679 in string format to be used in reporting errors, warnings, etc.
14681 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
14684 2002-04-26 Ravi Pratap <ravi@ximian.com>
14686 * delegate.cs (Define): Fix extremely silly bug where I was
14687 setting the type of the 'object' parameter of the BeginInvoke
14688 method to System.IAsyncResult instead of System.Object ;-)
14690 2002-04-26 Miguel de Icaza <miguel@ximian.com>
14692 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
14695 (Constructor.Emit): return if we fail to initialize the
14696 constructor. Another door closed!
14698 * expression.cs (New.DoResolve): Improve error message (from -6 to
14699 1501). Use DeclaredOnly lookup to find the exact constructor.
14701 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
14702 loop. This is useful.
14704 * cs-parser.jay: Adjust the default parameters so that destructors
14705 have the proper signature.
14707 2002-04-26 Martin Baulig <martin@gnome.org>
14709 * driver.cs (LoadAssembly): If `assembly' contains any characters
14710 which are only valid in path names and not in assembly names
14711 (currently slash, backslash and point), use Assembly.LoadFrom ()
14712 instead of Assembly.Load () on the `assembly' (before iteration
14713 over the link_paths).
14715 2002-04-26 Martin Baulig <martin@gnome.org>
14717 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
14719 2002-04-25 Miguel de Icaza <miguel@ximian.com>
14721 * class.cs (Property): use the new typemanager.MemberLookup
14723 (TypeContainer.MemberLookup): Implement using the
14724 TypeManager.MemberLookup now.
14726 * typemanager.cs: Make MemberLookup a function of the TypeManager,
14727 and return MemberInfos, so that these can be used without an
14728 EmitContext (what we had before).
14730 2002-04-24 Miguel de Icaza <miguel@ximian.com>
14732 * expression.cs: Fix the case where the argument to params if the
14733 type of the params. I omitted handling this before. Fixed
14735 2002-04-22 Miguel de Icaza <miguel@ximian.com>
14737 * driver.cs: Call BootCorlib_PopulateCoreType
14739 * class.cs (Property.CheckBase): Check for properties only, not
14742 * interface.cs: Temporary hack: try/catch around the
14743 CustomAttributeBuilder, because I am getting an exception that I
14746 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
14747 types whose definitions are required to be there (attributes are
14748 defined before standard types).
14750 Compute definitions as we boot the various types, as they are used
14751 immediately (value_type class will need object_type, but if we do
14752 not initialize object_type, we will pass a null, which will let
14753 the runtime pick the System.Object from the existing corlib, which
14754 is not what we want).
14756 2002-04-22 Patrik Torstensson <totte@labs2.com>
14758 * cs-tokenizer.cs: fixed a number of trim() issues.
14760 2002-04-22 Ravi Pratap <ravi@ximian.com>
14762 * expression.cs (Argument.Type): Ensure that we return the correct
14763 type when we have out or ref parameters [in which case we
14766 2002-04-22 Miguel de Icaza <miguel@ximian.com>
14768 * class.cs (Property, Indexer): Allow extern modifier in there.
14770 * typemanager.cs (InitBaseTypes): Initializes object_type and
14771 value_type, since those will be used early on during the bootstrap
14772 process to compile corlib.
14774 (InitCoreTypes): Move code from here to InitBaseTypes.
14776 2002-04-21 Miguel de Icaza <miguel@ximian.com>
14778 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
14779 single-dimension arrays as using the ldlen opcode.
14781 Daniel Lewis discovered this optimization.
14783 * typemanager.cs: Add signature for System.Array::get_Length
14785 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14787 * statement.cs: report the error when the foreach does not apply to an
14788 array nor a collection.
14790 2002-04-19 Miguel de Icaza <miguel@ximian.com>
14792 * expression.cs: Add implicit conversions to the operator ~.
14794 * constant.cs (DecimalConstant.Emit): Emit decimal value.
14796 * typemanager.cs: Locate the decimal constructor.
14798 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14800 * attribute.cs: use the new property of TypeOf.
14801 * expression.cs: added 'get' property around typearg.
14803 These changes fix a build breaker reported by NickD. Is this the
14804 correct way to fix? If not, please, revert my changes and make it
14807 2002-04-17 Miguel de Icaza <miguel@ximian.com>
14809 * attribute.cs: Add support for typeof in attribute invocations.
14810 I am not sure that this is right though.
14812 2002-04-14 Duncan Mak <duncan@ximian.com>
14814 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
14815 Binary.Operator.Division case.
14817 2002-04-13 Ravi Pratap <ravi@ximian.com>
14819 * class.cs (DefineType): Ensure that we do a proper check on
14820 attribute types and also register it with the TypeManager.
14822 (TypeContainer.Targets): The default for attribute types is
14823 AttributeTargets.All.
14825 * attribute.cs (ApplyAttributes): Registering the attribute type
14826 is done elsewhere, not when we discover we have a Usage attribute.
14828 2002-04-12 Ravi Pratap <ravi@ximian.com>
14830 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
14831 and get rid of is_delegate parameter.
14833 * everywhere : update.
14835 2002-04-12 Ravi Pratap <ravi@ximian.com>
14837 * cs-parser.jay (compilation_unit): Revamp completely to use
14838 some new ideas that I got from Rhys' grammar to solve the problems
14839 with assembly level attributes.
14841 (outer_declaration): New grammar production.
14843 (attribute_sections): Add.
14845 (opt_attributes): Base on attribute_sections
14847 (namespace_declaration): Allow opt_attributes to tackle the case
14848 when we have assembly level attributes - we are clever in this
14851 * attribute.cs (ApplyAttributes): Do not worry about assembly
14852 attributes in the non-global context.
14854 * rootcontext.cs (AddGlobalAttributes): Go back to using this
14855 instead of SetGlobalAttributes.
14857 * class.cs, rootcontext.cs : Ensure we define and generate
14858 attribute types before anything else.
14860 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
14861 and flag the new error -20 for the case when the attribute type
14862 does not have valid targets specified. csc does not catch this.
14864 * ../errors/errors.txt : update for error # -20
14866 2002-04-11 Ravi Pratap <ravi@ximian.com>
14868 * support.cs (InternalParameters.ParameterModifier): Do some null
14869 checking and return sane values.
14871 * class.cs (Method.Define): If we are a PInvoke method, ensure
14872 that we are static and extern. Report error # 601
14874 * ../errors/cs0601.cs : Add test case for the above error.
14876 2002-04-07 Ravi Pratap <ravi@ximian.com>
14878 * rootcontext.cs (attribute_types): We need to keep type of
14879 all attribute types separately and emit code for them first.
14881 (RegisterAttribute) : Implement.
14883 * class.cs (DefineType): Check if the current Type is a custom
14884 attribute type and register it accordingly.
14886 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
14887 adding the first attribute twice and rename to
14889 (SetGlobalAttributes): this.
14891 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
14894 * attribute.cs (ApplyAttributes): Take an additional argument telling us
14895 if we are processing global arguments. Hmm, I am unsure of this.
14897 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14899 * expression.cs: added static array of strings to avoid calling
14900 Enum.ToString () for Operator in Binary. Significant recover of
14903 2002-04-10 Miguel de Icaza <miguel@ximian.com>
14905 * class.cs (FindMembers): Allow the Builders of the various
14906 members to be null. If they are skip them. This only happens
14907 during the PInvoke declaration.
14909 2002-04-09 Miguel de Icaza <miguel@ximian.com>
14911 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
14912 failure, so we do not keep going afterwards.
14914 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
14915 wanted to pass `false' as the `is_delegate' argument. If this is
14916 the case, why not use delegate_type == null to mean `is_delegate =
14917 false' and anything else as is_delegate = true.
14919 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
14921 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
14922 code for the section, not the beginning of the tests.
14924 2002-04-08 Miguel de Icaza <miguel@ximian.com>
14926 * cfold.cs: Handle operator + (Enum x, Underlying x)
14928 * expression.cs (Binary): same. Warn about errors where we have
14929 Enum/Enum in operator + as well.
14931 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
14934 - added support for switch(bool)
14935 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
14936 - add TableSwitchEmit() to handle table-based switch statements
14938 2002-04-05 Ravi Pratap <ravi@ximian.com>
14940 * expression.cs (Invocation.OverloadResolve): Factor out code which
14941 does parameter compatibility checking with arguments so that we can
14942 re-use the code even from Delegate.VerifyApplicability
14944 (VerifyArgumentsCompat): Move above code here.
14946 * delegate.cs (VerifyApplicability): Get rid of duplicate code
14947 and instead make a call to the above method.
14949 2002-03-31 Ravi Pratap <ravi@ximian.com>
14951 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
14952 We use it to keep track of classes which are attribute types.
14954 2002-04-02 Miguel de Icaza <miguel@ximian.com>
14956 * delegate.cs (Delegate.Define): Correctly define the types in the
14957 presence of fixed and array parameters.
14959 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
14962 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
14963 include NonPublic after the first iteration.
14965 * class.cs (Indexer.CheckBase): Only check if both parents are
14968 * cs-parser.jay (accessor_body): If empty, set to null.
14970 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
14971 same code path here to resolve constants names that we did have in
14972 MemberAccess.DoResolve. There is too much code duplicated here.
14974 2002-04-01 Miguel de Icaza <miguel@ximian.com>
14976 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
14978 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
14981 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
14982 tokens, numbers and strings.
14984 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
14987 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
14988 asyncronous parameters and the regular parameters.
14990 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
14991 specify the target directory.
14993 * expression.cs: (This.DoResolve): Simplify
14994 (As.Emit): Optimize, do not generate IsInst if the expression is
14995 always of the given type.
14997 (Is.DoResolve): Bug fix, we were reporting both always/never for
15000 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15001 creating too many unnecessary arrays.
15003 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15005 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15006 fields instead of rolling our own initializer. Takes care of all
15007 implicit conversions, and drops unnecessary static checks/argument.
15009 2002-03-31 Dick Porter <dick@ximian.com>
15011 * driver.cs: use the GetDirectories() return values properly, and
15012 use "/" as path separator.
15014 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15016 * expression.cs (Unary): Optimize - - expr into expr.
15017 (Binary): Optimize a + (-b) into a -b.
15019 * codegen.cs (CodeGen): Made all methods static.
15021 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15025 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15026 TypeBuilder property.
15028 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15031 * tree.cs: Removed the various RecordXXXX, and replaced with a
15032 single RecordDecl. Removed all the accessor methods, and just
15033 left a single access point Type
15035 * enum.cs: Rename DefineEnum to DefineType.
15037 * decl.cs: New abstract method `DefineType' used to unify the
15038 Defines for Enumerations, Interfaces, TypeContainers and
15041 (FindType): Moved LookupInterfaceOrClass here. Moved the
15042 LookupBaseClasses method that used to live in class.cs and
15043 interface.cs here, and renamed to FindType.
15045 * delegate.cs: Implement DefineType. Take advantage of the
15046 refactored pattern for locating the parent builder without taking
15047 the parent_builder argument (which we know does not work if we are
15048 nested, and triggering a toplevel definition).
15050 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15052 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
15053 accessibility of a member has changed during override and report
15056 * class.cs (Method.Define, Property.Define): Only complain on
15057 overrides if the method is private, any other accessibility is
15058 fine (and since we just checked the permission is the same, we are
15061 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
15062 and elif are processed always. The other pre-processing
15063 directives are only processed if we are "taking" the path
15065 2002-03-29 Martin Baulig <martin@gnome.org>
15067 * class.cs (Method.Emit): Only emit symbolic debugging info if the
15068 current location is not Null.
15070 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
15071 a separate method so we can profile it.
15073 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
15074 `span.Seconds' are just seconds, but no minutes or hours.
15075 (MainDriver): Profile the CodeGen.SaveSymbols calls.
15077 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15079 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
15080 Remove the gratuitous set of Final:
15082 // If an interface implementation, then we can set Final.
15083 if (((flags & MethodAttributes.Abstract) == 0) &&
15084 implementing.DeclaringType.IsInterface)
15085 flags |= MethodAttributes.Final;
15087 I do not know what I was smoking when I used that.
15090 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
15091 step into fixing the name resolution issues for delegates and
15092 unifying the toplevel name resolution.
15094 2002-03-28 Martin Baulig <martin@gnome.org>
15096 * class.cs (Method.Emit): If we have a symbol writer, call its
15097 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
15098 tell it about the current method.
15100 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
15101 writer that we're going to emit the first byte of IL code for a new
15102 statement (a new source line).
15103 (EmitContext.EmitTopBlock): If we have a symbol writer, call
15104 EmitContext.Mark() before emitting any code.
15106 * location.cs (SymbolDocument): Return null when we're Null.
15108 * statement.cs (Statement): Moved the `Location loc' variable here.
15109 (Statement.EmitBoolExpression): If we have a symbol writer, call
15110 ec.Mark() before emitting any code to tell it that we're at the
15111 beginning of a new statement.
15112 (StatementExpression): Added `Location' argument to the constructor.
15113 (Block): Added public readonly variable `StartLocation' and public
15114 variable `EndLocation'. The latter is to be set using SetEndLocation().
15115 (Block): Added constructor which takes a start and end location.
15116 (Block.SetEndLocation): New method. This sets the end location.
15117 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
15118 local variables we create.
15119 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
15120 each statement and do also mark the begin and end of the block.
15122 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
15123 tell it the current lexer.Location, use Location.Null for the end of the
15125 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
15126 current block, set its end location using SetEndLocation().
15127 (statement_expression): StatementExpression constructor now takes the
15128 lexer.Location as additional argument.
15129 (for_statement, declare_local_variables): Likewise.
15130 (declare_local_variables): When creating a new implicit block, use the
15131 new Block constructor and pass it the lexer.Location.
15133 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15135 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
15136 members also on the parent interfaces recursively.
15138 2002-03-27 Miguel de Icaza <miguel@ximian.com>
15140 * report.cs: Use new formats, since Gonzalo finished the missing
15143 * expression.cs (Binary.ResolveOperator): added missing operator|
15144 operator& and operator^ for bool/bool.
15146 * cs-parser.jay: CheckDef now takes a Location argument that is
15147 used to report errors more precisly (instead of reporting the end
15148 of a definition, we try to track something which is a lot closer
15149 to the source of the problem).
15151 * cs-tokenizer.cs: Track global token use, so we can properly flag
15152 the use of #define/#undef after the first token has been seen.
15154 Also, rename the reportXXXX to Error_DescriptiveName
15156 * decl.cs (DeclSpace.IsTopLevel): Move property here from
15157 TypeContainer, so that Enum and Interface can use this too.
15159 * class.cs (TypeContainer.LookupInterfaceOrClass,
15160 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
15161 `builder' argument. Typically this was used to pass the parent
15162 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
15165 The problem is that a nested class could trigger the definition of
15166 a toplevel class, and the builder would be obviously wrong in that
15169 So we drop this argument, and we compute dynamically the
15170 TypeBuilder/ModuleBuilder (the correct information was available
15171 to us anyways from DeclSpace.Parent)
15173 * interface.cs (Interface.DefineInterface): Drop builder
15174 parameter cleanup like class.cs
15176 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
15179 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
15182 (Try.Emit): Propagate the returns value from the statement.
15184 (Return.Emit): Even if we are leavning
15186 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
15188 * modifiers.cs: Fix the computation of MethodAttributes flags.
15190 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
15192 * driver.cs: allow compilation of files that start with '/'.
15193 Add a default case when checking the argument of --target.
15195 2002-03-25 Miguel de Icaza <miguel@ximian.com>
15197 * interface.cs: Implement the same search algorithm for types in
15198 the interface code.
15200 * delegate.cs: Do not allow multiple definition.
15202 * Recovered ChangeLog that got accidentally amputated
15204 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
15206 * rootcontext.cs: Load manually enum to allow core classes to
15207 contain enumerations.
15209 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
15210 Update to new static methods in TypeManager.
15212 * typemanager.cs (GetMethod, GetConstructor): Use our
15213 implementation of FindMembers to find the members, since during
15214 corlib compilation, the types are TypeBuilders and GetMethod and
15215 GetConstructor do not work.
15217 Make all methods in TypeManager static.
15219 (InitCodeHelpers): Split the functionality from
15220 the InitCodeTypes function.
15222 * driver.cs: Call InitCodeHelpers after we have populated the
15225 * cs-parser.jay (delegate_declaration): we did not used to compute
15226 the delegate name correctly for void delegates.
15228 2002-03-24 Miguel de Icaza <miguel@ximian.com>
15230 * rootcontext.cs (RootContext): Init the interface_resolve_order
15231 and type_container_resolve_order always.
15233 (ResolveCore, BootstrapCorlib_ResolveClass,
15234 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
15235 compiler when compiling with --nostdlib
15237 * class.cs (TypeContainer.DefineType): Check that our parent is
15238 not null. This test is most important when we are bootstraping
15241 * codegen.cs: Split out the symbol writing code.
15243 2002-03-25 Martin Baulig <martin@gnome.org>
15245 * driver.cs (-g): Made -g an alias for --debug.
15247 2002-03-24 Martin Baulig <martin@gnome.org>
15249 * codegen.cs (SymbolWriter): New public variable. Returns the
15250 current symbol writer.
15251 (CodeGen): Added `bool want_debugging_support' argument to the
15252 constructor. If true, tell the ModuleBuild that we want debugging
15253 support and ask it for the ISymbolWriter.
15254 (Save): If we have a symbol writer, call it's Close() method after
15255 saving the assembly.
15257 * driver.c (--debug): New command line argument to create a
15258 debugger information file.
15260 * location.cs (SymbolDocument): New public property. Returns an
15261 ISymbolDocumentWriter object for the current source file or null
15262 if we don't have a symbol writer.
15264 2002-03-21 Miguel de Icaza <miguel@ximian.com>
15266 * driver.cs (LoadAssembly): Correctly return when all the paths
15267 have been tried and not before.
15269 * statement.cs (Switch.Emit): return the actual coverage for this
15270 statement (returns/not-returns)
15272 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
15273 switch of the statement if we are the last switch section. That
15274 kills two problems: try/catch problems (we used to emit an empty
15275 nop at the end) and switch statements where all branches would
15278 2002-03-19 Miguel de Icaza <miguel@ximian.com>
15280 * driver.cs: Add default assemblies (the equivalent to the
15281 Microsoft CSC.RSP file)
15283 * cs-tokenizer.cs: When updating `cols and setting it to zero,
15284 also update tokens_seen and set it to false.
15286 * driver.cs: Implement --recurse for Mike.
15288 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
15289 correctly splitting out the paths.
15291 2002-03-18 Miguel de Icaza <miguel@ximian.com>
15293 * interface.cs (Interface.PopulateProperty): Instead of using
15294 `parent' as the declaration space for the set parameters, use
15297 * support.cs (InternalParameters): InternalParameters constructor
15298 takes a DeclSpace instead of a TypeContainer.
15300 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
15301 types are being initialized, load the address of it before calling
15304 (New): Provide a mechanism to disable the generation of local
15305 value type temporaries when the caller will be providing us with
15306 an address to store it.
15308 (ArrayCreation.EmitDynamicInitializers): Use it.
15310 2002-03-17 Miguel de Icaza <miguel@ximian.com>
15312 * expression.cs (Invocation.EmitArguments): Only probe for array
15313 property if there is more than one argument. Sorry about that.
15315 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
15316 empty param arrays.
15318 * class.cs (Method.LabelParameters): Fix incorrect code path that
15319 prevented the `ParamArrayAttribute' from being applied to the
15322 2002-03-16 Miguel de Icaza <miguel@ximian.com>
15324 * support.cs (ReflectionParameters): Correctly compute whether the
15325 last argument is a params array. Fixes the problem with
15328 * typemanager.cs: Make the assemblies array always be non-null
15329 (empty, but non-null)
15331 * tree.cs (RecordDecl): New function that abstracts the recording
15332 of names. This reports error 101, and provides a pointer to the
15333 previous declaration. Fixes a crash in the compiler.
15335 * cs-parser.jay (constructor_declaration): Update to new grammar,
15336 and provide a constructor_body that can be empty.
15338 2002-03-15 Miguel de Icaza <miguel@ximian.com>
15340 * driver.cs: Add support for --resources.
15342 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
15343 Make all types for the various array helper methods be integer.
15345 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
15346 CheckState to ConvCast.
15348 (ConvCast): Now it takes a `checked' state argument, to avoid
15349 depending on the emit context for the conversion, and just using
15350 the resolve time setting.
15352 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
15353 instead of Invocation.EmitArguments. We do not emit the original
15354 arguments, instead we emit those which have been converted to
15355 unsigned int expressions.
15357 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
15359 * codegen.cs: ditto.
15361 * expression.cs (LocalVariableReference): Drop the use of the
15362 Store function that depended on the variable index.
15364 * statement.cs (VariableInfo): Drop the `Idx' property from this
15365 class, as this is not taking into account the indexes for
15366 temporaries tat we generate during the execution, getting the
15369 * class.cs: First emit class initializers, then call the parent
15372 * expression.cs (Binary): Fix opcode emision.
15373 (UnaryMutator.EmitCode): Support checked code generation
15375 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
15376 matches for events for both the Static and Instance scans,
15377 pointing to the same element. Fix that.
15379 2002-03-14 Miguel de Icaza <miguel@ximian.com>
15381 * rootcontext.cs (ResolveTree): Always set the
15382 interface_resolve_order, because nested interfaces will be calling
15385 * class.cs (GetInterfaceOrClass): Track the same resolution
15386 process used by TypeManager.LookupType. This fixes the nested
15387 type lookups in class declarations (separate path from
15390 (TypeContainer.DefineType): Also define nested interfaces.
15391 (TypeContainer.RegisterOrder): New public function used to
15392 register the order in which child interfaces need to be closed.
15394 Nested interfaces need to be closed after their parents have been
15397 * interface.cs (InterfaceAttr): Put all the logic for computing
15398 the interface attribute here.
15400 (DefineInterface): Register our interface order with the
15401 RootContext or with the TypeContainer depending on the case.
15403 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15405 * cs-parser.jay: rework foreach statement to work with the new
15406 changes to the policy on SimpleNames.
15408 * report.cs: support Stacktrace on warnings as well.
15410 * makefile: drop --unsafe and /unsafe from the compile.
15412 2002-03-13 Ravi Pratap <ravi@ximian.com>
15414 * ecore.cs (StandardConversionExists): Modify to take an Expression
15415 as the first parameter. Ensure we do null -> reference type conversion
15418 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
15419 temporary Expression objects.
15421 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
15423 * interface.cs: workaround bug in method overloading resolution
15424 (there is already a bugzilla bug for it).
15426 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15428 We could also solve this problem by having a separate path for
15429 performing type lookups, instead of DoResolve, we could have a
15430 ResolveType entry point, and only participating pieces of the
15431 production (simplename, deref, array) would implement this.
15433 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
15434 signal SimpleName to only resolve type names and not attempt to
15435 resolve anything else.
15437 * expression.cs (Cast): Set the flag.
15439 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
15441 * class.cs: Only report 108 if there is no `new' modifier.
15443 * cs-parser.jay: rework foreach statement to work with the new
15444 changes to the policy on SimpleNames.
15446 * report.cs: support Stacktrace on warnings as well.
15448 * makefile: drop --unsafe and /unsafe from the compile.
15450 2002-03-11 Miguel de Icaza <miguel@ximian.com>
15452 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
15453 lookups here, instead of doing that at parse time. This means
15454 that our grammar will not introduce `LocalVariableReferences' as
15455 expressions at this point. That solves the problem of code like
15459 static void Main ()
15463 This is only half the fix. The full fix requires parameters to
15464 also be handled in this way.
15466 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
15467 makes the use more obvious of the DeclSpace. The
15468 ec.TypeContainer.TypeBuilder is now only used to pull the
15469 TypeBuilder for it.
15471 My theory is that I can get rid of the TypeBuilder completely from
15472 the EmitContext, and have typecasts where it is used (from
15473 DeclSpace to where it matters).
15475 The only pending problem is that the code that implements Aliases
15476 is on TypeContainer, and probably should go in DeclSpace.
15478 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
15479 lookups here, instead of doing that at parse time. This means
15480 that our grammar will not introduce `LocalVariableReferences' as
15481 expressions at this point. That solves the problem of code like
15485 static void Main ()
15489 This is only half the fix. The full fix requires parameters to
15490 also be handled in this way.
15492 * class.cs (Property.DefineMethod): When implementing an interface
15493 method, set newslot, when implementing an abstract method, do not
15494 set the flag (before we tried never setting it, or always setting
15495 it, which is the difference).
15496 (Indexer.DefineMethod): same.
15497 (Method.DefineMethod): same.
15499 * ecore.cs: Only set the status used flag if we get back a Field.
15501 * attribute.cs: Temporary hack, so Paolo can keep working.
15503 2002-03-08 Ravi Pratap <ravi@ximian.com>
15505 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
15506 the unmanaged type in the case we have a MarshalAs attribute.
15508 (Resolve): Handle the case when we are parsing the special MarshalAs
15509 attribute [we need to store the unmanaged type to use later]
15511 * typemanager.cs (marshal_as_attr_type): Built in type for the
15512 MarshalAs Attribute.
15514 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
15515 on parameters and accordingly set the marshalling info.
15517 2002-03-09 Miguel de Icaza <miguel@ximian.com>
15519 * class.cs: Optimizing slightly by removing redundant code after
15520 we switched to the `NoTypes' return value.
15521 (Property.DefineMethod): use NoTypes here too.
15523 This fixes the bug I introduced in my last batch of changes.
15525 2002-03-05 Ravi Pratap <ravi@ximian.com>
15527 * tree.cs (RecordEnum): Add. We now keep track of enums too.
15529 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
15530 Enums since those are types too.
15532 * cs-parser.jay (enum_declaration): Record enums as we parse them.
15534 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
15535 thanks to a call during the lookup process.
15537 2002-03-07 Miguel de Icaza <miguel@ximian.com>
15539 * statement.cs (Foreach): Lots of work to accomodate a particular
15540 kind of foreach statement that I had not kept in mind. It is
15541 possible to have foreachs on classes that provide a GetEnumerator
15542 method that return objects that implement the "pattern" for using
15543 a foreach, there is no need to support GetEnumerator
15546 This is needed to compile nant.
15548 * decl.cs: Only report 114 if the member is not `Finalize' and if
15549 the warning level is at least 2.
15551 * class.cs: Moved the compare function from Method to
15554 (MethodSignature.InheritableMemberSignatureCompare): Add new
15555 filter function that is used to extract inheritable methods from a
15558 (Method.Define): Use the new `inheritable_method_signature_filter'
15561 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
15564 2002-03-06 Miguel de Icaza <miguel@ximian.com>
15566 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
15568 * cs-parser.jay: Add opt_semicolon to the interface declaration.
15570 * expression.cs: Pass location information to
15571 ConvertImplicitStandard.
15573 * class.cs: Added debugging code to track return values from
15576 2002-03-05 Miguel de Icaza <miguel@ximian.com>
15578 * expression.cs (Is.DoResolve): If either side of the `is' is an
15579 interface, do not flag the warning.
15581 * ecore.cs (ImplicitReferenceConversion): We need a separate test
15584 * report.cs: Allow for --fatal to be used with --probe.
15586 * typemanager.cs (NoTypes): Move the definition for the empty Type
15589 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
15591 (TypeContainer.DefineProxy): New function used to proxy to parent
15592 implementations when implementing interfaces.
15593 (TypeContainer.ParentImplements): used to lookup if our parent
15594 implements a public function that is required by an interface.
15595 (TypeContainer.VerifyPendingMethods): Hook this up.
15597 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
15598 `modules' and `assemblies' arraylists into arrays. We only grow
15599 these are the very early start up of the program, so this improves
15600 the speedof LookupType (nicely measured).
15602 * expression.cs (MakeByteBlob): Replaced unsafe code with
15603 BitConverter, as suggested by Paolo.
15605 * cfold.cs (ConstantFold.Binary): Special case: perform constant
15606 folding of string concatenation, but if either side is a string,
15607 and the other is not, then return null, and let the runtime use
15608 the concatenation on the string plus the object (using
15609 `Object.ToString').
15611 2002-03-04 Miguel de Icaza <miguel@ximian.com>
15613 Constant Folding has been implemented now.
15615 * expression.cs (Unary.Reduce): Do not throw an exception, catch
15616 the error instead on types that are not supported in one's
15619 * constant.cs (Constant and all children): New set of functions to
15620 perform implict and explicit conversions.
15622 * ecore.cs (EnumConstant): Implement the new functions to perform
15623 conversion by proxying to the child expression.
15625 * codegen.cs: (ConstantCheckState): Constant evaluation has its
15626 own separate setting that can not be turned off from the command
15627 line using --unchecked or --checked and is only controlled using
15628 the checked/unchecked statements and expressions. This setting is
15629 used by the constant folder to flag errors.
15631 * expression.cs (CheckedExpr, UncheckedExpr): Set the
15632 ConstantCheckState as well.
15634 During Resolve, they also have to flag the state, because the
15635 constant folder runs completely in the Resolve phase.
15637 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
15640 2002-03-01 Miguel de Icaza <miguel@ximian.com>
15642 * cfold.cs: New file, this file contains the constant folder.
15644 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
15645 argument to track whether we are using the resulting address to
15646 load or store a value and provide better error messages.
15648 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
15649 new AddressOf arguments.
15651 * statement.cs (Foreach.EmitCollectionForeach): Update
15653 * expression.cs (Argument.Emit): Call AddressOf with proper
15654 arguments to track usage.
15656 (New.DoEmit): Call AddressOf with new arguments.
15658 (Unary.Emit): Adjust AddressOf call.
15660 2002-03-01 Ravi Pratap <ravi@ximian.com>
15662 * cs-parser.jay (member_access): Change the case for pre-defined types
15663 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
15666 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
15669 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
15670 essentially like methods and apply attributes like MethodImplOptions to them too.
15672 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
15675 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
15676 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
15679 * Update code everywhere accordingly.
15681 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
15683 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
15685 2002-02-28 Ravi Pratap <ravi@ximian.com>
15687 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
15688 try performing lookups against those instead of jumping straight into using
15689 the 'using' clauses.
15691 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
15693 (LookupType): Perform lookups in implicit parents too.
15695 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
15696 sequence as RootContext.LookupType.
15698 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
15699 the various cases of namespace lookups into this method.
15701 2002-03-01 Miguel de Icaza <miguel@ximian.com>
15703 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
15704 in positional arguments)
15706 * class.cs (Operator): Update the AllowedModifiers to contain
15709 * cs-parser.jay: Update operator declaration to allow for the
15710 operator body to be empty.
15712 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
15715 2002-02-27 Miguel de Icaza <miguel@ximian.com>
15717 * class.cs (Method.Emit): Label parameters.
15719 * driver.cs: Return 1 or 0 as the program exit code.
15721 2002-02-26 Miguel de Icaza <miguel@ximian.com>
15723 * expression.cs: Special case the `null' object when trying to
15724 auto-compute the type, as anything can be explicitly converted to
15727 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
15728 spotting this Paolo.
15730 (Expression.ImplicitNumericConversion): Perform comparissions of
15731 the type using the underlying type in the case of an enumeration
15732 rather than using the enumeration type for the compare.
15734 Cope with the underlying == type case, which is not possible to
15737 (Expression.ConvertNumericExplicit): Perform comparissions of
15738 the type using the underlying type in the case of an enumeration
15739 rather than using the enumeration type for the compare.
15741 * driver.cs: If the user does not supply an extension, assume .exe
15743 * cs-parser.jay (if_statement): Rewrote so that we can track the
15744 location for the if statement.
15746 * expression.cs (Binary.ConstantFold): Only concat strings when
15747 the operation is "+", not everything ;-)
15749 * statement.cs (Statement.EmitBoolExpression): Take a location
15751 (If, While, Do): Track location.
15753 * expression.cs (Binary.ResolveOperator): In the object + string
15754 case, I was missing a call to ConvertImplicit
15756 2002-02-25 Ravi Pratap <ravi@ximian.com>
15758 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
15759 Location arguments. Ensure we use RootContext.LookupType to do our work
15760 and not try to do a direct Type.GetType and ModuleBuilder.GetType
15762 * interface.cs (PopulateMethod): Handle the type of the parameter being
15765 * expression.cs (Invocation.BetterFunction): Handle the case when we
15766 have a params method with no fixed arguments and a call is made with no
15769 2002-02-25 Miguel de Icaza <miguel@ximian.com>
15771 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
15772 the verbatim-string-literal
15774 * support.cs (InternalParameters.ParameterModifier): handle null
15776 (InternalParameters.ParameterType): ditto.
15778 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
15779 duplicating the name of the variable parameter.
15780 (GetParameterByName): Fix bug where we were not looking up array
15781 paramters if they were the only present (thanks Paolo!).
15782 (GetParameterInfo): We only have an empty set of types if both
15783 fixed and array are set to null.
15784 (GetParameterInfo-idx): Handle FixedParameter == null
15786 * cs-parser.jay: Handle the case where there is no catch
15787 statements (missing null test).
15789 2002-02-22 Miguel de Icaza <miguel@ximian.com>
15791 * driver.cs (MainDriver): Be conservative on our command line
15794 Catch DirectoryNotFoundException when calling GetFiles.
15796 (SplitPathAndPattern): Used to split the input specification into
15797 a path and a pattern that we can feed to Directory.GetFiles.
15799 2002-02-21 Miguel de Icaza <miguel@ximian.com>
15801 * statement.cs (Fixed): Implement the last case of the Fixed
15802 statement (string handling).
15804 * expression.cs (StringPtr): New class used to return a char * to
15805 a string; Used by the Fixed statement.
15807 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
15809 * expression.cs (Binary.ResolveOperator): Remove redundant
15810 MemberLookup pn parent type.
15811 Optimize union call, we do not need a union if the types are the same.
15812 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
15815 Specialize the use of MemberLookup everywhere, instead of using
15816 the default settings.
15818 (StackAlloc): Implement stackalloc keyword.
15820 * cs-parser.jay: Add rule to parse stackalloc.
15822 * driver.cs: Handle /h, /help, /?
15824 * expression.cs (MakeByteBlob): Removed the hacks we had in place
15825 before we supported unsafe code.
15827 * makefile: add --unsafe to the self compilation of mcs.
15829 2002-02-20 Miguel de Icaza <miguel@ximian.com>
15831 * expression.cs (PointerArithmetic): New class that is used to
15832 perform pointer arithmetic.
15833 (Binary.Resolve): Handle pointer arithmetic
15834 Handle pointer comparission.
15835 (ArrayPtr): Utility expression class that is used to take the
15836 address of an array.
15838 (ElementAccess): Implement array access for pointers
15840 * statement.cs (Fixed): Implement fixed statement for arrays, we
15841 are missing one more case before we are done.
15843 * expression.cs (Indirection): Implement EmitAssign and set the
15844 ExprClass to Variable. This allows pointer dereferences to be
15845 treated as variables, and to have values assigned to them.
15847 * ecore.cs (Expression.StoreFromPtr): New utility function to
15848 store values dereferencing.
15850 2002-02-20 Ravi Pratap <ravi@ximian.com>
15852 * expression.cs (Binary.ResolveOperator): Ensure that we are
15853 not trying to operate on a void type - this fixes the reported
15856 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
15857 the parent implementation is sealed.
15859 * ../errors/cs0239.cs : Add.
15861 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
15863 * typemanager.cs (unverifiable_code_type): Corresponds to
15864 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
15865 which have unsafe code in them.
15867 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
15870 2002-02-19 Miguel de Icaza <miguel@ximian.com>
15872 * cs-tokenizer.cs: Add support for @"litreal strings"
15874 Make tokenizer accept pre-processor directives
15875 on any column (remove the old C-like limitation).
15877 * rootcontext.cs (EmitCode): Emit any global attributes.
15878 (AddGlobalAttributes): Used to keep track of assembly attributes.
15880 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
15882 * cs-parser.jay: Add support for global attributes.
15884 2002-02-17 Miguel de Icaza <miguel@ximian.com>
15886 * expression.cs (Indirection): New helper class. Unary will
15887 create Indirection classes to be able to implement the
15888 IMemoryLocation interface on it.
15890 2002-02-16 Miguel de Icaza <miguel@ximian.com>
15892 * cs-parser.jay (fixed_statement): reference the right statement.
15894 * statement.cs (Fixed.Emit): Finish implementing the fixed
15895 statement for the &x case.
15897 2002-02-14 Miguel de Icaza <miguel@ximian.com>
15899 * class.cs (Property.Define, Method.Define): Remove newslot when
15902 * modifiers.cs: My use of NewSlot when `Abstract' was set was
15903 wrong. NewSlot should only be used if the `new' keyword is present.
15905 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
15906 locating our system dir. Sorry about this.
15908 2002-02-13 Miguel de Icaza <miguel@ximian.com>
15910 * driver.cs (GetSystemDir): Compute correctly the location of our
15911 system assemblies. I was using the compiler directory instead of
15912 the library directory.
15914 2002-02-13 Ravi Pratap <ravi@ximian.com>
15916 * expression.cs (BetterFunction): Put back in what Miguel commented out
15917 since it is the correct fix. The problem is elsewhere ;-)
15919 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
15920 parameters of the parms method are themselves compatible or not !
15922 (StandardConversionExists): Fix very dangerous bug where we were forgetting
15923 to check that a class implements an interface before saying that an implicit
15924 conversion was allowed. Use ImplementsInterface to do the checking.
15926 2002-02-13 Miguel de Icaza <miguel@ximian.com>
15928 * class.cs (Method.Define): Track whether we are an explicit
15929 implementation or not. And only call DefineMethodOverride if we
15930 are an explicit implementation.
15932 (Property.DefineMethod): Ditto.
15934 2002-02-11 Ravi Pratap <ravi@ximian.com>
15936 * expression.cs (BetterFunction): Catch hideous bug which was
15937 preventing us from detecting ambiguous calls due to implicit casts i.e
15940 2002-01-29 Miguel de Icaza <miguel@ximian.com>
15942 * support.cs (Pair): Remove un-needed method. I figured why I was
15943 getting the error in cs-parser.jay, the variable in a foreach loop
15944 is readonly, and the compiler does not really treat this as a variable.
15946 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
15947 instead of EQUALS in grammar.
15949 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
15951 * expression.cs (Unary.DoResolve): Check whether the argument is
15954 2002-01-28 Miguel de Icaza <miguel@ximian.com>
15956 * support.cs: Api for Pair to set a value. Despite the fact that
15957 the variables are public the MS C# compiler refuses to compile
15958 code that accesses the field if the variable is part of a foreach
15961 * statement.cs (Fixed): Begin implementation of the fixed
15964 (Block.AddVariable): Return the VariableInfo on success and null
15965 on failure instead of true/false.
15967 * cs-parser.jay (foreach): Catch errors on variables already
15968 defined (we were ignoring this value before) and properly unwind
15969 the block hierarchy
15971 (fixed_statement): grammar for the fixed statement.
15973 2002-01-25 Miguel de Icaza <miguel@ximian.com>
15975 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
15976 pointer types to be incretemented.
15978 (SizeOf): Implement.
15980 * cs-parser.jay (pointer_member_access): Implement
15981 expr->IDENTIFIER production.
15983 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
15984 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
15987 (Unary): Implement indirection.
15989 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
15990 use in non-unsafe context).
15992 (SimpleName.DoResolve): Check for pointers in field access on safe
15995 (Expression.LoadFromPtr): Factor the load-indirect code in this
15996 function. This was duplicated in UnboxCast and ParameterReference
15998 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16000 * expression.cs (ComposedCast): report an error if a pointer cast
16001 is used in a safe region.
16003 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16004 pointer type casts in unsafe context.
16006 * codegen.cs (EmitContext): Set up IsUnsafe.
16008 * cs-parser.jay (non_expression_type): Add productions for pointer
16011 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16012 code. We should not use force into static mode if the method is
16013 not virtual. Fixes bug in MIS
16015 * statement.cs (Do.Emit, While.Emit, For.Emit,
16016 Statement.EmitBoolExpression): Add support to Do and While to
16017 propagate infinite loop as `I do return' semantics.
16019 Improve the For case to also test for boolean constants.
16021 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16022 to the list of attributes we can add.
16024 Remove `EmitContext' argument.
16026 * class.cs (Method.Define): Apply parameter attributes.
16027 (Constructor.Define): Apply parameter attributes.
16028 (MethodCore.LabelParameters): Move here the core of labeling
16031 * support.cs (ReflectionParameters.ParameterModifier,
16032 InternalParameters.ParameterModifier): Use IsByRef on the type and
16033 only return the OUT bit for these parameters instead of in/out/ref
16036 This is because I miss-understood things. The ParameterInfo.IsIn
16037 and IsOut represent whether the parameter has the [In] and [Out]
16040 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16042 * ecore.cs (FieldExpr.Emit): Release temporaries.
16044 * assign.cs (LocalTemporary.Release): new function.
16046 * codegen.cs (EmitContext.GetTemporaryStorage,
16047 EmitContext.FreeTemporaryStorage): Rework the way we deal with
16048 temporary storage. Now we can "put back" localbuilders when we
16051 2002-01-21 Miguel de Icaza <miguel@ximian.com>
16053 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
16054 need to make a copy of the variable to generate verifiable code.
16056 2002-01-19 Miguel de Icaza <miguel@ximian.com>
16058 * driver.cs: Compute dynamically the system directory.
16060 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
16061 Slower, but more generally useful. Used by the abstract
16062 registering implementation.
16064 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
16065 the rules for the special rule on Type/instances. First check if
16066 we have the same name, and if so, try that special static path
16067 rather than the instance path.
16069 2002-01-18 Miguel de Icaza <miguel@ximian.com>
16071 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
16074 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
16075 Enum, ValueType, Delegate or Array for non-corlib compiles.
16077 * cs-tokenizer.cs: Catch long identifiers (645)
16079 * typemanager.cs (IndexerPropetyName): Ravi never tested this
16082 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
16083 fix, we were returning too early, so we were not registering
16084 pending methods from abstract classes.
16086 Do not register pending methods if the class is abstract.
16088 * expression.cs (Conditional.DoResolve): Report circular implicit
16089 conversions when we neecd to compute it for conditional
16092 (Is.DoResolve): If the expression is always of the provided type,
16093 flag warning 183. If the expression can not ever be of the
16094 provided type flag warning 184.
16096 * class.cs: Catch 169 as well.
16098 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
16101 2002-01-18 Nick Drochak <ndrochak@gol.com>
16103 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
16105 2002-01-17 Miguel de Icaza <miguel@ximian.com>
16107 * interface.cs: (PopulateMethod): Check for pointers being defined
16108 only if the unsafe context is active.
16109 (PopulateProperty): ditto.
16110 (PopulateIndexer): ditto.
16112 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
16113 specified. If pointers are present, make sure that they are
16114 present in an unsafe context.
16115 (Constructor, Constructor.Define): ditto.
16116 (Field, Field.Define): ditto.
16117 (Property, Property.Define): ditto.
16118 (Event, Event.Define): ditto.
16120 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
16121 hashtable if there are classes or structs defined.
16123 * expression.cs (LocalVariableReference.DoResolve): Simplify this
16124 code, as the constant resolution moved.
16126 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
16127 the metadata, so we can flag error 133.
16129 * decl.cs (MemberCore.UnsafeOK): New function to test that a
16130 pointer is being declared in an unsafe context.
16132 2002-01-16 Miguel de Icaza <miguel@ximian.com>
16134 * modifiers.cs (Modifiers.Check): Require a Location argument.
16135 Report error 227 for Unsafe use.
16137 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
16139 * statement.cs (For.Emit): If the test is null, then report that
16140 we do `return', as we wont reach anything afterwards.
16142 (Switch.SwitchGoverningType): Track the expression that matched
16145 * driver.cs: Allow negative numbers as an error code to flag.
16147 * cs-parser.jay: Handle 1551.
16149 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
16151 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16153 * cs-parser.jay: Report 1518 (type declaration can only contain
16154 class, struct, interface, enum or delegate)
16156 (switch_label): Report 1523 (keywords `case' or `default' must
16159 (opt_switch_sections): Report 1522 (empty switch)
16161 * driver.cs: Report 1515 (response file specified multiple times)
16162 Report 1516 (Source file specified multiple times).
16164 * expression.cs (Argument.Resolve): Signal 1510
16166 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
16167 access not allowed in static code)
16169 2002-01-11 Ravi Pratap <ravi@ximian.com>
16171 * typemanager.cs (IsPointerType): Utility method which we are going
16174 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
16175 the object type, so we take care of that.
16177 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
16179 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
16180 added to non-params parameters :-)
16182 * typemanager.cs (CSharpName): Include 'void' type too.
16184 (void_ptr_type): Include in the set of core types.
16186 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
16189 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
16192 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
16193 completely forgotten about it.
16195 2002-01-10 Ravi Pratap <ravi@ximian.com>
16197 * cs-parser.jay (pointer_type): Add. This begins our implementation
16198 of parsing rules for unsafe code.
16200 (unsafe_statement): Implement.
16202 (embedded_statement): Modify to include the above.
16204 * statement.cs (Unsafe): Implement new class for unsafe blocks.
16206 * codegen.cs (EmitContext.InUnsafe): Add. This determines
16207 if the current context is an unsafe one.
16209 * cs-parser.jay (local_variable_pointer_type): Since local variable types
16210 are handled differently, we need separate rules for them.
16212 (local_variable_declaration): Update to use local_variable_pointer_type
16213 to allow variable declarations of unmanaged pointer types.
16215 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
16216 in unsafe contexts.
16218 * ../errors/cs0214.cs : Add.
16220 2002-01-16 Nick Drochak <ndrochak@gol.com>
16222 * makefile: remove 'response' file when cleaning.
16224 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16226 * cs-parser.jay: Report 1524.
16228 2002-01-14 Miguel de Icaza <miguel@ximian.com>
16230 * typemanager.cs (RegisterMethod): drop checking if we have
16231 registered this from here
16233 2002-01-12 Miguel de Icaza <miguel@ximian.com>
16235 * class.cs (Method.EmitDestructor): Implement calling our base
16238 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
16239 value of InFinally.
16241 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
16242 this routine and will wrap the call in a try/catch block. Deal
16245 2002-01-11 Miguel de Icaza <miguel@ximian.com>
16247 * ecore.cs (Expression.MemberLookup): instead of taking a
16248 parameter `same_type' that was used to tell whether we could
16249 access private members we compute our containing type from the
16252 (FieldExpr): Added partial support for volatile fields. This does
16253 not work for volatile fields exposed from assemblies, as I can not
16254 figure out how to extract the modreq from it.
16256 Updated all the source files to use this.
16258 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
16259 because it is referenced by MemberLookup very often.
16261 2002-01-09 Ravi Pratap <ravi@ximian.com>
16263 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
16264 TypeBuilder.GetCustomAttributes to retrieve what we need.
16266 Get rid of redundant default_member_attr_type as this is the same as
16267 default_member_type which already exists.
16269 * interface.cs, attribute.cs : Update accordingly.
16271 2002-01-08 Miguel de Icaza <miguel@ximian.com>
16273 * typemanager.cs: Enable IndexerPropertyName again. It does not
16274 work for TYpeBuilders though. Ravi, can you please fix this?
16276 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
16278 * expression.cs (Argument.Emit): Handle the case of ref objects
16279 being passed to ref functions;
16281 (ParameterReference.EmitLoad): Loads the content of the pointer
16282 without dereferencing.
16284 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16286 * cs-tokenizer.cs: Implemented the pre-processing expressions.
16288 2002-01-08 Ravi Pratap <ravi@ximian.com>
16290 * class.cs (Indexer.DefineMethod): Incorporate the interface
16291 type in the name of the method if we are doing explicit interface
16294 * expression.cs (ConversionExists): Remove as it is completely obsolete.
16296 (BetterConversion): Fix extremely trivial bug where we were referring to
16297 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
16300 * ../errors/bug16.cs : Add although we have fixed it.
16302 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16304 * expression.cs (BaseIndexer): Begin implementation.
16306 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
16308 * cs-parser.jay (indexer_declarator): Use qualified_identifier
16309 production directly to remove a shift/reduce, and implement
16310 explicit interface implementation.
16312 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
16313 after a floating point suffix.
16315 * expression.cs (DoNumericPromotions): Improved the conversion for
16316 uint/uint. If we have a constant, we avoid doing a typecast to a
16319 * class.cs (Indexer): Implement explicit interface implementation
16322 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
16324 * class.cs: make the default instance constructor public and hidebysig.
16326 2001-01-03 Ravi Pratap <ravi@ximian.com>
16328 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
16329 so we can call it from elsewhere.
16331 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
16332 we emit it internally if the class has a defined indexer; otherwise the user
16333 emits it by decorating the class definition with the DefaultMemberAttribute.
16335 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
16336 attribute is not used on a type which defines an indexer.
16338 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
16339 character when we skip whitespace.
16341 * ../errors/cs0646.cs : Add.
16343 2002-01-03 Miguel de Icaza <miguel@ximian.com>
16345 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
16348 * makefile: Add practical target `mcs3.exe' which builds the third
16349 generation compiler.
16351 * expression.cs (New): Fix structures constructor calling.
16353 * class.cs (Property, Method, Indexer): Emit Final flag on the
16354 method if we are an interface implementation and we are not
16357 * ecore.cs (PropertyExpr): New public field `IsBase', tells
16358 whether this property is referencing a `base' method.
16360 * expression.cs (Invocation.EmitCall): take an extra argument:
16361 is_base, this is used to determine whether the `call' or
16362 `callvirt' opcode should be used.
16365 * delegate.cs: update EmitCall.
16367 * class.cs (Method.Define): Set NewSlot for the cases where we are
16368 not implementing an interface method.
16370 (Property.Define): ditto.
16372 2002-01-02 Miguel de Icaza <miguel@ximian.com>
16374 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
16375 'r'. Allows mcs to parse itself fully.
16377 2002-01-02 Ravi Pratap <ravi@ximian.com>
16379 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
16380 of the number of initializers that require the InitializeArray method.
16382 (CheckIndices): Store the Expression in all cases - not the plain value. Also
16383 update the above field where necessary.
16385 (MakeByteBlob): Update accordingly.
16387 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
16390 (EmitDynamicInitializers): Update in accordance with the new optimization.
16392 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
16393 same OpCode applies.
16395 * cs-parser.jay : Fix some glaring errors I introduced.
16397 2002-01-01 Ravi Pratap <ravi@ximian.com>
16399 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
16400 so that we can check for name clashes there too.
16402 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
16403 for interface indexers.
16405 * interfaces.cs (Define): Emit the default member attribute.
16407 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
16408 variable was being referred to while setting the value ;-)
16410 2002-01-01 Miguel de Icaza <miguel@ximian.com>
16412 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
16413 byte-by-byte information when we know the data is zero.
16415 Make the block always a multiple of 4, because
16416 DefineInitializedData has a bug.
16418 * assign.cs: Fix, we should assign from the temporary, not from
16421 * expression.cs (MakeByteBlob): Fix my incorrect code.
16423 2001-12-31 Miguel de Icaza <miguel@ximian.com>
16425 * typemanager.cs (EnumToUnderlying): This function is used to get
16426 the underlying type from an enumeration, because it does not
16429 * constant.cs: Use the I4_S form for values between -128 and 127.
16431 * statement.cs (Block.LookupLabel): Looks up a label.
16432 (Block): Drop support for labeled blocks.
16434 (LabeledStatement): New kind of statement that represents a label
16437 (Goto): Finally implement this bad boy.
16439 * cs-parser.jay: Update to reflect new mechanism to implement
16442 2001-12-30 Miguel de Icaza <miguel@ximian.com>
16444 * codegen.cs (EmitContext.This): a codegen property that keeps the
16445 a single instance of this instead of creating many different this
16448 * delegate.cs (Delegate.DoResolve): Update to use the property;
16450 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
16452 * expression.cs (BaseAccess.DoResolve): Ditto.
16454 2001-12-29 Ravi Pratap <ravi@ximian.com>
16456 * typemanager.cs (methodimpl_attr_type): Add to hold the type
16457 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
16459 (InitCoreTypes): Update accordingly.
16461 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
16462 so we can quickly store the state.
16464 (ApplyAttributes): Set the correct implementation flags
16465 for InternalCall methods.
16467 2001-12-29 Miguel de Icaza <miguel@ximian.com>
16469 * expression.cs (EmitCall): if a method is not virtual, then do
16470 not use callvirt on it.
16472 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
16473 user defined stuff) requires the use of stobj, which takes an
16474 address on the stack instead of an array and an index. So emit
16475 the Ldelema operation for it.
16477 (EmitStoreOpcode): Use stobj for valuetypes.
16479 (UnaryMutator.EmitCode): Use the right 1 value depending on
16480 whether we are dealing with int64/uint64, float or doubles.
16482 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
16483 constructors that I implemented last night.
16485 (Constructor.IsDefault): Fix to work properly for static
16488 * cs-parser.jay (CheckDef): report method signature errors.
16489 Update error number 103 to be 132.
16491 * decl.cs: New AdditionResult enumeration value: MethodExists.
16492 Although we do this check for methods later on in the semantic
16493 analysis, catching repeated default constructors is so easy that
16494 we catch these here.
16496 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
16499 (ParameterReference.EmitAssign, Emit): handle
16502 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
16503 (ArrayAccess.EmitStoreOpcode): ditto.
16505 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
16507 * expression.cs (MakeByteBlob): Complete all the missing types
16508 (uint, short, ushort, byte, sbyte)
16510 * class.cs: Only init instance field initializers on instance
16513 Rename `constructors' to instance_constructors.
16515 (TypeContainer.AddConstructor): Only add constructors to the list
16516 if it is not static.
16518 Make sure that we handle default_static_constructor independently
16519 everywhere where we handle instance_constructors
16521 2001-12-28 Miguel de Icaza <miguel@ximian.com>
16523 * class.cs: Do not lookup or create a base initializer for a
16524 static constructor.
16526 (ConstructorInitializer.Resolve): use the proper type to lookup
16529 * cs-parser.jay: Report error 1585 (modifiers between type and name).
16531 * enum.cs, interface.cs: Remove CloseType, this is taken care by
16534 * decl.cs: CloseType is now an virtual method, the default
16535 implementation just closes this type.
16537 2001-12-28 Ravi Pratap <ravi@ximian.com>
16539 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
16540 to PreserveSig by default. Also emit HideBySig on such methods.
16542 Basically, set the defaults to standard values.
16544 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
16545 argument, if candidate is better, it can't be worse than the best !
16547 (Invocation): Re-write bits to differentiate between methods being
16548 applicable in their expanded form and their normal form - for params
16551 Get rid of use_standard everywhere as only standard conversions are allowed
16552 in overload resolution.
16554 More spec conformance.
16556 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16558 * driver.cs: Add --timestamp, to see where the compiler spends
16561 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
16562 `this' in static code.
16564 (SimpleName.DoResolve): Implement in terms of a helper function
16565 that allows static-references to be passed upstream to
16568 (Expression.ResolveWithSimpleName): Resolve specially simple
16569 names when called by MemberAccess to implement the special
16572 (Expression.ImplicitReferenceConversion): Handle conversions from
16573 Null to reference types before others, as Null's type is
16576 * expression.cs (Invocation.EmitCall): Handle the special case of
16577 calling methods declared on a reference type from a ValueType
16578 (Base classes System.Object and System.Enum)
16580 (MemberAccess.Resolve): Only perform lookups on Enumerations if
16581 the left hand side is a TypeExpr, not on every enumeration.
16583 (Binary.Resolve): If types are reference types, then do a cast to
16584 object on operators != and == of both arguments.
16586 * typemanager.cs (FindMembers): Extract instance and static
16587 members if requested.
16589 * interface.cs (PopulateProperty): Use void_type instead of null
16590 as the return type for the setter method.
16592 (PopulateIndexer): ditto.
16594 2001-12-27 Ravi Pratap <ravi@ximian.com>
16596 * support.cs (ReflectionParameters): Fix minor bug where we
16597 were examining the wrong parameter for the ParamArray attribute.
16599 Cope with requests for the type of the parameter at position
16600 greater than the params parameter's. We now return the element
16601 type of the params array as that makes more sense.
16603 * expression.cs (Invocation.IsParamsMethodApplicable): Update
16604 accordingly as we no longer have to extract the element type
16607 (Invocation.OverloadResolve): Update.
16609 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16611 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
16612 against IEnumerator, test whether the return value is a descendant
16613 of the IEnumerator interface.
16615 * class.cs (Indexer.Define): Use an auxiliary method to implement
16616 the other bits of the method definition. Begin support for
16617 explicit interface implementation.
16619 (Property.DefineMethod): Use TypeManager.void_type instead of null
16620 for an empty return value.
16622 2001-12-26 Miguel de Icaza <miguel@ximian.com>
16624 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
16625 dealing with a FieldExpr which is composed of a FieldBuilder, in
16626 the code path we did extract the constant, but we should have
16627 obtained the underlying value to be able to cast it (otherwise we
16628 end up in an infinite loop, this is what Ravi was running into).
16630 (ArrayCreation.UpdateIndices): Arrays might be empty.
16632 (MemberAccess.ResolveMemberAccess): Add support for section
16633 14.5.4.1 that deals with the special case of E.I when E is a type
16634 and something else, that I can be a reference to a static member.
16636 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
16637 handle a particular array type to create byte blobs, it is just
16638 something we dont generate byteblobs for.
16640 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
16643 * location.cs (Push): remove the key from the hashtable that we
16644 are about to add. This happens for empty files.
16646 * driver.cs: Dispose files after we have parsed them.
16648 (tokenize): new function that only runs the tokenizer on its
16649 input, for speed testing.
16651 2001-12-26 Ravi Pratap <ravi@ximian.com>
16653 * class.cs (Event.Define): Define the private field only if there
16654 are no accessors defined.
16656 * expression.cs (ResolveMemberAccess): If there is no associated
16657 field with the event, that means we have an event defined with its
16658 own accessors and we should flag error cs0070 since transforming
16659 ourselves into a field is not valid in that case.
16661 * ecore.cs (SimpleName.DoResolve): Same as above.
16663 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
16664 and charset to sane values.
16666 2001-12-25 Ravi Pratap <ravi@ximian.com>
16668 * assign.cs (DoResolve): Perform check on events only if they
16669 are being accessed outside the declaring type.
16671 * cs-parser.jay (event_declarations): Update rules to correctly
16672 set the type of the implicit parameter etc.
16674 (add_accessor, remove_accessor): Set current local parameters.
16676 * expression.cs (Binary): For delegate addition and subtraction,
16677 cast the return value from the method into the appropriate delegate
16680 2001-12-24 Ravi Pratap <ravi@ximian.com>
16682 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
16683 of these as the workaround is unnecessary.
16685 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
16686 delegate data - none of that is needed at all.
16688 Re-write bits to extract the instance expression and the delegate method
16691 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
16694 * attribute.cs (ApplyAttributes): New method to take care of common tasks
16695 of attaching attributes instead of duplicating code everywhere.
16697 * everywhere : Update code to do attribute emission using the above method.
16699 2001-12-23 Miguel de Icaza <miguel@ximian.com>
16701 * expression.cs (IsParamsMethodApplicable): if there are not
16702 parameters, return immediately.
16704 * ecore.cs: The 0 literal can be implicity converted to an enum
16707 (SimpleName.DoResolve): First lookup the type, then lookup the
16710 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
16711 want to get its address. If the InstanceExpression is not
16712 addressable, store the result in a temporary variable, then get
16715 * codegen.cs: Only display 219 errors on warning level or above.
16717 * expression.cs (ArrayAccess): Make it implement the
16718 IMemoryLocation interface.
16720 (Binary.DoResolve): handle the operator == (object a, object b)
16721 and operator != (object a, object b) without incurring into a
16722 BoxedCast (because 5 != o should never be performed).
16724 Handle binary enumerator operators.
16726 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
16727 value type, otherwise use Ldelem_ref.
16729 Use precomputed names;
16731 (AddressOf): Implement address of
16733 * cs-parser.jay (labeled_statement): Fix recursive block
16734 addition by reworking the production.
16736 * expression.cs (New.DoEmit): New has a special case:
16738 If we are dealing with a ValueType, we have a few
16739 situations to deal with:
16741 * The target of New is a ValueType variable, that is
16742 easy, we just pass this as the variable reference
16744 * The target of New is being passed as an argument,
16745 to a boxing operation or a function that takes a
16748 In this case, we need to create a temporary variable
16749 that is the argument of New.
16752 2001-12-23 Ravi Pratap <ravi@ximian.com>
16754 * rootcontext.cs (LookupType): Check that current_type is not null before
16755 going about looking at nested types.
16757 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
16758 not implement the IAssignMethod interface any more.
16760 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
16761 where we tranform them into FieldExprs if they are being resolved from within
16762 the declaring type.
16764 * ecore.cs (SimpleName.DoResolve): Do the same here.
16766 * assign.cs (DoResolve, Emit): Clean up code considerably.
16768 * ../errors/bug10.cs : Add.
16770 * ../errors/cs0070.cs : Add.
16772 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
16774 * assign.cs : Get rid of EventIsLocal everywhere.
16776 2001-12-23 Miguel de Icaza <miguel@ximian.com>
16778 * ecore.cs (ConvertIntLiteral): finished the implementation.
16780 * statement.cs (SwitchLabel): Convert the value we are using as a
16781 key before looking up the table.
16783 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16785 * codegen.cs (EmitTopBlock): Require a Location argument now.
16787 * cs-parser.jay (constructor_declarator): We need to setup
16788 current_local_parameters before we parse the
16789 opt_constructor_initializer, to allow the variables to be bound
16790 to the constructor arguments.
16792 * rootcontext.cs (LookupType): First lookup nested classes in our
16793 class and our parents before we go looking outside our class.
16795 * expression.cs (ConstantFold): Extract/debox the values at the
16798 * rootcontext.cs (EmitCode): Resolve the constants first before we
16799 resolve the types. This is not really needed, but it helps debugging.
16801 * statement.cs: report location.
16803 * cs-parser.jay: pass location to throw statement.
16805 * driver.cs: Small bug fix.
16807 * report.cs: Updated format to be 4-zero filled digits.
16809 2001-12-22 Ravi Pratap <ravi@ximian.com>
16811 * expression.cs (CheckIndices): Fix minor bug where the wrong
16812 variable was being referred to ;-)
16814 (DoEmit): Do not call EmitStaticInitializers when the
16815 underlying type is System.Object.
16817 2001-12-21 Ravi Pratap <ravi@ximian.com>
16819 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
16820 and do the usual workaround for SRE.
16822 * class.cs (MyEventBuilder.EventType): New member to get at the type
16823 of the event, quickly.
16825 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
16827 * assign.cs (Assign.DoResolve): Handle the case when the target
16828 is an EventExpr and perform the necessary checks.
16830 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
16833 (SimpleName.MemberStaticCheck): Include check for EventExpr.
16835 (EventExpr): Set the type in the constructor itself since we
16836 are meant to be born fully resolved.
16838 (EventExpr.Define): Revert code I wrote earlier.
16840 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
16841 instance expression is null. The instance expression is a This in that case
16842 or a null, depending on whether it is a static method or not.
16844 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
16845 refers to more than one method.
16847 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
16848 and accordingly flag errors.
16850 2001-12-21 Miguel de Icaza <miguel@ximian.com>
16852 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
16854 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16856 * location.cs (ToString): Provide useful rutine.
16858 2001-12-21 Miguel de Icaza <miguel@ximian.com>
16860 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
16861 objects, return the actual integral boxed.
16863 * statement.cs (SwitchLabel): define an ILLabel for each
16866 (Switch.CheckSwitch): If the value is a Literal, extract
16867 the underlying literal.
16869 Also in the unused hashtable we had, add the SwitchLabel so we can
16870 quickly look this value up.
16872 * constant.cs: Implement a bunch of new constants. Rewrite
16873 Literal based on this. Made changes everywhere to adapt to this.
16875 * expression.cs (Expression.MakeByteBlob): Optimize routine by
16876 dereferencing array only once, and also copes with enumrations.
16878 bytes are two bytes wide, not one.
16880 (Cast): Perform constant conversions.
16882 * ecore.cs (TryImplicitIntConversion): Return literals instead of
16883 wrappers to the literals here.
16885 * expression.cs (DoNumericPromotions): long literals can converted
16886 to ulong implicity (this is taken care of elsewhere, but I was
16887 missing this spot).
16889 * ecore.cs (Expression.Literalize): Make the return type Literal,
16890 to improve type checking.
16892 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
16894 2001-12-20 Miguel de Icaza <miguel@ximian.com>
16896 * literal.cs: Revert code from ravi that checked the bounds. The
16897 bounds are sane by the definition of the type itself.
16899 * typemanager.cs: Fix implementation of ImplementsInterface. We
16900 need to actually look up in our parent hierarchy for interfaces
16903 * const.cs: Use the underlying type for enumerations
16905 * delegate.cs: Compute the basename for the delegate creation,
16906 that should fix the delegate test case, and restore the correct
16907 Type Lookup semantics in rootcontext
16909 * rootcontext.cs: Revert Ravi's last patch. The correct way of
16910 referencing a nested type with the Reflection API is using the "+"
16913 * cs-parser.jay: Do not require EOF token at the end.
16915 2001-12-20 Ravi Pratap <ravi@ximian.com>
16917 * rootcontext.cs (LookupType): Concatenate type names with
16918 a '.' instead of a '+' The test suite passes again.
16920 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
16921 field of the enumeration.
16923 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
16924 the case when the member is an EventExpr.
16926 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
16927 static has an associated instance expression.
16929 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
16931 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
16933 * class.cs (Event.Define): Register event and perform appropriate checks
16936 We define the Add and Remove methods even if the use provides none because
16937 in that case, we provide default implementations ourselves.
16939 Define a private field of the type of the event. This is done by the CSC compiler
16940 and we should be doing it too ;-)
16942 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
16943 More methods we use in code we generate.
16945 (multicast_delegate_type, delegate_type): Two separate types since the distinction
16948 (InitCoreTypes): Update accordingly for the above.
16950 * class.cs (Event.Emit): Generate code for default accessors that we provide
16952 (EmitDefaultMethod): Do the job in the above.
16954 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
16957 2001-12-20 Miguel de Icaza <miguel@ximian.com>
16959 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
16960 builders even if we were missing one.
16962 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
16963 pass the Basename as our class name instead of the Name. The
16964 basename will be correctly composed for us.
16966 * parameter.cs (Paramters): Now takes a Location argument.
16968 * decl.cs (DeclSpace.LookupType): Removed convenience function and
16969 make all the code call directly LookupType in RootContext and take
16970 this chance to pass the Location information everywhere.
16972 * Everywhere: pass Location information.
16974 2001-12-19 Miguel de Icaza <miguel@ximian.com>
16976 * class.cs (Constructor.Define): Updated way of detecting the
16977 length of the parameters.
16979 (TypeContainer.DefineType): Use basename as the type name for
16982 (TypeContainer.Define): Do not recursively define types here, as
16983 definition is taken care in order by the RootContext.
16985 * tree.cs: Keep track of namespaces in a per-file basis.
16987 * parameter.cs (Parameter.ComputeSignature): Update to use
16990 (Parameters.GetSignature): ditto.
16992 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
16993 instead of a TypeContainer.
16995 (Interface.SemanticAnalysis): Use `this' instead of our parent to
16996 resolve names. Because we need to be resolve in our context, not
16999 * driver.cs: Implement response files.
17001 * class.cs (TypeContainer.DefineType): If we are defined, do not
17002 redefine ourselves.
17004 (Event.Emit): Emit the code for add/remove handlers.
17005 (Event.Define): Save the MethodBuilders for add/remove.
17007 * typemanager.cs: Use pair here too.
17009 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17010 DictionaryEntry requires the first argument to be non-null.
17012 (enum_declaration): Compute full name for registering the
17015 (delegate_declaration): Instead of using
17016 formal_parameter_list, use opt_formal_parameter_list as the list
17019 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17020 (EventParsing): New property that controls whether `add' and
17021 `remove' are returned as tokens or identifiers (for events);
17023 2001-12-19 Ravi Pratap <ravi@ximian.com>
17025 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17026 use MyEventBuilder only and let it wrap the real builder for us.
17028 (MyEventBuilder): Revamp constructor etc.
17030 Implement all operations that we perform on EventBuilder in precisely the same
17033 (FindMembers): Update to use the EventBuilder member.
17035 (Event.Emit): Update accordingly.
17037 2001-12-18 Ravi Pratap <ravi@ximian.com>
17039 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17040 by calling the appropriate methods.
17042 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17045 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17047 2001-12-17 Ravi Pratap <ravi@ximian.com>
17049 * delegate.cs (Delegate.Populate): Check that the return type
17050 and various parameters types are indeed accessible.
17052 * class.cs (Constructor.Define): Same here.
17054 (Field.Define): Ditto.
17056 (Event.Define): Ditto.
17058 (Operator.Define): Check that the underlying Method defined itself
17059 correctly - so it's MethodBuilder should not be null.
17061 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
17062 expression happens to be null.
17064 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
17065 members but as of now we don't seem to be able to do anything really useful with it.
17067 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
17068 not the EventBuilder.
17070 2001-12-18 Miguel de Icaza <miguel@ximian.com>
17072 * cs-tokenizer.cs: Add support for defines.
17073 Add support for #if, #elif, #else, #endif
17075 (eval_var): evaluates a variable.
17076 (eval): stubbed for evaluating functions.
17078 * cs-parser.jay: Pass the defines information
17080 * driver.cs: Add --define command line option.
17082 * decl.cs: Move MemberCore here.
17084 Make it the base class for DeclSpace. This allows us to catch and
17085 report 108 and 109 for everything now.
17087 * class.cs (TypeContainer.Define): Extract all the members
17088 before populating and emit the warning 108 (new keyword required
17089 to override) instead of having each member implement this.
17091 (MemberCore.Define): New abstract method, we will be using this in
17092 the warning reporting engine in Populate.
17094 (Operator.Define): Adjust to new MemberCore protocol.
17096 * const.cs (Const): This does not derive from Expression, it is a
17097 temporary object we use to create fields, it is a MemberCore.
17099 * class.cs (Method.Define): Allow the entry point to be in a
17102 * driver.cs: Rewrite the argument handler to clean it up a bit.
17104 * rootcontext.cs: Made it just an auxiliary namespace feature by
17105 making everything static.
17107 * driver.cs: Adapt code to use RootContext type name instead of
17110 * delegate.cs: Remove RootContext argument.
17112 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
17115 * class.cs (Event.Define): The lookup can fail.
17117 * cs-tokenizer.cs: Begin implementation of pre-procesor.
17119 * expression.cs: Resolve the this instance before invoking the code.
17121 2001-12-17 Miguel de Icaza <miguel@ximian.com>
17123 * cs-parser.jay: Add a production in element_access that allows
17124 the thing to become a "type" reference. This way we can parse
17125 things like "(string [])" as a type.
17127 Note that this still does not handle the more complex rules of
17131 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
17133 * ecore.cs: (CopyNewMethods): new utility function used to
17134 assemble the list of methods from running FindMembers.
17136 (MemberLookup): Rework FindMembers so that
17138 2001-12-16 Miguel de Icaza <miguel@ximian.com>
17140 * class.cs (TypeContainer): Remove Delegates who fail to be
17143 * delegate.cs (Populate): Verify that we dont get null return
17144 values. TODO: Check for AsAccessible.
17146 * cs-parser.jay: Use basename to emit error 574 (destructor should
17147 have the same name as container class), not the full name.
17149 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
17150 possible representation.
17152 Also implements integer type suffixes U and L.
17154 2001-12-15 Miguel de Icaza <miguel@ximian.com>
17156 * expression.cs (ArrayCreation.DoResolve): We need to do the
17157 argument resolution *always*.
17159 * decl.cs: Make this hold the namespace. Hold the root context as
17161 (LookupType): Move here.
17163 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
17165 * location.cs (Row, Name): Fixed the code, it was always returning
17166 references to the first file.
17168 * interface.cs: Register properties defined through interfaces.
17170 * driver.cs: Add support for globbing on the command line
17172 * class.cs (Field): Make it derive from MemberCore as well.
17175 2001-12-15 Ravi Pratap <ravi@ximian.com>
17177 * class.cs (Event::Define): Check that the type of the event is a delegate
17178 type else flag error #66.
17180 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
17183 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
17184 values of EntryPoint, CharSet etc etc.
17186 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
17188 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
17189 be null and we should ignore this. I am not sure if this is really clean. Apparently,
17190 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
17191 which needs this to do its work.
17193 * ../errors/cs0066.cs : Add.
17195 2001-12-14 Miguel de Icaza <miguel@ximian.com>
17197 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
17200 * class.cs: (MethodSignature.MethodSignature): Removed hack that
17201 clears out the parameters field.
17202 (MemberSignatureCompare): Cleanup
17204 (MemberCore): New base class used to share code between MethodCore
17207 (RegisterRequiredImplementations) BindingFlags.Public requires
17208 either BindingFlags.Instace or Static. Use instance here.
17210 (Property): Refactored code to cope better with the full spec.
17212 * parameter.cs (GetParameterInfo): Return an empty array instead
17215 * class.cs (Property): Abstract or extern properties have no bodies.
17217 * parameter.cs (GetParameterInfo): return a zero-sized array.
17219 * class.cs (TypeContainer.MethodModifiersValid): Move all the
17220 method modifier validation to the typecontainer so we can reuse
17221 this on properties.
17223 (MethodCore.ParameterTypes): return an empty sized array of types.
17225 (Property.Define): Test property modifier validity.
17227 Add tests for sealed/override too.
17229 (Method.Emit): abstract or extern methods have no bodies.
17231 2001-12-14 Ravi Pratap <ravi@ximian.com>
17233 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
17236 (Method::Define, ::Emit): Modify accordingly.
17238 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
17240 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
17242 * makefile: Pass in /unsafe.
17244 2001-12-13 Miguel de Icaza <miguel@ximian.com>
17246 * class.cs (MakeKey): Kill routine.
17248 * class.cs (TypeContainer.Define): Correctly define explicit
17249 method implementations (they require the full interface name plus
17252 * typemanager.cs: Deply the PtrHashtable here and stop using the
17253 lame keys. Things work so much better.
17255 This of course broke everyone who depended on `RegisterMethod' to
17256 do the `test for existance' test. This has to be done elsewhere.
17258 * support.cs (PtrHashtable): A hashtable that avoid comparing with
17259 the object stupid Equals method (because, that like fails all over
17260 the place). We still do not use it.
17262 * class.cs (TypeContainer.SetRequiredInterface,
17263 TypeContainer.RequireMethods): Killed these two routines and moved
17264 all the functionality to RegisterRequiredImplementations.
17266 (TypeContainer.RegisterRequiredImplementations): This routine now
17267 registers all the implementations required in an array for the
17268 interfaces and abstract methods. We use an array of structures
17269 which can be computed ahead of time to reduce memory usage and we
17270 also assume that lookups are cheap as most classes will not
17271 implement too many interfaces.
17273 We also avoid creating too many MethodSignatures.
17275 (TypeContainer.IsInterfaceMethod): Update and optionally does not
17276 clear the "pending" bit if we find that there are problems with
17279 (TypeContainer.VerifyPendingMethods): Update to report errors of
17280 methods that look like implementations but are not.
17282 (TypeContainer.Define): Add support for explicit interface method
17285 2001-12-12 Miguel de Icaza <miguel@ximian.com>
17287 * typemanager.cs: Keep track of the parameters here instead of
17288 being a feature of the TypeContainer.
17290 * class.cs: Drop the registration of parameters here, as
17291 InterfaceMethods are also interface declarations.
17293 * delegate.cs: Register methods with the TypeManager not only with
17294 the TypeContainer. This code was buggy.
17296 * interface.cs: Full registation here.
17298 2001-12-11 Miguel de Icaza <miguel@ximian.com>
17300 * expression.cs: Remove reducer for binary expressions, it can not
17303 * const.cs: Put here the code that used to go into constant.cs
17305 * constant.cs: Put here the code for constants, this is a new base
17306 class for Literals.
17308 * literal.cs: Make Literal derive from Constant.
17310 2001-12-09 Miguel de Icaza <miguel@ximian.com>
17312 * statement.cs (Return.Emit): Report error 157 if the user
17313 attempts to return from a finally block.
17315 (Return.Emit): Instead of emitting a return, jump to the end of
17318 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
17319 LocalBuilder to store the result of the function. ReturnLabel is
17320 the target where we jump.
17323 2001-12-09 Radek Doulik <rodo@ximian.com>
17325 * cs-parser.jay: remember alias in current namespace
17327 * ecore.cs (SimpleName::DoResolve): use aliases for types or
17330 * class.cs (LookupAlias): lookup alias in my_namespace
17332 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
17334 (LookupAlias): lookup alias in this and if needed in parent
17337 2001-12-08 Miguel de Icaza <miguel@ximian.com>
17341 * rootcontext.cs: (ModuleBuilder) Made static, first step into
17342 making things static. I need this to avoid passing the
17343 TypeContainer when calling ParameterType.
17345 * support.cs (InternalParameters.ParameterType): Remove ugly hack
17346 that did string manipulation to compute the type and then call
17347 GetType. Use Parameter.ParameterType instead.
17349 * cs-tokenizer.cs: Consume the suffix for floating values.
17351 * expression.cs (ParameterReference): figure out whether this is a
17352 reference parameter or not. Kill an extra variable by computing
17353 the arg_idx during emission.
17355 * parameter.cs (Parameters.GetParameterInfo): New overloaded
17356 function that returns whether a parameter is an out/ref value or not.
17358 (Parameter.ParameterType): The type of the parameter (base,
17359 without ref/out applied).
17361 (Parameter.Resolve): Perform resolution here.
17362 (Parameter.ExternalType): The full type (with ref/out applied).
17364 * statement.cs (Using.Emit, Using.EmitExpression): Implement
17365 support for expressions on the using statement.
17367 2001-12-07 Miguel de Icaza <miguel@ximian.com>
17369 * statement.cs (Using.EmitLocalVariableDecls): Split the
17370 localvariable handling of the using statement.
17372 (Block.EmitMeta): Keep track of variable count across blocks. We
17373 were reusing slots on separate branches of blocks.
17375 (Try.Emit): Emit the general code block, we were not emitting it.
17377 Check the type of the declaration to be an IDisposable or
17378 something that can be implicity converted to it.
17380 Emit conversions if required.
17382 * ecore.cs (EmptyExpression): New utility class.
17383 (Expression.ImplicitConversionExists): New utility function.
17385 2001-12-06 Miguel de Icaza <miguel@ximian.com>
17387 * statement.cs (Using): Implement.
17389 * expression.cs (LocalVariableReference): Support read only variables.
17391 * statement.cs: Remove the explicit emit for the Leave opcode.
17392 (VariableInfo): Add a readonly field.
17394 2001-12-05 Miguel de Icaza <miguel@ximian.com>
17396 * ecore.cs (ConvCast): new class used to encapsulate the various
17397 explicit integer conversions that works in both checked and
17398 unchecked contexts.
17400 (Expression.ConvertNumericExplicit): Use new ConvCast class to
17401 properly generate the overflow opcodes.
17403 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17405 * statement.cs: The correct type for the EmptyExpression is the
17406 element_type, not the variable type. Ravi pointed this out.
17408 2001-12-04 Ravi Pratap <ravi@ximian.com>
17410 * class.cs (Method::Define): Handle PInvoke methods specially
17411 by using DefinePInvokeMethod instead of the usual one.
17413 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
17414 above to do the task of extracting information and defining the method.
17416 2001-12-04 Ravi Pratap <ravi@ximian.com>
17418 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
17419 of the condition for string type.
17421 (Emit): Move that here.
17423 (ArrayCreation::CheckIndices): Keep string literals in their expression
17426 (EmitDynamicInitializers): Handle strings appropriately.
17428 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17430 * codegen.cs (EmitContext): Replace multiple variables with a
17431 single pointer to the current Switch statement.
17433 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
17436 2001-12-03 Miguel de Icaza <miguel@ximian.com>
17440 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
17443 (Foreach.Emit): Foreach on arrays was not setting
17444 up the loop variables (for break/continue).
17446 (GotoCase): Semi-implented.
17448 2001-12-03 Ravi Pratap <ravi@ximian.com>
17450 * attribute.cs (CheckAttribute): Handle system attributes by using
17451 Attribute.GetAttributes to examine information we need.
17453 (GetValidPlaces): Same here.
17455 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
17457 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
17459 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
17461 (Method::Define): Set appropriate flags if we have a DllImport attribute.
17463 (Method::Emit): Handle the case when we are a PInvoke method.
17465 2001-12-03 Miguel de Icaza <miguel@ximian.com>
17467 * expression.cs: Use ResolveWithSimpleName on compound names.
17469 2001-12-02 Ravi Pratap <ravi@ximian.com>
17471 * constant.cs (EmitConstant): Make sure we resolve the associated expression
17472 before trying to reduce it.
17474 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
17476 * constant.cs (LookupConstantValue): Implement.
17478 (EmitConstant): Use the above in emitting the constant.
17480 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
17481 that are user-defined by doing a LookupConstantValue on them.
17483 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
17486 2001-11-29 Miguel de Icaza <miguel@ximian.com>
17488 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
17490 (BaseAccess.DoResolve): Implement.
17492 (MemberAccess.DoResolve): Split this routine into a
17493 ResolveMemberAccess routine that can be used independently
17495 2001-11-28 Miguel de Icaza <miguel@ximian.com>
17497 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
17498 As that share bits of the implementation. Is returns a boolean,
17499 while As returns the Type that is being probed.
17501 2001-12-01 Ravi Pratap <ravi@ximian.com>
17503 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
17504 instead of a Literal - much easier.
17506 (EnumInTransit): Remove - utterly useless :-)
17508 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
17510 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
17512 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
17513 chain when we have no associated expression.
17515 2001-11-30 Ravi Pratap <ravi@ximian.com>
17517 * constant.cs (Define): Use Location while reporting the errror.
17519 Also emit a warning when 'new' is used and there is no inherited
17522 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
17525 (LookupEnumValue): Implement to lookup an enum member's value and define it
17528 (Populate): Re-write accordingly to use the above routine.
17530 2001-11-27 Miguel de Icaza <miguel@ximian.com>
17532 * expression.cs (This): Fix prototype for DoResolveLValue to
17533 override the base class DoResolveLValue.
17535 * cs-parser.cs: Report errors cs574 and cs575 (destructor
17538 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
17539 (we need to load the address of the field here). This fixes
17542 (FieldExpr.DoResolveLValue): Call the DoResolve
17543 function to initialize the Instance expression.
17545 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
17546 correctly the GetEnumerator operation on a value type.
17548 * cs-parser.jay: Add more simple parsing error catches.
17550 * statement.cs (Switch): Add support for string switches.
17551 Handle null specially.
17553 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
17555 2001-11-28 Ravi Pratap <ravi@ximian.com>
17557 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
17559 (declare_local_constant): New helper function.
17561 * statement.cs (AddConstant): Keep a separate record of constants
17563 (IsConstant): Implement to determine if a variable is a constant.
17565 (GetConstantExpression): Implement.
17567 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
17569 * statement.cs (IsVariableDefined): Re-write.
17571 2001-11-27 Ravi Pratap <ravi@ximian.com>
17573 * class.cs (TypeContainer::FindMembers): Look for constants
17574 in the case when we are looking for MemberTypes.Field
17576 * expression.cs (MemberAccess::DoResolve): Check that in the
17577 case we are a FieldExpr and a Literal, we are not being accessed
17578 by an instance reference.
17580 * cs-parser.jay (local_constant_declaration): Implement.
17582 (declaration_statement): Implement for constant declarations.
17584 2001-11-26 Miguel de Icaza <miguel@ximian.com>
17586 * statement.cs (Switch): Catch double defaults.
17588 (Switch): More work on the switch() statement
17589 implementation. It works for integral values now, need to finish
17593 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17595 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
17596 integer literals into other integer literals. To be used by
17599 2001-11-24 Ravi Pratap <ravi@ximian.com>
17601 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
17604 (EmitDynamicInitializers): Cope with the above since we extract data
17605 directly from ArrayData now.
17607 (ExpectInitializers): Keep track of whether initializers are mandatory
17610 (Bounds): Make it a hashtable to prevent the same dimension being
17611 recorded for every element in that dimension.
17613 (EmitDynamicInitializers): Fix bug which prevented the Set array method
17616 Also fix bug which was causing the indices to be emitted in the reverse
17619 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17621 * expression.cs (ArrayCreation): Implement the bits that Ravi left
17622 unfinished. They do not work, because the underlying code is
17625 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17627 * cs-parser.jay: Remove bogus fixme.
17629 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
17630 on Switch statement.
17632 2001-11-23 Ravi Pratap <ravi@ximian.com>
17634 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
17637 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
17638 parameter. Apparently, any expression is allowed.
17640 (ValidateInitializers): Update accordingly.
17642 (CheckIndices): Fix some tricky bugs thanks to recursion.
17644 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
17645 I was being completely brain-dead.
17647 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
17648 and re-write acordingly.
17650 (DelegateInvocation): Re-write accordingly.
17652 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
17654 (MakeByteBlob): Handle types more correctly.
17656 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
17657 initialization from expressions but it is incomplete because I am a complete
17660 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17662 * statement.cs (If.Emit): Fix a bug that generated incorrect code
17663 on If. Basically, we have to return `true' (ie, we do return to
17664 our caller) only if both branches of the if return.
17666 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
17667 short-circuit operators, handle them as short circuit operators.
17669 (Cast.DoResolve): Resolve type.
17670 (Cast.Cast): Take an expression as the target type.
17672 * cs-parser.jay (cast_expression): Remove old hack that only
17673 allowed a limited set of types to be handled. Now we take a
17674 unary_expression and we resolve to a type during semantic
17677 Use the grammar productions from Rhys to handle casts (this is
17678 not complete like Rhys syntax yet, we fail to handle that corner
17679 case that C# has regarding (-x), but we will get there.
17681 2001-11-22 Ravi Pratap <ravi@ximian.com>
17683 * class.cs (EmitFieldInitializer): Take care of the case when we have a
17684 field which is an array type.
17686 * cs-parser.jay (declare_local_variables): Support array initialization too.
17688 * typemanager.cs (MakeKey): Implement.
17690 (everywhere): Use the above appropriately.
17692 * cs-parser.jay (for_statement): Update for array initialization while
17693 declaring variables.
17695 * ecore.cs : The error message was correct, it's the variable's names that
17696 were misleading ;-) Make the code more readable.
17698 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
17699 the correct type etc.
17701 (ConvertExplicit): Handle Enum types by examining the underlying type.
17703 2001-11-21 Ravi Pratap <ravi@ximian.com>
17705 * parameter.cs (GetCallingConvention): Always return
17706 CallingConventions.Standard for now.
17708 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17710 * expression.cs (Binary.ResolveOperator): Update the values of `l'
17711 and `r' after calling DoNumericPromotions.
17713 * ecore.cs: Fix error message (the types were in the wrong order).
17715 * statement.cs (Foreach.ProbeCollectionType): Need to pass
17716 BindingFlags.Instance as well
17718 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
17719 implicit int literal conversion in an empty cast so that we
17720 propagate the right type upstream.
17722 (UnboxCast): new class used to unbox value types.
17723 (Expression.ConvertExplicit): Add explicit type conversions done
17726 (Expression.ImplicitNumericConversion): Oops, forgot to test for
17727 the target type before applying the implicit LongLiterals to ULong
17730 2001-11-21 Miguel de Icaza <miguel@ximian.com>
17732 * cs-parser.jay (for_statement): Reworked the way For works: now
17733 we declare manually any variables that are introduced in
17734 for_initializer to solve the problem of having out-of-band code
17735 emition (that is what got for broken).
17737 (declaration_statement): Perform the actual variable declaration
17738 that used to be done in local_variable_declaration here.
17740 (local_variable_declaration): Do not declare anything, just pass
17741 the information on a DictionaryEntry
17743 2001-11-20 Ravi Pratap <ravi@ximian.com>
17745 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
17746 re-write of the logic to now make it recursive.
17748 (UpdateIndices): Re-write accordingly.
17750 Store element data in a separate ArrayData list in the above methods.
17752 (MakeByteBlob): Implement to dump the array data into a byte array.
17754 2001-11-19 Ravi Pratap <ravi@ximian.com>
17756 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
17759 * constant.cs (Define): Implement.
17761 (EmitConstant): Re-write fully.
17763 Pass in location info.
17765 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
17768 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
17769 DictionaryEntry since we need location info too.
17771 (constant_declaration): Update accordingly.
17773 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
17774 code into another method : UpdateIndices.
17776 2001-11-18 Ravi Pratap <ravi@ximian.com>
17778 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
17779 some type checking etc.
17781 2001-11-17 Ravi Pratap <ravi@ximian.com>
17783 * expression.cs (ArrayCreation::ValidateInitializers): Implement
17784 bits to provide dimension info if the user skips doing that.
17786 Update second constructor to store the rank correctly.
17788 2001-11-16 Ravi Pratap <ravi@ximian.com>
17790 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
17791 and try to implement.
17793 * ../errors/cs0150.cs : Add.
17795 * ../errors/cs0178.cs : Add.
17797 2001-11-16 Miguel de Icaza <miguel@ximian.com>
17799 * statement.cs: Implement foreach on multi-dimensional arrays.
17801 * parameter.cs (Parameters.GetParameterByName): Also lookup the
17802 name of the params argument.
17804 * expression.cs: Use EmitStoreOpcode to get the right opcode while
17805 initializing the array.
17807 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
17808 we can use this elsewhere.
17810 * statement.cs: Finish implementation of foreach for single
17813 * cs-parser.jay: Use an out-of-band stack to pass information
17814 around, I wonder why I need this.
17816 foreach_block: Make the new foreach_block the current_block.
17818 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
17819 function used to return a static Parameters structure. Used for
17820 empty parameters, as those are created very frequently.
17822 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
17824 2001-11-15 Ravi Pratap <ravi@ximian.com>
17826 * interface.cs : Default modifier is private, not public. The
17827 make verify test passes again.
17829 2001-11-15 Ravi Pratap <ravi@ximian.com>
17831 * support.cs (ReflectionParameters): Fix logic to determine
17832 whether the last parameter is a params one. Test 9 passes again.
17834 * delegate.cs (Populate): Register the builders we define with
17835 RegisterParameterForBuilder. Test 19 passes again.
17837 * cs-parser.jay (property_declaration): Reference $6 instead
17838 of $$ to get at the location.
17840 (indexer_declaration): Similar stuff.
17842 (attribute): Ditto.
17844 * class.cs (Property): Register parameters for the Get and Set methods
17845 if they exist. Test 23 passes again.
17847 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
17848 call to EmitArguments as we are sure there aren't any params arguments.
17849 Test 32 passes again.
17851 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
17852 IndexOutOfRangeException.
17854 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
17855 Test 33 now passes again.
17857 2001-11-15 Miguel de Icaza <miguel@ximian.com>
17859 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
17860 broke a bunch of things. Will have to come up with a better way
17861 of tracking locations.
17863 * statement.cs: Implemented foreach for single dimension arrays.
17865 2001-11-09 Miguel de Icaza <miguel@ximian.com>
17867 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
17868 an error. This removes the lookup from the critical path.
17870 * cs-parser.jay: Removed use of temporary_loc, which is completely
17873 2001-11-14 Miguel de Icaza <miguel@ximian.com>
17875 * support.cs (ReflectionParameters.ParameterModifier): Report
17876 whether the argument is a PARAMS argument or not.
17878 * class.cs: Set the attribute `ParamArrayAttribute' on the
17879 parameter argument.
17881 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
17882 and cons_param_array_attribute (ConstructorInfo for
17883 ParamArrayAttribute).,
17885 * codegen.cs: Emit the return using the `Return' statement, that
17886 way we can report the error correctly for missing return values.
17888 * class.cs (Method.Emit): Clean up.
17890 * expression.cs (Argument.Resolve): Take another argument: the
17891 location where this argument is used. Notice that this is not
17892 part of the "Argument" class as to reduce the size of the
17893 structure (we know the approximate location anyways).
17895 Test if the argument is a variable-reference, if not, then
17896 complain with a 206.
17898 (Argument.Emit): Emit addresses of variables.
17900 (Argument.FullDesc): Simplify.
17902 (Invocation.DoResolve): Update for Argument.Resolve.
17904 (ElementAccess.DoResolve): ditto.
17906 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
17907 method should be virtual, as this method is always virtual.
17909 (NewDelegate.DoResolve): Update for Argument.Resolve.
17911 * class.cs (ConstructorInitializer.DoResolve): ditto.
17913 * attribute.cs (Attribute.Resolve): ditto.
17915 2001-11-13 Miguel de Icaza <miguel@ximian.com>
17917 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
17919 * expression.cs (ParameterReference): Drop IStackStorage and implement
17920 IAssignMethod instead.
17922 (LocalVariableReference): ditto.
17924 * ecore.cs (FieldExpr): Drop IStackStorage and implement
17925 IAssignMethod instead.
17927 2001-11-13 Miguel de Icaza <miguel@ximian.com>
17929 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
17930 enumerations that are used in heavily used structures derive from
17931 byte in a laughable and pathetic attempt to reduce memory usage.
17932 This is the kind of pre-optimzations that you should not do at
17933 home without adult supervision.
17935 * expression.cs (UnaryMutator): New class, used to handle ++ and
17936 -- separatedly from the other unary operators. Cleans up the
17937 code, and kills the ExpressionStatement dependency in Unary.
17939 (Unary): Removed `method' and `Arguments' from this class, making
17940 it smaller, and moving it all to SimpleCall, so I can reuse this
17941 code in other locations and avoid creating a lot of transient data
17942 strucutres when not required.
17944 * cs-parser.jay: Adjust for new changes.
17946 2001-11-11 Miguel de Icaza <miguel@ximian.com>
17948 * enum.cs (Enum.Populate): If there is a failure during
17951 * cs-parser.jay (opt_enum_base): we used to catch type errors
17952 here, but this is really incorrect. The type error should be
17953 catched during semantic analysis.
17955 2001-12-11 Ravi Pratap <ravi@ximian.com>
17957 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
17958 current_local_parameters as expected since I, in my stupidity, had forgotten
17961 * attribute.cs (GetValidPlaces): Fix stupid bug.
17963 * class.cs (Method::Emit): Perform check on applicability of attributes.
17965 (Constructor::Emit): Ditto.
17967 (Field::Emit): Ditto.
17969 (Field.Location): Store location information.
17971 (Property, Event, Indexer, Operator): Ditto.
17973 * cs-parser.jay (field_declaration): Pass in location for each field.
17975 * ../errors/cs0592.cs : Add.
17977 2001-11-12 Ravi Pratap <ravi@ximian.com>
17979 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
17981 (InitCoreTypes): Update accordingly.
17983 (RegisterAttrType, LookupAttr): Implement.
17985 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
17986 info about the same.
17988 (Resolve): Update to populate the above as necessary.
17990 (Error592): Helper.
17992 (GetValidPlaces): Helper to the above.
17994 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
17996 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
17998 2001-11-12 Ravi Pratap <ravi@ximian.com>
18000 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18002 * ../errors/cs0617.cs : Add.
18004 2001-11-11 Ravi Pratap <ravi@ximian.com>
18006 * enum.cs (Emit): Rename to Populate to be more consistent with what
18007 we expect it to do and when exactly it is called.
18009 * class.cs, rootcontext.cs : Update accordingly.
18011 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18012 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18014 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18016 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18017 of a fieldinfo using the above, when dealing with a FieldBuilder.
18019 2001-11-10 Ravi Pratap <ravi@ximian.com>
18021 * ../errors/cs0031.cs : Add.
18023 * ../errors/cs1008.cs : Add.
18025 * ../errrors/cs0543.cs : Add.
18027 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18030 (FindMembers): Implement.
18032 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18033 enums and delegates too.
18035 (enum_types): Rename to builder_to_enum.
18037 (delegate_types): Rename to builder_to_delegate.
18039 * delegate.cs (FindMembers): Implement.
18041 2001-11-09 Ravi Pratap <ravi@ximian.com>
18043 * typemanager.cs (IsEnumType): Implement.
18045 * enum.cs (Emit): Re-write parts to account for the underlying type
18046 better and perform checking etc.
18048 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
18049 of the underlying type.
18051 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
18054 * enum.cs (error31): Helper to report error #31.
18056 * cs-parser.jay (enum_declaration): Store location of each member too.
18058 * enum.cs (member_to_location): New hashtable.
18060 (AddEnumMember): Update location hashtable.
18062 (Emit): Use the location of each member while reporting errors.
18064 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18066 * cs-parser.jay: A for_initializer if is a
18067 local_variable_declaration really ammount to have an implicit
18068 block with the variable declaration and no initializer for for.
18070 * statement.cs (For.Emit): Cope with null initializers.
18072 This fixes the infinite loop on for initializers.
18074 2001-11-08 Miguel de Icaza <miguel@ximian.com>
18076 * enum.cs: More cleanup.
18078 * ecore.cs: Remove dead code.
18080 * class.cs (Property.Emit): More simplification.
18081 (Event.Emit): ditto.
18083 Reworked to have less levels of indentation.
18085 2001-11-08 Ravi Pratap <ravi@ximian.com>
18087 * class.cs (Property): Emit attributes.
18097 * enum.cs (Emit): Ditto.
18099 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
18102 * class.cs (Field, Event, etc.): Move attribute generation into the
18103 Emit method everywhere.
18105 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
18106 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
18107 as we had no way of defining nested enums !
18109 * rootcontext.cs : Adjust code accordingly.
18111 * typemanager.cs (AddEnumType): To keep track of enum types separately.
18113 2001-11-07 Ravi Pratap <ravi@ximian.com>
18115 * expression.cs (EvalConstantExpression): Move into ecore.cs
18117 * enum.cs (Enum): Rename some members and make them public and readonly
18118 according to our convention.
18120 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
18123 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
18125 (Enum::Emit): Write a simple version for now which doesn't try to compute
18126 expressions. I shall modify this to be more robust in just a while.
18128 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
18130 (TypeContainer::CloseType): Create the Enum types too.
18132 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
18134 * expression.cs (EvalConstantExpression): Get rid of completely.
18136 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
18137 user-defined values and other cases.
18139 (IsValidEnumLiteral): Helper function.
18141 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
18142 out there in the case we had a literal FieldExpr.
18144 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
18146 (Literalize): Revamp a bit to take two arguments.
18148 (EnumLiteral): New class which derives from Literal to wrap enum literals.
18150 2001-11-06 Ravi Pratap <ravi@ximian.com>
18152 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
18154 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
18156 (Resolve): Use the above to ensure we have proper initializers.
18158 2001-11-05 Ravi Pratap <ravi@ximian.com>
18160 * expression.cs (Expression::EvalConstantExpression): New method to
18161 evaluate constant expressions.
18163 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
18165 2001-11-07 Miguel de Icaza <miguel@ximian.com>
18167 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
18170 (Binary.ResolveOperator): Handle operator != (object a, object b)
18171 and operator == (object a, object b);
18173 (Binary.DoNumericPromotions): Indicate whether the numeric
18174 promotion was possible.
18176 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
18179 Made the ArrayAccess implement interface IAssignMethod instead of
18180 IStackStore as the order in which arguments are passed reflects
18183 * assign.cs: Instead of using expr.ExprClass to select the way of
18184 assinging, probe for the IStackStore/IAssignMethod interfaces.
18186 * typemanager.cs: Load InitializeArray definition.
18188 * rootcontext.cs (RootContext.MakeStaticData): Used to define
18189 static data that can be used to initialize arrays.
18191 2001-11-05 Miguel de Icaza <miguel@ximian.com>
18193 * expression.cs: Handle operator== and operator!= for booleans.
18195 (Conditioal.Reduce): Implement reducer for the ?: operator.
18197 (Conditional.Resolve): Implement dead code elimination.
18199 (Binary.Resolve): Catch string literals and return a new
18200 concatenated string.
18202 (Unary.Reduce): Implement reduction of unary expressions.
18204 * ecore.cs: Split out the expression core handling here.
18206 (Expression.Reduce): New method used to perform constant folding
18207 and CSE. This is needed to support constant-expressions.
18209 * statement.cs (Statement.EmitBoolExpression): Pass true and false
18210 targets, and optimize for !x.
18212 2001-11-04 Ravi Pratap <ravi@ximian.com>
18214 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
18215 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
18216 set custom atttributes.
18218 * literal.cs (Literal::GetValue): New abstract method to return the actual
18219 value of the literal, cast as an object.
18221 (*Literal): Implement GetValue method.
18223 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
18224 expressions to the arraylist but objects of type Argument.
18226 * class.cs (TypeContainer::Emit): Emit our attributes too.
18228 (Method::Emit, Constructor::Emit): Ditto.
18230 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
18231 to be ignoring earlier.
18233 2001-11-03 Ravi Pratap <ravi@ximian.com>
18235 * attribute.cs (AttributeSection::Define): Implement to do the business
18236 of constructing a CustomAttributeBuilder.
18238 (Attribute): New trivial class. Increases readability of code.
18240 * cs-parser.jay : Update accordingly.
18242 (positional_argument_list, named_argument_list, named_argument): New rules
18244 (attribute_arguments): Use the above so that we are more correct.
18246 2001-11-02 Ravi Pratap <ravi@ximian.com>
18248 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
18249 to perform all checks for a method with a params parameter.
18251 (Invocation::OverloadResolve): Update to use the above method and therefore
18252 cope correctly with params method invocations.
18254 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
18257 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
18258 constructors in our parent too because we can't afford to miss out on
18261 * attribute.cs (AttributeSection): New name for the class Attribute
18263 Other trivial changes to improve readability.
18265 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
18266 use the new class names.
18268 2001-11-01 Ravi Pratap <ravi@ximian.com>
18270 * class.cs (Method::Define): Complete definition for params types too
18272 (Indexer::Define): Ditto.
18274 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
18275 Cope everywhere with a request for info about the array parameter.
18277 2001-11-01 Ravi Pratap <ravi@ximian.com>
18279 * tree.cs (RecordNamespace): Fix up to check for the correct key.
18281 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
18282 local_variable_type to extract the string corresponding to the type.
18284 (local_variable_type): Fixup the action to use the new helper method.
18286 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
18289 * expression.cs : Clean out code which uses the above.
18291 2001-10-31 Ravi Pratap <ravi@ximian.com>
18293 * typemanager.cs (RegisterMethod): Check if we already have an existing key
18294 and bale out if necessary by returning a false.
18296 (RegisterProperty): Ditto.
18298 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
18299 and print out appropriate error messages.
18301 * interface.cs (everywhere): Ditto.
18303 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
18304 location to constructor.
18306 * class.cs (Property, Event, Indexer): Update accordingly.
18308 * ../errors/cs111.cs : Added.
18310 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
18311 of a method, as laid down by the spec.
18313 (Invocation::OverloadResolve): Use the above method.
18315 2001-10-31 Ravi Pratap <ravi@ximian.com>
18317 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
18318 now take a TypeContainer and a Parameters object.
18320 (ParameterData): Modify return type of ParameterModifier method to be
18321 Parameter.Modifier and not a string.
18323 (ReflectionParameters, InternalParameters): Update accordingly.
18325 * expression.cs (Argument::GetParameterModifier): Same here.
18327 * support.cs (InternalParameters::ParameterType): Find a better way of determining
18328 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
18329 symbol in it at all so maybe this is only for now.
18331 2001-10-30 Ravi Pratap <ravi@ximian.com>
18333 * support.cs (InternalParameters): Constructor now takes an extra argument
18334 which is the actual Parameters class.
18336 (ParameterDesc): Update to provide info on ref/out modifiers.
18338 * class.cs (everywhere): Update call to InternalParameters to pass in
18339 the second argument too.
18341 * support.cs (ParameterData): Add ParameterModifier, which is a method
18342 to return the modifier info [ref/out etc]
18344 (InternalParameters, ReflectionParameters): Implement the above.
18346 * expression.cs (Argument::ParameterModifier): Similar function to return
18347 info about the argument's modifiers.
18349 (Invocation::OverloadResolve): Update to take into account matching modifiers
18352 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
18353 a new SetFormalParameters object which we pass to InternalParameters.
18355 2001-10-30 Ravi Pratap <ravi@ximian.com>
18357 * expression.cs (NewArray): Merge into the ArrayCreation class.
18359 2001-10-29 Ravi Pratap <ravi@ximian.com>
18361 * expression.cs (NewArray): Merge classes NewBuiltinArray and
18362 NewUserdefinedArray into one as there wasn't much of a use in having
18365 * expression.cs (Argument): Change field's name to ArgType from Type.
18367 (Type): New readonly property which returns the proper type, taking into
18368 account ref/out modifiers.
18370 (everywhere): Adjust code accordingly for the above.
18372 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
18373 whether we are emitting for a ref or out parameter.
18375 * expression.cs (Argument::Emit): Use the above field to set the state.
18377 (LocalVariableReference::Emit): Update to honour the flag and emit the
18380 * parameter.cs (Attributes): Set the correct flags for ref parameters.
18382 * expression.cs (Argument::FullDesc): New function to provide a full desc.
18384 * support.cs (ParameterData): Add method ParameterDesc to the interface.
18386 (ReflectionParameters, InternalParameters): Implement the above method.
18388 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
18391 (Invocation::FullMethodDesc): Ditto.
18393 2001-10-29 Miguel de Icaza <miguel@ximian.com>
18395 * cs-parser.jay: Add extra production for the second form of array
18398 * expression.cs (ArrayCreation): Update to reflect the above
18401 * Small changes to prepare for Array initialization.
18403 2001-10-28 Miguel de Icaza <miguel@ximian.com>
18405 * typemanager.cs (ImplementsInterface): interface might be null;
18406 Deal with this problem;
18408 Also, we do store negative hits on the cache (null values), so use
18409 this instead of calling t.GetInterfaces on the type everytime.
18411 2001-10-28 Ravi Pratap <ravi@ximian.com>
18413 * typemanager.cs (IsBuiltinType): New method to help determine the same.
18415 * expression.cs (New::DoResolve): Get rid of array creation code and instead
18416 split functionality out into different classes.
18418 (New::FormArrayType): Move into NewBuiltinArray.
18420 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
18423 (NewBuiltinArray): New class to handle creation of built-in arrays.
18425 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
18426 account creation of one-dimensional arrays.
18428 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
18430 (NewUserdefinedArray::DoResolve): Implement.
18432 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
18434 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
18435 we maintain inside the TypeManager. This is necessary to perform lookups on the
18438 (LookupType): Update to perform GetType on the module builders too.
18440 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
18442 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
18444 2001-10-23 Ravi Pratap <ravi@ximian.com>
18446 * expression.cs (New::DoResolve): Implement guts of array creation.
18448 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
18450 2001-10-27 Miguel de Icaza <miguel@ximian.com>
18452 * expression.cs: Fix bug I introduced lsat night that broke
18455 (Expression.Resolve): Report a 246 error (can not resolve name)
18456 if we find a SimpleName in the stream.
18458 (Expression.ResolveLValue): Ditto.
18460 (Expression.ResolveWithSimpleName): This function is a variant of
18461 ResolveName, this one allows SimpleNames to be returned without a
18462 warning. The only consumer of SimpleNames is MemberAccess
18464 2001-10-26 Miguel de Icaza <miguel@ximian.com>
18466 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
18467 might arrive here. I have my doubts that this is correct.
18469 * statement.cs (Lock): Implement lock statement.
18471 * cs-parser.jay: Small fixes to support `lock' and `using'
18473 * cs-tokenizer.cs: Remove extra space
18475 * driver.cs: New flag --checked, allows to turn on integer math
18478 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
18479 Threading.Monitor.Exit
18481 2001-10-23 Miguel de Icaza <miguel@ximian.com>
18483 * expression.cs (IndexerAccess::DoResolveLValue): Set the
18484 Expression Class to be IndexerAccess.
18486 Notice that Indexer::DoResolve sets the eclass to Value.
18488 2001-10-22 Miguel de Icaza <miguel@ximian.com>
18490 * class.cs (TypeContainer::Emit): Emit code for indexers.
18492 * assign.cs (IAssignMethod): New interface implemented by Indexers
18493 and Properties for handling assignment.
18495 (Assign::Emit): Simplify and reuse code.
18497 * expression.cs (IndexerAccess, PropertyExpr): Implement
18498 IAssignMethod, clean up old code.
18500 2001-10-22 Ravi Pratap <ravi@ximian.com>
18502 * typemanager.cs (ImplementsInterface): New method to determine if a type
18503 implements a given interface. Provides a nice cache too.
18505 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
18508 (ConvertReferenceExplicit): Ditto.
18510 * delegate.cs (Delegate::Populate): Update to define the parameters on the
18511 various methods, with correct names etc.
18513 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
18514 Operator.UnaryNegation.
18516 * cs-parser.jay (operator_declarator): Be a little clever in the case where
18517 we have a unary plus or minus operator.
18519 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
18522 * everywhere : update accordingly.
18524 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
18527 * class.cs (Method::Define): For the case where we are implementing a method
18528 inherited from an interface, we need to set the MethodAttributes.Final flag too.
18529 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
18531 2001-10-21 Ravi Pratap <ravi@ximian.com>
18533 * interface.cs (FindMembers): Implement to work around S.R.E
18536 * typemanager.cs (IsInterfaceType): Implement.
18538 (FindMembers): Update to handle interface types too.
18540 * expression.cs (ImplicitReferenceConversion): Re-write bits which
18541 use IsAssignableFrom as that is not correct - it doesn't work.
18543 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
18544 and accordingly override EmitStatement.
18546 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
18547 using the correct logic :-)
18549 2001-10-19 Ravi Pratap <ravi@ximian.com>
18551 * ../errors/cs-11.cs : Add to demonstrate error -11
18553 2001-10-17 Miguel de Icaza <miguel@ximian.com>
18555 * assign.cs (Assign::Resolve): Resolve right hand side first, and
18556 then pass this as a hint to ResolveLValue.
18558 * expression.cs (FieldExpr): Add Location information
18560 (FieldExpr::LValueResolve): Report assignment to readonly
18563 (Expression::ExprClassFromMemberInfo): Pass location information.
18565 (Expression::ResolveLValue): Add new method that resolves an
18568 (Expression::DoResolveLValue): Default invocation calls
18571 (Indexers): New class used to keep track of indexers in a given
18574 (IStackStore): Renamed from LValue, as it did not really describe
18575 what this did. Also ResolveLValue is gone from this interface and
18576 now is part of Expression.
18578 (ElementAccess): Depending on the element access type
18580 * typemanager.cs: Add `indexer_name_type' as a Core type
18581 (System.Runtime.CompilerServices.IndexerNameAttribute)
18583 * statement.cs (Goto): Take a location.
18585 2001-10-18 Ravi Pratap <ravi@ximian.com>
18587 * delegate.cs (Delegate::VerifyDelegate): New method to verify
18588 if two delegates are compatible.
18590 (NewDelegate::DoResolve): Update to take care of the case when
18591 we instantiate a delegate from another delegate.
18593 * typemanager.cs (FindMembers): Don't even try to look up members
18594 of Delegate types for now.
18596 2001-10-18 Ravi Pratap <ravi@ximian.com>
18598 * delegate.cs (NewDelegate): New class to take care of delegate
18601 * expression.cs (New): Split the delegate related code out into
18602 the NewDelegate class.
18604 * delegate.cs (DelegateInvocation): New class to handle delegate
18607 * expression.cs (Invocation): Split out delegate related code into
18608 the DelegateInvocation class.
18610 2001-10-17 Ravi Pratap <ravi@ximian.com>
18612 * expression.cs (New::DoResolve): Implement delegate creation fully
18613 and according to the spec.
18615 (New::DoEmit): Update to handle delegates differently.
18617 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
18618 because of which we were printing out arguments in reverse order !
18620 * delegate.cs (VerifyMethod): Implement to check if the given method
18621 matches the delegate.
18623 (FullDelegateDesc): Implement.
18625 (VerifyApplicability): Implement.
18627 * expression.cs (Invocation::DoResolve): Update to accordingly handle
18628 delegate invocations too.
18630 (Invocation::Emit): Ditto.
18632 * ../errors/cs1593.cs : Added.
18634 * ../errors/cs1594.cs : Added.
18636 * delegate.cs (InstanceExpression, TargetMethod): New properties.
18638 2001-10-16 Ravi Pratap <ravi@ximian.com>
18640 * typemanager.cs (intptr_type): Core type for System.IntPtr
18642 (InitCoreTypes): Update for the same.
18644 (iasyncresult_type, asynccallback_type): Ditto.
18646 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
18649 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
18652 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
18653 the builders for the 4 members of a delegate type :-)
18655 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
18658 * expression.cs (New::DoResolve): Implement guts for delegate creation.
18660 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
18662 2001-10-15 Miguel de Icaza <miguel@ximian.com>
18664 * statement.cs (Break::Emit): Implement.
18665 (Continue::Emit): Implement.
18667 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
18668 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
18669 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
18670 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
18673 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
18674 properties that track the label for the current loop (begin of the
18675 loop and end of the loop).
18677 2001-10-15 Ravi Pratap <ravi@ximian.com>
18679 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
18680 use of emitting anything at all.
18682 * class.cs, rootcontext.cs : Get rid of calls to the same.
18684 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
18686 (Populate): Define the constructor correctly and set the implementation
18689 * typemanager.cs (delegate_types): New hashtable to hold delegates that
18692 (AddDelegateType): Implement.
18694 (IsDelegateType): Implement helper method.
18696 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
18698 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
18699 and accordingly handle it.
18701 * delegate.cs (Populate): Take TypeContainer argument.
18702 Implement bits to define the Invoke method. However, I still haven't figured out
18703 how to take care of the native int bit :-(
18705 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
18706 Qualify the name of the delegate, not its return type !
18708 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
18711 (StandardConversionExists): Checking for array types turns out to be recursive.
18713 (ConvertReferenceExplicit): Implement array conversion.
18715 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
18717 2001-10-12 Ravi Pratap <ravi@ximian.com>
18719 * cs-parser.jay (delegate_declaration): Store the fully qualified
18720 name as it is a type declaration.
18722 * delegate.cs (ReturnType, Name): Rename members to these. Make them
18725 (DefineDelegate): Renamed from Define. Does the same thing essentially,
18726 as TypeContainer::DefineType.
18728 (Populate): Method in which all the definition of the various methods (Invoke)
18731 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
18734 (CloseDelegate): Finally creates the delegate.
18736 * class.cs (TypeContainer::DefineType): Update to define delegates.
18737 (Populate, Emit and CloseType): Do the same thing here too.
18739 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
18740 delegates in all these operations.
18742 2001-10-14 Miguel de Icaza <miguel@ximian.com>
18744 * expression.cs: LocalTemporary: a new expression used to
18745 reference a temporary that has been created.
18747 * assign.cs: Handle PropertyAccess back here, so that we can
18748 provide the proper semantic access to properties.
18750 * expression.cs (Expression::ConvertReferenceExplicit): Implement
18751 a few more explicit conversions.
18753 * modifiers.cs: `NEW' modifier maps to HideBySig.
18755 * expression.cs (PropertyExpr): Make this into an
18756 ExpressionStatement, and support the EmitStatement code path.
18758 Perform get/set error checking, clean up the interface.
18760 * assign.cs: recognize PropertyExprs as targets, and if so, turn
18761 them into toplevel access objects.
18763 2001-10-12 Miguel de Icaza <miguel@ximian.com>
18765 * expression.cs: PropertyExpr::PropertyExpr: use work around the
18768 * typemanager.cs: Keep track here of our PropertyBuilders again to
18769 work around lameness in SRE.
18771 2001-10-11 Miguel de Icaza <miguel@ximian.com>
18773 * expression.cs (LValue::LValueResolve): New method in the
18774 interface, used to perform a second resolution pass for LValues.
18776 (This::DoResolve): Catch the use of this in static methods.
18778 (This::LValueResolve): Implement.
18780 (This::Store): Remove warning, assigning to `this' in structures
18783 (Invocation::Emit): Deal with invocation of
18784 methods on value types. We need to pass the address to structure
18785 methods rather than the object itself. (The equivalent code to
18786 emit "this" for structures leaves the entire structure on the
18787 stack instead of a pointer to it).
18789 (ParameterReference::DoResolve): Compute the real index for the
18790 argument based on whether the method takes or not a `this' pointer
18791 (ie, the method is static).
18793 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
18794 value types returned from functions when we need to invoke a
18795 method on the sturcture.
18798 2001-10-11 Ravi Pratap <ravi@ximian.com>
18800 * class.cs (TypeContainer::DefineType): Method to actually do the business of
18801 defining the type in the Modulebuilder or Typebuilder. This is to take
18802 care of nested types which need to be defined on the TypeBuilder using
18803 DefineNestedMethod.
18805 (TypeContainer::GetClassBases): Implement. Essentially the code from the
18806 methods in RootContext, only ported to be part of TypeContainer.
18808 (TypeContainer::GetInterfaceOrClass): Ditto.
18810 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
18812 * interface.cs (Interface::DefineInterface): New method. Does exactly
18813 what RootContext.CreateInterface did earlier, only it takes care of nested types
18816 (Interface::GetInterfaces): Move from RootContext here and port.
18818 (Interface::GetInterfaceByName): Same here.
18820 * rootcontext.cs (ResolveTree): Re-write.
18822 (PopulateTypes): Re-write.
18824 * class.cs (TypeContainer::Populate): Populate nested types too.
18825 (TypeContainer::Emit): Emit nested members too.
18827 * typemanager.cs (AddUserType): Do not make use of the FullName property,
18828 instead just use the name argument passed in as it is already fully
18831 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
18832 to TypeContainer mapping to see if a type is user-defined.
18834 * class.cs (TypeContainer::CloseType): Implement.
18836 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
18837 the default constructor.
18839 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
18842 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
18844 * interface.cs (CloseType): Create the type here.
18846 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
18849 Remove all the methods which are now in TypeContainer.
18851 2001-10-10 Ravi Pratap <ravi@ximian.com>
18853 * delegate.cs (Define): Re-write bits to define the delegate
18856 2001-10-10 Miguel de Icaza <miguel@ximian.com>
18858 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
18860 * expression.cs (ImplicitReferenceConversion): handle null as well
18861 as a source to convert to any reference type.
18863 * statement.cs (Return): Perform any implicit conversions to
18864 expected return type.
18866 Validate use of return statement.
18868 * codegen.cs (EmitContext): Pass the expected return type here.
18870 * class.cs (Method, Constructor, Property): Pass expected return
18871 type to EmitContext.
18873 2001-10-09 Miguel de Icaza <miguel@ximian.com>
18875 * expression.cs: Make DoResolve take an EmitContext instead of a
18878 Replaced `l' and `location' for `loc', for consistency.
18880 (Error, Warning): Remove unneeded Tc argument.
18882 * assign.cs, literal.cs, constant.cs: Update to new calling
18885 * codegen.cs: EmitContext now contains a flag indicating whether
18886 code is being generated in a static method or not.
18888 * cs-parser.jay: DecomposeQI, new function that replaces the old
18889 QualifiedIdentifier. Now we always decompose the assembled
18890 strings from qualified_identifier productions into a group of
18893 2001-10-08 Miguel de Icaza <miguel@ximian.com>
18895 * rootcontext.cs: Deal with field-less struct types correctly now
18896 by passing the size option to Define Type.
18898 * class.cs: Removed hack that created one static field.
18900 2001-10-07 Miguel de Icaza <miguel@ximian.com>
18902 * statement.cs: Moved most of the code generation here.
18904 2001-10-09 Ravi Pratap <ravi@ximian.com>
18906 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
18909 (ElementAccess): Remove useless bits for now - keep checks as the spec
18912 2001-10-08 Ravi Pratap <ravi@ximian.com>
18914 * expression.cs (ElementAccess::DoResolve): Remove my crap code
18915 and start performing checks according to the spec.
18917 2001-10-07 Ravi Pratap <ravi@ximian.com>
18919 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
18920 rank_specifiers instead.
18922 (rank_specifiers): Change the order in which the rank specifiers are stored
18924 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
18926 * expression.cs (ElementAccess): Implement the LValue interface too.
18928 2001-10-06 Ravi Pratap <ravi@ximian.com>
18930 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
18931 except that user defined conversions are not included.
18933 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
18934 perform the conversion of the return type, if necessary.
18936 (New::DoResolve): Check whether we are creating an array or an object
18937 and accordingly do the needful.
18939 (New::Emit): Same here.
18941 (New::DoResolve): Implement guts of array creation.
18943 (New::FormLookupType): Helper function.
18945 2001-10-07 Miguel de Icaza <miguel@ximian.com>
18947 * codegen.cs: Removed most of the code generation here, and move the
18948 corresponding code generation bits to the statement classes.
18950 Added support for try/catch/finalize and throw.
18952 * cs-parser.jay: Added support for try/catch/finalize.
18954 * class.cs: Catch static methods having the flags override,
18955 virtual or abstract.
18957 * expression.cs (UserCast): This user cast was not really doing
18958 what it was supposed to do. Which is to be born in fully resolved
18959 state. Parts of the resolution were being performed at Emit time!
18963 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18965 * expression.cs: Implicity convert the result from UserCast.
18967 2001-10-05 Ravi Pratap <ravi@ximian.com>
18969 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
18970 prevented it from working correctly.
18972 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
18973 merely ConvertImplicit.
18975 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18977 * typemanager.cs: Make the LookupTypeContainer function static,
18978 and not per-instance.
18980 * class.cs: Make static FindMembers (the one that takes a Type
18983 * codegen.cs: Add EmitForeach here.
18985 * cs-parser.jay: Make foreach a toplevel object instead of the
18986 inline expansion, as we need to perform semantic analysis on it.
18988 2001-10-05 Ravi Pratap <ravi@ximian.com>
18990 * expression.cs (Expression::ImplicitUserConversion): Rename to
18991 UserDefinedConversion.
18993 (Expression::UserDefinedConversion): Take an extra argument specifying
18994 whether we look for explicit user conversions too.
18996 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
18998 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19000 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19001 with the appropriate arguments.
19003 * cs-parser.jay (cast_expression): Record location too.
19005 * expression.cs (Cast): Record location info.
19007 (Expression::ConvertExplicit): Take location argument.
19009 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19010 to determine if we are doing explicit conversions.
19012 (UserCast::Emit): Update accordingly.
19014 (Expression::ConvertExplicit): Report an error if everything fails.
19016 * ../errors/cs0030.cs : Add.
19018 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19020 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19021 virtual and newslot bits.
19023 * class.cs (TypeContainer::RegisterRequiredImplementations):
19024 Record methods we need.
19026 (TypeContainer::MakeKey): Helper function to make keys for
19027 MethodBases, since the Methodbase key is useless.
19029 (TypeContainer::Populate): Call RegisterRequiredImplementations
19030 before defining the methods.
19032 Create a mapping for method_builders_to_methods ahead of time
19033 instead of inside a tight loop.
19035 (::RequireMethods): Accept an object as the data to set into the
19036 hashtable so we can report interface vs abstract method mismatch.
19038 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19040 * report.cs: Make all of it static.
19042 * rootcontext.cs: Drop object_type and value_type computations, as
19043 we have those in the TypeManager anyways.
19045 Drop report instance variable too, now it is a global.
19047 * driver.cs: Use try/catch on command line handling.
19049 Add --probe option to debug the error reporting system with a test
19052 * report.cs: Add support for exiting program when a probe
19053 condition is reached.
19055 2001-10-03 Ravi Pratap <ravi@ximian.com>
19057 * expression.cs (Binary::DoNumericPromotions): Fix the case when
19058 we do a forcible conversion regardless of type, to check if
19059 ForceConversion returns a null.
19061 (Binary::error19): Use location to report error.
19063 (Unary::error23): Use location here too.
19065 * ../errors/cs0019.cs : Check in.
19067 * ../errors/cs0023.cs : Check in.
19069 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
19070 case of a non-null MethodInfo object with a length of 0 !
19072 (Binary::ResolveOperator): Flag error if overload resolution fails to find
19073 an applicable member - according to the spec :-)
19074 Also fix logic to find members in base types.
19076 (Unary::ResolveOperator): Same here.
19078 (Unary::report23): Change name to error23 and make first argument a TypeContainer
19079 as I was getting thoroughly confused between this and error19 :-)
19081 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
19082 (::FindMostEncompassedType): Implement.
19083 (::FindMostEncompassingType): Implement.
19084 (::StandardConversionExists): Implement.
19086 (UserImplicitCast): Re-vamp. We now need info about most specific
19087 source and target types so that we can do the necessary conversions.
19089 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
19090 mathematical union with no duplicates.
19092 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19094 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
19095 in order from base classes to child classes, so that we can in
19096 child classes look up in our parent for method names and
19097 attributes (required for handling abstract, virtual, new, override
19098 constructs: we need to instrospect our base class, and if we dont
19099 populate the classes in order, the introspection might be
19100 incorrect. For example, a method could query its parent before
19101 the parent has any methods and would determine that the parent has
19102 no abstract methods (while it could have had them)).
19104 (RootContext::CreateType): Record the order in which we define the
19107 2001-10-02 Miguel de Icaza <miguel@ximian.com>
19109 * class.cs (TypeContainer::Populate): Also method definitions can
19110 fail now, keep track of this.
19112 (TypeContainer::FindMembers): Implement support for
19113 DeclaredOnly/noDeclaredOnly flag.
19115 (Constructor::Emit) Return the ConstructorBuilder.
19117 (Method::Emit) Return the MethodBuilder.
19118 Check for abstract or virtual methods to be public.
19120 * rootcontext.cs (RootContext::CreateType): Register all the
19121 abstract methods required for the class to be complete and the
19122 interface methods that must be implemented.
19124 * cs-parser.jay: Report error 501 (method requires body if it is
19125 not marked abstract or extern).
19127 * expression.cs (TypeOf::Emit): Implement.
19129 * typemanager.cs: runtime_handle_type, new global type.
19131 * class.cs (Property::Emit): Generate code for properties.
19133 2001-10-02 Ravi Pratap <ravi@ximian.com>
19135 * expression.cs (Unary::ResolveOperator): Find operators on base type
19136 too - we now conform exactly to the spec.
19138 (Binary::ResolveOperator): Same here.
19140 * class.cs (Operator::Define): Fix minor quirk in the tests.
19142 * ../errors/cs0215.cs : Added.
19144 * ../errors/cs0556.cs : Added.
19146 * ../errors/cs0555.cs : Added.
19148 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19150 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
19151 single integer which is really efficient
19153 2001-10-01 Ravi Pratap <ravi@ximian.com>
19155 * expression.cs (Expression::ImplicitUserConversion): Use location
19156 even in the case when we are examining True operators.
19158 * class.cs (Operator::Define): Perform extensive checks to conform
19159 with the rules for operator overloading in the spec.
19161 * expression.cs (Expression::ImplicitReferenceConversion): Implement
19162 some of the other conversions mentioned in the spec.
19164 * typemanager.cs (array_type): New static member for the System.Array built-in
19167 (cloneable_interface): For System.ICloneable interface.
19169 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
19170 we start resolving the tree and populating types.
19172 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
19174 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19176 * expression.cs (Expression::ExprClassFromMemberInfo,
19177 Expression::Literalize): Create literal expressions from
19178 FieldInfos which are literals.
19180 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
19181 type casts, because they were wrong. The test suite in tests
19184 (ImplicitNumericConversion): ushort to ulong requires a widening
19187 Int32 constant to long requires widening cast as well.
19189 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
19190 for integers because the type on the stack is not i4.
19192 2001-09-30 Miguel de Icaza <miguel@ximian.com>
19194 * expression.cs (report118): require location argument.
19196 * parameter.cs: Do not dereference potential null value.
19198 * class.cs: Catch methods that lack the `new' keyword when
19199 overriding a name. Report warnings when `new' is used without
19200 anything being there to override.
19202 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
19204 * class.cs: Only add constructor to hashtable if it is non-null
19205 (as now constructors can fail on define).
19207 (TypeManager, Class, Struct): Take location arguments.
19209 Catch field instance initialization in structs as errors.
19211 accepting_filter: a new filter for FindMembers that is static so
19212 that we dont create an instance per invocation.
19214 (Constructor::Define): Catch errors where a struct constructor is
19217 * cs-parser.jay: Pass location information for various new
19220 * delegate.cs (Delegate): take a location argument.
19222 * driver.cs: Do not call EmitCode if there were problesm in the
19223 Definition of the types, as many Builders wont be there.
19225 * decl.cs (Decl::Decl): Require a location argument.
19227 * cs-tokenizer.cs: Handle properly hex constants that can not fit
19228 into integers, and find the most appropiate integer for it.
19230 * literal.cs: Implement ULongLiteral.
19232 * rootcontext.cs: Provide better information about the location of
19233 failure when CreateType fails.
19235 2001-09-29 Miguel de Icaza <miguel@ximian.com>
19237 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
19240 * expression.cs (Binary::CheckShiftArguments): Add missing type
19242 (Binary::ResolveOperator): Add type to the logical and and logical
19243 or, Bitwise And/Or and Exclusive Or code paths, it was missing
19246 (Binary::DoNumericPromotions): In the case where either argument
19247 is ulong (and most signed types combined with ulong cause an
19248 error) perform implicit integer constant conversions as well.
19250 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19252 * expression.cs (UserImplicitCast): Method should always be
19254 (Invocation::BetterConversion): Simplified test for IntLiteral.
19256 (Expression::ImplicitNumericConversion): Split this routine out.
19257 Put the code that performs implicit constant integer conversions
19260 (Expression::Resolve): Become a wrapper around DoResolve so we can
19261 check eclass and type being set after resolve.
19263 (Invocation::Badness): Remove this dead function
19265 (Binary::ResolveOperator): Do not compute the expensive argumnets
19266 unless we have a union for it.
19268 (Probe::Emit): Is needs to do an isinst and then
19269 compare against null.
19271 (::CanConvert): Added Location argument. If the Location argument
19272 is null (Location.Null), then we do not report errors. This is
19273 used by the `probe' mechanism of the Explicit conversion. We do
19274 not want to generate an error for something that the user
19275 explicitly requested to be casted. But the pipeline for an
19276 explicit cast first tests for potential implicit casts.
19278 So for now, if the Location is null, it means `Probe only' to
19279 avoid adding another argument. Might have to revise this
19282 (ClassCast): New class used to type cast objects into arbitrary
19283 classes (used in Explicit Reference Conversions).
19285 Implement `as' as well.
19287 Reverted all the patches from Ravi below: they were broken:
19289 * The use of `level' as a mechanism to stop recursive
19290 invocations is wrong. That was there just to catch the
19291 bug with a strack trace but not as a way of addressing
19294 To fix the problem we have to *understand* what is going
19295 on and the interactions and come up with a plan, not
19296 just get things going.
19298 * The use of the type conversion cache that I proposed
19299 last night had an open topic: How does this work across
19300 protection domains. A user defined conversion might not
19301 be public in the location where we are applying the
19302 conversion, a different conversion might be selected
19303 (ie, private A->B (better) but public B->A (worse),
19304 inside A, A->B applies, but outside it, B->A will
19307 * On top of that (ie, even if the above is solved),
19308 conversions in a cache need to be abstract. Ie, `To
19309 convert from an Int to a Short use an OpcodeCast', not
19310 `To convert from an Int to a Short use the OpcodeCast on
19311 the variable 5' (which is what this patch was doing).
19313 2001-09-28 Ravi Pratap <ravi@ximian.com>
19315 * expression.cs (Invocation::ConversionExists): Re-write to use
19316 the conversion cache
19318 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
19319 cache all conversions done, not just user-defined ones.
19321 (Invocation::BetterConversion): The real culprit. Use ConversionExists
19322 to determine if a conversion exists instead of acutually trying to
19323 perform the conversion. It's faster too.
19325 (Expression::ConvertExplicit): Modify to use ConversionExists to check
19326 and only then attempt the implicit conversion.
19328 2001-09-28 Ravi Pratap <ravi@ximian.com>
19330 * expression.cs (ConvertImplicit): Use a cache for conversions
19331 already found. Check level of recursion and bail out if necessary.
19333 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19335 * typemanager.cs (string_concat_string_string, string_concat_object_object):
19336 Export standard methods that we expect for string operations.
19338 * statement.cs (Block::UsageWarning): Track usage of variables and
19339 report the errors for not used variables.
19341 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
19344 2001-09-27 Miguel de Icaza <miguel@ximian.com>
19346 * codegen.cs: remove unnneded code
19348 * expression.cs: Removed BuiltinTypeAccess class
19350 Fix the order in which implicit conversions are
19353 The previous fixed dropped support for boxed conversions (adding a
19354 test to the test suite now)
19356 (UserImplicitCast::CanConvert): Remove test for source being null,
19357 that code is broken. We should not feed a null to begin with, if
19358 we do, then we should track the bug where the problem originates
19359 and not try to cover it up here.
19361 Return a resolved expression of type UserImplicitCast on success
19362 rather than true/false. Ravi: this is what I was talking about,
19363 the pattern is to use a static method as a "constructor" for
19366 Also, do not create arguments until the very last minute,
19367 otherwise we always create the arguments even for lookups that
19368 will never be performed.
19370 (UserImplicitCast::Resolve): Eliminate, objects of type
19371 UserImplicitCast are born in a fully resolved state.
19373 * typemanager.cs (InitCoreTypes): Init also value_type
19374 (System.ValueType).
19376 * expression.cs (Cast::Resolve): First resolve the child expression.
19378 (LValue): Add new method AddressOf to be used by
19381 Change the argument of Store to take an EmitContext instead of an
19382 ILGenerator, because things like FieldExpr need to be able to call
19383 their children expression to generate the instance code.
19385 (Expression::Error, Expression::Warning): Sugar functions for
19388 (Expression::MemberLookup): Accept a TypeContainer instead of a
19389 Report as the first argument.
19391 (Expression::ResolvePrimary): Killed. I still want to improve
19392 this as currently the code is just not right.
19394 (Expression::ResolveMemberAccess): Simplify, but it is still
19397 (Unary::Resolve): Catch errors in AddressOf operators.
19399 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
19400 index to a byte for the short-version, or the compiler will choose
19401 the wrong Emit call, which generates the wrong data.
19403 (ParameterReference::Emit, ::Store): same.
19405 (FieldExpr::AddressOf): Implement.
19407 * typemanager.cs: TypeManager: made public variable instead of
19410 * driver.cs: document --fatal.
19412 * report.cs (ErrorMessage, WarningMessage): new names for the old
19413 Error and Warning classes.
19415 * cs-parser.jay (member_access): Turn built-in access to types
19416 into a normal simplename
19418 2001-09-27 Ravi Pratap <ravi@ximian.com>
19420 * expression.cs (Invocation::BetterConversion): Fix to cope
19421 with q being null, since this was introducing a bug.
19423 * expression.cs (ConvertImplicit): Do built-in conversions first.
19425 2001-09-27 Ravi Pratap <ravi@ximian.com>
19427 * expression.cs (UserImplicitCast::Resolve): Fix bug.
19429 2001-09-27 Ravi Pratap <ravi@ximian.com>
19431 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
19432 I had introduced long ago (what's new ?).
19434 * expression.cs (UserImplicitCast::CanConvert): Static method to do
19435 the work of all the checking.
19436 (ConvertImplicit): Call CanConvert and only then create object if necessary.
19437 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
19439 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
19440 that is the right way.
19442 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
19443 overloading resolution. Use everywhere instead of cutting and pasting code.
19445 (Binary::ResolveOperator): Use MakeUnionSet.
19447 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
19448 we have to convert to bool types. Not complete yet.
19450 2001-09-27 Miguel de Icaza <miguel@ximian.com>
19452 * typemanager.cs (TypeManager::CSharpName): support ushort.
19454 * expression.cs (Expression::TryImplicitIntConversion): Attempts
19455 to provide an expression that performsn an implicit constant int
19456 conversion (section 6.1.6).
19457 (Expression::ConvertImplicitRequired): Reworked to include
19458 implicit constant expression conversions.
19460 (Expression::ConvertNumericExplicit): Finished.
19462 (Invocation::Emit): If InstanceExpression is null, then it means
19463 that we perform a call on this.
19465 2001-09-26 Miguel de Icaza <miguel@ximian.com>
19467 * expression.cs (Unary::Emit): Remove some dead code.
19468 (Probe): Implement Resolve and Emit for `is'.
19469 (Expression::ConvertImplicitRequired): Attempt to do constant
19470 expression conversions here. Maybe should be moved to
19471 ConvertImplicit, but I am not sure.
19472 (Expression::ImplicitLongConstantConversionPossible,
19473 Expression::ImplicitIntConstantConversionPossible): New functions
19474 that tell whether is it possible to apply an implicit constant
19475 expression conversion.
19477 (ConvertNumericExplicit): Started work on explicit numeric
19480 * cs-parser.jay: Update operator constants.
19482 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
19483 (Parameters::GetSignature): Hook up VerifyArgs here.
19484 (Parameters::VerifyArgs): Verifies that no two arguments have the
19487 * class.cs (Operator): Update the operator names to reflect the
19488 ones that the spec expects (as we are just stringizing the
19491 * expression.cs (Unary::ResolveOperator): Fix bug: Use
19492 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
19493 previous usage did only work for our methods.
19494 (Expression::ConvertImplicit): Handle decimal implicit numeric
19495 conversions as well.
19496 (Expression::InternalTypeConstructor): Used to invoke constructors
19497 on internal types for default promotions.
19499 (Unary::Emit): Implement special handling for the pre/post
19500 increment/decrement for overloaded operators, as they need to have
19501 the same semantics as the other operators.
19503 (Binary::ResolveOperator): ditto.
19504 (Invocation::ConversionExists): ditto.
19505 (UserImplicitCast::Resolve): ditto.
19507 2001-09-26 Ravi Pratap <ravi@ximian.com>
19509 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
19510 operator, return after emitting body. Regression tests pass again !
19512 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
19513 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
19514 (Invocation::OverloadResolve): Ditto.
19515 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
19517 * everywhere : update calls to the above methods accordingly.
19519 2001-09-26 Miguel de Icaza <miguel@ximian.com>
19521 * assign.cs (Assign): Make it inherit from ExpressionStatement.
19523 * expression.cs (ExpressionStatement): New base class used for
19524 expressions that can appear in statements, so that we can provide
19525 an alternate path to generate expression that do not leave a value
19528 (Expression::Emit, and all the derivatives): We no longer return
19529 whether a value is left on the stack or not. Every expression
19530 after being emitted leaves a single value on the stack.
19532 * codegen.cs (EmitContext::EmitStatementExpression): Use the
19533 facilties of ExpressionStatement if possible.
19535 * cs-parser.jay: Update statement_expression.
19537 2001-09-25 Miguel de Icaza <miguel@ximian.com>
19539 * driver.cs: Change the wording of message
19541 2001-09-25 Ravi Pratap <ravi@ximian.com>
19543 * expression.cs (Binary::ResolveOperator): Had forgottten to set
19544 the type of the expression to the return type of the method if
19545 we have an overloaded operator match ! The regression tests pass again !
19546 (Unary::ResolveOperator): Ditto.
19548 * expression.cs (Invocation::ConversionExists): Correct the member lookup
19549 to find "op_Implicit", not "implicit" ;-)
19550 (UserImplicitCast): New class to take care of user-defined implicit conversions.
19551 (ConvertImplicit, ForceConversion): Take TypeContainer argument
19553 * everywhere : Correct calls to the above accordingly.
19555 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
19556 (ConvertImplicit): Do user-defined conversion if it exists.
19558 2001-09-24 Miguel de Icaza <miguel@ximian.com>
19560 * assign.cs: track location.
19561 (Resolve): Use implicit conversions on assignment.
19563 * literal.cs: Oops. Not good, Emit of short access values should
19564 pass (Bytes) or the wrong argument will be selected.
19566 * expression.cs (Unary::Emit): Emit code for -expr.
19568 (Unary::ResolveOperator): Handle `Substract' for non-constants
19569 (substract from zero from the non-constants).
19570 Deal with Doubles as well.
19572 (Expression::ConvertImplicitRequired): New routine that reports an
19573 error if no implicit conversion exists.
19575 (Invocation::OverloadResolve): Store the converted implicit
19576 expressions if we make them
19578 2001-09-24 Ravi Pratap <ravi@ximian.com>
19580 * class.cs (ConstructorInitializer): Take a Location argument.
19581 (ConstructorBaseInitializer): Same here.
19582 (ConstructorThisInitializer): Same here.
19584 * cs-parser.jay : Update all calls accordingly.
19586 * expression.cs (Unary, Binary, New): Take location argument.
19587 Update accordingly everywhere.
19589 * cs-parser.jay : Update all calls to the above to take a location
19592 * class.cs : Ditto.
19594 2001-09-24 Ravi Pratap <ravi@ximian.com>
19596 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
19597 (Invocation::BetterConversion): Same here
19598 (Invocation::ConversionExists): Ditto.
19600 (Invocation::ConversionExists): Implement.
19602 2001-09-22 Ravi Pratap <ravi@ximian.com>
19604 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
19605 Also take an additional TypeContainer argument.
19607 * All over : Pass in TypeContainer as argument to OverloadResolve.
19609 * typemanager.cs (CSharpName): Update to check for the string type and return
19612 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
19615 2001-09-21 Ravi Pratap <ravi@ximian.com>
19617 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
19618 (Invocation::BetterFunction): Implement.
19619 (Invocation::BetterConversion): Implement.
19620 (Invocation::ConversionExists): Skeleton, no implementation yet.
19622 Okay, things work fine !
19624 2001-09-21 Miguel de Icaza <miguel@ximian.com>
19626 * typemanager.cs: declare and load enum_type, delegate_type and
19629 * expression.cs (Expression::Emit): Now emit returns a value that
19630 tells whether a value is left on the stack or not. This strategy
19631 might be reveted tomorrow with a mechanism that would address
19632 multiple assignments.
19633 (Expression::report118): Utility routine to report mismatches on
19636 (Unary::Report23): Report impossible type/operator combination
19639 (Unary::IsIncrementableNumber): Whether the type can be
19640 incremented or decremented with add.
19641 (Unary::ResolveOperator): Also allow enumerations to be bitwise
19643 (Unary::ResolveOperator): Implement ++, !, ~,
19645 (Invocation::Emit): Deal with new Emit convetion.
19647 * All Expression derivatives: Updated their Emit method to return
19648 whether they leave values on the stack or not.
19650 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
19651 stack for expressions that are statements.
19653 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19655 * expression.cs (LValue): New interface. Must be implemented by
19657 (LocalVariableReference, ParameterReference, FieldExpr): Implement
19660 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
19661 interface for generating code, simplifies the code.
19663 2001-09-20 Ravi Pratap <ravi@ximian.com>
19665 * expression.cs (everywhere): Comment out return statements in ::Resolve
19666 methods to avoid the warnings.
19668 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19670 * driver.cs (parse): Report error 2001 if we can not open the
19673 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
19676 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
19679 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
19680 otherwise nested blocks end up with the same index.
19682 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
19684 * expression.cs: Instead of having FIXMEs in the Resolve
19685 functions, throw exceptions so it is obvious that we are facing a
19688 * cs-parser.jay (invocation_expression): Pass Location information.
19690 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
19691 Use a basename for those routines because .NET does not like paths
19694 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
19697 2001-09-19 Miguel de Icaza <miguel@ximian.com>
19699 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
19700 are loading the correct data types (throws an exception if not).
19701 (TypeManager::InitCoreTypes): Use CoreLookupType
19703 * expression.cs (Unary::ResolveOperator): return the child
19704 expression for expressions which are just +expr.
19705 (Unary::ResolveOperator): Return negative literals for -LITERAL
19706 expressions (otherwise they are Unary {Literal}).
19707 (Invocation::Badness): Take into account `Implicit constant
19708 expression conversions'.
19710 * literal.cs (LongLiteral): Implement long literal class.
19711 (IntLiteral): export the `Value' of the intliteral.
19713 2001-09-19 Ravi Pratap <ravi@ximian.com>
19715 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
19717 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
19718 instead of 'Operator'
19720 * expression.cs (Binary::ResolveOperator): Update accordingly.
19721 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
19724 * cs-parser.jay (unary_expression): Update to use the new names.
19726 * gen-treedump.cs (GetUnary): Same here.
19728 * expression.cs (Unary::Resolve): Implement.
19729 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
19730 operators are found instead of making noise ;-)
19731 (Unary::ResolveOperator): New method to do precisely the same thing which
19732 Binary::ResolveOperator does for Binary expressions.
19733 (Unary.method, .Arguments): Add.
19734 (Unary::OperName): Implement.
19735 (Unary::ForceConversion): Copy and Paste !
19737 * class.cs (Operator::Define): Fix a small bug for the case when we have
19740 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
19741 for the inbuilt operators. Only overloading works for now ;-)
19743 2001-09-18 Miguel de Icaza <miguel@ximian.com>
19745 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
19746 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
19748 * expression.cs (This::Emit): Implement.
19749 (This::Resolve): Implement.
19750 (TypeOf:Resolve): Implement.
19751 (Expression::ResolveSimpleName): Add an implicit this to instance
19753 (MemberAccess::Resolve): Deal with Parameters and Fields.
19754 Bind instance variable to Field expressions.
19755 (FieldExpr::Instance): New field used to track the expression that
19756 represents the object instance.
19757 (FieldExpr::Resolve): Track potential errors from MemberLookup not
19759 (FieldExpr::Emit): Implement.
19761 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
19762 the last instruction contains a return opcode to avoid generating
19763 the last `ret' instruction (this generates correct code, and it is
19764 nice to pass the peverify output).
19766 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
19767 initializer for static and instance variables.
19768 (Constructor::Emit): Allow initializer to be null in the case of
19769 static constructors. Only emit initializer for instance
19772 (TypeContainer::FindMembers): Return a null array if there are no
19775 Also fix the code for the MemberTypes.Method branch, as it was not
19776 scanning that for operators (or tried to access null variables before).
19778 * assign.cs (Assign::Emit): Handle instance and static fields.
19782 * driver.cs: Stop compilation if there are parse errors.
19784 * cs-parser.jay (constructor_declaration): Provide default base
19785 initializer for non-static constructors.
19786 (constructor_declarator): Do not provide a default base
19787 initializers if none was specified.
19788 Catch the fact that constructors should not have parameters.
19790 * class.cs: Do not emit parent class initializers for static
19791 constructors, that should be flagged as an error.
19793 2001-09-18 Ravi Pratap <ravi@ximian.com>
19795 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
19796 Move back code into TypeContainer::Populate.
19798 2001-09-18 Ravi Pratap <ravi@ximian.com>
19800 * class.cs (TypeContainer::AddConstructor): Fix the check to
19801 compare against Name, not Basename.
19802 (Operator::OpType): Change Plus and Minus to Add and Subtract.
19804 * cs-parser.jay : Update accordingly.
19806 * class.cs (TypeContainer::FindMembers): For the case where we are searching
19807 for methods, don't forget to look into the operators too.
19808 (RegisterMethodBuilder): Helper method to take care of this for
19809 methods, constructors and operators.
19810 (Operator::Define): Completely revamp.
19811 (Operator.OperatorMethod, MethodName): New fields.
19812 (TypeContainer::Populate): Move the registering of builders into
19813 RegisterMethodBuilder.
19814 (Operator::Emit): Re-write.
19816 * expression.cs (Binary::Emit): Comment out code path to emit method
19817 invocation stuff for the case when we have a user defined operator. I am
19818 just not able to get it right !
19820 2001-09-17 Miguel de Icaza <miguel@ximian.com>
19822 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
19825 (Expression::MemberLookup): Provide a version that allows to
19826 specify the MemberTypes and BindingFlags.
19828 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
19829 so it was not fetching variable information from outer blocks.
19831 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
19832 Beforefieldinit as it was buggy.
19834 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
19835 that Ravi put here.
19837 * class.cs (Constructor::Emit): Only emit if block is not null.
19838 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
19839 deal with this by semantically definining it as if the user had
19842 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
19843 constructors as we now "emit" them at a higher level.
19845 (TypeContainer::DefineDefaultConstructor): Used to define the
19846 default constructors if none was provided.
19848 (ConstructorInitializer): Add methods Resolve and Emit.
19850 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
19852 2001-09-17 Ravi Pratap <ravi@ximian.com>
19854 * class.cs (TypeContainer::EmitDefaultConstructor): Register
19855 the default constructor builder with our hashtable for methodbuilders
19858 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
19859 and argument_count is 0 in which case we have a match.
19860 (Binary::ResolveOperator): More null checking and miscellaneous coding
19863 2001-09-17 Ravi Pratap <ravi@ximian.com>
19865 * rootcontext.cs (IsNameSpace): Compare against null.
19867 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
19869 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
19870 and Unary::Operator.
19872 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
19875 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
19876 we have overloaded operators.
19877 (Binary::ResolveOperator): Implement the part which does the operator overload
19880 * class.cs (Operator::Emit): Implement.
19881 (TypeContainer::Emit): Emit the operators we have too.
19883 * expression.cs (Binary::Emit): Update to emit the appropriate code for
19884 the case when we have a user-defined operator.
19886 2001-09-17 Miguel de Icaza <miguel@ximian.com>
19888 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
19890 2001-09-16 Ravi Pratap <ravi@ximian.com>
19892 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
19893 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
19894 (Constructor::Emit): Implement.
19895 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
19896 if we have no work to do.
19897 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
19900 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
19901 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
19903 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
19906 2001-09-15 Ravi Pratap <ravi@ximian.com>
19908 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
19910 (Tree::RecordNamespace): Method to do what the name says ;-)
19911 (Tree::Namespaces): Property to get at the namespaces hashtable.
19913 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
19916 * rootcontext.cs (IsNamespace): Fixed it :-)
19918 2001-09-14 Miguel de Icaza <miguel@ximian.com>
19920 * class.cs (TypeContainer::FindMembers): Add support for
19922 (MethodCore): New class that encapsulates both the shared aspects
19923 of a Constructor and a Method.
19924 (Method, Constructor): Factored pieces into MethodCore.
19926 * driver.cs: Added --fatal which makes errors throw exceptions.
19927 Load System assembly as well as part of the standard library.
19929 * report.cs: Allow throwing exceptions on errors for debugging.
19931 * modifiers.cs: Do not use `parent', instead use the real type
19932 container to evaluate permission settings.
19934 * class.cs: Put Ravi's patch back in. He is right, and we will
19935 have to cope with the
19937 2001-09-14 Ravi Pratap <ravi@ximian.com>
19939 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
19940 FamORAssem, not FamANDAssem.
19942 2001-09-14 Miguel de Icaza <miguel@ximian.com>
19944 * driver.cs: Added --parse option that only parses its input files
19947 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
19948 incorrect. IsTopLevel is not used to tell whether an object is
19949 root_types or not (that can be achieved by testing this ==
19950 root_types). But to see if this is a top-level *class* (not
19951 necessarly our "toplevel" container).
19953 2001-09-14 Ravi Pratap <ravi@ximian.com>
19955 * enum.cs (Enum::Define): Modify to call the Lookup method on the
19956 parent instead of a direct call to GetType.
19958 2001-09-14 Ravi Pratap <ravi@ximian.com>
19960 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
19961 Modifiers.TypeAttr. This should just be a call to that method.
19963 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
19964 object so that we can determine if we are top-level or not.
19966 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
19969 * enum.cs (Enum::Define): Ditto.
19971 * modifiers.cs (FieldAttr): Re-write.
19973 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
19974 (TypeContainer::HaveStaticConstructor): New property to provide access
19975 to precisely that info.
19977 * modifiers.cs (MethodAttr): Re-write.
19978 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
19980 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
19981 of top-level types as claimed.
19983 2001-09-13 Miguel de Icaza <miguel@ximian.com>
19985 * expression.cs (MemberLookup): Fruitless attempt to lookup
19986 constructors. Maybe I need to emit default constructors? That
19987 might be it (currently .NET emits this for me automatically).
19988 (Invocation::OverloadResolve): Cope with Arguments == null.
19989 (Invocation::EmitArguments): new function, shared by the new
19990 constructor and us.
19991 (Invocation::Emit): Handle static and instance methods. Emit
19992 proper call instruction for virtual or non-virtual invocations.
19993 (New::Emit): Implement.
19994 (New::Resolve): Implement.
19995 (MemberAccess:Resolve): Implement.
19996 (MethodGroupExpr::InstanceExpression): used conforming to the spec
19997 to track instances.
19998 (FieldExpr::Resolve): Set type.
20000 * support.cs: Handle empty arguments.
20002 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20003 SimpleLookup): Auxiliary routines to help parse a qualifier
20006 Update qualifier_identifier rule.
20008 * codegen.cs: Removed debugging messages.
20010 * class.cs: Make this a global thing, this acts just as a "key" to
20011 objects that we might have around.
20013 (Populate): Only initialize method_builders_to_methods once.
20015 * expression.cs (PropertyExpr): Initialize type from the
20018 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20019 Resolve pattern. Attempt to implicitly convert value to boolean.
20022 * expression.cs: Set the type for the int32/int32 argument case.
20023 (Binary::ResolveOperator): Set the return type to boolean for
20024 comparission operators
20026 * typemanager.cs: Remove debugging print code.
20028 (Invocation::Resolve): resolve type.
20030 * class.cs: Allocate a MemberInfo of the correct size, as the code
20031 elsewhere depends on the test to reflect the correct contents.
20033 (Method::) Keep track of parameters, due to System.Reflection holes
20035 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20038 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20039 of the exact size and return that.
20041 (Class::LookupMethodByBuilder): New function that maps
20042 MethodBuilders to its methods. Required to locate the information
20043 on methods because System.Reflection bit us again.
20045 * support.cs: New file, contains an interface ParameterData and
20046 two implementations: ReflectionParameters and InternalParameters
20047 used to access Parameter information. We will need to grow this
20050 * expression.cs (Invocation::GetParameterData): implement a cache
20051 and a wrapper around the ParameterData creation for methods.
20052 (Invocation::OverloadResolve): Use new code.
20054 2001-09-13 Ravi Pratap <ravi@ximian.com>
20056 * class.cs (TypeContainer::EmitField): Remove and move into
20057 (Field::Define): here and modify accordingly.
20058 (Field.FieldBuilder): New member.
20059 (TypeContainer::Populate): Update accordingly.
20060 (TypeContainer::FindMembers): Implement.
20062 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20064 * statement.cs: (VariableInfo::VariableType): New field to be
20065 initialized with the full type once it is resolved.
20067 2001-09-12 Miguel de Icaza <miguel@ximian.com>
20069 * parameter.cs (GetParameterInfo): Use a type cache to compute
20070 things only once, and to reuse this information
20072 * expression.cs (LocalVariableReference::Emit): Implement.
20073 (OpcodeCast::Emit): fix.
20075 (ParameterReference::Resolve): Implement.
20076 (ParameterReference::Emit): Implement.
20078 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
20079 that are expressions need to stay as Expressions.
20081 * typemanager.cs (CSharpName): Returns the C# name of a type if
20084 * expression.cs (Expression::ConvertImplicit): New function that
20085 implements implicit type conversions.
20087 (Expression::ImplicitReferenceConversion): Implements implicit
20088 reference conversions.
20090 (EmptyCast): New type for transparent casts.
20092 (OpcodeCast): New type for casts of types that are performed with
20093 a sequence of bytecodes.
20095 (BoxedCast): New type used for casting value types into reference
20096 types. Emits a box opcode.
20098 (Binary::DoNumericPromotions): Implements numeric promotions of
20099 and computation of the Binary::Type.
20101 (Binary::EmitBranchable): Optimization.
20103 (Binary::Emit): Implement code emission for expressions.
20105 * typemanager.cs (TypeManager): Added two new core types: sbyte
20108 2001-09-12 Ravi Pratap <ravi@ximian.com>
20110 * class.cs (TypeContainer::FindMembers): Method which does exactly
20111 what Type.FindMembers does, only we don't have to use reflection. No
20112 implementation yet.
20114 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
20115 typecontainer objects as we need to get at them.
20116 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
20118 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
20119 typecontainer object.
20121 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
20122 of just a Report object.
20124 2001-09-11 Ravi Pratap <ravi@ximian.com>
20126 * class.cs (Event::Define): Go back to using the prefixes "add_" and
20128 (TypeContainer::Populate): Now define the delegates of the type too.
20129 (TypeContainer.Delegates): Property to access the list of delegates defined
20132 * delegates.cs (Delegate::Define): Implement partially.
20134 * modifiers.cs (TypeAttr): Handle more flags.
20136 2001-09-11 Ravi Pratap <ravi@ximian.com>
20138 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
20140 (Operator::Define): Re-write logic to get types by using the LookupType method
20141 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
20142 (Indexer::Define): Ditto.
20143 (Event::Define): Ditto.
20144 (Property::Define): Ditto.
20146 2001-09-10 Ravi Pratap <ravi@ximian.com>
20148 * class.cs (TypeContainer::Populate): Now define operators too.
20149 (TypeContainer.Operators): New property to access the list of operators
20151 (Operator.OperatorMethodBuilder): New member to hold the method builder
20152 for the operator we are defining.
20153 (Operator::Define): Implement.
20155 2001-09-10 Ravi Pratap <ravi@ximian.com>
20157 * class.cs (Event::Define): Make the prefixes of the accessor methods
20158 addOn_ and removeOn_
20160 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
20161 of the location being passed in too. Ideally, this should go later since all
20162 error reporting should be done through the Report object.
20164 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
20165 (Populate): Iterate thru the indexers we have and define them too.
20166 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
20167 for the get and set accessors.
20168 (Indexer::Define): Implement.
20170 2001-09-09 Miguel de Icaza <miguel@ximian.com>
20172 * expression.cs (Binary::Resolve): Beginning of it. I scratched
20173 my previous implementation, did not work.
20175 * typemanager.cs: Add a couple of missing types (the longs).
20177 * literal.cs: Use TypeManager.bool_type instead of getting it.
20179 * expression.cs (EventExpr): New kind of expressions.
20180 (Expressio::ExprClassFromMemberInfo): finish
20182 2001-09-08 Miguel de Icaza <miguel@ximian.com>
20184 * assign.cs: Emit stores to static fields differently.
20186 2001-09-08 Ravi Pratap <ravi@ximian.com>
20188 * Merge in changes and adjust code to tackle conflicts. Backed out my
20189 code in Assign::Resolve ;-)
20191 2001-09-08 Ravi Pratap <ravi@ximian.com>
20193 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
20194 instead Report.Error and also pass in the location.
20195 (CSharpParser::Lexer): New readonly property to return the reference
20196 to the Tokenizer object.
20197 (declare_local_variables): Use Report.Error with location instead of plain
20201 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
20202 (Operator.CheckBinaryOperator): Ditto.
20204 * cs-parser.jay (operator_declarator): Update accordingly.
20206 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
20207 (CheckBinaryOperator): Same here.
20209 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
20210 on the name without any prefixes of namespace names etc. This is because we
20211 already might have something already fully qualified like
20212 'System.Console.WriteLine'
20214 * assign.cs (Resolve): Begin implementation. Stuck ;-)
20216 2001-09-07 Ravi Pratap <ravi@ximian.com>
20218 * cs-tokenizer.cs (location): Return a string which also contains
20221 * expression.cs (ElementAccess): New class for expressions of the
20222 type 'element access.'
20223 (BaseAccess): New class for expressions of the type 'base access.'
20224 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
20227 * cs-parser.jay (element_access): Implement action.
20228 (base_access): Implement actions.
20229 (checked_expression, unchecked_expression): Implement.
20231 * cs-parser.jay (local_variable_type): Correct and implement.
20232 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
20234 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
20236 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
20237 name and the specifiers.
20239 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
20241 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
20242 making them all public ;-)
20244 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
20247 2001-09-07 Miguel de Icaza <miguel@ximian.com>
20249 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
20251 (FieldExpr, PropertyExprs): New resolved expressions.
20252 (SimpleName::MemberStaticCheck): Perform static checks for access
20253 to non-static fields on static methods. Maybe this should be
20254 generalized for MemberAccesses.
20255 (SimpleName::ResolveSimpleName): More work on simple name
20258 * cs-parser.jay (primary_expression/qualified_identifier): track
20259 the parameter index.
20261 * codegen.cs (CodeGen::Save): Catch save exception, report error.
20262 (EmitContext::EmitBoolExpression): Chain to expression generation
20263 instead of temporary hack.
20264 (::EmitStatementExpression): Put generic expression code generation.
20266 * assign.cs (Assign::Emit): Implement variable assignments to
20267 local variables, parameters and fields.
20269 2001-09-06 Miguel de Icaza <miguel@ximian.com>
20271 * statement.cs (Block::GetVariableInfo): New method, returns the
20272 VariableInfo for a variable name in a block.
20273 (Block::GetVariableType): Implement in terms of GetVariableInfo
20275 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
20276 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
20278 2001-09-06 Ravi Pratap <ravi@ximian.com>
20280 * cs-parser.jay (operator_declaration): Continue on my quest : update
20281 to take attributes argument.
20282 (event_declaration): Ditto.
20283 (enum_declaration): Ditto.
20284 (indexer_declaration): Ditto.
20286 * class.cs (Operator::Operator): Update constructor accordingly.
20287 (Event::Event): Ditto.
20289 * delegate.cs (Delegate::Delegate): Same here.
20291 * enum.cs (Enum::Enum): Same here.
20293 2001-09-05 Ravi Pratap <ravi@ximian.com>
20295 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
20297 * ../tests/cs0658.cs : New file to demonstrate error 0658.
20299 * attribute.cs (Attributes): New class to encapsulate all attributes which were
20300 being passed around as an arraylist.
20301 (Attributes::AddAttribute): Method to add attribute sections.
20303 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
20304 (struct_declaration): Update accordingly.
20305 (constant_declaration): Update.
20306 (field_declaration): Update.
20307 (method_header): Update.
20308 (fixed_parameter): Update.
20309 (parameter_array): Ditto.
20310 (property_declaration): Ditto.
20311 (destructor_declaration): Ditto.
20313 * class.cs (Struct::Struct): Update constructors accordingly.
20314 (Class::Class): Ditto.
20315 (Field::Field): Ditto.
20316 (Method::Method): Ditto.
20317 (Property::Property): Ditto.
20318 (TypeContainer::OptAttribute): update property's return type.
20320 * interface.cs (Interface.opt_attributes): New member.
20321 (Interface::Interface): Update to take the extra Attributes argument.
20323 * parameter.cs (Parameter::Parameter): Ditto.
20325 * constant.cs (Constant::Constant): Ditto.
20327 * interface.cs (InterfaceMemberBase): New OptAttributes field.
20328 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
20329 the attributes as a parameter.
20330 (InterfaceProperty): Update constructor call.
20331 (InterfaceEvent): Ditto.
20332 (InterfaceMethod): Ditto.
20333 (InterfaceIndexer): Ditto.
20335 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
20336 pass the attributes too.
20337 (interface_event_declaration): Ditto.
20338 (interface_property_declaration): Ditto.
20339 (interface_method_declaration): Ditto.
20340 (interface_declaration): Ditto.
20342 2001-09-05 Miguel de Icaza <miguel@ximian.com>
20344 * class.cs (Method::Define): Track the "static Main" definition to
20345 create an entry point.
20347 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
20348 EntryPoint if we find it.
20350 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
20351 (EmitContext::ig): Make this variable public.
20353 * driver.cs: Make the default output file be the first file name
20354 with the .exe extension.
20356 Detect empty compilations
20358 Handle various kinds of output targets. Handle --target and
20359 rename -t to --dumper.
20361 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
20362 methods inherited from Expression return now an Expression. This
20363 will is used during the tree rewriting as we resolve them during
20366 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
20367 the spec. Missing entirely is the information about
20368 accessability of elements of it.
20370 (Expression::ExprClassFromMemberInfo): New constructor for
20371 Expressions that creates a fully initialized Expression based on
20372 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
20375 (Invocation::Resolve): Begin implementing resolution of invocations.
20377 * literal.cs (StringLiteral): Implement Emit.
20379 2001-09-05 Ravi Pratap <ravi@ximian.com>
20381 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
20384 2001-09-04 Ravi Pratap <ravi@ximian.com>
20386 * cs-parser.jay (attribute_arguments): Implement actions.
20387 (attribute): Fix bug in production. Implement action.
20388 (attribute_list): Implement.
20389 (attribute_target): Implement.
20390 (attribute_target_specifier, opt_target_specifier): Implement
20391 (CheckAttributeTarget): New method to check if the attribute target
20393 (attribute_section): Implement.
20394 (opt_attributes): Implement.
20396 * attribute.cs : New file to handle attributes.
20397 (Attribute): Class to hold attribute info.
20399 * cs-parser.jay (opt_attribute_target_specifier): Remove production
20400 (attribute_section): Modify production to use 2 different rules to
20401 achieve the same thing. 1 s/r conflict down !
20402 Clean out commented, useless, non-reducing dimension_separator rules.
20404 * class.cs (TypeContainer.attributes): New member to hold list
20405 of attributes for a type.
20406 (Struct::Struct): Modify to take one more argument, the attribute list.
20407 (Class::Class): Ditto.
20408 (Field::Field): Ditto.
20409 (Method::Method): Ditto.
20410 (Property::Property): Ditto.
20412 * cs-parser.jay (struct_declaration): Update constructor call to
20413 pass in the attributes too.
20414 (class_declaration): Ditto.
20415 (constant_declaration): Ditto.
20416 (field_declaration): Ditto.
20417 (method_header): Ditto.
20418 (fixed_parameter): Ditto.
20419 (parameter_array): Ditto.
20420 (property_declaration): Ditto.
20422 * constant.cs (Constant::Constant): Update constructor similarly.
20423 Use System.Collections.
20425 * parameter.cs (Parameter::Parameter): Update as above.
20427 2001-09-02 Ravi Pratap <ravi@ximian.com>
20429 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
20430 (TypeContainer.delegates): New member to hold list of delegates.
20432 * cs-parser.jay (delegate_declaration): Implement the action correctly
20433 this time as I seem to be on crack ;-)
20435 2001-09-02 Miguel de Icaza <miguel@ximian.com>
20437 * rootcontext.cs (RootContext::IsNamespace): new function, used to
20438 tell whether an identifier represents a namespace.
20440 * expression.cs (NamespaceExpr): A namespace expression, used only
20441 temporarly during expression resolution.
20442 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
20443 utility functions to resolve names on expressions.
20445 2001-09-01 Miguel de Icaza <miguel@ximian.com>
20447 * codegen.cs: Add hook for StatementExpressions.
20449 * class.cs: Fix inverted test for static flag in methods.
20451 2001-09-02 Ravi Pratap <ravi@ximian.com>
20453 * class.cs (Operator::CheckUnaryOperator): Correct error number used
20454 to make it coincide with MS' number.
20455 (Operator::CheckBinaryOperator): Ditto.
20457 * ../errors/errors.txt : Remove error numbers added earlier.
20459 * ../errors/cs1019.cs : Test case for error # 1019
20461 * ../errros/cs1020.cs : Test case for error # 1020
20463 * cs-parser.jay : Clean out commented cruft.
20464 (dimension_separators, dimension_separator): Comment out. Ostensibly not
20465 used anywhere - non-reducing rule.
20466 (namespace_declarations): Non-reducing rule - comment out.
20468 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
20469 with TypeContainer::AddEnum.
20471 * delegate.cs : New file for delegate handling classes.
20472 (Delegate): Class for declaring delegates.
20474 * makefile : Update.
20476 * cs-parser.jay (delegate_declaration): Implement.
20478 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
20480 * class.cs (Event::Define): Implement.
20481 (Event.EventBuilder): New member.
20483 * class.cs (TypeContainer::Populate): Update to define all enums and events
20485 (Events): New property for the events arraylist we hold. Shouldn't we move to using
20486 readonly fields for all these cases ?
20488 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
20490 * class.cs (Property): Revamp to use the convention of making fields readonly.
20491 Accordingly modify code elsewhere.
20493 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
20494 the Define method of the Property class.
20496 * class.cs : Clean up applied patch and update references to variables etc. Fix
20498 (TypeContainer::Populate): Update to define all the properties we have. Also
20499 define all enumerations.
20501 * enum.cs (Define): Implement.
20503 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
20505 * cs-parser.jay (overloadable_operator): The semantic value is an
20506 enum of the Operator class.
20507 (operator_declarator): Implement actions.
20508 (operator_declaration): Implement.
20510 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
20511 validity of definitions.
20512 (Operator::CheckBinaryOperator): Static method to check for binary operators
20513 (TypeContainer::AddOperator): New method to add an operator to a type.
20515 * cs-parser.jay (indexer_declaration): Added line to actually call the
20516 AddIndexer method so it gets added ;-)
20518 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
20519 already taken care of by the MS compiler ?
20521 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
20523 * class.cs (Operator): New class for operator declarations.
20524 (Operator::OpType): Enum for the various operators.
20526 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
20528 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
20529 ostensibly handle this in semantic analysis.
20531 * cs-parser.jay (general_catch_clause): Comment out
20532 (specific_catch_clauses, specific_catch_clause): Ditto.
20533 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
20534 (catch_args, opt_catch_args): New productions.
20535 (catch_clause): Rewrite to use the new productions above
20536 (catch_clauses): Modify accordingly.
20537 (opt_catch_clauses): New production to use in try_statement
20538 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
20539 and re-write the code in the actions to extract the specific and
20540 general catch clauses by being a little smart ;-)
20542 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
20543 Hooray, try and catch statements parse fine !
20545 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20547 * statement.cs (Block::GetVariableType): Fix logic to extract the type
20548 string from the hashtable of variables.
20550 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
20551 I end up making that mistake ;-)
20552 (catch_clauses): Fixed gross error which made Key and Value of the
20553 DictionaryEntry the same : $1 !!
20555 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20557 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
20559 * cs-parser.jay (event_declaration): Correct to remove the semicolon
20560 when the add and remove accessors are specified.
20562 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20564 * cs-parser.jay (IndexerDeclaration): New helper class to hold
20565 information about indexer_declarator.
20566 (indexer_declarator): Implement actions.
20567 (parsing_indexer): New local boolean used to keep track of whether
20568 we are parsing indexers or properties. This is necessary because
20569 implicit_parameters come into picture even for the get accessor in the
20570 case of an indexer.
20571 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
20573 * class.cs (Indexer): New class for indexer declarations.
20574 (TypeContainer::AddIndexer): New method to add an indexer to a type.
20575 (TypeContainer::indexers): New member to hold list of indexers for the
20578 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20580 * cs-parser.jay (add_accessor_declaration): Implement action.
20581 (remove_accessor_declaration): Implement action.
20582 (event_accessors_declaration): Implement
20583 (variable_declarators): swap statements for first rule - trivial.
20585 * class.cs (Event): New class to hold information about event
20587 (TypeContainer::AddEvent): New method to add an event to a type
20588 (TypeContainer::events): New member to hold list of events.
20590 * cs-parser.jay (event_declaration): Implement actions.
20592 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20594 * cs-parser.jay (dim_separators): Implement. Make it a string
20595 concatenating all the commas together, just as they appear.
20596 (opt_dim_separators): Modify accordingly
20597 (rank_specifiers): Update accordingly. Basically do the same
20598 thing - instead, collect the brackets here.
20599 (opt_rank_sepcifiers): Modify accordingly.
20600 (array_type): Modify to actually return the complete type string
20601 instead of ignoring the rank_specifiers.
20602 (expression_list): Implement to collect the expressions
20603 (variable_initializer): Implement. We make it a list of expressions
20604 essentially so that we can handle the array_initializer case neatly too.
20605 (variable_initializer_list): Implement.
20606 (array_initializer): Make it a list of variable_initializers
20607 (opt_array_initializer): Modify accordingly.
20609 * expression.cs (New::NType): Add enumeration to help us
20610 keep track of whether we have an object/delegate creation
20611 or an array creation.
20612 (New:NewType, New::Rank, New::Indices, New::Initializers): New
20613 members to hold data about array creation.
20614 (New:New): Modify to update NewType
20615 (New:New): New Overloaded contructor for the array creation
20618 * cs-parser.jay (array_creation_expression): Implement to call
20619 the overloaded New constructor.
20621 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
20623 * class.cs (TypeContainer::Constructors): Return member
20624 constructors instead of returning null.
20626 2001-08-26 Miguel de Icaza <miguel@ximian.com>
20628 * typemanager.cs (InitCoreTypes): Initialize the various core
20629 types after we have populated the type manager with the user
20630 defined types (this distinction will be important later while
20631 compiling corlib.dll)
20633 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
20634 on Expression Classification. Now all expressions have a method
20635 `Resolve' and a method `Emit'.
20637 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
20638 generation from working. Also add some temporary debugging
20641 2001-08-24 Miguel de Icaza <miguel@ximian.com>
20643 * codegen.cs: Lots of code generation pieces. This is only the
20644 beginning, will continue tomorrow with more touches of polish. We
20645 handle the fundamentals of if, while, do, for, return. Others are
20646 trickier and I need to start working on invocations soon.
20648 * gen-treedump.cs: Bug fix, use s.Increment here instead of
20651 * codegen.cs (EmitContext): New struct, used during code
20652 emission to keep a context. Most of the code generation will be
20655 * cs-parser.jay: Add embedded blocks to the list of statements of
20656 this block. So code generation proceeds in a top down fashion.
20658 2001-08-23 Miguel de Icaza <miguel@ximian.com>
20660 * statement.cs: Add support for multiple child blocks.
20662 2001-08-22 Miguel de Icaza <miguel@ximian.com>
20664 * codegen.cs (EmitCode): New function, will emit the code for a
20665 Block of code given a TypeContainer and its ILGenerator.
20667 * statement.cs (Block): Standard public readonly optimization.
20668 (Block::Block constructors): Link children.
20669 (Block::Child): Child Linker.
20670 (Block::EmitVariables): Emits IL variable declarations.
20672 * class.cs: Drop support for MethodGroups here, delay until
20674 (Method::): Applied the same simplification that I did before, and
20675 move from Properties to public readonly fields.
20676 (Method::ParameterTypes): Returns the parameter types for the
20677 function, and implements a cache that will be useful later when I
20678 do error checking and the semantic analysis on the methods is
20680 (Constructor::GetCallingConvention): Renamed from CallingConvetion
20681 and made a method, optional argument tells whether this is a class
20682 or a structure to apply the `has-this' bit.
20683 (Method::GetCallingConvention): Implement, returns the calling
20685 (Method::Define): Defines the type, a second pass is performed
20686 later to populate the methods.
20688 (Constructor::ParameterTypes): implement a cache similar to the
20689 one on Method::ParameterTypes, useful later when we do semantic
20692 (TypeContainer::EmitMethod): New method. Emits methods.
20694 * expression.cs: Removed MethodGroup class from here.
20696 * parameter.cs (Parameters::GetCallingConvention): new method.
20698 2001-08-21 Miguel de Icaza <miguel@ximian.com>
20700 * class.cs (TypeContainer::Populate): Drop RootContext from the
20703 (Constructor::CallingConvention): Returns the calling convention.
20704 (Constructor::ParameterTypes): Returns the constructor parameter
20707 (TypeContainer::AddConstructor): Keep track of default constructor
20708 and the default static constructor.
20710 (Constructor::) Another class that starts using `public readonly'
20711 instead of properties.
20713 (Constructor::IsDefault): Whether this is a default constructor.
20715 (Field::) use readonly public fields instead of properties also.
20717 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
20718 track of static constructors; If none is used, turn on
20719 BeforeFieldInit in the TypeAttributes.
20721 * cs-parser.jay (opt_argument_list): now the return can be null
20722 for the cases where there are no arguments.
20724 (constructor_declarator): If there is no implicit `base' or
20725 `this', then invoke the default parent constructor.
20727 * modifiers.cs (MethodAttr): New static function maps a set of
20728 modifiers flags into a MethodAttributes enum
20729 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
20730 MethodAttr, TypeAttr to represent the various mappings where the
20731 modifiers are used.
20732 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
20734 2001-08-19 Miguel de Icaza <miguel@ximian.com>
20736 * parameter.cs (GetParameterInfo): Fix bug where there would be no
20739 * interface.cs (PopulateIndexer): Implemented the code generator
20740 for interface indexers.
20742 2001-08-17 Miguel de Icaza <miguel@ximian.com>
20744 * interface.cs (InterfaceMemberBase): Now we track the new status
20747 (PopulateProperty): Implement property population. Woohoo! Got
20748 Methods and Properties going today.
20750 Removed all the properties for interfaces, and replaced them with
20751 `public readonly' fields.
20753 2001-08-16 Miguel de Icaza <miguel@ximian.com>
20755 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
20756 initialize their hashtables/arraylists only when they are needed
20757 instead of doing this always.
20759 * parameter.cs: Handle refs and out parameters.
20761 * cs-parser.jay: Use an ArrayList to construct the arguments
20762 instead of the ParameterCollection, and then cast that to a
20765 * parameter.cs: Drop the use of ParameterCollection and use
20766 instead arrays of Parameters.
20768 (GetParameterInfo): Use the Type, not the Name when resolving
20771 2001-08-13 Miguel de Icaza <miguel@ximian.com>
20773 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
20774 and instead use public readonly fields.
20776 * class.cs: Put back walking code for type containers.
20778 2001-08-11 Miguel de Icaza <miguel@ximian.com>
20780 * class.cs (MakeConstant): Code to define constants.
20782 * rootcontext.cs (LookupType): New function. Used to locate types
20785 2001-08-08 Miguel de Icaza <miguel@ximian.com>
20787 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
20788 this System.Reflection code is. Kudos to Microsoft
20790 * typemanager.cs: Implement a type cache and avoid loading all
20791 types at boot time. Wrap in LookupType the internals. This made
20792 the compiler so much faster. Wow. I rule!
20794 * driver.cs: Make sure we always load mscorlib first (for
20795 debugging purposes, nothing really important).
20797 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
20798 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
20800 * rootcontext.cs: Lookup types on their namespace; Lookup types
20801 on namespaces that have been imported using the `using' keyword.
20803 * class.cs (TypeContainer::TypeAttr): Virtualize.
20804 (Class::TypeAttr): Return attributes suitable for this bad boy.
20805 (Struct::TypeAttr): ditto.
20806 Handle nested classes.
20807 (TypeContainer::) Remove all the type visiting code, it is now
20808 replaced with the rootcontext.cs code
20810 * rootcontext.cs (GetClassBases): Added support for structs.
20812 2001-08-06 Miguel de Icaza <miguel@ximian.com>
20814 * interface.cs, statement.cs, class.cs, parameter.cs,
20815 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
20816 Drop use of TypeRefs, and use strings instead.
20818 2001-08-04 Miguel de Icaza <miguel@ximian.com>
20822 * class.cs (Struct::Struct): set the SEALED flags after
20823 checking the modifiers.
20824 (TypeContainer::TypeAttr): new property, returns the
20825 TypeAttributes for a class.
20827 * cs-parser.jay (type_list): Oops, list production was creating a
20828 new list of base types.
20830 * rootcontext.cs (StdLib): New property.
20831 (GetInterfaceTypeByName): returns an interface by type name, and
20832 encapsulates error handling here.
20833 (GetInterfaces): simplified.
20834 (ResolveTree): Encapsulated all the tree resolution here.
20835 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
20838 * driver.cs: Add support for --nostdlib, to avoid loading the
20839 default assemblies.
20840 (Main): Do not put tree resolution here.
20842 * rootcontext.cs: Beginning of the class resolution.
20844 2001-08-03 Miguel de Icaza <miguel@ximian.com>
20846 * rootcontext.cs: Provide better error reporting.
20848 * cs-parser.jay (interface_base): set our $$ to be interfaces.
20850 * rootcontext.cs (CreateInterface): Handle the case where there
20851 are no parent interfaces.
20853 (CloseTypes): Routine to flush types at the end.
20854 (CreateInterface): Track types.
20855 (GetInterfaces): Returns an array of Types from the list of
20856 defined interfaces.
20858 * typemanager.c (AddUserType): Mechanism to track user types (puts
20859 the type on the global type hash, and allows us to close it at the
20862 2001-08-02 Miguel de Icaza <miguel@ximian.com>
20864 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
20865 RecordInterface instead.
20867 * cs-parser.jay: Updated to reflect changes above.
20869 * decl.cs (Definition): Keep track of the TypeBuilder type that
20870 represents this type here. Not sure we will use it in the long
20871 run, but wont hurt for now.
20873 * driver.cs: Smaller changes to accomodate the new code.
20875 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
20878 * rootcontext.cs (CreateInterface): New method, used to create
20879 the System.TypeBuilder type for interfaces.
20880 (ResolveInterfaces): new entry point to resolve the interface
20882 (CodeGen): Property, used to keep track of the code generator.
20884 2001-07-26 Miguel de Icaza <miguel@ximian.com>
20886 * cs-parser.jay: Add a second production for delegate_declaration
20889 (enum_body): Put an opt_comma here instead of putting it on
20890 enum_body or enum_member_declarations so we can handle trailing
20891 commas on enumeration members. Gets rid of a shift/reduce.
20893 (type_list): Need a COMMA in the middle.
20895 (indexer_declaration): Tell tokenizer to recognize get/set
20897 * Remove old targets.
20899 * Re-add the parser target.
20901 2001-07-13 Simon Cozens <simon@simon-cozens.org>
20903 * cs-parser.jay: Add precendence rules for a number of operators
20904 ot reduce the number of shift/reduce conflicts in the grammar.
20906 2001-07-17 Miguel de Icaza <miguel@ximian.com>
20908 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
20911 Get rid of old crufty code.
20913 * rootcontext.cs: Use this to keep track of the parsed
20914 representation and the defined types available to the program.
20916 * gen-treedump.cs: adjust for new convention.
20918 * type.cs: Split out the type manager, and the assembly builder
20921 * typemanager.cs: the type manager will live here now.
20923 * cil-codegen.cs: And the code generator here.
20925 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
20927 * makefile: Fixed up for easy making.
20929 2001-07-13 Simon Cozens <simon@simon-cozens.org>
20931 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
20934 (unary_expression): Expand pre_increment_expression and
20935 post_decrement_expression to reduce a shift/reduce.
20937 2001-07-11 Simon Cozens
20939 * cs-tokenizer.cs: Hex numbers should begin with a 0.
20941 Improve allow_keyword_as_indent name.
20943 2001-06-19 Miguel de Icaza <miguel@ximian.com>
20945 * Adjustments for Beta2.
20947 2001-06-13 Miguel de Icaza <miguel@ximian.com>
20949 * decl.cs: Added `Define' abstract method.
20950 (InTransit): new property, used to catch recursive definitions.
20952 * interface.cs: Implement `Define'.
20954 * modifiers.cs: Map Modifiers.constants to
20955 System.Reflection.TypeAttribute flags.
20957 * class.cs: Keep track of types and user-defined types.
20958 (BuilderInit): New method for creating an assembly
20959 (ResolveType): New function to launch the resolution process, only
20960 used by interfaces for now.
20962 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
20963 that are inserted into the name space.
20965 2001-06-08 Miguel de Icaza <miguel@ximian.com>
20967 * ARGH. I have screwed up my tree so many times due to the use of
20968 rsync rather than using CVS. Going to fix this at once.
20970 * driver.cs: Objetify driver. Load assemblies, use assemblies to
20973 2001-06-07 Miguel de Icaza <miguel@ximian.com>
20975 * Experiment successful: Use System.Type rather that our own
20978 2001-05-25 Miguel de Icaza <miguel@ximian.com>
20980 * cs-parser.jay: Removed nsAliases from here.
20982 Use new namespaces, handle `using XXX;'
20984 * namespace.cs: Reimplemented namespace handling, use a recursive
20985 definition of the class. Now we can keep track of using clauses
20986 and catch invalid using clauses.
20988 2001-05-24 Miguel de Icaza <miguel@ximian.com>
20990 * gen-treedump.cs: Adapted for all the renaming.
20992 * expression.cs (Expression): this class now has a Type property
20993 which returns an expression Type.
20995 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
20996 `Type', as this has a different meaning now in the base
20998 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21000 * interface.cs, class.cs: Removed from all the sources the
21001 references to signature computation, as we can not do method
21002 signature computation during the parsing time, as we are not
21003 trying to solve at that point distinguishing:
21007 void a (NS.Blah x) {}
21010 Which depending on the context might be valid or not, as we do not
21011 know if Blah is the same thing as NS.Blah at that point.
21013 * Redid everything so the code uses TypeRefs now instead of
21014 Types. TypeRefs are just temporary type placeholders, that need
21015 to be resolved. They initially have a pointer to a string and the
21016 current scope in which they are used. This is used later by the
21017 compiler to resolve the reference to an actual Type.
21019 * DeclSpace is no longer a CIR.Type, and neither are
21020 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21021 are all DeclSpaces, but no Types.
21023 * type.cs (TypeRefManager): This implements the TypeRef manager,
21024 which keeps track of all the types that need to be resolved after
21025 the parsing has finished.
21027 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21029 * ARGH. We are going to have to store `foreach' as a class rather
21030 than resolving it, as we need to verify error 1579 after name
21031 resolution. *OR* we could keep a flag that says `This request to
21032 IEnumerator comes from a foreach statement' which we can then use
21033 to generate the error.
21035 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21037 * class.cs (TypeContainer.AddMethod): we now add methods to the
21038 MethodGroup instead of the method hashtable.
21040 * expression.cs: Add MethodGroup abstraction, which gets us one
21041 step closer to the specification in the way we handle method
21044 * cs-parser.jay (primary_expression): qualified_identifier now
21045 tried to match up an identifier to a local variable reference or
21046 to a parameter reference.
21048 current_local_parameters is now a parser global variable that
21049 points to the current parameters for the block, used during name
21052 (property_declaration): Now creates an implicit `value' argument to
21055 2001-05-09 Miguel de Icaza <miguel@ximian.com>
21057 * parameter.cs: Do not use `param' arguments as part of the
21058 signature, per the spec.
21060 2001-05-08 Miguel de Icaza <miguel@ximian.com>
21062 * decl.cs: Base class for classes, structs and interfaces. This
21063 is the "Declaration Space"
21065 * cs-parser.jay: Use CheckDef for checking declaration errors
21066 instead of having one on each function.
21068 * class.cs: Factor out some code for handling error handling in
21069 accordance to the "Declarations" section in the "Basic Concepts"
21070 chapter in the ECMA C# spec.
21072 * interface.cs: Make all interface member classes derive from
21073 InterfaceMemberBase.
21075 2001-05-07 Miguel de Icaza <miguel@ximian.com>
21077 * Many things: all interfaces are parsed and generated in
21078 gen-treedump. Support for member variables, constructors,
21079 destructors, properties, constants is there.
21081 Beginning of the IL backend, but very little done, just there for
21084 2001-04-29 Miguel de Icaza <miguel@ximian.com>
21086 * cs-parser.jay: Fix labeled statement.
21088 * cs-tokenizer.cs (escape): Escape " and ' always.
21089 ref_line, ref_name: keep track of the line/filename as instructed
21090 by #line by the compiler.
21093 2001-04-27 Miguel de Icaza <miguel@ximian.com>
21095 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
21096 to match the values in System.CodeDOM.
21098 Divid renamed to Divide.
21100 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
21102 (Statements.set): remove.
21104 * System.CodeDOM/CodeCatchClause.cs: always have a valid
21107 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
21108 falseStatements always have valid values.
21110 * cs-parser.jay: Use System.CodeDOM now.