1 2005-09-18 Miguel de Icaza <miguel@novell.com>
3 * driver.cs: Set InEmacs based on the environment variable EMACS.
5 * location.cs (InEmacs): in this mode, do not report column
6 location as it confuses Emacs.
8 2005-09-16 Marek Safar <marek.safar@seznam.cz>
10 * cfold.cs, constant.cs, convert.cs, ecore.cs,
11 expression.cs, iterators.cs, literal.cs: Store constants and
14 * class.cs (MemberBase.ShortName): Pass location.
16 * cs-parser.jay: Some location fixes.
18 * ecore.cs (Expression.Location): Made virtual.
20 2005-09-05 Miguel de Icaza <miguel@novell.com>
22 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
23 if the underlying types are the same, otherwise we need to produce
24 code that will do the proper cast.
26 This was exposed by Marek's constant rewrite which produced
27 invalid code for the call site:
36 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
38 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
39 Type/Object should be allowed as well. Fixed bug #75968.
41 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
43 * expression.cs : (Binary.DoResolve): when one is enum constant and
44 another is constant 0, then return enum one *as enum type*.
47 2005-09-02 Raja R Harinath <rharinath@novell.com>
49 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
53 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
54 flow-branching for LocalVariableReferences in case we were invoked
56 * expression.cs (LocalVariableReference.VerifyAssigned): New.
58 (LocalVariableReference.DoResolveBase): ... this.
59 (MemberAccess.Resolve): Do the check that was disabled during
62 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
65 (PartialContainer.Create): check abstract/sealed/static strictly
66 but abstract/sealed can exist only at one side. Fixed bug #75883.
68 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
71 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
72 specified, don't default to UnmanagedType.I4.
74 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
76 * expression.cs : conditional operator should check possibly
77 incorrect assign expression. Fixed bug #75946.
79 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
81 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
82 Reverting the change. gmcs is much complex than mcs on this matter.
84 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
86 * cs-tokenizer.cs : To read another token ahead of the actual
87 consumption, use new SavedToken and cache token instead of moving
88 back the stream with SeekableStreamReader (it seemed problematic).
90 driver.cs : Thus use StreamReader directly.
91 * support.cs : Thus removed SeekableStreamReader.
93 2005-08-30 Raja R Harinath <rharinath@novell.com>
96 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
97 (ScopeInfo.EmitScopeType): Use it to construct field names from
98 names of captured locals.
101 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
102 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
103 Pass 'target_type' to BoxedCast. Don't default to 'object'.
104 (ExplicitConversion): Remove enum cases already handled by
105 implicit conversion. Move implicit conversion check to the beginning.
106 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
107 * expression.cs (ArrayCreation.EmitDynamicInitializers):
108 Don't treat System.Enum as a struct.
110 2005-08-30 Jb Evain <jbevain@gmail.com>
112 * attribute.cs: handles as expression in parameters.
114 2005-08-30 Raja R Harinath <rharinath@novell.com>
117 * class.cs (TypeContainer.VerifyClsName): Don't use a
118 PartialContainer when verifying CLS compliance.
119 (AbstractPropertyEventMethod): Set Parent here, ...
120 (PropertyMethod): ... not here.
122 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
124 * attribute.cs : escaped attribute name should not be allowed to be
125 resolved (e.g. @class as classAttribute). Fixed bug #75930.
127 2005-08-29 Raja R Harinath <rharinath@novell.com>
130 * convert.cs (ImplicitStandardConversionExists): Allow zero also
131 when converting a long constant to unsigned long.
132 * expression.cs (Invocation.OverloadResolve): Add sanity check to
133 detect where IsApplicable and VerifyArgumentsCompat disagree.
135 2005-08-29 Raja R Harinath <rharinath@novell.com>
136 and Carlos Alberto Cortez <carlos@unixmexico.org>
139 * class.cs (TypeContainer.CanElideInitializer): New helper.
140 (TypeContainer.EmitFieldInitializers): Use it to determine if we
141 can safely emitting the initializer of a field.
143 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
145 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
146 allowed inside a switch (without loop). Fixed bug #75433.
148 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
150 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
151 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
153 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
155 * driver.cs : kinda reverting the default encoding changes (not exact
156 revert since I noticed that "codepage:reset" might not work fine).
158 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
160 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
161 Location. Now getter and setter store location correctly.
162 (errors/cs0111-12.cs now reports the expected location.)
164 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
166 * driver.cs : Use default encoding on the environment.
167 Removed (now that) extra parameter for SeekableStreamReader.
168 * support.cs : (SeekableStreamReader) third .ctor() argument for
169 StreamReader is not required (always true). preamble size could
170 be acquired in simpler and safe way.
172 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
174 * cs-parser.jay: report CS0642 at warning level 3
175 and report CS0642 for an if else statement also
176 fixes bug #74745. Patch by John Luke (and a bit
178 Removed extra CS0642 warning check for "while",
180 * statement.cs: In Block.Resolve(), CS0642 check
181 is reimplemented to check a sequence of an empty
182 statement and a block.
186 2005-08-24 Marek Safar <marek.safar@seznam.cz>
188 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
189 detection until I fix it.
191 * cs-tokenizer.cs: Changed error message.
193 * cs-parser.jay: Fixed 2 error locations.
195 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
196 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
199 * enum.cs (GetSignatureForError): Fixed.
201 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
205 * typemanager.cs (RegisterProperty): Removed.
207 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
209 2005-08-24 Raja R Harinath <rharinath@novell.com>
212 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
213 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
215 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
217 * expression.cs : tiny fix is required for not warning positive ulong.
220 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
222 * expression.cs : add CS0652 check for constant and integral
223 expression. Fixed bug #53974.
225 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
227 * expression.cs : in DoNumericPromotions(), check if there is implicit
228 conversion overload for string (to check CS0034). Fixed bug #52492.
230 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
232 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
234 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
236 * ecore.cs : report location when it is *not* Null.
238 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
244 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
245 correctly. Fixed bug #75721.
247 2005-08-23 Raja R Harinath <rharinath@novell.com>
249 * support.cs (SeekableStreamReader.Position): Avoid an expensive
250 loop that performs 'min (pos, char_count)'.
253 * expression.cs (Unary.ResolveOperator): Don't discard implicit
254 converted value in Operator.OnesComplement.
256 2005-08-22 Ben Maurer <bmaurer@ximian.com>
258 * anonymous.cs: If the anon method is pulled into a helper class,
259 it needs to be `internal' not `private'. Fixes runtime behavior on
262 2005-08-20 Martin Baulig <martin@ximian.com>
264 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
265 scope if we don't already have it.
267 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
268 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
271 2005-08-17 Marek Safar <marek.safar@seznam.cz>
274 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
277 2005-08-16 Marek Safar <marek.safar@seznam.cz>
279 The big constants rewrite
280 Fix #75746, #75685 and more
281 As a side effect saved 1MB for MWF ;-)
283 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
284 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
285 enum based for corlib compilation.
287 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
290 * class.cs (FixedField.Define): Use ResolveAsConstant.
292 * const.cs (IConstant): Interface constants and enums.
293 (Const.ResolveValue): New method for constant resolvning.
294 (ExternalConstant): Constants from imported assemblies.
296 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
297 conversion; like enums.
298 (Constant.ToType): Converts this constant to different type.
299 (Constant.Increment): Adds 1.
301 * convert.cs (ImplicitConversionRequired): Simplified.
303 * cs-parser.jay: Create EnumMember directly.
305 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
307 * doc.cs (GenerateEnumDocComment): Removed.
309 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
310 (ConvertIntLiteral): Removed.
311 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
313 * enum.cs (EnumMember): Implement IConstant.
314 (Enum.IsValidEnumConstant): Removed.
315 (Enum.GetNextDefaultValue): Removed.
316 (Enum.FindMembers): Updated.
317 (Enum.GenerateDocComment): Iterate enum members.
319 * expression.cs (Cast.TryReduce): Handle enums correctly.
320 (New.Constantify): Made public.
321 (MemberAccess.DoResolve): Removed contant specific if(s).
323 * literal.cs (NullLiteral): Implement new abstract methods.
325 * statement.cs (GotoCase.Resolve): Use new constant methods.
326 (SwitchLabel.ResolveAndReduce): Use new constant methods.
328 * typemanager.cs (LookupEnum): Removed.
329 (IsEnumType): Fixed to work with corlib.
330 (RegisterConstant): Removed.
331 (LookupConstant): Removed.
332 (GetConstant): Changed to work with IConstant.
334 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
336 * location.cs : Fixed overflown (>255) column number.
338 2005-08-03 Raja R Harinath <rharinath@novell.com>
340 First cut of the qualified-alias-member feature.
341 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
343 * cs-parser.jay (DOUBLE_COLON): New token.
344 (namespace_or_type_name): Add rule for recognizing
345 qualified-alias-members.
346 (primary_expression): Likewise.
347 (element_access): Allow QualifiedAliasMember as a possible
348 type-bearing expression.
349 (local_variable_type, local_variable_pointer_type): Likewise.
350 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
351 aliases in the current and enclosing namespace declarations.
352 (NamespaceEntry.UsingAlias): Add CS0440 warning.
353 * decl.cs (MemberName.is_double_colon): New.
354 (MemberName.MemberName): Add new constructor for alias-member.
355 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
356 * expression.cs (QualifiedAliasMember): New expression type.
358 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
360 * location.cs : it borked when no argument was specified.
362 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
364 * location.cs : tiny ToString() format fix.
366 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
368 * statement.cs : oops, it was missing.
370 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
372 A set of fixes for precise line/column location.
375 "token" field now holds a file/line "delta", a line number offset
376 from the segment, and a column number. See also:
377 http://lists.ximian.com/pipermail/mono-devel-list/2004-
379 Removed static IsNull. Use instance IsNull property instead.
381 For some tokens it stores Location. For Identifier it stores
382 LocatedToken which is a pair of string name and location.
383 Column numbers are adjusted only at getChar().
385 Use Location.ToString() for reporting (it now contains column).
387 Largely modified to use LocatedToken instead of
388 string (IDENTIFIER), and to acquire Location from some tokens.
389 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
390 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
392 Now MemberName holds Location. DeclSpace.ctor() receives Location
393 as a parameter. Removed extra parameters to all derived classes.
394 Replaced Location.IsNull() with instance property.
395 * assign.cs, expression.cs :
396 Added .ctor() overload that omits Location.
398 Added "nameEscaped" flag that indicates the identifier was escaped
399 in the source file. This fixes bug #57047.
401 2005-08-02 Marek Safar <marek.safar@seznam.cz>
403 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
404 New method, looking for lo-case imported cls type.
406 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
409 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
411 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
413 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
415 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
417 Optimized to save 3.5 MB for SWF compilation.
419 2005-08-01 Marek Safar <marek.safar@seznam.cz>
421 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
422 (PartialContainer.Create): Moved logic AddToContainer.
423 (PartialContainer.MarkForDuplicationCheck): Shares name.
425 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
428 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
430 (Namespace.GetSignatureForError): New method.
432 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
433 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
435 2005-08-01 Raja R Harinath <rharinath@novell.com>
438 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
439 member lookup rather than qualifier_type, since qualifier_type can
442 2005-08-01 Marek Safar <marek.safar@seznam.cz>
444 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
447 2005-07-31 Miguel de Icaza <miguel@novell.com>
449 * statement.cs: Copy the local exception into the exception
450 captured local. Fixes 75674
452 2005-07-31 Raja R Harinath <harinath@gmail.com>
455 * expression.cs (Invocation.OverloadResolve): Don't report error
456 CS1501 if error CS1502 has been reported.
457 (New.DoResolve): Delegate CS1501 reporting to
458 Invocation.OverloadResolve.
461 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
462 invariant-meaning-in-block property in an enclosing block if
465 2005-07-29 Marek Safar <marek.safar@seznam.cz>
467 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
468 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
469 (Switch.CheckSwitch): Just save 50kb for SWF.
471 2005-07-27 Martin Baulig <martin@ximian.com>
473 * anonymous.cs (CaptureContext.AddField): Added
474 `AnonymousContainer am' argument; compute its toplevel scope if
475 it's not already computed. Fixes #75649.
477 2005-07-26 Raja R Harinath <rharinath@novell.com>
480 * class.cs (Constructor.Emit): Reset block to null if the block
483 2005-07-25 Marek Safar <marek.safar@seznam.cz>
485 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
487 2005-07-25 Marek Safar <marek.safar@seznam.cz>
489 * class.cs (MethodData.Define): Check whether accessor implementing
492 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
494 2005-07-22 Marek Safar <marek.safar@seznam.cz>
497 * namespace.cs (LookupType): Moved same type check to...
499 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
502 2005-07-21 Raja R Harinath <rharinath@novell.com>
504 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
505 already found a typebuilder.
506 * class.cs (MethodCore.IsDuplicateImplementation): Compare
507 MemberNames, not strings.
509 * const.cs (Error_ExpressionMustBeConst):
510 Rename from Error_EpressionMustBeConst.
511 * const.cs, class.cs, statement.cd: Update.
513 2005-07-21 Marek Safar <marek.safar@seznam.cz>
517 * const.cs (Const.LookupConstantValue): Report missing contant expression
519 (Error_EpressionMustBeConstant): Only one error method.
521 * class.cs, statement.c: Updated.
523 2005-07-20 Raja R Harinath <rharinath@novell.com>
525 * statement.cs (Block.Flags): Add back HasVarargs.
526 (Block.flags): Make protected.
527 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
529 * typemanager.cs (types, typecontainers, user_types): Remove.
530 (UserTypes, TypeContainers): Likewise.
531 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
532 (CleanUp, Reset): Update.
533 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
534 (GetNestedType): Use Type.GetNestedType.
535 (CoreLookupType): Take two arguments, the namespace and the
536 basename of the type. Update to use the Namespace.Lookup
538 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
539 (RealMemberLookup): Use IsNestedChildOf instead of playing with
540 string concatenation and substring matches.
541 * class.cs, enum.cs, delegate.cs: Update to changes.
543 2005-07-20 Marek Safar <marek.safar@seznam.cz>
545 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
546 Expression and made virtual.
548 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
549 (ImplicitStandardConversionExists): Fixed `byte' typo ?
551 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
553 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
556 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
559 2005-07-18 Marek Safar <marek.safar@seznam.cz>
562 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
563 AssemblyCultureAttribute is not used on executable.
566 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
568 2005-07-16 Raja R Harinath <rharinath@novell.com>
571 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
572 New. Reports CS0252/CS0253.
573 Mostly taken from preliminary patch by Duncak Mak.
574 (Binary.DoResolveOperator): Store results of operator lookup.
575 Use them to detect if we need to warn about unintended reference
578 2005-07-15 Raja R Harinath <rharinath@novell.com>
581 * namespace.cs (Namespace.Lookup): Add back location parameter.
582 (Namespace.LookupType): Add CS0436 report. Add location parameter.
583 * delegate.cs, ecore.cs, expression.cs: Update to changes.
585 * codegen.cs (EmitContext.DeclSpace): Make readonly.
586 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
587 (Namespace.LookupType): ... this.
588 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
590 * typemanager.cs (LookupTypeReflection): Remove buggy code that
591 purported to handle pointers.
592 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
595 2005-07-15 Marek Safar <marek.safar@seznam.cz>
597 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
600 2005-07-15 Raja R Harinath <rharinath@novell.com>
602 * namespace.cs (Namespace.Lookup): Drop location parameter.
603 (NamespaceEntry.LookupAlias): Remove. Merge into ...
604 (NamespaceEntry.Lookup): ... this.
605 (NamespaceEntry.Error_AmbiguousTypeReference):
606 Move here from DeclSpace.
607 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
609 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
610 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
611 Move to NamespaceEntry.
612 * delegate.cs, expression.cs: Update to changes.
614 2005-07-14 Marek Safar <marek.safar@seznam.cz>
616 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
617 CheckAttributeType and refactored.
618 (Attribute.ResolvePossibleAttributeType): Changed to reuse
619 ResolveAsTypeTerminal error handling.
620 (ResolveAsTypeTerminal): Introduced because of global attributes extra
622 (GetSignatureForError): Print errors in same way.
625 * codegen.cs: Reflect attribute GetSignatureForError change.
628 * expression.cs: Add silent parameter to ResolveAsTypeStep.
630 * namespace.cs (UsingEntry): Refactored to make fields private.
633 statement.cs: Error_UnexpectedKind has extra parameter.
635 2005-07-14 Raja R Harinath <rharinath@novell.com>
637 * ecore.cs (IAlias): Remove.
638 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
639 that implement the interface.
640 * namespace.cs (Namespace): Likewise.
641 (Namespace.declspaces): Renamed from 'defined_names'.
642 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
643 DeclSpace instead of an IAlias.
644 * tree.cs (Tree.AddDecl): Update.
646 2005-07-12 Raja R Harinath <rharinath@novell.com>
648 * statement.cs (Block.Flags); Remove HasVarargs.
649 (Block.HasVarargs): Move to ToplevelBlock.
650 (Block.ThisVariable, Block.AddThisVariable): Likewise.
651 (Block.Variables): Make protected. Initialize variable hashtable
653 (Block.AddVariable): Update.
654 (Block.Resolve): Update to changes.
655 (ToplevelBlock.HasVarargs): New boolean.
656 (ToplevelBlock.ThisVariable): Move here from Block.
657 (ToplevelBlock.AddThisVariable): Likewise.
658 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
659 * expression.cs (This.ResolveBase): Update to changes.
660 (ArglistAccess.DoResolve): Likewise.
662 2005-07-11 Marek Safar <marek.safar@seznam.cz>
665 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
667 * class.cs (TypeContainer.VerifyMembers): Distinguish between
668 not used and not used & assigned.
669 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
671 2005-07-11 Marek Safar <marek.safar@seznam.cz>
674 * expression.cs (Is.DoResolve): null is never provided type.
676 2005-07-08 Marek Safar <marek.safar@seznam.cz>
679 * cs-parser.jay: Less strict event error rule to catch more errors.
681 2005-07-08 Martin Baulig <martin@ximian.com>
683 Fix test-iter-10.cs - distinguish whether we `yield' in a property
684 gettter (allowed) or setter (not allowed).
686 * class.cs (Accessor): Implement IIteratorContainer.
687 (Accessor.Yields): New public field.
688 (PropertyBase.PropertyMethod.Define): Handle iterators on a
692 (get_accessor_declaration, set_accessor_declaration): Set the
693 `yields' flag on the accessor, not the property.
694 (property_declaration): Do the iterators check on a per-accessor
695 basis and not for the whole property.
697 2005-07-08 Martin Baulig <martin@ximian.com>
699 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
700 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
702 2005-07-07 Marek Safar <marek.safar@seznam.cz>
705 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
706 (ExtractSecurityPermissionSet): Cope with self referencing security
709 * driver.cs (SetOutputFile): Made public property OutputFile.
711 2005-07-07 Raja R Harinath <rharinath@novell.com>
714 * class.cs (TypeContainer.first_nonstatic_field): Rename from
715 has_nonstatic_fields. Make into a FieldBase pointer.
716 (TypeContainer.AddField): Add CS0282 check.
717 (TypeContainer.EmitType): Update.
719 2005-07-06 Miguel de Icaza <miguel@novell.com>
721 * cs-tokenizer.cs (consume_identifier): Do not create strings to
722 compare if they start with __.
724 2005-07-06 Raja R Harinath <rharinath@novell.com>
726 * statement.cs (Switch.SwitchGoverningType): Only look at
727 UserCasts that don't need implicit standard conversions to one of
728 the allowed switch types (Fixes test-322.cs).
729 (LocalInfo.Resolve): Re-enable sanity-test.
731 2005-07-06 Marek Safar <marek.safar@seznam.cz>
733 * cs-tokenizer.cs (consume_identifier): Detect double undescores
735 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
737 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
739 2005-07-06 Raja R Harinath <rharinath@novell.com>
742 * ecore.cs (SimpleName.GetSignatureForError): Add.
743 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
744 (MemberAccess.GetSignatureForError): Add.
746 2005-07-05 Marek Safar <marek.safar@seznam.cz>
748 The big error and warning messages review.
778 * typemanager.cs: Updated.
780 * class.cs: (MethodCore.SetYields): Moved here to share.
781 (PropertyMethod.Define): Moved iterator setup here.
783 * iterators.cs: Add orig_method to have full access to parent
786 2005-07-05 Raja R Harinath <rharinath@novell.com>
788 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
789 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
790 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
791 variable of struct type.
792 * expression.cs (Unary.ResolveOperator): Update to change.
793 (Indirection.VerifyFixed): Likewise.
794 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
795 (ParameterReference.VerifyFixed): Value parameters are fixed.
796 (This.VerifyFixed): Treat 'this' as a value parameter.
797 * statement.cs (LocalInfo.IsFixed): Remove.
799 2005-07-01 Martin Baulig <martin@ximian.com>
801 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
802 `ec.EmitThis ()' to get the correct scope.
804 2005-07-01 Martin Baulig <martin@ximian.com>
806 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
807 instance is a ParameterReference; fixes #75299.
809 2005-07-01 Martin Baulig <martin@ximian.com>
811 Reverted Marek's latest patch (r46725):
812 - it contains structural changes which are neither mentioned in
813 the ChangeLog nor explained anywhere; for example the additional
814 argument of EmitContext's and Iterator's .ctor's and the
815 TypeContainer.DefineMembers() change.
816 - structural changes like this should go in in seperate patches
817 and not be hidden in a huge patch which just seems to affect
819 a big and hard to understand patch.
820 - it breaks iterators and causes regressions, for instance in
823 2005-06-30 Raja R Harinath <rharinath@novell.com>
826 * expression.cs (Indexers.map): Remove.
827 (Indexers.Append): Filter out inaccessible setters and getters.
828 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
831 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
833 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
834 (FieldExpr.Emit, PropertyExpr.Emit): Update.
835 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
836 * expression.cs (Invocation.EmitCall): Add CS0120 check.
838 2005-06-30 Marek Safar <marek.safar@seznam.cz>
841 * class.cs (FieldBase.GetInitializerExpression): One more field
844 2005-06-28 Miguel de Icaza <miguel@novell.com>
846 * pending.cs: Do not define a proxy if the base method is virtual,
847 it will be picked up by the runtime (bug 75270).
849 2005-06-08 Martin Baulig <martin@ximian.com>
851 The big Iterators rewrite :-)
853 * iterators.cs: Rewrite this to use the anonymous methods framework.
855 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
856 before the TypeContainers; see 2test-21.cs.
859 (TypeContainer.DefineType): Don't create a new EmitContext if we
860 already have one (this only happens if we're an Iterator).
861 (TypeContainer.Define): Also call Define() on all our iterators.
862 (Method.CreateEmitContext): Added support for iterators.
865 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
866 (AnonymousContainer.CreateMethodHost): Moved here from
867 AnonymousMethod and made abstract.
868 (AnonymousContainer.CreateScopeType): New abstract method.
869 (AnonymousContainer.IsIterator): New public property.
870 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
871 get the ScopeTypeBuilder rather than manually defining it here.
872 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
875 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
876 before RootContext.DefineTypes().
878 * codegen.cs (EmitContext.RemapToProxy): Removed.
879 (EmitContext.CurrentAnonymousMethod): Changed type from
880 AnonymousMethod -> AnonymousContainer.
881 (EmitContext.ResolveTopBlock): Protect from being called twice.
882 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
883 (EmitContext.EmitThis): Removed the iterators hacks; use the
884 anonymous methods framework for that.
887 (ToplevelBlock.Container): Make this a property, not a field.
888 (ToplevelBlock.ReParent): New public method; move the
889 ToplevelBlock into a new container.
890 (Foreach.TemporaryVariable): Simplify.
892 2005-06-05 Martin Baulig <martin@ximian.com>
894 * statement.cs (LocalInfo.CompilerGenerated): New flag.
895 (Block.AddTemporaryVariable): New public method; creates a new
896 `LocalInfo' for a temporary variable.
897 (Block.EmitMeta): Create the LocalBuilders for all the temporary
899 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
900 non-iterator variables.
902 2005-06-05 Martin Baulig <martin@ximian.com>
904 * statement.cs (Foreach.TemporaryVariable): Create the
905 LocalBuilder in the Emit phase and not in Resolve since in some
906 situations, we don't have an ILGenerator during Resolve; see
907 2test-19.cs for an example.
909 2005-06-04 Martin Baulig <martin@ximian.com>
911 **** Merged r45395 from GCS ****
913 The big Foreach rewrite - Part II.
915 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
916 with `PropertyInfo ienumerator_getcurrent'.
918 * codegen.cs (VariableStorage): Removed.
921 (Foreach): Derive from Statement, not ExceptionStatement.
922 (Foreach.CollectionForeach): New nested class. Moved all the code
923 dealing with collection foreach here.
924 (Foreach.ForeachHelperMethods): Removed.
925 (Foreach.TemporaryVariable): Implement IMemoryLocation.
927 2005-05-23 Martin Baulig <martin@ximian.com>
929 * statement.cs (Try.DoResolve): Don't create a `finally' if we
930 don't need to. Fix #75014.
932 2005-05-20 Martin Baulig <martin@ximian.com>
934 Merged r44808 from GMCS.
936 * class.cs (TypeContainer.CircularDepException): Removed.
937 (TypeContainer.DefineType): Removed the `InTransit' stuff.
938 (TypeContainer.CheckRecursiveDefinition): Check for circular class
939 (CS0146) and interface (CS0529) dependencies here.
941 2005-06-21 Raja R Harinath <rharinath@novell.com>
943 * expression.cs (Invocation.EmitCall): Fix initialization
944 'this_call' to reflect current behaviour. Fix indentation.
946 * convert.cs (FindMostEncompassedType): Add two trivial special
947 cases (number_of_types == 0 || number_of_types == 1).
948 (FindMostEncompasingType): Likewise.
950 2005-06-17 Raja R Harinath <rharinath@novell.com>
952 Some cleanups preparing for the fix of #75283.
953 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
955 (EventExpr.InstanceResolve): Likewise.
956 (EventExpr.DoResolve): Remove redundant checks.
958 2005-06-10 Duncan Mak <duncan@novell.com>
960 * cs-tokenizer.cs (process_directives): New flag for controlling
961 the processing of preprocessor directives.
962 (x_token): After seeing a '#', return Token.NONE instead of going
963 to handle_preprocessing_directive() when not processing
964 directives. This avoids unnecessary processing during the token peek in
969 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
970 the existing error reporting methods instead of Report.Error.
972 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
973 after Raja's rewrite.
975 2005-06-08 Miguel de Icaza <miguel@novell.com>
977 * class.cs: Small fix.
979 2005-06-08 Raja R Harinath <rharinath@novell.com>
982 * class.cs (GetPartialBases): Fix return value check of
985 2005-06-07 Raja R Harinath <rharinath@novell.com>
987 Ensure that partial classes are registered in their enclosing
988 namespace. Initial part of fix of #75160.
989 * tree.cs (Tree.RecordDecl): Add new namespace argument.
990 Register declspace with namespace here, not in
991 DeclSpace.RecordDecl.
992 * cs-parser.jay: Pass namespace to RecordDecl.
993 * class.cs (PartialContainer.Create): Likewise.
994 (ClassPart.DefineType): New sanity-check. Throws an exception if
996 * decl.cs (Declspace.RecordDecl): Remove.
997 * namespace.cs (NamespaceEntry.DefineName): Remove.
999 2005-06-06 Marek Safar <marek.safar@seznam.cz>
1001 * rootcontext.cs: Reset TargetExt as well.
1003 2005-06-03 Raja R Harinath <rharinath@novell.com>
1005 * ecore.cs (Expression.Resolve): Emit CS0654 error when
1008 2005-06-02 Raja R Harinath <rharinath@novell.com>
1010 Fix #75080, cs0119.cs.
1011 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
1013 (Expression.Resolve): ... this. Use it. Remove bogus code
1014 allowing ExprClass.Type and ExprClass.Namespace for
1015 ResolveFlags.VariableOrValue.
1016 (Expression.Resolve) [1-argument variant]: Change default resolve
1017 flags based on language version.
1018 (Expression.Error_UnexpectedKind): Use a simple string array
1019 rather than an ArrayList.
1020 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
1022 (TypeOfVoid.DoResolve): Likewise.
1023 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
1024 flags argument -- it always has the same value.
1026 2005-05-31 Raja R Harinath <rharinath@novell.com>
1029 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
1030 Use it in the error message.
1031 * assign.cs, expression.cs, statement.cs: Update.
1033 2005-05-30 Raja R Harinath <rharinath@novell.com>
1036 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
1037 the "almostMatchedMember" case too.
1038 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
1039 that failed the accessibility checks to 'almost_match'.
1041 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
1043 * attribute.cs: Use internal MethodBuilder methods to set
1044 ExactSpelling and SetLastError on PInvoke methods, instead
1045 of passing them via charset. Fixes #75060.
1047 2005-05-27 Raja R Harinath <rharinath@novell.com>
1049 * parameter.cs (Parameter): Remove TODO comment.
1050 (Parameter.DefineParameter): Remove Location parameter.
1051 (Parameters.LabelParameters): Likewise.
1052 * class.cs (Constructor.Emit): Update to change.
1053 (MethodData.Emit): Likewise.
1054 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
1055 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
1057 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
1060 Removed Parameters.Location and added Parameter.Location instead.
1061 Removed Location parameter from Emit() and GetSignature().
1068 Modified all related calls.
1070 2005-05-26 Raja R Harinath <rharinath@novell.com>
1072 Improve user-defined conversion handling.
1073 * convert.cs (GetConversionOperators): Rewrite. Return only the
1074 applicable operators.
1075 (AddConversionOperators): New. Helper for GetConversionOperators.
1076 (FindMostEncompassedType, FindMostEncompassingType): Verify that
1077 there is only one most encompassed/encompassing type.
1078 (FindMostSpecificSource, FindMostSpecificTarget): Remove
1079 "applicable operator" handling.
1080 (UserConversion): Move cache here from GetConversionOperators.
1081 Directly cache the chosen operator, rather than the whole
1083 (ExplicitNumericConversion): Fix buggy implementation of Decimal
1084 case. Allow conversion of decimal to sbyte and byte too.
1085 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
1086 New static methods. Used to avoid allocating EmptyExpressions in
1089 2005-05-24 Duncan Mak <duncan@novell.com>
1091 * ecore.cs (CastFromDecimal): New class for casting a decimal to
1092 another class, used in Convert.ExplicitNumericConversion.
1093 (CastToDecimal): New class, similar to above, but casts to
1094 System.Decimal, used in Convert.ImplicitNumericConversion and also
1095 in explicit convesion from double/float to decimal.
1097 * convert.cs (ImplicitNumericConversion): Handle implicit
1098 conversions to System.Decimal.
1099 (ExplicitNumericConversion): handle explicit conversions to
1104 2005-05-20 Miguel de Icaza <miguel@novell.com>
1106 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
1107 know the type at this stage, just break through. Fixes #75008
1109 2005-05-19 Martin Baulig <martin@ximian.com>
1112 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
1113 to disable error reporting.
1115 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
1116 here since we don't want to report an error; see the new test-336.cs.
1118 2005-05-19 Raja R Harinath <rharinath@novell.com>
1120 * statement.cs (ToplevelBlock.GetParameterReference)
1121 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
1122 Move here from class Block.
1123 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
1124 * expression.cs (ParameterReference.DoResolveBase): Likewise.
1126 2005-05-18 Martin Baulig <martin@ximian.com>
1131 (FlowBranching.Reachability): Add non-static public And() and Or()
1133 (FlowBranchingSwitch): New class; do the `break_origins' thing
1134 like in FlowBranchingLoop.
1135 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
1136 reachability, not just locals and parameters.
1137 (FlowBranching.MergeChild): Remove some of the hacks for loop and
1138 switch; MergeBreakOrigins() now takes care of that.
1140 2005-05-18 Martin Baulig <martin@ximian.com>
1142 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1143 a loop and may leave it, reset the barrier; fixes #74974.
1145 2005-05-17 Marek Safar <marek.safar@seznam.cz>
1147 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
1150 * cs-parser.jay: Catch more lexical errors.
1152 * report.cs: Add one more Error method.
1155 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
1157 2005-05-17 Martin Baulig <martin@ximian.com>
1159 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
1162 2005-05-16 Raja R Harinath <rharinath@novell.com>
1164 Fix test-382.cs. Emit values of decimal constants.
1165 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
1167 (TypeContainer.AddField): ... this.
1168 (TypeContainer.EmitFieldInitializers): Allow the list of fields
1169 with initializers to include 'Const's.
1170 (ClassPart.RegisterFieldForInitialization): Forward to
1172 * const.cs (Const.Const): Pass initializer to base class.
1173 (Const.Define): In case of decimal constants, register them for
1174 initialization in a static constructor.
1176 2005-05-14 Martin Baulig <martin@ximian.com>
1178 * statement.cs (Block.Resolve): Correctly handle unreachable code;
1179 do not call ResolveUnreachable() on unreachable statements in
1180 here, see the comment in the source code.
1182 2005-05-13 Raja R Harinath <rharinath@novell.com>
1185 * expression.cs (BinaryResolveOperator): If one of the operands of
1186 an equality comparison is 'null' and the other is a pointer type,
1187 convert the null to a NullPointer.
1188 * convert.cs (ImplicitReferenceConversion): If the expression is a
1189 NullLiteral and the target type is a pointer type, return a
1190 NullPointer instead.
1191 (ImplicitConversionStandard): Likewise.
1193 2005-05-13 Marek Safar <marek.safar@seznam.cz>
1195 * cs-parser.jay: Set readonly context based on special constructs.
1197 * expression.cs (LocalVariableReference.DoResolveBase): Improved
1198 readonly variable error handling.
1200 * rootcontext.cs (EmitCode): Don't verify members when error
1203 * statement.cs (LocalInfo): Add reaodnly context information.
1204 (SetReadOnlyContext, GetReadOnlyContext): New methods.
1206 2005-05-13 Raja R Harinath <rharinath@novell.com>
1208 * statement.cs (Block.Resolve): Revert change below. Modify fix
1209 for #74041 to initialize 'resolved' to false only for explicit
1210 blocks. Fixes #74873.
1212 2005-05-12 Raja R Harinath <harinath@gmail.com>
1215 * typemanager.cs (unmanaged_enclosing_types): New.
1216 (IsUnmanagedType): Avoid infloops by using
1217 'unmanaged_enclosing_types' to talk with recursive invocations.
1219 2005-05-13 Martin Baulig <martin@ximian.com>
1221 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
1222 instance variable, not a local. Fix #74873.
1223 (Block.ResolveUnreachable): Set it to true here.
1225 2005-05-11 Duncan Mak <duncan@novell.com>
1227 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
1228 continuing to process for 'arg'.
1229 (handle_preprocessing_directive): Check the argument of the #endif
1230 directive and report error CS1025 if there are any trailing
1233 According to the C# spec, having even whitespace after the #endif
1234 directive is illegal; however, because we call arg.TrimEnd ()
1235 beforehand, we have the same behavior as csc, allowing whitespace
1236 after the directive.
1240 2005-05-11 Marek Safar <marek.safar@seznam.cz>
1244 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
1245 (Constructor.GetObsoleteAttribute): Implemented correctly.
1247 2005-05-10 Martin Baulig <martin@ximian.com>
1249 * support.cs (ReflectionParameters.ParameterModifier): Use
1250 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
1251 and `ParameterAttributes.In'. Fixes #74884.
1253 2005-05-10 Marek Safar <marek.safar@seznam.cz>
1255 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
1257 * expression.cs (Argument.GetParameterModifier): Turned to property.
1258 (Invocation.Error_InvalidArguments): Add more descriptive errors.
1260 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
1263 2005-05-09 Raja R Harinath <rharinath@novell.com>
1266 * decl.cs (MemberCache.AddMethods): Register override methods,
1267 rather than non-override methods.
1268 * typemanager.cs (RegisterOverride): New.
1269 (IsOverride): Update.
1271 2005-05-09 Marek Safar <marek.safar@seznam.cz>
1275 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
1276 recursive declaration.
1278 * statement.cs (Block.ResolveMeta): Report any error in resolving.
1280 2005-05-06 Marek Safar <marek.safar@seznam.cz>
1282 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
1284 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
1286 2005-05-05 Raja R Harinath <rharinath@novell.com>
1289 * decl.cs (DeclSpace.FamilyAccessible):
1290 Use TypeManager.IsNestedFamilyAccessible.
1292 Fix reopened #64812.
1293 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
1296 2005-05-04 Raja R Harinath <rharinath@novell.com>
1297 Abin Thomas <projectmonokochi@rediffmail.com>
1298 Anoob V E <projectmonokochi@rediffmail.com>
1299 Harilal P R <projectmonokochi@rediffmail.com>
1302 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
1303 allow access to all static members.
1305 2005-05-04 Martin Baulig <martin@ximian.com>
1307 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
1309 2005-05-04 Martin Baulig <martin@ximian.com>
1313 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
1314 section at the end; make things work if `default' is not the last
1317 2005-05-04 Martin Baulig <martin@ximian.com>
1321 * statement.cs (Switch): Replaced the `got_default' field with a
1322 `default_section' one.
1323 (Switch.CheckSwitch): Set `default_section' here.
1324 (Switch.Resolve): If we're a constant switch and the constant is
1325 not found, use the default section.
1327 2005-05-03 Martin Baulig <martin@ximian.com>
1329 * expression.cs (ArrayAccess.EmitGetLength): New public method.
1331 * statement.cs (Foreach.ArrayForeach): New nested class.
1332 (Foreach.TemporaryVariable): New nested class.
1333 (Foreach.EmitArrayForeach): Removed; this is now in the new
1336 2005-05-03 Raja R Harinath <rharinath@novell.com>
1338 * pending.cs (BaseImplements): Move the #74773 fix here. This is
1340 (VerifyPendingMethods): Revert change below.
1342 * typemanager.cs (IsOverride, RegisterNonOverride): New.
1343 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
1344 that used to trigger warning -28. Remove warning -28.
1345 * expression.cs (Invocation.OverloadResolve): Use
1346 TypeManager.IsOverride to distinguish override methods.
1349 * pending.cs (VerifyPendingMethods): If a base type implements the
1350 requested interface, don't bother checking individual methods of
1351 the base type. As a side-effect, this prevents the creation of
1352 unnecessary proxies.
1354 2005-05-02 Martin Baulig <martin@ximian.com>
1358 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
1359 Also `And' the locals if the old vector is null.
1360 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
1361 null; in this case we basically reset all the variables.
1363 2005-05-02 Martin Baulig <martin@ximian.com>
1367 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
1368 Added `FlowBranching branching' argument; always `and' the
1369 variables instead of `or'ing them unless we're an infinite loop.
1371 * statement.cs (While.Resolve): Create a new sibling unless we're
1374 2005-05-02 Martin Baulig <martin@ximian.com>
1378 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
1379 arguments; use it instead of creating a new TopLevelBlock.
1380 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
1381 our ConstructorInitializer.
1384 (TopLevelBlock.TopLevelBranching): New public property.
1385 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
1386 and create our `TopLevelBranching'.
1388 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
1389 anonymous method host, use `block.TopLevelBranching' rather than
1390 creating a new branching.
1392 2005-04-20 Miguel de Icaza <miguel@novell.com>
1394 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
1395 a ScopeInfo, if any of the current children is a child of the new
1396 entry, move those children there.
1398 2005-04-30 Martin Baulig <martin@ximian.com>
1400 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
1401 at the beginning of a SwitchSection. Fix #73335.
1403 2005-04-27 Marek Safar <marek.safar@seznam.cz>
1406 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
1408 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
1409 (FieldExpr.DoResolve): Obsolete members are ignored for field
1412 2005-04-26 Marek Safar <marek.safar@seznam.cz>
1414 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
1415 of arrays detection.
1417 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
1419 (Field.VerifyClsCompliance): Volatile fields are not compliant.
1421 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
1424 2005-04-25 Ben Maurer <bmaurer@ximian.com>
1426 * cs-parser.jay: Use the prefered version of -unsafe in error
1429 2005-04-22 Marek Safar <marek.safar@seznam.cz>
1431 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
1434 2005-04-20 John Luke <john.luke@gmail.com>
1436 * driver.cs: fix typo in error message, --outout to --output
1438 2005-04-20 Marek Safar <marek.safar@seznam.cz>
1440 * codegen.cs (InRefOutArgumentResolving): New field.
1442 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
1443 fields outside contructor.
1445 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
1447 2005-04-19 Miguel de Icaza <miguel@novell.com>
1449 * anonymous.cs (CaptureContext.EmitParameterInstance): The
1450 parameter code was not completed ever, so it was not as up-to-date
1451 as local variables. Must finish it.
1453 The bug fix was to compare the Toplevel of the block, not the
1454 current block. Thanks for Ben for pointing this out.
1456 2005-04-19 Raja R Harinath <rharinath@novell.com>
1458 * decl.cs (AddMethods): Use the declaring type of the problem
1459 method to determine if we want to squash a warning.
1461 2005-04-19 Marek Safar <marek.safar@seznam.cz>
1463 * attribute.cs: Removed debug output.
1465 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
1467 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
1470 2005-04-18 Raja R Harinath <rharinath@novell.com>
1473 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
1474 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
1475 all null comparisons against reference types.
1477 2005-04-18 Marek Safar <marek.safar@seznam.cz>
1480 * class.cs (TypeContainer.CircularDepException) New nested
1482 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
1483 (TypeContainer.DefineType): Removed error, reset InTransit before
1485 (Class.DefineType): Throw exception when is in Transit.
1486 Catch exception and report error.
1487 (Struct.DefineType): Throw exception when is in Transit.
1488 Catch exception and report error.
1489 (Interface.DefineType): Throw exception when is in Transit.
1490 Catch exception and report error.
1492 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
1493 handle nested exception handlers.
1495 * flowanalysis.cs (InTryWithCatch): New method, search for try with
1498 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
1499 InFinally and InCatch storage.
1501 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
1502 (Catch.Resolve): Set and Restore ec.InCatch.
1503 (Try.Resolve): Set and Restore ec.InFinally.
1504 (Try.HasCatch): True when try has catch.
1506 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
1508 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
1509 for the same event member, so exclude such cases from warning 419.
1512 2005-04-16 Miguel de Icaza <miguel@novell.com>
1514 * expression.cs (Binary.ResolveOperator): Apply patch from John
1515 Luke to fix bug 59864: operators &, | and ^ on enumerations
1516 require that the same enum type on both sides.
1518 * driver.cs: Add warnings to old flag usage, this is to assist
1519 people who produce Makefiles and hope that the Makefiles will be
1522 * class.cs (TypeContainer.EmitType): Moved the definition of the
1523 special $PRIVATE$ field from the resolve phase to the Emit phase.
1524 During resolve we do not know if we are a struct with
1525 HasExplicitLayout, we know this only after the attributes for the
1528 Set the FieldOffset to zero on the dummy field that we create for
1529 the class. Fixes 74590.
1531 2005-04-16 Raja R Harinath <rharinath@novell.com>
1534 * ecore.cs (PropertyExpr.resolved): New.
1535 (DoResolve): Use it to handle a case of double resolution here.
1536 Handle a case of identical-name-and-type-name.
1537 * expression.cs (ArrayCreation.CheckIndices): Avoid double
1538 resolution by storing the results of expression resolution back
1539 into the "probes" array.
1541 2005-04-15 Raja R Harinath <rharinath@novell.com>
1543 Fix cs0208-7.cs and cs0208-8.cs.
1544 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
1545 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
1546 error reporting to point out the reason a struct is not unmanaged.
1548 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1550 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
1551 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
1553 2005-04-13 Raja R Harinath <rharinath@novell.com>
1556 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
1557 IdenticalNameAndTypeName here.
1558 (EventExpr.InstanceResolve): Likewise.
1560 2005-04-13 Marek Safar <marek.safar@seznam.cz>
1562 C# 2.0 DefaultCharSetAttribute implementation
1564 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
1565 which allows us to set GlobalNamespace for every resolve.
1566 (Attribute.ResolveArguments): Cut from Resolve.
1567 (Attribute.GetCharSetValue): Returns CharSet named argument.
1568 (Attribute.DefinePInvokeMethod): Gets default charset from
1570 (GlobalAttribute.ResolveAsTypeStep): Override.
1571 (GlobalAttribute.ResolveArguments): Override.
1573 * class.cs (TypeAttr): Is protected.
1575 * codegen.cs (ModuleClass.DefaultCharSet): New member.
1576 (ModuleClass.DefaultCharSetType): New memeber.
1577 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
1579 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
1580 charset from module.
1582 * delegate.cs (TypeAttr): Override.
1583 (Delegate.DefineType): Use this TypeAttr.
1585 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
1586 at very early stage (before types are defined) to resolve model
1587 module attributes. It will probably not work with corlib but it
1590 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
1591 charset from module.
1593 * typemanager.cs (default_charset_type): New type.
1595 2005-04-13 Raja R Harinath <rharinath@novell.com>
1597 * decl.cs (MemberCache.AddMethods): Don't warn if
1598 System.Object.Finalize has buggy MethodAttributes.
1600 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
1603 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1605 * doc.cs : detect ambiguous reference to overloaded members.
1606 Fixed bug #71603. MS 1.1 csc does not detect it.
1608 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1610 * doc.cs : delegates must not be referenced with parameters.
1613 2005-04-12 Miguel de Icaza <miguel@novell.com>
1615 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
1617 2005-04-10 Miguel de Icaza <miguel@novell.com>
1619 * driver.cs (MainDriver): Stop processing if the CLS stage found
1622 (CompilerCallableEntryPoint.InvokeCompiler): Always
1623 reset after execution; Take a TextWriter argument for the
1626 * report.cs: Use the error stream instead of hardcoding stderr.
1628 2005-04-09 Miguel de Icaza <miguel@novell.com>
1630 * class.cs: Reduce code paths to test, too small of an
1631 optimization to make it worth the extra testing. Always perform
1634 2005-04-08 Raja R Harinath <rharinath@novell.com>
1637 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
1638 operators that had errors reported on them.
1640 2005-04-08 Marek Safar <marek.safar@seznam.cz>
1642 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
1644 (Attribute.Resolve): Add named argument type checking.
1646 * class.cs (FixedField.Define): Use IsPrimitiveType
1648 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
1650 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
1651 unsafe parameter types.
1653 * statement.cs (Using.ResolveExpression): Add better error description.
1655 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
1657 2005-04-08 Raja R Harinath <rharinath@novell.com>
1660 * attribute.cs (Attribute.GetAttributeUsage): Resolve
1661 AttributeUsageAttribute in the emitcontext of the attribute class,
1662 not in the emitcontext of the attributable entity it was attached to.
1663 * cs-parser.jay: Use 'current_class', not 'current_container',
1664 when creating a GlobalAttribute.
1666 2005-04-08 Alp Toker <alp@atoker.com>
1668 * pending.cs: The fix to #58413 failed to compile methods implementing
1669 interfaces with/without params modifiers and vice versa, even though
1670 params modifiers aren't part of the signature. Make the modifier check
1671 less strict as in csc.
1673 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
1674 Anoob V E <projectmonokochi@rediffmail.com>
1675 Harilal P R <projectmonokochi@rediffmail.com>
1678 * pending.cs (TypeAndMethods.mods): New. Store the parameter
1679 modifiers of pending methods.
1680 (PendingImplementation.PendingImplementation): Initialize it.
1681 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
1682 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
1683 with ParameterData. Add check for modifiers.
1684 * class.cs (MethodData.Define): Update to changes.
1686 2005-04-07 Raja R Harinath <rharinath@novell.com>
1688 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
1690 2005-04-07 Marek Safar <marek.safar@seznam.cz>
1692 * class.cs (PropertyMethod.Define): Check private accessor in abstract
1695 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
1698 * typemanager.cs: Registered RequiredAttributeAttribute.
1700 2005-04-06 Marek Safar <marek.safar@seznam.cz>
1702 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
1703 Warning CS0169 is back at level 3.
1704 (IMethodData.SetMemberIsUsed): New method.
1706 * decl.cs (IsUsed): New value; moved from FieldBase.Status
1707 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
1709 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
1711 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
1713 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
1716 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
1719 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
1720 to avoid the problems with nested types.
1722 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
1723 Anoob V.E <projectmonokochi@rediffmail.com>
1724 Harilal P.R <projectmonokochi@rediffmail.com>
1725 Raja R Harinath <rharinath@novell.com>
1728 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
1730 * typemanager (GetConstructor): Make public.
1732 2005-04-05 John Luke <john.luke@gmail.com>
1733 Raja R Harinath <rharinath@novell.com>
1736 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
1737 struct too. Return false quicker in a few cases.
1738 (VerifyUnManaged): Use it.
1740 2005-04-05 Raja R Harinath <rharinath@novell.com>
1743 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
1744 not 'unreachable_seen'.
1746 2005-04-04 Marek Safar <marek.safar@seznam.cz>
1748 * attribute.cs (Attribute.GetValue): Removed unused.
1750 * codegen.cs (CodeGen.TrimExt): Removed unused.
1752 * cs-parser.jay (output): Removed unused.
1754 * cs-tokenizer.cs (hex_digits): Removed unused.
1756 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
1758 * expression.cs (Indirection.LoadExprValue): Removed unused.
1759 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
1761 * iterators.cs (Iterator.param_types): Removed unused.
1763 * statement.cs (Goto.block): Removed unused.
1764 (ToplevelBlock.did): Removed unused.
1765 (Switch.ResolveConstantSwitch): Removed unused.
1767 2005-04-01 Ben Maurer <bmaurer@ximian.com>
1769 * rootcontext.cs: Allow mcs to bootstrap with the compilation
1772 2005-04-01 Raja R Harinath <rharinath@novell.com>
1774 Fix #74232 and cs0208-3.cs.
1775 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
1776 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
1777 unmanaged type. Don't use FieldBuilders when 't' is a
1778 TypeBuilder. Use ModFlags and MemberType fields.
1779 * class.cs (MemberBase.member_type): Rename from MemberType.
1780 (MemberBase.MemberType): New property. Determines member_type on
1782 (MemberBase.DoDefine): Don't initialize MemberType here.
1783 (FieldMember.Define): Likewise.
1785 2005-04-01 Marek Safar <marek.safar@seznam.cz>
1788 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
1789 Attributes are emitted there.
1791 2005-04-01 Raja R Harinath <rharinath@novell.com>
1793 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
1794 keyword in 'partial enum' too.
1795 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
1797 Report from Kamil Skalski <nazgul@omega.pl>.
1800 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
1801 have partial containers too.
1803 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
1804 in block' checks to Block.CheckInvariantMeaningInBlock.
1805 * statement.cs (Block.GetKnownVariableInfo): Make private.
1806 (Block.IsVariableUsedInChildBlock): Remove.
1807 (Block.IsVariableUsedInBlock): Likewise.
1808 (Block.CheckInvariantMeaningInBlock): New. Show location of
1809 conflicting declaration.
1810 (Block.AddVariable): Make error messages less long-winded and more
1811 specific. Show location of conflicting declaration.
1812 * parameter.cs (Parameters.Location): New readonly property.
1814 2005-03-31 Raja R Harinath <rharinath@novell.com>
1816 Clean up semantics of invoking ResolveMemberAccess.
1817 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
1818 can have an instance, ensure that we pass in a non-TypeExpression
1819 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
1820 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
1821 argument. Update to changes and simplify.
1822 (FieldExpr.Emitinstance): Remove CS0120 check.
1823 (PropertyExpr.EmitInstance): Likewise.
1824 * expression.cs (Argument.Resolve): Likewise.
1825 (Invocation.DoResolve): Update to changes in semantics of
1828 2005-03-31 Marek Safar <marek.safar@seznam.cz>
1831 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
1834 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
1836 2005-03-31 Raja R Harinath <rharinath@novell.com>
1838 Fix difference in behaviour with commandline invocation.
1839 * driver.cs (Driver.Reset): New.
1840 (CompilerCallableEntryPoint): Call it.
1842 * statement.cs (If.Resolve): Avoid spurious "uninitialized
1843 variable" warnings if the boolean expression failed to resolve.
1845 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
1847 * attribute.cs: Fix the union of several permissions when some of them
1848 are unrestricted (so the result isn't an unrestricted permission set).
1851 2005-03-30 Raja R Harinath <rharinath@novell.com>
1853 * ecore.cs (MemberExpr): New class. Convert from interface
1855 (MemberExpr.ResolveMemberAccess): Refactor and move here from
1856 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
1858 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
1859 (MethodGroupExpr.IsExplicitImpl): Remove.
1860 (Expression.GetFieldFromEvent): Remove.
1861 (SimpleName.MemberStaticCheck): Remove.
1862 (SimpleName.DoSimpleNameResolve): Update to changes.
1863 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
1864 (MemberAccess.IdenticalNameAndTypeName): Remove.
1865 (MemberAccess.error176): Move to MemberExpr.
1866 (MemberAccess.DoResolve): Update to changes.
1867 (BaseAccess.DoResolve): Likewise.
1869 2005-03-30 Marek Safar <marek.safar@seznam.cz>
1871 C# 2.0 Conditional attribute class implementation
1873 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
1874 Analyzes class whether it has attribute which has ConditionalAttribute
1875 and its condition is not defined.
1877 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
1878 (Class.IsExcluded): New method. Search for at least one defined
1879 condition in ConditionalAttribute of attribute class.
1881 2005-03-30 Raja R Harinath <rharinath@novell.com>
1883 * ecore.cs (PropertyExpr): Derive from Expression, not
1884 ExpressionStatement.
1885 (PropertyExpr.EmitStatement): Remove.
1887 2005-03-29 Raja R Harinath <rharinath@novell.com>
1890 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
1891 internal field "value__" of an enum be private. The examples for
1892 "value__" that I found on MSDN all used FieldAttributes.Private.
1894 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
1895 Don't mention IL method attribute names.
1897 Fix #47991. Remove a TODO.
1898 * statement.cs (Block.Toplevel): Make into a field.
1899 (Block.Parameters): Move into ToplevelBlock.
1900 (Block.known_variables): Rename from child_variable_names.
1901 (Block.Block): Remove variants that take Parameters. Initialize
1902 'Toplevel' with the immediately surrounding toplevel block.
1903 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
1904 LocalInfo parameter.
1905 (Block.GetKnownVariableInfo): New.
1906 (Block.IsVariableNameUsedInChildBlock): Update.
1907 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
1908 the block, even though it may not be in scope.
1909 (Block.AddVariable): Remove Parameters parameter. Use
1910 Toplevel.Parameters instead.
1911 (Block.AddConstant): Remove Parameters parameter.
1912 (Block.GetParameterReference): Update to use Toplevel.Parameters.
1913 (Block.IsParamaterReference): Likewise.
1914 (Block.IsLocalParameter): Likewise. Simplify a lot.
1915 (ToplevelBlock.Parameters): New. Moved from Block.
1916 (ToplevelBlock.ToplevelBlock): Update to changes. Always
1917 initialize Parameters to a non-null value.
1918 * cs-parser.jay: Update to changes.
1919 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
1920 simple names that mean different things in the same block. Use
1921 Block.IsVariableNameUsedInBlock.
1923 2005-03-28 Raja R Harinath <rharinath@novell.com>
1925 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
1926 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
1927 GetTypeHandle. It is possible for a reflected type to derive from
1928 a TypeBuilder (e.g., int[] derives from the TypeBuilder
1929 System.Array during mscorlib compilation).
1930 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
1931 contain a method_hash, don't create one either. Don't create a
1932 deep copy of the base cache's method_hash.
1933 (MemberCache.SetupCache): Rename back from DeepCopy.
1934 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
1935 already initialized. If we see an override function, add its
1936 underlying base virtual function to the member_hash too.
1938 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
1940 2005-03-26 Raja R Harinath <harinath@acm.org>
1943 * assign.cs (Assign.DoResolve): When the RHS of an assignment
1944 fails to resolve, ensure that the LHS is still resolved as an
1947 2005-03-25 Raja R Harinath <harinath@acm.org>
1949 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
1951 (Enum.current_ec): Remove.
1952 (Enum.LookupEnumValue): Remove EmitContext argument.
1953 Just uses the one created during DefineType.
1954 (Enum.FindMembers): Update.
1955 * expression.cs (MemberAccess.DoResolve): Update.
1957 2005-03-22 Marek Safar <marek.safar@seznam.cz>
1959 * assign.cs (Assign.DoResolve): Check for CS1717 when
1960 source and target are same (uses Equals).
1962 * expression.cs (LocalVariableReference, ParameterReference,
1963 This): Implemented Equals, GetHashCode.
1965 * statement.cs (Block.GetParameterReference): Removed useless
1968 2005-03-22 Raja R Harinath <rharinath@novell.com>
1971 * statement.cs (Block.AddVariable): Ensure that we skip implicit
1972 blocks before deciding whether the error is cs0136 or cs0128.
1974 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
1975 (using_alias_directive, using_namespace_directive): Pass
1976 MemberName, not an expression to Namespace.UsingAlias and
1978 (MakeName): Use the MemberName of the namespace.
1979 * namespace.cs (Namespace.MemberName): New.
1980 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
1981 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
1983 * decl.cs (MemberName.Name): Make readonly.
1984 (MemberName.FromDotted): New "constructor".
1985 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
1986 (MemberCore.Name): Compute from MemberName on demand.
1987 (MemberCore.SetMemberName): Provide a way to change the
1989 (MemberCore.AddToContainer): Don't take a fullname parameter.
1990 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
1991 fully qualified name of the container to the member name.
1992 (TypeContainer.AddToTypeContainer): Use a fully qualified name
1993 only if the type is a member of the root container.
1994 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
1995 MemberName.Left rather than searching for an embedded ".".
1996 (PartialContainer.CreatePart): Update to changes in RootContext.
1997 (MemberBase.ShortName): Turn into a property. Use
1998 MemberCore.SetMemberName.
1999 (MemberBase.ExplicitInterfaceName): Remove.
2000 (MemberBase.UpdateMemberName): Remove.
2001 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
2002 (PropertyBase.SetMemberName): New override.
2003 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
2004 (Tree.GetDecl): New.
2005 (Tree.AllDecls): Rename from Decls.
2006 * attribute.cs, enum.cs, report.cs: Update to changes.
2007 * driver.cs (MainDriver): Use MemberName.FromDotted on
2008 RootContext.MainClass.
2010 2005-03-21 Marek Safar <marek.safar@seznam.cz>
2012 * class.cs (FixedField.Define): Check for CS1664 and more sanity
2015 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
2017 2005-03-18 Marek Safar <marek.safar@seznam.cz>
2019 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
2020 property accessor modifiers.
2022 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
2023 fixed buffer attribute (CS1716).
2024 (PropertyMethod.HasCustomAccessModifier): When property accessor
2025 has custom modifier.
2027 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
2029 (PropertyExpr.DoResolveLValue): Add CS0272.
2031 2005-03-17 Miguel de Icaza <miguel@novell.com>
2033 * convert.cs: When converting to a pointer, use the proper Conv.U
2034 or Conv.I depending on the source data type.
2036 * cs-tokenizer.cs: Make the size for large decimal constants,
2039 2005-03-17 Martin Baulig <martin@ximian.com>
2041 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2042 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2044 2005-03-17 Martin Baulig <martin@ximian.com>
2046 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2047 to bool so we can return an error condition.
2048 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2051 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
2053 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
2056 2005-03-16 Raja R Harinath <rharinath@novell.com>
2058 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
2059 Refactor to avoid traversing the list of assemblies, and to avoid
2060 string concatenation.
2061 * typemanager.cs (guid_attr_type): Remove.
2062 (negative_hits, pointers, references): Remove hashes.
2064 (GetConstructedType): New. Uses type_hash to handle constructed
2065 types (arrays, references, pointers).
2066 (GetReferenceType, GetPointerType): Use it.
2067 (GetNestedType): New. Uses type_hash to handle nested types of
2069 (LookupType, LookupTypeDirect): Remove.
2070 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
2071 'types' hash and LookupTypeReflection directly.
2072 (params_string, params_object): Use GetConstructedType.
2073 * namespace.cs (Namespace.cached_types): New. Cache of reflected
2075 (Namespace.Lookup): Use cached_types.
2076 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
2077 provided by old TypeManager.LookupType.
2078 * rootcontext.cs (MakeFQN): Remove.
2079 * decl.cs (DeclSpace.MakeFQN): Likewise.
2080 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
2081 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
2082 TypeManager.GetConstructedType.
2083 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
2085 2005-03-15 Marek Safar <marek.safar@seznam.cz>
2087 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
2090 * cs-parser.jay: Reports CS1527 for any namespace element.
2092 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
2095 * expression.cs (ParameterReference.IsAssigned): Changed error to
2097 (Error_WrongNumArguments): Moved CS0245 detection here.
2099 * statement.cs (Return.Resolve): Add CS1622 report.
2101 2005-03-11 Marek Safar <marek.safar@seznam.cz>
2103 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
2105 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
2107 * attribute.cs expression.cs: Get rid of some allocations.
2109 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
2111 * doc.cs : just eliminate the latest change.
2113 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2115 * doc.cs : commented out the latest change. It breaks xml-030.cs
2117 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2119 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
2120 fail. So invoke CreateType() in FindDocumentedType().
2122 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2124 * cs-tokenizer.cs : added IsKeyword().
2125 * doc.cs : Detect keyword incorrectly used as identifier.
2126 Allow identifiers prefixed by @.
2128 2005-03-10 Marek Safar <marek.safar@seznam.cz>
2130 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
2131 It caused exception in namespace resolving (again!).
2133 * class.cs (Class.ctor): Removed exit.
2134 (PropertyMethod.ctor): ditto.
2136 * codegen.cs (Codegen.Reset): Reset static data.
2137 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
2139 * cs-tokenizer.cs (Cleanup): Removed.
2141 * driver.cs (GetSystemDir): Rewrote to one line command.
2142 It caused problem with unloaded dynamic modules.
2143 (UnixParseOption): Removed Exit.
2144 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
2145 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
2146 Now can be mcs used as library.
2148 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
2151 * location.cs (Reset): Reset static data.
2153 * namespace.cs (Reset): Reset static data.
2155 * report.cs (Report.Reset): Reset static data.
2157 * rootcontext.cs (RootContext.Reset): Reset static data.
2159 * tree.cs (RootTypes.ctor): Use Location.Null
2161 * typemanager.cs (TypeManager.Reset): Reset static data.
2162 (CoreLookupType): Removed Exit.
2163 (TypeHandle.Reset): Reset static data.
2165 2005-03-10 Raja R Harinath <rharinath@novell.com>
2168 * typemanager.cs (ComputeNamespaces): Import namespaces from
2169 referenced modules too.
2171 2005-03-09 Raja R Harinath <rharinath@novell.com>
2173 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
2176 2005-03-09 Raja R Harinath <rharinath@novell.com>
2178 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
2179 enclosing DeclSpace. This ensures that a name-lookup populates
2180 more caches and there are fewer 'TypeExpression's. Carve out
2181 nested type lookup into ...
2182 (LookupNestedTypeInHierarchy): ... this.
2184 2005-03-09 Raja R Harinath <rharinath@novell.com>
2186 Clean up a few partial-class semantics.
2187 Fixes test-357.cs and cs1618-2.cs.
2188 * cs-parser.jay (struct_declaration): Use 'current_class' as
2189 parent of newly-created struct. Remove call to Register ().
2190 Use 'pop_current_class' to complete handing the current struct.
2191 (interface_declaration): Likewise.
2192 (class_declaration): Likewise.
2193 (enum_declaration): Use 'current_class' as parent of newly created
2195 (delegate_declaration): Likewise.
2196 (pop_current_class): New function. This is used to handle closing
2197 up the 'current_class' and 'current_container', and pointing them
2198 to the enclosing class/container.
2199 (CSharpParser): Initialize 'current_class' too.
2200 * decl.cs (MemberCore): Add check for invariant: a partial
2201 container is not a parsed entity, and thus does not enclose any
2203 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
2204 (DeclSpace.BaseTypeExpr): Use it.
2205 (DeclSpace.LookupType): Add check for invariant.
2206 * class.cs (TypeContainer): Add check for invariant: a nested
2207 class should have the same NamespaceEntry as its enclosing class.
2208 (TypeContainer.EmitFieldInitializers): Make virtual.
2209 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
2211 (TypeContainer.Register): Remove.
2212 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
2213 null. Use TypeResolveEmitContext for resolving base types and
2214 interfaces. Move initialization of Parts.TypeBuilder here from
2216 (TypeContainer.DefineNestedTypes): ... here.
2217 (PartialContainer): Take a Namespace not a NamespaceEntry.
2218 (PartialContainer.Create): Don't use Register. Call the
2219 appropriate Add... function directly.
2220 (ClassPart): Take both the PartialContainer and the enclosing
2221 class as constructor arguments.
2222 (ClassPart.EmitFieldInitializers): Override.
2223 (ClassPart.PartFindNestedTypes): Remove.
2224 (FieldBase.GetInitializerExpression): Resolve the initializer
2225 expression in the emit context of the enclosing class.
2226 * tree.cs (RootTypes): Remove Register ().
2228 2005-03-08 Marek Safar <marek.safar@seznam.cz>
2230 * cs-parser.jay: Removed CS0134.
2232 * driver.cs: Removed CS1901.
2234 * expression.cs (SizeOf.DoResolve): Don't report CS0233
2235 for predefined types.
2237 2005-03-07 Duncan Mak <duncan@novell.com>
2239 * codegen.cs (Save): Catch UnauthorizedAccessException as
2240 well. Fixes bug #73454.
2242 2005-03-07 Marek Safar <marek.safar@seznam.cz>
2244 * cs-tokenizer.cs (xtoken): Add CS1035.
2246 * class.cs (MethodData.Define): Add CS0683.
2247 (FieldMember.ctor): Add CS0681.
2249 2005-03-07 Raja R Harinath <rharinath@novell.com>
2251 * ecore.cs (SimpleName.DoResolve): Rename from
2252 SimpleName.DoResolveAllowStatic.
2253 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
2254 Pass 'intermediate' flag to MemberStaticCheck.
2255 (SimpleName.MemberStaticCheck): Skip "static check" only in case
2256 of "intermediate" lookups via MemberAccess.
2257 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
2258 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
2260 2005-03-07 Raja R Harinath <rharinath@novell.com>
2263 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
2264 slipped in because of variable names that are identical to a
2265 builtin type's BCL equivalent ('string String;', 'int Int32;').
2266 (PropertyExpr.EmitInstance): Likewise.
2268 2005-03-04 Marek Safar <marek.safar@seznam.cz>
2270 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
2272 * report.cs (warning_ignore_table): Made public.
2274 2005-03-04 Raja R Harinath <rharinath@novell.com>
2277 * class.cs (MethodData.Emit): Pass 'container' to
2278 container.GetObsoleteAttribute instead of 'container.Parent'.
2280 2005-03-03 Marek Safar <marek.safar@seznam.cz>
2282 * cs-parser.jay: Add 1534 error test.
2284 * iterators.cs (Yield.CheckContext): Add error 1629.
2285 (Iterator.ctor): Save unsafe modifier.
2286 (MoveNextMethod.DoEmit): Restore unsafe context.
2288 * namespace.cs (UsingAlias): Better error message.
2290 2005-03-03 Dan Winship <danw@novell.com>
2292 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
2293 the warning message [#73219]
2295 2005-03-03 Raja R Harinath <rharinath@novell.com>
2297 Fix compile with MCS 1.0.0.0.
2298 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
2299 w_restore to not depend on string constant folding.
2301 2005-03-03 Raja R Harinath <rharinath@novell.com>
2303 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
2304 CS0246 check to users who passed 'silent = false'.
2305 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
2307 (SimpleName.SimpleNameResolve): Update.
2308 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
2309 (MemberAccess.IdenticalNameAndTypeName): Update.
2310 * doc.cs (FindDocumentedTypeNonArray): Update.
2312 2005-03-03 Raja R Harinath <rharinath@novell.com>
2314 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
2315 * parameters.cs (ComputeAndDefineParameters): Remove.
2316 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
2317 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
2318 Use GetParameterInfo.
2320 2005-03-02 Marek Safar <marek.safar@seznam.cz>
2322 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
2324 2005-03-02 Raja R Harinath <rharinath@novell.com>
2326 Unify DeclSpace.LookupType and DeclSpace.FindType.
2327 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
2328 is in charge of defining nested types on demand.
2329 (DeclSpace.LookupType): Use it when the current_type is a
2330 TypeBuilder. Use LookupTypeDirect for reflected types.
2331 (DeclSpace.FindType): Remove.
2332 (DeclSpace.LookupInterfaceOrClass): Likewise.
2333 (DeclSpace.DefineTypeAndParents): Likewise.
2334 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
2335 DeclSpace.LookupType.
2336 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
2337 * typemanager.cs (LookupType): Simplify.
2338 (AddUserType): Remove type from negative_hits.
2339 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
2340 * class.cs (TypeContainer.FindMembers): Move handling of nested
2342 (TypeContainer.FindMembers_NestedTypes): ... here.
2343 (TypeContainer.FindNestedType): Implement override.
2344 (ClassPart.FindNestedType): Delegate to PartialContainer.
2345 (ClassPart.PartFindNestedType): Looks up the nested types of the
2348 2005-03-02 Martin Baulig <martin@ximian.com>
2350 * class.cs (TypeContainer.DoDefineMembers): We also need a default
2351 static constructor in static classes.
2353 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
2355 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
2356 sizeParamIndex is not specified.
2358 2005-03-01 Marek Safar <marek.safar@seznam.cz>
2361 * report.cs (WarningMessage.IsEnabled): Missing null check.
2363 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2365 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
2366 in the fields and not in the properties.
2368 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
2370 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
2373 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2375 * attribute.cs: Small refactoring (improved robustness).
2376 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
2377 (ValidateGuid): Removed.
2378 (Resolve): Removed referenced to above mentioned.
2379 (GetAttributeUsage): Made private and changed to work without
2381 (GetIndexerAttributeValue): Don't crash.
2382 (GetConditionalAttributeValue): Ditto.
2383 (GetClsCompliantAttributeValue): Ditto.
2384 (ExtractSecurityPermissionSet): All attributes exceptions are
2386 (GetPropertyValue): New helper.
2387 (GetMethodImplOptions): New method.
2388 (DefinePInvokeMethod): Reuse common code. Implemented handling of
2389 some missing properties.
2391 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
2392 (Method.ApplyAttributeBuilder): Updated.
2394 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
2397 2005-02-28 Raja R Harinath <rharinath@novell.com>
2400 * report.cs (Report.SymbolRelatedToPreviousError): Handle
2401 non-simple types (array, pointer, reference).
2403 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2405 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
2407 * class.cs (MethodCore.IsDuplicateImplementation): Special error
2409 (Method.CheckBase): Catch wrong destructor here.
2410 (MethodData.Define): Add errors 550, 668.
2412 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
2414 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
2416 * pending.cs (VerifyPendingMethods): Add error 551.
2418 * typemanager.cs (CSharpName): Next error report helper.
2420 2005-02-25 Marek Safar <marek.safar@seznam.cz>
2422 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
2423 attributes. Removed useless attribute double check.
2424 It saves almost 2MBs for corlib.
2426 2005-02-25 Raja R Harinath <rharinath@novell.com>
2429 * statement.cs (ExpressionStatement.Resolve): Make robust to being
2430 called twice in case of error.
2432 2005-02-23 Chris Toshok <toshok@ximian.com>
2434 Fix compiler portions of #72827.
2435 * statement.cs (Block.Emit): call Begin/EndScope on the
2436 EmitContext instead of the ILGenerator.
2438 * codegen.cs (EmitContext.BeginScope): new method, call
2439 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
2441 (EmitContext.BeginScope): same, but EndScope and CloseScope
2443 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
2444 offset and call the superclass's OpenScope(int) with it.
2445 (SymbolWriter.CloseScope): get the current il
2446 offset and call superclass's CloseScope(int) with it.
2448 2005-02-23 Marek Safar <marek.safar@seznam.cz>
2450 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
2451 CS1677 for out and ref as well.
2453 * class.cs (Method.Define): Add error CS1599 detection.
2455 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
2457 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
2459 * delegate.cs (Delegate.Define): Add error CS1599 detection.
2461 * support.cs.cs (ModifierDesc): New helper method.
2463 2005-02-23 Raja R Harinath <rharinath@novell.com>
2464 Abin Thomas <projectmonokochi@rediffmail.com>
2465 Anoob V E <projectmonokochi@rediffmail.com>
2466 Harilal P R <projectmonokochi@rediffmail.com>
2469 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
2470 MemberLookup (used for error reporting) actually returns a result.
2471 Fix error report number (122, not 112).
2473 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
2474 Anoob V E <projectmonokochi@rediffmail.com>
2475 Harilal P R <projectmonokochi@rediffmail.com>
2478 * pending.cs (PendingImplementation.GetAbstractMethods):
2479 Find NonPublic members too.
2481 2005-02-22 Marek Safar <marek.safar@seznam.cz>
2483 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
2486 * class.cs (MethodCore.CheckMethodAgainstBase):
2487 Add error 239 report.
2489 2005-02-21 Raja R Harinath <rharinath@novell.com>
2492 * expression.cs (Invocation.IsApplicable): Make public.
2493 (Invocation.IsParamsMethodApplicable): Likewise.
2494 * delegate.cs (Delegate.VerifyApplicability): Don't use
2495 Invocation.VerifyArgumentCompat for parameter applicability
2496 testing. Use Invocation.IsApplicable and
2497 Invocation.IsParamsMethodApplicable.
2499 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2501 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
2503 * class.cs (Operator.Define): Add error 217 report.
2505 2005-02-21 Raja R Harinath <rharinath@novell.com>
2507 * namespace.cs (UsingEntry.Resolve): Undo change below.
2509 2005-02-21 Raja R Harinath <rharinath@novell.com>
2512 * ecore.cs (Expression.MemberLookupFailed): Add argument to
2513 disable the error message when the extended MemberLookup also
2515 (Expression.MemberLookupFinal): Update.
2516 (SimpleName.DoSimpleNameResolve): Update.
2517 * expression.cs (MemberAccess.ResolveNamespaceOrType):
2518 Don't use MemberLookupFinal.
2519 (New.DoResolve): Update.
2520 (BaseAccess.CommonResolve): Update.
2522 2005-02-21 Raja R Harinath <rharinath@novell.com>
2525 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
2526 occured previously, don't resolve again.
2528 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2531 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
2532 argument. Call ResolveAttributeUsage for unresolved.
2533 when types doesn't match ctor arguments.
2535 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
2536 for nested attribute classes.
2537 (Class.attribute_usage): Removed.
2538 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
2539 for attribute class.
2541 * ecore.cs (IsAttribute): Removed.
2543 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
2545 * rootcontext.cs (RegisterAttribute): Removed, attributes are
2547 (attribute_types): Removed.
2548 (EmitCode): Global attributes are emited as the latest.
2550 2005-02-18 Marek Safar <marek.safar@seznam.cz>
2552 * class.cs (EmitFieldInitializers): Don't emit field initializer
2553 for default values when optimilization is on.
2555 * constant.cs (Constant.IsDefaultValue): New property.
2557 * driver.cs: Add /optimize handling.
2561 * literal.cs: Implement new IsDefaultValue property.
2563 * rootcontext.cs (Optimize): New field, holds /optimize option.
2565 2005-02-18 Raja R Harinath <rharinath@novell.com>
2567 Fix crasher in re-opened #72347.
2568 * namespace.cs (Namespace.Lookup): Return null if
2569 DeclSpace.DefineType returns null.
2572 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
2574 2005-02-18 Raja R Harinath <rharinath@novell.com>
2576 Fix remainder of #63202. Change semantics of DoResolveLValue: it
2577 now returns null if it cannot resolve to an lvalue.
2578 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
2579 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
2580 returned null. Remove check for SimpleName.
2581 (EventExpr.DoResolveLValue): New.
2582 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
2583 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
2585 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
2587 (Unary.ResolveOperator): Move CS0211 check ...
2588 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
2590 (Unary.DoResolveLValue): Simplify.
2591 (AddressOf.DoResolveLValue): New.
2592 (ArrayAccess.DoResolveLValue): New.
2594 2005-02-16 Marek Safar <marek.safar@seznam.cz>
2596 * attribute.cs (Attribute.Resolve): Add arguments casting for
2597 when types doesn't match ctor arguments.
2599 2005-02-16 Raja R Harinath <rharinath@novell.com>
2601 Fix parts of #63202.
2602 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
2603 lookup of operator in base type. Ensure that all checks happen
2604 when the operator resolves to an "op_..." method.
2606 2005-02-15 Raja R Harinath <rharinath@novell.com>
2609 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
2610 'ignore_cs0104' parameter. Pass it to ...
2611 (NamespaceEntry.Lookup): ... this.
2612 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
2613 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
2614 (TypeLookupExpression.DoResolveAsTypeStep): Update.
2615 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
2616 Update. Request that cs0104 errors be ignored.
2617 (ComposedCast.ResolveAsTypeStep): Update.
2619 2005-02-14 Raja R Harinath <rharinath@novell.com>
2622 * expression.cs (Invocation.BetterFunction): Remove support for
2623 comparing virtual functions and their overrides.
2624 (Invocation.IsOverride): New.
2625 (Invocation.OverloadResolve): Don't consider 'override' functions
2626 during candidate selection. Store them in a lookaside list.
2627 If the selected method is a 'virtual' function, use the list to
2628 find any overrides that are closer to the LHS type.
2630 2005-02-14 Marek Safar <marek.safar@seznam.cz>
2632 * expression.cs (New.DoResolve): Add complex core type reduction.
2633 (New.Constantify): Converts complex core type syntax like 'new int ()'
2636 2005-02-14 Raja R Harinath <rharinath@novell.com>
2638 * decl.cs (EntryType.EntryType): New constructor to create an
2639 updated copy of a cache entry.
2640 (MemberCache.AddMethods): Use it.
2641 (MemberCache.ClearDeclaredOnly): Remove.
2642 (MemberCache.MemberCache): Update.
2644 2005-02-11 Miguel de Icaza <miguel@novell.com>
2646 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
2647 variable. This one is represents the actual low-level declaration
2648 of the method, as opposed to the semantic level `IsStatic'.
2650 An anonymous method which is hosted into a static method might be
2651 actually an instance method. IsStatic would reflect the
2652 container, while MethodIsStatic represents the actual code
2655 * expression.cs (ParameterReference): Use the new MethodIsStatic
2656 instead of IsStatic.
2658 * anonymous.cs (AnonymousMethod.Compatible): Pass the
2659 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
2660 set on the current EmitContext.
2662 * expression.cs (Cast): Overload DoResolveLValue so we can pass
2663 resolve our casted expression as an LValue. This triggers the
2664 proper LValue processing that is later required by Assign.
2668 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
2670 2005-02-11 Marek Safar <marek.safar@seznam.cz>
2672 C# 2.0 Fixed buffer implementation
2674 * anonymous.cs: Update after RegisterHelperClass renaming.
2676 * attribute.cs (AttributeTester.fixed_buffer_cache):
2677 Cache of external fixed buffers.
2678 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
2679 implementation if field is fixed buffer else null.
2682 (TypeContainer.AddField): Accept FieldMember instead of Field.
2683 (FieldBase.IsFieldClsCompliant): Extracted code from
2684 VerifyClsCompliance descendant customization.
2685 (FixedField): New class handles fixed buffer fields.
2686 (FixedFieldExternal): Keeps information about imported fixed
2688 (IFixedField): Make access to internal or external fixed buffer
2691 * cs-parser.jay: Add fixed buffer parsing.
2693 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
2696 * expression.cs (Indirection): Extended implementation to accept
2698 (PointerArithmetic.Emit): Get element from fixed buffer as well.
2699 (ElementAccess.MakePointerAccess): Get type as parameter.
2700 (DoResolve): Add fixed buffer field expression conversion.
2701 (DoResolveLValue): Ditto.
2702 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
2703 (ArrayPtr): Derives from FixedBufferPtr.
2704 (ArrayPtr.Emit): Add extra emit for array elements.
2706 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
2708 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
2709 for compiler generated types.
2710 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
2712 * statement.cs (Fixed): Refactored to be easier add fixed buffer
2713 and consume less memory.
2714 (Fixed.Resolve): Add fixed buffer case.
2716 * typemanager.cs (compiler_generated_attr_ctor,
2717 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
2718 (HasElementType): Add our own implementation to work on every
2721 2005-02-11 Miguel de Icaza <miguel@novell.com>
2723 * anonymous.cs (CaptureContext): Track whether `this' has been
2726 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
2727 only captured `this' if it was implicitly done (instance
2728 methods/variables were used).
2730 * codegen.cs (EmitContext.CaptureThis): New method to flag that
2731 `this' must be captured.
2733 2005-01-30 Miguel de Icaza <miguel@novell.com>
2735 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
2736 is null it means that there has been no need to capture anything,
2737 so we just create a sibling.
2739 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
2741 Just a partial fix. The other half is fairly elusive.
2743 2005-02-10 Raja R Harinath <rharinath@novell.com>
2745 Fix #52586, cs0121-4.cs.
2746 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
2747 and return a hashtable.
2748 (MemberCache.ClearDeclaredOnly): New.
2749 (MemberCache.MemberCache): Update to change. Make a deep copy of
2750 the method_hash of a base type too.
2751 (MemberCache.AddMethods): Adapt to having a deep copy of the base
2752 type methods. Overwrite entries with the same MethodHandle so
2753 that the ReflectedType is correct. The process leaves in base
2754 virtual functions and their overrides as distinct entries.
2755 (CacheEntry): Now a class instead of a struct. It shouldn't alter
2756 matters since it was boxed in a ArrayList before.
2757 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
2759 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
2760 case of a virtual function and its override (choose the overload
2762 (Invocation.OverloadResolve): Avoid 'override' members during
2763 'applicable_type' calculation.
2765 2005-02-09 Raja R Harinath <rharinath@novell.com>
2767 Combine two near-redundant caches.
2768 * typemanager.cs (method_params): Rename from method_internal_params.
2769 (TypeManager.GetParameterData): New. Replace
2770 Invocation.GetParameterData.
2771 (TypeManager.LookupParametersByBuilder): Remove.
2772 * expression.cs (Invocation.method_parameter_cache): Remove.
2773 (Invocation.GetParameterData): Remove.
2775 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
2778 2005-02-08 Raja R Harinath <rharinath@novell.com>
2781 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
2782 TypeManager.multicast_delegate_type is null, resolve it by looking
2783 up "System.MulticastDelegate".
2784 * rootcontext.cs (RootContext.ResolveCore): Simplify.
2786 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
2787 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
2788 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
2791 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
2792 (LabeledStatement.AddReference): New. Set 'referenced'.
2793 (Goto.Resolve): Use it.
2795 2005-02-05 John Luke <john.luke@gmail.com>
2797 * driver.cs: remove duplicate -doc line in Usage ()
2799 2005-02-04 Raja R Harinath <rharinath@novell.com>
2801 * location.cs (Location.AddFile): Fix CS2002 error report.
2803 2005-02-02 Martin Baulig <martin@ximian.com>
2805 * delegate.cs (Delegate.DefineType): Report an internal error if
2806 TypeManager.multicast_delegate_type is null. See bug #72015 for
2809 2005-02-02 Raja R Harinath <rharinath@novell.com>
2811 Fix a crasher in a variant of #31984.
2812 * const.cs (Constant.CheckBase): New override that defers the
2813 new-or-override check in case the base type hasn't been populated
2815 (Constant.Define): Ensure the new-or-override check is performed.
2817 2005-02-01 Duncan Mak <duncan@ximian.com>
2819 * const.cs (LookupConstantValue): Check that `ce' is not null
2820 before calling GetValue ().
2822 2005-02-01 Raja R Harinath <rharinath@novell.com>
2824 Fix test-334.cs (#69519).
2825 * cs-parser.jay (using_alias_directive): Pass in an expression to
2826 NamespaceEntry.UsingAlias.
2827 (using_namespace_directive): Pass in an expression to
2828 NamespaceEntry.Using.
2829 (namespace_name): Don't flatten to a string.
2830 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
2831 (NamespaceEntry.AliasEntry.Resolve): Lookup using
2833 (NamespaceEntry.UsingEntry): Likewise.
2834 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
2836 (NamespaceEntry.LookupForUsing): Remove.
2837 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
2839 (NamespaceEntry.Lookup): Remove support for dotted names.
2841 2005-02-01 Raja R Harinath <rharinath@novell.com>
2843 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
2845 (NamespaceEntry.ImplicitParent): Compute on demand.
2846 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
2847 parallels the current.
2848 (NamespaceEntry.LookupForUsing): Use it.
2849 (NamespaceEntry.Lookup): If the current namespace-entry is
2850 implicit, don't search aliases and using tables.
2852 2005-02-01 Raja R Harinath <rharinath@novell.com>
2855 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
2857 (TypeContainer.BaseCache): Compute on demand.
2858 (TypeContainer.FindMembers): Define constants and types if they're
2859 not already created.
2860 (FieldMember.Define): Move resetting of ec.InUnsafe before error
2862 * const.cs (Constant.Define): Make idempotent.
2864 2005-01-29 Miguel de Icaza <miguel@novell.com>
2866 * pending.cs: Produce better code (no nops produced by using Ldarg
2869 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
2870 i - 1' it should be arg + 1.
2874 2005-01-28 Raja R Harinath <rharinath@novell.com>
2876 * attribute.cs (Attribute.CheckAttributeType): Make private
2878 (Attribute.ResolveType): Make virtual.
2879 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
2880 handling of RootContext.Tree.Types.
2882 2005-01-27 Raja R Harinath <rharinath@novell.com>
2884 Update attribute-handling to use the SimpleName/MemberAccess
2886 * cs-parser.jay (attribute): Pass in an expression to the
2887 constructors of Attribute and GlobalAttribute.
2888 * attribute.cs (Attribute): Take an expression for the name.
2889 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
2890 passed in attribute name expression.
2891 (Attribute.CheckAttributeType): Use it.
2892 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
2893 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
2894 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
2895 argument to prevent error messages if the lookup fails.
2897 2005-01-27 Marek Safar <marek.safar@seznam.cz>
2899 * expression.cs (Indirection): Implemented IVariable interface
2900 to support indirection in AddressOf operator.
2901 (PointerArithmetic.Emit): Add optimalization for case where
2902 result can be precomputed.
2904 2005-01-26 Martin Baulig <martin@ximian.com>
2906 * class.cs (TypeContainer.AttributeTargets): Return the correct
2907 AttributeTargets depending on our `Kind' instead of throwing an
2908 exception; fixes #71632.
2910 2005-01-26 Marek Safar <marek.safar@seznam.cz>
2913 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
2916 2005-01-25 Raja R Harinath <rharinath@novell.com>
2919 * expression.cs (MemberAccess.DoResolve): Don't complain with
2920 cs0572 when the LHS of a member access has identical name and type
2923 2005-01-25 Marek Safar <marek.safar@seznam.cz>
2926 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
2928 Create custom PermissionSet only for PermissionSetAttribute.
2930 2005-01-24 Marek Safar <marek.safar@seznam.cz>
2933 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
2934 delegates in static class.
2936 2005-01-24 Martin Baulig <martin@ximian.com>
2938 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2939 merging an implicit block, just use its reachability.
2941 * statement.cs (Block.Resolve): Make the unreachable code check
2942 work wrt. implicit blocks; see test-337 from #63842.
2944 2005-01-21 Alp Toker <alp@atoker.com>
2946 * cs-parser.jay: destructor_declaration's container is PartialContainer
2947 not Class when partial types are used, so use Kind prop instead of
2950 2005-01-22 Miguel de Icaza <miguel@ximian.com>
2952 * cs-parser.jay: Improve error reporting when an interface
2955 2005-01-20 Dick Porter <dick@ximian.com>
2957 * support.cs: SeekableStreamReader fix from Sandor Dobos
2958 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
2959 chars are read. Fixes bug 70369.
2961 2005-01-20 Raja R Harinath <rharinath@novell.com>
2963 * cs-parser.jay (catch_clause): Simplify current_block handling
2966 2005-01-17 Miguel de Icaza <miguel@ximian.com>
2968 * convert.cs (ImplicitStandardConversionExists): Synchronize the
2969 code with ImplicitStandardConversion to handle the implicit
2970 conversion of method groups into valid delegate invocations.
2972 The problem is that in parameter handling we were using this code
2973 path. Fixes bug #64698
2975 2005-01-19 Raja R Harinath <rharinath@novell.com>
2977 * cs-parser.jay: Fix several infelicities.
2978 - Avoid assigning to the parser value stack. Code like
2979 '$3 = null' is unclean. Synthesize a value for the code block
2981 - Avoid using oob_stack for storing location information. Use ...
2982 (_mark_): ... this. New (empty) rule. Saves the current location
2984 (foreach_statement): Avoid using oob_stack for current_block
2985 handling. Use technique used in for_statement and
2986 using_statement. Synthesize a value for the code block to store
2987 additional intermediate information.
2989 2005-01-13 Miguel de Icaza <miguel@ximian.com>
2991 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
2992 of a different type is only allowed to private fields of a
2993 containing type, not on fields of a base class.
2995 See test-174.cs and error cs0122-9.cs
2997 2005-01-13 Raja R Harinath <rharinath@novell.com>
2999 Fix test-335.cs (bug #58126).
3000 * cs-parser.jay (argument): Split out non-expression parts of the
3001 rule into 'non_simple_argument'.
3002 (invocation_expression): Support parenthesized invocations with
3003 multiple arguments, and with single non-simple arguments.
3005 2005-01-13 Raja R Harinath <rharinath@novell.com>
3007 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
3010 2005-01-12 Raja R Harinath <rharinath@novell.com>
3012 Fix cs0038-1.cs, cs1640-6.cs.
3013 * ecore.cs (Expression.Resolve): Remove special-case for
3014 SimpleName in error-handling.
3015 (Expression.almostMatchedMembers): Relax access permission to
3017 (Expression.MemberLookupFailed): Handle duplicates in
3018 almostMatchedMembers list.
3019 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
3020 * expression.cs (New.DoResolve): Report CS1540 for more cases.
3021 * typemanager.cs (GetFullNameSignature): Use the MethodBase
3022 overload if the passed in MemberInfo is a MethodBase.
3024 2005-01-12 Marek Safar <marek.safar@seznam.cz>
3027 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
3028 for non-CAS & merge permission sets properly.
3030 2005-01-11 Raja R Harinath <rharinath@novell.com>
3032 Improve standard-compliance of simple name and member access
3033 resolution. Fixes bugs #52697, #57200, #67520, #69519.
3034 * ecore.cs (FullNamedExpression): New abstract base class
3035 for Namespaces and TypeExpressions.
3036 (ResolveFlags.SimpleName): Remove.
3037 (SimpleName): Remove support for dotted names.
3038 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
3039 DeclSpace.FindType and DeclSpace.LookupType.
3040 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
3041 (Expression.ExprClassName): Make member function.
3042 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
3043 a namespace. Remove creation of dotted "SimpleName"s.
3044 (MemberAccess.DoResolve): Likewise.
3045 * decl.cs (DeclSpace.Cache): Make private.
3046 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
3047 (DeclSpace.FindType): Update.
3048 (DeclSpace.LookupType): Move here from RootContext. Return a
3049 FullNamedExpression.
3050 * namespace.cs (Namespace): Derive from FullNamedExpression
3051 so that it can be part of expression resolution.
3052 (Namespace.Lookup): Return an FullNamedExpression.
3053 (NamespaceEntry.LookupAlias): Lookup aliases only in current
3055 * rootcontext.cs (NamespaceLookup): Remove.
3056 (LookupType): Move to DeclSpace.
3057 * attribute.cs (CheckAttributeType): Update.
3058 * doc.cs (FindDocumentedType): Remove allowAlias argument.
3059 (FindDocumentedTypeNonArray): Likewise.
3061 2005-01-11 Raja R Harinath <rharinath@novell.com>
3063 Fix cs0509.cs, cs1632.cs.
3064 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
3065 is the same as IsInterface.
3066 (TypeContainer.GetClassBases): Likewise.
3067 * statement.cs (LabeledStatement.ig): New field.
3068 (LabeledStatement.LabelTarget): Save ILGenerator which created the
3070 (LabeledStatement.DoEmit): Check that the label was created with
3071 the same ILGenerator.
3073 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3076 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
3077 accessors to its properties.
3079 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
3080 from accessors to property.
3082 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3085 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
3088 2005-01-08 Miguel de Icaza <miguel@ximian.com>
3090 * attribute.cs: Check for null and empty strings.
3092 I have lost another battle to Paolo.
3094 2005-01-07 Marek Safar <marek.safar@seznam.cz>
3097 * class.cs (PropertyMethod): Set Parent field in ctors.
3098 (SetMethod.InternalParameters): Add unsafe switch hack.
3099 Override MarkForDuplicationCheck where it is appropriate.
3101 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
3102 It says whether container allows members with the same name.
3104 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
3105 Removed is_method parameter.
3107 2005-01-06 Duncan Mak <duncan@ximian.com>
3109 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
3110 because the previous change led to incorrect reporting of CS1032
3111 ("Cannot define/undefine preprocessor symbols after first token in
3112 file"). Instead of using `tokens_seen' as the only flag that
3113 triggers CS1040, introduce `comments_seen'. This new flag is used
3114 to signify having seen comments on the current line, so it is
3115 unset after a newline.
3117 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3119 * doc.cs : When searching for a type, find nested type too.
3120 This fixes bug #71040.
3122 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3125 - Warn missing member comment on those classes which also does not
3126 have doc comments. Fixed bug #71041.
3127 - Don't warn missing doc comment on default constructor.
3130 2005-01-06 Duncan Mak <duncan@ximian.com>
3132 * cs-tokenizer.cs (xtoken): After handling traditional C-style
3133 comments, set `tokens_seen' to true. This allows us to detect
3134 misplaced preprocessor directives (i.e. not at the beginning of
3135 the a line, nor after whitespaces). In that case, report error
3136 CS1040. This fixes bug #56460.
3138 * cs-parser.jay (interface_member_declaration): Add checks for
3139 IsExplicitImpl, and report CS0541 error if an interface member is
3140 defined as an explicit interface declaration.
3142 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3145 * class.cs (PropertyMethod): Set Parent field in ctors.
3146 (SetMethod.InternalParameters): Add unsafe switch hack.
3148 * decl.cs (MemberCore.Parent): Cannot be readonly.
3150 2005-01-06 Raja R Harinath <rharinath@novell.com>
3152 * decl.cs (DeclSpace.ResolveType): Remove.
3153 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3154 Merge in code from ...
3155 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3156 * class.cs, enum.cs: Update to changes.
3158 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3160 * anonymous.cs: Ensure that we init the scope of our parent if it
3161 has not been initialized yet.
3163 2004-12-30 Duncan Mak <duncan@ximian.com>
3165 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3166 if field.FieldBuilder is null. Fixes #70758.
3168 * convert.cs: Fixed some typos and updated some of the comments.
3169 (ImplicitStandardConversionExists):
3170 (TryImplicitIntConversion): If `target_type' is an interface and
3171 the type of `ic' implements this interface, return true or a new
3172 BoxedCast instead of null. This fixes #70468.
3174 2004-12-29 Duncan Mak <duncan@ximian.com>
3176 * expression.cs (Argument.Emit): Check that Expr is
3177 IMemoryLocation before casting to it, and report CS1510 otherwise.
3181 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3183 * statement.cs (Block.ThisVariable): remove the recursion here, to
3184 make the --profile more sane.
3186 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3188 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3189 assembly, by JB Evain.
3191 2004-12-17 Raja R Harinath <rharinath@novell.com>
3193 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
3194 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
3195 "parent" refers to enclosing type/class. "base" refers to superclass.
3197 2004-12-17 Raja R Harinath <rharinath@novell.com>
3199 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3200 Ensure that we only have GlobalAttributes.
3201 * attribute.cs (Attribute.Emit): Make non-virtual.
3202 (GlobalAttribute.Emit): Remove.
3203 (Attribute.Resolve): Make virtual.
3204 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
3205 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
3206 the argument. Don't create one.
3207 (Attribute.GetObsoleteAttribute): Likewise.
3208 (Attribute.GetClsCompliantAttributeValue): Likewise.
3209 * class.cs, decl.cs: Update to changes.
3211 2004-12-17 Marek Safar <marek.safar@seznam.cz>
3213 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
3215 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
3217 * statement.cs (Foreach.Resolve): Add error 186 report.
3219 2004-12-16 Marek Safar <marek.safar@seznam.cz>
3221 * expression.cs (Conditional.DoResolve): Add warning 429.
3223 * statement.cs (If.Resolve): Add warning 665.
3225 2004-12-16 Raja R Harinath <rharinath@novell.com>
3227 New invariant: RootContext.Tree.Types.NamespaceEntry == null
3228 except when in the parser, and in GlobalAttribute.
3229 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
3230 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
3231 RootContext.Tree.Types.NamespaceEntry once work is done.
3232 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
3233 and resets RootContext.Tree.Types.NamespaceEntry.
3235 2004-12-15 Marek Safar <marek.safar@seznam.cz>
3237 * cs-parser.jay: Don't create a block for every variable.
3239 2004-12-14 Miguel de Icaza <miguel@ximian.com>
3241 * location.cs: Provide extra information.
3243 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
3244 variables from the captured environment, it is the ldarg_0.
3246 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3248 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
3251 * class.cs: Changed warning level for 169 to avoid developer
3252 displeasure from warning flooding. It will be changed back when they
3253 fix most of current BCL warnings.
3255 * RootContext.cs: Pushed default WarningLevel to 3.
3257 * statement.cs: Removed unused variable.
3259 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3261 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
3262 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
3263 Add error 502 report.
3264 (StaticClass.DefineType): Add error 441 report.
3265 (Class.AllowedModifiersProp): New virtual property as temporary
3266 extension to AllowedModifiers.
3267 (Class.DefineType): Add error 418 report. Moved ModFlags check here
3268 to share implementation with StaticClass and don't call virtual
3271 * driver.cs (MainDriver): Add error 1558 test.
3273 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
3274 report. Moved error 36 test here.
3276 * statement.cs (Throw.Resolve): Add error 724 report.
3278 * typemanager.cs: Add out_attribute_type core type.
3280 2004-12-13 Marek Safar <marek.safar@seznam.cz>
3282 * class.cs (TypeContainer.VerifyClsCompliance): Add error
3284 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
3286 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
3289 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
3291 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
3292 Add error 3023 report.
3293 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
3295 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
3298 2004-12-12 John Luke <john.luke@gmail.com>
3300 * driver.cs (AddArgs): take -- into account when
3301 adding arguments, fixes bug 65710
3303 2004-12-12 Martin Baulig <martin@ximian.com>
3305 * expression.cs (Unary.TryReduceNegative): Added support for
3306 SByteConstant and ByteConstant.
3307 (Unary.Reduce): Check error values from TryReduceNegative().
3309 2004-12-10 Marek Safar <marek.safar@seznam.cz>
3311 * attributes.cs (Attribute.Resolve): Avoid multiple error report
3312 and report exception as error 182.
3314 2004-12-10 Raja R Harinath <rharinath@novell.com>
3316 * driver.cs (Main): Fix message when there are warnings.
3318 2004-12-09 Miguel de Icaza <miguel@ximian.com>
3320 * delegate.cs: Fixed my fix from yesterday, sorry about that.
3322 2004-12-09 Marek Safar <marek.safar@seznam.cz>
3324 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
3325 Reduced number of warnings.
3327 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
3329 2004-12-08 Miguel de Icaza <miguel@ximian.com>
3331 * driver.cs: Removed message.
3333 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
3335 2004-12-08 <vargaz@freemail.hu>
3337 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
3339 2004-12-08 Martin Baulig <martin@ximian.com>
3341 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
3342 instead of a CS3002 for properties and indexer.
3344 2004-12-08 Martin Baulig <martin@ximian.com>
3346 * decl.cs (MemberName.ToString): Make this work again.
3348 2004-12-08 Marek Safar <marek.safar@seznam.cz>
3350 * attribute.cs (Resolve): Add error 591 detection.
3352 * class.cs (FieldMember.Define): Add error 1547 detection.
3353 (Indexer.Define): Add error 620 detection.
3354 (Operator.Define): Add error 590 detection.
3356 * ecore.cs: Missing argument for error 79.
3358 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
3361 2004-12-07 Marek Safar <marek.safar@seznam.cz>
3364 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
3367 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
3369 * cs-parser.jay : handle doc comments on implicit/explicit operators.
3370 Some operator comments were suppressed.
3371 * doc.cs : Implicit/explicit operator name in doc comments are like
3372 "op_Explicit(type)~returnType", so added suffix handling.
3374 2004-12-07 Martin Baulig <martin@ximian.com>
3377 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
3378 (MemberCore.GetClsCompliantAttributeValue): Likewise.
3379 (DeclSpace.ec): New protected field; store the EmitContext here.
3380 (DeclSpace.EmitContext): New public property; moved here from
3382 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
3385 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
3386 (Enum.Emit): Don't create a new EmitContext.
3388 * delegate.cs (Delegate.DefineType): Always create the
3391 * iterators.cs (Iterators.DefineIterator): Create a new
3392 EmitContext and store it in `ec'.
3394 2004-08-24 Martin Baulig <martin@ximian.com>
3397 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
3398 this for accessibility checks.
3399 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
3400 IsNestedFamilyAccessible.
3401 (TypeManager.IsSubclassOf): New method, do what the name actually
3404 2004-12-06 Raja R Harinath <rharinath@novell.com>
3406 Fix crash on cs0657-17.cs.
3407 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3408 Use RootContext.Tree.Types, not 'new RootTypes ()'.
3409 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
3410 the case where the NamespaceEntry gets overwritten.
3412 2004-12-06 Marek Safar <marek.safar@seznam.cz>
3414 Fixed #69195, #56821
3415 * ecore.cs (ResolveBoolean): Tiny refactoring.
3417 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
3418 of right expression resolving when left is false constant and
3419 operator is LogicalAnd OR true constant and operator is LogicalOr.
3421 * statement.cs (ResolveUnreachable): Always reports warning.
3423 2004-12-05 Miguel de Icaza <miguel@ximian.com>
3425 * class.cs: Distinguish between 1721 and 1722 (just a little help
3426 for the programmer).
3428 2004-12-03 Miguel de Icaza <miguel@ximian.com>
3430 * delegate.cs: Only allow this on new versions of the language.
3432 2004-12-02 Duncan Mak <duncan@ximian.com>
3434 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
3436 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
3437 here as a static method. Take an additional bool out parameter
3438 `must_do_cs1540_check' for signaling to InstanceResolve.
3439 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
3440 member field from PropertyExpr class and made it an argument of
3442 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
3443 check for MarshalByRefObject, and report CS0122 instead of CS1540.
3444 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
3445 and `remove_accessor' as well as InstanceResolve: report CS0122
3450 2004-12-03 Raja R Harinath <rharinath@novell.com>
3452 Fix test-327.cs, test-328.cs, and put in early infrastructure
3453 for eventually fixing #52697.
3454 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
3455 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
3457 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
3458 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
3459 (VerifyUsing, error246): Update.
3460 * rootcontext.cs (RootContext.NamespaceLookup): Just use
3461 'NamespaceEntry.LookupNamespaceOrType'.
3463 2004-12-03 Martin Baulig <martin@ximian.com>
3465 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3466 method as our child, call AnonymousMethod.Compatible() on it.
3468 2004-12-03 Raja R Harinath <rharinath@novell.com>
3470 Disable XML documentation support in 'basic' profile.
3471 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
3472 Redirect XmlElement to System.Object.
3473 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
3474 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
3475 * mcs.exe.sources: Add doc-bootstrap.cs.
3476 * doc-bootstrap.cs: New file. Contains empty stub implementation
3479 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
3481 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
3482 comments are allowed.
3484 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3486 * delegate.cs: Add checks for subtypes in paramaters and return values
3487 in VerifyMethod () to add support for Covariance/Contravariance
3490 2004-12-02 Miguel de Icaza <miguel@ximian.com>
3492 * report.cs: Remove extra closing parenthesis.
3494 * convert.cs (Error_CannotImplicitConversion): If the name of the
3495 types are the same, provide some extra information.
3497 * class.cs (FieldBase): Use an unused bit field from the field to
3498 encode the `has_offset' property from the FieldMember. This saves
3499 a couple of Ks on bootstrap compilation.
3501 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3502 method as our child, return the AnonymousMethod resolved
3505 * expression.cs (New.DoResolve): Allow return values from
3506 NewDelegate to also include AnonymousMethods.
3510 2004-12-02 Marek Safar <marek.safar@seznam.cz>
3513 * attribute.cs (Resolve): Improved implementation of params
3514 attribute arguments.
3516 * support.cs (ParameterData): Add HasParams to be faster.
3518 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
3520 all things are for /doc support:
3522 * doc.cs: new file that supports XML documentation generation.
3523 * mcs.exe.sources: added doc.cs.
3525 Handle /doc command line option.
3526 Report error 2006 instead of 5 for missing file name for /doc.
3527 Generate XML documentation when required, after type resolution.
3529 Added support for picking up documentation (/// and /** ... */),
3530 including a new XmlCommentState enumeration.
3532 Added lines to fill Documentation element for field, constant,
3533 property, indexer, method, constructor, destructor, operator, event
3534 and class, struct, interface, delegate, enum.
3535 Added lines to warn incorrect comment.
3537 Added Documentation field (passed only when /doc was specified).
3539 Added DocComment, DocCommentHeader, GenerateDocComment() and
3540 OnGenerateDocComment() and some supporting private members for
3541 /doc feature to MemberCore.
3543 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
3545 Added overriden DocCommentHeader.
3547 Added overriden DocCommentHeader and GenerateDocComment().
3549 2004-12-01 Miguel de Icaza <miguel@ximian.com>
3551 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
3552 unwrapping the enumeration values, chain to
3553 DoConstantNumericPromotions again, so we can promote things to the
3554 fundamental types (takes care of enums that are bytes, sbytes).
3558 2004-12-01 Raja R Harinath <rharinath@novell.com>
3560 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
3561 Fix long-standing bug in type-lookup. Use FindType instead of
3562 LookupType when ec.ResolvingTypeTree.
3563 (Attribute.ResolveType, Attribute.Resolve)
3564 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
3566 (Attributes.Search): Remove internal version. Update.
3567 (Attributes.SearchMulti): Update.
3568 (Attributes.GetClsCompliantAttribute): Remove.
3569 (Attributes.GetIndexerNameAttribute): Remove.
3570 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
3571 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
3572 * class.cs (Indexer.Define): Likewise.
3574 2004-12-01 Marek Safar <marek.safar@seznam.cz>
3577 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
3578 MarshallByReference members access.
3580 * expression.cs: Use CheckMarshallByRefAccess;
3581 Better error CS0197 message.
3583 * report.cs: Print whole related error message.
3585 2004-11-30 Raja R Harinath <rharinath@novell.com>
3587 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
3588 the current directory to help debugging.
3590 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3592 * class (GetClassBases): Better error 60 report.
3593 (EventProperty): Disabled warning 67 detection.
3595 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3598 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
3600 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
3603 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3606 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
3608 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
3610 2004-11-26 Miguel de Icaza <miguel@ximian.com>
3612 * attribute.cs (Attribute.Resolve): Refine error reporting and
3613 report a cs0117 if the identifier does not exist, to distinguish
3614 from 0617 which is a miss-use of the actual identifier.
3616 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
3617 between cs0070 and cs0079.
3619 * class.cs (MemberBase.DoDefine): When reporting a wrong
3620 accessibility level, we use MethodCore to compare instead of
3621 Method (this was a regression in some refactoring effort).
3623 So now we correctly report cs0056 again.
3625 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
3626 testing the target_type (which was known to be object_type) and
3627 not the source type (which is anonymous_method).
3629 Fixed reporting of error cs1660.
3631 * expression.cs (UserCast.Source): Expose the underlying cast.
3633 * statement.cs (Switch.SwitchGoverningType): Sort the list of
3634 allowed types to find a match to int32 first (most common).
3636 In addition, it ignores any ImplicitUserConversions that did an
3637 internal implicit conversion (as the switch statement allows only
3638 one integral conversion to exist).
3640 * class.cs (PartialContainer.Create): rename `name' to
3641 `member_name' for clarity. Then replace the string calls with a
3642 call to MemberName.GetPartialName, as now using
3643 MemberName.ToString is an error (this is due to the side effects
3644 it had, that were fixed in the past).
3646 This will restore the error reporting on a number of partial class
3647 errors that were missusing this (and getting an exception as a
3648 results, which is now just a plain textual warning, because
3649 yyparse debug output would crash otherwise).
3651 2004-11-26 Raja R Harinath <rharinath@novell.com>
3653 * Makefile (PROGRAM_INSTALL_DIR): Remove.
3655 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3657 * rootcontext.cs (LookupType): Make sure to cache lookups that
3658 don't give us a negative result. This saves about 5% of corlib
3661 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3663 * report.cs (AbstractMessage.Print): messages are sent to stderr
3665 * class.cs (TypeContainer.GetClassBases): It is an error to have a
3666 non-interface in the list of interfaces (at this point, either
3667 parent was properly set, or a base class is being listed in the
3668 interfaces section).
3670 This flags error 1722, and resolves the crash from bug 69259.
3672 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3674 * statement.cs (Using.EmitExpressionFinally): make this work right
3675 for valuetypes. Fixes 69926.
3677 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3679 * const.cs (Const.ChangeType): Cope with the "0 literal can be
3680 converted to an enum" here, before we try to change the underlying
3681 type. This code exists, but it is a different code path than the
3682 one used while encoding constants.
3684 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
3685 old bug: when converting from the null literal to a pointer,
3686 return an EmptyCast, not the NullLiteral.
3688 This fixes #69921, the recent null_type changes probably made this
3691 (ImplicitReferenceConversionExists): In addition, resynchronized
3692 the code here, so it matches the same code in
3693 ImplicitReferenceConversionExists for the `from any class-type S
3694 to any interface-type T'.
3697 2004-11-25 Marek Safar <marek.safar@seznam.cz>
3699 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
3701 2004-11-24 Miguel de Icaza <miguel@ximian.com>
3703 * cs-parser.jay: Use verbosity accordingly.
3705 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3707 * expression.cs (Unary.ResolveOperator): Do not report warning;
3708 AddressOf reads from variable.
3710 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
3712 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3716 * attribute.cs (Attributable): Removed CheckTargets.
3717 (Attributes.Emit): Explicit attribute targets are tested here.
3719 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
3720 not enabled for interfaces.
3722 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
3723 (GetAssemblyName): Ouch next bug there.
3725 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3727 * expression.cs: Error 275 added.
3729 2004-11-23 Marek Safar <marek.safar@seznam.cz>
3731 Fix bug #69177 (Implemented decimal constant support)
3733 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
3734 (BinaryFold): Add DecimalConstant.
3736 * const.cs (Define): Decimal constant
3738 (ChangeType): Add decimal type handling.
3739 (LookupConstantValue): Don't set value for decimal type but
3740 emit DecimalConstantAttribute. Needed for constant optimization.
3742 * constant.cs (ToDecimal): New method.
3743 (ConvertToDecimal): New method.
3744 (IntConstant): Implemented ConvertToDecimal.
3745 (DecimalConstant.Emit): Emit optimized version for decimals in
3748 * expression.cs (ResolveOperator): Changed order of constant
3749 reduction to work correctly with native types which have
3750 overloaded operators.
3751 (ResolveMemberAccess): Extract constant value from attribute
3754 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
3756 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
3757 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
3758 (ChangeType): Decimal is special.
3759 (TypeToCoreType): Add decimal type.
3761 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3763 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
3766 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3768 * class.cs (EventField.ApplyAttributeBuilder): Fix error
3771 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3773 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
3775 * pending.cs (PendingImplementation): Grab only interfaces.
3777 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3779 * statement.cs (ForeachHelperMethods): Add location member and
3780 error 202 detection.
3782 2004-11-19 Raja R Harinath <rharinath@novell.com>
3784 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
3785 automatically handled by executable.make.
3786 (PROGRAM): Make profile-specific.
3788 2004-11-18 Marek Safar <marek.safar@seznam.cz>
3790 * expression.cs (DoResolveBase): Fixed wrong warning for out
3793 2004-11-18 Martin Baulig <martin@ximian.com>
3795 Merged latest changes into gmcs. Please keep this comment in
3796 here, it makes it easier for me to see what changed in MCS since
3797 the last time I merged.
3799 2004-11-17 Raja R Harinath <rharinath@novell.com>
3801 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
3802 (TypeHandle.GetMemberCache): New.
3803 (TypeHandle.TypeHandle): Update.
3804 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
3805 (TypeManager.LookupParentInterfacesCache):
3806 Rename from LookupInterfaceCache. Optimize slightly.
3807 (TypeManager.MemberLookup_FindMembers): Update.
3808 * decl.cs (MemberCache.MemberCache): Set Container to null in the
3810 (AddCacheContents): Rename from AddHashtable.
3811 * class.cs (TypeContainer.parent_container): Remove.
3812 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
3813 (TypeContainer.DoDefineMembers): Don't initialize it.
3814 Update to name changes.
3816 2004-11-17 Miguel de Icaza <miguel@ximian.com>
3818 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
3819 that factors the code to check access modifiers on override.
3821 (PropertyBase): Use the code here.
3823 Patch from Lluis S'anchez, fixes bug #69361.
3825 2004-11-15 Miguel de Icaza <miguel@ximian.com>
3827 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
3828 routine that is used to report the use of a captured variable
3829 whose address has been taken.
3831 There are two checks: one when variables are being captured and
3832 the other check is when the address of a variable is taken.
3834 (because an anonymous methods might be resolved before *or* after
3835 the address has been taken) and
3837 * expression.cs (Conditional.DoResolve): Remove the special
3838 casing that Martin added to trueExpr and falseExpr being both
3839 NullLiteral. We get the right behavior now just by introducing
3840 the null_type into the compiler.
3842 * convert.cs (ExplicitConversion): Change the code to use
3843 null_type instead of testing `expr is NullLiteral'.
3844 (ImplicitConversionStandard): use null_type too.
3845 (ImplicitReferenceConversionExists): use null_type too.
3846 (ImplicitReferenceConversion): use null_type too.
3848 * literal.cs: The type of `NullLiteral' is now null_type instead
3850 (Resolve): Set the type here.
3852 * typemanager.cs: Introduce null_type.
3854 2004-11-17 Martin Baulig <martin@ximian.com>
3856 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
3857 direction, like FindMembers() does. Fixes #69546, testcase is in
3860 2004-11-16 Martin Baulig <martin@ximian.com>
3862 This is based on a patch from Marek Safar, see bug #69082.
3863 Fixes bugs #63705 and #67130.
3865 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
3866 method; create a MemberCache for an interface type and cache the
3869 * decl.cs (IMemberContainer.ParentContainer): Removed.
3870 (IMemberContainer.ParentCache): New property.
3871 (MemberCache.SetupCacheForInterface): Removed.
3872 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
3873 to create a cache for an interface's "parent".
3875 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
3878 2004-11-16 Martin Baulig <martin@ximian.com>
3880 Merged back from gmcs; these changes already went into gmcs a
3881 couple of weeks ago.
3884 (TypeManager.AddUserType): Removed the `ifaces' argument.
3885 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
3887 (TypeManager.AddUserInterface): Removed.
3888 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
3890 (TypeManager.GetInterfaces): Likewise.
3891 (TypeManager.GetExplicitInterfaces): Likewise.
3893 * ecore.cs (TypeExpr.GetInterfaces): Removed.
3895 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
3896 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
3898 2004-11-14 Ben Maurer <bmaurer@ximian.com>
3900 * statement.cs: Avoid adding bools to a hashtable.
3902 2004-11-07 Miguel de Icaza <miguel@ximian.com>
3904 * expression.cs (Invocation.OverloadResolve): Flag error if we are
3905 calling an unsafe method from a safe location.
3907 2004-11-06 Marek Safar <marek.safar@seznam.cz>
3910 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
3912 2004-11-06 Miguel de Icaza <miguel@ximian.com>
3914 * namespace.cs (VerifyUsing): use GetPartialName instead of
3917 2004-11-05 Miguel de Icaza <miguel@ximian.com>
3919 * statement.cs (Return.Resolve): Fix regression in typo: if
3920 `in_exc', we have to request a NeedReturnLabel, this was a typo
3921 introduced in the anonymous method check-in. Fixes #69131.
3923 * Indexers were using the ShortName when defining themselves,
3924 causing a regression in the compiler bootstrap when applying the
3925 patch from 2004-11-02 (first part), now they use their full name
3926 and the bug is gone.
3928 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
3930 * driver.cs: Strip the path from the names of embedded resources. Fixes
3933 2004-11-04 Raja R Harinath <rharinath@novell.com>
3935 Fix error message regression: cs0104-2.cs.
3936 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
3937 (AliasEntry.Resolve): Update.
3938 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
3940 (RootContext.LookupType): Update.
3942 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
3944 * cs-parser.jay: Add support for handling accessor modifiers
3945 * class: Add support port accessor modifiers and error checking,
3946 define PropertyMethod.Define as virtual (not abstract anymore)
3947 * ecore.cs: Add checking for proeprties access with access modifiers
3948 * iterators.cs: Modify Accessor constructor call based in the modified
3950 2004-11-02 Ben Maurer <bmaurer@ximian.com>
3952 * expression.cs (StringConcat): Handle being called twice,
3953 as when we have a concat in a field init with more than two
3956 2004-11-02 Miguel de Icaza <miguel@ximian.com>
3958 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
3959 special case explicit implementations, we should always produce
3960 the .property or .event declaration.
3962 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
3963 since it will not return correct data if people use this
3964 unresolved in the presence of using statements (see test-313).
3966 * class.cs (MethodData.Define): If we are an explicit interface
3967 implementation, set the method name to the full name of the
3968 interface plus the name of the method.
3970 Notice that using the method.MethodName.GetFullName() does not
3971 work, as it will only contain the name as declared on the source
3972 file (it can be a shorthand in the presence of using statements)
3973 and not the fully qualifed type name, for example:
3977 class D : ICloneable {
3978 object ICloneable.Clone () {
3982 Would produce a method called `ICloneable.Clone' instead of
3983 `System.ICloneable.Clone'.
3985 * namespace.cs (Alias.Resolve): Use GetPartialName.
3987 2004-11-01 Marek Safar <marek.safar@seznam.cz>
3989 * cs-parser.jay: Add error 1055 report.
3991 2004-11-01 Miguel de Icaza <miguel@ximian.com>
3993 * assign.cs (Assign.DoResolve): Only do the transform of
3994 assignment into a New if the types are compatible, if not, fall
3995 through and let the implicit code deal with the errors and with
3996 the necessary conversions.
3998 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4000 * cs-parser.jay: Add error 1031 report.
4002 * cs-tokenizer.cs: Add location for error 1038.
4004 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4006 * cs-parser.jay: Add error 1016 report.
4008 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4010 * cs-parser.jay: Add errors 1575,1611 report.
4012 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4014 * cs-parser.jay: Add error 1001 report.
4016 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4019 * attribute.cs (GetMarshal): Add method argument for
4020 caller identification.
4022 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
4023 agument for GetMarshal and RuntimeMissingSupport.
4025 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4027 * attribute.cs (ExtractSecurityPermissionSet): Removed
4028 TypeManager.code_access_permission_type.
4030 * typemanager.cs: Removed TypeManager.code_access_permission_type.
4032 2004-10-27 Miguel de Icaza <miguel@ximian.com>
4034 * expression.cs (LocalVariableReference.DoResolveLValue): Check
4035 for obsolete use of a variable here. Fixes regression on errors
4036 cs0619-25 and cs0619-26.
4038 2004-10-27 Marek Safar <marek.safar@seznam.cz>
4040 Fix #62358, implemented security attribute encoding.
4042 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
4043 Tests permitted SecurityAction for assembly or other types.
4044 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
4045 data from SecurityPermissionAttribute to PermisionSet class.
4047 * class.cs (ApplyAttributeBuilder): Added special handling
4048 for System.Security.Permissions.SecurityAttribute based types.
4050 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
4051 special handling for System.Security.Permissions.SecurityAttribute
4054 * enum.cs (ApplyAttributeBuilder): Added special handling
4055 for System.Security.Permissions.SecurityAttribute based types.
4057 * parameter.cs (ApplyAttributeBuilder): Added special handling
4058 for System.Security.Permissions.SecurityAttribute based types.
4060 * rootcontext.cs: Next 2 core types.
4062 * typemanager.cs (TypeManager.security_permission_attr_type):
4063 Built in type for the SecurityPermission Attribute.
4064 (code_access_permission_type): Build in type.
4066 2004-10-17 Miguel de Icaza <miguel@ximian.com>
4068 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
4069 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
4070 all of this information into
4071 EmitContext.EmitCapturedVariableInstance.
4073 * codegen.cs (EmitCapturedVariableInstance): move here the
4074 funcionality of emitting an ldarg.0 in the presence of a
4075 remapping. This centralizes the instance emit code.
4077 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
4078 then emit a load of this: it means that we have reached the
4079 topmost ScopeInfo: the one that contains the pointer to the
4080 instance of the class hosting the anonymous method.
4082 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
4083 captures to the topmost CaptureContext.
4085 2004-10-12 Miguel de Icaza <miguel@ximian.com>
4087 * expression.cs (LocalVariableReference): Move the knowledge about
4088 the iterators into codegen's EmitCapturedVariableInstance.
4090 2004-10-11 Miguel de Icaza <miguel@ximian.com>
4092 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
4093 all code paths return a value from an anonymous method (it is the
4094 same as the 161 error, but for anonymous methods).
4096 2004-10-08 Miguel de Icaza <miguel@ximian.com>
4098 The introduction of anonymous methods in the compiler changed
4099 various ways of doing things in the compiler. The most
4100 significant one is the hard split between the resolution phase
4101 and the emission phases of the compiler.
4103 For instance, routines that referenced local variables no
4104 longer can safely create temporary variables during the
4105 resolution phase: they must do so from the emission phase,
4106 since the variable might have been "captured", hence access to
4107 it can not be done with the local-variable operations from the runtime.
4111 (Block.Flags): New flag `IsTopLevel' to indicate that this block
4112 is a toplevel block.
4114 (ToplevelBlock): A new kind of Block, these are the blocks that
4115 are created by the parser for all toplevel method bodies. These
4116 include methods, accessors and anonymous methods.
4118 These contain some extra information not found in regular blocks:
4119 A pointer to an optional CaptureContext (for tracking captured
4120 local variables and parameters). A pointer to the parent
4123 (Return.Resolve): Catch missmatches when returning a value from an
4124 anonymous method (error 1662).
4125 Invoke NeedReturnLabel from the Resolve phase instead of the emit
4128 (Break.Resolve): ditto.
4130 (SwitchLabel): instead of defining the labels during the
4131 resolution phase, we now turned the public ILLabel and ILLabelCode
4132 labels into methods called GetILLabelCode() and GetILLabel() that
4133 only define the label during the Emit phase.
4135 (GotoCase): Track the SwitchLabel instead of the computed label
4136 (its contained therein). Emit the code by using
4137 SwitchLabel.GetILLabelCode ().
4139 (LocalInfo.Flags.Captured): A new flag has been introduce to track
4140 whether the Local has been captured or not.
4142 (LocalInfo.IsCaptured): New property, used to tell whether the
4143 local has been captured.
4145 * anonymous.cs: Vastly updated to contain the anonymous method
4148 The main classes here are: CaptureContext which tracks any
4149 captured information for a toplevel block and ScopeInfo used to
4150 track the activation frames for various local variables.
4152 Each toplevel block has an optional capture context associated
4153 with it. When a method contains an anonymous method both the
4154 toplevel method and the anonymous method will create a capture
4155 context. When variables or parameters are captured, they are
4156 recorded on the CaptureContext that owns them, for example:
4160 MyDelegate d = delegate {
4165 Here `a' will be recorded as captured on the toplevel
4166 CapturedContext, the inner captured context will not have anything
4167 (it will only have data if local variables or parameters from it
4168 are captured in a nested anonymous method.
4170 The ScopeInfo is used to track the activation frames for local
4171 variables, for example:
4173 for (int i = 0; i < 10; i++)
4174 for (int j = 0; j < 10; j++){
4175 MyDelegate d = delegate {
4180 At runtime this captures a single captured variable `i', but it
4181 captures 10 different versions of the variable `j'. The variable
4182 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4183 recorded on a child.
4185 The toplevel ScopeInfo will also track information like the `this'
4186 pointer if instance variables were referenced (this is necessary
4187 as the anonymous method lives inside a nested class in the host
4188 type of the method).
4190 (AnonymousMethod): Expanded to track the Toplevel, implement
4191 `AnonymousMethod.Compatible' to tell whether an anonymous method
4192 can be converted to a target delegate type.
4194 The routine now also produces the anonymous method content
4196 (AnonymousDelegate): A helper class that derives from
4197 DelegateCreation, this is used to generate the code necessary to
4198 produce the delegate for the anonymous method that was created.
4200 * assign.cs: API adjustments for new changes in
4201 Convert.ImplicitStandardConversionExists.
4203 * class.cs: Adjustments to cope with the fact that now toplevel
4204 blocks are of type `ToplevelBlock'.
4206 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
4207 insteda of standard blocks.
4209 Flag errors if params arguments are passed to anonymous methods.
4211 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
4212 `CurrentAnonymousMethod' which points to the current Anonymous
4213 Method. The variable points to the AnonymousMethod class that
4214 holds the code being compiled. It is set in the new EmitContext
4215 created for the anonymous method.
4217 (EmitContext.Phase): Introduce a variable and an enumeration to
4218 assist in enforcing some rules about when and where we are allowed
4219 to invoke certain methods (EmitContext.NeedsReturnLabel is the
4220 only one that enfonces this right now).
4222 (EmitContext.HaveCaptureInfo): new helper method that returns
4223 whether we have a CapturedContext initialized.
4225 (EmitContext.CaptureVariable): New method used to register that a
4226 LocalInfo must be flagged for capturing.
4228 (EmitContext.CapturedParameter): New method used to register that a
4229 parameters must be flagged for capturing.
4231 (EmitContext.CapturedField): New method used to register that a
4232 field must be flagged for capturing.
4234 (EmitContext.HaveCapturedVariables,
4235 EmitContext.HaveCapturedFields): Return whether there are captured
4236 variables or fields.
4238 (EmitContext.EmitMethodHostInstance): This is used to emit the
4239 instance for the anonymous method. The instance might be null
4240 (static methods), this (for anonymous methods that capture nothing
4241 and happen to live side-by-side with the current method body) or a
4242 more complicated expression if the method has a CaptureContext.
4244 (EmitContext.EmitTopBlock): Routine that drives the emission of
4245 code: it will first resolve the top block, then emit any metadata
4246 and then emit the code. The split is done so that we can extract
4247 any anonymous methods and flag any captured variables/parameters.
4249 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
4250 during this phase, the ILGenerator should not be used as labels
4251 and local variables declared here might not be accessible to any
4252 code that is part of an anonymous method.
4254 Exceptions to this include the temporary variables that are
4255 created by some statements internally for holding temporary
4258 (EmitContext.EmitMeta): New routine, in charge of emitting all the
4261 (EmitContext.TemporaryReturn): This method is typically called
4262 from the Emit phase, and its the only place where we allow the
4263 ReturnLabel to be defined other than the EmitMeta. The reason is
4264 that otherwise we would have to duplicate a lot of logic in the
4265 Resolve phases of various methods that today is on the Emit
4268 (EmitContext.NeedReturnLabel): This no longer creates the label,
4269 as the ILGenerator is not valid during the resolve phase.
4271 (EmitContext.EmitThis): Extended the knowledge in this class to
4272 work in anonymous methods in addition to iterators.
4274 (EmitContext.EmitCapturedVariableInstance): This emits whatever
4275 code is necessary on the stack to access the instance to a local
4276 variable (the variable will be accessed as a field).
4278 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
4279 EmitContext.EmitAddressOfParameter): Routines to support
4280 parameters (not completed at this point).
4282 Removals: Removed RemapLocal and RemapLocalLValue. We probably
4283 will also remove the parameters.
4285 * convert.cs (Convert): Define a `ConstantEC' which points to a
4286 null. This is just to prefity some code that uses
4287 ImplicitStandardConversion code and do not have an EmitContext
4290 The idea is to flag explicitly that at that point in time, it is
4291 known that the conversion will not trigger the delegate checking
4292 code in implicit conversions (which requires a valid
4295 Everywhere: pass new EmitContext parameter since
4296 ImplicitStandardConversionExists now requires it to check for
4297 anonymous method conversions.
4299 (Convert.ImplicitStandardConversionExists): If the type of an
4300 expression is the anonymous_method_type, and the type is a
4301 delegate, we invoke the AnonymousMethod.Compatible method to check
4302 whether an implicit conversion is possible.
4304 (Convert.ImplicitConversionStandard): Only do implicit method
4305 group conversions if the language level is not ISO_1.
4307 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
4308 MethodInfo for the Invoke method. used by Delegate and
4311 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
4312 method conversions if the target type is a delegate.
4314 Removed extra debugging nops.
4316 (LocalVariableReference): Turn the `local_info' into a public
4319 Add `prepared' field, the same hack used for FieldExprs to cope
4320 with composed assignments, as Local variables do not necessarily
4321 operate purely on the stack as they used to: they can be captured
4324 Add `temp' for a temporary result, like fields.
4326 Refactor DoResolve and DoResolveLValue into DoResolveBase.
4328 It now copes with Local variables that are captured and emits the
4329 proper instance variable to load it from a field in the captured
4332 (ParameterReference.DoResolveBase): During the resolve phase,
4333 capture parameters if we are in an anonymous method.
4335 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
4336 anonymous method, use the EmitContext helper routines to emit the
4337 parameter reference.
4339 * iterators.cs: Set RemapToProxy to true/false during the
4342 * parameters.cs (GetParameterByName): New helper method.
4344 * typemanager.cs (anonymous_method_type) a new type that
4345 represents an anonyous method. This is always an internal type,
4346 used as a fencepost to test against the anonymous-methodness of an
4349 2004-10-20 Marek Safar <marek.safar@seznam.cz>
4351 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
4353 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
4355 2004-10-18 Martin Baulig <martin@ximian.com>
4357 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
4358 `Type' directly, but call ResolveType() on it.
4359 (Catch.Resolve): Likewise.
4360 (Foreach.Resolve): Likewise.
4362 2004-10-18 Martin Baulig <martin@ximian.com>
4364 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
4365 `Type' directly, but call ResolveType() on it.
4366 (Probe.DoResolve): Likewise.
4367 (ArrayCreation.LookupType): Likewise.
4368 (TypeOf.DoResolve): Likewise.
4369 (SizeOf.DoResolve): Likewise.
4371 2004-10-18 Martin Baulig <martin@ximian.com>
4373 * expression.cs (Invocation.BetterFunction): Put back
4374 TypeManager.TypeToCoreType().
4376 2004-10-18 Raja R Harinath <rharinath@novell.com>
4378 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
4381 2004-10-18 Martin Baulig <martin@ximian.com>
4383 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
4384 `Type' directly, but call ResolveType() on it.
4386 2004-10-18 Martin Baulig <martin@ximian.com>
4388 * class.cs (FieldMember.Define): Don't access the TypeExpr's
4389 `Type' directly, but call ResolveType() on it.
4390 (MemberBase.DoDefine): Likewise.
4392 * expression.cs (New.DoResolve): Don't access the TypeExpr's
4393 `Type' directly, but call ResolveType() on it.
4394 (ComposedCast.DoResolveAsTypeStep): Likewise.
4396 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
4397 `Type' directly, but call ResolveType() on it.
4399 2004-10-17 John Luke <john.luke@gmail.com>
4401 * class.cs (Operator.GetSignatureForError): use CSharpName
4403 * parameter.cs (Parameter.GetSignatureForError): Returns
4404 correct name even if was not defined.
4406 2004-10-13 Raja R Harinath <rharinath@novell.com>
4409 * class.cs (TypeContainer.EmitContext): New property.
4410 (DefineNestedTypes): Create an emitcontext for each part.
4411 (MethodCore.DoDefineParameters): Use container's emitcontext.
4412 Pass type array to InternalParameters.
4413 (MemberBase.DoDefine): Use container's emitcontext.
4414 (FieldMember.Define): Likewise.
4415 (Event.Define): Likewise.
4416 (SetMethod.GetParameterInfo): Change argument to EmitContext.
4417 Pass type array to InternalParameters.
4418 (SetIndexerMethod.GetParameterInfo): Likewise.
4419 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
4420 * delegate.cs (Define): Pass emitcontext to
4421 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
4422 array to InternalParameters.
4423 * expression.cs (ParameterReference.DoResolveBase): Pass
4424 emitcontext to GetParameterInfo.
4425 (ComposedCast.DoResolveAsTypeStep): Remove check on
4426 ec.ResolvingTypeTree.
4427 * parameter.cs (Parameter.Resolve): Change argument to
4428 EmitContext. Use ResolveAsTypeTerminal.
4429 (Parameter.GetSignature): Change argument to EmitContext.
4430 (Parameters.ComputeSignature): Likewise.
4431 (Parameters.ComputeParameterTypes): Likewise.
4432 (Parameters.GetParameterInfo): Likewise.
4433 (Parameters.ComputeAndDefineParameterTypes): Likewise.
4434 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
4435 * support.cs (InternalParameters..ctor): Remove variant that takes
4437 * typemanager.cs (system_intptr_expr): New.
4438 (InitExpressionTypes): Initialize it.
4440 2004-10-12 Chris Toshok <toshok@ximian.com>
4442 * cs-parser.jay: fix location for try_statement and catch_clause.
4444 2004-10-11 Martin Baulig <martin@ximian.com>
4446 * report.cs: Don't make --fatal abort on warnings, we have
4447 -warnaserror for that.
4449 2004-10-07 Raja R Harinath <rharinath@novell.com>
4451 More DeclSpace.ResolveType avoidance.
4452 * decl.cs (MemberCore.InUnsafe): New property.
4453 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
4454 with newly created EmitContext.
4455 (FieldMember.Define): Likewise.
4456 * delegate.cs (Delegate.Define): Likewise.
4457 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
4458 only if normal name-lookup fails.
4459 (TypeExpr.DoResolve): Enable error-checking.
4460 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
4461 (SizeOf.DoResolve): Likewise.
4462 (ComposedCast.DoResolveAsTypeStep): Likewise.
4463 (StackAlloc.DoResolve): Likewise.
4464 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
4465 (Block.Unsafe): New property.
4466 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
4467 (Unsafe): Set 'unsafe' flag of contained block.
4468 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
4469 (Fixed.Resolve): Likewise.
4470 (Catch.Resolve): Likewise.
4471 (Using.ResolveLocalVariableDecls): Likewise.
4472 (Foreach.Resolve): Likewise.
4474 2004-10-05 John Luke <john.luke@gmail.com>
4476 * cs-parser.jay: add location to error CS0175
4478 2004-10-04 Miguel de Icaza <miguel@ximian.com>
4480 * ecore.cs (Expression.Constantity): Add support for turning null
4483 * const.cs (Const.Define): Allow constants to be reference types
4484 as long as the value is Null.
4486 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
4488 * namespace.cs (NamespaceEntry.Using): No matter which warning
4489 level is set, check if this namespace name has already been added.
4491 2004-10-03 Ben Maurer <bmaurer@ximian.com>
4493 * expression.cs: reftype [!=]= null should always use br[true,false].
4496 2004-10-03 Marek Safar <marek.safar@seznam.cz>
4499 * attribute.cs: Enum conversion moved to
4500 GetAttributeArgumentExpression to be applied to the all
4503 2004-10-01 Raja R Harinath <rharinath@novell.com>
4505 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
4506 * class.c (TypeContainer.DefineType): Flag error if
4507 base types aren't accessible due to access permissions.
4508 * decl.cs (DeclSpace.ResolveType): Move logic to
4509 Expression.ResolveAsTypeTerminal.
4510 (DeclSpace.ResolveTypeExpr): Thin layer over
4511 Expression.ResolveAsTypeTerminal.
4512 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
4513 Refactor code into NestedAccess. Use it.
4514 (DeclSpace.NestedAccess): New.
4515 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
4516 argument to silence errors. Check access permissions.
4517 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
4518 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
4519 (Cast.DoResolve): Likewise.
4520 (New.DoResolve): Likewise.
4521 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
4522 (TypeOf.DoResolve): Likewise.
4524 * expression.cs (Invocation.BetterConversion): Return the Type of
4525 the better conversion. Implement section 14.4.2.3 more faithfully.
4526 (Invocation.BetterFunction): Make boolean. Make correspondence to
4527 section 14.4.2.2 explicit.
4528 (Invocation.OverloadResolve): Update.
4529 (Invocation): Remove is_base field.
4530 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
4531 (Invocation.Emit): Likewise.
4533 2004-09-27 Raja R Harinath <rharinath@novell.com>
4535 * README: Update to changes.
4537 2004-09-24 Marek Safar <marek.safar@seznam.cz>
4539 * cs-parser.jay: Reverted 642 warning fix.
4541 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4544 * decl.cs (FindMemberWithSameName): Indexer can have more than
4547 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4549 * expression.cs (LocalVariableReference.DoResolveLValue):
4550 Do not report warning 219 for out values.
4551 (EmptyExpression.Null): New member to avoid extra allocations.
4553 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4555 * cs-parser.jay: Fix wrong warning 642 report.
4557 * cs-tokenizer.cs (CheckNextToken): New helper;
4558 Inspect next character if is same as expected.
4560 2004-09-23 Martin Baulig <martin@ximian.com>
4562 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
4563 (Convert.ImplicitReferenceConversionExists): Likewise.
4565 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4567 * class.cs (Operator.Define): Add error 448 and 559 report.
4569 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4571 * class.cs (MemberBase.IsTypePermitted): New protected
4572 method for checking error CS0610.
4574 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4576 * class.cs (TypeContainer.HasExplicitLayout): New property
4577 Returns whether container has StructLayout attribute set Explicit.
4578 (FieldMember): New abstract class for consts and fields.
4579 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
4580 (Field): Reuse FieldMember.
4582 * const.cs (Const): Reuse FieldMember.
4584 * rootcontext.cs: EmitConstants call moved to class.
4586 2004-09-22 Martin Baulig <martin@ximian.com>
4588 Thanks to Peter Sestoft for this bug report.
4590 * expression.cs (Conditional): If both the `trueExpr' and the
4591 `falseExpr' is a NullLiteral, return a NullLiteral.
4593 2004-09-22 Martin Baulig <martin@ximian.com>
4595 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
4596 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
4597 for the "get_Current" call.
4599 2004-09-22 Martin Baulig <martin@ximian.com>
4601 Marek and me just fixed one of our oldest bugs: #28562 :-)
4603 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
4605 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
4606 we're an EnumConstant, just return that.
4607 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
4608 an EnumConstant. In this case, we need to use GetValueAsEnumType()
4609 to get the value which'll actually be written into the attribute.
4610 However, we have to use GetValue() to access the attribute's value
4613 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4615 * constant.cs (Constant.IsNegative): New abstract property
4618 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
4619 (StackAlloc.DoResolve): Reused IsNegative.
4621 2004-09-21 Martin Baulig <martin@ximian.com>
4623 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
4624 if we're used in an iterator, we may be called from different
4627 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
4628 we actually have an exception block.
4630 2004-09-20 John Luke <jluke@cfl.rr.com>
4632 * class.cs, cs-parser.jay: Improve the error report for 1520:
4633 report the actual line where the error happens, not where the
4636 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
4637 Pass location information that was available elsewhere.
4639 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
4641 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
4642 runtime to delay sign assemblies.
4644 2004-09-19 Miguel de Icaza <miguel@ximian.com>
4646 * cs-parser.jay: Do not report the stack trace, this is barely
4649 2004-08-22 John Luke <john.luke@gmail.com>
4651 * driver.cs : check that a resource id is not already used
4652 before adding it, report CS1508 if it is, bug #63637
4654 2004-09-19 Miguel de Icaza <miguel@ximian.com>
4656 * ecore.cs: Removed dead code.
4658 2004-09-18 Marek Safar <marek.safar@seznam.cz>
4660 * class.cs: Do not report warning CS0067 on the interfaces.
4662 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4664 * cs-parser.jay: Add error 504 report.
4666 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4668 * rootcontext.cs: WarningLevel is 4 by default now.
4670 * statement.cs (Fixed.Resolve): Do not null
4673 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4676 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
4677 deep search when property is not virtual.
4678 (PropertyExpr.ResolveAccessors): Make one call for both
4681 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4684 * statement.cs: Error 152 report constains also location.
4686 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4689 * const.cs: Explicitly set constant as static.
4691 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4694 * cs-parser.jay: Add error 1017 report.
4696 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4698 Fixed bug #59980, #64224
4699 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
4701 * typemanager.cs (IsSpecialMethod): Simplified
4703 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4705 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
4706 condition with better params.
4708 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4711 * attribute.cs (Resolve): Property has to have both
4714 2004-09-14 Martin Baulig <martin@ximian.com>
4716 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
4718 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4721 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
4722 called and is obsolete then this member suppress message
4723 when call is inside next [Obsolete] method or type.
4725 * expression.cs: Use TestObsoleteMethodUsage member.
4727 2004-09-14 Martin Baulig <martin@ximian.com>
4729 * cs-parser.jay: Sync a bit with the GMCS version.
4731 2004-09-14 Martin Baulig <martin@ximian.com>
4733 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
4734 (CSharpParser.yacc_verbose_flag): New public field.
4736 * genericparser.cs: Removed.
4738 2004-09-14 Raja R Harinath <rharinath@novell.com>
4740 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
4742 2004-09-13 Marek Safar <marek.safar@seznam.cz>
4744 * class.cs (MethodCore.CheckBase): Fix bug #65757.
4746 2004-09-10 Martin Baulig <martin@ximian.com>
4748 Backported my MemberName changes from GMCS into MCS.
4750 - we are now using a special `MemberName' class instead of using
4751 strings; in GMCS, the `MemberName' also contains the type
4754 - changed the grammar rules a bit:
4755 * the old `member_name' is now a `namespace_or_type_name':
4756 The rule is that we use `namespace_or_type_name' everywhere
4757 where we expect either a "member name" (GetEnumerator) or a
4758 "member name" with an explicit interface name
4759 (IEnumerable.GetEnumerator).
4760 In GMCS, the explicit interface name may include type arguments
4761 (IEnumerable<T>.GetEnumerator).
4762 * we use `member_name' instead of just `IDENTIFIER' for
4764 The rule is that we use `member_name' wherever a member may
4765 have type parameters in GMCS.
4767 * decl.cs (MemberName): New public class.
4768 (MemberCore.MemberName): New public readonly field.
4769 (MemberCore.ctor): Take a `MemberName' argument, not a string.
4770 (DeclSpace): Likewise.
4772 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
4773 * enum.cs (Enum.ctor): Likewise.
4775 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
4777 (AliasEntry.ctor): Take a MemberName, not an Expression.
4778 (AliasEntry.UsingAlias): Likewise.
4780 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
4781 (IMethodData.MemberName): Changed type from string to MemberName.
4782 (MemberBase.ExplicitInterfaceName): Likewise.
4783 (AbstractPropertyEventMethod.SetupName): Make this private.
4784 (AbstractPropertyEventMethod.ctor): Added `string prefix'
4785 argument; compute the member name here.
4786 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
4787 on the `member.MemberName' and the `prefix'.
4789 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
4791 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
4792 thus, we get a `MemberName' instead of a `string'. These
4793 declarations may have type parameters in GMCS.
4794 (interface_method_declaration, delegate_declaration): Likewise.
4795 (class_declaration, interface_declaration): Likewise.
4796 (method_header): Use `namespace_or_type_name' instead of
4797 `member_name'. We may be an explicit interface implementation.
4798 (property_declaration, event_declaration): Likewise.
4799 (member_name): This is now just an `IDENTIFIER', not a
4800 `namespace_or_type_name'.
4801 (type_name, interface_type): Removed.
4802 (namespace_or_type_name): Return a MemberName, not an Expression.
4803 (primary_expression): Use `member_name' instead of `IDENTIFIER';
4804 call GetTypeExpression() on the MemberName to get an expression.
4805 (IndexerDeclaration.interface_type): Changed type from string to
4807 (MakeName): Operate on MemberName's instead of string's.
4809 2004-09-13 Raja R Harinath <rharinath@novell.com>
4812 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
4813 (NamespaceEntry.Lookup): Add new argument to flag if we want the
4814 lookup to avoid symbols introduced by 'using'.
4815 * rootcontext.cs (NamespaceLookup): Update.
4817 2004-09-12 Marek Safar <marek.safar@seznam.cz>
4819 * class.cs (TypeContainer.DoDefineMembers): Do not call
4820 DefineDefaultConstructor for static classes.
4822 2004-09-12 Marek Safar <marek.safar@seznam.cz>
4824 * attribute.cs (Attribute.Resolve): Add error 653 report.
4826 * class.cs (Class.ApplyAttributeBuilder): Add error 641
4828 (Method.ApplyAttributeBuilder): Add error 685 report.
4829 (Operator.Define): Add error 564 report.
4831 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
4833 * expression.cs (Invocation.DoResolve): Add error
4836 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
4839 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4841 * class.cs (ConstructorInitializer.Resolve):
4842 Wrong error number (515->516).
4844 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4846 * class.cs (Indexer.Define): Add error 631 report.
4848 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4850 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
4852 2004-09-11 Marek Safar <marek.safar@seznam.cz>
4854 * expression.cs (Probe.DoResolve): Add error CS0241 report.
4856 2004-09-10 Marek Safar <marek.safar@seznam.cz>
4858 * cs-parser.jay: Added error CS0241 report.
4860 2004-09-10 Raja R Harinath <rharinath@novell.com>
4862 * cs-parser.jay (fixed_statement): Introduce a scope for the
4863 declaration in the 'fixed' statement.
4865 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4867 * cs-parser.jay: Added CS0230 error report.
4869 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4871 * cs-parser.jay: Added errors CS0231 and CS0257 report.
4873 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4875 * expression.cs (Argument.Resolve): Added error CS0192 and
4878 2004-09-09 Marek Safar <marek.safar@seznam.cz>
4880 C# 2.0 #pragma warning feature
4882 * cs-tokenizer.cs (PreProcessPragma): New method;
4883 Handles #pragma directive.
4885 * report.cs (WarningRegions): New class; Support
4886 class for #pragma warning directive. It tests whether
4887 warning is enabled for a given line.
4889 2004-09-08 Miguel de Icaza <miguel@ximian.com>
4891 * const.cs: Add more descriptive error report, tahnks to
4894 2004-09-08 Marek Safar <marek.safar@seznam.cz>
4896 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
4898 2004-09-07 Miguel de Icaza <miguel@ximian.com>
4900 * expression.cs: Apply patch from Ben: Remove dead code from
4901 ArrayCreation, and remove the TurnintoConstant call in const.cs,
4902 as that code just threw an exception anwyays.
4904 * const.cs: Remove the call to the turnintoconstant, for details
4907 * literal.cs: The type of the null-literal is the null type; So
4908 we use a placeholder type (literal.cs:System.Null, defined here)
4911 * expression.cs (Conditional.DoResolve): Remove some old code that
4912 is no longer needed, conversions have been fixed.
4914 (ArrayCreationExpression.DoResolve): Return false if we fail to
4915 resolve the inner expression.
4917 2004-09-07 Raja R Harinath <rharinath@novell.com>
4920 * cs-parser.jay (delegate_declaration): Record a delegate
4921 declaration as a type declaration.
4922 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
4924 2004-09-06 Miguel de Icaza <miguel@ximian.com>
4926 * parameter.cs: Do not crash if the type can not be resolved.
4928 * expression.cs: Report errors with unsafe pointers, fixes #64896
4930 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
4932 * expression.cs: Pointer arith always needs to do a conv.i
4933 if the operand is a long. fix 65320
4935 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4937 Fixed cs0619-37.cs, cs0619-38.cs
4939 * enum.cs (GetObsoleteAttribute): Removed.
4941 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
4942 on Enum member is double staged. The first is tested member
4945 2004-09-04 Marek Safar <marek.safar@seznam.cz>
4947 Fixed #56986, #63631, #65231
4949 * class.cs: (TypeContainer.AddToMemberContainer): New method,
4950 adds member to name container.
4951 (TypeContainer.AddToTypeContainer): New method, adds type to
4953 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
4954 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
4955 AddOperator): Simplified by reusing AddToMemberContainer.
4956 (TypeContainer.UserDefinedStaticConstructor): Changed to property
4958 (Method.CheckForDuplications): Fixed implementation to test all
4960 (MemberBase): Detection whether member is explicit interface
4961 implementation is now in constructor.
4962 (MemberBase.UpdateMemberName): Handles IndexerName.
4963 (Accessor): Changed to keep also location information.
4964 (AbstractPropertyEventMethod): Is derived from MemberCore.
4965 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
4966 will be emited or not.
4967 (PropertyBase.AreAccessorsDuplicateImplementation):
4968 Tests whether accessors are not in collision with some method.
4969 (Operator): Is derived from MethodCore to simplify common
4972 * decl.cs (Flags.TestMethodDuplication): Test for duplication
4974 (DeclSpace.AddToContainer): Adds the member to defined_names
4975 table. It tests for duplications and enclosing name conflicts.
4977 * enum.cs (EnumMember): Clean up to reuse the base structures
4979 2004-09-03 Martin Baulig <martin@ximian.com>
4981 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
4982 into TypeContainer, to make partial classes work again.
4984 2004-09-03 Martin Baulig <martin@ximian.com>
4986 * rootcontext.cs (RootContext.V2): Removed.
4988 2004-03-23 Martin Baulig <martin@ximian.com>
4990 * expression.cs (Invocation.OverloadResolve): Added `bool
4991 may_fail' argument and use it instead of the Location.IsNull() hack.
4993 2004-09-03 Martin Baulig <martin@ximian.com>
4995 Merged latest changes into gmcs. Please keep this comment in
4996 here, it makes it easier for me to see what changed in MCS since
4997 the last time I merged.
4999 2004-09-03 Raja R Harinath <rharinath@novell.com>
5002 * expression.cs (BetterConversion): Don't allow either conversion
5003 to be null. Remove redundant implicit conversion test when 'q ==
5004 null' -- when this function is invoked, we already know that the
5005 implicit conversion exists.
5006 (BetterFunction): Assume that 'best' is non-null. Remove
5007 redundant reimplementation of IsApplicable when 'best' is null.
5008 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
5009 number of arguments.
5010 (IsAncestralType): Extract from OverloadResolve.
5011 (OverloadResolve): Make robust to the MethodGroupExpr being
5012 unsorted. Implement all the logic of Section 14.5.5.1, and
5013 support overloading of methods from multiple applicable types.
5014 Clean up logic somewhat. Don't pass null methods to BetterFunction.
5016 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
5017 (RealError, Warning): Append type of report to related symbol.
5019 2004-09-03 Marek Safar <marek.safar@seznam.cz>
5021 * enum.cs: Fixed CLS-Compliance checks for enum members.
5022 Error tests cs3008-8.cs, cs3014-8.cs
5024 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5026 Fixed bug #62342, #63102
5027 * class.cs: ImplementIndexer uses member.IsExplicitImpl
5028 like ImplementMethod.
5030 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5032 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5035 2004-09-02 Martin Baulig <martin@ximian.com>
5037 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5038 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5041 2004-09-01 Marek Safar <marek.safar@seznam.cz>
5043 C# 2.0 Static classes implemented
5045 * class.cs (TypeContainer): instance_constructors,
5046 initialized_fields, initialized_static_fields,
5047 default_constructor, base_inteface_types are protected to be
5048 accessible from StaticClass.
5049 (TypeContainer.DefineDefaultConstructor): New virtual method
5050 for custom default constructor generating
5051 (StaticClass): New class to handle "Static classes" feature.
5053 * cs-parser.jay: Handle static keyword on class like instance
5056 * driver.cs: Added "/langversion" command line switch with two
5057 options (iso-1, default).
5059 2004-08-31 Marek Safar <marek.safar@seznam.cz>
5061 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
5063 2004-08-31 Miguel de Icaza <miguel@ximian.com>
5065 * delegate.cs: Style.
5067 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
5069 * delegate.cs: Add seperate instance expr field for miguel.
5071 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5073 * PointerArithmetic (Resolve): make sure we are not doing
5074 pointer arith on void*. Also, make sure we are resolved
5075 by not setting eclass until resolve.
5077 All callers: Make sure that PointerArithmetic gets resolved.
5079 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5081 * ArrayCreation (LookupType): If the type does not resolve
5082 to an array, give an error.
5084 2004-08-27 Marek Safar <marek.safar@seznam.cz>
5086 * statement.cs (Try.Resolve): Fixed bug #64222
5088 2004-08-27 Martin Baulig <martin@ximian.com>
5091 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5094 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5096 * ecore.cs (Constantify): Get underlying type via
5097 System.Enum.GetUnderlyingType to avoid StackOverflow on the
5098 Windows in special cases.
5100 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5102 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
5103 for obtaining also private methods.
5104 (GetRemoveMethod): Used GetRemoveMethod (true)
5105 for obtaining also private methods.
5107 2004-08-24 Martin Baulig <martin@ximian.com>
5109 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5110 MethodAttributes.HideBySig for operators.
5112 2004-08-23 Martin Baulig <martin@ximian.com>
5114 Back to the old error reporting system :-)
5116 * report.cs (Message): Removed.
5117 (Report.MessageData, ErrorData, WarningData): Removed.
5118 (Report.Error, Warning): Back to the old system.
5120 2004-08-23 Martin Baulig <martin@ximian.com>
5122 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5124 * class.cs (TypeContainer.ParentContainer): New public virtual
5125 method; replaces the explicit interface implementation.
5126 (ClassPart.ParentContainer): Override.
5128 2004-08-23 Martin Baulig <martin@ximian.com>
5130 * statement.cs (Switch): Added support for constant switches; see
5131 #59428 or test-285.cs.
5133 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5136 * statement.cs (GetEnumeratorFilter): Removed useless
5137 logic because C# specs is strict. GetEnumerator must be
5140 2004-08-22 Martin Baulig <martin@ximian.com>
5142 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5143 a switch and may break, reset the barrier. Fixes #59867.
5145 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5147 CLS-Compliance speed up (~5% for corlib)
5149 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5150 New method. Tests container for CLS-Compliant names
5152 * class.cs (TypeContainer.VerifyClsName): New method.
5153 Checks whether container name is CLS Compliant.
5154 (Constructor): Implements IMethodData.
5156 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5157 low-case table for CLS Compliance test.
5158 (MemberCache.VerifyClsParameterConflict): New method.
5159 Checks method parameters for CS3006 error.
5161 * enum.cs (EnumMember): Is derived from MemberCore.
5162 (Enum.VerifyClsName): Optimized for better performance.
5164 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5166 * report.cs: Renamed Error_T to Error and changed all
5169 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5171 * class.cs (TypeContainer.IndexerArrayList): New inner class
5172 container for indexers.
5173 (TypeContainer.DefaultIndexerName): New constant for default
5174 indexer name. Replaced all "Item" with this constant.
5175 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5177 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5178 DefaultMemberAttribute constructor.
5180 2004-08-05 Martin Baulig <martin@ximian.com>
5182 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5185 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5187 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5188 multi platforms problem.
5190 * compiler.csproj: Included shared files.
5192 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5194 Fix bug 60333, 55971 in the more general way
5195 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5196 Added arg_type argument for constant conversion.
5197 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5199 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5202 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5203 OperatorArrayList, MethodCoreArrayList for typecontainer
5204 containers. Changed class member types to these new types.
5205 (MethodArrayList.DefineMembers): Added test for CS0659.
5207 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5209 * cfold.cs: Synchronize the folding with the code in expression.cs
5210 Binary.DoNumericPromotions for uint operands.
5212 * attribute.cs: Revert patch from Raja, it introduced a regression
5213 while building Blam-1.2.1 (hard to isolate a test case).
5215 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5219 (TypeContainer.Define): Renamed to DefineContainerMembers because of
5221 (MethodCore.parent_method): New member. The method we're overriding
5222 if this is an override method.
5223 (MethodCore.CheckBase): Moved from Method class and made common.
5224 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
5226 (MethodCore.CheckForDuplications): New abstract method. For custom
5227 member duplication search in a container
5228 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
5229 method and its return type.
5230 (Event.conflict_symbol): New member. Symbol with same name in the
5234 (MemberCache.FindMemberWithSameName): New method. The method
5235 is looking for conflict with inherited symbols.
5237 2004-08-04 Martin Baulig <martin@ximian.com>
5239 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5241 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5243 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5245 * report.cs (Message): New enum for better error, warning reference in
5247 (MessageData): New inner abstract class. It generally handles printing of
5248 error and warning messages.
5249 Removed unused Error, Warning, Message methods.
5251 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5253 Fix for cs0592-8.cs test
5255 (Attributable.ValidAttributeTargets): Made public.
5256 (Attribute.ExplicitTarget): New member for explicit target value.
5257 (Attribute.CheckTargets): Now we translate explicit attribute
5258 target to Target here.
5260 2004-08-03 Ben Maurer <bmaurer@ximian.com>
5262 * ecore.cs (MethodGroupExpr): new IsBase property.
5264 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
5266 * delegate.cs (DelegateCreation): store a MethodGroupExpr
5267 rather than an instance expr.
5269 (DelegateCreation.Emit): Use the method group rather than
5270 the instance expression. Also, if you have base.Foo as the
5271 method for a delegate, make sure to emit ldftn, not ldftnvirt.
5273 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
5275 (NewDelegate.DoResolve): Only check for the existance of Invoke
5276 if the method is going to be needed. Use MethodGroupExpr.
5278 (NewDelegate.Emit): Remove, DelegateCreation implements this.
5280 * expression.cs: For pointer arith., make sure to use
5281 the size of the type, not the size of the pointer to
5284 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5287 * class.cs (Class): Added error CS0502 test.
5289 2004-08-03 John Luke <jluke@cfl.rr.com>
5290 Raja R Harinath <rharinath@novell.com>
5293 * attribute.cs (Attribute.complained_before): New flag.
5294 (Attribute.ResolveType, Attribute.Resolve),
5295 (Attribute.DefinePInvokeMethod): Set it.
5296 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
5298 2004-08-03 Martin Baulig <martin@ximian.com>
5300 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5301 use a user-defined operator; we still need to do numeric
5302 promotions in case one argument is a builtin type and the other
5303 one has an implicit conversion to that type. Fixes #62322.
5305 2004-08-02 Martin Baulig <martin@ximian.com>
5307 * statement.cs (LocalInfo.Flags): Added `IsThis'.
5308 (LocalInfo.IsThis): New public property.
5309 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
5311 2004-08-01 Martin Baulig <martin@ximian.com>
5313 * class.cs (TypeContainer.GetClassBases): Don't set the default
5314 here since we may get called from GetPartialBases().
5315 (TypeContainer.DefineType): If GetClassBases() didn't return a
5316 parent, use the default one.
5318 2004-07-30 Duncan Mak <duncan@ximian.com>
5320 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
5322 2004-07-30 Martin Baulig <martin@ximian.com>
5324 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
5326 * class.cs (SourceMethod): New public class, derive from the
5327 symbol writer's ISourceMethod.
5328 (Method): Use the new symbol writer API.
5330 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
5331 as argument and use the new symbol writer.
5334 (SourceFile): Implement the symbol writer's ISourceFile.
5335 (Location.SymbolDocument): Removed.
5336 (Location.SourceFile): New public property.
5338 * symbolwriter.cs: Use the new symbol writer API.
5340 2004-07-30 Raja R Harinath <rharinath@novell.com>
5342 * Makefile (install-local): Remove. Functionality moved to
5345 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
5347 * Makefile: Install mcs.exe.config file together with mcs.exe.
5348 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
5349 correct runtime version.
5351 2004-07-25 Martin Baulig <martin@ximian.com>
5354 (TypeContainer.RegisterOrder): Removed, this was unused.
5355 (TypeContainer, interface_order): Removed.
5356 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
5357 TypeContainer as argument since we can also be called with a
5358 `PartialContainer' for a partial class/struct/interface.
5359 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
5360 of checking whether we're an `Interface' - we could be a
5362 (PartialContainer.Register): Override; call
5363 AddClass()/AddStruct()/AddInterface() on our parent.
5365 * cs-parser.jay (interface_member_declaration): Add things to the
5366 `current_container', not the `current_class'.
5368 * rootcontext.cs (RegisterOrder): The overloaded version which
5369 takes an `Interface' was unused, removed.
5371 * typemanager.cs (TypeManager.LookupInterface): Return a
5372 `TypeContainer', not an `Interface'.
5373 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
5374 contain a `PartialContainer' for an interface, so check it's
5375 `Kind' to figure out what it is.
5377 2004-07-25 Martin Baulig <martin@ximian.com>
5379 * class.cs (Class.DefaultTypeAttributes): New public constant.
5380 (Struct.DefaultTypeAttributes): Likewise.
5381 (Interface.DefaultTypeAttributes): Likewise.
5382 (PartialContainer.TypeAttr): Override this and add the
5383 DefaultTypeAttributes.
5385 2004-07-25 Martin Baulig <martin@ximian.com>
5387 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
5388 we can just use the `Parent' field instead.
5390 2004-07-25 Martin Baulig <martin@ximian.com>
5392 * class.cs (TypeContainer.Emit): Renamed to EmitType().
5394 2004-07-25 Martin Baulig <martin@ximian.com>
5396 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
5397 our parts before defining any methods.
5398 (TypeContainer.VerifyImplements): Make this virtual.
5399 (ClassPart.VerifyImplements): Override and call VerifyImplements()
5400 on our PartialContainer.
5402 2004-07-25 Martin Baulig <martin@ximian.com>
5404 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
5406 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
5407 argument, we can just use the `Parent' field instead.
5410 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
5411 (MemberBase.DoDefine): Likewise.
5413 2004-07-24 Martin Baulig <martin@ximian.com>
5415 * decl.cs (MemberCore.Parent): New public field.
5416 (DeclSpace.Parent): Moved to MemberCore.
5418 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
5419 (MemberBase.ctor): Added TypeContainer argument, pass it to our
5421 (FieldBase, Field, Operator): Likewise.
5422 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
5423 (EventField, Event): Likewise.
5425 2004-07-23 Martin Baulig <martin@ximian.com>
5427 * class.cs (PartialContainer): New public class.
5428 (ClassPart): New public class.
5429 (TypeContainer): Added support for partial classes.
5430 (TypeContainer.GetClassBases): Splitted some of the functionality
5431 out into GetNormalBases() and GetPartialBases().
5433 * cs-tokenizer.cs (Token.PARTIAL): New token.
5434 (Tokenizer.consume_identifier): Added some hacks to recognize
5435 `partial', but only if it's immediately followed by `class',
5436 `struct' or `interface'.
5438 * cs-parser.jay: Added support for partial clases.
5440 2004-07-23 Martin Baulig <martin@ximian.com>
5442 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
5443 a `DeclSpace' and also made it readonly.
5444 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
5445 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
5446 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
5448 * cs-parser.jay: Pass the `current_class', not the
5449 `current_container' (at the moment, this is still the same thing)
5450 to a new Method, Property, Event, Indexer or Constructor.
5452 2004-07-23 Martin Baulig <martin@ximian.com>
5454 * cs-parser.jay (CSharpParser): Added a new `current_class' field
5455 and removed the `current_interface' one.
5456 (struct_declaration, class_declaration, interface_declaration):
5457 Set `current_class' to the newly created class/struct/interface;
5458 set their `Bases' and call Register() before parsing their body.
5460 2004-07-23 Martin Baulig <martin@ximian.com>
5462 * class.cs (Kind): New public enum.
5463 (TypeContainer): Made this class abstract.
5464 (TypeContainer.Kind): New public readonly field.
5465 (TypeContainer.CheckDef): New public method; moved here from
5467 (TypeContainer.Register): New public abstract method.
5468 (TypeContainer.GetPendingImplementations): New public abstract
5470 (TypeContainer.GetClassBases): Removed the `is_class' and
5471 `is_iface' parameters.
5472 (TypeContainer.DefineNestedTypes): Formerly known as
5474 (ClassOrStruct): Made this class abstract.
5476 * tree.cs (RootTypes): New public type.
5478 2004-07-20 Martin Baulig <martin@ximian.com>
5480 * tree.cs (Tree.RecordNamespace): Removed.
5481 (Tree.Namespaces): Removed.
5483 * rootcontext.cs (RootContext.IsNamespace): Removed.
5485 * cs-parser.jay (namespace_declaration): Just create a new
5486 NamespaceEntry here.
5488 2004-07-20 Martin Baulig <martin@ximian.com>
5490 * statement.cs (ExceptionStatement): New abstract class. This is
5491 now used as a base class for everyone who's using `finally'.
5492 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
5493 our local variables before using them.
5495 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
5496 virtual method. This is used by Yield.Resolve() to "steal" an
5497 outer block's `finally' clauses.
5498 (FlowBranchingException): The .ctor now takes an ExceptionStatement
5501 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
5502 version which takes an ExceptionStatement. This version must be
5503 used to create exception branchings.
5506 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
5507 (Iterator.EmitMoveNext): Added exception support; protect the
5508 block with a `fault' clause, properly handle 'finally' clauses.
5509 (Iterator.EmitDispose): Run all the `finally' clauses here.
5511 2004-07-20 Martin Baulig <martin@ximian.com>
5513 * iterator.cs: This is the first of a set of changes in the
5514 iterator code. Match the spec more closely: if we're an
5515 IEnumerable, then GetEnumerator() must be called. The first time
5516 GetEnumerator() is called, it returns the current instance; all
5517 subsequent invocations (if any) must create a copy.
5519 2004-07-19 Miguel de Icaza <miguel@ximian.com>
5521 * expression.cs: Resolve the constant expression before returning
5524 2004-07-19 Martin Baulig <martin@ximian.com>
5526 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
5527 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
5528 the return type of the new EmitContext.
5530 2004-07-18 Martin Baulig <martin@ximian.com>
5532 * class.cs (Property.Define): Fix iterators.
5534 * iterators.cs (Iterator.Define): Moved the
5535 `container.AddInterator (this)' call here from the .ctor; only do
5536 it if we resolved successfully.
5538 2004-07-17 Miguel de Icaza <miguel@ximian.com>
5540 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
5541 `true' for preprocessing directives that we parse. The return
5542 value indicates whether we should return to regular tokenizing or
5543 not, not whether it was parsed successfully.
5545 In the past if we were in: #if false ... #line #endif, we would
5546 resume parsing after `#line'. See bug 61604.
5548 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
5549 building: IsEnumType should return true only for enums, not for
5550 enums or System.Enum itself. This fixes #61593.
5552 Likely what happened is that corlib was wrong: mcs depended on
5553 this bug in some places. The bug got fixed, we had to add the
5554 hack, which caused bug 61593.
5556 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
5557 that was a workaround for the older conditions.
5559 2004-07-16 Ben Maurer <bmaurer@ximian.com>
5561 * assign.cs: IAssignMethod has a new interface, as documented
5562 inline. All assignment code now uses this new api.
5564 * ecore.cs, expression.cs: All classes which implement
5565 IAssignMethod now use the new interface.
5567 * expression.cs (Invocation): add a hack to EmitCall so that
5568 IndexerAccess can be the target of a compound assignment without
5569 evaluating its arguments twice.
5571 * statement.cs: Handle changes in Invocation api.
5573 2004-07-16 Martin Baulig <martin@ximian.com>
5575 * iterators.cs: Rewrote this. We're now using one single Proxy
5576 class for both the IEnumerable and the IEnumerator interface and
5577 `Iterator' derives from Class so we can use the high-level API.
5579 * class.cs (TypeContainer.AddIterator): New method.
5580 (TypeContainer.DoDefineType): New protected virtual method, which
5581 is called from DefineType().
5582 (TypeContainer.DoDefineMembers): Call DefineType() and
5583 DefineMembers() on all our iterators.
5584 (TypeContainer.Emit): Call Emit() on all our iterators.
5585 (TypeContainer.CloseType): Call CloseType() on all our iterators.
5587 * codegen.cs (EmitContext.CurrentIterator): New public field.
5589 2004-07-15 Martin Baulig <martin@ximian.com>
5592 (TypeManager.not_supported_exception_type): New type.
5594 2004-07-14 Martin Baulig <martin@ximian.com>
5596 * iterators.cs: Use real error numbers.
5598 2004-07-14 Martin Baulig <martin@ximian.com>
5600 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
5601 requires this to be a System.Collection.IEnumerable and not a
5602 class implementing that interface.
5603 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
5605 2004-07-13 Marek Safar <marek.safar@seznam.cz>
5607 * class.cs: Fixed previous fix, it broke some error tests.
5609 2004-07-12 Martin Baulig <martin@ximian.com>
5611 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
5614 2004-07-09 Miguel de Icaza <miguel@ximian.com>
5616 * assign.cs (LocalTemporary): Add new argument: is_address,If
5617 `is_address' is true, then the value that we store is the address
5618 to the real value, and not the value itself.
5620 * ecore.cs (PropertyExpr): use the new local temporary
5621 stuff to allow us to handle X.Y += z (where X is a struct)
5623 2004-07-08 Martin Baulig <martin@ximian.com>
5625 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
5626 not always return, just like we're doing in Using.Resolve().
5628 2004-07-07 Miguel de Icaza <miguel@ximian.com>
5630 * cs-parser.jay (fixed_statement): flag this as Pinned.
5632 2004-07-06 Miguel de Icaza <miguel@ximian.com>
5634 * typemanager.cs (TypeManager): Removed MakePinned method, this
5635 mechanism is replaced with the .NET 2.x compatible mechanism of
5636 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
5638 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
5639 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
5640 `IsFixed' property which has a different meaning.
5642 2004-07-02 Raja R Harinath <rharinath@novell.com>
5644 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
5645 visible from inside a nested class, not just the names of the
5646 immediately enclosing class.
5649 2004-06-24 Raja R Harinath <rharinath@novell.com>
5651 * expression.cs (BetterConversion): Remove buggy special-case
5652 handling of "implicit constant expression conversions". At this
5653 point, we already know that the conversion is possible -- we're
5654 only checking to see which is better.
5656 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5658 * cs-parser.jay: Added error CS0210 test.
5660 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5662 * cs-parser.jay: Added error CS0134 test.
5664 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5667 * cs-parser.jay: Added error CS0145 test.
5669 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5671 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
5673 2004-06-23 Ben Maurer <bmaurer@ximian.com>
5675 * expression.cs (StackAlloc.Resolve): The argument may not
5676 be a constant; deal with this case.
5678 2004-06-23 Marek Safar <marek.safar@seznam.cz>
5680 * attribute.cs (IndexerName_GetIndexerName): Renamed to
5681 GetIndexerAttributeValue.
5682 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
5684 * class.cs (Indexer.Define): Added error tests for CS0415,
5687 2004-06-23 Miguel de Icaza <miguel@ximian.com>
5689 * attribute.cs (Attribute.Resolve): Keep field code in sync with
5692 2004-06-23 Martin Baulig <martin@ximian.com>
5694 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
5695 neither return nor throw, reset the barrier as well. Fixes #60457.
5697 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
5699 * class.cs : EventAttributes is now set to None by default.
5700 This fixes bug #60459.
5702 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5705 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5706 Don't throw exception but return null (it's sufficient now).
5708 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5710 * typemanager.cs (GetArgumentTypes): Faster implementation.
5712 2004-06-18 Martin Baulig <martin@ximian.com>
5714 * attribute.cs (Attribute.Resolve): Check whether we're an
5715 EmptyCast which a Constant child. Fixes #60333.
5717 2004-06-17 Ben Maurer <bmaurer@ximian.com>
5719 * statement.cs (EmitCollectionForeach): Account for the fact that
5720 not all valuetypes are in areas which we can take the address of.
5721 For these variables, we store to a temporary variable. Also, make
5722 sure that we dont emit a `callvirt' on a valuetype method.
5724 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5726 * expression.cs (StackAlloc.DoReSolve): Added test for
5727 negative parameter (CS0247).
5729 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5732 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
5734 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5737 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
5740 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5742 Fix bug #58254 & cs1555.cs, cs1556.cs
5743 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
5745 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5747 * cs-parser.jay: Added error CS1669 test for indexers.
5749 2004-06-11 Martin Baulig <martin@ximian.com>
5751 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
5752 call this twice: for params and varargs methods.
5754 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5757 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
5759 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5761 * attribute.cs (Attribute.GetValidTargets): Made public.
5764 (AbstractPropertyEventMethod): New class for better code sharing.
5765 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
5767 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
5769 2004-06-11 Raja R Harinath <rharinath@novell.com>
5772 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
5773 that the call to Resolve is part of a MemberAccess.
5774 (Expression.Resolve): Use it for SimpleName resolution.
5775 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
5776 Add 'intermediate' boolean argument.
5777 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
5778 error message when the SimpleName can be resolved ambiguously
5779 between an expression and a type.
5780 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
5782 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
5783 call on the left-side.
5785 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5788 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
5790 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5792 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
5794 2004-06-11 Martin Baulig <martin@ximian.com>
5796 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
5797 varargs methods if applicable.
5799 2004-06-11 Martin Baulig <martin@ximian.com>
5801 * expression.cs (Invocation.EmitCall): Don't use
5802 `method.CallingConvention == CallingConventions.VarArgs' since the
5803 method could also have `CallingConventions.HasThis'.
5805 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5807 * class.cs (Event.GetSignatureForError): Implemented.
5808 Fixed crash in error test cs3010.cs
5810 2004-06-10 Miguel de Icaza <miguel@ximian.com>
5812 * cs-tokenizer.cs: Change the way we track __arglist to be
5813 consistent with the other keywords.
5815 2004-06-09 Miguel de Icaza <miguel@ximian.com>
5817 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
5820 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
5822 * codegen.cs: Check that all referenced assemblies have a strongname
5823 before strongnaming the compiled assembly. If not report error CS1577.
5824 Fix bug #56563. Patch by Jackson Harper.
5825 * typemanager.cs: Added a method to return all referenced assemblies.
5826 Fix bug #56563. Patch by Jackson Harper.
5828 2004-06-08 Marek Safar <marek.safar@seznam.cz>
5831 (Method.ApplyAttributeBuilder): Moved and added conditional
5832 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
5835 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
5837 2004-06-08 Marek Safar <marek.safar@seznam.cz>
5840 * class.cs: (EventField.attribute_targets): Changed default target.
5842 2004-06-08 Martin Baulig <martin@ximian.com>
5844 * expression.cs (Invocation.EmitCall): Enable varargs methods.
5846 2004-06-08 Martin Baulig <martin@ximian.com>
5848 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
5850 2004-06-07 Martin Baulig <martin@ximian.com>
5852 Added support for varargs methods.
5854 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
5857 * cs-parser.jay: Added support for `__arglist'.
5859 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
5861 * expression.cs (Argument.AType): Added `ArgList'.
5862 (Invocation): Added support for varargs methods.
5863 (ArglistAccess): New public class.
5864 (Arglist): New public class.
5866 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
5868 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
5869 a method's top-level block if the method has varargs.
5871 * support.cs (ReflectionParameters, InternalParameters): Added
5872 support for varargs methods.
5874 2004-06-07 Miguel de Icaza <miguel@ximian.com>
5876 * class.cs: Provide location in indexer error report.
5878 * driver.cs: Use standard names.
5880 * namespace.cs: Catch the use of using after a namespace has been
5881 declared also on using aliases.
5883 2004-06-03 Raja R Harinath <rharinath@novell.com>
5886 * typemanager.cs (closure_private_ok, closure_invocation_type)
5887 (closure_qualifier_type, closure_invocation_assembly)
5888 (FilterWithClosure): Move to ...
5889 (Closure): New internal nested class.
5890 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
5891 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
5892 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
5893 (MemberLookup, MemberLookupFailed): Use it.
5894 * expression.cs (New.DoResolve): Treat the lookup for the
5895 constructor as being qualified by the 'new'ed type.
5896 (Indexers.GetIndexersForTypeOrInterface): Update.
5898 2004-06-03 Marek Safar <marek.safar@seznam.cz>
5901 (GetConditionalAttributeValue): New method. Returns
5902 condition of ConditionalAttribute.
5903 (SearchMulti): New method. Returns all attributes of type 't'.
5904 Use it when attribute is AllowMultiple = true.
5905 (IsConditionalMethodExcluded): New method.
5908 (Method.IsExcluded): Implemented. Returns true if method has conditional
5909 attribute and the conditions is not defined (method is excluded).
5910 (IMethodData): Extended interface for ConditionalAttribute support.
5911 (PropertyMethod.IsExcluded): Implemented.
5914 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
5917 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
5920 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
5922 * expression.cs (ArrayCreationExpression): Make this just an
5923 `expression'. It can't be a statement, so the code here was
5926 2004-06-02 Marek Safar <marek.safar@seznam.cz>
5929 * typemanager.cs (GetFullNameSignature): New method for
5932 2004-06-02 Marek Safar <marek.safar@seznam.cz>
5935 * class.cs (MemberBase.GetSignatureForError): New virtual method.
5936 Use this method when MethodBuilder is null.
5937 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
5938 Added test for error CS0626 (MONO reports error for this situation).
5939 (IMethodData.GetSignatureForError): Extended interface.
5941 2004-06-01 Marek Safar <marek.safar@seznam.cz>
5944 (AttributeTester.GetObsoleteAttribute): Returns instance of
5945 ObsoleteAttribute when type is obsolete.
5948 (TypeContainer.VerifyObsoleteAttribute): Override.
5949 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
5950 (MethodCode.VerifyObsoleteAttribute): Override.
5951 (MemberBase.VerifyObsoleteAttribute): Override.
5954 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
5955 and report proper error.
5958 Delegate.VerifyObsoleteAttribute): Override.
5961 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
5962 and report proper error.
5963 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
5966 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
5970 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
5971 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
5972 Added test for ObsoleteAttribute.
5975 (Catch): Derived from Statement.
5977 2004-06-01 Marek Safar <marek.safar@seznam.cz>
5979 Fixed bug #59071 & cs0160.cs
5981 * statement.cs (Try.Resolve): Check here whether order of catch
5982 clauses matches their dependencies.
5984 2004-05-31 Miguel de Icaza <miguel@ximian.com>
5986 * Reverted patch to namespace.cs (Use lookuptypedirect). This
5987 caused a regression: #59343. Referencing nested classes from an
5988 assembly stopped working.
5990 2004-05-31 Martin Baulig <martin@ximian.com>
5992 MCS is now frozen for beta 2.
5994 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
5996 * convert.cs: add a trivial cache for overload operator resolution.
5998 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6000 * decl.cs: If possible, use lookuptypedirect here. We can only do
6001 this if there is no `.' after the namespace. Avoids using
6002 LookupType, which does lots of slow processing.
6003 (FindNestedType) New method, does what it says :-).
6004 * namespace.cs: use LookupTypeDirect.
6005 * rootcontext.cs: use membercache, if possible.
6006 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6008 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6011 According to the spec,
6013 In a member access of the form E.I, if E is a single identifier,
6014 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6015 field, property, localvariable, or parameter with the same type as
6016 the meaning of E as a type-name (§3.8), then both possible
6017 meanings of E are permitted.
6019 We did not check that E as a simple-name had the same type as E as
6022 This trivial check gives us 5-7% on bootstrap time.
6024 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6026 * expression.cs (Invocation.OverloadResolve): Avoid the
6027 use of hashtables and boxing here by allocating on demand.
6029 2004-05-30 Martin Baulig <martin@ximian.com>
6031 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6032 we're doing a silent lookup. Don't try to lookup nested types in
6033 TypeManager.object_type (thanks to Ben Maurer).
6035 2004-05-30 Martin Baulig <martin@ximian.com>
6037 Committing a patch from Ben Maurer.
6039 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6041 2004-05-29 Martin Baulig <martin@ximian.com>
6043 * class.cs (IMethodData.ShouldIgnore): New method.
6045 * typemanager.cs (TypeManager.MethodFlags): Don't take a
6046 `Location' argument, we don't need it anywhere. Use
6047 `IMethodData.ShouldIgnore ()' instead of
6048 `MethodData.GetMethodFlags ()'.
6049 (TypeManager.AddMethod): Removed.
6050 (TypeManager.AddMethod2): Renamed to AddMethod.
6052 2004-05-29 Martin Baulig <martin@ximian.com>
6054 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
6056 * convert.cs (Convert.ImplicitReferenceConversion): If we're
6057 converting from a class type S to an interface type and we already
6058 have an object on the stack, don't box it again. Fixes #52578.
6060 2004-05-29 Martin Baulig <martin@ximian.com>
6062 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6063 Added support for `params' parameters. Fixes #59267.
6065 2004-05-29 Martin Baulig <martin@ximian.com>
6067 * literal.cs (NullPointer): Provide a private .ctor which sets
6068 `type' to TypeManager.object_type. Fixes #59048.
6070 2004-05-29 Martin Baulig <martin@ximian.com>
6072 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
6073 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
6075 * ecore.cs (EventExpr.instance_expr): Make the field private.
6077 2004-05-26 Marek Safar <marek.safar@seznam.cz>
6079 Fixed bug #50080 & cs0214-2.cs
6080 * expression.cs (Cast.DoResolve): Check unsafe context here.
6082 * statement.cs (Resolve.DoResolve): Likewise.
6084 2004-05-26 Martin Baulig <martin@ximian.com>
6086 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6088 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6089 (RootContext.LookupType): Pass down the `silent' flag.
6091 2004-05-25 Martin Baulig <martin@ximian.com>
6094 (MethodGroupExpr.IdenticalTypeName): New public property.
6095 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6096 expression actually refers to a type.
6098 2004-05-25 Martin Baulig <martin@ximian.com>
6100 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6101 for #56176 and made it actually work.
6103 2004-05-25 Martin Baulig <martin@ximian.com>
6105 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6106 (FieldExpr, PropertyExpr): Override and implement
6107 CacheTemporaries. Fixes #52279.
6109 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6111 * location.cs: In the new compiler listing a file twice is a
6112 warning, not an error.
6114 2004-05-24 Martin Baulig <martin@ximian.com>
6116 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6117 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6119 2004-05-24 Martin Baulig <martin@ximian.com>
6121 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6122 walking the `using' list. Fixes #53921.
6124 2004-05-24 Martin Baulig <martin@ximian.com>
6126 * const.cs (Const.LookupConstantValue): Added support for
6127 EmptyCast's; fixes #55251.
6129 2004-05-24 Martin Baulig <martin@ximian.com>
6131 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6132 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6133 which does the CS0135 check. The reason is that we first need to
6134 check whether the variable actually exists.
6136 2004-05-24 Martin Baulig <martin@ximian.com>
6138 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6139 than RootContext.LookupType() to find the explicit interface
6142 2004-05-24 Raja R Harinath <rharinath@novell.com>
6144 * Makefile: Simplify. Use executable.make.
6145 * mcs.exe.sources: New file. List of sources of mcs.exe.
6147 2004-05-24 Anders Carlsson <andersca@gnome.org>
6151 Use the invariant culture when doing String.Compare for CLS case
6154 2004-05-23 Martin Baulig <martin@ximian.com>
6156 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6157 don't have any dots. Fixes #52622, added cs0246-8.cs.
6159 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6161 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6163 * class.cs (MemberBase.Define): Reuse MemberType member for
6164 resolved type. Other methods can use it too.
6166 2004-05-23 Martin Baulig <martin@ximian.com>
6168 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6169 the variable also exists in the current block (otherwise, we need
6170 to report a CS0103). Fixes #58670.
6172 2004-05-23 Martin Baulig <martin@ximian.com>
6174 * flowanalysis.cs (Reachability.Reachable): Compute this
6175 on-the-fly rather than storing it as a field.
6177 2004-05-23 Martin Baulig <martin@ximian.com>
6179 * flowanalysis.cs (Reachability.And): Manually compute the
6180 resulting `barrier' from the reachability.
6182 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6185 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6186 instance of ObsoleteAttribute when symbol is obsolete.
6189 (IMethodData): Extended interface for ObsoleteAttribute support.
6191 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6193 * attribute.cs: Fix bug #55970
6195 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6199 (GetObsoleteAttribute): New method. Creates the instance of
6201 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6202 ObsoleteAttribute when member is obsolete.
6203 (AttributeTester.Report_ObsoleteMessage): Common method for
6204 Obsolete error/warning reporting.
6207 (TypeContainer.base_classs_type): New member for storing parent type.
6210 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6211 for this MemberCore.
6213 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6215 * attribute.cs, const.cs: Fix bug #58590
6217 2004-05-21 Martin Baulig <martin@ximian.com>
6219 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
6220 out parameters if the end of the method is unreachable. Fixes
6223 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6225 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
6226 Hari was right, why extra method.
6228 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6230 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
6232 2004-05-20 Martin Baulig <martin@ximian.com>
6234 Merged this back from gmcs to keep the differences to a minumum.
6236 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
6237 instead of a Declspace.
6238 (Attribute.ResolveType): Likewise.
6239 (Attributes.Search): Likewise.
6240 (Attributes.Contains): Likewise.
6241 (Attributes.GetClsCompliantAttribute): Likewise.
6243 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
6245 (MethodData.ApplyAttributes): Take an EmitContext instead of a
6248 2004-05-19 Marek Safar <marek.safar@seznam.cz>
6250 Fix bug #58688 (MCS does not report error when the same attribute
6253 * attribute.cs (Attribute.Emit): Distinction between null and default.
6255 2004-05-19 Raja R Harinath <rharinath@novell.com>
6257 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
6258 of a top-level attribute without an attribute target.
6259 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
6261 (Attribute.Conditional_GetConditionName),
6262 (Attribute.Obsolete_GetObsoleteMessage): Update.
6263 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
6264 part of ScanForIndexerName.
6265 (Attribute.CanIgnoreInvalidAttribute): New function.
6266 (Attribute.ScanForIndexerName): Move to ...
6267 (Attributes.ScanForIndexerName): ... here.
6268 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
6269 (Attributes.Search): New internal variant that can choose not to
6270 complain if types aren't resolved. The original signature now
6272 (Attributes.GetClsCompliantAttribute): Use internal variant, with
6273 complaints suppressed.
6274 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
6275 only if it not useful.
6276 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
6277 top-level for attributes that are shared between the assembly
6278 and a top-level class.
6279 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
6280 * class.cs: Update to reflect changes.
6281 (DefineIndexers): Fuse loops.
6282 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
6283 a couple more variants of attribute names.
6285 2004-05-18 Marek Safar <marek.safar@seznam.cz>
6287 Fix bug #52585 (Implemented explicit attribute declaration)
6290 (Attributable.ValidAttributeTargets): New abstract method. It gets
6291 list of valid attribute targets for explicit target declaration.
6292 (Attribute.Target): It holds target itself.
6293 (AttributeSection): Removed.
6294 (Attribute.CheckTargets): New method. It checks whether attribute
6295 target is valid for the current element.
6298 (EventProperty): New class. For events that are declared like
6299 property (with add and remove accessors).
6300 (EventField): New class. For events that are declared like field.
6303 * cs-parser.jay: Implemented explicit attribute target declaration.
6305 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
6306 Override ValidAttributeTargets.
6309 (ReturnParameter): Class for applying custom attributes on
6311 (ParameterAtribute): New class. Class for applying custom
6312 attributes on the parameter type.
6314 2004-05-17 Miguel de Icaza <miguel@ximian.com>
6316 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
6319 (Method): Allow UNSAFE here.
6321 * modifiers.cs: Support unsafe reporting.
6323 2004-05-17 Marek Safar <marek.safar@seznam.cz>
6325 * decl.cs: Fix bug #58478.
6327 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6329 * statement.cs: When checking for unreachable code on an EmptyStatement,
6330 set the location. Fixes bug #58488.
6332 2004-05-13 Miguel de Icaza <miguel@ximian.com>
6334 * driver.cs: Add -pkg handling.
6336 From Gonzalo: UseShelLExecute=false
6338 2004-05-12 Marek Safar <marek.safar@seznam.cz>
6341 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
6343 (Attribute.IsClsCompliaceRequired): Moved to base for better
6345 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
6346 when attribute is AttributeUsageAttribute.
6347 (Attribute.GetValidTargets): Simplified.
6348 (Attribute.GetAttributeUsage): New method returns AttributeUsage
6349 attribute for this type.
6350 (Attribute.ApplyAttributes): Method renamed to Emit and make
6352 (GlobalAttributeSection): New class for special handling of global
6353 attributes (assembly, module).
6354 (AttributeSection.Emit): New method.
6356 * class.cs: Implemented Attributable abstract methods.
6357 (MethodCore.LabelParameters): Moved to Parameter class.
6358 (Accessor): Is back simple class.
6359 (PropertyMethod): Implemented Attributable abstract class.
6360 (DelegateMethod): Implemented Attributable abstract class.
6361 (Event): New constructor for disctintion between normal Event
6362 and Event with accessors.
6364 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
6366 * codegen.cs, const.cs, decl.cs, delegate.cs:
6367 (CommonAssemblyModulClass): Implemented Attributable abstract class
6370 * enum.cs: Implement IAttributeSupport interface.
6371 (EnumMember): New class for emum members. Implemented Attributable
6375 (ParameterBase): Is abstract.
6376 (ReturnParameter): New class for easier [return:] attribute handling.
6378 * typemanager.cs: Removed builder_to_attr.
6380 2004-05-11 Raja R Harinath <rharinath@novell.com>
6383 * attribute.cs (Attribute.GetPositionalValue): New function.
6384 * class.cs (TypeContainer.VerifyMembers): New function.
6385 (TypeContainer.Emit): Use it.
6386 (ClassOrStruct): New base class for Class and Struct.
6387 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
6388 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
6390 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
6391 then each non-static field should have a FieldOffset attribute.
6392 Otherwise, none of the fields should have a FieldOffset attribute.
6393 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
6394 and FieldOffset attributes.
6395 * typemanager.cs (TypeManager.struct_layout_attribute_type)
6396 (TypeManager.field_offset_attribute_type): New core types.
6397 (TypeManager.InitCoreTypes): Initialize them.
6399 2004-05-11 Michal Moskal <malekith@pld-linux.org>
6401 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
6402 Return correct type.
6405 2004-05-09 Miguel de Icaza <miguel@ximian.com>
6407 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
6408 be implicitly converted to ulong.
6410 * expression.cs: The logic for allowing operator &, | and ^ worked
6411 was wrong, it worked before because we did not report an error in
6412 an else branch. Fixes 57895.
6414 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
6415 allow volatile fields to be reference types.
6417 2004-05-07 Miguel de Icaza <miguel@ximian.com>
6419 * driver.cs: Add support for /debug-
6421 2004-05-07 Raja R Harinath <rharinath@novell.com>
6423 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
6424 Add a 'complain' parameter to silence errors.
6425 (Attribute.Resolve): Update to changes. Put in sanity check to catch
6426 silently overlooked type-resolutions.
6427 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
6429 (Attributes.Search): New function.
6430 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
6431 (Attributes.GetAttributeFullName): Remove hack.
6432 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
6433 Update to reflect changes.
6434 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
6435 Use Attributes.Search instead of nested loops.
6437 2004-05-07 Marek Safar <marek.safar@seznam.cz>
6440 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
6441 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
6442 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
6444 * report.cs: (Report.Warning): Renamed to Warning_T because of
6445 parameter collision.
6447 2004-05-05 Raja R Harinath <rharinath@novell.com>
6449 * expression.cs (MemberAccess.ResolveMemberAccess):
6450 Exit with non-zero status after Report.Error.
6451 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
6453 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
6455 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6457 * support.cs: Don't hang when the file is empty.
6459 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6461 * support.cs: In SeekableStreamReader, compute the preamble size of the
6462 underlying stream. Position changes should take into account that initial
6465 2004-05-03 Todd Berman <tberman@sevenl.net>
6467 * driver.cs: remove unused GetSysVersion function.
6469 2004-05-03 Todd Berman <tberman@sevenl.net>
6471 * driver.cs: Remove the hack from saturday, as well as the hack
6472 from jackson (LoadAssemblyFromGac), also adds the CWD to the
6473 link_paths to get that bit proper.
6475 2004-05-01 Todd Berman <tberman@sevenl.net>
6477 * driver.cs: Try a LoadFrom before a Load, this checks the current
6478 path. This is currently a bug in mono that is be fixed, however, this
6479 provides a workaround for now. This will be removed when the bug
6482 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
6484 * CryptoConvert.cs: Updated to latest version. Fix issue with
6485 incomplete key pairs (#57941).
6487 2004-05-01 Todd Berman <tberman@sevenl.net>
6489 * driver.cs: Remove '.' from path_chars, now System.* loads properly
6492 2004-04-30 Jackson Harper <jackson@ximian.com>
6494 * codegen.cs: Open keys readonly.
6496 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6498 * typemanager.cs: don't report cyclic struct layout when a struct
6499 contains 2 or more fields of the same type. Failed for Pango.AttrShape
6500 which has 2 Pango.Rectangle fields.
6502 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
6504 * expression.cs: Handle IntPtr comparisons with IL code
6505 rather than a method call.
6507 2004-04-29 Martin Baulig <martin@ximian.com>
6509 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
6510 the list of PropertyInfo's in class hierarchy and find the
6511 accessor. Fixes #56013.
6513 2004-04-29 Martin Baulig <martin@ximian.com>
6515 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
6517 2004-04-29 Martin Baulig <martin@ximian.com>
6519 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6521 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
6523 2004-04-29 Martin Baulig <martin@ximian.com>
6525 * class.cs (ConstructorInitializer.Resolve): Check whether the
6526 parent .ctor is accessible. Fixes #52146.
6528 2004-04-29 Martin Baulig <martin@ximian.com>
6530 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6532 * statement.cs (Using.EmitLocalVariableDecls): Use
6533 TypeManager.idisposable_type, not typeof (IDisposable).
6534 (Foreach.EmitCollectionForeach): Added support for valuetypes.
6536 2004-04-29 Martin Baulig <martin@ximian.com>
6538 * class.cs (Event.Define): Don't emit the field and don't set
6539 RTSpecialName and SpecialName for events on interfaces. Fixes
6542 2004-04-29 Raja R Harinath <rharinath@novell.com>
6544 Refactor Attribute.ApplyAttributes.
6545 * attribute.cs (Attributable): New base class for objects that can
6546 have Attributes applied on them.
6547 (Attribute): Make AttributeUsage fields public.
6548 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
6549 (Attribute.IsInternalCall): New property.
6550 (Attribute.UsageAttr): Convert to a public read-only property.
6551 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
6552 (Attribute.ResolveType, Attribute.Resolve)
6553 (Attribute.ScanForIndexerName): Update to reflect changes.
6554 (Attribute.CheckAttributeTarget): Re-format.
6555 (Attribute.ApplyAttributes): Refactor, to various
6556 Attributable.ApplyAttributeBuilder methods.
6557 * decl.cs (MemberCore): Make Attributable.
6558 * class.cs (Accessor): Make Attributable.
6559 (MethodData.ApplyAttributes): Use proper attribute types, not
6561 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
6562 (TypeContainer.ApplyAttributeBuilder)
6563 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
6564 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
6565 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
6566 (Operator.ApplyAttributeBuilder): New factored-out methods.
6567 * const.cs (Const.ApplyAttributeBuilder): Likewise.
6568 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
6569 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
6570 * parameter.cs (ParameterBase): New Attributable base class
6571 that can also represent Return types.
6572 (Parameter): Update to the changes.
6574 2004-04-29 Jackson Harper <jackson@ximian.com>
6576 * driver.cs: Prefer the corlib system version when looking for
6577 assemblies in the GAC. This is still a hack, but its a better hack
6580 2004-04-29 Marek Safar <marek.safar@seznam.cz>
6582 * decl.cs, enum.cs: Improved error 3005 reporting.
6584 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
6585 (related_symbols): New private member for list of symbols
6586 related to reported error/warning.
6588 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
6590 2004-04-29 Martin Baulig <martin@ximian.com>
6592 * ecore.cs (Expression.Constantify): If we're an enum and
6593 TypeManager.TypeToCoreType() doesn't give us another type, use
6594 t.UnderlyingSystemType. Fixes #56178.
6596 2004-04-29 Martin Baulig <martin@ximian.com>
6598 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
6599 interfaces and for each interface, only add members directly
6600 declared in that interface. Fixes #53255.
6602 2004-04-28 Martin Baulig <martin@ximian.com>
6604 * expression.cs (ConditionalLogicalOperator): Use a temporary
6605 variable for `left' to avoid that we evaluate it more than once;
6608 2004-04-28 Martin Baulig <martin@ximian.com>
6610 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
6613 2004-04-28 Martin Baulig <martin@ximian.com>
6615 * statement.cs (LocalInfo.Resolve): Check whether the type is not
6618 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
6619 whether the type is not void (CS1547).
6621 2004-04-28 Martin Baulig <martin@ximian.com>
6623 * expression.cs (Unary.DoResolveLValue): Override this and report
6624 CS0131 for anything but Operator.Indirection.
6626 2004-04-28 Martin Baulig <martin@ximian.com>
6628 Committing a patch from Ben Maurer; see bug #50820.
6630 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6633 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6636 2004-04-28 Martin Baulig <martin@ximian.com>
6638 Committing a patch from Ben Maurer; see bug #50820.
6640 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6643 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6646 2004-04-28 Martin Baulig <martin@ximian.com>
6648 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
6649 (Block.AddLabel): Call DoLookupLabel() to only search in the
6652 2004-04-28 Martin Baulig <martin@ximian.com>
6654 * cfold.cs (ConstantFold.BinaryFold): Added special support for
6655 comparing StringConstants and NullLiterals in Equality and Inequality.
6657 2004-04-28 Jackson Harper <jackson@ximian.com>
6659 * driver.cs: Attempt to load referenced assemblies from the
6660 GAC. This is the quick and dirty version of this method that
6661 doesnt take into account versions and just takes the first
6662 canidate found. Will be good enough for now as we will not have more
6663 then one version installed into the GAC until I update this method.
6665 2004-04-28 Martin Baulig <martin@ximian.com>
6667 * typemanager.cs (TypeManager.CheckStructCycles): New public
6668 static method to check for cycles in the struct layout.
6670 * rootcontext.cs (RootContext.PopulateTypes): Call
6671 TypeManager.CheckStructCycles() for each TypeContainer.
6672 [Note: We only need to visit each type once.]
6674 2004-04-28 Martin Baulig <martin@ximian.com>
6676 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
6678 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
6679 success and added `out object value'. Use a `bool resolved' field
6680 to check whether we've already been called rather than
6681 `ConstantValue != null' since this breaks for NullLiterals.
6683 2004-04-28 Raja R Harinath <rharinath@novell.com>
6685 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
6686 setting of this flag, since the 'set' method may be non-public.
6688 2004-04-28 Raja R Harinath <rharinath@novell.com>
6690 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
6691 check on current_vector.Block.
6693 2004-04-27 Martin Baulig <martin@ximian.com>
6695 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
6696 a field initializer. Fixes #56459.
6698 2004-04-27 Martin Baulig <martin@ximian.com>
6700 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
6701 we're not attempting to use an indexer. Fixes #52154.
6703 2004-04-27 Martin Baulig <martin@ximian.com>
6705 * statement.cs (Return): Don't create a return label if we don't
6706 need it; reverts my change from January 20th. Thanks to Ben
6709 2004-04-27 Martin Baulig <martin@ximian.com>
6711 According to the spec, `goto' can only leave a nested scope, but
6714 * statement.cs (Block.LookupLabel): Only lookup in the current
6715 block, don't recurse into parent or child blocks.
6716 (Block.AddLabel): Check in parent and child blocks, report
6717 CS0140/CS0158 if we find a duplicate.
6718 (Block): Removed this indexer for label lookups.
6719 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
6720 this already does the error reporting for us.
6723 (FlowBranching.UsageVector.Block): New public variable; may be null.
6724 (FlowBranching.CreateSibling): Added `Block' argument.
6725 (FlowBranching.LookupLabel): New public virtual method. Lookup a
6726 label for the target of a `goto' and check whether we're not
6727 leaving a `finally'.
6729 2004-04-27 Martin Baulig <martin@ximian.com>
6731 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
6732 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
6735 2004-04-27 Martin Baulig <martin@ximian.com>
6737 * statement.cs (Block.AddLabel): Also check for implicit blocks
6738 and added a CS0158 check.
6740 2004-04-27 Martin Baulig <martin@ximian.com>
6742 * flowanalysis.cs (FlowBranchingLoop): New class.
6743 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
6744 UsageVector's instead of an ArrayList.
6745 (FlowBranching.Label): Likewise.
6746 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
6747 (FlowBranching.AddBreakVector): New method.
6749 2004-04-27 Miguel de Icaza <miguel@ximian.com>
6751 * attribute.cs: Small regression fix: only convert the type if we
6752 the type is different, fixes System.Drawing build.
6754 2004-04-27 Martin Baulig <martin@ximian.com>
6756 * attribute.cs (Attribute.Resolve): If we have a constant value
6757 for a named field or property, implicity convert it to the correct
6760 2004-04-27 Raja R Harinath <rharinath@novell.com>
6762 * statement.cs (Block.Block): Implicit blocks share
6763 'child_variable_names' fields with parent blocks.
6764 (Block.AddChildVariableNames): Remove.
6765 (Block.AddVariable): Mark variable as "used by a child block" in
6766 every surrounding block.
6767 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
6768 been used in a child block, complain about violation of "Invariant
6769 meaning in blocks" rule.
6770 * cs-parser.jay (declare_local_variables): Don't use
6771 AddChildVariableNames.
6772 (foreach_statement): Don't create an implicit block: 'foreach'
6775 2004-04-23 Miguel de Icaza <miguel@ximian.com>
6777 * convert.cs (ImplicitNumericConversion): 0 is also positive when
6778 converting from 0L to ulong. Fixes 57522.
6780 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6782 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
6783 derived class hides via 'new' keyword field from base class (test-242.cs).
6784 TODO: Handle this in the more general way.
6786 * class.cs (CheckBase): Ditto.
6788 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6790 * decl.cs (caching_flags): New member for storing cached values
6792 (MemberCore.Flags): New enum where bit flags for caching_flags
6794 (MemberCore.cls_compliance): Moved to caching_flags.
6795 (DeclSpace.Created): Moved to caching_flags.
6797 * class.cs: Use caching_flags instead of DeclSpace.Created
6799 2004-04-21 Miguel de Icaza <miguel@ximian.com>
6801 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
6802 if we are only a derived class, not a nested class.
6804 * typemanager.cs: Same as above, but do this at the MemberLookup
6805 level (used by field and methods, properties are handled in
6806 PropertyExpr). Allow for the qualified access if we are a nested
6809 2004-04-21 Marek Safar <marek.safar@seznam.cz>
6811 * class.cs: Refactoring.
6812 (IMethodData): New inteface; Holds links to parent members
6813 to avoid member duplication (reduced memory allocation).
6814 (Method): Implemented IMethodData interface.
6815 (PropertyBase): New inner classes for get/set methods.
6816 (PropertyBase.PropertyMethod): Implemented IMethodData interface
6817 (Event): New inner classes for add/remove methods.
6818 (Event.DelegateMethod): Implemented IMethodData interface.
6820 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
6821 EmitContext (related to class.cs refactoring).
6823 2004-04-21 Raja R Harinath <rharinath@novell.com>
6825 * delegate.cs (Delegate.VerifyApplicability): If the number of
6826 arguments are the same as the number of parameters, first try to
6827 verify applicability ignoring any 'params' modifier on the last
6831 2004-04-16 Raja R Harinath <rharinath@novell.com>
6833 * class.cs (TypeContainer.AddIndexer): Use
6834 'ExplicitInterfaceName' to determine if interface name was
6835 explicitly specified. 'InterfaceType' is not initialized at this time.
6836 (TypeContainer.DefineIndexers): Remove use of temporary list. The
6837 Indexers array is already in the required order. Initialize
6838 'IndexerName' only if there are normal indexers.
6839 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
6840 (TypeContainer.Emit): Emit DefaultMember attribute only if
6841 IndexerName is initialized.
6844 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
6846 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
6849 2004-04-15 Raja R Harinath <rharinath@novell.com>
6851 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
6855 * attribute.cs (Attribute.Resolve): Check for duplicate named
6859 2004-04-15 Miguel de Icaza <miguel@ximian.com>
6861 * iterators.cs (MarkYield): track whether we are in an exception,
6862 and generate code accordingly. Use a temporary value to store the
6863 result for our state.
6865 I had ignored a bit the interaction of try/catch with iterators
6866 since their behavior was not entirely obvious, but now it is
6867 possible to verify that our behavior is the same as MS .NET 2.0
6871 2004-04-14 Miguel de Icaza <miguel@ximian.com>
6873 * iterators.cs: Avoid creating temporaries if there is no work to
6876 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
6877 Enumerations, use TypeManager.EnumToUnderlying and call
6880 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
6883 (This.Emit): Use EmitContext.EmitThis to emit our
6886 (This.EmitAssign): Ditto.
6888 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
6889 codepaths, we will move all the functionality into
6892 (FieldExpr.EmitAssign): Ditto.
6894 This fixes several hidden bugs that I uncovered while doing a code
6895 review of this today.
6897 * codegen.cs (EmitThis): reworked so the semantics are more clear
6898 and also support value types "this" instances.
6900 * iterators.cs: Changed so that for iterators in value types, we
6901 do not pass the value type as a parameter.
6903 Initialization of the enumerator helpers is now done in the caller
6904 instead of passing the parameters to the constructors and having
6905 the constructor set the fields.
6907 The fields have now `assembly' visibility instead of private.
6909 2004-04-11 Miguel de Icaza <miguel@ximian.com>
6911 * expression.cs (Argument.Resolve): Check if fields passed as ref
6912 or out are contained in a MarshalByRefObject.
6914 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
6915 another compiler type.
6917 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
6919 * class.cs (Indexer.Define): use the new name checking method.
6920 Also, return false on an error.
6921 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
6922 (is_identifier_[start/part]_character): make static.
6924 2004-04-10 Miguel de Icaza <miguel@ximian.com>
6926 * expression.cs (Binary.ResolveOperator): Do no append strings
6927 twice: since we can be invoked more than once (array evaluation)
6928 on the same concatenation, take care of this here. Based on a fix
6929 from Ben (bug #56454)
6931 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
6933 * codegen.cs: Fix another case where CS1548 must be reported (when
6934 delay-sign isn't specified and no private is available #56564). Fix
6935 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
6936 error when MCS is used on the MS runtime and we need to delay-sign
6937 (which seems unsupported by AssemblyBuilder - see #56621).
6939 2004-04-08 Marek Safar <marek.safar@seznam.cz>
6941 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
6942 (TypeManager.ComputeNamespaces): Faster implementation for
6945 * compiler.csproj: Updated AssemblyName to mcs.
6947 2004-04-07 Miguel de Icaza <miguel@ximian.com>
6949 * rootcontext.cs: Add new types to the boot resolution.
6951 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
6952 MulticastDelegate is not allowed.
6954 * typemanager.cs: Add new types to lookup: System.TypedReference
6957 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
6958 check for TypedReference or ArgIterator, they are not allowed.
6960 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
6961 makes us properly catch 1510 in some conditions (see bug 56016 for
6964 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
6966 * CryptoConvert.cs: update from corlib version
6969 2004-04-05 Miguel de Icaza <miguel@ximian.com>
6971 * class.cs (Indexer.Define): Check indexername declaration
6973 2004-04-05 Marek Safar <marek.safar@seznam.cz>
6975 * attribute.cs (IsClsCompliant): Fixed problem with handling
6976 all three states (compliant, not-compliant, undetected).
6978 2004-03-30 Marek Safar <marek.safar@seznam.cz>
6980 * attribute.cs (Attribute): Location is now public.
6981 (Resolve): Store resolved arguments (pos_values) in attribute class.
6982 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
6983 (GetClsCompliantAttributeValue): New method that gets
6984 CLSCompliantAttribute value.
6985 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
6986 if exists else null.
6987 (AttributeTester): New class for CLS-Compliant verification routines.
6989 * class.cs (Emit): Add CLS-Compliant verification.
6990 (Method.GetSignatureForError): Implemented.
6991 (Constructor.GetSignatureForError): Implemented
6992 (Constructor.HasCompliantArgs): Returns if constructor has
6993 CLS-Compliant arguments.
6994 (Constructor.Emit): Override.
6995 (Construcor.IsIdentifierClsCompliant): New method; For constructors
6996 is needed to test only parameters.
6997 (FieldBase.GetSignatureForError): Implemented.
6998 (TypeContainer): New member for storing base interfaces.
6999 (TypeContainer.FindMembers): Search in base interfaces too.
7001 * codegen.cs (GetClsComplianceAttribute): New method that gets
7002 assembly or module CLSCompliantAttribute value.
7003 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7005 (ModuleClass.Emit): Add error 3012 test.
7007 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7009 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7010 state for all decl types.
7011 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7012 if CLS-Compliant tests are required.
7013 (IsClsCompliaceRequired): New method. Analyze whether code
7014 must be CLS-Compliant.
7015 (IsExposedFromAssembly): New method. Returns true when MemberCore
7016 is exposed from assembly.
7017 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7018 value or gets cached value.
7019 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7020 is explicitly marked with CLSCompliantAttribute.
7021 (IsIdentifierClsCompliant): New abstract method. This method is
7022 used to testing error 3005.
7023 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7024 for identifier and parameters CLS-Compliant testing.
7025 (VerifyClsCompliance): New method. The main virtual method for
7026 CLS-Compliant verifications.
7027 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7028 null. I don't know why is null (too many public members !).
7029 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7030 and get value of first CLSCompliantAttribute that found.
7032 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7033 (VerifyClsCompliance): Override and add extra tests.
7035 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7036 clscheck- disable CLS-Compliant verification event if assembly is has
7037 CLSCompliantAttribute(true).
7039 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7040 ApllyAttribute is now called in emit section as in the other cases.
7041 Possible future Emit integration.
7042 (IsIdentifierClsCompliant): New override.
7043 (VerifyClsCompliance): New override.
7044 (GetEnumeratorName): Returns full enum name.
7046 * parameter.cs (GetSignatureForError): Implemented.
7048 * report.cs (WarningData): New struct for Warning message information.
7049 (LocationOfPreviousError): New method.
7050 (Warning): New method. Reports warning based on the warning table.
7051 (Error_T): New method. Reports error based on the error table.
7053 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7054 verifications are done here.
7056 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7058 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7059 CLSCompliantAttribute.
7060 (all_imported_types): New member holds all imported types from other
7062 (LoadAllImportedTypes): New method fills static table with exported types
7063 from all referenced assemblies.
7064 (Modules): New property returns all assembly modules.
7066 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7068 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7069 throwing a parser error.
7071 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7072 which removes the hardcoded get_/set_ prefixes for properties, as
7073 IL allows for the properties to be named something else.
7077 * expression.cs: Do not override operand before we know if it is
7080 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7082 * typemanager.cs: support for pinned variables.
7084 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7086 * decl.cs, typemanager.cs: Avoid using an arraylist
7087 as a buffer if there is only one result set.
7089 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7091 * expression.cs: Make sure you cant call a static method
7092 with an instance expression, bug #56174.
7094 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7096 * class.cs (IsDuplicateImplementation): Improve error reporting to
7097 flag 663 (method only differs in parameter modifier).
7099 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7100 in preprocessor directives.
7102 * location.cs (LookupFile): Allow for the empty path.
7104 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7105 better approach for some of that patch, but its failing with the
7106 CharSet enumeration. For now try/catch will do.
7108 * typemanager.cs: Do not crash if a struct does not have fields.
7111 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7113 * expression.cs: cs0213, cant fix a fixed expression.
7116 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7118 * cs-parser.jay: detect invalid embeded statements gracefully.
7121 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7123 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7126 the invocation type may not be a subclass of the tye of the item/
7127 The type of the item must be a subclass of the invocation item.
7132 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7134 * attribute.cs: Added methods to get a string and a bool from an
7135 attribute. Required to information from AssemblyKeyFileAttribute,
7136 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7137 * codegen.cs: Modified AssemblyName creation to include support for
7138 strongnames. Catch additional exceptions to report them as CS1548.
7139 * compiler.csproj: Updated include CryptoConvert.cs.
7140 * compiler.csproj.user: Removed file - user specific configuration.
7141 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7142 Mono.Security assembly. The original class is maintained and tested in
7143 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7144 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7145 like CSC 8.0 (C# v2) supports.
7146 * Makefile: Added CryptoConvert.cs to mcs sources.
7147 * rootcontext.cs: Added new options for strongnames.
7149 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7151 * driver.cs: For --expect-error, report error code `2'
7152 if the program compiled with no errors, error code `1' if
7153 it compiled with an error other than the one expected.
7155 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7157 * compiler.csproj: Updated for Visual Studio .NET 2003.
7158 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7159 * compiler.sln: Updated for Visual Studio .NET 2003.
7161 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7163 * expression.cs: Fix bug #47234. We basically need to apply the
7164 rule that we prefer the conversion of null to a reference type
7165 when faced with a conversion to 'object' (csc behaviour).
7167 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7169 * statement.cs: Shorter form for foreach, eliminates
7170 a local variable. r=Martin.
7172 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7174 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7175 checks if we can use brtrue/brfalse to test for 0.
7176 * expression.cs: use the above in the test for using brtrue/brfalse.
7179 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7181 * expression.cs: Rewrite string concat stuff. Benefits:
7183 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7184 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7185 rather than a concat chain.
7187 * typemanager.cs: Add lookups for more concat overloads.
7189 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7191 * expression.cs: Emit shorter il code for array init.
7208 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7210 * statement.cs: Before, two switch blocks would be merged if the
7211 total size of the blocks (end_item - begin_item + 1) was less than
7212 two times the combined sizes of the blocks.
7214 Now, it will only merge if after the merge at least half of the
7219 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7221 * class.cs : csc build fix for GetMethods(). See bug #52503.
7223 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7225 * expression.cs: Make sure fp comparisons work with NaN.
7226 This fixes bug #54303. Mig approved this patch a long
7227 time ago, but we were not able to test b/c the runtime
7230 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7232 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7234 2004-03-19 Martin Baulig <martin@ximian.com>
7236 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7237 error here and not in our caller.
7239 2004-03-19 Martin Baulig <martin@ximian.com>
7241 * interface.cs: Completely killed this file.
7242 (Interface): We're now a TypeContainer and live in class.cs.
7244 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7245 argument; we're now also called for interfaces.
7246 (TypeContainer.DefineMembers): Allow this method being called
7248 (TypeContainer.GetMethods): New public method; formerly known as
7249 Interface.GetMethod(). This is used by PendingImplementation.
7250 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7251 it's now private and non-static.
7252 (Interface): Moved this here; it's now implemented similar to
7254 (Method, Property, Event, Indexer): Added `bool is_interface'
7255 argument to their .ctor's.
7256 (MemberBase.IsInterface): New public field.
7258 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7259 instances instead of InterfaceMethod, InterfaceProperty, etc.
7260 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7261 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
7263 2004-03-19 Martin Baulig <martin@ximian.com>
7265 * class.cs (MethodCore.IsDuplicateImplementation): New private
7266 method which does the CS0111 checking.
7267 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
7268 Use IsDuplicateImplementation().
7270 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
7272 * decl.cs (FindMemberToOverride): New method to find the correct
7273 method or property to override in the base class.
7275 - Make Method/Property use the above method to find the
7276 version in the base class.
7277 - Remove the InheritableMemberSignatureCompare as it is now
7280 This patch makes large code bases much faster to compile, as it is
7281 O(n) rather than O(n^2) to do this validation.
7283 Also, it fixes bug 52458 which is that nested classes are not
7284 taken into account when finding the base class member.
7286 Reviewed/Approved by Martin.
7288 2004-03-17 Marek Safar <marek.safar@seznam.cz>
7290 * interface.cs: In all interface classes removed redundant
7291 member initialization.
7293 2004-03-16 Martin Baulig <martin@ximian.com>
7295 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7297 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7299 * decl.cs (DefineTypeAndParents): New helper method to define a
7300 type's containers before the type itself is defined; This is a
7301 bug exposed by the recent changes to Windows.Forms when an
7302 implemented interface was defined inside a class that had not been
7305 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
7307 (Check): Loop correctly to report errors modifiers
7308 (UNSAFE was not in the loop, since it was the same as TOP).
7310 * interface.cs: Every interface member now takes a ModFlags,
7311 instead of a "is_new" bool, which we set on the base MemberCore.
7313 Every place where we called "UnsafeOk" in the interface, now we
7314 call the proper member (InterfaceMethod.UnsafeOK) instead to get
7315 the unsafe settings from the member declaration instead of the
7316 container interface.
7318 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
7320 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7321 `set_indexer_name' to the pending bits (one per type).
7323 We fixed a bug today that was picking the wrong method to
7324 override, since for properties the existing InterfaceMethod code
7325 basically ignored the method name. Now we make sure that the
7326 method name is one of the valid indexer names.
7328 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
7330 * support.cs (SeekableStreamReader): Keep track of stream byte
7331 positions and don't mix them with character offsets to the buffer.
7333 Patch from Gustavo Giráldez
7335 2004-03-15 Marek Safar <marek.safar@seznam.cz>
7337 * interface.cs (InterfaceSetGetBase): Removed double member
7338 initialization, base class does it as well.
7340 2004-03-13 Martin Baulig <martin@ximian.com>
7342 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
7343 when compiling corlib.
7345 2004-03-13 Miguel de Icaza <miguel@ximian.com>
7347 * convert.cs (ExplicitConversion): We were reporting an error on
7348 certain conversions (object_type source to a value type, when the
7349 expression was `null') before we had a chance to pass it through
7350 the user defined conversions.
7352 * driver.cs: Replace / and \ in resource specifications to dots.
7355 * class.cs: Add check for duplicate operators. Fixes 52477
7357 2004-03-11 Miguel de Icaza <miguel@ximian.com>
7359 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
7360 that are in the middle of the statements, not only at the end.
7363 * class.cs (TypeContainer.AddField): No longer set the
7364 `HaveStaticConstructor' flag, now we call it
7365 `UserDefineStaticConstructor' to diferentiate the slightly
7366 semantic difference.
7368 The situation is that we were not adding BeforeFieldInit (from
7369 Modifiers.TypeAttr) to classes that could have it.
7370 BeforeFieldInit should be set to classes that have no static
7375 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
7377 And most importantly Zoltan's comment:
7379 http://bugzilla.ximian.com/show_bug.cgi?id=44229
7381 "I think beforefieldinit means 'it's ok to initialize the type sometime
7382 before its static fields are used', i.e. initialization does not need
7383 to be triggered by the first access to the type. Setting this flag
7384 helps the JIT to compile better code, since it can run the static
7385 constructor at JIT time, and does not need to generate code to call it
7386 (possibly lots of times) at runtime. Unfortunately, mcs does not set
7387 this flag for lots of classes like String.
7389 csc sets this flag if the type does not have an explicit static
7390 constructor. The reasoning seems to be that if there are only static
7391 initalizers for a type, and no static constructor, then the programmer
7392 does not care when this initialization happens, so beforefieldinit
7395 This bug prevents the AOT compiler from being usable, since it
7396 generates so many calls to mono_runtime_class_init that the AOT code
7397 is much slower than the JITted code. The JITted code is faster,
7398 because it does not generate these calls if the vtable is type is
7399 already initialized, which is true in the majority of cases. But the
7400 AOT compiler can't do this."
7402 2004-03-10 Miguel de Icaza <miguel@ximian.com>
7404 * class.cs (MethodData.Emit): Refactor the code so symbolic
7405 information is generated for destructors; For some reasons we
7406 were taking a code path that did not generate symbolic information
7409 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
7411 * class.cs: Create a Constructor.CheckBase method that
7412 takes care of all validation type code. The method
7413 contains some code that was moved from Define.
7415 It also includes new code that checks for duplicate ctors.
7416 This fixes bug #55148.
7418 2004-03-09 Joshua Tauberer <tauberer@for.net>
7420 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
7421 a { ... }-style array creation invokes EmitStaticInitializers
7422 which is not good for reference-type arrays. String, decimal
7423 and now null constants (NullCast) are not counted toward
7424 static initializers.
7426 2004-03-05 Martin Baulig <martin@ximian.com>
7428 * location.cs (SourceFile.HasLineDirective): New public field;
7429 specifies whether the file contains or is referenced by a "#line"
7431 (Location.DefineSymbolDocuments): Ignore source files which
7432 either contain or are referenced by a "#line" directive.
7434 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
7436 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
7437 direct access to our parent, so check the method inline there.
7439 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
7441 * expression.cs (Invocation.EmitCall): Miguel's last commit
7442 caused a regression. If you had:
7447 In Foo the implict this would be null.
7449 2004-02-27 Miguel de Icaza <miguel@ximian.com>
7451 * expression.cs (Invocation.EmitCall): If the method is not
7452 virtual, do not emit a CallVirt to it, use Call.
7454 * typemanager.cs (GetFullNameSignature): Improve the method to
7455 cope with ".ctor" and replace it with the type name.
7457 * class.cs (ConstructorInitializer.Resolve): Now the method takes
7458 as an argument the ConstructorBuilder where it is being defined,
7459 to catch the recursive constructor invocations.
7461 2004-02-26 Miguel de Icaza <miguel@ximian.com>
7463 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
7464 routines to check if a type is an enumerable/enumerator allow
7465 classes that implement the IEnumerable or IEnumerator interfaces.
7467 * class.cs (Property, Operator): Implement IIteratorContainer, and
7468 implement SetYields.
7470 (Property.Define): Do the block swapping for get_methods in the
7471 context of iterators. We need to check if Properties also
7472 include indexers or not.
7474 (Operator): Assign the Block before invoking the
7475 OperatorMethod.Define, so we can trigger the Iterator code
7478 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
7479 Property and Operator classes are not created when we parse the
7480 declarator but until we have the block completed, so we use a
7481 singleton SimpleIteratorContainer.Simple to flag whether the
7482 SetYields has been invoked.
7484 We propagate this setting then to the Property or the Operator to
7485 allow the `yield' to function.
7487 2004-02-25 Marek Safar <marek.safar@seznam.cz>
7489 * codegen.cs: Implemented attribute support for modules.
7490 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
7491 Assembly/Module functionality.
7493 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
7494 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
7495 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
7497 2004-02-16 Marek Safar <marek.safar@seznam.cz>
7499 * interface.cs (FindMembers): The operation is performed on all base
7500 interfaces and not only on the first. It is required for future CLS Compliance patch.
7502 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
7504 * statement.cs, codegen.cs:
7505 This patch deals with patterns such as:
7507 public class List : IEnumerable {
7509 public MyEnumerator GetEnumerator () {
7510 return new MyEnumerator(this);
7513 IEnumerator IEnumerable.GetEnumerator () {
7517 public struct MyEnumerator : IEnumerator {
7522 Before, there were a few things we did wrong:
7523 1) we would emit callvirt on a struct, which is illegal
7524 2) we emited ldarg when we needed to emit ldarga
7525 3) we would mistakenly call the interface methods on an enumerator
7526 type that derived from IEnumerator and was in another assembly. For example:
7528 public class MyEnumerator : IEnumerator
7530 Would have the interface methods called, even if there were public impls of the
7531 method. In a struct, this lead to invalid IL code.
7533 2004-02-11 Marek Safar <marek.safar@seznam.cz>
7535 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
7538 * delegate.cs (Define): Fixed crash when delegate type is undefined.
7540 2004-02-11 Miguel de Icaza <miguel@ximian.com>
7542 * cs-parser.jay: Fix small regression: we were not testing V2
7543 compiler features correctly.
7545 * interface.cs: If the emit context is null, then create one
7547 2004-02-09 Marek Safar <marek.safar@seznam.cz>
7549 * decl.cs (GetSignatureForError): New virtual method to get full name
7552 * attribute.cs (IAttributeSupport): New interface for attribute setting.
7553 Now it is possible to rewrite ApplyAttributes method to be less if/else.
7555 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
7556 Duplicated members and code in these classes has been removed.
7557 Better encapsulation in these classes.
7559 2004-02-07 Miguel de Icaza <miguel@ximian.com>
7561 * assign.cs (Assign.DoResolve): When dealing with compound
7562 assignments, there is a new rule in ECMA C# 2.4 (might have been
7563 there before, but it is documented here) that states that in:
7567 If b is of type int, and the `op' is a shift-operator, then the
7568 above is evaluated as:
7572 * expression.cs (Binary.ResolveOperator): Instead of testing for
7573 int/uint/long/ulong, try to implicitly convert to any of those
7574 types and use that in pointer arithmetic.
7576 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
7577 method to print information for from the type, not from the
7578 null-method we were given.
7580 2004-02-01 Duncan Mak <duncan@ximian.com>
7582 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
7583 parsing for cmd, fixes bug #53694.
7585 2004-02-04 Marek Safar <marek.safar@seznam.cz>
7587 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
7588 in the member name duplication tests. Property and operator name duplication
7589 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
7591 2004-02-03 Marek Safar <marek.safar@seznam.cz>
7593 * interface.cs (PopulateMethod): Fixed crash when interface method
7594 returns not existing type (error test cs0246-3.cs).
7596 2004-02-02 Ravi Pratap M <ravi@ximian.com>
7598 * cs-parser.jay (interface_accessors): Re-write actions to also
7599 store attributes attached to get and set methods. Fix spelling
7602 (inteface_property_declaration): Modify accordingly.
7604 (InterfaceAccessorInfo): New helper class to store information to pass
7605 around between rules that use interface_accessors.
7607 * interface.cs (Emit): Apply attributes on the get and set
7608 accessors of properties and indexers too.
7610 * attribute.cs (ApplyAttributes): Modify accordingly to use the
7611 right MethodBuilder when applying attributes to the get and set accessors.
7613 2004-01-31 Miguel de Icaza <miguel@ximian.com>
7615 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
7617 2004-01-26 Miguel de Icaza <miguel@ximian.com>
7619 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
7621 2004-01-25 Miguel de Icaza <miguel@ximian.com>
7623 * cs-parser.jay: Remove YIELD token, instead use the new grammar
7624 changes that treat `yield' specially when present before `break'
7627 * cs-tokenizer.cs: yield is no longer a keyword.
7629 2004-01-23 Marek Safar <marek.safar@seznam.cz>
7631 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
7632 setting for default constructors.
7633 For default constructors are almost every time set wrong Modifier. The
7634 generated IL code has been alright. But inside mcs this values was
7635 wrong and this was reason why several of my CLS Compliance tests
7638 2004-01-22 Martin Baulig <martin@ximian.com>
7640 * cs-parser.jay (namespace_or_type_name): Return an Expression,
7641 not a QualifiedIdentifier. This is what `type_name_expression'
7642 was previously doing.
7643 (type_name_expression): Removed; the code is now in
7644 `namespace_or_type_name'.
7645 (qualified_identifier): Removed, use `namespace_or_type_name'
7647 (QualifiedIdentifier): Removed this class.
7649 2004-01-22 Martin Baulig <martin@ximian.com>
7651 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
7652 not a string as alias name.
7654 2004-01-21 Miguel de Icaza <miguel@ximian.com>
7656 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
7657 #52730 bug, and instead compute correctly the need to use a
7658 temporary variable when requesting an address based on the
7659 static/instace modified of the field and the constructor.
7661 2004-01-21 Martin Baulig <martin@ximian.com>
7663 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
7664 class and namespace before looking up aliases. Fixes #52517.
7666 2004-01-21 Martin Baulig <martin@ximian.com>
7668 * flowanalysis.cs (UsageVector.Merge): Allow variables being
7669 assinged in a 'try'; fixes exception4.cs.
7671 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7672 * class.cs : Implemented parameter-less constructor for TypeContainer
7674 * decl.cs: Attributes are now stored here. New property OptAttributes
7676 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
7678 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
7680 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7682 * typemanager.cs (CSharpSignature): Now reports also inner class name.
7683 (CSharpSignature): New method for indexer and property signature.
7685 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7687 * pending.cs (IsVirtualFilter): Faster implementation.
7689 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7691 * typemanager.cs: Avoid inclusion of same assembly more than once.
7693 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7695 * cs-parser.jay: Fixed problem where the last assembly attribute
7696 has been applied also to following declaration (class, struct, etc.)
7698 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7700 * class.cs: Added error CS0538, CS0539 reporting.
7701 Fixed crash on Microsoft runtime when field type is void.
7703 * cs-parser.jay: Added error CS0537 reporting.
7705 * pending.cs: Added error CS0535 reporting.
7706 Improved error report for errors CS0536, CS0534.
7708 2004-01-20 Miguel de Icaza <miguel@ximian.com>
7710 Merge a few bits from the Anonymous Method MCS tree.
7712 * statement.cs (ToplevelBlock): New class for toplevel methods,
7713 will hold anonymous methods, lifted variables.
7715 * cs-parser.jay: Create toplevel blocks for delegates and for
7716 regular blocks of code.
7718 2004-01-20 Martin Baulig <martin@ximian.com>
7720 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
7721 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
7722 and `NeedExplicitReturn'; added `IsLastStatement'.
7723 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
7724 have a `ReturnLabel' or we're not unreachable.
7726 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
7727 child's reachability; don't just override ours with it. Fixes
7728 #58058 (lluis's example).
7729 (FlowBranching): Added public InTryOrCatch(), InCatch(),
7730 InFinally(), InLoop(), InSwitch() and
7731 BreakCrossesTryCatchBoundary() methods.
7733 * statement.cs (Return): Do all error checking in Resolve().
7734 Unless we are the last statement in a top-level block, always
7735 create a return label and jump to it.
7736 (Break, Continue): Do all error checking in Resolve(); also make
7737 sure we aren't leaving a `finally'.
7738 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
7739 statement in a top-level block.
7740 (Block.Flags): Added `IsDestructor'.
7741 (Block.IsDestructor): New public property.
7743 2004-01-20 Martin Baulig <martin@ximian.com>
7745 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
7747 2004-01-20 Martin Baulig <martin@ximian.com>
7749 * statement.cs (Statement.ResolveUnreachable): New public method.
7750 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
7751 (Block.Resolve): Resolve unreachable statements.
7753 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7755 * expression.cs: We need to fix the case where we do
7756 not have a temp variable here.
7758 * assign.cs: Only expression compound assignments need
7759 temporary variables.
7761 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7763 * flowanalysis.cs: Reduce memory allocation in a few ways:
7764 - A block with no variables should not allocate a bit
7766 - A method with no out parameters does not need any tracking
7767 for assignment of the parameters, so we need not allocate
7770 public readonly Type[] VariableTypes;
7771 public readonly string[] VariableNames;
7772 Are redundant. The data is already stored in the variable
7773 map, so we need not allocate another array for it.
7774 - We need to add alot of checks for if (params | locals) == null
7775 due to the first two changes.
7777 2004-01-18 Miguel de Icaza <miguel@ximian.com>
7779 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
7780 implement IMemoryLocation, we store a copy on a local variable and
7781 take the address of it. Patch from Benjamin Jemlich
7783 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
7784 to use a special "type_name_expression" rule which reduces the
7785 number of "QualifiedIdentifier" classes created, and instead
7786 directly creates MemberAccess expressions.
7788 2004-01-17 Miguel de Icaza <miguel@ximian.com>
7790 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
7791 that fixes #52853. Null literal assignment to ValueType
7793 * class.cs (MethodData.Emit): Instead of checking the name of the
7794 method to determine if its a destructor, create a new derived
7795 class from Method called Destructor, and test for that.
7797 * cs-parser.jay: Create a Destructor object instead of a Method.
7799 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
7803 2004-01-16 Miguel de Icaza <miguel@ximian.com>
7805 * expression.cs (Binary.ResolveOperator): Perform an implicit
7806 conversion from MethodGroups to their delegate types on the
7809 * delegate.cs: Introduce a new class DelegateCreation that is the
7810 base class for `NewDelegate' and `ImplicitDelegateCreation',
7811 factor some code in here.
7813 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
7814 conversion from MethodGroups to compatible delegate types.
7816 * ecore.cs (Expression.Resolve): Do not flag error 654
7817 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
7818 we allow conversions from MethodGroups to delegate types now.
7820 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
7821 assignments in v2 either.
7823 2004-01-10 Miguel de Icaza <miguel@ximian.com>
7825 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
7826 static read-only fields in ctors.
7828 Applied patch from Benjamin Jemlich
7830 * expression.cs (UnaryMutator): Avoid leaking local variables.
7832 2004-01-09 Miguel de Icaza <miguel@ximian.com>
7834 * cs-tokenizer.cs (IsCastToken): Allow the various native types
7835 here to return true, as they can be used like this:
7839 Fixed 49836 and all the other dups
7841 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
7843 * driver.cs: Implement /win32res and /win32icon.
7845 2004-01-08 Miguel de Icaza <miguel@ximian.com>
7847 * cs-parser.jay: Add a rule to improve error handling for the
7848 common mistake of placing modifiers after the type.
7850 2004-01-07 Miguel de Icaza <miguel@ximian.com>
7852 * cs-parser.jay (interface_event_declaration): Catch
7853 initialization of events on interfaces, and report cs0068
7855 * cs-parser.jay (interface_event_declaration): Catch
7856 initialization of events.
7858 * ecore.cs: Better report missing constructors.
7860 * expression.cs (Binary.ResolveOperator): My previous bug fix had
7861 the error reporting done in the wrong place. Fix.
7863 * expression.cs (Binary.ResolveOperator): Catch the
7864 operator + (E x, E y) error earlier, and later allow for implicit
7865 conversions in operator +/- (E e, U x) from U to the underlying
7868 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
7869 52596, if the container class is abstract, the default constructor
7870 is protected otherwise its public (before, we were always public).
7872 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
7875 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
7876 Jemlich that fixes bug #52597, MCS was generating invalid code for
7877 idisposable structs. Thanks to Ben for following up with this
7880 2004-01-06 Miguel de Icaza <miguel@ximian.com>
7882 * driver.cs: Allow assemblies without code to be generated, fixes
7885 2004-01-07 Nick Drochak <ndrochak@gol.com>
7887 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
7889 2004-01-05 Miguel de Icaza <miguel@ximian.com>
7891 * cs-parser.jay: Add rules to improve error reporting if fields or
7892 methods are declared at the namespace level (error 116)
7894 * Add rules to catch event add/remove
7896 2004-01-04 David Sheldon <dave-mono@earth.li>
7898 * expression.cs: Added matching ")" to error message for
7901 2004-01-03 Todd Berman <tberman@gentoo.org>
7903 * ecore.cs, attribute.cs:
7904 Applying fix from #52429.
7906 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7908 * ecore.cs, expression.cs, statement.cs:
7909 Total rewrite of how we handle branching. We
7910 now handle complex boolean expressions with fewer
7911 jumps. As well if (x == 0) no longer emits a ceq.
7913 if (x is Foo) is much faster now, because we generate
7916 Overall, we get a pretty big improvement on our benchmark
7917 tests. The code we generate is smaller and more readable.
7919 I did a full two-stage bootstrap. The patch was reviewed
7920 by Martin and Miguel.
7922 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7924 * cs-parser.jay: Make primary_expression not take a QI.
7925 we dont need this because the member_access rule covers
7926 us here. So we replace the rule with just IDENTIFIER.
7928 This has two good effects. First, we remove a s/r conflict.
7929 Second, we allocate many fewer QualifiedIdentifier objects.
7931 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7933 * attribute.cs: Handle MarshalAs attributes as pseudo, and
7934 set the correct information via SRE. This prevents
7935 hanging on the MS runtime. Fixes #29374.
7937 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
7939 * convert.cs: correctly handle conversions to value types
7940 from Enum and ValueType as unboxing conversions.
7942 Fixes bug #52569. Patch by Benjamin Jemlich.
7944 2004-01-02 Ravi Pratap <ravi@ximian.com>
7946 * expression.cs (BetterConversion): Prefer int -> uint
7947 over int -> ulong (csc's behaviour). This fixed bug #52046.
7949 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
7951 * decl.cs (MemberCache.FindMembers): now returns a
7954 * typemanager.cs: In general, go with with ^^.
7955 (CopyNewMethods): take an IList.
7956 (RealMemberLookup): Only allocate an arraylist
7957 if we copy from two sets of methods.
7959 This change basically does two things:
7960 1) Fewer array lists allocated due to CopyNewMethods.
7961 2) the explicit cast in MemberList costed ALOT.
7963 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
7965 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
7966 a hashtable to avoid needless string allocations when an identifier is
7967 used more than once (the common case).
7969 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
7971 * pending.cs: MS's TypeBuilder.GetInterfaces ()
7972 is broken, it will not return anything. So, we
7973 have to use the information we have in mcs to
7976 * typemanager.cs: Add a cache for GetInterfaces,
7977 since this will now be used more often (due to ^^)
7979 (GetExplicitInterfaces) New method that gets the
7980 declared, not effective, interfaces on a type
7981 builder (eg, if you have interface IFoo, interface
7982 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
7985 This patch makes MCS able to bootstrap itself on
7988 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
7990 * expression.cs: Remove the Nop's that Miguel put
7993 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
7995 * report.cs, codegen.cs: Give the real stack trace to
7996 the error when an exception is thrown.
7998 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8000 * decl.cs: only allocate hashtables for ifaces if
8003 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8005 * expression.cs: fix the error from cs0121-2.cs
8006 (a parent interface has two child interfaces that
8007 have a function with the same name and 0 params
8008 and the function is called through the parent).
8010 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8012 * class.cs, rootcontext.cs, typmanager.cs: do not
8015 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8017 * codegen.cs: remove stack for the ec flow branching.
8018 It is already a linked list, so no need.
8020 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8022 * Makefile: Allow custom profiler here.
8024 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8026 * typemanager.cs (LookupType):
8027 - Use a static char [], because split takes
8028 a param array for args, so it was allocating
8030 - Do not store true in a hashtable, it boxes.
8032 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8034 * flowanalysis.cs: bytify common enums.
8036 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8038 * modifiers.cs: Add a new set of flags for the
8039 flags allowed on explicit interface impls.
8040 * cs-parser.jay: catch the use of modifiers in
8041 interfaces correctly.
8042 * class.cs: catch private void IFoo.Blah ().
8044 All related to bug #50572.
8046 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8048 * decl.cs: Rewrite the consistant accessability checking.
8049 Accessability is not linear, it must be implemented in
8050 a tableish way. Fixes #49704.
8052 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8054 * expression.cs: Handle negation in a checked context.
8055 We must use subtraction from zero. Fixes #38674.
8057 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8059 * class.cs: Ignore static void main in DLLs.
8060 * rootcontext.cs: Handle the target type here,
8061 since we are have to access it from class.cs
8062 * driver.cs: account for the above.
8064 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8066 * report.cs: Give line numbers and files if available.
8068 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8070 * driver.cs: Implement /addmodule.
8072 * typemanager.cs: Change 'modules' field so it now contains Modules not
8075 2003-12-20 Martin Baulig <martin@ximian.com>
8077 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8078 (FieldBase.IsAssigned): Removed this field.
8079 (FieldBase.SetAssigned): New public method.
8080 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8082 2003-12-20 Martin Baulig <martin@ximian.com>
8084 * expression.cs (LocalVariableReference.DoResolve): Don't set
8085 `vi.Used' if we're called from DoResolveLValue().
8087 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8088 returns the usage vector it just merged into the current one -
8089 pass this one to UsageWarning().
8090 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8091 of the `EmitContext', don't call this recursively on our children.
8093 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8095 * driver.cs: Implement /target:module.
8097 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8099 * support.cs (CharArrayHashtable): New helper class.
8101 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8102 char arrays, not strings, so we can avoid creating a string in
8103 consume_identifier if the identifier is a keyword.
8105 2003-12-16 Martin Baulig <martin@ximian.com>
8107 * statement.cs (LocalInfo.Assigned): Removed this property.
8108 (LocalInfo.Flags): Removed `Assigned'.
8109 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8110 and uses flow analysis.
8111 (Block.UsageWarning): Made this method private.
8112 (Block.Resolve): Call UsageWarning() if appropriate.
8114 * expression.cs (LocalVariableReference.DoResolve): Always set
8115 LocalInfo.Used here.
8117 2003-12-13 Martin Baulig <martin@ximian.com>
8119 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8120 any value here; we're now using flow analysis to figure out
8121 whether a statement/block returns a value.
8123 2003-12-13 Martin Baulig <martin@ximian.com>
8125 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8127 (FlowBranching.MergeFinally): Don't call
8128 `branching.CheckOutParameters()' here, this is called in
8130 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8131 when adding the `finally' vector.
8133 2003-12-13 Martin Baulig <martin@ximian.com>
8136 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8137 actually work and also fix #48962.
8139 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8141 * decl.cs: Do not check System.Object for nested types,
8142 since we know it does not have any. Big bang for buck:
8147 corlib: 17.99 seconds
8151 corlib: 17.39 seconds
8153 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8155 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8156 time we are returning 0 members, so we save alot here.
8158 2003-12-11 Martin Baulig <martin@ximian.com>
8160 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8161 `MergeChild()', also just take the `FlowBranching' as argument;
8162 call Merge() on it and return the result.
8163 (FlowBranching.Merge): We don't need to do anything if we just
8166 2003-12-11 Martin Baulig <martin@ximian.com>
8168 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8169 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8170 Maurer for this idea.
8172 2003-12-11 Martin Baulig <martin@ximian.com>
8174 * flowanalysis.cs (MergeResult): This class is now gone; we now
8175 use the `UsageVector' for this. The reason for this is that if a
8176 branching just has one sibling, we don't need to "merge" them at
8177 all - that's the next step to do.
8178 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8181 2003-12-11 Martin Baulig <martin@ximian.com>
8183 Reworked flow analyis and made it more precise and bug-free. The
8184 most important change is that we're now using a special `Reachability'
8185 class instead of having "magic" meanings of `FlowReturns'. I'll
8186 do some more cleanups and optimizations and also add some more
8187 documentation this week.
8189 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8190 largely reworked this class.
8191 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8192 the new `Reachability' class instead of having "magic" values here.
8193 (FlowBranching): We're now using an instance of `Reachability'
8194 instead of having separate `Returns', `Breaks' etc. fields.
8196 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8197 based on flow analysis; ignore the return value of block.Emit ().
8199 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8201 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8202 if they are private.
8204 2003-12-09 Martin Baulig <martin@ximian.com>
8206 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8207 call them directly on the UsageVector.
8209 2003-12-09 Martin Baulig <martin@ximian.com>
8211 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8212 Changed return type from `FlowReturns' to `Reachability'.
8214 2003-12-09 Martin Baulig <martin@ximian.com>
8216 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8217 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8218 `Reachable' fields with a single `Reachability' one.
8220 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8222 * class.cs (FindMembers): Remove foreach's.
8235 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8240 This patch does a few things:
8241 1. EmptyStatement is now a singleton, so it is never reallocated.
8242 2. All blah is EmptyStatement constructs have been changed to
8243 blah == EmptyStatement.Value, which is much faster and valid
8244 now that EmptyStatement is a singleton.
8245 3. When resolving a block, rather than allocating a new array for
8246 the non-empty statements, empty statements are replaced with
8247 EmptyStatement.Value
8248 4. Some recursive functions have been made non-recursive.
8249 Mainly the performance impact is from (3), however (1) and (2) are needed for
8250 this to work. (4) does not make a big difference in normal situations, however
8251 it makes the profile look saner.
8256 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8257 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8258 Total memory allocated: 56397 KB
8261 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
8262 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
8263 Total memory allocated: 55666 KB
8265 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8267 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
8268 than the hashtable in a hashtable version
8270 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
8271 we always end up concating a string. This results in a huge perf
8272 loss, because many strings have to be tracked by the GC. In this
8273 patch, we first use a hashtable that works with two keys, so that
8274 the strings do not need to be concat'ed.
8285 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8287 * Makefile: Add a new target `do-time' that does a quick and simple
8288 profile, leaving easy to parse output.
8290 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
8292 * codegen.cs (Init): Create the dynamic assembly with
8293 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
8295 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
8297 * support.cs: Make the PtrHashtable use only one
8298 instance of its comparer.
8300 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
8302 * typemanager.cs: Fix lookup of GetNamespaces.
8304 2003-11-29 Miguel de Icaza <miguel@ximian.com>
8306 * expression.cs: Removed redundant line.
8308 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
8309 ArrayLists, use for loops with bounds.
8311 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
8314 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
8315 arraylists, use for loop with bounds.
8317 The above three changes give us a 0.071 second performance
8318 improvement out of 3.294 seconds down to 3.223. On my machine
8319 the above changes reduced the memory usage by 1,387 KB during
8322 * cs-parser.jay (QualifiedIdentifier): New class used to represent
8323 QualifiedIdentifiers. Before we created a new string through
8324 concatenation, and mostly later on, the result would be
8325 manipulated by DecomposeQI through string manipulation.
8327 This reduced the compiler memory usage for bootstrapping from
8328 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
8329 compile times in 0.05 seconds.
8331 2003-11-28 Dick Porter <dick@ximian.com>
8333 * support.cs: Do string compares with the Invariant culture.
8341 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
8342 the comparison is done with the Invariant culture.
8344 2003-11-27 Miguel de Icaza <miguel@ximian.com>
8346 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
8347 GetEnumerator method.
8349 (ProbeCollectionType): Iterate starting at the most specific type
8350 upwards looking for a GetEnumerator
8352 * expression.cs: Shift count can be up to 31 for int/uint and 63
8355 2003-11-26 Miguel de Icaza <miguel@ximian.com>
8357 * statement.cs (Block.LookupLabel): Also look for the label on the
8358 children blocks. Use a hash table to keep track of visited
8361 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
8362 we actually did transform the other operand, otherwise fall back
8363 to the common codepath that casts to long.
8365 * cs-tokenizer.cs: Use the same code pattern as the int case.
8366 Maybe I should do the parsing myself, and avoid depending on the
8367 Parse routines to get this done.
8369 2003-11-25 Miguel de Icaza <miguel@ximian.com>
8371 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8372 which fixes bug 51347. This time test it.
8374 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
8375 attributes for example can not tell the difference between these.
8376 The difference was only a syntax feature of the language.
8378 * attribute.cs: Apply attributes to delegates.
8380 * delegate.cs: Call the apply attributes method.
8382 2003-11-24 Miguel de Icaza <miguel@ximian.com>
8384 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
8385 comparing 0 vs Byte.MinValue, not the value
8387 (ImplicitConversionRequired): When reporting a conversion error,
8388 use error 31 to print out the constant error instead of the
8391 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8392 which fixes bug 51347.
8394 2003-11-22 Miguel de Icaza <miguel@ximian.com>
8396 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
8397 which fixes the -warnaserror command line option.
8399 2003-11-21 Miguel de Icaza <miguel@ximian.com>
8401 * cfold.cs (DoNumericPromotions): During constant folding of
8402 additions on UIntConstant, special case intconstants with
8403 IntConstants like we do on the expression binary operator.
8405 2003-11-12 Miguel de Icaza <miguel@ximian.com>
8407 * convert.cs (ImplicitReferenceConversion): We were missing a case
8408 (System.Enum are not value types or class types, so we need to
8409 classify them separatedly).
8411 * driver.cs: We do not support error 2007.
8413 2003-11-12 Jackson Harper <jackson@ximian.com>
8415 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
8416 system directory. Also use the full file name so users can
8417 libraries names mscorlib-o-tron.dll in a non system dir.
8419 2003-11-10 Martin Baulig <martin@ximian.com>
8421 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
8422 (TypeManager.InitCoreTypes): Initialize them here, but instead of
8423 calling `ResolveType()' on them, directly assign their `Type'.
8425 2003-11-08 Martin Baulig <martin@ximian.com>
8427 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
8428 return value and the `out parent' parameter.
8429 (TypeContainer.DefineType): Moved the CS0644 check into
8430 GetClassBases(). Don't pass the interface types to the
8431 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
8432 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
8434 * ecore.cs (TypeExpr.IsAttribute): New property.
8435 (TypeExpr.GetInterfaces): New method.
8437 * interface.cs (Interface.GetInterfaceTypeByName): Return a
8438 TypeExpr instead of a Type.
8439 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
8440 (Interface.DefineType): Don't pass the interface types to the
8441 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
8442 them later and then call `TypeBulider.AddInterfaceImplementation()'.
8444 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
8445 instead of a `Type[]'.
8446 (TypeManager.RegisterBuilder): Likewise.
8447 (TypeManager.AddUserInterface): Likewise.
8448 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
8449 `Type[]' and also return a `TypeExpr[]'.
8450 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
8452 2003-11-08 Martin Baulig <martin@ximian.com>
8454 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
8457 2003-11-08 Martin Baulig <martin@ximian.com>
8459 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
8460 TypeManager.ResolveExpressionTypes().
8462 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
8463 instead of an Expression.
8464 (TypeExpr): This is now an abstract base class for `TypeExpression'.
8465 (TypeExpression): New public class; formerly known as `TypeExpr'.
8467 * expression.cs (ComposedCast): Derive from TypeExpr.
8469 * typemanager.cs (TypeManager.system_*_expr): These are now
8470 TypExpr's instead of Expression's.
8471 (TypeManager.ResolveExpressionTypes): New public static function;
8472 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
8475 2003-11-06 Miguel de Icaza <miguel@ximian.com>
8477 * expression.cs (New.DoResolve): Do not dereference value that
8478 might be a null return.
8480 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
8481 sure that the constant value has the right type. Fixes an
8482 unreported bug, similar to 50425.
8484 * const.cs (Const.LookupConstantValue): Call
8485 ImplicitStandardConversionExists before doing a conversion to
8486 avoid havng the TypeManager.ChangeType do conversions.
8488 Reduced the number of casts used
8490 (Const.ChangeType): New routine to enable reuse of the constant
8491 type changing code from statement.
8493 * typemanager.cs (ChangeType): Move common initialization to
8494 static global variables.
8498 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
8499 every value type to go through, even if it was void. Fix that.
8501 * cs-tokenizer.cs: Use is_identifier_start_character on the start
8502 character of the define, and the is_identifier_part_character for
8503 the rest of the string.
8505 2003-11-05 Miguel de Icaza <miguel@ximian.com>
8507 * expression.cs (UnaryMutator.EmitCode): When I updated
8508 LocalVariableReference.DoResolve, I overdid it, and dropped an
8509 optimization done on local variable references.
8511 2003-11-04 Miguel de Icaza <miguel@ximian.com>
8513 * ecore.cs: Convert the return from Ldlen into an int.
8515 2003-10-20 Miguel de Icaza <miguel@ximian.com>
8517 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
8518 the accessibility, this is a special case for toplevel non-public
8519 classes (internal for instance).
8521 2003-10-20 Nick Drochak <ndrochak@gol.com>
8523 * ecore.cs: Fix typo and build. Needed another right paren.
8525 2003-10-19 Miguel de Icaza <miguel@ximian.com>
8527 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
8528 `internal' case regular and protected, but not allowing protected
8529 to be evaluated later. Bug 49840
8531 2003-10-15 Miguel de Icaza <miguel@ximian.com>
8533 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
8534 to kb.Nlast, and not the kb.nFirst to isolate the switch
8537 Extract the underlying type, so enumerations of long/ulong are
8538 treated like long/ulong.
8540 2003-10-14 Miguel de Icaza <miguel@ximian.com>
8542 * expression.cs (New): Overload the meaning of RequestedType to
8543 track the possible creation of the NewDelegate type, since
8544 DoResolve is invoked more than once for new constructors on field
8547 See bugs: #48800 and #37014
8549 * cs-parser.jay (declare_local_constants): Take an arraylist
8550 instead of a single constant.
8552 (local_constant_declaration): It should take a
8553 constant_declarators, not a constant_declarator. Fixes 49487
8555 * convert.cs: Fix error report.
8557 2003-10-13 Jackson Harper <jackson@ximian.com>
8559 * typemanager.cs (TypeToCoreType): Add float and double this fixes
8562 2003-10-09 Martin Baulig <martin@ximian.com>
8564 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
8566 (MethodCore.DoDefineParameters): Removed the TypeContainer
8567 argument; use the DeclSpace which was passed to the .ctor instead.
8568 (MethodCore.CheckParameter): Take a DeclSpace instead of a
8569 TypeContainer; we only need a DeclSpace here.
8571 2003-10-09 Martin Baulig <martin@ximian.com>
8573 * class.cs (MethodData): Added additional `DeclSpace ds' argument
8575 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
8576 EmitContext's .ctor.
8578 2003-10-09 Martin Baulig <martin@ximian.com>
8580 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
8581 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
8582 AsAccessible(), moved them as well.
8584 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
8586 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
8588 * cs-parser.jay : Renamed yyName to yyNames related to jay.
8590 2003-10-07 Miguel de Icaza <miguel@ximian.com>
8592 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
8593 generation for >=, as spotted by Paolo, bug 48679.
8594 Patch from David Waite.
8596 * cs-tokenizer.cs: Add handling for #pragma.
8598 * cs-parser.jay: Allow for both yield and yield return in the
8599 syntax. The anti-cobolization of C# fight will go on!
8601 * class.cs (TypeBuilder.DefineType): Catch error condition here
8602 (Parent.DefineType erroring out and returning null).
8604 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8605 coping with enumerations variables, we were mistakenly processing
8606 them as a regular value type instead of built-in types. Fixes the
8609 * typemanager.cs (IsBuiltinOrEnum): New method.
8611 2003-09-30 Miguel de Icaza <miguel@ximian.com>
8613 * cs-parser.jay: Upgrade: yield now needs the return clause.
8615 2003-09-19 Martin Baulig <martin@ximian.com>
8617 * decl.cs (MemberCache.SetupCacheForInterface): Take a
8618 `MemberCache parent' argument. Normally, an interface doesn't
8619 have a parent type except System.Object, but we use this in gmcs
8620 for generic type parameters.
8622 2003-09-18 Martin Baulig <martin@ximian.com>
8624 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
8625 on `type.IsInterface'; don't check whether the type has a parent
8626 to determine whether it's an interface.
8628 2003-09-15 Martin Baulig <martin@ximian.com>
8630 * class.cs (TypeContainer.DefineType): Added an error flag to
8631 avoid reporting duplicate CS0146's ("class definition is
8634 * driver.cs (Driver.MainDriver): Abort if
8635 RootContext.ResolveTree() reported any errors.
8637 2003-09-07 Martin Baulig <martin@ximian.com>
8639 * report.cs (Error, Warning): Added overloaded versions which take
8640 a `params object[] args' and call String.Format().
8642 2003-09-07 Martin Baulig <martin@ximian.com>
8644 * decl.cs (DeclSpace..ctor): Don't call
8645 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
8646 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
8647 (DeclSpace.RecordDecl): New method.
8649 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
8651 2003-09-02 Ravi Pratap <ravi@ximian.com>
8653 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
8654 value attributes to be applied to ParameterBuilders.
8656 * class.cs (MethodCore.LabelParameters): Make static and more
8657 generic so that it can be used from other places - like interface
8658 methods, for instance.
8660 * interface.cs (Interface.Emit): Call LabelParameters before
8661 emitting attributes on the InterfaceMethod.
8663 2003-08-26 Martin Baulig <martin@ximian.com>
8665 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
8666 resolving aliases; fixes #47927.
8668 2003-08-26 Martin Baulig <martin@ximian.com>
8670 * statement.cs (Using.DoResolve): This is internally emitting a
8671 try/finally clause, so we need to set ec.NeedExplicitReturn if we
8672 do not always return. Fixes #47681.
8674 2003-08-26 Martin Baulig <martin@ximian.com>
8676 * decl.cs (MemberCore): Moved WarningNotHiding(),
8677 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
8679 (AdditionResult): Make this nested in DeclSpace.
8680 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
8681 argument; call NamespaceEntry.Define() unless we're nested in a
8684 * namespace.cs (Namespace.DefineName): New public function. This
8685 is called from DeclSpace's .ctor to add
8686 (Namespace.Lookup): Include DeclSpaces in the lookup.
8688 * class.cs (Operator): Derive from MemberBase, not MemberCore.
8690 * const.cs (Const): Derive from MemberBase, not MemberCore.
8692 2003-08-25 Martin Baulig <martin@ximian.com>
8694 * convert.cs (Convert.ExplicitReferenceConversion): When
8695 converting from an interface type to a class, unbox if the target
8696 type is a struct type. Fixes #47822.
8698 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8700 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
8703 2003-08-22 Martin Baulig <martin@ximian.com>
8705 * class.cs (TypeManager.DefineType): When defining a nested type,
8706 call DefineType() on our parent; fixes #47801.
8708 2003-08-22 Martin Baulig <martin@ximian.com>
8710 * class.cs (MethodData.Define): While checking if a method is an
8711 interface implementation, improve the test a bit more to fix #47654.
8713 2003-08-22 Martin Baulig <martin@ximian.com>
8715 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
8716 correctly; fixes #47722.
8718 2003-08-22 Martin Baulig <martin@ximian.com>
8720 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
8721 LocalVariableReference, ensure it's not read-only. Fixes #47536.
8723 * statement.cs (Fixed.DoResolve): Make all variables read-only.
8725 2003-08-22 Martin Baulig <martin@ximian.com>
8727 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
8728 can only be assigned in static constructors. Fixes #47161.
8730 2003-08-22 Martin Baulig <martin@ximian.com>
8732 Rewrote and improved the flow analysis code.
8734 * flowbranching.cs (FlowBranching): Make this class abstract.
8735 (FlowBranching.CreateBranching): New static function to create a
8737 (FlowBranchingBlock, FlowBranchingException): New classes.
8738 (FlowBranching.UsageVector.Type): New public readonly field.
8739 (FlowBranching.UsageVector.Breaks): Removed the setter.
8740 (FlowBranching.UsageVector.Returns): Removed the setter.
8741 (FlowBranching.UsageVector): Added Break(), Return(),
8742 NeverReachable() and Throw() methods to modify the reachability.
8743 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
8744 done by FlowBranching.Merge().
8745 (FlowBranching.UsageVector.MergeChild): New method; merges the
8746 merge result into the current vector.
8747 (FlowBranching.Merge): New abstract method to merge a branching.
8749 2003-08-12 Martin Baulig <martin@ximian.com>
8751 * expression.cs (Indirection.CacheTemporaries): Create the
8752 LocalTemporary with the pointer type, not its element type.
8754 2003-08-10 Miguel de Icaza <miguel@ximian.com>
8756 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
8757 token was a keyword or not.
8759 Add `error' options where an IDENTIFIER was expected; Provide
8760 CheckToken and CheckIdentifierToken convenience error reporting
8763 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
8765 * decl.cs: Rename `NamespaceEntry Namespace' public field into
8766 NameSpaceEntry NameSpaceEntry.
8768 (LookupInterfaceOrClass): Avoid creating a full qualified name
8769 from namespace and name: avoid doing lookups when we know the
8770 namespace is non-existant. Use new Tree.LookupByNamespace which
8771 looks up DeclSpaces based on their namespace, name pair.
8773 * driver.cs: Provide a new `parser verbose' to display the
8774 exception thrown during parsing. This is turned off by default
8775 now, so the output of a failure from mcs is more graceful.
8777 * namespace.cs: Track all the namespaces defined in a hashtable
8780 (IsNamespace): New method
8782 2003-08-09 Miguel de Icaza <miguel@ximian.com>
8784 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
8785 we know that we need to concatenate (full typename can never be
8790 * statement.cs: Use a bitfield; Do not initialize to null things
8791 which are done by the constructor by default.
8793 * cs-parser.jay: bug fix, parameter was 4, not 3.
8795 * expression.cs: Just use the property;
8797 * statement.cs: No need for GetVariableInfo method.
8799 2003-08-08 Martin Baulig <martin@ximian.com>
8801 * flowanalysis.cs (FlowReturns): This is now nested in the
8802 `FlowBranching' class.
8803 (MyBitVector): Moved this here from statement.cs.
8804 (FlowBranching.SiblingType): New enum type.
8805 (FlowBranching.CreateSibling): Added `SiblingType' argument.
8807 2003-08-07 Martin Baulig <martin@ximian.com>
8809 * flowanalysis.cs (FlowBranchingType): This is now nested in the
8810 `FlowBranching' class and called `BranchingType'.
8812 2003-08-07 Martin Baulig <martin@ximian.com>
8814 * flowanalysis.cs: Moved all the control flow analysis code into
8817 2003-08-07 Martin Baulig <martin@ximian.com>
8819 * assign.cs (Assign.DoResolve): `target' must either be an
8820 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
8823 2003-08-07 Miguel de Icaza <miguel@ximian.com>
8825 * expression.cs (BinaryMethod): This kind of expression is created by the
8826 Binary class if it determines that the operator has to be handled
8829 (BinaryDelegate): This kind of expression is created if we are
8830 dealing with a + or - operator on delegates.
8832 (Binary): remove method, argumetns, and DelegateOperator: when
8833 dealing with methods,
8835 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
8837 * statement.cs (Block): use bitfields for the three extra booleans
8838 we had in use. Remove unused topblock parameter.
8840 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
8842 * assign.cs: Drop extra unneeded tests.
8844 2003-08-06 Miguel de Icaza <miguel@ximian.com>
8846 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
8848 * statement.cs (Foreach): Use VariableStorage instead of
8851 * codegen.cs (VariableStorage): New class used by clients that
8852 require a variable stored: locals or fields for variables that
8853 need to live across yield.
8855 Maybe provide a convenience api for EmitThis+EmitLoad?
8857 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
8860 2003-08-05 Miguel de Icaza <miguel@ximian.com>
8862 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
8863 RemapParameterLValue): New methods that are used to turn a
8864 precomputed FieldInfo into an expression like this:
8868 The idea is to use this instead of making LocalVariableReference
8869 have more than one meaning.
8871 * cs-parser.jay: Add error production to BASE.
8873 * ecore.cs: Deal with TypeManager.GetField returning null, which
8874 is now a valid return value.
8876 (FieldExprNoAddress): New expression for Fields whose address can
8879 * expression.cs (LocalVariableReference): During the resolve
8880 phases, create new expressions if we are in a remapping context.
8881 Remove code that dealt with remapping here.
8883 (ParameterReference): same.
8885 (ProxyInstance): New expression, like the `This' expression, but
8886 it is born fully resolved. We know what we are doing, so remove
8887 the errors that are targeted to user-provided uses of `this'.
8889 * statement.cs (Foreach): our variable is now stored as an
8890 Expression; During resolution, follow the protocol, dont just
8891 assume it will return this.
8893 2003-08-06 Martin Baulig <martin@ximian.com>
8895 * support.cs (SeekableStreamReader.cs): New public class.
8897 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
8898 SeekableStreamReader instead of the normal StreamReader.
8900 2003-08-04 Martin Baulig <martin@ximian.com>
8902 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
8903 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
8904 deambiguate casts and delegate invocations.
8905 (parenthesized_expression): Use the new tokens to ensure this is
8906 not a cast of method invocation.
8908 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
8909 when reading a `)' and Deambiguate_CloseParens () was previously
8912 * expression.cs (ParenthesizedExpression): New class. This is
8913 just used for the CS0075 test.
8914 (Binary.DoResolve): Check for CS0075.
8916 2003-07-29 Ravi Pratap <ravi@ximian.com>
8918 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
8919 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
8920 reference comparison.
8922 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
8923 examine the ReturnType for equality - this is necessary in the
8924 cases of implicit and explicit operators whose signature also
8925 includes the return type.
8927 2003-07-26 Miguel de Icaza <miguel@ximian.com>
8929 * namespace.cs: Cache the result of the namespace computation,
8930 instead of computing it every time.
8932 2003-07-24 Miguel de Icaza <miguel@ximian.com>
8934 * decl.cs: Use a global arraylist that we reuse over invocations
8935 to avoid excesive memory consumption. Reduces memory usage on an
8936 mcs compile by one meg (45 average).
8938 * typemanager.cs (LookupTypeReflection): In .NET pointers are
8939 private, work around that.
8941 2003-07-23 Miguel de Icaza <miguel@ximian.com>
8943 * literal.cs (IntLiteral): Define Zero and One static literals.
8945 * cs-parser.jay (integer_literal): use static literals to reduce
8946 memory usage for the most used literals (0, 1 and -1). 211kb
8947 reduced in memory usage.
8949 Replace all calls to `new ArrayList' with `new
8950 ArrayList(4)' which is a good average number for most allocations,
8951 and also requires only 16 bytes of memory for its buffer by
8954 This reduced MCS memory usage in seven megabytes for the RSS after
8957 2003-07-28 Ravi Pratap <ravi@ximian.com>
8959 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
8960 handle params methods the correct way by forming only one
8961 applicable set with params and normal methods in them. Earlier we
8962 were looking at params methods only if we found no normal methods
8963 which was not the correct thing to do.
8965 (Invocation.BetterFunction): Take separate arguments indicating
8966 when candidate and the best method are params methods in their
8969 This fixes bugs #43367 and #46199.
8971 * attribute.cs: Documentation updates.
8973 (CheckAttribute): Rename to CheckAttributeTarget.
8974 (GetValidPlaces): Rename to GetValidTargets.
8976 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
8977 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
8981 2003-07-28 Martin Baulig <martin@ximian.com>
8983 * class.cs (TypeContainer.DefineMembers): Use the base type's full
8984 name when looking up the base class of a nested class. Fixes #46977.
8986 2003-07-26 Martin Baulig <martin@ximian.com>
8988 * expression.cs (Indexers.Indexer): New nested struct; contains
8989 getter, setter and the indexer's type.
8990 (Indexers.Properties): This is now an ArrayList of
8992 (IndexerAccess.DoResolveLValue): Correctly set the type if the
8993 indexer doesn't have any getters.
8995 * assign.cs (Assign.DoResolve): Also do the implicit conversions
8996 for embedded property and indexer assignments.
8998 2003-07-26 Martin Baulig <martin@ximian.com>
9000 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
9001 preprocessor directive is not the first non-whitespace character
9004 2003-07-26 Martin Baulig <martin@ximian.com>
9006 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
9007 namespace parsing, follow the spec more closely.
9009 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
9010 NamespaceEntry.Lookup().
9012 2003-07-25 Martin Baulig <martin@ximian.com>
9014 * MethodCore.cs (OverridesSomething): New public field; it's set
9015 from TypeContainer.DefineMembers if this method overrides
9016 something (which doesn't need to be a method). Fix #39462.
9018 2003-07-25 Ravi Pratap <ravi@ximian.com>
9020 * typemanager.cs (GetMembers): Ensure that the list of members is
9021 reversed. This keeps things in sync.
9023 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
9024 find an AttributeUsage attribute.
9026 * expression.cs (Invocation.OverloadResolve): Perform the check
9027 which disallows Invoke to be directly called on a Delegate.
9029 (Error_InvokeOnDelegate): Report error cs1533.
9031 2003-07-25 Martin Baulig <martin@ximian.com>
9033 * expression.cs (Indexers.GetIndexersForType): Only look in the
9034 interface hierarchy if the requested type is already an
9035 interface. Fixes #46788 while keeping #46502 fixed.
9037 2003-07-25 Martin Baulig <martin@ximian.com>
9039 * class.cs (TypeContainer.DefineMembers): Check whether all
9040 readonly fields have been assigned and report warning CS0649 if
9043 * statement.cs (LocalInfo.IsFixed): Always return true if this is
9046 2003-07-24 Ravi Pratap <ravi@ximian.com>
9048 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
9049 returned from GetMethods to make things consistent with the
9050 assumptions MCS makes about ordering of methods.
9052 This should comprehensively fix bug #45127 and it does :-)
9054 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
9055 ordering is actually reverse.
9057 * Clean up some debug messages I left lying around.
9059 * interface.cs (Populate*): Get rid of code which emits attributes
9060 since the stage in which we emit attributes is the 'Emit' stage,
9061 not the define stage.
9063 (Emit): Move attribute emission for interface members here.
9065 2003-07-22 Ravi Pratap <ravi@ximian.com>
9067 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9068 closely: we eliminate methods in base types when we have an
9069 applicable method in a top-level type.
9071 Please see section 14.5.5.1 for an exact description of what goes
9074 This fixes bug #45127 and a host of other related to corlib compilation.
9076 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9077 array is the method corresponding to the top-level type (this is
9078 because of the changes made to icall.c) so we change this
9081 (MethodGroupExpr.Name): This too.
9083 * typemanager.cs (GetElementType): New method which does the right
9084 thing when compiling corlib.
9086 * everywhere: Make use of the above in the relevant places.
9088 2003-07-22 Martin Baulig <martin@ximian.com>
9090 * cs-parser.jay (invocation_expression): Moved
9091 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9092 `cast_expression', but create a InvocationOrCast which later
9093 resolves to either an Invocation or a Cast.
9095 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9096 method; call this before EmitStatement() to make sure that this
9097 expression can be used as a statement.
9099 * expression.cs (InvocationOrCast): New class; resolves to either
9100 an Invocation or a Cast.
9102 * statement.cs (StatementExpression): Call ResolveStatement() on
9103 the ExpressionStatement before emitting it.
9105 2003-07-21 Martin Baulig <martin@ximian.com>
9107 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
9108 `ref' and `out' attributes match; fixes #46220.
9109 (MemberAccess.ResolveMemberAccess): You can't reference a type
9110 through an expression; fixes #33180.
9111 (Indexers.GetIndexersForType): Don't return the indexers from
9112 interfaces the class implements; fixes #46502.
9114 2003-07-21 Martin Baulig <martin@ximian.com>
9116 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
9117 CS0661 checks; fixes bug #30442.
9119 2003-07-21 Martin Baulig <martin@ximian.com>
9121 * decl.cs (AdditionResult): Added `Error'.
9123 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
9125 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
9126 makes cs0031.cs actually work.
9128 2003-07-20 Martin Baulig <martin@ximian.com>
9130 * namespace.cs: Fixed that bug which caused a crash when compiling
9133 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9135 * typemanager.cs (LookupTypeReflection): Never expose types which
9136 are NotPublic, NestedPrivate, NestedAssembly, or
9137 NestedFamANDAssem. We used to return these, and later do a check
9138 that would report a meaningful error, but the problem is that we
9139 would not get the real match, if there was a name override.
9141 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9143 * namespace.cs (Namespace, Name): Do not compute the namespace
9144 name dynamically, compute it in the constructor. This reduced
9145 memory usage by 1697 KB.
9147 * driver.cs: Use --pause to pause at the end.
9149 2003-07-17 Peter Williams <peter@newton.cx>
9151 * Makefile: Change the name of the test target so that it doesn't
9152 conflict with the recursive test target.
9154 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9156 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9157 AddressOf): Do not use EmitThis, that was wrong, use the actual
9160 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9162 * class.cs (MethodData.Define): While checking if a method is an
9163 interface implementation, improve the test: If we are not public
9164 (use new test here: use the computed MethodAttributes directly,
9165 instead of the parsed modifier flags) check if the `implementing'
9166 method comes from an interface or not.
9168 * pending.cs (VerifyPendingMethods): Slightly better error
9171 * makefile: add test target that does the mcs bootstrap.
9173 2003-07-16 Ravi Pratap <ravi@ximian.com>
9175 * interface.cs (Define): Do nothing here since there are no
9176 members to populate etc. Move the attribute emission out of here
9177 since this was just totally the wrong place to put it. Attribute
9178 application happens during the 'Emit' phase, not in the 'Define'
9181 (Emit): Add this method and move the attribute emission here
9183 * rootcontext.cs (EmitCode): Call the Emit method on interface
9186 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9188 * expression.cs (OverloadResolve): Report error only if Location
9189 is not 'Null' which means that there was a probe going on.
9191 2003-07-14 Martin Baulig <martin@ximian.com>
9193 * expression.cs (ConditionalLogicalOperator): New public class to
9194 implement user defined conditional logical operators.
9195 This is section 14.11.2 in the spec and bug #40505.
9197 2003-07-14 Martin Baulig <martin@ximian.com>
9199 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
9201 2003-07-14 Martin Baulig <martin@ximian.com>
9203 * codegen.cs (EmitContext.InFixedInitializer): New public field.
9205 * ecore.cs (IVariable.VerifyFixed): New interface method.
9207 * expression.cs (Unary.ResolveOperator): When resolving the `&'
9208 operator, check whether the variable is actually fixed. Fixes bug
9209 #36055. Set a variable definitely assigned when taking its
9210 address as required by the spec.
9212 * statement.cs (LocalInfo.IsFixed): New field.
9213 (LocalInfo.MakePinned): Set `IsFixed' to true.
9215 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9217 * attribute.cs (Attribute.Resolve): While doing a Member lookup
9218 for .ctors, ensure that we only ask for members declared in the
9219 attribute type (BindingFlags.DeclaredOnly).
9223 * expression.cs (Error_WrongNumArguments): Report error 1501
9224 correctly the way CSC does.
9226 2003-07-13 Martin Baulig <martin@ximian.com>
9228 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
9229 lookup on the fully qualified name, to make things like "X.X" work
9230 where "X.X" is a fully qualified type name, but we also have a
9231 namespace "X" in the using list. Fixes #41975.
9233 2003-07-13 Martin Baulig <martin@ximian.com>
9235 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
9236 function. If we're a CompoundAssign, we need to create an embedded
9237 CompoundAssign, not an embedded Assign.
9238 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
9241 2003-07-13 Martin Baulig <martin@ximian.com>
9243 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
9244 work to fix bug #46088.
9246 2003-07-13 Ravi Pratap <ravi@ximian.com>
9248 * class.cs (Operator.Emit): Do not emit attributes here - it is
9249 taken care of by the Method class that we delegate too. This takes
9252 2003-07-10 Martin Baulig <martin@ximian.com>
9254 * expression.cs (TypeOfVoid): New class.
9255 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
9257 2003-07-10 Martin Baulig <martin@ximian.com>
9259 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
9262 2003-07-10 Martin Baulig <martin@ximian.com>
9264 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
9265 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
9267 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
9269 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
9271 2003-07-10 Martin Baulig <martin@ximian.com>
9273 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
9274 of decimal. Fixes #42850.
9276 NOTE: I also fixed the created byte blob, but this doesn't work on
9277 the MS runtime and csc never produces any byte blobs for decimal
9280 2003-07-10 Martin Baulig <martin@ximian.com>
9282 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
9283 structs; fixes #32068.
9284 (Block.AddChildVariableNames): Fixed #44302.
9286 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9288 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
9290 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9292 * attribute.cs: And this test is onger needed.
9294 2003-07-08 Martin Baulig <martin@ximian.com>
9296 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
9297 inaccessible types. Fixes #36313.
9299 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
9301 * namespace.cs (NamespaceEntry): Create implicit entries for all
9302 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
9303 implicit entries for N1.N2 and N1.
9305 2003-07-08 Martin Baulig <martin@ximian.com>
9307 Rewrote the handling of namespaces to fix a lot of the issues
9308 wrt. `using' aliases etc.
9310 * namespace.cs (Namespace): Splitted this class into a
9311 per-assembly `Namespace' and a per-file `NamespaceEntry'.
9313 * typemanager.cs (TypeManager.IsNamespace): Removed.
9314 (TypeManager.ComputeNamespaces): Only compute namespaces from
9315 loaded assemblies here, not the namespaces from the assembly we're
9316 currently compiling.
9318 2003-07-08 Martin Baulig <martin@ximian.com>
9320 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
9322 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9324 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
9327 I thought about the memory savings here, but LookupTypeReflection
9328 is used under already very constrained scenarios. Compiling
9329 corlib or mcs only exposes one hit, so it would not really reduce
9330 any memory consumption.
9332 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9334 * typemanager.cs: fixes bug #45889 by only adding public types from
9335 other assemblies to the list of known types.
9337 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9339 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
9340 on the type we resolved.
9342 2003-07-05 Martin Baulig <martin@ximian.com>
9344 * pending.cs (PendingImplementation.ParentImplements): Don't
9345 create the proxy if the parent is abstract.
9347 * class.cs (TypeContainer.DefineIndexers): Process explicit
9348 interface implementations first. Fixes #37714.
9350 2003-07-04 Miguel de Icaza <miguel@ximian.com>
9352 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
9353 defined recursively; but since we modify the input parameters
9354 (left is set to `this' temporarily), we reset this value if the
9355 left_is_explicit is false, which gives the original semantics to
9358 * literal.cs (NullPointer): new class used to represent a null
9359 literal in a pointer context.
9361 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
9362 type is a pointer, use a NullPointer object instead of a
9363 NullLiteral. Closes 43687
9365 (ExplicitConversion): Convert pointer values using
9366 the conv opcode to the proper type.
9368 * ecore.cs (New): change ValueTypeVariable property into a method,
9369 that returns whether the valuetype is suitable for being used.
9371 * expression.cs (Binary.DoNumericPromotions): Only return if we
9372 the int constant was a valid uint, and we can return both left and
9373 right as uints. If not, we continue processing, to trigger the
9374 type conversion. This fixes 39018.
9376 * statement.cs (Block.EmitMeta): During constant resolution, set
9377 the CurrentBlock property on the emitcontext, so that we resolve
9378 constants propertly.
9380 2003-07-02 Martin Baulig <martin@ximian.com>
9382 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
9383 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
9385 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
9386 than emitting it here.
9388 * statement.cs: Fixed some more flow analysis bugs.
9390 2003-07-02 Martin Baulig <martin@ximian.com>
9392 * class.cs (MethodData.Define): When implementing interface
9393 methods, set Final unless we're Virtual.
9395 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
9396 check work for interface methods.
9398 2003-07-01 Martin Baulig <martin@ximian.com>
9400 * ecore.cs (EmitContext.This): Replaced this property with a
9401 GetThis() method which takes a Location argument. This ensures
9402 that we get the correct error location for a CS0188.
9404 2003-07-01 Miguel de Icaza <miguel@ximian.com>
9406 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
9407 ImplicitStandardConversion.
9409 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
9411 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
9413 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
9416 2003-06-30 Miguel de Icaza <miguel@ximian.com>
9418 * class.cs (Constructor.Define): Turn off initlocals for unsafe
9421 (MethodData.Define): Turn off initlocals for unsafe methods.
9423 2003-06-29 Miguel de Icaza <miguel@ximian.com>
9425 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
9426 complete; Fixes #37521.
9428 * delegate.cs: Use Modifiers.TypeAttr to compute the
9429 TypeAttributes, instead of rolling our own. This makes the flags
9430 correct for the delegates.
9432 2003-06-28 Miguel de Icaza <miguel@ximian.com>
9434 * class.cs (Constructor.Define): Set the private flag for static
9435 constructors as well.
9437 * cs-parser.jay (statement_expression): Set the return value to
9438 null, to avoid a crash when we catch an error.
9440 2003-06-24 Miguel de Icaza <miguel@ximian.com>
9442 * cs-parser.jay: Applied patch from Jackson that adds support for
9443 extern and unsafe modifiers to destructor declarations.
9445 * expression.cs: Report error 21 if the user is trying to index a
9448 * driver.cs: Add an error message, suggested by the bug report.
9450 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
9451 if we do not have a ": this ()" constructor initializer. Fixes 45149
9453 2003-06-14 Miguel de Icaza <miguel@ximian.com>
9455 * namespace.cs: Add some information to reduce FAQs.
9457 2003-06-13 Miguel de Icaza <miguel@ximian.com>
9459 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
9460 underlying enumeration types. Fixes #43915.
9462 * expression.cs: Treat ushort/short as legal values to be used in
9465 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
9467 * delegate.cs: transfer custom attributes for paramenters from
9468 the delegate declaration to Invoke and BeginInvoke.
9470 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
9472 * attribute.cs: handle custom marshalers and emit marshal info
9475 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
9477 * makefile.gnu: Added anonymous.cs to the compiler sources.
9479 2003-05-28 Miguel de Icaza <miguel@ximian.com>
9481 * iterators.cs: Change the name of the proxy class to include two
9484 * cs-parser.jay: Update grammar to include anonymous methods.
9486 * anonymous.cs: new file.
9488 2003-05-27 Miguel de Icaza <miguel@ximian.com>
9490 * class.cs (Field.Define): Add missing test for pointers and
9493 2003-05-27 Ravi Pratap <ravi@ximian.com>
9495 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
9496 we use the stobj opcode.
9498 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
9499 since it wasn't the correct fix.
9501 It still is puzzling that we are required to use stobj for IntPtr
9502 which seems to be a ValueType.
9504 2003-05-26 Miguel de Icaza <miguel@ximian.com>
9506 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
9507 during regular simple name resolution. Now, the trick is that
9508 instead of returning for processing the simplename, we do a
9509 TypeManager.LookupType (ie, a rooted lookup as opposed to a
9510 contextual lookup type). If a match is found, return that, if
9511 not, return for further composition.
9513 This fixes long-standing 30485.
9515 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9516 using the address to initialize an object, do an Stobj instead of
9517 using the regular Stelem.
9519 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
9520 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
9521 Because if we are a BaseIndexerAccess that value will be true.
9524 * statement.cs (GotoCase.Resolve): Return after reporting an
9525 error, do not attempt to continue.
9527 * expression.cs (PointerArithmetic.Emit): If our operand is a
9528 long, convert our constants to match the operand before
9529 multiplying. Convert to I type before adding. Fixes 43670.
9531 2003-05-14 Ravi Pratap <ravi@ximian.com>
9533 * enum.cs (ImplicitConversionExists) : Rename to
9534 ImplicitEnumConversionExists to remove ambiguity.
9536 * ecore.cs (NullCast): New type of cast expression class which
9537 basically is very similar to EmptyCast with the difference being
9538 it still is a constant since it is used only to cast a null to
9542 * convert.cs (ImplicitReferenceConversion): When casting a null
9543 literal, we return a NullCast.
9545 * literal.cs (NullLiteralTyped): Remove - I don't see why this
9546 should be around anymore.
9548 The renaming (reported was slightly wrong). Corrections:
9550 ConvertImplicitStandard -> ImplicitConversionStandard
9551 ConvertExplicitStandard -> ExplicitConversionStandard
9553 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
9554 before passing them in !
9556 * convert.cs (ImplicitConversionStandard): When comparing for
9557 equal expr and target types, ensure that expr is not a
9560 In general, we must not be checking (expr_type ==
9561 target_type) in the top level conversion methods
9562 (ImplicitConversion, ExplicitConversion etc). This checking is
9563 done in the methods that they delegate to.
9565 2003-05-20 Miguel de Icaza <miguel@ximian.com>
9567 * convert.cs: Move Error_CannotConvertType,
9568 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
9569 ImplicitNumericConversion, ImplicitConversionExists,
9570 ImplicitUserConversionExists, StandardConversionExists,
9571 FindMostEncompassedType, FindMostSpecificSource,
9572 FindMostSpecificTarget, ImplicitUserConversion,
9573 ExplicitUserConversion, GetConversionOperators,
9574 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
9575 TryImplicitIntConversion, Error_CannotConvertImplicit,
9576 ConvertImplicitRequired, ConvertNumericExplicit,
9577 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
9578 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
9581 Perform the following renames:
9583 StandardConversionExists -> ImplicitStandardConversionExists
9584 ConvertImplicit -> ImplicitConversion
9585 ConvertImplicitStandard -> ImplicitStandardConversion
9586 TryImplicitIntConversion -> ImplicitIntConversion
9587 ConvertImplicitRequired -> ImplicitConversionRequired
9588 ConvertNumericExplicit -> ExplicitNumericConversion
9589 ConvertReferenceExplicit -> ExplicitReferenceConversion
9590 ConvertExplicit -> ExplicitConversion
9591 ConvertExplicitStandard -> ExplicitStandardConversion
9593 2003-05-19 Martin Baulig <martin@ximian.com>
9595 * statement.cs (TypeInfo.StructInfo): Made this type protected.
9596 (TypeInfo): Added support for structs having structs as fields.
9598 * ecore.cs (FieldExpr): Implement IVariable.
9599 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
9600 VariableInfo for the field.
9602 2003-05-18 Martin Baulig <martin@ximian.com>
9604 * expression.cs (This.DoResolve): Report a CS0027 if we're
9605 emitting a field initializer.
9607 2003-05-18 Martin Baulig <martin@ximian.com>
9609 * expression.cs (This.ResolveBase): New public function.
9610 (This.DoResolve): Check for CS0188.
9612 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
9615 * ecore.cs (MethodGroupExpr.DoResolve): Set the
9616 `instance_expression' to null if we don't have any non-static
9619 2003-05-18 Martin Baulig <martin@ximian.com>
9621 Reworked the way how local variables and parameters are handled by
9622 the flow analysis code.
9624 * statement.cs (TypeInfo, VariableMap): New public classes.
9625 (VariableInfo): New public class. This is now responsible for
9626 checking whether a variable has been assigned. It is used for
9627 parameters and local variables.
9628 (Block.EmitMeta): Take the InternalParameters as argument; compute
9629 the layout of the flow vectors here.
9630 (Block.LocalMap, Block.ParameterMap): New public properties.
9631 (FlowBranching): The .ctor doesn't get the InternalParameters
9632 anymore since Block.EmitMeta() now computes the layout of the flow
9634 (MyStructInfo): This class is now known as `StructInfo' and nested
9635 in `TypeInfo'; we don't access this directly anymore.
9637 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
9638 property and removed IsAssigned(), IsFieldAssigned(),
9639 SetAssigned() and SetFieldAssigned(); we now call them on the
9640 VariableInfo so we don't need to duplicate this code everywhere.
9642 * expression.cs (ParameterReference): Added `Block block' argument
9644 (LocalVariableReference, ParameterReference, This): The new
9645 VariableInfo class is now responsible for all the definite
9648 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
9649 IsParameterAssigned, SetParameterAssigned): Removed.
9651 2003-05-18 Martin Baulig <martin@ximian.com>
9653 * typemanager.cs (InitCoreTypes): Try calling
9654 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
9655 the 3-args-version. Corlib now also needs our `void_type'.
9656 (GetMethod): Added overloaded version which takes an optional
9657 `bool report_errors' to allow lookups of optional methods.
9659 2003-05-12 Martin Baulig <martin@ximian.com>
9661 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
9662 only used for locals and not for parameters.
9664 2003-05-12 Miguel de Icaza <miguel@ximian.com>
9666 * support.cs (InternalParameters.ParameterType): Return the
9667 ExternalType of the parameter.
9669 * parameter.cs (Parameter.ExternalType): drop the two arguments,
9672 2003-05-11 Miguel de Icaza <miguel@ximian.com>
9674 * class.cs (MethodData.Define): Do not set the `newslot' on
9675 interface members, if they are also flagged as "override".
9677 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
9678 better code for ++i and i++. This only works for static fields
9679 and local variables.
9681 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
9682 want to pull the DeclSpace out of the builder_to_declspace instead
9683 of the TypeBuilder (like in TypeContainer.FindMembers).
9685 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
9686 instead of LookupTypeContainer. Fixes the crash on .NET for
9687 looking up interface members.
9689 * const.cs: Create our own emit context during the Definition
9690 stage, so that constants are evaluated in the proper context, when
9691 a recursive definition happens.
9693 2003-05-11 Martin Baulig <martin@ximian.com>
9695 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
9696 new block for a switch section.
9697 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
9698 the adding/lookup in the switch block. Fixes #39828.
9700 2003-05-09 Miguel de Icaza <miguel@ximian.com>
9702 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
9703 functionality: I needed to convert the data after I had performed
9704 the add/sub operation into the operands type size.
9706 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
9707 pass the type for the box operation, otherwise the resulting
9708 object would have been of type object.
9710 (BoxedCast): Add constructor to specify the type to box as.
9712 2003-05-07 Miguel de Icaza <miguel@ximian.com>
9714 * iterators.cs: I was reusing the `count' variable inadvertently,
9715 take steps to not allow this to happen.
9717 2003-05-06 Miguel de Icaza <miguel@ximian.com>
9719 * attribute.cs (Attribute.Resolve): Params attributes are encoded
9720 by creating an array at the point where the params starts and
9721 putting all those arguments there, then adjusting the size of the
9724 2003-05-05 Miguel de Icaza <miguel@ximian.com>
9726 * expression.cs (New.AddressOf): Implement interface
9727 IMemoryLocation. This is used when the `new' operator is used in
9728 the context of an invocation to a method on a value type.
9730 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
9733 * namespace.cs: Also check the using aliases here.
9735 * driver.cs: Move the test for using validity after the types have
9736 been entered, so we do a single pass that also includes the using
9739 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
9740 in the regular case. CreateSiblingForFinally is doing extra
9743 * attribute.cs (GetAttributeArgumentExpression): Store the result
9744 on an out value, and use the return value to indicate failure
9745 instead of using null (which is a valid return for Constant.GetValue).
9747 * statement.cs: Perform the analysis flow for the increment
9748 portion after the statement, because this will be the real flow of
9749 execution. Fixes #42385
9751 * codegen.cs (EmitContext.EmitArgument,
9752 EmitContext.EmitStoreArgument): New helper functions when the
9753 RemapToProxy flag is set.
9755 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
9758 Add support for remapping parameters.
9760 * iterators.cs: Propagate parameter values; Store parameter
9761 values in the proxy classes.
9763 2003-05-04 Miguel de Icaza <miguel@ximian.com>
9765 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
9766 need a proxy reference; I do not know what I was thinking
9768 * cs-parser.jay (constructor_initializer): catch another error,
9769 and display nice message.
9771 (field_declaration): catch void field declaration
9772 to flag a better error.
9774 * class.cs (MemberBase.CheckBase): Report an error instead of a
9775 warning if a new protected member is declared in a struct.
9776 (Field.Define): catch the error of readonly/volatile.
9778 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
9780 (FieldExpr.AddressOf): ditto. Catch error where the address of a
9781 volatile variable is taken
9783 2003-05-02 Miguel de Icaza <miguel@ximian.com>
9785 * statement.cs (Fixed.Resolve): Report an error if we are not in
9788 2003-05-01 Miguel de Icaza <miguel@ximian.com>
9790 * typemanager.cs: reuse the code that handles type clashes for
9791 delegates and enumerations.
9793 * class.cs (Report28): Always report.
9795 * expression.cs (EncodeAsAttribute): Allow nulls here.
9797 2003-04-28 Miguel de Icaza <miguel@ximian.com>
9799 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
9800 the functionality for testing whether an expression is valid for
9801 an attribute here. Also handle the case of arrays of elements
9804 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
9805 encoding a linear array into an array of objects that are suitable
9806 to be passed to an CustomAttributeBuilder.
9808 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
9810 * ecore.cs: (FieldExpr): Handle field remapping here.
9812 * iteratators.cs: Pass the instance variable (if the method is an
9813 instance method) to the constructors, so we can access the field
9814 variables on the class.
9816 TODO: Test this with structs. I think the THIS variable on
9817 structs might have to be a pointer, and not a refenrece
9819 2003-04-27 Miguel de Icaza <miguel@ximian.com>
9821 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
9822 local variables to fields in a proxy class.
9824 * iterators.cs (PopulateProxy): Rename our internal fields to
9826 Create a <THIS> field if we are an instance method, so we can
9827 reference our parent container variables.
9828 (MapVariable): Called back from the EmitContext code to enter a
9829 new variable to field mapping into the proxy class (we just create
9833 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
9834 for using the remapped locals to fields.
9836 I placed the code here, because that gives the same semantics to
9837 local variables, and only changes the Emit code.
9839 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
9840 statements inside iterators.
9841 (VariableInfo): Add a FieldBuilder for the cases when we are
9842 remapping local variables to fields in a proxy class
9844 * ecore.cs (SimpleNameResolve): Avoid testing two times for
9845 current_block != null.
9847 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
9848 not cope with strings, as it has been moved to the
9849 TableSwitchEmit. Fixed bug in switch generation.
9851 * expression.cs (New.DoResolve): Provide more context for the user
9852 when reporting an error.
9854 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
9857 * expression.cs (MemberAccess.DoResolve): When we get a type back,
9858 check the permissions for it. Note than in a type-resolution
9859 context the check was already present in DeclSpace.ResolveType,
9860 but was missing from the MemberAccess.
9862 (ArrayCreation.CheckIndices): warn if the user has
9863 more nested levels of expressions, but there are no more
9864 dimensions specified. Avoids crash on bug 41906.
9866 2003-04-26 Miguel de Icaza <miguel@ximian.com>
9868 * statement.cs (Block): replace Implicit bool, for a generic
9870 New flag: `Unchecked'. This is used during the EmitMeta phase
9871 (which is out-of-line with the regular Resolve/Emit process for a
9872 statement, as this is done ahead of time, but still gets a chance
9873 to call constant resolve).
9875 (Block.Flags): new enum for adding a new flag.
9877 (Block.EmitMeta): track the state of unchecked.
9879 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
9880 to enable constant resolution to work there as well.
9882 2003-04-22 Miguel de Icaza <miguel@ximian.com>
9884 * typemanager.cs (ienumerable_type): Also look up
9885 System.Collections.IEnumerable.
9887 2003-04-21 Miguel de Icaza <miguel@ximian.com>
9889 TODO: Test more than one conditional per method.
9891 * class.cs (Indexer.Define): Report the location where the user is
9892 referencing the unsupported feature.
9894 (MethodData): Overload the use of `conditionals' to
9895 minimize the creation of needless ArrayLists. This saves roughly
9896 212kb on my machine.
9898 (Method): Implement the new IIteratorContainer interface.
9899 (Method.SetYields): Implement the method by setting the ModFlags
9900 to contain METHOD_YIELDS.
9902 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
9903 which just got set to null.
9905 * iterators.cs: New file.
9907 (Yield, YieldBreak): New statements.
9909 * statement.cs (Return.Resolve): Flag an error if we are used in
9912 * codegen.cs (InIterator): New flag set if the code is being
9913 compiled in an iterator method.
9915 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
9916 internal modifier, and we just use it to avoid adding extra
9917 fields, as this is seldom used.
9919 * cs-parser.jay: Add yield_statement (yield and yield break).
9921 * driver.cs: New flag -v2 to turn on version 2 features.
9923 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
9924 hashtable when v2 is enabled.
9926 2003-04-20 Miguel de Icaza <miguel@ximian.com>
9928 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
9929 there is already a namespace defined with this name.
9931 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
9932 people upgraded their corlibs.
9934 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
9935 always use fully qualified types, no need to use the compiler
9938 (TypeManager.IsNamespace): Use binarysearch.
9940 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
9941 AddDelegate): I did not quite use the new IsValid API properly: I
9942 have to pass the short-name and the fullname. I was passing only
9943 the basename instead of the fullname sometimes.
9945 (TypeContainer.DefineType): call NamespaceClash.
9947 * interface.cs (Interface.DefineType): use NamespaceClash before
9950 * delegate.cs (Delegate.DefineType): use NamespaceClash before
9953 * enum.cs: (Enum.DefineType): use NamespaceClash before
9956 * typemanager.cs (: 3-line patch that gives us some tasty 11%
9957 speed increase. First, use the negative_hits cache when we get a
9958 negative. Second, add the type with its full original name
9959 instead of the new . and + encoded name (reflection uses + to
9960 separate type from a nested type). Use LookupTypeReflection
9961 directly which bypasses the type->name hashtable (that we already
9962 know does not contain the type.
9964 * decl.cs (DeclSpace.ResolveTypeExpr): track the
9965 location/container type.
9967 * driver.cs: When passing utf8, use directly the UTF8Encoding.
9969 2003-04-19 Miguel de Icaza <miguel@ximian.com>
9971 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
9973 * delegate.cs (NewDelegate.Resolve): Test whether an instance
9974 method is being referenced in the method group from a static
9975 context, and report error 120 if so.
9977 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
9980 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
9981 is created, we create the A namespace).
9983 * cs-parser.jay: A namespace also introduces a DeclarationFound.
9986 2003-04-18 Miguel de Icaza <miguel@ximian.com>
9988 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
9989 invocation to ModuleBuilder.GetType with the same values will
9990 return a new type instance, so we need to cache its return
9993 * expression.cs (Binary.ResolveOperator): Only allow the compare
9994 operators on enums if they are of the same type.
9996 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
9997 types of ValueType on their own case. Before we were giving them
9998 the same treatment as objects.
10000 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10001 fullname. Short name is used to compare against container name.
10002 Fullname is used to check against defined namespace names.
10004 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10005 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10007 (Method.CheckBase): Call parent.
10008 (MemberBase.CheckBase): Check for protected members on sealed
10010 (PropertyBase.CheckBase): Call parent.
10011 (Field.Define): Call parent.
10013 * report.cs: Negative error codes are now mapped to 8000 - code,
10014 so that the display is render more nicely.
10016 * typemanager.cs: Do not use try/catch, instead report a regular
10019 (GetPointerType, GetReferenceType): These methods provide
10020 mechanisms to obtain the T* and T& from a T. We had the code
10021 previously scattered around the code base, and it also used
10022 TypeManager.LookupType that would go through plenty of caches.
10023 This one goes directly to the type source.
10025 In some places we did the Type.GetType followed by
10026 ModuleBuilder.GetType, but not in others, so this unifies the
10027 processing as well.
10029 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10030 statements now that we have namespace information.
10032 * typemanager.cs (IsNamespace): New method, returns whether the
10033 string presented is a namespace or not.
10035 (ComputeNamespaces): New public entry point, computes the list of
10036 available namespaces, using the GetNamespaces API call in Mono, or
10037 the slower version in MS.NET.
10039 Now before we start the semantic analysis phase, we have a
10040 complete list of namespaces including everything that the user has
10043 Deleted old code to cache namespaces in .nsc files.
10045 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10047 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10048 class/struct location definition Location for the implicit
10049 constructor location.
10051 (Operator.Define): Use the location of the operator for the
10052 implicit Method definition.
10054 (Constructor.Emit): use the constructor location for the implicit
10055 base initializer constructor.
10057 * ecore.cs: Remove ITypeExpression. This interface is now gone,
10058 and the Expression class now contains two new methods:
10060 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
10061 isolate type lookup from the rest of the resolution process.
10063 Since we use Expressions to hold type definitions due to the way
10064 we parse the input we have historically overloaded Resolve to
10065 perform the Type lookups if a special flag is passed. Now this is
10066 eliminated and two methods take their place.
10068 The differences in the two methods between xStep and xTerminal is
10069 that xStep is involved in our current lookup system that uses
10070 SimpleNames to compose a name, while xTerminal is used just to
10071 catch the case where the simplename lookup failed.
10073 2003-04-16 Miguel de Icaza <miguel@ximian.com>
10075 * expression.cs (ResolveMemberAccess): Remove redundant code.
10076 TypeExpr expressions are always born fully resolved.
10078 * interface.cs (PopulateMethod): Do not lookup the types twice.
10079 We were doing it once during SemanticAnalysis and once during
10082 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
10083 in local variable type definitions, were being returned as a
10084 SimpleName (we decomposed everything into a string), that is
10085 because primary_expression was being used instead of a type in the
10086 grammar (reduce/reduce conflicts).
10088 The part that was wrong is that we converted the expression into a
10089 string (an oversimplification in one hand, compounded with primary
10090 expressions doing string concatenation).
10096 Would return "A.B.C[]" as a SimpleName. This stopped things like
10097 using clauses from working on this particular context. And a type
10098 was being matched directly against "A.B.C[]".
10100 We now use the correct approach, and allow for ComposedCast to be
10101 part of the unary expression. So the "A.B.C []" become a composed
10102 cast of "A.B.C" (as a nested group of MemberAccess with a
10103 SimpleName at the end) plus the rank composition "[]".
10107 2003-04-10 Miguel de Icaza <miguel@ximian.com>
10109 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
10110 for the access level checking.
10112 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
10113 `TypeContainer container', because I kept getting confused when I
10114 was debugging this code.
10116 * expression.cs (Indexers): Instead of tracking getters/setters,
10117 we now track them in parallel. We create one arraylist less, but
10118 most importantly it is possible now for the LValue code to find a
10119 matching get for a set.
10121 (IndexerAccess.DoResolveLValue): Update the code.
10122 GetIndexersForType has been modified already to extract all the
10123 indexers from a type. The code assumed it did not.
10125 Also make the code set the correct return type for the indexer.
10126 This was fixed a long time ago for properties, but was missing for
10127 indexers. It used to be void_type.
10129 (Binary.Emit): Test first for doubles instead of
10130 floats, as they are more common.
10132 (Binary.EmitBranchable): Use the .un version of the branch opcodes
10133 when dealing with floats and the <=, >= operators. This fixes bug
10136 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
10137 to load the array value by emitting a load on the foreach variable
10138 type. This was incorrect.
10140 We now emit the code to load an element using the the array
10141 variable type, and then we emit the conversion operator.
10145 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10147 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10149 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10151 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10152 test for protection before we test for signatures.
10154 (MethodSignature.ToString): implement.
10156 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10157 to the case where we reduced into a LongConstant.
10159 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10160 depend on whether the information is acurrate, because the
10161 Microsoft runtime will always claim that the array type is public,
10162 regardless of the real state.
10164 If the type is a pointer, another problem happens: the type is
10165 reported as non-public in Microsoft.
10167 In both cases we have to call CheckAccessLevel recursively with
10168 the underlying type as the argument to be tested.
10170 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10172 * assign.cs (Assign.Emit): If we are dealing with a compound
10173 assignment expression, we should use the code path that stores the
10174 intermediate result in a temporary value. This fixes #40903.
10176 *expression.cs (Indirection.ToString): Provide ToString method for
10179 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10181 * class.cs: Null out fields holding references to Block objects so
10182 they can be garbage collected.
10184 * expression.cs (OverloadResolve): Remove unused local.
10186 2003-04-07 Martin Baulig <martin@ximian.com>
10188 * codegen.cs (EmitContext.CurrentFile): New public field.
10189 (EmitContext.Mark): Use the CurrentFile to check whether the
10190 location is in the correct file.
10191 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
10193 2003-04-07 Martin Baulig <martin@ximian.com>
10195 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
10197 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
10198 location. [FIXME: The location argument which gets passed to this
10199 method is sometimes wrong!]
10201 2003-04-07 Nick Drochak <ndrochak@gol.com>
10203 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
10205 2003-04-07 Miguel de Icaza <miguel@ximian.com>
10207 * expression.cs (Indirection.EmitAssign): We were using the
10208 temporary, but returning immediately instead of continuing the
10211 2003-04-06 Martin Baulig <martin@ximian.com>
10213 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
10214 if it's a nested child, but also deriving from the outer class.
10217 * typemanager.cs (IsNestedChildOf): Make this work if it's a
10218 nested child, but also deriving from the outer class. See
10220 (FilterWithClosure): We may access private members of the outer
10221 class if we're a nested child and deriving from the outer class.
10222 (RealMemberLookup): Only set `closure_private_ok' if the
10223 `original_bf' contained BindingFlags.NonPublic.
10225 2003-04-05 Martin Baulig <martin@ximian.com>
10227 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
10229 2003-04-02 Miguel de Icaza <miguel@ximian.com>
10231 * class.cs (Event.Define): Do not allow abstract events to have
10234 2003-04-01 Miguel de Icaza <miguel@ximian.com>
10236 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
10237 block in event declarations.
10239 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
10240 value type, get its address.
10242 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
10243 leaving a class on the stack instead of a boolean value (int
10244 0/1). Change the code so we compare against null, and then the
10245 result against zero.
10247 * class.cs (TypeContainer.GetClassBases): We were checking for the
10248 parent class being sealed too late.
10250 * expression.cs (Binary.Emit): For <= and >= when dealing with
10251 floating point values, use cgt.un and clt.un instead of cgt and
10254 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
10256 * statement.cs: Apply the same optimization as MS: skip the
10257 GetEnumerator returning an IEnumerator, and use the one returning a
10258 CharEnumerator instead. This allows us to avoid the try-finally block
10261 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
10263 * cs-parser.jay: Attributes cannot be applied to
10264 namespaces. Fixes #40473
10266 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10269 (Add*): check if the name is valid using the full name for constants,
10270 fields, properties and events.
10272 2003-03-28 Miguel de Icaza <miguel@ximian.com>
10274 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
10275 char constants to be part of the enumeration.
10277 * expression.cs (Conditional.DoResolve): Add support for operator
10278 true. Implements the missing functionality from 14.12
10280 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
10281 operator true/false as required by the spec.
10283 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
10284 implicit conversion to boolean.
10286 * statement.cs (Statement.ResolveBoolean): A boolean expression is
10287 also one where the type implements `operator true'.
10289 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
10290 get an expression that will invoke operator true based on an
10293 (GetConversionOperators): Removed the hack that called op_True
10296 (Expression.ResolveBoolean): Move this from Statement.
10298 2003-03-17 Miguel de Icaza <miguel@ximian.com>
10300 * ecore.cs (FieldExpr): do not allow initialization of initonly
10301 fields on derived classes
10303 2003-03-13 Martin Baulig <martin@ximian.com>
10305 * statement.cs (Block.Emit): Call ig.BeginScope() and
10306 ig.EndScope() when compiling with debugging info; call
10307 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
10309 2003-03-08 Miguel de Icaza <miguel@ximian.com>
10311 * expression.cs (Indexers): Do not construct immediately, allow
10312 for new members to be appended as we go. Fixes 38143
10314 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10316 * expression.cs: save/restore context when resolving an unchecked
10319 2003-03-05 Miguel de Icaza <miguel@ximian.com>
10321 * cfold.cs: Catch division by zero in modulus operator during
10324 2003-03-03 Miguel de Icaza <miguel@ximian.com>
10326 * interface.cs (Interface.DefineMembers): Avoid defining members
10329 2003-02-27 Miguel de Icaza <miguel@ximian.com>
10331 * driver.cs: handle the +/- options for -noconfig
10333 * statement.cs (Unckeched.Resolve): Also track the state of
10334 unchecked in the Resolve phase.
10336 2003-02-27 Martin Baulig <martin@ximian.com>
10338 * ecore.cs (Expression.MemberLookup): Don't create a
10339 MethodGroupExpr for something which is not a method. Fixes #38291.
10341 2003-02-25 Miguel de Icaza <miguel@ximian.com>
10343 * class.cs (MemberBase.CheckParameters): Also check that the type
10344 is unmanaged if it is a pointer.
10346 * expression.cs (SizeOf.Resolve): Add location information.
10348 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
10349 a managed type is declared.
10351 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
10352 parameter modifiers as well. Fixes bug 38606
10354 * class.cs: Very sad. Am backing out the speed up changes
10355 introduced by the ArrayList -> Array in the TypeContainer, as they
10356 were not actually that much faster, and introduced a bug (no error
10357 reports on duplicated methods).
10359 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
10360 source first, this will guarantee that we have a valid expression
10361 before calling in lower levels functions that will require a
10362 resolved object. Then use this original_source in the
10363 target.ResolveLValue instead of the original source that was
10366 Another change. Use target.Resolve instead of LValueResolve.
10367 Although we are resolving for LValues, we will let the Assign code
10368 take care of that (it will be called again from Resolve). This
10369 basically allows code like this:
10371 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
10372 class Y { void A (X x) { x [0] += o; }
10374 The problem was that the indexer was trying to resolve for
10375 set_Item (idx, object o) and never finding one. The real set_Item
10376 was set_Item (idx, X). By delaying the process we get the right
10381 2003-02-23 Martin Baulig <martin@ximian.com>
10383 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
10384 while calling DoEmit ().
10386 * codegen.cs (EmitContext.Mark): Don't mark locations in other
10387 source files; if you use the #line directive inside a method, the
10388 compiler stops emitting line numbers for the debugger until it
10389 reaches the end of the method or another #line directive which
10390 restores the original file.
10392 2003-02-23 Martin Baulig <martin@ximian.com>
10394 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
10396 2003-02-23 Martin Baulig <martin@ximian.com>
10398 * statement.cs (Block.AddChildVariableNames): We need to call this
10399 recursively, not just for our immediate children.
10401 2003-02-23 Martin Baulig <martin@ximian.com>
10403 * class.cs (Event.Define): Always make the field private, like csc does.
10405 * typemanager.cs (TypeManager.RealMemberLookup): Make events
10406 actually work, fixes bug #37521.
10408 2003-02-23 Miguel de Icaza <miguel@ximian.com>
10410 * delegate.cs: When creating the various temporary "Parameters"
10411 classes, make sure that we call the ComputeAndDefineParameterTypes
10412 on those new parameters (just like we do with the formal ones), to
10413 allow them to be resolved in the context of the DeclSpace.
10415 This fixes the bug that Dick observed in Bugzilla #38530.
10417 2003-02-22 Miguel de Icaza <miguel@ximian.com>
10419 * expression.cs (ResolveMemberAccess): When resolving a constant,
10420 do not attempt to pull a constant if the value was not able to
10421 generate a valid constant.
10423 * const.cs (LookupConstantValue): Do not report more errors than required.
10425 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10427 * expression.cs: fixes bug #38328.
10429 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10431 * class.cs: Changed all the various members that can be part of a
10432 class from being an ArrayList to be an Array of the right type.
10433 During the DefineType type_list, interface_list, delegate_list and
10434 enum_list are turned into types, interfaces, delegates and enums
10437 And during the member population, indexer_list, event_list,
10438 constant_list, field_list, instance_constructor_list, method_list,
10439 operator_list and property_list are turned into their real arrays.
10441 Although we could probably perform this operation earlier, for
10442 good error reporting we need to keep the lists and remove the
10443 lists for longer than required.
10445 This optimization was triggered by Paolo profiling the compiler
10446 speed on the output of `gen-sample-program.pl' perl script.
10448 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
10449 not crash in methods like MemberLookupFailed that use this field.
10451 This problem arises when the compiler fails to resolve a type
10452 during interface type definition for example.
10454 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10456 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
10457 inherit from System.Object, so we have to stop at null, not only
10458 when reaching System.Object.
10460 2003-02-17 Miguel de Icaza <miguel@ximian.com>
10462 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
10463 DeclaredOnly because the parent indexer might have had a different
10464 name, but did not loop until the top of the hierarchy was reached.
10466 The problem this one fixes is 35492: when a class implemented an
10467 indexer from an interface, we were getting the interface method
10468 (which was abstract) and we were flagging an error (can not invoke
10471 This also keeps bug 33089 functioning, and test-148 functioning.
10473 * typemanager.cs (IsSpecialMethod): The correct way of figuring
10474 out if a method is special is to see if it is declared in a
10475 property or event, or whether it is one of the predefined operator
10476 names. This should fix correctly #36804.
10478 2003-02-15 Miguel de Icaza <miguel@ximian.com>
10480 The goal here is to remove the dependency on EmptyCast.Peel ().
10481 Killing it completely.
10483 The problem is that currently in a number of places where
10484 constants are expected, we have to "probe" for an EmptyCast, and
10485 Peel, which is not the correct thing to do, as this will be
10486 repetitive and will likely lead to errors.
10488 The idea is to remove any EmptyCasts that are used in casts that
10489 can be reduced to constants, so we only have to cope with
10492 This bug hunt was triggered by Bug 37363 and the desire to remove
10493 the duplicate pattern where we were "peeling" emptycasts to check
10494 whether they were constants. Now constants will always be
10497 * ecore.cs: Use an enumconstant here instead of wrapping with
10500 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
10501 throwing me off. By handling this we can get rid of a few hacks.
10503 * statement.cs (Switch): Removed Peel() code.
10505 2003-02-14 Miguel de Icaza <miguel@ximian.com>
10507 * class.cs: Location information for error 508
10509 * expression.cs (New.DoResolve): Add a guard against double
10510 resolution of an expression.
10512 The New DoResolve might be called twice when initializing field
10513 expressions (see EmitFieldInitializers, the call to
10514 GetInitializerExpression will perform a resolve on the expression,
10515 and later the assign will trigger another resolution
10517 This leads to bugs (#37014)
10519 * delegate.cs: The signature for EndInvoke should contain any ref
10520 or out parameters as well. We were not doing this in the past.
10522 * class.cs (Field.Define): Do not overwrite the type definition
10523 inside the `volatile' group. Turns out that volatile enumerations
10524 were changing the type here to perform a validity test, which
10527 2003-02-12 Miguel de Icaza <miguel@ximian.com>
10529 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
10530 and structs, we do not want to load the instance variable
10532 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
10533 enum_type has to be handled like an object reference (implicit
10534 conversions exists from this to object), but the regular IsClass
10535 and IsValueType tests will never return true for this one.
10537 Also we use TypeManager.IsValueType instead of type.IsValueType,
10538 just for consistency with the rest of the code (this is only
10539 needed if we ever use the construct exposed by test-180.cs inside
10540 corlib, which we dont today).
10542 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
10544 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
10547 2003-02-09 Martin Baulig <martin@ximian.com>
10549 * namespace.cs (Namespace..ctor): Added SourceFile argument.
10550 (Namespace.DefineNamespaces): New static public method; this is
10551 called when we're compiling with debugging to add all namespaces
10552 to the symbol file.
10554 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
10555 pass it to the Namespace's .ctor.
10557 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
10558 and MethodBase arguments; pass the namespace ID to the symwriter;
10559 pass the MethodBase instead of the token to the symwriter.
10560 (SymbolWriter.DefineNamespace): New method to add a namespace to
10563 2003-02-09 Martin Baulig <martin@ximian.com>
10565 * symbolwriter.cs: New file. This is a wrapper around
10566 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
10567 methods here in near future.
10569 2003-02-09 Martin Baulig <martin@ximian.com>
10571 * codegen.cs (EmitContext.Mark): Just pass the arguments to
10572 ILGenerator.MarkSequencePoint() which are actually used by the
10575 2003-02-09 Martin Baulig <martin@ximian.com>
10577 * location.cs (SourceFile): New public sealed class. This
10578 contains the name and an index which is used in the location's token.
10579 (Location): Reserve an appropriate number of bits in the token for
10580 the source file instead of walking over that list, this gives us a
10581 really huge performance improvement when compiling with debugging.
10583 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
10584 `SourceFile' argument instead of a string.
10585 (Driver.ProcessFile): Add all the files via Location.AddFile(),
10586 but don't parse/tokenize here, we need to generate the list of all
10587 source files before we do that.
10588 (Driver.ProcessFiles): New static function. Parses/tokenizes all
10591 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
10592 instead of a string.
10594 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
10597 2003-02-09 Martin Baulig <martin@ximian.com>
10599 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
10600 filename on `#line default'.
10602 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
10604 * statement.cs: don't clear the pinned var when the fixed statement
10605 returns from the method (fixes bug#37752).
10607 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
10609 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
10612 2003-02-07 Martin Baulig <martin@ximian.com>
10614 * driver.cs: Removed the `--debug-args' command line argument.
10616 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
10617 automatically by the AsssemblyBuilder.
10618 (CodeGen.InitializeSymbolWriter): We don't need to call any
10619 initialization function on the symbol writer anymore. This method
10620 doesn't take any arguments.
10622 2003-02-03 Miguel de Icaza <miguel@ximian.com>
10624 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
10625 from referenced assemblies as well.
10627 2003-02-02 Martin Baulig <martin@ximian.com>
10629 * class.cs (MethodData.Emit): Generate debugging info for external methods.
10631 2003-02-02 Martin Baulig <martin@ximian.com>
10633 * class.cs (Constructor.Emit): Open the symbol writer before
10634 emitting the constructor initializer.
10635 (ConstructorInitializer.Emit): Call ec.Mark() to allow
10636 single-stepping through constructor initializers.
10638 2003-01-30 Miguel de Icaza <miguel@ximian.com>
10640 * class.cs: Handle error 549: do not allow virtual methods in
10643 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
10645 * decl.cs: Check access levels when resolving types
10647 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
10649 * statement.cs: Add parameters and locals set in catch blocks that might
10650 return to set vector
10652 2003-01-29 Miguel de Icaza <miguel@ximian.com>
10654 * class.cs (Operator): Set the SpecialName flags for operators.
10656 * expression.cs (Invocation.DoResolve): Only block calls to
10657 accessors and operators on SpecialName methods.
10659 (Cast.TryReduce): Handle conversions from char constants.
10662 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
10664 * statement.cs: small memory and time optimization in FlowBranching.
10666 2003-01-28 Pedro Mart <yoros@wanadoo.es>
10668 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
10669 problem that the last fix but in the other sid (Set).
10671 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
10672 access when there is no indexer in the hierarchy.
10674 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
10676 * class.cs: Combine some if statements.
10678 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10680 * driver.cs: fixed bug #37187.
10682 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
10684 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
10685 any indexer, it's needed to build a list with all the indexers in the
10686 hierarchy (AllGetters), else we have problems. Fixes #35653.
10688 2003-01-23 Miguel de Icaza <miguel@ximian.com>
10690 * class.cs (MethodData.Define): It is wrong for an interface
10691 implementation to be static in both cases: explicit and implicit.
10692 We were only handling this in one case.
10694 Improve the if situation there to not have negations.
10696 * class.cs (Field.Define): Turns out that we do not need to check
10697 the unsafe bit on field definition, only on usage. Remove the test.
10699 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10701 * driver.cs: use assembly.Location instead of Codebase (the latest
10702 patch made mcs fail when using MS assemblies).
10704 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
10706 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
10707 get the path to *corlib.dll.
10709 2003-01-21 Nick Drochak <ndrochak@gol.com>
10713 * typemanager.cs: Remove compiler warnings
10715 2003-01-20 Duncan Mak <duncan@ximian.com>
10717 * AssemblyInfo.cs: Bump the version number to 0.19.
10719 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10721 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
10723 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
10725 * class.cs (Constructor::Emit): Emit debugging info for constructors.
10727 2003-01-17 Miguel de Icaza <miguel@ximian.com>
10729 * cs-parser.jay: Small fix: we were not comparing the constructor
10730 name correctly. Thanks to Zoltan for the initial pointer.
10732 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
10734 * cs-tokenizer.cs: Set file name when specified with #line
10736 2003-01-15 Miguel de Icaza <miguel@ximian.com>
10738 * cs-parser.jay: Only perform the constructor checks here if we
10739 are named like the class; This will help provider a better
10740 error. The constructor path is taken when a type definition is
10741 not found, but most likely the user forgot to add the type, so
10742 report that rather than the constructor error.
10744 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
10746 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
10749 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10751 * cs-parser.jay: Add cleanup call.
10753 2003-01-13 Duncan Mak <duncan@ximian.com>
10755 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
10756 consistent with other methods.
10758 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10760 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
10762 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
10764 * attribute.cs: only set GuidAttr to true when we have a
10767 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10771 * typemanager.cs: fixes to allow mcs compile corlib with the new
10772 Type.IsSubclassOf fix.
10774 2003-01-08 Miguel de Icaza <miguel@ximian.com>
10776 * expression.cs (LocalVariableReference.DoResolve): Classify a
10777 constant as a value, not as a variable. Also, set the type for
10780 * cs-parser.jay (fixed_statement): take a type instead of a
10781 pointer_type, so we can produce a better error message later.
10783 * statement.cs (Fixed.Resolve): Flag types that are not pointers
10786 (For.DoEmit): Make inifinite loops have a
10787 non-conditional branch back.
10789 (Fixed.DoEmit): First populate the pinned variables, then emit the
10790 statement, then clear the variables. Before I was emitting the
10791 code once for each fixed piece.
10794 2003-01-08 Martin Baulig <martin@ximian.com>
10796 * statement.cs (FlowBranching.MergeChild): A break in a
10797 SWITCH_SECTION does not leave a loop. Fixes #36155.
10799 2003-01-08 Martin Baulig <martin@ximian.com>
10801 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
10802 lives in the same number space than `param_map'. Fixes #36154.
10804 2003-01-07 Miguel de Icaza <miguel@ximian.com>
10806 * cs-parser.jay (constructor_declaration): Set the
10807 Constructor.ModFlags before probing for it. This makes the
10808 compiler report 514, 515 and 132 (the code was there, but got
10811 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
10812 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
10813 (GotoCase.Resolve): Set `Returns' to ALWAYS.
10815 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
10817 * enum.cs: create the enum static fields using the enum type.
10819 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
10821 * class.cs: don't try to create the ParamBuilder for the return
10822 type if it's not needed (and handle it breaking for the ms runtime
10825 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
10827 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
10829 2002-12-29 Miguel de Icaza <miguel@ximian.com>
10831 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
10832 the command. This showed up while compiling the JANET source
10833 code, which used \r as its only newline separator.
10835 2002-12-28 Miguel de Icaza <miguel@ximian.com>
10837 * class.cs (Method.Define): If we are an operator (because it
10838 reuses our code), then set the SpecialName and HideBySig. #36128
10840 2002-12-22 Miguel de Icaza <miguel@ximian.com>
10842 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
10843 exception, report error 120 `object reference required'.
10845 * driver.cs: Add --pause option, used during to measure the size
10846 of the process as it goes with --timestamp.
10848 * expression.cs (Invocation.DoResolve): Do not allow methods with
10849 SpecialName to be invoked.
10851 2002-12-21 Miguel de Icaza <miguel@ximian.com>
10853 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
10854 number before adding it.
10856 2002-12-21 Ravi Pratap <ravi@ximian.com>
10858 * ecore.cs (StandardImplicitConversion): When in an unsafe
10859 context, we allow conversion between void * to any other pointer
10860 type. This fixes bug #35973.
10862 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
10864 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
10865 is not thrown when extensionless outputs are used
10867 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10869 * rootcontext.cs: fixed compilation of corlib.
10871 2002-12-19 Miguel de Icaza <miguel@ximian.com>
10873 * attribute.cs (Attributes.Contains): Add new method.
10875 * class.cs (MethodCore.LabelParameters): if the parameter is an
10876 `out' parameter, check that no attribute `[In]' has been passed.
10878 * enum.cs: Handle the `value__' name in an enumeration.
10880 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
10882 * decl.cs: Added special case to allow overrides on "protected
10885 2002-12-18 Ravi Pratap <ravi@ximian.com>
10887 * attribute.cs (Attributes.AddAttributeSection): Rename to this
10888 since it makes much more sense.
10890 (Attributes.ctor): Don't require a Location parameter.
10892 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
10894 * attribute.cs (ApplyAttributes): Remove extra Location parameters
10895 since we already have that information per attribute.
10897 * everywhere : make appropriate changes.
10899 * class.cs (LabelParameters): Write the code which actually
10900 applies attributes to the return type. We can't do this on the MS
10901 .NET runtime so we flag a warning in the case an exception is
10904 2002-12-18 Miguel de Icaza <miguel@ximian.com>
10906 * const.cs: Handle implicit null conversions here too.
10908 2002-12-17 Ravi Pratap <ravi@ximian.com>
10910 * class.cs (MethodCore.LabelParameters): Remove the extra
10911 Type [] parameter since it is completely unnecessary. Instead
10912 pass in the method's attributes so that we can extract
10913 the "return" attribute.
10915 2002-12-17 Miguel de Icaza <miguel@ximian.com>
10917 * cs-parser.jay (parse): Use Report.Error to flag errors instead
10918 of ignoring it and letting the compile continue.
10920 * typemanager.cs (ChangeType): use an extra argument to return an
10921 error condition instead of throwing an exception.
10923 2002-12-15 Miguel de Icaza <miguel@ximian.com>
10925 * expression.cs (Unary.TryReduce): mimic the code for the regular
10926 code path. Perform an implicit cast in the cases where we can
10927 implicitly convert to one of the integral types, and then reduce
10928 based on that constant. This fixes bug #35483.
10930 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10932 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
10934 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10936 * namespace.cs: fixed bug #35489.
10938 2002-12-12 Miguel de Icaza <miguel@ximian.com>
10940 * class.cs: Remove some dead code.
10942 * cs-parser.jay: Estimate the number of methods needed
10943 (RootContext.MethodCount);
10945 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
10946 numbers instead of StringBuilders.
10948 * support.cs (PtrHashtable): Add constructor with initial size;
10949 We can now reduce reallocations of the method table.
10951 2002-12-10 Ravi Pratap <ravi@ximian.com>
10953 * attribute.cs (ApplyAttributes): Keep track of the emitted
10954 attributes on a per-target basis. This fixes bug #35413.
10956 2002-12-10 Miguel de Icaza <miguel@ximian.com>
10958 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
10959 default to the Windows 1252 encoding.
10961 (UnixParseOption): Support version, thanks to Alp for the missing
10964 * AssemblyInfo.cs: Add nice assembly information.
10966 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
10969 * cs-parser.jay: Allow a trailing comma before the close bracked
10970 in the attribute_section production.
10972 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
10973 address of the instance was being taken, I will take this out,
10974 because we take the address of the object immediately here.
10976 2002-12-09 Ravi Pratap <ravi@ximian.com>
10978 * typemanager.cs (AreMultipleAllowed): Take care of the most
10979 obvious case where attribute type is not in the current assembly -
10982 2002-12-08 Miguel de Icaza <miguel@ximian.com>
10984 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
10985 definitions, instead of doing that afterwards.
10987 Also we use a nice little hack, depending on the constructor, we
10988 know if we are a "composed" name or a simple name. Hence, we
10989 avoid the IndexOf test, and we avoid
10991 * codegen.cs: Add code to assist in a bug reporter to track down
10992 the source of a compiler crash.
10994 2002-12-07 Ravi Pratap <ravi@ximian.com>
10996 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
10997 types have been emitted for a given element and flag an error
10998 if something which does not have AllowMultiple set is used more
11001 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11002 attribute types and their corresponding AllowMultiple properties
11004 (AreMultipleAllowed): Check the property for a given type.
11006 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11007 property in the case we have a TypeContainer.
11009 (Attributes.AddAttribute): Detect duplicates and just skip on
11010 adding them. This trivial fix catches a pretty gross error in our
11011 attribute emission - global attributes were being emitted twice!
11013 Bugzilla bug #33187 is now fixed.
11015 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11017 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11018 instead of pp_and).
11020 * expression.cs (Binary.ResolveOperator): I can only use the
11021 Concat (string, string, string) and Concat (string, string,
11022 string, string) if the child is actually a concatenation of
11025 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11027 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11028 context where we need a 2-character lookahead.
11030 * pending.cs (PendingImplementation): Rework so we can keep track
11031 of interface types all the time, and flag those which were
11032 implemented by parents as optional.
11034 2002-12-03 Miguel de Icaza <miguel@ximian.com>
11036 * expression.cs (Binary.ResolveOperator): Use
11037 String.Concat(string,string,string) or
11038 String.Concat(string,string,string,string) when possible.
11040 * typemanager: More helper methods.
11043 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
11045 * pending.cs: remove the bogus return from GetMissingInterfaces()
11046 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
11048 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11050 * namespace.cs: avoid duplicated 'using xxx' being added to
11051 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
11052 when we get more than one 'using' statement for the same namespace.
11053 Report a CS0105 warning for it.
11055 2002-11-30 Miguel de Icaza <miguel@ximian.com>
11057 * cs-tokenizer.cs (consume_identifier): use read directly, instead
11058 of calling getChar/putback, uses internal knowledge of it.
11060 (xtoken): Reorder tokenizer so most common patterns are checked
11061 first. This reduces the compilation time in another 5% (from 8.11s
11062 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
11064 The parsing time is 22% of the compilation in mcs, and from that
11065 64% is spent on the tokenization process.
11067 I tried using a binary search for keywords, but this is slower
11068 than the hashtable. Another option would be to do a couple of
11071 * Not use a StringBuilder, instead use an array of chars,
11072 with a set value. Notice that this way we could catch
11073 the 645 error without having to do it *afterwards*.
11075 * We could write a hand-parser to avoid the hashtable
11076 compares altogether.
11078 The identifier consumption process takes 37% of the tokenization
11079 time. Another 15% is spent on is_number. 56% of the time spent
11080 on is_number is spent on Int64.Parse:
11082 * We could probably choose based on the string length to
11083 use Int32.Parse or Int64.Parse and avoid all the 64-bit
11086 Another 3% is spend on wrapping `xtoken' in the `token' function.
11088 Handle 0xa0 as whitespace (#34752)
11090 2002-11-26 Miguel de Icaza <miguel@ximian.com>
11092 * typemanager.cs (IsCLRType): New routine to tell whether a type
11093 is one of the builtin types.
11095 Maybe it needs to use TypeCodes to be faster. Maybe we could use
11096 typecode in more places instead of doing pointer comparissions.
11097 We could leverage some knowledge about the way the typecodes are
11100 New code to cache namespaces in assemblies, it is currently not
11101 invoked, to be used soon.
11103 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
11105 * expression.cs (Binary.ResolveOperator): specially handle
11106 strings, and do not perform user-defined operator overloading for
11109 2002-11-24 Miguel de Icaza <miguel@ximian.com>
11111 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
11112 internalcall as it is a pretty simple operation; Avoid whenever
11113 possible to call Char.IsLetter.
11115 (consume_identifier): Cut by half the number of
11116 hashtable calls by merging the is_keyword and GetKeyword behavior.
11118 Do not short-circuit, because if we do, we
11119 report errors (ie, #if false && true would produce an invalid
11123 2002-11-24 Martin Baulig <martin@ximian.com>
11125 * expression.cs (Cast.TryReduce): If we're in checked syntax,
11126 check constant ranges and report a CS0221. Fixes #33186.
11128 2002-11-24 Martin Baulig <martin@ximian.com>
11130 * cs-parser.jay: Make this work for uninitialized variable
11131 declarations in the `for' initializer. Fixes #32416.
11133 2002-11-24 Martin Baulig <martin@ximian.com>
11135 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
11136 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
11138 2002-11-24 Martin Baulig <martin@ximian.com>
11140 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
11141 argument; if true, we also check for user-defined conversions.
11142 This is only needed if both arguments are of a user-defined type.
11143 Fixes #30443, added test-175.cs.
11144 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11146 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11148 2002-11-24 Martin Baulig <martin@ximian.com>
11150 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11151 function to get the store opcode.
11152 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11153 only emit the Ldelema if the store opcode is Stobj. You must run
11154 both test-34 and test-167 to test this. Fixes #34529.
11156 2002-11-23 Martin Baulig <martin@ximian.com>
11158 * ecore.cs (Expression.MemberLookup): Added additional
11159 `qualifier_type' argument which is used when we're being called
11160 from MemberAccess.DoResolve() and null if we're called from a
11162 (Expression.MemberLookupFailed): New method to report errors; this
11163 does the CS1540 check and reports the correct error message.
11165 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11166 argument for the CS1540 check and redone the way how we're dealing
11167 with private members. See the comment in the source code for details.
11168 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11169 `closure_start_type' to `closure_qualifier_type' and check whether
11170 it's not null. It was not this filter being broken, it was just
11171 being called with the wrong arguments.
11173 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11174 and pass it the correct `qualifier_type'; this also does the error
11177 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11179 * expression.cs (Invocation.EmitParams): If the we are dealing
11180 with a non-built-in value type, load its address as well.
11182 (ArrayCreation): Use a a pretty constant instead
11183 of the hardcoded value 2. Use 6 instead of 2 for the number of
11184 static initializers.
11186 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11187 because they are not really value types, just glorified integers.
11189 * driver.cs: Do not append .exe, the CSC compiler does not do it.
11191 * ecore.cs: Remove redundant code for enumerations, make them use
11192 the same code path as everything else, fixes the casting issue
11193 with enumerations in Windows.Forms.
11195 * attribute.cs: Do only cast to string if it is a string, the
11196 validation happens later.
11198 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
11199 people upgrade their corlibs.
11201 * ecore.cs: Oops, enumerations were not following the entire code path
11203 2002-11-21 Miguel de Icaza <miguel@ximian.com>
11205 * typemanager.cs (FilterWithClosure): Commented out the test for
11206 1540 in typemanager.cs, as it has problems when accessing
11207 protected methods from a parent class (see test-174.cs).
11209 * attribute.cs (Attribute.ValidateGuid): new method.
11210 (Attribute.Resolve): Use above.
11212 2002-11-19 Miguel de Icaza <miguel@ximian.com>
11214 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
11216 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
11217 handling for enumerations, as we only needed the TypeContainer
11218 functionality to begin with (this is required for the fix below to
11219 work for enums that reference constants in a container class for
11222 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
11224 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
11225 a valid TypeBuilder to perform lookups on.o
11227 * class.cs (InheritableMemberSignatureCompare): Use true in the
11228 call to GetGetMethod and GetSetMethod, because we are comparing
11229 the signature, and we need to get the methods *even* if they are
11232 (PropertyBase.CheckBase): ditto.
11234 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
11235 GotoCase.Resolve): Use Peel on EmpytCasts.
11237 * ecore.cs (EmptyCast): drop child, add Peel method.
11239 2002-11-17 Martin Baulig <martin@ximian.com>
11241 * ecore.cs (EmptyCast.Child): New public property.
11243 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
11244 label resolved to an EmptyCast. Fixes #34162.
11245 (GotoCase.Resolve): Likewise.
11246 (Block.EmitMeta): Likewise.
11248 2002-11-17 Martin Baulig <martin@ximian.com>
11250 * expression.cs (Invocation.BetterConversion): Prefer int over
11251 uint; short over ushort; long over ulong for integer literals.
11252 Use ImplicitConversionExists instead of StandardConversionExists
11253 since we also need to check for user-defined implicit conversions.
11254 Fixes #34165. Added test-173.cs.
11256 2002-11-16 Martin Baulig <martin@ximian.com>
11258 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
11259 with the `true' and `false' literals. Fixes #33151.
11261 2002-11-16 Martin Baulig <martin@ximian.com>
11263 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
11264 October 22nd; don't do the cs1540 check for static members.
11266 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
11267 now using our own filter here and doing the cs1540 check again.
11269 2002-11-16 Martin Baulig <martin@ximian.com>
11271 * support.cs (InternalParameters): Don't crash if we don't have
11272 any fixed parameters. Fixes #33532.
11274 2002-11-16 Martin Baulig <martin@ximian.com>
11276 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
11277 when looking up static methods to make this work on Windows.
11280 2002-11-16 Martin Baulig <martin@ximian.com>
11282 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
11283 a setter rather than using PropertyInfo.CanWrite.
11285 2002-11-15 Nick Drochak <ndrochak@gol.com>
11287 * class.cs: Allow acces to block member by subclasses. Fixes build
11290 2002-11-14 Martin Baulig <martin@ximian.com>
11292 * class.cs (Constructor.Emit): Added the extern/block check.
11295 2002-11-14 Martin Baulig <martin@ximian.com>
11297 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
11298 iteration while looking for indexers, this is needed because the
11299 indexer may have a different name in our base classes. Fixed the
11300 error reporting (no indexers at all, not get accessor, no
11301 overloaded match). Fixes bug #33089.
11302 (IndexerAccess.DoResolveLValue): Likewise.
11304 2002-11-14 Martin Baulig <martin@ximian.com>
11306 * class.cs (PropertyBase.CheckBase): Make this work for multiple
11307 indexers. Fixes the first part of bug #33089.
11308 (MethodSignature.InheritableMemberSignatureCompare): Added support
11311 2002-11-13 Ravi Pratap <ravi@ximian.com>
11313 * attribute.cs (Attribute.Resolve): Catch the
11314 NullReferenceException and report it since it isn't supposed to
11317 2002-11-12 Miguel de Icaza <miguel@ximian.com>
11319 * expression.cs (Binary.EmitBranchable): Also handle the cases for
11320 LogicalOr and LogicalAnd that can benefit from recursively
11321 handling EmitBranchable. The code now should be nice for Paolo.
11323 2002-11-08 Miguel de Icaza <miguel@ximian.com>
11325 * typemanager.cs (LookupType): Added a negative-hit hashtable for
11326 the Type lookups, as we perform quite a number of lookups on
11327 non-Types. This can be removed once we can deterministically tell
11328 whether we have a type or a namespace in advance.
11330 But this might require special hacks from our corlib.
11334 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
11335 and double which avoids a conversion from an integer to a double.
11337 * expression.cs: tiny optimization, avoid calling IsConstant,
11338 because it effectively performs the lookup twice.
11340 2002-11-06 Miguel de Icaza <miguel@ximian.com>
11342 But a bogus return here to keep the semantics of the old code
11343 until the Mono runtime is fixed.
11345 * pending.cs (GetMissingInterfaces): New method used to remove all
11346 the interfaces that are already implemented by our parent
11347 classes from the list of pending methods.
11349 * interface.cs: Add checks for calls after ResolveTypeExpr.
11351 2002-11-05 Miguel de Icaza <miguel@ximian.com>
11353 * class.cs (Class.Emit): Report warning 67: event not used if the
11354 warning level is beyond 3.
11356 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
11357 being a NullLiteral.
11359 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
11362 * class.cs (TypeContainer.GetClassBases): Cover a missing code
11363 path that might fail if a type can not be resolved.
11365 * expression.cs (Binary.Emit): Emit unsigned versions of the
11368 * driver.cs: use error 5.
11370 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
11372 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
11374 2002-11-01 Miguel de Icaza <miguel@ximian.com>
11376 * cs-parser.jay (switch_section): A beautiful patch from Martin
11377 Baulig that fixed 33094.
11379 2002-10-31 Miguel de Icaza <miguel@ximian.com>
11381 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
11382 Check whether the base is abstract and report an error if so.
11384 * expression.cs (IndexerAccess.DoResolveLValue,
11385 IndexerAccess.DoResolve): ditto.
11387 (Invocation.DoResolve): ditto.
11389 (Invocation.FullMethodDesc): Improve the report string.
11391 * statement.cs (Block): Eliminate IsVariableDefined as it is
11392 basically just a wrapper for GetVariableInfo.
11394 * ecore.cs (SimpleName): Use new
11396 * support.cs (ReflectionParamter.ParameterType): We unwrap the
11397 type, as we return the actual parameter ref/unref state on a
11400 2002-10-30 Miguel de Icaza <miguel@ximian.com>
11402 * support.cs: Return proper flags REF/OUT fixing the previous
11405 * expression.cs: Reverted last patch, that was wrong. Is_ref is
11406 not used to mean `ref' but `ref or out' in ParameterReference
11408 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
11409 full type signature instead of calling TypeManger.CSharpName
11412 * support.cs (InternalParameters.ParameterDesc): Do not compare
11413 directly to the modflags, because REF/OUT will actually be bitsets
11416 * delegate.cs (VerifyMethod): Check also the modifiers.
11418 * cs-tokenizer.cs: Fix bug where floating point values with an
11419 exponent where a sign was missing was ignored.
11421 * driver.cs: Allow multiple assemblies to be specified in a single
11424 2002-10-28 Miguel de Icaza <miguel@ximian.com>
11426 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
11427 because identifiers after a parenthesis would end up in this kind
11428 of production, and we needed to desamiguate it for having casts
11431 (UserDefinedType *) xxx
11433 2002-10-24 Miguel de Icaza <miguel@ximian.com>
11435 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
11436 we should set on the Bindingflags.NonPublic, but not turn on
11437 private_ok. private_ok controls whether a Private member is
11438 returned (this is chekced on the filter routine), while the
11439 BindingFlags.NonPublic just controls whether private/protected
11440 will be allowed. This fixes the problem part of the problem of
11441 private properties being allowed to be used in derived classes.
11443 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
11444 so we can call the children DoResolveLValue method (this will
11445 properly signal errors on lvalue assignments to base properties)
11447 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
11448 getter are null, and we have a property info, we know that this
11449 happened because the lookup failed, so we report an error 122 for
11450 protection level violation.
11452 We also silently return if setter and getter are null in the
11453 resolve functions, this condition only happens if we have flagged
11454 the error before. This is the other half of the problem.
11456 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
11457 not have accessibility information, that is why we were returning
11458 true in the filter function in typemanager.cs.
11460 To properly report 122 (property is inaccessible because of its
11461 protection level) correctly, we report this error in ResolveAccess
11462 by failing if both the setter and the getter are lacking (ie, the
11465 DoResolve and DoLResolve have been modified to check for both
11466 setter/getter being null and returning silently, the reason being
11467 that I did not want to put the knowledge about this error in upper
11470 int old = Report.Errors;
11471 x = new PropertyExpr (...);
11472 if (old != Report.Errors)
11477 So the property expr is returned, but it is invalid, so the error
11478 will be flagged during the resolve process.
11480 * class.cs: Remove InheritablePropertySignatureCompare from the
11481 class, as we no longer depend on the property signature to compute
11482 whether it is possible to implement a method or not.
11484 The reason is that calling PropertyInfo.GetGetMethod will return
11485 null (in .NET, in Mono it works, and we should change this), in
11486 cases where the Get Method does not exist in that particular
11491 class X { public virtual int A { get { return 1; } } }
11493 class Z : Y { public override int A { get { return 2; } } }
11495 Would fail in Z because the parent (Y) would not have the property
11496 defined. So we avoid this completely now (because the alternative
11497 fix was ugly and slow), and we now depend exclusively on the
11500 (PropertyBase.CheckBase): Use a method-base mechanism to find our
11501 reference method, instead of using the property.
11503 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
11504 routines are gone now.
11506 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
11507 names, they were incorrectly named.
11509 * cs-tokenizer.cs: Return are more gentle token on failure.
11511 * pending.cs (PendingImplementation.InterfaceMethod): This routine
11512 had an out-of-sync index variable, which caused it to remove from
11513 the list of pending methods the wrong method sometimes.
11515 2002-10-22 Miguel de Icaza <miguel@ximian.com>
11517 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
11518 CanWrite, because those refer to this particular instance of the
11519 property, and do not take into account the fact that we can
11520 override single members of a property.
11522 Constructor requires an EmitContext. The resolution process does
11523 not happen here, but we need to compute the accessors before,
11524 because the resolution does not always happen for properties.
11526 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
11527 subclass, before we did not update this flag, but we did update
11530 (GetAccessors): Drop this routine, as it did not work in the
11531 presence of partially overwritten set/get methods.
11533 Notice that this broke the cs1540 detection, but that will require
11536 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11540 * driver.cs: issue a warning instead of an error if we don't support
11541 debugging for the platform. Also ignore a couple of errors that may
11542 arise when trying to write the symbols. Undo my previous patch.
11544 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11546 * driver.cs: ignore /debug switch except for Unix platforms.
11548 2002-10-23 Nick Drochak <ndrochak@gol.com>
11550 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
11552 2002-10-21 Miguel de Icaza <miguel@ximian.com>
11554 * driver.cs: Do not make mcs-debug conditional, so we do not break
11555 builds that use it.
11557 * statement.cs (UsageVector.MergeChildren): I would like Martin to
11558 review this patch. But basically after all the children variables
11559 have been merged, the value of "Breaks" was not being set to
11560 new_breaks for Switch blocks. I think that it should be set after
11561 it has executed. Currently I set this to the value of new_breaks,
11562 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
11563 conservative, but I do not understand this code very well.
11565 I did not break anything in the build, so that is good ;-)
11567 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
11569 2002-10-20 Mark Crichton <crichton@gimp.org>
11571 * cfold.cs: Fixed compile blocker. Really fixed it this time.
11573 2002-10-20 Nick Drochak <ndrochak@gol.com>
11575 * cfold.cs: Fixed compile blocker.
11577 2002-10-20 Miguel de Icaza <miguel@ximian.com>
11579 * driver.cs: I was chekcing the key, not the file.
11581 2002-10-19 Ravi Pratap <ravi@ximian.com>
11583 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
11584 message that we were generating - we just need to silently return
11587 2002-10-19 Miguel de Icaza <miguel@ximian.com>
11589 * class.cs (Event.Define): Change my previous commit, as this
11590 breaks the debugger. This is a temporary hack, as it seems like
11591 the compiler is generating events incorrectly to begin with.
11593 * expression.cs (Binary.ResolveOperator): Added support for
11594 "U operator - (E x, E y)"
11596 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
11599 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
11600 init-only variables, but this path did not take into account that
11601 there might be also instance readonly variables. Correct this
11604 This fixes bug 32253
11606 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
11609 * driver.cs: Change the extension for modules to `netmodule'
11611 * cs-parser.jay: Improved slightly the location tracking for
11612 the debugger symbols.
11614 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
11615 modifiers that were specified instead of the hardcoded value
11616 (FamAndAssem). This was basically ignoring the static modifier,
11617 and others. Fixes 32429.
11619 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
11620 fixed a bug in the process (32476)
11622 * expression.cs (ArrayAccess.EmitAssign): Patch from
11623 hwang_rob@yahoo.ca that fixes bug 31834.3
11625 2002-10-18 Miguel de Icaza <miguel@ximian.com>
11627 * driver.cs: Make the module extension .netmodule.
11629 2002-10-16 Miguel de Icaza <miguel@ximian.com>
11631 * driver.cs: Report an error if the resource file is not found
11632 instead of crashing.
11634 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
11635 false, like Emit does.
11637 2002-10-16 Nick Drochak <ndrochak@gol.com>
11639 * typemanager.cs: Remove unused private member. Also reported mcs
11640 bug to report this as a warning like csc.
11642 2002-10-15 Martin Baulig <martin@gnome.org>
11644 * statement.cs (Statement.Emit): Made this a virtual method; emits
11645 the line number info and calls DoEmit().
11646 (Statement.DoEmit): New protected abstract method, formerly knows
11647 as Statement.Emit().
11649 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
11651 2002-10-11 Miguel de Icaza <miguel@ximian.com>
11653 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
11654 have fixed a remaining problem: not every AddXXXX was adding a
11655 fully qualified name.
11657 Now everyone registers a fully qualified name in the DeclSpace as
11658 being defined instead of the partial name.
11660 Downsides: we are slower than we need to be due to the excess
11661 copies and the names being registered this way.
11663 The reason for this is that we currently depend (on the corlib
11664 bootstrap for instance) that types are fully qualified, because
11665 we dump all the types in the namespace, and we should really have
11666 types inserted into the proper namespace, so we can only store the
11667 basenames in the defined_names array.
11669 2002-10-10 Martin Baulig <martin@gnome.org>
11671 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
11672 from bug #31834, see the bug report for a testcase which is
11675 2002-10-10 Martin Baulig <martin@gnome.org>
11677 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
11678 flow analysis code for this.
11680 * statement.cs (Do, While, For): Tell the flow analysis code about
11682 (FlowBranching.UsageVector): Added support for infinite loops.
11683 (Block.Resolve): Moved the dead code elimination here and use flow
11686 2002-10-09 Miguel de Icaza <miguel@ximian.com>
11688 * class.cs (Field.Define): Catch cycles on struct type
11691 * typemanager.cs (IsUnmanagedtype): Do not recursively check
11692 fields if the fields are static. We only need to check instance
11695 * expression.cs (As.DoResolve): Test for reference type.
11697 * statement.cs (Using.ResolveExpression): Use
11698 ConvertImplicitRequired, not ConvertImplicit which reports an
11700 (Using.ResolveLocalVariableDecls): ditto.
11702 * expression.cs (Binary.ResolveOperator): Report errors in a few
11703 places where we had to.
11705 * typemanager.cs (IsUnmanagedtype): Finish implementation.
11707 2002-10-08 Miguel de Icaza <miguel@ximian.com>
11709 * expression.cs: Use StoreFromPtr instead of extracting the type
11710 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
11712 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
11713 an enumeration value to a System.Enum, but System.Enum is not a
11714 value type, but an class type, so we need to box.
11716 (Expression.ConvertExplicit): One codepath could return
11717 errors but not flag them. Fix this. Fixes #31853
11719 * parameter.cs (Resolve): Do not allow void as a parameter type.
11721 2002-10-06 Martin Baulig <martin@gnome.org>
11723 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
11724 if it's a class type and not a struct. Fixes #31815.
11726 2002-10-06 Martin Baulig <martin@gnome.org>
11728 * statement.cs: Reworked the flow analysis code a bit to make it
11729 usable for dead code elimination.
11731 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11733 * cs-parser.jay: allow empty source files. Fixes bug #31781.
11735 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11737 * expression.cs (ComposedCast.DoResolveType): A quick workaround
11738 to fix the test 165, will investigate deeper.
11740 2002-10-04 Martin Baulig <martin@gnome.org>
11742 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
11743 finally blocks actually work.
11744 (Try.Resolve): We don't need to create a sibling for `finally' if
11745 there is no finally block.
11747 2002-10-04 Martin Baulig <martin@gnome.org>
11749 * class.cs (Constructor.Define): The default accessibility for a
11750 non-default constructor is private, not public.
11752 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11754 * class.cs (Constructor): Make AllowedModifiers public, add
11757 * cs-parser.jay: Perform the modifiers test here, as the
11758 constructor for the Constructor class usually receives a zero
11759 because of the way we create it (first we create, later we
11760 customize, and we were never checking the modifiers).
11762 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
11763 is a version of LookupTypeReflection that includes the type-name
11764 cache. This can be used as a fast path for functions that know
11765 the fully qualified name and are only calling into *.GetType() to
11766 obtain a composed type.
11768 This is also used by TypeManager.LookupType during its type
11771 (LookupType): We now also track the real type name, as sometimes
11772 we can get a quey for the real type name from things like
11773 ComposedCast. This fixes bug 31422.
11775 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
11776 complete type fullname, it does not have to go through the type
11777 resolution system to obtain the composed version of the type (for
11778 obtaining arrays or pointers).
11780 (Conditional.Emit): Use the EmitBoolExpression to
11781 generate nicer code, as requested by Paolo.
11783 (ArrayCreation.CheckIndices): Use the patch from
11784 hwang_rob@yahoo.ca to validate the array initializers.
11786 2002-10-03 Miguel de Icaza <miguel@ximian.com>
11788 * class.cs (ConstructorInitializer.Emit): simplify code by using
11789 Invocation.EmitCall, and at the same time, fix the bugs in calling
11790 parent constructors that took variable arguments.
11792 * ecore.cs (Expression.ConvertNumericExplicit,
11793 Expression.ImplicitNumericConversion): Remove the code that
11794 manually wrapped decimal (InternalTypeConstructor call is now gone
11797 * expression.cs (Cast.TryReduce): Also handle decimal types when
11798 trying to perform a constant fold on the type.
11800 * typemanager.cs (IsUnmanagedtype): Partially implemented.
11802 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
11803 that only turned off an error report, and did nothing else.
11805 2002-10-02 Miguel de Icaza <miguel@ximian.com>
11807 * driver.cs: Handle and ignore /fullpaths
11809 2002-10-01 Miguel de Icaza <miguel@ximian.com>
11811 * expression.cs (Binary.ResolveOperator): Catch the case where
11812 DoNumericPromotions returns true,
11814 (Binary.DoNumericPromotions): Simplify the code, and the tests.
11816 2002-09-27 Miguel de Icaza <miguel@ximian.com>
11818 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
11821 2002-09-26 Miguel de Icaza <miguel@ximian.com>
11823 * ecore.cs (ConvertNumericExplicit): It is not enough that the
11824 conversion exists, but it is also required that the conversion be
11825 performed. This manifested in "(Type64Enum) 2".
11827 * class.cs (TypeManager.AddMethod): The fix is not to change
11828 AddEnum, because that one was using a fully qualified name (every
11829 DeclSpace derivative does), but to change the AddMethod routine
11830 that was using an un-namespaced name. This now correctly reports
11831 the duplicated name.
11833 Revert patch until I can properly fix it. The issue
11834 is that we have a shared Type space across all namespaces
11835 currently, which is wrong.
11837 Options include making the Namespace a DeclSpace, and merge
11838 current_namespace/current_container in the parser.
11840 2002-09-25 Miguel de Icaza <miguel@ximian.com>
11842 * cs-parser.jay: Improve error reporting when we get a different
11843 kind of expression in local_variable_type and
11844 local_variable_pointer_type.
11846 Propagate this to avoid missleading errors being reported.
11848 * ecore.cs (ImplicitReferenceConversion): treat
11849 TypeManager.value_type as a target just like object_type. As
11854 Is valid, and needs to result in the int 1 being boxed before it
11855 is assigned to the value type v.
11857 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
11858 to validate the enumeration name.
11860 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
11861 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
11862 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
11864 * ecore.cs (TryImplicitIntConversion): When doing an
11865 implicit-enumeration-conversion, check if the type is 64-bits and
11866 perform a conversion before passing to EnumConstant.
11868 2002-09-23 Miguel de Icaza <miguel@ximian.com>
11870 * decl.cs (Error_AmbiguousTypeReference); New routine used to
11871 report ambiguous type references. Unlike the MS version, we
11872 report what the ambiguity is. Innovation at work ;-)
11874 (DeclSpace.FindType): Require a location argument to
11875 display when we display an ambiguous error.
11877 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
11879 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
11881 * expression.cs (EmitDynamicInitializers): Apply patch from
11882 hwang_rob@yahoo.ca that fixes the order in which we emit our
11885 2002-09-21 Martin Baulig <martin@gnome.org>
11887 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
11888 delegate takes no arguments.
11890 2002-09-20 Miguel de Icaza <miguel@ximian.com>
11892 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
11895 * expression.cs: Extract the underlying type.
11897 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
11899 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
11901 2002-09-19 Miguel de Icaza <miguel@ximian.com>
11903 * class.cs (TypeContainer.DefineType): We can not use the nice
11904 PackingSize with the size set to 1 DefineType method, because it
11905 will not allow us to define the interfaces that the struct
11908 This completes the fixing of bug 27287
11910 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
11911 means also structs. This fixes part of the problem.
11912 (Expresion.ImplicitReferenceConversionExists): ditto.
11914 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
11915 error if there were no errors reported during the type lookup
11916 process, to avoid duplicates or redundant errors. Without this
11917 you would get an ambiguous errors plus a type not found. We have
11918 beaten the user enough with the first error.
11920 (DeclSparce.FindType): Emit a warning if we have an ambiguous
11923 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
11924 during the resolution process, stop the lookup, this avoids
11925 repeated error reports (same error twice).
11927 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
11929 * typemanager.cs (LookupType): Redo the type lookup code to match
11930 the needs of System.Reflection.
11932 The issue is that System.Reflection requires references to nested
11933 types to begin with a "+" sign instead of a dot. So toplevel
11934 types look like: "NameSpace.TopLevelClass", and nested ones look
11935 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
11938 2002-09-19 Martin Baulig <martin@gnome.org>
11940 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
11941 says that a method always returns or always throws an exception,
11942 don't report the CS0161.
11944 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
11945 set `Returns = new_returns'.
11947 2002-09-19 Martin Baulig <martin@gnome.org>
11949 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
11950 to an enum constant, check for a CS0176.
11952 2002-09-18 Miguel de Icaza <miguel@ximian.com>
11954 * class.cs (TypeContainer.CheckPairedOperators): Now we check
11955 for operators that must be in pairs and report errors.
11957 * ecore.cs (SimpleName.DoResolveType): During the initial type
11958 resolution process, when we define types recursively, we must
11959 check first for types in our current scope before we perform
11960 lookups in the enclosing scopes.
11962 * expression.cs (MakeByteBlob): Handle Decimal blobs.
11964 (Invocation.VerifyArgumentsCompat): Call
11965 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
11966 I thought we were supposed to always call this, but there are a
11967 few places in the code where we dont do it.
11969 2002-09-17 Miguel de Icaza <miguel@ximian.com>
11971 * driver.cs: Add support in -linkres and -resource to specify the
11972 name of the identifier.
11974 2002-09-16 Miguel de Icaza <miguel@ximian.com>
11976 * ecore.cs (StandardConversionExists): Sync with the conversion
11977 code: allow anything-* to void* conversions.
11979 (FindMostSpecificSource): Use an Expression argument
11980 instead of a Type, because we might be handed over a Literal which
11981 gets a few more implicit conversions that plain types do not. So
11982 this information was being lost.
11984 Also, we drop the temporary type-holder expression when not
11987 2002-09-17 Martin Baulig <martin@gnome.org>
11989 * class.cs (PropertyBase.CheckBase): Don't check the base class if
11990 this is an explicit interface implementation.
11992 2002-09-17 Martin Baulig <martin@gnome.org>
11994 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
11995 different `IndexerName' attributes.
11997 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
11998 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
11999 virtual CommonResolve().
12001 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12003 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12004 and convert that to the UnderlyingType.
12006 * statement.cs (Foreach.Resolve): Indexers are just like variables
12007 or PropertyAccesses.
12009 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12010 inside quoted strings, we were not doing this before.
12012 2002-09-16 Martin Baulig <martin@gnome.org>
12014 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12015 resolve it. This is needed for the definite assignment check of the
12016 instance expression, fixes bug #29846.
12017 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12019 2002-09-16 Nick Drochak <ndrochak@gol.com>
12021 * parameter.cs: Fix compile error. Cannot reference static member
12022 from an instance object. Is this an mcs bug?
12024 2002-09-14 Martin Baulig <martin@gnome.org>
12026 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12027 multiple times. Fixes bug #30295, added test-166.cs.
12029 2002-09-14 Martin Baulig <martin@gnome.org>
12031 * statement.cs (Block.Emit): Don't emit unreachable code.
12032 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
12033 `break' statements.
12034 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
12036 2002-09-14 Martin Baulig <martin@gnome.org>
12038 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
12041 2002-09-14 Martin Baulig <martin@gnome.org>
12043 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
12044 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
12045 be false on the ms runtime.
12047 2002-09-13 Martin Baulig <martin@gnome.org>
12049 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
12050 the CS0038 error message.
12052 2002-09-12 Miguel de Icaza <miguel@ximian.com>
12054 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
12055 constant inside, return it.
12057 2002-09-12 Martin Baulig <martin@gnome.org>
12059 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
12060 implicit conversion can be done between enum types.
12062 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
12063 check whether an implicit conversion to the current enum's UnderlyingType
12064 exists and report an error if not.
12066 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
12067 without debugging support.
12069 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
12070 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
12072 2002-09-12 Martin Baulig <martin@gnome.org>
12074 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
12076 * ecore.cs (IMemberExpr.DeclaringType): New property.
12077 (SimpleName.SimpleNameResolve): Check whether we're accessing a
12078 nonstatic member of an outer type (CS0038).
12080 2002-09-11 Miguel de Icaza <miguel@ximian.com>
12082 * driver.cs: Activate the using-error detector at warning level
12083 4 (at least for MS-compatible APIs).
12085 * namespace.cs (VerifyUsing): Small buglett fix.
12087 * pending.cs (PendingImplementation): pass the container pointer.
12089 * interface.cs (GetMethods): Allow for recursive definition. Long
12090 term, I would like to move every type to support recursive
12091 definitions, not the current ordering mechanism that we have right
12094 The situation is this: Attributes are handled before interfaces,
12095 so we can apply attributes to interfaces. But some attributes
12096 implement interfaces, we will now handle the simple cases
12097 (recursive definitions will just get an error).
12099 * parameter.cs: Only invalidate types at the end if we fail to
12102 2002-09-09 Martin Baulig <martin@gnome.org>
12104 * ecore.cs (PropertyExpr.Emit): Also check for
12105 TypeManager.system_int_array_get_length so this'll also work when
12106 compiling corlib. Fixes #30003.
12108 2002-09-09 Martin Baulig <martin@gnome.org>
12110 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
12111 and throw an exception if we can't get the type's size. Fixed #30040,
12114 2002-09-09 Martin Baulig <martin@gnome.org>
12116 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
12118 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
12119 context. Fixes bug #30027.
12121 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
12122 virtual functions. Fixes bug #30043, added test-164.cs.
12124 2002-09-08 Ravi Pratap <ravi@ximian.com>
12126 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
12128 2002-09-08 Nick Drochak <ndrochak@gol.com>
12130 * driver.cs: Use an object to get the windows codepage since it's not a
12133 2002-09-08 Miguel de Icaza <miguel@ximian.com>
12135 * statement.cs (For.Emit): for infinite loops (test == null)
12136 return whether there is a break inside, not always "true".
12138 * namespace.cs (UsingEntry): New struct to hold the name of the
12139 using definition, the location where it is defined, and whether it
12140 has been used in a successful type lookup.
12142 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12147 2002-09-06 Ravi Pratap <ravi@ximian.com>
12149 * attribute.cs : Fix incorrect code which relied on catching
12150 a NullReferenceException to detect a null being passed in
12151 where an object was expected.
12153 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12155 * statement.cs (Try): flag the catch variable as assigned
12157 * expression.cs (Cast): Simplified by using ResolveType instead of
12158 manually resolving.
12160 * statement.cs (Catch): Fix bug by using ResolveType.
12162 2002-09-06 Ravi Pratap <ravi@ximian.com>
12164 * expression.cs (BetterConversion): Special case for when we have
12165 a NullLiteral as the argument and we have to choose between string
12166 and object types - we choose string the way csc does.
12168 * attribute.cs (Attribute.Resolve): Catch the
12169 NullReferenceException and report error #182 since the Mono
12170 runtime no more has the bug and having this exception raised means
12171 we tried to select a constructor which takes an object and is
12174 2002-09-05 Ravi Pratap <ravi@ximian.com>
12176 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12177 message (1502, 1503) when we can't locate a method after overload
12178 resolution. This is much more informative and closes the bug
12181 * interface.cs (PopulateMethod): Return if there are no argument
12182 types. Fixes a NullReferenceException bug.
12184 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12185 expressions too. Previously we were checking only in one place for
12186 positional arguments leaving out named arguments.
12188 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12189 type to the enum type is not allowed. Remove code corresponding to
12192 (ConvertNumericExplicit): Allow explicit conversions from
12193 the underlying type to enum type. This precisely follows the spec
12194 and closes a bug filed by Gonzalo.
12196 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12199 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
12201 2002-09-03 Miguel de Icaza <miguel@ximian.com>
12203 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
12204 it was important that we stored the right value after the
12205 reduction in `converted'.
12207 2002-09-04 Martin Baulig <martin@gnome.org>
12209 * location.cs (Location.SymbolDocument): Use full pathnames for the
12212 2002-08-30 Miguel de Icaza <miguel@ximian.com>
12214 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
12215 of the expression resolve mechanism, because that will catch the
12216 SimpleName error failures.
12218 (Conditional): If we can not resolve the
12219 expression, return, do not crash.
12221 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12224 (location): display token name instead of its number.
12226 2002-08-28 Martin Baulig <martin@gnome.org>
12228 * expression.cs (Binary.ResolveOperator): Don't silently return
12229 but return an error if an operator cannot be applied between two
12232 2002-08-28 Martin Baulig <martin@gnome.org>
12234 * class.cs (Constructor.Define): Set the permission attributes
12235 correctly instead of making all constructors public.
12237 2002-08-28 Martin Baulig <martin@gnome.org>
12239 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
12240 for private members before reporting a CS0103; if we find anything,
12243 2002-08-28 Martin Baulig <martin@gnome.org>
12245 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
12246 to check whether `closure_start_type == closure_invocation_type',
12247 we also need to check whether `m.DeclaringType == closure_invocation_type'
12248 before bypassing the permission checks. We might be accessing
12249 protected/private members from the base class.
12250 (TypeManager.RealMemberLookup): Only set private_ok if private
12251 members were requested via BindingFlags.NonPublic.
12253 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
12255 * expression.cs (MemberAccess.ResolveMemberAccess): Set
12256 MethodGroupExpr.IsExplicitImpl if appropriate.
12257 (Invocation.DoResolve): Don't report the CS0120 for explicit
12258 interface implementations.
12260 2002-08-27 Martin Baulig <martin@gnome.org>
12262 * expression.cs (Invocation.DoResolve): If this is a static
12263 method and we don't have an InstanceExpression, we must report
12266 2002-08-25 Martin Baulig <martin@gnome.org>
12268 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
12269 `==' between a valuetype and an object.
12271 2002-08-25 Miguel de Icaza <miguel@ximian.com>
12273 * ecore.cs (TypeExpr): Provide a ToString method.
12275 2002-08-24 Martin Baulig <martin@gnome.org>
12277 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
12278 now called proggie.dbg and it's a binary file.
12280 2002-08-23 Martin Baulig <martin@gnome.org>
12282 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
12284 2002-08-23 Martin Baulig <martin@gnome.org>
12286 * struct.cs (MyStructInfo.ctor): Make this work with empty
12287 structs; it's not allowed to use foreach() on null.
12289 2002-08-23 Martin Baulig <martin@gnome.org>
12291 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
12292 writer the full pathname of the generated assembly.
12294 2002-08-23 Martin Baulig <martin@gnome.org>
12296 * statements.cs (FlowBranching.UsageVector.MergeChildren):
12297 A `finally' block never returns or breaks; improved handling of
12300 2002-08-23 Martin Baulig <martin@gnome.org>
12302 * statement.cs (Throw.Resolve): Allow `throw null'.
12304 2002-08-23 Martin Baulig <martin@gnome.org>
12306 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
12307 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
12308 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
12309 MemberLookup would return a wrong event if this is an explicit
12310 interface implementation and the class has an event with the same
12313 2002-08-23 Martin Baulig <martin@gnome.org>
12315 * statement.cs (Block.AddChildVariableNames): New public method.
12316 (Block.AddChildVariableName): Likewise.
12317 (Block.IsVariableNameUsedInChildBlock): Likewise.
12318 (Block.AddVariable): Check whether a variable name has already
12319 been used in a child block.
12321 * cs-parser.jay (declare_local_variables): Mark all variable names
12322 from the current block as being used in a child block in the
12325 2002-08-23 Martin Baulig <martin@gnome.org>
12327 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
12328 find the symbol writer.
12330 * driver.cs: csc also allows the arguments to /define being
12331 separated by commas, not only by semicolons.
12333 2002-08-23 Martin Baulig <martin@gnome.org>
12335 * interface.cs (Interface.GetMembers): Added static check for events.
12337 2002-08-15 Martin Baulig <martin@gnome.org>
12339 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
12340 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
12342 * ecore.cs (Expression.MemberLookup): Added documentation and explained
12343 why the MethodData.EmitDestructor() change was necessary.
12345 2002-08-20 Martin Baulig <martin@gnome.org>
12347 * class.cs (TypeContainer.FindMembers): Added static check for events.
12349 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
12351 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
12352 use Type.GetEvents(), not Type.FindMembers().
12354 2002-08-20 Martin Baulig <martin@gnome.org>
12356 * decl.cs (MemberCache): Added a special method cache which will
12357 be used for method-only searched. This ensures that a method
12358 search will return a MethodInfo with the correct ReflectedType for
12361 2002-08-20 Martin Baulig <martin@gnome.org>
12363 * decl.cs (DeclSpace.FindMembers): Made this public.
12365 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12367 * delegate.cs: fixed build on windows.
12368 [FIXME: Filed as bug #29150: MCS must report these errors.]
12370 2002-08-19 Ravi Pratap <ravi@ximian.com>
12372 * ecore.cs (StandardConversionExists): Return a false
12373 if we are trying to convert the void type to anything else
12374 since that is not allowed.
12376 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
12377 we flag error 70 in the event an event is trying to be accessed
12378 directly from outside the declaring type.
12380 2002-08-20 Martin Baulig <martin@gnome.org>
12382 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
12383 MemberCache from typemanager.cs to decl.cs.
12385 2002-08-19 Martin Baulig <martin@gnome.org>
12387 * class.cs (TypeContainer): Implement IMemberContainer.
12388 (TypeContainer.DefineMembers): Create the MemberCache.
12389 (TypeContainer.FindMembers): Do better BindingFlags checking; only
12390 return public members if BindingFlags.Public was given, check
12391 whether members are static.
12393 2002-08-16 Martin Baulig <martin@gnome.org>
12395 * decl.cs (DeclSpace.Define): Splitted this in Define and
12396 DefineMembers. DefineMembers is called first and initializes the
12399 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
12400 DefineMembers() on all our DeclSpaces.
12402 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
12403 but call DefineMembers() on all nested interfaces. We call their
12404 Define() in our new Define() function.
12406 * interface.cs (Interface): Implement IMemberContainer.
12407 (Interface.Define): Moved all code except the attribute stuf to
12409 (Interface.DefineMembers): Initialize the member cache.
12411 * typemanager.cs (IMemberFinder): Removed this interface, we don't
12412 need this anymore since we can use MemberCache.FindMembers directly.
12414 2002-08-19 Martin Baulig <martin@gnome.org>
12416 * typemanager.cs (MemberCache): When creating the cache for an
12417 interface type, add all inherited members.
12418 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
12419 to `out bool used_cache' and documented it.
12420 (TypeManager.MemberLookup): If we already used the cache in the first
12421 iteration, we don't need to do the interfaces check.
12423 2002-08-19 Martin Baulig <martin@gnome.org>
12425 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
12426 here from IMemberFinder and don't implement this interface anymore.
12427 (DeclSpace.MemberCache): Moved here from IMemberFinder.
12429 * typemanager.cs (IMemberFinder): This interface is now only used by
12430 classes which actually support the member cache.
12431 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
12432 since we only put DeclSpaces into this Hashtable.
12433 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
12434 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
12436 2002-08-16 Martin Baulig <martin@gnome.org>
12438 * typemanager.cs (ICachingMemberFinder): Removed.
12439 (IMemberFinder.MemberCache): New property.
12440 (TypeManager.FindMembers): Merged this with RealFindMembers().
12441 This function will never be called from TypeManager.MemberLookup()
12442 so we can't use the cache here, just the IMemberFinder.
12443 (TypeManager.MemberLookup_FindMembers): Check whether the
12444 IMemberFinder has a MemberCache and call the cache's FindMembers
12446 (MemberCache): Rewrote larger parts of this yet another time and
12447 cleaned it up a bit.
12449 2002-08-15 Miguel de Icaza <miguel@ximian.com>
12451 * driver.cs (LoadArgs): Support quoting.
12453 (Usage): Show the CSC-like command line arguments.
12455 Improved a few error messages.
12457 2002-08-15 Martin Baulig <martin@gnome.org>
12459 * typemanager.cs (IMemberContainer.Type): New property.
12460 (IMemberContainer.IsInterface): New property.
12462 The following changes are conditional to BROKEN_RUNTIME, which is
12463 defined at the top of the file.
12465 * typemanager.cs (MemberCache.MemberCache): Don't add the base
12466 class'es members, but add all members from TypeHandle.ObjectType
12467 if we're an interface.
12468 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
12469 is the current type.
12470 (MemberCache.CacheEntry.Container): Removed this field.
12471 (TypeHandle.GetMembers): Include inherited members.
12473 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12475 * typemanager.cs: fixed compilation and added a comment on a field that
12478 2002-08-15 Martin Baulig <martin@gnome.org>
12480 * class.cs (ConstructorInitializer.Resolve): In the
12481 Expression.MemberLookup call, use the queried_type as
12484 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
12485 declared' attribute, it's always true.
12486 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
12487 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
12488 temporary wrapper for FindMembers which tells MemberLookup whether
12489 members from the base classes are included in the return value.
12490 This will go away soon.
12491 (TypeManager.MemberLookup): Use this temporary hack here; once the
12492 new MemberCache is completed, we don't need to do the DeclaredOnly
12493 looping here anymore since the MemberCache will take care of this.
12494 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
12495 (MemberCache): When creating the MemberCache for a class, get
12496 members from the current class and all its base classes.
12497 (MemberCache.CacheEntry.Container): New field. This is a
12498 temporary hack until the Mono runtime is fixed to distinguish
12499 between ReflectedType and DeclaringType. It allows us to use MCS
12500 with both the MS runtime and the unfixed Mono runtime without
12501 problems and without accecting performance.
12502 (MemberCache.SearchMembers): The DeclaredOnly looping from
12503 TypeManager.MemberLookup is now done here.
12505 2002-08-14 Martin Baulig <martin@gnome.org>
12507 * statement.cs (MyStructInfo.MyStructInfo): Don't call
12508 Type.GetFields on dynamic types but get the fields from the
12509 corresponding TypeContainer.
12510 (MyStructInfo.GetStructInfo): Added check for enum types.
12512 * typemanager.cs (MemberList.IsSynchronized): Implemented.
12513 (MemberList.SyncRoot): Implemented.
12514 (TypeManager.FilterWithClosure): No need to check permissions if
12515 closure_start_type == closure_invocation_type, don't crash if
12516 closure_invocation_type is null.
12518 2002-08-13 Martin Baulig <martin@gnome.org>
12520 Rewrote TypeContainer.FindMembers to use a member cache. This
12521 gives us a speed increase of about 35% for the self-hosting MCS
12522 build and of about 15-20% for the class libs (both on GNU/Linux).
12524 * report.cs (Timer): New class to get enhanced profiling. This
12525 whole class is "TIMER" conditional since it remarkably slows down
12528 * class.cs (MemberList): New class. This is an IList wrapper
12529 which we're now using instead of passing MemberInfo[]'s around to
12530 avoid copying this array unnecessarily.
12531 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
12532 (ICachingMemberFinder, IMemberContainer): New interface.
12533 (TypeManager.FilterWithClosure): If `criteria' is null, the name
12534 has already been checked, otherwise use it for the name comparision.
12535 (TypeManager.FindMembers): Renamed to RealMemberFinder and
12536 provided wrapper which tries to use ICachingMemberFinder.FindMembers
12537 if possible. Returns a MemberList, not a MemberInfo [].
12538 (TypeHandle): New class, implements IMemberContainer. We create
12539 one instance of this class per type, it contains a MemberCache
12540 which is used to do the member lookups.
12541 (MemberCache): New class. Each instance of this class contains
12542 all members of a type and a name-based hash table.
12543 (MemberCache.FindMembers): This is our new member lookup
12544 function. First, it looks up all members of the requested name in
12545 the hash table. Then, it walks this list and sorts out all
12546 applicable members and returns them.
12548 2002-08-13 Martin Baulig <martin@gnome.org>
12550 In addition to a nice code cleanup, this gives us a performance
12551 increase of about 1.4% on GNU/Linux - not much, but it's already
12552 half a second for the self-hosting MCS compilation.
12554 * typemanager.cs (IMemberFinder): New interface. It is used by
12555 TypeManager.FindMembers to call FindMembers on a TypeContainer,
12556 Enum, Delegate or Interface.
12557 (TypeManager.finder_to_member_finder): New PtrHashtable.
12558 (TypeManager.finder_to_container): Removed.
12559 (TypeManager.finder_to_delegate): Removed.
12560 (TypeManager.finder_to_interface): Removed.
12561 (TypeManager.finder_to_enum): Removed.
12563 * interface.cs (Interface): Implement IMemberFinder.
12565 * delegate.cs (Delegate): Implement IMemberFinder.
12567 * enum.cs (Enum): Implement IMemberFinder.
12569 * class.cs (TypeContainer): Implement IMemberFinder.
12571 2002-08-12 Martin Baulig <martin@gnome.org>
12573 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
12575 2002-08-12 Martin Baulig <martin@gnome.org>
12577 * ecore.cs (ITypeExpression): New interface for expressions which
12579 (TypeExpression): Renamed to TypeLookupExpression.
12580 (Expression.DoResolve): If we're doing a types-only lookup, the
12581 expression must implement the ITypeExpression interface and we
12582 call DoResolveType() on it.
12583 (SimpleName): Implement the new ITypeExpression interface.
12584 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
12585 hack, the situation that we're only looking up types can't happen
12586 anymore when this method is called. Moved the type lookup code to
12587 DoResolveType() and call it.
12588 (SimpleName.DoResolveType): This ITypeExpression interface method
12589 is now doing the types-only lookup.
12590 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
12591 (ResolveFlags): Added MaskExprClass.
12593 * expression.cs (MemberAccess): Implement the ITypeExpression
12595 (MemberAccess.DoResolve): Added support for a types-only lookup
12596 when we're called via ITypeExpression.DoResolveType().
12597 (ComposedCast): Implement the ITypeExpression interface.
12599 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
12600 Expression.Resolve() with ResolveFlags.Type instead.
12602 2002-08-12 Martin Baulig <martin@gnome.org>
12604 * interface.cs (Interface.Define): Apply attributes.
12606 * attribute.cs (Attribute.ApplyAttributes): Added support for
12607 interface attributes.
12609 2002-08-11 Martin Baulig <martin@gnome.org>
12611 * statement.cs (Block.Emit): Only check the "this" variable if we
12612 do not always throw an exception.
12614 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
12615 whether the property has a set accessor.
12617 2002-08-11 Martin Baulig <martin@gnome.org>
12619 Added control flow analysis support for structs.
12621 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
12622 with control flow analysis turned off.
12623 (IVariable): New interface.
12624 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
12625 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
12626 (FieldExpr.DoResolve): Resolve the instance expression with flow
12627 analysis turned off and do the definite assignment check after the
12628 resolving when we know what the expression will resolve to.
12630 * expression.cs (LocalVariableReference, ParameterReference):
12631 Implement the new IVariable interface, only call the flow analysis
12632 code if ec.DoFlowAnalysis is true.
12633 (This): Added constructor which takes a Block argument. Implement
12634 the new IVariable interface.
12635 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
12636 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
12637 This does the definite assignment checks for struct members.
12639 * class.cs (Constructor.Emit): If this is a non-static `struct'
12640 constructor which doesn't have any initializer, call
12641 Block.AddThisVariable() to tell the flow analysis code that all
12642 struct elements must be initialized before control returns from
12645 * statement.cs (MyStructInfo): New public class.
12646 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
12647 argument to this indexer. If non-zero, check an individual struct
12648 member, not the whole struct.
12649 (FlowBranching.CheckOutParameters): Check struct members.
12650 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
12651 overloaded versions of these methods which take an additional
12652 `int field_idx' argument to check struct members.
12653 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
12654 overloaded versions of these methods which take an additional
12655 `string field_name' argument to check struct member.s
12656 (VariableInfo): Implement the IVariable interface.
12657 (VariableInfo.StructInfo): New public property. Returns the
12658 MyStructInfo instance of the variable if it's a struct or null.
12659 (Block.AddThisVariable): New public method. This is called from
12660 Constructor.Emit() for non-static `struct' constructor which do
12661 not have any initializer. It creates a special variable for the
12662 "this" instance variable which will be checked by the flow
12663 analysis code to ensure that all of the struct's fields are
12664 initialized before control returns from the constructor.
12665 (UsageVector): Added support for struct members. If a
12666 variable/parameter is a struct with N members, we reserve a slot
12667 in the usage vector for each member. A struct is considered fully
12668 initialized if either the struct itself (slot 0) or all its
12669 members are initialized.
12671 2002-08-08 Martin Baulig <martin@gnome.org>
12673 * driver.cs (Driver.MainDriver): Only report an error CS5001
12674 if there were no compilation errors.
12676 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
12677 `UnsafeContext' property to determine whether the parent is in
12678 unsafe context rather than checking the parent's ModFlags:
12679 classes nested in an unsafe class are unsafe as well.
12681 2002-08-08 Martin Baulig <martin@gnome.org>
12683 * statement.cs (UsageVector.MergeChildren): Distinguish between
12684 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
12685 we return. Added test17() and test18() to test-154.cs.
12687 2002-08-08 Martin Baulig <martin@gnome.org>
12689 * typemanager.cs (TypeManager.FilterWithClosure): If we have
12690 Family access, make sure the invoking type isn't a subclass of the
12691 queried type (that'd be a CS1540).
12693 * ecore.cs (Expression.MemberLookup): Added overloaded version of
12694 this method which takes an additional `Type invocation_type'.
12696 * expression.cs (BaseAccess.DoResolve): Use the base type as
12697 invocation and query type.
12698 (MemberAccess.DoResolve): If the lookup failed and we're about to
12699 report a CS0122, try a lookup with the ec.ContainerType - if this
12700 succeeds, we must report a CS1540.
12702 2002-08-08 Martin Baulig <martin@gnome.org>
12704 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
12705 (MethodGroupExpr): Implement the IMemberExpr interface.
12707 * expression (MemberAccess.ResolveMemberAccess): No need to have
12708 any special code for MethodGroupExprs anymore, they're now
12711 2002-08-08 Martin Baulig <martin@gnome.org>
12713 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
12714 Family, FamANDAssem and FamORAssem permissions.
12715 (TypeManager.IsSubclassOrNestedChildOf): New public method.
12717 2002-08-08 Martin Baulig <martin@gnome.org>
12719 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
12720 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
12723 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
12725 * driver.cs: implemented /resource option to embed managed resources.
12727 2002-08-07 Martin Baulig <martin@gnome.org>
12729 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
12730 (FieldBase.HasFieldInitializer): New public property.
12731 (FieldBase.GetInitializerExpression): New public method. Resolves and
12732 returns the field initializer and makes sure it is only resolved once.
12733 (TypeContainer.EmitFieldInitializers): Call
12734 FieldBase.GetInitializerExpression to get the initializer, this ensures
12735 that it isn't resolved multiple times.
12737 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
12738 the resolving process (SimpleName/MemberLookup) that we're currently
12739 emitting a field initializer (which must not access any instance members,
12740 this is an error CS0236).
12742 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
12743 argument, if the `IsFieldInitializer' flag is set, we must report and
12744 error CS0236 and not an error CS0120.
12746 2002-08-07 Martin Baulig <martin@gnome.org>
12748 * ecore.cs (IMemberExpr): New public interface.
12749 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
12750 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
12751 if the expression is an IMemberExpr.
12753 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
12754 to be null, implicitly default to `this' if we're non-static in
12755 this case. Simplified the code a lot by using the new IMemberExpr
12756 interface. Also fixed bug #28176 here.
12758 2002-08-06 Martin Baulig <martin@gnome.org>
12760 * cs-parser.jay (SimpleLookup): Removed. We need to create
12761 ParameterReferences during semantic analysis so that we can do a
12762 type-only search when resolving Cast, TypeOf and SizeOf.
12763 (block): Pass the `current_local_parameters' to the Block's
12766 * class.cs (ConstructorInitializer): Added `Parameters parameters'
12767 argument to the constructor.
12768 (ConstructorInitializer.Resolve): Create a temporary implicit
12769 block with the parameters.
12771 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
12772 references here if we aren't doing a type-only search.
12774 * statement.cs (Block): Added constructor which takes a
12775 `Parameters parameters' argument.
12776 (Block.Parameters): New public property.
12778 * support.cs (InternalParameters.Parameters): Renamed `parameters'
12779 to `Parameters' and made it public readonly.
12781 2002-08-06 Martin Baulig <martin@gnome.org>
12783 * ecore.cs (Expression.Warning): Made this public as well.
12785 * report.cs (Report.Debug): Print the contents of collections.
12787 2002-08-06 Martin Baulig <martin@gnome.org>
12789 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
12790 used to tell Resolve() which kinds of expressions it may return.
12791 (Expression.Resolve): Added overloaded version of this method which
12792 takes a `ResolveFlags flags' argument. This can be used to tell
12793 Resolve() which kinds of expressions it may return. Reports a
12795 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
12796 ResolveFlags.SimpleName.
12797 (Expression.Error118): Added overloaded version of this method which
12798 takes a `ResolveFlags flags' argument. It uses the flags to determine
12799 which kinds of expressions are allowed.
12801 * expression.cs (Argument.ResolveMethodGroup): New public method.
12802 Resolves an argument, but allows a MethodGroup to be returned.
12803 This is used when invoking a delegate.
12805 * TODO: Updated a bit.
12807 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12809 Fixed compilation with csc.
12811 * ecore.cs: Expression.Error made public. Is this correct? Should
12812 Warning be made public too?
12814 * expression.cs: use ea.Location instead of ea.loc.
12815 [FIXME: Filed as bug #28607: MCS must report these errors.]
12817 2002-08-06 Martin Baulig <martin@gnome.org>
12819 * ecore.cs (Expression.loc): Moved the location here instead of
12820 duplicating it in all derived classes.
12821 (Expression.Location): New public property.
12822 (Expression.Error, Expression.Warning): Made them non-static and
12823 removed the location argument.
12824 (Expression.Warning): Added overloaded version which takes an
12825 `int level' argument.
12826 (Expression.Error118): Make this non-static and removed the
12827 expression and location arguments.
12828 (TypeExpr): Added location argument to the constructor.
12830 * expression.cs (StaticCallExpr): Added location argument to
12832 (Indirection, PointerArithmetic): Likewise.
12833 (CheckedExpr, UnCheckedExpr): Likewise.
12834 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
12835 (StringPtr): Likewise.
12838 2002-08-05 Martin Baulig <martin@gnome.org>
12840 * expression.cs (BaseAccess.DoResolve): Actually report errors.
12842 * assign.cs (Assign.DoResolve): Check whether the source
12843 expression is a value or variable.
12845 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
12846 while resolving the corresponding blocks.
12848 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
12849 an error, don't silently return null.
12851 * statement.cs (Block.AddVariable): Do the error reporting here
12852 and distinguish between CS0128 and CS0136.
12853 (Block.DoResolve): Report all unused labels (warning CS0164).
12854 (LabeledStatement): Pass the location to the constructor.
12855 (LabeledStatement.HasBeenReferenced): New property.
12856 (LabeledStatement.Resolve): Set it to true here.
12858 * statement.cs (Return.Emit): Return success even after reporting
12859 a type mismatch error (CS0126 or CS0127), this is what csc does and
12860 it avoids confusing the users with any consecutive errors.
12862 2002-08-05 Martin Baulig <martin@gnome.org>
12864 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
12866 * const.cs (Const.LookupConstantValue): Catch circular definitions.
12868 * expression.cs (MemberAccess.DoResolve): Silently return if an
12869 error has already been reported.
12871 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
12872 error has already been reported.
12874 2002-08-05 Martin Baulig <martin@gnome.org>
12876 * statement.cs (UsageVector): Only initialize the `parameters'
12877 vector if we actually have any "out" parameters.
12879 2002-08-05 Martin Baulig <martin@gnome.org>
12881 * expression.cs (Binary.ResolveOperator): When combining delegates,
12882 they must have the same type.
12884 2002-08-05 Martin Baulig <martin@gnome.org>
12886 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
12887 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
12888 work with the ms runtime and we also don't need it: if we're a
12889 PropertyBuilder and not in the `indexer_arguments' hash, then we
12890 are a property and not an indexer.
12892 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
12893 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
12894 since the latter one doesn't work with the ms runtime.
12896 2002-08-03 Martin Baulig <martin@gnome.org>
12898 Fixed bugs #27998 and #22735.
12900 * class.cs (Method.IsOperator): New public field.
12901 (Method.CheckBase): Report CS0111 if there's already a method
12902 with the same parameters in the current class. Report CS0508 when
12903 attempting to change the return type of an inherited method.
12904 (MethodData.Emit): Report CS0179 if a method doesn't have a body
12905 and it's not marked abstract or extern.
12906 (PropertyBase): New abstract base class for Property and Indexer.
12907 (PropertyBase.CheckBase): Moved here from Property and made it work
12909 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
12910 the same so we can reuse it there.
12911 (Property, Indexer): Derive from PropertyBase.
12912 (MethodSignature.inheritable_property_signature_filter): New delegate
12913 to find properties and indexers.
12915 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
12916 argument and improved error reporting.
12918 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
12919 EmptyReadOnlyParameters and made it a property.
12921 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
12922 version of this method which takes a `PropertyInfo indexer'.
12923 (TypeManager.RegisterIndexer): New method.
12925 * class.cs: Added myself as author of this file :-)
12927 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12929 * class.cs: fixed compilation on windoze.
12931 2002-08-03 Martin Baulig <martin@gnome.org>
12933 * interface.cs (Interface.GetInterfaceBases): Check whether all
12934 base interfaces are at least as accessible than the current one.
12936 * class.cs (TypeContainer.GetClassBases): Check whether base types
12937 are at least as accessible than the current type.
12938 (TypeContainer.AsAccessible): Implemented and made non-static.
12939 (MemberBase.CheckParameters): Report errors if the accessibility
12942 * delegate.cs (Delegate.Delegate): The default visibility is
12943 internal for top-level types and private for nested types.
12944 (Delegate.Define): Report errors if the accessibility checks fail.
12946 * enum.cs (Enum.Enum): The default visibility is internal for
12947 top-level types and private for nested types.
12948 (Enum.DefineType): Compute the correct visibility.
12950 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
12951 function which takes a `bool is_toplevel' instead of a TypeContainer.
12953 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
12956 2002-08-02 Martin Baulig <martin@gnome.org>
12958 * expression.cs (LocalVariableReferenc): Added constructor which
12959 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
12960 (LocalVariableReference.IsReadOnly): New property.
12961 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
12962 variable is readonly, use our own readonly flag to do this; you can
12963 use the new constructor to get a writable reference to a read-only
12966 * cs-parser.jay (foreach_statement, using_statement): Get a writable
12967 reference to the local variable.
12969 2002-08-01 Miguel de Icaza <miguel@ximian.com>
12971 * rootcontext.cs (ResolveCore): Also include System.Exception
12973 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
12974 we reach an EmptyStatement.
12976 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
12979 * expression.cs (Binary.ResolveOperator): Check error result in
12982 use brtrue/brfalse directly and avoid compares to null.
12984 2002-08-02 Martin Baulig <martin@gnome.org>
12986 * class.cs (TypeContainer.Define): Define all nested interfaces here.
12987 Fixes bug #28407, added test-155.cs.
12989 2002-08-01 Martin Baulig <martin@gnome.org>
12991 * class.cs (Event.EmitDefaultMethod): Make this work with static
12992 events. Fixes #28311, added verify-3.cs.
12994 2002-08-01 Martin Baulig <martin@gnome.org>
12996 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
12997 `is_disposable' fields.
12998 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
12999 `hm.is_disposable' if we're using the collection pattern.
13000 (Foreach.EmitCollectionForeach): Use the correct type for the
13001 enumerator's local variable, only emit the try/finally block if
13002 necessary (fixes #27713).
13004 2002-08-01 Martin Baulig <martin@gnome.org>
13006 * ecore.cs (Expression.report118): Renamed to Error118 and made
13009 * statement.cs (Throw.Resolve): Check whether the expression is of
13010 the correct type (CS0118) and whether the type derives from
13011 System.Exception (CS0155).
13012 (Catch.Resolve): New method. Do the type lookup here and check
13013 whether it derives from System.Exception (CS0155).
13014 (Catch.CatchType, Catch.IsGeneral): New public properties.
13016 * typemanager.cs (TypeManager.exception_type): Added.
13018 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13020 * driver.cs: Updated About function.
13022 2002-07-31 Martin Baulig <martin@gnome.org>
13024 Implemented Control Flow Analysis.
13026 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13027 (EmitContext.CurrentBranching): Added.
13028 (EmitContext.StartFlowBranching): Added.
13029 (EmitContext.EndFlowBranching): Added.
13030 (EmitContext.KillFlowBranching): Added.
13031 (EmitContext.IsVariableAssigned): Added.
13032 (EmitContext.SetVariableAssigned): Added.
13033 (EmitContext.IsParameterAssigned): Added.
13034 (EmitContext.SetParameterAssigned): Added.
13035 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
13036 Added control flow analysis stuff here.
13038 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
13039 resolve the expression as lvalue.
13040 (LocalVariableReference.DoResolve): Check whether the variable has
13041 already been assigned.
13042 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
13043 the parameter as assigned here.
13044 (ParameterReference.DoResolve): Check whether the parameter has already
13046 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
13047 expression as lvalue.
13049 * statement.cs (FlowBranching): New class for the flow analysis code.
13050 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
13051 (LabeledStatement.IsDefined): New public property.
13052 (LabeledStatement.AddUsageVector): New public method to tell flow
13053 analyis that the label may be reached via a forward jump.
13054 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
13056 (VariableInfo.Number): New public field. This is used by flow analysis
13057 to number all locals of a block.
13058 (Block.CountVariables): New public property. This is the number of
13059 local variables in this block (including the locals from all parent
13061 (Block.EmitMeta): Number all the variables.
13063 * statement.cs: Added flow analysis support to all classes.
13065 2002-07-31 Martin Baulig <martin@gnome.org>
13067 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
13068 To get debugging messages, compile mcs with /define:MCS_DEBUG and
13069 then use this argument.
13071 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
13073 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
13074 use this to specify /define options.
13076 2002-07-29 Martin Baulig <martin@gnome.org>
13078 * statement.cs (Fixed): Moved all code that does variable lookups
13079 and resolvings from Emit to Resolve.
13081 * statement.cs (For): Moved all code that does variable lookups
13082 and resolvings from Emit to Resolve.
13084 * statement.cs (Using): Moved all code that does variable lookups
13085 and resolvings from Emit to Resolve.
13087 2002-07-29 Martin Baulig <martin@gnome.org>
13089 * attribute.cs (Attribute.Resolve): Explicitly catch a
13090 System.NullReferenceException when creating the
13091 CustromAttributeBuilder and report a different warning message.
13093 2002-07-29 Martin Baulig <martin@gnome.org>
13095 * support.cs (ParameterData.ParameterName): Added method to
13096 get the name of a parameter.
13098 * typemanager.cs (TypeManager.IsValueType): New public method.
13100 2002-07-29 Martin Baulig <martin@gnome.org>
13102 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
13103 is a flag which specifies that it's either ref or out.
13104 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
13105 the out parameter to `out Parameter.Modifier mod', also set the
13106 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
13108 * support.cs (InternalParameters.ParameterModifier): Distinguish
13109 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13110 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13112 * expression.cs (Argument.GetParameterModifier): Distinguish
13113 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13114 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13116 2002-07-29 Martin Baulig <martin@gnome.org>
13118 * expression.cs (ParameterReference.ParameterReference): Added
13119 `Location loc' argument to the constructor.
13121 * cs-parser.jay: Pass location to ParameterReference.
13123 2002-07-28 Miguel de Icaza <miguel@ximian.com>
13125 * statement.cs (Try): Initialize the location.
13127 * cs-parser.jay: pass location to Try.
13129 * expression.cs (Unary.Reduce): Change the prototype to return
13130 whether a constant fold could be performed or not. The result is
13131 returned in an out parameters. In the case of Indirection and
13132 AddressOf, we want to perform the full tests.
13134 2002-07-26 Miguel de Icaza <miguel@ximian.com>
13136 * statement.cs (Statement.Emit): Flag dead code.
13138 2002-07-27 Andrew Birkett <andy@nobugs.org>
13140 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13142 2002-07-27 Martin Baulig <martin@gnome.org>
13144 * class.cs (MethodData.Define): Put back call to
13145 TypeManager.AddMethod(), accidentally commented this out.
13147 * report.cs (Debug): New public method to print debugging information,
13148 this is `[Conditional ("DEBUG")]'.
13150 2002-07-26 Martin Baulig <martin@gnome.org>
13152 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13153 (switch_statement): Push the current_block to the switch_stack and
13154 pop it again when we're done with the switch.
13155 (switch_section): The new block is a child of the current_block.
13156 Fixes bug #24007, added test-152.cs.
13158 2002-07-27 Martin Baulig <martin@gnome.org>
13160 * expression.cs (Invocation.EmitArguments): When calling a varargs
13161 function with only its fixed arguments, we need to pass an empty
13164 2002-07-27 Martin Baulig <martin@gnome.org>
13166 Mono 0.13 has been released.
13168 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13170 * driver.cs: Rename --resource to --linkres, because that is what
13171 we do currently, we dont support --resource yet.
13173 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13175 2002-07-25 Martin Baulig <martin@gnome.org>
13177 * class.cs (MethodData): New public class. This is a `method builder'
13178 class for a method or one accessor of a Property/Indexer/Event.
13179 (MethodData.GetMethodFlags): Moved here from MemberBase.
13180 (MethodData.ApplyAttributes): Likewise.
13181 (MethodData.ApplyObsoleteAttribute): Likewise.
13182 (MethodData.ApplyConditionalAttribute): Likewise.
13183 (MethodData.ApplyDllImportAttribute): Likewise.
13184 (MethodData.CheckAbstractAndExternal): Likewise.
13185 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13186 (MethodData.Emit): Formerly known as Method.Emit().
13187 (MemberBase): Moved everything which was specific to a single
13188 accessor/method to MethodData.
13189 (Method): Create a new MethodData and call Define() and Emit() on it.
13190 (Property, Indexer, Event): Create a new MethodData objects for each
13191 accessor and call Define() and Emit() on them.
13193 2002-07-25 Martin Baulig <martin@gnome.org>
13195 Made MethodCore derive from MemberBase to reuse the code from there.
13196 MemberBase now also checks for attributes.
13198 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
13199 (MemberBase.GetMethodFlags): Moved here from class Method and marked
13201 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
13202 `CallingConventions cc' and `Attributes opt_attrs' arguments.
13203 (MemberBase.ApplyAttributes): New virtual method; applies the
13204 attributes to a method or accessor.
13205 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
13206 (MemberBase.ApplyConditionalAttribute): Likewise.
13207 (MemberBase.ApplyDllImportAttribute): Likewise.
13208 (MemberBase.CheckAbstractAndExternal): Likewise.
13209 (MethodCore.ParameterTypes): This is now a property instead of a
13210 method, it's initialized from DoDefineParameters().
13211 (MethodCore.ParameterInfo): Removed the set accessor.
13212 (MethodCore.DoDefineParameters): New protected virtual method to
13213 initialize ParameterTypes and ParameterInfo.
13214 (Method.GetReturnType): We can now simply return the MemberType.
13215 (Method.GetMethodFlags): Override the MemberBase version and add
13216 the conditional flags.
13217 (Method.CheckBase): Moved some code from Define() here, call
13218 DoDefineParameters() here.
13219 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
13220 here to avoid some larger code duplication.
13221 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
13222 ensure that abstract and external accessors don't declare a body.
13224 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
13225 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
13226 lookup in the attribute's parent classes, so we need to abort as soon
13227 as we found the first match.
13228 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
13229 the attribute has no arguments.
13231 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
13234 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13236 * cs-parser.jay: reverted previous patch.
13238 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13240 * cs-parser.jay: fixed bug #22119.
13242 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13244 * attribute.cs: fixed compilation. The error was:
13245 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
13246 be assigned to before control leaves the current method."
13247 [FIXME: Filed as bug #28186: MCS must report this error.]
13249 2002-07-25 Martin Baulig <martin@gnome.org>
13251 * attribute.cs (Attribute.Conditional_GetConditionName): New static
13252 method to pull the condition name ouf of a Conditional attribute.
13253 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
13254 the obsolete message and error flag out of an Obsolete attribute.
13256 * class.cs (Method.GetMethodFlags): New public method to get the
13257 TypeManager.MethodFlags for this method.
13258 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
13260 (Method.Define): Get and apply the Obsolete and Conditional attributes;
13261 if we're overriding a virtual function, set the new private variable
13262 `parent_method'; call the new TypeManager.AddMethod().
13264 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
13265 the MethodBuilder and the Method in a PtrHashtable.
13266 (TypeManager.builder_to_method): Added for this purpose.
13267 (TypeManager.MethodFlags): Added IsObsoleteError.
13268 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
13269 Obsolete and Conditional arguments in MethodBuilders. If we discover
13270 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
13271 the message from the attribute.
13273 2002-07-24 Martin Baulig <martin@gnome.org>
13275 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
13276 preprocessor directives, ensure that the argument to #define/#undef is
13277 exactly one identifier and that it's actually an identifier.
13279 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
13282 2002-07-24 Martin Baulig <martin@gnome.org>
13284 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
13285 initialize it to TypeManager.object_type in the constructor.
13286 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
13287 of the `hm.get_current' method if we're using the collection pattern.
13288 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
13289 for the explicit conversion to make it work when we're using the collection
13290 pattern and the `Current' property has a different return type than `object'.
13293 2002-07-24 Martin Baulig <martin@gnome.org>
13295 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
13296 does not match, but don't report any errors. This method is called in
13297 order for all methods in a MethodGroupExpr until a matching method is
13298 found, so we don't want to bail out if the first method doesn't match.
13299 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
13300 matches, report the 123. Fixes #28070.
13302 2002-07-24 Martin Baulig <martin@gnome.org>
13304 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
13305 TypeManager.TypeToCoreType() to the top of the method so the
13306 following equality checks will work. Fixes #28107.
13308 2002-07-24 Martin Baulig <martin@gnome.org>
13310 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
13311 operand is of type uint, and the other operand is of type sbyte,
13312 short or int, the operands are converted to type long." -
13313 Actually do what this comment already told us. Fixes bug #28106,
13316 2002-07-24 Martin Baulig <martin@gnome.org>
13318 * class.cs (MethodBase): New abstract class. This is now a base
13319 class for Property, Indexer and Event to avoid some code duplication
13320 in their Define() and DefineMethods() methods.
13321 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
13322 generic methods for Define() and DefineMethods().
13323 (FieldBase): Derive from MemberBase, not MemberCore.
13324 (Property): Derive from MemberBase, not MemberCore.
13325 (Property.DefineMethod): Moved all the code from this method to the
13326 new MethodBase.DefineAccessor(), just call it with appropriate
13328 (Property.Define): Call the new Property.DoDefine(), this does some
13329 sanity checks and we don't need to duplicate the code everywhere.
13330 (Event): Derive from MemberBase, not MemberCore.
13331 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
13332 accessors, this will also make them work with interface events.
13333 (Indexer): Derive from MemberBase, not MemberCore.
13334 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
13335 (Indexer.Define): Use the new MethodBase functions.
13337 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
13338 argument to the constructor.
13339 (Interface.FindMembers): Added support for interface events.
13340 (Interface.PopluateEvent): Implemented.
13342 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
13344 2002-07-22 Miguel de Icaza <miguel@ximian.com>
13346 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
13347 but this is required to check for a method name being the same as
13348 the containing class.
13352 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13354 * interface.cs: initialize variable.
13356 2002-07-23 Martin Baulig <martin@gnome.org>
13358 Implemented the IndexerName attribute in interfaces.
13360 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
13361 name if this is an explicit interface implementation.
13362 (Indexer.InterfaceIndexerName): New public variable. If we're
13363 implementing an interface indexer, this is the IndexerName in that
13364 interface. Otherwise, it's the IndexerName.
13365 (Indexer.DefineMethod): If we're implementing interface indexer,
13366 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
13367 and Pending.ImplementIndexer methods.
13368 (Indexer.Define): Also define the PropertyBuilder if we're
13369 implementing an interface indexer and this is neither an explicit
13370 interface implementation nor do the IndexerName match the one in
13373 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
13374 If a method is defined here, then we always need to create a proxy
13375 for it. This is used when implementing interface indexers.
13376 (Pending.IsInterfaceIndexer): New public method.
13377 (Pending.ImplementIndexer): New public method.
13378 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
13379 This is used when implementing interface indexers to define a proxy
13381 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
13382 define a proxy if necessary.
13384 * interface.cs (Interface.IndexerName): New public variable.
13385 (Interface.PopulateIndexer): Set the IndexerName.
13386 (Interface.DefineIndexers): New private method. Populate all the
13387 indexers and make sure their IndexerNames match.
13389 * typemanager.cs (IndexerPropertyName): Added support for interface
13392 2002-07-22 Martin Baulig <martin@gnome.org>
13394 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
13395 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
13396 ret if HasReturnLabel.
13397 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
13400 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
13401 and set the ec.LoopBeginTryCatchLevel.
13402 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
13403 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
13404 the current ec.TryCatchLevel, the branch goes out of an exception
13405 block. In this case, we need to use Leave and not Br.
13407 2002-07-22 Martin Baulig <martin@gnome.org>
13409 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
13410 block unless the block does not always return or it is contained in
13411 another try { ... } catch { ... } block. Fixes bug #26506.
13412 Added verify-1.cs to the test suite.
13414 2002-07-22 Martin Baulig <martin@gnome.org>
13416 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
13417 then we do not always return. Fixes bug #24985.
13419 2002-07-22 Martin Baulig <martin@gnome.org>
13421 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
13422 lookup on a per-class level; ie. walk up the class hierarchy until we
13423 found at least one applicable method, then choose the best among them.
13424 Fixes bug #24463 and test-29.cs.
13426 2002-07-22 Martin Baulig <martin@gnome.org>
13428 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
13429 return types of the methods. The return type is not part of the
13430 signature and we must not check it to make the `new' modifier work.
13431 Fixes bug #27999, also added test-147.cs.
13432 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
13434 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
13435 on the method's return type.
13437 2002-07-21 Martin Baulig <martin@gnome.org>
13439 * assign.cs: Make this work if the rightmost source is a constant and
13440 we need to do an implicit type conversion. Also adding a few more tests
13441 to test-38.cs which should have caught this.
13443 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
13444 target in the makefile for this. The makefile.gnu is primarily intended
13445 for end-users who don't want to debug the compiler.
13447 2002-07-21 Martin Baulig <martin@gnome.org>
13449 * assign.cs: Improved the Assign class so it can now handle embedded
13450 assignments (X = Y = Z = something). As a side-effect this'll now also
13451 consume less local variables. test-38.cs now passes with MCS, added
13452 a few new test cases to that test.
13454 2002-07-20 Martin Baulig <martin@gnome.org>
13456 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
13457 instructions. Fixes bug #27977, also added test-146.cs.
13459 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13461 * cs-tokenizer.cs: fixed getHex ().
13463 2002-07-19 Martin Baulig <martin@gnome.org>
13465 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
13466 not Type.GetType() to lookup the array type. This is needed when
13467 we're constructing an array of a user-defined type.
13468 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
13469 single-dimensional arrays, but also for single-dimensial arrays of
13472 2002-07-19 Martin Baulig <martin@gnome.org>
13474 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
13475 this function is called, it's not allowed to share LocalBuilders
13476 among ILGenerators.
13478 2002-07-19 Martin Baulig <martin@gnome.org>
13480 * expression.cs (Argument.Resolve): Report an error 118 when trying
13481 to pass a type as argument.
13483 2002-07-18 Martin Baulig <martin@gnome.org>
13485 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
13486 Conv_R_Un for the signed `long' type.
13488 2002-07-15 Miguel de Icaza <miguel@ximian.com>
13490 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
13491 `expr' for the temporary result, as that will fail if we do
13492 multiple resolves on the same expression.
13494 2002-07-05 Miguel de Icaza <miguel@ximian.com>
13496 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
13497 ec.TypeContainer for looking up aliases.
13499 * class.cs (TypeContainer): Remove LookupAlias from here.
13501 * decl.cs (DeclSpace); Move here.
13503 2002-07-01 Miguel de Icaza <miguel@ximian.com>
13505 * class.cs (FindMembers): Only call filter if the constructor
13506 bulider is not null.
13508 Also handle delegates in `NestedTypes' now. Now we will perform
13509 type lookups using the standard resolution process. This also
13512 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
13513 This uses Expressions (the limited kind that can be parsed by the
13514 tree) instead of strings.
13516 * expression.cs (ComposedCast.ToString): Implement, used to flag
13517 errors since now we have to render expressions.
13519 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
13522 * ecore.cs (SimpleName.ToString): ditto.
13524 * cs-parser.jay: Instead of using strings to assemble types, use
13525 Expressions to assemble the type (using SimpleName, ComposedCast,
13526 MemberAccess). This should fix the type lookups in declarations,
13527 because we were using a different code path for this.
13529 * statement.cs (Block.Resolve): Continue processing statements
13530 even when there is an error.
13532 2002-07-17 Miguel de Icaza <miguel@ximian.com>
13534 * class.cs (Event.Define): Also remove the `remove' method from
13535 the list of pending items.
13537 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
13538 generate more compact code.
13540 2002-07-17 Martin Baulig <martin@gnome.org>
13542 * const.cs (Const.LookupConstantValue): Add support for constant
13543 `unchecked' and `checked' expressions.
13544 Also adding test case test-140.cs for this.
13546 2002-07-17 Martin Baulig <martin@gnome.org>
13548 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
13549 check whether mi.ReturnType implements the IEnumerator interface; the
13550 `==' and the IsAssignableFrom() will fail in this situation.
13552 2002-07-16 Ravi Pratap <ravi@ximian.com>
13554 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
13557 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13559 * expression.cs: fixed bug #27811.
13561 2002-07-14 Miguel de Icaza <miguel@ximian.com>
13563 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
13564 Molaro: when we are a ref, the value already contains a pointer
13565 value, do not take the address of it.
13567 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
13568 * removed mb-parser.jay and mb-tokenizer.cs
13570 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13572 * expression.cs: check against the building corlib void type.
13574 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
13576 * ecore.cs: fix for valuetype static readonly fields: when
13577 initializing them, we need their address, not the address of a copy.
13579 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
13581 * typemanager.cs: register also enum_type in corlib.
13583 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
13585 * class.cs: allow calling this (but not base) initializers in structs.
13587 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
13589 * ecore.cs: make sure we compare against the building base types
13592 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
13594 * typemanager.cs: fix TypeToCoreType() to handle void and object
13595 (corlib gets no more typerefs after this change).
13597 2002-07-12 Miguel de Icaza <miguel@ximian.com>
13599 * expression.cs (ArrayCreation.EmitArrayArguments): use
13600 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
13602 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
13603 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
13604 array indexes, the runtime actually forbids them.
13606 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
13607 for array arguments here.
13609 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
13610 instead of the default for ValueTypes.
13612 (New.DoEmit): Use IsValueType instead of
13613 IsSubclassOf (value_type)
13614 (New.DoResolve): ditto.
13615 (Invocation.EmitCall): ditto.
13617 * assign.cs (Assign): ditto.
13619 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
13620 Statements *are* currently doing part of their resolution during
13623 Expressions do always resolve during resolve, but statements are
13624 only required to propagate resolution to their children.
13626 2002-07-11 Miguel de Icaza <miguel@ximian.com>
13628 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
13630 (LoadAssembly): Do not add the dll if it is already specified
13632 (MainDriver): Add the System directory to the link path at the end,
13633 after all the other -L arguments.
13635 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
13636 wrong opcode for loading bytes and bools (ldelem.i1 instead of
13637 ldelem.u1) and using the opposite for sbytes.
13639 This fixes Digger, and we can finally run it.
13641 * driver.cs (UnixParseOption): Move the option parsing here.
13642 (CSCParseOption): Implement CSC-like parsing of options.
13644 We now support both modes of operation, the old Unix way, and the
13645 new CSC-like way. This should help those who wanted to make cross
13646 platform makefiles.
13648 The only thing broken is that /r:, /reference: and /lib: are not
13649 implemented, because I want to make those have the same semantics
13650 as the CSC compiler has, and kill once and for all the confussion
13651 around this. Will be doing this tomorrow.
13653 * statement.cs (Unsafe.Resolve): The state is checked during
13654 resolve, not emit, so we have to set the flags for IsUnsfe here.
13656 2002-07-10 Miguel de Icaza <miguel@ximian.com>
13658 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
13659 not catch the Error_ObjectRefRequired in SimpleName (as it is
13660 possible to have a class/instance variable name that later gets
13661 deambiguated), we have to check this here.
13663 2002-07-10 Ravi Pratap <ravi@ximian.com>
13665 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
13666 make static and put into Expression.
13668 (Event.Define): Register the private field of the event with the
13669 TypeManager so that GetFieldFromEvent can get at it.
13671 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
13672 keep track of the private field associated with an event which
13675 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
13678 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
13680 2002-07-10 Miguel de Icaza <miguel@ximian.com>
13682 * expression.cs (Binary.EmitBranchable): this routine emits the
13683 Binary expression in a branchable context. This basically means:
13684 we need to branch somewhere, not just get the value on the stack.
13686 This works together with Statement.EmitBoolExpression.
13688 * statement.cs (Statement.EmitBoolExpression): Use
13691 2002-07-09 Miguel de Icaza <miguel@ximian.com>
13693 * statement.cs (For): Reduce the number of jumps in loops.
13695 (For): Implement loop inversion for the For statement.
13697 (Break): We can be breaking out of a Try/Catch controlled section
13698 (foreach might have an implicit try/catch clause), so we need to
13699 use Leave instead of Br.
13701 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
13702 now). If the instace expression supports IMemoryLocation, we use
13703 the AddressOf method from the IMemoryLocation to extract the
13704 address instead of emitting the instance.
13706 This showed up with `This', as we were emitting the instance
13707 always (Emit) instead of the Address of This. Particularly
13708 interesting when This is a value type, as we dont want the Emit
13709 effect (which was to load the object).
13711 2002-07-08 Miguel de Icaza <miguel@ximian.com>
13713 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
13715 * statement.cs (Checked): Set the CheckedState during the resolve
13716 process too, as the ConvCast operations track the checked state on
13717 the resolve process, and not emit.
13719 * cs-parser.jay (namespace_member_declaration): Flag that we have
13720 found a declaration when we do. This is used to flag error 1529
13722 * driver.cs: Report ok when we display the help only.
13724 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
13726 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
13728 2002-07-04 Miguel de Icaza <miguel@ximian.com>
13730 * cs-tokenizer.cs (define): We also have to track locally the
13731 defines. AllDefines is just used for the Conditional Attribute,
13732 but we also need the local defines for the current source code.
13734 2002-07-03 Miguel de Icaza <miguel@ximian.com>
13736 * statement.cs (While, For, Do): These loops can exit through a
13737 Break statement, use this information to tell whether the
13738 statement is the last piece of code.
13740 (Break): Flag that we break.
13742 * codegen.cs (EmitContexts): New `Breaks' state variable.
13744 2002-07-03 Martin Baulig <martin@gnome.org>
13746 * class.cs (TypeContainer.MethodModifiersValid): Allow override
13747 modifiers in method declarations in structs. Otherwise, you won't
13748 be able to override things like Object.Equals().
13750 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13752 * class.cs (Method, Property, Indexer): Do not allow the public
13753 modifier to be used in explicit interface implementations.
13755 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
13756 override modifiers in method declarations in structs
13758 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
13760 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
13761 integer or real overflow, report an error
13763 2002-07-02 Martin Baulig <martin@gnome.org>
13765 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
13766 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
13767 to tell the runtime about our newly created System.Object and
13768 System.ValueType types.
13770 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13772 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
13773 struct instead of Ldarg/Starg.
13775 2002-07-02 Martin Baulig <martin@gnome.org>
13777 * expression.cs (Indirection.Indirection): Call
13778 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
13780 2002-07-02 Martin Baulig <martin@gnome.org>
13782 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
13783 ValueType, call TypeManager.TypeToCoreType() on it.
13784 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
13785 the OpCodes.Newarr argument.
13787 2002-07-02 Martin Baulig <martin@gnome.org>
13789 * expression.cs (Invocation.EmitCall): When compiling corlib,
13790 replace all calls to the system's System.Array type to calls to
13791 the newly created one.
13793 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
13794 System.Array methods.
13795 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
13796 from the system's System.Array type which must be replaced.
13798 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
13800 * typemanager.cs: load unverifiable_code_ctor so we can build
13801 corlib using the correct type. Avoid using GetTypeCode() with
13803 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
13804 TypeManager.object_type to allow building corlib.
13806 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
13808 * ecore.cs: handle System.Enum separately in LoadFromPtr().
13810 2002-07-01 Martin Baulig <martin@gnome.org>
13812 * class.cs: Make the last change actually work, we need to check
13813 whether `ifaces != null' to avoid a crash.
13815 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13817 * class.cs: when we build structs without fields that implement
13818 interfaces, we need to add the interfaces separately, since there is
13819 no API to both set the size and add the interfaces at type creation
13822 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
13824 * expression.cs: the dimension arguments to the array constructors
13825 need to be converted if they are a long.
13827 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
13829 * class.cs: don't emit ldarg.0 if there is no parent constructor
13830 (fixes showstopper for corlib).
13832 2002-06-29 Martin Baulig <martin@gnome.org>
13834 MCS now compiles corlib on GNU/Linux :-)
13836 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
13837 ie. check for MethodImplOptions.InternalCall.
13839 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
13840 and TypeManager.attribute_type are null, so we must explicitly check
13841 whether parent is not null to find out whether it's an attribute type.
13842 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
13843 and SetBuilder, not only if the property is neither abstract nor external.
13844 This is necessary to set the MethodImplOptions on the accessor methods.
13845 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
13846 SetBuilder, see Property.Emit().
13848 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
13849 populate "System.Object", "System.ValueType" and "System.Attribute" since
13850 they've already been populated from BootCorlib_PopulateCoreTypes().
13852 2002-06-29 Martin Baulig <martin@gnome.org>
13854 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
13855 is the NullLiteral, we also need to make sure that target_type is not
13858 2002-06-29 Martin Baulig <martin@gnome.org>
13860 * rootcontext.cs (RootContext.ResolveCore): We must initialize
13861 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
13862 before calling BootstrapCorlib_ResolveDelegate ().
13864 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13866 * statement.cs: fixed build-breaker. All tests passed ok.
13868 2002-06-27 Martin Baulig <martin@gnome.org>
13870 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
13871 for System.Decimal when compiling corlib.
13873 2002-06-27 Martin Baulig <martin@gnome.org>
13875 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
13876 switch blocks which contain nothing but a default clause.
13878 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
13880 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
13882 2002-06-27 Martin Baulig <martin@gnome.org>
13884 * ecore.cs (PropertyExpr.PropertyExpr): Call
13885 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
13887 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
13888 is already a TypeBuilder.
13890 2002-06-27 Martin Baulig <martin@gnome.org>
13892 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
13893 `target_type == TypeManager.array_type', not IsAssignableFrom() in
13894 the "from an array-type to System.Array" case. This makes it work
13895 when compiling corlib.
13897 2002-06-27 Martin Baulig <martin@gnome.org>
13899 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
13900 non-static PropertyExpr, set its InstanceExpression. This makes
13901 the `ICollection.Count' property work in System/Array.cs.
13903 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
13905 * driver.cs: Made error handling more consistent. Errors now
13906 tracked by Report class, so many methods which used to return int
13907 now return void. Main() now prints success/failure and
13908 errors/warnings message.
13910 Renamed '--probe' compiler argument to '--expect-error'. Removed
13911 the magic number return values (123 and 124). Now, if the
13912 expected error occurs, the compiler exits with success (exit value
13913 0). If the compilation completes without seeing that particular
13914 error, the compiler exits with failure (exit value 1). The
13915 makefile in mcs/errors has been changed to handle the new behaviour.
13917 * report.cs: Made 'expected error' number a property and renamed
13918 it from 'Probe' to 'ExpectedError'.
13920 * genericparser.cs: Removed error handling support, since it is
13921 now all done by Report class.
13923 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
13924 class, so parse() no longer returns an int.
13926 * namespace.cs: Use Report.Error instead of GenericParser.error
13928 2002-06-22 Miguel de Icaza <miguel@ximian.com>
13930 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
13931 TypeContainer.AddOperator): At the front of the list put the
13932 explicit implementations, so they get resolved/defined first.
13934 2002-06-21 Miguel de Icaza <miguel@ximian.com>
13936 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
13937 interface type is implemented by this TypeContainer. Used during
13938 explicit interface implementation.
13940 (Property.Define, Indexer.Define, Method.Define): Validate that
13941 the given interface in the explicit implementation is one of the
13942 base classes for the containing type.
13944 Also if we are explicitly implementing an interface, but there is
13945 no match in the pending implementation table, report an error.
13947 (Property.Define): Only define the property if we are
13948 not explicitly implementing a property from an interface. Use the
13949 correct name also for those properties (the same CSC uses,
13950 although that is really not needed).
13952 (Property.Emit): Do not emit attributes for explicitly implemented
13953 properties, as there is no TypeBuilder.
13955 (Indexer.Emit): ditto.
13957 Hiding then means that we do not really *implement* a pending
13958 implementation, which makes code fail.
13960 2002-06-22 Martin Baulig <martin@gnome.org>
13962 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
13963 the return value of Object.GetType(). [FIXME: we need to do this whenever
13964 we get a type back from the reflection library].
13966 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
13968 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
13970 2002-06-20 Miguel de Icaza <miguel@ximian.com>
13972 * attribute.cs: Return null if we can not look up the type.
13974 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
13975 the interface types found.
13977 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
13978 interface types found.
13980 * typemanager.cs (GetInterfaces): Make this routine returns alll
13981 the interfaces and work around the lame differences between
13982 System.Type and System.Reflection.Emit.TypeBuilder in the results
13983 result for GetInterfaces.
13985 (ExpandInterfaces): Given an array of interface types, expand and
13986 eliminate repeated ocurrences of an interface. This expands in
13987 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
13990 2002-06-21 Martin Baulig <martin@gnome.org>
13992 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
13995 2002-06-21 Martin Baulig <martin@gnome.org>
13997 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
13998 and called with one of the core types, return the corresponding typebuilder for
14001 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14004 2002-06-21 Martin Baulig <martin@gnome.org>
14006 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14007 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14008 (Expression.ConvertReferenceExplicit): Likewise.
14010 * expression.cs (ElementAccess.DoResolve): Likewise.
14011 (ElementAccess.DoResolveLValue): Likewise.
14013 2002-06-10 Martin Baulig <martin@gnome.org>
14015 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14016 add the "value" parameter to the parameter list.
14018 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14021 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14023 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14024 the argument to an int, uint, long or ulong, per the spec. Also
14025 catch negative constants in array creation.
14027 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14029 * class.cs: do not allow the same interface to appear twice in
14030 the definition list.
14032 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
14034 * ecore.cs: don't use ldlen with System.Array.
14036 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
14038 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
14040 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
14042 * modifiers.cs: produce correct field attributes for protected
14043 internal. Easy fix so miguel can work on ther harder stuff:-)
14045 2002-06-18 Miguel de Icaza <miguel@ximian.com>
14047 * pending.cs: New file. Move the code from class.cs here.
14048 Support clearning the pending flag for all methods (when not doing
14049 explicit interface implementation).
14051 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
14053 * rootcontext.cs: added a couple more types needed to bootstrap.
14055 2002-06-17 Miguel de Icaza <miguel@ximian.com>
14057 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
14058 constructor in the type, instead of any constructor in the type
14059 hierarchy. Thanks to Paolo for finding this bug (it showed up as
14060 a bug in the Mono runtime when applying the params attribute).
14062 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14063 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
14065 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
14067 * expression.cs (Unary.ResolveOperator): Use TypeManager
14068 to resolve the type.
14070 2002-06-13 Ravi Pratap <ravi@ximian.com>
14072 * cs-parser.jay (enum_member_declaration): Pass in the attributes
14075 * enum.cs (AddEnumMember): Add support to store the attributes associated
14076 with each member too.
14078 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
14079 field builders too - this takes care of the enum member case.
14081 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
14083 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
14084 address-of operator on both value types and pointers.
14086 2002-06-10 Martin Baulig <martin@gnome.org>
14088 * interface.cs (Interface.PopulateIndexer): Add the indexer's
14089 PropertyBuilder to the `property_builders' list.
14091 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
14092 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
14093 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
14094 find any indexers which are inherited from an interface.
14096 2002-06-09 Martin Baulig <martin@gnome.org>
14098 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
14099 the same type as the constant if necessary. There's also a test-130.cs
14102 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
14104 * typemanager.cs (TypeManager.ChangeType): Previously known as
14105 Enum.ChangeEnumType().
14107 2002-06-09 Martin Baulig <martin@gnome.org>
14109 * expression.cs (Cast.TryReduce): Added support for consts.
14111 2002-06-08 Ravi Pratap <ravi@ximian.com>
14113 * class.cs (Accessor): Hold attributes information so we can pass
14116 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
14117 Modify to pass in attributes attached to the methods.
14119 (add_accessor_declaration, remove_accessor_declaration): Ditto.
14121 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
14122 to handle the Accessor kind :-)
14124 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
14126 2002-06-08 Martin Baulig <martin@gnome.org>
14128 * expression.cs (Unary.TryReduceNegative): Added support for
14131 2002-06-08 Martin Baulig <martin@gnome.org>
14133 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
14134 name can't be found in the `defined_names' - the caller will do a
14135 MemberLookup in this case and thus find methods in System.Enum
14136 such as Enum.IsDefined().
14138 2002-06-08 Martin Baulig <martin@gnome.org>
14140 * enum.cs (Enum.ChangeEnumType): This is a custom version of
14141 Convert.ChangeType() which works with TypeBuilder created types.
14142 (Enum.LookupEnumValue, Enum.Define): Use it here.
14144 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14145 `TypeBuilder.BaseType != null' check.
14146 (TypeContainer.FindMembers): Only lookup parent members if we
14147 actually have a parent.
14148 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14149 (ConstructorInitializer.Resolve): Likewise.
14151 * interface.cs (Interface.FindMembers): Added
14152 `TypeBuilder.BaseType != null' check.
14154 * rootcontext.cs (RootContext.ResolveCore): Added
14155 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14156 classes_second_stage.
14158 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14159 debug_type and trace_type when compiling with --nostdlib.
14161 2002-06-07 Martin Baulig <martin@gnome.org>
14163 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14164 (AddField): Set it to true when adding a non-static field.
14165 (DefineType): Use `have_nonstatic_fields' to find out whether we
14166 have non-static fields, not `Fields != null'.
14168 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14170 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14171 dereferencing a null on the static-field code path)
14173 2002-05-30 Martin Baulig <martin@gnome.org>
14175 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14176 to take command line arguments. Use reflection to call the new
14177 custom `Initialize' function on the symbol writer and pass it the
14178 command line arguments.
14180 * driver.cs (--debug-args): New command line argument to pass command
14181 line arguments to the symbol writer.
14183 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14185 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14186 the target type for indexers and properties. Thanks to Joe for
14189 2002-05-27 Miguel de Icaza <miguel@ximian.com>
14191 * typemanager.cs (MethodFlags): returns the method flags
14192 (Obsolete/ShouldIgnore) that control warning emission and whether
14193 the invocation should be made, or ignored.
14195 * expression.cs (Invocation.Emit): Remove previous hack, we should
14196 not do this on matching a base type, we should do this based on an attribute
14198 Only emit calls to System.Diagnostics.Debug and
14199 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
14200 on the command line.
14202 * rootcontext.cs: Global settings for tracing and debugging.
14204 * cs-tokenizer.cs (define): New utility function to track
14205 defines. Set the global settings for TRACE and DEBUG if found.
14207 2002-05-25 Ravi Pratap <ravi@ximian.com>
14209 * interface.cs (Populate*): Pass in the TypeContainer as well as
14210 the DeclSpace as parameters so that we can create EmitContexts and
14211 then use that to apply attributes etc.
14213 (PopulateMethod, PopulateEvent, PopulateProperty)
14214 (PopulateIndexer): Apply attributes everywhere.
14216 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
14219 (ApplyAttributes): Update accordingly.
14221 We now apply interface attributes for all members too.
14223 2002-05-26 Miguel de Icaza <miguel@ximian.com>
14225 * class.cs (Indexer.Define); Correctly check if we are explicit
14226 implementation (instead of checking the Name for a ".", we
14227 directly look up if the InterfaceType was specified).
14229 Delay the creation of the PropertyBuilder.
14231 Only create the PropertyBuilder if we are not an explicit
14232 interface implementation. This means that explicit interface
14233 implementation members do not participate in regular function
14234 lookups, and hence fixes another major ambiguity problem in
14235 overload resolution (that was the visible effect).
14237 (DefineMethod): Return whether we are doing an interface
14240 * typemanager.cs: Temporary hack until we get attributes in
14241 interfaces (Ravi is working on that) and we get IndexerName
14242 support in interfaces.
14244 * interface.cs: Register the indexers as properties.
14246 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
14247 warning, I have verified that this is a bug in the .NET runtime
14248 (JavaScript suffers of the same problem).
14250 * typemanager.cs (MemberLookup): When looking up members for
14251 interfaces, the parent of an interface is the implicit
14252 System.Object (so we succeed in searches of Object methods in an
14253 interface method invocation. Example: IEnumerable x; x.ToString
14256 2002-05-25 Miguel de Icaza <miguel@ximian.com>
14258 * class.cs (Event): Events should also register if they do
14259 implement the methods that an interface requires.
14261 * typemanager.cs (MemberLookup); use the new GetInterfaces
14264 (GetInterfaces): The code used to lookup interfaces for a type is
14265 used in more than one place, factor it here.
14267 * driver.cs: Track the errors at the bottom of the file, we kept
14270 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
14271 instance if the method we are calling is static!
14273 2002-05-24 Miguel de Icaza <miguel@ximian.com>
14275 * attribute.cs (ApplyAttributes): Make this function filter out
14276 the IndexerName attribute (as that attribute in reality is never
14277 applied) and return the string constant for the IndexerName
14280 * class.cs (TypeContainer.Emit): Validate that all the indexers
14281 have the same IndexerName attribute, and if so, set the
14282 DefaultName attribute on the class.
14284 * typemanager.cs: The return value might contain other stuff (not
14285 only methods). For instance, consider a method with an "Item"
14286 property and an Item method.
14288 * class.cs: If there is a problem with the parameter types,
14291 2002-05-24 Ravi Pratap <ravi@ximian.com>
14293 * ecore.cs (ImplicitConversionExists): Wrapper function which also
14294 looks at user defined conversion after making a call to
14295 StandardConversionExists - we need this for overload resolution.
14297 * expression.cs : Update accordingly the various method calls.
14299 This fixes 2 bugs filed against implicit user defined conversions
14301 2002-05-22 Miguel de Icaza <miguel@ximian.com>
14303 * statement.cs: Track the result of the assignment.
14305 2002-05-21 Miguel de Icaza <miguel@ximian.com>
14307 * expression.cs (MemberAccess): Improved error reporting for
14308 inaccessible members.
14310 2002-05-22 Martin Baulig <martin@gnome.org>
14312 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
14313 itself with debugging support.
14315 2002-05-22 Martin Baulig <martin@gnome.org>
14317 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
14318 Removed, this isn't needed anymore.
14320 2002-05-20 Martin Baulig <martin@gnome.org>
14322 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
14323 be underlying type for an enum.
14325 2002-05-20 Miguel de Icaza <miguel@ximian.com>
14327 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
14328 that splits out the loading of just the core types.
14330 * rootcontext.cs (ResolveCore): Split the struct resolution in
14331 two, so we can load the enumeration underlying types before any
14334 * expression.cs (Is): Bandaid until we fix properly Switch (see
14335 bug #24985 for details).
14337 * typemanager.cs (ImplementsInterface): The hashtable will contain
14338 a null if there are no interfaces implemented.
14340 2002-05-18 Miguel de Icaza <miguel@ximian.com>
14342 * cs-parser.jay (indexer_declarator): It is fine to have array
14345 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14347 * typemanager.cs: (RegisterBuilder): New function used to register
14348 TypeBuilders that implement interfaces. Since
14349 TypeBuilder.GetInterfaces (as usual) does not work with lame
14351 (AddUserType): register interfaces.
14353 (ImplementsInterface): Use the builder_to_ifaces hash if we are
14354 dealing with TypeBuilder. Also, arrays are showing up as
14355 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
14356 methods can not be invoked on them!
14358 * ecore.cs (ExplicitReferenceConversionExists): Made public.
14359 (ImplicitReferenceConversionExists): Split out from
14360 StandardConversionExists.
14362 * expression.cs (As): We were only implementing one of the three
14363 cases for the as operator. We now implement them all.
14364 (Is): Implement the various other cases for Is as well.
14366 * typemanager.cs (CACHE): New define used to control if we want or
14367 not the FindMembers cache. Seems to have a negative impact on
14368 performance currently
14370 (MemberLookup): Nested types have full acess to
14371 enclosing type members
14373 Remove code that coped with instance/static returns for events, we
14374 now catch this in RealFindMembers.
14376 (RealFindMembers): only perform static lookup if the instance
14377 lookup did not return a type or an event.
14379 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14381 * assign.cs (CompoundAssign): We pass more semantic information
14382 now to Compound Assignments than we did before: now we have all
14383 the information at hand, and now we resolve the target *before* we
14384 do the expression expansion, which allows the "CacheValue" method
14385 to have the effect we intended (before, a [x] += 1 would generate
14386 two differen ArrayAccess expressions from the ElementAccess,
14387 during the resolution process).
14389 (CompoundAssign.DoResolve): Resolve target and original_source here.
14391 2002-05-16 Miguel de Icaza <miguel@ximian.com>
14393 * expression.cs (ArrayAccess): dropped debugging information.
14395 * typemanager.cs: Small bug fix: I was always returning i_members,
14396 instead of one of i_members or s_members (depending on which had
14399 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
14400 method is invoked before any code generation takes place, and it
14401 is a mechanism to inform that the expression will be invoked more
14402 than once, and that the method should use temporary values to
14403 avoid having side effects
14405 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
14407 * ecore.cs (Expression.CacheTemporaries): Provide empty default
14410 * expression.cs (Indirection, ArrayAccess): Add support for
14411 CacheTemporaries in these two bad boys.
14413 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
14414 ldobj or ldind_ref.
14415 (StoreFromPtr): Handle stobj as well.
14417 * expression.cs (UnaryMutator): Share more code.
14419 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
14420 down: I was not tracking the Filter function as well, which
14421 was affecting the results of the cache.
14423 2002-05-15 Miguel de Icaza <miguel@ximian.com>
14425 * attribute.cs: Remove the hack to handle the CharSet property on
14428 2002-05-14 Miguel de Icaza <miguel@ximian.com>
14430 * attribute.cs (DoResolve): More uglyness, we now only try to
14431 resolve the attribute partially, to extract the CharSet
14432 information (only if we are a StructLayout attribute). Otherwise
14434 (GetExtraTypeInfo): Add some code to conditionally kill in the
14435 future this. I am more and more convinced that the .NET
14436 framework has special code to handle the attribute setting on
14439 * expression.cs (IsParamsMethodApplicable): Revert my previous
14440 foreach change here, it was wrong.
14442 2002-05-13 Miguel de Icaza <miguel@ximian.com>
14444 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
14445 (pp_expr): do not abort on unknown input, just return.
14446 (eval): abort if there are pending chars.
14448 * attribute.cs (Attribute.Resolve): Positional parameters are
14449 optional. Deal with that case.
14451 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
14452 the Ansi/Unicode/Auto information for the type.
14454 (TypeContainer.DefineType): instantiate the EmitContext here, as
14455 we will be using it during the type definition (to resolve
14456 attributes) and during the emit phase.
14458 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
14459 to pull type information out of the attributes
14461 (Attribute.Resolve): track the constructor builder, and allow for
14462 multiple invocations (structs and classes will use this).
14464 * ecore.cs (MemberLookupFinal): new version with all the
14465 parameters customizable.
14467 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
14468 constructors. Return if the result value is null (as the error
14469 would have been flagged already by MemberLookupFinal)
14471 Do not allow instances of abstract classes or interfaces to be
14474 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
14475 We have to compare the assembly property here when dealing with
14476 FamANDAssem and Assembly access modifiers, because we might be
14477 creating an assembly from *modules* (that means that we are not
14478 getting TypeBuilders for types defined in other modules that are
14479 part of this assembly).
14481 (Method.Emit): If the method is marked abstract and has a body,
14484 (TypeContainer.DefineMembers): If both the defined member and the
14485 parent name match are methods, then do not emit any warnings: let
14486 the Method.Define routine take care of flagging warnings. But if
14487 there is a mismatch (method overrides something else, or method is
14488 overriwritten by something, then emit warning).
14490 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
14491 set to null, this means `do not check for the return type on the
14494 (Method.Define): set the return type for the method signature to
14495 null, so that we get methods with the same name and parameters and
14496 different return types. This is used to flag warning 114 (you are
14497 hiding a method, and you probably want to use the new/override
14500 * typemanager.cs (MemberLookup): Implemented proper access
14501 control, closing a long standing set of bug reports. The problem
14502 was that the Framework only has two bits: Public and NonPublic,
14503 and NonPublic includes private and protected methods, but we need
14504 to enforce the FamANDAssem, FamOrAssem and Family.
14506 2002-05-11 Miguel de Icaza <miguel@ximian.com>
14508 * statement.cs (GotoCase): Return true: Ammounts to giving up
14509 knowledge on whether we return or not, and letting the other case
14510 be responsible for it.
14512 2002-05-10 Miguel de Icaza <miguel@ximian.com>
14514 * driver.cs: Do not load directories for each file processed, only
14515 do it if there is a pattern.
14517 * ecore.cs: Report readonly assigns here as well, as we might have
14518 been resolved only by MemberAccess.
14520 (SimpleName.SimpleNameResolve): Also be useful for LValue
14521 resolution. We need this to propagate assign to local readonly variables
14523 * typemanager.cs: Use a ptrhashtable for the criteria, because we
14524 do not want to reuse potential criteria memory.
14526 * class.cs (MyEventBuilder): Set reflected_type;
14528 * ecore.cs (Constantify): Added support for constifying bools.
14530 (RootContext.LookupType): Added a cache for values looked up in
14531 the declaration space.
14533 * typemanager.cs (FindMembers): Now is a front-end to
14534 RealFindMembers, and provides a two-level hashtable-based cache to
14537 15% performance improvement: from 22.5 to 19.2 seconds.
14539 * expression.cs (IsParamsMethodApplicable): use foreach.
14540 (Invocation.DoResolve): ditto.
14541 (New.DoResolve): ditto.
14542 (ArrayCreation.DoResolve): ditto.
14544 * ecore.cs (FindMostEncompassingType): use foreach.
14546 * delegate.cs (NewDelegate.DoResolve): Use foreach
14548 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
14549 (RemoveMethods): use foreach.
14551 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
14552 nested foreach statements instead of for, and also break out of
14553 the inner loop once a match is found.
14555 (Invocation.OverloadResolve): Use foreach, simplify the code.
14557 2002-05-08 Miguel de Icaza <miguel@ximian.com>
14559 * cfold.cs (BinaryFold): During an enumeration evaluation context,
14560 we actually unwrap the expression to allow for extra information
14563 * expression.cs: Use Shr_Un on unsigned operations.
14565 2002-05-08 Ravi Pratap <ravi@ximian.com>
14567 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
14568 applicable operators was not being considered correctly. This closes
14569 the bug Miguel reported.
14571 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
14573 * attribute.cs: check that the type derives from System.Attribute
14574 and report the correct error in that case (moved the duplicate code to
14575 its own method, too).
14577 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
14579 * attribute.cs: lookup attribute type name as the spec says: first the
14580 bare attribute name and then name + "Attribute" (nant compiles with
14581 mcs after this fix).
14583 2002-05-07 Miguel de Icaza <miguel@ximian.com>
14585 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
14586 Because of the way we parse things, we should try to see if a
14587 UIntConstant can fit in an integer.
14589 2002-05-07 Ravi Pratap <ravi@ximian.com>
14591 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
14592 when we are in an explicit context.
14594 (ConvertReferenceExplicit): When converting from Iface type S to Class
14595 T make sure the rules are implemented as an OR.
14597 * parameter.cs (ParameterType): Make it a property for now although the
14598 purpose really isn't anything immediate.
14600 * expression.cs (Is*Applicable): Do better checking on the parameter type
14601 of a ref/out parameter. The ones from the system assemblies are already
14602 marked with the correct type so we don't need to do any correction.
14604 * ecore.cs (StandardConversionExists): Conversion from Interface types to
14605 the object type is standard too so include that.
14607 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14609 * ecore.cs (StandardConversionExists): Augment with missing code:
14610 deal with IntConstant, LongConstants and Enumerations.
14612 * assign.cs: Report the error, instead of failing silently
14614 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
14615 typecontainer that they are declared, because the
14616 typecontainer/namespace will have the list of using clauses that
14617 need to be applied.
14619 Assembly Attributes were escaping the normal registration
14622 (EmitCode): Apply attributes within an EmitContext that represents
14623 the container they were declared on.
14625 * cs-parser.jay: Track bases for structs. How did I get this wrong?
14627 2002-05-06 Ravi Pratap <ravi@ximian.com>
14629 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
14630 Revamp completely - make much cleaner as we now operate only
14633 (FindMostSpecificSource, FindMostSpecificTarget): New methods
14634 to implement the logic detailed in the spec more correctly.
14636 (UserDefinedConversion): Update accordingly.
14638 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14640 * statement.cs: Return flow analysis information up.
14642 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
14645 (token): Do not consume an extra character before calling
14648 2002-05-06 Piers Haken <piersh@friskit.com>
14650 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
14652 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14654 * class.cs (Constructor.Emit): Set the IsStatic flag in the
14655 EmitContext during the instance constructor initializer
14656 resolution, to stop access to instance variables.
14658 This is mandated by the spec, last paragraph of the `constructor
14659 initializers' section.
14661 2002-05-05 Miguel de Icaza <miguel@ximian.com>
14663 * cs-parser.jay, class.cs (Accessor): new class used to represent
14664 an accessor (get or set). In the past we used `null' to represent
14665 a missing accessor. But this is ambiguous because there was no
14666 way to tell in abstract indexers/properties if one of them was
14669 Now there is a way of addressing that.
14671 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
14672 instead of FindMembers.
14674 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
14675 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
14677 * attribute.cs: Treat indexers and properties as the same in terms
14678 of applying attributes
14680 * ecore.cs (FindMostEncompassedType): Use statically initialized
14681 EmptyExpressions()s like we do elsewhere to avoid creating useless
14682 objects (and we take this out of the tight loop).
14684 (GetConversionOperators): Move the code to extract the actual
14685 operators to a separate routine to clean things up.
14687 2002-05-04 Miguel de Icaza <miguel@ximian.com>
14689 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
14690 events are always registered FieldBuilders.
14692 * class.cs (FieldBase): New class shared by Fields
14694 * delegate.cs: If we are a toplevel delegate, use our full name.
14695 If we are a nested delegate, then only use our tail name.
14697 2002-05-02 Ravi Pratap <ravi@ximian.com>
14699 * expression.cs (IsApplicable): Ensure that we add the "&" to
14700 ref/out types before comparing it with the type of the argument.
14702 (IsParamsMethodApplicable): Ditto.
14704 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
14707 * delegate.cs : Handle the case when we have more than one applicable
14708 method. Flag an error only when we finish checking all.
14710 2002-05-02 Miguel de Icaza <miguel@ximian.com>
14712 * expression.cs: Add support for boolean static initializers.
14714 2002-05-01 Miguel de Icaza <miguel@ximian.com>
14716 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
14718 * parameter.cs (ComputeParameterTypes,
14719 ComputeAndDefineParameterTypes): Better error handling: now we
14720 clear the `types' cache if we fail during any of the type lookups.
14721 We also return the status code correctly to our caller
14723 * delegate.cs: If we fail to define a delegate, abort the extra
14726 * expression.cs (Binary.ResolveOperator): for
14727 operator==(object,object) and operator !=(object, object) we also
14728 have to verify that there is an implicit conversion from one to
14731 (ArrayAccess.DoResolve): Array Access can operate on
14734 2002-04-30 Miguel de Icaza <miguel@ximian.com>
14736 * assign.cs (CompoundAssign): A new class used as a "flag" that
14737 the assignment actually is happening as part of a compound
14738 assignment operator.
14740 During compound assignment, a few new rules exist to enable things
14747 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
14748 to the type of x) if y is implicitly convertible to the type of x,
14749 and the operator is a builtin operator and the return type of the
14750 operator is explicitly convertible to the type of x.
14752 * rootcontext.cs: Reset warning level to 2. 4 catches various
14753 "interesting" features in mcs, we must clean this up at some
14754 point, but currently am trying to kill other bugs ;-)
14756 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
14757 in container classes as well.
14759 * expression.cs (Binary.ResolveOperator): Handle string case
14760 before anything else (as operator overloading does emit an error
14761 before doing anything else).
14763 This code could go away when we move to a table driven model, but
14764 i could not come up with a good plan last night.
14766 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
14768 * typemanager.cs (CSharpName): reimplementation using regex.
14769 * class.cs: added null check for fields in Emit
14770 * rootcontext.cs: set warninglevel to 4
14772 2002-04-29 Miguel de Icaza <miguel@ximian.com>
14774 * typemanager.cs (CSharpName): reimplemented with Lupus
14777 2002-04-28 Miguel de Icaza <miguel@ximian.com>
14779 * statement.cs (If): correclty implement Resolve, because we were
14780 not catching sem errors in there. The same process is needed
14782 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
14785 (Statement.Warning_DeadCodeFound): Factorize code.
14786 (While): Report dead code here too.
14788 (Statement): Added Resolve virtual method to allow
14789 for resolution split from the emit code.
14791 2002-04-26 Miguel de Icaza <miguel@ximian.com>
14793 * statement.cs (EmitBoolExpression): No longer try to resolve the
14795 (MakeBoolean): New utility function that resolve, implicitly
14796 converts to boolean and tags the expression.
14799 (If, Do): Implement dead code elimination.
14800 (While): Implement loop inversion
14802 (Do, While, For, If): Resolve the expression prior to calling our
14805 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
14808 - added method Report28 (warning: program has more than one entry point)
14809 - added method IsEntryPoint, implements paragraph 10.1 of the spec
14810 - modified method Method.Define, the part at the end of the method
14812 * rootcontext.cs: added static public Location EntryPointLocation;
14814 * ../errors/cs0028.cs : Add test case for the above warning.
14817 - modified method CSharpName to allow arrays of primitive type to
14818 be printed nicely (e.g. instead of System.Int32[][] it now prints
14820 - added method CSharpSignature: returns the signature of a method
14821 in string format to be used in reporting errors, warnings, etc.
14823 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
14826 2002-04-26 Ravi Pratap <ravi@ximian.com>
14828 * delegate.cs (Define): Fix extremely silly bug where I was
14829 setting the type of the 'object' parameter of the BeginInvoke
14830 method to System.IAsyncResult instead of System.Object ;-)
14832 2002-04-26 Miguel de Icaza <miguel@ximian.com>
14834 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
14837 (Constructor.Emit): return if we fail to initialize the
14838 constructor. Another door closed!
14840 * expression.cs (New.DoResolve): Improve error message (from -6 to
14841 1501). Use DeclaredOnly lookup to find the exact constructor.
14843 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
14844 loop. This is useful.
14846 * cs-parser.jay: Adjust the default parameters so that destructors
14847 have the proper signature.
14849 2002-04-26 Martin Baulig <martin@gnome.org>
14851 * driver.cs (LoadAssembly): If `assembly' contains any characters
14852 which are only valid in path names and not in assembly names
14853 (currently slash, backslash and point), use Assembly.LoadFrom ()
14854 instead of Assembly.Load () on the `assembly' (before iteration
14855 over the link_paths).
14857 2002-04-26 Martin Baulig <martin@gnome.org>
14859 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
14861 2002-04-25 Miguel de Icaza <miguel@ximian.com>
14863 * class.cs (Property): use the new typemanager.MemberLookup
14865 (TypeContainer.MemberLookup): Implement using the
14866 TypeManager.MemberLookup now.
14868 * typemanager.cs: Make MemberLookup a function of the TypeManager,
14869 and return MemberInfos, so that these can be used without an
14870 EmitContext (what we had before).
14872 2002-04-24 Miguel de Icaza <miguel@ximian.com>
14874 * expression.cs: Fix the case where the argument to params if the
14875 type of the params. I omitted handling this before. Fixed
14877 2002-04-22 Miguel de Icaza <miguel@ximian.com>
14879 * driver.cs: Call BootCorlib_PopulateCoreType
14881 * class.cs (Property.CheckBase): Check for properties only, not
14884 * interface.cs: Temporary hack: try/catch around the
14885 CustomAttributeBuilder, because I am getting an exception that I
14888 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
14889 types whose definitions are required to be there (attributes are
14890 defined before standard types).
14892 Compute definitions as we boot the various types, as they are used
14893 immediately (value_type class will need object_type, but if we do
14894 not initialize object_type, we will pass a null, which will let
14895 the runtime pick the System.Object from the existing corlib, which
14896 is not what we want).
14898 2002-04-22 Patrik Torstensson <totte@labs2.com>
14900 * cs-tokenizer.cs: fixed a number of trim() issues.
14902 2002-04-22 Ravi Pratap <ravi@ximian.com>
14904 * expression.cs (Argument.Type): Ensure that we return the correct
14905 type when we have out or ref parameters [in which case we
14908 2002-04-22 Miguel de Icaza <miguel@ximian.com>
14910 * class.cs (Property, Indexer): Allow extern modifier in there.
14912 * typemanager.cs (InitBaseTypes): Initializes object_type and
14913 value_type, since those will be used early on during the bootstrap
14914 process to compile corlib.
14916 (InitCoreTypes): Move code from here to InitBaseTypes.
14918 2002-04-21 Miguel de Icaza <miguel@ximian.com>
14920 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
14921 single-dimension arrays as using the ldlen opcode.
14923 Daniel Lewis discovered this optimization.
14925 * typemanager.cs: Add signature for System.Array::get_Length
14927 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14929 * statement.cs: report the error when the foreach does not apply to an
14930 array nor a collection.
14932 2002-04-19 Miguel de Icaza <miguel@ximian.com>
14934 * expression.cs: Add implicit conversions to the operator ~.
14936 * constant.cs (DecimalConstant.Emit): Emit decimal value.
14938 * typemanager.cs: Locate the decimal constructor.
14940 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14942 * attribute.cs: use the new property of TypeOf.
14943 * expression.cs: added 'get' property around typearg.
14945 These changes fix a build breaker reported by NickD. Is this the
14946 correct way to fix? If not, please, revert my changes and make it
14949 2002-04-17 Miguel de Icaza <miguel@ximian.com>
14951 * attribute.cs: Add support for typeof in attribute invocations.
14952 I am not sure that this is right though.
14954 2002-04-14 Duncan Mak <duncan@ximian.com>
14956 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
14957 Binary.Operator.Division case.
14959 2002-04-13 Ravi Pratap <ravi@ximian.com>
14961 * class.cs (DefineType): Ensure that we do a proper check on
14962 attribute types and also register it with the TypeManager.
14964 (TypeContainer.Targets): The default for attribute types is
14965 AttributeTargets.All.
14967 * attribute.cs (ApplyAttributes): Registering the attribute type
14968 is done elsewhere, not when we discover we have a Usage attribute.
14970 2002-04-12 Ravi Pratap <ravi@ximian.com>
14972 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
14973 and get rid of is_delegate parameter.
14975 * everywhere : update.
14977 2002-04-12 Ravi Pratap <ravi@ximian.com>
14979 * cs-parser.jay (compilation_unit): Revamp completely to use
14980 some new ideas that I got from Rhys' grammar to solve the problems
14981 with assembly level attributes.
14983 (outer_declaration): New grammar production.
14985 (attribute_sections): Add.
14987 (opt_attributes): Base on attribute_sections
14989 (namespace_declaration): Allow opt_attributes to tackle the case
14990 when we have assembly level attributes - we are clever in this
14993 * attribute.cs (ApplyAttributes): Do not worry about assembly
14994 attributes in the non-global context.
14996 * rootcontext.cs (AddGlobalAttributes): Go back to using this
14997 instead of SetGlobalAttributes.
14999 * class.cs, rootcontext.cs : Ensure we define and generate
15000 attribute types before anything else.
15002 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15003 and flag the new error -20 for the case when the attribute type
15004 does not have valid targets specified. csc does not catch this.
15006 * ../errors/errors.txt : update for error # -20
15008 2002-04-11 Ravi Pratap <ravi@ximian.com>
15010 * support.cs (InternalParameters.ParameterModifier): Do some null
15011 checking and return sane values.
15013 * class.cs (Method.Define): If we are a PInvoke method, ensure
15014 that we are static and extern. Report error # 601
15016 * ../errors/cs0601.cs : Add test case for the above error.
15018 2002-04-07 Ravi Pratap <ravi@ximian.com>
15020 * rootcontext.cs (attribute_types): We need to keep type of
15021 all attribute types separately and emit code for them first.
15023 (RegisterAttribute) : Implement.
15025 * class.cs (DefineType): Check if the current Type is a custom
15026 attribute type and register it accordingly.
15028 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15029 adding the first attribute twice and rename to
15031 (SetGlobalAttributes): this.
15033 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
15036 * attribute.cs (ApplyAttributes): Take an additional argument telling us
15037 if we are processing global arguments. Hmm, I am unsure of this.
15039 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15041 * expression.cs: added static array of strings to avoid calling
15042 Enum.ToString () for Operator in Binary. Significant recover of
15045 2002-04-10 Miguel de Icaza <miguel@ximian.com>
15047 * class.cs (FindMembers): Allow the Builders of the various
15048 members to be null. If they are skip them. This only happens
15049 during the PInvoke declaration.
15051 2002-04-09 Miguel de Icaza <miguel@ximian.com>
15053 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
15054 failure, so we do not keep going afterwards.
15056 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
15057 wanted to pass `false' as the `is_delegate' argument. If this is
15058 the case, why not use delegate_type == null to mean `is_delegate =
15059 false' and anything else as is_delegate = true.
15061 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
15063 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
15064 code for the section, not the beginning of the tests.
15066 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15068 * cfold.cs: Handle operator + (Enum x, Underlying x)
15070 * expression.cs (Binary): same. Warn about errors where we have
15071 Enum/Enum in operator + as well.
15073 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
15076 - added support for switch(bool)
15077 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
15078 - add TableSwitchEmit() to handle table-based switch statements
15080 2002-04-05 Ravi Pratap <ravi@ximian.com>
15082 * expression.cs (Invocation.OverloadResolve): Factor out code which
15083 does parameter compatibility checking with arguments so that we can
15084 re-use the code even from Delegate.VerifyApplicability
15086 (VerifyArgumentsCompat): Move above code here.
15088 * delegate.cs (VerifyApplicability): Get rid of duplicate code
15089 and instead make a call to the above method.
15091 2002-03-31 Ravi Pratap <ravi@ximian.com>
15093 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
15094 We use it to keep track of classes which are attribute types.
15096 2002-04-02 Miguel de Icaza <miguel@ximian.com>
15098 * delegate.cs (Delegate.Define): Correctly define the types in the
15099 presence of fixed and array parameters.
15101 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
15104 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
15105 include NonPublic after the first iteration.
15107 * class.cs (Indexer.CheckBase): Only check if both parents are
15110 * cs-parser.jay (accessor_body): If empty, set to null.
15112 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
15113 same code path here to resolve constants names that we did have in
15114 MemberAccess.DoResolve. There is too much code duplicated here.
15116 2002-04-01 Miguel de Icaza <miguel@ximian.com>
15118 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
15120 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
15123 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
15124 tokens, numbers and strings.
15126 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
15129 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
15130 asyncronous parameters and the regular parameters.
15132 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
15133 specify the target directory.
15135 * expression.cs: (This.DoResolve): Simplify
15136 (As.Emit): Optimize, do not generate IsInst if the expression is
15137 always of the given type.
15139 (Is.DoResolve): Bug fix, we were reporting both always/never for
15142 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15143 creating too many unnecessary arrays.
15145 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15147 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15148 fields instead of rolling our own initializer. Takes care of all
15149 implicit conversions, and drops unnecessary static checks/argument.
15151 2002-03-31 Dick Porter <dick@ximian.com>
15153 * driver.cs: use the GetDirectories() return values properly, and
15154 use "/" as path separator.
15156 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15158 * expression.cs (Unary): Optimize - - expr into expr.
15159 (Binary): Optimize a + (-b) into a -b.
15161 * codegen.cs (CodeGen): Made all methods static.
15163 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15167 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15168 TypeBuilder property.
15170 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15173 * tree.cs: Removed the various RecordXXXX, and replaced with a
15174 single RecordDecl. Removed all the accessor methods, and just
15175 left a single access point Type
15177 * enum.cs: Rename DefineEnum to DefineType.
15179 * decl.cs: New abstract method `DefineType' used to unify the
15180 Defines for Enumerations, Interfaces, TypeContainers and
15183 (FindType): Moved LookupInterfaceOrClass here. Moved the
15184 LookupBaseClasses method that used to live in class.cs and
15185 interface.cs here, and renamed to FindType.
15187 * delegate.cs: Implement DefineType. Take advantage of the
15188 refactored pattern for locating the parent builder without taking
15189 the parent_builder argument (which we know does not work if we are
15190 nested, and triggering a toplevel definition).
15192 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15194 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
15195 accessibility of a member has changed during override and report
15198 * class.cs (Method.Define, Property.Define): Only complain on
15199 overrides if the method is private, any other accessibility is
15200 fine (and since we just checked the permission is the same, we are
15203 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
15204 and elif are processed always. The other pre-processing
15205 directives are only processed if we are "taking" the path
15207 2002-03-29 Martin Baulig <martin@gnome.org>
15209 * class.cs (Method.Emit): Only emit symbolic debugging info if the
15210 current location is not Null.
15212 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
15213 a separate method so we can profile it.
15215 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
15216 `span.Seconds' are just seconds, but no minutes or hours.
15217 (MainDriver): Profile the CodeGen.SaveSymbols calls.
15219 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15221 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
15222 Remove the gratuitous set of Final:
15224 // If an interface implementation, then we can set Final.
15225 if (((flags & MethodAttributes.Abstract) == 0) &&
15226 implementing.DeclaringType.IsInterface)
15227 flags |= MethodAttributes.Final;
15229 I do not know what I was smoking when I used that.
15232 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
15233 step into fixing the name resolution issues for delegates and
15234 unifying the toplevel name resolution.
15236 2002-03-28 Martin Baulig <martin@gnome.org>
15238 * class.cs (Method.Emit): If we have a symbol writer, call its
15239 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
15240 tell it about the current method.
15242 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
15243 writer that we're going to emit the first byte of IL code for a new
15244 statement (a new source line).
15245 (EmitContext.EmitTopBlock): If we have a symbol writer, call
15246 EmitContext.Mark() before emitting any code.
15248 * location.cs (SymbolDocument): Return null when we're Null.
15250 * statement.cs (Statement): Moved the `Location loc' variable here.
15251 (Statement.EmitBoolExpression): If we have a symbol writer, call
15252 ec.Mark() before emitting any code to tell it that we're at the
15253 beginning of a new statement.
15254 (StatementExpression): Added `Location' argument to the constructor.
15255 (Block): Added public readonly variable `StartLocation' and public
15256 variable `EndLocation'. The latter is to be set using SetEndLocation().
15257 (Block): Added constructor which takes a start and end location.
15258 (Block.SetEndLocation): New method. This sets the end location.
15259 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
15260 local variables we create.
15261 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
15262 each statement and do also mark the begin and end of the block.
15264 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
15265 tell it the current lexer.Location, use Location.Null for the end of the
15267 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
15268 current block, set its end location using SetEndLocation().
15269 (statement_expression): StatementExpression constructor now takes the
15270 lexer.Location as additional argument.
15271 (for_statement, declare_local_variables): Likewise.
15272 (declare_local_variables): When creating a new implicit block, use the
15273 new Block constructor and pass it the lexer.Location.
15275 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15277 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
15278 members also on the parent interfaces recursively.
15280 2002-03-27 Miguel de Icaza <miguel@ximian.com>
15282 * report.cs: Use new formats, since Gonzalo finished the missing
15285 * expression.cs (Binary.ResolveOperator): added missing operator|
15286 operator& and operator^ for bool/bool.
15288 * cs-parser.jay: CheckDef now takes a Location argument that is
15289 used to report errors more precisly (instead of reporting the end
15290 of a definition, we try to track something which is a lot closer
15291 to the source of the problem).
15293 * cs-tokenizer.cs: Track global token use, so we can properly flag
15294 the use of #define/#undef after the first token has been seen.
15296 Also, rename the reportXXXX to Error_DescriptiveName
15298 * decl.cs (DeclSpace.IsTopLevel): Move property here from
15299 TypeContainer, so that Enum and Interface can use this too.
15301 * class.cs (TypeContainer.LookupInterfaceOrClass,
15302 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
15303 `builder' argument. Typically this was used to pass the parent
15304 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
15307 The problem is that a nested class could trigger the definition of
15308 a toplevel class, and the builder would be obviously wrong in that
15311 So we drop this argument, and we compute dynamically the
15312 TypeBuilder/ModuleBuilder (the correct information was available
15313 to us anyways from DeclSpace.Parent)
15315 * interface.cs (Interface.DefineInterface): Drop builder
15316 parameter cleanup like class.cs
15318 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
15321 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
15324 (Try.Emit): Propagate the returns value from the statement.
15326 (Return.Emit): Even if we are leavning
15328 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
15330 * modifiers.cs: Fix the computation of MethodAttributes flags.
15332 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
15334 * driver.cs: allow compilation of files that start with '/'.
15335 Add a default case when checking the argument of --target.
15337 2002-03-25 Miguel de Icaza <miguel@ximian.com>
15339 * interface.cs: Implement the same search algorithm for types in
15340 the interface code.
15342 * delegate.cs: Do not allow multiple definition.
15344 * Recovered ChangeLog that got accidentally amputated
15346 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
15348 * rootcontext.cs: Load manually enum to allow core classes to
15349 contain enumerations.
15351 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
15352 Update to new static methods in TypeManager.
15354 * typemanager.cs (GetMethod, GetConstructor): Use our
15355 implementation of FindMembers to find the members, since during
15356 corlib compilation, the types are TypeBuilders and GetMethod and
15357 GetConstructor do not work.
15359 Make all methods in TypeManager static.
15361 (InitCodeHelpers): Split the functionality from
15362 the InitCodeTypes function.
15364 * driver.cs: Call InitCodeHelpers after we have populated the
15367 * cs-parser.jay (delegate_declaration): we did not used to compute
15368 the delegate name correctly for void delegates.
15370 2002-03-24 Miguel de Icaza <miguel@ximian.com>
15372 * rootcontext.cs (RootContext): Init the interface_resolve_order
15373 and type_container_resolve_order always.
15375 (ResolveCore, BootstrapCorlib_ResolveClass,
15376 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
15377 compiler when compiling with --nostdlib
15379 * class.cs (TypeContainer.DefineType): Check that our parent is
15380 not null. This test is most important when we are bootstraping
15383 * codegen.cs: Split out the symbol writing code.
15385 2002-03-25 Martin Baulig <martin@gnome.org>
15387 * driver.cs (-g): Made -g an alias for --debug.
15389 2002-03-24 Martin Baulig <martin@gnome.org>
15391 * codegen.cs (SymbolWriter): New public variable. Returns the
15392 current symbol writer.
15393 (CodeGen): Added `bool want_debugging_support' argument to the
15394 constructor. If true, tell the ModuleBuild that we want debugging
15395 support and ask it for the ISymbolWriter.
15396 (Save): If we have a symbol writer, call it's Close() method after
15397 saving the assembly.
15399 * driver.c (--debug): New command line argument to create a
15400 debugger information file.
15402 * location.cs (SymbolDocument): New public property. Returns an
15403 ISymbolDocumentWriter object for the current source file or null
15404 if we don't have a symbol writer.
15406 2002-03-21 Miguel de Icaza <miguel@ximian.com>
15408 * driver.cs (LoadAssembly): Correctly return when all the paths
15409 have been tried and not before.
15411 * statement.cs (Switch.Emit): return the actual coverage for this
15412 statement (returns/not-returns)
15414 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
15415 switch of the statement if we are the last switch section. That
15416 kills two problems: try/catch problems (we used to emit an empty
15417 nop at the end) and switch statements where all branches would
15420 2002-03-19 Miguel de Icaza <miguel@ximian.com>
15422 * driver.cs: Add default assemblies (the equivalent to the
15423 Microsoft CSC.RSP file)
15425 * cs-tokenizer.cs: When updating `cols and setting it to zero,
15426 also update tokens_seen and set it to false.
15428 * driver.cs: Implement --recurse for Mike.
15430 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
15431 correctly splitting out the paths.
15433 2002-03-18 Miguel de Icaza <miguel@ximian.com>
15435 * interface.cs (Interface.PopulateProperty): Instead of using
15436 `parent' as the declaration space for the set parameters, use
15439 * support.cs (InternalParameters): InternalParameters constructor
15440 takes a DeclSpace instead of a TypeContainer.
15442 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
15443 types are being initialized, load the address of it before calling
15446 (New): Provide a mechanism to disable the generation of local
15447 value type temporaries when the caller will be providing us with
15448 an address to store it.
15450 (ArrayCreation.EmitDynamicInitializers): Use it.
15452 2002-03-17 Miguel de Icaza <miguel@ximian.com>
15454 * expression.cs (Invocation.EmitArguments): Only probe for array
15455 property if there is more than one argument. Sorry about that.
15457 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
15458 empty param arrays.
15460 * class.cs (Method.LabelParameters): Fix incorrect code path that
15461 prevented the `ParamArrayAttribute' from being applied to the
15464 2002-03-16 Miguel de Icaza <miguel@ximian.com>
15466 * support.cs (ReflectionParameters): Correctly compute whether the
15467 last argument is a params array. Fixes the problem with
15470 * typemanager.cs: Make the assemblies array always be non-null
15471 (empty, but non-null)
15473 * tree.cs (RecordDecl): New function that abstracts the recording
15474 of names. This reports error 101, and provides a pointer to the
15475 previous declaration. Fixes a crash in the compiler.
15477 * cs-parser.jay (constructor_declaration): Update to new grammar,
15478 and provide a constructor_body that can be empty.
15480 2002-03-15 Miguel de Icaza <miguel@ximian.com>
15482 * driver.cs: Add support for --resources.
15484 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
15485 Make all types for the various array helper methods be integer.
15487 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
15488 CheckState to ConvCast.
15490 (ConvCast): Now it takes a `checked' state argument, to avoid
15491 depending on the emit context for the conversion, and just using
15492 the resolve time setting.
15494 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
15495 instead of Invocation.EmitArguments. We do not emit the original
15496 arguments, instead we emit those which have been converted to
15497 unsigned int expressions.
15499 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
15501 * codegen.cs: ditto.
15503 * expression.cs (LocalVariableReference): Drop the use of the
15504 Store function that depended on the variable index.
15506 * statement.cs (VariableInfo): Drop the `Idx' property from this
15507 class, as this is not taking into account the indexes for
15508 temporaries tat we generate during the execution, getting the
15511 * class.cs: First emit class initializers, then call the parent
15514 * expression.cs (Binary): Fix opcode emision.
15515 (UnaryMutator.EmitCode): Support checked code generation
15517 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
15518 matches for events for both the Static and Instance scans,
15519 pointing to the same element. Fix that.
15521 2002-03-14 Miguel de Icaza <miguel@ximian.com>
15523 * rootcontext.cs (ResolveTree): Always set the
15524 interface_resolve_order, because nested interfaces will be calling
15527 * class.cs (GetInterfaceOrClass): Track the same resolution
15528 process used by TypeManager.LookupType. This fixes the nested
15529 type lookups in class declarations (separate path from
15532 (TypeContainer.DefineType): Also define nested interfaces.
15533 (TypeContainer.RegisterOrder): New public function used to
15534 register the order in which child interfaces need to be closed.
15536 Nested interfaces need to be closed after their parents have been
15539 * interface.cs (InterfaceAttr): Put all the logic for computing
15540 the interface attribute here.
15542 (DefineInterface): Register our interface order with the
15543 RootContext or with the TypeContainer depending on the case.
15545 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15547 * cs-parser.jay: rework foreach statement to work with the new
15548 changes to the policy on SimpleNames.
15550 * report.cs: support Stacktrace on warnings as well.
15552 * makefile: drop --unsafe and /unsafe from the compile.
15554 2002-03-13 Ravi Pratap <ravi@ximian.com>
15556 * ecore.cs (StandardConversionExists): Modify to take an Expression
15557 as the first parameter. Ensure we do null -> reference type conversion
15560 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
15561 temporary Expression objects.
15563 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
15565 * interface.cs: workaround bug in method overloading resolution
15566 (there is already a bugzilla bug for it).
15568 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15570 We could also solve this problem by having a separate path for
15571 performing type lookups, instead of DoResolve, we could have a
15572 ResolveType entry point, and only participating pieces of the
15573 production (simplename, deref, array) would implement this.
15575 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
15576 signal SimpleName to only resolve type names and not attempt to
15577 resolve anything else.
15579 * expression.cs (Cast): Set the flag.
15581 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
15583 * class.cs: Only report 108 if there is no `new' modifier.
15585 * cs-parser.jay: rework foreach statement to work with the new
15586 changes to the policy on SimpleNames.
15588 * report.cs: support Stacktrace on warnings as well.
15590 * makefile: drop --unsafe and /unsafe from the compile.
15592 2002-03-11 Miguel de Icaza <miguel@ximian.com>
15594 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
15595 lookups here, instead of doing that at parse time. This means
15596 that our grammar will not introduce `LocalVariableReferences' as
15597 expressions at this point. That solves the problem of code like
15601 static void Main ()
15605 This is only half the fix. The full fix requires parameters to
15606 also be handled in this way.
15608 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
15609 makes the use more obvious of the DeclSpace. The
15610 ec.TypeContainer.TypeBuilder is now only used to pull the
15611 TypeBuilder for it.
15613 My theory is that I can get rid of the TypeBuilder completely from
15614 the EmitContext, and have typecasts where it is used (from
15615 DeclSpace to where it matters).
15617 The only pending problem is that the code that implements Aliases
15618 is on TypeContainer, and probably should go in DeclSpace.
15620 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
15621 lookups here, instead of doing that at parse time. This means
15622 that our grammar will not introduce `LocalVariableReferences' as
15623 expressions at this point. That solves the problem of code like
15627 static void Main ()
15631 This is only half the fix. The full fix requires parameters to
15632 also be handled in this way.
15634 * class.cs (Property.DefineMethod): When implementing an interface
15635 method, set newslot, when implementing an abstract method, do not
15636 set the flag (before we tried never setting it, or always setting
15637 it, which is the difference).
15638 (Indexer.DefineMethod): same.
15639 (Method.DefineMethod): same.
15641 * ecore.cs: Only set the status used flag if we get back a Field.
15643 * attribute.cs: Temporary hack, so Paolo can keep working.
15645 2002-03-08 Ravi Pratap <ravi@ximian.com>
15647 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
15648 the unmanaged type in the case we have a MarshalAs attribute.
15650 (Resolve): Handle the case when we are parsing the special MarshalAs
15651 attribute [we need to store the unmanaged type to use later]
15653 * typemanager.cs (marshal_as_attr_type): Built in type for the
15654 MarshalAs Attribute.
15656 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
15657 on parameters and accordingly set the marshalling info.
15659 2002-03-09 Miguel de Icaza <miguel@ximian.com>
15661 * class.cs: Optimizing slightly by removing redundant code after
15662 we switched to the `NoTypes' return value.
15663 (Property.DefineMethod): use NoTypes here too.
15665 This fixes the bug I introduced in my last batch of changes.
15667 2002-03-05 Ravi Pratap <ravi@ximian.com>
15669 * tree.cs (RecordEnum): Add. We now keep track of enums too.
15671 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
15672 Enums since those are types too.
15674 * cs-parser.jay (enum_declaration): Record enums as we parse them.
15676 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
15677 thanks to a call during the lookup process.
15679 2002-03-07 Miguel de Icaza <miguel@ximian.com>
15681 * statement.cs (Foreach): Lots of work to accomodate a particular
15682 kind of foreach statement that I had not kept in mind. It is
15683 possible to have foreachs on classes that provide a GetEnumerator
15684 method that return objects that implement the "pattern" for using
15685 a foreach, there is no need to support GetEnumerator
15688 This is needed to compile nant.
15690 * decl.cs: Only report 114 if the member is not `Finalize' and if
15691 the warning level is at least 2.
15693 * class.cs: Moved the compare function from Method to
15696 (MethodSignature.InheritableMemberSignatureCompare): Add new
15697 filter function that is used to extract inheritable methods from a
15700 (Method.Define): Use the new `inheritable_method_signature_filter'
15703 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
15706 2002-03-06 Miguel de Icaza <miguel@ximian.com>
15708 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
15710 * cs-parser.jay: Add opt_semicolon to the interface declaration.
15712 * expression.cs: Pass location information to
15713 ConvertImplicitStandard.
15715 * class.cs: Added debugging code to track return values from
15718 2002-03-05 Miguel de Icaza <miguel@ximian.com>
15720 * expression.cs (Is.DoResolve): If either side of the `is' is an
15721 interface, do not flag the warning.
15723 * ecore.cs (ImplicitReferenceConversion): We need a separate test
15726 * report.cs: Allow for --fatal to be used with --probe.
15728 * typemanager.cs (NoTypes): Move the definition for the empty Type
15731 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
15733 (TypeContainer.DefineProxy): New function used to proxy to parent
15734 implementations when implementing interfaces.
15735 (TypeContainer.ParentImplements): used to lookup if our parent
15736 implements a public function that is required by an interface.
15737 (TypeContainer.VerifyPendingMethods): Hook this up.
15739 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
15740 `modules' and `assemblies' arraylists into arrays. We only grow
15741 these are the very early start up of the program, so this improves
15742 the speedof LookupType (nicely measured).
15744 * expression.cs (MakeByteBlob): Replaced unsafe code with
15745 BitConverter, as suggested by Paolo.
15747 * cfold.cs (ConstantFold.Binary): Special case: perform constant
15748 folding of string concatenation, but if either side is a string,
15749 and the other is not, then return null, and let the runtime use
15750 the concatenation on the string plus the object (using
15751 `Object.ToString').
15753 2002-03-04 Miguel de Icaza <miguel@ximian.com>
15755 Constant Folding has been implemented now.
15757 * expression.cs (Unary.Reduce): Do not throw an exception, catch
15758 the error instead on types that are not supported in one's
15761 * constant.cs (Constant and all children): New set of functions to
15762 perform implict and explicit conversions.
15764 * ecore.cs (EnumConstant): Implement the new functions to perform
15765 conversion by proxying to the child expression.
15767 * codegen.cs: (ConstantCheckState): Constant evaluation has its
15768 own separate setting that can not be turned off from the command
15769 line using --unchecked or --checked and is only controlled using
15770 the checked/unchecked statements and expressions. This setting is
15771 used by the constant folder to flag errors.
15773 * expression.cs (CheckedExpr, UncheckedExpr): Set the
15774 ConstantCheckState as well.
15776 During Resolve, they also have to flag the state, because the
15777 constant folder runs completely in the Resolve phase.
15779 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
15782 2002-03-01 Miguel de Icaza <miguel@ximian.com>
15784 * cfold.cs: New file, this file contains the constant folder.
15786 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
15787 argument to track whether we are using the resulting address to
15788 load or store a value and provide better error messages.
15790 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
15791 new AddressOf arguments.
15793 * statement.cs (Foreach.EmitCollectionForeach): Update
15795 * expression.cs (Argument.Emit): Call AddressOf with proper
15796 arguments to track usage.
15798 (New.DoEmit): Call AddressOf with new arguments.
15800 (Unary.Emit): Adjust AddressOf call.
15802 2002-03-01 Ravi Pratap <ravi@ximian.com>
15804 * cs-parser.jay (member_access): Change the case for pre-defined types
15805 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
15808 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
15811 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
15812 essentially like methods and apply attributes like MethodImplOptions to them too.
15814 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
15817 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
15818 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
15821 * Update code everywhere accordingly.
15823 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
15825 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
15827 2002-02-28 Ravi Pratap <ravi@ximian.com>
15829 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
15830 try performing lookups against those instead of jumping straight into using
15831 the 'using' clauses.
15833 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
15835 (LookupType): Perform lookups in implicit parents too.
15837 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
15838 sequence as RootContext.LookupType.
15840 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
15841 the various cases of namespace lookups into this method.
15843 2002-03-01 Miguel de Icaza <miguel@ximian.com>
15845 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
15846 in positional arguments)
15848 * class.cs (Operator): Update the AllowedModifiers to contain
15851 * cs-parser.jay: Update operator declaration to allow for the
15852 operator body to be empty.
15854 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
15857 2002-02-27 Miguel de Icaza <miguel@ximian.com>
15859 * class.cs (Method.Emit): Label parameters.
15861 * driver.cs: Return 1 or 0 as the program exit code.
15863 2002-02-26 Miguel de Icaza <miguel@ximian.com>
15865 * expression.cs: Special case the `null' object when trying to
15866 auto-compute the type, as anything can be explicitly converted to
15869 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
15870 spotting this Paolo.
15872 (Expression.ImplicitNumericConversion): Perform comparissions of
15873 the type using the underlying type in the case of an enumeration
15874 rather than using the enumeration type for the compare.
15876 Cope with the underlying == type case, which is not possible to
15879 (Expression.ConvertNumericExplicit): Perform comparissions of
15880 the type using the underlying type in the case of an enumeration
15881 rather than using the enumeration type for the compare.
15883 * driver.cs: If the user does not supply an extension, assume .exe
15885 * cs-parser.jay (if_statement): Rewrote so that we can track the
15886 location for the if statement.
15888 * expression.cs (Binary.ConstantFold): Only concat strings when
15889 the operation is "+", not everything ;-)
15891 * statement.cs (Statement.EmitBoolExpression): Take a location
15893 (If, While, Do): Track location.
15895 * expression.cs (Binary.ResolveOperator): In the object + string
15896 case, I was missing a call to ConvertImplicit
15898 2002-02-25 Ravi Pratap <ravi@ximian.com>
15900 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
15901 Location arguments. Ensure we use RootContext.LookupType to do our work
15902 and not try to do a direct Type.GetType and ModuleBuilder.GetType
15904 * interface.cs (PopulateMethod): Handle the type of the parameter being
15907 * expression.cs (Invocation.BetterFunction): Handle the case when we
15908 have a params method with no fixed arguments and a call is made with no
15911 2002-02-25 Miguel de Icaza <miguel@ximian.com>
15913 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
15914 the verbatim-string-literal
15916 * support.cs (InternalParameters.ParameterModifier): handle null
15918 (InternalParameters.ParameterType): ditto.
15920 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
15921 duplicating the name of the variable parameter.
15922 (GetParameterByName): Fix bug where we were not looking up array
15923 paramters if they were the only present (thanks Paolo!).
15924 (GetParameterInfo): We only have an empty set of types if both
15925 fixed and array are set to null.
15926 (GetParameterInfo-idx): Handle FixedParameter == null
15928 * cs-parser.jay: Handle the case where there is no catch
15929 statements (missing null test).
15931 2002-02-22 Miguel de Icaza <miguel@ximian.com>
15933 * driver.cs (MainDriver): Be conservative on our command line
15936 Catch DirectoryNotFoundException when calling GetFiles.
15938 (SplitPathAndPattern): Used to split the input specification into
15939 a path and a pattern that we can feed to Directory.GetFiles.
15941 2002-02-21 Miguel de Icaza <miguel@ximian.com>
15943 * statement.cs (Fixed): Implement the last case of the Fixed
15944 statement (string handling).
15946 * expression.cs (StringPtr): New class used to return a char * to
15947 a string; Used by the Fixed statement.
15949 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
15951 * expression.cs (Binary.ResolveOperator): Remove redundant
15952 MemberLookup pn parent type.
15953 Optimize union call, we do not need a union if the types are the same.
15954 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
15957 Specialize the use of MemberLookup everywhere, instead of using
15958 the default settings.
15960 (StackAlloc): Implement stackalloc keyword.
15962 * cs-parser.jay: Add rule to parse stackalloc.
15964 * driver.cs: Handle /h, /help, /?
15966 * expression.cs (MakeByteBlob): Removed the hacks we had in place
15967 before we supported unsafe code.
15969 * makefile: add --unsafe to the self compilation of mcs.
15971 2002-02-20 Miguel de Icaza <miguel@ximian.com>
15973 * expression.cs (PointerArithmetic): New class that is used to
15974 perform pointer arithmetic.
15975 (Binary.Resolve): Handle pointer arithmetic
15976 Handle pointer comparission.
15977 (ArrayPtr): Utility expression class that is used to take the
15978 address of an array.
15980 (ElementAccess): Implement array access for pointers
15982 * statement.cs (Fixed): Implement fixed statement for arrays, we
15983 are missing one more case before we are done.
15985 * expression.cs (Indirection): Implement EmitAssign and set the
15986 ExprClass to Variable. This allows pointer dereferences to be
15987 treated as variables, and to have values assigned to them.
15989 * ecore.cs (Expression.StoreFromPtr): New utility function to
15990 store values dereferencing.
15992 2002-02-20 Ravi Pratap <ravi@ximian.com>
15994 * expression.cs (Binary.ResolveOperator): Ensure that we are
15995 not trying to operate on a void type - this fixes the reported
15998 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
15999 the parent implementation is sealed.
16001 * ../errors/cs0239.cs : Add.
16003 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16005 * typemanager.cs (unverifiable_code_type): Corresponds to
16006 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16007 which have unsafe code in them.
16009 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16012 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16014 * cs-tokenizer.cs: Add support for @"litreal strings"
16016 Make tokenizer accept pre-processor directives
16017 on any column (remove the old C-like limitation).
16019 * rootcontext.cs (EmitCode): Emit any global attributes.
16020 (AddGlobalAttributes): Used to keep track of assembly attributes.
16022 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16024 * cs-parser.jay: Add support for global attributes.
16026 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16028 * expression.cs (Indirection): New helper class. Unary will
16029 create Indirection classes to be able to implement the
16030 IMemoryLocation interface on it.
16032 2002-02-16 Miguel de Icaza <miguel@ximian.com>
16034 * cs-parser.jay (fixed_statement): reference the right statement.
16036 * statement.cs (Fixed.Emit): Finish implementing the fixed
16037 statement for the &x case.
16039 2002-02-14 Miguel de Icaza <miguel@ximian.com>
16041 * class.cs (Property.Define, Method.Define): Remove newslot when
16044 * modifiers.cs: My use of NewSlot when `Abstract' was set was
16045 wrong. NewSlot should only be used if the `new' keyword is present.
16047 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
16048 locating our system dir. Sorry about this.
16050 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16052 * driver.cs (GetSystemDir): Compute correctly the location of our
16053 system assemblies. I was using the compiler directory instead of
16054 the library directory.
16056 2002-02-13 Ravi Pratap <ravi@ximian.com>
16058 * expression.cs (BetterFunction): Put back in what Miguel commented out
16059 since it is the correct fix. The problem is elsewhere ;-)
16061 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
16062 parameters of the parms method are themselves compatible or not !
16064 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16065 to check that a class implements an interface before saying that an implicit
16066 conversion was allowed. Use ImplementsInterface to do the checking.
16068 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16070 * class.cs (Method.Define): Track whether we are an explicit
16071 implementation or not. And only call DefineMethodOverride if we
16072 are an explicit implementation.
16074 (Property.DefineMethod): Ditto.
16076 2002-02-11 Ravi Pratap <ravi@ximian.com>
16078 * expression.cs (BetterFunction): Catch hideous bug which was
16079 preventing us from detecting ambiguous calls due to implicit casts i.e
16082 2002-01-29 Miguel de Icaza <miguel@ximian.com>
16084 * support.cs (Pair): Remove un-needed method. I figured why I was
16085 getting the error in cs-parser.jay, the variable in a foreach loop
16086 is readonly, and the compiler does not really treat this as a variable.
16088 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
16089 instead of EQUALS in grammar.
16091 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
16093 * expression.cs (Unary.DoResolve): Check whether the argument is
16096 2002-01-28 Miguel de Icaza <miguel@ximian.com>
16098 * support.cs: Api for Pair to set a value. Despite the fact that
16099 the variables are public the MS C# compiler refuses to compile
16100 code that accesses the field if the variable is part of a foreach
16103 * statement.cs (Fixed): Begin implementation of the fixed
16106 (Block.AddVariable): Return the VariableInfo on success and null
16107 on failure instead of true/false.
16109 * cs-parser.jay (foreach): Catch errors on variables already
16110 defined (we were ignoring this value before) and properly unwind
16111 the block hierarchy
16113 (fixed_statement): grammar for the fixed statement.
16115 2002-01-25 Miguel de Icaza <miguel@ximian.com>
16117 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
16118 pointer types to be incretemented.
16120 (SizeOf): Implement.
16122 * cs-parser.jay (pointer_member_access): Implement
16123 expr->IDENTIFIER production.
16125 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
16126 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
16129 (Unary): Implement indirection.
16131 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
16132 use in non-unsafe context).
16134 (SimpleName.DoResolve): Check for pointers in field access on safe
16137 (Expression.LoadFromPtr): Factor the load-indirect code in this
16138 function. This was duplicated in UnboxCast and ParameterReference
16140 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16142 * expression.cs (ComposedCast): report an error if a pointer cast
16143 is used in a safe region.
16145 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16146 pointer type casts in unsafe context.
16148 * codegen.cs (EmitContext): Set up IsUnsafe.
16150 * cs-parser.jay (non_expression_type): Add productions for pointer
16153 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16154 code. We should not use force into static mode if the method is
16155 not virtual. Fixes bug in MIS
16157 * statement.cs (Do.Emit, While.Emit, For.Emit,
16158 Statement.EmitBoolExpression): Add support to Do and While to
16159 propagate infinite loop as `I do return' semantics.
16161 Improve the For case to also test for boolean constants.
16163 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16164 to the list of attributes we can add.
16166 Remove `EmitContext' argument.
16168 * class.cs (Method.Define): Apply parameter attributes.
16169 (Constructor.Define): Apply parameter attributes.
16170 (MethodCore.LabelParameters): Move here the core of labeling
16173 * support.cs (ReflectionParameters.ParameterModifier,
16174 InternalParameters.ParameterModifier): Use IsByRef on the type and
16175 only return the OUT bit for these parameters instead of in/out/ref
16178 This is because I miss-understood things. The ParameterInfo.IsIn
16179 and IsOut represent whether the parameter has the [In] and [Out]
16182 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16184 * ecore.cs (FieldExpr.Emit): Release temporaries.
16186 * assign.cs (LocalTemporary.Release): new function.
16188 * codegen.cs (EmitContext.GetTemporaryStorage,
16189 EmitContext.FreeTemporaryStorage): Rework the way we deal with
16190 temporary storage. Now we can "put back" localbuilders when we
16193 2002-01-21 Miguel de Icaza <miguel@ximian.com>
16195 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
16196 need to make a copy of the variable to generate verifiable code.
16198 2002-01-19 Miguel de Icaza <miguel@ximian.com>
16200 * driver.cs: Compute dynamically the system directory.
16202 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
16203 Slower, but more generally useful. Used by the abstract
16204 registering implementation.
16206 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
16207 the rules for the special rule on Type/instances. First check if
16208 we have the same name, and if so, try that special static path
16209 rather than the instance path.
16211 2002-01-18 Miguel de Icaza <miguel@ximian.com>
16213 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
16216 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
16217 Enum, ValueType, Delegate or Array for non-corlib compiles.
16219 * cs-tokenizer.cs: Catch long identifiers (645)
16221 * typemanager.cs (IndexerPropetyName): Ravi never tested this
16224 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
16225 fix, we were returning too early, so we were not registering
16226 pending methods from abstract classes.
16228 Do not register pending methods if the class is abstract.
16230 * expression.cs (Conditional.DoResolve): Report circular implicit
16231 conversions when we neecd to compute it for conditional
16234 (Is.DoResolve): If the expression is always of the provided type,
16235 flag warning 183. If the expression can not ever be of the
16236 provided type flag warning 184.
16238 * class.cs: Catch 169 as well.
16240 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
16243 2002-01-18 Nick Drochak <ndrochak@gol.com>
16245 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
16247 2002-01-17 Miguel de Icaza <miguel@ximian.com>
16249 * interface.cs: (PopulateMethod): Check for pointers being defined
16250 only if the unsafe context is active.
16251 (PopulateProperty): ditto.
16252 (PopulateIndexer): ditto.
16254 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
16255 specified. If pointers are present, make sure that they are
16256 present in an unsafe context.
16257 (Constructor, Constructor.Define): ditto.
16258 (Field, Field.Define): ditto.
16259 (Property, Property.Define): ditto.
16260 (Event, Event.Define): ditto.
16262 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
16263 hashtable if there are classes or structs defined.
16265 * expression.cs (LocalVariableReference.DoResolve): Simplify this
16266 code, as the constant resolution moved.
16268 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
16269 the metadata, so we can flag error 133.
16271 * decl.cs (MemberCore.UnsafeOK): New function to test that a
16272 pointer is being declared in an unsafe context.
16274 2002-01-16 Miguel de Icaza <miguel@ximian.com>
16276 * modifiers.cs (Modifiers.Check): Require a Location argument.
16277 Report error 227 for Unsafe use.
16279 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
16281 * statement.cs (For.Emit): If the test is null, then report that
16282 we do `return', as we wont reach anything afterwards.
16284 (Switch.SwitchGoverningType): Track the expression that matched
16287 * driver.cs: Allow negative numbers as an error code to flag.
16289 * cs-parser.jay: Handle 1551.
16291 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
16293 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16295 * cs-parser.jay: Report 1518 (type declaration can only contain
16296 class, struct, interface, enum or delegate)
16298 (switch_label): Report 1523 (keywords `case' or `default' must
16301 (opt_switch_sections): Report 1522 (empty switch)
16303 * driver.cs: Report 1515 (response file specified multiple times)
16304 Report 1516 (Source file specified multiple times).
16306 * expression.cs (Argument.Resolve): Signal 1510
16308 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
16309 access not allowed in static code)
16311 2002-01-11 Ravi Pratap <ravi@ximian.com>
16313 * typemanager.cs (IsPointerType): Utility method which we are going
16316 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
16317 the object type, so we take care of that.
16319 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
16321 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
16322 added to non-params parameters :-)
16324 * typemanager.cs (CSharpName): Include 'void' type too.
16326 (void_ptr_type): Include in the set of core types.
16328 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
16331 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
16334 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
16335 completely forgotten about it.
16337 2002-01-10 Ravi Pratap <ravi@ximian.com>
16339 * cs-parser.jay (pointer_type): Add. This begins our implementation
16340 of parsing rules for unsafe code.
16342 (unsafe_statement): Implement.
16344 (embedded_statement): Modify to include the above.
16346 * statement.cs (Unsafe): Implement new class for unsafe blocks.
16348 * codegen.cs (EmitContext.InUnsafe): Add. This determines
16349 if the current context is an unsafe one.
16351 * cs-parser.jay (local_variable_pointer_type): Since local variable types
16352 are handled differently, we need separate rules for them.
16354 (local_variable_declaration): Update to use local_variable_pointer_type
16355 to allow variable declarations of unmanaged pointer types.
16357 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
16358 in unsafe contexts.
16360 * ../errors/cs0214.cs : Add.
16362 2002-01-16 Nick Drochak <ndrochak@gol.com>
16364 * makefile: remove 'response' file when cleaning.
16366 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16368 * cs-parser.jay: Report 1524.
16370 2002-01-14 Miguel de Icaza <miguel@ximian.com>
16372 * typemanager.cs (RegisterMethod): drop checking if we have
16373 registered this from here
16375 2002-01-12 Miguel de Icaza <miguel@ximian.com>
16377 * class.cs (Method.EmitDestructor): Implement calling our base
16380 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
16381 value of InFinally.
16383 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
16384 this routine and will wrap the call in a try/catch block. Deal
16387 2002-01-11 Miguel de Icaza <miguel@ximian.com>
16389 * ecore.cs (Expression.MemberLookup): instead of taking a
16390 parameter `same_type' that was used to tell whether we could
16391 access private members we compute our containing type from the
16394 (FieldExpr): Added partial support for volatile fields. This does
16395 not work for volatile fields exposed from assemblies, as I can not
16396 figure out how to extract the modreq from it.
16398 Updated all the source files to use this.
16400 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
16401 because it is referenced by MemberLookup very often.
16403 2002-01-09 Ravi Pratap <ravi@ximian.com>
16405 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
16406 TypeBuilder.GetCustomAttributes to retrieve what we need.
16408 Get rid of redundant default_member_attr_type as this is the same as
16409 default_member_type which already exists.
16411 * interface.cs, attribute.cs : Update accordingly.
16413 2002-01-08 Miguel de Icaza <miguel@ximian.com>
16415 * typemanager.cs: Enable IndexerPropertyName again. It does not
16416 work for TYpeBuilders though. Ravi, can you please fix this?
16418 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
16420 * expression.cs (Argument.Emit): Handle the case of ref objects
16421 being passed to ref functions;
16423 (ParameterReference.EmitLoad): Loads the content of the pointer
16424 without dereferencing.
16426 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16428 * cs-tokenizer.cs: Implemented the pre-processing expressions.
16430 2002-01-08 Ravi Pratap <ravi@ximian.com>
16432 * class.cs (Indexer.DefineMethod): Incorporate the interface
16433 type in the name of the method if we are doing explicit interface
16436 * expression.cs (ConversionExists): Remove as it is completely obsolete.
16438 (BetterConversion): Fix extremely trivial bug where we were referring to
16439 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
16442 * ../errors/bug16.cs : Add although we have fixed it.
16444 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16446 * expression.cs (BaseIndexer): Begin implementation.
16448 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
16450 * cs-parser.jay (indexer_declarator): Use qualified_identifier
16451 production directly to remove a shift/reduce, and implement
16452 explicit interface implementation.
16454 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
16455 after a floating point suffix.
16457 * expression.cs (DoNumericPromotions): Improved the conversion for
16458 uint/uint. If we have a constant, we avoid doing a typecast to a
16461 * class.cs (Indexer): Implement explicit interface implementation
16464 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
16466 * class.cs: make the default instance constructor public and hidebysig.
16468 2001-01-03 Ravi Pratap <ravi@ximian.com>
16470 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
16471 so we can call it from elsewhere.
16473 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
16474 we emit it internally if the class has a defined indexer; otherwise the user
16475 emits it by decorating the class definition with the DefaultMemberAttribute.
16477 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
16478 attribute is not used on a type which defines an indexer.
16480 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
16481 character when we skip whitespace.
16483 * ../errors/cs0646.cs : Add.
16485 2002-01-03 Miguel de Icaza <miguel@ximian.com>
16487 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
16490 * makefile: Add practical target `mcs3.exe' which builds the third
16491 generation compiler.
16493 * expression.cs (New): Fix structures constructor calling.
16495 * class.cs (Property, Method, Indexer): Emit Final flag on the
16496 method if we are an interface implementation and we are not
16499 * ecore.cs (PropertyExpr): New public field `IsBase', tells
16500 whether this property is referencing a `base' method.
16502 * expression.cs (Invocation.EmitCall): take an extra argument:
16503 is_base, this is used to determine whether the `call' or
16504 `callvirt' opcode should be used.
16507 * delegate.cs: update EmitCall.
16509 * class.cs (Method.Define): Set NewSlot for the cases where we are
16510 not implementing an interface method.
16512 (Property.Define): ditto.
16514 2002-01-02 Miguel de Icaza <miguel@ximian.com>
16516 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
16517 'r'. Allows mcs to parse itself fully.
16519 2002-01-02 Ravi Pratap <ravi@ximian.com>
16521 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
16522 of the number of initializers that require the InitializeArray method.
16524 (CheckIndices): Store the Expression in all cases - not the plain value. Also
16525 update the above field where necessary.
16527 (MakeByteBlob): Update accordingly.
16529 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
16532 (EmitDynamicInitializers): Update in accordance with the new optimization.
16534 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
16535 same OpCode applies.
16537 * cs-parser.jay : Fix some glaring errors I introduced.
16539 2002-01-01 Ravi Pratap <ravi@ximian.com>
16541 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
16542 so that we can check for name clashes there too.
16544 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
16545 for interface indexers.
16547 * interfaces.cs (Define): Emit the default member attribute.
16549 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
16550 variable was being referred to while setting the value ;-)
16552 2002-01-01 Miguel de Icaza <miguel@ximian.com>
16554 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
16555 byte-by-byte information when we know the data is zero.
16557 Make the block always a multiple of 4, because
16558 DefineInitializedData has a bug.
16560 * assign.cs: Fix, we should assign from the temporary, not from
16563 * expression.cs (MakeByteBlob): Fix my incorrect code.
16565 2001-12-31 Miguel de Icaza <miguel@ximian.com>
16567 * typemanager.cs (EnumToUnderlying): This function is used to get
16568 the underlying type from an enumeration, because it does not
16571 * constant.cs: Use the I4_S form for values between -128 and 127.
16573 * statement.cs (Block.LookupLabel): Looks up a label.
16574 (Block): Drop support for labeled blocks.
16576 (LabeledStatement): New kind of statement that represents a label
16579 (Goto): Finally implement this bad boy.
16581 * cs-parser.jay: Update to reflect new mechanism to implement
16584 2001-12-30 Miguel de Icaza <miguel@ximian.com>
16586 * codegen.cs (EmitContext.This): a codegen property that keeps the
16587 a single instance of this instead of creating many different this
16590 * delegate.cs (Delegate.DoResolve): Update to use the property;
16592 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
16594 * expression.cs (BaseAccess.DoResolve): Ditto.
16596 2001-12-29 Ravi Pratap <ravi@ximian.com>
16598 * typemanager.cs (methodimpl_attr_type): Add to hold the type
16599 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
16601 (InitCoreTypes): Update accordingly.
16603 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
16604 so we can quickly store the state.
16606 (ApplyAttributes): Set the correct implementation flags
16607 for InternalCall methods.
16609 2001-12-29 Miguel de Icaza <miguel@ximian.com>
16611 * expression.cs (EmitCall): if a method is not virtual, then do
16612 not use callvirt on it.
16614 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
16615 user defined stuff) requires the use of stobj, which takes an
16616 address on the stack instead of an array and an index. So emit
16617 the Ldelema operation for it.
16619 (EmitStoreOpcode): Use stobj for valuetypes.
16621 (UnaryMutator.EmitCode): Use the right 1 value depending on
16622 whether we are dealing with int64/uint64, float or doubles.
16624 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
16625 constructors that I implemented last night.
16627 (Constructor.IsDefault): Fix to work properly for static
16630 * cs-parser.jay (CheckDef): report method signature errors.
16631 Update error number 103 to be 132.
16633 * decl.cs: New AdditionResult enumeration value: MethodExists.
16634 Although we do this check for methods later on in the semantic
16635 analysis, catching repeated default constructors is so easy that
16636 we catch these here.
16638 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
16641 (ParameterReference.EmitAssign, Emit): handle
16644 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
16645 (ArrayAccess.EmitStoreOpcode): ditto.
16647 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
16649 * expression.cs (MakeByteBlob): Complete all the missing types
16650 (uint, short, ushort, byte, sbyte)
16652 * class.cs: Only init instance field initializers on instance
16655 Rename `constructors' to instance_constructors.
16657 (TypeContainer.AddConstructor): Only add constructors to the list
16658 if it is not static.
16660 Make sure that we handle default_static_constructor independently
16661 everywhere where we handle instance_constructors
16663 2001-12-28 Miguel de Icaza <miguel@ximian.com>
16665 * class.cs: Do not lookup or create a base initializer for a
16666 static constructor.
16668 (ConstructorInitializer.Resolve): use the proper type to lookup
16671 * cs-parser.jay: Report error 1585 (modifiers between type and name).
16673 * enum.cs, interface.cs: Remove CloseType, this is taken care by
16676 * decl.cs: CloseType is now an virtual method, the default
16677 implementation just closes this type.
16679 2001-12-28 Ravi Pratap <ravi@ximian.com>
16681 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
16682 to PreserveSig by default. Also emit HideBySig on such methods.
16684 Basically, set the defaults to standard values.
16686 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
16687 argument, if candidate is better, it can't be worse than the best !
16689 (Invocation): Re-write bits to differentiate between methods being
16690 applicable in their expanded form and their normal form - for params
16693 Get rid of use_standard everywhere as only standard conversions are allowed
16694 in overload resolution.
16696 More spec conformance.
16698 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16700 * driver.cs: Add --timestamp, to see where the compiler spends
16703 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
16704 `this' in static code.
16706 (SimpleName.DoResolve): Implement in terms of a helper function
16707 that allows static-references to be passed upstream to
16710 (Expression.ResolveWithSimpleName): Resolve specially simple
16711 names when called by MemberAccess to implement the special
16714 (Expression.ImplicitReferenceConversion): Handle conversions from
16715 Null to reference types before others, as Null's type is
16718 * expression.cs (Invocation.EmitCall): Handle the special case of
16719 calling methods declared on a reference type from a ValueType
16720 (Base classes System.Object and System.Enum)
16722 (MemberAccess.Resolve): Only perform lookups on Enumerations if
16723 the left hand side is a TypeExpr, not on every enumeration.
16725 (Binary.Resolve): If types are reference types, then do a cast to
16726 object on operators != and == of both arguments.
16728 * typemanager.cs (FindMembers): Extract instance and static
16729 members if requested.
16731 * interface.cs (PopulateProperty): Use void_type instead of null
16732 as the return type for the setter method.
16734 (PopulateIndexer): ditto.
16736 2001-12-27 Ravi Pratap <ravi@ximian.com>
16738 * support.cs (ReflectionParameters): Fix minor bug where we
16739 were examining the wrong parameter for the ParamArray attribute.
16741 Cope with requests for the type of the parameter at position
16742 greater than the params parameter's. We now return the element
16743 type of the params array as that makes more sense.
16745 * expression.cs (Invocation.IsParamsMethodApplicable): Update
16746 accordingly as we no longer have to extract the element type
16749 (Invocation.OverloadResolve): Update.
16751 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16753 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
16754 against IEnumerator, test whether the return value is a descendant
16755 of the IEnumerator interface.
16757 * class.cs (Indexer.Define): Use an auxiliary method to implement
16758 the other bits of the method definition. Begin support for
16759 explicit interface implementation.
16761 (Property.DefineMethod): Use TypeManager.void_type instead of null
16762 for an empty return value.
16764 2001-12-26 Miguel de Icaza <miguel@ximian.com>
16766 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
16767 dealing with a FieldExpr which is composed of a FieldBuilder, in
16768 the code path we did extract the constant, but we should have
16769 obtained the underlying value to be able to cast it (otherwise we
16770 end up in an infinite loop, this is what Ravi was running into).
16772 (ArrayCreation.UpdateIndices): Arrays might be empty.
16774 (MemberAccess.ResolveMemberAccess): Add support for section
16775 14.5.4.1 that deals with the special case of E.I when E is a type
16776 and something else, that I can be a reference to a static member.
16778 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
16779 handle a particular array type to create byte blobs, it is just
16780 something we dont generate byteblobs for.
16782 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
16785 * location.cs (Push): remove the key from the hashtable that we
16786 are about to add. This happens for empty files.
16788 * driver.cs: Dispose files after we have parsed them.
16790 (tokenize): new function that only runs the tokenizer on its
16791 input, for speed testing.
16793 2001-12-26 Ravi Pratap <ravi@ximian.com>
16795 * class.cs (Event.Define): Define the private field only if there
16796 are no accessors defined.
16798 * expression.cs (ResolveMemberAccess): If there is no associated
16799 field with the event, that means we have an event defined with its
16800 own accessors and we should flag error cs0070 since transforming
16801 ourselves into a field is not valid in that case.
16803 * ecore.cs (SimpleName.DoResolve): Same as above.
16805 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
16806 and charset to sane values.
16808 2001-12-25 Ravi Pratap <ravi@ximian.com>
16810 * assign.cs (DoResolve): Perform check on events only if they
16811 are being accessed outside the declaring type.
16813 * cs-parser.jay (event_declarations): Update rules to correctly
16814 set the type of the implicit parameter etc.
16816 (add_accessor, remove_accessor): Set current local parameters.
16818 * expression.cs (Binary): For delegate addition and subtraction,
16819 cast the return value from the method into the appropriate delegate
16822 2001-12-24 Ravi Pratap <ravi@ximian.com>
16824 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
16825 of these as the workaround is unnecessary.
16827 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
16828 delegate data - none of that is needed at all.
16830 Re-write bits to extract the instance expression and the delegate method
16833 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
16836 * attribute.cs (ApplyAttributes): New method to take care of common tasks
16837 of attaching attributes instead of duplicating code everywhere.
16839 * everywhere : Update code to do attribute emission using the above method.
16841 2001-12-23 Miguel de Icaza <miguel@ximian.com>
16843 * expression.cs (IsParamsMethodApplicable): if there are not
16844 parameters, return immediately.
16846 * ecore.cs: The 0 literal can be implicity converted to an enum
16849 (SimpleName.DoResolve): First lookup the type, then lookup the
16852 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
16853 want to get its address. If the InstanceExpression is not
16854 addressable, store the result in a temporary variable, then get
16857 * codegen.cs: Only display 219 errors on warning level or above.
16859 * expression.cs (ArrayAccess): Make it implement the
16860 IMemoryLocation interface.
16862 (Binary.DoResolve): handle the operator == (object a, object b)
16863 and operator != (object a, object b) without incurring into a
16864 BoxedCast (because 5 != o should never be performed).
16866 Handle binary enumerator operators.
16868 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
16869 value type, otherwise use Ldelem_ref.
16871 Use precomputed names;
16873 (AddressOf): Implement address of
16875 * cs-parser.jay (labeled_statement): Fix recursive block
16876 addition by reworking the production.
16878 * expression.cs (New.DoEmit): New has a special case:
16880 If we are dealing with a ValueType, we have a few
16881 situations to deal with:
16883 * The target of New is a ValueType variable, that is
16884 easy, we just pass this as the variable reference
16886 * The target of New is being passed as an argument,
16887 to a boxing operation or a function that takes a
16890 In this case, we need to create a temporary variable
16891 that is the argument of New.
16894 2001-12-23 Ravi Pratap <ravi@ximian.com>
16896 * rootcontext.cs (LookupType): Check that current_type is not null before
16897 going about looking at nested types.
16899 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
16900 not implement the IAssignMethod interface any more.
16902 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
16903 where we tranform them into FieldExprs if they are being resolved from within
16904 the declaring type.
16906 * ecore.cs (SimpleName.DoResolve): Do the same here.
16908 * assign.cs (DoResolve, Emit): Clean up code considerably.
16910 * ../errors/bug10.cs : Add.
16912 * ../errors/cs0070.cs : Add.
16914 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
16916 * assign.cs : Get rid of EventIsLocal everywhere.
16918 2001-12-23 Miguel de Icaza <miguel@ximian.com>
16920 * ecore.cs (ConvertIntLiteral): finished the implementation.
16922 * statement.cs (SwitchLabel): Convert the value we are using as a
16923 key before looking up the table.
16925 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16927 * codegen.cs (EmitTopBlock): Require a Location argument now.
16929 * cs-parser.jay (constructor_declarator): We need to setup
16930 current_local_parameters before we parse the
16931 opt_constructor_initializer, to allow the variables to be bound
16932 to the constructor arguments.
16934 * rootcontext.cs (LookupType): First lookup nested classes in our
16935 class and our parents before we go looking outside our class.
16937 * expression.cs (ConstantFold): Extract/debox the values at the
16940 * rootcontext.cs (EmitCode): Resolve the constants first before we
16941 resolve the types. This is not really needed, but it helps debugging.
16943 * statement.cs: report location.
16945 * cs-parser.jay: pass location to throw statement.
16947 * driver.cs: Small bug fix.
16949 * report.cs: Updated format to be 4-zero filled digits.
16951 2001-12-22 Ravi Pratap <ravi@ximian.com>
16953 * expression.cs (CheckIndices): Fix minor bug where the wrong
16954 variable was being referred to ;-)
16956 (DoEmit): Do not call EmitStaticInitializers when the
16957 underlying type is System.Object.
16959 2001-12-21 Ravi Pratap <ravi@ximian.com>
16961 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
16962 and do the usual workaround for SRE.
16964 * class.cs (MyEventBuilder.EventType): New member to get at the type
16965 of the event, quickly.
16967 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
16969 * assign.cs (Assign.DoResolve): Handle the case when the target
16970 is an EventExpr and perform the necessary checks.
16972 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
16975 (SimpleName.MemberStaticCheck): Include check for EventExpr.
16977 (EventExpr): Set the type in the constructor itself since we
16978 are meant to be born fully resolved.
16980 (EventExpr.Define): Revert code I wrote earlier.
16982 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
16983 instance expression is null. The instance expression is a This in that case
16984 or a null, depending on whether it is a static method or not.
16986 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
16987 refers to more than one method.
16989 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
16990 and accordingly flag errors.
16992 2001-12-21 Miguel de Icaza <miguel@ximian.com>
16994 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
16996 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16998 * location.cs (ToString): Provide useful rutine.
17000 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17002 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17003 objects, return the actual integral boxed.
17005 * statement.cs (SwitchLabel): define an ILLabel for each
17008 (Switch.CheckSwitch): If the value is a Literal, extract
17009 the underlying literal.
17011 Also in the unused hashtable we had, add the SwitchLabel so we can
17012 quickly look this value up.
17014 * constant.cs: Implement a bunch of new constants. Rewrite
17015 Literal based on this. Made changes everywhere to adapt to this.
17017 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17018 dereferencing array only once, and also copes with enumrations.
17020 bytes are two bytes wide, not one.
17022 (Cast): Perform constant conversions.
17024 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17025 wrappers to the literals here.
17027 * expression.cs (DoNumericPromotions): long literals can converted
17028 to ulong implicity (this is taken care of elsewhere, but I was
17029 missing this spot).
17031 * ecore.cs (Expression.Literalize): Make the return type Literal,
17032 to improve type checking.
17034 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
17036 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17038 * literal.cs: Revert code from ravi that checked the bounds. The
17039 bounds are sane by the definition of the type itself.
17041 * typemanager.cs: Fix implementation of ImplementsInterface. We
17042 need to actually look up in our parent hierarchy for interfaces
17045 * const.cs: Use the underlying type for enumerations
17047 * delegate.cs: Compute the basename for the delegate creation,
17048 that should fix the delegate test case, and restore the correct
17049 Type Lookup semantics in rootcontext
17051 * rootcontext.cs: Revert Ravi's last patch. The correct way of
17052 referencing a nested type with the Reflection API is using the "+"
17055 * cs-parser.jay: Do not require EOF token at the end.
17057 2001-12-20 Ravi Pratap <ravi@ximian.com>
17059 * rootcontext.cs (LookupType): Concatenate type names with
17060 a '.' instead of a '+' The test suite passes again.
17062 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
17063 field of the enumeration.
17065 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
17066 the case when the member is an EventExpr.
17068 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
17069 static has an associated instance expression.
17071 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
17073 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
17075 * class.cs (Event.Define): Register event and perform appropriate checks
17078 We define the Add and Remove methods even if the use provides none because
17079 in that case, we provide default implementations ourselves.
17081 Define a private field of the type of the event. This is done by the CSC compiler
17082 and we should be doing it too ;-)
17084 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
17085 More methods we use in code we generate.
17087 (multicast_delegate_type, delegate_type): Two separate types since the distinction
17090 (InitCoreTypes): Update accordingly for the above.
17092 * class.cs (Event.Emit): Generate code for default accessors that we provide
17094 (EmitDefaultMethod): Do the job in the above.
17096 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
17099 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17101 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
17102 builders even if we were missing one.
17104 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
17105 pass the Basename as our class name instead of the Name. The
17106 basename will be correctly composed for us.
17108 * parameter.cs (Paramters): Now takes a Location argument.
17110 * decl.cs (DeclSpace.LookupType): Removed convenience function and
17111 make all the code call directly LookupType in RootContext and take
17112 this chance to pass the Location information everywhere.
17114 * Everywhere: pass Location information.
17116 2001-12-19 Miguel de Icaza <miguel@ximian.com>
17118 * class.cs (Constructor.Define): Updated way of detecting the
17119 length of the parameters.
17121 (TypeContainer.DefineType): Use basename as the type name for
17124 (TypeContainer.Define): Do not recursively define types here, as
17125 definition is taken care in order by the RootContext.
17127 * tree.cs: Keep track of namespaces in a per-file basis.
17129 * parameter.cs (Parameter.ComputeSignature): Update to use
17132 (Parameters.GetSignature): ditto.
17134 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
17135 instead of a TypeContainer.
17137 (Interface.SemanticAnalysis): Use `this' instead of our parent to
17138 resolve names. Because we need to be resolve in our context, not
17141 * driver.cs: Implement response files.
17143 * class.cs (TypeContainer.DefineType): If we are defined, do not
17144 redefine ourselves.
17146 (Event.Emit): Emit the code for add/remove handlers.
17147 (Event.Define): Save the MethodBuilders for add/remove.
17149 * typemanager.cs: Use pair here too.
17151 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17152 DictionaryEntry requires the first argument to be non-null.
17154 (enum_declaration): Compute full name for registering the
17157 (delegate_declaration): Instead of using
17158 formal_parameter_list, use opt_formal_parameter_list as the list
17161 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17162 (EventParsing): New property that controls whether `add' and
17163 `remove' are returned as tokens or identifiers (for events);
17165 2001-12-19 Ravi Pratap <ravi@ximian.com>
17167 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17168 use MyEventBuilder only and let it wrap the real builder for us.
17170 (MyEventBuilder): Revamp constructor etc.
17172 Implement all operations that we perform on EventBuilder in precisely the same
17175 (FindMembers): Update to use the EventBuilder member.
17177 (Event.Emit): Update accordingly.
17179 2001-12-18 Ravi Pratap <ravi@ximian.com>
17181 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17182 by calling the appropriate methods.
17184 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17187 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17189 2001-12-17 Ravi Pratap <ravi@ximian.com>
17191 * delegate.cs (Delegate.Populate): Check that the return type
17192 and various parameters types are indeed accessible.
17194 * class.cs (Constructor.Define): Same here.
17196 (Field.Define): Ditto.
17198 (Event.Define): Ditto.
17200 (Operator.Define): Check that the underlying Method defined itself
17201 correctly - so it's MethodBuilder should not be null.
17203 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
17204 expression happens to be null.
17206 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
17207 members but as of now we don't seem to be able to do anything really useful with it.
17209 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
17210 not the EventBuilder.
17212 2001-12-18 Miguel de Icaza <miguel@ximian.com>
17214 * cs-tokenizer.cs: Add support for defines.
17215 Add support for #if, #elif, #else, #endif
17217 (eval_var): evaluates a variable.
17218 (eval): stubbed for evaluating functions.
17220 * cs-parser.jay: Pass the defines information
17222 * driver.cs: Add --define command line option.
17224 * decl.cs: Move MemberCore here.
17226 Make it the base class for DeclSpace. This allows us to catch and
17227 report 108 and 109 for everything now.
17229 * class.cs (TypeContainer.Define): Extract all the members
17230 before populating and emit the warning 108 (new keyword required
17231 to override) instead of having each member implement this.
17233 (MemberCore.Define): New abstract method, we will be using this in
17234 the warning reporting engine in Populate.
17236 (Operator.Define): Adjust to new MemberCore protocol.
17238 * const.cs (Const): This does not derive from Expression, it is a
17239 temporary object we use to create fields, it is a MemberCore.
17241 * class.cs (Method.Define): Allow the entry point to be in a
17244 * driver.cs: Rewrite the argument handler to clean it up a bit.
17246 * rootcontext.cs: Made it just an auxiliary namespace feature by
17247 making everything static.
17249 * driver.cs: Adapt code to use RootContext type name instead of
17252 * delegate.cs: Remove RootContext argument.
17254 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
17257 * class.cs (Event.Define): The lookup can fail.
17259 * cs-tokenizer.cs: Begin implementation of pre-procesor.
17261 * expression.cs: Resolve the this instance before invoking the code.
17263 2001-12-17 Miguel de Icaza <miguel@ximian.com>
17265 * cs-parser.jay: Add a production in element_access that allows
17266 the thing to become a "type" reference. This way we can parse
17267 things like "(string [])" as a type.
17269 Note that this still does not handle the more complex rules of
17273 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
17275 * ecore.cs: (CopyNewMethods): new utility function used to
17276 assemble the list of methods from running FindMembers.
17278 (MemberLookup): Rework FindMembers so that
17280 2001-12-16 Miguel de Icaza <miguel@ximian.com>
17282 * class.cs (TypeContainer): Remove Delegates who fail to be
17285 * delegate.cs (Populate): Verify that we dont get null return
17286 values. TODO: Check for AsAccessible.
17288 * cs-parser.jay: Use basename to emit error 574 (destructor should
17289 have the same name as container class), not the full name.
17291 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
17292 possible representation.
17294 Also implements integer type suffixes U and L.
17296 2001-12-15 Miguel de Icaza <miguel@ximian.com>
17298 * expression.cs (ArrayCreation.DoResolve): We need to do the
17299 argument resolution *always*.
17301 * decl.cs: Make this hold the namespace. Hold the root context as
17303 (LookupType): Move here.
17305 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
17307 * location.cs (Row, Name): Fixed the code, it was always returning
17308 references to the first file.
17310 * interface.cs: Register properties defined through interfaces.
17312 * driver.cs: Add support for globbing on the command line
17314 * class.cs (Field): Make it derive from MemberCore as well.
17317 2001-12-15 Ravi Pratap <ravi@ximian.com>
17319 * class.cs (Event::Define): Check that the type of the event is a delegate
17320 type else flag error #66.
17322 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
17325 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
17326 values of EntryPoint, CharSet etc etc.
17328 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
17330 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
17331 be null and we should ignore this. I am not sure if this is really clean. Apparently,
17332 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
17333 which needs this to do its work.
17335 * ../errors/cs0066.cs : Add.
17337 2001-12-14 Miguel de Icaza <miguel@ximian.com>
17339 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
17342 * class.cs: (MethodSignature.MethodSignature): Removed hack that
17343 clears out the parameters field.
17344 (MemberSignatureCompare): Cleanup
17346 (MemberCore): New base class used to share code between MethodCore
17349 (RegisterRequiredImplementations) BindingFlags.Public requires
17350 either BindingFlags.Instace or Static. Use instance here.
17352 (Property): Refactored code to cope better with the full spec.
17354 * parameter.cs (GetParameterInfo): Return an empty array instead
17357 * class.cs (Property): Abstract or extern properties have no bodies.
17359 * parameter.cs (GetParameterInfo): return a zero-sized array.
17361 * class.cs (TypeContainer.MethodModifiersValid): Move all the
17362 method modifier validation to the typecontainer so we can reuse
17363 this on properties.
17365 (MethodCore.ParameterTypes): return an empty sized array of types.
17367 (Property.Define): Test property modifier validity.
17369 Add tests for sealed/override too.
17371 (Method.Emit): abstract or extern methods have no bodies.
17373 2001-12-14 Ravi Pratap <ravi@ximian.com>
17375 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
17378 (Method::Define, ::Emit): Modify accordingly.
17380 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
17382 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
17384 * makefile: Pass in /unsafe.
17386 2001-12-13 Miguel de Icaza <miguel@ximian.com>
17388 * class.cs (MakeKey): Kill routine.
17390 * class.cs (TypeContainer.Define): Correctly define explicit
17391 method implementations (they require the full interface name plus
17394 * typemanager.cs: Deply the PtrHashtable here and stop using the
17395 lame keys. Things work so much better.
17397 This of course broke everyone who depended on `RegisterMethod' to
17398 do the `test for existance' test. This has to be done elsewhere.
17400 * support.cs (PtrHashtable): A hashtable that avoid comparing with
17401 the object stupid Equals method (because, that like fails all over
17402 the place). We still do not use it.
17404 * class.cs (TypeContainer.SetRequiredInterface,
17405 TypeContainer.RequireMethods): Killed these two routines and moved
17406 all the functionality to RegisterRequiredImplementations.
17408 (TypeContainer.RegisterRequiredImplementations): This routine now
17409 registers all the implementations required in an array for the
17410 interfaces and abstract methods. We use an array of structures
17411 which can be computed ahead of time to reduce memory usage and we
17412 also assume that lookups are cheap as most classes will not
17413 implement too many interfaces.
17415 We also avoid creating too many MethodSignatures.
17417 (TypeContainer.IsInterfaceMethod): Update and optionally does not
17418 clear the "pending" bit if we find that there are problems with
17421 (TypeContainer.VerifyPendingMethods): Update to report errors of
17422 methods that look like implementations but are not.
17424 (TypeContainer.Define): Add support for explicit interface method
17427 2001-12-12 Miguel de Icaza <miguel@ximian.com>
17429 * typemanager.cs: Keep track of the parameters here instead of
17430 being a feature of the TypeContainer.
17432 * class.cs: Drop the registration of parameters here, as
17433 InterfaceMethods are also interface declarations.
17435 * delegate.cs: Register methods with the TypeManager not only with
17436 the TypeContainer. This code was buggy.
17438 * interface.cs: Full registation here.
17440 2001-12-11 Miguel de Icaza <miguel@ximian.com>
17442 * expression.cs: Remove reducer for binary expressions, it can not
17445 * const.cs: Put here the code that used to go into constant.cs
17447 * constant.cs: Put here the code for constants, this is a new base
17448 class for Literals.
17450 * literal.cs: Make Literal derive from Constant.
17452 2001-12-09 Miguel de Icaza <miguel@ximian.com>
17454 * statement.cs (Return.Emit): Report error 157 if the user
17455 attempts to return from a finally block.
17457 (Return.Emit): Instead of emitting a return, jump to the end of
17460 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
17461 LocalBuilder to store the result of the function. ReturnLabel is
17462 the target where we jump.
17465 2001-12-09 Radek Doulik <rodo@ximian.com>
17467 * cs-parser.jay: remember alias in current namespace
17469 * ecore.cs (SimpleName::DoResolve): use aliases for types or
17472 * class.cs (LookupAlias): lookup alias in my_namespace
17474 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
17476 (LookupAlias): lookup alias in this and if needed in parent
17479 2001-12-08 Miguel de Icaza <miguel@ximian.com>
17483 * rootcontext.cs: (ModuleBuilder) Made static, first step into
17484 making things static. I need this to avoid passing the
17485 TypeContainer when calling ParameterType.
17487 * support.cs (InternalParameters.ParameterType): Remove ugly hack
17488 that did string manipulation to compute the type and then call
17489 GetType. Use Parameter.ParameterType instead.
17491 * cs-tokenizer.cs: Consume the suffix for floating values.
17493 * expression.cs (ParameterReference): figure out whether this is a
17494 reference parameter or not. Kill an extra variable by computing
17495 the arg_idx during emission.
17497 * parameter.cs (Parameters.GetParameterInfo): New overloaded
17498 function that returns whether a parameter is an out/ref value or not.
17500 (Parameter.ParameterType): The type of the parameter (base,
17501 without ref/out applied).
17503 (Parameter.Resolve): Perform resolution here.
17504 (Parameter.ExternalType): The full type (with ref/out applied).
17506 * statement.cs (Using.Emit, Using.EmitExpression): Implement
17507 support for expressions on the using statement.
17509 2001-12-07 Miguel de Icaza <miguel@ximian.com>
17511 * statement.cs (Using.EmitLocalVariableDecls): Split the
17512 localvariable handling of the using statement.
17514 (Block.EmitMeta): Keep track of variable count across blocks. We
17515 were reusing slots on separate branches of blocks.
17517 (Try.Emit): Emit the general code block, we were not emitting it.
17519 Check the type of the declaration to be an IDisposable or
17520 something that can be implicity converted to it.
17522 Emit conversions if required.
17524 * ecore.cs (EmptyExpression): New utility class.
17525 (Expression.ImplicitConversionExists): New utility function.
17527 2001-12-06 Miguel de Icaza <miguel@ximian.com>
17529 * statement.cs (Using): Implement.
17531 * expression.cs (LocalVariableReference): Support read only variables.
17533 * statement.cs: Remove the explicit emit for the Leave opcode.
17534 (VariableInfo): Add a readonly field.
17536 2001-12-05 Miguel de Icaza <miguel@ximian.com>
17538 * ecore.cs (ConvCast): new class used to encapsulate the various
17539 explicit integer conversions that works in both checked and
17540 unchecked contexts.
17542 (Expression.ConvertNumericExplicit): Use new ConvCast class to
17543 properly generate the overflow opcodes.
17545 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17547 * statement.cs: The correct type for the EmptyExpression is the
17548 element_type, not the variable type. Ravi pointed this out.
17550 2001-12-04 Ravi Pratap <ravi@ximian.com>
17552 * class.cs (Method::Define): Handle PInvoke methods specially
17553 by using DefinePInvokeMethod instead of the usual one.
17555 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
17556 above to do the task of extracting information and defining the method.
17558 2001-12-04 Ravi Pratap <ravi@ximian.com>
17560 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
17561 of the condition for string type.
17563 (Emit): Move that here.
17565 (ArrayCreation::CheckIndices): Keep string literals in their expression
17568 (EmitDynamicInitializers): Handle strings appropriately.
17570 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17572 * codegen.cs (EmitContext): Replace multiple variables with a
17573 single pointer to the current Switch statement.
17575 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
17578 2001-12-03 Miguel de Icaza <miguel@ximian.com>
17582 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
17585 (Foreach.Emit): Foreach on arrays was not setting
17586 up the loop variables (for break/continue).
17588 (GotoCase): Semi-implented.
17590 2001-12-03 Ravi Pratap <ravi@ximian.com>
17592 * attribute.cs (CheckAttribute): Handle system attributes by using
17593 Attribute.GetAttributes to examine information we need.
17595 (GetValidPlaces): Same here.
17597 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
17599 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
17601 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
17603 (Method::Define): Set appropriate flags if we have a DllImport attribute.
17605 (Method::Emit): Handle the case when we are a PInvoke method.
17607 2001-12-03 Miguel de Icaza <miguel@ximian.com>
17609 * expression.cs: Use ResolveWithSimpleName on compound names.
17611 2001-12-02 Ravi Pratap <ravi@ximian.com>
17613 * constant.cs (EmitConstant): Make sure we resolve the associated expression
17614 before trying to reduce it.
17616 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
17618 * constant.cs (LookupConstantValue): Implement.
17620 (EmitConstant): Use the above in emitting the constant.
17622 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
17623 that are user-defined by doing a LookupConstantValue on them.
17625 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
17628 2001-11-29 Miguel de Icaza <miguel@ximian.com>
17630 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
17632 (BaseAccess.DoResolve): Implement.
17634 (MemberAccess.DoResolve): Split this routine into a
17635 ResolveMemberAccess routine that can be used independently
17637 2001-11-28 Miguel de Icaza <miguel@ximian.com>
17639 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
17640 As that share bits of the implementation. Is returns a boolean,
17641 while As returns the Type that is being probed.
17643 2001-12-01 Ravi Pratap <ravi@ximian.com>
17645 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
17646 instead of a Literal - much easier.
17648 (EnumInTransit): Remove - utterly useless :-)
17650 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
17652 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
17654 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
17655 chain when we have no associated expression.
17657 2001-11-30 Ravi Pratap <ravi@ximian.com>
17659 * constant.cs (Define): Use Location while reporting the errror.
17661 Also emit a warning when 'new' is used and there is no inherited
17664 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
17667 (LookupEnumValue): Implement to lookup an enum member's value and define it
17670 (Populate): Re-write accordingly to use the above routine.
17672 2001-11-27 Miguel de Icaza <miguel@ximian.com>
17674 * expression.cs (This): Fix prototype for DoResolveLValue to
17675 override the base class DoResolveLValue.
17677 * cs-parser.cs: Report errors cs574 and cs575 (destructor
17680 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
17681 (we need to load the address of the field here). This fixes
17684 (FieldExpr.DoResolveLValue): Call the DoResolve
17685 function to initialize the Instance expression.
17687 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
17688 correctly the GetEnumerator operation on a value type.
17690 * cs-parser.jay: Add more simple parsing error catches.
17692 * statement.cs (Switch): Add support for string switches.
17693 Handle null specially.
17695 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
17697 2001-11-28 Ravi Pratap <ravi@ximian.com>
17699 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
17701 (declare_local_constant): New helper function.
17703 * statement.cs (AddConstant): Keep a separate record of constants
17705 (IsConstant): Implement to determine if a variable is a constant.
17707 (GetConstantExpression): Implement.
17709 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
17711 * statement.cs (IsVariableDefined): Re-write.
17713 2001-11-27 Ravi Pratap <ravi@ximian.com>
17715 * class.cs (TypeContainer::FindMembers): Look for constants
17716 in the case when we are looking for MemberTypes.Field
17718 * expression.cs (MemberAccess::DoResolve): Check that in the
17719 case we are a FieldExpr and a Literal, we are not being accessed
17720 by an instance reference.
17722 * cs-parser.jay (local_constant_declaration): Implement.
17724 (declaration_statement): Implement for constant declarations.
17726 2001-11-26 Miguel de Icaza <miguel@ximian.com>
17728 * statement.cs (Switch): Catch double defaults.
17730 (Switch): More work on the switch() statement
17731 implementation. It works for integral values now, need to finish
17735 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17737 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
17738 integer literals into other integer literals. To be used by
17741 2001-11-24 Ravi Pratap <ravi@ximian.com>
17743 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
17746 (EmitDynamicInitializers): Cope with the above since we extract data
17747 directly from ArrayData now.
17749 (ExpectInitializers): Keep track of whether initializers are mandatory
17752 (Bounds): Make it a hashtable to prevent the same dimension being
17753 recorded for every element in that dimension.
17755 (EmitDynamicInitializers): Fix bug which prevented the Set array method
17758 Also fix bug which was causing the indices to be emitted in the reverse
17761 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17763 * expression.cs (ArrayCreation): Implement the bits that Ravi left
17764 unfinished. They do not work, because the underlying code is
17767 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17769 * cs-parser.jay: Remove bogus fixme.
17771 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
17772 on Switch statement.
17774 2001-11-23 Ravi Pratap <ravi@ximian.com>
17776 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
17779 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
17780 parameter. Apparently, any expression is allowed.
17782 (ValidateInitializers): Update accordingly.
17784 (CheckIndices): Fix some tricky bugs thanks to recursion.
17786 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
17787 I was being completely brain-dead.
17789 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
17790 and re-write acordingly.
17792 (DelegateInvocation): Re-write accordingly.
17794 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
17796 (MakeByteBlob): Handle types more correctly.
17798 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
17799 initialization from expressions but it is incomplete because I am a complete
17802 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17804 * statement.cs (If.Emit): Fix a bug that generated incorrect code
17805 on If. Basically, we have to return `true' (ie, we do return to
17806 our caller) only if both branches of the if return.
17808 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
17809 short-circuit operators, handle them as short circuit operators.
17811 (Cast.DoResolve): Resolve type.
17812 (Cast.Cast): Take an expression as the target type.
17814 * cs-parser.jay (cast_expression): Remove old hack that only
17815 allowed a limited set of types to be handled. Now we take a
17816 unary_expression and we resolve to a type during semantic
17819 Use the grammar productions from Rhys to handle casts (this is
17820 not complete like Rhys syntax yet, we fail to handle that corner
17821 case that C# has regarding (-x), but we will get there.
17823 2001-11-22 Ravi Pratap <ravi@ximian.com>
17825 * class.cs (EmitFieldInitializer): Take care of the case when we have a
17826 field which is an array type.
17828 * cs-parser.jay (declare_local_variables): Support array initialization too.
17830 * typemanager.cs (MakeKey): Implement.
17832 (everywhere): Use the above appropriately.
17834 * cs-parser.jay (for_statement): Update for array initialization while
17835 declaring variables.
17837 * ecore.cs : The error message was correct, it's the variable's names that
17838 were misleading ;-) Make the code more readable.
17840 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
17841 the correct type etc.
17843 (ConvertExplicit): Handle Enum types by examining the underlying type.
17845 2001-11-21 Ravi Pratap <ravi@ximian.com>
17847 * parameter.cs (GetCallingConvention): Always return
17848 CallingConventions.Standard for now.
17850 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17852 * expression.cs (Binary.ResolveOperator): Update the values of `l'
17853 and `r' after calling DoNumericPromotions.
17855 * ecore.cs: Fix error message (the types were in the wrong order).
17857 * statement.cs (Foreach.ProbeCollectionType): Need to pass
17858 BindingFlags.Instance as well
17860 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
17861 implicit int literal conversion in an empty cast so that we
17862 propagate the right type upstream.
17864 (UnboxCast): new class used to unbox value types.
17865 (Expression.ConvertExplicit): Add explicit type conversions done
17868 (Expression.ImplicitNumericConversion): Oops, forgot to test for
17869 the target type before applying the implicit LongLiterals to ULong
17872 2001-11-21 Miguel de Icaza <miguel@ximian.com>
17874 * cs-parser.jay (for_statement): Reworked the way For works: now
17875 we declare manually any variables that are introduced in
17876 for_initializer to solve the problem of having out-of-band code
17877 emition (that is what got for broken).
17879 (declaration_statement): Perform the actual variable declaration
17880 that used to be done in local_variable_declaration here.
17882 (local_variable_declaration): Do not declare anything, just pass
17883 the information on a DictionaryEntry
17885 2001-11-20 Ravi Pratap <ravi@ximian.com>
17887 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
17888 re-write of the logic to now make it recursive.
17890 (UpdateIndices): Re-write accordingly.
17892 Store element data in a separate ArrayData list in the above methods.
17894 (MakeByteBlob): Implement to dump the array data into a byte array.
17896 2001-11-19 Ravi Pratap <ravi@ximian.com>
17898 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
17901 * constant.cs (Define): Implement.
17903 (EmitConstant): Re-write fully.
17905 Pass in location info.
17907 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
17910 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
17911 DictionaryEntry since we need location info too.
17913 (constant_declaration): Update accordingly.
17915 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
17916 code into another method : UpdateIndices.
17918 2001-11-18 Ravi Pratap <ravi@ximian.com>
17920 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
17921 some type checking etc.
17923 2001-11-17 Ravi Pratap <ravi@ximian.com>
17925 * expression.cs (ArrayCreation::ValidateInitializers): Implement
17926 bits to provide dimension info if the user skips doing that.
17928 Update second constructor to store the rank correctly.
17930 2001-11-16 Ravi Pratap <ravi@ximian.com>
17932 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
17933 and try to implement.
17935 * ../errors/cs0150.cs : Add.
17937 * ../errors/cs0178.cs : Add.
17939 2001-11-16 Miguel de Icaza <miguel@ximian.com>
17941 * statement.cs: Implement foreach on multi-dimensional arrays.
17943 * parameter.cs (Parameters.GetParameterByName): Also lookup the
17944 name of the params argument.
17946 * expression.cs: Use EmitStoreOpcode to get the right opcode while
17947 initializing the array.
17949 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
17950 we can use this elsewhere.
17952 * statement.cs: Finish implementation of foreach for single
17955 * cs-parser.jay: Use an out-of-band stack to pass information
17956 around, I wonder why I need this.
17958 foreach_block: Make the new foreach_block the current_block.
17960 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
17961 function used to return a static Parameters structure. Used for
17962 empty parameters, as those are created very frequently.
17964 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
17966 2001-11-15 Ravi Pratap <ravi@ximian.com>
17968 * interface.cs : Default modifier is private, not public. The
17969 make verify test passes again.
17971 2001-11-15 Ravi Pratap <ravi@ximian.com>
17973 * support.cs (ReflectionParameters): Fix logic to determine
17974 whether the last parameter is a params one. Test 9 passes again.
17976 * delegate.cs (Populate): Register the builders we define with
17977 RegisterParameterForBuilder. Test 19 passes again.
17979 * cs-parser.jay (property_declaration): Reference $6 instead
17980 of $$ to get at the location.
17982 (indexer_declaration): Similar stuff.
17984 (attribute): Ditto.
17986 * class.cs (Property): Register parameters for the Get and Set methods
17987 if they exist. Test 23 passes again.
17989 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
17990 call to EmitArguments as we are sure there aren't any params arguments.
17991 Test 32 passes again.
17993 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
17994 IndexOutOfRangeException.
17996 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
17997 Test 33 now passes again.
17999 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18001 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18002 broke a bunch of things. Will have to come up with a better way
18003 of tracking locations.
18005 * statement.cs: Implemented foreach for single dimension arrays.
18007 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18009 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18010 an error. This removes the lookup from the critical path.
18012 * cs-parser.jay: Removed use of temporary_loc, which is completely
18015 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18017 * support.cs (ReflectionParameters.ParameterModifier): Report
18018 whether the argument is a PARAMS argument or not.
18020 * class.cs: Set the attribute `ParamArrayAttribute' on the
18021 parameter argument.
18023 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18024 and cons_param_array_attribute (ConstructorInfo for
18025 ParamArrayAttribute).,
18027 * codegen.cs: Emit the return using the `Return' statement, that
18028 way we can report the error correctly for missing return values.
18030 * class.cs (Method.Emit): Clean up.
18032 * expression.cs (Argument.Resolve): Take another argument: the
18033 location where this argument is used. Notice that this is not
18034 part of the "Argument" class as to reduce the size of the
18035 structure (we know the approximate location anyways).
18037 Test if the argument is a variable-reference, if not, then
18038 complain with a 206.
18040 (Argument.Emit): Emit addresses of variables.
18042 (Argument.FullDesc): Simplify.
18044 (Invocation.DoResolve): Update for Argument.Resolve.
18046 (ElementAccess.DoResolve): ditto.
18048 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
18049 method should be virtual, as this method is always virtual.
18051 (NewDelegate.DoResolve): Update for Argument.Resolve.
18053 * class.cs (ConstructorInitializer.DoResolve): ditto.
18055 * attribute.cs (Attribute.Resolve): ditto.
18057 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18059 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
18061 * expression.cs (ParameterReference): Drop IStackStorage and implement
18062 IAssignMethod instead.
18064 (LocalVariableReference): ditto.
18066 * ecore.cs (FieldExpr): Drop IStackStorage and implement
18067 IAssignMethod instead.
18069 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18071 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
18072 enumerations that are used in heavily used structures derive from
18073 byte in a laughable and pathetic attempt to reduce memory usage.
18074 This is the kind of pre-optimzations that you should not do at
18075 home without adult supervision.
18077 * expression.cs (UnaryMutator): New class, used to handle ++ and
18078 -- separatedly from the other unary operators. Cleans up the
18079 code, and kills the ExpressionStatement dependency in Unary.
18081 (Unary): Removed `method' and `Arguments' from this class, making
18082 it smaller, and moving it all to SimpleCall, so I can reuse this
18083 code in other locations and avoid creating a lot of transient data
18084 strucutres when not required.
18086 * cs-parser.jay: Adjust for new changes.
18088 2001-11-11 Miguel de Icaza <miguel@ximian.com>
18090 * enum.cs (Enum.Populate): If there is a failure during
18093 * cs-parser.jay (opt_enum_base): we used to catch type errors
18094 here, but this is really incorrect. The type error should be
18095 catched during semantic analysis.
18097 2001-12-11 Ravi Pratap <ravi@ximian.com>
18099 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
18100 current_local_parameters as expected since I, in my stupidity, had forgotten
18103 * attribute.cs (GetValidPlaces): Fix stupid bug.
18105 * class.cs (Method::Emit): Perform check on applicability of attributes.
18107 (Constructor::Emit): Ditto.
18109 (Field::Emit): Ditto.
18111 (Field.Location): Store location information.
18113 (Property, Event, Indexer, Operator): Ditto.
18115 * cs-parser.jay (field_declaration): Pass in location for each field.
18117 * ../errors/cs0592.cs : Add.
18119 2001-11-12 Ravi Pratap <ravi@ximian.com>
18121 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
18123 (InitCoreTypes): Update accordingly.
18125 (RegisterAttrType, LookupAttr): Implement.
18127 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
18128 info about the same.
18130 (Resolve): Update to populate the above as necessary.
18132 (Error592): Helper.
18134 (GetValidPlaces): Helper to the above.
18136 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
18138 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
18140 2001-11-12 Ravi Pratap <ravi@ximian.com>
18142 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18144 * ../errors/cs0617.cs : Add.
18146 2001-11-11 Ravi Pratap <ravi@ximian.com>
18148 * enum.cs (Emit): Rename to Populate to be more consistent with what
18149 we expect it to do and when exactly it is called.
18151 * class.cs, rootcontext.cs : Update accordingly.
18153 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18154 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18156 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18158 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18159 of a fieldinfo using the above, when dealing with a FieldBuilder.
18161 2001-11-10 Ravi Pratap <ravi@ximian.com>
18163 * ../errors/cs0031.cs : Add.
18165 * ../errors/cs1008.cs : Add.
18167 * ../errrors/cs0543.cs : Add.
18169 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18172 (FindMembers): Implement.
18174 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18175 enums and delegates too.
18177 (enum_types): Rename to builder_to_enum.
18179 (delegate_types): Rename to builder_to_delegate.
18181 * delegate.cs (FindMembers): Implement.
18183 2001-11-09 Ravi Pratap <ravi@ximian.com>
18185 * typemanager.cs (IsEnumType): Implement.
18187 * enum.cs (Emit): Re-write parts to account for the underlying type
18188 better and perform checking etc.
18190 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
18191 of the underlying type.
18193 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
18196 * enum.cs (error31): Helper to report error #31.
18198 * cs-parser.jay (enum_declaration): Store location of each member too.
18200 * enum.cs (member_to_location): New hashtable.
18202 (AddEnumMember): Update location hashtable.
18204 (Emit): Use the location of each member while reporting errors.
18206 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18208 * cs-parser.jay: A for_initializer if is a
18209 local_variable_declaration really ammount to have an implicit
18210 block with the variable declaration and no initializer for for.
18212 * statement.cs (For.Emit): Cope with null initializers.
18214 This fixes the infinite loop on for initializers.
18216 2001-11-08 Miguel de Icaza <miguel@ximian.com>
18218 * enum.cs: More cleanup.
18220 * ecore.cs: Remove dead code.
18222 * class.cs (Property.Emit): More simplification.
18223 (Event.Emit): ditto.
18225 Reworked to have less levels of indentation.
18227 2001-11-08 Ravi Pratap <ravi@ximian.com>
18229 * class.cs (Property): Emit attributes.
18239 * enum.cs (Emit): Ditto.
18241 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
18244 * class.cs (Field, Event, etc.): Move attribute generation into the
18245 Emit method everywhere.
18247 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
18248 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
18249 as we had no way of defining nested enums !
18251 * rootcontext.cs : Adjust code accordingly.
18253 * typemanager.cs (AddEnumType): To keep track of enum types separately.
18255 2001-11-07 Ravi Pratap <ravi@ximian.com>
18257 * expression.cs (EvalConstantExpression): Move into ecore.cs
18259 * enum.cs (Enum): Rename some members and make them public and readonly
18260 according to our convention.
18262 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
18265 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
18267 (Enum::Emit): Write a simple version for now which doesn't try to compute
18268 expressions. I shall modify this to be more robust in just a while.
18270 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
18272 (TypeContainer::CloseType): Create the Enum types too.
18274 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
18276 * expression.cs (EvalConstantExpression): Get rid of completely.
18278 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
18279 user-defined values and other cases.
18281 (IsValidEnumLiteral): Helper function.
18283 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
18284 out there in the case we had a literal FieldExpr.
18286 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
18288 (Literalize): Revamp a bit to take two arguments.
18290 (EnumLiteral): New class which derives from Literal to wrap enum literals.
18292 2001-11-06 Ravi Pratap <ravi@ximian.com>
18294 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
18296 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
18298 (Resolve): Use the above to ensure we have proper initializers.
18300 2001-11-05 Ravi Pratap <ravi@ximian.com>
18302 * expression.cs (Expression::EvalConstantExpression): New method to
18303 evaluate constant expressions.
18305 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
18307 2001-11-07 Miguel de Icaza <miguel@ximian.com>
18309 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
18312 (Binary.ResolveOperator): Handle operator != (object a, object b)
18313 and operator == (object a, object b);
18315 (Binary.DoNumericPromotions): Indicate whether the numeric
18316 promotion was possible.
18318 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
18321 Made the ArrayAccess implement interface IAssignMethod instead of
18322 IStackStore as the order in which arguments are passed reflects
18325 * assign.cs: Instead of using expr.ExprClass to select the way of
18326 assinging, probe for the IStackStore/IAssignMethod interfaces.
18328 * typemanager.cs: Load InitializeArray definition.
18330 * rootcontext.cs (RootContext.MakeStaticData): Used to define
18331 static data that can be used to initialize arrays.
18333 2001-11-05 Miguel de Icaza <miguel@ximian.com>
18335 * expression.cs: Handle operator== and operator!= for booleans.
18337 (Conditioal.Reduce): Implement reducer for the ?: operator.
18339 (Conditional.Resolve): Implement dead code elimination.
18341 (Binary.Resolve): Catch string literals and return a new
18342 concatenated string.
18344 (Unary.Reduce): Implement reduction of unary expressions.
18346 * ecore.cs: Split out the expression core handling here.
18348 (Expression.Reduce): New method used to perform constant folding
18349 and CSE. This is needed to support constant-expressions.
18351 * statement.cs (Statement.EmitBoolExpression): Pass true and false
18352 targets, and optimize for !x.
18354 2001-11-04 Ravi Pratap <ravi@ximian.com>
18356 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
18357 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
18358 set custom atttributes.
18360 * literal.cs (Literal::GetValue): New abstract method to return the actual
18361 value of the literal, cast as an object.
18363 (*Literal): Implement GetValue method.
18365 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
18366 expressions to the arraylist but objects of type Argument.
18368 * class.cs (TypeContainer::Emit): Emit our attributes too.
18370 (Method::Emit, Constructor::Emit): Ditto.
18372 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
18373 to be ignoring earlier.
18375 2001-11-03 Ravi Pratap <ravi@ximian.com>
18377 * attribute.cs (AttributeSection::Define): Implement to do the business
18378 of constructing a CustomAttributeBuilder.
18380 (Attribute): New trivial class. Increases readability of code.
18382 * cs-parser.jay : Update accordingly.
18384 (positional_argument_list, named_argument_list, named_argument): New rules
18386 (attribute_arguments): Use the above so that we are more correct.
18388 2001-11-02 Ravi Pratap <ravi@ximian.com>
18390 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
18391 to perform all checks for a method with a params parameter.
18393 (Invocation::OverloadResolve): Update to use the above method and therefore
18394 cope correctly with params method invocations.
18396 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
18399 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
18400 constructors in our parent too because we can't afford to miss out on
18403 * attribute.cs (AttributeSection): New name for the class Attribute
18405 Other trivial changes to improve readability.
18407 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
18408 use the new class names.
18410 2001-11-01 Ravi Pratap <ravi@ximian.com>
18412 * class.cs (Method::Define): Complete definition for params types too
18414 (Indexer::Define): Ditto.
18416 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
18417 Cope everywhere with a request for info about the array parameter.
18419 2001-11-01 Ravi Pratap <ravi@ximian.com>
18421 * tree.cs (RecordNamespace): Fix up to check for the correct key.
18423 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
18424 local_variable_type to extract the string corresponding to the type.
18426 (local_variable_type): Fixup the action to use the new helper method.
18428 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
18431 * expression.cs : Clean out code which uses the above.
18433 2001-10-31 Ravi Pratap <ravi@ximian.com>
18435 * typemanager.cs (RegisterMethod): Check if we already have an existing key
18436 and bale out if necessary by returning a false.
18438 (RegisterProperty): Ditto.
18440 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
18441 and print out appropriate error messages.
18443 * interface.cs (everywhere): Ditto.
18445 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
18446 location to constructor.
18448 * class.cs (Property, Event, Indexer): Update accordingly.
18450 * ../errors/cs111.cs : Added.
18452 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
18453 of a method, as laid down by the spec.
18455 (Invocation::OverloadResolve): Use the above method.
18457 2001-10-31 Ravi Pratap <ravi@ximian.com>
18459 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
18460 now take a TypeContainer and a Parameters object.
18462 (ParameterData): Modify return type of ParameterModifier method to be
18463 Parameter.Modifier and not a string.
18465 (ReflectionParameters, InternalParameters): Update accordingly.
18467 * expression.cs (Argument::GetParameterModifier): Same here.
18469 * support.cs (InternalParameters::ParameterType): Find a better way of determining
18470 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
18471 symbol in it at all so maybe this is only for now.
18473 2001-10-30 Ravi Pratap <ravi@ximian.com>
18475 * support.cs (InternalParameters): Constructor now takes an extra argument
18476 which is the actual Parameters class.
18478 (ParameterDesc): Update to provide info on ref/out modifiers.
18480 * class.cs (everywhere): Update call to InternalParameters to pass in
18481 the second argument too.
18483 * support.cs (ParameterData): Add ParameterModifier, which is a method
18484 to return the modifier info [ref/out etc]
18486 (InternalParameters, ReflectionParameters): Implement the above.
18488 * expression.cs (Argument::ParameterModifier): Similar function to return
18489 info about the argument's modifiers.
18491 (Invocation::OverloadResolve): Update to take into account matching modifiers
18494 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
18495 a new SetFormalParameters object which we pass to InternalParameters.
18497 2001-10-30 Ravi Pratap <ravi@ximian.com>
18499 * expression.cs (NewArray): Merge into the ArrayCreation class.
18501 2001-10-29 Ravi Pratap <ravi@ximian.com>
18503 * expression.cs (NewArray): Merge classes NewBuiltinArray and
18504 NewUserdefinedArray into one as there wasn't much of a use in having
18507 * expression.cs (Argument): Change field's name to ArgType from Type.
18509 (Type): New readonly property which returns the proper type, taking into
18510 account ref/out modifiers.
18512 (everywhere): Adjust code accordingly for the above.
18514 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
18515 whether we are emitting for a ref or out parameter.
18517 * expression.cs (Argument::Emit): Use the above field to set the state.
18519 (LocalVariableReference::Emit): Update to honour the flag and emit the
18522 * parameter.cs (Attributes): Set the correct flags for ref parameters.
18524 * expression.cs (Argument::FullDesc): New function to provide a full desc.
18526 * support.cs (ParameterData): Add method ParameterDesc to the interface.
18528 (ReflectionParameters, InternalParameters): Implement the above method.
18530 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
18533 (Invocation::FullMethodDesc): Ditto.
18535 2001-10-29 Miguel de Icaza <miguel@ximian.com>
18537 * cs-parser.jay: Add extra production for the second form of array
18540 * expression.cs (ArrayCreation): Update to reflect the above
18543 * Small changes to prepare for Array initialization.
18545 2001-10-28 Miguel de Icaza <miguel@ximian.com>
18547 * typemanager.cs (ImplementsInterface): interface might be null;
18548 Deal with this problem;
18550 Also, we do store negative hits on the cache (null values), so use
18551 this instead of calling t.GetInterfaces on the type everytime.
18553 2001-10-28 Ravi Pratap <ravi@ximian.com>
18555 * typemanager.cs (IsBuiltinType): New method to help determine the same.
18557 * expression.cs (New::DoResolve): Get rid of array creation code and instead
18558 split functionality out into different classes.
18560 (New::FormArrayType): Move into NewBuiltinArray.
18562 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
18565 (NewBuiltinArray): New class to handle creation of built-in arrays.
18567 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
18568 account creation of one-dimensional arrays.
18570 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
18572 (NewUserdefinedArray::DoResolve): Implement.
18574 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
18576 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
18577 we maintain inside the TypeManager. This is necessary to perform lookups on the
18580 (LookupType): Update to perform GetType on the module builders too.
18582 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
18584 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
18586 2001-10-23 Ravi Pratap <ravi@ximian.com>
18588 * expression.cs (New::DoResolve): Implement guts of array creation.
18590 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
18592 2001-10-27 Miguel de Icaza <miguel@ximian.com>
18594 * expression.cs: Fix bug I introduced lsat night that broke
18597 (Expression.Resolve): Report a 246 error (can not resolve name)
18598 if we find a SimpleName in the stream.
18600 (Expression.ResolveLValue): Ditto.
18602 (Expression.ResolveWithSimpleName): This function is a variant of
18603 ResolveName, this one allows SimpleNames to be returned without a
18604 warning. The only consumer of SimpleNames is MemberAccess
18606 2001-10-26 Miguel de Icaza <miguel@ximian.com>
18608 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
18609 might arrive here. I have my doubts that this is correct.
18611 * statement.cs (Lock): Implement lock statement.
18613 * cs-parser.jay: Small fixes to support `lock' and `using'
18615 * cs-tokenizer.cs: Remove extra space
18617 * driver.cs: New flag --checked, allows to turn on integer math
18620 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
18621 Threading.Monitor.Exit
18623 2001-10-23 Miguel de Icaza <miguel@ximian.com>
18625 * expression.cs (IndexerAccess::DoResolveLValue): Set the
18626 Expression Class to be IndexerAccess.
18628 Notice that Indexer::DoResolve sets the eclass to Value.
18630 2001-10-22 Miguel de Icaza <miguel@ximian.com>
18632 * class.cs (TypeContainer::Emit): Emit code for indexers.
18634 * assign.cs (IAssignMethod): New interface implemented by Indexers
18635 and Properties for handling assignment.
18637 (Assign::Emit): Simplify and reuse code.
18639 * expression.cs (IndexerAccess, PropertyExpr): Implement
18640 IAssignMethod, clean up old code.
18642 2001-10-22 Ravi Pratap <ravi@ximian.com>
18644 * typemanager.cs (ImplementsInterface): New method to determine if a type
18645 implements a given interface. Provides a nice cache too.
18647 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
18650 (ConvertReferenceExplicit): Ditto.
18652 * delegate.cs (Delegate::Populate): Update to define the parameters on the
18653 various methods, with correct names etc.
18655 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
18656 Operator.UnaryNegation.
18658 * cs-parser.jay (operator_declarator): Be a little clever in the case where
18659 we have a unary plus or minus operator.
18661 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
18664 * everywhere : update accordingly.
18666 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
18669 * class.cs (Method::Define): For the case where we are implementing a method
18670 inherited from an interface, we need to set the MethodAttributes.Final flag too.
18671 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
18673 2001-10-21 Ravi Pratap <ravi@ximian.com>
18675 * interface.cs (FindMembers): Implement to work around S.R.E
18678 * typemanager.cs (IsInterfaceType): Implement.
18680 (FindMembers): Update to handle interface types too.
18682 * expression.cs (ImplicitReferenceConversion): Re-write bits which
18683 use IsAssignableFrom as that is not correct - it doesn't work.
18685 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
18686 and accordingly override EmitStatement.
18688 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
18689 using the correct logic :-)
18691 2001-10-19 Ravi Pratap <ravi@ximian.com>
18693 * ../errors/cs-11.cs : Add to demonstrate error -11
18695 2001-10-17 Miguel de Icaza <miguel@ximian.com>
18697 * assign.cs (Assign::Resolve): Resolve right hand side first, and
18698 then pass this as a hint to ResolveLValue.
18700 * expression.cs (FieldExpr): Add Location information
18702 (FieldExpr::LValueResolve): Report assignment to readonly
18705 (Expression::ExprClassFromMemberInfo): Pass location information.
18707 (Expression::ResolveLValue): Add new method that resolves an
18710 (Expression::DoResolveLValue): Default invocation calls
18713 (Indexers): New class used to keep track of indexers in a given
18716 (IStackStore): Renamed from LValue, as it did not really describe
18717 what this did. Also ResolveLValue is gone from this interface and
18718 now is part of Expression.
18720 (ElementAccess): Depending on the element access type
18722 * typemanager.cs: Add `indexer_name_type' as a Core type
18723 (System.Runtime.CompilerServices.IndexerNameAttribute)
18725 * statement.cs (Goto): Take a location.
18727 2001-10-18 Ravi Pratap <ravi@ximian.com>
18729 * delegate.cs (Delegate::VerifyDelegate): New method to verify
18730 if two delegates are compatible.
18732 (NewDelegate::DoResolve): Update to take care of the case when
18733 we instantiate a delegate from another delegate.
18735 * typemanager.cs (FindMembers): Don't even try to look up members
18736 of Delegate types for now.
18738 2001-10-18 Ravi Pratap <ravi@ximian.com>
18740 * delegate.cs (NewDelegate): New class to take care of delegate
18743 * expression.cs (New): Split the delegate related code out into
18744 the NewDelegate class.
18746 * delegate.cs (DelegateInvocation): New class to handle delegate
18749 * expression.cs (Invocation): Split out delegate related code into
18750 the DelegateInvocation class.
18752 2001-10-17 Ravi Pratap <ravi@ximian.com>
18754 * expression.cs (New::DoResolve): Implement delegate creation fully
18755 and according to the spec.
18757 (New::DoEmit): Update to handle delegates differently.
18759 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
18760 because of which we were printing out arguments in reverse order !
18762 * delegate.cs (VerifyMethod): Implement to check if the given method
18763 matches the delegate.
18765 (FullDelegateDesc): Implement.
18767 (VerifyApplicability): Implement.
18769 * expression.cs (Invocation::DoResolve): Update to accordingly handle
18770 delegate invocations too.
18772 (Invocation::Emit): Ditto.
18774 * ../errors/cs1593.cs : Added.
18776 * ../errors/cs1594.cs : Added.
18778 * delegate.cs (InstanceExpression, TargetMethod): New properties.
18780 2001-10-16 Ravi Pratap <ravi@ximian.com>
18782 * typemanager.cs (intptr_type): Core type for System.IntPtr
18784 (InitCoreTypes): Update for the same.
18786 (iasyncresult_type, asynccallback_type): Ditto.
18788 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
18791 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
18794 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
18795 the builders for the 4 members of a delegate type :-)
18797 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
18800 * expression.cs (New::DoResolve): Implement guts for delegate creation.
18802 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
18804 2001-10-15 Miguel de Icaza <miguel@ximian.com>
18806 * statement.cs (Break::Emit): Implement.
18807 (Continue::Emit): Implement.
18809 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
18810 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
18811 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
18812 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
18815 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
18816 properties that track the label for the current loop (begin of the
18817 loop and end of the loop).
18819 2001-10-15 Ravi Pratap <ravi@ximian.com>
18821 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
18822 use of emitting anything at all.
18824 * class.cs, rootcontext.cs : Get rid of calls to the same.
18826 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
18828 (Populate): Define the constructor correctly and set the implementation
18831 * typemanager.cs (delegate_types): New hashtable to hold delegates that
18834 (AddDelegateType): Implement.
18836 (IsDelegateType): Implement helper method.
18838 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
18840 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
18841 and accordingly handle it.
18843 * delegate.cs (Populate): Take TypeContainer argument.
18844 Implement bits to define the Invoke method. However, I still haven't figured out
18845 how to take care of the native int bit :-(
18847 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
18848 Qualify the name of the delegate, not its return type !
18850 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
18853 (StandardConversionExists): Checking for array types turns out to be recursive.
18855 (ConvertReferenceExplicit): Implement array conversion.
18857 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
18859 2001-10-12 Ravi Pratap <ravi@ximian.com>
18861 * cs-parser.jay (delegate_declaration): Store the fully qualified
18862 name as it is a type declaration.
18864 * delegate.cs (ReturnType, Name): Rename members to these. Make them
18867 (DefineDelegate): Renamed from Define. Does the same thing essentially,
18868 as TypeContainer::DefineType.
18870 (Populate): Method in which all the definition of the various methods (Invoke)
18873 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
18876 (CloseDelegate): Finally creates the delegate.
18878 * class.cs (TypeContainer::DefineType): Update to define delegates.
18879 (Populate, Emit and CloseType): Do the same thing here too.
18881 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
18882 delegates in all these operations.
18884 2001-10-14 Miguel de Icaza <miguel@ximian.com>
18886 * expression.cs: LocalTemporary: a new expression used to
18887 reference a temporary that has been created.
18889 * assign.cs: Handle PropertyAccess back here, so that we can
18890 provide the proper semantic access to properties.
18892 * expression.cs (Expression::ConvertReferenceExplicit): Implement
18893 a few more explicit conversions.
18895 * modifiers.cs: `NEW' modifier maps to HideBySig.
18897 * expression.cs (PropertyExpr): Make this into an
18898 ExpressionStatement, and support the EmitStatement code path.
18900 Perform get/set error checking, clean up the interface.
18902 * assign.cs: recognize PropertyExprs as targets, and if so, turn
18903 them into toplevel access objects.
18905 2001-10-12 Miguel de Icaza <miguel@ximian.com>
18907 * expression.cs: PropertyExpr::PropertyExpr: use work around the
18910 * typemanager.cs: Keep track here of our PropertyBuilders again to
18911 work around lameness in SRE.
18913 2001-10-11 Miguel de Icaza <miguel@ximian.com>
18915 * expression.cs (LValue::LValueResolve): New method in the
18916 interface, used to perform a second resolution pass for LValues.
18918 (This::DoResolve): Catch the use of this in static methods.
18920 (This::LValueResolve): Implement.
18922 (This::Store): Remove warning, assigning to `this' in structures
18925 (Invocation::Emit): Deal with invocation of
18926 methods on value types. We need to pass the address to structure
18927 methods rather than the object itself. (The equivalent code to
18928 emit "this" for structures leaves the entire structure on the
18929 stack instead of a pointer to it).
18931 (ParameterReference::DoResolve): Compute the real index for the
18932 argument based on whether the method takes or not a `this' pointer
18933 (ie, the method is static).
18935 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
18936 value types returned from functions when we need to invoke a
18937 method on the sturcture.
18940 2001-10-11 Ravi Pratap <ravi@ximian.com>
18942 * class.cs (TypeContainer::DefineType): Method to actually do the business of
18943 defining the type in the Modulebuilder or Typebuilder. This is to take
18944 care of nested types which need to be defined on the TypeBuilder using
18945 DefineNestedMethod.
18947 (TypeContainer::GetClassBases): Implement. Essentially the code from the
18948 methods in RootContext, only ported to be part of TypeContainer.
18950 (TypeContainer::GetInterfaceOrClass): Ditto.
18952 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
18954 * interface.cs (Interface::DefineInterface): New method. Does exactly
18955 what RootContext.CreateInterface did earlier, only it takes care of nested types
18958 (Interface::GetInterfaces): Move from RootContext here and port.
18960 (Interface::GetInterfaceByName): Same here.
18962 * rootcontext.cs (ResolveTree): Re-write.
18964 (PopulateTypes): Re-write.
18966 * class.cs (TypeContainer::Populate): Populate nested types too.
18967 (TypeContainer::Emit): Emit nested members too.
18969 * typemanager.cs (AddUserType): Do not make use of the FullName property,
18970 instead just use the name argument passed in as it is already fully
18973 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
18974 to TypeContainer mapping to see if a type is user-defined.
18976 * class.cs (TypeContainer::CloseType): Implement.
18978 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
18979 the default constructor.
18981 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
18984 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
18986 * interface.cs (CloseType): Create the type here.
18988 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
18991 Remove all the methods which are now in TypeContainer.
18993 2001-10-10 Ravi Pratap <ravi@ximian.com>
18995 * delegate.cs (Define): Re-write bits to define the delegate
18998 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19000 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19002 * expression.cs (ImplicitReferenceConversion): handle null as well
19003 as a source to convert to any reference type.
19005 * statement.cs (Return): Perform any implicit conversions to
19006 expected return type.
19008 Validate use of return statement.
19010 * codegen.cs (EmitContext): Pass the expected return type here.
19012 * class.cs (Method, Constructor, Property): Pass expected return
19013 type to EmitContext.
19015 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19017 * expression.cs: Make DoResolve take an EmitContext instead of a
19020 Replaced `l' and `location' for `loc', for consistency.
19022 (Error, Warning): Remove unneeded Tc argument.
19024 * assign.cs, literal.cs, constant.cs: Update to new calling
19027 * codegen.cs: EmitContext now contains a flag indicating whether
19028 code is being generated in a static method or not.
19030 * cs-parser.jay: DecomposeQI, new function that replaces the old
19031 QualifiedIdentifier. Now we always decompose the assembled
19032 strings from qualified_identifier productions into a group of
19035 2001-10-08 Miguel de Icaza <miguel@ximian.com>
19037 * rootcontext.cs: Deal with field-less struct types correctly now
19038 by passing the size option to Define Type.
19040 * class.cs: Removed hack that created one static field.
19042 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19044 * statement.cs: Moved most of the code generation here.
19046 2001-10-09 Ravi Pratap <ravi@ximian.com>
19048 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
19051 (ElementAccess): Remove useless bits for now - keep checks as the spec
19054 2001-10-08 Ravi Pratap <ravi@ximian.com>
19056 * expression.cs (ElementAccess::DoResolve): Remove my crap code
19057 and start performing checks according to the spec.
19059 2001-10-07 Ravi Pratap <ravi@ximian.com>
19061 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
19062 rank_specifiers instead.
19064 (rank_specifiers): Change the order in which the rank specifiers are stored
19066 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
19068 * expression.cs (ElementAccess): Implement the LValue interface too.
19070 2001-10-06 Ravi Pratap <ravi@ximian.com>
19072 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
19073 except that user defined conversions are not included.
19075 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
19076 perform the conversion of the return type, if necessary.
19078 (New::DoResolve): Check whether we are creating an array or an object
19079 and accordingly do the needful.
19081 (New::Emit): Same here.
19083 (New::DoResolve): Implement guts of array creation.
19085 (New::FormLookupType): Helper function.
19087 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19089 * codegen.cs: Removed most of the code generation here, and move the
19090 corresponding code generation bits to the statement classes.
19092 Added support for try/catch/finalize and throw.
19094 * cs-parser.jay: Added support for try/catch/finalize.
19096 * class.cs: Catch static methods having the flags override,
19097 virtual or abstract.
19099 * expression.cs (UserCast): This user cast was not really doing
19100 what it was supposed to do. Which is to be born in fully resolved
19101 state. Parts of the resolution were being performed at Emit time!
19105 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19107 * expression.cs: Implicity convert the result from UserCast.
19109 2001-10-05 Ravi Pratap <ravi@ximian.com>
19111 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
19112 prevented it from working correctly.
19114 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
19115 merely ConvertImplicit.
19117 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19119 * typemanager.cs: Make the LookupTypeContainer function static,
19120 and not per-instance.
19122 * class.cs: Make static FindMembers (the one that takes a Type
19125 * codegen.cs: Add EmitForeach here.
19127 * cs-parser.jay: Make foreach a toplevel object instead of the
19128 inline expansion, as we need to perform semantic analysis on it.
19130 2001-10-05 Ravi Pratap <ravi@ximian.com>
19132 * expression.cs (Expression::ImplicitUserConversion): Rename to
19133 UserDefinedConversion.
19135 (Expression::UserDefinedConversion): Take an extra argument specifying
19136 whether we look for explicit user conversions too.
19138 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
19140 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19142 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19143 with the appropriate arguments.
19145 * cs-parser.jay (cast_expression): Record location too.
19147 * expression.cs (Cast): Record location info.
19149 (Expression::ConvertExplicit): Take location argument.
19151 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19152 to determine if we are doing explicit conversions.
19154 (UserCast::Emit): Update accordingly.
19156 (Expression::ConvertExplicit): Report an error if everything fails.
19158 * ../errors/cs0030.cs : Add.
19160 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19162 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19163 virtual and newslot bits.
19165 * class.cs (TypeContainer::RegisterRequiredImplementations):
19166 Record methods we need.
19168 (TypeContainer::MakeKey): Helper function to make keys for
19169 MethodBases, since the Methodbase key is useless.
19171 (TypeContainer::Populate): Call RegisterRequiredImplementations
19172 before defining the methods.
19174 Create a mapping for method_builders_to_methods ahead of time
19175 instead of inside a tight loop.
19177 (::RequireMethods): Accept an object as the data to set into the
19178 hashtable so we can report interface vs abstract method mismatch.
19180 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19182 * report.cs: Make all of it static.
19184 * rootcontext.cs: Drop object_type and value_type computations, as
19185 we have those in the TypeManager anyways.
19187 Drop report instance variable too, now it is a global.
19189 * driver.cs: Use try/catch on command line handling.
19191 Add --probe option to debug the error reporting system with a test
19194 * report.cs: Add support for exiting program when a probe
19195 condition is reached.
19197 2001-10-03 Ravi Pratap <ravi@ximian.com>
19199 * expression.cs (Binary::DoNumericPromotions): Fix the case when
19200 we do a forcible conversion regardless of type, to check if
19201 ForceConversion returns a null.
19203 (Binary::error19): Use location to report error.
19205 (Unary::error23): Use location here too.
19207 * ../errors/cs0019.cs : Check in.
19209 * ../errors/cs0023.cs : Check in.
19211 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
19212 case of a non-null MethodInfo object with a length of 0 !
19214 (Binary::ResolveOperator): Flag error if overload resolution fails to find
19215 an applicable member - according to the spec :-)
19216 Also fix logic to find members in base types.
19218 (Unary::ResolveOperator): Same here.
19220 (Unary::report23): Change name to error23 and make first argument a TypeContainer
19221 as I was getting thoroughly confused between this and error19 :-)
19223 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
19224 (::FindMostEncompassedType): Implement.
19225 (::FindMostEncompassingType): Implement.
19226 (::StandardConversionExists): Implement.
19228 (UserImplicitCast): Re-vamp. We now need info about most specific
19229 source and target types so that we can do the necessary conversions.
19231 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
19232 mathematical union with no duplicates.
19234 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19236 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
19237 in order from base classes to child classes, so that we can in
19238 child classes look up in our parent for method names and
19239 attributes (required for handling abstract, virtual, new, override
19240 constructs: we need to instrospect our base class, and if we dont
19241 populate the classes in order, the introspection might be
19242 incorrect. For example, a method could query its parent before
19243 the parent has any methods and would determine that the parent has
19244 no abstract methods (while it could have had them)).
19246 (RootContext::CreateType): Record the order in which we define the
19249 2001-10-02 Miguel de Icaza <miguel@ximian.com>
19251 * class.cs (TypeContainer::Populate): Also method definitions can
19252 fail now, keep track of this.
19254 (TypeContainer::FindMembers): Implement support for
19255 DeclaredOnly/noDeclaredOnly flag.
19257 (Constructor::Emit) Return the ConstructorBuilder.
19259 (Method::Emit) Return the MethodBuilder.
19260 Check for abstract or virtual methods to be public.
19262 * rootcontext.cs (RootContext::CreateType): Register all the
19263 abstract methods required for the class to be complete and the
19264 interface methods that must be implemented.
19266 * cs-parser.jay: Report error 501 (method requires body if it is
19267 not marked abstract or extern).
19269 * expression.cs (TypeOf::Emit): Implement.
19271 * typemanager.cs: runtime_handle_type, new global type.
19273 * class.cs (Property::Emit): Generate code for properties.
19275 2001-10-02 Ravi Pratap <ravi@ximian.com>
19277 * expression.cs (Unary::ResolveOperator): Find operators on base type
19278 too - we now conform exactly to the spec.
19280 (Binary::ResolveOperator): Same here.
19282 * class.cs (Operator::Define): Fix minor quirk in the tests.
19284 * ../errors/cs0215.cs : Added.
19286 * ../errors/cs0556.cs : Added.
19288 * ../errors/cs0555.cs : Added.
19290 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19292 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
19293 single integer which is really efficient
19295 2001-10-01 Ravi Pratap <ravi@ximian.com>
19297 * expression.cs (Expression::ImplicitUserConversion): Use location
19298 even in the case when we are examining True operators.
19300 * class.cs (Operator::Define): Perform extensive checks to conform
19301 with the rules for operator overloading in the spec.
19303 * expression.cs (Expression::ImplicitReferenceConversion): Implement
19304 some of the other conversions mentioned in the spec.
19306 * typemanager.cs (array_type): New static member for the System.Array built-in
19309 (cloneable_interface): For System.ICloneable interface.
19311 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
19312 we start resolving the tree and populating types.
19314 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
19316 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19318 * expression.cs (Expression::ExprClassFromMemberInfo,
19319 Expression::Literalize): Create literal expressions from
19320 FieldInfos which are literals.
19322 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
19323 type casts, because they were wrong. The test suite in tests
19326 (ImplicitNumericConversion): ushort to ulong requires a widening
19329 Int32 constant to long requires widening cast as well.
19331 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
19332 for integers because the type on the stack is not i4.
19334 2001-09-30 Miguel de Icaza <miguel@ximian.com>
19336 * expression.cs (report118): require location argument.
19338 * parameter.cs: Do not dereference potential null value.
19340 * class.cs: Catch methods that lack the `new' keyword when
19341 overriding a name. Report warnings when `new' is used without
19342 anything being there to override.
19344 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
19346 * class.cs: Only add constructor to hashtable if it is non-null
19347 (as now constructors can fail on define).
19349 (TypeManager, Class, Struct): Take location arguments.
19351 Catch field instance initialization in structs as errors.
19353 accepting_filter: a new filter for FindMembers that is static so
19354 that we dont create an instance per invocation.
19356 (Constructor::Define): Catch errors where a struct constructor is
19359 * cs-parser.jay: Pass location information for various new
19362 * delegate.cs (Delegate): take a location argument.
19364 * driver.cs: Do not call EmitCode if there were problesm in the
19365 Definition of the types, as many Builders wont be there.
19367 * decl.cs (Decl::Decl): Require a location argument.
19369 * cs-tokenizer.cs: Handle properly hex constants that can not fit
19370 into integers, and find the most appropiate integer for it.
19372 * literal.cs: Implement ULongLiteral.
19374 * rootcontext.cs: Provide better information about the location of
19375 failure when CreateType fails.
19377 2001-09-29 Miguel de Icaza <miguel@ximian.com>
19379 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
19382 * expression.cs (Binary::CheckShiftArguments): Add missing type
19384 (Binary::ResolveOperator): Add type to the logical and and logical
19385 or, Bitwise And/Or and Exclusive Or code paths, it was missing
19388 (Binary::DoNumericPromotions): In the case where either argument
19389 is ulong (and most signed types combined with ulong cause an
19390 error) perform implicit integer constant conversions as well.
19392 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19394 * expression.cs (UserImplicitCast): Method should always be
19396 (Invocation::BetterConversion): Simplified test for IntLiteral.
19398 (Expression::ImplicitNumericConversion): Split this routine out.
19399 Put the code that performs implicit constant integer conversions
19402 (Expression::Resolve): Become a wrapper around DoResolve so we can
19403 check eclass and type being set after resolve.
19405 (Invocation::Badness): Remove this dead function
19407 (Binary::ResolveOperator): Do not compute the expensive argumnets
19408 unless we have a union for it.
19410 (Probe::Emit): Is needs to do an isinst and then
19411 compare against null.
19413 (::CanConvert): Added Location argument. If the Location argument
19414 is null (Location.Null), then we do not report errors. This is
19415 used by the `probe' mechanism of the Explicit conversion. We do
19416 not want to generate an error for something that the user
19417 explicitly requested to be casted. But the pipeline for an
19418 explicit cast first tests for potential implicit casts.
19420 So for now, if the Location is null, it means `Probe only' to
19421 avoid adding another argument. Might have to revise this
19424 (ClassCast): New class used to type cast objects into arbitrary
19425 classes (used in Explicit Reference Conversions).
19427 Implement `as' as well.
19429 Reverted all the patches from Ravi below: they were broken:
19431 * The use of `level' as a mechanism to stop recursive
19432 invocations is wrong. That was there just to catch the
19433 bug with a strack trace but not as a way of addressing
19436 To fix the problem we have to *understand* what is going
19437 on and the interactions and come up with a plan, not
19438 just get things going.
19440 * The use of the type conversion cache that I proposed
19441 last night had an open topic: How does this work across
19442 protection domains. A user defined conversion might not
19443 be public in the location where we are applying the
19444 conversion, a different conversion might be selected
19445 (ie, private A->B (better) but public B->A (worse),
19446 inside A, A->B applies, but outside it, B->A will
19449 * On top of that (ie, even if the above is solved),
19450 conversions in a cache need to be abstract. Ie, `To
19451 convert from an Int to a Short use an OpcodeCast', not
19452 `To convert from an Int to a Short use the OpcodeCast on
19453 the variable 5' (which is what this patch was doing).
19455 2001-09-28 Ravi Pratap <ravi@ximian.com>
19457 * expression.cs (Invocation::ConversionExists): Re-write to use
19458 the conversion cache
19460 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
19461 cache all conversions done, not just user-defined ones.
19463 (Invocation::BetterConversion): The real culprit. Use ConversionExists
19464 to determine if a conversion exists instead of acutually trying to
19465 perform the conversion. It's faster too.
19467 (Expression::ConvertExplicit): Modify to use ConversionExists to check
19468 and only then attempt the implicit conversion.
19470 2001-09-28 Ravi Pratap <ravi@ximian.com>
19472 * expression.cs (ConvertImplicit): Use a cache for conversions
19473 already found. Check level of recursion and bail out if necessary.
19475 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19477 * typemanager.cs (string_concat_string_string, string_concat_object_object):
19478 Export standard methods that we expect for string operations.
19480 * statement.cs (Block::UsageWarning): Track usage of variables and
19481 report the errors for not used variables.
19483 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
19486 2001-09-27 Miguel de Icaza <miguel@ximian.com>
19488 * codegen.cs: remove unnneded code
19490 * expression.cs: Removed BuiltinTypeAccess class
19492 Fix the order in which implicit conversions are
19495 The previous fixed dropped support for boxed conversions (adding a
19496 test to the test suite now)
19498 (UserImplicitCast::CanConvert): Remove test for source being null,
19499 that code is broken. We should not feed a null to begin with, if
19500 we do, then we should track the bug where the problem originates
19501 and not try to cover it up here.
19503 Return a resolved expression of type UserImplicitCast on success
19504 rather than true/false. Ravi: this is what I was talking about,
19505 the pattern is to use a static method as a "constructor" for
19508 Also, do not create arguments until the very last minute,
19509 otherwise we always create the arguments even for lookups that
19510 will never be performed.
19512 (UserImplicitCast::Resolve): Eliminate, objects of type
19513 UserImplicitCast are born in a fully resolved state.
19515 * typemanager.cs (InitCoreTypes): Init also value_type
19516 (System.ValueType).
19518 * expression.cs (Cast::Resolve): First resolve the child expression.
19520 (LValue): Add new method AddressOf to be used by
19523 Change the argument of Store to take an EmitContext instead of an
19524 ILGenerator, because things like FieldExpr need to be able to call
19525 their children expression to generate the instance code.
19527 (Expression::Error, Expression::Warning): Sugar functions for
19530 (Expression::MemberLookup): Accept a TypeContainer instead of a
19531 Report as the first argument.
19533 (Expression::ResolvePrimary): Killed. I still want to improve
19534 this as currently the code is just not right.
19536 (Expression::ResolveMemberAccess): Simplify, but it is still
19539 (Unary::Resolve): Catch errors in AddressOf operators.
19541 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
19542 index to a byte for the short-version, or the compiler will choose
19543 the wrong Emit call, which generates the wrong data.
19545 (ParameterReference::Emit, ::Store): same.
19547 (FieldExpr::AddressOf): Implement.
19549 * typemanager.cs: TypeManager: made public variable instead of
19552 * driver.cs: document --fatal.
19554 * report.cs (ErrorMessage, WarningMessage): new names for the old
19555 Error and Warning classes.
19557 * cs-parser.jay (member_access): Turn built-in access to types
19558 into a normal simplename
19560 2001-09-27 Ravi Pratap <ravi@ximian.com>
19562 * expression.cs (Invocation::BetterConversion): Fix to cope
19563 with q being null, since this was introducing a bug.
19565 * expression.cs (ConvertImplicit): Do built-in conversions first.
19567 2001-09-27 Ravi Pratap <ravi@ximian.com>
19569 * expression.cs (UserImplicitCast::Resolve): Fix bug.
19571 2001-09-27 Ravi Pratap <ravi@ximian.com>
19573 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
19574 I had introduced long ago (what's new ?).
19576 * expression.cs (UserImplicitCast::CanConvert): Static method to do
19577 the work of all the checking.
19578 (ConvertImplicit): Call CanConvert and only then create object if necessary.
19579 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
19581 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
19582 that is the right way.
19584 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
19585 overloading resolution. Use everywhere instead of cutting and pasting code.
19587 (Binary::ResolveOperator): Use MakeUnionSet.
19589 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
19590 we have to convert to bool types. Not complete yet.
19592 2001-09-27 Miguel de Icaza <miguel@ximian.com>
19594 * typemanager.cs (TypeManager::CSharpName): support ushort.
19596 * expression.cs (Expression::TryImplicitIntConversion): Attempts
19597 to provide an expression that performsn an implicit constant int
19598 conversion (section 6.1.6).
19599 (Expression::ConvertImplicitRequired): Reworked to include
19600 implicit constant expression conversions.
19602 (Expression::ConvertNumericExplicit): Finished.
19604 (Invocation::Emit): If InstanceExpression is null, then it means
19605 that we perform a call on this.
19607 2001-09-26 Miguel de Icaza <miguel@ximian.com>
19609 * expression.cs (Unary::Emit): Remove some dead code.
19610 (Probe): Implement Resolve and Emit for `is'.
19611 (Expression::ConvertImplicitRequired): Attempt to do constant
19612 expression conversions here. Maybe should be moved to
19613 ConvertImplicit, but I am not sure.
19614 (Expression::ImplicitLongConstantConversionPossible,
19615 Expression::ImplicitIntConstantConversionPossible): New functions
19616 that tell whether is it possible to apply an implicit constant
19617 expression conversion.
19619 (ConvertNumericExplicit): Started work on explicit numeric
19622 * cs-parser.jay: Update operator constants.
19624 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
19625 (Parameters::GetSignature): Hook up VerifyArgs here.
19626 (Parameters::VerifyArgs): Verifies that no two arguments have the
19629 * class.cs (Operator): Update the operator names to reflect the
19630 ones that the spec expects (as we are just stringizing the
19633 * expression.cs (Unary::ResolveOperator): Fix bug: Use
19634 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
19635 previous usage did only work for our methods.
19636 (Expression::ConvertImplicit): Handle decimal implicit numeric
19637 conversions as well.
19638 (Expression::InternalTypeConstructor): Used to invoke constructors
19639 on internal types for default promotions.
19641 (Unary::Emit): Implement special handling for the pre/post
19642 increment/decrement for overloaded operators, as they need to have
19643 the same semantics as the other operators.
19645 (Binary::ResolveOperator): ditto.
19646 (Invocation::ConversionExists): ditto.
19647 (UserImplicitCast::Resolve): ditto.
19649 2001-09-26 Ravi Pratap <ravi@ximian.com>
19651 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
19652 operator, return after emitting body. Regression tests pass again !
19654 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
19655 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
19656 (Invocation::OverloadResolve): Ditto.
19657 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
19659 * everywhere : update calls to the above methods accordingly.
19661 2001-09-26 Miguel de Icaza <miguel@ximian.com>
19663 * assign.cs (Assign): Make it inherit from ExpressionStatement.
19665 * expression.cs (ExpressionStatement): New base class used for
19666 expressions that can appear in statements, so that we can provide
19667 an alternate path to generate expression that do not leave a value
19670 (Expression::Emit, and all the derivatives): We no longer return
19671 whether a value is left on the stack or not. Every expression
19672 after being emitted leaves a single value on the stack.
19674 * codegen.cs (EmitContext::EmitStatementExpression): Use the
19675 facilties of ExpressionStatement if possible.
19677 * cs-parser.jay: Update statement_expression.
19679 2001-09-25 Miguel de Icaza <miguel@ximian.com>
19681 * driver.cs: Change the wording of message
19683 2001-09-25 Ravi Pratap <ravi@ximian.com>
19685 * expression.cs (Binary::ResolveOperator): Had forgottten to set
19686 the type of the expression to the return type of the method if
19687 we have an overloaded operator match ! The regression tests pass again !
19688 (Unary::ResolveOperator): Ditto.
19690 * expression.cs (Invocation::ConversionExists): Correct the member lookup
19691 to find "op_Implicit", not "implicit" ;-)
19692 (UserImplicitCast): New class to take care of user-defined implicit conversions.
19693 (ConvertImplicit, ForceConversion): Take TypeContainer argument
19695 * everywhere : Correct calls to the above accordingly.
19697 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
19698 (ConvertImplicit): Do user-defined conversion if it exists.
19700 2001-09-24 Miguel de Icaza <miguel@ximian.com>
19702 * assign.cs: track location.
19703 (Resolve): Use implicit conversions on assignment.
19705 * literal.cs: Oops. Not good, Emit of short access values should
19706 pass (Bytes) or the wrong argument will be selected.
19708 * expression.cs (Unary::Emit): Emit code for -expr.
19710 (Unary::ResolveOperator): Handle `Substract' for non-constants
19711 (substract from zero from the non-constants).
19712 Deal with Doubles as well.
19714 (Expression::ConvertImplicitRequired): New routine that reports an
19715 error if no implicit conversion exists.
19717 (Invocation::OverloadResolve): Store the converted implicit
19718 expressions if we make them
19720 2001-09-24 Ravi Pratap <ravi@ximian.com>
19722 * class.cs (ConstructorInitializer): Take a Location argument.
19723 (ConstructorBaseInitializer): Same here.
19724 (ConstructorThisInitializer): Same here.
19726 * cs-parser.jay : Update all calls accordingly.
19728 * expression.cs (Unary, Binary, New): Take location argument.
19729 Update accordingly everywhere.
19731 * cs-parser.jay : Update all calls to the above to take a location
19734 * class.cs : Ditto.
19736 2001-09-24 Ravi Pratap <ravi@ximian.com>
19738 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
19739 (Invocation::BetterConversion): Same here
19740 (Invocation::ConversionExists): Ditto.
19742 (Invocation::ConversionExists): Implement.
19744 2001-09-22 Ravi Pratap <ravi@ximian.com>
19746 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
19747 Also take an additional TypeContainer argument.
19749 * All over : Pass in TypeContainer as argument to OverloadResolve.
19751 * typemanager.cs (CSharpName): Update to check for the string type and return
19754 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
19757 2001-09-21 Ravi Pratap <ravi@ximian.com>
19759 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
19760 (Invocation::BetterFunction): Implement.
19761 (Invocation::BetterConversion): Implement.
19762 (Invocation::ConversionExists): Skeleton, no implementation yet.
19764 Okay, things work fine !
19766 2001-09-21 Miguel de Icaza <miguel@ximian.com>
19768 * typemanager.cs: declare and load enum_type, delegate_type and
19771 * expression.cs (Expression::Emit): Now emit returns a value that
19772 tells whether a value is left on the stack or not. This strategy
19773 might be reveted tomorrow with a mechanism that would address
19774 multiple assignments.
19775 (Expression::report118): Utility routine to report mismatches on
19778 (Unary::Report23): Report impossible type/operator combination
19781 (Unary::IsIncrementableNumber): Whether the type can be
19782 incremented or decremented with add.
19783 (Unary::ResolveOperator): Also allow enumerations to be bitwise
19785 (Unary::ResolveOperator): Implement ++, !, ~,
19787 (Invocation::Emit): Deal with new Emit convetion.
19789 * All Expression derivatives: Updated their Emit method to return
19790 whether they leave values on the stack or not.
19792 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
19793 stack for expressions that are statements.
19795 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19797 * expression.cs (LValue): New interface. Must be implemented by
19799 (LocalVariableReference, ParameterReference, FieldExpr): Implement
19802 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
19803 interface for generating code, simplifies the code.
19805 2001-09-20 Ravi Pratap <ravi@ximian.com>
19807 * expression.cs (everywhere): Comment out return statements in ::Resolve
19808 methods to avoid the warnings.
19810 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19812 * driver.cs (parse): Report error 2001 if we can not open the
19815 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
19818 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
19821 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
19822 otherwise nested blocks end up with the same index.
19824 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
19826 * expression.cs: Instead of having FIXMEs in the Resolve
19827 functions, throw exceptions so it is obvious that we are facing a
19830 * cs-parser.jay (invocation_expression): Pass Location information.
19832 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
19833 Use a basename for those routines because .NET does not like paths
19836 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
19839 2001-09-19 Miguel de Icaza <miguel@ximian.com>
19841 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
19842 are loading the correct data types (throws an exception if not).
19843 (TypeManager::InitCoreTypes): Use CoreLookupType
19845 * expression.cs (Unary::ResolveOperator): return the child
19846 expression for expressions which are just +expr.
19847 (Unary::ResolveOperator): Return negative literals for -LITERAL
19848 expressions (otherwise they are Unary {Literal}).
19849 (Invocation::Badness): Take into account `Implicit constant
19850 expression conversions'.
19852 * literal.cs (LongLiteral): Implement long literal class.
19853 (IntLiteral): export the `Value' of the intliteral.
19855 2001-09-19 Ravi Pratap <ravi@ximian.com>
19857 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
19859 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
19860 instead of 'Operator'
19862 * expression.cs (Binary::ResolveOperator): Update accordingly.
19863 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
19866 * cs-parser.jay (unary_expression): Update to use the new names.
19868 * gen-treedump.cs (GetUnary): Same here.
19870 * expression.cs (Unary::Resolve): Implement.
19871 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
19872 operators are found instead of making noise ;-)
19873 (Unary::ResolveOperator): New method to do precisely the same thing which
19874 Binary::ResolveOperator does for Binary expressions.
19875 (Unary.method, .Arguments): Add.
19876 (Unary::OperName): Implement.
19877 (Unary::ForceConversion): Copy and Paste !
19879 * class.cs (Operator::Define): Fix a small bug for the case when we have
19882 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
19883 for the inbuilt operators. Only overloading works for now ;-)
19885 2001-09-18 Miguel de Icaza <miguel@ximian.com>
19887 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
19888 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
19890 * expression.cs (This::Emit): Implement.
19891 (This::Resolve): Implement.
19892 (TypeOf:Resolve): Implement.
19893 (Expression::ResolveSimpleName): Add an implicit this to instance
19895 (MemberAccess::Resolve): Deal with Parameters and Fields.
19896 Bind instance variable to Field expressions.
19897 (FieldExpr::Instance): New field used to track the expression that
19898 represents the object instance.
19899 (FieldExpr::Resolve): Track potential errors from MemberLookup not
19901 (FieldExpr::Emit): Implement.
19903 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
19904 the last instruction contains a return opcode to avoid generating
19905 the last `ret' instruction (this generates correct code, and it is
19906 nice to pass the peverify output).
19908 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
19909 initializer for static and instance variables.
19910 (Constructor::Emit): Allow initializer to be null in the case of
19911 static constructors. Only emit initializer for instance
19914 (TypeContainer::FindMembers): Return a null array if there are no
19917 Also fix the code for the MemberTypes.Method branch, as it was not
19918 scanning that for operators (or tried to access null variables before).
19920 * assign.cs (Assign::Emit): Handle instance and static fields.
19924 * driver.cs: Stop compilation if there are parse errors.
19926 * cs-parser.jay (constructor_declaration): Provide default base
19927 initializer for non-static constructors.
19928 (constructor_declarator): Do not provide a default base
19929 initializers if none was specified.
19930 Catch the fact that constructors should not have parameters.
19932 * class.cs: Do not emit parent class initializers for static
19933 constructors, that should be flagged as an error.
19935 2001-09-18 Ravi Pratap <ravi@ximian.com>
19937 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
19938 Move back code into TypeContainer::Populate.
19940 2001-09-18 Ravi Pratap <ravi@ximian.com>
19942 * class.cs (TypeContainer::AddConstructor): Fix the check to
19943 compare against Name, not Basename.
19944 (Operator::OpType): Change Plus and Minus to Add and Subtract.
19946 * cs-parser.jay : Update accordingly.
19948 * class.cs (TypeContainer::FindMembers): For the case where we are searching
19949 for methods, don't forget to look into the operators too.
19950 (RegisterMethodBuilder): Helper method to take care of this for
19951 methods, constructors and operators.
19952 (Operator::Define): Completely revamp.
19953 (Operator.OperatorMethod, MethodName): New fields.
19954 (TypeContainer::Populate): Move the registering of builders into
19955 RegisterMethodBuilder.
19956 (Operator::Emit): Re-write.
19958 * expression.cs (Binary::Emit): Comment out code path to emit method
19959 invocation stuff for the case when we have a user defined operator. I am
19960 just not able to get it right !
19962 2001-09-17 Miguel de Icaza <miguel@ximian.com>
19964 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
19967 (Expression::MemberLookup): Provide a version that allows to
19968 specify the MemberTypes and BindingFlags.
19970 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
19971 so it was not fetching variable information from outer blocks.
19973 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
19974 Beforefieldinit as it was buggy.
19976 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
19977 that Ravi put here.
19979 * class.cs (Constructor::Emit): Only emit if block is not null.
19980 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
19981 deal with this by semantically definining it as if the user had
19984 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
19985 constructors as we now "emit" them at a higher level.
19987 (TypeContainer::DefineDefaultConstructor): Used to define the
19988 default constructors if none was provided.
19990 (ConstructorInitializer): Add methods Resolve and Emit.
19992 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
19994 2001-09-17 Ravi Pratap <ravi@ximian.com>
19996 * class.cs (TypeContainer::EmitDefaultConstructor): Register
19997 the default constructor builder with our hashtable for methodbuilders
20000 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20001 and argument_count is 0 in which case we have a match.
20002 (Binary::ResolveOperator): More null checking and miscellaneous coding
20005 2001-09-17 Ravi Pratap <ravi@ximian.com>
20007 * rootcontext.cs (IsNameSpace): Compare against null.
20009 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20011 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20012 and Unary::Operator.
20014 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20017 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20018 we have overloaded operators.
20019 (Binary::ResolveOperator): Implement the part which does the operator overload
20022 * class.cs (Operator::Emit): Implement.
20023 (TypeContainer::Emit): Emit the operators we have too.
20025 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20026 the case when we have a user-defined operator.
20028 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20030 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
20032 2001-09-16 Ravi Pratap <ravi@ximian.com>
20034 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
20035 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
20036 (Constructor::Emit): Implement.
20037 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
20038 if we have no work to do.
20039 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
20042 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
20043 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
20045 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
20048 2001-09-15 Ravi Pratap <ravi@ximian.com>
20050 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
20052 (Tree::RecordNamespace): Method to do what the name says ;-)
20053 (Tree::Namespaces): Property to get at the namespaces hashtable.
20055 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
20058 * rootcontext.cs (IsNamespace): Fixed it :-)
20060 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20062 * class.cs (TypeContainer::FindMembers): Add support for
20064 (MethodCore): New class that encapsulates both the shared aspects
20065 of a Constructor and a Method.
20066 (Method, Constructor): Factored pieces into MethodCore.
20068 * driver.cs: Added --fatal which makes errors throw exceptions.
20069 Load System assembly as well as part of the standard library.
20071 * report.cs: Allow throwing exceptions on errors for debugging.
20073 * modifiers.cs: Do not use `parent', instead use the real type
20074 container to evaluate permission settings.
20076 * class.cs: Put Ravi's patch back in. He is right, and we will
20077 have to cope with the
20079 2001-09-14 Ravi Pratap <ravi@ximian.com>
20081 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
20082 FamORAssem, not FamANDAssem.
20084 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20086 * driver.cs: Added --parse option that only parses its input files
20089 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
20090 incorrect. IsTopLevel is not used to tell whether an object is
20091 root_types or not (that can be achieved by testing this ==
20092 root_types). But to see if this is a top-level *class* (not
20093 necessarly our "toplevel" container).
20095 2001-09-14 Ravi Pratap <ravi@ximian.com>
20097 * enum.cs (Enum::Define): Modify to call the Lookup method on the
20098 parent instead of a direct call to GetType.
20100 2001-09-14 Ravi Pratap <ravi@ximian.com>
20102 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
20103 Modifiers.TypeAttr. This should just be a call to that method.
20105 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
20106 object so that we can determine if we are top-level or not.
20108 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
20111 * enum.cs (Enum::Define): Ditto.
20113 * modifiers.cs (FieldAttr): Re-write.
20115 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
20116 (TypeContainer::HaveStaticConstructor): New property to provide access
20117 to precisely that info.
20119 * modifiers.cs (MethodAttr): Re-write.
20120 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
20122 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
20123 of top-level types as claimed.
20125 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20127 * expression.cs (MemberLookup): Fruitless attempt to lookup
20128 constructors. Maybe I need to emit default constructors? That
20129 might be it (currently .NET emits this for me automatically).
20130 (Invocation::OverloadResolve): Cope with Arguments == null.
20131 (Invocation::EmitArguments): new function, shared by the new
20132 constructor and us.
20133 (Invocation::Emit): Handle static and instance methods. Emit
20134 proper call instruction for virtual or non-virtual invocations.
20135 (New::Emit): Implement.
20136 (New::Resolve): Implement.
20137 (MemberAccess:Resolve): Implement.
20138 (MethodGroupExpr::InstanceExpression): used conforming to the spec
20139 to track instances.
20140 (FieldExpr::Resolve): Set type.
20142 * support.cs: Handle empty arguments.
20144 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20145 SimpleLookup): Auxiliary routines to help parse a qualifier
20148 Update qualifier_identifier rule.
20150 * codegen.cs: Removed debugging messages.
20152 * class.cs: Make this a global thing, this acts just as a "key" to
20153 objects that we might have around.
20155 (Populate): Only initialize method_builders_to_methods once.
20157 * expression.cs (PropertyExpr): Initialize type from the
20160 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20161 Resolve pattern. Attempt to implicitly convert value to boolean.
20164 * expression.cs: Set the type for the int32/int32 argument case.
20165 (Binary::ResolveOperator): Set the return type to boolean for
20166 comparission operators
20168 * typemanager.cs: Remove debugging print code.
20170 (Invocation::Resolve): resolve type.
20172 * class.cs: Allocate a MemberInfo of the correct size, as the code
20173 elsewhere depends on the test to reflect the correct contents.
20175 (Method::) Keep track of parameters, due to System.Reflection holes
20177 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20180 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20181 of the exact size and return that.
20183 (Class::LookupMethodByBuilder): New function that maps
20184 MethodBuilders to its methods. Required to locate the information
20185 on methods because System.Reflection bit us again.
20187 * support.cs: New file, contains an interface ParameterData and
20188 two implementations: ReflectionParameters and InternalParameters
20189 used to access Parameter information. We will need to grow this
20192 * expression.cs (Invocation::GetParameterData): implement a cache
20193 and a wrapper around the ParameterData creation for methods.
20194 (Invocation::OverloadResolve): Use new code.
20196 2001-09-13 Ravi Pratap <ravi@ximian.com>
20198 * class.cs (TypeContainer::EmitField): Remove and move into
20199 (Field::Define): here and modify accordingly.
20200 (Field.FieldBuilder): New member.
20201 (TypeContainer::Populate): Update accordingly.
20202 (TypeContainer::FindMembers): Implement.
20204 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20206 * statement.cs: (VariableInfo::VariableType): New field to be
20207 initialized with the full type once it is resolved.
20209 2001-09-12 Miguel de Icaza <miguel@ximian.com>
20211 * parameter.cs (GetParameterInfo): Use a type cache to compute
20212 things only once, and to reuse this information
20214 * expression.cs (LocalVariableReference::Emit): Implement.
20215 (OpcodeCast::Emit): fix.
20217 (ParameterReference::Resolve): Implement.
20218 (ParameterReference::Emit): Implement.
20220 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
20221 that are expressions need to stay as Expressions.
20223 * typemanager.cs (CSharpName): Returns the C# name of a type if
20226 * expression.cs (Expression::ConvertImplicit): New function that
20227 implements implicit type conversions.
20229 (Expression::ImplicitReferenceConversion): Implements implicit
20230 reference conversions.
20232 (EmptyCast): New type for transparent casts.
20234 (OpcodeCast): New type for casts of types that are performed with
20235 a sequence of bytecodes.
20237 (BoxedCast): New type used for casting value types into reference
20238 types. Emits a box opcode.
20240 (Binary::DoNumericPromotions): Implements numeric promotions of
20241 and computation of the Binary::Type.
20243 (Binary::EmitBranchable): Optimization.
20245 (Binary::Emit): Implement code emission for expressions.
20247 * typemanager.cs (TypeManager): Added two new core types: sbyte
20250 2001-09-12 Ravi Pratap <ravi@ximian.com>
20252 * class.cs (TypeContainer::FindMembers): Method which does exactly
20253 what Type.FindMembers does, only we don't have to use reflection. No
20254 implementation yet.
20256 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
20257 typecontainer objects as we need to get at them.
20258 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
20260 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
20261 typecontainer object.
20263 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
20264 of just a Report object.
20266 2001-09-11 Ravi Pratap <ravi@ximian.com>
20268 * class.cs (Event::Define): Go back to using the prefixes "add_" and
20270 (TypeContainer::Populate): Now define the delegates of the type too.
20271 (TypeContainer.Delegates): Property to access the list of delegates defined
20274 * delegates.cs (Delegate::Define): Implement partially.
20276 * modifiers.cs (TypeAttr): Handle more flags.
20278 2001-09-11 Ravi Pratap <ravi@ximian.com>
20280 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
20282 (Operator::Define): Re-write logic to get types by using the LookupType method
20283 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
20284 (Indexer::Define): Ditto.
20285 (Event::Define): Ditto.
20286 (Property::Define): Ditto.
20288 2001-09-10 Ravi Pratap <ravi@ximian.com>
20290 * class.cs (TypeContainer::Populate): Now define operators too.
20291 (TypeContainer.Operators): New property to access the list of operators
20293 (Operator.OperatorMethodBuilder): New member to hold the method builder
20294 for the operator we are defining.
20295 (Operator::Define): Implement.
20297 2001-09-10 Ravi Pratap <ravi@ximian.com>
20299 * class.cs (Event::Define): Make the prefixes of the accessor methods
20300 addOn_ and removeOn_
20302 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
20303 of the location being passed in too. Ideally, this should go later since all
20304 error reporting should be done through the Report object.
20306 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
20307 (Populate): Iterate thru the indexers we have and define them too.
20308 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
20309 for the get and set accessors.
20310 (Indexer::Define): Implement.
20312 2001-09-09 Miguel de Icaza <miguel@ximian.com>
20314 * expression.cs (Binary::Resolve): Beginning of it. I scratched
20315 my previous implementation, did not work.
20317 * typemanager.cs: Add a couple of missing types (the longs).
20319 * literal.cs: Use TypeManager.bool_type instead of getting it.
20321 * expression.cs (EventExpr): New kind of expressions.
20322 (Expressio::ExprClassFromMemberInfo): finish
20324 2001-09-08 Miguel de Icaza <miguel@ximian.com>
20326 * assign.cs: Emit stores to static fields differently.
20328 2001-09-08 Ravi Pratap <ravi@ximian.com>
20330 * Merge in changes and adjust code to tackle conflicts. Backed out my
20331 code in Assign::Resolve ;-)
20333 2001-09-08 Ravi Pratap <ravi@ximian.com>
20335 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
20336 instead Report.Error and also pass in the location.
20337 (CSharpParser::Lexer): New readonly property to return the reference
20338 to the Tokenizer object.
20339 (declare_local_variables): Use Report.Error with location instead of plain
20343 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
20344 (Operator.CheckBinaryOperator): Ditto.
20346 * cs-parser.jay (operator_declarator): Update accordingly.
20348 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
20349 (CheckBinaryOperator): Same here.
20351 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
20352 on the name without any prefixes of namespace names etc. This is because we
20353 already might have something already fully qualified like
20354 'System.Console.WriteLine'
20356 * assign.cs (Resolve): Begin implementation. Stuck ;-)
20358 2001-09-07 Ravi Pratap <ravi@ximian.com>
20360 * cs-tokenizer.cs (location): Return a string which also contains
20363 * expression.cs (ElementAccess): New class for expressions of the
20364 type 'element access.'
20365 (BaseAccess): New class for expressions of the type 'base access.'
20366 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
20369 * cs-parser.jay (element_access): Implement action.
20370 (base_access): Implement actions.
20371 (checked_expression, unchecked_expression): Implement.
20373 * cs-parser.jay (local_variable_type): Correct and implement.
20374 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
20376 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
20378 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
20379 name and the specifiers.
20381 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
20383 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
20384 making them all public ;-)
20386 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
20389 2001-09-07 Miguel de Icaza <miguel@ximian.com>
20391 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
20393 (FieldExpr, PropertyExprs): New resolved expressions.
20394 (SimpleName::MemberStaticCheck): Perform static checks for access
20395 to non-static fields on static methods. Maybe this should be
20396 generalized for MemberAccesses.
20397 (SimpleName::ResolveSimpleName): More work on simple name
20400 * cs-parser.jay (primary_expression/qualified_identifier): track
20401 the parameter index.
20403 * codegen.cs (CodeGen::Save): Catch save exception, report error.
20404 (EmitContext::EmitBoolExpression): Chain to expression generation
20405 instead of temporary hack.
20406 (::EmitStatementExpression): Put generic expression code generation.
20408 * assign.cs (Assign::Emit): Implement variable assignments to
20409 local variables, parameters and fields.
20411 2001-09-06 Miguel de Icaza <miguel@ximian.com>
20413 * statement.cs (Block::GetVariableInfo): New method, returns the
20414 VariableInfo for a variable name in a block.
20415 (Block::GetVariableType): Implement in terms of GetVariableInfo
20417 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
20418 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
20420 2001-09-06 Ravi Pratap <ravi@ximian.com>
20422 * cs-parser.jay (operator_declaration): Continue on my quest : update
20423 to take attributes argument.
20424 (event_declaration): Ditto.
20425 (enum_declaration): Ditto.
20426 (indexer_declaration): Ditto.
20428 * class.cs (Operator::Operator): Update constructor accordingly.
20429 (Event::Event): Ditto.
20431 * delegate.cs (Delegate::Delegate): Same here.
20433 * enum.cs (Enum::Enum): Same here.
20435 2001-09-05 Ravi Pratap <ravi@ximian.com>
20437 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
20439 * ../tests/cs0658.cs : New file to demonstrate error 0658.
20441 * attribute.cs (Attributes): New class to encapsulate all attributes which were
20442 being passed around as an arraylist.
20443 (Attributes::AddAttribute): Method to add attribute sections.
20445 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
20446 (struct_declaration): Update accordingly.
20447 (constant_declaration): Update.
20448 (field_declaration): Update.
20449 (method_header): Update.
20450 (fixed_parameter): Update.
20451 (parameter_array): Ditto.
20452 (property_declaration): Ditto.
20453 (destructor_declaration): Ditto.
20455 * class.cs (Struct::Struct): Update constructors accordingly.
20456 (Class::Class): Ditto.
20457 (Field::Field): Ditto.
20458 (Method::Method): Ditto.
20459 (Property::Property): Ditto.
20460 (TypeContainer::OptAttribute): update property's return type.
20462 * interface.cs (Interface.opt_attributes): New member.
20463 (Interface::Interface): Update to take the extra Attributes argument.
20465 * parameter.cs (Parameter::Parameter): Ditto.
20467 * constant.cs (Constant::Constant): Ditto.
20469 * interface.cs (InterfaceMemberBase): New OptAttributes field.
20470 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
20471 the attributes as a parameter.
20472 (InterfaceProperty): Update constructor call.
20473 (InterfaceEvent): Ditto.
20474 (InterfaceMethod): Ditto.
20475 (InterfaceIndexer): Ditto.
20477 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
20478 pass the attributes too.
20479 (interface_event_declaration): Ditto.
20480 (interface_property_declaration): Ditto.
20481 (interface_method_declaration): Ditto.
20482 (interface_declaration): Ditto.
20484 2001-09-05 Miguel de Icaza <miguel@ximian.com>
20486 * class.cs (Method::Define): Track the "static Main" definition to
20487 create an entry point.
20489 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
20490 EntryPoint if we find it.
20492 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
20493 (EmitContext::ig): Make this variable public.
20495 * driver.cs: Make the default output file be the first file name
20496 with the .exe extension.
20498 Detect empty compilations
20500 Handle various kinds of output targets. Handle --target and
20501 rename -t to --dumper.
20503 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
20504 methods inherited from Expression return now an Expression. This
20505 will is used during the tree rewriting as we resolve them during
20508 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
20509 the spec. Missing entirely is the information about
20510 accessability of elements of it.
20512 (Expression::ExprClassFromMemberInfo): New constructor for
20513 Expressions that creates a fully initialized Expression based on
20514 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
20517 (Invocation::Resolve): Begin implementing resolution of invocations.
20519 * literal.cs (StringLiteral): Implement Emit.
20521 2001-09-05 Ravi Pratap <ravi@ximian.com>
20523 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
20526 2001-09-04 Ravi Pratap <ravi@ximian.com>
20528 * cs-parser.jay (attribute_arguments): Implement actions.
20529 (attribute): Fix bug in production. Implement action.
20530 (attribute_list): Implement.
20531 (attribute_target): Implement.
20532 (attribute_target_specifier, opt_target_specifier): Implement
20533 (CheckAttributeTarget): New method to check if the attribute target
20535 (attribute_section): Implement.
20536 (opt_attributes): Implement.
20538 * attribute.cs : New file to handle attributes.
20539 (Attribute): Class to hold attribute info.
20541 * cs-parser.jay (opt_attribute_target_specifier): Remove production
20542 (attribute_section): Modify production to use 2 different rules to
20543 achieve the same thing. 1 s/r conflict down !
20544 Clean out commented, useless, non-reducing dimension_separator rules.
20546 * class.cs (TypeContainer.attributes): New member to hold list
20547 of attributes for a type.
20548 (Struct::Struct): Modify to take one more argument, the attribute list.
20549 (Class::Class): Ditto.
20550 (Field::Field): Ditto.
20551 (Method::Method): Ditto.
20552 (Property::Property): Ditto.
20554 * cs-parser.jay (struct_declaration): Update constructor call to
20555 pass in the attributes too.
20556 (class_declaration): Ditto.
20557 (constant_declaration): Ditto.
20558 (field_declaration): Ditto.
20559 (method_header): Ditto.
20560 (fixed_parameter): Ditto.
20561 (parameter_array): Ditto.
20562 (property_declaration): Ditto.
20564 * constant.cs (Constant::Constant): Update constructor similarly.
20565 Use System.Collections.
20567 * parameter.cs (Parameter::Parameter): Update as above.
20569 2001-09-02 Ravi Pratap <ravi@ximian.com>
20571 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
20572 (TypeContainer.delegates): New member to hold list of delegates.
20574 * cs-parser.jay (delegate_declaration): Implement the action correctly
20575 this time as I seem to be on crack ;-)
20577 2001-09-02 Miguel de Icaza <miguel@ximian.com>
20579 * rootcontext.cs (RootContext::IsNamespace): new function, used to
20580 tell whether an identifier represents a namespace.
20582 * expression.cs (NamespaceExpr): A namespace expression, used only
20583 temporarly during expression resolution.
20584 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
20585 utility functions to resolve names on expressions.
20587 2001-09-01 Miguel de Icaza <miguel@ximian.com>
20589 * codegen.cs: Add hook for StatementExpressions.
20591 * class.cs: Fix inverted test for static flag in methods.
20593 2001-09-02 Ravi Pratap <ravi@ximian.com>
20595 * class.cs (Operator::CheckUnaryOperator): Correct error number used
20596 to make it coincide with MS' number.
20597 (Operator::CheckBinaryOperator): Ditto.
20599 * ../errors/errors.txt : Remove error numbers added earlier.
20601 * ../errors/cs1019.cs : Test case for error # 1019
20603 * ../errros/cs1020.cs : Test case for error # 1020
20605 * cs-parser.jay : Clean out commented cruft.
20606 (dimension_separators, dimension_separator): Comment out. Ostensibly not
20607 used anywhere - non-reducing rule.
20608 (namespace_declarations): Non-reducing rule - comment out.
20610 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
20611 with TypeContainer::AddEnum.
20613 * delegate.cs : New file for delegate handling classes.
20614 (Delegate): Class for declaring delegates.
20616 * makefile : Update.
20618 * cs-parser.jay (delegate_declaration): Implement.
20620 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
20622 * class.cs (Event::Define): Implement.
20623 (Event.EventBuilder): New member.
20625 * class.cs (TypeContainer::Populate): Update to define all enums and events
20627 (Events): New property for the events arraylist we hold. Shouldn't we move to using
20628 readonly fields for all these cases ?
20630 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
20632 * class.cs (Property): Revamp to use the convention of making fields readonly.
20633 Accordingly modify code elsewhere.
20635 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
20636 the Define method of the Property class.
20638 * class.cs : Clean up applied patch and update references to variables etc. Fix
20640 (TypeContainer::Populate): Update to define all the properties we have. Also
20641 define all enumerations.
20643 * enum.cs (Define): Implement.
20645 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
20647 * cs-parser.jay (overloadable_operator): The semantic value is an
20648 enum of the Operator class.
20649 (operator_declarator): Implement actions.
20650 (operator_declaration): Implement.
20652 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
20653 validity of definitions.
20654 (Operator::CheckBinaryOperator): Static method to check for binary operators
20655 (TypeContainer::AddOperator): New method to add an operator to a type.
20657 * cs-parser.jay (indexer_declaration): Added line to actually call the
20658 AddIndexer method so it gets added ;-)
20660 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
20661 already taken care of by the MS compiler ?
20663 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
20665 * class.cs (Operator): New class for operator declarations.
20666 (Operator::OpType): Enum for the various operators.
20668 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
20670 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
20671 ostensibly handle this in semantic analysis.
20673 * cs-parser.jay (general_catch_clause): Comment out
20674 (specific_catch_clauses, specific_catch_clause): Ditto.
20675 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
20676 (catch_args, opt_catch_args): New productions.
20677 (catch_clause): Rewrite to use the new productions above
20678 (catch_clauses): Modify accordingly.
20679 (opt_catch_clauses): New production to use in try_statement
20680 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
20681 and re-write the code in the actions to extract the specific and
20682 general catch clauses by being a little smart ;-)
20684 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
20685 Hooray, try and catch statements parse fine !
20687 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20689 * statement.cs (Block::GetVariableType): Fix logic to extract the type
20690 string from the hashtable of variables.
20692 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
20693 I end up making that mistake ;-)
20694 (catch_clauses): Fixed gross error which made Key and Value of the
20695 DictionaryEntry the same : $1 !!
20697 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20699 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
20701 * cs-parser.jay (event_declaration): Correct to remove the semicolon
20702 when the add and remove accessors are specified.
20704 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20706 * cs-parser.jay (IndexerDeclaration): New helper class to hold
20707 information about indexer_declarator.
20708 (indexer_declarator): Implement actions.
20709 (parsing_indexer): New local boolean used to keep track of whether
20710 we are parsing indexers or properties. This is necessary because
20711 implicit_parameters come into picture even for the get accessor in the
20712 case of an indexer.
20713 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
20715 * class.cs (Indexer): New class for indexer declarations.
20716 (TypeContainer::AddIndexer): New method to add an indexer to a type.
20717 (TypeContainer::indexers): New member to hold list of indexers for the
20720 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20722 * cs-parser.jay (add_accessor_declaration): Implement action.
20723 (remove_accessor_declaration): Implement action.
20724 (event_accessors_declaration): Implement
20725 (variable_declarators): swap statements for first rule - trivial.
20727 * class.cs (Event): New class to hold information about event
20729 (TypeContainer::AddEvent): New method to add an event to a type
20730 (TypeContainer::events): New member to hold list of events.
20732 * cs-parser.jay (event_declaration): Implement actions.
20734 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20736 * cs-parser.jay (dim_separators): Implement. Make it a string
20737 concatenating all the commas together, just as they appear.
20738 (opt_dim_separators): Modify accordingly
20739 (rank_specifiers): Update accordingly. Basically do the same
20740 thing - instead, collect the brackets here.
20741 (opt_rank_sepcifiers): Modify accordingly.
20742 (array_type): Modify to actually return the complete type string
20743 instead of ignoring the rank_specifiers.
20744 (expression_list): Implement to collect the expressions
20745 (variable_initializer): Implement. We make it a list of expressions
20746 essentially so that we can handle the array_initializer case neatly too.
20747 (variable_initializer_list): Implement.
20748 (array_initializer): Make it a list of variable_initializers
20749 (opt_array_initializer): Modify accordingly.
20751 * expression.cs (New::NType): Add enumeration to help us
20752 keep track of whether we have an object/delegate creation
20753 or an array creation.
20754 (New:NewType, New::Rank, New::Indices, New::Initializers): New
20755 members to hold data about array creation.
20756 (New:New): Modify to update NewType
20757 (New:New): New Overloaded contructor for the array creation
20760 * cs-parser.jay (array_creation_expression): Implement to call
20761 the overloaded New constructor.
20763 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
20765 * class.cs (TypeContainer::Constructors): Return member
20766 constructors instead of returning null.
20768 2001-08-26 Miguel de Icaza <miguel@ximian.com>
20770 * typemanager.cs (InitCoreTypes): Initialize the various core
20771 types after we have populated the type manager with the user
20772 defined types (this distinction will be important later while
20773 compiling corlib.dll)
20775 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
20776 on Expression Classification. Now all expressions have a method
20777 `Resolve' and a method `Emit'.
20779 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
20780 generation from working. Also add some temporary debugging
20783 2001-08-24 Miguel de Icaza <miguel@ximian.com>
20785 * codegen.cs: Lots of code generation pieces. This is only the
20786 beginning, will continue tomorrow with more touches of polish. We
20787 handle the fundamentals of if, while, do, for, return. Others are
20788 trickier and I need to start working on invocations soon.
20790 * gen-treedump.cs: Bug fix, use s.Increment here instead of
20793 * codegen.cs (EmitContext): New struct, used during code
20794 emission to keep a context. Most of the code generation will be
20797 * cs-parser.jay: Add embedded blocks to the list of statements of
20798 this block. So code generation proceeds in a top down fashion.
20800 2001-08-23 Miguel de Icaza <miguel@ximian.com>
20802 * statement.cs: Add support for multiple child blocks.
20804 2001-08-22 Miguel de Icaza <miguel@ximian.com>
20806 * codegen.cs (EmitCode): New function, will emit the code for a
20807 Block of code given a TypeContainer and its ILGenerator.
20809 * statement.cs (Block): Standard public readonly optimization.
20810 (Block::Block constructors): Link children.
20811 (Block::Child): Child Linker.
20812 (Block::EmitVariables): Emits IL variable declarations.
20814 * class.cs: Drop support for MethodGroups here, delay until
20816 (Method::): Applied the same simplification that I did before, and
20817 move from Properties to public readonly fields.
20818 (Method::ParameterTypes): Returns the parameter types for the
20819 function, and implements a cache that will be useful later when I
20820 do error checking and the semantic analysis on the methods is
20822 (Constructor::GetCallingConvention): Renamed from CallingConvetion
20823 and made a method, optional argument tells whether this is a class
20824 or a structure to apply the `has-this' bit.
20825 (Method::GetCallingConvention): Implement, returns the calling
20827 (Method::Define): Defines the type, a second pass is performed
20828 later to populate the methods.
20830 (Constructor::ParameterTypes): implement a cache similar to the
20831 one on Method::ParameterTypes, useful later when we do semantic
20834 (TypeContainer::EmitMethod): New method. Emits methods.
20836 * expression.cs: Removed MethodGroup class from here.
20838 * parameter.cs (Parameters::GetCallingConvention): new method.
20840 2001-08-21 Miguel de Icaza <miguel@ximian.com>
20842 * class.cs (TypeContainer::Populate): Drop RootContext from the
20845 (Constructor::CallingConvention): Returns the calling convention.
20846 (Constructor::ParameterTypes): Returns the constructor parameter
20849 (TypeContainer::AddConstructor): Keep track of default constructor
20850 and the default static constructor.
20852 (Constructor::) Another class that starts using `public readonly'
20853 instead of properties.
20855 (Constructor::IsDefault): Whether this is a default constructor.
20857 (Field::) use readonly public fields instead of properties also.
20859 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
20860 track of static constructors; If none is used, turn on
20861 BeforeFieldInit in the TypeAttributes.
20863 * cs-parser.jay (opt_argument_list): now the return can be null
20864 for the cases where there are no arguments.
20866 (constructor_declarator): If there is no implicit `base' or
20867 `this', then invoke the default parent constructor.
20869 * modifiers.cs (MethodAttr): New static function maps a set of
20870 modifiers flags into a MethodAttributes enum
20871 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
20872 MethodAttr, TypeAttr to represent the various mappings where the
20873 modifiers are used.
20874 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
20876 2001-08-19 Miguel de Icaza <miguel@ximian.com>
20878 * parameter.cs (GetParameterInfo): Fix bug where there would be no
20881 * interface.cs (PopulateIndexer): Implemented the code generator
20882 for interface indexers.
20884 2001-08-17 Miguel de Icaza <miguel@ximian.com>
20886 * interface.cs (InterfaceMemberBase): Now we track the new status
20889 (PopulateProperty): Implement property population. Woohoo! Got
20890 Methods and Properties going today.
20892 Removed all the properties for interfaces, and replaced them with
20893 `public readonly' fields.
20895 2001-08-16 Miguel de Icaza <miguel@ximian.com>
20897 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
20898 initialize their hashtables/arraylists only when they are needed
20899 instead of doing this always.
20901 * parameter.cs: Handle refs and out parameters.
20903 * cs-parser.jay: Use an ArrayList to construct the arguments
20904 instead of the ParameterCollection, and then cast that to a
20907 * parameter.cs: Drop the use of ParameterCollection and use
20908 instead arrays of Parameters.
20910 (GetParameterInfo): Use the Type, not the Name when resolving
20913 2001-08-13 Miguel de Icaza <miguel@ximian.com>
20915 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
20916 and instead use public readonly fields.
20918 * class.cs: Put back walking code for type containers.
20920 2001-08-11 Miguel de Icaza <miguel@ximian.com>
20922 * class.cs (MakeConstant): Code to define constants.
20924 * rootcontext.cs (LookupType): New function. Used to locate types
20927 2001-08-08 Miguel de Icaza <miguel@ximian.com>
20929 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
20930 this System.Reflection code is. Kudos to Microsoft
20932 * typemanager.cs: Implement a type cache and avoid loading all
20933 types at boot time. Wrap in LookupType the internals. This made
20934 the compiler so much faster. Wow. I rule!
20936 * driver.cs: Make sure we always load mscorlib first (for
20937 debugging purposes, nothing really important).
20939 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
20940 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
20942 * rootcontext.cs: Lookup types on their namespace; Lookup types
20943 on namespaces that have been imported using the `using' keyword.
20945 * class.cs (TypeContainer::TypeAttr): Virtualize.
20946 (Class::TypeAttr): Return attributes suitable for this bad boy.
20947 (Struct::TypeAttr): ditto.
20948 Handle nested classes.
20949 (TypeContainer::) Remove all the type visiting code, it is now
20950 replaced with the rootcontext.cs code
20952 * rootcontext.cs (GetClassBases): Added support for structs.
20954 2001-08-06 Miguel de Icaza <miguel@ximian.com>
20956 * interface.cs, statement.cs, class.cs, parameter.cs,
20957 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
20958 Drop use of TypeRefs, and use strings instead.
20960 2001-08-04 Miguel de Icaza <miguel@ximian.com>
20964 * class.cs (Struct::Struct): set the SEALED flags after
20965 checking the modifiers.
20966 (TypeContainer::TypeAttr): new property, returns the
20967 TypeAttributes for a class.
20969 * cs-parser.jay (type_list): Oops, list production was creating a
20970 new list of base types.
20972 * rootcontext.cs (StdLib): New property.
20973 (GetInterfaceTypeByName): returns an interface by type name, and
20974 encapsulates error handling here.
20975 (GetInterfaces): simplified.
20976 (ResolveTree): Encapsulated all the tree resolution here.
20977 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
20980 * driver.cs: Add support for --nostdlib, to avoid loading the
20981 default assemblies.
20982 (Main): Do not put tree resolution here.
20984 * rootcontext.cs: Beginning of the class resolution.
20986 2001-08-03 Miguel de Icaza <miguel@ximian.com>
20988 * rootcontext.cs: Provide better error reporting.
20990 * cs-parser.jay (interface_base): set our $$ to be interfaces.
20992 * rootcontext.cs (CreateInterface): Handle the case where there
20993 are no parent interfaces.
20995 (CloseTypes): Routine to flush types at the end.
20996 (CreateInterface): Track types.
20997 (GetInterfaces): Returns an array of Types from the list of
20998 defined interfaces.
21000 * typemanager.c (AddUserType): Mechanism to track user types (puts
21001 the type on the global type hash, and allows us to close it at the
21004 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21006 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21007 RecordInterface instead.
21009 * cs-parser.jay: Updated to reflect changes above.
21011 * decl.cs (Definition): Keep track of the TypeBuilder type that
21012 represents this type here. Not sure we will use it in the long
21013 run, but wont hurt for now.
21015 * driver.cs: Smaller changes to accomodate the new code.
21017 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21020 * rootcontext.cs (CreateInterface): New method, used to create
21021 the System.TypeBuilder type for interfaces.
21022 (ResolveInterfaces): new entry point to resolve the interface
21024 (CodeGen): Property, used to keep track of the code generator.
21026 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21028 * cs-parser.jay: Add a second production for delegate_declaration
21031 (enum_body): Put an opt_comma here instead of putting it on
21032 enum_body or enum_member_declarations so we can handle trailing
21033 commas on enumeration members. Gets rid of a shift/reduce.
21035 (type_list): Need a COMMA in the middle.
21037 (indexer_declaration): Tell tokenizer to recognize get/set
21039 * Remove old targets.
21041 * Re-add the parser target.
21043 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21045 * cs-parser.jay: Add precendence rules for a number of operators
21046 ot reduce the number of shift/reduce conflicts in the grammar.
21048 2001-07-17 Miguel de Icaza <miguel@ximian.com>
21050 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
21053 Get rid of old crufty code.
21055 * rootcontext.cs: Use this to keep track of the parsed
21056 representation and the defined types available to the program.
21058 * gen-treedump.cs: adjust for new convention.
21060 * type.cs: Split out the type manager, and the assembly builder
21063 * typemanager.cs: the type manager will live here now.
21065 * cil-codegen.cs: And the code generator here.
21067 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
21069 * makefile: Fixed up for easy making.
21071 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21073 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
21076 (unary_expression): Expand pre_increment_expression and
21077 post_decrement_expression to reduce a shift/reduce.
21079 2001-07-11 Simon Cozens
21081 * cs-tokenizer.cs: Hex numbers should begin with a 0.
21083 Improve allow_keyword_as_indent name.
21085 2001-06-19 Miguel de Icaza <miguel@ximian.com>
21087 * Adjustments for Beta2.
21089 2001-06-13 Miguel de Icaza <miguel@ximian.com>
21091 * decl.cs: Added `Define' abstract method.
21092 (InTransit): new property, used to catch recursive definitions.
21094 * interface.cs: Implement `Define'.
21096 * modifiers.cs: Map Modifiers.constants to
21097 System.Reflection.TypeAttribute flags.
21099 * class.cs: Keep track of types and user-defined types.
21100 (BuilderInit): New method for creating an assembly
21101 (ResolveType): New function to launch the resolution process, only
21102 used by interfaces for now.
21104 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
21105 that are inserted into the name space.
21107 2001-06-08 Miguel de Icaza <miguel@ximian.com>
21109 * ARGH. I have screwed up my tree so many times due to the use of
21110 rsync rather than using CVS. Going to fix this at once.
21112 * driver.cs: Objetify driver. Load assemblies, use assemblies to
21115 2001-06-07 Miguel de Icaza <miguel@ximian.com>
21117 * Experiment successful: Use System.Type rather that our own
21120 2001-05-25 Miguel de Icaza <miguel@ximian.com>
21122 * cs-parser.jay: Removed nsAliases from here.
21124 Use new namespaces, handle `using XXX;'
21126 * namespace.cs: Reimplemented namespace handling, use a recursive
21127 definition of the class. Now we can keep track of using clauses
21128 and catch invalid using clauses.
21130 2001-05-24 Miguel de Icaza <miguel@ximian.com>
21132 * gen-treedump.cs: Adapted for all the renaming.
21134 * expression.cs (Expression): this class now has a Type property
21135 which returns an expression Type.
21137 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
21138 `Type', as this has a different meaning now in the base
21140 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21142 * interface.cs, class.cs: Removed from all the sources the
21143 references to signature computation, as we can not do method
21144 signature computation during the parsing time, as we are not
21145 trying to solve at that point distinguishing:
21149 void a (NS.Blah x) {}
21152 Which depending on the context might be valid or not, as we do not
21153 know if Blah is the same thing as NS.Blah at that point.
21155 * Redid everything so the code uses TypeRefs now instead of
21156 Types. TypeRefs are just temporary type placeholders, that need
21157 to be resolved. They initially have a pointer to a string and the
21158 current scope in which they are used. This is used later by the
21159 compiler to resolve the reference to an actual Type.
21161 * DeclSpace is no longer a CIR.Type, and neither are
21162 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21163 are all DeclSpaces, but no Types.
21165 * type.cs (TypeRefManager): This implements the TypeRef manager,
21166 which keeps track of all the types that need to be resolved after
21167 the parsing has finished.
21169 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21171 * ARGH. We are going to have to store `foreach' as a class rather
21172 than resolving it, as we need to verify error 1579 after name
21173 resolution. *OR* we could keep a flag that says `This request to
21174 IEnumerator comes from a foreach statement' which we can then use
21175 to generate the error.
21177 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21179 * class.cs (TypeContainer.AddMethod): we now add methods to the
21180 MethodGroup instead of the method hashtable.
21182 * expression.cs: Add MethodGroup abstraction, which gets us one
21183 step closer to the specification in the way we handle method
21186 * cs-parser.jay (primary_expression): qualified_identifier now
21187 tried to match up an identifier to a local variable reference or
21188 to a parameter reference.
21190 current_local_parameters is now a parser global variable that
21191 points to the current parameters for the block, used during name
21194 (property_declaration): Now creates an implicit `value' argument to
21197 2001-05-09 Miguel de Icaza <miguel@ximian.com>
21199 * parameter.cs: Do not use `param' arguments as part of the
21200 signature, per the spec.
21202 2001-05-08 Miguel de Icaza <miguel@ximian.com>
21204 * decl.cs: Base class for classes, structs and interfaces. This
21205 is the "Declaration Space"
21207 * cs-parser.jay: Use CheckDef for checking declaration errors
21208 instead of having one on each function.
21210 * class.cs: Factor out some code for handling error handling in
21211 accordance to the "Declarations" section in the "Basic Concepts"
21212 chapter in the ECMA C# spec.
21214 * interface.cs: Make all interface member classes derive from
21215 InterfaceMemberBase.
21217 2001-05-07 Miguel de Icaza <miguel@ximian.com>
21219 * Many things: all interfaces are parsed and generated in
21220 gen-treedump. Support for member variables, constructors,
21221 destructors, properties, constants is there.
21223 Beginning of the IL backend, but very little done, just there for
21226 2001-04-29 Miguel de Icaza <miguel@ximian.com>
21228 * cs-parser.jay: Fix labeled statement.
21230 * cs-tokenizer.cs (escape): Escape " and ' always.
21231 ref_line, ref_name: keep track of the line/filename as instructed
21232 by #line by the compiler.
21235 2001-04-27 Miguel de Icaza <miguel@ximian.com>
21237 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
21238 to match the values in System.CodeDOM.
21240 Divid renamed to Divide.
21242 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
21244 (Statements.set): remove.
21246 * System.CodeDOM/CodeCatchClause.cs: always have a valid
21249 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
21250 falseStatements always have valid values.
21252 * cs-parser.jay: Use System.CodeDOM now.